diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f01fbe90..bf51221a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,52 +351,52 @@ set(DUCKDB_SRC_FILES src/duckdb/third_party/zstd/dict/divsufsort.cpp src/duckdb/third_party/zstd/dict/fastcover.cpp src/duckdb/third_party/zstd/dict/zdict.cpp - src/duckdb/extension/core_functions/lambda_functions.cpp - src/duckdb/extension/core_functions/function_list.cpp src/duckdb/extension/core_functions/core_functions_extension.cpp - src/duckdb/ub_extension_core_functions_aggregate_distributive.cpp + src/duckdb/extension/core_functions/function_list.cpp + src/duckdb/extension/core_functions/lambda_functions.cpp src/duckdb/ub_extension_core_functions_aggregate_nested.cpp - src/duckdb/ub_extension_core_functions_aggregate_regression.cpp + src/duckdb/ub_extension_core_functions_aggregate_distributive.cpp src/duckdb/ub_extension_core_functions_aggregate_algebraic.cpp + src/duckdb/ub_extension_core_functions_aggregate_regression.cpp src/duckdb/ub_extension_core_functions_aggregate_holistic.cpp - src/duckdb/ub_extension_core_functions_scalar_string.cpp + src/duckdb/ub_extension_core_functions_scalar_generic.cpp src/duckdb/extension/core_functions/scalar/bit/bitstring.cpp - src/duckdb/extension/core_functions/scalar/operators/bitwise.cpp - src/duckdb/extension/core_functions/scalar/enum/enum_functions.cpp + src/duckdb/ub_extension_core_functions_scalar_string.cpp + src/duckdb/ub_extension_core_functions_scalar_debug.cpp src/duckdb/ub_extension_core_functions_scalar_map.cpp - src/duckdb/ub_extension_core_functions_scalar_random.cpp - src/duckdb/extension/core_functions/scalar/math/numeric.cpp - src/duckdb/ub_extension_core_functions_scalar_union.cpp - src/duckdb/ub_extension_core_functions_scalar_generic.cpp src/duckdb/ub_extension_core_functions_scalar_struct.cpp - src/duckdb/ub_extension_core_functions_scalar_list.cpp + src/duckdb/extension/core_functions/scalar/operators/bitwise.cpp + src/duckdb/ub_extension_core_functions_scalar_union.cpp src/duckdb/ub_extension_core_functions_scalar_array.cpp - src/duckdb/ub_extension_core_functions_scalar_debug.cpp src/duckdb/ub_extension_core_functions_scalar_blob.cpp + src/duckdb/extension/core_functions/scalar/enum/enum_functions.cpp + src/duckdb/ub_extension_core_functions_scalar_random.cpp src/duckdb/ub_extension_core_functions_scalar_date.cpp + src/duckdb/ub_extension_core_functions_scalar_list.cpp + src/duckdb/extension/core_functions/scalar/math/numeric.cpp + src/duckdb/extension/parquet/parquet_file_metadata_cache.cpp + src/duckdb/extension/parquet/parquet_field_id.cpp src/duckdb/extension/parquet/parquet_writer.cpp - src/duckdb/extension/parquet/zstd_file_system.cpp + src/duckdb/extension/parquet/parquet_column_schema.cpp + src/duckdb/extension/parquet/parquet_multi_file_info.cpp + src/duckdb/extension/parquet/parquet_metadata.cpp src/duckdb/extension/parquet/parquet_crypto.cpp - src/duckdb/extension/parquet/parquet_reader.cpp src/duckdb/extension/parquet/parquet_timestamp.cpp - src/duckdb/extension/parquet/parquet_float16.cpp - src/duckdb/extension/parquet/parquet_statistics.cpp - src/duckdb/extension/parquet/parquet_shredding.cpp - src/duckdb/extension/parquet/parquet_geometry.cpp - src/duckdb/extension/parquet/parquet_multi_file_info.cpp - src/duckdb/extension/parquet/column_reader.cpp - src/duckdb/extension/parquet/parquet_field_id.cpp src/duckdb/extension/parquet/parquet_extension.cpp - src/duckdb/extension/parquet/parquet_column_schema.cpp src/duckdb/extension/parquet/column_writer.cpp - src/duckdb/extension/parquet/parquet_file_metadata_cache.cpp src/duckdb/extension/parquet/serialize_parquet.cpp - src/duckdb/extension/parquet/parquet_metadata.cpp + src/duckdb/extension/parquet/parquet_reader.cpp + src/duckdb/extension/parquet/column_reader.cpp + src/duckdb/extension/parquet/parquet_float16.cpp + src/duckdb/extension/parquet/zstd_file_system.cpp + src/duckdb/extension/parquet/parquet_shredding.cpp + src/duckdb/extension/parquet/parquet_geometry.cpp + src/duckdb/extension/parquet/parquet_statistics.cpp + src/duckdb/ub_extension_parquet_writer.cpp + src/duckdb/ub_extension_parquet_writer_variant.cpp src/duckdb/ub_extension_parquet_decoder.cpp src/duckdb/ub_extension_parquet_reader.cpp src/duckdb/ub_extension_parquet_reader_variant.cpp - src/duckdb/ub_extension_parquet_writer.cpp - src/duckdb/ub_extension_parquet_writer_variant.cpp src/duckdb/third_party/parquet/parquet_types.cpp src/duckdb/third_party/thrift/thrift/protocol/TProtocol.cpp src/duckdb/third_party/thrift/thrift/transport/TTransportException.cpp @@ -436,31 +436,355 @@ set(DUCKDB_SRC_FILES src/duckdb/third_party/brotli/enc/static_dict.cpp src/duckdb/third_party/brotli/enc/utf8_util.cpp src/duckdb/extension/icu/./icu_extension.cpp + src/duckdb/extension/icu/./icu-table-range.cpp + src/duckdb/extension/icu/./icu-list-range.cpp src/duckdb/extension/icu/./icu-strptime.cpp - src/duckdb/extension/icu/./icu-datepart.cpp - src/duckdb/extension/icu/./icu-makedate.cpp - src/duckdb/extension/icu/./icu-datefunc.cpp + src/duckdb/extension/icu/./icu-datetrunc.cpp src/duckdb/extension/icu/./icu-current.cpp src/duckdb/extension/icu/./icu-timezone.cpp - src/duckdb/extension/icu/./icu-table-range.cpp - src/duckdb/extension/icu/./icu-dateadd.cpp - src/duckdb/extension/icu/./icu-timebucket.cpp src/duckdb/extension/icu/./icu-datesub.cpp - src/duckdb/extension/icu/./icu-datetrunc.cpp - src/duckdb/extension/icu/./icu-list-range.cpp - src/duckdb/ub_extension_icu_third_party_icu_common.cpp - src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp + src/duckdb/extension/icu/./icu-timebucket.cpp + src/duckdb/extension/icu/./icu-makedate.cpp + src/duckdb/extension/icu/./icu-dateadd.cpp + src/duckdb/extension/icu/./icu-datepart.cpp + src/duckdb/extension/icu/./icu-datefunc.cpp + src/duckdb/extension/icu/third_party/icu/common/propsvec.cpp + src/duckdb/extension/icu/third_party/icu/common/unormcmp.cpp + src/duckdb/extension/icu/third_party/icu/common/uloc.cpp + src/duckdb/extension/icu/third_party/icu/common/pluralmap.cpp + src/duckdb/extension/icu/third_party/icu/common/filterednormalizer2.cpp + src/duckdb/extension/icu/third_party/icu/common/uprops.cpp + src/duckdb/extension/icu/third_party/icu/common/uinit.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestrieiterator.cpp + src/duckdb/extension/icu/third_party/icu/common/cstr.cpp + src/duckdb/extension/icu/third_party/icu/common/normalizer2.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidiln.cpp + src/duckdb/extension/icu/third_party/icu/common/parsepos.cpp + src/duckdb/extension/icu/third_party/icu/common/uenum.cpp + src/duckdb/extension/icu/third_party/icu/common/uniset.cpp + src/duckdb/extension/icu/third_party/icu/common/emojiprops.cpp + src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp + src/duckdb/extension/icu/third_party/icu/common/errorcode.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie_swap.cpp + src/duckdb/extension/icu/third_party/icu/common/schriter.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie2.cpp + src/duckdb/extension/icu/third_party/icu/common/ustr_wcs.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr_props.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie.cpp + src/duckdb/extension/icu/third_party/icu/common/uiter.cpp + src/duckdb/extension/icu/third_party/icu/common/localematcher.cpp + src/duckdb/extension/icu/third_party/icu/common/icudataver.cpp + src/duckdb/extension/icu/third_party/icu/common/uhash_us.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestream.cpp + src/duckdb/extension/icu/third_party/icu/common/loclikely.cpp + src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp + src/duckdb/extension/icu/third_party/icu/common/lsr.cpp + src/duckdb/extension/icu/third_party/icu/common/uvector.cpp + src/duckdb/extension/icu/third_party/icu/common/uscript.cpp + src/duckdb/extension/icu/third_party/icu/common/uset_props.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrcase.cpp + src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp + src/duckdb/extension/icu/third_party/icu/common/ustack.cpp + src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.cpp + src/duckdb/extension/icu/third_party/icu/common/uniset_props.cpp + src/duckdb/extension/icu/third_party/icu/common/normalizer2impl.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr.cpp + src/duckdb/extension/icu/third_party/icu/common/locdspnm.cpp + src/duckdb/extension/icu/third_party/icu/common/ruleiter.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrfmt.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie2_builder.cpp + src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/cstring.cpp + src/duckdb/extension/icu/third_party/icu/common/locdistance.cpp + src/duckdb/extension/icu/third_party/icu/common/usc_impl.cpp + src/duckdb/extension/icu/third_party/icu/common/ulist.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/ushape.cpp + src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.cpp + src/duckdb/extension/icu/third_party/icu/common/ucmndata.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidiwrt.cpp + src/duckdb/extension/icu/third_party/icu/common/propname.cpp + src/duckdb/extension/icu/third_party/icu/common/usetiter.cpp + src/duckdb/extension/icu/third_party/icu/common/umapfile.cpp + src/duckdb/extension/icu/third_party/icu/common/ucol_swp.cpp + src/duckdb/extension/icu/third_party/icu/common/ucptrie.cpp + src/duckdb/extension/icu/third_party/icu/common/ucasemap.cpp + src/duckdb/extension/icu/third_party/icu/common/locbased.cpp + src/duckdb/extension/icu/third_party/icu/common/unisetspan.cpp + src/duckdb/extension/icu/third_party/icu/common/util_props.cpp + src/duckdb/extension/icu/third_party/icu/common/caniter.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidi.cpp + src/duckdb/extension/icu/third_party/icu/common/loadednormalizer2impl.cpp + src/duckdb/extension/icu/third_party/icu/common/uloc_tag.cpp + src/duckdb/extension/icu/third_party/icu/common/umath.cpp + src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.cpp + src/duckdb/extension/icu/third_party/icu/common/locavailable.cpp + src/duckdb/extension/icu/third_party/icu/common/locmap.cpp + src/duckdb/extension/icu/third_party/icu/common/ures_cnv.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr_case.cpp + src/duckdb/extension/icu/third_party/icu/common/locdispnames.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestrie.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidi_props.cpp + src/duckdb/extension/icu/third_party/icu/common/uloc_keytype.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrcase_locale.cpp + src/duckdb/extension/icu/third_party/icu/common/chariter.cpp + src/duckdb/extension/icu/third_party/icu/common/localebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/utf_impl.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr_case_locale.cpp + src/duckdb/extension/icu/third_party/icu/common/stringpiece.cpp + src/duckdb/extension/icu/third_party/icu/common/locresdata.cpp + src/duckdb/extension/icu/third_party/icu/common/ucat.cpp + src/duckdb/extension/icu/third_party/icu/common/utext.cpp + src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrtrns.cpp + src/duckdb/extension/icu/third_party/icu/common/resbund_cnv.cpp + src/duckdb/extension/icu/third_party/icu/common/unorm.cpp + src/duckdb/extension/icu/third_party/icu/common/ucharstrieiterator.cpp + src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp + src/duckdb/extension/icu/third_party/icu/common/uarrsort.cpp + src/duckdb/extension/icu/third_party/icu/common/umutex.cpp + src/duckdb/extension/icu/third_party/icu/common/uobject.cpp + src/duckdb/extension/icu/third_party/icu/common/dtintrv.cpp + src/duckdb/extension/icu/third_party/icu/common/utypes.cpp + src/duckdb/extension/icu/third_party/icu/common/uhash.cpp + src/duckdb/extension/icu/third_party/icu/common/resbund.cpp + src/duckdb/extension/icu/third_party/icu/common/unifunct.cpp + src/duckdb/extension/icu/third_party/icu/common/uresdata.cpp + src/duckdb/extension/icu/third_party/icu/common/uniset_closure.cpp + src/duckdb/extension/icu/third_party/icu/common/resource.cpp + src/duckdb/extension/icu/third_party/icu/common/ustring.cpp + src/duckdb/extension/icu/third_party/icu/common/charstr.cpp + src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.cpp + src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp + src/duckdb/extension/icu/third_party/icu/common/umutablecptrie.cpp + src/duckdb/extension/icu/third_party/icu/common/udata.cpp + src/duckdb/extension/icu/third_party/icu/common/utrace.cpp + src/duckdb/extension/icu/third_party/icu/common/uset.cpp + src/duckdb/extension/icu/third_party/icu/common/unifilt.cpp + src/duckdb/extension/icu/third_party/icu/common/udatamem.cpp + src/duckdb/extension/icu/third_party/icu/common/putil.cpp + src/duckdb/extension/icu/third_party/icu/common/unames.cpp + src/duckdb/extension/icu/third_party/icu/common/patternprops.cpp + src/duckdb/extension/icu/third_party/icu/common/bmpset.cpp + src/duckdb/extension/icu/third_party/icu/common/sharedobject.cpp + src/duckdb/extension/icu/third_party/icu/common/unifiedcache.cpp + src/duckdb/extension/icu/third_party/icu/common/uscript_props.cpp + src/duckdb/extension/icu/third_party/icu/common/ucase.cpp + src/duckdb/extension/icu/third_party/icu/common/characterproperties.cpp + src/duckdb/extension/icu/third_party/icu/common/edits.cpp + src/duckdb/extension/icu/third_party/icu/common/uchar.cpp + src/duckdb/extension/icu/third_party/icu/common/appendable.cpp + src/duckdb/extension/icu/third_party/icu/common/ubiditransform.cpp + src/duckdb/extension/icu/third_party/icu/common/simpleformatter.cpp + src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.cpp + src/duckdb/extension/icu/third_party/icu/common/wintz.cpp + src/duckdb/extension/icu/third_party/icu/common/udataswp.cpp + src/duckdb/extension/icu/third_party/icu/common/util.cpp + src/duckdb/extension/icu/third_party/icu/common/cmemory.cpp + src/duckdb/extension/icu/third_party/icu/common/locid.cpp + src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp + src/duckdb/extension/icu/third_party/icu/common/uinvchar.cpp + src/duckdb/extension/icu/third_party/icu/common/ucharstrie.cpp + src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationrootelements.cpp + src/duckdb/extension/icu/third_party/icu/i18n/persncal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formattedval_sbimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/zrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.cpp + src/duckdb/extension/icu/third_party/icu/i18n/selfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/units_complexconverter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_compact.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tzrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/smpdtfst.cpp + src/duckdb/extension/icu/third_party/icu/i18n/unumsys.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_symbolswrapper.cpp + src/duckdb/extension/icu/third_party/icu/i18n/indiancal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucln_in.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_scientific.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp + src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/islamcal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/gender.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ulocdata.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collation.cpp + src/duckdb/extension/icu/third_party/icu/i18n/displayoptions.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationsets.cpp + src/duckdb/extension/icu/third_party/icu/i18n/vzone.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ulistformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/units_data.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measunit_extra.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.cpp + src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_rounding.cpp + src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp + src/duckdb/extension/icu/third_party/icu/i18n/utf8collationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formattedvalue.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp + src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/upluralrules.cpp + src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_simple.cpp + src/duckdb/extension/icu/third_party/icu/i18n/gregocal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/smpdtfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/compactdecimalformat.cpp + src/duckdb/extension/icu/third_party/icu/i18n/japancal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/units_converter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.cpp + src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_symbols.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucol.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.cpp + src/duckdb/extension/icu/third_party/icu/i18n/astro.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatinbuilder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_utils.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationweights.cpp + src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tznames_impl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.cpp + src/duckdb/extension/icu/third_party/icu/i18n/windtfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/zonemeta.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tztrans.cpp + src/duckdb/extension/icu/third_party/icu/i18n/taiwncal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_parsednumber.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucoleitr.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_fluent.cpp + src/duckdb/extension/icu/third_party/icu/i18n/unum.cpp + src/duckdb/extension/icu/third_party/icu/i18n/curramt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/decContext.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_affixutils.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp + src/duckdb/extension/icu/third_party/icu/i18n/uregion.cpp + src/duckdb/extension/icu/third_party/icu/i18n/uitercollationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.cpp + src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp + src/duckdb/extension/icu/third_party/icu/i18n/erarules.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_capi.cpp + src/duckdb/extension/icu/third_party/icu/i18n/timezone.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tznames.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.cpp + src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp + src/duckdb/extension/icu/third_party/icu/i18n/standardplural.cpp + src/duckdb/extension/icu/third_party/icu/i18n/units_router.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.cpp + src/duckdb/extension/icu/third_party/icu/i18n/utf16collationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/format.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formattedval_iterimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp + src/duckdb/extension/icu/third_party/icu/i18n/decNumber.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationroot.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tmunit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/scientificnumberformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_padding.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucol_res.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numrange_fluent.cpp + src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numrange_capi.cpp + src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/utmscale.cpp + src/duckdb/extension/icu/third_party/icu/i18n/umsg.cpp + src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ztrans.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_notation.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationcompare.cpp + src/duckdb/extension/icu/third_party/icu/i18n/sortkey.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.cpp + src/duckdb/extension/icu/third_party/icu/i18n/currfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/region.cpp + src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp + src/duckdb/extension/icu/third_party/icu/i18n/simpletz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/winnmfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ufieldpositer.cpp + src/duckdb/extension/icu/third_party/icu/i18n/vtzone.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_grouping.cpp + src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tzfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.cpp + src/duckdb/extension/icu/third_party/icu/i18n/cecal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.cpp + src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_output.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucol_sit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/udatpg.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tmutamt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tmutfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.cpp + src/duckdb/extension/icu/third_party/icu/i18n/string_segment.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_integerwidth.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_impl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/bocsu.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp + src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp + src/duckdb/extension/icu/third_party/icu/i18n/coptccal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/wintzimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/currunit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/basictz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numsys.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.cpp + src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp + src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp + src/duckdb/extension/icu/third_party/icu/i18n/udat.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/udateintervalformat.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdata.cpp + src/duckdb/extension/icu/third_party/icu/i18n/pluralranges.cpp src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp - src/duckdb/extension/json/json_reader.cpp - src/duckdb/extension/json/json_functions.cpp - src/duckdb/extension/json/json_extension.cpp + src/duckdb/extension/json/serialize_json.cpp src/duckdb/extension/json/json_scan.cpp + src/duckdb/extension/json/json_reader.cpp src/duckdb/extension/json/json_multi_file_info.cpp - src/duckdb/extension/json/json_enums.cpp - src/duckdb/extension/json/serialize_json.cpp src/duckdb/extension/json/json_common.cpp - src/duckdb/extension/json/json_deserializer.cpp + src/duckdb/extension/json/json_enums.cpp src/duckdb/extension/json/json_serializer.cpp + src/duckdb/extension/json/json_extension.cpp + src/duckdb/extension/json/json_functions.cpp + src/duckdb/extension/json/json_deserializer.cpp src/duckdb/ub_extension_json_json_functions.cpp src/duckdb/generated_extension_loader_package_build.cpp) diff --git a/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp b/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp index 6e55010e2..15d562f85 100644 --- a/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp +++ b/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp @@ -239,27 +239,47 @@ struct TimeTZAverageOperation : public BaseSumOperation children; + children.emplace_back("count", LogicalType::UBIGINT); + children.emplace_back("value", function.arguments[0]); + return LogicalType::STRUCT(std::move(children)); +} + +LogicalType GetKahanAvgStateType(const AggregateFunction &function) { + child_list_t children; + children.emplace_back("count", LogicalType::UBIGINT); + children.emplace_back("value", LogicalType::DOUBLE); + children.emplace_back("err", LogicalType::DOUBLE); + return LogicalType::STRUCT(std::move(children)); +} + AggregateFunction GetAverageAggregate(PhysicalType type) { switch (type) { case PhysicalType::INT16: { return AggregateFunction::UnaryAggregate, int16_t, double, IntegerAverageOperation>( - LogicalType::SMALLINT, LogicalType::DOUBLE); + LogicalType::SMALLINT, LogicalType::DOUBLE) + .SetStructStateExport(GetAvgStateType); } case PhysicalType::INT32: { return AggregateFunction::UnaryAggregate, int32_t, double, IntegerAverageOperationHugeint>( - LogicalType::INTEGER, LogicalType::DOUBLE); + LogicalType::INTEGER, LogicalType::DOUBLE) + .SetStructStateExport(GetAvgStateType); } case PhysicalType::INT64: { return AggregateFunction::UnaryAggregate, int64_t, double, IntegerAverageOperationHugeint>( - LogicalType::BIGINT, LogicalType::DOUBLE); + LogicalType::BIGINT, LogicalType::DOUBLE) + .SetStructStateExport(GetAvgStateType); } case PhysicalType::INT128: { return AggregateFunction::UnaryAggregate, hugeint_t, double, HugeintAverageOperation>( - LogicalType::HUGEINT, LogicalType::DOUBLE); + LogicalType::HUGEINT, LogicalType::DOUBLE) + .SetStructStateExport(GetAvgStateType); } case PhysicalType::INTERVAL: { return AggregateFunction::UnaryAggregate( - LogicalType::INTERVAL, LogicalType::INTERVAL); + LogicalType::INTERVAL, LogicalType::INTERVAL) + .SetStructStateExport(GetAvgStateType); } default: throw InternalException("Unimplemented average aggregate"); @@ -282,6 +302,7 @@ unique_ptr BindDecimalAvg(ClientContext &context, AggregateFunctio AggregateFunctionSet AvgFun::GetFunctions() { AggregateFunctionSet avg; + // The first is already opted-in during `BindDecimalAvg` avg.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr, nullptr, nullptr, FunctionNullHandling::DEFAULT_NULL_HANDLING, nullptr, BindDecimalAvg)); @@ -291,24 +312,31 @@ AggregateFunctionSet AvgFun::GetFunctions() { avg.AddFunction(GetAverageAggregate(PhysicalType::INT128)); avg.AddFunction(GetAverageAggregate(PhysicalType::INTERVAL)); avg.AddFunction(AggregateFunction::UnaryAggregate, double, double, NumericAverageOperation>( - LogicalType::DOUBLE, LogicalType::DOUBLE)); + LogicalType::DOUBLE, LogicalType::DOUBLE) + .SetStructStateExport(GetAvgStateType)); avg.AddFunction(AggregateFunction::UnaryAggregate, int64_t, int64_t, DiscreteAverageOperation>( - LogicalType::TIMESTAMP, LogicalType::TIMESTAMP)); + LogicalType::TIMESTAMP, LogicalType::TIMESTAMP) + .SetStructStateExport(GetAvgStateType)); avg.AddFunction(AggregateFunction::UnaryAggregate, int64_t, int64_t, DiscreteAverageOperation>( - LogicalType::TIMESTAMP_TZ, LogicalType::TIMESTAMP_TZ)); + LogicalType::TIMESTAMP_TZ, LogicalType::TIMESTAMP_TZ) + .SetStructStateExport(GetAvgStateType)); avg.AddFunction(AggregateFunction::UnaryAggregate, int64_t, int64_t, DiscreteAverageOperation>( - LogicalType::TIME, LogicalType::TIME)); + LogicalType::TIME, LogicalType::TIME) + .SetStructStateExport(GetAvgStateType)); avg.AddFunction( AggregateFunction::UnaryAggregate, dtime_tz_t, dtime_tz_t, TimeTZAverageOperation>( - LogicalType::TIME_TZ, LogicalType::TIME_TZ)); + LogicalType::TIME_TZ, LogicalType::TIME_TZ) + .SetStructStateExport(GetAvgStateType)); return avg; } AggregateFunction FAvgFun::GetFunction() { - return AggregateFunction::UnaryAggregate(LogicalType::DOUBLE, - LogicalType::DOUBLE); + auto function = AggregateFunction::UnaryAggregate( + LogicalType::DOUBLE, LogicalType::DOUBLE) + .SetStructStateExport(GetKahanAvgStateType); + return function; } } // namespace duckdb diff --git a/src/duckdb/extension/core_functions/aggregate/algebraic/corr.cpp b/src/duckdb/extension/core_functions/aggregate/algebraic/corr.cpp index bf53a5ad3..1c4614aee 100644 --- a/src/duckdb/extension/core_functions/aggregate/algebraic/corr.cpp +++ b/src/duckdb/extension/core_functions/aggregate/algebraic/corr.cpp @@ -6,8 +6,34 @@ namespace duckdb { +LogicalType GetCorrExportStateType(const AggregateFunction &function) { + auto state_children = child_list_t {}; + + auto covar_pop_children = child_list_t {}; + covar_pop_children.emplace_back("count", LogicalType::UBIGINT); + covar_pop_children.emplace_back("mean_x", LogicalType::DOUBLE); + covar_pop_children.emplace_back("mean_y", LogicalType::DOUBLE); + covar_pop_children.emplace_back("co_moment", LogicalType::DOUBLE); + state_children.emplace_back("cov_pop", LogicalType::STRUCT(std::move(covar_pop_children))); + + auto dev_pop_x_children = child_list_t {}; + dev_pop_x_children.emplace_back("count", LogicalType::UBIGINT); + dev_pop_x_children.emplace_back("mean", LogicalType::DOUBLE); + dev_pop_x_children.emplace_back("dsquared", LogicalType::DOUBLE); + state_children.emplace_back("dev_pop_x", LogicalType::STRUCT(std::move(dev_pop_x_children))); + + auto dev_pop_y_children = child_list_t {}; + dev_pop_y_children.emplace_back("count", LogicalType::UBIGINT); + dev_pop_y_children.emplace_back("mean", LogicalType::DOUBLE); + dev_pop_y_children.emplace_back("dsquared", LogicalType::DOUBLE); + state_children.emplace_back("dev_pop_y", LogicalType::STRUCT(std::move(dev_pop_y_children))); + + return LogicalType::STRUCT(std::move(state_children)); +} + AggregateFunction CorrFun::GetFunction() { return AggregateFunction::BinaryAggregate( - LogicalType::DOUBLE, LogicalType::DOUBLE, LogicalType::DOUBLE); + LogicalType::DOUBLE, LogicalType::DOUBLE, LogicalType::DOUBLE) + .SetStructStateExport(GetCorrExportStateType); } } // namespace duckdb diff --git a/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp index fccfd0ac8..8856bd23c 100644 --- a/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp +++ b/src/duckdb/extension/core_functions/aggregate/distributive/bitagg.cpp @@ -17,29 +17,57 @@ struct BitState { T value; }; +template +LogicalType GetBitStateType(const AggregateFunction &function) { + child_list_t child_types; + child_types.emplace_back("is_set", LogicalType::BOOLEAN); + + LogicalType value_type = function.return_type; + child_types.emplace_back("value", value_type); + + return LogicalType::STRUCT(std::move(child_types)); +} + +LogicalType GetBitStringStateType(const AggregateFunction &function) { + child_list_t child_types; + child_types.emplace_back("is_set", LogicalType::BOOLEAN); + child_types.emplace_back("value", function.return_type); + return LogicalType::STRUCT(std::move(child_types)); +} + template AggregateFunction GetBitfieldUnaryAggregate(LogicalType type) { switch (type.id()) { case LogicalTypeId::TINYINT: - return AggregateFunction::UnaryAggregate, int8_t, int8_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, int8_t, int8_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::SMALLINT: - return AggregateFunction::UnaryAggregate, int16_t, int16_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, int16_t, int16_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::INTEGER: - return AggregateFunction::UnaryAggregate, int32_t, int32_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, int32_t, int32_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::BIGINT: - return AggregateFunction::UnaryAggregate, int64_t, int64_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, int64_t, int64_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::HUGEINT: - return AggregateFunction::UnaryAggregate, hugeint_t, hugeint_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, hugeint_t, hugeint_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::UTINYINT: - return AggregateFunction::UnaryAggregate, uint8_t, uint8_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint8_t, uint8_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::USMALLINT: - return AggregateFunction::UnaryAggregate, uint16_t, uint16_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint16_t, uint16_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::UINTEGER: - return AggregateFunction::UnaryAggregate, uint32_t, uint32_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint32_t, uint32_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::UBIGINT: - return AggregateFunction::UnaryAggregate, uint64_t, uint64_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint64_t, uint64_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); case LogicalTypeId::UHUGEINT: - return AggregateFunction::UnaryAggregate, uhugeint_t, uhugeint_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uhugeint_t, uhugeint_t, OP>(type, type) + .SetStructStateExport(GetBitStateType); default: throw InternalException("Unimplemented bitfield type for unary aggregate"); } @@ -202,9 +230,11 @@ AggregateFunctionSet BitAndFun::GetFunctions() { bit_and.AddFunction(GetBitfieldUnaryAggregate(type)); } - bit_and.AddFunction( + auto bit_string_fun = AggregateFunction::UnaryAggregateDestructor, string_t, string_t, BitStringAndOperation>( - LogicalType::BIT, LogicalType::BIT)); + LogicalType::BIT, LogicalType::BIT); + bit_string_fun.SetStructStateExport(GetBitStringStateType); + bit_and.AddFunction(bit_string_fun); return bit_and; } @@ -213,9 +243,11 @@ AggregateFunctionSet BitOrFun::GetFunctions() { for (auto &type : LogicalType::Integral()) { bit_or.AddFunction(GetBitfieldUnaryAggregate(type)); } - bit_or.AddFunction( + auto bit_string_fun = AggregateFunction::UnaryAggregateDestructor, string_t, string_t, BitStringOrOperation>( - LogicalType::BIT, LogicalType::BIT)); + LogicalType::BIT, LogicalType::BIT); + bit_string_fun.SetStructStateExport(GetBitStringStateType); + bit_or.AddFunction(bit_string_fun); return bit_or; } @@ -224,9 +256,11 @@ AggregateFunctionSet BitXorFun::GetFunctions() { for (auto &type : LogicalType::Integral()) { bit_xor.AddFunction(GetBitfieldUnaryAggregate(type)); } - bit_xor.AddFunction( + auto bit_string_fun = AggregateFunction::UnaryAggregateDestructor, string_t, string_t, BitStringXorOperation>( - LogicalType::BIT, LogicalType::BIT)); + LogicalType::BIT, LogicalType::BIT); + bit_string_fun.SetStructStateExport(GetBitStringStateType); + bit_xor.AddFunction(bit_string_fun); return bit_xor; } diff --git a/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp index 89646f3b1..b457e7c24 100644 --- a/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp +++ b/src/duckdb/extension/core_functions/aggregate/distributive/bool.cpp @@ -93,6 +93,13 @@ struct BoolOrFunFunction { } }; +LogicalType GetBoolAndStateType(const AggregateFunction &function) { + child_list_t child_types; + child_types.emplace_back("empty", LogicalType::BOOLEAN); + child_types.emplace_back("val", LogicalType::BOOLEAN); + return LogicalType::STRUCT(std::move(child_types)); +} + } // namespace AggregateFunction BoolOrFun::GetFunction() { @@ -100,7 +107,7 @@ AggregateFunction BoolOrFun::GetFunction() { LogicalType(LogicalTypeId::BOOLEAN), LogicalType::BOOLEAN); fun.SetOrderDependent(AggregateOrderDependent::NOT_ORDER_DEPENDENT); fun.SetDistinctDependent(AggregateDistinctDependent::NOT_DISTINCT_DEPENDENT); - return fun; + return fun.SetStructStateExport(GetBoolAndStateType); } AggregateFunction BoolAndFun::GetFunction() { @@ -108,7 +115,7 @@ AggregateFunction BoolAndFun::GetFunction() { LogicalType(LogicalTypeId::BOOLEAN), LogicalType::BOOLEAN); fun.SetOrderDependent(AggregateOrderDependent::NOT_ORDER_DEPENDENT); fun.SetDistinctDependent(AggregateDistinctDependent::NOT_DISTINCT_DEPENDENT); - return fun; + return fun.SetStructStateExport(GetBoolAndStateType); } } // namespace duckdb diff --git a/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp index ee5a086af..90d2507c0 100644 --- a/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp +++ b/src/duckdb/extension/core_functions/aggregate/distributive/product.cpp @@ -55,11 +55,19 @@ struct ProductFunction { } }; +LogicalType GetProductStateType(const AggregateFunction &function) { + child_list_t children; + children.emplace_back("empty", LogicalType::BOOLEAN); + children.emplace_back("val", LogicalType::DOUBLE); + return LogicalType::STRUCT(std::move(children)); +} + } // namespace AggregateFunction ProductFun::GetFunction() { return AggregateFunction::UnaryAggregate( - LogicalType(LogicalTypeId::DOUBLE), LogicalType::DOUBLE); + LogicalType(LogicalTypeId::DOUBLE), LogicalType::DOUBLE) + .SetStructStateExport(GetProductStateType); } } // namespace duckdb diff --git a/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp b/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp index 7746cadf3..6f3f44761 100644 --- a/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp +++ b/src/duckdb/extension/core_functions/aggregate/distributive/sum.cpp @@ -73,6 +73,37 @@ struct HugeintSumOperation : public BaseSumOperation +static LogicalType GetValueLogicalType(); + +template <> +LogicalType GetValueLogicalType() { + return LogicalType::BIGINT; +} +template <> +LogicalType GetValueLogicalType() { + return LogicalType::HUGEINT; +} +template <> +LogicalType GetValueLogicalType() { + return LogicalType::DOUBLE; +} + +template +LogicalType GetSumStateType(const AggregateFunction &function) { + child_list_t child_types; + child_types.emplace_back("isset", LogicalType::BOOLEAN); + + LogicalType value_type = GetValueLogicalType(); + // Use the return type when its physical representation matches the state type + if (function.return_type.InternalType() == value_type.InternalType()) { + value_type = function.return_type; + } + child_types.emplace_back("value", value_type); + + return LogicalType::STRUCT(std::move(child_types)); +} + unique_ptr SumNoOverflowBind(ClientContext &context, AggregateFunction &function, vector> &arguments) { throw BinderException("sum_no_overflow is for internal use only!"); @@ -98,7 +129,7 @@ AggregateFunction GetSumAggregateNoOverflow(PhysicalType type) { function.SetBindCallback(SumNoOverflowBind); function.SetSerializeCallback(SumNoOverflowSerialize); function.SetDeserializeCallback(SumNoOverflowDeserialize); - return function; + return function.SetStructStateExport(GetSumStateType); } case PhysicalType::INT64: { auto function = AggregateFunction::UnaryAggregate, int64_t, hugeint_t, IntegerSumOperation>( @@ -108,7 +139,7 @@ AggregateFunction GetSumAggregateNoOverflow(PhysicalType type) { function.SetBindCallback(SumNoOverflowBind); function.SetSerializeCallback(SumNoOverflowSerialize); function.SetDeserializeCallback(SumNoOverflowDeserialize); - return function; + return function.SetStructStateExport(GetSumStateType); } default: throw BinderException("Unsupported internal type for sum_no_overflow"); @@ -164,13 +195,13 @@ AggregateFunction GetSumAggregate(PhysicalType type) { auto function = AggregateFunction::UnaryAggregate, bool, hugeint_t, IntegerSumOperation>( LogicalType::BOOLEAN, LogicalType::HUGEINT); function.SetOrderDependent(AggregateOrderDependent::NOT_ORDER_DEPENDENT); - return function; + return function.SetStructStateExport(GetSumStateType); } case PhysicalType::INT16: { auto function = AggregateFunction::UnaryAggregate, int16_t, hugeint_t, IntegerSumOperation>( LogicalType::SMALLINT, LogicalType::HUGEINT); function.SetOrderDependent(AggregateOrderDependent::NOT_ORDER_DEPENDENT); - return function; + return function.SetStructStateExport(GetSumStateType); } case PhysicalType::INT32: { @@ -179,7 +210,7 @@ AggregateFunction GetSumAggregate(PhysicalType type) { LogicalType::INTEGER, LogicalType::HUGEINT); function.SetStatisticsCallback(SumPropagateStats); function.SetOrderDependent(AggregateOrderDependent::NOT_ORDER_DEPENDENT); - return function; + return function.SetStructStateExport(GetSumStateType); } case PhysicalType::INT64: { auto function = @@ -187,14 +218,14 @@ AggregateFunction GetSumAggregate(PhysicalType type) { LogicalType::BIGINT, LogicalType::HUGEINT); function.SetStatisticsCallback(SumPropagateStats); function.SetOrderDependent(AggregateOrderDependent::NOT_ORDER_DEPENDENT); - return function; + return function.SetStructStateExport(GetSumStateType); } case PhysicalType::INT128: { auto function = AggregateFunction::UnaryAggregate, hugeint_t, hugeint_t, HugeintSumOperation>( LogicalType::HUGEINT, LogicalType::HUGEINT); function.SetOrderDependent(AggregateOrderDependent::NOT_ORDER_DEPENDENT); - return function; + return function.SetStructStateExport(GetSumStateType); } default: throw InternalException("Unimplemented sum aggregate"); @@ -283,7 +314,8 @@ AggregateFunctionSet SumFun::GetFunctions() { sum.AddFunction(GetSumAggregate(PhysicalType::INT64)); sum.AddFunction(GetSumAggregate(PhysicalType::INT128)); sum.AddFunction(AggregateFunction::UnaryAggregate, double, double, NumericSumOperation>( - LogicalType::DOUBLE, LogicalType::DOUBLE)); + LogicalType::DOUBLE, LogicalType::DOUBLE) + .SetStructStateExport(GetSumStateType)); sum.AddFunction(AggregateFunction::UnaryAggregate( LogicalType::BIGNUM, LogicalType::BIGNUM)); return sum; @@ -301,9 +333,18 @@ AggregateFunctionSet SumNoOverflowFun::GetFunctions() { return sum_no_overflow; } +LogicalType GetKahanSumStateType(const AggregateFunction &function) { + child_list_t children; + children.emplace_back("isset", LogicalType::BOOLEAN); + children.emplace_back("value", LogicalType::DOUBLE); + children.emplace_back("err", LogicalType::DOUBLE); + return LogicalType::STRUCT(std::move(children)); +} + AggregateFunction KahanSumFun::GetFunction() { return AggregateFunction::UnaryAggregate(LogicalType::DOUBLE, - LogicalType::DOUBLE); + LogicalType::DOUBLE) + .SetStructStateExport(GetKahanSumStateType); } } // namespace duckdb diff --git a/src/duckdb/extension/core_functions/function_list.cpp b/src/duckdb/extension/core_functions/function_list.cpp index 4987d2e3f..0f14a8113 100644 --- a/src/duckdb/extension/core_functions/function_list.cpp +++ b/src/duckdb/extension/core_functions/function_list.cpp @@ -196,6 +196,7 @@ static const StaticFunctionDefinition core_functions[] = { DUCKDB_SCALAR_FUNCTION_SET(GenerateSeriesFun), DUCKDB_SCALAR_FUNCTION(GetBitFun), DUCKDB_SCALAR_FUNCTION(GetCurrentTimestampFun), + DUCKDB_SCALAR_FUNCTION(GetTypeFun), DUCKDB_SCALAR_FUNCTION_SET_ALIAS(GradeUpFun), DUCKDB_SCALAR_FUNCTION_SET(GreatestFun), DUCKDB_SCALAR_FUNCTION_SET(GreatestCommonDivisorFun), @@ -266,6 +267,7 @@ static const StaticFunctionDefinition core_functions[] = { DUCKDB_SCALAR_FUNCTION_SET(MakeTimestampFun), DUCKDB_SCALAR_FUNCTION_SET(MakeTimestampMsFun), DUCKDB_SCALAR_FUNCTION_SET(MakeTimestampNsFun), + DUCKDB_SCALAR_FUNCTION(MakeTypeFun), DUCKDB_SCALAR_FUNCTION_SET(MapFun), DUCKDB_SCALAR_FUNCTION(MapConcatFun), DUCKDB_SCALAR_FUNCTION(MapEntriesFun), diff --git a/src/duckdb/extension/core_functions/include/core_functions/scalar/generic_functions.hpp b/src/duckdb/extension/core_functions/include/core_functions/scalar/generic_functions.hpp index 36afd4537..f8642e689 100644 --- a/src/duckdb/extension/core_functions/include/core_functions/scalar/generic_functions.hpp +++ b/src/duckdb/extension/core_functions/include/core_functions/scalar/generic_functions.hpp @@ -85,6 +85,26 @@ struct TypeOfFun { static ScalarFunction GetFunction(); }; +struct GetTypeFun { + static constexpr const char *Name = "get_type"; + static constexpr const char *Parameters = "expression"; + static constexpr const char *Description = "Returns the type of the result of the expression"; + static constexpr const char *Example = "get_type('abc')"; + static constexpr const char *Categories = ""; + + static ScalarFunction GetFunction(); +}; + +struct MakeTypeFun { + static constexpr const char *Name = "make_type"; + static constexpr const char *Parameters = "name,..."; + static constexpr const char *Description = "Construct a type from its name and optional parameters"; + static constexpr const char *Example = "make_type('DECIMAL', 10, 2)"; + static constexpr const char *Categories = ""; + + static ScalarFunction GetFunction(); +}; + struct CanCastImplicitlyFun { static constexpr const char *Name = "can_cast_implicitly"; static constexpr const char *Parameters = "source_type,target_type"; diff --git a/src/duckdb/extension/core_functions/lambda_functions.cpp b/src/duckdb/extension/core_functions/lambda_functions.cpp index 89356921c..cc626d51e 100644 --- a/src/duckdb/extension/core_functions/lambda_functions.cpp +++ b/src/duckdb/extension/core_functions/lambda_functions.cpp @@ -5,6 +5,7 @@ #include "duckdb/planner/expression/bound_function_expression.hpp" #include "duckdb/planner/expression/bound_cast_expression.hpp" +#include "duckdb/planner/expression/bound_lambda_expression.hpp" namespace duckdb { diff --git a/src/duckdb/extension/core_functions/scalar/bit/bitstring.cpp b/src/duckdb/extension/core_functions/scalar/bit/bitstring.cpp index b3e26a7f1..929f4787d 100644 --- a/src/duckdb/extension/core_functions/scalar/bit/bitstring.cpp +++ b/src/duckdb/extension/core_functions/scalar/bit/bitstring.cpp @@ -23,12 +23,8 @@ static void BitStringFunction(DataChunk &args, ExpressionState &state, Vector &r if (idx_t(n) < input_length) { throw InvalidInputException("Length must be equal or larger than input string"); } - idx_t len; - if (FROM_STRING) { - Bit::TryGetBitStringSize(input, len, nullptr); // string verification - } - len = Bit::ComputeBitstringLen(UnsafeNumericCast(n)); + idx_t len = Bit::ComputeBitstringLen(UnsafeNumericCast(n)); string_t target = StringVector::EmptyString(result, len); if (FROM_STRING) { Bit::BitString(input, UnsafeNumericCast(n), target); diff --git a/src/duckdb/extension/core_functions/scalar/date/date_trunc.cpp b/src/duckdb/extension/core_functions/scalar/date/date_trunc.cpp index f4df3a25a..787dc77fd 100644 --- a/src/duckdb/extension/core_functions/scalar/date/date_trunc.cpp +++ b/src/duckdb/extension/core_functions/scalar/date/date_trunc.cpp @@ -517,7 +517,8 @@ unique_ptr DateTruncStatistics(vector &child_sta auto result = NumericStats::CreateEmpty(min_value.type()); NumericStats::SetMin(result, min_value); NumericStats::SetMax(result, max_value); - result.CopyValidity(child_stats[0]); + + result.CombineValidity(child_stats[0], child_stats[1]); return result.ToUnique(); } diff --git a/src/duckdb/extension/core_functions/scalar/generic/stats.cpp b/src/duckdb/extension/core_functions/scalar/generic/stats.cpp index 3bd18ae01..4eb00c98d 100644 --- a/src/duckdb/extension/core_functions/scalar/generic/stats.cpp +++ b/src/duckdb/extension/core_functions/scalar/generic/stats.cpp @@ -5,10 +5,10 @@ namespace duckdb { namespace { struct StatsBindData : public FunctionData { - explicit StatsBindData(string stats_p = string()) : stats(std::move(stats_p)) { + explicit StatsBindData(Value stats_p = Value(LogicalType::VARIANT())) : stats(std::move(stats_p)) { } - string stats; + Value stats; public: unique_ptr Copy() const override { @@ -17,18 +17,14 @@ struct StatsBindData : public FunctionData { bool Equals(const FunctionData &other_p) const override { auto &other = other_p.Cast(); - return stats == other.stats; + return Value::NotDistinctFrom(stats, other.stats); } }; void StatsFunction(DataChunk &args, ExpressionState &state, Vector &result) { auto &func_expr = state.expr.Cast(); auto &info = func_expr.bind_info->Cast(); - if (info.stats.empty()) { - info.stats = "No statistics"; - } - Value v(info.stats); - result.Reference(v); + result.Reference(info.stats); } unique_ptr StatsBind(ClientContext &context, ScalarFunction &bound_function, @@ -40,14 +36,14 @@ unique_ptr StatsPropagateStats(ClientContext &context, FunctionS auto &child_stats = input.child_stats; auto &bind_data = input.bind_data; auto &info = bind_data->Cast(); - info.stats = child_stats[0].ToString(); + info.stats = child_stats[0].ToStruct().CastAs(context, LogicalType::VARIANT()); return nullptr; } } // namespace ScalarFunction StatsFun::GetFunction() { - ScalarFunction stats({LogicalType::ANY}, LogicalType::VARCHAR, StatsFunction, StatsBind, nullptr, + ScalarFunction stats({LogicalType::ANY}, LogicalType::VARIANT(), StatsFunction, StatsBind, nullptr, StatsPropagateStats); stats.SetNullHandling(FunctionNullHandling::SPECIAL_HANDLING); stats.SetStability(FunctionStability::VOLATILE); diff --git a/src/duckdb/extension/core_functions/scalar/generic/type_functions.cpp b/src/duckdb/extension/core_functions/scalar/generic/type_functions.cpp new file mode 100644 index 000000000..813e93228 --- /dev/null +++ b/src/duckdb/extension/core_functions/scalar/generic/type_functions.cpp @@ -0,0 +1,130 @@ +#include "core_functions/scalar/generic_functions.hpp" +#include "duckdb/planner/expression/bound_constant_expression.hpp" +#include "duckdb/planner/expression/bound_function_expression.hpp" +#include "duckdb/parser/expression/constant_expression.hpp" +#include "duckdb/planner/binder.hpp" +#include "duckdb/parser/expression/type_expression.hpp" +#include "duckdb/execution/expression_executor.hpp" + +namespace duckdb { + +//---------------------------------------------------------------------------------------------------------------------- +// typeof function +//---------------------------------------------------------------------------------------------------------------------- + +static void TypeOfFunction(DataChunk &args, ExpressionState &state, Vector &result) { + Value v(args.data[0].GetType().ToString()); + result.Reference(v); +} + +static unique_ptr BindTypeOfFunctionExpression(FunctionBindExpressionInput &input) { + auto &return_type = input.children[0]->return_type; + if (return_type.id() == LogicalTypeId::UNKNOWN || return_type.id() == LogicalTypeId::SQLNULL) { + // parameter - unknown return type + return nullptr; + } + // emit a constant expression + return make_uniq(Value(return_type.ToString())); +} + +ScalarFunction TypeOfFun::GetFunction() { + auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::VARCHAR, TypeOfFunction); + fun.SetNullHandling(FunctionNullHandling::SPECIAL_HANDLING); + fun.SetBindExpressionCallback(BindTypeOfFunctionExpression); + return fun; +} + +//---------------------------------------------------------------------------------------------------------------------- +// get_type function +//---------------------------------------------------------------------------------------------------------------------- +// This is like "typeof", except returns LogicalType::TYPE instead of VARCHAR + +static void GetTypeFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto v = Value::TYPE(args.data[0].GetType()); + result.Reference(v); +} + +static unique_ptr BindGetTypeFunction(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + if (arguments[0]->HasParameter()) { + throw ParameterNotResolvedException(); + } + bound_function.arguments[0] = arguments[0]->return_type; + return nullptr; +} + +static unique_ptr BindGetTypeFunctionExpression(FunctionBindExpressionInput &input) { + auto &return_type = input.children[0]->return_type; + if (return_type.id() == LogicalTypeId::UNKNOWN || return_type.id() == LogicalTypeId::SQLNULL) { + // parameter - unknown return type + return nullptr; + } + // emit a constant expression + return make_uniq(Value::TYPE(return_type)); +} + +ScalarFunction GetTypeFun::GetFunction() { + auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::TYPE(), GetTypeFunction, BindGetTypeFunction); + fun.SetNullHandling(FunctionNullHandling::SPECIAL_HANDLING); + fun.SetBindExpressionCallback(BindGetTypeFunctionExpression); + return fun; +} + +//---------------------------------------------------------------------------------------------------------------------- +// make_type function +//---------------------------------------------------------------------------------------------------------------------- +static void MakeTypeFunction(DataChunk &args, ExpressionState &state, Vector &result) { + throw InvalidInputException("make_type function can only be used in constant expressions"); +} + +static unique_ptr BindMakeTypeFunctionExpression(FunctionBindExpressionInput &input) { + vector> args; + + // Evaluate all arguments to constant values + for (auto &child : input.children) { + string name = child->alias; + if (!child->IsFoldable()) { + throw BinderException("make_type function arguments must be constant expressions"); + } + auto val = ExpressionExecutor::EvaluateScalar(input.context, *child); + args.emplace_back(name, val); + } + + if (args.empty()) { + throw BinderException("make_type function requires at least one argument"); + } + + if (args.front().second.type() != LogicalType::VARCHAR) { + throw BinderException("make_type function first argument must be the type name as VARCHAR"); + } + + vector> type_args; + for (idx_t i = 1; i < args.size(); i++) { + auto &arg = args[i]; + auto result = make_uniq(arg.second); + result->SetAlias(arg.first); + + type_args.push_back(std::move(result)); + } + + auto type_name = args.front().second.GetValue(); + auto qualified_name = QualifiedName::Parse(type_name); + + auto unbound_type = LogicalType::UNBOUND(make_uniq(qualified_name.catalog, qualified_name.schema, + qualified_name.name, std::move(type_args))); + + // Bind the unbound type + auto binder = Binder::CreateBinder(input.context); + binder->BindLogicalType(unbound_type); + return make_uniq(Value::TYPE(unbound_type)); +} + +ScalarFunction MakeTypeFun::GetFunction() { + auto fun = ScalarFunction({LogicalType::VARCHAR}, LogicalType::TYPE(), MakeTypeFunction); + fun.SetNullHandling(FunctionNullHandling::SPECIAL_HANDLING); + fun.SetBindExpressionCallback(BindMakeTypeFunctionExpression); + fun.varargs = LogicalType::ANY; + return fun; +} + +} // namespace duckdb diff --git a/src/duckdb/extension/core_functions/scalar/generic/typeof.cpp b/src/duckdb/extension/core_functions/scalar/generic/typeof.cpp deleted file mode 100644 index 008df7678..000000000 --- a/src/duckdb/extension/core_functions/scalar/generic/typeof.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "core_functions/scalar/generic_functions.hpp" -#include "duckdb/planner/expression/bound_constant_expression.hpp" -#include "duckdb/planner/expression/bound_function_expression.hpp" - -namespace duckdb { - -namespace { - -void TypeOfFunction(DataChunk &args, ExpressionState &state, Vector &result) { - Value v(args.data[0].GetType().ToString()); - result.Reference(v); -} - -unique_ptr BindTypeOfFunctionExpression(FunctionBindExpressionInput &input) { - auto &return_type = input.children[0]->return_type; - if (return_type.id() == LogicalTypeId::UNKNOWN || return_type.id() == LogicalTypeId::SQLNULL) { - // parameter - unknown return type - return nullptr; - } - // emit a constant expression - return make_uniq(Value(return_type.ToString())); -} - -} // namespace - -ScalarFunction TypeOfFun::GetFunction() { - auto fun = ScalarFunction({LogicalType::ANY}, LogicalType::VARCHAR, TypeOfFunction); - fun.SetNullHandling(FunctionNullHandling::SPECIAL_HANDLING); - fun.SetBindExpressionCallback(BindTypeOfFunctionExpression); - return fun; -} - -} // namespace duckdb diff --git a/src/duckdb/extension/core_functions/scalar/list/list_filter.cpp b/src/duckdb/extension/core_functions/scalar/list/list_filter.cpp index 017c611a2..69fd5c906 100644 --- a/src/duckdb/extension/core_functions/scalar/list/list_filter.cpp +++ b/src/duckdb/extension/core_functions/scalar/list/list_filter.cpp @@ -2,6 +2,7 @@ #include "duckdb/function/lambda_functions.hpp" #include "duckdb/planner/expression/bound_cast_expression.hpp" +#include "duckdb/planner/expression/bound_lambda_expression.hpp" namespace duckdb { diff --git a/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp b/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp index f3c23e98f..1960d64fc 100644 --- a/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp +++ b/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp @@ -1,6 +1,8 @@ #include "core_functions/scalar/list_functions.hpp" + #include "duckdb/function/lambda_functions.hpp" #include "duckdb/planner/expression/bound_cast_expression.hpp" +#include "duckdb/planner/expression/bound_lambda_expression.hpp" namespace duckdb { @@ -46,6 +48,7 @@ struct ReduceExecuteInfo { } input_types.push_back(left_slice->GetType()); input_types.push_back(left_slice->GetType()); + // skip the first entry if there is an initial value for (idx_t i = info.has_initial ? 1 : 0; i < info.column_infos.size(); i++) { input_types.push_back(info.column_infos[i].vector.get().GetType()); diff --git a/src/duckdb/extension/core_functions/scalar/list/list_sort.cpp b/src/duckdb/extension/core_functions/scalar/list/list_sort.cpp index 61fab0938..4da6b192b 100644 --- a/src/duckdb/extension/core_functions/scalar/list/list_sort.cpp +++ b/src/duckdb/extension/core_functions/scalar/list/list_sort.cpp @@ -80,7 +80,7 @@ static void SinkDataChunk(const Sort &sort, ExecutionContext &context, OperatorS chunk.data[1].Reference(slice); chunk.data[2].Reference(payload_vector); chunk.SetCardinality(offset_lists_indices); - chunk.Verify(); + chunk.Verify(context.client.db); // sink chunk.Flatten(); diff --git a/src/duckdb/extension/core_functions/scalar/list/list_transform.cpp b/src/duckdb/extension/core_functions/scalar/list/list_transform.cpp index be4f319a9..c9aada10b 100644 --- a/src/duckdb/extension/core_functions/scalar/list/list_transform.cpp +++ b/src/duckdb/extension/core_functions/scalar/list/list_transform.cpp @@ -2,6 +2,7 @@ #include "duckdb/function/lambda_functions.hpp" #include "duckdb/planner/expression/bound_cast_expression.hpp" +#include "duckdb/planner/expression/bound_lambda_expression.hpp" namespace duckdb { diff --git a/src/duckdb/extension/core_functions/scalar/struct/struct_keys.cpp b/src/duckdb/extension/core_functions/scalar/struct/struct_keys.cpp index f021408e8..968a6e854 100644 --- a/src/duckdb/extension/core_functions/scalar/struct/struct_keys.cpp +++ b/src/duckdb/extension/core_functions/scalar/struct/struct_keys.cpp @@ -74,7 +74,8 @@ static void StructKeysFunction(DataChunk &args, ExpressionState &state, Vector & static unique_ptr StructKeysBind(ClientContext &context, ScalarFunction &bound_function, vector> &arguments) { - if (arguments[0]->return_type.id() != LogicalTypeId::STRUCT) { + auto return_type = arguments[0]->return_type; + if (return_type.id() != LogicalTypeId::STRUCT && !return_type.IsAggregateStateStructType()) { throw InvalidInputException("struct_keys() expects a STRUCT argument"); } @@ -86,7 +87,7 @@ static unique_ptr StructKeysBind(ClientContext &context, ScalarFun } ScalarFunction StructKeysFun::GetFunction() { - ScalarFunction func({LogicalType::ANY}, LogicalType::LIST(LogicalType::VARCHAR), StructKeysFunction, + ScalarFunction func({LogicalTypeId::ANY}, LogicalType::LIST(LogicalType::VARCHAR), StructKeysFunction, StructKeysBind); return func; } diff --git a/src/duckdb/extension/icu/icu-makedate.cpp b/src/duckdb/extension/icu/icu-makedate.cpp index 128e80d93..fb477122d 100644 --- a/src/duckdb/extension/icu/icu-makedate.cpp +++ b/src/duckdb/extension/icu/icu-makedate.cpp @@ -2,13 +2,12 @@ #include "duckdb/common/operator/cast_operators.hpp" #include "duckdb/common/operator/subtract.hpp" #include "duckdb/common/types/date.hpp" -#include "duckdb/common/types/time.hpp" #include "duckdb/common/types/timestamp.hpp" #include "duckdb/common/vector_operations/senary_executor.hpp" #include "duckdb/common/vector_operations/septenary_executor.hpp" #include "duckdb/function/cast/cast_function_set.hpp" #include "duckdb/main/extension/extension_loader.hpp" -#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp" +#include "duckdb/main/settings.hpp" #include "include/icu-casts.hpp" #include "include/icu-datefunc.hpp" #include "include/icu-datetrunc.hpp" @@ -57,6 +56,10 @@ BoundCastInfo ICUMakeDate::BindCastToDate(BindCastInput &input, const LogicalTyp if (!input.context) { throw InternalException("Missing context for TIMESTAMPTZ to DATE cast."); } + if (Settings::Get(*input.context)) { + throw BinderException("Casting from TIMESTAMP WITH TIME ZONE to DATE without an explicit time zone " + "has been disabled - use \"AT TIME ZONE ...\""); + } auto cast_data = make_uniq(make_uniq(*input.context)); @@ -80,7 +83,7 @@ struct ICUMakeTimestampTZFunc : public ICUDateFunc { ss -= secs; ss *= Interval::MSECS_PER_SEC; const auto millis = int32_t(ss); - int64_t micros = std::round((ss - millis) * Interval::MICROS_PER_MSEC); + int64_t micros = LossyNumericCast(std::round((ss - millis) * Interval::MICROS_PER_MSEC)); calendar->set(UCAL_YEAR, year); calendar->set(UCAL_MONTH, month); diff --git a/src/duckdb/extension/icu/icu-timezone.cpp b/src/duckdb/extension/icu/icu-timezone.cpp index 65993beaf..d3925df39 100644 --- a/src/duckdb/extension/icu/icu-timezone.cpp +++ b/src/duckdb/extension/icu/icu-timezone.cpp @@ -164,7 +164,7 @@ struct ICUFromNaiveTimestamp : public ICUDateFunc { if (!input.context) { throw InternalException("Missing context for TIMESTAMP to TIMESTAMPTZ cast."); } - if (DBConfig::GetSetting(*input.context)) { + if (Settings::Get(*input.context)) { throw BinderException("Casting from TIMESTAMP to TIMESTAMP WITH TIME ZONE without an explicit time zone " "has been disabled - use \"AT TIME ZONE ...\""); } @@ -251,7 +251,7 @@ struct ICUToNaiveTimestamp : public ICUDateFunc { if (!input.context) { throw InternalException("Missing context for TIMESTAMPTZ to TIMESTAMP cast."); } - if (DBConfig::GetSetting(*input.context)) { + if (Settings::Get(*input.context)) { throw BinderException("Casting from TIMESTAMP WITH TIME ZONE to TIMESTAMP without an explicit time zone " "has been disabled - use \"AT TIME ZONE ...\""); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/appendable.cpp b/src/duckdb/extension/icu/third_party/icu/common/appendable.cpp index fca3c1e41..c0fbcc653 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/appendable.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/appendable.cpp @@ -25,45 +25,45 @@ Appendable::~Appendable() {} UBool Appendable::appendCodePoint(UChar32 c) { if(c<=0xffff) { - return appendCodeUnit((UChar)c); + return appendCodeUnit((char16_t)c); } else { return appendCodeUnit(U16_LEAD(c)) && appendCodeUnit(U16_TRAIL(c)); } } UBool -Appendable::appendString(const UChar *s, int32_t length) { +Appendable::appendString(const char16_t *s, int32_t length) { if(length<0) { - UChar c; + char16_t c; while((c=*s++)!=0) { if(!appendCodeUnit(c)) { - return FALSE; + return false; } } } else if(length>0) { - const UChar *limit=s+length; + const char16_t *limit=s+length; do { if(!appendCodeUnit(*s++)) { - return FALSE; + return false; } } while(scontains(c); -// } - -// int32_t -// UnhandledEngine::findBreaks( UText *text, -// int32_t /* startPos */, -// int32_t endPos, -// UVector32 &/*foundBreaks*/ ) const { -// UChar32 c = utext_current32(text); -// while((int32_t)utext_getNativeIndex(text) < endPos && fHandled->contains(c)) { -// utext_next32(text); // TODO: recast loop to work with post-increment operations. -// c = utext_current32(text); -// } -// return 0; -// } - -// void -// 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); -// } -// } - -// /* -// ****************************************************************** -// */ - -// ICULanguageBreakFactory::ICULanguageBreakFactory(UErrorCode &/*status*/) { -// fEngines = 0; -// } - -// ICULanguageBreakFactory::~ICULanguageBreakFactory() { -// if (fEngines != 0) { -// delete fEngines; -// } -// } - -// U_NAMESPACE_END -// U_CDECL_BEGIN -// static void U_CALLCONV _deleteEngine(void *obj) { -// delete (const icu::LanguageBreakEngine *) obj; -// } -// U_CDECL_END -// U_NAMESPACE_BEGIN - -// const LanguageBreakEngine * -// ICULanguageBreakFactory::getEngineFor(UChar32 c) { -// const LanguageBreakEngine *lbe = NULL; -// UErrorCode status = U_ZERO_ERROR; - -// static UMutex gBreakEngineMutex; -// Mutex m(&gBreakEngineMutex); - -// if (fEngines == NULL) { -// UStack *engines = new UStack(_deleteEngine, NULL, status); -// if (U_FAILURE(status) || engines == NULL) { -// // Note: no way to return error code to caller. -// delete engines; -// return NULL; -// } -// fEngines = engines; -// } else { -// int32_t i = fEngines->size(); -// while (--i >= 0) { -// lbe = (const LanguageBreakEngine *)(fEngines->elementAt(i)); -// if (lbe != NULL && lbe->handles(c)) { -// return lbe; -// } -// } -// } - -// // We didn't find an engine. Create one. -// lbe = loadEngineFor(c); -// if (lbe != NULL) { -// fEngines->push((void *)lbe, status); -// } -// return lbe; -// } - -// const LanguageBreakEngine * -// ICULanguageBreakFactory::loadEngineFor(UChar32 c) { -// UErrorCode status = U_ZERO_ERROR; -// UScriptCode code = uscript_getScript(c, &status); -// if (U_SUCCESS(status)) { -// DictionaryMatcher *m = loadDictionaryMatcherFor(code); -// if (m != NULL) { -// const LanguageBreakEngine *engine = NULL; -// switch(code) { -// case USCRIPT_THAI: -// engine = new ThaiBreakEngine(m, status); -// break; -// case USCRIPT_LAO: -// engine = new LaoBreakEngine(m, status); -// break; -// case USCRIPT_MYANMAR: -// engine = new BurmeseBreakEngine(m, status); -// break; -// case USCRIPT_KHMER: -// engine = new KhmerBreakEngine(m, status); -// break; - -// #if !UCONFIG_NO_NORMALIZATION -// // CJK not available w/o normalization -// case USCRIPT_HANGUL: -// engine = new CjkBreakEngine(m, kKorean, status); -// break; - -// // use same BreakEngine and dictionary for both Chinese and Japanese -// case USCRIPT_HIRAGANA: -// case USCRIPT_KATAKANA: -// case USCRIPT_HAN: -// engine = new CjkBreakEngine(m, kChineseJapanese, status); -// break; -// #if 0 -// // TODO: Have to get some characters with script=common handled -// // by CjkBreakEngine (e.g. U+309B). Simply subjecting -// // them to CjkBreakEngine does not work. The engine has to -// // special-case them. -// case USCRIPT_COMMON: -// { -// UBlockCode block = ublock_getCode(code); -// if (block == UBLOCK_HIRAGANA || block == UBLOCK_KATAKANA) -// engine = new CjkBreakEngine(dict, kChineseJapanese, status); -// break; -// } -// #endif -// #endif - -// default: -// break; -// } -// if (engine == NULL) { -// delete m; -// } -// else if (U_FAILURE(status)) { -// delete engine; -// engine = NULL; -// } -// return engine; -// } -// } -// return NULL; -// } - -// DictionaryMatcher * -// ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) { -// UErrorCode status = U_ZERO_ERROR; -// // open root from brkitr tree. -// UResourceBundle *b = ures_open(U_ICUDATA_BRKITR, "", &status); -// b = ures_getByKeyWithFallback(b, "dictionaries", b, &status); -// int32_t dictnlength = 0; -// const UChar *dictfname = -// ures_getStringByKeyWithFallback(b, uscript_getShortName(script), &dictnlength, &status); -// if (U_FAILURE(status)) { -// ures_close(b); -// return NULL; -// } -// CharString dictnbuf; -// CharString ext; -// const UChar *extStart = u_memrchr(dictfname, 0x002e, dictnlength); // last dot -// if (extStart != NULL) { -// int32_t len = (int32_t)(extStart - dictfname); -// ext.appendInvariantChars(UnicodeString(FALSE, extStart + 1, dictnlength - len - 1), status); -// dictnlength = len; -// } -// dictnbuf.appendInvariantChars(UnicodeString(FALSE, dictfname, dictnlength), status); -// ures_close(b); - -// UDataMemory *file = udata_open(U_ICUDATA_BRKITR, ext.data(), dictnbuf.data(), &status); -// if (U_SUCCESS(status)) { -// // build trie -// const uint8_t *data = (const uint8_t *)udata_getMemory(file); -// const int32_t *indexes = (const int32_t *)data; -// const int32_t offset = indexes[DictionaryData::IX_STRING_TRIE_OFFSET]; -// const int32_t trieType = indexes[DictionaryData::IX_TRIE_TYPE] & DictionaryData::TRIE_TYPE_MASK; -// DictionaryMatcher *m = NULL; -// if (trieType == DictionaryData::TRIE_TYPE_BYTES) { -// const int32_t transform = indexes[DictionaryData::IX_TRANSFORM]; -// const char *characters = (const char *)(data + offset); -// m = new BytesDictionaryMatcher(characters, transform, file); -// } -// else if (trieType == DictionaryData::TRIE_TYPE_UCHARS) { -// const UChar *characters = (const UChar *)(data + offset); -// m = new UCharsDictionaryMatcher(characters, file); -// } -// if (m == NULL) { -// // no matcher exists to take ownership - either we are an invalid -// // type or memory allocation failed -// udata_close(file); -// } -// return m; -// } else if (dictfname != NULL) { -// // we don't have a dictionary matcher. -// // returning NULL here will cause us to fail to find a dictionary break engine, as expected -// status = U_ZERO_ERROR; -// return NULL; -// } -// return NULL; -// } - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/brkeng.h b/src/duckdb/extension/icu/third_party/icu/common/brkeng.h index e40fce13f..42a3d697c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/brkeng.h +++ b/src/duckdb/extension/icu/third_party/icu/common/brkeng.h @@ -10,6 +10,7 @@ #ifndef BRKENG_H #define BRKENG_H +#include "unicode/umisc.h" #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/utext.h" @@ -21,6 +22,7 @@ class UnicodeSet; class UStack; class UVector32; class DictionaryMatcher; +class ExternalBreakEngine; /******************************************************************* * LanguageBreakEngine @@ -35,7 +37,7 @@ class DictionaryMatcher; *

LanguageBreakEngines should normally be implemented so as to * be shared between threads without locking.

*/ -class LanguageBreakEngine : public UMemory { +class LanguageBreakEngine : public UObject { public: /** @@ -54,10 +56,11 @@ class LanguageBreakEngine : public UMemory { * a particular kind of break.

* * @param c A character which begins a run that the engine might handle - * @return TRUE if this engine handles the particular character and break + * @param locale The locale. + * @return true if this engine handles the particular character and break * type. */ - virtual UBool handles(UChar32 c) const = 0; + virtual UBool handles(UChar32 c, const char* locale) const = 0; /** *

Find any breaks within a run in the supplied text.

@@ -68,15 +71,47 @@ class LanguageBreakEngine : public UMemory { * @param startPos The start of the run within the supplied text. * @param endPos The end of the run within the supplied text. * @param foundBreaks A Vector of int32_t to receive the breaks. + * @param status Information on any errors encountered. * @return The number of breaks found. */ virtual int32_t findBreaks( UText *text, int32_t startPos, int32_t endPos, - UVector32 &foundBreaks ) const = 0; + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode &status) const = 0; }; +/******************************************************************* + * BreakEngineWrapper + */ + +/** + *

BreakEngineWrapper implement LanguageBreakEngine by + * a thin wrapper that delegate the task to ExternalBreakEngine + *

+ */ +class BreakEngineWrapper : public LanguageBreakEngine { + public: + + BreakEngineWrapper(ExternalBreakEngine* engine, UErrorCode &status); + + virtual ~BreakEngineWrapper(); + + virtual UBool handles(UChar32 c, const char* locale) const override; + + virtual int32_t findBreaks( UText *text, + int32_t startPos, + int32_t endPos, + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode &status) const override; + + private: + LocalPointer delegate; +}; + /******************************************************************* * LanguageBreakFactory */ @@ -122,9 +157,10 @@ class LanguageBreakFactory : public UMemory { * * @param c A character that begins a run for which a LanguageBreakEngine is * sought. + * @param locale The locale. * @return A LanguageBreakEngine with the desired characteristics, or 0. */ - virtual const LanguageBreakEngine *getEngineFor(UChar32 c) = 0; + virtual const LanguageBreakEngine *getEngineFor(UChar32 c, const char* locale) = 0; }; @@ -171,10 +207,11 @@ class UnhandledEngine : public LanguageBreakEngine { * a particular kind of break.

* * @param c A character which begins a run that the engine might handle - * @return TRUE if this engine handles the particular character and break + * @param locale The locale. + * @return true if this engine handles the particular character and break * type. */ - virtual UBool handles(UChar32 c) const; + virtual UBool handles(UChar32 c, const char* locale) const override; /** *

Find any breaks within a run in the supplied text.

@@ -185,12 +222,15 @@ class UnhandledEngine : public LanguageBreakEngine { * @param startPos The start of the run within the supplied text. * @param endPos The end of the run within the supplied text. * @param foundBreaks An allocated C array of the breaks found, if any + * @param status Information on any errors encountered. * @return The number of breaks found. */ virtual int32_t findBreaks( UText *text, int32_t startPos, int32_t endPos, - UVector32 &foundBreaks ) const; + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode &status) const override; /** *

Tell the engine to handle a particular character and break type.

@@ -241,9 +281,18 @@ class ICULanguageBreakFactory : public LanguageBreakFactory { * * @param c A character that begins a run for which a LanguageBreakEngine is * sought. + * @param locale The locale. * @return A LanguageBreakEngine with the desired characteristics, or 0. */ - virtual const LanguageBreakEngine *getEngineFor(UChar32 c); + virtual const LanguageBreakEngine *getEngineFor(UChar32 c, const char* locale) override; + + /** + * Add and adopt the engine and return an URegistryKey. + * @param engine The ExternalBreakEngine to be added and adopt. The caller + * pass the ownership and should not release the memory after this. + * @param status the error code. + */ + virtual void addExternalEngine(ExternalBreakEngine* engine, UErrorCode& status); protected: /** @@ -252,17 +301,21 @@ class ICULanguageBreakFactory : public LanguageBreakFactory { * * @param c A character that begins a run for which a LanguageBreakEngine is * sought. + * @param locale The locale. * @return A LanguageBreakEngine with the desired characteristics, or 0. */ - virtual const LanguageBreakEngine *loadEngineFor(UChar32 c); + virtual const LanguageBreakEngine *loadEngineFor(UChar32 c, const char* locale); /** *

Create a DictionaryMatcher for the specified script and break type.

* @param script An ISO 15924 script code that identifies the dictionary to be * created. - * @return A DictionaryMatcher with the desired characteristics, or NULL. + * @return A DictionaryMatcher with the desired characteristics, or nullptr. */ virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script); + + private: + void ensureEngines(UErrorCode& status); }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/brkiter.cpp b/src/duckdb/extension/icu/third_party/icu/common/brkiter.cpp deleted file mode 100644 index 712d1fee5..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/brkiter.cpp +++ /dev/null @@ -1,508 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* Copyright (C) 1997-2015, International Business Machines Corporation and -* others. All Rights Reserved. -******************************************************************************* -* -* File brkiter.cpp -* -* Modification History: -* -* Date Name Description -* 02/18/97 aliu Converted from OpenClass. Added DONE. -* 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods. -***************************************************************************************** -*/ - -// ***************************************************************************** -// This file was generated from the java source file BreakIterator.java -// ***************************************************************************** - -#include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/rbbi.h" -// #include "unicode/brkiter.h" -// #include "unicode/udata.h" -// #include "unicode/ures.h" -// #include "unicode/ustring.h" -// #include "unicode/filteredbrk.h" -// #include "ucln_cmn.h" -// #include "cstring.h" -// #include "umutex.h" -// #include "servloc.h" -// #include "locbased.h" -// #include "uresimp.h" -// #include "uassert.h" -// #include "ubrkimpl.h" -// #include "charstr.h" - -// // ***************************************************************************** -// // class BreakIterator -// // This class implements methods for finding the location of boundaries in text. -// // Instances of BreakIterator maintain a current position and scan over text -// // returning the index of characters where boundaries occur. -// // ***************************************************************************** - -// U_NAMESPACE_BEGIN - -// // ------------------------------------- - -// BreakIterator* -// BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &status) -// { -// char fnbuff[256]; -// char ext[4]={'\0'}; -// CharString actualLocale; -// int32_t size; -// const UChar* brkfname = NULL; -// UResourceBundle brkRulesStack; -// UResourceBundle brkNameStack; -// UResourceBundle *brkRules = &brkRulesStack; -// UResourceBundle *brkName = &brkNameStack; -// RuleBasedBreakIterator *result = NULL; - -// if (U_FAILURE(status)) -// return NULL; - -// ures_initStackObject(brkRules); -// ures_initStackObject(brkName); - -// // Get the locale -// UResourceBundle *b = ures_openNoDefault(U_ICUDATA_BRKITR, loc.getName(), &status); - -// // Get the "boundaries" array. -// if (U_SUCCESS(status)) { -// brkRules = ures_getByKeyWithFallback(b, "boundaries", brkRules, &status); -// // Get the string object naming the rules file -// brkName = ures_getByKeyWithFallback(brkRules, type, brkName, &status); -// // Get the actual string -// brkfname = ures_getString(brkName, &size, &status); -// U_ASSERT((size_t)size=sizeof(fnbuff)) { -// size=0; -// if (U_SUCCESS(status)) { -// status = U_BUFFER_OVERFLOW_ERROR; -// } -// } - -// // Use the string if we found it -// if (U_SUCCESS(status) && brkfname) { -// actualLocale.append(ures_getLocaleInternal(brkName, &status), -1, status); - -// UChar* extStart=u_strchr(brkfname, 0x002e); -// int len = 0; -// if(extStart!=NULL){ -// len = (int)(extStart-brkfname); -// u_UCharsToChars(extStart+1, ext, sizeof(ext)); // nul terminates the buff -// u_UCharsToChars(brkfname, fnbuff, len); -// } -// fnbuff[len]=0; // nul terminate -// } -// } - -// ures_close(brkRules); -// ures_close(brkName); - -// UDataMemory* file = udata_open(U_ICUDATA_BRKITR, ext, fnbuff, &status); -// if (U_FAILURE(status)) { -// ures_close(b); -// return NULL; -// } - -// // Create a RuleBasedBreakIterator -// result = new RuleBasedBreakIterator(file, status); - -// // If there is a result, set the valid locale and actual locale, and the kind -// if (U_SUCCESS(status) && result != NULL) { -// U_LOCALE_BASED(locBased, *(BreakIterator*)result); -// locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status), -// actualLocale.data()); -// } - -// ures_close(b); - -// if (U_FAILURE(status) && result != NULL) { // Sometimes redundant check, but simple -// delete result; -// return NULL; -// } - -// if (result == NULL) { -// udata_close(file); -// if (U_SUCCESS(status)) { -// status = U_MEMORY_ALLOCATION_ERROR; -// } -// } - -// return result; -// } - -// // Creates a break iterator for word breaks. -// BreakIterator* U_EXPORT2 -// BreakIterator::createWordInstance(const Locale& key, UErrorCode& status) -// { -// return createInstance(key, UBRK_WORD, status); -// } - -// // ------------------------------------- - -// // Creates a break iterator for line breaks. -// BreakIterator* U_EXPORT2 -// BreakIterator::createLineInstance(const Locale& key, UErrorCode& status) -// { -// return createInstance(key, UBRK_LINE, status); -// } - -// // ------------------------------------- - -// // Creates a break iterator for character breaks. -// BreakIterator* U_EXPORT2 -// BreakIterator::createCharacterInstance(const Locale& key, UErrorCode& status) -// { -// return createInstance(key, UBRK_CHARACTER, status); -// } - -// // ------------------------------------- - -// // Creates a break iterator for sentence breaks. -// BreakIterator* U_EXPORT2 -// BreakIterator::createSentenceInstance(const Locale& key, UErrorCode& status) -// { -// return createInstance(key, UBRK_SENTENCE, status); -// } - -// // ------------------------------------- - -// // Creates a break iterator for title casing breaks. -// BreakIterator* U_EXPORT2 -// BreakIterator::createTitleInstance(const Locale& key, UErrorCode& status) -// { -// return createInstance(key, UBRK_TITLE, status); -// } - -// // ------------------------------------- - -// // Gets all the available locales that has localized text boundary data. -// const Locale* U_EXPORT2 -// BreakIterator::getAvailableLocales(int32_t& count) -// { -// return Locale::getAvailableLocales(count); -// } - -// // ------------------------------------------ -// // -// // Constructors, destructor and assignment operator -// // -// //------------------------------------------- - -// 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() -// { -// } - -// // ------------------------------------------ -// // -// // Registration -// // -// //------------------------------------------- -// #if !UCONFIG_NO_SERVICE - -// // ------------------------------------- - -// class ICUBreakIteratorFactory : public ICUResourceBundleFactory { -// public: -// virtual ~ICUBreakIteratorFactory(); -// protected: -// virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* /*service*/, UErrorCode& status) const { -// return BreakIterator::makeInstance(loc, kind, status); -// } -// }; - -// ICUBreakIteratorFactory::~ICUBreakIteratorFactory() {} - -// // ------------------------------------- - -// class ICUBreakIteratorService : public ICULocaleService { -// public: -// ICUBreakIteratorService() -// : ICULocaleService(UNICODE_STRING("Break Iterator", 14)) -// { -// UErrorCode status = U_ZERO_ERROR; -// registerFactory(new ICUBreakIteratorFactory(), status); -// } - -// virtual ~ICUBreakIteratorService(); - -// virtual UObject* cloneInstance(UObject* instance) const { -// return ((BreakIterator*)instance)->clone(); -// } - -// virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /*actualID*/, UErrorCode& status) const { -// LocaleKey& lkey = (LocaleKey&)key; -// int32_t kind = lkey.kind(); -// Locale loc; -// lkey.currentLocale(loc); -// return BreakIterator::makeInstance(loc, kind, status); -// } - -// virtual UBool isDefault() const { -// return countFactories() == 1; -// } -// }; - -// ICUBreakIteratorService::~ICUBreakIteratorService() {} - -// // ------------------------------------- - -// // defined in ucln_cmn.h -// U_NAMESPACE_END - -// static icu::UInitOnce gInitOnceBrkiter = U_INITONCE_INITIALIZER; -// static icu::ICULocaleService* gService = NULL; - - - -// /** -// * Release all static memory held by breakiterator. -// */ -// U_CDECL_BEGIN -// static UBool U_CALLCONV breakiterator_cleanup(void) { -// #if !UCONFIG_NO_SERVICE -// if (gService) { -// delete gService; -// gService = NULL; -// } -// gInitOnceBrkiter.reset(); -// #endif -// return TRUE; -// } -// U_CDECL_END -// U_NAMESPACE_BEGIN - -// static void U_CALLCONV -// initService(void) { -// gService = new ICUBreakIteratorService(); -// ucln_common_registerCleanup(UCLN_COMMON_BREAKITERATOR, breakiterator_cleanup); -// } - -// static ICULocaleService* -// getService(void) -// { -// umtx_initOnce(gInitOnceBrkiter, &initService); -// return gService; -// } - - -// // ------------------------------------- - -// static inline UBool -// hasService(void) -// { -// return !gInitOnceBrkiter.isReset() && getService() != NULL; -// } - -// // ------------------------------------- - -// URegistryKey U_EXPORT2 -// BreakIterator::registerInstance(BreakIterator* toAdopt, const Locale& locale, UBreakIteratorType kind, UErrorCode& status) -// { -// ICULocaleService *service = getService(); -// if (service == NULL) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// return service->registerInstance(toAdopt, locale, kind, status); -// } - -// // ------------------------------------- - -// UBool U_EXPORT2 -// BreakIterator::unregister(URegistryKey key, UErrorCode& status) -// { -// if (U_SUCCESS(status)) { -// if (hasService()) { -// return gService->unregister(key, status); -// } -// status = U_MEMORY_ALLOCATION_ERROR; -// } -// return FALSE; -// } - -// // ------------------------------------- - -// StringEnumeration* U_EXPORT2 -// BreakIterator::getAvailableLocales(void) -// { -// ICULocaleService *service = getService(); -// if (service == NULL) { -// return NULL; -// } -// return service->getAvailableLocales(); -// } -// #endif /* UCONFIG_NO_SERVICE */ - -// // ------------------------------------- - -// BreakIterator* -// BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& status) -// { -// if (U_FAILURE(status)) { -// return NULL; -// } - -// #if !UCONFIG_NO_SERVICE -// if (hasService()) { -// Locale actualLoc(""); -// BreakIterator *result = (BreakIterator*)gService->get(loc, kind, &actualLoc, status); -// // TODO: The way the service code works in ICU 2.8 is that if -// // there is a real registered break iterator, the actualLoc -// // will be populated, but if the handleDefault path is taken -// // (because nothing is registered that can handle the -// // requested locale) then the actualLoc comes back empty. In -// // that case, the returned object already has its actual/valid -// // locale data populated (by makeInstance, which is what -// // handleDefault calls), so we don't touch it. YES, A COMMENT -// // THIS LONG is a sign of bad code -- so the action item is to -// // revisit this in ICU 3.0 and clean it up/fix it/remove it. -// if (U_SUCCESS(status) && (result != NULL) && *actualLoc.getName() != 0) { -// U_LOCALE_BASED(locBased, *result); -// locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName()); -// } -// return result; -// } -// else -// #endif -// { -// return makeInstance(loc, kind, status); -// } -// } - -// // ------------------------------------- -// enum { kKeyValueLenMax = 32 }; - -// BreakIterator* -// BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status) -// { - -// if (U_FAILURE(status)) { -// return NULL; -// } -// char lbType[kKeyValueLenMax]; - -// BreakIterator *result = NULL; -// switch (kind) { -// case UBRK_CHARACTER: -// result = BreakIterator::buildInstance(loc, "grapheme", status); -// break; -// case UBRK_WORD: -// result = BreakIterator::buildInstance(loc, "word", status); -// break; -// case UBRK_LINE: -// uprv_strcpy(lbType, "line"); -// { -// char lbKeyValue[kKeyValueLenMax] = {0}; -// UErrorCode kvStatus = U_ZERO_ERROR; -// int32_t kLen = loc.getKeywordValue("lb", lbKeyValue, kKeyValueLenMax, kvStatus); -// if (U_SUCCESS(kvStatus) && kLen > 0 && (uprv_strcmp(lbKeyValue,"strict")==0 || uprv_strcmp(lbKeyValue,"normal")==0 || uprv_strcmp(lbKeyValue,"loose")==0)) { -// uprv_strcat(lbType, "_"); -// uprv_strcat(lbType, lbKeyValue); -// } -// } -// result = BreakIterator::buildInstance(loc, lbType, status); -// break; -// case UBRK_SENTENCE: -// result = BreakIterator::buildInstance(loc, "sentence", status); -// #if !UCONFIG_NO_FILTERED_BREAK_ITERATION -// { -// char ssKeyValue[kKeyValueLenMax] = {0}; -// UErrorCode kvStatus = U_ZERO_ERROR; -// int32_t kLen = loc.getKeywordValue("ss", ssKeyValue, kKeyValueLenMax, kvStatus); -// if (U_SUCCESS(kvStatus) && kLen > 0 && uprv_strcmp(ssKeyValue,"standard")==0) { -// FilteredBreakIteratorBuilder* fbiBuilder = FilteredBreakIteratorBuilder::createInstance(loc, kvStatus); -// if (U_SUCCESS(kvStatus)) { -// result = fbiBuilder->build(result, status); -// delete fbiBuilder; -// } -// } -// } -// #endif -// break; -// case UBRK_TITLE: -// result = BreakIterator::buildInstance(loc, "title", status); -// break; -// default: -// status = U_ILLEGAL_ARGUMENT_ERROR; -// } - -// if (U_FAILURE(status)) { -// return NULL; -// } - -// return result; -// } - -// Locale -// BreakIterator::getLocale(ULocDataLocaleType type, UErrorCode& status) const { -// U_LOCALE_BASED(locBased, *this); -// return locBased.getLocale(type, status); -// } - -// const char * -// BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const { -// U_LOCALE_BASED(locBased, *this); -// return locBased.getLocaleID(type, status); -// } - - -// // This implementation of getRuleStatus is a do-nothing stub, here to -// // provide a default implementation for any derived BreakIterator classes that -// // do not implement it themselves. -// int32_t BreakIterator::getRuleStatus() const { -// return 0; -// } - -// // This implementation of getRuleStatusVec is a do-nothing stub, here to -// // provide a default implementation for any derived BreakIterator classes that -// // do not implement it themselves. -// int32_t BreakIterator::getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return 0; -// } -// if (capacity < 1) { -// status = U_BUFFER_OVERFLOW_ERROR; -// return 1; -// } -// *fillInVec = 0; -// return 1; -// } - -// BreakIterator::BreakIterator (const Locale& valid, const Locale& actual) { -// U_LOCALE_BASED(locBased, (*this)); -// locBased.setLocaleIDs(valid, actual); -// } - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ - -//eof diff --git a/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.cpp b/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.cpp index 5c8bd94ff..a32254a7d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.cpp @@ -20,7 +20,7 @@ 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; } + if (U_FAILURE(errorCode)) { return false; } char scratch[200]; int32_t s8Length = 0; for (int32_t i = 0; i < s16Length;) { @@ -44,7 +44,7 @@ ByteSinkUtil::appendChange(int32_t length, const char16_t *s16, int32_t s16Lengt } if (j > (INT32_MAX - s8Length)) { errorCode = U_INDEX_OUTOFBOUNDS_ERROR; - return FALSE; + return false; } sink.Append(buffer, j); s8Length += j; @@ -52,17 +52,17 @@ ByteSinkUtil::appendChange(int32_t length, const char16_t *s16, int32_t s16Lengt if (edits != nullptr) { edits->addReplace(length, s8Length); } - return TRUE; + 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 (U_FAILURE(errorCode)) { return false; } if ((limit - s) > INT32_MAX) { errorCode = U_INDEX_OUTOFBOUNDS_ERROR; - return FALSE; + return false; } return appendChange((int32_t)(limit - s), s16, s16Length, sink, edits, errorCode); } @@ -78,14 +78,18 @@ ByteSinkUtil::appendCodePoint(int32_t length, UChar32 c, ByteSink &sink, Edits * sink.Append(s8, s8Length); } +namespace { + // See unicode/utf8.h U8_APPEND_UNSAFE(). -inline uint8_t bytesinkutil_getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); } -inline uint8_t bytesinkutil_getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); } +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)bytesinkutil_getTwoByteLead(c), (char)bytesinkutil_getTwoByteTrail(c) }; + char s8[2] = { (char)getTwoByteLead(c), (char)getTwoByteTrail(c) }; sink.Append(s8, 2); } @@ -105,16 +109,16 @@ 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 (U_FAILURE(errorCode)) { return false; } if ((limit - s) > INT32_MAX) { errorCode = U_INDEX_OUTOFBOUNDS_ERROR; - return FALSE; + return false; } int32_t length = (int32_t)(limit - s); if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); } - return TRUE; + return true; } CharStringByteSink::CharStringByteSink(CharString* dest) : dest_(*dest) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.h b/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.h index 5838b1e3c..929c71fbe 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.h +++ b/src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.h @@ -4,7 +4,8 @@ // bytesinkutil.h // created: 2017sep14 Markus W. Scherer -#pragma once +#ifndef BYTESINKUTIL_H +#define BYTESINKUTIL_H #include "unicode/utypes.h" #include "unicode/bytestream.h" @@ -47,9 +48,9 @@ class U_COMMON_API ByteSinkUtil { static UBool appendUnchanged(const uint8_t *s, int32_t length, ByteSink &sink, uint32_t options, Edits *edits, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return FALSE; } + if (U_FAILURE(errorCode)) { return false; } if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); } - return TRUE; + return true; } static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit, @@ -83,3 +84,5 @@ class U_COMMON_API CharStringByteSink : public ByteSink { }; U_NAMESPACE_END + +#endif //BYTESINKUTIL_H diff --git a/src/duckdb/extension/icu/third_party/icu/common/bytestream.cpp b/src/duckdb/extension/icu/third_party/icu/common/bytestream.cpp index 0d0e4dda3..bd870cd3b 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/bytestream.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/bytestream.cpp @@ -20,7 +20,7 @@ char* ByteSink::GetAppendBuffer(int32_t min_capacity, int32_t* result_capacity) { if (min_capacity < 1 || scratch_capacity < min_capacity) { *result_capacity = 0; - return NULL; + return nullptr; } *result_capacity = scratch_capacity; return scratch; @@ -30,14 +30,14 @@ void ByteSink::Flush() {} CheckedArrayByteSink::CheckedArrayByteSink(char* outbuf, int32_t capacity) : outbuf_(outbuf), capacity_(capacity < 0 ? 0 : capacity), - size_(0), appended_(0), overflowed_(FALSE) { + size_(0), appended_(0), overflowed_(false) { } CheckedArrayByteSink::~CheckedArrayByteSink() {} CheckedArrayByteSink& CheckedArrayByteSink::Reset() { size_ = appended_ = 0; - overflowed_ = FALSE; + overflowed_ = false; return *this; } @@ -48,14 +48,14 @@ void CheckedArrayByteSink::Append(const char* bytes, int32_t n) { if (n > (INT32_MAX - appended_)) { // TODO: Report as integer overflow, not merely buffer overflow. appended_ = INT32_MAX; - overflowed_ = TRUE; + overflowed_ = true; return; } appended_ += n; int32_t available = capacity_ - size_; if (n > available) { n = available; - overflowed_ = TRUE; + overflowed_ = true; } if (n > 0 && bytes != (outbuf_ + size_)) { uprv_memcpy(outbuf_ + size_, bytes, n); @@ -70,7 +70,7 @@ char* CheckedArrayByteSink::GetAppendBuffer(int32_t min_capacity, int32_t* result_capacity) { if (min_capacity < 1 || scratch_capacity < min_capacity) { *result_capacity = 0; - return NULL; + return nullptr; } int32_t available = capacity_ - size_; if (available >= min_capacity) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/bytestrie.cpp b/src/duckdb/extension/icu/third_party/icu/common/bytestrie.cpp index c4d498c4b..532ea9e9c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/bytestrie.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/bytestrie.cpp @@ -68,7 +68,7 @@ BytesTrie::jumpByDelta(const uint8_t *pos) { UStringTrieResult BytesTrie::current() const { const uint8_t *pos=pos_; - if(pos==NULL) { + if(pos==nullptr) { return USTRINGTRIE_NO_MATCH; } else { int32_t node; @@ -182,7 +182,7 @@ BytesTrie::nextImpl(const uint8_t *pos, int32_t inByte) { UStringTrieResult BytesTrie::next(int32_t inByte) { const uint8_t *pos=pos_; - if(pos==NULL) { + if(pos==nullptr) { return USTRINGTRIE_NO_MATCH; } if(inByte<0) { @@ -212,7 +212,7 @@ BytesTrie::next(const char *s, int32_t sLength) { return current(); } const uint8_t *pos=pos_; - if(pos==NULL) { + if(pos==nullptr) { return USTRINGTRIE_NO_MATCH; } int32_t length=remainingMatchLength_; // Actual remaining match length minus 1. @@ -317,8 +317,8 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length, UBool haveUniqueValue, int32_t &uniqueValue) { while(length>kMaxBranchLinearSubNodeLength) { ++pos; // ignore the comparison byte - if(NULL==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) { - return NULL; + if(nullptr==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) { + return nullptr; } length=length-(length>>1); pos=skipDelta(pos); @@ -333,17 +333,17 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length, if(isFinal) { if(haveUniqueValue) { if(value!=uniqueValue) { - return NULL; + return nullptr; } } else { uniqueValue=value; - haveUniqueValue=TRUE; + haveUniqueValue=true; } } else { if(!findUniqueValue(pos+value, haveUniqueValue, uniqueValue)) { - return NULL; + return nullptr; } - haveUniqueValue=TRUE; + haveUniqueValue=true; } } while(--length>1); return pos+1; // ignore the last comparison byte @@ -358,10 +358,10 @@ BytesTrie::findUniqueValue(const uint8_t *pos, UBool haveUniqueValue, int32_t &u node=*pos++; } pos=findUniqueValueFromBranch(pos, node+1, haveUniqueValue, uniqueValue); - if(pos==NULL) { - return FALSE; + if(pos==nullptr) { + return false; } - haveUniqueValue=TRUE; + haveUniqueValue=true; } else if(node>1); if(haveUniqueValue) { if(value!=uniqueValue) { - return FALSE; + return false; } } else { uniqueValue=value; - haveUniqueValue=TRUE; + haveUniqueValue=true; } if(isFinal) { - return TRUE; + return true; } pos=skipValue(pos, node); } @@ -387,7 +387,7 @@ BytesTrie::findUniqueValue(const uint8_t *pos, UBool haveUniqueValue, int32_t &u int32_t BytesTrie::getNextBytes(ByteSink &out) const { const uint8_t *pos=pos_; - if(pos==NULL) { + if(pos==nullptr) { return 0; } if(remainingMatchLength_>=0) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp b/src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp index 038f2221a..876e0dfa1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp @@ -127,13 +127,13 @@ BytesTrieElement::compareStringTo(const BytesTrieElement &other, const CharStrin } BytesTrieBuilder::BytesTrieBuilder(UErrorCode &errorCode) - : strings(NULL), elements(NULL), elementsCapacity(0), elementsLength(0), - bytes(NULL), bytesCapacity(0), bytesLength(0) { + : strings(nullptr), elements(nullptr), elementsCapacity(0), elementsLength(0), + bytes(nullptr), bytesCapacity(0), bytesLength(0) { if(U_FAILURE(errorCode)) { return; } strings=new CharString(); - if(strings==NULL) { + if(strings==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } @@ -162,7 +162,7 @@ BytesTrieBuilder::add(StringPiece s, int32_t value, UErrorCode &errorCode) { newCapacity=4*elementsCapacity; } BytesTrieElement *newElements=new BytesTrieElement[newCapacity]; - if(newElements==NULL) { + if(newElements==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; return *this; // error instead of dereferencing null } @@ -180,7 +180,7 @@ BytesTrieBuilder::add(StringPiece s, int32_t value, UErrorCode &errorCode) { U_CDECL_BEGIN static int32_t U_CALLCONV -bytestriebuilder_compareElementStrings(const void *context, const void *left, const void *right) { +compareElementStrings(const void *context, const void *left, const void *right) { const CharString *strings=static_cast(context); const BytesTrieElement *leftElement=static_cast(left); const BytesTrieElement *rightElement=static_cast(right); @@ -192,13 +192,13 @@ U_CDECL_END BytesTrie * BytesTrieBuilder::build(UStringTrieBuildOption buildOption, UErrorCode &errorCode) { buildBytes(buildOption, errorCode); - BytesTrie *newTrie=NULL; + BytesTrie *newTrie=nullptr; if(U_SUCCESS(errorCode)) { newTrie=new BytesTrie(bytes, bytes+(bytesCapacity-bytesLength)); - if(newTrie==NULL) { + if(newTrie==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } else { - bytes=NULL; // The new trie now owns the array. + bytes=nullptr; // The new trie now owns the array. bytesCapacity=0; } } @@ -220,7 +220,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err if(U_FAILURE(errorCode)) { return; } - if(bytes!=NULL && bytesLength>0) { + if(bytes!=nullptr && bytesLength>0) { // Already built. return; } @@ -230,8 +230,8 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err return; } uprv_sortArray(elements, elementsLength, (int32_t)sizeof(BytesTrieElement), - bytestriebuilder_compareElementStrings, strings, - FALSE, // need not be a stable sort + compareElementStrings, strings, + false, // need not be a stable sort &errorCode); if(U_FAILURE(errorCode)) { return; @@ -256,7 +256,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err if(bytesCapacity(uprv_malloc(capacity)); - if(bytes==NULL) { + if(bytes==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; bytesCapacity=0; return; @@ -264,7 +264,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err bytesCapacity=capacity; } StringTrieBuilder::build(buildOption, elementsLength, errorCode); - if(bytes==NULL) { + if(bytes==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } @@ -282,7 +282,7 @@ BytesTrieBuilder::getElementStringLength(int32_t i) const { return elements[i].getStringLength(*strings); } -UChar +char16_t BytesTrieBuilder::getElementUnit(int32_t i, int32_t byteIndex) const { return (uint8_t)elements[i].charAt(byteIndex, *strings); } @@ -329,7 +329,7 @@ BytesTrieBuilder::skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t } int32_t -BytesTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, UChar byte) const { +BytesTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const { char b=(char)byte; while(b==elements[i].charAt(byteIndex, *strings)) { ++i; @@ -346,18 +346,18 @@ BytesTrieBuilder::BTLinearMatchNode::BTLinearMatchNode(const char *bytes, int32_ bool BytesTrieBuilder::BTLinearMatchNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!LinearMatchNode::operator==(other)) { - return FALSE; + return false; } - const BTLinearMatchNode &o=(const BTLinearMatchNode &)other; + const BTLinearMatchNode &o=static_cast(other); return 0==uprv_memcmp(s, o.s, length); } void BytesTrieBuilder::BTLinearMatchNode::write(StringTrieBuilder &builder) { - BytesTrieBuilder &b=(BytesTrieBuilder &)builder; + BytesTrieBuilder &b=static_cast(builder); next->write(builder); b.write(s, length); offset=b.write(b.getMinLinearMatch()+length-1); @@ -374,8 +374,8 @@ BytesTrieBuilder::createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t le UBool BytesTrieBuilder::ensureCapacity(int32_t length) { - if(bytes==NULL) { - return FALSE; // previous memory allocation had failed + if(bytes==nullptr) { + return false; // previous memory allocation had failed } if(length>bytesCapacity) { int32_t newCapacity=bytesCapacity; @@ -383,12 +383,12 @@ BytesTrieBuilder::ensureCapacity(int32_t length) { newCapacity*=2; } while(newCapacity<=length); char *newBytes=static_cast(uprv_malloc(newCapacity)); - if(newBytes==NULL) { + if(newBytes==nullptr) { // unable to allocate memory uprv_free(bytes); - bytes=NULL; + bytes=nullptr; bytesCapacity=0; - return FALSE; + return false; } uprv_memcpy(newBytes+(newCapacity-bytesLength), bytes+(bytesCapacity-bytesLength), bytesLength); @@ -396,7 +396,7 @@ BytesTrieBuilder::ensureCapacity(int32_t length) { bytes=newBytes; bytesCapacity=newCapacity; } - return TRUE; + return true; } int32_t @@ -463,7 +463,7 @@ int32_t BytesTrieBuilder::writeValueAndType(UBool hasValue, int32_t value, int32_t node) { int32_t offset=write(node); if(hasValue) { - offset=writeValueAndFinal(value, FALSE); + offset=writeValueAndFinal(value, false); } return offset; } @@ -474,31 +474,39 @@ BytesTrieBuilder::writeDeltaTo(int32_t jumpTarget) { U_ASSERT(i>=0); if(i<=BytesTrie::kMaxOneByteDelta) { return write(i); + } else { + char intBytes[5]; + return write(intBytes, internalEncodeDelta(i, intBytes)); } - char intBytes[5]; - int32_t length; +} + +int32_t +BytesTrieBuilder::internalEncodeDelta(int32_t i, char intBytes[]) { + U_ASSERT(i>=0); + if(i<=BytesTrie::kMaxOneByteDelta) { + intBytes[0]=(char)i; + return 1; + } + int32_t length=1; if(i<=BytesTrie::kMaxTwoByteDelta) { intBytes[0]=(char)(BytesTrie::kMinTwoByteDeltaLead+(i>>8)); - length=1; } else { if(i<=BytesTrie::kMaxThreeByteDelta) { intBytes[0]=(char)(BytesTrie::kMinThreeByteDeltaLead+(i>>16)); - length=2; } else { if(i<=0xffffff) { intBytes[0]=(char)BytesTrie::kFourByteDeltaLead; - length=3; } else { intBytes[0]=(char)BytesTrie::kFiveByteDeltaLead; intBytes[1]=(char)(i>>24); - length=4; + length=2; } - intBytes[1]=(char)(i>>16); + intBytes[length++]=(char)(i>>16); } - intBytes[1]=(char)(i>>8); + intBytes[length++]=(char)(i>>8); } intBytes[length++]=(char)i; - return write(intBytes, length); + return length; } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/bytestrieiterator.cpp b/src/duckdb/extension/icu/third_party/icu/common/bytestrieiterator.cpp index e64961a1f..65f54be48 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/bytestrieiterator.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/bytestrieiterator.cpp @@ -27,7 +27,7 @@ BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength, : bytes_(static_cast(trieBytes)), pos_(bytes_), initialPos_(bytes_), remainingMatchLength_(-1), initialRemainingMatchLength_(-1), - str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) { + str_(nullptr), maxLength_(maxStringLength), value_(0), stack_(nullptr) { if(U_FAILURE(errorCode)) { return; } @@ -39,7 +39,7 @@ BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength, // cost is minimal. str_=new CharString(); stack_=new UVector32(errorCode); - if(U_SUCCESS(errorCode) && (str_==NULL || stack_==NULL)) { + if(U_SUCCESS(errorCode) && (str_==nullptr || stack_==nullptr)) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } @@ -49,7 +49,7 @@ BytesTrie::Iterator::Iterator(const BytesTrie &trie, int32_t maxStringLength, : bytes_(trie.bytes_), pos_(trie.pos_), initialPos_(trie.pos_), remainingMatchLength_(trie.remainingMatchLength_), initialRemainingMatchLength_(trie.remainingMatchLength_), - str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) { + str_(nullptr), maxLength_(maxStringLength), value_(0), stack_(nullptr) { if(U_FAILURE(errorCode)) { return; } @@ -58,7 +58,7 @@ BytesTrie::Iterator::Iterator(const BytesTrie &trie, int32_t maxStringLength, if(U_FAILURE(errorCode)) { return; } - if(str_==NULL || stack_==NULL) { + if(str_==nullptr || stack_==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; return; } @@ -96,17 +96,17 @@ BytesTrie::Iterator::reset() { } UBool -BytesTrie::Iterator::hasNext() const { return pos_!=NULL || !stack_->isEmpty(); } +BytesTrie::Iterator::hasNext() const { return pos_!=nullptr || !stack_->isEmpty(); } UBool BytesTrie::Iterator::next(UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } const uint8_t *pos=pos_; - if(pos==NULL) { + if(pos==nullptr) { if(stack_->isEmpty()) { - return FALSE; + return false; } // Pop the state off the stack and continue with the next outbound edge of // the branch node. @@ -118,8 +118,8 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) { length=(int32_t)((uint32_t)length>>16); if(length>1) { pos=branchNext(pos, length, errorCode); - if(pos==NULL) { - return TRUE; // Reached a final value. + if(pos==nullptr) { + return true; // Reached a final value. } } else { str_->append((char)*pos++, errorCode); @@ -137,11 +137,11 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) { UBool isFinal=(UBool)(node&kValueIsFinal); value_=readValue(pos, node>>1); if(isFinal || (maxLength_>0 && str_->length()==maxLength_)) { - pos_=NULL; + pos_=nullptr; } else { pos_=skipValue(pos, node); } - return TRUE; + return true; } if(maxLength_>0 && str_->length()==maxLength_) { return truncateAndStop(); @@ -151,8 +151,8 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) { node=*pos++; } pos=branchNext(pos, node+1, errorCode); - if(pos==NULL) { - return TRUE; // Reached a final value. + if(pos==nullptr) { + return true; // Reached a final value. } } else { // Linear-match node, append length bytes to str_. @@ -170,14 +170,14 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) { StringPiece BytesTrie::Iterator::getString() const { - return str_ == NULL ? StringPiece() : str_->toStringPiece(); + return str_ == nullptr ? StringPiece() : str_->toStringPiece(); } UBool BytesTrie::Iterator::truncateAndStop() { - pos_=NULL; + pos_=nullptr; value_=-1; // no real value for str - return TRUE; + return true; } // Branch node, needs to take the first outbound edge and push state for the rest. @@ -203,9 +203,9 @@ BytesTrie::Iterator::branchNext(const uint8_t *pos, int32_t length, UErrorCode & stack_->addElement(((length-1)<<16)|str_->length(), errorCode); str_->append((char)trieByte, errorCode); if(isFinal) { - pos_=NULL; + pos_=nullptr; value_=value; - return NULL; + return nullptr; } else { return pos+value; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/caniter.cpp b/src/duckdb/extension/icu/third_party/icu/common/caniter.cpp index b28acfc84..64a3c65d2 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/caniter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/caniter.cpp @@ -68,10 +68,10 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CanonicalIterator) *@param source string to get results for */ CanonicalIterator::CanonicalIterator(const UnicodeString &sourceStr, UErrorCode &status) : - pieces(NULL), + pieces(nullptr), pieces_length(0), - pieces_lengths(NULL), - current(NULL), + pieces_lengths(nullptr), + current(nullptr), current_length(0), nfd(*Normalizer2::getNFDInstance(status)), nfcImpl(*Normalizer2Factory::getNFCImpl(status)) @@ -87,23 +87,23 @@ CanonicalIterator::~CanonicalIterator() { void CanonicalIterator::cleanPieces() { int32_t i = 0; - if(pieces != NULL) { + if(pieces != nullptr) { for(i = 0; i < pieces_length; i++) { - if(pieces[i] != NULL) { + if(pieces[i] != nullptr) { delete[] pieces[i]; } } uprv_free(pieces); - pieces = NULL; + pieces = nullptr; pieces_length = 0; } - if(pieces_lengths != NULL) { + if(pieces_lengths != nullptr) { uprv_free(pieces_lengths); - pieces_lengths = NULL; + pieces_lengths = nullptr; } - if(current != NULL) { + if(current != nullptr) { uprv_free(current); - current = NULL; + current = nullptr; current_length = 0; } } @@ -119,7 +119,7 @@ UnicodeString CanonicalIterator::getSource() { * Resets the iterator so that one can start again from the beginning. */ void CanonicalIterator::reset() { - done = FALSE; + done = false; for (int i = 0; i < current_length; ++i) { current[i] = 0; } @@ -151,7 +151,7 @@ UnicodeString CanonicalIterator::next() { for (i = current_length - 1; ; --i) { if (i < 0) { - done = TRUE; + done = true; break; } current[i]++; @@ -170,13 +170,13 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st UChar32 cp = 0; int32_t start = 0; int32_t i = 0; - UnicodeString *list = NULL; + UnicodeString *list = nullptr; nfd.normalize(newSource, source, status); if(U_FAILURE(status)) { return; } - done = FALSE; + done = false; cleanPieces(); @@ -187,7 +187,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st pieces_length = 1; current = (int32_t*)uprv_malloc(1 * sizeof(int32_t)); current_length = 1; - if (pieces == NULL || pieces_lengths == NULL || current == NULL) { + if (pieces == nullptr || pieces_lengths == nullptr || current == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; goto CleanPartialInitialization; } @@ -208,10 +208,10 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st goto CleanPartialInitialization; } - // i should initialy be the number of code units at the + // i should initially be the number of code units at the // start of the string i = U16_LENGTH(source.char32At(0)); - //int32_t i = 1; + // int32_t i = 1; // find the segments // This code iterates through the source string and // extracts segments that end up on a codepoint that @@ -233,7 +233,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st pieces_lengths = (int32_t*)uprv_malloc(list_length * sizeof(int32_t)); current = (int32_t*)uprv_malloc(list_length * sizeof(int32_t)); current_length = list_length; - if (pieces == NULL || pieces_lengths == NULL || current == NULL) { + if (pieces == nullptr || pieces_lengths == nullptr || current == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; goto CleanPartialInitialization; } @@ -252,7 +252,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st return; // Common section to cleanup all local variables and reset object variables. CleanPartialInitialization: - if (list != NULL) { + if (list != nullptr) { delete[] list; } cleanPieces(); @@ -276,7 +276,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros // we check for length < 2 to keep from counting code points all the time if (source.length() <= 2 && source.countChar32() <= 1) { UnicodeString *toPut = new UnicodeString(source); - /* test for NULL */ + /* test for nullptr */ if (toPut == 0) { status = U_MEMORY_ALLOCATION_ERROR; return; @@ -295,7 +295,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros for (i = 0; i < source.length(); i += U16_LENGTH(cp)) { cp = source.char32At(i); - const UHashElement *ne = NULL; + const UHashElement *ne = nullptr; int32_t el = UHASH_FIRST; UnicodeString subPermuteString = source; @@ -321,11 +321,11 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros // prefix this character to all of them ne = subpermute.nextElement(el); - while (ne != NULL) { + while (ne != nullptr) { UnicodeString *permRes = (UnicodeString *)(ne->value.pointer); UnicodeString *chStr = new UnicodeString(cp); - //test for NULL - if (chStr == NULL) { + //test for nullptr + if (chStr == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -352,7 +352,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i permutations.setValueDeleter(uprv_deleteUObject); basic.setValueDeleter(uprv_deleteUObject); - UChar USeg[256]; + char16_t USeg[256]; int32_t segLen = segment.extract(USeg, 256, status); getEquivalents2(&basic, USeg, segLen, status); @@ -360,23 +360,23 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i // add only the ones that are canonically equivalent // TODO: optimize by not permuting any class zero. - const UHashElement *ne = NULL; + const UHashElement *ne = nullptr; int32_t el = UHASH_FIRST; //Iterator it = basic.iterator(); ne = basic.nextElement(el); //while (it.hasNext()) - while (ne != NULL) { + while (ne != nullptr) { //String item = (String) it.next(); UnicodeString item = *((UnicodeString *)(ne->value.pointer)); permutations.removeAll(); permute(item, CANITER_SKIP_ZEROES, &permutations, status); - const UHashElement *ne2 = NULL; + const UHashElement *ne2 = nullptr; int32_t el2 = UHASH_FIRST; //Iterator it2 = permutations.iterator(); ne2 = permutations.nextElement(el2); //while (it2.hasNext()) - while (ne2 != NULL) { + while (ne2 != nullptr) { //String possible = (String) it2.next(); //UnicodeString *possible = new UnicodeString(*((UnicodeString *)(ne2->value.pointer))); UnicodeString possible(*((UnicodeString *)(ne2->value.pointer))); @@ -403,24 +403,24 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i } // convert into a String[] to clean up storage //String[] finalResult = new String[result.size()]; - UnicodeString *finalResult = NULL; + UnicodeString *finalResult = nullptr; int32_t resultCount; if((resultCount = result.count()) != 0) { finalResult = new UnicodeString[resultCount]; if (finalResult == 0) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } } else { status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } //result.toArray(finalResult); result_len = 0; el = UHASH_FIRST; ne = result.nextElement(el); - while(ne != NULL) { + while(ne != nullptr) { finalResult[result_len++] = *((UnicodeString *)(ne->value.pointer)); ne = result.nextElement(el); } @@ -429,10 +429,10 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i return finalResult; } -Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status) { +Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } //if (PROGRESS) printf("Adding: %s\n", UToS(Tr(segment))); @@ -457,7 +457,7 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh UChar32 cp2 = iter.getCodepoint(); Hashtable remainder(status); remainder.setValueDeleter(uprv_deleteUObject); - if (extract(&remainder, cp2, segment, segLen, i, status) == NULL) { + if (extract(&remainder, cp2, segment, segLen, i, status) == nullptr) { continue; } @@ -467,13 +467,13 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh int32_t el = UHASH_FIRST; const UHashElement *ne = remainder.nextElement(el); - while (ne != NULL) { + while (ne != nullptr) { UnicodeString item = *((UnicodeString *)(ne->value.pointer)); UnicodeString *toAdd = new UnicodeString(prefix); - /* test for NULL */ + /* test for nullptr */ if (toAdd == 0) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } *toAdd += item; fillinResult->put(*toAdd, toAdd, status); @@ -487,23 +487,23 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh /* Test for buffer overflows */ if(U_FAILURE(status)) { - return NULL; + return nullptr; } return fillinResult; } /** * See if the decomposition of cp2 is at segment starting at segmentPos - * (with canonical rearrangment!) + * (with canonical rearrangement!) * If so, take the remainder, and return the equivalents */ -Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status) { +Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status) { //Hashtable *CanonicalIterator::extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status) { //if (PROGRESS) printf(" extract: %s, ", UToS(Tr(UnicodeString(comp)))); //if (PROGRESS) printf("%s, %i\n", UToS(Tr(segment)), segmentPos); if (U_FAILURE(status)) { - return NULL; + return nullptr; } UnicodeString temp(comp); @@ -511,17 +511,17 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con UnicodeString decompString; nfd.normalize(temp, decompString, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } if (decompString.isBogus()) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - const UChar *decomp=decompString.getBuffer(); + const char16_t *decomp=decompString.getBuffer(); int32_t decompLen=decompString.length(); // See if it matches the start of segment (at segmentPos) - UBool ok = FALSE; + UBool ok = false; UChar32 cp; int32_t decompPos = 0; UChar32 decompCp; @@ -537,7 +537,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con if (decompPos == decompLen) { // done, have all decomp characters! temp.append(segment+i, segLen-i); - ok = TRUE; + ok = true; break; } U16_NEXT(decomp, decompPos, decompLen, decompCp); @@ -561,7 +561,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con } } if (!ok) - return NULL; // we failed, characters left over + return nullptr; // we failed, characters left over //if (PROGRESS) printf("Matches\n"); @@ -575,7 +575,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con UnicodeString trial; nfd.normalize(temp, trial, status); if(U_FAILURE(status) || trial.compare(segment+segmentPos, segLen - segmentPos) != 0) { - return NULL; + return nullptr; } return getEquivalents2(fillinResult, temp.getBuffer()+inputLen, temp.length()-inputLen, status); diff --git a/src/duckdb/extension/icu/third_party/icu/common/characterproperties.cpp b/src/duckdb/extension/icu/third_party/icu/common/characterproperties.cpp index 7b50a4e20..f1e15b488 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/characterproperties.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/characterproperties.cpp @@ -14,6 +14,7 @@ #include "unicode/uscript.h" #include "unicode/uset.h" #include "cmemory.h" +#include "emojiprops.h" #include "mutex.h" #include "normalizer2impl.h" #include "uassert.h" @@ -35,11 +36,11 @@ namespace { UBool U_CALLCONV characterproperties_cleanup(); -constexpr int32_t NUM_INCLUSIONS = UPROPS_SRC_COUNT + UCHAR_INT_LIMIT - UCHAR_INT_START; +constexpr int32_t NUM_INCLUSIONS = UPROPS_SRC_COUNT + (UCHAR_INT_LIMIT - UCHAR_INT_START); struct Inclusion { UnicodeSet *fSet = nullptr; - UInitOnce fInitOnce = U_INITONCE_INITIALIZER; + UInitOnce fInitOnce {}; }; Inclusion gInclusions[NUM_INCLUSIONS]; // cached getInclusions() @@ -66,7 +67,7 @@ _set_addRange(USet *set, UChar32 start, UChar32 end) { } void U_CALLCONV -_set_addString(USet *set, const UChar *str, int32_t length) { +_set_addString(USet *set, const char16_t *str, int32_t length) { ((UnicodeSet *)set)->add(icu::UnicodeString((UBool)(length<0), str, length)); } @@ -84,7 +85,7 @@ UBool U_CALLCONV characterproperties_cleanup() { ucptrie_close(reinterpret_cast(maps[i])); maps[i] = nullptr; } - return TRUE; + return true; } void U_CALLCONV initInclusion(UPropertySource src, UErrorCode &errorCode) { @@ -168,7 +169,22 @@ void U_CALLCONV initInclusion(UPropertySource src, UErrorCode &errorCode) { case UPROPS_SRC_INPC: case UPROPS_SRC_INSC: case UPROPS_SRC_VO: - uprops_addPropertyStarts((UPropertySource)src, &sa, &errorCode); + uprops_addPropertyStarts(src, &sa, &errorCode); + break; + case UPROPS_SRC_EMOJI: { + const icu::EmojiProps *ep = icu::EmojiProps::getSingleton(errorCode); + if (U_SUCCESS(errorCode)) { + ep->addPropertyStarts(&sa, errorCode); + } + break; + } + case UPROPS_SRC_IDSU: + // New in Unicode 15.1 for just two characters. + sa.add(sa.set, 0x2FFE); + sa.add(sa.set, 0x2FFF + 1); + break; + case UPROPS_SRC_ID_COMPAT_MATH: + uprops_addPropertyStarts(src, &sa, &errorCode); break; default: errorCode = U_INTERNAL_PROGRAM_ERROR; @@ -202,7 +218,7 @@ const UnicodeSet *getInclusionsForSource(UPropertySource src, UErrorCode &errorC 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; + 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); @@ -247,7 +263,7 @@ 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; + int32_t inclIndex = UPROPS_SRC_COUNT + (prop - UCHAR_INT_START); Inclusion &i = gInclusions[inclIndex]; umtx_initOnce(i.fInitOnce, &initIntPropInclusion, prop, errorCode); return i.fSet; @@ -268,6 +284,26 @@ UnicodeSet *makeSet(UProperty property, UErrorCode &errorCode) { errorCode = U_MEMORY_ALLOCATION_ERROR; return nullptr; } + if (UCHAR_BASIC_EMOJI <= property && property <= UCHAR_RGI_EMOJI) { + // property of strings + const icu::EmojiProps *ep = icu::EmojiProps::getSingleton(errorCode); + if (U_FAILURE(errorCode)) { return nullptr; } + USetAdder sa = { + (USet *)set.getAlias(), + _set_add, + _set_addRange, + _set_addString, + nullptr, // don't need remove() + nullptr // don't need removeRange() + }; + ep->addStrings(&sa, property, errorCode); + if (property != UCHAR_BASIC_EMOJI && property != UCHAR_RGI_EMOJI) { + // property of _only_ strings + set->freeze(); + return set.orphan(); + } + } + const UnicodeSet *inclusions = icu::CharacterProperties::getInclusionsForProperty(property, errorCode); if (U_FAILURE(errorCode)) { return nullptr; } @@ -349,22 +385,30 @@ UCPMap *makeMap(UProperty property, UErrorCode &errorCode) { } // namespace -U_NAMESPACE_USE +U_NAMESPACE_BEGIN -U_CAPI const USet * U_EXPORT2 -u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode) { - if (U_FAILURE(*pErrorCode)) { return nullptr; } +const UnicodeSet *CharacterProperties::getBinaryPropertySet(UProperty property, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return nullptr; } if (property < 0 || UCHAR_BINARY_LIMIT <= property) { - *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; + errorCode = U_ILLEGAL_ARGUMENT_ERROR; return nullptr; } Mutex m(&cpMutex); UnicodeSet *set = sets[property]; if (set == nullptr) { - sets[property] = set = makeSet(property, *pErrorCode); + sets[property] = set = makeSet(property, errorCode); } - if (U_FAILURE(*pErrorCode)) { return nullptr; } - return set->toUSet(); + return set; +} + +U_NAMESPACE_END + +U_NAMESPACE_USE + +U_CAPI const USet * U_EXPORT2 +u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode) { + const UnicodeSet *set = CharacterProperties::getBinaryPropertySet(property, *pErrorCode); + return U_SUCCESS(*pErrorCode) ? set->toUSet() : nullptr; } U_CAPI const UCPMap * U_EXPORT2 diff --git a/src/duckdb/extension/icu/third_party/icu/common/chariter.cpp b/src/duckdb/extension/icu/third_party/icu/common/chariter.cpp index 887119a0e..16f3b1e14 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/chariter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/chariter.cpp @@ -85,14 +85,14 @@ CharacterIterator::operator=(const CharacterIterator &that) { // implementing first[32]PostInc() directly in a subclass should be faster // but these implementations make subclassing a little easier -UChar -CharacterIterator::firstPostInc(void) { +char16_t +CharacterIterator::firstPostInc() { setToStart(); return nextPostInc(); } UChar32 -CharacterIterator::first32PostInc(void) { +CharacterIterator::first32PostInc() { setToStart(); return next32PostInc(); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/charstr.cpp b/src/duckdb/extension/icu/third_party/icu/common/charstr.cpp index dda29dac6..f76cc8a4d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/charstr.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/charstr.cpp @@ -14,21 +14,24 @@ * created by: Markus W. Scherer */ +#include + #include "unicode/utypes.h" #include "unicode/putil.h" #include "charstr.h" #include "cmemory.h" #include "cstring.h" #include "uinvchar.h" +#include "ustr_imp.h" U_NAMESPACE_BEGIN -CharString::CharString(CharString&& src) U_NOEXCEPT +CharString::CharString(CharString&& src) 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 { +CharString& CharString::operator=(CharString&& src) noexcept { buffer = std::move(src.buffer); len = src.len; src.len = 0; // not strictly necessary because we make no guarantees on the source string @@ -46,6 +49,19 @@ char *CharString::cloneData(UErrorCode &errorCode) const { return p; } +int32_t CharString::extract(char *dest, int32_t capacity, UErrorCode &errorCode) const { + if (U_FAILURE(errorCode)) { return len; } + if (capacity < 0 || (capacity > 0 && dest == nullptr)) { + errorCode = U_ILLEGAL_ARGUMENT_ERROR; + return len; + } + const char *src = buffer.getAlias(); + if (0 < len && len <= capacity && src != dest) { + uprv_memcpy(dest, src, len); + } + return u_terminateChars(dest, capacity, len, &errorCode); +} + CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) { if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) { len=s.len; @@ -97,7 +113,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error if(U_FAILURE(errorCode)) { return *this; } - if(sLength<-1 || (s==NULL && sLength!=0)) { + if(sLength<-1 || (s==nullptr && sLength!=0)) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; return *this; } @@ -127,13 +143,45 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error return *this; } +CharString &CharString::appendNumber(int32_t number, UErrorCode &status) { + if (number < 0) { + this->append('-', status); + if (U_FAILURE(status)) { + return *this; + } + } + + if (number == 0) { + this->append('0', status); + return *this; + } + + int32_t numLen = 0; + while (number != 0) { + int32_t residue = number % 10; + number /= 10; + this->append(std::abs(residue) + '0', status); + numLen++; + if (U_FAILURE(status)) { + return *this; + } + } + + int32_t start = this->length() - numLen, end = this->length() - 1; + while(start < end) { + std::swap(this->data()[start++], this->data()[end--]); + } + + return *this; +} + char *CharString::getAppendBuffer(int32_t minCapacity, int32_t desiredCapacityHint, int32_t &resultCapacity, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { resultCapacity=0; - return NULL; + return nullptr; } int32_t appendCapacity=buffer.getCapacity()-len-1; // -1 for NUL if(appendCapacity>=minCapacity) { @@ -145,14 +193,14 @@ char *CharString::getAppendBuffer(int32_t minCapacity, return buffer.getAlias()+len; } resultCapacity=0; - return NULL; + return nullptr; } 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) { +CharString &CharString::appendInvariantChars(const char16_t* uchars, int32_t ucharsLen, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return *this; } @@ -172,20 +220,20 @@ UBool CharString::ensureCapacity(int32_t capacity, int32_t desiredCapacityHint, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } if(capacity>buffer.getCapacity()) { if(desiredCapacityHint==0) { desiredCapacityHint=capacity+buffer.getCapacity(); } - if( (desiredCapacityHint<=capacity || buffer.resize(desiredCapacityHint, len+1)==NULL) && - buffer.resize(capacity, len+1)==NULL + if( (desiredCapacityHint<=capacity || buffer.resize(desiredCapacityHint, len+1)==nullptr) && + buffer.resize(capacity, len+1)==nullptr ) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } } - return TRUE; + return true; } CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) { @@ -197,7 +245,7 @@ CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) { } char c; if(len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) { - append(U_FILE_SEP_CHAR, errorCode); + append(getDirSepChar(), errorCode); } append(s, errorCode); return *this; @@ -207,9 +255,19 @@ CharString &CharString::ensureEndsWithFileSeparator(UErrorCode &errorCode) { char c; if(U_SUCCESS(errorCode) && len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) { - append(U_FILE_SEP_CHAR, errorCode); + append(getDirSepChar(), errorCode); } return *this; } +char CharString::getDirSepChar() const { + char dirSepChar = U_FILE_SEP_CHAR; +#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) + // We may need to return a different directory separator when building for Cygwin or MSYS2. + if(len>0 && !uprv_strchr(data(), U_FILE_SEP_CHAR) && uprv_strchr(data(), U_FILE_ALT_SEP_CHAR)) + dirSepChar = U_FILE_ALT_SEP_CHAR; +#endif + return dirSepChar; +} + U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/charstr.h b/src/duckdb/extension/icu/third_party/icu/common/charstr.h index 23b950ed6..7749a804b 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/charstr.h +++ b/src/duckdb/extension/icu/third_party/icu/common/charstr.h @@ -59,13 +59,13 @@ class U_COMMON_API CharString : public UMemory { * 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; + CharString(CharString &&src) 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; + CharString &operator=(CharString &&src) noexcept; /** * Replaces this string's contents with the other string's contents. @@ -87,6 +87,22 @@ class U_COMMON_API CharString : public UMemory { * The caller must uprv_free() the result. */ char *cloneData(UErrorCode &errorCode) const; + /** + * Copies the contents of the string into dest. + * Checks if there is enough space in dest, extracts the entire string if possible, + * and NUL-terminates dest if possible. + * + * If the string fits into dest but cannot be NUL-terminated (length()==capacity), + * then the error code is set to U_STRING_NOT_TERMINATED_WARNING. + * If the string itself does not fit into dest (length()>capacity), + * then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * + * @param dest Destination string buffer. + * @param capacity Size of the dest buffer (number of chars). + * @param errorCode ICU error code. + * @return length() + */ + int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; bool operator==(StringPiece other) const { return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); @@ -111,6 +127,9 @@ class U_COMMON_API CharString : public UMemory { return append(s.data(), s.length(), errorCode); } CharString &append(const char *s, int32_t sLength, UErrorCode &status); + + CharString &appendNumber(int32_t number, UErrorCode &status); + /** * Returns a writable buffer for appending and writes the buffer's capacity to * resultCapacity. Guarantees resultCapacity>=minCapacity if U_SUCCESS(). @@ -137,17 +156,17 @@ class U_COMMON_API CharString : public UMemory { UErrorCode &errorCode); CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode); - CharString &appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode& errorCode); + CharString &appendInvariantChars(const char16_t* uchars, int32_t ucharsLen, UErrorCode& errorCode); /** * Appends a filename/path part, e.g., a directory name. - * First appends a U_FILE_SEP_CHAR if necessary. + * First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary. * Does nothing if s is empty. */ CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); /** - * Appends a U_FILE_SEP_CHAR if this string is not empty + * Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty * and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR. */ CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); @@ -158,8 +177,14 @@ class U_COMMON_API CharString : public UMemory { UBool ensureCapacity(int32_t capacity, int32_t desiredCapacityHint, UErrorCode &errorCode); - CharString(const CharString &other); // forbid copying of this class - CharString &operator=(const CharString &other); // forbid copying of this class + CharString(const CharString &other) = delete; // forbid copying of this class + CharString &operator=(const CharString &other) = delete; // forbid copying of this class + + /** + * Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found. + * Otherwise returns U_FILE_SEP_CHAR. + */ + char getDirSepChar() const; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/charstrmap.h b/src/duckdb/extension/icu/third_party/icu/common/charstrmap.h new file mode 100644 index 000000000..64d5fd125 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/common/charstrmap.h @@ -0,0 +1,55 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// charstrmap.h +// created: 2020sep01 Frank Yung-Fong Tang + +#ifndef __CHARSTRMAP_H__ +#define __CHARSTRMAP_H__ + +#include +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "uhash.h" + +U_NAMESPACE_BEGIN + +/** + * Map of const char * keys & values. + * Stores pointers as is: Does not own/copy/adopt/release strings. + */ +class CharStringMap final : public UMemory { +public: + /** Constructs an unusable non-map. */ + CharStringMap() : map(nullptr) {} + CharStringMap(int32_t size, UErrorCode &errorCode) { + map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars, + size, &errorCode); + } + CharStringMap(CharStringMap &&other) noexcept : map(other.map) { + other.map = nullptr; + } + CharStringMap(const CharStringMap &other) = delete; + ~CharStringMap() { + uhash_close(map); + } + + CharStringMap &operator=(CharStringMap &&other) noexcept { + map = other.map; + other.map = nullptr; + return *this; + } + CharStringMap &operator=(const CharStringMap &other) = delete; + + const char *get(const char *key) const { return static_cast(uhash_get(map, key)); } + void put(const char *key, const char *value, UErrorCode &errorCode) { + uhash_put(map, const_cast(key), const_cast(value), &errorCode); + } + +private: + UHashtable *map; +}; + +U_NAMESPACE_END + +#endif // __CHARSTRMAP_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/common/cmemory.cpp b/src/duckdb/extension/icu/third_party/icu/common/cmemory.cpp index 663c1411e..e59d4b0ef 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/cmemory.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/cmemory.cpp @@ -15,8 +15,8 @@ * If you have a need to replace ICU allocation, this is the * place to do it. * -* Note that uprv_malloc(0) returns a non-NULL pointer, and -* that a subsequent free of that pointer value is a NOP. +* Note that uprv_malloc(0) returns a non-nullptr pointer, +* and that a subsequent free of that pointer value is a NOP. * ****************************************************************************** */ @@ -103,7 +103,7 @@ uprv_free(void *buffer) { U_CAPI void * U_EXPORT2 uprv_calloc(size_t num, size_t size) { - void *mem = NULL; + void *mem = nullptr; size *= num; mem = uprv_malloc(size); if (mem) { @@ -118,7 +118,7 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem if (U_FAILURE(*status)) { return; } - if (a==NULL || r==NULL || f==NULL) { + if (a==nullptr || r==nullptr || f==nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -129,10 +129,10 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem } -U_CFUNC UBool cmemory_cleanup(void) { - pContext = NULL; - pAlloc = NULL; - pRealloc = NULL; - pFree = NULL; - return TRUE; +U_CFUNC UBool cmemory_cleanup() { + pContext = nullptr; + pAlloc = nullptr; + pRealloc = nullptr; + pFree = nullptr; + return true; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/cmemory.h b/src/duckdb/extension/icu/third_party/icu/common/cmemory.h index 7f7fd8d08..3705c2dfd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/cmemory.h +++ b/src/duckdb/extension/icu/third_party/icu/common/cmemory.h @@ -31,14 +31,63 @@ #include #include #include "unicode/localpointer.h" +#include "uassert.h" #if U_DEBUG && defined(UPRV_MALLOC_COUNT) #include #endif - -#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) +// uprv_memcpy and uprv_memmove +#if defined(__clang__) +#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("clang diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("clang diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#elif defined(__GNUC__) +#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("GCC diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + /* Suppress warnings about addresses that will never be NULL */ \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Waddress\"") \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + _Pragma("GCC diagnostic pop") \ + U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#else +#define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ + U_ASSERT(dst != NULL); \ + U_ASSERT(src != NULL); \ + U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ +} UPRV_BLOCK_MACRO_END +#endif /** * \def UPRV_LENGTHOF @@ -143,13 +192,13 @@ class LocalMemory : public LocalPointerBase { * Constructor takes ownership. * @param p simple pointer to an array of T items that is adopted */ - explicit LocalMemory(T *p=NULL) : LocalPointerBase(p) {} + explicit LocalMemory(T *p=nullptr) : LocalPointerBase(p) {} /** * Move constructor, leaves src with isNull(). * @param src source smart pointer */ - LocalMemory(LocalMemory &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { - src.ptr=NULL; + LocalMemory(LocalMemory &&src) noexcept : LocalPointerBase(src.ptr) { + src.ptr=nullptr; } /** * Destructor deletes the memory it owns. @@ -163,17 +212,17 @@ class LocalMemory : public LocalPointerBase { * @param src source smart pointer * @return *this */ - LocalMemory &operator=(LocalMemory &&src) U_NOEXCEPT { + LocalMemory &operator=(LocalMemory &&src) noexcept { uprv_free(LocalPointerBase::ptr); LocalPointerBase::ptr=src.ptr; - src.ptr=NULL; + src.ptr=nullptr; return *this; } /** * Swap pointers. * @param other other smart pointer */ - void swap(LocalMemory &other) U_NOEXCEPT { + void swap(LocalMemory &other) noexcept { T *temp=LocalPointerBase::ptr; LocalPointerBase::ptr=other.ptr; other.ptr=temp; @@ -183,7 +232,7 @@ class LocalMemory : public LocalPointerBase { * @param p1 will get p2's pointer * @param p2 will get p1's pointer */ - friend inline void swap(LocalMemory &p1, LocalMemory &p2) U_NOEXCEPT { + friend inline void swap(LocalMemory &p1, LocalMemory &p2) noexcept { p1.swap(p2); } /** @@ -199,21 +248,21 @@ class LocalMemory : public LocalPointerBase { * Deletes the array it owns, allocates a new one and reset its bytes to 0. * Returns the new array pointer. * If the allocation fails, then the current array is unchanged and - * this method returns NULL. + * this method returns nullptr. * @param newCapacity must be >0 - * @return the allocated array pointer, or NULL if the allocation failed + * @return the allocated array pointer, or nullptr if the allocation failed */ inline T *allocateInsteadAndReset(int32_t newCapacity=1); /** * Deletes the array it owns and allocates a new one, copying length T items. * Returns the new array pointer. * If the allocation fails, then the current array is unchanged and - * this method returns NULL. + * this method returns nullptr. * @param newCapacity must be >0 * @param length number of T items to be copied from the old array to the new one; * must be no more than the capacity of the old array, * which the caller must track because the LocalMemory does not track it - * @return the allocated array pointer, or NULL if the allocation failed + * @return the allocated array pointer, or nullptr if the allocation failed */ inline T *allocateInsteadAndCopy(int32_t newCapacity=1, int32_t length=0); /** @@ -229,14 +278,14 @@ template inline T *LocalMemory::allocateInsteadAndReset(int32_t newCapacity) { if(newCapacity>0) { T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); - if(p!=NULL) { + if(p!=nullptr) { uprv_memset(p, 0, newCapacity*sizeof(T)); uprv_free(LocalPointerBase::ptr); LocalPointerBase::ptr=p; } return p; } else { - return NULL; + return nullptr; } } @@ -245,7 +294,7 @@ template inline T *LocalMemory::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) { if(newCapacity>0) { T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); - if(p!=NULL) { + if(p!=nullptr) { if(length>0) { if(length>newCapacity) { length=newCapacity; @@ -257,7 +306,7 @@ inline T *LocalMemory::allocateInsteadAndCopy(int32_t newCapacity, int32_t le } return p; } else { - return NULL; + return nullptr; } } @@ -274,29 +323,39 @@ inline T *LocalMemory::allocateInsteadAndCopy(int32_t newCapacity, int32_t le * * 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 or MemoryPool. + * destructors, consider: + * + * - LocalArray in localpointer.h if you know the length ahead of time + * - MaybeStackVector if you know the length at runtime */ template class MaybeStackArray { public: // No heap allocation. Use only on the stack. - static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete; - static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t) noexcept = delete; + static void* U_EXPORT2 operator new[](size_t) noexcept = delete; #if U_HAVE_PLACEMENT_NEW - static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; #endif /** * Default constructor initializes with internal T[stackCapacity] buffer. */ - MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(FALSE) {} + MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} /** * Automatically allocates the heap array if the argument is larger than the stack capacity. * Intended for use when an approximate capacity is known at compile time but the true * capacity is not known until runtime. */ - MaybeStackArray(int32_t newCapacity) : MaybeStackArray() { - if (capacity < newCapacity) { resize(newCapacity); } + MaybeStackArray(int32_t newCapacity, UErrorCode status) : MaybeStackArray() { + if (U_FAILURE(status)) { + return; + } + if (capacity < newCapacity) { + if (resize(newCapacity) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + } } /** * Destructor deletes the array (if owned). @@ -305,11 +364,11 @@ class MaybeStackArray { /** * Move constructor: transfers ownership or copies the stack array. */ - MaybeStackArray(MaybeStackArray &&src) U_NOEXCEPT; + MaybeStackArray(MaybeStackArray &&src) noexcept; /** * Move assignment: transfers ownership or copies the stack array. */ - MaybeStackArray &operator=(MaybeStackArray &&src) U_NOEXCEPT; + MaybeStackArray &operator=(MaybeStackArray &&src) noexcept; /** * Returns the array capacity (number of T items). * @return array capacity @@ -344,32 +403,32 @@ class MaybeStackArray { /** * Deletes the array (if owned) and aliases another one, no transfer of ownership. * If the arguments are illegal, then the current array is unchanged. - * @param otherArray must not be NULL + * @param otherArray must not be nullptr * @param otherCapacity must be >0 */ void aliasInstead(T *otherArray, int32_t otherCapacity) { - if(otherArray!=NULL && otherCapacity>0) { + if(otherArray!=nullptr && otherCapacity>0) { releaseArray(); ptr=otherArray; capacity=otherCapacity; - needToRelease=FALSE; + needToRelease=false; } } /** * Deletes the array (if owned) and allocates a new one, copying length T items. * Returns the new array pointer. * If the allocation fails, then the current array is unchanged and - * this method returns NULL. + * this method returns nullptr. * @param newCapacity can be less than or greater than the current capacity; * must be >0 * @param length number of T items to be copied from the old array to the new one - * @return the allocated array pointer, or NULL if the allocation failed + * @return the allocated array pointer, or nullptr if the allocation failed */ inline T *resize(int32_t newCapacity, int32_t length=0); /** * Gives up ownership of the array if owned, or else clones it, * copying length T items; resets itself to the internal stack array. - * Returns NULL if the allocation failed. + * Returns nullptr if the allocation failed. * @param length number of T items to copy when cloning, * and capacity of the clone when cloning * @param resultCapacity will be set to the returned array's capacity (output-only) @@ -377,6 +436,20 @@ class MaybeStackArray { * caller becomes responsible for deleting the array */ inline T *orphanOrClone(int32_t length, int32_t &resultCapacity); + +protected: + // Resizes the array to the size of src, then copies the contents of src. + void copyFrom(const MaybeStackArray &src, UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + if (this->resize(src.capacity, 0) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memcpy(this->ptr, src.ptr, (size_t)capacity * sizeof(T)); + } + private: T *ptr; int32_t capacity; @@ -390,19 +463,19 @@ class MaybeStackArray { void resetToStackArray() { ptr=stackArray; capacity=stackCapacity; - needToRelease=FALSE; + needToRelease=false; } /* No comparison operators with other MaybeStackArray's. */ - bool operator==(const MaybeStackArray & /*other*/) {return FALSE;} - bool operator!=(const MaybeStackArray & /*other*/) {return TRUE;} + bool operator==(const MaybeStackArray & /*other*/) = delete; + bool operator!=(const MaybeStackArray & /*other*/) = delete; /* No ownership transfer: No copy constructor, no assignment operator. */ - MaybeStackArray(const MaybeStackArray & /*other*/) {} - void operator=(const MaybeStackArray & /*other*/) {} + MaybeStackArray(const MaybeStackArray & /*other*/) = delete; + void operator=(const MaybeStackArray & /*other*/) = delete; }; template icu::MaybeStackArray::MaybeStackArray( - MaybeStackArray && src) U_NOEXCEPT + MaybeStackArray && src) noexcept : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { if (src.ptr == src.stackArray) { ptr = stackArray; @@ -414,7 +487,7 @@ icu::MaybeStackArray::MaybeStackArray( template inline MaybeStackArray & -MaybeStackArray::operator=(MaybeStackArray && src) U_NOEXCEPT { +MaybeStackArray::operator=(MaybeStackArray && src) noexcept { releaseArray(); // in case this instance had its own memory allocated capacity = src.capacity; needToRelease = src.needToRelease; @@ -432,10 +505,10 @@ template inline T *MaybeStackArray::resize(int32_t newCapacity, int32_t length) { if(newCapacity>0) { #if U_DEBUG && defined(UPRV_MALLOC_COUNT) - ::fprintf(::stderr,"MaybeStacArray (resize) alloc %d * %lu\n", newCapacity,sizeof(T)); + ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); #endif T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); - if(p!=NULL) { + if(p!=nullptr) { if(length>0) { if(length>capacity) { length=capacity; @@ -448,11 +521,11 @@ inline T *MaybeStackArray::resize(int32_t newCapacity, int32_t releaseArray(); ptr=p; capacity=newCapacity; - needToRelease=TRUE; + needToRelease=true; } return p; } else { - return NULL; + return nullptr; } } @@ -462,7 +535,7 @@ inline T *MaybeStackArray::orphanOrClone(int32_t length, int32 if(needToRelease) { p=ptr; } else if(length<=0) { - return NULL; + return nullptr; } else { if(length>capacity) { length=capacity; @@ -471,8 +544,8 @@ inline T *MaybeStackArray::orphanOrClone(int32_t length, int32 #if U_DEBUG && defined(UPRV_MALLOC_COUNT) ::fprintf(::stderr,"MaybeStacArray (orphan) alloc %d * %lu\n", length,sizeof(T)); #endif - if(p==NULL) { - return NULL; + if(p==nullptr) { + return nullptr; } uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); } @@ -495,16 +568,16 @@ template class MaybeStackHeaderAndArray { public: // No heap allocation. Use only on the stack. - static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete; - static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t) noexcept = delete; + static void* U_EXPORT2 operator new[](size_t) noexcept = delete; #if U_HAVE_PLACEMENT_NEW - static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; #endif /** * Default constructor initializes with internal H+T[stackCapacity] buffer. */ - MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(FALSE) {} + MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(false) {} /** * Destructor deletes the memory (if owned). */ @@ -545,15 +618,15 @@ class MaybeStackHeaderAndArray { /** * Deletes the memory block (if owned) and aliases another one, no transfer of ownership. * If the arguments are illegal, then the current memory is unchanged. - * @param otherArray must not be NULL + * @param otherArray must not be nullptr * @param otherCapacity must be >0 */ void aliasInstead(H *otherMemory, int32_t otherCapacity) { - if(otherMemory!=NULL && otherCapacity>0) { + if(otherMemory!=nullptr && otherCapacity>0) { releaseMemory(); ptr=otherMemory; capacity=otherCapacity; - needToRelease=FALSE; + needToRelease=false; } } /** @@ -561,17 +634,17 @@ class MaybeStackHeaderAndArray { * copying the header and length T array items. * Returns the new header pointer. * If the allocation fails, then the current memory is unchanged and - * this method returns NULL. + * this method returns nullptr. * @param newCapacity can be less than or greater than the current capacity; * must be >0 * @param length number of T items to be copied from the old array to the new one - * @return the allocated pointer, or NULL if the allocation failed + * @return the allocated pointer, or nullptr if the allocation failed */ inline H *resize(int32_t newCapacity, int32_t length=0); /** * Gives up ownership of the memory if owned, or else clones it, * copying the header and length T array items; resets itself to the internal memory. - * Returns NULL if the allocation failed. + * Returns nullptr if the allocation failed. * @param length number of T items to copy when cloning, * and array capacity of the clone when cloning * @param resultCapacity will be set to the returned array's capacity (output-only) @@ -592,8 +665,8 @@ class MaybeStackHeaderAndArray { } } /* No comparison operators with other MaybeStackHeaderAndArray's. */ - bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return FALSE;} - bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return TRUE;} + bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return false;} + bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return true;} /* No ownership transfer: No copy constructor, no assignment operator. */ MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {} void operator=(const MaybeStackHeaderAndArray & /*other*/) {} @@ -607,7 +680,7 @@ inline H *MaybeStackHeaderAndArray::resize(int32_t newCapac ::fprintf(::stderr,"MaybeStackHeaderAndArray alloc %d + %d * %ul\n", sizeof(H),newCapacity,sizeof(T)); #endif H *p=(H *)uprv_malloc(sizeof(H)+newCapacity*sizeof(T)); - if(p!=NULL) { + if(p!=nullptr) { if(length<0) { length=0; } else if(length>0) { @@ -622,11 +695,11 @@ inline H *MaybeStackHeaderAndArray::resize(int32_t newCapac releaseMemory(); ptr=p; capacity=newCapacity; - needToRelease=TRUE; + needToRelease=true; } return p; } else { - return NULL; + return nullptr; } } @@ -646,15 +719,15 @@ inline H *MaybeStackHeaderAndArray::orphanOrClone(int32_t l ::fprintf(::stderr,"MaybeStackHeaderAndArray (orphan) alloc %ul + %d * %lu\n", sizeof(H),length,sizeof(T)); #endif p=(H *)uprv_malloc(sizeof(H)+length*sizeof(T)); - if(p==NULL) { - return NULL; + if(p==nullptr) { + return nullptr; } uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T)); } resultCapacity=length; ptr=&stackHeader; capacity=stackCapacity; - needToRelease=FALSE; + needToRelease=false; return p; } @@ -684,26 +757,31 @@ inline H *MaybeStackHeaderAndArray::orphanOrClone(int32_t l template class MemoryPool : public UMemory { public: - MemoryPool() : count(0), pool() {} + MemoryPool() : fCount(0), fPool() {} ~MemoryPool() { - for (int32_t i = 0; i < count; ++i) { - delete pool[i]; + for (int32_t i = 0; i < fCount; ++i) { + delete fPool[i]; } } MemoryPool(const MemoryPool&) = delete; MemoryPool& operator=(const MemoryPool&) = delete; - MemoryPool(MemoryPool&& other) U_NOEXCEPT : count(other.count), - pool(std::move(other.pool)) { - other.count = 0; + MemoryPool(MemoryPool&& other) noexcept : fCount(other.fCount), + fPool(std::move(other.fPool)) { + other.fCount = 0; } - MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT { - count = other.count; - pool = std::move(other.pool); - other.count = 0; + MemoryPool& operator=(MemoryPool&& other) noexcept { + // Since `this` may contain instances that need to be deleted, we can't + // just throw them away and replace them with `other`. The normal way of + // dealing with this in C++ is to swap `this` and `other`, rather than + // simply overwrite: the destruction of `other` can then take care of + // running MemoryPool::~MemoryPool() over the still-to-be-deallocated + // instances. + std::swap(fCount, other.fCount); + std::swap(fPool, other.fPool); return *this; } @@ -716,20 +794,106 @@ class MemoryPool : public UMemory { */ template T* create(Args&&... args) { - int32_t capacity = pool.getCapacity(); - if (count == capacity && - pool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, - capacity) == nullptr) { + int32_t capacity = fPool.getCapacity(); + if (fCount == capacity && + fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, + capacity) == nullptr) { return nullptr; } - return pool[count++] = new T(std::forward(args)...); + return fPool[fCount++] = new T(std::forward(args)...); } -private: - int32_t count; - MaybeStackArray pool; + template + T* createAndCheckErrorCode(UErrorCode &status, Args &&... args) { + if (U_FAILURE(status)) { + return nullptr; + } + T *pointer = this->create(args...); + if (U_SUCCESS(status) && pointer == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + return pointer; + } + + /** + * @return Number of elements that have been allocated. + */ + int32_t count() const { + return fCount; + } + +protected: + int32_t fCount; + MaybeStackArray fPool; +}; + +/** + * An internal Vector-like implementation based on MemoryPool. + * + * Heap-allocates each element and stores pointers. + * + * To append an item to the vector, use emplaceBack. + * + * MaybeStackVector vector; + * MyType* element = vector.emplaceBack(); + * if (!element) { + * status = U_MEMORY_ALLOCATION_ERROR; + * } + * // do stuff with element + * + * To loop over the vector, use a for loop with indices: + * + * for (int32_t i = 0; i < vector.length(); i++) { + * MyType* element = vector[i]; + * } + */ +template +class MaybeStackVector : protected MemoryPool { +public: + template + T* emplaceBack(Args&&... args) { + return this->create(args...); + } + + template + T *emplaceBackAndCheckErrorCode(UErrorCode &status, Args &&... args) { + return this->createAndCheckErrorCode(status, args...); + } + + int32_t length() const { + return this->fCount; + } + + T** getAlias() { + return this->fPool.getAlias(); + } + + const T *const *getAlias() const { + return this->fPool.getAlias(); + } + + /** + * Array item access (read-only). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + const T* operator[](ptrdiff_t i) const { + return this->fPool[i]; + } + + /** + * Array item access (writable). + * No index bounds check. + * @param i array index + * @return reference to the array item + */ + T* operator[](ptrdiff_t i) { + return this->fPool[i]; + } }; + U_NAMESPACE_END #endif /* __cplusplus */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/cpputils.h b/src/duckdb/extension/icu/third_party/icu/common/cpputils.h index 1e9a9909b..2eda999a6 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/cpputils.h +++ b/src/duckdb/extension/icu/third_party/icu/common/cpputils.h @@ -24,47 +24,47 @@ /* Array copy utility functions */ /*==========================================================================*/ -// static -// inline void uprv_arrayCopy(const double* src, double* dst, int32_t count) -// { uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } +static +inline void uprv_arrayCopy(const double* src, double* dst, int32_t count) +{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } -// static -// inline void uprv_arrayCopy(const double* src, int32_t srcStart, -// double* dst, int32_t dstStart, int32_t count) -// { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } +static +inline void uprv_arrayCopy(const double* src, int32_t srcStart, + double* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } static inline void uprv_arrayCopy(const int8_t* src, int8_t* dst, int32_t count) { uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } -// static -// inline void uprv_arrayCopy(const int8_t* src, int32_t srcStart, -// int8_t* dst, int32_t dstStart, int32_t count) -// { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } +static +inline void uprv_arrayCopy(const int8_t* src, int32_t srcStart, + int8_t* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } -// static -// inline void uprv_arrayCopy(const int16_t* src, int16_t* dst, int32_t count) -// { uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } +static +inline void uprv_arrayCopy(const int16_t* src, int16_t* dst, int32_t count) +{ uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } -// static -// inline void uprv_arrayCopy(const int16_t* src, int32_t srcStart, -// int16_t* dst, int32_t dstStart, int32_t count) -// { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } +static +inline void uprv_arrayCopy(const int16_t* src, int32_t srcStart, + int16_t* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } static inline void uprv_arrayCopy(const int32_t* src, int32_t* dst, int32_t count) { uprv_memcpy(dst, src, (size_t)count * sizeof(*src)); } -// static -// inline void uprv_arrayCopy(const int32_t* src, int32_t srcStart, -// int32_t* dst, int32_t dstStart, int32_t count) -// { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } +static +inline void uprv_arrayCopy(const int32_t* src, int32_t srcStart, + int32_t* dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } -// static -// inline void -// uprv_arrayCopy(const UChar *src, int32_t srcStart, -// UChar *dst, int32_t dstStart, int32_t count) -// { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } +static +inline void +uprv_arrayCopy(const char16_t *src, int32_t srcStart, + char16_t *dst, int32_t dstStart, int32_t count) +{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); } /** * Copy an array of UnicodeString OBJECTS (not pointers). diff --git a/src/duckdb/extension/icu/third_party/icu/common/cstr.cpp b/src/duckdb/extension/icu/third_party/icu/common/cstr.cpp index 24654f8fc..b87597e45 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/cstr.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/cstr.cpp @@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN CStr::CStr(const UnicodeString &in) { UErrorCode status = U_ZERO_ERROR; #if !UCONFIG_NO_CONVERSION || U_CHARSET_IS_UTF8 - int32_t length = in.extract(0, in.length(), static_cast(NULL), static_cast(0)); + int32_t length = in.extract(0, in.length(), static_cast(nullptr), static_cast(0)); int32_t resultCapacity = 0; char *buf = s.getAppendBuffer(length, length, resultCapacity, status); if (U_SUCCESS(status)) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/cstr.h b/src/duckdb/extension/icu/third_party/icu/common/cstr.h index c33f487ea..be21d910b 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/cstr.h +++ b/src/duckdb/extension/icu/third_party/icu/common/cstr.h @@ -28,7 +28,7 @@ * default code page conversion, which will do the best job possible, * but may be lossy, depending on the platform. * - * If no other conversion is available, use invariant conversion and substitue + * If no other conversion is available, use invariant conversion and substitute * '?' for non-invariant characters. * * Example Usage: @@ -51,8 +51,8 @@ class U_COMMON_API CStr : public UMemory { private: CharString s; - CStr(const CStr &other); // Forbid copying of this class. - CStr &operator =(const CStr &other); // Forbid assignment. + CStr(const CStr &other) = delete; // Forbid copying of this class. + CStr &operator =(const CStr &other) = delete; // Forbid assignment. }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/cstring.cpp b/src/duckdb/extension/icu/third_party/icu/common/cstring.cpp index 06275c4b5..e95816c13 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/cstring.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/cstring.cpp @@ -189,7 +189,7 @@ T_CString_integerToString(char* buffer, int32_t v, int32_t radix) /* * Takes a int64_t and fills in a char* string with that number "radix"-based. * Writes at most 21: chars ("-9223372036854775807" plus NUL). - * Returns the length of the string, not including the terminating NULL. + * Returns the length of the string, not including the terminating NUL. */ U_CAPI int32_t U_EXPORT2 T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix) @@ -233,16 +233,16 @@ T_CString_stringToInteger(const char *integerString, int32_t radix) U_CAPI int U_EXPORT2 uprv_stricmp(const char *str1, const char *str2) { - if(str1==NULL) { - if(str2==NULL) { + if(str1==nullptr) { + if(str2==nullptr) { return 0; } else { return -1; } - } else if(str2==NULL) { + } else if(str2==nullptr) { return 1; } else { - /* compare non-NULL strings lexically with lowercase */ + /* compare non-nullptr strings lexically with lowercase */ int rc; unsigned char c1, c2; @@ -272,16 +272,16 @@ uprv_stricmp(const char *str1, const char *str2) { U_CAPI int U_EXPORT2 uprv_strnicmp(const char *str1, const char *str2, uint32_t n) { - if(str1==NULL) { - if(str2==NULL) { + if(str1==nullptr) { + if(str2==nullptr) { return 0; } else { return -1; } - } else if(str2==NULL) { + } else if(str2==nullptr) { return 1; } else { - /* compare non-NULL strings lexically with lowercase */ + /* compare non-nullptr strings lexically with lowercase */ int rc; unsigned char c1, c2; diff --git a/src/duckdb/extension/icu/third_party/icu/common/cstring.h b/src/duckdb/extension/icu/third_party/icu/common/cstring.h index ed0b1a7c8..3a14e4216 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/cstring.h +++ b/src/duckdb/extension/icu/third_party/icu/common/cstring.h @@ -52,6 +52,8 @@ U_CAPI UBool U_EXPORT2 uprv_isASCIILetter(char c); +// NOTE: For u_asciiToUpper that takes a UChar, see ustr_imp.h + U_CAPI char U_EXPORT2 uprv_toupper(char c); diff --git a/src/duckdb/extension/icu/third_party/icu/common/cwchar.cpp b/src/duckdb/extension/icu/third_party/icu/common/cwchar.cpp deleted file mode 100644 index 20c7d71e0..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/cwchar.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* -* Copyright (C) 2001, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* file name: cwchar.c -* encoding: UTF-8 -* tab size: 8 (not used) -* indentation:4 -* -* created on: 2001may25 -* created by: Markus W. Scherer -*/ - -#include "unicode/utypes.h" - -#if !U_HAVE_WCSCPY - -#include "cwchar.h" - -U_CAPI wchar_t *uprv_wcscat(wchar_t *dst, const wchar_t *src) { - wchar_t *start=dst; - while(*dst!=0) { - ++dst; - } - while((*dst=*src)!=0) { - ++dst; - ++src; - } - return start; -} - -U_CAPI wchar_t *uprv_wcscpy(wchar_t *dst, const wchar_t *src) { - wchar_t *start=dst; - while((*dst=*src)!=0) { - ++dst; - ++src; - } - return start; -} - -U_CAPI size_t uprv_wcslen(const wchar_t *src) { - const wchar_t *start=src; - while(*src!=0) { - ++src; - } - return src-start; -} - -#endif - diff --git a/src/duckdb/extension/icu/third_party/icu/common/dictbe.cpp b/src/duckdb/extension/icu/third_party/icu/common/dictbe.cpp deleted file mode 100644 index 15d0b2a37..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/dictbe.cpp +++ /dev/null @@ -1,1394 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** - ******************************************************************************* - * Copyright (C) 2006-2016, International Business Machines Corporation - * and others. All Rights Reserved. - ******************************************************************************* - */ - -#include - -#include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "brkeng.h" -// #include "dictbe.h" -// #include "unicode/uniset.h" -// #include "unicode/chariter.h" -// #include "unicode/ubrk.h" -// #include "uvectr32.h" -// #include "uvector.h" -// #include "uassert.h" -// #include "unicode/normlzr.h" -// #include "cmemory.h" -// #include "dictionarydata.h" - -// U_NAMESPACE_BEGIN - -// /* -// ****************************************************************** -// */ - -// DictionaryBreakEngine::DictionaryBreakEngine() { -// } - -// DictionaryBreakEngine::~DictionaryBreakEngine() { -// } - -// UBool -// DictionaryBreakEngine::handles(UChar32 c) const { -// return fSet.contains(c); -// } - -// int32_t -// DictionaryBreakEngine::findBreaks( UText *text, -// int32_t startPos, -// int32_t endPos, -// UVector32 &foundBreaks ) const { -// (void)startPos; // TODO: remove this param? -// int32_t result = 0; - -// // Find the span of characters included in the set. -// // The span to break begins at the current position in the text, and -// // extends towards the start or end of the text, depending on 'reverse'. - -// int32_t start = (int32_t)utext_getNativeIndex(text); -// int32_t current; -// int32_t rangeStart; -// int32_t rangeEnd; -// UChar32 c = utext_current32(text); -// while((current = (int32_t)utext_getNativeIndex(text)) < endPos && fSet.contains(c)) { -// utext_next32(text); // TODO: recast loop for postincrement -// c = utext_current32(text); -// } -// rangeStart = start; -// rangeEnd = current; -// result = divideUpDictionaryRange(text, rangeStart, rangeEnd, foundBreaks); -// utext_setNativeIndex(text, current); - -// return result; -// } - -// void -// DictionaryBreakEngine::setCharacters( const UnicodeSet &set ) { -// fSet = set; -// // Compact for caching -// fSet.compact(); -// } - -// /* -// ****************************************************************** -// * PossibleWord -// */ - -// // Helper class for improving readability of the Thai/Lao/Khmer word break -// // algorithm. The implementation is completely inline. - -// // List size, limited by the maximum number of words in the dictionary -// // that form a nested sequence. -// static const int32_t POSSIBLE_WORD_LIST_MAX = 20; - -// class PossibleWord { -// private: -// // list of word candidate lengths, in increasing length order -// // TODO: bytes would be sufficient for word lengths. -// int32_t count; // Count of candidates -// int32_t prefix; // The longest match with a dictionary word -// int32_t offset; // Offset in the text of these candidates -// int32_t mark; // The preferred candidate's offset -// int32_t current; // The candidate we're currently looking at -// int32_t cuLengths[POSSIBLE_WORD_LIST_MAX]; // Word Lengths, in code units. -// int32_t cpLengths[POSSIBLE_WORD_LIST_MAX]; // Word Lengths, in code points. - -// public: -// PossibleWord() : count(0), prefix(0), offset(-1), mark(0), current(0) {} -// ~PossibleWord() {} - -// // Fill the list of candidates if needed, select the longest, and return the number found -// int32_t candidates( UText *text, DictionaryMatcher *dict, int32_t rangeEnd ); - -// // Select the currently marked candidate, point after it in the text, and invalidate self -// int32_t acceptMarked( UText *text ); - -// // Back up from the current candidate to the next shorter one; return TRUE if that exists -// // and point the text after it -// UBool backUp( UText *text ); - -// // Return the longest prefix this candidate location shares with a dictionary word -// // Return value is in code points. -// int32_t longestPrefix() { return prefix; } - -// // Mark the current candidate as the one we like -// void markCurrent() { mark = current; } - -// // Get length in code points of the marked word. -// int32_t markedCPLength() { return cpLengths[mark]; } -// }; - - -// int32_t PossibleWord::candidates( UText *text, DictionaryMatcher *dict, int32_t rangeEnd ) { -// // TODO: If getIndex is too slow, use offset < 0 and add discardAll() -// int32_t start = (int32_t)utext_getNativeIndex(text); -// if (start != offset) { -// offset = start; -// count = dict->matches(text, rangeEnd-start, UPRV_LENGTHOF(cuLengths), cuLengths, cpLengths, NULL, &prefix); -// // Dictionary leaves text after longest prefix, not longest word. Back up. -// if (count <= 0) { -// utext_setNativeIndex(text, start); -// } -// } -// if (count > 0) { -// utext_setNativeIndex(text, start+cuLengths[count-1]); -// } -// current = count-1; -// mark = current; -// return count; -// } - -// int32_t -// PossibleWord::acceptMarked( UText *text ) { -// utext_setNativeIndex(text, offset + cuLengths[mark]); -// return cuLengths[mark]; -// } - - -// UBool -// PossibleWord::backUp( UText *text ) { -// if (current > 0) { -// utext_setNativeIndex(text, offset + cuLengths[--current]); -// return TRUE; -// } -// return FALSE; -// } - -// /* -// ****************************************************************** -// * ThaiBreakEngine -// */ - -// // How many words in a row are "good enough"? -// static const int32_t THAI_LOOKAHEAD = 3; - -// // Will not combine a non-word with a preceding dictionary word longer than this -// static const int32_t THAI_ROOT_COMBINE_THRESHOLD = 3; - -// // Will not combine a non-word that shares at least this much prefix with a -// // dictionary word, with a preceding word -// static const int32_t THAI_PREFIX_COMBINE_THRESHOLD = 3; - -// // Ellision character -// static const int32_t THAI_PAIYANNOI = 0x0E2F; - -// // Repeat character -// static const int32_t THAI_MAIYAMOK = 0x0E46; - -// // Minimum word size -// static const int32_t THAI_MIN_WORD = 2; - -// // Minimum number of characters for two words -// static const int32_t THAI_MIN_WORD_SPAN = THAI_MIN_WORD * 2; - -// ThaiBreakEngine::ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status) -// : DictionaryBreakEngine(), -// fDictionary(adoptDictionary) -// { -// fThaiWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Thai:]&[:LineBreak=SA:]]"), status); -// if (U_SUCCESS(status)) { -// setCharacters(fThaiWordSet); -// } -// fMarkSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Thai:]&[:LineBreak=SA:]&[:M:]]"), status); -// fMarkSet.add(0x0020); -// fEndWordSet = fThaiWordSet; -// fEndWordSet.remove(0x0E31); // MAI HAN-AKAT -// fEndWordSet.remove(0x0E40, 0x0E44); // SARA E through SARA AI MAIMALAI -// fBeginWordSet.add(0x0E01, 0x0E2E); // KO KAI through HO NOKHUK -// fBeginWordSet.add(0x0E40, 0x0E44); // SARA E through SARA AI MAIMALAI -// fSuffixSet.add(THAI_PAIYANNOI); -// fSuffixSet.add(THAI_MAIYAMOK); - -// // Compact for caching. -// fMarkSet.compact(); -// fEndWordSet.compact(); -// fBeginWordSet.compact(); -// fSuffixSet.compact(); -// } - -// ThaiBreakEngine::~ThaiBreakEngine() { -// delete fDictionary; -// } - -// int32_t -// ThaiBreakEngine::divideUpDictionaryRange( UText *text, -// int32_t rangeStart, -// int32_t rangeEnd, -// UVector32 &foundBreaks ) const { -// utext_setNativeIndex(text, rangeStart); -// utext_moveIndex32(text, THAI_MIN_WORD_SPAN); -// if (utext_getNativeIndex(text) >= rangeEnd) { -// return 0; // Not enough characters for two words -// } -// utext_setNativeIndex(text, rangeStart); - - -// uint32_t wordsFound = 0; -// int32_t cpWordLength = 0; // Word Length in Code Points. -// int32_t cuWordLength = 0; // Word length in code units (UText native indexing) -// int32_t current; -// UErrorCode status = U_ZERO_ERROR; -// PossibleWord words[THAI_LOOKAHEAD]; - -// utext_setNativeIndex(text, rangeStart); - -// while (U_SUCCESS(status) && (current = (int32_t)utext_getNativeIndex(text)) < rangeEnd) { -// cpWordLength = 0; -// cuWordLength = 0; - -// // Look for candidate words at the current position -// int32_t candidates = words[wordsFound%THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); - -// // If we found exactly one, use that -// if (candidates == 1) { -// cuWordLength = words[wordsFound % THAI_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % THAI_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } -// // If there was more than one, see which one can take us forward the most words -// else if (candidates > 1) { -// // If we're already at the end of the range, we're done -// if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } -// do { -// int32_t wordsMatched = 1; -// if (words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) { -// if (wordsMatched < 2) { -// // Followed by another dictionary word; mark first word as a good candidate -// words[wordsFound%THAI_LOOKAHEAD].markCurrent(); -// wordsMatched = 2; -// } - -// // If we're already at the end of the range, we're done -// if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } - -// // See if any of the possible second words is followed by a third word -// do { -// // If we find a third word, stop right away -// if (words[(wordsFound + 2) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd)) { -// words[wordsFound % THAI_LOOKAHEAD].markCurrent(); -// goto foundBest; -// } -// } -// while (words[(wordsFound + 1) % THAI_LOOKAHEAD].backUp(text)); -// } -// } -// while (words[wordsFound % THAI_LOOKAHEAD].backUp(text)); -// foundBest: -// // Set UText position to after the accepted word. -// cuWordLength = words[wordsFound % THAI_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % THAI_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } - -// // We come here after having either found a word or not. We look ahead to the -// // next word. If it's not a dictionary word, we will combine it with the word we -// // just found (if there is one), but only if the preceding word does not exceed -// // the threshold. -// // The text iterator should now be positioned at the end of the word we found. - -// UChar32 uc = 0; -// if ((int32_t)utext_getNativeIndex(text) < rangeEnd && cpWordLength < THAI_ROOT_COMBINE_THRESHOLD) { -// // if it is a dictionary word, do nothing. If it isn't, then if there is -// // no preceding word, or the non-word shares less than the minimum threshold -// // of characters with a dictionary word, then scan to resynchronize -// if (words[wordsFound % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) <= 0 -// && (cuWordLength == 0 -// || words[wordsFound%THAI_LOOKAHEAD].longestPrefix() < THAI_PREFIX_COMBINE_THRESHOLD)) { -// // Look for a plausible word boundary -// int32_t remaining = rangeEnd - (current+cuWordLength); -// UChar32 pc; -// int32_t chars = 0; -// for (;;) { -// int32_t pcIndex = (int32_t)utext_getNativeIndex(text); -// pc = utext_next32(text); -// int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex; -// chars += pcSize; -// remaining -= pcSize; -// if (remaining <= 0) { -// break; -// } -// uc = utext_current32(text); -// if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) { -// // Maybe. See if it's in the dictionary. -// // NOTE: In the original Apple code, checked that the next -// // two characters after uc were not 0x0E4C THANTHAKHAT before -// // checking the dictionary. That is just a performance filter, -// // but it's not clear it's faster than checking the trie. -// int32_t num_candidates = words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); -// utext_setNativeIndex(text, current + cuWordLength + chars); -// if (num_candidates > 0) { -// break; -// } -// } -// } - -// // Bump the word count if there wasn't already one -// if (cuWordLength <= 0) { -// wordsFound += 1; -// } - -// // Update the length with the passed-over characters -// cuWordLength += chars; -// } -// else { -// // Back up to where we were for next iteration -// utext_setNativeIndex(text, current+cuWordLength); -// } -// } - -// // Never stop before a combining mark. -// int32_t currPos; -// while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) { -// utext_next32(text); -// cuWordLength += (int32_t)utext_getNativeIndex(text) - currPos; -// } - -// // Look ahead for possible suffixes if a dictionary word does not follow. -// // We do this in code rather than using a rule so that the heuristic -// // resynch continues to function. For example, one of the suffix characters -// // could be a typo in the middle of a word. -// if ((int32_t)utext_getNativeIndex(text) < rangeEnd && cuWordLength > 0) { -// if (words[wordsFound%THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) <= 0 -// && fSuffixSet.contains(uc = utext_current32(text))) { -// if (uc == THAI_PAIYANNOI) { -// if (!fSuffixSet.contains(utext_previous32(text))) { -// // Skip over previous end and PAIYANNOI -// utext_next32(text); -// int32_t paiyannoiIndex = (int32_t)utext_getNativeIndex(text); -// utext_next32(text); -// cuWordLength += (int32_t)utext_getNativeIndex(text) - paiyannoiIndex; // Add PAIYANNOI to word -// uc = utext_current32(text); // Fetch next character -// } -// else { -// // Restore prior position -// utext_next32(text); -// } -// } -// if (uc == THAI_MAIYAMOK) { -// if (utext_previous32(text) != THAI_MAIYAMOK) { -// // Skip over previous end and MAIYAMOK -// utext_next32(text); -// int32_t maiyamokIndex = (int32_t)utext_getNativeIndex(text); -// utext_next32(text); -// cuWordLength += (int32_t)utext_getNativeIndex(text) - maiyamokIndex; // Add MAIYAMOK to word -// } -// else { -// // Restore prior position -// utext_next32(text); -// } -// } -// } -// else { -// utext_setNativeIndex(text, current+cuWordLength); -// } -// } - -// // Did we find a word on this iteration? If so, push it on the break stack -// if (cuWordLength > 0) { -// foundBreaks.push((current+cuWordLength), status); -// } -// } - -// // Don't return a break for the end of the dictionary range if there is one there. -// if (foundBreaks.peeki() >= rangeEnd) { -// (void) foundBreaks.popi(); -// wordsFound -= 1; -// } - -// return wordsFound; -// } - -// /* -// ****************************************************************** -// * LaoBreakEngine -// */ - -// // How many words in a row are "good enough"? -// static const int32_t LAO_LOOKAHEAD = 3; - -// // Will not combine a non-word with a preceding dictionary word longer than this -// static const int32_t LAO_ROOT_COMBINE_THRESHOLD = 3; - -// // Will not combine a non-word that shares at least this much prefix with a -// // dictionary word, with a preceding word -// static const int32_t LAO_PREFIX_COMBINE_THRESHOLD = 3; - -// // Minimum word size -// static const int32_t LAO_MIN_WORD = 2; - -// // Minimum number of characters for two words -// static const int32_t LAO_MIN_WORD_SPAN = LAO_MIN_WORD * 2; - -// LaoBreakEngine::LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status) -// : DictionaryBreakEngine(), -// fDictionary(adoptDictionary) -// { -// fLaoWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Laoo:]&[:LineBreak=SA:]]"), status); -// if (U_SUCCESS(status)) { -// setCharacters(fLaoWordSet); -// } -// fMarkSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Laoo:]&[:LineBreak=SA:]&[:M:]]"), status); -// fMarkSet.add(0x0020); -// fEndWordSet = fLaoWordSet; -// fEndWordSet.remove(0x0EC0, 0x0EC4); // prefix vowels -// fBeginWordSet.add(0x0E81, 0x0EAE); // basic consonants (including holes for corresponding Thai characters) -// fBeginWordSet.add(0x0EDC, 0x0EDD); // digraph consonants (no Thai equivalent) -// fBeginWordSet.add(0x0EC0, 0x0EC4); // prefix vowels - -// // Compact for caching. -// fMarkSet.compact(); -// fEndWordSet.compact(); -// fBeginWordSet.compact(); -// } - -// LaoBreakEngine::~LaoBreakEngine() { -// delete fDictionary; -// } - -// int32_t -// LaoBreakEngine::divideUpDictionaryRange( UText *text, -// int32_t rangeStart, -// int32_t rangeEnd, -// UVector32 &foundBreaks ) const { -// if ((rangeEnd - rangeStart) < LAO_MIN_WORD_SPAN) { -// return 0; // Not enough characters for two words -// } - -// uint32_t wordsFound = 0; -// int32_t cpWordLength = 0; -// int32_t cuWordLength = 0; -// int32_t current; -// UErrorCode status = U_ZERO_ERROR; -// PossibleWord words[LAO_LOOKAHEAD]; - -// utext_setNativeIndex(text, rangeStart); - -// while (U_SUCCESS(status) && (current = (int32_t)utext_getNativeIndex(text)) < rangeEnd) { -// cuWordLength = 0; -// cpWordLength = 0; - -// // Look for candidate words at the current position -// int32_t candidates = words[wordsFound%LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); - -// // If we found exactly one, use that -// if (candidates == 1) { -// cuWordLength = words[wordsFound % LAO_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % LAO_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } -// // If there was more than one, see which one can take us forward the most words -// else if (candidates > 1) { -// // If we're already at the end of the range, we're done -// if (utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } -// do { -// int32_t wordsMatched = 1; -// if (words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) { -// if (wordsMatched < 2) { -// // Followed by another dictionary word; mark first word as a good candidate -// words[wordsFound%LAO_LOOKAHEAD].markCurrent(); -// wordsMatched = 2; -// } - -// // If we're already at the end of the range, we're done -// if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } - -// // See if any of the possible second words is followed by a third word -// do { -// // If we find a third word, stop right away -// if (words[(wordsFound + 2) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd)) { -// words[wordsFound % LAO_LOOKAHEAD].markCurrent(); -// goto foundBest; -// } -// } -// while (words[(wordsFound + 1) % LAO_LOOKAHEAD].backUp(text)); -// } -// } -// while (words[wordsFound % LAO_LOOKAHEAD].backUp(text)); -// foundBest: -// cuWordLength = words[wordsFound % LAO_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % LAO_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } - -// // We come here after having either found a word or not. We look ahead to the -// // next word. If it's not a dictionary word, we will combine it withe the word we -// // just found (if there is one), but only if the preceding word does not exceed -// // the threshold. -// // The text iterator should now be positioned at the end of the word we found. -// if ((int32_t)utext_getNativeIndex(text) < rangeEnd && cpWordLength < LAO_ROOT_COMBINE_THRESHOLD) { -// // if it is a dictionary word, do nothing. If it isn't, then if there is -// // no preceding word, or the non-word shares less than the minimum threshold -// // of characters with a dictionary word, then scan to resynchronize -// if (words[wordsFound % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) <= 0 -// && (cuWordLength == 0 -// || words[wordsFound%LAO_LOOKAHEAD].longestPrefix() < LAO_PREFIX_COMBINE_THRESHOLD)) { -// // Look for a plausible word boundary -// int32_t remaining = rangeEnd - (current + cuWordLength); -// UChar32 pc; -// UChar32 uc; -// int32_t chars = 0; -// for (;;) { -// int32_t pcIndex = (int32_t)utext_getNativeIndex(text); -// pc = utext_next32(text); -// int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex; -// chars += pcSize; -// remaining -= pcSize; -// if (remaining <= 0) { -// break; -// } -// uc = utext_current32(text); -// if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) { -// // Maybe. See if it's in the dictionary. -// // TODO: this looks iffy; compare with old code. -// int32_t num_candidates = words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); -// utext_setNativeIndex(text, current + cuWordLength + chars); -// if (num_candidates > 0) { -// break; -// } -// } -// } - -// // Bump the word count if there wasn't already one -// if (cuWordLength <= 0) { -// wordsFound += 1; -// } - -// // Update the length with the passed-over characters -// cuWordLength += chars; -// } -// else { -// // Back up to where we were for next iteration -// utext_setNativeIndex(text, current + cuWordLength); -// } -// } - -// // Never stop before a combining mark. -// int32_t currPos; -// while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) { -// utext_next32(text); -// cuWordLength += (int32_t)utext_getNativeIndex(text) - currPos; -// } - -// // Look ahead for possible suffixes if a dictionary word does not follow. -// // We do this in code rather than using a rule so that the heuristic -// // resynch continues to function. For example, one of the suffix characters -// // could be a typo in the middle of a word. -// // NOT CURRENTLY APPLICABLE TO LAO - -// // Did we find a word on this iteration? If so, push it on the break stack -// if (cuWordLength > 0) { -// foundBreaks.push((current+cuWordLength), status); -// } -// } - -// // Don't return a break for the end of the dictionary range if there is one there. -// if (foundBreaks.peeki() >= rangeEnd) { -// (void) foundBreaks.popi(); -// wordsFound -= 1; -// } - -// return wordsFound; -// } - -// /* -// ****************************************************************** -// * BurmeseBreakEngine -// */ - -// // How many words in a row are "good enough"? -// static const int32_t BURMESE_LOOKAHEAD = 3; - -// // Will not combine a non-word with a preceding dictionary word longer than this -// static const int32_t BURMESE_ROOT_COMBINE_THRESHOLD = 3; - -// // Will not combine a non-word that shares at least this much prefix with a -// // dictionary word, with a preceding word -// static const int32_t BURMESE_PREFIX_COMBINE_THRESHOLD = 3; - -// // Minimum word size -// static const int32_t BURMESE_MIN_WORD = 2; - -// // Minimum number of characters for two words -// static const int32_t BURMESE_MIN_WORD_SPAN = BURMESE_MIN_WORD * 2; - -// BurmeseBreakEngine::BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status) -// : DictionaryBreakEngine(), -// fDictionary(adoptDictionary) -// { -// fBurmeseWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Mymr:]&[:LineBreak=SA:]]"), status); -// if (U_SUCCESS(status)) { -// setCharacters(fBurmeseWordSet); -// } -// fMarkSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Mymr:]&[:LineBreak=SA:]&[:M:]]"), status); -// fMarkSet.add(0x0020); -// fEndWordSet = fBurmeseWordSet; -// fBeginWordSet.add(0x1000, 0x102A); // basic consonants and independent vowels - -// // Compact for caching. -// fMarkSet.compact(); -// fEndWordSet.compact(); -// fBeginWordSet.compact(); -// } - -// BurmeseBreakEngine::~BurmeseBreakEngine() { -// delete fDictionary; -// } - -// int32_t -// BurmeseBreakEngine::divideUpDictionaryRange( UText *text, -// int32_t rangeStart, -// int32_t rangeEnd, -// UVector32 &foundBreaks ) const { -// if ((rangeEnd - rangeStart) < BURMESE_MIN_WORD_SPAN) { -// return 0; // Not enough characters for two words -// } - -// uint32_t wordsFound = 0; -// int32_t cpWordLength = 0; -// int32_t cuWordLength = 0; -// int32_t current; -// UErrorCode status = U_ZERO_ERROR; -// PossibleWord words[BURMESE_LOOKAHEAD]; - -// utext_setNativeIndex(text, rangeStart); - -// while (U_SUCCESS(status) && (current = (int32_t)utext_getNativeIndex(text)) < rangeEnd) { -// cuWordLength = 0; -// cpWordLength = 0; - -// // Look for candidate words at the current position -// int32_t candidates = words[wordsFound%BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); - -// // If we found exactly one, use that -// if (candidates == 1) { -// cuWordLength = words[wordsFound % BURMESE_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % BURMESE_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } -// // If there was more than one, see which one can take us forward the most words -// else if (candidates > 1) { -// // If we're already at the end of the range, we're done -// if (utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } -// do { -// int32_t wordsMatched = 1; -// if (words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) { -// if (wordsMatched < 2) { -// // Followed by another dictionary word; mark first word as a good candidate -// words[wordsFound%BURMESE_LOOKAHEAD].markCurrent(); -// wordsMatched = 2; -// } - -// // If we're already at the end of the range, we're done -// if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } - -// // See if any of the possible second words is followed by a third word -// do { -// // If we find a third word, stop right away -// if (words[(wordsFound + 2) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd)) { -// words[wordsFound % BURMESE_LOOKAHEAD].markCurrent(); -// goto foundBest; -// } -// } -// while (words[(wordsFound + 1) % BURMESE_LOOKAHEAD].backUp(text)); -// } -// } -// while (words[wordsFound % BURMESE_LOOKAHEAD].backUp(text)); -// foundBest: -// cuWordLength = words[wordsFound % BURMESE_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % BURMESE_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } - -// // We come here after having either found a word or not. We look ahead to the -// // next word. If it's not a dictionary word, we will combine it withe the word we -// // just found (if there is one), but only if the preceding word does not exceed -// // the threshold. -// // The text iterator should now be positioned at the end of the word we found. -// if ((int32_t)utext_getNativeIndex(text) < rangeEnd && cpWordLength < BURMESE_ROOT_COMBINE_THRESHOLD) { -// // if it is a dictionary word, do nothing. If it isn't, then if there is -// // no preceding word, or the non-word shares less than the minimum threshold -// // of characters with a dictionary word, then scan to resynchronize -// if (words[wordsFound % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) <= 0 -// && (cuWordLength == 0 -// || words[wordsFound%BURMESE_LOOKAHEAD].longestPrefix() < BURMESE_PREFIX_COMBINE_THRESHOLD)) { -// // Look for a plausible word boundary -// int32_t remaining = rangeEnd - (current + cuWordLength); -// UChar32 pc; -// UChar32 uc; -// int32_t chars = 0; -// for (;;) { -// int32_t pcIndex = (int32_t)utext_getNativeIndex(text); -// pc = utext_next32(text); -// int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex; -// chars += pcSize; -// remaining -= pcSize; -// if (remaining <= 0) { -// break; -// } -// uc = utext_current32(text); -// if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) { -// // Maybe. See if it's in the dictionary. -// // TODO: this looks iffy; compare with old code. -// int32_t num_candidates = words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); -// utext_setNativeIndex(text, current + cuWordLength + chars); -// if (num_candidates > 0) { -// break; -// } -// } -// } - -// // Bump the word count if there wasn't already one -// if (cuWordLength <= 0) { -// wordsFound += 1; -// } - -// // Update the length with the passed-over characters -// cuWordLength += chars; -// } -// else { -// // Back up to where we were for next iteration -// utext_setNativeIndex(text, current + cuWordLength); -// } -// } - -// // Never stop before a combining mark. -// int32_t currPos; -// while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) { -// utext_next32(text); -// cuWordLength += (int32_t)utext_getNativeIndex(text) - currPos; -// } - -// // Look ahead for possible suffixes if a dictionary word does not follow. -// // We do this in code rather than using a rule so that the heuristic -// // resynch continues to function. For example, one of the suffix characters -// // could be a typo in the middle of a word. -// // NOT CURRENTLY APPLICABLE TO BURMESE - -// // Did we find a word on this iteration? If so, push it on the break stack -// if (cuWordLength > 0) { -// foundBreaks.push((current+cuWordLength), status); -// } -// } - -// // Don't return a break for the end of the dictionary range if there is one there. -// if (foundBreaks.peeki() >= rangeEnd) { -// (void) foundBreaks.popi(); -// wordsFound -= 1; -// } - -// return wordsFound; -// } - -// /* -// ****************************************************************** -// * KhmerBreakEngine -// */ - -// // How many words in a row are "good enough"? -// static const int32_t KHMER_LOOKAHEAD = 3; - -// // Will not combine a non-word with a preceding dictionary word longer than this -// static const int32_t KHMER_ROOT_COMBINE_THRESHOLD = 3; - -// // Will not combine a non-word that shares at least this much prefix with a -// // dictionary word, with a preceding word -// static const int32_t KHMER_PREFIX_COMBINE_THRESHOLD = 3; - -// // Minimum word size -// static const int32_t KHMER_MIN_WORD = 2; - -// // Minimum number of characters for two words -// static const int32_t KHMER_MIN_WORD_SPAN = KHMER_MIN_WORD * 2; - -// KhmerBreakEngine::KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status) -// : DictionaryBreakEngine(), -// fDictionary(adoptDictionary) -// { -// fKhmerWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:LineBreak=SA:]]"), status); -// if (U_SUCCESS(status)) { -// setCharacters(fKhmerWordSet); -// } -// fMarkSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:LineBreak=SA:]&[:M:]]"), status); -// fMarkSet.add(0x0020); -// fEndWordSet = fKhmerWordSet; -// fBeginWordSet.add(0x1780, 0x17B3); -// //fBeginWordSet.add(0x17A3, 0x17A4); // deprecated vowels -// //fEndWordSet.remove(0x17A5, 0x17A9); // Khmer independent vowels that can't end a word -// //fEndWordSet.remove(0x17B2); // Khmer independent vowel that can't end a word -// fEndWordSet.remove(0x17D2); // KHMER SIGN COENG that combines some following characters -// //fEndWordSet.remove(0x17B6, 0x17C5); // Remove dependent vowels -// // fEndWordSet.remove(0x0E31); // MAI HAN-AKAT -// // fEndWordSet.remove(0x0E40, 0x0E44); // SARA E through SARA AI MAIMALAI -// // fBeginWordSet.add(0x0E01, 0x0E2E); // KO KAI through HO NOKHUK -// // fBeginWordSet.add(0x0E40, 0x0E44); // SARA E through SARA AI MAIMALAI -// // fSuffixSet.add(THAI_PAIYANNOI); -// // fSuffixSet.add(THAI_MAIYAMOK); - -// // Compact for caching. -// fMarkSet.compact(); -// fEndWordSet.compact(); -// fBeginWordSet.compact(); -// // fSuffixSet.compact(); -// } - -// KhmerBreakEngine::~KhmerBreakEngine() { -// delete fDictionary; -// } - -// int32_t -// KhmerBreakEngine::divideUpDictionaryRange( UText *text, -// int32_t rangeStart, -// int32_t rangeEnd, -// UVector32 &foundBreaks ) const { -// if ((rangeEnd - rangeStart) < KHMER_MIN_WORD_SPAN) { -// return 0; // Not enough characters for two words -// } - -// uint32_t wordsFound = 0; -// int32_t cpWordLength = 0; -// int32_t cuWordLength = 0; -// int32_t current; -// UErrorCode status = U_ZERO_ERROR; -// PossibleWord words[KHMER_LOOKAHEAD]; - -// utext_setNativeIndex(text, rangeStart); - -// while (U_SUCCESS(status) && (current = (int32_t)utext_getNativeIndex(text)) < rangeEnd) { -// cuWordLength = 0; -// cpWordLength = 0; - -// // Look for candidate words at the current position -// int32_t candidates = words[wordsFound%KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); - -// // If we found exactly one, use that -// if (candidates == 1) { -// cuWordLength = words[wordsFound % KHMER_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % KHMER_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } - -// // If there was more than one, see which one can take us forward the most words -// else if (candidates > 1) { -// // If we're already at the end of the range, we're done -// if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } -// do { -// int32_t wordsMatched = 1; -// if (words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) > 0) { -// if (wordsMatched < 2) { -// // Followed by another dictionary word; mark first word as a good candidate -// words[wordsFound % KHMER_LOOKAHEAD].markCurrent(); -// wordsMatched = 2; -// } - -// // If we're already at the end of the range, we're done -// if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) { -// goto foundBest; -// } - -// // See if any of the possible second words is followed by a third word -// do { -// // If we find a third word, stop right away -// if (words[(wordsFound + 2) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd)) { -// words[wordsFound % KHMER_LOOKAHEAD].markCurrent(); -// goto foundBest; -// } -// } -// while (words[(wordsFound + 1) % KHMER_LOOKAHEAD].backUp(text)); -// } -// } -// while (words[wordsFound % KHMER_LOOKAHEAD].backUp(text)); -// foundBest: -// cuWordLength = words[wordsFound % KHMER_LOOKAHEAD].acceptMarked(text); -// cpWordLength = words[wordsFound % KHMER_LOOKAHEAD].markedCPLength(); -// wordsFound += 1; -// } - -// // We come here after having either found a word or not. We look ahead to the -// // next word. If it's not a dictionary word, we will combine it with the word we -// // just found (if there is one), but only if the preceding word does not exceed -// // the threshold. -// // The text iterator should now be positioned at the end of the word we found. -// if ((int32_t)utext_getNativeIndex(text) < rangeEnd && cpWordLength < KHMER_ROOT_COMBINE_THRESHOLD) { -// // if it is a dictionary word, do nothing. If it isn't, then if there is -// // no preceding word, or the non-word shares less than the minimum threshold -// // of characters with a dictionary word, then scan to resynchronize -// if (words[wordsFound % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) <= 0 -// && (cuWordLength == 0 -// || words[wordsFound % KHMER_LOOKAHEAD].longestPrefix() < KHMER_PREFIX_COMBINE_THRESHOLD)) { -// // Look for a plausible word boundary -// int32_t remaining = rangeEnd - (current+cuWordLength); -// UChar32 pc; -// UChar32 uc; -// int32_t chars = 0; -// for (;;) { -// int32_t pcIndex = (int32_t)utext_getNativeIndex(text); -// pc = utext_next32(text); -// int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex; -// chars += pcSize; -// remaining -= pcSize; -// if (remaining <= 0) { -// break; -// } -// uc = utext_current32(text); -// if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) { -// // Maybe. See if it's in the dictionary. -// int32_t num_candidates = words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd); -// utext_setNativeIndex(text, current+cuWordLength+chars); -// if (num_candidates > 0) { -// break; -// } -// } -// } - -// // Bump the word count if there wasn't already one -// if (cuWordLength <= 0) { -// wordsFound += 1; -// } - -// // Update the length with the passed-over characters -// cuWordLength += chars; -// } -// else { -// // Back up to where we were for next iteration -// utext_setNativeIndex(text, current+cuWordLength); -// } -// } - -// // Never stop before a combining mark. -// int32_t currPos; -// while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) { -// utext_next32(text); -// cuWordLength += (int32_t)utext_getNativeIndex(text) - currPos; -// } - -// // Look ahead for possible suffixes if a dictionary word does not follow. -// // We do this in code rather than using a rule so that the heuristic -// // resynch continues to function. For example, one of the suffix characters -// // could be a typo in the middle of a word. -// // if ((int32_t)utext_getNativeIndex(text) < rangeEnd && wordLength > 0) { -// // if (words[wordsFound%KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) <= 0 -// // && fSuffixSet.contains(uc = utext_current32(text))) { -// // if (uc == KHMER_PAIYANNOI) { -// // if (!fSuffixSet.contains(utext_previous32(text))) { -// // // Skip over previous end and PAIYANNOI -// // utext_next32(text); -// // utext_next32(text); -// // wordLength += 1; // Add PAIYANNOI to word -// // uc = utext_current32(text); // Fetch next character -// // } -// // else { -// // // Restore prior position -// // utext_next32(text); -// // } -// // } -// // if (uc == KHMER_MAIYAMOK) { -// // if (utext_previous32(text) != KHMER_MAIYAMOK) { -// // // Skip over previous end and MAIYAMOK -// // utext_next32(text); -// // utext_next32(text); -// // wordLength += 1; // Add MAIYAMOK to word -// // } -// // else { -// // // Restore prior position -// // utext_next32(text); -// // } -// // } -// // } -// // else { -// // utext_setNativeIndex(text, current+wordLength); -// // } -// // } - -// // Did we find a word on this iteration? If so, push it on the break stack -// if (cuWordLength > 0) { -// foundBreaks.push((current+cuWordLength), status); -// } -// } - -// // Don't return a break for the end of the dictionary range if there is one there. -// if (foundBreaks.peeki() >= rangeEnd) { -// (void) foundBreaks.popi(); -// wordsFound -= 1; -// } - -// return wordsFound; -// } - -// #if !UCONFIG_NO_NORMALIZATION -// /* -// ****************************************************************** -// * CjkBreakEngine -// */ -// static const uint32_t kuint32max = 0xFFFFFFFF; -// CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType type, UErrorCode &status) -// : DictionaryBreakEngine(), fDictionary(adoptDictionary) { -// // Korean dictionary only includes Hangul syllables -// fHangulWordSet.applyPattern(UNICODE_STRING_SIMPLE("[\\uac00-\\ud7a3]"), status); -// fHanWordSet.applyPattern(UNICODE_STRING_SIMPLE("[:Han:]"), status); -// fKatakanaWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Katakana:]\\uff9e\\uff9f]"), status); -// fHiraganaWordSet.applyPattern(UNICODE_STRING_SIMPLE("[:Hiragana:]"), status); -// nfkcNorm2 = Normalizer2::getNFKCInstance(status); - -// if (U_SUCCESS(status)) { -// // handle Korean and Japanese/Chinese using different dictionaries -// if (type == kKorean) { -// setCharacters(fHangulWordSet); -// } else { //Chinese and Japanese -// UnicodeSet cjSet; -// cjSet.addAll(fHanWordSet); -// cjSet.addAll(fKatakanaWordSet); -// cjSet.addAll(fHiraganaWordSet); -// cjSet.add(0xFF70); // HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK -// cjSet.add(0x30FC); // KATAKANA-HIRAGANA PROLONGED SOUND MARK -// setCharacters(cjSet); -// } -// } -// } - -// CjkBreakEngine::~CjkBreakEngine(){ -// delete fDictionary; -// } - -// // The katakanaCost values below are based on the length frequencies of all -// // katakana phrases in the dictionary -// static const int32_t kMaxKatakanaLength = 8; -// static const int32_t kMaxKatakanaGroupLength = 20; -// static const uint32_t maxSnlp = 255; - -// static inline uint32_t getKatakanaCost(int32_t wordLength){ -// //TODO: fill array with actual values from dictionary! -// static const uint32_t katakanaCost[kMaxKatakanaLength + 1] -// = {8192, 984, 408, 240, 204, 252, 300, 372, 480}; -// return (wordLength > kMaxKatakanaLength) ? 8192 : katakanaCost[wordLength]; -// } - -// static inline bool isKatakana(UChar32 value) { -// return (value >= 0x30A1 && value <= 0x30FE && value != 0x30FB) || -// (value >= 0xFF66 && value <= 0xFF9f); -// } - - -// // Function for accessing internal utext flags. -// // Replicates an internal UText function. - -// static inline int32_t utext_i32_flag(int32_t bitIndex) { -// return (int32_t)1 << bitIndex; -// } - - -// /* -// * @param text A UText representing the text -// * @param rangeStart The start of the range of dictionary characters -// * @param rangeEnd The end of the range of dictionary characters -// * @param foundBreaks vector to receive the break positions -// * @return The number of breaks found -// */ -// int32_t -// CjkBreakEngine::divideUpDictionaryRange( UText *inText, -// int32_t rangeStart, -// int32_t rangeEnd, -// UVector32 &foundBreaks ) const { -// if (rangeStart >= rangeEnd) { -// return 0; -// } - -// // UnicodeString version of input UText, NFKC normalized if necessary. -// UnicodeString inString; - -// // inputMap[inStringIndex] = corresponding native index from UText inText. -// // If NULL then mapping is 1:1 -// LocalPointer inputMap; - -// UErrorCode status = U_ZERO_ERROR; - - -// // if UText has the input string as one contiguous UTF-16 chunk -// if ((inText->providerProperties & utext_i32_flag(UTEXT_PROVIDER_STABLE_CHUNKS)) && -// inText->chunkNativeStart <= rangeStart && -// inText->chunkNativeLimit >= rangeEnd && -// inText->nativeIndexingLimit >= rangeEnd - inText->chunkNativeStart) { - -// // Input UText is in one contiguous UTF-16 chunk. -// // Use Read-only aliasing UnicodeString. -// inString.setTo(FALSE, -// inText->chunkContents + rangeStart - inText->chunkNativeStart, -// rangeEnd - rangeStart); -// } else { -// // Copy the text from the original inText (UText) to inString (UnicodeString). -// // Create a map from UnicodeString indices -> UText offsets. -// utext_setNativeIndex(inText, rangeStart); -// int32_t limit = rangeEnd; -// U_ASSERT(limit <= utext_nativeLength(inText)); -// if (limit > utext_nativeLength(inText)) { -// limit = (int32_t)utext_nativeLength(inText); -// } -// inputMap.adoptInsteadAndCheckErrorCode(new UVector32(status), status); -// if (U_FAILURE(status)) { -// return 0; -// } -// while (utext_getNativeIndex(inText) < limit) { -// int32_t nativePosition = (int32_t)utext_getNativeIndex(inText); -// UChar32 c = utext_next32(inText); -// U_ASSERT(c != U_SENTINEL); -// inString.append(c); -// while (inputMap->size() < inString.length()) { -// inputMap->addElement(nativePosition, status); -// } -// } -// inputMap->addElement(limit, status); -// } - - -// if (!nfkcNorm2->isNormalized(inString, status)) { -// UnicodeString normalizedInput; -// // normalizedMap[normalizedInput position] == original UText position. -// LocalPointer normalizedMap(new UVector32(status), status); -// if (U_FAILURE(status)) { -// return 0; -// } - -// UnicodeString fragment; -// UnicodeString normalizedFragment; -// for (int32_t srcI = 0; srcI < inString.length();) { // Once per normalization chunk -// fragment.remove(); -// int32_t fragmentStartI = srcI; -// UChar32 c = inString.char32At(srcI); -// for (;;) { -// fragment.append(c); -// srcI = inString.moveIndex32(srcI, 1); -// if (srcI == inString.length()) { -// break; -// } -// c = inString.char32At(srcI); -// if (nfkcNorm2->hasBoundaryBefore(c)) { -// break; -// } -// } -// nfkcNorm2->normalize(fragment, normalizedFragment, status); -// normalizedInput.append(normalizedFragment); - -// // Map every position in the normalized chunk to the start of the chunk -// // in the original input. -// int32_t fragmentOriginalStart = inputMap.isValid() ? -// inputMap->elementAti(fragmentStartI) : fragmentStartI+rangeStart; -// while (normalizedMap->size() < normalizedInput.length()) { -// normalizedMap->addElement(fragmentOriginalStart, status); -// if (U_FAILURE(status)) { -// break; -// } -// } -// } -// U_ASSERT(normalizedMap->size() == normalizedInput.length()); -// int32_t nativeEnd = inputMap.isValid() ? -// inputMap->elementAti(inString.length()) : inString.length()+rangeStart; -// normalizedMap->addElement(nativeEnd, status); - -// inputMap = std::move(normalizedMap); -// inString = std::move(normalizedInput); -// } - -// int32_t numCodePts = inString.countChar32(); -// if (numCodePts != inString.length()) { -// // There are supplementary characters in the input. -// // The dictionary will produce boundary positions in terms of code point indexes, -// // not in terms of code unit string indexes. -// // Use the inputMap mechanism to take care of this in addition to indexing differences -// // from normalization and/or UTF-8 input. -// UBool hadExistingMap = inputMap.isValid(); -// if (!hadExistingMap) { -// inputMap.adoptInsteadAndCheckErrorCode(new UVector32(status), status); -// if (U_FAILURE(status)) { -// return 0; -// } -// } -// int32_t cpIdx = 0; -// for (int32_t cuIdx = 0; ; cuIdx = inString.moveIndex32(cuIdx, 1)) { -// U_ASSERT(cuIdx >= cpIdx); -// if (hadExistingMap) { -// inputMap->setElementAt(inputMap->elementAti(cuIdx), cpIdx); -// } else { -// inputMap->addElement(cuIdx+rangeStart, status); -// } -// cpIdx++; -// if (cuIdx == inString.length()) { -// break; -// } -// } -// } - -// // bestSnlp[i] is the snlp of the best segmentation of the first i -// // code points in the range to be matched. -// UVector32 bestSnlp(numCodePts + 1, status); -// bestSnlp.addElement(0, status); -// for(int32_t i = 1; i <= numCodePts; i++) { -// bestSnlp.addElement(kuint32max, status); -// } - - -// // prev[i] is the index of the last CJK code point in the previous word in -// // the best segmentation of the first i characters. -// UVector32 prev(numCodePts + 1, status); -// for(int32_t i = 0; i <= numCodePts; i++){ -// prev.addElement(-1, status); -// } - -// const int32_t maxWordSize = 20; -// UVector32 values(numCodePts, status); -// values.setSize(numCodePts); -// UVector32 lengths(numCodePts, status); -// lengths.setSize(numCodePts); - -// UText fu = UTEXT_INITIALIZER; -// utext_openUnicodeString(&fu, &inString, &status); - -// // Dynamic programming to find the best segmentation. - -// // In outer loop, i is the code point index, -// // ix is the corresponding string (code unit) index. -// // They differ when the string contains supplementary characters. -// int32_t ix = 0; -// bool is_prev_katakana = false; -// for (int32_t i = 0; i < numCodePts; ++i, ix = inString.moveIndex32(ix, 1)) { -// if ((uint32_t)bestSnlp.elementAti(i) == kuint32max) { -// continue; -// } - -// int32_t count; -// utext_setNativeIndex(&fu, ix); -// count = fDictionary->matches(&fu, maxWordSize, numCodePts, -// NULL, lengths.getBuffer(), values.getBuffer(), NULL); -// // Note: lengths is filled with code point lengths -// // The NULL parameter is the ignored code unit lengths. - -// // if there are no single character matches found in the dictionary -// // starting with this character, treat character as a 1-character word -// // with the highest value possible, i.e. the least likely to occur. -// // Exclude Korean characters from this treatment, as they should be left -// // together by default. -// if ((count == 0 || lengths.elementAti(0) != 1) && -// !fHangulWordSet.contains(inString.char32At(ix))) { -// values.setElementAt(maxSnlp, count); // 255 -// lengths.setElementAt(1, count++); -// } - -// for (int32_t j = 0; j < count; j++) { -// uint32_t newSnlp = (uint32_t)bestSnlp.elementAti(i) + (uint32_t)values.elementAti(j); -// int32_t ln_j_i = lengths.elementAti(j) + i; -// if (newSnlp < (uint32_t)bestSnlp.elementAti(ln_j_i)) { -// bestSnlp.setElementAt(newSnlp, ln_j_i); -// prev.setElementAt(i, ln_j_i); -// } -// } - -// // In Japanese, -// // Katakana word in single character is pretty rare. So we apply -// // the following heuristic to Katakana: any continuous run of Katakana -// // characters is considered a candidate word with a default cost -// // specified in the katakanaCost table according to its length. - -// bool is_katakana = isKatakana(inString.char32At(ix)); -// int32_t katakanaRunLength = 1; -// if (!is_prev_katakana && is_katakana) { -// int32_t j = inString.moveIndex32(ix, 1); -// // Find the end of the continuous run of Katakana characters -// while (j < inString.length() && katakanaRunLength < kMaxKatakanaGroupLength && -// isKatakana(inString.char32At(j))) { -// j = inString.moveIndex32(j, 1); -// katakanaRunLength++; -// } -// if (katakanaRunLength < kMaxKatakanaGroupLength) { -// uint32_t newSnlp = bestSnlp.elementAti(i) + getKatakanaCost(katakanaRunLength); -// if (newSnlp < (uint32_t)bestSnlp.elementAti(i+katakanaRunLength)) { -// bestSnlp.setElementAt(newSnlp, i+katakanaRunLength); -// prev.setElementAt(i, i+katakanaRunLength); // prev[j] = i; -// } -// } -// } -// is_prev_katakana = is_katakana; -// } -// utext_close(&fu); - -// // Start pushing the optimal offset index into t_boundary (t for tentative). -// // prev[numCodePts] is guaranteed to be meaningful. -// // We'll first push in the reverse order, i.e., -// // t_boundary[0] = numCodePts, and afterwards do a swap. -// UVector32 t_boundary(numCodePts+1, status); - -// int32_t numBreaks = 0; -// // No segmentation found, set boundary to end of range -// if ((uint32_t)bestSnlp.elementAti(numCodePts) == kuint32max) { -// t_boundary.addElement(numCodePts, status); -// numBreaks++; -// } else { -// for (int32_t i = numCodePts; i > 0; i = prev.elementAti(i)) { -// t_boundary.addElement(i, status); -// numBreaks++; -// } -// U_ASSERT(prev.elementAti(t_boundary.elementAti(numBreaks - 1)) == 0); -// } - -// // Add a break for the start of the dictionary range if there is not one -// // there already. -// if (foundBreaks.size() == 0 || foundBreaks.peeki() < rangeStart) { -// t_boundary.addElement(0, status); -// numBreaks++; -// } - -// // 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; -// 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 -// return numBreaks; -// } -// #endif - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ - diff --git a/src/duckdb/extension/icu/third_party/icu/common/dictbe.h b/src/duckdb/extension/icu/third_party/icu/common/dictbe.h index 731bfdff9..e512071fa 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/dictbe.h +++ b/src/duckdb/extension/icu/third_party/icu/common/dictbe.h @@ -15,11 +15,14 @@ #include "unicode/utext.h" #include "brkeng.h" +#include "hash.h" +#include "mlbe.h" #include "uvectr32.h" U_NAMESPACE_BEGIN class DictionaryMatcher; +class MlBreakEngine; class Normalizer2; /******************************************************************* @@ -59,26 +62,30 @@ class DictionaryBreakEngine : public LanguageBreakEngine { * a particular kind of break.

* * @param c A character which begins a run that the engine might handle - * @return TRUE if this engine handles the particular character and break + * @param locale The locale. + * @return true if this engine handles the particular character and break * type. */ - virtual UBool handles(UChar32 c) const; + virtual UBool handles(UChar32 c, const char* locale) const override; /** *

Find any breaks within a run in the supplied text.

* * @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 + * the end of the run of characters which the engine is capable of handling * that starts from the first character in the range. * @param startPos The start of the run within the supplied text. * @param endPos The end of the run within the supplied text. * @param foundBreaks vector of int32_t to receive the break positions + * @param status Information on any errors encountered. * @return The number of breaks found. */ virtual int32_t findBreaks( UText *text, int32_t startPos, int32_t endPos, - UVector32 &foundBreaks ) const; + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode& status ) const override; protected: @@ -96,12 +103,15 @@ class DictionaryBreakEngine : public LanguageBreakEngine { * @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 status Information on any errors encountered. * @return The number of breaks found */ virtual int32_t divideUpDictionaryRange( UText *text, int32_t rangeStart, int32_t rangeEnd, - UVector32 &foundBreaks ) const = 0; + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode& status) const = 0; }; @@ -123,7 +133,6 @@ class ThaiBreakEngine : public DictionaryBreakEngine { * @internal */ - UnicodeSet fThaiWordSet; UnicodeSet fEndWordSet; UnicodeSet fBeginWordSet; UnicodeSet fSuffixSet; @@ -153,12 +162,15 @@ class ThaiBreakEngine : public DictionaryBreakEngine { * @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 status Information on any errors encountered. * @return The number of breaks found */ virtual int32_t divideUpDictionaryRange( UText *text, int32_t rangeStart, int32_t rangeEnd, - UVector32 &foundBreaks ) const; + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode& status) const override; }; @@ -180,7 +192,6 @@ class LaoBreakEngine : public DictionaryBreakEngine { * @internal */ - UnicodeSet fLaoWordSet; UnicodeSet fEndWordSet; UnicodeSet fBeginWordSet; UnicodeSet fMarkSet; @@ -209,127 +220,134 @@ class LaoBreakEngine : public DictionaryBreakEngine { * @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 status Information on any errors encountered. * @return The number of breaks found */ virtual int32_t divideUpDictionaryRange( UText *text, int32_t rangeStart, int32_t rangeEnd, - UVector32 &foundBreaks ) const; + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode& status) const override; + +}; + +/******************************************************************* + * BurmeseBreakEngine + */ + +/** + *

BurmeseBreakEngine is a kind of DictionaryBreakEngine that uses a + * DictionaryMatcher and heuristics to determine Burmese-specific breaks.

+ * + *

After it is constructed a BurmeseBreakEngine may be shared between + * threads without synchronization.

+ */ +class BurmeseBreakEngine : public DictionaryBreakEngine { + private: + /** + * The set of characters handled by this engine + * @internal + */ + + UnicodeSet fEndWordSet; + UnicodeSet fBeginWordSet; + UnicodeSet fMarkSet; + DictionaryMatcher *fDictionary; + + public: + + /** + *

Default constructor.

+ * + * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the + * engine is deleted. + */ + BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~BurmeseBreakEngine(); + + protected: + /** + *

Divide up a range of known dictionary characters.

+ * + * @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 status Information on any errors encountered. + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode& status) const override; + +}; + +/******************************************************************* + * KhmerBreakEngine + */ + +/** + *

KhmerBreakEngine is a kind of DictionaryBreakEngine that uses a + * DictionaryMatcher and heuristics to determine Khmer-specific breaks.

+ * + *

After it is constructed a KhmerBreakEngine may be shared between + * threads without synchronization.

+ */ +class KhmerBreakEngine : public DictionaryBreakEngine { + private: + /** + * The set of characters handled by this engine + * @internal + */ + + UnicodeSet fEndWordSet; + UnicodeSet fBeginWordSet; + UnicodeSet fMarkSet; + DictionaryMatcher *fDictionary; + + public: + + /** + *

Default constructor.

+ * + * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the + * engine is deleted. + */ + KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); + + /** + *

Virtual destructor.

+ */ + virtual ~KhmerBreakEngine(); + + protected: + /** + *

Divide up a range of known dictionary characters.

+ * + * @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 status Information on any errors encountered. + * @return The number of breaks found + */ + virtual int32_t divideUpDictionaryRange( UText *text, + int32_t rangeStart, + int32_t rangeEnd, + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode& status) const override; }; -/******************************************************************* - * BurmeseBreakEngine - */ - -/** - *

BurmeseBreakEngine is a kind of DictionaryBreakEngine that uses a - * DictionaryMatcher and heuristics to determine Burmese-specific breaks.

- * - *

After it is constructed a BurmeseBreakEngine may be shared between - * threads without synchronization.

- */ -class BurmeseBreakEngine : public DictionaryBreakEngine { - private: - /** - * The set of characters handled by this engine - * @internal - */ - - UnicodeSet fBurmeseWordSet; - UnicodeSet fEndWordSet; - UnicodeSet fBeginWordSet; - UnicodeSet fMarkSet; - DictionaryMatcher *fDictionary; - - public: - - /** - *

Default constructor.

- * - * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the - * engine is deleted. - */ - BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); - - /** - *

Virtual destructor.

- */ - virtual ~BurmeseBreakEngine(); - - protected: - /** - *

Divide up a range of known dictionary characters.

- * - * @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 - * @return The number of breaks found - */ - virtual int32_t divideUpDictionaryRange( UText *text, - int32_t rangeStart, - int32_t rangeEnd, - UVector32 &foundBreaks ) const; - -}; - -/******************************************************************* - * KhmerBreakEngine - */ - -/** - *

KhmerBreakEngine is a kind of DictionaryBreakEngine that uses a - * DictionaryMatcher and heuristics to determine Khmer-specific breaks.

- * - *

After it is constructed a KhmerBreakEngine may be shared between - * threads without synchronization.

- */ -class KhmerBreakEngine : public DictionaryBreakEngine { - private: - /** - * The set of characters handled by this engine - * @internal - */ - - UnicodeSet fKhmerWordSet; - UnicodeSet fEndWordSet; - UnicodeSet fBeginWordSet; - UnicodeSet fMarkSet; - DictionaryMatcher *fDictionary; - - public: - - /** - *

Default constructor.

- * - * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the - * engine is deleted. - */ - KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status); - - /** - *

Virtual destructor.

- */ - virtual ~KhmerBreakEngine(); - - protected: - /** - *

Divide up a range of known dictionary characters.

- * - * @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 - * @return The number of breaks found - */ - virtual int32_t divideUpDictionaryRange( UText *text, - int32_t rangeStart, - int32_t rangeEnd, - UVector32 &foundBreaks ) const; - -}; - #if !UCONFIG_NO_NORMALIZATION /******************************************************************* @@ -354,12 +372,23 @@ class CjkBreakEngine : public DictionaryBreakEngine { * @internal */ UnicodeSet fHangulWordSet; - UnicodeSet fHanWordSet; - UnicodeSet fKatakanaWordSet; - UnicodeSet fHiraganaWordSet; + UnicodeSet fDigitOrOpenPunctuationOrAlphabetSet; + UnicodeSet fClosePunctuationSet; DictionaryMatcher *fDictionary; const Normalizer2 *nfkcNorm2; + MlBreakEngine *fMlBreakEngine; + bool isCj; + + private: + // Load Japanese extensions. + void loadJapaneseExtensions(UErrorCode& error); + // Load Japanese Hiragana. + void loadHiragana(UErrorCode& error); + // Initialize fSkipSet by loading Japanese Hiragana and extensions. + void initJapanesePhraseParameter(UErrorCode& error); + + Hashtable fSkipSet; public: @@ -385,12 +414,15 @@ class CjkBreakEngine : public DictionaryBreakEngine { * @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 status Information on any errors encountered. * @return The number of breaks found */ virtual int32_t divideUpDictionaryRange( UText *text, int32_t rangeStart, int32_t rangeEnd, - UVector32 &foundBreaks ) const; + UVector32 &foundBreaks, + UBool isPhraseBreaking, + UErrorCode& status) const override; }; diff --git a/src/duckdb/extension/icu/third_party/icu/common/dictionarydata.cpp b/src/duckdb/extension/icu/third_party/icu/common/dictionarydata.cpp deleted file mode 100644 index f941ad608..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/dictionarydata.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* Copyright (C) 2014-2016, International Business Machines -* Corporation and others. All Rights Reserved. -******************************************************************************* -* dictionarydata.h -* -* created on: 2012may31 -* created by: Markus W. Scherer & Maxime Serrano -*/ - -// #include "dictionarydata.h" -// #include "unicode/ucharstrie.h" -// #include "unicode/bytestrie.h" -// #include "unicode/udata.h" -// #include "cmemory.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// U_NAMESPACE_BEGIN - -// const int32_t DictionaryData::TRIE_TYPE_BYTES = 0; -// const int32_t DictionaryData::TRIE_TYPE_UCHARS = 1; -// const int32_t DictionaryData::TRIE_TYPE_MASK = 7; -// const int32_t DictionaryData::TRIE_HAS_VALUES = 8; - -// const int32_t DictionaryData::TRANSFORM_NONE = 0; -// const int32_t DictionaryData::TRANSFORM_TYPE_OFFSET = 0x1000000; -// const int32_t DictionaryData::TRANSFORM_TYPE_MASK = 0x7f000000; -// const int32_t DictionaryData::TRANSFORM_OFFSET_MASK = 0x1fffff; - -// DictionaryMatcher::~DictionaryMatcher() { -// } - -// UCharsDictionaryMatcher::~UCharsDictionaryMatcher() { -// udata_close(file); -// } - -// int32_t UCharsDictionaryMatcher::getType() const { -// return DictionaryData::TRIE_TYPE_UCHARS; -// } - -// int32_t UCharsDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t limit, -// int32_t *lengths, int32_t *cpLengths, int32_t *values, -// int32_t *prefix) const { - -// UCharsTrie uct(characters); -// int32_t startingTextIndex = (int32_t)utext_getNativeIndex(text); -// int32_t wordCount = 0; -// int32_t codePointsMatched = 0; - -// for (UChar32 c = utext_next32(text); c >= 0; c=utext_next32(text)) { -// UStringTrieResult result = (codePointsMatched == 0) ? uct.first(c) : uct.next(c); -// int32_t lengthMatched = (int32_t)utext_getNativeIndex(text) - startingTextIndex; -// codePointsMatched += 1; -// if (USTRINGTRIE_HAS_VALUE(result)) { -// if (wordCount < limit) { -// if (values != NULL) { -// values[wordCount] = uct.getValue(); -// } -// if (lengths != NULL) { -// lengths[wordCount] = lengthMatched; -// } -// if (cpLengths != NULL) { -// cpLengths[wordCount] = codePointsMatched; -// } -// ++wordCount; -// } -// if (result == USTRINGTRIE_FINAL_VALUE) { -// break; -// } -// } -// else if (result == USTRINGTRIE_NO_MATCH) { -// break; -// } -// if (lengthMatched >= maxLength) { -// break; -// } -// } - -// if (prefix != NULL) { -// *prefix = codePointsMatched; -// } -// return wordCount; -// } - -// BytesDictionaryMatcher::~BytesDictionaryMatcher() { -// udata_close(file); -// } - -// UChar32 BytesDictionaryMatcher::transform(UChar32 c) const { -// if ((transformConstant & DictionaryData::TRANSFORM_TYPE_MASK) == DictionaryData::TRANSFORM_TYPE_OFFSET) { -// if (c == 0x200D) { -// return 0xFF; -// } else if (c == 0x200C) { -// return 0xFE; -// } -// int32_t delta = c - (transformConstant & DictionaryData::TRANSFORM_OFFSET_MASK); -// if (delta < 0 || 0xFD < delta) { -// return U_SENTINEL; -// } -// return (UChar32)delta; -// } -// return c; -// } - -// int32_t BytesDictionaryMatcher::getType() const { -// return DictionaryData::TRIE_TYPE_BYTES; -// } - -// int32_t BytesDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t limit, -// int32_t *lengths, int32_t *cpLengths, int32_t *values, -// int32_t *prefix) const { -// BytesTrie bt(characters); -// int32_t startingTextIndex = (int32_t)utext_getNativeIndex(text); -// int32_t wordCount = 0; -// int32_t codePointsMatched = 0; - -// for (UChar32 c = utext_next32(text); c >= 0; c=utext_next32(text)) { -// UStringTrieResult result = (codePointsMatched == 0) ? bt.first(transform(c)) : bt.next(transform(c)); -// int32_t lengthMatched = (int32_t)utext_getNativeIndex(text) - startingTextIndex; -// codePointsMatched += 1; -// if (USTRINGTRIE_HAS_VALUE(result)) { -// if (wordCount < limit) { -// if (values != NULL) { -// values[wordCount] = bt.getValue(); -// } -// if (lengths != NULL) { -// lengths[wordCount] = lengthMatched; -// } -// if (cpLengths != NULL) { -// cpLengths[wordCount] = codePointsMatched; -// } -// ++wordCount; -// } -// if (result == USTRINGTRIE_FINAL_VALUE) { -// break; -// } -// } -// else if (result == USTRINGTRIE_NO_MATCH) { -// break; -// } -// if (lengthMatched >= maxLength) { -// break; -// } -// } - -// if (prefix != NULL) { -// *prefix = codePointsMatched; -// } -// return wordCount; -// } - - -// U_NAMESPACE_END - -// U_NAMESPACE_USE - -// U_CAPI int32_t U_EXPORT2 -// udict_swap(const UDataSwapper *ds, const void *inData, int32_t length, -// void *outData, UErrorCode *pErrorCode) { -// const UDataInfo *pInfo; -// int32_t headerSize; -// const uint8_t *inBytes; -// uint8_t *outBytes; -// const int32_t *inIndexes; -// int32_t indexes[DictionaryData::IX_COUNT]; -// int32_t i, offset, size; - -// headerSize = udata_swapDataHeader(ds, inData, length, outData, pErrorCode); -// if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) return 0; -// pInfo = (const UDataInfo *)((const char *)inData + 4); -// if (!(pInfo->dataFormat[0] == 0x44 && -// pInfo->dataFormat[1] == 0x69 && -// pInfo->dataFormat[2] == 0x63 && -// pInfo->dataFormat[3] == 0x74 && -// pInfo->formatVersion[0] == 1)) { -// udata_printError(ds, "udict_swap(): data format %02x.%02x.%02x.%02x (format version %02x) is not recognized as dictionary data\n", -// pInfo->dataFormat[0], pInfo->dataFormat[1], pInfo->dataFormat[2], pInfo->dataFormat[3], pInfo->formatVersion[0]); -// *pErrorCode = U_UNSUPPORTED_ERROR; -// return 0; -// } - -// inBytes = (const uint8_t *)inData + headerSize; -// outBytes = (uint8_t *)outData + headerSize; - -// inIndexes = (const int32_t *)inBytes; -// if (length >= 0) { -// length -= headerSize; -// if (length < (int32_t)(sizeof(indexes))) { -// udata_printError(ds, "udict_swap(): too few bytes (%d after header) for dictionary data\n", length); -// *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } -// } - -// for (i = 0; i < DictionaryData::IX_COUNT; i++) { -// indexes[i] = udata_readInt32(ds, inIndexes[i]); -// } - -// size = indexes[DictionaryData::IX_TOTAL_SIZE]; - -// if (length >= 0) { -// if (length < size) { -// udata_printError(ds, "udict_swap(): too few bytes (%d after header) for all of dictionary data\n", length); -// *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } - -// if (inBytes != outBytes) { -// uprv_memcpy(outBytes, inBytes, size); -// } - -// offset = 0; -// ds->swapArray32(ds, inBytes, sizeof(indexes), outBytes, pErrorCode); -// offset = (int32_t)sizeof(indexes); -// int32_t trieType = indexes[DictionaryData::IX_TRIE_TYPE] & DictionaryData::TRIE_TYPE_MASK; -// int32_t nextOffset = indexes[DictionaryData::IX_RESERVED1_OFFSET]; - -// if (trieType == DictionaryData::TRIE_TYPE_UCHARS) { -// ds->swapArray16(ds, inBytes + offset, nextOffset - offset, outBytes + offset, pErrorCode); -// } else if (trieType == DictionaryData::TRIE_TYPE_BYTES) { -// // nothing to do -// } else { -// udata_printError(ds, "udict_swap(): unknown trie type!\n"); -// *pErrorCode = U_UNSUPPORTED_ERROR; -// return 0; -// } - -// // these next two sections are empty in the current format, -// // but may be used later. -// offset = nextOffset; -// nextOffset = indexes[DictionaryData::IX_RESERVED2_OFFSET]; -// offset = nextOffset; -// nextOffset = indexes[DictionaryData::IX_TOTAL_SIZE]; -// offset = nextOffset; -// } -// return headerSize + size; -// } -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/dictionarydata.h b/src/duckdb/extension/icu/third_party/icu/common/dictionarydata.h index 280e22fee..8751e502d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/dictionarydata.h +++ b/src/duckdb/extension/icu/third_party/icu/common/dictionarydata.h @@ -1,191 +1,191 @@ -// // © 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. -// ******************************************************************************* -// * dictionarydata.h -// * -// * created on: 2012may31 -// * created by: Markus W. Scherer & Maxime Serrano -// */ - -// #ifndef __DICTIONARYDATA_H__ -// #define __DICTIONARYDATA_H__ - -// #include "unicode/utypes.h" - -// // #if !UCONFIG_NO_BREAK_ITERATION - -// // #include "unicode/utext.h" -// // #include "unicode/udata.h" -// // #include "udataswp.h" -// // #include "unicode/uobject.h" -// // #include "unicode/ustringtrie.h" - -// // U_NAMESPACE_BEGIN - -// // class UCharsTrie; -// // class BytesTrie; - -// // class U_COMMON_API DictionaryData : public UMemory { -// // public: -// // static const int32_t TRIE_TYPE_BYTES; // = 0; -// // static const int32_t TRIE_TYPE_UCHARS; // = 1; -// // static const int32_t TRIE_TYPE_MASK; // = 7; -// // static const int32_t TRIE_HAS_VALUES; // = 8; - -// // static const int32_t TRANSFORM_NONE; // = 0; -// // static const int32_t TRANSFORM_TYPE_OFFSET; // = 0x1000000; -// // static const int32_t TRANSFORM_TYPE_MASK; // = 0x7f000000; -// // static const int32_t TRANSFORM_OFFSET_MASK; // = 0x1fffff; - -// // enum { -// // // Byte offsets from the start of the data, after the generic header. -// // IX_STRING_TRIE_OFFSET, -// // IX_RESERVED1_OFFSET, -// // IX_RESERVED2_OFFSET, -// // IX_TOTAL_SIZE, - -// // // Trie type: TRIE_HAS_VALUES | TRIE_TYPE_BYTES etc. -// // IX_TRIE_TYPE, -// // // Transform specification: TRANSFORM_TYPE_OFFSET | 0xe00 etc. -// // IX_TRANSFORM, - -// // IX_RESERVED6, -// // IX_RESERVED7, -// // IX_COUNT -// // }; -// // }; - -// // /** -// // * Wrapper class around generic dictionaries, implementing matches(). -// // * getType() should return a TRIE_TYPE_??? constant from DictionaryData. -// // * -// // * All implementations of this interface must be thread-safe if they are to be used inside of the -// // * dictionary-based break iteration code. -// // */ -// // class U_COMMON_API DictionaryMatcher : public UMemory { -// // public: -// // DictionaryMatcher() {} -// // virtual ~DictionaryMatcher(); -// // // this should emulate CompactTrieDictionary::matches() -// // /* @param text The text in which to look for matching words. Matching begins -// // * at the current position of the UText. -// // * @param maxLength The max length of match to consider. Units are the native indexing -// // * units of the UText. -// // * @param limit Capacity of output arrays, which is also the maximum number of -// // * matching words to be found. -// // * @param lengths output array, filled with the lengths of the matches, in order, -// // * from shortest to longest. Lengths are in native indexing units -// // * of the UText. May be NULL. -// // * @param cpLengths output array, filled with the lengths of the matches, in order, -// // * from shortest to longest. Lengths are the number of Unicode code points. -// // * May be NULL. -// // * @param values Output array, filled with the values associated with the words found. -// // * May be NULL. -// // * @param prefix Output parameter, the code point length of the prefix match, even if that -// // * prefix didn't lead to a complete word. Will always be >= the cpLength -// // * of the longest complete word matched. May be NULL. -// // * @return Number of matching words found. -// // */ -// // virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, -// // int32_t *lengths, int32_t *cpLengths, int32_t *values, -// // int32_t *prefix) const = 0; - -// // /** @return DictionaryData::TRIE_TYPE_XYZ */ -// // virtual int32_t getType() const = 0; -// // }; - -// // // Implementation of the DictionaryMatcher interface for a UCharsTrie dictionary -// // class U_COMMON_API UCharsDictionaryMatcher : public DictionaryMatcher { -// // public: -// // // constructs a new UCharsDictionaryMatcher. -// // // The UDataMemory * will be closed on this object's destruction. -// // UCharsDictionaryMatcher(const UChar *c, UDataMemory *f) : characters(c), file(f) { } -// // virtual ~UCharsDictionaryMatcher(); -// // virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, -// // int32_t *lengths, int32_t *cpLengths, int32_t *values, -// // int32_t *prefix) const; -// // virtual int32_t getType() const; -// // private: -// // const UChar *characters; -// // UDataMemory *file; -// // }; - -// // // Implementation of the DictionaryMatcher interface for a BytesTrie dictionary -// // class U_COMMON_API BytesDictionaryMatcher : public DictionaryMatcher { -// // public: -// // // constructs a new BytesTrieDictionaryMatcher -// // // the transform constant should be the constant read from the file, not a masked version! -// // // the UDataMemory * fed in here will be closed on this object's destruction -// // BytesDictionaryMatcher(const char *c, int32_t t, UDataMemory *f) -// // : characters(c), transformConstant(t), file(f) { } -// // virtual ~BytesDictionaryMatcher(); -// // virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, -// // int32_t *lengths, int32_t *cpLengths, int32_t *values, -// // int32_t *prefix) const; -// // virtual int32_t getType() const; -// // private: -// // UChar32 transform(UChar32 c) const; - -// // const char *characters; -// // int32_t transformConstant; -// // UDataMemory *file; -// // }; - -// // U_NAMESPACE_END - -// // U_CAPI int32_t U_EXPORT2 -// // udict_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode); - -// // /** -// // * Format of dictionary .dict data files. -// // * Format version 1.0. -// // * -// // * A dictionary .dict data file contains a byte-serialized BytesTrie or -// // * a UChars-serialized UCharsTrie. -// // * Such files are used in dictionary-based break iteration (DBBI). -// // * -// // * For a BytesTrie, a transformation type is specified for -// // * transforming Unicode strings into byte sequences. -// // * -// // * A .dict file begins with a standard ICU data file header -// // * (DataHeader, see ucmndata.h and unicode/udata.h). -// // * The UDataInfo.dataVersion field is currently unused (set to 0.0.0.0). -// // * -// // * After the header, the file contains the following parts. -// // * Constants are defined in the DictionaryData class. -// // * -// // * For the data structure of BytesTrie & UCharsTrie see -// // * http://site.icu-project.org/design/struct/tries -// // * and the bytestrie.h and ucharstrie.h header files. -// // * -// // * int32_t indexes[indexesLength]; -- indexesLength=indexes[IX_STRING_TRIE_OFFSET]/4; -// // * -// // * The first four indexes are byte offsets in ascending order. -// // * Each byte offset marks the start of the next part in the data file, -// // * and the end of the previous one. -// // * When two consecutive byte offsets are the same, then the corresponding part is empty. -// // * Byte offsets are offsets from after the header, -// // * that is, from the beginning of the indexes[]. -// // * Each part starts at an offset with proper alignment for its data. -// // * If necessary, the previous part may include padding bytes to achieve this alignment. -// // * -// // * trieType=indexes[IX_TRIE_TYPE] defines the trie type. -// // * transform=indexes[IX_TRANSFORM] defines the Unicode-to-bytes transformation. -// // * If the transformation type is TRANSFORM_TYPE_OFFSET, -// // * then the lower 21 bits contain the offset code point. -// // * Each code point c is mapped to byte b = (c - offset). -// // * Code points outside the range offset..(offset+0xff) cannot be mapped -// // * and do not occur in the dictionary. -// // * -// // * stringTrie; -- a serialized BytesTrie or UCharsTrie -// // * -// // * The dictionary maps strings to specific values (TRIE_HAS_VALUES bit set in trieType), -// // * or it maps all strings to 0 (TRIE_HAS_VALUES bit not set). -// // */ - -// // #endif /* !UCONFIG_NO_BREAK_ITERATION */ -// // #endif /* __DICTIONARYDATA_H__ */ +// © 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. +******************************************************************************* +* dictionarydata.h +* +* created on: 2012may31 +* created by: Markus W. Scherer & Maxime Serrano +*/ + +#ifndef __DICTIONARYDATA_H__ +#define __DICTIONARYDATA_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/utext.h" +#include "unicode/udata.h" +#include "udataswp.h" +#include "unicode/uobject.h" +#include "unicode/ustringtrie.h" + +U_NAMESPACE_BEGIN + +class UCharsTrie; +class BytesTrie; + +class U_COMMON_API DictionaryData : public UMemory { +public: + static const int32_t TRIE_TYPE_BYTES; // = 0; + static const int32_t TRIE_TYPE_UCHARS; // = 1; + static const int32_t TRIE_TYPE_MASK; // = 7; + static const int32_t TRIE_HAS_VALUES; // = 8; + + static const int32_t TRANSFORM_NONE; // = 0; + static const int32_t TRANSFORM_TYPE_OFFSET; // = 0x1000000; + static const int32_t TRANSFORM_TYPE_MASK; // = 0x7f000000; + static const int32_t TRANSFORM_OFFSET_MASK; // = 0x1fffff; + + enum { + // Byte offsets from the start of the data, after the generic header. + IX_STRING_TRIE_OFFSET, + IX_RESERVED1_OFFSET, + IX_RESERVED2_OFFSET, + IX_TOTAL_SIZE, + + // Trie type: TRIE_HAS_VALUES | TRIE_TYPE_BYTES etc. + IX_TRIE_TYPE, + // Transform specification: TRANSFORM_TYPE_OFFSET | 0xe00 etc. + IX_TRANSFORM, + + IX_RESERVED6, + IX_RESERVED7, + IX_COUNT + }; +}; + +/** + * Wrapper class around generic dictionaries, implementing matches(). + * getType() should return a TRIE_TYPE_??? constant from DictionaryData. + * + * All implementations of this interface must be thread-safe if they are to be used inside of the + * dictionary-based break iteration code. + */ +class U_COMMON_API DictionaryMatcher : public UMemory { +public: + DictionaryMatcher() {} + virtual ~DictionaryMatcher(); + // this should emulate CompactTrieDictionary::matches() + /* @param text The text in which to look for matching words. Matching begins + * at the current position of the UText. + * @param maxLength The max length of match to consider. Units are the native indexing + * units of the UText. + * @param limit Capacity of output arrays, which is also the maximum number of + * matching words to be found. + * @param lengths output array, filled with the lengths of the matches, in order, + * from shortest to longest. Lengths are in native indexing units + * of the UText. May be nullptr. + * @param cpLengths output array, filled with the lengths of the matches, in order, + * from shortest to longest. Lengths are the number of Unicode code points. + * May be nullptr. + * @param values Output array, filled with the values associated with the words found. + * May be nullptr. + * @param prefix Output parameter, the code point length of the prefix match, even if that + * prefix didn't lead to a complete word. Will always be >= the cpLength + * of the longest complete word matched. May be nullptr. + * @return Number of matching words found. + */ + virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, + int32_t *lengths, int32_t *cpLengths, int32_t *values, + int32_t *prefix) const = 0; + + /** @return DictionaryData::TRIE_TYPE_XYZ */ + virtual int32_t getType() const = 0; +}; + +// Implementation of the DictionaryMatcher interface for a UCharsTrie dictionary +class U_COMMON_API UCharsDictionaryMatcher : public DictionaryMatcher { +public: + // constructs a new UCharsDictionaryMatcher. + // The UDataMemory * will be closed on this object's destruction. + UCharsDictionaryMatcher(const char16_t *c, UDataMemory *f) : characters(c), file(f) { } + virtual ~UCharsDictionaryMatcher(); + virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, + int32_t *lengths, int32_t *cpLengths, int32_t *values, + int32_t *prefix) const override; + virtual int32_t getType() const override; +private: + const char16_t *characters; + UDataMemory *file; +}; + +// Implementation of the DictionaryMatcher interface for a BytesTrie dictionary +class U_COMMON_API BytesDictionaryMatcher : public DictionaryMatcher { +public: + // constructs a new BytesTrieDictionaryMatcher + // the transform constant should be the constant read from the file, not a masked version! + // the UDataMemory * fed in here will be closed on this object's destruction + BytesDictionaryMatcher(const char *c, int32_t t, UDataMemory *f) + : characters(c), transformConstant(t), file(f) { } + virtual ~BytesDictionaryMatcher(); + virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit, + int32_t *lengths, int32_t *cpLengths, int32_t *values, + int32_t *prefix) const override; + virtual int32_t getType() const override; +private: + UChar32 transform(UChar32 c) const; + + const char *characters; + int32_t transformConstant; + UDataMemory *file; +}; + +U_NAMESPACE_END + +U_CAPI int32_t U_EXPORT2 +udict_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode); + +/** + * Format of dictionary .dict data files. + * Format version 1.0. + * + * A dictionary .dict data file contains a byte-serialized BytesTrie or + * a UChars-serialized UCharsTrie. + * Such files are used in dictionary-based break iteration (DBBI). + * + * For a BytesTrie, a transformation type is specified for + * transforming Unicode strings into byte sequences. + * + * A .dict file begins with a standard ICU data file header + * (DataHeader, see ucmndata.h and unicode/udata.h). + * The UDataInfo.dataVersion field is currently unused (set to 0.0.0.0). + * + * After the header, the file contains the following parts. + * Constants are defined in the DictionaryData class. + * + * For the data structure of BytesTrie & UCharsTrie see + * https://icu.unicode.org/design/struct/tries + * and the bytestrie.h and ucharstrie.h header files. + * + * int32_t indexes[indexesLength]; -- indexesLength=indexes[IX_STRING_TRIE_OFFSET]/4; + * + * The first four indexes are byte offsets in ascending order. + * Each byte offset marks the start of the next part in the data file, + * and the end of the previous one. + * When two consecutive byte offsets are the same, then the corresponding part is empty. + * Byte offsets are offsets from after the header, + * that is, from the beginning of the indexes[]. + * Each part starts at an offset with proper alignment for its data. + * If necessary, the previous part may include padding bytes to achieve this alignment. + * + * trieType=indexes[IX_TRIE_TYPE] defines the trie type. + * transform=indexes[IX_TRANSFORM] defines the Unicode-to-bytes transformation. + * If the transformation type is TRANSFORM_TYPE_OFFSET, + * then the lower 21 bits contain the offset code point. + * Each code point c is mapped to byte b = (c - offset). + * Code points outside the range offset..(offset+0xff) cannot be mapped + * and do not occur in the dictionary. + * + * stringTrie; -- a serialized BytesTrie or UCharsTrie + * + * The dictionary maps strings to specific values (TRIE_HAS_VALUES bit set in trieType), + * or it maps all strings to 0 (TRIE_HAS_VALUES bit not set). + */ + +#endif /* !UCONFIG_NO_BREAK_ITERATION */ +#endif /* __DICTIONARYDATA_H__ */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/edits.cpp b/src/duckdb/extension/icu/third_party/icu/common/edits.cpp index 95f0c19a7..3348145d4 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/edits.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/edits.cpp @@ -35,7 +35,7 @@ const int32_t LENGTH_IN_2TRAIL = 62; } // namespace -void Edits::releaseArray() U_NOEXCEPT { +void Edits::releaseArray() noexcept { if (array != stackArray) { uprv_free(array); } @@ -63,7 +63,7 @@ Edits &Edits::copyArray(const Edits &other) { return *this; } -Edits &Edits::moveArray(Edits &src) U_NOEXCEPT { +Edits &Edits::moveArray(Edits &src) noexcept { if (U_FAILURE(errorCode_)) { length = delta = numChanges = 0; return *this; @@ -86,6 +86,7 @@ Edits &Edits::moveArray(Edits &src) U_NOEXCEPT { } Edits &Edits::operator=(const Edits &other) { + if (this == &other) { return *this; } // self-assignment: no-op length = other.length; delta = other.delta; numChanges = other.numChanges; @@ -93,7 +94,7 @@ Edits &Edits::operator=(const Edits &other) { return copyArray(other); } -Edits &Edits::operator=(Edits &&src) U_NOEXCEPT { +Edits &Edits::operator=(Edits &&src) noexcept { length = src.length; delta = src.delta; numChanges = src.numChanges; @@ -105,7 +106,7 @@ Edits::~Edits() { releaseArray(); } -void Edits::reset() U_NOEXCEPT { +void Edits::reset() noexcept { length = delta = numChanges = 0; errorCode_ = U_ZERO_ERROR; } @@ -220,7 +221,7 @@ UBool Edits::growArray() { // 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; + return false; } else if (capacity >= (INT32_MAX / 2)) { newCapacity = INT32_MAX; } else { @@ -229,25 +230,25 @@ UBool Edits::growArray() { // 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; + return false; } uint16_t *newArray = (uint16_t *)uprv_malloc((size_t)newCapacity * 2); - if (newArray == NULL) { + if (newArray == nullptr) { errorCode_ = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } uprv_memcpy(newArray, array, (size_t)length * 2); releaseArray(); array = newArray; capacity = newCapacity; - return TRUE; + return true; } UBool Edits::copyErrorTo(UErrorCode &outErrorCode) const { - if (U_FAILURE(outErrorCode)) { return TRUE; } - if (U_SUCCESS(errorCode_)) { return FALSE; } + if (U_FAILURE(outErrorCode)) { return true; } + if (U_SUCCESS(errorCode_)) { return false; } outErrorCode = errorCode_; - return TRUE; + return true; } Edits &Edits::mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode) { @@ -256,7 +257,7 @@ Edits &Edits::mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &error // Parallel iteration over both Edits. Iterator abIter = ab.getFineIterator(); Iterator bcIter = bc.getFineIterator(); - UBool abHasNext = TRUE, bcHasNext = TRUE; + 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; @@ -399,7 +400,7 @@ Edits &Edits::mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &error 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), + dir(0), changed(false), oldLength_(0), newLength_(0), srcIndex(0), replIndex(0), destIndex(0) {} int32_t Edits::Iterator::readLength(int32_t head) { @@ -440,16 +441,16 @@ void Edits::Iterator::updatePreviousIndexes() { UBool Edits::Iterator::noNext() { // No change before or beyond the string. dir = 0; - changed = FALSE; + changed = false; oldLength_ = newLength_ = 0; - return FALSE; + 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; } + 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) { @@ -463,7 +464,7 @@ UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) { // 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; + return true; } } dir = 1; @@ -472,7 +473,7 @@ UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) { // Fine-grained iterator: Continue a sequence of compressed changes. if (remaining > 1) { --remaining; - return TRUE; + return true; } remaining = 0; } @@ -482,7 +483,7 @@ UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) { int32_t u = array[index++]; if (u <= MAX_UNCHANGED) { // Combine adjacent unchanged ranges. - changed = FALSE; + changed = false; oldLength_ = u + 1; while (index < length && (u = array[index]) <= MAX_UNCHANGED) { ++index; @@ -497,10 +498,10 @@ UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) { // already fetched u > MAX_UNCHANGED at index ++index; } else { - return TRUE; + return true; } } - changed = TRUE; + changed = true; if (u <= MAX_SHORT_CHANGE) { int32_t oldLen = u >> 12; int32_t newLen = (u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH; @@ -515,14 +516,14 @@ UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) { if (num > 1) { remaining = num; // This is the first of two or more changes. } - return TRUE; + return true; } } else { U_ASSERT(u <= 0x7fff); oldLength_ = readLength((u >> 6) & 0x3f); newLength_ = readLength(u & 0x3f); if (!coarse) { - return TRUE; + return true; } } // Combine adjacent changes. @@ -538,14 +539,14 @@ UBool Edits::Iterator::next(UBool onlyChanges, UErrorCode &errorCode) { newLength_ += readLength(u & 0x3f); } } - return TRUE; + 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; } + 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) { @@ -558,7 +559,7 @@ UBool Edits::Iterator::previous(UErrorCode &errorCode) { // Stay on the current one of a sequence of compressed changes. --index; // previous() rests on the sequence unit. dir = -1; - return TRUE; + return true; } updateNextIndexes(); } @@ -571,7 +572,7 @@ UBool Edits::Iterator::previous(UErrorCode &errorCode) { if (remaining <= (u & SHORT_CHANGE_NUM_MASK)) { ++remaining; updatePreviousIndexes(); - return TRUE; + return true; } remaining = 0; } @@ -581,7 +582,7 @@ UBool Edits::Iterator::previous(UErrorCode &errorCode) { int32_t u = array[--index]; if (u <= MAX_UNCHANGED) { // Combine adjacent unchanged ranges. - changed = FALSE; + changed = false; oldLength_ = u + 1; while (index > 0 && (u = array[index - 1]) <= MAX_UNCHANGED) { --index; @@ -590,9 +591,9 @@ UBool Edits::Iterator::previous(UErrorCode &errorCode) { newLength_ = oldLength_; // No need to handle onlyChanges as long as previous() is called only from findIndex(). updatePreviousIndexes(); - return TRUE; + return true; } - changed = TRUE; + changed = true; if (u <= MAX_SHORT_CHANGE) { int32_t oldLen = u >> 12; int32_t newLen = (u >> 9) & MAX_SHORT_CHANGE_NEW_LENGTH; @@ -608,7 +609,7 @@ UBool Edits::Iterator::previous(UErrorCode &errorCode) { remaining = 1; // This is the last of two or more changes. } updatePreviousIndexes(); - return TRUE; + return true; } } else { if (u <= 0x7fff) { @@ -628,7 +629,7 @@ UBool Edits::Iterator::previous(UErrorCode &errorCode) { } if (!coarse) { updatePreviousIndexes(); - return TRUE; + return true; } } // Combine adjacent changes. @@ -647,7 +648,7 @@ UBool Edits::Iterator::previous(UErrorCode &errorCode) { } } updatePreviousIndexes(); - return TRUE; + return true; } int32_t Edits::Iterator::findIndex(int32_t i, UBool findSource, UErrorCode &errorCode) { @@ -704,7 +705,7 @@ int32_t Edits::Iterator::findIndex(int32_t i, UBool findSource, UErrorCode &erro // The index is in the current span. return 0; } - while (next(FALSE, errorCode)) { + while (next(false, errorCode)) { if (findSource) { spanStart = srcIndex; spanLength = oldLength_; @@ -738,7 +739,7 @@ int32_t Edits::Iterator::findIndex(int32_t i, UBool findSource, UErrorCode &erro } int32_t Edits::Iterator::destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode) { - int32_t where = findIndex(i, TRUE, errorCode); + int32_t where = findIndex(i, true, errorCode); if (where < 0) { // Error or before the string. return 0; @@ -757,7 +758,7 @@ int32_t Edits::Iterator::destinationIndexFromSourceIndex(int32_t i, UErrorCode & } int32_t Edits::Iterator::sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode) { - int32_t where = findIndex(i, FALSE, errorCode); + int32_t where = findIndex(i, false, errorCode); if (where < 0) { // Error or before the string. return 0; diff --git a/src/duckdb/extension/icu/third_party/icu/common/emojiprops.cpp b/src/duckdb/extension/icu/third_party/icu/common/emojiprops.cpp new file mode 100644 index 000000000..f2b3f4762 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/common/emojiprops.cpp @@ -0,0 +1,220 @@ +// © 2021 and later: Unicode, Inc. and others. +// License & terms of use: https://www.unicode.org/copyright.html + +// emojiprops.cpp +// created: 2021sep04 Markus W. Scherer + +#include "unicode/utypes.h" +#include "unicode/uchar.h" +#include "unicode/ucharstrie.h" +#include "unicode/ucptrie.h" +#include "unicode/udata.h" +#include "unicode/ustringtrie.h" +#include "unicode/utf16.h" +#include "emojiprops.h" +#include "ucln.h" +#include "ucln_cmn.h" +#include "umutex.h" +#include "uset_imp.h" + +U_NAMESPACE_BEGIN + +namespace { + +EmojiProps *singleton = nullptr; +icu::UInitOnce emojiInitOnce {}; + +UBool U_CALLCONV emojiprops_cleanup() { + delete singleton; + singleton = nullptr; + emojiInitOnce.reset(); + return true; +} + +void U_CALLCONV initSingleton(UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return; } + singleton = new EmojiProps(errorCode); + if (singleton == nullptr) { + errorCode = U_MEMORY_ALLOCATION_ERROR; + } else if (U_FAILURE(errorCode)) { + delete singleton; + singleton = nullptr; + } + ucln_common_registerCleanup(UCLN_COMMON_EMOJIPROPS, emojiprops_cleanup); +} + +// TODO: turn this into a shared helper function +// Requires the major version to match, and then requires at least the minor version. +UBool udata_isAcceptableMajorMinor( + const UDataInfo &info, const char16_t *dataFormat, uint8_t major, uint8_t minor) { + return + info.size >= 20 && + info.isBigEndian == U_IS_BIG_ENDIAN && + info.charsetFamily == U_CHARSET_FAMILY && + info.dataFormat[0] == dataFormat[0] && + info.dataFormat[1] == dataFormat[1] && + info.dataFormat[2] == dataFormat[2] && + info.dataFormat[3] == dataFormat[3] && + info.formatVersion[0] == major && + info.formatVersion[1] >= minor; +} + +} // namespace + +EmojiProps::~EmojiProps() { + udata_close(memory); + ucptrie_close(cpTrie); +} + +const EmojiProps * +EmojiProps::getSingleton(UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return nullptr; } + umtx_initOnce(emojiInitOnce, &initSingleton, errorCode); + return singleton; +} + +UBool U_CALLCONV +EmojiProps::isAcceptable(void * /*context*/, const char * /*type*/, const char * /*name*/, + const UDataInfo *pInfo) { + return udata_isAcceptableMajorMinor(*pInfo, u"Emoj", 1, 0); +} + +void +EmojiProps::load(UErrorCode &errorCode) { + memory = udata_openChoice(nullptr, "icu", "uemoji", isAcceptable, this, &errorCode); + if (U_FAILURE(errorCode)) { return; } + const uint8_t *inBytes = (const uint8_t *)udata_getMemory(memory); + const int32_t *inIndexes = (const int32_t *)inBytes; + int32_t indexesLength = inIndexes[IX_CPTRIE_OFFSET] / 4; + if (indexesLength <= IX_RGI_EMOJI_ZWJ_SEQUENCE_TRIE_OFFSET) { + errorCode = U_INVALID_FORMAT_ERROR; // Not enough indexes. + return; + } + + int32_t i = IX_CPTRIE_OFFSET; + int32_t offset = inIndexes[i++]; + int32_t nextOffset = inIndexes[i]; + cpTrie = ucptrie_openFromBinary(UCPTRIE_TYPE_FAST, UCPTRIE_VALUE_BITS_8, + inBytes + offset, nextOffset - offset, nullptr, &errorCode); + if (U_FAILURE(errorCode)) { + return; + } + + for (i = IX_BASIC_EMOJI_TRIE_OFFSET; i <= IX_RGI_EMOJI_ZWJ_SEQUENCE_TRIE_OFFSET; ++i) { + offset = inIndexes[i]; + nextOffset = inIndexes[i + 1]; + // Set/leave nullptr if there is no UCharsTrie. + const char16_t *p = nextOffset > offset ? (const char16_t *)(inBytes + offset) : nullptr; + stringTries[getStringTrieIndex(i)] = p; + } +} + +void +EmojiProps::addPropertyStarts(const USetAdder *sa, UErrorCode & /*errorCode*/) const { + // Add the start code point of each same-value range of the trie. + UChar32 start = 0, end; + uint32_t value; + while ((end = ucptrie_getRange(cpTrie, start, UCPMAP_RANGE_NORMAL, 0, + nullptr, nullptr, &value)) >= 0) { + sa->add(sa->set, start); + start = end + 1; + } +} + +UBool +EmojiProps::hasBinaryProperty(UChar32 c, UProperty which) { + UErrorCode errorCode = U_ZERO_ERROR; + const EmojiProps *ep = getSingleton(errorCode); + return U_SUCCESS(errorCode) && ep->hasBinaryPropertyImpl(c, which); +} + +UBool +EmojiProps::hasBinaryPropertyImpl(UChar32 c, UProperty which) const { + if (which < UCHAR_EMOJI || UCHAR_RGI_EMOJI < which) { + return false; + } + // Note: UCHAR_REGIONAL_INDICATOR is a single, hardcoded range implemented elsewhere. + static constexpr int8_t bitFlags[] = { + BIT_EMOJI, // UCHAR_EMOJI=57 + BIT_EMOJI_PRESENTATION, // UCHAR_EMOJI_PRESENTATION=58 + BIT_EMOJI_MODIFIER, // UCHAR_EMOJI_MODIFIER=59 + BIT_EMOJI_MODIFIER_BASE, // UCHAR_EMOJI_MODIFIER_BASE=60 + BIT_EMOJI_COMPONENT, // UCHAR_EMOJI_COMPONENT=61 + -1, // UCHAR_REGIONAL_INDICATOR=62 + -1, // UCHAR_PREPENDED_CONCATENATION_MARK=63 + BIT_EXTENDED_PICTOGRAPHIC, // UCHAR_EXTENDED_PICTOGRAPHIC=64 + BIT_BASIC_EMOJI, // UCHAR_BASIC_EMOJI=65 + -1, // UCHAR_EMOJI_KEYCAP_SEQUENCE=66 + -1, // UCHAR_RGI_EMOJI_MODIFIER_SEQUENCE=67 + -1, // UCHAR_RGI_EMOJI_FLAG_SEQUENCE=68 + -1, // UCHAR_RGI_EMOJI_TAG_SEQUENCE=69 + -1, // UCHAR_RGI_EMOJI_ZWJ_SEQUENCE=70 + BIT_BASIC_EMOJI, // UCHAR_RGI_EMOJI=71 + }; + int32_t bit = bitFlags[which - UCHAR_EMOJI]; + if (bit < 0) { + return false; // not a property that we support in this function + } + uint8_t bits = UCPTRIE_FAST_GET(cpTrie, UCPTRIE_8, c); + return (bits >> bit) & 1; +} + +UBool +EmojiProps::hasBinaryProperty(const char16_t *s, int32_t length, UProperty which) { + UErrorCode errorCode = U_ZERO_ERROR; + const EmojiProps *ep = getSingleton(errorCode); + return U_SUCCESS(errorCode) && ep->hasBinaryPropertyImpl(s, length, which); +} + +UBool +EmojiProps::hasBinaryPropertyImpl(const char16_t *s, int32_t length, UProperty which) const { + if (s == nullptr && length != 0) { return false; } + if (length <= 0 && (length == 0 || *s == 0)) { return false; } // empty string + // The caller should have delegated single code points to hasBinaryProperty(c, which). + if (which < UCHAR_BASIC_EMOJI || UCHAR_RGI_EMOJI < which) { + return false; + } + UProperty firstProp = which, lastProp = which; + if (which == UCHAR_RGI_EMOJI) { + // RGI_Emoji is the union of the other emoji properties of strings. + firstProp = UCHAR_BASIC_EMOJI; + lastProp = UCHAR_RGI_EMOJI_ZWJ_SEQUENCE; + } + for (int32_t prop = firstProp; prop <= lastProp; ++prop) { + const char16_t *trieUChars = stringTries[prop - UCHAR_BASIC_EMOJI]; + if (trieUChars != nullptr) { + UCharsTrie trie(trieUChars); + UStringTrieResult result = trie.next(s, length); + if (USTRINGTRIE_HAS_VALUE(result)) { + return true; + } + } + } + return false; +} + +void +EmojiProps::addStrings(const USetAdder *sa, UProperty which, UErrorCode &errorCode) const { + if (U_FAILURE(errorCode)) { return; } + if (which < UCHAR_BASIC_EMOJI || UCHAR_RGI_EMOJI < which) { + return; + } + UProperty firstProp = which, lastProp = which; + if (which == UCHAR_RGI_EMOJI) { + // RGI_Emoji is the union of the other emoji properties of strings. + firstProp = UCHAR_BASIC_EMOJI; + lastProp = UCHAR_RGI_EMOJI_ZWJ_SEQUENCE; + } + for (int32_t prop = firstProp; prop <= lastProp; ++prop) { + const char16_t *trieUChars = stringTries[prop - UCHAR_BASIC_EMOJI]; + if (trieUChars != nullptr) { + UCharsTrie::Iterator iter(trieUChars, 0, errorCode); + while (iter.next(errorCode)) { + const UnicodeString &s = iter.getString(); + sa->addString(sa->set, s.getBuffer(), s.length()); + } + } + } +} + +U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/emojiprops.h b/src/duckdb/extension/icu/third_party/icu/common/emojiprops.h new file mode 100644 index 000000000..777b7b11a --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/common/emojiprops.h @@ -0,0 +1,90 @@ +// © 2021 and later: Unicode, Inc. and others. +// License & terms of use: https://www.unicode.org/copyright.html + +// emojiprops.h +// created: 2021sep03 Markus W. Scherer + +#ifndef __EMOJIPROPS_H__ +#define __EMOJIPROPS_H__ + +#include "unicode/utypes.h" +#include "unicode/ucptrie.h" +#include "unicode/udata.h" +#include "unicode/uobject.h" +#include "uset_imp.h" + +U_NAMESPACE_BEGIN + +class EmojiProps : public UMemory { +public: + // @internal + EmojiProps(UErrorCode &errorCode) { load(errorCode); } + ~EmojiProps(); + + static const EmojiProps *getSingleton(UErrorCode &errorCode); + static UBool hasBinaryProperty(UChar32 c, UProperty which); + static UBool hasBinaryProperty(const char16_t *s, int32_t length, UProperty which); + + void addPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const; + void addStrings(const USetAdder *sa, UProperty which, UErrorCode &errorCode) const; + + enum { + // Byte offsets from the start of the data, after the generic header, + // in ascending order. + // UCPTrie=CodePointTrie, follows the indexes + IX_CPTRIE_OFFSET, + IX_RESERVED1, + IX_RESERVED2, + IX_RESERVED3, + + // UCharsTrie=CharsTrie + IX_BASIC_EMOJI_TRIE_OFFSET, + IX_EMOJI_KEYCAP_SEQUENCE_TRIE_OFFSET, + IX_RGI_EMOJI_MODIFIER_SEQUENCE_TRIE_OFFSET, + IX_RGI_EMOJI_FLAG_SEQUENCE_TRIE_OFFSET, + IX_RGI_EMOJI_TAG_SEQUENCE_TRIE_OFFSET, + IX_RGI_EMOJI_ZWJ_SEQUENCE_TRIE_OFFSET, + IX_RESERVED10, + IX_RESERVED11, + IX_RESERVED12, + IX_TOTAL_SIZE, + + // Not initially byte offsets. + IX_RESERVED14, + IX_RESERVED15, + IX_COUNT // 16 + }; + + // Properties in the code point trie. + enum { + // https://www.unicode.org/reports/tr51/#Emoji_Properties + BIT_EMOJI, + BIT_EMOJI_PRESENTATION, + BIT_EMOJI_MODIFIER, + BIT_EMOJI_MODIFIER_BASE, + BIT_EMOJI_COMPONENT, + BIT_EXTENDED_PICTOGRAPHIC, + // https://www.unicode.org/reports/tr51/#Emoji_Sets + BIT_BASIC_EMOJI + }; + +private: + static UBool U_CALLCONV + isAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo); + /** Input i: One of the IX_..._TRIE_OFFSET indexes into the data file indexes[] array. */ + static int32_t getStringTrieIndex(int32_t i) { + return i - IX_BASIC_EMOJI_TRIE_OFFSET; + } + + void load(UErrorCode &errorCode); + UBool hasBinaryPropertyImpl(UChar32 c, UProperty which) const; + UBool hasBinaryPropertyImpl(const char16_t *s, int32_t length, UProperty which) const; + + UDataMemory *memory = nullptr; + UCPTrie *cpTrie = nullptr; + const char16_t *stringTries[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; +}; + +U_NAMESPACE_END + +#endif // __EMOJIPROPS_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/common/filteredbrk.cpp b/src/duckdb/extension/icu/third_party/icu/common/filteredbrk.cpp deleted file mode 100644 index 59b914fbb..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/filteredbrk.cpp +++ /dev/null @@ -1,710 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* Copyright (C) 2014-2015, International Business Machines Corporation and -* others. All Rights Reserved. -******************************************************************************* -*/ - -#include "unicode/utypes.h" -// #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION - -// #include "cmemory.h" - -// #include "unicode/filteredbrk.h" -// #include "unicode/ucharstriebuilder.h" -// #include "unicode/ures.h" - -// #include "uresimp.h" // ures_getByKeyWithFallback -// #include "ubrkimpl.h" // U_ICUDATA_BRKITR -// #include "uvector.h" -// #include "cmemory.h" - -// U_NAMESPACE_BEGIN - -// #ifndef FB_DEBUG -// #define FB_DEBUG 0 -// #endif - -// #if FB_DEBUG -// #include -// static void _fb_trace(const char *m, const UnicodeString *s, UBool b, int32_t d, const char *f, int l) { -// char buf[2048]; -// if(s) { -// s->extract(0,s->length(),buf,2048); -// } else { -// strcpy(buf,"NULL"); -// } -// fprintf(stderr,"%s:%d: %s. s='%s'(%p), b=%c, d=%d\n", -// f, l, m, buf, (const void*)s, b?'T':'F',(int)d); -// } - -// #define FB_TRACE(m,s,b,d) _fb_trace(m,s,b,d,__FILE__,__LINE__) -// #else -// #define FB_TRACE(m,s,b,d) -// #endif - -// /** -// * Used with sortedInsert() -// */ -// static int8_t U_CALLCONV compareUnicodeString(UElement t1, UElement t2) { -// const UnicodeString &a = *(const UnicodeString*)t1.pointer; -// const UnicodeString &b = *(const UnicodeString*)t2.pointer; -// return a.compare(b); -// } - -// /** -// * A UVector which implements a set of strings. -// */ -// class U_COMMON_API UStringSet : public UVector { -// public: -// UStringSet(UErrorCode &status) : UVector(uprv_deleteUObject, -// uhash_compareUnicodeString, -// 1, -// status) {} -// virtual ~UStringSet(); -// /** -// * Is this UnicodeSet contained? -// */ -// inline UBool contains(const UnicodeString& s) { -// return contains((void*) &s); -// } -// using UVector::contains; -// /** -// * Return the ith UnicodeString alias -// */ -// inline const UnicodeString* getStringAt(int32_t i) const { -// return (const UnicodeString*)elementAt(i); -// } -// /** -// * Adopt the UnicodeString if not already contained. -// * Caller no longer owns the pointer in any case. -// * @return true if adopted successfully, false otherwise (error, or else duplicate) -// */ -// inline UBool adopt(UnicodeString *str, UErrorCode &status) { -// if(U_FAILURE(status) || contains(*str)) { -// delete str; -// return false; -// } else { -// sortedInsert(str, compareUnicodeString, status); -// if(U_FAILURE(status)) { -// delete str; -// return false; -// } -// return true; -// } -// } -// /** -// * Add by value. -// * @return true if successfully adopted. -// */ -// inline UBool add(const UnicodeString& str, UErrorCode &status) { -// if(U_FAILURE(status)) return false; -// UnicodeString *t = new UnicodeString(str); -// if(t==NULL) { -// status = U_MEMORY_ALLOCATION_ERROR; return false; -// } -// return adopt(t, status); -// } -// /** -// * Remove this string. -// * @return true if successfully removed, false otherwise (error, or else it wasn't there) -// */ -// inline UBool remove(const UnicodeString &s, UErrorCode &status) { -// if(U_FAILURE(status)) return false; -// return removeElement((void*) &s); -// } -// }; - -// /** -// * Virtual, won't be inlined -// */ -// UStringSet::~UStringSet() {} - -// /* ----------------------------------------------------------- */ - - -// /* Filtered Break constants */ -// static const int32_t kPARTIAL = (1<<0); //< partial - need to run through forward trie -// static const int32_t kMATCH = (1<<1); //< exact match - skip this one. -// static const int32_t kSuppressInReverse = (1<<0); -// static const int32_t kAddToForward = (1<<1); -// static const UChar kFULLSTOP = 0x002E; // '.' - -// /** -// * Shared data for SimpleFilteredSentenceBreakIterator -// */ -// class SimpleFilteredSentenceBreakData : public UMemory { -// public: -// SimpleFilteredSentenceBreakData(UCharsTrie *forwards, UCharsTrie *backwards ) -// : fForwardsPartialTrie(forwards), fBackwardsTrie(backwards), refcount(1) { } -// SimpleFilteredSentenceBreakData *incr() { refcount++; return this; } -// SimpleFilteredSentenceBreakData *decr() { if((--refcount) <= 0) delete this; return 0; } -// virtual ~SimpleFilteredSentenceBreakData(); - -// LocalPointer fForwardsPartialTrie; // Has ".a" for "a.M." -// LocalPointer fBackwardsTrie; // i.e. ".srM" for Mrs. -// int32_t refcount; -// }; - -// SimpleFilteredSentenceBreakData::~SimpleFilteredSentenceBreakData() {} - -// /** -// * Concrete implementation -// */ -// class SimpleFilteredSentenceBreakIterator : public BreakIterator { -// public: -// SimpleFilteredSentenceBreakIterator(BreakIterator *adopt, UCharsTrie *forwards, UCharsTrie *backwards, UErrorCode &status); -// SimpleFilteredSentenceBreakIterator(const SimpleFilteredSentenceBreakIterator& other); -// virtual ~SimpleFilteredSentenceBreakIterator(); -// private: -// SimpleFilteredSentenceBreakData *fData; -// LocalPointer fDelegate; -// LocalUTextPointer fText; - -// /* -- subclass interface -- */ -// public: -// /* -- cloning and other subclass stuff -- */ -// virtual BreakIterator * createBufferClone(void * /*stackBuffer*/, -// int32_t &/*BufferSize*/, -// UErrorCode &status) { -// // for now - always deep clone -// status = U_SAFECLONE_ALLOCATED_WARNING; -// return clone(); -// } -// virtual SimpleFilteredSentenceBreakIterator* clone() const { return new SimpleFilteredSentenceBreakIterator(*this); } -// virtual UClassID getDynamicClassID(void) const { return NULL; } -// virtual bool operator==(const BreakIterator& o) const { if(this==&o) return true; return false; } - -// /* -- text modifying -- */ -// virtual void setText(UText *text, UErrorCode &status) { fDelegate->setText(text,status); } -// virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) { fDelegate->refreshInputText(input,status); return *this; } -// virtual void adoptText(CharacterIterator* it) { fDelegate->adoptText(it); } -// virtual void setText(const UnicodeString &text) { fDelegate->setText(text); } - -// /* -- other functions that are just delegated -- */ -// virtual UText *getUText(UText *fillIn, UErrorCode &status) const { return fDelegate->getUText(fillIn,status); } -// virtual CharacterIterator& getText(void) const { return fDelegate->getText(); } - -// /* -- ITERATION -- */ -// virtual int32_t first(void); -// virtual int32_t preceding(int32_t offset); -// virtual int32_t previous(void); -// virtual UBool isBoundary(int32_t offset); -// virtual int32_t current(void) const { return fDelegate->current(); } // we keep the delegate current, so this should be correct. - -// virtual int32_t next(void); - -// virtual int32_t next(int32_t n); -// virtual int32_t following(int32_t offset); -// virtual int32_t last(void); - -// private: -// /** -// * Given that the fDelegate has already given its "initial" answer, -// * find the NEXT actual (non-excepted) break. -// * @param n initial position from delegate -// * @return new break position or UBRK_DONE -// */ -// int32_t internalNext(int32_t n); -// /** -// * Given that the fDelegate has already given its "initial" answer, -// * find the PREV actual (non-excepted) break. -// * @param n initial position from delegate -// * @return new break position or UBRK_DONE -// */ -// int32_t internalPrev(int32_t n); -// /** -// * set up the UText with the value of the fDelegate. -// * Call this before calling breakExceptionAt. -// * May be able to avoid excess calls -// */ -// void resetState(UErrorCode &status); -// /** -// * Is there a match (exception) at this spot? -// */ -// enum EFBMatchResult { kNoExceptionHere, kExceptionHere }; -// /** -// * Determine if there is an exception at this spot -// * @param n spot to check -// * @return kNoExceptionHere or kExceptionHere -// **/ -// enum EFBMatchResult breakExceptionAt(int32_t n); -// }; - -// SimpleFilteredSentenceBreakIterator::SimpleFilteredSentenceBreakIterator(const SimpleFilteredSentenceBreakIterator& other) -// : BreakIterator(other), fData(other.fData->incr()), fDelegate(other.fDelegate->clone()) -// { -// } - - -// SimpleFilteredSentenceBreakIterator::SimpleFilteredSentenceBreakIterator(BreakIterator *adopt, UCharsTrie *forwards, UCharsTrie *backwards, UErrorCode &status) : -// BreakIterator(adopt->getLocale(ULOC_VALID_LOCALE,status),adopt->getLocale(ULOC_ACTUAL_LOCALE,status)), -// fData(new SimpleFilteredSentenceBreakData(forwards, backwards)), -// fDelegate(adopt) -// { -// // all set.. -// } - -// SimpleFilteredSentenceBreakIterator::~SimpleFilteredSentenceBreakIterator() { -// fData = fData->decr(); -// } - -// void SimpleFilteredSentenceBreakIterator::resetState(UErrorCode &status) { -// fText.adoptInstead(fDelegate->getUText(fText.orphan(), status)); -// } - -// SimpleFilteredSentenceBreakIterator::EFBMatchResult -// SimpleFilteredSentenceBreakIterator::breakExceptionAt(int32_t n) { -// int64_t bestPosn = -1; -// int32_t bestValue = -1; -// // loops while 'n' points to an exception. -// utext_setNativeIndex(fText.getAlias(), n); // from n.. -// fData->fBackwardsTrie->reset(); -// UChar32 uch; - -// //if(debug2) u_printf(" n@ %d\n", n); -// // Assume a space is following the '.' (so we handle the case: "Mr. /Brown") -// if((uch=utext_previous32(fText.getAlias()))==(UChar32)0x0020) { // TODO: skip a class of chars here?? -// // TODO only do this the 1st time? -// //if(debug2) u_printf("skipping prev: |%C| \n", (UChar)uch); -// } else { -// //if(debug2) u_printf("not skipping prev: |%C| \n", (UChar)uch); -// uch = utext_next32(fText.getAlias()); -// //if(debug2) u_printf(" -> : |%C| \n", (UChar)uch); -// } - -// UStringTrieResult r = USTRINGTRIE_INTERMEDIATE_VALUE; - -// while((uch=utext_previous32(fText.getAlias()))!=U_SENTINEL && // more to consume backwards and.. -// USTRINGTRIE_HAS_NEXT(r=fData->fBackwardsTrie->nextForCodePoint(uch))) {// more in the trie -// if(USTRINGTRIE_HAS_VALUE(r)) { // remember the best match so far -// bestPosn = utext_getNativeIndex(fText.getAlias()); -// bestValue = fData->fBackwardsTrie->getValue(); -// } -// //if(debug2) u_printf("rev< /%C/ cont?%d @%d\n", (UChar)uch, r, utext_getNativeIndex(fText.getAlias())); -// } - -// if(USTRINGTRIE_MATCHES(r)) { // exact match? -// //if(debug2) u_printf("revfBackwardsTrie->getValue(); -// bestPosn = utext_getNativeIndex(fText.getAlias()); -// //if(debug2) u_printf("rev<+/%C/+end of seq.. r=%d, bestPosn=%d, bestValue=%d\n", (UChar)uch, r, bestPosn, bestValue); -// } - -// if(bestPosn>=0) { -// //if(debug2) u_printf("rev< /%C/ end of seq.. r=%d, bestPosn=%d, bestValue=%d\n", (UChar)uch, r, bestPosn, bestValue); - -// //if(USTRINGTRIE_MATCHES(r)) { // matched - so, now what? -// //int32_t bestValue = fBackwardsTrie->getValue(); -// ////if(debug2) u_printf("rev< /%C/ matched, skip..%d bestValue=%d\n", (UChar)uch, r, bestValue); - -// if(bestValue == kMATCH) { // exact match! -// //if(debug2) u_printf(" exact backward match\n"); -// return kExceptionHere; // See if the next is another exception. -// } else if(bestValue == kPARTIAL -// && fData->fForwardsPartialTrie.isValid()) { // make sure there's a forward trie -// //if(debug2) u_printf(" partial backward match\n"); -// // We matched the "Ph." in "Ph.D." - now we need to run everything through the forwards trie -// // to see if it matches something going forward. -// fData->fForwardsPartialTrie->reset(); -// UStringTrieResult rfwd = USTRINGTRIE_INTERMEDIATE_VALUE; -// utext_setNativeIndex(fText.getAlias(), bestPosn); // hope that's close .. -// //if(debug2) u_printf("Retrying at %d\n", bestPosn); -// while((uch=utext_next32(fText.getAlias()))!=U_SENTINEL && -// USTRINGTRIE_HAS_NEXT(rfwd=fData->fForwardsPartialTrie->nextForCodePoint(uch))) { -// //if(debug2) u_printf("fwd> /%C/ cont?%d @%d\n", (UChar)uch, rfwd, utext_getNativeIndex(fText.getAlias())); -// } -// if(USTRINGTRIE_MATCHES(rfwd)) { -// //if(debug2) u_printf("fwd> /%C/ == forward match!\n", (UChar)uch); -// // only full matches here, nothing to check -// // skip the next: -// return kExceptionHere; -// } else { -// //if(debug2) u_printf("fwd> /%C/ no match.\n", (UChar)uch); -// // no match (no exception) -return the 'underlying' break -// return kNoExceptionHere; -// } -// } else { -// return kNoExceptionHere; // internal error and/or no forwards trie -// } -// } else { -// //if(debug2) u_printf("rev< /%C/ .. no match..%d\n", (UChar)uch, r); // no best match -// return kNoExceptionHere; // No match - so exit. Not an exception. -// } -// } - -// // the workhorse single next. -// int32_t -// SimpleFilteredSentenceBreakIterator::internalNext(int32_t n) { -// if(n == UBRK_DONE || // at end or -// fData->fBackwardsTrie.isNull()) { // .. no backwards table loaded == no exceptions -// return n; -// } -// // OK, do we need to break here? -// UErrorCode status = U_ZERO_ERROR; -// // refresh text -// resetState(status); -// if(U_FAILURE(status)) return UBRK_DONE; // bail out -// int64_t utextLen = utext_nativeLength(fText.getAlias()); - -// //if(debug2) u_printf("str, native len=%d\n", utext_nativeLength(fText.getAlias())); -// while (n != UBRK_DONE && n != utextLen) { // outer loop runs once per underlying break (from fDelegate). -// SimpleFilteredSentenceBreakIterator::EFBMatchResult m = breakExceptionAt(n); - -// switch(m) { -// case kExceptionHere: -// n = fDelegate->next(); // skip this one. Find the next lowerlevel break. -// continue; - -// default: -// case kNoExceptionHere: -// return n; -// } -// } -// return n; -// } - -// int32_t -// SimpleFilteredSentenceBreakIterator::internalPrev(int32_t n) { -// if(n == 0 || n == UBRK_DONE || // at end or -// fData->fBackwardsTrie.isNull()) { // .. no backwards table loaded == no exceptions -// return n; -// } -// // OK, do we need to break here? -// UErrorCode status = U_ZERO_ERROR; -// // refresh text -// resetState(status); -// if(U_FAILURE(status)) return UBRK_DONE; // bail out - -// //if(debug2) u_printf("str, native len=%d\n", utext_nativeLength(fText.getAlias())); -// while (n != UBRK_DONE && n != 0) { // outer loop runs once per underlying break (from fDelegate). -// SimpleFilteredSentenceBreakIterator::EFBMatchResult m = breakExceptionAt(n); - -// switch(m) { -// case kExceptionHere: -// n = fDelegate->previous(); // skip this one. Find the next lowerlevel break. -// continue; - -// default: -// case kNoExceptionHere: -// return n; -// } -// } -// return n; -// } - - -// int32_t -// SimpleFilteredSentenceBreakIterator::next() { -// return internalNext(fDelegate->next()); -// } - -// int32_t -// SimpleFilteredSentenceBreakIterator::first(void) { -// // Don't suppress a break opportunity at the beginning of text. -// return fDelegate->first(); -// } - -// int32_t -// SimpleFilteredSentenceBreakIterator::preceding(int32_t offset) { -// return internalPrev(fDelegate->preceding(offset)); -// } - -// int32_t -// SimpleFilteredSentenceBreakIterator::previous(void) { -// return internalPrev(fDelegate->previous()); -// } - -// UBool SimpleFilteredSentenceBreakIterator::isBoundary(int32_t offset) { -// if (!fDelegate->isBoundary(offset)) return false; // no break to suppress - -// if (fData->fBackwardsTrie.isNull()) return true; // no data = no suppressions - -// UErrorCode status = U_ZERO_ERROR; -// resetState(status); - -// SimpleFilteredSentenceBreakIterator::EFBMatchResult m = breakExceptionAt(offset); - -// switch(m) { -// case kExceptionHere: -// return false; -// default: -// case kNoExceptionHere: -// return true; -// } -// } - -// int32_t -// SimpleFilteredSentenceBreakIterator::next(int32_t offset) { -// return internalNext(fDelegate->next(offset)); -// } - -// int32_t -// SimpleFilteredSentenceBreakIterator::following(int32_t offset) { -// return internalNext(fDelegate->following(offset)); -// } - -// int32_t -// SimpleFilteredSentenceBreakIterator::last(void) { -// // Don't suppress a break opportunity at the end of text. -// return fDelegate->last(); -// } - - -// /** -// * Concrete implementation of builder class. -// */ -// class U_COMMON_API SimpleFilteredBreakIteratorBuilder : public FilteredBreakIteratorBuilder { -// public: -// virtual ~SimpleFilteredBreakIteratorBuilder(); -// SimpleFilteredBreakIteratorBuilder(const Locale &fromLocale, UErrorCode &status); -// SimpleFilteredBreakIteratorBuilder(UErrorCode &status); -// virtual UBool suppressBreakAfter(const UnicodeString& exception, UErrorCode& status); -// virtual UBool unsuppressBreakAfter(const UnicodeString& exception, UErrorCode& status); -// virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status); -// private: -// UStringSet fSet; -// }; - -// SimpleFilteredBreakIteratorBuilder::~SimpleFilteredBreakIteratorBuilder() -// { -// } - -// SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(UErrorCode &status) -// : fSet(status) -// { -// } - -// SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Locale &fromLocale, UErrorCode &status) -// : fSet(status) -// { -// if(U_SUCCESS(status)) { -// UErrorCode subStatus = U_ZERO_ERROR; -// LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &subStatus)); -// if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) { -// status = subStatus; // copy the failing status -// #if FB_DEBUG -// fprintf(stderr, "open BUNDLE %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status)); -// #endif -// return; // leaves the builder empty, if you try to use it. -// } -// LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &subStatus)); -// if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) { -// status = subStatus; // copy the failing status -// #if FB_DEBUG -// fprintf(stderr, "open EXCEPTIONS %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status)); -// #endif -// return; // leaves the builder empty, if you try to use it. -// } -// LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &subStatus)); - -// #if FB_DEBUG -// { -// UErrorCode subsub = subStatus; -// fprintf(stderr, "open SentenceBreak %s => %s, %s\n", fromLocale.getBaseName(), ures_getLocale(breaks.getAlias(), &subsub), u_errorName(subStatus)); -// } -// #endif - -// if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) { -// status = subStatus; // copy the failing status -// #if FB_DEBUG -// fprintf(stderr, "open %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status)); -// #endif -// return; // leaves the builder empty, if you try to use it. -// } - -// LocalUResourceBundlePointer strs; -// subStatus = status; // Pick up inherited warning status now -// do { -// strs.adoptInstead(ures_getNextResource(breaks.getAlias(), strs.orphan(), &subStatus)); -// if(strs.isValid() && U_SUCCESS(subStatus)) { -// UnicodeString str(ures_getUnicodeString(strs.getAlias(), &status)); -// suppressBreakAfter(str, status); // load the string -// } -// } while (strs.isValid() && U_SUCCESS(subStatus)); -// if(U_FAILURE(subStatus)&&subStatus!=U_INDEX_OUTOFBOUNDS_ERROR&&U_SUCCESS(status)) { -// status = subStatus; -// } -// } -// } - -// UBool -// SimpleFilteredBreakIteratorBuilder::suppressBreakAfter(const UnicodeString& exception, UErrorCode& status) -// { -// UBool r = fSet.add(exception, status); -// FB_TRACE("suppressBreakAfter",&exception,r,0); -// return r; -// } - -// UBool -// SimpleFilteredBreakIteratorBuilder::unsuppressBreakAfter(const UnicodeString& exception, UErrorCode& status) -// { -// UBool r = fSet.remove(exception, status); -// FB_TRACE("unsuppressBreakAfter",&exception,r,0); -// return r; -// } - -// /** -// * Jitterbug 2974: MSVC has a bug whereby new X[0] behaves badly. -// * Work around this. -// * -// * Note: "new UnicodeString[subCount]" ends up calling global operator new -// * on MSVC2012 for some reason. -// */ -// static inline UnicodeString* newUnicodeStringArray(size_t count) { -// return new UnicodeString[count ? count : 1]; -// } - -// BreakIterator * -// SimpleFilteredBreakIteratorBuilder::build(BreakIterator* adoptBreakIterator, UErrorCode& status) { -// LocalPointer adopt(adoptBreakIterator); - -// LocalPointer builder(new UCharsTrieBuilder(status), status); -// LocalPointer builder2(new UCharsTrieBuilder(status), status); -// if(U_FAILURE(status)) { -// return NULL; -// } - -// int32_t revCount = 0; -// int32_t fwdCount = 0; - -// int32_t subCount = fSet.size(); - -// UnicodeString *ustrs_ptr = newUnicodeStringArray(subCount); - -// LocalArray ustrs(ustrs_ptr); - -// LocalMemory partials; -// partials.allocateInsteadAndReset(subCount); - -// LocalPointer backwardsTrie; // i.e. ".srM" for Mrs. -// LocalPointer forwardsPartialTrie; // Has ".a" for "a.M." - -// int n=0; -// for ( int32_t i = 0; -// i-1 && (nn+1)!=ustrs[i].length()) { -// FB_TRACE("partial",&ustrs[i],FALSE,i); -// // is partial. -// // is it unique? -// int sameAs = -1; -// for(int j=0;jadd(prefix, kPARTIAL, status); -// revCount++; -// FB_TRACE("Added partial",&prefix,FALSE, i); -// FB_TRACE(u_errorName(status),&ustrs[i],FALSE,i); -// partials[i] = kSuppressInReverse | kAddToForward; -// } else { -// FB_TRACE("NOT adding partial",&prefix,FALSE, i); -// FB_TRACE(u_errorName(status),&ustrs[i],FALSE,i); -// } -// } -// } -// for(int i=0;iadd(ustrs[i], kMATCH, status); -// revCount++; -// FB_TRACE(u_errorName(status), &ustrs[i], FALSE, i); -// } else { -// FB_TRACE("Adding fwd",&ustrs[i], FALSE, i); - -// // an optimization would be to only add the portion after the '.' -// // for example, for "Ph.D." we store ".hP" in the reverse table. We could just store "D." in the forward, -// // instead of "Ph.D." since we already know the "Ph." part is a match. -// // would need the trie to be able to hold 0-length strings, though. -// builder2->add(ustrs[i], kMATCH, status); // forward -// fwdCount++; -// //ustrs[i].reverse(); -// ////if(debug2) u_printf("SUPPRESS- not Added(%d): /%S/ status=%s\n",partials[i], ustrs[i].getTerminatedBuffer(), u_errorName(status)); -// } -// } -// FB_TRACE("AbbrCount",NULL,FALSE, subCount); - -// if(revCount>0) { -// backwardsTrie.adoptInstead(builder->build(USTRINGTRIE_BUILD_FAST, status)); -// if(U_FAILURE(status)) { -// FB_TRACE(u_errorName(status),NULL,FALSE, -1); -// return NULL; -// } -// } - -// if(fwdCount>0) { -// forwardsPartialTrie.adoptInstead(builder2->build(USTRINGTRIE_BUILD_FAST, status)); -// if(U_FAILURE(status)) { -// FB_TRACE(u_errorName(status),NULL,FALSE, -1); -// return NULL; -// } -// } - -// return new SimpleFilteredSentenceBreakIterator(adopt.orphan(), forwardsPartialTrie.orphan(), backwardsTrie.orphan(), status); -// } - - -// // ----------- Base class implementation - -// FilteredBreakIteratorBuilder::FilteredBreakIteratorBuilder() { -// } - -// FilteredBreakIteratorBuilder::~FilteredBreakIteratorBuilder() { -// } - -// FilteredBreakIteratorBuilder * -// FilteredBreakIteratorBuilder::createInstance(const Locale& where, UErrorCode& status) { -// if(U_FAILURE(status)) return NULL; -// LocalPointer ret(new SimpleFilteredBreakIteratorBuilder(where, status), status); -// return (U_SUCCESS(status))? ret.orphan(): NULL; -// } - -// FilteredBreakIteratorBuilder * -// FilteredBreakIteratorBuilder::createInstance(UErrorCode &status) { -// return createEmptyInstance(status); -// } - -// FilteredBreakIteratorBuilder * -// FilteredBreakIteratorBuilder::createEmptyInstance(UErrorCode& status) { -// if(U_FAILURE(status)) return NULL; -// LocalPointer ret(new SimpleFilteredBreakIteratorBuilder(status), status); -// return (U_SUCCESS(status))? ret.orphan(): NULL; -// } - -// U_NAMESPACE_END - -// #endif //#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION diff --git a/src/duckdb/extension/icu/third_party/icu/common/filterednormalizer2.cpp b/src/duckdb/extension/icu/third_party/icu/common/filterednormalizer2.cpp index 1a0914d3f..5eafcb6d7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/filterednormalizer2.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/filterednormalizer2.cpp @@ -137,14 +137,14 @@ UnicodeString & FilteredNormalizer2::normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const { - return normalizeSecondAndAppend(first, second, TRUE, errorCode); + return normalizeSecondAndAppend(first, second, true, errorCode); } UnicodeString & FilteredNormalizer2::append(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const { - return normalizeSecondAndAppend(first, second, FALSE, errorCode); + return normalizeSecondAndAppend(first, second, false, errorCode); } UnicodeString & @@ -224,7 +224,7 @@ UBool FilteredNormalizer2::isNormalized(const UnicodeString &s, UErrorCode &errorCode) const { uprv_checkCanGetBuffer(s, errorCode); if(U_FAILURE(errorCode)) { - return FALSE; + return false; } USetSpanCondition spanCondition=USET_SPAN_SIMPLE; for(int32_t prevSpanLimit=0; prevSpanLimit -#ifdef __MVS__ /* defined by z/OS compiler */ -#define _POSIX_SOURCE -#include /* 12 Nov 2011 JAM iscics() function */ -#endif -#include "charstr.h" - -using namespace icu; - -#ifndef UPLUG_TRACE -#define UPLUG_TRACE 0 -#endif - -#if UPLUG_TRACE -#include -#define DBG(x) fprintf(stderr, "%s:%d: ",__FILE__,__LINE__); fprintf x -#endif - -/** - * Internal structure of an ICU plugin. - */ - -struct UPlugData { - UPlugEntrypoint *entrypoint; /**< plugin entrypoint */ - uint32_t structSize; /**< initialized to the size of this structure */ - uint32_t token; /**< must be U_PLUG_TOKEN */ - void *lib; /**< plugin library, or NULL */ - char libName[UPLUG_NAME_MAX]; /**< library name */ - char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */ - char config[UPLUG_NAME_MAX]; /**< configuration data */ - void *context; /**< user context data */ - char name[UPLUG_NAME_MAX]; /**< name of plugin */ - UPlugLevel level; /**< level of plugin */ - UBool awaitingLoad; /**< TRUE if the plugin is awaiting a load call */ - UBool dontUnload; /**< TRUE if plugin must stay resident (leak plugin and lib) */ - UErrorCode pluginStatus; /**< status code of plugin */ -}; - - - -#define UPLUG_LIBRARY_INITIAL_COUNT 8 -#define UPLUG_PLUGIN_INITIAL_COUNT 12 - -/** - * Remove an item - * @param list the full list - * @param listSize the number of entries in the list - * @param memberSize the size of one member - * @param itemToRemove the item number of the member - * @return the new listsize - */ -static int32_t uplug_removeEntryAt(void *list, int32_t listSize, int32_t memberSize, int32_t itemToRemove) { - uint8_t *bytePtr = (uint8_t *)list; - - /* get rid of some bad cases first */ - if(listSize<1) { - return listSize; - } - - /* is there anything to move? */ - if(listSize > itemToRemove+1) { - memmove(bytePtr+(itemToRemove*memberSize), bytePtr+((itemToRemove+1)*memberSize), memberSize); - } - - return listSize-1; -} - - - - -#if U_ENABLE_DYLOAD -/** - * Library management. Internal. - * @internal - */ -struct UPlugLibrary; - -/** - * Library management. Internal. - * @internal - */ -typedef struct UPlugLibrary { - void *lib; /**< library ptr */ - char name[UPLUG_NAME_MAX]; /**< library name */ - uint32_t ref; /**< reference count */ -} UPlugLibrary; - -static UPlugLibrary staticLibraryList[UPLUG_LIBRARY_INITIAL_COUNT]; -static UPlugLibrary * libraryList = staticLibraryList; -static int32_t libraryCount = 0; -static int32_t libraryMax = UPLUG_LIBRARY_INITIAL_COUNT; - -/** - * Search for a library. Doesn't lock - * @param libName libname to search for - * @return the library's struct - */ -static int32_t searchForLibraryName(const char *libName) { - int32_t i; - - for(i=0;i= libraryMax) { - /* Ran out of library slots. Statically allocated because we can't depend on allocating memory.. */ - *status = U_MEMORY_ALLOCATION_ERROR; -#if UPLUG_TRACE - DBG((stderr, "uplug_openLibrary() - out of library slots (max %d)\n", libraryMax)); -#endif - return NULL; - } - /* Some operating systems don't want - DL operations from multiple threads. */ - libraryList[libEntry].lib = uprv_dl_open(libName, status); -#if UPLUG_TRACE - DBG((stderr, "uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib)); -#endif - - if(libraryList[libEntry].lib == NULL || U_FAILURE(*status)) { - /* cleanup. */ - libraryList[libEntry].lib = NULL; /* failure with open */ - libraryList[libEntry].name[0] = 0; -#if UPLUG_TRACE - DBG((stderr, "uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib)); -#endif - /* no need to free - just won't increase the count. */ - libraryCount--; - } else { /* is it still there? */ - /* link it in */ - uprv_strncpy(libraryList[libEntry].name,libName,UPLUG_NAME_MAX); - libraryList[libEntry].ref=1; - lib = libraryList[libEntry].lib; - } - - } else { - lib = libraryList[libEntry].lib; - libraryList[libEntry].ref++; - } - return lib; -} - -U_INTERNAL void U_EXPORT2 -uplug_closeLibrary(void *lib, UErrorCode *status) { - int32_t i; - -#if UPLUG_TRACE - DBG((stderr, "uplug_closeLibrary(%p,%s) list %p\n", lib, u_errorName(*status), (void*)libraryList)); -#endif - if(U_FAILURE(*status)) return; - - for(i=0;i=pastPlug) { - return pluginCount; - } else { - return (d-pluginList)/sizeof(pluginList[0]); - } -} - - -U_CAPI UPlugData * U_EXPORT2 -uplug_nextPlug(UPlugData *prior) { - if(prior==NULL) { - return pluginList; - } else { - UPlugData *nextPlug = &prior[1]; - UPlugData *pastPlug = &pluginList[pluginCount]; - - if(nextPlug>=pastPlug) { - return NULL; - } else { - return nextPlug; - } - } -} - - - -/** - * Call the plugin with some params - */ -static void uplug_callPlug(UPlugData *plug, UPlugReason reason, UErrorCode *status) { - UPlugTokenReturn token; - if(plug==NULL||U_FAILURE(*status)) { - return; - } - token = (*(plug->entrypoint))(plug, reason, status); - if(token!=UPLUG_TOKEN) { - *status = U_INTERNAL_PROGRAM_ERROR; - } -} - - -static void uplug_unloadPlug(UPlugData *plug, UErrorCode *status) { - if(plug->awaitingLoad) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/ - *status = U_INTERNAL_PROGRAM_ERROR; - return; - } - if(U_SUCCESS(plug->pluginStatus)) { - /* Don't unload a plug which has a failing load status - means it didn't actually load. */ - uplug_callPlug(plug, UPLUG_REASON_UNLOAD, status); - } -} - -static void uplug_queryPlug(UPlugData *plug, UErrorCode *status) { - if(!plug->awaitingLoad || !(plug->level == UPLUG_LEVEL_UNKNOWN) ) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/ - *status = U_INTERNAL_PROGRAM_ERROR; - return; - } - plug->level = UPLUG_LEVEL_INVALID; - uplug_callPlug(plug, UPLUG_REASON_QUERY, status); - if(U_SUCCESS(*status)) { - if(plug->level == UPLUG_LEVEL_INVALID) { - plug->pluginStatus = U_PLUGIN_DIDNT_SET_LEVEL; - plug->awaitingLoad = FALSE; - } - } else { - plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR; - plug->awaitingLoad = FALSE; - } -} - - -static void uplug_loadPlug(UPlugData *plug, UErrorCode *status) { - if(U_FAILURE(*status)) { - return; - } - if(!plug->awaitingLoad || (plug->level < UPLUG_LEVEL_LOW) ) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/ - *status = U_INTERNAL_PROGRAM_ERROR; - return; - } - uplug_callPlug(plug, UPLUG_REASON_LOAD, status); - plug->awaitingLoad = FALSE; - if(!U_SUCCESS(*status)) { - plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR; - } -} - -static UPlugData *uplug_allocateEmptyPlug(UErrorCode *status) -{ - UPlugData *plug = NULL; - - if(U_FAILURE(*status)) { - return NULL; - } - - if(pluginCount == UPLUG_PLUGIN_INITIAL_COUNT) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - - plug = &pluginList[pluginCount++]; - - plug->token = UPLUG_TOKEN; - plug->structSize = sizeof(UPlugData); - plug->name[0]=0; - plug->level = UPLUG_LEVEL_UNKNOWN; /* initialize to null state */ - plug->awaitingLoad = TRUE; - plug->dontUnload = FALSE; - plug->pluginStatus = U_ZERO_ERROR; - plug->libName[0] = 0; - plug->config[0]=0; - plug->sym[0]=0; - plug->lib=NULL; - plug->entrypoint=NULL; - - - return plug; -} - -static UPlugData *uplug_allocatePlug(UPlugEntrypoint *entrypoint, const char *config, void *lib, const char *symName, - UErrorCode *status) { - UPlugData *plug = uplug_allocateEmptyPlug(status); - if(U_FAILURE(*status)) { - return NULL; - } - - if(config!=NULL) { - uprv_strncpy(plug->config, config, UPLUG_NAME_MAX); - } else { - plug->config[0] = 0; - } - - if(symName!=NULL) { - uprv_strncpy(plug->sym, symName, UPLUG_NAME_MAX); - } else { - plug->sym[0] = 0; - } - - plug->entrypoint = entrypoint; - plug->lib = lib; - uplug_queryPlug(plug, status); - - return plug; -} - -static void uplug_deallocatePlug(UPlugData *plug, UErrorCode *status) { - UErrorCode subStatus = U_ZERO_ERROR; - if(!plug->dontUnload) { -#if U_ENABLE_DYLOAD - uplug_closeLibrary(plug->lib, &subStatus); -#endif - } - plug->lib = NULL; - if(U_SUCCESS(*status) && U_FAILURE(subStatus)) { - *status = subStatus; - } - /* shift plugins up and decrement count. */ - if(U_SUCCESS(*status)) { - /* all ok- remove. */ - pluginCount = uplug_removeEntryAt(pluginList, pluginCount, sizeof(plug[0]), uplug_pluginNumber(plug)); - } else { - /* not ok- leave as a message. */ - plug->awaitingLoad=FALSE; - plug->entrypoint=0; - plug->dontUnload=TRUE; - } -} - -static void uplug_doUnloadPlug(UPlugData *plugToRemove, UErrorCode *status) { - if(plugToRemove != NULL) { - uplug_unloadPlug(plugToRemove, status); - uplug_deallocatePlug(plugToRemove, status); - } -} - -U_CAPI void U_EXPORT2 -uplug_removePlug(UPlugData *plug, UErrorCode *status) { - UPlugData *cursor = NULL; - UPlugData *plugToRemove = NULL; - if(U_FAILURE(*status)) return; - - for(cursor=pluginList;cursor!=NULL;) { - if(cursor==plug) { - plugToRemove = plug; - cursor=NULL; - } else { - cursor = uplug_nextPlug(cursor); - } - } - - uplug_doUnloadPlug(plugToRemove, status); -} - - - - -U_CAPI void U_EXPORT2 -uplug_setPlugNoUnload(UPlugData *data, UBool dontUnload) -{ - data->dontUnload = dontUnload; -} - - -U_CAPI void U_EXPORT2 -uplug_setPlugLevel(UPlugData *data, UPlugLevel level) { - data->level = level; -} - - -U_CAPI UPlugLevel U_EXPORT2 -uplug_getPlugLevel(UPlugData *data) { - return data->level; -} - - -U_CAPI void U_EXPORT2 -uplug_setPlugName(UPlugData *data, const char *name) { - uprv_strncpy(data->name, name, UPLUG_NAME_MAX); -} - - -U_CAPI const char * U_EXPORT2 -uplug_getPlugName(UPlugData *data) { - return data->name; -} - - -U_CAPI const char * U_EXPORT2 -uplug_getSymbolName(UPlugData *data) { - return data->sym; -} - -U_CAPI const char * U_EXPORT2 -uplug_getLibraryName(UPlugData *data, UErrorCode *status) { - if(data->libName[0]) { - return data->libName; - } else { -#if U_ENABLE_DYLOAD - return uplug_findLibrary(data->lib, status); -#else - return NULL; -#endif - } -} - -U_CAPI void * U_EXPORT2 -uplug_getLibrary(UPlugData *data) { - return data->lib; -} - -U_CAPI void * U_EXPORT2 -uplug_getContext(UPlugData *data) { - return data->context; -} - - -U_CAPI void U_EXPORT2 -uplug_setContext(UPlugData *data, void *context) { - data->context = context; -} - -U_CAPI const char* U_EXPORT2 -uplug_getConfiguration(UPlugData *data) { - return data->config; -} - -U_INTERNAL UPlugData* U_EXPORT2 -uplug_getPlugInternal(int32_t n) { - if(n <0 || n >= pluginCount) { - return NULL; - } else { - return &(pluginList[n]); - } -} - - -U_CAPI UErrorCode U_EXPORT2 -uplug_getPlugLoadStatus(UPlugData *plug) { - return plug->pluginStatus; -} - - - - -/** - * Initialize a plugin fron an entrypoint and library - but don't load it. - */ -static UPlugData* uplug_initPlugFromEntrypointAndLibrary(UPlugEntrypoint *entrypoint, const char *config, void *lib, const char *sym, - UErrorCode *status) { - UPlugData *plug = NULL; - - plug = uplug_allocatePlug(entrypoint, config, lib, sym, status); - - if(U_SUCCESS(*status)) { - return plug; - } else { - uplug_deallocatePlug(plug, status); - return NULL; - } -} - -U_CAPI UPlugData* U_EXPORT2 -uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status) { - UPlugData* plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, NULL, NULL, status); - uplug_loadPlug(plug, status); - return plug; -} - -#if U_ENABLE_DYLOAD - -static UPlugData* -uplug_initErrorPlug(const char *libName, const char *sym, const char *config, const char *nameOrError, UErrorCode loadStatus, UErrorCode *status) -{ - UPlugData *plug = uplug_allocateEmptyPlug(status); - if(U_FAILURE(*status)) return NULL; - - plug->pluginStatus = loadStatus; - plug->awaitingLoad = FALSE; /* Won't load. */ - plug->dontUnload = TRUE; /* cannot unload. */ - - if(sym!=NULL) { - uprv_strncpy(plug->sym, sym, UPLUG_NAME_MAX); - } - - if(libName!=NULL) { - uprv_strncpy(plug->libName, libName, UPLUG_NAME_MAX); - } - - if(nameOrError!=NULL) { - uprv_strncpy(plug->name, nameOrError, UPLUG_NAME_MAX); - } - - if(config!=NULL) { - uprv_strncpy(plug->config, config, UPLUG_NAME_MAX); - } - - return plug; -} - -/** - * Fetch a plugin from DLL, and then initialize it from a library- but don't load it. - */ -static UPlugData* -uplug_initPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) { - void *lib = NULL; - UPlugData *plug = NULL; - if(U_FAILURE(*status)) { return NULL; } - lib = uplug_openLibrary(libName, status); - if(lib!=NULL && U_SUCCESS(*status)) { - UPlugEntrypoint *entrypoint = NULL; - entrypoint = (UPlugEntrypoint*)uprv_dlsym_func(lib, sym, status); - - if(entrypoint!=NULL&&U_SUCCESS(*status)) { - plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, lib, sym, status); - if(plug!=NULL&&U_SUCCESS(*status)) { - plug->lib = lib; /* plug takes ownership of library */ - lib = NULL; /* library is now owned by plugin. */ - } - } else { - UErrorCode subStatus = U_ZERO_ERROR; - plug = uplug_initErrorPlug(libName,sym,config,"ERROR: Could not load entrypoint",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus); - } - if(lib!=NULL) { /* still need to close the lib */ - UErrorCode subStatus = U_ZERO_ERROR; - uplug_closeLibrary(lib, &subStatus); /* don't care here */ - } - } else { - UErrorCode subStatus = U_ZERO_ERROR; - plug = uplug_initErrorPlug(libName,sym,config,"ERROR: could not load library",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus); - } - return plug; -} - -U_CAPI UPlugData* U_EXPORT2 -uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) { - UPlugData *plug = NULL; - if(U_FAILURE(*status)) { return NULL; } - plug = uplug_initPlugFromLibrary(libName, sym, config, status); - uplug_loadPlug(plug, status); - - return plug; -} - -#endif - -static UPlugLevel gCurrentLevel = UPLUG_LEVEL_LOW; - -U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel() { - return gCurrentLevel; -} - -static UBool U_CALLCONV uplug_cleanup(void) -{ - int32_t i; - - UPlugData *pluginToRemove; - /* cleanup plugs */ - for(i=0;iawaitingLoad) { - if(pluginToLoad->level == UPLUG_LEVEL_LOW) { - if(currentLevel > UPLUG_LEVEL_LOW) { - pluginToLoad->pluginStatus = U_PLUGIN_TOO_HIGH; - } else { - UPlugLevel newLevel; - uplug_loadPlug(pluginToLoad, &subStatus); - newLevel = uplug_getCurrentLevel(); - if(newLevel > currentLevel) { - pluginToLoad->pluginStatus = U_PLUGIN_CHANGED_LEVEL_WARNING; - currentLevel = newLevel; - } - } - pluginToLoad->awaitingLoad = FALSE; - } - } - } - for(i=0;iawaitingLoad) { - if(pluginToLoad->level == UPLUG_LEVEL_INVALID) { - pluginToLoad->pluginStatus = U_PLUGIN_DIDNT_SET_LEVEL; - } else if(pluginToLoad->level == UPLUG_LEVEL_UNKNOWN) { - pluginToLoad->pluginStatus = U_INTERNAL_PROGRAM_ERROR; - } else { - uplug_loadPlug(pluginToLoad, &subStatus); - } - pluginToLoad->awaitingLoad = FALSE; - } - } - -#if UPLUG_TRACE - DBG((stderr, " Done Loading Plugs. Level: %d\n", (int32_t)uplug_getCurrentLevel())); -#endif -} - -/* Name of the plugin config file */ -static char plugin_file[2048] = ""; -#endif - -U_INTERNAL const char* U_EXPORT2 -uplug_getPluginFile() { -#if U_ENABLE_DYLOAD && !UCONFIG_NO_FILE_IO - return plugin_file; -#else - return NULL; -#endif -} - - -// uplug_init() is called first thing from u_init(). - -U_CAPI void U_EXPORT2 -uplug_init(UErrorCode *status) { -#if !U_ENABLE_DYLOAD - (void)status; /* unused */ -#elif !UCONFIG_NO_FILE_IO - CharString plugin_dir; - const char *env = getenv("ICU_PLUGINS"); - - if(U_FAILURE(*status)) return; - if(env != NULL) { - plugin_dir.append(env, -1, *status); - } - if(U_FAILURE(*status)) return; - -#if defined(DEFAULT_ICU_PLUGINS) - if(plugin_dir.isEmpty()) { - plugin_dir.append(DEFAULT_ICU_PLUGINS, -1, *status); - } -#endif - -#if UPLUG_TRACE - DBG((stderr, "ICU_PLUGINS=%s\n", plugin_dir.data())); -#endif - - if(!plugin_dir.isEmpty()) { - FILE *f; - - CharString pluginFile; -#ifdef OS390BATCH -/* There are potentially a lot of ways to implement a plugin directory on OS390/zOS */ -/* Keeping in mind that unauthorized file access is logged, monitored, and enforced */ -/* I've chosen to open a DDNAME if BATCH and leave it alone for (presumably) UNIX */ -/* System Services. Alternative techniques might be allocating a member in */ -/* SYS1.PARMLIB or setting an environment variable "ICU_PLUGIN_PATH" (?). The */ -/* DDNAME can be connected to a file in the HFS if need be. */ - - pluginFile.append("//DD:ICUPLUG", -1, *status); /* JAM 20 Oct 2011 */ -#else - pluginFile.append(plugin_dir, *status); - pluginFile.append(U_FILE_SEP_STRING, -1, *status); - pluginFile.append("icuplugins", -1, *status); - pluginFile.append(U_ICU_VERSION_SHORT, -1, *status); - pluginFile.append(".txt", -1, *status); -#endif - -#if UPLUG_TRACE - DBG((stderr, "status=%s\n", u_errorName(*status))); -#endif - - if(U_FAILURE(*status)) { - return; - } - if((size_t)pluginFile.length() > (sizeof(plugin_file)-1)) { - *status = U_BUFFER_OVERFLOW_ERROR; -#if UPLUG_TRACE - DBG((stderr, "status=%s\n", u_errorName(*status))); -#endif - return; - } - - /* plugin_file is not used for processing - it is only used - so that uplug_getPluginFile() works (i.e. icuinfo) - */ - uprv_strncpy(plugin_file, pluginFile.data(), sizeof(plugin_file)); - -#if UPLUG_TRACE - DBG((stderr, "pluginfile= %s len %d/%d\n", plugin_file, (int)strlen(plugin_file), (int)sizeof(plugin_file))); -#endif - -#ifdef __MVS__ - if (iscics()) /* 12 Nov 2011 JAM */ - { - f = NULL; - } - else -#endif - { - f = fopen(pluginFile.data(), "r"); - } - - if(f != NULL) { - char linebuf[1024]; - char *p, *libName=NULL, *symName=NULL, *config=NULL; - int32_t line = 0; - - - while(fgets(linebuf,1023,f)) { - line++; - - if(!*linebuf || *linebuf=='#') { - continue; - } else { - p = linebuf; - while(*p&&isspace((int)*p)) - p++; - if(!*p || *p=='#') continue; - libName = p; - while(*p&&!isspace((int)*p)) { - p++; - } - if(!*p || *p=='#') continue; /* no tab after libname */ - *p=0; /* end of libname */ - p++; - while(*p&&isspace((int)*p)) { - p++; - } - if(!*p||*p=='#') continue; /* no symname after libname +tab */ - symName = p; - while(*p&&!isspace((int)*p)) { - p++; - } - - if(*p) { /* has config */ - *p=0; - ++p; - while(*p&&isspace((int)*p)) { - p++; - } - if(*p) { - config = p; - } - } - - /* chop whitespace at the end of the config */ - if(config!=NULL&&*config!=0) { - p = config+strlen(config); - while(p>config&&isspace((int)*(--p))) { - *p=0; - } - } - - /* OK, we're good. */ - { - UErrorCode subStatus = U_ZERO_ERROR; - UPlugData *plug = uplug_initPlugFromLibrary(libName, symName, config, &subStatus); - if(U_FAILURE(subStatus) && U_SUCCESS(*status)) { - *status = subStatus; - } -#if UPLUG_TRACE - DBG((stderr, "PLUGIN libName=[%s], sym=[%s], config=[%s]\n", libName, symName, config)); - DBG((stderr, " -> %p, %s\n", (void*)plug, u_errorName(subStatus))); -#else - (void)plug; /* unused */ -#endif - } - } - } - fclose(f); - } else { -#if UPLUG_TRACE - DBG((stderr, "Can't open plugin file %s\n", plugin_file)); -#endif - } - } - uplug_loadWaitingPlugs(status); -#endif /* U_ENABLE_DYLOAD */ - gCurrentLevel = UPLUG_LEVEL_HIGH; - ucln_registerCleanup(UCLN_UPLUG, uplug_cleanup); -} - -#endif - - diff --git a/src/duckdb/extension/icu/third_party/icu/common/icuplugimp.h b/src/duckdb/extension/icu/third_party/icu/common/icuplugimp.h index 3cad8f87f..9df309204 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/icuplugimp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/icuplugimp.h @@ -36,7 +36,7 @@ * @return the library pointer, or NULL * @internal internal use only */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uplug_openLibrary(const char *libName, UErrorCode *status); /** @@ -45,7 +45,7 @@ uplug_openLibrary(const char *libName, UErrorCode *status); * @param status error code * @internal internal use only */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_closeLibrary(void *lib, UErrorCode *status); /** @@ -55,7 +55,7 @@ uplug_closeLibrary(void *lib, UErrorCode *status); * @return the library name, or NULL if not found. * @internal internal use only */ -U_INTERNAL char * U_EXPORT2 +U_CAPI char * U_EXPORT2 uplug_findLibrary(void *lib, UErrorCode *status); /** @} */ @@ -69,21 +69,21 @@ uplug_findLibrary(void *lib, UErrorCode *status); * @param status error result * @internal - Internal use only. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_init(UErrorCode *status); /** * Get raw plug N * @internal - Internal use only */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_getPlugInternal(int32_t n); /** * Get the name of the plugin file. * @internal - Internal use only. */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uplug_getPluginFile(void); /** @} */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/loadednormalizer2impl.cpp b/src/duckdb/extension/icu/third_party/icu/common/loadednormalizer2impl.cpp index e4b36f105..99b8f3e86 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/loadednormalizer2impl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/loadednormalizer2impl.cpp @@ -33,7 +33,7 @@ U_NAMESPACE_BEGIN class LoadedNormalizer2Impl : public Normalizer2Impl { public: - LoadedNormalizer2Impl() : memory(NULL), ownedTrie(NULL) {} + LoadedNormalizer2Impl() : memory(nullptr), ownedTrie(nullptr) {} virtual ~LoadedNormalizer2Impl(); void load(const char *packageName, const char *name, UErrorCode &errorCode); @@ -67,9 +67,9 @@ LoadedNormalizer2Impl::isAcceptable(void * /*context*/, ) { // Normalizer2Impl *me=(Normalizer2Impl *)context; // uprv_memcpy(me->dataVersion, pInfo->dataVersion, 4); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -93,7 +93,7 @@ LoadedNormalizer2Impl::load(const char *packageName, const char *name, UErrorCod int32_t offset=inIndexes[IX_NORM_TRIE_OFFSET]; int32_t nextOffset=inIndexes[IX_EXTRA_DATA_OFFSET]; ownedTrie=ucptrie_openFromBinary(UCPTRIE_TYPE_FAST, UCPTRIE_VALUE_BITS_16, - inBytes+offset, nextOffset-offset, NULL, + inBytes+offset, nextOffset-offset, nullptr, &errorCode); if(U_FAILURE(errorCode)) { return; @@ -117,12 +117,12 @@ Norm2AllModes::createInstance(const char *packageName, const char *name, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } LoadedNormalizer2Impl *impl=new LoadedNormalizer2Impl; - if(impl==NULL) { + if(impl==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } impl->load(packageName, name, errorCode); return createInstance(impl, errorCode); @@ -134,30 +134,35 @@ U_CDECL_END #if !NORM2_HARDCODE_NFC_DATA static Norm2AllModes *nfcSingleton; -static icu::UInitOnce nfcInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce nfcInitOnce {}; #endif static Norm2AllModes *nfkcSingleton; -static icu::UInitOnce nfkcInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce nfkcInitOnce {}; static Norm2AllModes *nfkc_cfSingleton; -static icu::UInitOnce nfkc_cfInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce nfkc_cfInitOnce {}; -static UHashtable *cache=NULL; +static Norm2AllModes *nfkc_scfSingleton; +static icu::UInitOnce nfkc_scfInitOnce {}; + +static UHashtable *cache=nullptr; // 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); + nfcSingleton = Norm2AllModes::createInstance(nullptr, "nfc", errorCode); } else #endif if (uprv_strcmp(what, "nfkc") == 0) { - nfkcSingleton = Norm2AllModes::createInstance(NULL, "nfkc", errorCode); + nfkcSingleton = Norm2AllModes::createInstance(nullptr, "nfkc", errorCode); } else if (uprv_strcmp(what, "nfkc_cf") == 0) { - nfkc_cfSingleton = Norm2AllModes::createInstance(NULL, "nfkc_cf", errorCode); + nfkc_cfSingleton = Norm2AllModes::createInstance(nullptr, "nfkc_cf", errorCode); + } else if (uprv_strcmp(what, "nfkc_scf") == 0) { + nfkc_scfSingleton = Norm2AllModes::createInstance(nullptr, "nfkc_scf", errorCode); } else { - UPRV_UNREACHABLE; // Unknown singleton + UPRV_UNREACHABLE_EXIT; // Unknown singleton } ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup); } @@ -171,21 +176,25 @@ static void U_CALLCONV deleteNorm2AllModes(void *allModes) { static UBool U_CALLCONV uprv_loaded_normalizer2_cleanup() { #if !NORM2_HARDCODE_NFC_DATA delete nfcSingleton; - nfcSingleton = NULL; + nfcSingleton = nullptr; nfcInitOnce.reset(); #endif delete nfkcSingleton; - nfkcSingleton = NULL; + nfkcSingleton = nullptr; nfkcInitOnce.reset(); delete nfkc_cfSingleton; - nfkc_cfSingleton = NULL; + nfkc_cfSingleton = nullptr; nfkc_cfInitOnce.reset(); + delete nfkc_scfSingleton; + nfkc_scfSingleton = nullptr; + nfkc_scfInitOnce.reset(); + uhash_close(cache); - cache=NULL; - return TRUE; + cache=nullptr; + return true; } U_CDECL_END @@ -193,7 +202,7 @@ U_CDECL_END #if !NORM2_HARDCODE_NFC_DATA const Norm2AllModes * Norm2AllModes::getNFCInstance(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } umtx_initOnce(nfcInitOnce, &initSingletons, "nfc", errorCode); return nfcSingleton; } @@ -201,64 +210,77 @@ Norm2AllModes::getNFCInstance(UErrorCode &errorCode) { const Norm2AllModes * Norm2AllModes::getNFKCInstance(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } umtx_initOnce(nfkcInitOnce, &initSingletons, "nfkc", errorCode); return nfkcSingleton; } const Norm2AllModes * Norm2AllModes::getNFKC_CFInstance(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } umtx_initOnce(nfkc_cfInitOnce, &initSingletons, "nfkc_cf", errorCode); return nfkc_cfSingleton; } +const Norm2AllModes * +Norm2AllModes::getNFKC_SCFInstance(UErrorCode &errorCode) { + if(U_FAILURE(errorCode)) { return nullptr; } + umtx_initOnce(nfkc_scfInitOnce, &initSingletons, "nfkc_scf", errorCode); + return nfkc_scfSingleton; +} + #if !NORM2_HARDCODE_NFC_DATA const Normalizer2 * Normalizer2::getNFCInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->comp : NULL; + return allModes!=nullptr ? &allModes->comp : nullptr; } const Normalizer2 * Normalizer2::getNFDInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->decomp : NULL; + return allModes!=nullptr ? &allModes->decomp : nullptr; } const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->fcd : NULL; + return allModes!=nullptr ? &allModes->fcd : nullptr; } const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->fcc : NULL; + return allModes!=nullptr ? &allModes->fcc : nullptr; } const Normalizer2Impl * Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? allModes->impl : NULL; + return allModes!=nullptr ? allModes->impl : nullptr; } #endif const Normalizer2 * Normalizer2::getNFKCInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode); - return allModes!=NULL ? &allModes->comp : NULL; + return allModes!=nullptr ? &allModes->comp : nullptr; } const Normalizer2 * Normalizer2::getNFKDInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode); - return allModes!=NULL ? &allModes->decomp : NULL; + return allModes!=nullptr ? &allModes->decomp : nullptr; } const Normalizer2 * Normalizer2::getNFKCCasefoldInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFKC_CFInstance(errorCode); - return allModes!=NULL ? &allModes->comp : NULL; + return allModes!=nullptr ? &allModes->comp : nullptr; +} + +const Normalizer2 * +Normalizer2::getNFKCSimpleCasefoldInstance(UErrorCode &errorCode) { + const Norm2AllModes *allModes=Norm2AllModes::getNFKC_SCFInstance(errorCode); + return allModes!=nullptr ? &allModes->comp : nullptr; } const Normalizer2 * @@ -267,50 +289,52 @@ Normalizer2::getInstance(const char *packageName, UNormalization2Mode mode, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } - if(name==NULL || *name==0) { + if(name==nullptr || *name==0) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - const Norm2AllModes *allModes=NULL; - if(packageName==NULL) { + const Norm2AllModes *allModes=nullptr; + if(packageName==nullptr) { if(0==uprv_strcmp(name, "nfc")) { allModes=Norm2AllModes::getNFCInstance(errorCode); } else if(0==uprv_strcmp(name, "nfkc")) { allModes=Norm2AllModes::getNFKCInstance(errorCode); } else if(0==uprv_strcmp(name, "nfkc_cf")) { allModes=Norm2AllModes::getNFKC_CFInstance(errorCode); + } else if(0==uprv_strcmp(name, "nfkc_scf")) { + allModes=Norm2AllModes::getNFKC_SCFInstance(errorCode); } } - if(allModes==NULL && U_SUCCESS(errorCode)) { + if(allModes==nullptr && U_SUCCESS(errorCode)) { { Mutex lock; - if(cache!=NULL) { + if(cache!=nullptr) { allModes=(Norm2AllModes *)uhash_get(cache, name); } } - if(allModes==NULL) { + if(allModes==nullptr) { ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup); LocalPointer localAllModes( Norm2AllModes::createInstance(packageName, name, errorCode)); if(U_SUCCESS(errorCode)) { Mutex lock; - if(cache==NULL) { - cache=uhash_open(uhash_hashChars, uhash_compareChars, NULL, &errorCode); + if(cache==nullptr) { + cache=uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &errorCode); if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } uhash_setKeyDeleter(cache, uprv_free); uhash_setValueDeleter(cache, deleteNorm2AllModes); } void *temp=uhash_get(cache, name); - if(temp==NULL) { + if(temp==nullptr) { int32_t keyLength= static_cast(uprv_strlen(name)+1); char *nameCopy=(char *)uprv_malloc(keyLength); - if(nameCopy==NULL) { + if(nameCopy==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uprv_memcpy(nameCopy, name, keyLength); allModes=localAllModes.getAlias(); @@ -322,7 +346,7 @@ Normalizer2::getInstance(const char *packageName, } } } - if(allModes!=NULL && U_SUCCESS(errorCode)) { + if(allModes!=nullptr && U_SUCCESS(errorCode)) { switch(mode) { case UNORM2_COMPOSE: return &allModes->comp; @@ -336,13 +360,13 @@ Normalizer2::getInstance(const char *packageName, break; // do nothing } } - return NULL; + return nullptr; } const Normalizer2 * Normalizer2Factory::getInstance(UNormalizationMode mode, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } switch(mode) { case UNORM_NFD: @@ -363,13 +387,13 @@ Normalizer2Factory::getInstance(UNormalizationMode mode, UErrorCode &errorCode) const Normalizer2Impl * Normalizer2Factory::getNFKCImpl(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode); - return allModes!=NULL ? allModes->impl : NULL; + return allModes!=nullptr ? allModes->impl : nullptr; } const Normalizer2Impl * Normalizer2Factory::getNFKC_CFImpl(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFKC_CFInstance(errorCode); - return allModes!=NULL ? allModes->impl : NULL; + return allModes!=nullptr ? allModes->impl : nullptr; } U_NAMESPACE_END @@ -393,6 +417,11 @@ unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode) { return (const UNormalizer2 *)Normalizer2::getNFKCCasefoldInstance(*pErrorCode); } +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getNFKCSimpleCasefoldInstance(UErrorCode *pErrorCode) { + return (const UNormalizer2 *)Normalizer2::getNFKCSimpleCasefoldInstance(*pErrorCode); +} + U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getInstance(const char *packageName, const char *name, diff --git a/src/duckdb/extension/icu/third_party/icu/common/localebuilder.cpp b/src/duckdb/extension/icu/third_party/icu/common/localebuilder.cpp index 1dd8131e5..c1e1f2ad6 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/localebuilder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/localebuilder.cpp @@ -15,7 +15,7 @@ U_NAMESPACE_BEGIN #define UPRV_ISDIGIT(c) (((c) >= '0') && ((c) <= '9')) #define UPRV_ISALPHANUM(c) (uprv_isASCIILetter(c) || UPRV_ISDIGIT(c) ) -const char* kAttributeKey = "attribute"; +constexpr const char* kAttributeKey = "attribute"; static bool _isExtensionSubtags(char key, const char* s, int32_t len) { switch (uprv_tolower(key)) { @@ -228,7 +228,7 @@ LocaleBuilder& LocaleBuilder::setExtension(char key, StringPiece value) return *this; } if (extensions_ == nullptr) { - extensions_ = new Locale(); + extensions_ = Locale::getRoot().clone(); if (extensions_ == nullptr) { status_ = U_MEMORY_ALLOCATION_ERROR; return *this; @@ -259,11 +259,11 @@ LocaleBuilder& LocaleBuilder::setUnicodeLocaleKeyword( return *this; } if (extensions_ == nullptr) { - extensions_ = new Locale(); - } - if (extensions_ == nullptr) { - status_ = U_MEMORY_ALLOCATION_ERROR; - return *this; + extensions_ = Locale::getRoot().clone(); + if (extensions_ == nullptr) { + status_ = U_MEMORY_ALLOCATION_ERROR; + return *this; + } } extensions_->setUnicodeKeywordValue(key, type, status_); return *this; @@ -280,7 +280,7 @@ LocaleBuilder& LocaleBuilder::addUnicodeLocaleAttribute( return *this; } if (extensions_ == nullptr) { - extensions_ = new Locale(); + extensions_ = Locale::getRoot().clone(); if (extensions_ == nullptr) { status_ = U_MEMORY_ALLOCATION_ERROR; return *this; @@ -415,7 +415,7 @@ void LocaleBuilder::copyExtensionsFrom(const Locale& src, UErrorCode& errorCode) return; } if (extensions_ == nullptr) { - extensions_ = new Locale(); + extensions_ = Locale::getRoot().clone(); if (extensions_ == nullptr) { status_ = U_MEMORY_ALLOCATION_ERROR; return; @@ -459,7 +459,7 @@ Locale LocaleBuilder::build(UErrorCode& errorCode) UBool LocaleBuilder::copyErrorTo(UErrorCode &outErrorCode) const { if (U_FAILURE(outErrorCode)) { // Do not overwrite the older error code - return TRUE; + return true; } outErrorCode = status_; return U_FAILURE(outErrorCode); diff --git a/src/duckdb/extension/icu/third_party/icu/common/localefallback_data.h b/src/duckdb/extension/icu/third_party/icu/common/localefallback_data.h new file mode 100644 index 000000000..c847edeff --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/common/localefallback_data.h @@ -0,0 +1,1344 @@ +// © 2022 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// Internal static data tables used by uresbund.cpp +// WARNING: This file is mechanically generated by the CLDR-to-ICU tool +// (see tools/cldr/cldr-to-icu/src/main/java/org/unicode/tool/cldrtoicu/generator/ResourcFallbackCodeGenerator.java). +// DO NOT HAND EDIT!!! + +#ifdef INCLUDED_FROM_URESBUND_CPP + +//====================================================================== +// Default script table +const char scriptCodeChars[] = + "Aghb\0Ahom\0Arab\0Armi\0Armn\0Avst\0Bamu\0Bass\0Batk\0Beng\0Bopo\0" + "Brah\0Cakm\0Cans\0Cari\0Cham\0Cher\0Chrs\0Copt\0Cprt\0Cyrl\0Deva\0" + "Egyp\0Elym\0Ethi\0Geor\0Gong\0Gonm\0Goth\0Gran\0Grek\0Gujr\0Guru\0" + "Hang\0Hani\0Hans\0Hant\0Hebr\0Hluw\0Hmnp\0Ital\0Java\0Jpan\0Kali\0" + "Kana\0Kawi\0Khar\0Khmr\0Kits\0Knda\0Kore\0Lana\0Laoo\0Lepc\0Lina\0" + "Linb\0Lisu\0Lyci\0Lydi\0Mand\0Mani\0Marc\0Medf\0Merc\0Mlym\0Modi\0" + "Mong\0Mroo\0Mtei\0Mymr\0Narb\0Newa\0Nkoo\0Nshu\0Ogam\0Olck\0Orkh\0" + "Orya\0Osge\0Pauc\0Phli\0Phnx\0Plrd\0Prti\0Rjng\0Rohg\0Runr\0Samr\0" + "Sarb\0Saur\0Sgnw\0Sinh\0Sogd\0Sora\0Soyo\0Syrc\0Tagb\0Takr\0Tale\0" + "Talu\0Taml\0Tang\0Tavt\0Telu\0Tfng\0Thaa\0Thai\0Tibt\0Tnsa\0Toto\0" + "Ugar\0Vaii\0Wcho\0Xpeo\0Xsux\0Yiii\0"; + +const char dsLocaleIDChars[] = + "aaf\0aao\0aat\0ab\0abh\0abl\0abv\0acm\0acq\0acw\0acx\0adf\0adx\0" + "ady\0ae\0aeb\0aec\0aee\0aeq\0afb\0agi\0agj\0agx\0ahg\0aho\0ahr\0" + "aib\0aij\0ain\0aio\0aiq\0ajp\0akk\0akv\0alk\0all\0alr\0alt\0alw\0" + "am\0ams\0amw\0ani\0anp\0anr\0anu\0aot\0apc\0apd\0aph\0aqc\0ar\0" + "arc\0arq\0ars\0ary\0arz\0as\0ase\0ask\0atn\0atv\0auj\0auz\0av\0" + "avd\0avl\0awa\0awn\0axm\0ayh\0ayl\0ayn\0ayp\0az_IQ\0az_IR\0az_RU\0" + "azb\0ba\0bal\0bap\0bax\0bbl\0bcq\0bdv\0bdz\0be\0bee\0bej\0bfb\0" + "bfq\0bft\0bfu\0bfw\0bfy\0bfz\0bg\0bgc\0bgd\0bgn\0bgp\0bgq\0bgw\0" + "bgx\0bha\0bhb\0bhd\0bhe\0bhh\0bhi\0bhj\0bhm\0bhn\0bho\0bht\0bhu\0" + "biy\0bjf\0bjj\0bjm\0blk\0blt\0bmj\0bn\0bns\0bo\0bph\0bpx\0bpy\0" + "bqi\0bra\0brb\0brd\0brh\0brk\0brv\0brx\0bsh\0bsk\0bsq\0bst\0btd\0" + "btm\0btv\0bua\0bwe\0bxm\0bxu\0byh\0byn\0byw\0bzi\0cbn\0ccp\0cde\0" + "cdh\0cdi\0cdj\0cdm\0cdo\0cdz\0ce\0cgk\0chg\0chm\0chr\0chx\0cih\0" + "cja\0cji\0cjm\0cjy\0ckb\0ckt\0clh\0clw\0cmg\0cna\0cnp\0cog\0cop\0" + "cpg\0cr\0crh\0crj\0crk\0crl\0crm\0csh\0csp\0csw\0ctd\0ctg\0ctn\0" + "ctt\0cu\0cuu\0cv\0czh\0czk\0daq\0dar\0dcc\0ddo\0def\0deh\0der\0" + "dhi\0dhn\0dho\0dhw\0dka\0dlg\0dmf\0dmk\0dml\0dng\0dnu\0dnv\0doi\0" + "dox\0dre\0drq\0drs\0dry\0dso\0dty\0dub\0duh\0dus\0dv\0dwk\0dwz\0" + "dz\0dzl\0ecr\0ecy\0egy\0eky\0el\0emg\0emu\0enf\0enh\0era\0esg\0" + "esh\0ett\0eve\0evn\0fa\0fay\0faz\0fia\0fmu\0fub\0gan\0gaq\0gas\0" + "gau\0gbj\0gbk\0gbl\0gbm\0gbz\0gdb\0gdo\0gdx\0gez\0ggg\0gha\0ghe\0" + "ghr\0ght\0gig\0gin\0gjk\0gju\0gld\0glh\0glk\0gmv\0gmy\0goe\0gof\0" + "gok\0gom\0gon\0got\0gra\0grc\0grt\0gru\0gu\0gvr\0gwc\0gwf\0gwt\0" + "gyo\0gzi\0ha_CM\0ha_SD\0hac\0hak\0har\0haz\0hbo\0hdy\0he\0hi\0" + "hii\0hit\0hkh\0hlb\0hlu\0hmd\0hmj\0hmq\0hnd\0hne\0hnj\0hnj_AU\0" + "hnj_CN\0hnj_FR\0hnj_GF\0hnj_LA\0hnj_MM\0hnj_SR\0hnj_TH\0hnj_VN\0" + "hno\0hoc\0hoh\0hoj\0how\0hoy\0hpo\0hrt\0hrz\0hsn\0hss\0htx\0hut\0" + "huy\0huz\0hy\0hyw\0ii\0imy\0inh\0int\0ior\0iru\0isk\0itk\0itl\0" + "iu\0iw\0ja\0jad\0jat\0jbe\0jbn\0jct\0jda\0jdg\0jdt\0jee\0jge\0" + "ji\0jje\0jkm\0jml\0jna\0jnd\0jnl\0jns\0jog\0jpa\0jpr\0jrb\0jrb_MA\0" + "jul\0jun\0juy\0jya\0jye\0ka\0kaa\0kap\0kaw\0kbd\0kbu\0kby\0kca\0" + "kdq\0kdt\0ket\0kex\0key\0kfa\0kfb\0kfc\0kfd\0kfe\0kfh\0kfi\0kfk\0" + "kfm\0kfp\0kfq\0kfr\0kfs\0kfx\0kfy\0kgj\0kgy\0khb\0khf\0khg\0khn\0" + "kht\0khv\0khw\0kif\0kim\0kip\0kjg\0kjh\0kjl\0kjo\0kjp\0kjt\0kk\0" + "kk_AF\0kk_CN\0kk_IR\0kk_MN\0kkf\0kkh\0kkt\0kle\0klj\0klr\0km\0" + "kmj\0kmz\0kn\0ko\0koi\0kok\0kpt\0kpy\0kqd\0kqy\0kra\0krc\0krk\0" + "krr\0kru\0krv\0ks\0ksu\0ksw\0ksz\0ktb\0ktl\0ktp\0ku_LB\0kuf\0" + "kum\0kv\0kva\0kvq\0kvt\0kvx\0kvy\0kxf\0kxk\0kxm\0kxp\0ky\0ky_CN\0" + "kyu\0kyv\0kyw\0lab\0lad\0lae\0lah\0lbc\0lbe\0lbf\0lbj\0lbm\0lbo\0" + "lbr\0lcp\0lep\0lez\0lhm\0lhs\0lif\0lis\0lkh\0lki\0lmh\0lmn\0lo\0" + "loy\0lpo\0lrc\0lrk\0lrl\0lsa\0lsd\0lss\0luk\0luu\0luv\0luz\0lwl\0" + "lwm\0lya\0lzh\0mag\0mai\0man_GN\0mby\0mde\0mdf\0mdx\0mdy\0mfa\0" + "mfi\0mgp\0mhj\0mid\0mjl\0mjq\0mjr\0mjt\0mju\0mjv\0mjz\0mk\0mkb\0" + "mke\0mki\0mkm\0ml\0mlf\0mn\0mn_CN\0mni\0mnj\0mns\0mnw\0mpz\0mr\0" + "mra\0mrd\0mrj\0mro\0mrr\0ms_CC\0mtm\0mtr\0mud\0muk\0mut\0muv\0" + "muz\0mvf\0mvy\0mvz\0mwr\0mwt\0mww\0my\0mym\0myv\0myz\0mzn\0nan\0" + "nao\0ncd\0ncq\0ndf\0ne\0neg\0neh\0nei\0new\0ngt\0nio\0nit\0niv\0" + "nli\0nlm\0nlx\0nmm\0nnp\0nod\0noe\0nog\0noi\0non\0nos\0npb\0nqo\0" + "nsd\0nsf\0nsk\0nst\0nsv\0nty\0ntz\0nwc\0nwx\0nyl\0nyq\0oaa\0oac\0" + "oar\0oav\0obm\0obr\0odk\0oht\0oj\0ojs\0okm\0oko\0okz\0ola\0ole\0" + "omk\0omp\0omr\0oon\0or\0ort\0oru\0orv\0os\0osa\0osc\0osi\0ota\0" + "otb\0otk\0oty\0pa\0pa_PK\0pal\0paq\0pbt\0pcb\0pce\0pcf\0pcg\0" + "pch\0pci\0pcj\0peg\0peo\0pgd\0pgg\0pgl\0pgn\0phd\0phk\0phl\0phn\0" + "pho\0phr\0pht\0phv\0phw\0pi\0pka\0pkr\0plk\0pll\0pmh\0pnt\0pra\0" + "prc\0prd\0prp\0prt\0prx\0ps\0psh\0psi\0pst\0pum\0pwo\0pwr\0pww\0" + "pyx\0qxq\0raa\0rab\0raf\0rah\0raj\0rav\0rbb\0rdb\0rei\0rhg\0rji\0" + "rjs\0rka\0rki\0rkt\0rmi\0rmt\0rmz\0rom_BG\0rsk\0rtw\0ru\0rue\0" + "rut\0rwr\0ryu\0sa\0sah\0sam\0sat\0saz\0sbn\0sbu\0sck\0scl\0scl_IN\0" + "scp\0sct\0scu\0scx\0sd\0sd_IN\0sdb\0sdf\0sdg\0sdh\0sds\0sel\0" + "sfm\0sga\0sgh\0sgj\0sgr\0sgt\0sgw\0sgy\0shd\0shi\0shm\0shn\0shu\0" + "shv\0si\0sia\0sip\0siy\0siz\0sjd\0sjp\0sjt\0skb\0skj\0skr\0slq\0" + "smh\0smp\0smu\0smy\0soa\0sog\0soi\0sou\0spt\0spv\0sqo\0sqq\0sqt\0" + "sr\0srb\0srh\0srx\0srz\0ssh\0sss\0sts\0stv\0sty\0suz\0sva\0swb\0" + "swi\0swv\0syc\0syl\0syn\0syr\0syw\0ta\0tab\0taj\0tbk\0tcn\0tco\0" + "tcx\0tcy\0tda\0tdb\0tdd\0tdg\0tdh\0te\0tes\0tg\0tg_PK\0tge\0tgf\0" + "th\0the\0thf\0thi\0thl\0thm\0thq\0thr\0ths\0ti\0tig\0tij\0tin\0" + "tjl\0tjo\0tkb\0tks\0tkt\0tmk\0tmr\0tnv\0tov\0tpu\0tra\0trg\0trm\0" + "trw\0tsd\0tsj\0tt\0tth\0tto\0tts\0tvn\0twm\0txg\0txo\0tyr\0tyv\0" + "ude\0udg\0udi\0udm\0ug\0ug_KZ\0ug_MN\0uga\0ugh\0ugo\0uk\0uki\0" + "ulc\0unr\0unr_NP\0unx\0ur\0urk\0ush\0uum\0uz_AF\0uz_CN\0uzs\0" + "vaa\0vaf\0vah\0vai\0vas\0vav\0vay\0vgr\0vmd\0vmh\0wal\0wbk\0wbq\0" + "wbr\0wlo\0wme\0wne\0wni\0wsg\0wsv\0wtm\0wuu\0xal\0xan\0xas\0xco\0" + "xcr\0xdq\0xhe\0xhm\0xis\0xka\0xkc\0xkj\0xkp\0xlc\0xld\0xly\0xmf\0" + "xmn\0xmr\0xna\0xnr\0xpg\0xpi\0xpm\0xpr\0xrm\0xrn\0xsa\0xsr\0xss\0" + "xub\0xuj\0xve\0xvi\0xwo\0xzh\0yai\0ybh\0ybi\0ydg\0yea\0yej\0yeu\0" + "ygp\0yhd\0yi\0yig\0yih\0yiv\0ykg\0yna\0ynk\0yoi\0yoy\0yrk\0ysd\0" + "ysn\0ysp\0ysr\0ysy\0yud\0yue\0yue_CN\0yug\0yux\0ywq\0ywu\0zau\0" + "zba\0zch\0zdj\0zeh\0zen\0zgb\0zgh\0zgm\0zgn\0zh\0zh_AU\0zh_BN\0" + "zh_GB\0zh_GF\0zh_HK\0zh_ID\0zh_MO\0zh_PA\0zh_PF\0zh_PH\0zh_SR\0" + "zh_TH\0zh_TW\0zh_US\0zh_VN\0zhd\0zhx\0zkb\0zko\0zkt\0zkz\0zlj\0" + "zln\0zlq\0zqe\0zrp\0zum\0zyg\0zyn\0zzj\0"; + +const int32_t defaultScriptTable[] = { + 0, 320, // aaf -> Mlym + 4, 10, // aao -> Arab + 8, 150, // aat -> Grek + 12, 100, // ab -> Cyrl + 15, 10, // abh -> Arab + 19, 420, // abl -> Rjng + 23, 10, // abv -> Arab + 27, 10, // acm -> Arab + 31, 10, // acq -> Arab + 35, 10, // acw -> Arab + 39, 10, // acx -> Arab + 43, 10, // adf -> Arab + 47, 535, // adx -> Tibt + 51, 100, // ady -> Cyrl + 55, 25, // ae -> Avst + 58, 10, // aeb -> Arab + 62, 10, // aec -> Arab + 66, 10, // aee -> Arab + 70, 10, // aeq -> Arab + 74, 10, // afb -> Arab + 78, 105, // agi -> Deva + 82, 120, // agj -> Ethi + 86, 100, // agx -> Cyrl + 90, 120, // ahg -> Ethi + 94, 5, // aho -> Ahom + 98, 105, // ahr -> Deva + 102, 10, // aib -> Arab + 106, 185, // aij -> Hebr + 110, 220, // ain -> Kana + 114, 345, // aio -> Mymr + 118, 10, // aiq -> Arab + 122, 10, // ajp -> Arab + 126, 570, // akk -> Xsux + 130, 100, // akv -> Cyrl + 134, 260, // alk -> Laoo + 138, 320, // all -> Mlym + 142, 100, // alr -> Cyrl + 146, 100, // alt -> Cyrl + 150, 120, // alw -> Ethi + 154, 120, // am -> Ethi + 157, 210, // ams -> Jpan + 161, 475, // amw -> Syrc + 165, 100, // ani -> Cyrl + 169, 105, // anp -> Deva + 173, 105, // anr -> Deva + 177, 120, // anu -> Ethi + 181, 45, // aot -> Beng + 185, 10, // apc -> Arab + 189, 10, // apd -> Arab + 193, 105, // aph -> Deva + 197, 100, // aqc -> Cyrl + 201, 10, // ar -> Arab + 204, 15, // arc -> Armi + 208, 10, // arq -> Arab + 212, 10, // ars -> Arab + 216, 10, // ary -> Arab + 220, 10, // arz -> Arab + 224, 45, // as -> Beng + 227, 450, // ase -> Sgnw + 231, 10, // ask -> Arab + 235, 10, // atn -> Arab + 239, 100, // atv -> Cyrl + 243, 10, // auj -> Arab + 247, 10, // auz -> Arab + 251, 100, // av -> Cyrl + 254, 10, // avd -> Arab + 258, 10, // avl -> Arab + 262, 105, // awa -> Deva + 266, 120, // awn -> Ethi + 270, 20, // axm -> Armn + 274, 10, // ayh -> Arab + 278, 10, // ayl -> Arab + 282, 10, // ayn -> Arab + 286, 10, // ayp -> Arab + 290, 10, // az_IQ -> Arab + 296, 10, // az_IR -> Arab + 302, 100, // az_RU -> Cyrl + 308, 10, // azb -> Arab + 312, 100, // ba -> Cyrl + 315, 10, // bal -> Arab + 319, 105, // bap -> Deva + 323, 30, // bax -> Bamu + 327, 125, // bbl -> Geor + 331, 120, // bcq -> Ethi + 335, 385, // bdv -> Orya + 339, 10, // bdz -> Arab + 343, 100, // be -> Cyrl + 346, 105, // bee -> Deva + 350, 10, // bej -> Arab + 354, 105, // bfb -> Deva + 358, 500, // bfq -> Taml + 362, 10, // bft -> Arab + 366, 535, // bfu -> Tibt + 370, 385, // bfw -> Orya + 374, 105, // bfy -> Deva + 378, 105, // bfz -> Deva + 382, 100, // bg -> Cyrl + 385, 105, // bgc -> Deva + 389, 105, // bgd -> Deva + 393, 10, // bgn -> Arab + 397, 10, // bgp -> Arab + 401, 105, // bgq -> Deva + 405, 105, // bgw -> Deva + 409, 150, // bgx -> Grek + 413, 105, // bha -> Deva + 417, 105, // bhb -> Deva + 421, 105, // bhd -> Deva + 425, 10, // bhe -> Arab + 429, 100, // bhh -> Cyrl + 433, 105, // bhi -> Deva + 437, 105, // bhj -> Deva + 441, 10, // bhm -> Arab + 445, 475, // bhn -> Syrc + 449, 105, // bho -> Deva + 453, 485, // bht -> Takr + 457, 105, // bhu -> Deva + 461, 105, // biy -> Deva + 465, 475, // bjf -> Syrc + 469, 105, // bjj -> Deva + 473, 10, // bjm -> Arab + 477, 345, // blk -> Mymr + 481, 510, // blt -> Tavt + 485, 105, // bmj -> Deva + 489, 45, // bn -> Beng + 492, 105, // bns -> Deva + 496, 535, // bo -> Tibt + 499, 100, // bph -> Cyrl + 503, 105, // bpx -> Deva + 507, 45, // bpy -> Beng + 511, 10, // bqi -> Arab + 515, 105, // bra -> Deva + 519, 235, // brb -> Khmr + 523, 105, // brd -> Deva + 527, 10, // brh -> Arab + 531, 10, // brk -> Arab + 535, 260, // brv -> Laoo + 539, 105, // brx -> Deva + 543, 10, // bsh -> Arab + 547, 10, // bsk -> Arab + 551, 35, // bsq -> Bass + 555, 120, // bst -> Ethi + 559, 40, // btd -> Batk + 563, 40, // btm -> Batk + 567, 105, // btv -> Deva + 571, 100, // bua -> Cyrl + 575, 345, // bwe -> Mymr + 579, 100, // bxm -> Cyrl + 583, 330, // bxu -> Mong + 587, 105, // byh -> Deva + 591, 120, // byn -> Ethi + 595, 105, // byw -> Deva + 599, 530, // bzi -> Thai + 603, 530, // cbn -> Thai + 607, 60, // ccp -> Cakm + 611, 515, // cde -> Telu + 615, 105, // cdh -> Deva + 619, 155, // cdi -> Gujr + 623, 105, // cdj -> Deva + 627, 105, // cdm -> Deva + 631, 175, // cdo -> Hans + 635, 45, // cdz -> Beng + 639, 100, // ce -> Cyrl + 642, 535, // cgk -> Tibt + 646, 10, // chg -> Arab + 650, 100, // chm -> Cyrl + 654, 80, // chr -> Cher + 658, 105, // chx -> Deva + 662, 105, // cih -> Deva + 666, 10, // cja -> Arab + 670, 100, // cji -> Cyrl + 674, 75, // cjm -> Cham + 678, 175, // cjy -> Hans + 682, 10, // ckb -> Arab + 686, 100, // ckt -> Cyrl + 690, 10, // clh -> Arab + 694, 100, // clw -> Cyrl + 698, 470, // cmg -> Soyo + 702, 535, // cna -> Tibt + 706, 175, // cnp -> Hans + 710, 530, // cog -> Thai + 714, 90, // cop -> Copt + 718, 150, // cpg -> Grek + 722, 65, // cr -> Cans + 725, 100, // crh -> Cyrl + 729, 65, // crj -> Cans + 733, 65, // crk -> Cans + 737, 65, // crl -> Cans + 741, 65, // crm -> Cans + 745, 345, // csh -> Mymr + 749, 175, // csp -> Hans + 753, 65, // csw -> Cans + 757, 395, // ctd -> Pauc + 761, 45, // ctg -> Beng + 765, 105, // ctn -> Deva + 769, 500, // ctt -> Taml + 773, 100, // cu -> Cyrl + 776, 255, // cuu -> Lana + 780, 100, // cv -> Cyrl + 783, 175, // czh -> Hans + 787, 185, // czk -> Hebr + 791, 105, // daq -> Deva + 795, 100, // dar -> Cyrl + 799, 10, // dcc -> Arab + 803, 100, // ddo -> Cyrl + 807, 10, // def -> Arab + 811, 10, // deh -> Arab + 815, 45, // der -> Beng + 819, 105, // dhi -> Deva + 823, 155, // dhn -> Gujr + 827, 105, // dho -> Deva + 831, 105, // dhw -> Deva + 835, 535, // dka -> Tibt + 839, 100, // dlg -> Cyrl + 843, 310, // dmf -> Medf + 847, 10, // dmk -> Arab + 851, 10, // dml -> Arab + 855, 100, // dng -> Cyrl + 859, 345, // dnu -> Mymr + 863, 345, // dnv -> Mymr + 867, 105, // doi -> Deva + 871, 120, // dox -> Ethi + 875, 535, // dre -> Tibt + 879, 105, // drq -> Deva + 883, 120, // drs -> Ethi + 887, 105, // dry -> Deva + 891, 385, // dso -> Orya + 895, 105, // dty -> Deva + 899, 155, // dub -> Gujr + 903, 105, // duh -> Deva + 907, 105, // dus -> Deva + 911, 525, // dv -> Thaa + 914, 385, // dwk -> Orya + 918, 105, // dwz -> Deva + 922, 535, // dz -> Tibt + 925, 535, // dzl -> Tibt + 929, 150, // ecr -> Grek + 933, 95, // ecy -> Cprt + 937, 110, // egy -> Egyp + 941, 215, // eky -> Kali + 945, 150, // el -> Grek + 948, 105, // emg -> Deva + 952, 105, // emu -> Deva + 956, 100, // enf -> Cyrl + 960, 100, // enh -> Cyrl + 964, 500, // era -> Taml + 968, 135, // esg -> Gonm + 972, 10, // esh -> Arab + 976, 200, // ett -> Ital + 980, 100, // eve -> Cyrl + 984, 100, // evn -> Cyrl + 988, 10, // fa -> Arab + 991, 10, // fay -> Arab + 995, 10, // faz -> Arab + 999, 10, // fia -> Arab + 1003, 105, // fmu -> Deva + 1007, 10, // fub -> Arab + 1011, 175, // gan -> Hans + 1015, 385, // gaq -> Orya + 1019, 155, // gas -> Gujr + 1023, 515, // gau -> Telu + 1027, 385, // gbj -> Orya + 1031, 105, // gbk -> Deva + 1035, 155, // gbl -> Gujr + 1039, 105, // gbm -> Deva + 1043, 10, // gbz -> Arab + 1047, 385, // gdb -> Orya + 1051, 100, // gdo -> Cyrl + 1055, 105, // gdx -> Deva + 1059, 120, // gez -> Ethi + 1063, 10, // ggg -> Arab + 1067, 10, // gha -> Arab + 1071, 105, // ghe -> Deva + 1075, 10, // ghr -> Arab + 1079, 535, // ght -> Tibt + 1083, 10, // gig -> Arab + 1087, 100, // gin -> Cyrl + 1091, 10, // gjk -> Arab + 1095, 10, // gju -> Arab + 1099, 100, // gld -> Cyrl + 1103, 10, // glh -> Arab + 1107, 10, // glk -> Arab + 1111, 120, // gmv -> Ethi + 1115, 275, // gmy -> Linb + 1119, 535, // goe -> Tibt + 1123, 120, // gof -> Ethi + 1127, 105, // gok -> Deva + 1131, 105, // gom -> Deva + 1135, 515, // gon -> Telu + 1139, 140, // got -> Goth + 1143, 105, // gra -> Deva + 1147, 95, // grc -> Cprt + 1151, 45, // grt -> Beng + 1155, 120, // gru -> Ethi + 1159, 155, // gu -> Gujr + 1162, 105, // gvr -> Deva + 1166, 10, // gwc -> Arab + 1170, 10, // gwf -> Arab + 1174, 10, // gwt -> Arab + 1178, 105, // gyo -> Deva + 1182, 10, // gzi -> Arab + 1186, 10, // ha_CM -> Arab + 1192, 10, // ha_SD -> Arab + 1198, 10, // hac -> Arab + 1202, 175, // hak -> Hans + 1206, 120, // har -> Ethi + 1210, 10, // haz -> Arab + 1214, 185, // hbo -> Hebr + 1218, 120, // hdy -> Ethi + 1222, 185, // he -> Hebr + 1225, 105, // hi -> Deva + 1228, 485, // hii -> Takr + 1232, 570, // hit -> Xsux + 1236, 10, // hkh -> Arab + 1240, 105, // hlb -> Deva + 1244, 190, // hlu -> Hluw + 1248, 410, // hmd -> Plrd + 1252, 50, // hmj -> Bopo + 1256, 50, // hmq -> Bopo + 1260, 10, // hnd -> Arab + 1264, 105, // hne -> Deva + 1268, 195, // hnj -> Hmnp + 1272, 260, // hnj_AU -> Laoo + 1279, 260, // hnj_CN -> Laoo + 1286, 260, // hnj_FR -> Laoo + 1293, 260, // hnj_GF -> Laoo + 1300, 260, // hnj_LA -> Laoo + 1307, 260, // hnj_MM -> Laoo + 1314, 260, // hnj_SR -> Laoo + 1321, 260, // hnj_TH -> Laoo + 1328, 260, // hnj_VN -> Laoo + 1335, 10, // hno -> Arab + 1339, 105, // hoc -> Deva + 1343, 10, // hoh -> Arab + 1347, 105, // hoj -> Deva + 1351, 170, // how -> Hani + 1355, 105, // hoy -> Deva + 1359, 345, // hpo -> Mymr + 1363, 475, // hrt -> Syrc + 1367, 10, // hrz -> Arab + 1371, 175, // hsn -> Hans + 1375, 10, // hss -> Arab + 1379, 570, // htx -> Xsux + 1383, 105, // hut -> Deva + 1387, 185, // huy -> Hebr + 1391, 100, // huz -> Cyrl + 1395, 20, // hy -> Armn + 1398, 20, // hyw -> Armn + 1402, 575, // ii -> Yiii + 1405, 285, // imy -> Lyci + 1409, 100, // inh -> Cyrl + 1413, 345, // int -> Mymr + 1417, 120, // ior -> Ethi + 1421, 500, // iru -> Taml + 1425, 10, // isk -> Arab + 1429, 185, // itk -> Hebr + 1433, 100, // itl -> Cyrl + 1437, 65, // iu -> Cans + 1440, 185, // iw -> Hebr + 1443, 210, // ja -> Jpan + 1446, 10, // jad -> Arab + 1450, 10, // jat -> Arab + 1454, 185, // jbe -> Hebr + 1458, 10, // jbn -> Arab + 1462, 100, // jct -> Cyrl + 1466, 535, // jda -> Tibt + 1470, 10, // jdg -> Arab + 1474, 100, // jdt -> Cyrl + 1478, 105, // jee -> Deva + 1482, 125, // jge -> Geor + 1486, 185, // ji -> Hebr + 1489, 165, // jje -> Hang + 1493, 345, // jkm -> Mymr + 1497, 105, // jml -> Deva + 1501, 485, // jna -> Takr + 1505, 10, // jnd -> Arab + 1509, 105, // jnl -> Deva + 1513, 105, // jns -> Deva + 1517, 10, // jog -> Arab + 1521, 185, // jpa -> Hebr + 1525, 185, // jpr -> Hebr + 1529, 185, // jrb -> Hebr + 1533, 10, // jrb_MA -> Arab + 1540, 105, // jul -> Deva + 1544, 385, // jun -> Orya + 1548, 385, // juy -> Orya + 1552, 535, // jya -> Tibt + 1556, 185, // jye -> Hebr + 1560, 125, // ka -> Geor + 1563, 100, // kaa -> Cyrl + 1567, 100, // kap -> Cyrl + 1571, 225, // kaw -> Kawi + 1575, 100, // kbd -> Cyrl + 1579, 10, // kbu -> Arab + 1583, 10, // kby -> Arab + 1587, 100, // kca -> Cyrl + 1591, 45, // kdq -> Beng + 1595, 530, // kdt -> Thai + 1599, 100, // ket -> Cyrl + 1603, 105, // kex -> Deva + 1607, 515, // key -> Telu + 1611, 245, // kfa -> Knda + 1615, 105, // kfb -> Deva + 1619, 515, // kfc -> Telu + 1623, 245, // kfd -> Knda + 1627, 500, // kfe -> Taml + 1631, 320, // kfh -> Mlym + 1635, 500, // kfi -> Taml + 1639, 105, // kfk -> Deva + 1643, 10, // kfm -> Arab + 1647, 105, // kfp -> Deva + 1651, 105, // kfq -> Deva + 1655, 105, // kfr -> Deva + 1659, 105, // kfs -> Deva + 1663, 105, // kfx -> Deva + 1667, 105, // kfy -> Deva + 1671, 105, // kgj -> Deva + 1675, 105, // kgy -> Deva + 1679, 495, // khb -> Talu + 1683, 530, // khf -> Thai + 1687, 535, // khg -> Tibt + 1691, 105, // khn -> Deva + 1695, 345, // kht -> Mymr + 1699, 100, // khv -> Cyrl + 1703, 10, // khw -> Arab + 1707, 105, // kif -> Deva + 1711, 100, // kim -> Cyrl + 1715, 105, // kip -> Deva + 1719, 260, // kjg -> Laoo + 1723, 100, // kjh -> Cyrl + 1727, 105, // kjl -> Deva + 1731, 105, // kjo -> Deva + 1735, 345, // kjp -> Mymr + 1739, 530, // kjt -> Thai + 1743, 100, // kk -> Cyrl + 1746, 10, // kk_AF -> Arab + 1752, 10, // kk_CN -> Arab + 1758, 10, // kk_IR -> Arab + 1764, 10, // kk_MN -> Arab + 1770, 535, // kkf -> Tibt + 1774, 255, // kkh -> Lana + 1778, 105, // kkt -> Deva + 1782, 105, // kle -> Deva + 1786, 10, // klj -> Arab + 1790, 105, // klr -> Deva + 1794, 235, // km -> Khmr + 1797, 105, // kmj -> Deva + 1801, 10, // kmz -> Arab + 1805, 245, // kn -> Knda + 1808, 250, // ko -> Kore + 1811, 100, // koi -> Cyrl + 1815, 105, // kok -> Deva + 1819, 100, // kpt -> Cyrl + 1823, 100, // kpy -> Cyrl + 1827, 475, // kqd -> Syrc + 1831, 120, // kqy -> Ethi + 1835, 105, // kra -> Deva + 1839, 100, // krc -> Cyrl + 1843, 100, // krk -> Cyrl + 1847, 235, // krr -> Khmr + 1851, 105, // kru -> Deva + 1855, 235, // krv -> Khmr + 1859, 10, // ks -> Arab + 1862, 345, // ksu -> Mymr + 1866, 345, // ksw -> Mymr + 1870, 105, // ksz -> Deva + 1874, 120, // ktb -> Ethi + 1878, 10, // ktl -> Arab + 1882, 410, // ktp -> Plrd + 1886, 10, // ku_LB -> Arab + 1892, 260, // kuf -> Laoo + 1896, 100, // kum -> Cyrl + 1900, 100, // kv -> Cyrl + 1903, 100, // kva -> Cyrl + 1907, 345, // kvq -> Mymr + 1911, 345, // kvt -> Mymr + 1915, 10, // kvx -> Arab + 1919, 215, // kvy -> Kali + 1923, 345, // kxf -> Mymr + 1927, 345, // kxk -> Mymr + 1931, 530, // kxm -> Thai + 1935, 10, // kxp -> Arab + 1939, 100, // ky -> Cyrl + 1942, 10, // ky_CN -> Arab + 1948, 215, // kyu -> Kali + 1952, 105, // kyv -> Deva + 1956, 105, // kyw -> Deva + 1960, 270, // lab -> Lina + 1964, 185, // lad -> Hebr + 1968, 105, // lae -> Deva + 1972, 10, // lah -> Arab + 1976, 280, // lbc -> Lisu + 1980, 100, // lbe -> Cyrl + 1984, 105, // lbf -> Deva + 1988, 535, // lbj -> Tibt + 1992, 105, // lbm -> Deva + 1996, 260, // lbo -> Laoo + 2000, 105, // lbr -> Deva + 2004, 530, // lcp -> Thai + 2008, 265, // lep -> Lepc + 2012, 100, // lez -> Cyrl + 2016, 105, // lhm -> Deva + 2020, 475, // lhs -> Syrc + 2024, 105, // lif -> Deva + 2028, 280, // lis -> Lisu + 2032, 535, // lkh -> Tibt + 2036, 10, // lki -> Arab + 2040, 105, // lmh -> Deva + 2044, 515, // lmn -> Telu + 2048, 260, // lo -> Laoo + 2051, 105, // loy -> Deva + 2055, 410, // lpo -> Plrd + 2059, 10, // lrc -> Arab + 2063, 10, // lrk -> Arab + 2067, 10, // lrl -> Arab + 2071, 10, // lsa -> Arab + 2075, 185, // lsd -> Hebr + 2079, 10, // lss -> Arab + 2083, 535, // luk -> Tibt + 2087, 105, // luu -> Deva + 2091, 10, // luv -> Arab + 2095, 10, // luz -> Arab + 2099, 530, // lwl -> Thai + 2103, 530, // lwm -> Thai + 2107, 535, // lya -> Tibt + 2111, 175, // lzh -> Hans + 2115, 105, // mag -> Deva + 2119, 105, // mai -> Deva + 2123, 360, // man_GN -> Nkoo + 2130, 10, // mby -> Arab + 2134, 10, // mde -> Arab + 2138, 100, // mdf -> Cyrl + 2142, 120, // mdx -> Ethi + 2146, 120, // mdy -> Ethi + 2150, 10, // mfa -> Arab + 2154, 10, // mfi -> Arab + 2158, 105, // mgp -> Deva + 2162, 10, // mhj -> Arab + 2166, 295, // mid -> Mand + 2170, 105, // mjl -> Deva + 2174, 320, // mjq -> Mlym + 2178, 320, // mjr -> Mlym + 2182, 105, // mjt -> Deva + 2186, 515, // mju -> Telu + 2190, 320, // mjv -> Mlym + 2194, 105, // mjz -> Deva + 2198, 100, // mk -> Cyrl + 2201, 105, // mkb -> Deva + 2205, 105, // mke -> Deva + 2209, 10, // mki -> Arab + 2213, 530, // mkm -> Thai + 2217, 320, // ml -> Mlym + 2220, 530, // mlf -> Thai + 2224, 100, // mn -> Cyrl + 2227, 330, // mn_CN -> Mong + 2233, 45, // mni -> Beng + 2237, 10, // mnj -> Arab + 2241, 100, // mns -> Cyrl + 2245, 345, // mnw -> Mymr + 2249, 530, // mpz -> Thai + 2253, 105, // mr -> Deva + 2256, 530, // mra -> Thai + 2260, 105, // mrd -> Deva + 2264, 100, // mrj -> Cyrl + 2268, 335, // mro -> Mroo + 2272, 105, // mrr -> Deva + 2276, 10, // ms_CC -> Arab + 2282, 100, // mtm -> Cyrl + 2286, 105, // mtr -> Deva + 2290, 100, // mud -> Cyrl + 2294, 535, // muk -> Tibt + 2298, 105, // mut -> Deva + 2302, 500, // muv -> Taml + 2306, 120, // muz -> Ethi + 2310, 330, // mvf -> Mong + 2314, 10, // mvy -> Arab + 2318, 120, // mvz -> Ethi + 2322, 105, // mwr -> Deva + 2326, 345, // mwt -> Mymr + 2330, 195, // mww -> Hmnp + 2334, 345, // my -> Mymr + 2337, 120, // mym -> Ethi + 2341, 100, // myv -> Cyrl + 2345, 295, // myz -> Mand + 2349, 10, // mzn -> Arab + 2353, 175, // nan -> Hans + 2357, 105, // nao -> Deva + 2361, 105, // ncd -> Deva + 2365, 260, // ncq -> Laoo + 2369, 100, // ndf -> Cyrl + 2373, 105, // ne -> Deva + 2376, 100, // neg -> Cyrl + 2380, 535, // neh -> Tibt + 2384, 570, // nei -> Xsux + 2388, 105, // new -> Deva + 2392, 260, // ngt -> Laoo + 2396, 100, // nio -> Cyrl + 2400, 515, // nit -> Telu + 2404, 100, // niv -> Cyrl + 2408, 10, // nli -> Arab + 2412, 10, // nlm -> Arab + 2416, 105, // nlx -> Deva + 2420, 105, // nmm -> Deva + 2424, 560, // nnp -> Wcho + 2428, 255, // nod -> Lana + 2432, 105, // noe -> Deva + 2436, 100, // nog -> Cyrl + 2440, 105, // noi -> Deva + 2444, 430, // non -> Runr + 2448, 575, // nos -> Yiii + 2452, 535, // npb -> Tibt + 2456, 360, // nqo -> Nkoo + 2460, 575, // nsd -> Yiii + 2464, 575, // nsf -> Yiii + 2468, 65, // nsk -> Cans + 2472, 540, // nst -> Tnsa + 2476, 575, // nsv -> Yiii + 2480, 575, // nty -> Yiii + 2484, 10, // ntz -> Arab + 2488, 355, // nwc -> Newa + 2492, 105, // nwx -> Deva + 2496, 530, // nyl -> Thai + 2500, 10, // nyq -> Arab + 2504, 100, // oaa -> Cyrl + 2508, 100, // oac -> Cyrl + 2512, 475, // oar -> Syrc + 2516, 125, // oav -> Geor + 2520, 405, // obm -> Phnx + 2524, 345, // obr -> Mymr + 2528, 10, // odk -> Arab + 2532, 570, // oht -> Xsux + 2536, 65, // oj -> Cans + 2539, 65, // ojs -> Cans + 2543, 165, // okm -> Hang + 2547, 170, // oko -> Hani + 2551, 235, // okz -> Khmr + 2555, 105, // ola -> Deva + 2559, 535, // ole -> Tibt + 2563, 100, // omk -> Cyrl + 2567, 340, // omp -> Mtei + 2571, 325, // omr -> Modi + 2575, 105, // oon -> Deva + 2579, 385, // or -> Orya + 2582, 515, // ort -> Telu + 2586, 10, // oru -> Arab + 2590, 100, // orv -> Cyrl + 2594, 100, // os -> Cyrl + 2597, 390, // osa -> Osge + 2601, 200, // osc -> Ital + 2605, 205, // osi -> Java + 2609, 10, // ota -> Arab + 2613, 535, // otb -> Tibt + 2617, 380, // otk -> Orkh + 2621, 145, // oty -> Gran + 2625, 160, // pa -> Guru + 2628, 10, // pa_PK -> Arab + 2634, 400, // pal -> Phli + 2638, 100, // paq -> Cyrl + 2642, 10, // pbt -> Arab + 2646, 235, // pcb -> Khmr + 2650, 345, // pce -> Mymr + 2654, 320, // pcf -> Mlym + 2658, 320, // pcg -> Mlym + 2662, 105, // pch -> Deva + 2666, 105, // pci -> Deva + 2670, 515, // pcj -> Telu + 2674, 385, // peg -> Orya + 2678, 565, // peo -> Xpeo + 2682, 230, // pgd -> Khar + 2686, 105, // pgg -> Deva + 2690, 370, // pgl -> Ogam + 2694, 200, // pgn -> Ital + 2698, 105, // phd -> Deva + 2702, 345, // phk -> Mymr + 2706, 10, // phl -> Arab + 2710, 405, // phn -> Phnx + 2714, 260, // pho -> Laoo + 2718, 10, // phr -> Arab + 2722, 530, // pht -> Thai + 2726, 10, // phv -> Arab + 2730, 105, // phw -> Deva + 2734, 455, // pi -> Sinh + 2737, 55, // pka -> Brah + 2741, 320, // pkr -> Mlym + 2745, 10, // plk -> Arab + 2749, 345, // pll -> Mymr + 2753, 55, // pmh -> Brah + 2757, 150, // pnt -> Grek + 2761, 230, // pra -> Khar + 2765, 10, // prc -> Arab + 2769, 10, // prd -> Arab + 2773, 155, // prp -> Gujr + 2777, 530, // prt -> Thai + 2781, 10, // prx -> Arab + 2785, 10, // ps -> Arab + 2788, 10, // psh -> Arab + 2792, 10, // psi -> Arab + 2796, 10, // pst -> Arab + 2800, 105, // pum -> Deva + 2804, 345, // pwo -> Mymr + 2808, 105, // pwr -> Deva + 2812, 530, // pww -> Thai + 2816, 345, // pyx -> Mymr + 2820, 10, // qxq -> Arab + 2824, 105, // raa -> Deva + 2828, 105, // rab -> Deva + 2832, 105, // raf -> Deva + 2836, 45, // rah -> Beng + 2840, 105, // raj -> Deva + 2844, 105, // rav -> Deva + 2848, 345, // rbb -> Mymr + 2852, 10, // rdb -> Arab + 2856, 385, // rei -> Orya + 2860, 425, // rhg -> Rohg + 2864, 105, // rji -> Deva + 2868, 105, // rjs -> Deva + 2872, 235, // rka -> Khmr + 2876, 345, // rki -> Mymr + 2880, 45, // rkt -> Beng + 2884, 20, // rmi -> Armn + 2888, 10, // rmt -> Arab + 2892, 345, // rmz -> Mymr + 2896, 100, // rom_BG -> Cyrl + 2903, 100, // rsk -> Cyrl + 2907, 105, // rtw -> Deva + 2911, 100, // ru -> Cyrl + 2914, 100, // rue -> Cyrl + 2918, 100, // rut -> Cyrl + 2922, 105, // rwr -> Deva + 2926, 220, // ryu -> Kana + 2930, 105, // sa -> Deva + 2933, 100, // sah -> Cyrl + 2937, 435, // sam -> Samr + 2941, 375, // sat -> Olck + 2945, 445, // saz -> Saur + 2949, 10, // sbn -> Arab + 2953, 535, // sbu -> Tibt + 2957, 105, // sck -> Deva + 2961, 10, // scl -> Arab + 2965, 10, // scl_IN -> Arab + 2972, 105, // scp -> Deva + 2976, 260, // sct -> Laoo + 2980, 485, // scu -> Takr + 2984, 150, // scx -> Grek + 2988, 10, // sd -> Arab + 2991, 105, // sd_IN -> Deva + 2997, 10, // sdb -> Arab + 3001, 10, // sdf -> Arab + 3005, 10, // sdg -> Arab + 3009, 10, // sdh -> Arab + 3013, 10, // sds -> Arab + 3017, 100, // sel -> Cyrl + 3021, 410, // sfm -> Plrd + 3025, 370, // sga -> Ogam + 3029, 100, // sgh -> Cyrl + 3033, 105, // sgj -> Deva + 3037, 10, // sgr -> Arab + 3041, 535, // sgt -> Tibt + 3045, 120, // sgw -> Ethi + 3049, 10, // sgy -> Arab + 3053, 10, // shd -> Arab + 3057, 520, // shi -> Tfng + 3061, 10, // shm -> Arab + 3065, 345, // shn -> Mymr + 3069, 10, // shu -> Arab + 3073, 10, // shv -> Arab + 3077, 455, // si -> Sinh + 3080, 100, // sia -> Cyrl + 3084, 535, // sip -> Tibt + 3088, 10, // siy -> Arab + 3092, 10, // siz -> Arab + 3096, 100, // sjd -> Cyrl + 3100, 105, // sjp -> Deva + 3104, 100, // sjt -> Cyrl + 3108, 530, // skb -> Thai + 3112, 105, // skj -> Deva + 3116, 10, // skr -> Arab + 3120, 10, // slq -> Arab + 3124, 575, // smh -> Yiii + 3128, 435, // smp -> Samr + 3132, 235, // smu -> Khmr + 3136, 10, // smy -> Arab + 3140, 510, // soa -> Tavt + 3144, 460, // sog -> Sogd + 3148, 105, // soi -> Deva + 3152, 530, // sou -> Thai + 3156, 535, // spt -> Tibt + 3160, 385, // spv -> Orya + 3164, 10, // sqo -> Arab + 3168, 260, // sqq -> Laoo + 3172, 10, // sqt -> Arab + 3176, 100, // sr -> Cyrl + 3179, 465, // srb -> Sora + 3183, 10, // srh -> Arab + 3187, 105, // srx -> Deva + 3191, 10, // srz -> Arab + 3195, 10, // ssh -> Arab + 3199, 260, // sss -> Laoo + 3203, 10, // sts -> Arab + 3207, 120, // stv -> Ethi + 3211, 100, // sty -> Cyrl + 3215, 105, // suz -> Deva + 3219, 125, // sva -> Geor + 3223, 10, // swb -> Arab + 3227, 170, // swi -> Hani + 3231, 105, // swv -> Deva + 3235, 475, // syc -> Syrc + 3239, 45, // syl -> Beng + 3243, 475, // syn -> Syrc + 3247, 475, // syr -> Syrc + 3251, 105, // syw -> Deva + 3255, 500, // ta -> Taml + 3258, 100, // tab -> Cyrl + 3262, 105, // taj -> Deva + 3266, 480, // tbk -> Tagb + 3270, 535, // tcn -> Tibt + 3274, 345, // tco -> Mymr + 3278, 500, // tcx -> Taml + 3282, 245, // tcy -> Knda + 3286, 520, // tda -> Tfng + 3290, 105, // tdb -> Deva + 3294, 490, // tdd -> Tale + 3298, 105, // tdg -> Deva + 3302, 105, // tdh -> Deva + 3306, 515, // te -> Telu + 3309, 205, // tes -> Java + 3313, 100, // tg -> Cyrl + 3316, 10, // tg_PK -> Arab + 3322, 105, // tge -> Deva + 3326, 535, // tgf -> Tibt + 3330, 530, // th -> Thai + 3333, 105, // the -> Deva + 3337, 105, // thf -> Deva + 3341, 490, // thi -> Tale + 3345, 105, // thl -> Deva + 3349, 530, // thm -> Thai + 3353, 105, // thq -> Deva + 3357, 105, // thr -> Deva + 3361, 105, // ths -> Deva + 3365, 120, // ti -> Ethi + 3368, 120, // tig -> Ethi + 3372, 105, // tij -> Deva + 3376, 100, // tin -> Cyrl + 3380, 345, // tjl -> Mymr + 3384, 10, // tjo -> Arab + 3388, 105, // tkb -> Deva + 3392, 10, // tks -> Arab + 3396, 105, // tkt -> Deva + 3400, 105, // tmk -> Deva + 3404, 475, // tmr -> Syrc + 3408, 60, // tnv -> Cakm + 3412, 10, // tov -> Arab + 3416, 235, // tpu -> Khmr + 3420, 10, // tra -> Arab + 3424, 185, // trg -> Hebr + 3428, 10, // trm -> Arab + 3432, 10, // trw -> Arab + 3436, 150, // tsd -> Grek + 3440, 535, // tsj -> Tibt + 3444, 100, // tt -> Cyrl + 3447, 260, // tth -> Laoo + 3451, 260, // tto -> Laoo + 3455, 530, // tts -> Thai + 3459, 345, // tvn -> Mymr + 3463, 105, // twm -> Deva + 3467, 505, // txg -> Tang + 3471, 545, // txo -> Toto + 3475, 510, // tyr -> Tavt + 3479, 100, // tyv -> Cyrl + 3483, 100, // ude -> Cyrl + 3487, 320, // udg -> Mlym + 3491, 0, // udi -> Aghb + 3495, 100, // udm -> Cyrl + 3499, 10, // ug -> Arab + 3502, 100, // ug_KZ -> Cyrl + 3508, 100, // ug_MN -> Cyrl + 3514, 550, // uga -> Ugar + 3518, 100, // ugh -> Cyrl + 3522, 530, // ugo -> Thai + 3526, 100, // uk -> Cyrl + 3529, 385, // uki -> Orya + 3533, 100, // ulc -> Cyrl + 3537, 45, // unr -> Beng + 3541, 105, // unr_NP -> Deva + 3548, 45, // unx -> Beng + 3552, 10, // ur -> Arab + 3555, 530, // urk -> Thai + 3559, 10, // ush -> Arab + 3563, 150, // uum -> Grek + 3567, 10, // uz_AF -> Arab + 3573, 100, // uz_CN -> Cyrl + 3579, 10, // uzs -> Arab + 3583, 500, // vaa -> Taml + 3587, 10, // vaf -> Arab + 3591, 105, // vah -> Deva + 3595, 555, // vai -> Vaii + 3599, 105, // vas -> Deva + 3603, 105, // vav -> Deva + 3607, 105, // vay -> Deva + 3611, 10, // vgr -> Arab + 3615, 245, // vmd -> Knda + 3619, 10, // vmh -> Arab + 3623, 120, // wal -> Ethi + 3627, 10, // wbk -> Arab + 3631, 515, // wbq -> Telu + 3635, 105, // wbr -> Deva + 3639, 10, // wlo -> Arab + 3643, 105, // wme -> Deva + 3647, 10, // wne -> Arab + 3651, 10, // wni -> Arab + 3655, 130, // wsg -> Gong + 3659, 10, // wsv -> Arab + 3663, 105, // wtm -> Deva + 3667, 175, // wuu -> Hans + 3671, 100, // xal -> Cyrl + 3675, 120, // xan -> Ethi + 3679, 100, // xas -> Cyrl + 3683, 85, // xco -> Chrs + 3687, 70, // xcr -> Cari + 3691, 100, // xdq -> Cyrl + 3695, 10, // xhe -> Arab + 3699, 235, // xhm -> Khmr + 3703, 385, // xis -> Orya + 3707, 10, // xka -> Arab + 3711, 10, // xkc -> Arab + 3715, 10, // xkj -> Arab + 3719, 10, // xkp -> Arab + 3723, 285, // xlc -> Lyci + 3727, 290, // xld -> Lydi + 3731, 115, // xly -> Elym + 3735, 125, // xmf -> Geor + 3739, 300, // xmn -> Mani + 3743, 315, // xmr -> Merc + 3747, 350, // xna -> Narb + 3751, 105, // xnr -> Deva + 3755, 150, // xpg -> Grek + 3759, 370, // xpi -> Ogam + 3763, 100, // xpm -> Cyrl + 3767, 415, // xpr -> Prti + 3771, 100, // xrm -> Cyrl + 3775, 100, // xrn -> Cyrl + 3779, 440, // xsa -> Sarb + 3783, 105, // xsr -> Deva + 3787, 100, // xss -> Cyrl + 3791, 500, // xub -> Taml + 3795, 500, // xuj -> Taml + 3799, 200, // xve -> Ital + 3803, 10, // xvi -> Arab + 3807, 100, // xwo -> Cyrl + 3811, 305, // xzh -> Marc + 3815, 100, // yai -> Cyrl + 3819, 105, // ybh -> Deva + 3823, 105, // ybi -> Deva + 3827, 10, // ydg -> Arab + 3831, 320, // yea -> Mlym + 3835, 150, // yej -> Grek + 3839, 515, // yeu -> Telu + 3843, 410, // ygp -> Plrd + 3847, 185, // yhd -> Hebr + 3851, 185, // yi -> Hebr + 3854, 575, // yig -> Yiii + 3858, 185, // yih -> Hebr + 3862, 575, // yiv -> Yiii + 3866, 100, // ykg -> Cyrl + 3870, 410, // yna -> Plrd + 3874, 100, // ynk -> Cyrl + 3878, 210, // yoi -> Jpan + 3882, 530, // yoy -> Thai + 3886, 100, // yrk -> Cyrl + 3890, 575, // ysd -> Yiii + 3894, 575, // ysn -> Yiii + 3898, 575, // ysp -> Yiii + 3902, 100, // ysr -> Cyrl + 3906, 410, // ysy -> Plrd + 3910, 185, // yud -> Hebr + 3914, 180, // yue -> Hant + 3918, 175, // yue_CN -> Hans + 3925, 100, // yug -> Cyrl + 3929, 100, // yux -> Cyrl + 3933, 410, // ywq -> Plrd + 3937, 410, // ywu -> Plrd + 3941, 535, // zau -> Tibt + 3945, 10, // zba -> Arab + 3949, 170, // zch -> Hani + 3953, 10, // zdj -> Arab + 3957, 170, // zeh -> Hani + 3961, 520, // zen -> Tfng + 3965, 170, // zgb -> Hani + 3969, 520, // zgh -> Tfng + 3973, 170, // zgm -> Hani + 3977, 170, // zgn -> Hani + 3981, 175, // zh -> Hans + 3984, 180, // zh_AU -> Hant + 3990, 180, // zh_BN -> Hant + 3996, 180, // zh_GB -> Hant + 4002, 180, // zh_GF -> Hant + 4008, 180, // zh_HK -> Hant + 4014, 180, // zh_ID -> Hant + 4020, 180, // zh_MO -> Hant + 4026, 180, // zh_PA -> Hant + 4032, 180, // zh_PF -> Hant + 4038, 180, // zh_PH -> Hant + 4044, 180, // zh_SR -> Hant + 4050, 180, // zh_TH -> Hant + 4056, 180, // zh_TW -> Hant + 4062, 180, // zh_US -> Hant + 4068, 180, // zh_VN -> Hant + 4074, 170, // zhd -> Hani + 4078, 365, // zhx -> Nshu + 4082, 100, // zkb -> Cyrl + 4086, 100, // zko -> Cyrl + 4090, 240, // zkt -> Kits + 4094, 100, // zkz -> Cyrl + 4098, 170, // zlj -> Hani + 4102, 170, // zln -> Hani + 4106, 170, // zlq -> Hani + 4110, 170, // zqe -> Hani + 4114, 185, // zrp -> Hebr + 4118, 10, // zum -> Arab + 4122, 170, // zyg -> Hani + 4126, 170, // zyn -> Hani + 4130, 170, // zzj -> Hani +}; + +//====================================================================== +// Parent locale table +const char parentLocaleChars[] = + "az_Arab\0az_Cyrl\0bal_Latn\0blt_Latn\0bm_Nkoo\0bs_Cyrl\0byn_Latn\0" + "cu_Glag\0dje_Arab\0dyo_Arab\0en_001\0en_150\0en_AG\0en_AI\0en_AT\0" + "en_AU\0en_BB\0en_BE\0en_BM\0en_BS\0en_BW\0en_BZ\0en_CC\0en_CH\0" + "en_CK\0en_CM\0en_CX\0en_CY\0en_DE\0en_DG\0en_DK\0en_DM\0en_Dsrt\0" + "en_ER\0en_FI\0en_FJ\0en_FK\0en_FM\0en_GB\0en_GD\0en_GG\0en_GH\0" + "en_GI\0en_GM\0en_GY\0en_HK\0en_ID\0en_IE\0en_IL\0en_IM\0en_IN\0" + "en_IO\0en_JE\0en_JM\0en_KE\0en_KI\0en_KN\0en_KY\0en_LC\0en_LR\0" + "en_LS\0en_MG\0en_MO\0en_MS\0en_MT\0en_MU\0en_MV\0en_MW\0en_MY\0" + "en_NA\0en_NF\0en_NG\0en_NL\0en_NR\0en_NU\0en_NZ\0en_PG\0en_PK\0" + "en_PN\0en_PW\0en_RW\0en_SB\0en_SC\0en_SD\0en_SE\0en_SG\0en_SH\0" + "en_SI\0en_SL\0en_SS\0en_SX\0en_SZ\0en_Shaw\0en_TC\0en_TK\0en_TO\0" + "en_TT\0en_TV\0en_TZ\0en_UG\0en_VC\0en_VG\0en_VU\0en_WS\0en_ZA\0" + "en_ZM\0en_ZW\0es_419\0es_AR\0es_BO\0es_BR\0es_BZ\0es_CL\0es_CO\0" + "es_CR\0es_CU\0es_DO\0es_EC\0es_GT\0es_HN\0es_JP\0es_MX\0es_NI\0" + "es_PA\0es_PE\0es_PR\0es_PY\0es_SV\0es_US\0es_UY\0es_VE\0ff_Adlm\0" + "ff_Arab\0fr_HT\0ha_Arab\0hi_Latn\0ht\0iu_Latn\0kk_Arab\0ks_Deva\0" + "ku_Arab\0kxv_Deva\0kxv_Orya\0kxv_Telu\0ky_Arab\0ky_Latn\0ml_Arab\0" + "mn_Mong\0mni_Mtei\0ms_Arab\0nb\0nn\0no\0no_NO\0pa_Arab\0pt_AO\0" + "pt_CH\0pt_CV\0pt_FR\0pt_GQ\0pt_GW\0pt_LU\0pt_MO\0pt_MZ\0pt_PT\0" + "pt_ST\0pt_TL\0root\0sat_Deva\0sd_Deva\0sd_Khoj\0sd_Sind\0shi_Latn\0" + "so_Arab\0sr_Latn\0sw_Arab\0tg_Arab\0ug_Cyrl\0uz_Arab\0uz_Cyrl\0" + "vai_Latn\0wo_Arab\0yo_Arab\0yue_Hans\0zh_Hant\0zh_Hant_HK\0zh_Hant_MO\0" + ""; + +const int32_t parentLocaleTable[] = { + 0, 1062, // az_Arab -> root + 8, 1062, // az_Cyrl -> root + 16, 1062, // bal_Latn -> root + 25, 1062, // blt_Latn -> root + 34, 1062, // bm_Nkoo -> root + 42, 1062, // bs_Cyrl -> root + 50, 1062, // byn_Latn -> root + 59, 1062, // cu_Glag -> root + 67, 1062, // dje_Arab -> root + 76, 1062, // dyo_Arab -> root + 92, 85, // en_150 -> en_001 + 99, 85, // en_AG -> en_001 + 105, 85, // en_AI -> en_001 + 111, 92, // en_AT -> en_150 + 117, 85, // en_AU -> en_001 + 123, 85, // en_BB -> en_001 + 129, 92, // en_BE -> en_150 + 135, 85, // en_BM -> en_001 + 141, 85, // en_BS -> en_001 + 147, 85, // en_BW -> en_001 + 153, 85, // en_BZ -> en_001 + 159, 85, // en_CC -> en_001 + 165, 92, // en_CH -> en_150 + 171, 85, // en_CK -> en_001 + 177, 85, // en_CM -> en_001 + 183, 85, // en_CX -> en_001 + 189, 85, // en_CY -> en_001 + 195, 92, // en_DE -> en_150 + 201, 85, // en_DG -> en_001 + 207, 92, // en_DK -> en_150 + 213, 85, // en_DM -> en_001 + 219, 1062, // en_Dsrt -> root + 227, 85, // en_ER -> en_001 + 233, 92, // en_FI -> en_150 + 239, 85, // en_FJ -> en_001 + 245, 85, // en_FK -> en_001 + 251, 85, // en_FM -> en_001 + 257, 85, // en_GB -> en_001 + 263, 85, // en_GD -> en_001 + 269, 85, // en_GG -> en_001 + 275, 85, // en_GH -> en_001 + 281, 85, // en_GI -> en_001 + 287, 85, // en_GM -> en_001 + 293, 85, // en_GY -> en_001 + 299, 85, // en_HK -> en_001 + 305, 85, // en_ID -> en_001 + 311, 85, // en_IE -> en_001 + 317, 85, // en_IL -> en_001 + 323, 85, // en_IM -> en_001 + 329, 85, // en_IN -> en_001 + 335, 85, // en_IO -> en_001 + 341, 85, // en_JE -> en_001 + 347, 85, // en_JM -> en_001 + 353, 85, // en_KE -> en_001 + 359, 85, // en_KI -> en_001 + 365, 85, // en_KN -> en_001 + 371, 85, // en_KY -> en_001 + 377, 85, // en_LC -> en_001 + 383, 85, // en_LR -> en_001 + 389, 85, // en_LS -> en_001 + 395, 85, // en_MG -> en_001 + 401, 85, // en_MO -> en_001 + 407, 85, // en_MS -> en_001 + 413, 85, // en_MT -> en_001 + 419, 85, // en_MU -> en_001 + 425, 85, // en_MV -> en_001 + 431, 85, // en_MW -> en_001 + 437, 85, // en_MY -> en_001 + 443, 85, // en_NA -> en_001 + 449, 85, // en_NF -> en_001 + 455, 85, // en_NG -> en_001 + 461, 92, // en_NL -> en_150 + 467, 85, // en_NR -> en_001 + 473, 85, // en_NU -> en_001 + 479, 85, // en_NZ -> en_001 + 485, 85, // en_PG -> en_001 + 491, 85, // en_PK -> en_001 + 497, 85, // en_PN -> en_001 + 503, 85, // en_PW -> en_001 + 509, 85, // en_RW -> en_001 + 515, 85, // en_SB -> en_001 + 521, 85, // en_SC -> en_001 + 527, 85, // en_SD -> en_001 + 533, 92, // en_SE -> en_150 + 539, 85, // en_SG -> en_001 + 545, 85, // en_SH -> en_001 + 551, 92, // en_SI -> en_150 + 557, 85, // en_SL -> en_001 + 563, 85, // en_SS -> en_001 + 569, 85, // en_SX -> en_001 + 575, 85, // en_SZ -> en_001 + 581, 1062, // en_Shaw -> root + 589, 85, // en_TC -> en_001 + 595, 85, // en_TK -> en_001 + 601, 85, // en_TO -> en_001 + 607, 85, // en_TT -> en_001 + 613, 85, // en_TV -> en_001 + 619, 85, // en_TZ -> en_001 + 625, 85, // en_UG -> en_001 + 631, 85, // en_VC -> en_001 + 637, 85, // en_VG -> en_001 + 643, 85, // en_VU -> en_001 + 649, 85, // en_WS -> en_001 + 655, 85, // en_ZA -> en_001 + 661, 85, // en_ZM -> en_001 + 667, 85, // en_ZW -> en_001 + 680, 673, // es_AR -> es_419 + 686, 673, // es_BO -> es_419 + 692, 673, // es_BR -> es_419 + 698, 673, // es_BZ -> es_419 + 704, 673, // es_CL -> es_419 + 710, 673, // es_CO -> es_419 + 716, 673, // es_CR -> es_419 + 722, 673, // es_CU -> es_419 + 728, 673, // es_DO -> es_419 + 734, 673, // es_EC -> es_419 + 740, 673, // es_GT -> es_419 + 746, 673, // es_HN -> es_419 + 752, 673, // es_JP -> es_419 + 758, 673, // es_MX -> es_419 + 764, 673, // es_NI -> es_419 + 770, 673, // es_PA -> es_419 + 776, 673, // es_PE -> es_419 + 782, 673, // es_PR -> es_419 + 788, 673, // es_PY -> es_419 + 794, 673, // es_SV -> es_419 + 800, 673, // es_US -> es_419 + 806, 673, // es_UY -> es_419 + 812, 673, // es_VE -> es_419 + 818, 1062, // ff_Adlm -> root + 826, 1062, // ff_Arab -> root + 840, 1062, // ha_Arab -> root + 848, 329, // hi_Latn -> en_IN + 856, 834, // ht -> fr_HT + 859, 1062, // iu_Latn -> root + 867, 1062, // kk_Arab -> root + 875, 1062, // ks_Deva -> root + 883, 1062, // ku_Arab -> root + 891, 1062, // kxv_Deva -> root + 900, 1062, // kxv_Orya -> root + 909, 1062, // kxv_Telu -> root + 918, 1062, // ky_Arab -> root + 926, 1062, // ky_Latn -> root + 934, 1062, // ml_Arab -> root + 942, 1062, // mn_Mong -> root + 950, 1062, // mni_Mtei -> root + 959, 1062, // ms_Arab -> root + 967, 973, // nb -> no + 970, 973, // nn -> no + 976, 973, // no_NO -> no + 982, 1062, // pa_Arab -> root + 990, 1044, // pt_AO -> pt_PT + 996, 1044, // pt_CH -> pt_PT + 1002, 1044, // pt_CV -> pt_PT + 1008, 1044, // pt_FR -> pt_PT + 1014, 1044, // pt_GQ -> pt_PT + 1020, 1044, // pt_GW -> pt_PT + 1026, 1044, // pt_LU -> pt_PT + 1032, 1044, // pt_MO -> pt_PT + 1038, 1044, // pt_MZ -> pt_PT + 1050, 1044, // pt_ST -> pt_PT + 1056, 1044, // pt_TL -> pt_PT + 1067, 1062, // sat_Deva -> root + 1076, 1062, // sd_Deva -> root + 1084, 1062, // sd_Khoj -> root + 1092, 1062, // sd_Sind -> root + 1100, 1062, // shi_Latn -> root + 1109, 1062, // so_Arab -> root + 1117, 1062, // sr_Latn -> root + 1125, 1062, // sw_Arab -> root + 1133, 1062, // tg_Arab -> root + 1141, 1062, // ug_Cyrl -> root + 1149, 1062, // uz_Arab -> root + 1157, 1062, // uz_Cyrl -> root + 1165, 1062, // vai_Latn -> root + 1174, 1062, // wo_Arab -> root + 1182, 1062, // yo_Arab -> root + 1190, 1062, // yue_Hans -> root + 1199, 1062, // zh_Hant -> root + 1218, 1207, // zh_Hant_MO -> zh_Hant_HK +}; + + +#endif // INCLUDED_FROM_URESBUND_CPP diff --git a/src/duckdb/extension/icu/third_party/icu/common/localematcher.cpp b/src/duckdb/extension/icu/third_party/icu/common/localematcher.cpp index d975fe759..6fc578af1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/localematcher.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/localematcher.cpp @@ -1,17 +1,15 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localematcher.cpp // created: 2019may08 Markus W. Scherer -#ifndef __LOCMATCHER_H__ -#define __LOCMATCHER_H__ - #include "unicode/utypes.h" #include "unicode/localebuilder.h" #include "unicode/localematcher.h" #include "unicode/locid.h" #include "unicode/stringpiece.h" +#include "unicode/uloc.h" #include "unicode/uobject.h" #include "cstring.h" #include "localeprioritylist.h" @@ -20,9 +18,10 @@ #include "lsr.h" #include "uassert.h" #include "uhash.h" +#include "ustr_imp.h" #include "uvector.h" -#define UND_LSR LSR("und", "", "") +#define UND_LSR LSR("und", "", "", LSR::EXPLICIT_LSR) /** * Indicator for the lifetime of desired-locale objects passed into the LocaleMatcher. @@ -52,7 +51,7 @@ typedef enum ULocMatchLifetime ULocMatchLifetime; U_NAMESPACE_BEGIN -LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) U_NOEXCEPT : +LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) noexcept : desiredLocale(src.desiredLocale), supportedLocale(src.supportedLocale), desiredIndex(src.desiredIndex), @@ -61,7 +60,7 @@ LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) U_NOEXCEPT : if (desiredIsOwned) { src.desiredLocale = nullptr; src.desiredIndex = -1; - src.desiredIsOwned = FALSE; + src.desiredIsOwned = false; } } @@ -71,7 +70,7 @@ LocaleMatcher::Result::~Result() { } } -LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result &&src) U_NOEXCEPT { +LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result &&src) noexcept { this->~Result(); desiredLocale = src.desiredLocale; @@ -83,7 +82,7 @@ LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result && if (desiredIsOwned) { src.desiredLocale = nullptr; src.desiredIndex = -1; - src.desiredIsOwned = FALSE; + src.desiredIsOwned = false; } return *this; } @@ -123,13 +122,15 @@ Locale LocaleMatcher::Result::makeResolvedLocale(UErrorCode &errorCode) const { return b.build(errorCode); } -LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT : +LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) noexcept : errorCode_(src.errorCode_), supportedLocales_(src.supportedLocales_), thresholdDistance_(src.thresholdDistance_), demotion_(src.demotion_), defaultLocale_(src.defaultLocale_), - favor_(src.favor_) { + withDefault_(src.withDefault_), + favor_(src.favor_), + direction_(src.direction_) { src.supportedLocales_ = nullptr; src.defaultLocale_ = nullptr; } @@ -137,9 +138,11 @@ LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT : LocaleMatcher::Builder::~Builder() { delete supportedLocales_; delete defaultLocale_; + delete maxDistanceDesired_; + delete maxDistanceSupported_; } -LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) U_NOEXCEPT { +LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) noexcept { this->~Builder(); errorCode_ = src.errorCode_; @@ -147,7 +150,9 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder thresholdDistance_ = src.thresholdDistance_; demotion_ = src.demotion_; defaultLocale_ = src.defaultLocale_; + withDefault_ = src.withDefault_, favor_ = src.favor_; + direction_ = src.direction_; src.supportedLocales_ = nullptr; src.defaultLocale_ = nullptr; @@ -163,12 +168,9 @@ void LocaleMatcher::Builder::clearSupportedLocales() { bool LocaleMatcher::Builder::ensureSupportedLocaleVector() { if (U_FAILURE(errorCode_)) { return false; } if (supportedLocales_ != nullptr) { return true; } - supportedLocales_ = new UVector(uprv_deleteUObject, nullptr, errorCode_); + LocalPointer lpSupportedLocales(new UVector(uprv_deleteUObject, nullptr, errorCode_), errorCode_); if (U_FAILURE(errorCode_)) { return false; } - if (supportedLocales_ == nullptr) { - errorCode_ = U_MEMORY_ALLOCATION_ERROR; - return false; - } + supportedLocales_ = lpSupportedLocales.orphan(); return true; } @@ -182,9 +184,8 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocalesFromListStrin for (int32_t i = 0; i < length; ++i) { Locale *locale = list.orphanLocaleAt(i); if (locale == nullptr) { continue; } - supportedLocales_->addElement(locale, errorCode_); + supportedLocales_->adoptElement(locale, errorCode_); if (U_FAILURE(errorCode_)) { - delete locale; break; } } @@ -192,39 +193,33 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocalesFromListStrin } LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocales(Locale::Iterator &locales) { - if (U_FAILURE(errorCode_)) { return *this; } - clearSupportedLocales(); - if (!ensureSupportedLocaleVector()) { return *this; } - while (locales.hasNext()) { - const Locale &locale = locales.next(); - Locale *clone = locale.clone(); - if (clone == nullptr) { - errorCode_ = U_MEMORY_ALLOCATION_ERROR; - break; - } - supportedLocales_->addElement(clone, errorCode_); - if (U_FAILURE(errorCode_)) { - delete clone; - break; + if (ensureSupportedLocaleVector()) { + clearSupportedLocales(); + while (locales.hasNext() && U_SUCCESS(errorCode_)) { + const Locale &locale = locales.next(); + LocalPointer clone (locale.clone(), errorCode_); + supportedLocales_->adoptElement(clone.orphan(), errorCode_); } } return *this; } LocaleMatcher::Builder &LocaleMatcher::Builder::addSupportedLocale(const Locale &locale) { - if (!ensureSupportedLocaleVector()) { return *this; } - Locale *clone = locale.clone(); - if (clone == nullptr) { - errorCode_ = U_MEMORY_ALLOCATION_ERROR; - return *this; - } - supportedLocales_->addElement(clone, errorCode_); - if (U_FAILURE(errorCode_)) { - delete clone; + if (ensureSupportedLocaleVector()) { + LocalPointer clone(locale.clone(), errorCode_); + supportedLocales_->adoptElement(clone.orphan(), errorCode_); } return *this; } +LocaleMatcher::Builder &LocaleMatcher::Builder::setNoDefaultLocale() { + if (U_FAILURE(errorCode_)) { return *this; } + delete defaultLocale_; + defaultLocale_ = nullptr; + withDefault_ = false; + return *this; +} + LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *defaultLocale) { if (U_FAILURE(errorCode_)) { return *this; } Locale *clone = nullptr; @@ -237,6 +232,7 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *d } delete defaultLocale_; defaultLocale_ = clone; + withDefault_ = true; return *this; } @@ -252,6 +248,24 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULoc return *this; } +LocaleMatcher::Builder &LocaleMatcher::Builder::setMaxDistance(const Locale &desired, + const Locale &supported) { + if (U_FAILURE(errorCode_)) { return *this; } + Locale *desiredClone = desired.clone(); + Locale *supportedClone = supported.clone(); + if (desiredClone == nullptr || supportedClone == nullptr) { + delete desiredClone; // in case only one could not be allocated + delete supportedClone; + errorCode_ = U_MEMORY_ALLOCATION_ERROR; + return *this; + } + delete maxDistanceDesired_; + delete maxDistanceSupported_; + maxDistanceDesired_ = desiredClone; + maxDistanceSupported_ = supportedClone; + return *this; +} + #if 0 /** * Internal only! @@ -273,10 +287,10 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::internalSetThresholdDistance(int #endif UBool LocaleMatcher::Builder::copyErrorTo(UErrorCode &outErrorCode) const { - if (U_FAILURE(outErrorCode)) { return TRUE; } - if (U_SUCCESS(errorCode_)) { return FALSE; } + if (U_FAILURE(outErrorCode)) { return true; } + if (U_SUCCESS(errorCode_)) { return false; } outErrorCode = errorCode_; - return TRUE; + return true; } LocaleMatcher LocaleMatcher::Builder::build(UErrorCode &errorCode) const { @@ -293,7 +307,7 @@ LSR getMaximalLsrOrUnd(const XLikelySubtags &likelySubtags, const Locale &locale if (U_FAILURE(errorCode) || locale.isBogus() || *locale.getName() == 0 /* "und" */) { return UND_LSR; } else { - return likelySubtags.makeMaximizedLsrFrom(locale, errorCode); + return likelySubtags.makeMaximizedLsrFrom(locale, false, errorCode); } } @@ -308,38 +322,49 @@ UBool compareLSRs(const UHashTok t1, const UHashTok t2) { return *lsr1 == *lsr2; } -bool putIfAbsent(UHashtable *lsrToIndex, const LSR &lsr, int32_t i, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return false; } - U_ASSERT(i > 0); - int32_t index = uhash_geti(lsrToIndex, &lsr); - if (index != 0) { - return false; - } else { - uhash_puti(lsrToIndex, const_cast(&lsr), i, &errorCode); - return U_SUCCESS(errorCode); +} // namespace + +int32_t LocaleMatcher::putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength, + UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return suppLength; } + if (!uhash_containsKey(supportedLsrToIndex, &lsr)) { + uhash_putiAllowZero(supportedLsrToIndex, const_cast(&lsr), i, &errorCode); + if (U_SUCCESS(errorCode)) { + supportedLSRs[suppLength] = &lsr; + supportedIndexes[suppLength++] = i; + } } + return suppLength; } -} // namespace - LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) : likelySubtags(*XLikelySubtags::getSingleton(errorCode)), localeDistance(*LocaleDistance::getSingleton(errorCode)), thresholdDistance(builder.thresholdDistance_), demotionPerDesiredLocale(0), favorSubtag(builder.favor_), + direction(builder.direction_), supportedLocales(nullptr), lsrs(nullptr), supportedLocalesLength(0), supportedLsrToIndex(nullptr), supportedLSRs(nullptr), supportedIndexes(nullptr), supportedLSRsLength(0), - ownedDefaultLocale(nullptr), defaultLocale(nullptr), defaultLocaleIndex(-1) { + ownedDefaultLocale(nullptr), defaultLocale(nullptr) { if (U_FAILURE(errorCode)) { return; } - if (thresholdDistance < 0) { - thresholdDistance = localeDistance.getDefaultScriptDistance(); + const Locale *def = builder.defaultLocale_; + LSR builderDefaultLSR; + const LSR *defLSR = nullptr; + if (def != nullptr) { + ownedDefaultLocale = def->clone(); + if (ownedDefaultLocale == nullptr) { + errorCode = U_MEMORY_ALLOCATION_ERROR; + return; + } + def = ownedDefaultLocale; + builderDefaultLSR = getMaximalLsrOrUnd(likelySubtags, *def, errorCode); + if (U_FAILURE(errorCode)) { return; } + defLSR = &builderDefaultLSR; } supportedLocalesLength = builder.supportedLocales_ != nullptr ? builder.supportedLocales_->size() : 0; - const Locale *def = builder.defaultLocale_; - int32_t idef = -1; if (supportedLocalesLength > 0) { // Store the supported locales in input order, // so that when different types are used (e.g., language tag strings) @@ -356,15 +381,6 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) : } // If the constructor fails partway, we need null pointers for destructibility. uprv_memset(supportedLocales, 0, supportedLocalesLength * sizeof(const Locale *)); - // Also find the first supported locale whose LSR is - // the same as that for the default locale. - LSR builderDefaultLSR; - const LSR *defLSR = nullptr; - if (def != nullptr) { - builderDefaultLSR = getMaximalLsrOrUnd(likelySubtags, *def, errorCode); - if (U_FAILURE(errorCode)) { return; } - defLSR = &builderDefaultLSR; - } for (int32_t i = 0; i < supportedLocalesLength; ++i) { const Locale &locale = *static_cast(builder.supportedLocales_->elementAt(i)); supportedLocales[i] = locale.clone(); @@ -376,123 +392,111 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) : LSR &lsr = lsrs[i] = getMaximalLsrOrUnd(likelySubtags, supportedLocale, errorCode); lsr.setHashCode(); if (U_FAILURE(errorCode)) { return; } - if (idef < 0 && defLSR != nullptr && lsr == *defLSR) { - idef = i; - defLSR = &lsr; // owned pointer to put into supportedLsrToIndex - if (*def == supportedLocale) { - def = &supportedLocale; // owned pointer to keep - } - } } // We need an unordered map from LSR to first supported locale with that LSR, - // and an ordered list of (LSR, supported index). - // We insert the supported locales in the following order: + // and an ordered list of (LSR, supported index) for + // the supported locales in the following order: // 1. Default locale, if it is supported. // 2. Priority locales (aka "paradigm locales") in builder order. // 3. Remaining locales in builder order. - // In Java, we use a LinkedHashMap for both map & ordered lists. - // In C++, we use separate structures. - // We over-allocate arrays of LSRs and indexes for simplicity. - // We reserve slots at the array starts for the default and paradigm locales, - // plus enough for all supported locales. - // If there are few paradigm locales and few duplicate supported LSRs, - // then the amount of wasted space is small. supportedLsrToIndex = uhash_openSize(hashLSR, compareLSRs, uhash_compareLong, supportedLocalesLength, &errorCode); if (U_FAILURE(errorCode)) { return; } - int32_t paradigmLimit = 1 + localeDistance.getParadigmLSRsLength(); - int32_t suppLSRsCapacity = paradigmLimit + supportedLocalesLength; supportedLSRs = static_cast( - uprv_malloc(suppLSRsCapacity * sizeof(const LSR *))); + uprv_malloc(supportedLocalesLength * sizeof(const LSR *))); supportedIndexes = static_cast( - uprv_malloc(suppLSRsCapacity * sizeof(int32_t))); + uprv_malloc(supportedLocalesLength * sizeof(int32_t))); if (supportedLSRs == nullptr || supportedIndexes == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } - int32_t paradigmIndex = 0; - int32_t otherIndex = paradigmLimit; - if (idef >= 0) { - uhash_puti(supportedLsrToIndex, const_cast(defLSR), idef + 1, &errorCode); - supportedLSRs[0] = defLSR; - supportedIndexes[0] = idef; - paradigmIndex = 1; - } + int32_t suppLength = 0; + // Determine insertion order. + // Add locales immediately that are equivalent to the default. + MaybeStackArray order(supportedLocalesLength, errorCode); + if (U_FAILURE(errorCode)) { return; } + int32_t numParadigms = 0; for (int32_t i = 0; i < supportedLocalesLength; ++i) { - if (i == idef) { continue; } const Locale &locale = *supportedLocales[i]; const LSR &lsr = lsrs[i]; - if (defLSR == nullptr) { + if (defLSR == nullptr && builder.withDefault_) { + // Implicit default locale = first supported locale, if not turned off. U_ASSERT(i == 0); def = &locale; defLSR = &lsr; - idef = 0; - uhash_puti(supportedLsrToIndex, const_cast(&lsr), 0 + 1, &errorCode); - supportedLSRs[0] = &lsr; - supportedIndexes[0] = 0; - paradigmIndex = 1; - } else if (idef >= 0 && lsr == *defLSR) { - // lsr == *defLSR means that this supported locale is - // a duplicate of the default locale. - // Either an explicit default locale is supported, and we added it before the loop, - // or there is no explicit default locale, and this is - // a duplicate of the first supported locale. - // In both cases, idef >= 0 now, so otherwise we can skip the comparison. - // For a duplicate, putIfAbsent() is a no-op, so nothing to do. + order[i] = 1; + suppLength = putIfAbsent(lsr, 0, suppLength, errorCode); + } else if (defLSR != nullptr && lsr.isEquivalentTo(*defLSR)) { + order[i] = 1; + suppLength = putIfAbsent(lsr, i, suppLength, errorCode); + } else if (localeDistance.isParadigmLSR(lsr)) { + order[i] = 2; + ++numParadigms; } else { - if (putIfAbsent(supportedLsrToIndex, lsr, i + 1, errorCode)) { - if (localeDistance.isParadigmLSR(lsr)) { - supportedLSRs[paradigmIndex] = &lsr; - supportedIndexes[paradigmIndex++] = i; - } else { - supportedLSRs[otherIndex] = &lsr; - supportedIndexes[otherIndex++] = i; - } - } + order[i] = 3; } if (U_FAILURE(errorCode)) { return; } } - // Squeeze out unused array slots. - if (paradigmIndex < paradigmLimit && paradigmLimit < otherIndex) { - uprv_memmove(supportedLSRs + paradigmIndex, supportedLSRs + paradigmLimit, - (otherIndex - paradigmLimit) * sizeof(const LSR *)); - uprv_memmove(supportedIndexes + paradigmIndex, supportedIndexes + paradigmLimit, - (otherIndex - paradigmLimit) * sizeof(int32_t)); + // Add supported paradigm locales. + int32_t paradigmLimit = suppLength + numParadigms; + for (int32_t i = 0; i < supportedLocalesLength && suppLength < paradigmLimit; ++i) { + if (order[i] == 2) { + suppLength = putIfAbsent(lsrs[i], i, suppLength, errorCode); + } } - supportedLSRsLength = otherIndex - (paradigmLimit - paradigmIndex); - } - - if (def != nullptr && (idef < 0 || def != supportedLocales[idef])) { - ownedDefaultLocale = def->clone(); - if (ownedDefaultLocale == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return; + // Add remaining supported locales. + for (int32_t i = 0; i < supportedLocalesLength; ++i) { + if (order[i] == 3) { + suppLength = putIfAbsent(lsrs[i], i, suppLength, errorCode); + } } - def = ownedDefaultLocale; + supportedLSRsLength = suppLength; + // If supportedLSRsLength < supportedLocalesLength then + // we waste as many array slots as there are duplicate supported LSRs, + // but the amount of wasted space is small as long as there are few duplicates. } + defaultLocale = def; - defaultLocaleIndex = idef; if (builder.demotion_ == ULOCMATCH_DEMOTION_REGION) { demotionPerDesiredLocale = localeDistance.getDefaultDemotionPerDesiredLocale(); } + + if (thresholdDistance >= 0) { + // already copied + } else if (builder.maxDistanceDesired_ != nullptr) { + LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, *builder.maxDistanceSupported_, errorCode); + const LSR *pSuppLSR = &suppLSR; + int32_t indexAndDistance = localeDistance.getBestIndexAndDistance( + getMaximalLsrOrUnd(likelySubtags, *builder.maxDistanceDesired_, errorCode), + &pSuppLSR, 1, + LocaleDistance::shiftDistance(100), favorSubtag, direction); + if (U_SUCCESS(errorCode)) { + // +1 for an exclusive threshold from an inclusive max. + thresholdDistance = LocaleDistance::getDistanceFloor(indexAndDistance) + 1; + } else { + thresholdDistance = 0; + } + } else { + thresholdDistance = localeDistance.getDefaultScriptDistance(); + } } -LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT : +LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) noexcept : likelySubtags(src.likelySubtags), localeDistance(src.localeDistance), thresholdDistance(src.thresholdDistance), demotionPerDesiredLocale(src.demotionPerDesiredLocale), favorSubtag(src.favorSubtag), + direction(src.direction), supportedLocales(src.supportedLocales), lsrs(src.lsrs), supportedLocalesLength(src.supportedLocalesLength), supportedLsrToIndex(src.supportedLsrToIndex), supportedLSRs(src.supportedLSRs), supportedIndexes(src.supportedIndexes), supportedLSRsLength(src.supportedLSRsLength), - ownedDefaultLocale(src.ownedDefaultLocale), defaultLocale(src.defaultLocale), - defaultLocaleIndex(src.defaultLocaleIndex) { + ownedDefaultLocale(src.ownedDefaultLocale), defaultLocale(src.defaultLocale) { src.supportedLocales = nullptr; src.lsrs = nullptr; src.supportedLocalesLength = 0; @@ -502,7 +506,6 @@ LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT : src.supportedLSRsLength = 0; src.ownedDefaultLocale = nullptr; src.defaultLocale = nullptr; - src.defaultLocaleIndex = -1; } LocaleMatcher::~LocaleMatcher() { @@ -517,12 +520,13 @@ LocaleMatcher::~LocaleMatcher() { delete ownedDefaultLocale; } -LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) U_NOEXCEPT { +LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) noexcept { this->~LocaleMatcher(); thresholdDistance = src.thresholdDistance; demotionPerDesiredLocale = src.demotionPerDesiredLocale; favorSubtag = src.favorSubtag; + direction = src.direction; supportedLocales = src.supportedLocales; lsrs = src.lsrs; supportedLocalesLength = src.supportedLocalesLength; @@ -532,7 +536,6 @@ LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) U_NOEXCEPT { supportedLSRsLength = src.supportedLSRsLength; ownedDefaultLocale = src.ownedDefaultLocale; defaultLocale = src.defaultLocale; - defaultLocaleIndex = src.defaultLocaleIndex; src.supportedLocales = nullptr; src.lsrs = nullptr; @@ -543,7 +546,6 @@ LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) U_NOEXCEPT { src.supportedLSRsLength = 0; src.ownedDefaultLocale = nullptr; src.defaultLocale = nullptr; - src.defaultLocaleIndex = -1; return *this; } @@ -630,30 +632,30 @@ const Locale *LocaleMatcher::getBestMatchForListString( LocaleMatcher::Result LocaleMatcher::getBestMatchResult( const Locale &desiredLocale, UErrorCode &errorCode) const { if (U_FAILURE(errorCode)) { - return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE); + return Result(nullptr, defaultLocale, -1, -1, false); } int32_t suppIndex = getBestSuppIndex( getMaximalLsrOrUnd(likelySubtags, desiredLocale, errorCode), nullptr, errorCode); if (U_FAILURE(errorCode) || suppIndex < 0) { - return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE); + return Result(nullptr, defaultLocale, -1, -1, false); } else { - return Result(&desiredLocale, supportedLocales[suppIndex], 0, suppIndex, FALSE); + return Result(&desiredLocale, supportedLocales[suppIndex], 0, suppIndex, false); } } LocaleMatcher::Result LocaleMatcher::getBestMatchResult( Locale::Iterator &desiredLocales, UErrorCode &errorCode) const { if (U_FAILURE(errorCode) || !desiredLocales.hasNext()) { - return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE); + return Result(nullptr, defaultLocale, -1, -1, false); } LocaleLsrIterator lsrIter(likelySubtags, desiredLocales, ULOCMATCH_TEMPORARY_LOCALES); int32_t suppIndex = getBestSuppIndex(lsrIter.next(errorCode), &lsrIter, errorCode); if (U_FAILURE(errorCode) || suppIndex < 0) { - return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE); + return Result(nullptr, defaultLocale, -1, -1, false); } else { return Result(lsrIter.orphanRemembered(), supportedLocales[suppIndex], - lsrIter.getBestDesiredIndex(), suppIndex, TRUE); + lsrIter.getBestDesiredIndex(), suppIndex, true); } } @@ -662,14 +664,13 @@ int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remai if (U_FAILURE(errorCode)) { return -1; } int32_t desiredIndex = 0; int32_t bestSupportedLsrIndex = -1; - for (int32_t bestDistance = thresholdDistance;;) { + for (int32_t bestShiftedDistance = LocaleDistance::shiftDistance(thresholdDistance);;) { // Quick check for exact maximized LSR. - // Returns suppIndex+1 where 0 means not found. if (supportedLsrToIndex != nullptr) { desiredLSR.setHashCode(); - int32_t index = uhash_geti(supportedLsrToIndex, &desiredLSR); - if (index != 0) { - int32_t suppIndex = index - 1; + UBool found = false; + int32_t suppIndex = uhash_getiAndFound(supportedLsrToIndex, &desiredLSR, &found); + if (found) { if (remainingIter != nullptr) { remainingIter->rememberCurrent(desiredIndex, errorCode); } @@ -677,16 +678,17 @@ int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remai } } int32_t bestIndexAndDistance = localeDistance.getBestIndexAndDistance( - desiredLSR, supportedLSRs, supportedLSRsLength, bestDistance, favorSubtag); + desiredLSR, supportedLSRs, supportedLSRsLength, + bestShiftedDistance, favorSubtag, direction); if (bestIndexAndDistance >= 0) { - bestDistance = bestIndexAndDistance & 0xff; + bestShiftedDistance = LocaleDistance::getShiftedDistance(bestIndexAndDistance); if (remainingIter != nullptr) { remainingIter->rememberCurrent(desiredIndex, errorCode); if (U_FAILURE(errorCode)) { return -1; } } - bestSupportedLsrIndex = bestIndexAndDistance >= 0 ? bestIndexAndDistance >> 8 : -1; + bestSupportedLsrIndex = LocaleDistance::getIndex(bestIndexAndDistance); } - if ((bestDistance -= demotionPerDesiredLocale) <= 0) { + if ((bestShiftedDistance -= LocaleDistance::shiftDistance(demotionPerDesiredLocale)) <= 0) { break; } if (remainingIter == nullptr || !remainingIter->hasNext()) { @@ -703,18 +705,122 @@ int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remai return supportedIndexes[bestSupportedLsrIndex]; } +UBool LocaleMatcher::isMatch(const Locale &desired, const Locale &supported, + UErrorCode &errorCode) const { + LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, supported, errorCode); + if (U_FAILURE(errorCode)) { return 0; } + const LSR *pSuppLSR = &suppLSR; + int32_t indexAndDistance = localeDistance.getBestIndexAndDistance( + getMaximalLsrOrUnd(likelySubtags, desired, errorCode), + &pSuppLSR, 1, + LocaleDistance::shiftDistance(thresholdDistance), favorSubtag, direction); + return indexAndDistance >= 0; +} + double LocaleMatcher::internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const { // Returns the inverse of the distance: That is, 1-distance(desired, supported). LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, supported, errorCode); if (U_FAILURE(errorCode)) { return 0; } const LSR *pSuppLSR = &suppLSR; - int32_t distance = localeDistance.getBestIndexAndDistance( + int32_t indexAndDistance = localeDistance.getBestIndexAndDistance( getMaximalLsrOrUnd(likelySubtags, desired, errorCode), &pSuppLSR, 1, - thresholdDistance, favorSubtag) & 0xff; - return (100 - distance) / 100.0; + LocaleDistance::shiftDistance(thresholdDistance), favorSubtag, direction); + double distance = LocaleDistance::getDistanceDouble(indexAndDistance); + return (100.0 - distance) / 100.0; } U_NAMESPACE_END -#endif // __LOCMATCHER_H__ +// uloc_acceptLanguage() --------------------------------------------------- *** + +U_NAMESPACE_USE + +namespace { + +class LocaleFromTag { +public: + LocaleFromTag() : locale(Locale::getRoot()) {} + const Locale &operator()(const char *tag) { return locale = Locale(tag); } + +private: + // Store the locale in the converter, rather than return a reference to a temporary, + // or a value which could go out of scope with the caller's reference to it. + Locale locale; +}; + +int32_t acceptLanguage(UEnumeration &supportedLocales, Locale::Iterator &desiredLocales, + char *dest, int32_t capacity, UAcceptResult *acceptResult, + UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return 0; } + LocaleMatcher::Builder builder; + const char *locString; + while ((locString = uenum_next(&supportedLocales, nullptr, &errorCode)) != nullptr) { + Locale loc(locString); + if (loc.isBogus()) { + errorCode = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } + builder.addSupportedLocale(loc); + } + LocaleMatcher matcher = builder.build(errorCode); + LocaleMatcher::Result result = matcher.getBestMatchResult(desiredLocales, errorCode); + if (U_FAILURE(errorCode)) { return 0; } + if (result.getDesiredIndex() >= 0) { + if (acceptResult != nullptr) { + *acceptResult = *result.getDesiredLocale() == *result.getSupportedLocale() ? + ULOC_ACCEPT_VALID : ULOC_ACCEPT_FALLBACK; + } + const char *bestStr = result.getSupportedLocale()->getName(); + int32_t bestLength = (int32_t)uprv_strlen(bestStr); + if (bestLength <= capacity) { + uprv_memcpy(dest, bestStr, bestLength); + } + return u_terminateChars(dest, capacity, bestLength, &errorCode); + } else { + if (acceptResult != nullptr) { + *acceptResult = ULOC_ACCEPT_FAILED; + } + return u_terminateChars(dest, capacity, 0, &errorCode); + } +} + +} // namespace + +U_CAPI int32_t U_EXPORT2 +uloc_acceptLanguage(char *result, int32_t resultAvailable, + UAcceptResult *outResult, + const char **acceptList, int32_t acceptListCount, + UEnumeration *availableLocales, + UErrorCode *status) { + if (U_FAILURE(*status)) { return 0; } + if ((result == nullptr ? resultAvailable != 0 : resultAvailable < 0) || + (acceptList == nullptr ? acceptListCount != 0 : acceptListCount < 0) || + availableLocales == nullptr) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } + LocaleFromTag converter; + Locale::ConvertingIterator desiredLocales( + acceptList, acceptList + acceptListCount, converter); + return acceptLanguage(*availableLocales, desiredLocales, + result, resultAvailable, outResult, *status); +} + +U_CAPI int32_t U_EXPORT2 +uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, + UAcceptResult *outResult, + const char *httpAcceptLanguage, + UEnumeration *availableLocales, + UErrorCode *status) { + if (U_FAILURE(*status)) { return 0; } + if ((result == nullptr ? resultAvailable != 0 : resultAvailable < 0) || + httpAcceptLanguage == nullptr || availableLocales == nullptr) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } + LocalePriorityList list(httpAcceptLanguage, *status); + LocalePriorityList::Iterator desiredLocales = list.iterator(); + return acceptLanguage(*availableLocales, desiredLocales, + result, resultAvailable, outResult, *status); +} diff --git a/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.cpp b/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.cpp index d444b83ab..e5ba0a3c7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.cpp @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localeprioritylist.cpp // created: 2019jul11 Markus W. Scherer @@ -18,33 +18,6 @@ U_NAMESPACE_BEGIN -struct LocaleAndWeight { - Locale *locale; - int32_t weight; // 0..1000 = 0.0..1.0 - int32_t index; // force stable sort - - int32_t compare(const LocaleAndWeight &other) const { - int32_t diff = other.weight - weight; // descending: other-this - if (diff != 0) { return diff; } - return index - other.index; - } -}; - -/** - * Nothing but a wrapper over a MaybeStackArray of LocaleAndWeight. - * - * This wrapper exists (and is not in an anonymous namespace) - * so that we can forward-declare it in the header file and - * don't have to expose the MaybeStackArray specialization and - * the LocaleAndWeight to code (like the test) that #includes localeprioritylist.h. - * Also, otherwise we would have to do a platform-specific - * template export declaration of some kind for the MaybeStackArray specialization - * to be properly exported from the common DLL. - */ -struct LocaleAndWeightArray : public UMemory { - MaybeStackArray array; -}; - namespace { int32_t hashLocale(const UHashTok token) { @@ -60,6 +33,18 @@ UBool compareLocales(const UHashTok t1, const UHashTok t2) { constexpr int32_t WEIGHT_ONE = 1000; +struct LocaleAndWeight { + Locale *locale; + int32_t weight; // 0..1000 = 0.0..1.0 + int32_t index; // force stable sort + + int32_t compare(const LocaleAndWeight &other) const { + int32_t diff = other.weight - weight; // descending: other-this + if (diff != 0) { return diff; } + return index - other.index; + } +}; + int32_t U_CALLCONV compareLocaleAndWeight(const void * /*context*/, const void *left, const void *right) { return static_cast(left)-> @@ -110,6 +95,21 @@ int32_t parseWeight(const char *&p, const char *limit) { } // namespace +/** + * Nothing but a wrapper over a MaybeStackArray of LocaleAndWeight. + * + * This wrapper exists (and is not in an anonymous namespace) + * so that we can forward-declare it in the header file and + * don't have to expose the MaybeStackArray specialization and + * the LocaleAndWeight to code (like the test) that #includes localeprioritylist.h. + * Also, otherwise we would have to do a platform-specific + * template export declaration of some kind for the MaybeStackArray specialization + * to be properly exported from the common DLL. + */ +struct LocaleAndWeightArray : public UMemory { + MaybeStackArray array; +}; + LocalePriorityList::LocalePriorityList(StringPiece s, UErrorCode &errorCode) { if (U_FAILURE(errorCode)) { return; } list = new LocaleAndWeightArray(); @@ -133,7 +133,7 @@ LocalePriorityList::LocalePriorityList(StringPiece s, UErrorCode &errorCode) { if (U_FAILURE(errorCode)) { return; } Locale locale = Locale(tag.data()); if (locale.isBogus()) { - errorCode = U_MEMORY_ALLOCATION_ERROR; + errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } int32_t weight = WEIGHT_ONE; @@ -187,17 +187,18 @@ bool LocalePriorityList::add(const Locale &locale, int32_t weight, UErrorCode &e if (U_FAILURE(errorCode)) { return false; } } LocalPointer clone; - int32_t index = uhash_geti(map, &locale); - if (index != 0) { + UBool found = false; + int32_t index = uhash_getiAndFound(map, &locale, &found); + if (found) { // Duplicate: Remove the old item and append it anew. - LocaleAndWeight &lw = list->array[index - 1]; + LocaleAndWeight &lw = list->array[index]; clone.adoptInstead(lw.locale); lw.locale = nullptr; lw.weight = 0; ++numRemoved; } if (weight <= 0) { // do not add q=0 - if (index != 0) { + if (found) { // Not strictly necessary but cleaner. uhash_removei(map, &locale); } @@ -217,7 +218,7 @@ bool LocalePriorityList::add(const Locale &locale, int32_t weight, UErrorCode &e return false; } } - uhash_puti(map, clone.getAlias(), listLength + 1, &errorCode); + uhash_putiAllowZero(map, clone.getAlias(), listLength, &errorCode); if (U_FAILURE(errorCode)) { return false; } LocaleAndWeight &lw = list->array[listLength]; lw.locale = clone.orphan(); @@ -233,7 +234,7 @@ void LocalePriorityList::sort(UErrorCode &errorCode) { // The comparator forces a stable sort via the item index. if (U_FAILURE(errorCode) || getLength() <= 1 || !hasWeights) { return; } uprv_sortArray(list->array.getAlias(), listLength, sizeof(LocaleAndWeight), - compareLocaleAndWeight, nullptr, FALSE, &errorCode); + compareLocaleAndWeight, nullptr, false, &errorCode); } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.h b/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.h index 80ca38a7b..41e9d3ea0 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.h +++ b/src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localeprioritylist.h // created: 2019jul11 Markus W. Scherer diff --git a/src/duckdb/extension/icu/third_party/icu/common/locavailable.cpp b/src/duckdb/extension/icu/third_party/icu/common/locavailable.cpp index c2f62fda3..0ea209398 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locavailable.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locavailable.cpp @@ -35,26 +35,26 @@ U_NAMESPACE_BEGIN -static icu::Locale* gLocAvailable_availableLocaleList = NULL; -static int32_t gLocAvailable_availableLocaleListCount; -static icu::UInitOnce gLocAvailableInitOnceLocale = U_INITONCE_INITIALIZER; +static icu::Locale* availableLocaleList = nullptr; +static int32_t availableLocaleListCount; +static icu::UInitOnce gInitOnceLocale {}; U_NAMESPACE_END U_CDECL_BEGIN -static UBool U_CALLCONV locale_available_cleanup(void) +static UBool U_CALLCONV locale_available_cleanup() { U_NAMESPACE_USE - if (gLocAvailable_availableLocaleList) { - delete []gLocAvailable_availableLocaleList; - gLocAvailable_availableLocaleList = NULL; + if (availableLocaleList) { + delete []availableLocaleList; + availableLocaleList = nullptr; } - gLocAvailable_availableLocaleListCount = 0; - gLocAvailableInitOnceLocale.reset(); + availableLocaleListCount = 0; + gInitOnceLocale.reset(); - return TRUE; + return true; } U_CDECL_END @@ -64,18 +64,18 @@ U_NAMESPACE_BEGIN void U_CALLCONV locale_available_init() { // This function is a friend of class Locale. // This function is only invoked via umtx_initOnce(). - + // for now, there is a hardcoded list, so just walk through that list and set it up. // Note: this function is a friend of class Locale. - gLocAvailable_availableLocaleListCount = uloc_countAvailable(); - if(gLocAvailable_availableLocaleListCount) { - gLocAvailable_availableLocaleList = new Locale[gLocAvailable_availableLocaleListCount]; + availableLocaleListCount = uloc_countAvailable(); + if(availableLocaleListCount) { + availableLocaleList = new Locale[availableLocaleListCount]; } - if (gLocAvailable_availableLocaleList == NULL) { - gLocAvailable_availableLocaleListCount= 0; + if (availableLocaleList == nullptr) { + availableLocaleListCount= 0; } - for (int32_t locCount=gLocAvailable_availableLocaleListCount-1; locCount>=0; --locCount) { - gLocAvailable_availableLocaleList[locCount].setFromPOSIXID(uloc_getAvailable(locCount)); + for (int32_t locCount=availableLocaleListCount-1; locCount>=0; --locCount) { + availableLocaleList[locCount].setFromPOSIXID(uloc_getAvailable(locCount)); } ucln_common_registerCleanup(UCLN_COMMON_LOCALE_AVAILABLE, locale_available_cleanup); } @@ -83,9 +83,9 @@ void U_CALLCONV locale_available_init() { const Locale* U_EXPORT2 Locale::getAvailableLocales(int32_t& count) { - umtx_initOnce(gLocAvailableInitOnceLocale, &locale_available_init); - count = gLocAvailable_availableLocaleListCount; - return gLocAvailable_availableLocaleList; + umtx_initOnce(gInitOnceLocale, &locale_available_init); + count = availableLocaleListCount; + return availableLocaleList; } @@ -102,11 +102,11 @@ namespace { // Enough capacity for the two lists in the res_index.res file const char** gAvailableLocaleNames[2] = {}; int32_t gAvailableLocaleCounts[2] = {}; -icu::UInitOnce ginstalledLocalesInitOnce = U_INITONCE_INITIALIZER; +icu::UInitOnce ginstalledLocalesInitOnce {}; class AvailableLocalesSink : public ResourceSink { public: - void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE { + void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) override { ResourceTable resIndexTable = value.getTable(status); if (U_FAILURE(status)) { return; @@ -196,14 +196,14 @@ class AvailableLocalesStringEnumeration : public StringEnumeration { /* ### Get available **************************************************/ -static UBool U_CALLCONV uloc_cleanup(void) { +static UBool U_CALLCONV uloc_cleanup() { for (int32_t i = 0; i < UPRV_LENGTHOF(gAvailableLocaleNames); i++) { uprv_free(gAvailableLocaleNames[i]); gAvailableLocaleNames[i] = nullptr; gAvailableLocaleCounts[i] = 0; } ginstalledLocalesInitOnce.reset(); - return TRUE; + return true; } // Load Installed Locales. This function will be called exactly once @@ -212,7 +212,7 @@ static UBool U_CALLCONV uloc_cleanup(void) { static void U_CALLCONV loadInstalledLocales(UErrorCode& status) { ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup); - icu::LocalUResourceBundlePointer rb(ures_openDirect(NULL, "res_index", &status)); + icu::LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "res_index", &status)); AvailableLocalesSink sink; ures_getAllItemsWithFallback(rb.getAlias(), "", sink, status); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/locbased.cpp b/src/duckdb/extension/icu/third_party/icu/common/locbased.cpp index ff378b4cc..adcf2f843 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locbased.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locbased.cpp @@ -22,7 +22,7 @@ Locale LocaleBased::getLocale(ULocDataLocaleType type, UErrorCode& status) const const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const { if (U_FAILURE(status)) { - return NULL; + return nullptr; } switch(type) { @@ -32,7 +32,7 @@ const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status return actual; default: status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/locdispnames.cpp b/src/duckdb/extension/icu/third_party/icu/common/locdispnames.cpp index d92348e31..3ec1b81c8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locdispnames.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locdispnames.cpp @@ -26,6 +26,8 @@ #include "unicode/uloc.h" #include "unicode/ures.h" #include "unicode/ustring.h" +#include "bytesinkutil.h" +#include "charstr.h" #include "cmemory.h" #include "cstring.h" #include "putilimp.h" @@ -53,7 +55,7 @@ Locale::getDisplayLanguage(UnicodeString& dispLang) const UnicodeString& Locale::getDisplayLanguage(const Locale &displayLocale, UnicodeString &result) const { - UChar *buffer; + char16_t *buffer; UErrorCode errorCode=U_ZERO_ERROR; int32_t length; @@ -93,7 +95,7 @@ Locale::getDisplayScript(UnicodeString& dispScript) const UnicodeString& Locale::getDisplayScript(const Locale &displayLocale, UnicodeString &result) const { - UChar *buffer; + char16_t *buffer; UErrorCode errorCode=U_ZERO_ERROR; int32_t length; @@ -133,7 +135,7 @@ Locale::getDisplayCountry(UnicodeString& dispCntry) const UnicodeString& Locale::getDisplayCountry(const Locale &displayLocale, UnicodeString &result) const { - UChar *buffer; + char16_t *buffer; UErrorCode errorCode=U_ZERO_ERROR; int32_t length; @@ -173,7 +175,7 @@ Locale::getDisplayVariant(UnicodeString& dispVar) const UnicodeString& Locale::getDisplayVariant(const Locale &displayLocale, UnicodeString &result) const { - UChar *buffer; + char16_t *buffer; UErrorCode errorCode=U_ZERO_ERROR; int32_t length; @@ -213,7 +215,7 @@ Locale::getDisplayName( UnicodeString& name ) const UnicodeString& Locale::getDisplayName(const Locale &displayLocale, UnicodeString &result) const { - UChar *buffer; + char16_t *buffer; UErrorCode errorCode=U_ZERO_ERROR; int32_t length; @@ -300,12 +302,12 @@ _getStringOrCopyKey(const char *path, const char *locale, const char* subTableKey, const char *itemKey, const char *substitute, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { - const UChar *s = NULL; + const char16_t *s = nullptr; int32_t length = 0; - if(itemKey==NULL) { + if(itemKey==nullptr) { /* top-level item: normal resource bundle access */ icu::LocalUResourceBundlePointer rb(ures_open(path, locale, pErrorCode)); @@ -314,23 +316,35 @@ _getStringOrCopyKey(const char *path, const char *locale, /* see comment about closing rb near "return item;" in _res_getTableStringWithFallback() */ } } else { + bool isLanguageCode = (uprv_strncmp(tableKey, _kLanguages, 9) == 0); /* Language code should not be a number. If it is, set the error code. */ - if (!uprv_strncmp(tableKey, "Languages", 9) && uprv_strtol(itemKey, NULL, 10)) { + if (isLanguageCode && uprv_strtol(itemKey, nullptr, 10)) { *pErrorCode = U_MISSING_RESOURCE_ERROR; } else { /* second-level item, use special fallback */ s=uloc_getTableStringWithFallback(path, locale, - tableKey, + tableKey, subTableKey, itemKey, &length, pErrorCode); + if (U_FAILURE(*pErrorCode) && isLanguageCode && itemKey != nullptr) { + // convert itemKey locale code to canonical form and try again, ICU-20870 + *pErrorCode = U_ZERO_ERROR; + Locale canonKey = Locale::createCanonical(itemKey); + s=uloc_getTableStringWithFallback(path, locale, + tableKey, + subTableKey, + canonKey.getName(), + &length, + pErrorCode); + } } } if(U_SUCCESS(*pErrorCode)) { int32_t copyLength=uprv_min(length, destCapacity); - if(copyLength>0 && s != NULL) { + if(copyLength>0 && s != nullptr) { u_memcpy(dest, s, copyLength); } } else { @@ -348,21 +362,21 @@ typedef int32_t U_CALLCONV UDisplayNameGetter(const char *, char *, int32_t, UE static int32_t _getDisplayNameForComponent(const char *locale, const char *displayLocale, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UDisplayNameGetter *getter, const char *tag, UErrorCode *pErrorCode) { char localeBuffer[ULOC_FULLNAME_CAPACITY*4]; int32_t length; UErrorCode localStatus; - const char* root = NULL; + const char* root = nullptr; /* argument checking */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(destCapacity<0 || (destCapacity>0 && dest==NULL)) { + if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -385,7 +399,7 @@ _getDisplayNameForComponent(const char *locale, root = tag == _kCountries ? U_ICUDATA_REGION : U_ICUDATA_LANG; return _getStringOrCopyKey(root, displayLocale, - tag, NULL, localeBuffer, + tag, nullptr, localeBuffer, localeBuffer, dest, destCapacity, pErrorCode); @@ -394,7 +408,7 @@ _getDisplayNameForComponent(const char *locale, U_CAPI int32_t U_EXPORT2 uloc_getDisplayLanguage(const char *locale, const char *displayLocale, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, uloc_getLanguage, _kLanguages, pErrorCode); @@ -403,26 +417,32 @@ uloc_getDisplayLanguage(const char *locale, U_CAPI int32_t U_EXPORT2 uloc_getDisplayScript(const char* locale, const char* displayLocale, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { - UErrorCode err = U_ZERO_ERROR; - int32_t res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, + UErrorCode err = U_ZERO_ERROR; + int32_t res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, uloc_getScript, _kScriptsStandAlone, &err); - - if ( err == U_USING_DEFAULT_WARNING ) { + + if (destCapacity == 0 && err == U_BUFFER_OVERFLOW_ERROR) { + // For preflight, return the max of the value and the fallback. + int32_t fallback_res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, + uloc_getScript, _kScripts, pErrorCode); + return (fallback_res > res) ? fallback_res : res; + } + if ( err == U_USING_DEFAULT_WARNING ) { return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, - uloc_getScript, _kScripts, pErrorCode); - } else { - *pErrorCode = err; - return res; - } + uloc_getScript, _kScripts, pErrorCode); + } else { + *pErrorCode = err; + return res; + } } -U_INTERNAL int32_t U_EXPORT2 +static int32_t uloc_getDisplayScriptInContext(const char* locale, const char* displayLocale, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, @@ -432,7 +452,7 @@ uloc_getDisplayScriptInContext(const char* locale, U_CAPI int32_t U_EXPORT2 uloc_getDisplayCountry(const char *locale, const char *displayLocale, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, uloc_getCountry, _kCountries, pErrorCode); @@ -446,7 +466,7 @@ uloc_getDisplayCountry(const char *locale, U_CAPI int32_t U_EXPORT2 uloc_getDisplayVariant(const char *locale, const char *displayLocale, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity, uloc_getVariant, _kVariants, pErrorCode); @@ -467,14 +487,14 @@ uloc_getDisplayVariant(const char *locale, U_CAPI int32_t U_EXPORT2 uloc_getDisplayName(const char *locale, const char *displayLocale, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { - static const UChar defaultSeparator[9] = { 0x007b, 0x0030, 0x007d, 0x002c, 0x0020, 0x007b, 0x0031, 0x007d, 0x0000 }; /* "{0}, {1}" */ - static const UChar sub0[4] = { 0x007b, 0x0030, 0x007d , 0x0000 } ; /* {0} */ - static const UChar sub1[4] = { 0x007b, 0x0031, 0x007d , 0x0000 } ; /* {1} */ + static const char16_t defaultSeparator[9] = { 0x007b, 0x0030, 0x007d, 0x002c, 0x0020, 0x007b, 0x0031, 0x007d, 0x0000 }; /* "{0}, {1}" */ + static const char16_t sub0[4] = { 0x007b, 0x0030, 0x007d , 0x0000 } ; /* {0} */ + static const char16_t sub1[4] = { 0x007b, 0x0031, 0x007d , 0x0000 } ; /* {1} */ static const int32_t subLen = 3; - static const UChar defaultPattern[10] = { + static const char16_t defaultPattern[10] = { 0x007b, 0x0030, 0x007d, 0x0020, 0x0028, 0x007b, 0x0031, 0x007d, 0x0029, 0x0000 }; /* {0} ({1}) */ static const int32_t defaultPatLen = 9; @@ -483,30 +503,30 @@ uloc_getDisplayName(const char *locale, int32_t length; /* of formatted result */ - const UChar *separator; + const char16_t *separator; int32_t sepLen = 0; - const UChar *pattern; + const char16_t *pattern; int32_t patLen = 0; int32_t sub0Pos, sub1Pos; - UChar formatOpenParen = 0x0028; // ( - UChar formatReplaceOpenParen = 0x005B; // [ - UChar formatCloseParen = 0x0029; // ) - UChar formatReplaceCloseParen = 0x005D; // ] + char16_t formatOpenParen = 0x0028; // ( + char16_t formatReplaceOpenParen = 0x005B; // [ + char16_t formatCloseParen = 0x0029; // ) + char16_t formatReplaceCloseParen = 0x005D; // ] - UBool haveLang = TRUE; /* assume true, set false if we find we don't have + UBool haveLang = true; /* assume true, set false if we find we don't have a lang component in the locale */ - UBool haveRest = TRUE; /* assume true, set false if we find we don't have + UBool haveRest = true; /* assume true, set false if we find we don't have any other component in the locale */ - UBool retry = FALSE; /* set true if we need to retry, see below */ + UBool retry = false; /* set true if we need to retry, see below */ int32_t langi = 0; /* index of the language substitution (0 or 1), virtually always 0 */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(destCapacity<0 || (destCapacity>0 && dest==NULL)) { + if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -517,7 +537,7 @@ uloc_getDisplayName(const char *locale, icu::LocalUResourceBundlePointer locbundle( ures_open(U_ICUDATA_LANG, displayLocale, &status)); icu::LocalUResourceBundlePointer dspbundle( - ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, NULL, &status)); + ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, nullptr, &status)); separator=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kSeparator, &sepLen, &status); pattern=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kPattern, &patLen, &status); @@ -537,13 +557,13 @@ uloc_getDisplayName(const char *locale, * This is similar to how pattern is handled below. */ { - UChar *p0=u_strstr(separator, sub0); - UChar *p1=u_strstr(separator, sub1); - if (p0==NULL || p1==NULL || p1(p1 - separator); } @@ -554,9 +574,9 @@ uloc_getDisplayName(const char *locale, sub1Pos=defaultSub1Pos; // use default formatOpenParen etc. set above } else { /* non-default pattern */ - UChar *p0=u_strstr(pattern, sub0); - UChar *p1=u_strstr(pattern, sub1); - if (p0==NULL || p1==NULL) { + char16_t *p0=u_strstr(pattern, sub0); + char16_t *p1=u_strstr(pattern, sub1); + if (p0==nullptr || p1==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -566,7 +586,7 @@ uloc_getDisplayName(const char *locale, int32_t t=sub0Pos; sub0Pos=sub1Pos; sub1Pos=t; langi=1; } - if (u_strchr(pattern, 0xFF08) != NULL) { + if (u_strchr(pattern, 0xFF08) != nullptr) { formatOpenParen = 0xFF08; // fullwidth ( formatReplaceOpenParen = 0xFF3B; // fullwidth [ formatCloseParen = 0xFF09; // fullwidth ) @@ -582,7 +602,7 @@ uloc_getDisplayName(const char *locale, * adjust the parameters so padding is not added, and repeat. */ do { - UChar* p=dest; + char16_t* p=dest; int32_t patPos=0; /* position in the pattern, used for non-substitution portions */ int32_t langLen=0; /* length of language substitution */ int32_t langPos=0; /* position in output of language substitution */ @@ -605,7 +625,7 @@ uloc_getDisplayName(const char *locale, } for(int32_t subi=0,resti=0;subi<2;) { /* iterate through patterns 0 and 1*/ - UBool subdone = FALSE; /* set true when ready to move to next substitution */ + UBool subdone = false; /* set true when ready to move to next substitution */ /* prep p and cap for calls to get display components, pin cap to 0 since they complain if cap is negative */ @@ -623,10 +643,10 @@ uloc_getDisplayName(const char *locale, length+=langLen; haveLang=langLen>0; } - subdone=TRUE; + subdone=true; } else { /* {1} */ if(!haveRest) { - subdone=TRUE; + subdone=true; } else { int32_t len; /* length of component (plus other stuff) we just fetched */ switch(resti++) { @@ -645,9 +665,9 @@ uloc_getDisplayName(const char *locale, U_FALLTHROUGH; default: { const char* kw=uenum_next(kenum.getAlias(), &len, pErrorCode); - if (kw == NULL) { + if (kw == nullptr) { len=0; /* mark that we didn't add a component */ - subdone=TRUE; + subdone=true; } else { /* incorporating this behavior into the loop made it even more complex, so just special case it here */ @@ -690,9 +710,9 @@ uloc_getDisplayName(const char *locale, } /* end switch */ if (len>0) { - /* we addeed a component, so add separator and write it if there's room. */ + /* we added a component, so add separator and write it if there's room. */ if(len+sepLen<=cap) { - const UChar * plimit = p + len; + const char16_t * plimit = p + len; for (; p < plimit; p++) { if (*p == formatOpenParen) { *p = formatReplaceOpenParen; @@ -727,7 +747,7 @@ uloc_getDisplayName(const char *locale, int32_t padLen; patPos+=subLen; padLen=(subi==0 ? sub1Pos : patLen)-patPos; - if(length+padLen < destCapacity) { + if(length+padLen <= destCapacity) { p=dest+length; for(int32_t i=0;i0 && dest==NULL)) { + if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) { *status=U_ILLEGAL_ARGUMENT_ERROR; return 0; } - /* pass itemKey=NULL to look for a top-level item */ + /* pass itemKey=nullptr to look for a top-level item */ return _getStringOrCopyKey(U_ICUDATA_LANG, displayLocale, - _kKeys, NULL, + _kKeys, nullptr, keyword, keyword, dest, destCapacity, @@ -800,30 +820,27 @@ U_CAPI int32_t U_EXPORT2 uloc_getDisplayKeywordValue( const char* locale, const char* keyword, const char* displayLocale, - UChar* dest, + char16_t* dest, int32_t destCapacity, UErrorCode* status){ - char keywordValue[ULOC_FULLNAME_CAPACITY*4]; - int32_t capacity = ULOC_FULLNAME_CAPACITY*4; - int32_t keywordValueLen =0; - /* argument checking */ - if(status==NULL || U_FAILURE(*status)) { + if(status==nullptr || U_FAILURE(*status)) { return 0; } - if(destCapacity<0 || (destCapacity>0 && dest==NULL)) { + if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) { *status=U_ILLEGAL_ARGUMENT_ERROR; return 0; } /* get the keyword value */ - keywordValue[0]=0; - keywordValueLen = uloc_getKeywordValue(locale, keyword, keywordValue, capacity, status); - if (*status == U_STRING_NOT_TERMINATED_WARNING) - *status = U_BUFFER_OVERFLOW_ERROR; + CharString keywordValue; + { + CharStringByteSink sink(&keywordValue); + ulocimp_getKeywordValue(locale, keyword, sink, status); + } /* * if the keyword is equal to currency .. then to get the display name @@ -832,14 +849,14 @@ uloc_getDisplayKeywordValue( const char* locale, if(uprv_stricmp(keyword, _kCurrency)==0){ int32_t dispNameLen = 0; - const UChar *dispName = NULL; + const char16_t *dispName = nullptr; icu::LocalUResourceBundlePointer bundle( ures_open(U_ICUDATA_CURR, displayLocale, status)); icu::LocalUResourceBundlePointer currencies( - ures_getByKey(bundle.getAlias(), _kCurrencies, NULL, status)); + ures_getByKey(bundle.getAlias(), _kCurrencies, nullptr, status)); icu::LocalUResourceBundlePointer currency( - ures_getByKeyWithFallback(currencies.getAlias(), keywordValue, NULL, status)); + ures_getByKeyWithFallback(currencies.getAlias(), keywordValue.data(), nullptr, status)); dispName = ures_getStringByIndex(currency.getAlias(), UCURRENCY_DISPLAY_NAME_INDEX, &dispNameLen, status); @@ -852,8 +869,8 @@ uloc_getDisplayKeywordValue( const char* locale, } } - /* now copy the dispName over if not NULL */ - if(dispName != NULL){ + /* now copy the dispName over if not nullptr */ + if(dispName != nullptr){ if(dispNameLen <= destCapacity){ u_memcpy(dest, dispName, dispNameLen); return u_terminateUChars(dest, destCapacity, dispNameLen, status); @@ -863,12 +880,12 @@ uloc_getDisplayKeywordValue( const char* locale, } }else{ /* we have not found the display name for the value .. just copy over */ - if(keywordValueLen <= destCapacity){ - u_charsToUChars(keywordValue, dest, keywordValueLen); - return u_terminateUChars(dest, destCapacity, keywordValueLen, status); + if(keywordValue.length() <= destCapacity){ + u_charsToUChars(keywordValue.data(), dest, keywordValue.length()); + return u_terminateUChars(dest, destCapacity, keywordValue.length(), status); }else{ *status = U_BUFFER_OVERFLOW_ERROR; - return keywordValueLen; + return keywordValue.length(); } } @@ -877,8 +894,8 @@ uloc_getDisplayKeywordValue( const char* locale, return _getStringOrCopyKey(U_ICUDATA_LANG, displayLocale, _kTypes, keyword, - keywordValue, - keywordValue, + keywordValue.data(), + keywordValue.data(), dest, destCapacity, status); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/locdistance.cpp b/src/duckdb/extension/icu/third_party/icu/common/locdistance.cpp index ae69152ac..fb22fe79e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locdistance.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locdistance.cpp @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // locdistance.cpp // created: 2019may08 Markus W. Scherer @@ -45,13 +45,13 @@ enum { }; LocaleDistance *gLocaleDistance = nullptr; -UInitOnce locdistance_gInitOnce = U_INITONCE_INITIALIZER; +UInitOnce gInitOnce {}; -UBool U_CALLCONV locdistance_cleanup() { +UBool U_CALLCONV cleanup() { delete gLocaleDistance; gLocaleDistance = nullptr; - locdistance_gInitOnce.reset(); - return TRUE; + gInitOnce.reset(); + return true; } } // namespace @@ -69,21 +69,22 @@ void U_CALLCONV LocaleDistance::initLocaleDistance(UErrorCode &errorCode) { errorCode = U_MISSING_RESOURCE_ERROR; return; } - gLocaleDistance = new LocaleDistance(data); + gLocaleDistance = new LocaleDistance(data, likely); if (gLocaleDistance == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } - ucln_common_registerCleanup(UCLN_COMMON_LOCALE_DISTANCE, locdistance_cleanup); + ucln_common_registerCleanup(UCLN_COMMON_LOCALE_DISTANCE, cleanup); } const LocaleDistance *LocaleDistance::getSingleton(UErrorCode &errorCode) { if (U_FAILURE(errorCode)) { return nullptr; } - umtx_initOnce(locdistance_gInitOnce, &LocaleDistance::initLocaleDistance, errorCode); + umtx_initOnce(gInitOnce, &LocaleDistance::initLocaleDistance, errorCode); return gLocaleDistance; } -LocaleDistance::LocaleDistance(const LocaleDistanceData &data) : +LocaleDistance::LocaleDistance(const LocaleDistanceData &data, const XLikelySubtags &likely) : + likelySubtags(likely), trie(data.distanceTrieBytes), regionToPartitionsIndex(data.regionToPartitions), partitionArrays(data.partitions), paradigmLSRs(data.paradigms), paradigmLSRsLength(data.paradigmsLength), @@ -97,17 +98,19 @@ LocaleDistance::LocaleDistance(const LocaleDistanceData &data) : // a mere region difference for one desired locale // is as good as a perfect match for the next following desired locale. // As of CLDR 36, we have . - LSR en("en", "Latn", "US"); - LSR enGB("en", "Latn", "GB"); + LSR en("en", "Latn", "US", LSR::EXPLICIT_LSR); + LSR enGB("en", "Latn", "GB", LSR::EXPLICIT_LSR); const LSR *p_enGB = &enGB; - defaultDemotionPerDesiredLocale = getBestIndexAndDistance(en, &p_enGB, 1, - 50, ULOCMATCH_FAVOR_LANGUAGE) & 0xff; + int32_t indexAndDistance = getBestIndexAndDistance(en, &p_enGB, 1, + shiftDistance(50), ULOCMATCH_FAVOR_LANGUAGE, ULOCMATCH_DIRECTION_WITH_ONE_WAY); + defaultDemotionPerDesiredLocale = getDistanceFloor(indexAndDistance); } int32_t LocaleDistance::getBestIndexAndDistance( const LSR &desired, const LSR **supportedLSRs, int32_t supportedLSRsLength, - int32_t threshold, ULocMatchFavorSubtag favorSubtag) const { + int32_t shiftedThreshold, + ULocMatchFavorSubtag favorSubtag, ULocMatchDirection direction) const { BytesTrie iter(trie); // Look up the desired language only once for all supported LSRs. // Its "distance" is either a match point value of 0, or a non-match negative value. @@ -116,6 +119,8 @@ int32_t LocaleDistance::getBestIndexAndDistance( uint64_t desLangState = desLangDistance >= 0 && supportedLSRsLength > 1 ? iter.getState64() : 0; // Index of the supported LSR with the lowest distance. int32_t bestIndex = -1; + // Cached lookup info from XLikelySubtags.compareLikely(). + int32_t bestLikelyInfo = -1; for (int32_t slIndex = 0; slIndex < supportedLSRsLength; ++slIndex) { const LSR &supported = *supportedLSRs[slIndex]; bool star = false; @@ -145,6 +150,11 @@ int32_t LocaleDistance::getBestIndexAndDistance( star = true; } U_ASSERT(0 <= distance && distance <= 100); + // Round up the shifted threshold (if fraction bits are not 0) + // for comparison with un-shifted distances until we need fraction bits. + // (If we simply shifted non-zero fraction bits away, then we might ignore a language + // when it's really still a micro distance below the threshold.) + int32_t roundedThreshold = (shiftedThreshold + DISTANCE_FRACTION_MASK) >> DISTANCE_SHIFT; // We implement "favor subtag" by reducing the language subtag distance // (unscientifically reducing it to a quarter of the normal value), // so that the script distance is relatively more important. @@ -153,7 +163,9 @@ int32_t LocaleDistance::getBestIndexAndDistance( if (favorSubtag == ULOCMATCH_FAVOR_SCRIPT) { distance >>= 2; } - if (distance >= threshold) { + // Let distance == roundedThreshold pass until the tie-breaker logic + // at the end of the loop. + if (distance > roundedThreshold) { continue; } @@ -171,7 +183,7 @@ int32_t LocaleDistance::getBestIndexAndDistance( scriptDistance &= ~DISTANCE_IS_FINAL; } distance += scriptDistance; - if (distance >= threshold) { + if (distance > roundedThreshold) { continue; } @@ -180,8 +192,8 @@ int32_t LocaleDistance::getBestIndexAndDistance( } else if (star || (flags & DISTANCE_IS_FINAL) != 0) { distance += defaultRegionDistance; } else { - int32_t remainingThreshold = threshold - distance; - if (minRegionDistance >= remainingThreshold) { + int32_t remainingThreshold = roundedThreshold - distance; + if (minRegionDistance > remainingThreshold) { continue; } @@ -196,15 +208,51 @@ int32_t LocaleDistance::getBestIndexAndDistance( partitionsForRegion(supported), remainingThreshold); } - if (distance < threshold) { - if (distance == 0) { - return slIndex << 8; + int32_t shiftedDistance = shiftDistance(distance); + if (shiftedDistance == 0) { + // Distinguish between equivalent but originally unequal locales via an + // additional micro distance. + shiftedDistance |= (desired.flags ^ supported.flags); + if (shiftedDistance < shiftedThreshold) { + if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY || + // Is there also a match when we swap desired/supported? + isMatch(supported, desired, shiftedThreshold, favorSubtag)) { + if (shiftedDistance == 0) { + return slIndex << INDEX_SHIFT; + } + bestIndex = slIndex; + shiftedThreshold = shiftedDistance; + bestLikelyInfo = -1; + } + } + } else { + if (shiftedDistance < shiftedThreshold) { + if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY || + // Is there also a match when we swap desired/supported? + isMatch(supported, desired, shiftedThreshold, favorSubtag)) { + bestIndex = slIndex; + shiftedThreshold = shiftedDistance; + bestLikelyInfo = -1; + } + } else if (shiftedDistance == shiftedThreshold && bestIndex >= 0) { + if (direction != ULOCMATCH_DIRECTION_ONLY_TWO_WAY || + // Is there also a match when we swap desired/supported? + isMatch(supported, desired, shiftedThreshold, favorSubtag)) { + bestLikelyInfo = likelySubtags.compareLikely( + supported, *supportedLSRs[bestIndex], bestLikelyInfo); + if ((bestLikelyInfo & 1) != 0) { + // This supported locale matches as well as the previous best match, + // and neither matches perfectly, + // but this one is "more likely" (has more-default subtags). + bestIndex = slIndex; + } + } } - bestIndex = slIndex; - threshold = distance; } } - return bestIndex >= 0 ? (bestIndex << 8) | threshold : 0xffffff00 | ABOVE_THRESHOLD; + return bestIndex >= 0 ? + (bestIndex << INDEX_SHIFT) | shiftedThreshold : + INDEX_NEG_1 | shiftDistance(ABOVE_THRESHOLD); } int32_t LocaleDistance::getDesSuppScriptDistance( @@ -273,7 +321,7 @@ int32_t LocaleDistance::getRegionPartitionsDistance( d = getFallbackRegionDistance(iter, startState); star = true; } - if (d >= threshold) { + if (d > threshold) { return d; } else if (regionDistance < d) { regionDistance = d; @@ -286,7 +334,7 @@ int32_t LocaleDistance::getRegionPartitionsDistance( } } else if (!star) { int32_t d = getFallbackRegionDistance(iter, startState); - if (d >= threshold) { + if (d > threshold) { return d; } else if (regionDistance < d) { regionDistance = d; @@ -352,11 +400,14 @@ int32_t LocaleDistance::trieNext(BytesTrie &iter, const char *s, bool wantValue) } UBool LocaleDistance::isParadigmLSR(const LSR &lsr) const { - // Linear search for a very short list (length 6 as of 2019). - // If there are many paradigm LSRs we should use a hash set. + // Linear search for a very short list (length 6 as of 2019), + // because we look for equivalence not equality, and + // because it's easy. + // If there are many paradigm LSRs we should use a hash set + // with custom comparator and hasher. U_ASSERT(paradigmLSRsLength <= 15); for (int32_t i = 0; i < paradigmLSRsLength; ++i) { - if (lsr == paradigmLSRs[i]) { return true; } + if (lsr.isEquivalentTo(paradigmLSRs[i])) { return true; } } return false; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/locdistance.h b/src/duckdb/extension/icu/third_party/icu/common/locdistance.h index 7439f51c5..51b777e62 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locdistance.h +++ b/src/duckdb/extension/icu/third_party/icu/common/locdistance.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // locdistance.h // created: 2019may08 Markus W. Scherer @@ -26,19 +26,41 @@ class LocaleDistance final : public UMemory { public: static const LocaleDistance *getSingleton(UErrorCode &errorCode); + static int32_t shiftDistance(int32_t distance) { + return distance << DISTANCE_SHIFT; + } + + static int32_t getShiftedDistance(int32_t indexAndDistance) { + return indexAndDistance & DISTANCE_MASK; + } + + static double getDistanceDouble(int32_t indexAndDistance) { + double shiftedDistance = getShiftedDistance(indexAndDistance); + return shiftedDistance / (1 << DISTANCE_SHIFT); + } + + static int32_t getDistanceFloor(int32_t indexAndDistance) { + return (indexAndDistance & DISTANCE_MASK) >> DISTANCE_SHIFT; + } + + static int32_t getIndex(int32_t indexAndDistance) { + // assert indexAndDistance >= 0; + return indexAndDistance >> INDEX_SHIFT; + } + /** * Finds the supported LSR with the smallest distance from the desired one. * Equivalent LSR subtags must be normalized into a canonical form. * - *

Returns the index of the lowest-distance supported LSR in bits 31..8 + *

Returns the index of the lowest-distance supported LSR in the high bits * (negative if none has a distance below the threshold), - * and its distance (0..ABOVE_THRESHOLD) in bits 7..0. + * and its distance (0..ABOVE_THRESHOLD) in the low bits. */ int32_t getBestIndexAndDistance(const LSR &desired, const LSR **supportedLSRs, int32_t supportedLSRsLength, - int32_t threshold, ULocMatchFavorSubtag favorSubtag) const; - - int32_t getParadigmLSRsLength() const { return paradigmLSRsLength; } + int32_t shiftedThreshold, + ULocMatchFavorSubtag favorSubtag, + ULocMatchDirection direction) const; UBool isParadigmLSR(const LSR &lsr) const; @@ -51,12 +73,30 @@ class LocaleDistance final : public UMemory { } private: - LocaleDistance(const LocaleDistanceData &data); + // The distance is shifted left to gain some fraction bits. + static constexpr int32_t DISTANCE_SHIFT = 3; + static constexpr int32_t DISTANCE_FRACTION_MASK = 7; + // 7 bits for 0..100 + static constexpr int32_t DISTANCE_INT_SHIFT = 7; + static constexpr int32_t INDEX_SHIFT = DISTANCE_INT_SHIFT + DISTANCE_SHIFT; + static constexpr int32_t DISTANCE_MASK = 0x3ff; + // tic constexpr int32_t MAX_INDEX = 0x1fffff; // avoids sign bit + static constexpr int32_t INDEX_NEG_1 = 0xfffffc00; + + LocaleDistance(const LocaleDistanceData &data, const XLikelySubtags &likely); LocaleDistance(const LocaleDistance &other) = delete; LocaleDistance &operator=(const LocaleDistance &other) = delete; static void initLocaleDistance(UErrorCode &errorCode); + UBool isMatch(const LSR &desired, const LSR &supported, + int32_t shiftedThreshold, ULocMatchFavorSubtag favorSubtag) const { + const LSR *pSupp = &supported; + return getBestIndexAndDistance( + desired, &pSupp, 1, + shiftedThreshold, favorSubtag, ULOCMATCH_DIRECTION_WITH_ONE_WAY) >= 0; + } + static int32_t getDesSuppScriptDistance(BytesTrie &iter, uint64_t startState, const char *desired, const char *supported); @@ -79,6 +119,8 @@ class LocaleDistance final : public UMemory { return defaultRegionDistance; } + const XLikelySubtags &likelySubtags; + // The trie maps each dlang+slang+dscript+sscript+dregion+sregion // (encoded in ASCII with bit 7 set on the last character of each subtag) to a distance. // There is also a trie value for each subsequence of whole subtags. diff --git a/src/duckdb/extension/icu/third_party/icu/common/locdspnm.cpp b/src/duckdb/extension/icu/third_party/icu/common/locdspnm.cpp index b3e33c2d5..73fe531c5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locdspnm.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locdspnm.cpp @@ -40,7 +40,7 @@ static int32_t ncat(char *buffer, uint32_t buflen, ...) { char *p = buffer; const char* e = buffer + buflen - 1; - if (buffer == NULL || buflen < 1) { + if (buffer == nullptr || buflen < 1) { return -1; } @@ -86,16 +86,16 @@ class ICUDataTable { inline UnicodeString & ICUDataTable::get(const char* tableKey, const char* itemKey, UnicodeString& result) const { - return get(tableKey, NULL, itemKey, result); + return get(tableKey, nullptr, itemKey, result); } inline UnicodeString & ICUDataTable::getNoFallback(const char* tableKey, const char* itemKey, UnicodeString& result) const { - return getNoFallback(tableKey, NULL, itemKey, result); + return getNoFallback(tableKey, nullptr, itemKey, result); } ICUDataTable::ICUDataTable(const char* path, const Locale& locale) - : path(NULL), locale(Locale::getRoot()) + : path(nullptr), locale(Locale::getRoot()) { if (path) { int32_t len = static_cast(uprv_strlen(path)); @@ -110,7 +110,7 @@ ICUDataTable::ICUDataTable(const char* path, const Locale& locale) ICUDataTable::~ICUDataTable() { if (path) { uprv_free((void*) path); - path = NULL; + path = nullptr; } } @@ -125,7 +125,7 @@ ICUDataTable::get(const char* tableKey, const char* subTableKey, const char* ite UErrorCode status = U_ZERO_ERROR; int32_t len = 0; - const UChar *s = uloc_getTableStringWithFallback(path, locale.getName(), + const char16_t *s = uloc_getTableStringWithFallback(path, locale.getName(), tableKey, subTableKey, itemKey, &len, &status); if (U_SUCCESS(status) && len > 0) { @@ -140,7 +140,7 @@ ICUDataTable::getNoFallback(const char* tableKey, const char* subTableKey, const UErrorCode status = U_ZERO_ERROR; int32_t len = 0; - const UChar *s = uloc_getTableStringWithFallback(path, locale.getName(), + const char16_t *s = uloc_getTableStringWithFallback(path, locale.getName(), tableKey, subTableKey, itemKey, &len, &status); if (U_SUCCESS(status)) { @@ -281,13 +281,11 @@ class LocaleDisplayNamesImpl : public LocaleDisplayNames { SimpleFormatter format; SimpleFormatter keyTypeFormat; UDisplayContext capitalizationContext; -public: #if !UCONFIG_NO_BREAK_ITERATION BreakIterator* capitalizationBrkIter; #else UObject* capitalizationBrkIter; #endif -private: UnicodeString formatOpenParen; UnicodeString formatReplaceOpenParen; UnicodeString formatCloseParen; @@ -315,29 +313,29 @@ class LocaleDisplayNamesImpl : public LocaleDisplayNames { LocaleDisplayNamesImpl(const Locale& locale, UDisplayContext *contexts, int32_t length); virtual ~LocaleDisplayNamesImpl(); - virtual const Locale& getLocale() const; - virtual UDialectHandling getDialectHandling() const; - virtual UDisplayContext getContext(UDisplayContextType type) const; + virtual const Locale& getLocale() const override; + virtual UDialectHandling getDialectHandling() const override; + virtual UDisplayContext getContext(UDisplayContextType type) const override; virtual UnicodeString& localeDisplayName(const Locale& locale, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& localeDisplayName(const char* localeId, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& languageDisplayName(const char* lang, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& scriptDisplayName(const char* script, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& regionDisplayName(const char* region, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& variantDisplayName(const char* variant, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& keyDisplayName(const char* key, - UnicodeString& result) const; + UnicodeString& result) const override; virtual UnicodeString& keyValueDisplayName(const char* key, const char* value, - UnicodeString& result) const; + UnicodeString& result) const override; private: UnicodeString& localeIdName(const char* localeId, UnicodeString& result, bool substitute) const; @@ -349,7 +347,7 @@ class LocaleDisplayNamesImpl : public LocaleDisplayNames { UnicodeString& keyDisplayName(const char* key, UnicodeString& result, UBool skipAdjust) const; UnicodeString& keyValueDisplayName(const char* key, const char* value, UnicodeString& result, UBool skipAdjust) const; - void initialize(void); + void initialize(); struct CapitalizationContextSink; }; @@ -360,7 +358,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale, , langData(U_ICUDATA_LANG, locale) , regionData(U_ICUDATA_REGION, locale) , capitalizationContext(UDISPCTX_CAPITALIZATION_NONE) - , capitalizationBrkIter(NULL) + , capitalizationBrkIter(nullptr) , nameLength(UDISPCTX_LENGTH_FULL) , substitute(UDISPCTX_SUBSTITUTE) { @@ -373,7 +371,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale, , langData(U_ICUDATA_LANG, locale) , regionData(U_ICUDATA_REGION, locale) , capitalizationContext(UDISPCTX_CAPITALIZATION_NONE) - , capitalizationBrkIter(NULL) + , capitalizationBrkIter(nullptr) , nameLength(UDISPCTX_LENGTH_FULL) , substitute(UDISPCTX_SUBSTITUTE) { @@ -405,11 +403,11 @@ struct LocaleDisplayNamesImpl::CapitalizationContextSink : public ResourceSink { LocaleDisplayNamesImpl& parent; CapitalizationContextSink(LocaleDisplayNamesImpl& _parent) - : hasCapitalizationUsage(FALSE), parent(_parent) {} + : hasCapitalizationUsage(false), parent(_parent) {} virtual ~CapitalizationContextSink(); virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { + UErrorCode &errorCode) override { ResourceTable contexts = value.getTable(errorCode); if (U_FAILURE(errorCode)) { return; } for (int i = 0; contexts.getKeyAndValue(i, key, value); ++i) { @@ -439,8 +437,8 @@ struct LocaleDisplayNamesImpl::CapitalizationContextSink : public ResourceSink { int32_t titlecaseInt = (parent.capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU) ? intVector[0] : intVector[1]; if (titlecaseInt == 0) { continue; } - parent.fCapitalization[usageEnum] = TRUE; - hasCapitalizationUsage = TRUE; + parent.fCapitalization[usageEnum] = true; + hasCapitalizationUsage = true; } } }; @@ -449,7 +447,7 @@ struct LocaleDisplayNamesImpl::CapitalizationContextSink : public ResourceSink { LocaleDisplayNamesImpl::CapitalizationContextSink::~CapitalizationContextSink() {} void -LocaleDisplayNamesImpl::initialize(void) { +LocaleDisplayNamesImpl::initialize() { LocaleDisplayNamesImpl *nonConstThis = (LocaleDisplayNamesImpl *)this; nonConstThis->locale = langData.getLocale() == Locale::getRoot() ? regionData.getLocale() @@ -469,16 +467,16 @@ LocaleDisplayNamesImpl::initialize(void) { pattern = UnicodeString("{0} ({1})", -1, US_INV); } format.applyPatternMinMaxArguments(pattern, 2, 2, status); - if (pattern.indexOf((UChar)0xFF08) >= 0) { - formatOpenParen.setTo((UChar)0xFF08); // fullwidth ( - formatReplaceOpenParen.setTo((UChar)0xFF3B); // fullwidth [ - formatCloseParen.setTo((UChar)0xFF09); // fullwidth ) - formatReplaceCloseParen.setTo((UChar)0xFF3D); // fullwidth ] + if (pattern.indexOf((char16_t)0xFF08) >= 0) { + formatOpenParen.setTo((char16_t)0xFF08); // fullwidth ( + formatReplaceOpenParen.setTo((char16_t)0xFF3B); // fullwidth [ + formatCloseParen.setTo((char16_t)0xFF09); // fullwidth ) + formatReplaceCloseParen.setTo((char16_t)0xFF3D); // fullwidth ] } else { - formatOpenParen.setTo((UChar)0x0028); // ( - formatReplaceOpenParen.setTo((UChar)0x005B); // [ - formatCloseParen.setTo((UChar)0x0029); // ) - formatReplaceCloseParen.setTo((UChar)0x005D); // ] + formatOpenParen.setTo((char16_t)0x0028); // ( + formatReplaceOpenParen.setTo((char16_t)0x005B); // [ + formatCloseParen.setTo((char16_t)0x0029); // ) + formatReplaceCloseParen.setTo((char16_t)0x005D); // ] } UnicodeString ktPattern; @@ -492,9 +490,9 @@ LocaleDisplayNamesImpl::initialize(void) { #if !UCONFIG_NO_BREAK_ITERATION // Only get the context data if we need it! This is a const object so we know now... // Also check whether we will need a break iterator (depends on the data) - UBool needBrkIter = FALSE; + UBool needBrkIter = false; if (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE) { - LocalUResourceBundlePointer resource(ures_open(NULL, locale.getName(), &status)); + LocalUResourceBundlePointer resource(ures_open(nullptr, locale.getName(), &status)); if (U_FAILURE(status)) { return; } CapitalizationContextSink sink(*this); ures_getAllItemsWithFallback(resource.getAlias(), "contextTransforms", sink, status); @@ -512,7 +510,7 @@ LocaleDisplayNamesImpl::initialize(void) { capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status); if (U_FAILURE(status)) { delete capitalizationBrkIter; - capitalizationBrkIter = NULL; + capitalizationBrkIter = nullptr; } } #endif @@ -556,7 +554,7 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage, UnicodeString& result) const { #if !UCONFIG_NO_BREAK_ITERATION // check to see whether we need to titlecase result - if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= NULL && + if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= nullptr && ( capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || fCapitalization[usage] ) ) { // note fCapitalization[usage] won't be set unless capitalizationContext is UI_LIST_OR_MENU or STANDALONE static UMutex capitalizationBrkIterLock; @@ -595,8 +593,8 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", script, "_", country, (char *)0); localeIdName(buffer, resultName, false); if (!resultName.isBogus()) { - hasScript = FALSE; - hasCountry = FALSE; + hasScript = false; + hasCountry = false; break; } } @@ -604,7 +602,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", script, (char *)0); localeIdName(buffer, resultName, false); if (!resultName.isBogus()) { - hasScript = FALSE; + hasScript = false; break; } } @@ -612,11 +610,11 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", country, (char*)0); localeIdName(buffer, resultName, false); if (!resultName.isBogus()) { - hasCountry = FALSE; + hasCountry = false; break; } } - } while (FALSE); + } while (false); } if (resultName.isBogus() || resultName.isEmpty()) { localeIdName(lang, resultName, substitute == UDISPCTX_SUBSTITUTE); @@ -631,7 +629,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, UErrorCode status = U_ZERO_ERROR; if (hasScript) { - UnicodeString script_str = scriptDisplayName(script, temp, TRUE); + UnicodeString script_str = scriptDisplayName(script, temp, true); if (script_str.isBogus()) { result.setToBogus(); return result; @@ -639,7 +637,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, resultRemainder.append(script_str); } if (hasCountry) { - UnicodeString region_str = regionDisplayName(country, temp, TRUE); + UnicodeString region_str = regionDisplayName(country, temp, true); if (region_str.isBogus()) { result.setToBogus(); return result; @@ -647,7 +645,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, appendWithSep(resultRemainder, region_str); } if (hasVariant) { - UnicodeString variant_str = variantDisplayName(variant, temp, TRUE); + UnicodeString variant_str = variantDisplayName(variant, temp, true); if (variant_str.isBogus()) { result.setToBogus(); return result; @@ -662,16 +660,16 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, 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) { + while ((key = e->next((int32_t *)0, status)) != nullptr) { 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); + keyDisplayName(key, temp, true); temp.findAndReplace(formatOpenParen, formatReplaceOpenParen); temp.findAndReplace(formatCloseParen, formatReplaceCloseParen); - keyValueDisplayName(key, value, temp2, TRUE); + keyValueDisplayName(key, value, temp2, true); temp2.findAndReplace(formatOpenParen, formatReplaceOpenParen); temp2.findAndReplace(formatCloseParen, formatReplaceCloseParen); if (temp2 != UnicodeString(value, -1, US_INV)) { @@ -682,7 +680,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc, appendWithSep(resultRemainder, temp3); } else { appendWithSep(resultRemainder, temp) - .append((UChar)0x3d /* = */) + .append((char16_t)0x3d /* = */) .append(temp2); } } @@ -704,7 +702,7 @@ LocaleDisplayNamesImpl::appendWithSep(UnicodeString& buffer, const UnicodeString } else { const UnicodeString *values[2] = { &buffer, &src }; UErrorCode status = U_ZERO_ERROR; - separatorFormat.formatAndReplace(values, 2, buffer, NULL, 0, status); + separatorFormat.formatAndReplace(values, 2, buffer, nullptr, 0, status); } return buffer; } @@ -725,17 +723,31 @@ LocaleDisplayNamesImpl::localeIdName(const char* localeId, return result; } } - if (substitute) { - return langData.get("Languages", localeId, result); - } else { - return langData.getNoFallback("Languages", localeId, result); + langData.getNoFallback("Languages", localeId, result); + if (result.isBogus() && uprv_strchr(localeId, '_') == nullptr) { + // Canonicalize lang and try again, ICU-20870 + // (only for language codes without script or region) + Locale canonLocale = Locale::createCanonical(localeId); + const char* canonLocId = canonLocale.getName(); + if (nameLength == UDISPCTX_LENGTH_SHORT) { + langData.getNoFallback("Languages%short", canonLocId, result); + if (!result.isBogus()) { + return result; + } + } + langData.getNoFallback("Languages", canonLocId, result); + } + if (result.isBogus() && substitute) { + // use key, this is what langData.get (with fallback) falls back to. + result.setTo(UnicodeString(localeId, -1, US_INV)); // use key ( } + return result; } UnicodeString& LocaleDisplayNamesImpl::languageDisplayName(const char* lang, UnicodeString& result) const { - if (uprv_strcmp("root", lang) == 0 || uprv_strchr(lang, '_') != NULL) { + if (uprv_strcmp("root", lang) == 0 || uprv_strchr(lang, '_') != nullptr) { return result = UnicodeString(lang, -1, US_INV); } if (nameLength == UDISPCTX_LENGTH_SHORT) { @@ -744,10 +756,22 @@ LocaleDisplayNamesImpl::languageDisplayName(const char* lang, return adjustForUsageAndContext(kCapContextUsageLanguage, result); } } - if (substitute == UDISPCTX_SUBSTITUTE) { - langData.get("Languages", lang, result); - } else { - langData.getNoFallback("Languages", lang, result); + langData.getNoFallback("Languages", lang, result); + if (result.isBogus()) { + // Canonicalize lang and try again, ICU-20870 + Locale canonLocale = Locale::createCanonical(lang); + const char* canonLocId = canonLocale.getName(); + if (nameLength == UDISPCTX_LENGTH_SHORT) { + langData.getNoFallback("Languages%short", canonLocId, result); + if (!result.isBogus()) { + return adjustForUsageAndContext(kCapContextUsageLanguage, result); + } + } + langData.getNoFallback("Languages", canonLocId, result); + } + if (result.isBogus() && substitute == UDISPCTX_SUBSTITUTE) { + // use key, this is what langData.get (with fallback) falls back to. + result.setTo(UnicodeString(lang, -1, US_INV)); // use key ( } return adjustForUsageAndContext(kCapContextUsageLanguage, result); } @@ -773,13 +797,13 @@ LocaleDisplayNamesImpl::scriptDisplayName(const char* script, UnicodeString& LocaleDisplayNamesImpl::scriptDisplayName(const char* script, UnicodeString& result) const { - return scriptDisplayName(script, result, FALSE); + return scriptDisplayName(script, result, false); } UnicodeString& LocaleDisplayNamesImpl::scriptDisplayName(UScriptCode scriptCode, UnicodeString& result) const { - return scriptDisplayName(uscript_getName(scriptCode), result, FALSE); + return scriptDisplayName(uscript_getName(scriptCode), result, false); } UnicodeString& @@ -803,7 +827,7 @@ LocaleDisplayNamesImpl::regionDisplayName(const char* region, UnicodeString& LocaleDisplayNamesImpl::regionDisplayName(const char* region, UnicodeString& result) const { - return regionDisplayName(region, result, FALSE); + return regionDisplayName(region, result, false); } @@ -823,7 +847,7 @@ LocaleDisplayNamesImpl::variantDisplayName(const char* variant, UnicodeString& LocaleDisplayNamesImpl::variantDisplayName(const char* variant, UnicodeString& result) const { - return variantDisplayName(variant, result, FALSE); + return variantDisplayName(variant, result, false); } UnicodeString& @@ -842,7 +866,7 @@ LocaleDisplayNamesImpl::keyDisplayName(const char* key, UnicodeString& LocaleDisplayNamesImpl::keyDisplayName(const char* key, UnicodeString& result) const { - return keyDisplayName(key, result, FALSE); + return keyDisplayName(key, result, false); } UnicodeString& @@ -855,7 +879,7 @@ LocaleDisplayNamesImpl::keyValueDisplayName(const char* key, UErrorCode sts = U_ZERO_ERROR; UnicodeString ustrValue(value, -1, US_INV); int32_t len; - const UChar *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(), + const char16_t *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(), locale.getBaseName(), UCURR_LONG_NAME, nullptr /* isChoiceFormat */, &len, &sts); if (U_FAILURE(sts)) { // Return the value as is on failure @@ -884,10 +908,11 @@ UnicodeString& LocaleDisplayNamesImpl::keyValueDisplayName(const char* key, const char* value, UnicodeString& result) const { - return keyValueDisplayName(key, value, result, FALSE); + return keyValueDisplayName(key, value, result, false); } //////////////////////////////////////////////////////////////////////////////////////////////////// + LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale, UDialectHandling dialectHandling) { @@ -897,7 +922,7 @@ LocaleDisplayNames::createInstance(const Locale& locale, LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale, UDisplayContext *contexts, int32_t length) { - if (contexts == NULL) { + if (contexts == nullptr) { length = 0; } return new LocaleDisplayNamesImpl(locale, contexts, length); @@ -916,7 +941,7 @@ uldn_open(const char * locale, if (U_FAILURE(*pErrorCode)) { return 0; } - if (locale == NULL) { + if (locale == nullptr) { locale = uloc_getDefault(); } return (ULocaleDisplayNames *)LocaleDisplayNames::createInstance(Locale(locale), dialectHandling); @@ -929,7 +954,7 @@ uldn_openForContext(const char * locale, if (U_FAILURE(*pErrorCode)) { return 0; } - if (locale == NULL) { + if (locale == nullptr) { locale = uloc_getDefault(); } return (ULocaleDisplayNames *)LocaleDisplayNames::createInstance(Locale(locale), contexts, length); @@ -946,7 +971,7 @@ uldn_getLocale(const ULocaleDisplayNames *ldn) { if (ldn) { return ((const LocaleDisplayNames *)ldn)->getLocale().getName(); } - return NULL; + return nullptr; } U_CAPI UDialectHandling U_EXPORT2 @@ -970,13 +995,13 @@ uldn_getContext(const ULocaleDisplayNames *ldn, U_CAPI int32_t U_EXPORT2 uldn_localeDisplayName(const ULocaleDisplayNames *ldn, const char *locale, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { if (U_FAILURE(*pErrorCode)) { return 0; } - if (ldn == NULL || locale == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) { + if (ldn == nullptr || locale == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -992,13 +1017,13 @@ uldn_localeDisplayName(const ULocaleDisplayNames *ldn, U_CAPI int32_t U_EXPORT2 uldn_languageDisplayName(const ULocaleDisplayNames *ldn, const char *lang, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { if (U_FAILURE(*pErrorCode)) { return 0; } - if (ldn == NULL || lang == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) { + if (ldn == nullptr || lang == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1010,13 +1035,13 @@ uldn_languageDisplayName(const ULocaleDisplayNames *ldn, U_CAPI int32_t U_EXPORT2 uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, const char *script, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { if (U_FAILURE(*pErrorCode)) { return 0; } - if (ldn == NULL || script == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) { + if (ldn == nullptr || script == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1028,7 +1053,7 @@ uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, U_CAPI int32_t U_EXPORT2 uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, UScriptCode scriptCode, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { return uldn_scriptDisplayName(ldn, uscript_getName(scriptCode), result, maxResultSize, pErrorCode); @@ -1037,13 +1062,13 @@ uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, U_CAPI int32_t U_EXPORT2 uldn_regionDisplayName(const ULocaleDisplayNames *ldn, const char *region, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { if (U_FAILURE(*pErrorCode)) { return 0; } - if (ldn == NULL || region == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) { + if (ldn == nullptr || region == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1055,13 +1080,13 @@ uldn_regionDisplayName(const ULocaleDisplayNames *ldn, U_CAPI int32_t U_EXPORT2 uldn_variantDisplayName(const ULocaleDisplayNames *ldn, const char *variant, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { if (U_FAILURE(*pErrorCode)) { return 0; } - if (ldn == NULL || variant == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) { + if (ldn == nullptr || variant == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1073,13 +1098,13 @@ uldn_variantDisplayName(const ULocaleDisplayNames *ldn, U_CAPI int32_t U_EXPORT2 uldn_keyDisplayName(const ULocaleDisplayNames *ldn, const char *key, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { if (U_FAILURE(*pErrorCode)) { return 0; } - if (ldn == NULL || key == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) { + if (ldn == nullptr || key == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1092,13 +1117,13 @@ U_CAPI int32_t U_EXPORT2 uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, const char *key, const char *value, - UChar *result, + char16_t *result, int32_t maxResultSize, UErrorCode *pErrorCode) { if (U_FAILURE(*pErrorCode)) { return 0; } - if (ldn == NULL || key == NULL || value == NULL || (result == NULL && maxResultSize > 0) + if (ldn == nullptr || key == nullptr || value == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; diff --git a/src/duckdb/extension/icu/third_party/icu/common/locid.cpp b/src/duckdb/extension/icu/third_party/icu/common/locid.cpp index 179d5b3b4..64ff63f36 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locid.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locid.cpp @@ -35,12 +35,15 @@ #include "unicode/bytestream.h" #include "unicode/locid.h" +#include "unicode/localebuilder.h" #include "unicode/strenum.h" #include "unicode/stringpiece.h" #include "unicode/uloc.h" +#include "unicode/ures.h" #include "bytesinkutil.h" #include "charstr.h" +#include "charstrmap.h" #include "cmemory.h" #include "cstring.h" #include "mutex.h" @@ -50,21 +53,23 @@ #include "uhash.h" #include "ulocimp.h" #include "umutex.h" +#include "uniquecharstr.h" #include "ustr_imp.h" +#include "uvector.h" U_CDECL_BEGIN -static UBool U_CALLCONV locale_cleanup(void); +static UBool U_CALLCONV locale_cleanup(); U_CDECL_END U_NAMESPACE_BEGIN -static Locale *gLocaleCache = NULL; -static UInitOnce gLocaleCacheInitOnce = U_INITONCE_INITIALIZER; +static Locale *gLocaleCache = nullptr; +static UInitOnce gLocaleCacheInitOnce {}; // gDefaultLocaleMutex protects all access to gDefaultLocalesHashT and gDefaultLocale. static UMutex gDefaultLocaleMutex; -static UHashtable *gDefaultLocalesHashT = NULL; -static Locale *gDefaultLocale = NULL; +static UHashtable *gDefaultLocalesHashT = nullptr; +static Locale *gDefaultLocale = nullptr; /** * \def ULOC_STRING_LIMIT @@ -101,13 +106,6 @@ typedef enum ELocalePos { eMAX_LOCALES } ELocalePos; -U_CFUNC int32_t locale_getKeywords(const char *localeID, - char prev, - char *keywords, int32_t keywordCapacity, - char *values, int32_t valuesCapacity, int32_t *valLen, - UBool valuesToo, - UErrorCode *status); - U_CDECL_BEGIN // // Deleter function for Locales owned by the default Locale hash table/ @@ -117,29 +115,29 @@ deleteLocale(void *obj) { delete (icu::Locale *) obj; } -static UBool U_CALLCONV locale_cleanup(void) +static UBool U_CALLCONV locale_cleanup() { U_NAMESPACE_USE delete [] gLocaleCache; - gLocaleCache = NULL; + gLocaleCache = nullptr; gLocaleCacheInitOnce.reset(); if (gDefaultLocalesHashT) { uhash_close(gDefaultLocalesHashT); // Automatically deletes all elements, using deleter func. - gDefaultLocalesHashT = NULL; + gDefaultLocalesHashT = nullptr; } - gDefaultLocale = NULL; - return TRUE; + gDefaultLocale = nullptr; + return true; } static void U_CALLCONV locale_init(UErrorCode &status) { U_NAMESPACE_USE - U_ASSERT(gLocaleCache == NULL); + U_ASSERT(gLocaleCache == nullptr); gLocaleCache = new Locale[(int)eMAX_LOCALES]; - if (gLocaleCache == NULL) { + if (gLocaleCache == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -173,34 +171,33 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) { // Synchronize this entire function. Mutex lock(&gDefaultLocaleMutex); - UBool canonicalize = FALSE; + UBool canonicalize = false; - // If given a NULL string for the locale id, grab the default + // If given a nullptr string for the locale id, grab the default // name from the system. // (Different from most other locale APIs, where a null name means use // the current ICU default locale.) - if (id == NULL) { + if (id == nullptr) { id = uprv_getDefaultLocaleID(); // This function not thread safe? TODO: verify. - canonicalize = TRUE; // always canonicalize host ID + canonicalize = true; // always canonicalize host ID } - char localeNameBuf[512]; - - if (canonicalize) { - uloc_canonicalize(id, localeNameBuf, sizeof(localeNameBuf)-1, &status); - } else { - uloc_getName(id, localeNameBuf, sizeof(localeNameBuf)-1, &status); + CharString localeNameBuf; + { + CharStringByteSink sink(&localeNameBuf); + if (canonicalize) { + ulocimp_canonicalize(id, sink, &status); + } else { + ulocimp_getName(id, sink, &status); + } } - localeNameBuf[sizeof(localeNameBuf)-1] = 0; // Force null termination in event of - // a long name filling the buffer. - // (long names are truncated.) - // + if (U_FAILURE(status)) { return gDefaultLocale; } - if (gDefaultLocalesHashT == NULL) { - gDefaultLocalesHashT = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status); + if (gDefaultLocalesHashT == nullptr) { + gDefaultLocalesHashT = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status); if (U_FAILURE(status)) { return gDefaultLocale; } @@ -208,14 +205,14 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) { ucln_common_registerCleanup(UCLN_COMMON_LOCALE, locale_cleanup); } - Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf); - if (newDefault == NULL) { + Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf.data()); + if (newDefault == nullptr) { newDefault = new Locale(Locale::eBOGUS); - if (newDefault == NULL) { + if (newDefault == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return gDefaultLocale; } - newDefault->init(localeNameBuf, FALSE); + newDefault->init(localeNameBuf.data(), false); uhash_put(gDefaultLocalesHashT, (char*) newDefault->getName(), newDefault, &status); if (U_FAILURE(status)) { return gDefaultLocale; @@ -238,7 +235,7 @@ locale_set_default(const char *id) /* end */ U_CFUNC const char * -locale_get_default(void) +locale_get_default() { U_NAMESPACE_USE return Locale::getDefault().getName(); @@ -253,25 +250,26 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Locale) // '_' // In the platform codepage. #define SEP_CHAR '_' +#define NULL_CHAR '\0' Locale::~Locale() { - if (baseName != fullName) { + if ((baseName != fullName) && (baseName != fullNameBuffer)) { uprv_free(baseName); } - baseName = NULL; + baseName = nullptr; /*if fullName is on the heap, we free it*/ if (fullName != fullNameBuffer) { uprv_free(fullName); - fullName = NULL; + fullName = nullptr; } } Locale::Locale() - : UObject(), fullName(fullNameBuffer), baseName(NULL) + : UObject(), fullName(fullNameBuffer), baseName(nullptr) { - init(NULL, FALSE); + init(nullptr, false); } /* @@ -280,7 +278,7 @@ Locale::Locale() * the default locale.) */ Locale::Locale(Locale::ELocaleType) - : UObject(), fullName(fullNameBuffer), baseName(NULL) + : UObject(), fullName(fullNameBuffer), baseName(nullptr) { setToBogus(); } @@ -290,11 +288,11 @@ Locale::Locale( const char * newLanguage, const char * newCountry, const char * newVariant, const char * newKeywords) - : UObject(), fullName(fullNameBuffer), baseName(NULL) + : UObject(), fullName(fullNameBuffer), baseName(nullptr) { - if( (newLanguage==NULL) && (newCountry == NULL) && (newVariant == NULL) ) + if( (newLanguage==nullptr) && (newCountry == nullptr) && (newVariant == nullptr) ) { - init(NULL, FALSE); /* shortcut */ + init(nullptr, false); /* shortcut */ } else { @@ -304,10 +302,10 @@ Locale::Locale( const char * newLanguage, int32_t vsize = 0; int32_t ksize = 0; - // Calculate the size of the resulting string. + // Check the sizes of the input strings. // Language - if ( newLanguage != NULL ) + if ( newLanguage != nullptr ) { lsize = (int32_t)uprv_strlen(newLanguage); if ( lsize < 0 || lsize > ULOC_STRING_LIMIT ) { // int32 wrap @@ -319,7 +317,7 @@ Locale::Locale( const char * newLanguage, CharString togo(newLanguage, lsize, status); // start with newLanguage // _Country - if ( newCountry != NULL ) + if ( newCountry != nullptr ) { csize = (int32_t)uprv_strlen(newCountry); if ( csize < 0 || csize > ULOC_STRING_LIMIT ) { // int32 wrap @@ -329,7 +327,7 @@ Locale::Locale( const char * newLanguage, } // _Variant - if ( newVariant != NULL ) + if ( newVariant != nullptr ) { // remove leading _'s while(newVariant[0] == SEP_CHAR) @@ -349,7 +347,7 @@ Locale::Locale( const char * newLanguage, } } - if ( newKeywords != NULL) + if ( newKeywords != nullptr) { ksize = (int32_t)uprv_strlen(newKeywords); if ( ksize < 0 || ksize > ULOC_STRING_LIMIT ) { @@ -358,8 +356,7 @@ Locale::Locale( const char * newLanguage, } } - // NOW we have the full locale string.. - // Now, copy it back. + // We've checked the input sizes, now build up the full locale string.. // newLanguage is already copied @@ -400,17 +397,17 @@ Locale::Locale( const char * newLanguage, } // Parse it, because for example 'language' might really be a complete // string. - init(togo.data(), FALSE); + init(togo.data(), false); } } Locale::Locale(const Locale &other) - : UObject(other), fullName(fullNameBuffer), baseName(NULL) + : UObject(other), fullName(fullNameBuffer), baseName(nullptr) { *this = other; } -Locale::Locale(Locale&& other) U_NOEXCEPT +Locale::Locale(Locale&& other) noexcept : UObject(other), fullName(fullNameBuffer), baseName(fullName) { *this = std::move(other); } @@ -448,18 +445,22 @@ Locale& Locale::operator=(const Locale& other) { return *this; } -Locale& Locale::operator=(Locale&& other) U_NOEXCEPT { - if (baseName != fullName) uprv_free(baseName); +Locale& Locale::operator=(Locale&& other) noexcept { + if ((baseName != fullName) && (baseName != fullNameBuffer)) uprv_free(baseName); if (fullName != fullNameBuffer) uprv_free(fullName); - if (other.fullName == other.fullNameBuffer) { + if (other.fullName == other.fullNameBuffer || other.baseName == other.fullNameBuffer) { uprv_strcpy(fullNameBuffer, other.fullNameBuffer); + } + if (other.fullName == other.fullNameBuffer) { fullName = fullNameBuffer; } else { fullName = other.fullName; } - if (other.baseName == other.fullName) { + if (other.baseName == other.fullNameBuffer) { + baseName = fullNameBuffer; + } else if (other.baseName == other.fullName) { baseName = fullName; } else { baseName = other.baseName; @@ -488,17 +489,1353 @@ Locale::operator==( const Locale& other) const return (uprv_strcmp(other.fullName, fullName) == 0); } -#define ISASCIIALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) +namespace { + +UInitOnce gKnownCanonicalizedInitOnce {}; +UHashtable *gKnownCanonicalized = nullptr; + +static const char* const KNOWN_CANONICALIZED[] = { + "c", + // Commonly used locales known are already canonicalized + "af", "af_ZA", "am", "am_ET", "ar", "ar_001", "as", "as_IN", "az", "az_AZ", + "be", "be_BY", "bg", "bg_BG", "bn", "bn_IN", "bs", "bs_BA", "ca", "ca_ES", + "cs", "cs_CZ", "cy", "cy_GB", "da", "da_DK", "de", "de_DE", "el", "el_GR", + "en", "en_GB", "en_US", "es", "es_419", "es_ES", "et", "et_EE", "eu", + "eu_ES", "fa", "fa_IR", "fi", "fi_FI", "fil", "fil_PH", "fr", "fr_FR", + "ga", "ga_IE", "gl", "gl_ES", "gu", "gu_IN", "he", "he_IL", "hi", "hi_IN", + "hr", "hr_HR", "hu", "hu_HU", "hy", "hy_AM", "id", "id_ID", "is", "is_IS", + "it", "it_IT", "ja", "ja_JP", "jv", "jv_ID", "ka", "ka_GE", "kk", "kk_KZ", + "km", "km_KH", "kn", "kn_IN", "ko", "ko_KR", "ky", "ky_KG", "lo", "lo_LA", + "lt", "lt_LT", "lv", "lv_LV", "mk", "mk_MK", "ml", "ml_IN", "mn", "mn_MN", + "mr", "mr_IN", "ms", "ms_MY", "my", "my_MM", "nb", "nb_NO", "ne", "ne_NP", + "nl", "nl_NL", "no", "or", "or_IN", "pa", "pa_IN", "pl", "pl_PL", "ps", "ps_AF", + "pt", "pt_BR", "pt_PT", "ro", "ro_RO", "ru", "ru_RU", "sd", "sd_IN", "si", + "si_LK", "sk", "sk_SK", "sl", "sl_SI", "so", "so_SO", "sq", "sq_AL", "sr", + "sr_Cyrl_RS", "sr_Latn", "sr_RS", "sv", "sv_SE", "sw", "sw_TZ", "ta", + "ta_IN", "te", "te_IN", "th", "th_TH", "tk", "tk_TM", "tr", "tr_TR", "uk", + "uk_UA", "ur", "ur_PK", "uz", "uz_UZ", "vi", "vi_VN", "yue", "yue_Hant", + "yue_Hant_HK", "yue_HK", "zh", "zh_CN", "zh_Hans", "zh_Hans_CN", "zh_Hant", + "zh_Hant_TW", "zh_TW", "zu", "zu_ZA" +}; + +static UBool U_CALLCONV cleanupKnownCanonicalized() { + gKnownCanonicalizedInitOnce.reset(); + if (gKnownCanonicalized) { uhash_close(gKnownCanonicalized); } + return true; +} + +static void U_CALLCONV loadKnownCanonicalized(UErrorCode &status) { + ucln_common_registerCleanup(UCLN_COMMON_LOCALE_KNOWN_CANONICALIZED, + cleanupKnownCanonicalized); + LocalUHashtablePointer newKnownCanonicalizedMap( + uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status)); + for (int32_t i = 0; + U_SUCCESS(status) && i < UPRV_LENGTHOF(KNOWN_CANONICALIZED); + i++) { + uhash_puti(newKnownCanonicalizedMap.getAlias(), + (void*)KNOWN_CANONICALIZED[i], + 1, &status); + } + if (U_FAILURE(status)) { + return; + } + + gKnownCanonicalized = newKnownCanonicalizedMap.orphan(); +} + +class AliasData; + +/** + * A Builder class to build the alias data. + */ +class AliasDataBuilder { +public: + AliasDataBuilder() { + } + + // Build the AliasData from resource. + AliasData* build(UErrorCode &status); + +private: + void readAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + void (*checkType)(const char* type), + void (*checkReplacement)(const UChar* replacement), + UErrorCode &status); + + // Read the languageAlias data from alias to + // strings+types+replacementIndexes + // The number of record will be stored into length. + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement script. + void readLanguageAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status); + + // Read the scriptAlias data from alias to + // strings+types+replacementIndexes + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement script. + void readScriptAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, UErrorCode &status); + + // Read the territoryAlias data from alias to + // strings+types+replacementIndexes + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement script. + void readTerritoryAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, UErrorCode &status); + + // Read the variantAlias data from alias to + // strings+types+replacementIndexes + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement variant. + void readVariantAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, UErrorCode &status); + + // Read the subdivisionAlias data from alias to + // strings+types+replacementIndexes + // Allocate length items for types, to store the type field. + // Allocate length items for replacementIndexes, + // to store the index in the strings for the replacement variant. + void readSubdivisionAlias(UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, UErrorCode &status); +}; + +/** + * A class to hold the Alias Data. + */ +class AliasData : public UMemory { +public: + static const AliasData* singleton(UErrorCode& status) { + if (U_FAILURE(status)) { + // Do not get into loadData if the status already has error. + return nullptr; + } + umtx_initOnce(AliasData::gInitOnce, &AliasData::loadData, status); + return gSingleton; + } + + const CharStringMap& languageMap() const { return language; } + const CharStringMap& scriptMap() const { return script; } + const CharStringMap& territoryMap() const { return territory; } + const CharStringMap& variantMap() const { return variant; } + const CharStringMap& subdivisionMap() const { return subdivision; } + + static void U_CALLCONV loadData(UErrorCode &status); + static UBool U_CALLCONV cleanup(); + + static UInitOnce gInitOnce; + +private: + AliasData(CharStringMap languageMap, + CharStringMap scriptMap, + CharStringMap territoryMap, + CharStringMap variantMap, + CharStringMap subdivisionMap, + CharString* strings) + : language(std::move(languageMap)), + script(std::move(scriptMap)), + territory(std::move(territoryMap)), + variant(std::move(variantMap)), + subdivision(std::move(subdivisionMap)), + strings(strings) { + } + + ~AliasData() { + delete strings; + } + + static const AliasData* gSingleton; + + CharStringMap language; + CharStringMap script; + CharStringMap territory; + CharStringMap variant; + CharStringMap subdivision; + CharString* strings; + + friend class AliasDataBuilder; +}; + + +const AliasData* AliasData::gSingleton = nullptr; +UInitOnce AliasData::gInitOnce {}; + +UBool U_CALLCONV +AliasData::cleanup() +{ + gInitOnce.reset(); + delete gSingleton; + return true; +} + +void +AliasDataBuilder::readAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + void (*checkType)(const char* type), + void (*checkReplacement)(const UChar* replacement), + UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + length = ures_getSize(alias); + const char** rawTypes = types.allocateInsteadAndCopy(length); + if (rawTypes == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + int32_t* rawIndexes = replacementIndexes.allocateInsteadAndCopy(length); + if (rawIndexes == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + for (int i = 0; U_SUCCESS(status) && ures_hasNext(alias); i++) { + LocalUResourceBundlePointer res( + ures_getNextResource(alias, nullptr, &status)); + const char* aliasFrom = ures_getKey(res.getAlias()); + const UChar* aliasTo = + ures_getStringByKey(res.getAlias(), "replacement", nullptr, &status); + if (U_FAILURE(status)) return; + + checkType(aliasFrom); + checkReplacement(aliasTo); + + rawTypes[i] = aliasFrom; + rawIndexes[i] = strings->add(aliasTo, status); + } +} + +/** + * Read the languageAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement language. + */ +void +AliasDataBuilder::readLanguageAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + // Assert the aliasFrom only contains the following possibilities + // language_REGION_variant + // language_REGION + // language_variant + // language + // und_variant + Locale test(type); + // Assert no script in aliasFrom + U_ASSERT(test.getScript()[0] == '\0'); + // Assert when language is und, no REGION in aliasFrom. + U_ASSERT(test.getLanguage()[0] != '\0' || test.getCountry()[0] == '\0'); + }, +#else + [](const char*) {}, +#endif + [](const UChar*) {}, status); +} + +/** + * Read the scriptAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement script. + */ +void +AliasDataBuilder::readScriptAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + U_ASSERT(uprv_strlen(type) == 4); + }, + [](const UChar* replacement) { + U_ASSERT(u_strlen(replacement) == 4); + }, +#else + [](const char*) {}, + [](const UChar*) { }, +#endif + status); +} + +/** + * Read the territoryAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement regions. + */ +void +AliasDataBuilder::readTerritoryAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + U_ASSERT(uprv_strlen(type) == 2 || uprv_strlen(type) == 3); + }, +#else + [](const char*) {}, +#endif + [](const UChar*) { }, + status); +} + +/** + * Read the variantAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement variant. + */ +void +AliasDataBuilder::readVariantAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + U_ASSERT(uprv_strlen(type) >= 4 && uprv_strlen(type) <= 8); + U_ASSERT(uprv_strlen(type) != 4 || + (type[0] >= '0' && type[0] <= '9')); + }, + [](const UChar* replacement) { + int32_t len = u_strlen(replacement); + U_ASSERT(len >= 4 && len <= 8); + U_ASSERT(len != 4 || + (*replacement >= u'0' && + *replacement <= u'9')); + }, +#else + [](const char*) {}, + [](const UChar*) { }, +#endif + status); +} + +/** + * Read the subdivisionAlias data from alias to strings+types+replacementIndexes. + * Allocate length items for types, to store the type field. Allocate length + * items for replacementIndexes, to store the index in the strings for the + * replacement regions. + */ +void +AliasDataBuilder::readSubdivisionAlias( + UResourceBundle* alias, + UniqueCharStrings* strings, + LocalMemory& types, + LocalMemory& replacementIndexes, + int32_t &length, + UErrorCode &status) +{ + return readAlias( + alias, strings, types, replacementIndexes, length, +#if U_DEBUG + [](const char* type) { + U_ASSERT(uprv_strlen(type) >= 3 && uprv_strlen(type) <= 8); + }, +#else + [](const char*) {}, +#endif + [](const UChar*) { }, + status); +} + +/** + * Initializes the alias data from the ICU resource bundles. The alias data + * contains alias of language, country, script and variants. + * + * If the alias data has already loaded, then this method simply returns without + * doing anything meaningful. + */ +void U_CALLCONV +AliasData::loadData(UErrorCode &status) +{ +#ifdef LOCALE_CANONICALIZATION_DEBUG + UDate start = uprv_getRawUTCtime(); +#endif // LOCALE_CANONICALIZATION_DEBUG + ucln_common_registerCleanup(UCLN_COMMON_LOCALE_ALIAS, cleanup); + AliasDataBuilder builder; + gSingleton = builder.build(status); +#ifdef LOCALE_CANONICALIZATION_DEBUG + UDate end = uprv_getRawUTCtime(); + printf("AliasData::loadData took total %f ms\n", end - start); +#endif // LOCALE_CANONICALIZATION_DEBUG +} + +/** + * Build the alias data from resources. + */ +AliasData* +AliasDataBuilder::build(UErrorCode &status) { + LocalUResourceBundlePointer metadata( + ures_openDirect(nullptr, "metadata", &status)); + LocalUResourceBundlePointer metadataAlias( + ures_getByKey(metadata.getAlias(), "alias", nullptr, &status)); + LocalUResourceBundlePointer languageAlias( + ures_getByKey(metadataAlias.getAlias(), "language", nullptr, &status)); + LocalUResourceBundlePointer scriptAlias( + ures_getByKey(metadataAlias.getAlias(), "script", nullptr, &status)); + LocalUResourceBundlePointer territoryAlias( + ures_getByKey(metadataAlias.getAlias(), "territory", nullptr, &status)); + LocalUResourceBundlePointer variantAlias( + ures_getByKey(metadataAlias.getAlias(), "variant", nullptr, &status)); + LocalUResourceBundlePointer subdivisionAlias( + ures_getByKey(metadataAlias.getAlias(), "subdivision", nullptr, &status)); + + if (U_FAILURE(status)) { + return nullptr; + } + int32_t languagesLength = 0, scriptLength = 0, territoryLength = 0, + variantLength = 0, subdivisionLength = 0; + + // Read the languageAlias into languageTypes, languageReplacementIndexes + // and strings + UniqueCharStrings strings(status); + LocalMemory languageTypes; + LocalMemory languageReplacementIndexes; + readLanguageAlias(languageAlias.getAlias(), + &strings, + languageTypes, + languageReplacementIndexes, + languagesLength, + status); + + // Read the scriptAlias into scriptTypes, scriptReplacementIndexes + // and strings + LocalMemory scriptTypes; + LocalMemory scriptReplacementIndexes; + readScriptAlias(scriptAlias.getAlias(), + &strings, + scriptTypes, + scriptReplacementIndexes, + scriptLength, + status); + + // Read the territoryAlias into territoryTypes, territoryReplacementIndexes + // and strings + LocalMemory territoryTypes; + LocalMemory territoryReplacementIndexes; + readTerritoryAlias(territoryAlias.getAlias(), + &strings, + territoryTypes, + territoryReplacementIndexes, + territoryLength, status); + + // Read the variantAlias into variantTypes, variantReplacementIndexes + // and strings + LocalMemory variantTypes; + LocalMemory variantReplacementIndexes; + readVariantAlias(variantAlias.getAlias(), + &strings, + variantTypes, + variantReplacementIndexes, + variantLength, status); + + // Read the subdivisionAlias into subdivisionTypes, subdivisionReplacementIndexes + // and strings + LocalMemory subdivisionTypes; + LocalMemory subdivisionReplacementIndexes; + readSubdivisionAlias(subdivisionAlias.getAlias(), + &strings, + subdivisionTypes, + subdivisionReplacementIndexes, + subdivisionLength, status); + + if (U_FAILURE(status)) { + return nullptr; + } + + // We can only use strings after freeze it. + strings.freeze(); + + // Build the languageMap from languageTypes & languageReplacementIndexes + CharStringMap languageMap(490, status); + for (int32_t i = 0; U_SUCCESS(status) && i < languagesLength; i++) { + languageMap.put(languageTypes[i], + strings.get(languageReplacementIndexes[i]), + status); + } + + // Build the scriptMap from scriptTypes & scriptReplacementIndexes + CharStringMap scriptMap(1, status); + for (int32_t i = 0; U_SUCCESS(status) && i < scriptLength; i++) { + scriptMap.put(scriptTypes[i], + strings.get(scriptReplacementIndexes[i]), + status); + } + + // Build the territoryMap from territoryTypes & territoryReplacementIndexes + CharStringMap territoryMap(650, status); + for (int32_t i = 0; U_SUCCESS(status) && i < territoryLength; i++) { + territoryMap.put(territoryTypes[i], + strings.get(territoryReplacementIndexes[i]), + status); + } + + // Build the variantMap from variantTypes & variantReplacementIndexes. + CharStringMap variantMap(2, status); + for (int32_t i = 0; U_SUCCESS(status) && i < variantLength; i++) { + variantMap.put(variantTypes[i], + strings.get(variantReplacementIndexes[i]), + status); + } + + // Build the subdivisionMap from subdivisionTypes & subdivisionReplacementIndexes. + CharStringMap subdivisionMap(2, status); + for (int32_t i = 0; U_SUCCESS(status) && i < subdivisionLength; i++) { + subdivisionMap.put(subdivisionTypes[i], + strings.get(subdivisionReplacementIndexes[i]), + status); + } + + if (U_FAILURE(status)) { + return nullptr; + } + + // copy hashtables + auto *data = new AliasData( + std::move(languageMap), + std::move(scriptMap), + std::move(territoryMap), + std::move(variantMap), + std::move(subdivisionMap), + strings.orphanCharStrings()); + + if (data == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + return data; +} + +/** + * A class that find the replacement values of locale fields by using AliasData. + */ +class AliasReplacer { +public: + AliasReplacer(UErrorCode status) : + language(nullptr), script(nullptr), region(nullptr), + extensions(nullptr), + // store value in variants only once + variants(nullptr, + ([](UElement e1, UElement e2) -> UBool { + return 0==uprv_strcmp((const char*)e1.pointer, + (const char*)e2.pointer);}), + status), + data(nullptr) { + } + ~AliasReplacer() { + } + + // Check the fields inside locale, if need to replace fields, + // place the the replaced locale ID in out and return true. + // Otherwise return false for no replacement or error. + bool replace( + const Locale& locale, CharString& out, UErrorCode& status); + +private: + const char* language; + const char* script; + const char* region; + const char* extensions; + UVector variants; + + const AliasData* data; + + inline bool notEmpty(const char* str) { + return str && str[0] != NULL_CHAR; + } + + /** + * If replacement is neither null nor empty and input is either null or empty, + * return replacement. + * If replacement is neither null nor empty but input is not empty, return input. + * If replacement is either null or empty and type is either null or empty, + * return input. + * Otherwise return null. + * replacement input type return + * AAA nullptr * AAA + * AAA BBB * BBB + * nullptr || "" CCC nullptr CCC + * nullptr || "" * DDD nullptr + */ + inline const char* deleteOrReplace( + const char* input, const char* type, const char* replacement) { + return notEmpty(replacement) ? + ((input == nullptr) ? replacement : input) : + ((type == nullptr) ? input : nullptr); + } + + inline bool same(const char* a, const char* b) { + if (a == nullptr && b == nullptr) { + return true; + } + if ((a == nullptr && b != nullptr) || + (a != nullptr && b == nullptr)) { + return false; + } + return uprv_strcmp(a, b) == 0; + } + + // Gather fields and generate locale ID into out. + CharString& outputToString(CharString& out, UErrorCode status); + + // Generate the lookup key. + CharString& generateKey(const char* language, const char* region, + const char* variant, CharString& out, + UErrorCode status); + + void parseLanguageReplacement(const char* replacement, + const char*& replaceLanguage, + const char*& replaceScript, + const char*& replaceRegion, + const char*& replaceVariant, + const char*& replaceExtensions, + UVector& toBeFreed, + UErrorCode& status); + + // Replace by using languageAlias. + bool replaceLanguage(bool checkLanguage, bool checkRegion, + bool checkVariants, UVector& toBeFreed, + UErrorCode& status); + + // Replace by using territoryAlias. + bool replaceTerritory(UVector& toBeFreed, UErrorCode& status); + + // Replace by using scriptAlias. + bool replaceScript(UErrorCode& status); + + // Replace by using variantAlias. + bool replaceVariant(UErrorCode& status); + + // Replace by using subdivisionAlias. + bool replaceSubdivision(StringPiece subdivision, + CharString& output, UErrorCode& status); + + // Replace transformed extensions. + bool replaceTransformedExtensions( + CharString& transformedExtensions, CharString& output, UErrorCode& status); +}; + +CharString& +AliasReplacer::generateKey( + const char* language, const char* region, const char* variant, + CharString& out, UErrorCode status) +{ + out.append(language, status); + if (notEmpty(region)) { + out.append(SEP_CHAR, status) + .append(region, status); + } + if (notEmpty(variant)) { + out.append(SEP_CHAR, status) + .append(variant, status); + } + return out; +} + +void +AliasReplacer::parseLanguageReplacement( + const char* replacement, + const char*& replacedLanguage, + const char*& replacedScript, + const char*& replacedRegion, + const char*& replacedVariant, + const char*& replacedExtensions, + UVector& toBeFreed, + UErrorCode& status) +{ + if (U_FAILURE(status)) { + return; + } + replacedScript = replacedRegion = replacedVariant + = replacedExtensions = nullptr; + if (uprv_strchr(replacement, '_') == nullptr) { + replacedLanguage = replacement; + // reach the end, just return it. + return; + } + // We have multiple field so we have to allocate and parse + CharString* str = new CharString( + replacement, (int32_t)uprv_strlen(replacement), status); + LocalPointer lpStr(str, status); + toBeFreed.adoptElement(lpStr.orphan(), status); + if (U_FAILURE(status)) { + return; + } + char* data = str->data(); + replacedLanguage = (const char*) data; + char* endOfField = uprv_strchr(data, '_'); + *endOfField = '\0'; // null terminiate it. + endOfField++; + const char* start = endOfField; + endOfField = (char*) uprv_strchr(start, '_'); + size_t len = 0; + if (endOfField == nullptr) { + len = uprv_strlen(start); + } else { + len = endOfField - start; + *endOfField = '\0'; // null terminiate it. + } + if (len == 4 && uprv_isASCIILetter(*start)) { + // Got a script + replacedScript = start; + if (endOfField == nullptr) { + return; + } + start = endOfField++; + endOfField = (char*)uprv_strchr(start, '_'); + if (endOfField == nullptr) { + len = uprv_strlen(start); + } else { + len = endOfField - start; + *endOfField = '\0'; // null terminiate it. + } + } + if (len >= 2 && len <= 3) { + // Got a region + replacedRegion = start; + if (endOfField == nullptr) { + return; + } + start = endOfField++; + endOfField = (char*)uprv_strchr(start, '_'); + if (endOfField == nullptr) { + len = uprv_strlen(start); + } else { + len = endOfField - start; + *endOfField = '\0'; // null terminiate it. + } + } + if (len >= 4) { + // Got a variant + replacedVariant = start; + if (endOfField == nullptr) { + return; + } + start = endOfField++; + } + replacedExtensions = start; +} + +bool +AliasReplacer::replaceLanguage( + bool checkLanguage, bool checkRegion, + bool checkVariants, UVector& toBeFreed, UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + if ( (checkRegion && region == nullptr) || + (checkVariants && variants.size() == 0)) { + // Nothing to search. + return false; + } + int32_t variant_size = checkVariants ? variants.size() : 1; + // Since we may have more than one variant, we need to loop through them. + const char* searchLanguage = checkLanguage ? language : "und"; + const char* searchRegion = checkRegion ? region : nullptr; + const char* searchVariant = nullptr; + for (int32_t variant_index = 0; + variant_index < variant_size; + variant_index++) { + if (checkVariants) { + U_ASSERT(variant_index < variant_size); + searchVariant = (const char*)(variants.elementAt(variant_index)); + } + + if (searchVariant != nullptr && uprv_strlen(searchVariant) < 4) { + // Do not consider ill-formed variant subtag. + searchVariant = nullptr; + } + CharString typeKey; + generateKey(searchLanguage, searchRegion, searchVariant, typeKey, + status); + if (U_FAILURE(status)) { + return false; + } + const char *replacement = data->languageMap().get(typeKey.data()); + if (replacement == nullptr) { + // Found no replacement data. + continue; + } + + const char* replacedLanguage = nullptr; + const char* replacedScript = nullptr; + const char* replacedRegion = nullptr; + const char* replacedVariant = nullptr; + const char* replacedExtensions = nullptr; + parseLanguageReplacement(replacement, + replacedLanguage, + replacedScript, + replacedRegion, + replacedVariant, + replacedExtensions, + toBeFreed, + status); + replacedLanguage = + (replacedLanguage != nullptr && uprv_strcmp(replacedLanguage, "und") == 0) ? + language : replacedLanguage; + replacedScript = deleteOrReplace(script, nullptr, replacedScript); + replacedRegion = deleteOrReplace(region, searchRegion, replacedRegion); + replacedVariant = deleteOrReplace( + searchVariant, searchVariant, replacedVariant); + + if ( same(language, replacedLanguage) && + same(script, replacedScript) && + same(region, replacedRegion) && + same(searchVariant, replacedVariant) && + replacedExtensions == nullptr) { + // Replacement produce no changes. + continue; + } + + language = replacedLanguage; + region = replacedRegion; + script = replacedScript; + if (searchVariant != nullptr) { + if (notEmpty(replacedVariant)) { + variants.setElementAt((void*)replacedVariant, variant_index); + } else { + variants.removeElementAt(variant_index); + } + } + if (replacedExtensions != nullptr) { + // DO NOTHING + // UTS35 does not specify what should we do if we have extensions in the + // replacement. Currently we know only the following 4 "BCP47 LegacyRules" have + // extensions in them languageAlias: + // i_default => en_x_i_default + // i_enochian => und_x_i_enochian + // i_mingo => see_x_i_mingo + // zh_min => nan_x_zh_min + // But all of them are already changed by code inside ultag_parse() before + // hitting this code. + } + + // Something changed by language alias data. + return true; + } + // Nothing changed by language alias data. + return false; +} + +bool +AliasReplacer::replaceTerritory(UVector& toBeFreed, UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + if (region == nullptr) { + // No region to search. + return false; + } + const char *replacement = data->territoryMap().get(region); + if (replacement == nullptr) { + // Found no replacement data for this region. + return false; + } + const char* replacedRegion = replacement; + const char* firstSpace = uprv_strchr(replacement, ' '); + if (firstSpace != nullptr) { + // If there are are more than one region in the replacement. + // We need to check which one match based on the language. + // Cannot use nullptr for language because that will construct + // the default locale, in that case, use "und" to get the correct + // locale. + Locale l = LocaleBuilder() + .setLanguage(language == nullptr ? "und" : language) + .setScript(script) + .build(status); + l.addLikelySubtags(status); + const char* likelyRegion = l.getCountry(); + LocalPointer item; + if (likelyRegion != nullptr && uprv_strlen(likelyRegion) > 0) { + size_t len = uprv_strlen(likelyRegion); + const char* foundInReplacement = uprv_strstr(replacement, + likelyRegion); + if (foundInReplacement != nullptr) { + // Assuming the case there are no three letter region code in + // the replacement of territoryAlias + U_ASSERT(foundInReplacement == replacement || + *(foundInReplacement-1) == ' '); + U_ASSERT(foundInReplacement[len] == ' ' || + foundInReplacement[len] == '\0'); + item.adoptInsteadAndCheckErrorCode( + new CharString(foundInReplacement, (int32_t)len, status), status); + } + } + if (item.isNull() && U_SUCCESS(status)) { + item.adoptInsteadAndCheckErrorCode( + new CharString(replacement, + (int32_t)(firstSpace - replacement), status), status); + } + if (U_FAILURE(status)) { return false; } + replacedRegion = item->data(); + toBeFreed.adoptElement(item.orphan(), status); + if (U_FAILURE(status)) { return false; } + } + U_ASSERT(!same(region, replacedRegion)); + region = replacedRegion; + // The region is changed by data in territory alias. + return true; +} + +bool +AliasReplacer::replaceScript(UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + if (script == nullptr) { + // No script to search. + return false; + } + const char *replacement = data->scriptMap().get(script); + if (replacement == nullptr) { + // Found no replacement data for this script. + return false; + } + U_ASSERT(!same(script, replacement)); + script = replacement; + // The script is changed by data in script alias. + return true; +} + +bool +AliasReplacer::replaceVariant(UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + // Since we may have more than one variant, we need to loop through them. + for (int32_t i = 0; i < variants.size(); i++) { + const char *variant = (const char*)(variants.elementAt(i)); + const char *replacement = data->variantMap().get(variant); + if (replacement == nullptr) { + // Found no replacement data for this variant. + continue; + } + U_ASSERT((uprv_strlen(replacement) >= 5 && + uprv_strlen(replacement) <= 8) || + (uprv_strlen(replacement) == 4 && + replacement[0] >= '0' && + replacement[0] <= '9')); + if (!same(variant, replacement)) { + variants.setElementAt((void*)replacement, i); + // Special hack to handle hepburn-heploc => alalc97 + if (uprv_strcmp(variant, "heploc") == 0) { + for (int32_t j = 0; j < variants.size(); j++) { + if (uprv_strcmp((const char*)(variants.elementAt(j)), + "hepburn") == 0) { + variants.removeElementAt(j); + } + } + } + return true; + } + } + return false; +} + +bool +AliasReplacer::replaceSubdivision( + StringPiece subdivision, CharString& output, UErrorCode& status) +{ + if (U_FAILURE(status)) { + return false; + } + const char *replacement = data->subdivisionMap().get(subdivision.data()); + if (replacement != nullptr) { + const char* firstSpace = uprv_strchr(replacement, ' '); + // Found replacement data for this subdivision. + size_t len = (firstSpace != nullptr) ? + (firstSpace - replacement) : uprv_strlen(replacement); + if (2 <= len && len <= 8) { + output.append(replacement, (int32_t)len, status); + if (2 == len) { + // Add 'zzzz' based on changes to UTS #35 for CLDR-14312. + output.append("zzzz", 4, status); + } + } + return true; + } + return false; +} + +bool +AliasReplacer::replaceTransformedExtensions( + CharString& transformedExtensions, CharString& output, UErrorCode& status) +{ + // The content of the transformedExtensions will be modified in this + // function to NUL-terminating (tkey-tvalue) pairs. + if (U_FAILURE(status)) { + return false; + } + int32_t len = transformedExtensions.length(); + const char* str = transformedExtensions.data(); + const char* tkey = ultag_getTKeyStart(str); + int32_t tlangLen = (tkey == str) ? 0 : + ((tkey == nullptr) ? len : static_cast((tkey - str - 1))); + CharStringByteSink sink(&output); + if (tlangLen > 0) { + Locale tlang = LocaleBuilder() + .setLanguageTag(StringPiece(str, tlangLen)) + .build(status); + tlang.canonicalize(status); + tlang.toLanguageTag(sink, status); + if (U_FAILURE(status)) { + return false; + } + T_CString_toLowerCase(output.data()); + } + if (tkey != nullptr) { + // We need to sort the tfields by tkey + UVector tfields(status); + if (U_FAILURE(status)) { + return false; + } + do { + const char* tvalue = uprv_strchr(tkey, '-'); + if (tvalue == nullptr) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return false; + } + const char* nextTKey = ultag_getTKeyStart(tvalue); + if (nextTKey != nullptr) { + *((char*)(nextTKey-1)) = '\0'; // NUL terminate tvalue + } + tfields.insertElementAt((void*)tkey, tfields.size(), status); + if (U_FAILURE(status)) { + return false; + } + tkey = nextTKey; + } while (tkey != nullptr); + tfields.sort([](UElement e1, UElement e2) -> int32_t { + return uprv_strcmp((const char*)e1.pointer, (const char*)e2.pointer); + }, status); + for (int32_t i = 0; i < tfields.size(); i++) { + if (output.length() > 0) { + output.append('-', status); + } + const char* tfield = (const char*) tfields.elementAt(i); + const char* tvalue = uprv_strchr(tfield, '-'); + if (tvalue == nullptr) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return false; + } + // Split the "tkey-tvalue" pair string so that we can canonicalize the tvalue. + *((char*)tvalue++) = '\0'; // NUL terminate tkey + output.append(tfield, status).append('-', status); + const char* bcpTValue = ulocimp_toBcpType(tfield, tvalue, nullptr, nullptr); + output.append((bcpTValue == nullptr) ? tvalue : bcpTValue, status); + } + } + if (U_FAILURE(status)) { + return false; + } + return true; +} + +CharString& +AliasReplacer::outputToString( + CharString& out, UErrorCode status) +{ + out.append(language, status); + if (notEmpty(script)) { + out.append(SEP_CHAR, status) + .append(script, status); + } + if (notEmpty(region)) { + out.append(SEP_CHAR, status) + .append(region, status); + } + if (variants.size() > 0) { + if (!notEmpty(script) && !notEmpty(region)) { + out.append(SEP_CHAR, status); + } + variants.sort([](UElement e1, UElement e2) -> int32_t { + return uprv_strcmp((const char*)e1.pointer, (const char*)e2.pointer); + }, status); + int32_t variantsStart = out.length(); + for (int32_t i = 0; i < variants.size(); i++) { + out.append(SEP_CHAR, status) + .append((const char*)(variants.elementAt(i)), + status); + } + T_CString_toUpperCase(out.data() + variantsStart); + } + if (notEmpty(extensions)) { + CharString tmp("und_", status); + tmp.append(extensions, status); + Locale tmpLocale(tmp.data()); + // only support x extension inside CLDR for now. + U_ASSERT(extensions[0] == 'x'); + out.append(tmpLocale.getName() + 1, status); + } + return out; +} + +bool +AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode& status) +{ + data = AliasData::singleton(status); + if (U_FAILURE(status)) { + return false; + } + U_ASSERT(data != nullptr); + out.clear(); + language = locale.getLanguage(); + if (!notEmpty(language)) { + language = nullptr; + } + script = locale.getScript(); + if (!notEmpty(script)) { + script = nullptr; + } + region = locale.getCountry(); + if (!notEmpty(region)) { + region = nullptr; + } + const char* variantsStr = locale.getVariant(); + CharString variantsBuff(variantsStr, -1, status); + if (!variantsBuff.isEmpty()) { + if (U_FAILURE(status)) { return false; } + char* start = variantsBuff.data(); + T_CString_toLowerCase(start); + char* end; + while ((end = uprv_strchr(start, SEP_CHAR)) != nullptr && + U_SUCCESS(status)) { + *end = NULL_CHAR; // null terminate inside variantsBuff + // do not add "" or duplicate data to variants + if (*start && !variants.contains(start)) { + variants.addElement(start, status); + } + start = end + 1; + } + // do not add "" or duplicate data to variants + if (*start && !variants.contains(start)) { + variants.addElement(start, status); + } + } + if (U_FAILURE(status)) { return false; } + + // Sort the variants + variants.sort([](UElement e1, UElement e2) -> int32_t { + return uprv_strcmp((const char*)e1.pointer, (const char*)e2.pointer); + }, status); + + // A changed count to assert when loop too many times. + int changed = 0; + // A UVector to to hold CharString allocated by the replace* method + // and freed when out of scope from his function. + UVector stringsToBeFreed([](void *obj){ delete ((CharString*) obj); }, + nullptr, 10, status); + while (U_SUCCESS(status)) { + // Something wrong with the data cause looping here more than 10 times + // already. + U_ASSERT(changed < 5); + // From observation of key in data/misc/metadata.txt + // we know currently we only need to search in the following combination + // of fields for type in languageAlias: + // * lang_region_variant + // * lang_region + // * lang_variant + // * lang + // * und_variant + // This assumption is ensured by the U_ASSERT in readLanguageAlias + // + // lang REGION variant + if ( replaceLanguage(true, true, true, stringsToBeFreed, status) || + replaceLanguage(true, true, false, stringsToBeFreed, status) || + replaceLanguage(true, false, true, stringsToBeFreed, status) || + replaceLanguage(true, false, false, stringsToBeFreed, status) || + replaceLanguage(false,false, true, stringsToBeFreed, status) || + replaceTerritory(stringsToBeFreed, status) || + replaceScript(status) || + replaceVariant(status)) { + // Some values in data is changed, try to match from the beginning + // again. + changed++; + continue; + } + // Nothing changed. Break out. + break; + } // while(1) + + if (U_FAILURE(status)) { return false; } + // Nothing changed and we know the order of the variants are not change + // because we have no variant or only one. + const char* extensionsStr = locale_getKeywordsStart(locale.getName()); + if (changed == 0 && variants.size() <= 1 && extensionsStr == nullptr) { + return false; + } + outputToString(out, status); + if (U_FAILURE(status)) { + return false; + } + if (extensionsStr != nullptr) { + changed = 0; + Locale temp(locale); + LocalPointer iter(locale.createKeywords(status)); + if (U_SUCCESS(status) && !iter.isNull()) { + const char* key; + while ((key = iter->next(nullptr, status)) != nullptr) { + if (uprv_strcmp("sd", key) == 0 || uprv_strcmp("rg", key) == 0 || + uprv_strcmp("t", key) == 0) { + CharString value; + CharStringByteSink valueSink(&value); + locale.getKeywordValue(key, valueSink, status); + if (U_FAILURE(status)) { + status = U_ZERO_ERROR; + continue; + } + CharString replacement; + if (uprv_strlen(key) == 2) { + if (replaceSubdivision(value.toStringPiece(), replacement, status)) { + changed++; + temp.setKeywordValue(key, replacement.data(), status); + } + } else { + U_ASSERT(uprv_strcmp(key, "t") == 0); + if (replaceTransformedExtensions(value, replacement, status)) { + changed++; + temp.setKeywordValue(key, replacement.data(), status); + } + } + if (U_FAILURE(status)) { + return false; + } + } + } + } + if (changed != 0) { + extensionsStr = locale_getKeywordsStart(temp.getName()); + } + out.append(extensionsStr, status); + } + if (U_FAILURE(status)) { + return false; + } + // If the tag is not changed, return. + if (uprv_strcmp(out.data(), locale.getName()) == 0) { + out.clear(); + return false; + } + return true; +} + +// Return true if the locale is changed during canonicalization. +// The replaced value then will be put into out. +bool +canonicalizeLocale(const Locale& locale, CharString& out, UErrorCode& status) +{ + AliasReplacer replacer(status); + return replacer.replace(locale, out, status); +} + +// Function to optimize for known cases without so we can skip the loading +// of resources in the startup time until we really need it. +bool +isKnownCanonicalizedLocale(const char* locale, UErrorCode& status) +{ + if ( uprv_strcmp(locale, "c") == 0 || + uprv_strcmp(locale, "en") == 0 || + uprv_strcmp(locale, "en_US") == 0) { + return true; + } + + // common well-known Canonicalized. + umtx_initOnce(gKnownCanonicalizedInitOnce, + &loadKnownCanonicalized, status); + if (U_FAILURE(status)) { + return false; + } + U_ASSERT(gKnownCanonicalized != nullptr); + return uhash_geti(gKnownCanonicalized, locale) != 0; +} + +} // namespace + +// Function for testing. +U_CAPI const char* const* +ulocimp_getKnownCanonicalizedLocaleForTest(int32_t* length) +{ + *length = UPRV_LENGTHOF(KNOWN_CANONICALIZED); + return KNOWN_CANONICALIZED; +} + +// Function for testing. +U_CAPI bool +ulocimp_isCanonicalizedLocaleForTest(const char* localeName) +{ + Locale l(localeName); + UErrorCode status = U_ZERO_ERROR; + CharString temp; + return !canonicalizeLocale(l, temp, status) && U_SUCCESS(status); +} /*This function initializes a Locale from a C locale ID*/ Locale& Locale::init(const char* localeID, UBool canonicalize) { - fIsBogus = FALSE; + fIsBogus = false; /* Free our current storage */ - if (baseName != fullName) { + if ((baseName != fullName) && (baseName != fullNameBuffer)) { uprv_free(baseName); } - baseName = NULL; + baseName = nullptr; if(fullName != fullNameBuffer) { uprv_free(fullName); fullName = fullNameBuffer; @@ -516,7 +1853,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) int32_t length; UErrorCode err; - if(localeID == NULL) { + if(localeID == nullptr) { // not an error, just set the default locale return *this = getDefault(); } @@ -531,6 +1868,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) uloc_getName(localeID, fullName, sizeof(fullNameBuffer), &err); if(err == U_BUFFER_OVERFLOW_ERROR || length >= (int32_t)sizeof(fullNameBuffer)) { + U_ASSERT(baseName == nullptr); /*Go to heap for the fullName if necessary*/ fullName = (char *)uprv_malloc(sizeof(char)*(length + 1)); if(fullName == 0) { @@ -564,8 +1902,8 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) // variant may contain @foo or .foo POSIX cruft; remove it separator = uprv_strchr(field[fieldIdx-1], '@'); char* sep2 = uprv_strchr(field[fieldIdx-1], '.'); - if (separator!=NULL || sep2!=NULL) { - if (separator==NULL || (sep2!=NULL && separator > sep2)) { + if (separator!=nullptr || sep2!=nullptr) { + if (separator==nullptr || (sep2!=nullptr && separator > sep2)) { separator = sep2; } fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]); @@ -584,9 +1922,9 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) uprv_memcpy(language, fullName, fieldLen[0]); language[fieldLen[0]] = 0; } - if (fieldLen[1] == 4 && ISASCIIALPHA(field[1][0]) && - ISASCIIALPHA(field[1][1]) && ISASCIIALPHA(field[1][2]) && - ISASCIIALPHA(field[1][3])) { + if (fieldLen[1] == 4 && uprv_isASCIILetter(field[1][0]) && + uprv_isASCIILetter(field[1][1]) && uprv_isASCIILetter(field[1][2]) && + uprv_isASCIILetter(field[1][3])) { /* We have at least a script */ uprv_memcpy(script, field[1], fieldLen[1]); script[fieldLen[1]] = 0; @@ -613,6 +1951,21 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) break; } + if (canonicalize) { + if (!isKnownCanonicalizedLocale(fullName, err)) { + CharString replaced; + // Not sure it is already canonicalized + if (canonicalizeLocale(*this, replaced, err)) { + U_ASSERT(U_SUCCESS(err)); + // If need replacement, call init again. + init(replaced.data(), false); + } + if (U_FAILURE(err)) { + break; + } + } + } // if (canonicalize) { + // successful end of init() return *this; } while(0); /*loop doesn't iterate*/ @@ -634,14 +1987,14 @@ Locale::initBaseName(UErrorCode &status) { if (U_FAILURE(status)) { return; } - U_ASSERT(baseName==NULL || baseName==fullName); + U_ASSERT(baseName==nullptr || baseName==fullName); const char *atPtr = uprv_strchr(fullName, '@'); const char *eqPtr = uprv_strchr(fullName, '='); if (atPtr && eqPtr && atPtr < eqPtr) { // Key words exist. int32_t baseNameLength = (int32_t)(atPtr - fullName); baseName = (char *)uprv_malloc(baseNameLength + 1); - if (baseName == NULL) { + if (baseName == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -669,10 +2022,10 @@ Locale::hashCode() const void Locale::setToBogus() { /* Free our current storage */ - if(baseName != fullName) { + if((baseName != fullName) && (baseName != fullNameBuffer)) { uprv_free(baseName); } - baseName = NULL; + baseName = nullptr; if(fullName != fullNameBuffer) { uprv_free(fullName); fullName = fullNameBuffer; @@ -681,7 +2034,7 @@ Locale::setToBogus() { *language = 0; *script = 0; *country = 0; - fIsBogus = TRUE; + fIsBogus = true; variantBegin = 0; } @@ -690,12 +2043,12 @@ Locale::getDefault() { { Mutex lock(&gDefaultLocaleMutex); - if (gDefaultLocale != NULL) { + if (gDefaultLocale != nullptr) { return *gDefaultLocale; } } UErrorCode status = U_ZERO_ERROR; - return *locale_set_default_internal(NULL, status); + return *locale_set_default_internal(nullptr, status); } @@ -731,7 +2084,7 @@ Locale::addLikelySubtags(UErrorCode& status) { return; } - init(maximizedLocaleID.data(), /*canonicalize=*/FALSE); + init(maximizedLocaleID.data(), /*canonicalize=*/false); if (isBogus()) { status = U_ILLEGAL_ARGUMENT_ERROR; } @@ -739,6 +2092,10 @@ Locale::addLikelySubtags(UErrorCode& status) { void Locale::minimizeSubtags(UErrorCode& status) { + Locale::minimizeSubtags(false, status); +} +void +Locale::minimizeSubtags(bool favorScript, UErrorCode& status) { if (U_FAILURE(status)) { return; } @@ -746,14 +2103,33 @@ Locale::minimizeSubtags(UErrorCode& status) { CharString minimizedLocaleID; { CharStringByteSink sink(&minimizedLocaleID); - ulocimp_minimizeSubtags(fullName, sink, &status); + ulocimp_minimizeSubtags(fullName, sink, favorScript, &status); } if (U_FAILURE(status)) { return; } - init(minimizedLocaleID.data(), /*canonicalize=*/FALSE); + init(minimizedLocaleID.data(), /*canonicalize=*/false); + if (isBogus()) { + status = U_ILLEGAL_ARGUMENT_ERROR; + } +} + +void +Locale::canonicalize(UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (isBogus()) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } + CharString uncanonicalized(fullName, status); + if (U_FAILURE(status)) { + return; + } + init(uncanonicalized.data(), /*canonicalize=*/true); if (isBogus()) { status = U_ILLEGAL_ARGUMENT_ERROR; } @@ -768,13 +2144,14 @@ Locale::forLanguageTag(StringPiece tag, UErrorCode& status) return result; } - // If a BCP-47 language tag is passed as the language parameter to the + // 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 + // 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 + // legacy language tags (marked as “Type: grandfathered” in BCP 47, + // e.g., "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. @@ -799,7 +2176,7 @@ Locale::forLanguageTag(StringPiece tag, UErrorCode& status) return result; } - result.init(localeID.data(), /*canonicalize=*/FALSE); + result.init(localeID.data(), /*canonicalize=*/false); if (result.isBogus()) { status = U_ILLEGAL_ARGUMENT_ERROR; } @@ -818,7 +2195,7 @@ Locale::toLanguageTag(ByteSink& sink, UErrorCode& status) const return; } - ulocimp_toLanguageTag(fullName, sink, /*strict=*/FALSE, &status); + ulocimp_toLanguageTag(fullName, sink, /*strict=*/false, &status); } Locale U_EXPORT2 @@ -826,7 +2203,7 @@ Locale::createFromName (const char *name) { if (name) { Locale l(""); - l.init(name, FALSE); + l.init(name, false); return l; } else { @@ -837,7 +2214,7 @@ Locale::createFromName (const char *name) Locale U_EXPORT2 Locale::createCanonical(const char* name) { Locale loc(""); - loc.init(name, TRUE); + loc.init(name, true); return loc; } @@ -880,138 +2257,138 @@ const char* const* U_EXPORT2 Locale::getISOLanguages() // Set the locale's data based on a posix id. void Locale::setFromPOSIXID(const char *posixID) { - init(posixID, TRUE); + init(posixID, true); } const Locale & U_EXPORT2 -Locale::getRoot(void) +Locale::getRoot() { return getLocale(eROOT); } const Locale & U_EXPORT2 -Locale::getEnglish(void) +Locale::getEnglish() { return getLocale(eENGLISH); } const Locale & U_EXPORT2 -Locale::getFrench(void) +Locale::getFrench() { return getLocale(eFRENCH); } const Locale & U_EXPORT2 -Locale::getGerman(void) +Locale::getGerman() { return getLocale(eGERMAN); } const Locale & U_EXPORT2 -Locale::getItalian(void) +Locale::getItalian() { return getLocale(eITALIAN); } const Locale & U_EXPORT2 -Locale::getJapanese(void) +Locale::getJapanese() { return getLocale(eJAPANESE); } const Locale & U_EXPORT2 -Locale::getKorean(void) +Locale::getKorean() { return getLocale(eKOREAN); } const Locale & U_EXPORT2 -Locale::getChinese(void) +Locale::getChinese() { return getLocale(eCHINESE); } const Locale & U_EXPORT2 -Locale::getSimplifiedChinese(void) +Locale::getSimplifiedChinese() { return getLocale(eCHINA); } const Locale & U_EXPORT2 -Locale::getTraditionalChinese(void) +Locale::getTraditionalChinese() { return getLocale(eTAIWAN); } const Locale & U_EXPORT2 -Locale::getFrance(void) +Locale::getFrance() { return getLocale(eFRANCE); } const Locale & U_EXPORT2 -Locale::getGermany(void) +Locale::getGermany() { return getLocale(eGERMANY); } const Locale & U_EXPORT2 -Locale::getItaly(void) +Locale::getItaly() { return getLocale(eITALY); } const Locale & U_EXPORT2 -Locale::getJapan(void) +Locale::getJapan() { return getLocale(eJAPAN); } const Locale & U_EXPORT2 -Locale::getKorea(void) +Locale::getKorea() { return getLocale(eKOREA); } const Locale & U_EXPORT2 -Locale::getChina(void) +Locale::getChina() { return getLocale(eCHINA); } const Locale & U_EXPORT2 -Locale::getPRC(void) +Locale::getPRC() { return getLocale(eCHINA); } const Locale & U_EXPORT2 -Locale::getTaiwan(void) +Locale::getTaiwan() { return getLocale(eTAIWAN); } const Locale & U_EXPORT2 -Locale::getUK(void) +Locale::getUK() { return getLocale(eUK); } const Locale & U_EXPORT2 -Locale::getUS(void) +Locale::getUS() { return getLocale(eUS); } const Locale & U_EXPORT2 -Locale::getCanada(void) +Locale::getCanada() { return getLocale(eCANADA); } const Locale & U_EXPORT2 -Locale::getCanadaFrench(void) +Locale::getCanadaFrench() { return getLocale(eCANADA_FRENCH); } @@ -1021,12 +2398,12 @@ Locale::getLocale(int locid) { Locale *localeCache = getLocaleCache(); U_ASSERT((locid < eMAX_LOCALES)&&(locid>=0)); - if (localeCache == NULL) { + if (localeCache == nullptr) { // Failure allocating the locale cache. - // The best we can do is return a NULL reference. + // The best we can do is return a nullptr reference. locid = 0; } - return localeCache[locid]; /*operating on NULL*/ + return localeCache[locid]; /*operating on nullptr*/ } /* @@ -1034,7 +2411,7 @@ This function is defined this way in order to get around static initialization and static destruction. */ Locale * -Locale::getLocaleCache(void) +Locale::getLocaleCache() { UErrorCode status = U_ZERO_ERROR; umtx_initOnce(gLocaleCacheInitOnce, locale_init, status); @@ -1042,25 +2419,26 @@ Locale::getLocaleCache(void) } class KeywordEnumeration : public StringEnumeration { -private: +protected: char *keywords; +private: char *current; int32_t length; UnicodeString currUSKey; static const char fgClassID;/* Warning this is used beyond the typical RTTI usage. */ public: - static UClassID U_EXPORT2 getStaticClassID(void) { return (UClassID)&fgClassID; } - virtual UClassID getDynamicClassID(void) const { return getStaticClassID(); } + static UClassID U_EXPORT2 getStaticClassID() { return (UClassID)&fgClassID; } + virtual UClassID getDynamicClassID() const override { return getStaticClassID(); } public: KeywordEnumeration(const char *keys, int32_t keywordLen, int32_t currentIndex, UErrorCode &status) : keywords((char *)&fgClassID), current((char *)&fgClassID), length(0) { if(U_SUCCESS(status) && keywordLen != 0) { - if(keys == NULL || keywordLen < 0) { + if(keys == nullptr || keywordLen < 0) { status = U_ILLEGAL_ARGUMENT_ERROR; } else { keywords = (char *)uprv_malloc(keywordLen+1); - if (keywords == NULL) { + if (keywords == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } else { @@ -1075,13 +2453,13 @@ class KeywordEnumeration : public StringEnumeration { virtual ~KeywordEnumeration(); - virtual StringEnumeration * clone() const + virtual StringEnumeration * clone() const override { UErrorCode status = U_ZERO_ERROR; return new KeywordEnumeration(keywords, length, (int32_t)(current - keywords), status); } - virtual int32_t count(UErrorCode &/*status*/) const { + virtual int32_t count(UErrorCode &/*status*/) const override { char *kw = keywords; int32_t result = 0; while(*kw) { @@ -1091,32 +2469,32 @@ class KeywordEnumeration : public StringEnumeration { return result; } - virtual const char* next(int32_t* resultLength, UErrorCode& status) { + virtual const char* next(int32_t* resultLength, UErrorCode& status) override { const char* result; int32_t len; if(U_SUCCESS(status) && *current != 0) { result = current; len = (int32_t)uprv_strlen(current); current += len+1; - if(resultLength != NULL) { + if(resultLength != nullptr) { *resultLength = len; } } else { - if(resultLength != NULL) { + if(resultLength != nullptr) { *resultLength = 0; } - result = NULL; + result = nullptr; } return result; } - virtual const UnicodeString* snext(UErrorCode& status) { + virtual const UnicodeString* snext(UErrorCode& status) override { int32_t resultLength = 0; const char *s = next(&resultLength, status); return setChars(s, resultLength, status); } - virtual void reset(UErrorCode& /*status*/) { + virtual void reset(UErrorCode& /*status*/) override { current = keywords; } }; @@ -1134,22 +2512,33 @@ class UnicodeKeywordEnumeration : public KeywordEnumeration { using KeywordEnumeration::KeywordEnumeration; virtual ~UnicodeKeywordEnumeration(); - virtual const char* next(int32_t* resultLength, UErrorCode& status) { + virtual const char* next(int32_t* resultLength, UErrorCode& status) override { const char* legacy_key = KeywordEnumeration::next(nullptr, status); - if (U_SUCCESS(status) && legacy_key != nullptr) { + while (U_SUCCESS(status) && legacy_key != nullptr) { const char* key = uloc_toUnicodeLocaleKey(legacy_key); - if (key == nullptr) { - status = U_ILLEGAL_ARGUMENT_ERROR; - } else { + if (key != nullptr) { if (resultLength != nullptr) { *resultLength = static_cast(uprv_strlen(key)); } return key; } + // Not a Unicode keyword, could be a t, x or other, continue to look at the next one. + legacy_key = KeywordEnumeration::next(nullptr, status); } if (resultLength != nullptr) *resultLength = 0; return nullptr; } + virtual int32_t count(UErrorCode &/*status*/) const override { + char *kw = keywords; + int32_t result = 0; + while(*kw) { + if (uloc_toUnicodeLocaleKey(kw) != nullptr) { + result++; + } + kw += uprv_strlen(kw)+1; + } + return result; + } }; // Out-of-line virtual destructor to serve as the "key function". @@ -1158,9 +2547,7 @@ UnicodeKeywordEnumeration::~UnicodeKeywordEnumeration() = default; StringEnumeration * Locale::createKeywords(UErrorCode &status) const { - char keywords[256]; - int32_t keywordCapacity = sizeof keywords; - StringEnumeration *result = NULL; + StringEnumeration *result = nullptr; if (U_FAILURE(status)) { return result; @@ -1170,9 +2557,11 @@ Locale::createKeywords(UErrorCode &status) const 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 KeywordEnumeration(keywords, keyLen, 0, status); + CharString keywords; + CharStringByteSink sink(&keywords); + ulocimp_getKeywords(variantStart+1, '@', sink, false, &status); + if (U_SUCCESS(status) && !keywords.isEmpty()) { + result = new KeywordEnumeration(keywords.data(), keywords.length(), 0, status); if (!result) { status = U_MEMORY_ALLOCATION_ERROR; } @@ -1187,9 +2576,7 @@ Locale::createKeywords(UErrorCode &status) const StringEnumeration * Locale::createUnicodeKeywords(UErrorCode &status) const { - char keywords[256]; - int32_t keywordCapacity = sizeof keywords; - StringEnumeration *result = NULL; + StringEnumeration *result = nullptr; if (U_FAILURE(status)) { return result; @@ -1199,9 +2586,11 @@ Locale::createUnicodeKeywords(UErrorCode &status) const 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); + CharString keywords; + CharStringByteSink sink(&keywords); + ulocimp_getKeywords(variantStart+1, '@', sink, false, &status); + if (U_SUCCESS(status) && !keywords.isEmpty()) { + result = new UnicodeKeywordEnumeration(keywords.data(), keywords.length(), 0, status); if (!result) { status = U_MEMORY_ALLOCATION_ERROR; } @@ -1236,48 +2625,7 @@ Locale::getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& sta return; } - LocalMemory 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. - } + ulocimp_getKeywordValue(fullName, keywordName_nul.data(), sink, &status); } void @@ -1324,9 +2672,13 @@ Locale::setKeywordValue(const char* keywordName, const char* keywordValue, UErro if (U_FAILURE(status)) { return; } + if (status == U_STRING_NOT_TERMINATED_WARNING) { + status = U_ZERO_ERROR; + } int32_t bufferLength = uprv_max((int32_t)(uprv_strlen(fullName) + 1), ULOC_FULLNAME_CAPACITY); int32_t newLength = uloc_setKeywordValue(keywordName, keywordValue, fullName, bufferLength, &status) + 1; + U_ASSERT(status != U_STRING_NOT_TERMINATED_WARNING); /* Handle the case the current buffer is not enough to hold the new id */ if (status == U_BUFFER_OVERFLOW_ERROR) { U_ASSERT(newLength > bufferLength); @@ -1339,10 +2691,14 @@ Locale::setKeywordValue(const char* keywordName, const char* keywordValue, UErro if (fullName != fullNameBuffer) { // if full Name is already on the heap, need to free it. uprv_free(fullName); + if (baseName == fullName) { + baseName = newFullName; // baseName should not point to freed memory. + } } fullName = newFullName; status = U_ZERO_ERROR; uloc_setKeywordValue(keywordName, keywordValue, fullName, newLength, &status); + U_ASSERT(status != U_STRING_NOT_TERMINATED_WARNING); } else { U_ASSERT(newLength <= bufferLength); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/loclikely.cpp b/src/duckdb/extension/icu/third_party/icu/common/loclikely.cpp index a4a4181cb..eedfb8149 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/loclikely.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/loclikely.cpp @@ -31,82 +31,10 @@ #include "charstr.h" #include "cmemory.h" #include "cstring.h" +#include "loclikelysubtags.h" #include "ulocimp.h" #include "ustr_imp.h" -/** - * These are the canonical strings for unknown languages, scripts and regions. - **/ -static const char* const unknownLanguage = "und"; -static const char* const unknownScript = "Zzzz"; -static const char* const unknownRegion = "ZZ"; - -/** - * This function looks for the localeID in the likelySubtags resource. - * - * @param localeID The tag to find. - * @param buffer A buffer to hold the matching entry - * @param bufferLength The length of the output buffer - * @return A pointer to "buffer" if found, or a null pointer if not. - */ -static const char* U_CALLCONV -findLikelySubtags(const char* localeID, - char* buffer, - int32_t bufferLength, - UErrorCode* err) { - const char* result = NULL; - - if (!U_FAILURE(*err)) { - int32_t resLen = 0; - const UChar* s = NULL; - UErrorCode tmpErr = U_ZERO_ERROR; - icu::LocalUResourceBundlePointer subtags(ures_openDirect(NULL, "likelySubtags", &tmpErr)); - if (U_SUCCESS(tmpErr)) { - icu::CharString und; - if (localeID != NULL) { - if (*localeID == '\0') { - localeID = unknownLanguage; - } else if (*localeID == '_') { - und.append(unknownLanguage, *err); - und.append(localeID, *err); - if (U_FAILURE(*err)) { - return NULL; - } - localeID = und.data(); - } - } - s = ures_getStringByKey(subtags.getAlias(), localeID, &resLen, &tmpErr); - - if (U_FAILURE(tmpErr)) { - /* - * If a resource is missing, it's not really an error, it's - * just that we don't have any data for that particular locale ID. - */ - if (tmpErr != U_MISSING_RESOURCE_ERROR) { - *err = tmpErr; - } - } - else if (resLen >= bufferLength) { - /* The buffer should never overflow. */ - *err = U_INTERNAL_PROGRAM_ERROR; - } - else { - u_UCharsToChars(s, buffer, resLen + 1); - if (resLen >= 3 && - uprv_strnicmp(buffer, unknownLanguage, 3) == 0 && - (resLen == 3 || buffer[3] == '_')) { - uprv_memmove(buffer, buffer + 3, resLen - 3 + 1); - } - result = buffer; - } - } else { - *err = tmpErr; - } - } - - return result; -} - /** * Append a tag to a buffer, adding the separator if necessary. The buffer * must be large enough to contain the resulting tag plus any separator @@ -115,7 +43,7 @@ findLikelySubtags(const char* localeID, * @param tag The tag to add. * @param tagLength The length of the tag. * @param buffer The output buffer. - * @param bufferLength The length of the output buffer. This is an input/ouput parameter. + * @param bufferLength The length of the output buffer. This is an input/output parameter. **/ static void U_CALLCONV appendTag( @@ -140,12 +68,12 @@ appendTag( /** * Create a tag string from the supplied parameters. The lang, script and region - * parameters may be NULL pointers. If they are, their corresponding length parameters + * parameters may be nullptr pointers. If they are, their corresponding length parameters * must be less than or equal to 0. * * If any of the language, script or region parameters are empty, and the alternateTags - * parameter is not NULL, it will be parsed for potential language, script and region tags - * to be used when constructing the new tag. If the alternateTags parameter is NULL, or + * parameter is not nullptr, it will be parsed for potential language, script and region tags + * to be used when constructing the new tag. If the alternateTags parameter is nullptr, or * it contains no language tag, the default tag for the unknown language is used. * * If the length of the new string exceeds the capacity of the output buffer, @@ -201,7 +129,7 @@ createTagStringWithAlternates( **/ char tagBuffer[ULOC_FULLNAME_CAPACITY]; int32_t tagLength = 0; - UBool regionAppended = FALSE; + UBool regionAppended = false; if (langLength > 0) { appendTag( @@ -209,9 +137,9 @@ createTagStringWithAlternates( langLength, tagBuffer, &tagLength, - /*withSeparator=*/FALSE); + /*withSeparator=*/false); } - else if (alternateTags == NULL) { + else if (alternateTags == nullptr) { /* * Use the empty string for an unknown language, if * we found no language. @@ -246,7 +174,7 @@ createTagStringWithAlternates( alternateLangLength, tagBuffer, &tagLength, - /*withSeparator=*/FALSE); + /*withSeparator=*/false); } } @@ -256,9 +184,9 @@ createTagStringWithAlternates( scriptLength, tagBuffer, &tagLength, - /*withSeparator=*/TRUE); + /*withSeparator=*/true); } - else if (alternateTags != NULL) { + else if (alternateTags != nullptr) { /* * Parse the alternateTags string for the script. */ @@ -281,7 +209,7 @@ createTagStringWithAlternates( alternateScriptLength, tagBuffer, &tagLength, - /*withSeparator=*/TRUE); + /*withSeparator=*/true); } } @@ -291,11 +219,11 @@ createTagStringWithAlternates( regionLength, tagBuffer, &tagLength, - /*withSeparator=*/TRUE); + /*withSeparator=*/true); - regionAppended = TRUE; + regionAppended = true; } - else if (alternateTags != NULL) { + else if (alternateTags != nullptr) { /* * Parse the alternateTags string for the region. */ @@ -317,9 +245,9 @@ createTagStringWithAlternates( alternateRegionLength, tagBuffer, &tagLength, - /*withSeparator=*/TRUE); + /*withSeparator=*/true); - regionAppended = TRUE; + regionAppended = true; } } @@ -360,57 +288,6 @@ createTagStringWithAlternates( } } -/** - * Create a tag string from the supplied parameters. The lang, script and region - * parameters may be NULL pointers. If they are, their corresponding length parameters - * must be less than or equal to 0. If the lang parameter is an empty string, the - * default value for an unknown language is written to the output buffer. - * - * If the length of the new string exceeds the capacity of the output buffer, - * the function copies as many bytes to the output buffer as it can, and returns - * the error U_BUFFER_OVERFLOW_ERROR. - * - * If an illegal argument is provided, the function returns the error - * U_ILLEGAL_ARGUMENT_ERROR. - * - * @param lang The language tag to use. - * @param langLength The length of the language tag. - * @param script The script tag to use. - * @param scriptLength The length of the script tag. - * @param region The region tag to use. - * @param regionLength The length of the region tag. - * @param trailing Any trailing data to append to the new tag. - * @param trailingLength The length of the trailing data. - * @param sink The output sink receiving the tag string. - * @param err A pointer to a UErrorCode for error reporting. - **/ -static void U_CALLCONV -createTagString( - const char* lang, - int32_t langLength, - const char* script, - int32_t scriptLength, - const char* region, - int32_t regionLength, - const char* trailing, - int32_t trailingLength, - icu::ByteSink& sink, - UErrorCode* err) -{ - createTagStringWithAlternates( - lang, - langLength, - script, - scriptLength, - region, - regionLength, - trailing, - trailingLength, - NULL, - sink, - err); -} - /** * Parse the language, script, and region subtags from a tag string, and copy the * results into the corresponding output parameters. The buffers are null-terminated, @@ -454,18 +331,17 @@ parseTagString( int32_t subtagLength = 0; if(U_FAILURE(*err) || - localeID == NULL || - lang == NULL || - langLength == NULL || - script == NULL || - scriptLength == NULL || - region == NULL || - regionLength == NULL) { + localeID == nullptr || + lang == nullptr || + langLength == nullptr || + script == nullptr || + scriptLength == nullptr || + region == nullptr || + regionLength == nullptr) { goto error; } - subtagLength = ulocimp_getLanguage(position, lang, *langLength, &position); - u_terminateChars(lang, *langLength, subtagLength, err); + subtagLength = ulocimp_getLanguage(position, &position, *err).extract(lang, *langLength, *err); /* * Note that we explicit consider U_STRING_NOT_TERMINATED_WARNING @@ -486,8 +362,7 @@ parseTagString( ++position; } - subtagLength = ulocimp_getScript(position, script, *scriptLength, &position); - u_terminateChars(script, *scriptLength, subtagLength, err); + subtagLength = ulocimp_getScript(position, &position, *err).extract(script, *scriptLength, *err); if(U_FAILURE(*err)) { goto error; @@ -496,13 +371,6 @@ parseTagString( *scriptLength = subtagLength; if (*scriptLength > 0) { - if (uprv_strnicmp(script, unknownScript, *scriptLength) == 0) { - /** - * If the script part is the "unknown" script, then don't return it. - **/ - *scriptLength = 0; - } - /* * Move past any separator. */ @@ -511,8 +379,7 @@ parseTagString( } } - subtagLength = ulocimp_getCountry(position, region, *regionLength, &position); - u_terminateChars(region, *regionLength, subtagLength, err); + subtagLength = ulocimp_getCountry(position, &position, *err).extract(region, *regionLength, *err); if(U_FAILURE(*err)) { goto error; @@ -520,14 +387,7 @@ parseTagString( *regionLength = subtagLength; - if (*regionLength > 0) { - if (uprv_strnicmp(region, unknownRegion, *regionLength) == 0) { - /** - * If the region part is the "unknown" region, then don't return it. - **/ - *regionLength = 0; - } - } else if (*position != 0 && *position != '@') { + if (*regionLength <= 0 && *position != 0 && *position != '@') { /* back up over consumed trailing separator */ --position; } @@ -549,264 +409,6 @@ parseTagString( goto exit; } -static UBool U_CALLCONV -createLikelySubtagsString( - const char* lang, - int32_t langLength, - const char* script, - int32_t scriptLength, - const char* region, - int32_t regionLength, - const char* variants, - int32_t variantsLength, - icu::ByteSink& sink, - UErrorCode* err) { - /** - * ULOC_FULLNAME_CAPACITY will provide enough capacity - * that we can build a string that contains the language, - * script and region code without worrying about overrunning - * the user-supplied buffer. - **/ - char likelySubtagsBuffer[ULOC_FULLNAME_CAPACITY]; - - if(U_FAILURE(*err)) { - goto error; - } - - /** - * Try the language with the script and region first. - **/ - if (scriptLength > 0 && regionLength > 0) { - - const char* likelySubtags = NULL; - - icu::CharString tagBuffer; - { - icu::CharStringByteSink sink(&tagBuffer); - createTagString( - lang, - langLength, - script, - scriptLength, - region, - regionLength, - NULL, - 0, - sink, - err); - } - if(U_FAILURE(*err)) { - goto error; - } - - likelySubtags = - findLikelySubtags( - tagBuffer.data(), - likelySubtagsBuffer, - sizeof(likelySubtagsBuffer), - err); - if(U_FAILURE(*err)) { - goto error; - } - - if (likelySubtags != NULL) { - /* Always use the language tag from the - maximal string, since it may be more - specific than the one provided. */ - createTagStringWithAlternates( - NULL, - 0, - NULL, - 0, - NULL, - 0, - variants, - variantsLength, - likelySubtags, - sink, - err); - return TRUE; - } - } - - /** - * Try the language with just the script. - **/ - if (scriptLength > 0) { - - const char* likelySubtags = NULL; - - icu::CharString tagBuffer; - { - icu::CharStringByteSink sink(&tagBuffer); - createTagString( - lang, - langLength, - script, - scriptLength, - NULL, - 0, - NULL, - 0, - sink, - err); - } - if(U_FAILURE(*err)) { - goto error; - } - - likelySubtags = - findLikelySubtags( - tagBuffer.data(), - likelySubtagsBuffer, - sizeof(likelySubtagsBuffer), - err); - if(U_FAILURE(*err)) { - goto error; - } - - if (likelySubtags != NULL) { - /* Always use the language tag from the - maximal string, since it may be more - specific than the one provided. */ - createTagStringWithAlternates( - NULL, - 0, - NULL, - 0, - region, - regionLength, - variants, - variantsLength, - likelySubtags, - sink, - err); - return TRUE; - } - } - - /** - * Try the language with just the region. - **/ - if (regionLength > 0) { - - const char* likelySubtags = NULL; - - icu::CharString tagBuffer; - { - icu::CharStringByteSink sink(&tagBuffer); - createTagString( - lang, - langLength, - NULL, - 0, - region, - regionLength, - NULL, - 0, - sink, - err); - } - if(U_FAILURE(*err)) { - goto error; - } - - likelySubtags = - findLikelySubtags( - tagBuffer.data(), - likelySubtagsBuffer, - sizeof(likelySubtagsBuffer), - err); - if(U_FAILURE(*err)) { - goto error; - } - - if (likelySubtags != NULL) { - /* Always use the language tag from the - maximal string, since it may be more - specific than the one provided. */ - createTagStringWithAlternates( - NULL, - 0, - script, - scriptLength, - NULL, - 0, - variants, - variantsLength, - likelySubtags, - sink, - err); - return TRUE; - } - } - - /** - * Finally, try just the language. - **/ - { - const char* likelySubtags = NULL; - - icu::CharString tagBuffer; - { - icu::CharStringByteSink sink(&tagBuffer); - createTagString( - lang, - langLength, - NULL, - 0, - NULL, - 0, - NULL, - 0, - sink, - err); - } - if(U_FAILURE(*err)) { - goto error; - } - - likelySubtags = - findLikelySubtags( - tagBuffer.data(), - likelySubtagsBuffer, - sizeof(likelySubtagsBuffer), - err); - if(U_FAILURE(*err)) { - goto error; - } - - if (likelySubtags != NULL) { - /* Always use the language tag from the - maximal string, since it may be more - specific than the one provided. */ - createTagStringWithAlternates( - NULL, - 0, - script, - scriptLength, - region, - regionLength, - variants, - variantsLength, - likelySubtags, - sink, - err); - return TRUE; - } - } - - return FALSE; - -error: - - if (!U_FAILURE(*err)) { - *err = U_ILLEGAL_ARGUMENT_ERROR; - } - - return FALSE; -} - #define CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength) UPRV_BLOCK_MACRO_BEGIN { \ int32_t count = 0; \ int32_t i; \ @@ -826,7 +428,7 @@ createLikelySubtagsString( } \ } UPRV_BLOCK_MACRO_END -static void +static UBool _uloc_addLikelySubtags(const char* localeID, icu::ByteSink& sink, UErrorCode* err) { @@ -839,12 +441,11 @@ _uloc_addLikelySubtags(const char* localeID, const char* trailing = ""; int32_t trailingLength = 0; int32_t trailingIndex = 0; - UBool success = FALSE; if(U_FAILURE(*err)) { goto error; } - if (localeID == NULL) { + if (localeID == nullptr) { goto error; } @@ -865,6 +466,9 @@ _uloc_addLikelySubtags(const char* localeID, goto error; } + if (langLength > 3) { + goto error; + } /* Find the length of the trailing portion. */ while (_isIDSeparator(localeID[trailingIndex])) { @@ -874,41 +478,61 @@ _uloc_addLikelySubtags(const char* localeID, trailingLength = (int32_t)uprv_strlen(trailing); CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength); - - success = - createLikelySubtagsString( - lang, - langLength, - script, - scriptLength, - region, - regionLength, + { + const icu::XLikelySubtags* likelySubtags = icu::XLikelySubtags::getSingleton(*err); + if(U_FAILURE(*err)) { + goto error; + } + // We need to keep l on the stack because lsr may point into internal + // memory of l. + icu::Locale l = icu::Locale::createFromName(localeID); + if (l.isBogus()) { + goto error; + } + icu::LSR lsr = likelySubtags->makeMaximizedLsrFrom(l, true, *err); + if(U_FAILURE(*err)) { + goto error; + } + const char* language = lsr.language; + if (uprv_strcmp(language, "und") == 0) { + language = ""; + } + createTagStringWithAlternates( + language, + (int32_t)uprv_strlen(language), + lsr.script, + (int32_t)uprv_strlen(lsr.script), + lsr.region, + (int32_t)uprv_strlen(lsr.region), trailing, trailingLength, + nullptr, sink, err); - - if (!success) { - const int32_t localIDLength = (int32_t)uprv_strlen(localeID); - - /* - * If we get here, we need to return localeID. - */ - sink.Append(localeID, localIDLength); + if(U_FAILURE(*err)) { + goto error; + } } - - return; + return true; error: if (!U_FAILURE(*err)) { *err = U_ILLEGAL_ARGUMENT_ERROR; } + return false; } +// Add likely subtags to the sink +// return true if the value in the sink is produced by a match during the lookup +// return false if the value in the sink is the same as input because there are +// no match after the lookup. +static UBool _ulocimp_addLikelySubtags(const char*, icu::ByteSink&, UErrorCode*); + static void _uloc_minimizeSubtags(const char* localeID, icu::ByteSink& sink, + bool favorScript, UErrorCode* err) { icu::CharString maximizedTagBuffer; @@ -925,7 +549,7 @@ _uloc_minimizeSubtags(const char* localeID, if(U_FAILURE(*err)) { goto error; } - else if (localeID == NULL) { + else if (localeID == nullptr) { goto error; } @@ -959,174 +583,38 @@ _uloc_minimizeSubtags(const char* localeID, CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength); { - icu::CharString base; - { - icu::CharStringByteSink sink(&base); - createTagString( - lang, - langLength, - script, - scriptLength, - region, - regionLength, - NULL, - 0, - sink, - err); - } - - /** - * First, we need to first get the maximization - * from AddLikelySubtags. - **/ - { - icu::CharStringByteSink sink(&maximizedTagBuffer); - ulocimp_addLikelySubtags(base.data(), sink, err); - } - } - - if(U_FAILURE(*err)) { - goto error; - } - - /** - * Start first with just the language. - **/ - { - icu::CharString tagBuffer; - { - icu::CharStringByteSink sink(&tagBuffer); - createLikelySubtagsString( - lang, - langLength, - NULL, - 0, - NULL, - 0, - NULL, - 0, - sink, - err); - } - + const icu::XLikelySubtags* likelySubtags = icu::XLikelySubtags::getSingleton(*err); if(U_FAILURE(*err)) { goto error; } - else if (!tagBuffer.isEmpty() && uprv_strnicmp( - maximizedTagBuffer.data(), - tagBuffer.data(), - tagBuffer.length()) == 0) { - - createTagString( - lang, - langLength, - NULL, - 0, - NULL, - 0, - trailing, - trailingLength, - sink, - err); - return; - } - } - - /** - * Next, try the language and region. - **/ - if (regionLength > 0) { - - icu::CharString tagBuffer; - { - icu::CharStringByteSink sink(&tagBuffer); - createLikelySubtagsString( - lang, - langLength, - NULL, - 0, - region, - regionLength, - NULL, - 0, - sink, - err); - } - + icu::LSR lsr = likelySubtags->minimizeSubtags( + {lang, langLength}, + {script, scriptLength}, + {region, regionLength}, + favorScript, + *err); if(U_FAILURE(*err)) { goto error; } - else if (uprv_strnicmp( - maximizedTagBuffer.data(), - tagBuffer.data(), - tagBuffer.length()) == 0) { - - createTagString( - lang, - langLength, - NULL, - 0, - region, - regionLength, - trailing, - trailingLength, - sink, - err); - return; - } - } - - /** - * Finally, try the language and script. This is our last chance, - * since trying with all three subtags would only yield the - * maximal version that we already have. - **/ - if (scriptLength > 0 && regionLength > 0) { - icu::CharString tagBuffer; - { - icu::CharStringByteSink sink(&tagBuffer); - createLikelySubtagsString( - lang, - langLength, - script, - scriptLength, - NULL, - 0, - NULL, - 0, - sink, - err); - } - + const char* language = lsr.language; + if (uprv_strcmp(language, "und") == 0) { + language = ""; + } + createTagStringWithAlternates( + language, + (int32_t)uprv_strlen(language), + lsr.script, + (int32_t)uprv_strlen(lsr.script), + lsr.region, + (int32_t)uprv_strlen(lsr.region), + trailing, + trailingLength, + nullptr, + sink, + err); if(U_FAILURE(*err)) { goto error; } - else if (uprv_strnicmp( - maximizedTagBuffer.data(), - tagBuffer.data(), - tagBuffer.length()) == 0) { - - createTagString( - lang, - langLength, - script, - scriptLength, - NULL, - 0, - trailing, - trailingLength, - sink, - err); - return; - } - } - - { - /** - * If we got here, return the locale ID parameter. - **/ - const int32_t localeIDLength = (int32_t)uprv_strlen(localeID); - sink.Append(localeID, localeIDLength); return; } @@ -1137,33 +625,6 @@ _uloc_minimizeSubtags(const char* localeID, } } -static UBool -do_canonicalize(const char* localeID, - char* buffer, - int32_t bufferCapacity, - UErrorCode* err) -{ - uloc_canonicalize( - localeID, - buffer, - bufferCapacity, - err); - - if (*err == U_STRING_NOT_TERMINATED_WARNING || - *err == U_BUFFER_OVERFLOW_ERROR) { - *err = U_ILLEGAL_ARGUMENT_ERROR; - - return FALSE; - } - else if (U_FAILURE(*err)) { - - return FALSE; - } - else { - return TRUE; - } -} - U_CAPI int32_t U_EXPORT2 uloc_addLikelySubtags(const char* localeID, char* maximizedLocaleID, @@ -1193,15 +654,27 @@ uloc_addLikelySubtags(const char* localeID, return reslen; } +static UBool +_ulocimp_addLikelySubtags(const char* localeID, + icu::ByteSink& sink, + UErrorCode* status) { + icu::CharString localeBuffer; + { + icu::CharStringByteSink localeSink(&localeBuffer); + ulocimp_canonicalize(localeID, localeSink, status); + } + if (U_SUCCESS(*status)) { + return _uloc_addLikelySubtags(localeBuffer.data(), sink, status); + } else { + return false; + } +} + U_CAPI void U_EXPORT2 ulocimp_addLikelySubtags(const char* localeID, icu::ByteSink& sink, UErrorCode* status) { - char localeBuffer[ULOC_FULLNAME_CAPACITY]; - - if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) { - _uloc_addLikelySubtags(localeBuffer, sink, status); - } + _ulocimp_addLikelySubtags(localeID, sink, status); } U_CAPI int32_t U_EXPORT2 @@ -1216,7 +689,7 @@ uloc_minimizeSubtags(const char* localeID, icu::CheckedArrayByteSink sink( minimizedLocaleID, minimizedLocaleIDCapacity); - ulocimp_minimizeSubtags(localeID, sink, status); + ulocimp_minimizeSubtags(localeID, sink, false, status); int32_t reslen = sink.NumberOfBytesAppended(); if (U_FAILURE(*status)) { @@ -1236,12 +709,14 @@ uloc_minimizeSubtags(const char* localeID, U_CAPI void U_EXPORT2 ulocimp_minimizeSubtags(const char* localeID, icu::ByteSink& sink, + bool favorScript, UErrorCode* status) { - char localeBuffer[ULOC_FULLNAME_CAPACITY]; - - if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) { - _uloc_minimizeSubtags(localeBuffer, sink, status); + icu::CharString localeBuffer; + { + icu::CharStringByteSink localeSink(&localeBuffer); + ulocimp_canonicalize(localeID, localeSink, status); } + _uloc_minimizeSubtags(localeBuffer.data(), sink, favorScript, status); } // Pairs of (language subtag, + or -) for finding out fast if common languages @@ -1263,14 +738,14 @@ uloc_isRightToLeft(const char *locale) { char lang[8]; int32_t langLength = uloc_getLanguage(locale, lang, UPRV_LENGTHOF(lang), &errorCode); if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) { - return FALSE; + return false; } if (langLength > 0) { const char* langPtr = uprv_strstr(LANG_DIR_STRING, lang); - if (langPtr != NULL) { + if (langPtr != nullptr) { switch (langPtr[langLength]) { - case '-': return FALSE; - case '+': return TRUE; + case '-': return false; + case '+': return true; default: break; // partial match of a longer code } } @@ -1283,12 +758,12 @@ uloc_isRightToLeft(const char *locale) { ulocimp_addLikelySubtags(locale, sink, &errorCode); } if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) { - return FALSE; + return false; } scriptLength = uloc_getScript(likely.data(), script, UPRV_LENGTHOF(script), &errorCode); if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING || scriptLength == 0) { - return FALSE; + return false; } } UScriptCode scriptCode = (UScriptCode)u_getPropertyValueEnum(UCHAR_SCRIPT, script); @@ -1317,16 +792,26 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion, UErrorCode rgStatus = U_ZERO_ERROR; // First check for rg keyword value - int32_t rgLen = uloc_getKeywordValue(localeID, "rg", rgBuf, ULOC_RG_BUFLEN, &rgStatus); - if (U_FAILURE(rgStatus) || rgLen != 6) { + icu::CharString rg; + { + icu::CharStringByteSink sink(&rg); + ulocimp_getKeywordValue(localeID, "rg", sink, &rgStatus); + } + int32_t rgLen = rg.length(); + if (U_FAILURE(rgStatus) || rgLen < 3 || rgLen > 7) { rgLen = 0; } else { - // rgBuf guaranteed to be zero terminated here, with text len 6 - char *rgPtr = rgBuf; - for (; *rgPtr!= 0; rgPtr++) { - *rgPtr = uprv_toupper(*rgPtr); + // chop off the subdivision code (which will generally be "zzzz" anyway) + const char* const data = rg.data(); + if (uprv_isASCIILetter(data[0])) { + rgLen = 2; + rgBuf[0] = uprv_toupper(data[0]); + rgBuf[1] = uprv_toupper(data[1]); + } else { + // assume three-digit region code + rgLen = 3; + uprv_memcpy(rgBuf, data, rgLen); } - rgLen = (uprv_strcmp(rgBuf+2, "ZZZZ") == 0)? 2: 0; } if (rgLen == 0) { @@ -1335,7 +820,7 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion, if (U_FAILURE(*status)) { rgLen = 0; } else if (rgLen == 0 && inferRegion) { - // no unicode_region_subtag but inferRegion TRUE, try likely subtags + // no unicode_region_subtag but inferRegion true, try likely subtags rgStatus = U_ZERO_ERROR; icu::CharString locBuf; { diff --git a/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.cpp b/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.cpp index 7cd9f7bc3..c2a7011b5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.cpp @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // loclikelysubtags.cpp // created: 2019may08 Markus W. Scherer @@ -11,6 +11,7 @@ #include "unicode/locid.h" #include "unicode/uobject.h" #include "unicode/ures.h" +#include "unicode/uscript.h" #include "charstr.h" #include "cstring.h" #include "loclikelysubtags.h" @@ -20,8 +21,10 @@ #include "uhash.h" #include "uinvchar.h" #include "umutex.h" +#include "uniquecharstr.h" #include "uresdata.h" #include "uresimp.h" +#include "uvector.h" U_NAMESPACE_BEGIN @@ -33,71 +36,6 @@ constexpr char PSEUDO_CRACKED_PREFIX = ','; // -XC, -PSCRACK } // namespace -/** - * Stores NUL-terminated strings with duplicate elimination. - * Checks for unique UTF-16 string pointers and converts to invariant characters. - */ -class UniqueCharStrings { -public: - UniqueCharStrings(UErrorCode &errorCode) : strings(nullptr) { - uhash_init(&map, uhash_hashUChars, uhash_compareUChars, uhash_compareLong, &errorCode); - if (U_FAILURE(errorCode)) { return; } - strings = new CharString(); - if (strings == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - } - } - ~UniqueCharStrings() { - uhash_close(&map); - delete strings; - } - - /** Returns/orphans the CharString that contains all strings. */ - CharString *orphanCharStrings() { - CharString *result = strings; - strings = nullptr; - return result; - } - - /** Adds a string and returns a unique number for it. */ - int32_t add(const UnicodeString &s, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return 0; } - if (isFrozen) { - errorCode = U_NO_WRITE_PERMISSION; - return 0; - } - // The string points into the resource bundle. - const char16_t *p = s.getBuffer(); - int32_t oldIndex = uhash_geti(&map, p); - if (oldIndex != 0) { // found duplicate - return oldIndex; - } - // Explicit NUL terminator for the previous string. - // The strings object is also terminated with one implicit NUL. - strings->append(0, errorCode); - int32_t newIndex = strings->length(); - strings->appendInvariantChars(s, errorCode); - uhash_puti(&map, const_cast(p), newIndex, &errorCode); - return newIndex; - } - - void freeze() { isFrozen = true; } - - /** - * Returns a string pointer for its unique number, if this object is frozen. - * Otherwise nullptr. - */ - const char *get(int32_t i) const { - U_ASSERT(isFrozen); - return isFrozen && i > 0 ? strings->data() + i : nullptr; - } - -private: - UHashtable map; - CharString *strings; - bool isFrozen = false; -}; - LocaleDistanceData::LocaleDistanceData(LocaleDistanceData &&data) : distanceTrieBytes(data.distanceTrieBytes), regionToPartitions(data.regionToPartitions), @@ -145,11 +83,18 @@ struct XLikelySubtagsData { // Read all strings in the resource bundle and convert them to invariant char *. LocalMemory languageIndexes, regionIndexes, lsrSubtagIndexes; int32_t languagesLength = 0, regionsLength = 0, lsrSubtagsLength = 0; + ResourceArray m49Array; + if (likelyTable.findValue("m49", value)) { + m49Array = value.getArray(errorCode); + } else { + errorCode = U_MISSING_RESOURCE_ERROR; + return; + } if (!readStrings(likelyTable, "languageAliases", value, languageIndexes, languagesLength, errorCode) || !readStrings(likelyTable, "regionAliases", value, regionIndexes, regionsLength, errorCode) || - !readStrings(likelyTable, "lsrs", value, + !readLSREncodedStrings(likelyTable, "lsrnum", value, m49Array, lsrSubtagIndexes,lsrSubtagsLength, errorCode)) { return; } @@ -200,7 +145,7 @@ struct XLikelySubtagsData { if (!readStrings(matchTable, "partitions", value, partitionIndexes, partitionsLength, errorCode) || - !readStrings(matchTable, "paradigms", value, + !readLSREncodedStrings(matchTable, "paradigmnum", value, m49Array, paradigmSubtagIndexes, paradigmSubtagsLength, errorCode)) { return; } @@ -250,7 +195,8 @@ struct XLikelySubtagsData { for (int32_t i = 0, j = 0; i < lsrSubtagsLength; i += 3, ++j) { lsrs[j] = LSR(strings.get(lsrSubtagIndexes[i]), strings.get(lsrSubtagIndexes[i + 1]), - strings.get(lsrSubtagIndexes[i + 2])); + strings.get(lsrSubtagIndexes[i + 2]), + LSR::IMPLICIT_LSR); } if (partitionsLength > 0) { @@ -275,7 +221,8 @@ struct XLikelySubtagsData { for (int32_t i = 0, j = 0; i < paradigmSubtagsLength; i += 3, ++j) { paradigms[j] = LSR(strings.get(paradigmSubtagIndexes[i]), strings.get(paradigmSubtagIndexes[i + 1]), - strings.get(paradigmSubtagIndexes[i + 2])); + strings.get(paradigmSubtagIndexes[i + 2]), + LSR::DONT_CARE_FLAGS); } distanceData.paradigms = paradigms; } @@ -295,10 +242,96 @@ struct XLikelySubtagsData { return false; } for (int i = 0; i < length; ++i) { - stringArray.getValue(i, value); // returns TRUE because i < length - rawIndexes[i] = strings.add(value.getUnicodeString(errorCode), errorCode); + if (stringArray.getValue(i, value)) { // returns true because i < length + int32_t strLength = 0; + rawIndexes[i] = strings.add(value.getString(strLength, errorCode), errorCode); + if (U_FAILURE(errorCode)) { return false; } + } + } + } + return true; + } + UnicodeString toLanguage(int encoded) { + if (encoded == 0) { + return UNICODE_STRING_SIMPLE(""); + } + if (encoded == 1) { + return UNICODE_STRING_SIMPLE("skip"); + } + encoded &= 0x00ffffff; + encoded %= 27*27*27; + char lang[3]; + lang[0] = 'a' + ((encoded % 27) - 1); + lang[1] = 'a' + (((encoded / 27 ) % 27) - 1); + if (encoded / (27 * 27) == 0) { + return UnicodeString(lang, 2, US_INV); + } + lang[2] = 'a' + ((encoded / (27 * 27)) - 1); + return UnicodeString(lang, 3, US_INV); + } + UnicodeString toScript(int encoded) { + if (encoded == 0) { + return UNICODE_STRING_SIMPLE(""); + } + if (encoded == 1) { + return UNICODE_STRING_SIMPLE("script"); + } + encoded = (encoded >> 24) & 0x000000ff; + const char* script = uscript_getShortName(static_cast(encoded)); + if (script == nullptr) { + return UNICODE_STRING_SIMPLE(""); + } + U_ASSERT(uprv_strlen(script) == 4); + return UnicodeString(script, 4, US_INV); + } + UnicodeString m49IndexToCode(const ResourceArray &m49Array, ResourceValue &value, int index, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { + return UNICODE_STRING_SIMPLE(""); + } + if (m49Array.getValue(index, value)) { + return value.getUnicodeString(errorCode); + } + // "m49" does not include the index. + errorCode = U_MISSING_RESOURCE_ERROR; + return UNICODE_STRING_SIMPLE(""); + } + + UnicodeString toRegion(const ResourceArray& m49Array, ResourceValue &value, int encoded, UErrorCode &errorCode) { + if (encoded == 0 || encoded == 1) { + return UNICODE_STRING_SIMPLE(""); + } + encoded &= 0x00ffffff; + encoded /= 27 * 27 * 27; + encoded %= 27 * 27; + if (encoded < 27) { + // Selected M49 code index, find the code from "m49" resource. + return m49IndexToCode(m49Array, value, encoded, errorCode); + } + char region[2]; + region[0] = 'A' + ((encoded % 27) - 1); + region[1] = 'A' + (((encoded / 27) % 27) - 1); + return UnicodeString(region, 2, US_INV); + } + + bool readLSREncodedStrings(const ResourceTable &table, const char* key, ResourceValue &value, const ResourceArray& m49Array, + LocalMemory &indexes, int32_t &length, UErrorCode &errorCode) { + if (table.findValue(key, value)) { + const int32_t* vectors = value.getIntVector(length, errorCode); + if (U_FAILURE(errorCode)) { return false; } + if (length == 0) { return true; } + int32_t *rawIndexes = indexes.allocateInsteadAndCopy(length * 3); + if (rawIndexes == nullptr) { + errorCode = U_MEMORY_ALLOCATION_ERROR; + return false; + } + for (int i = 0; i < length; ++i) { + rawIndexes[i*3] = strings.addByValue(toLanguage(vectors[i]), errorCode); + rawIndexes[i*3+1] = strings.addByValue(toScript(vectors[i]), errorCode); + rawIndexes[i*3+2] = strings.addByValue( + toRegion(m49Array, value, vectors[i], errorCode), errorCode); if (U_FAILURE(errorCode)) { return false; } } + length *= 3; } return true; } @@ -307,13 +340,50 @@ struct XLikelySubtagsData { namespace { XLikelySubtags *gLikelySubtags = nullptr; -UInitOnce loclikelysubtags_gInitOnce = U_INITONCE_INITIALIZER; +UVector *gMacroregions = nullptr; +UInitOnce gInitOnce {}; -UBool U_CALLCONV loclikelysubtags_cleanup() { +UBool U_CALLCONV cleanup() { delete gLikelySubtags; gLikelySubtags = nullptr; - loclikelysubtags_gInitOnce.reset(); - return TRUE; + delete gMacroregions; + gMacroregions = nullptr; + gInitOnce.reset(); + return true; +} + +static const char16_t RANGE_MARKER = 0x7E; /* '~' */ +UVector* loadMacroregions(UErrorCode &status) { + LocalPointer newMacroRegions(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); + + LocalUResourceBundlePointer supplementalData(ures_openDirect(nullptr,"supplementalData",&status)); + LocalUResourceBundlePointer idValidity(ures_getByKey(supplementalData.getAlias(),"idValidity",nullptr,&status)); + LocalUResourceBundlePointer regionList(ures_getByKey(idValidity.getAlias(),"region",nullptr,&status)); + LocalUResourceBundlePointer regionMacro(ures_getByKey(regionList.getAlias(),"macroregion",nullptr,&status)); + + if (U_FAILURE(status)) { + return nullptr; + } + + while (U_SUCCESS(status) && ures_hasNext(regionMacro.getAlias())) { + UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),nullptr,&status); + int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER); + char16_t buf[6]; + regionName.extract(buf,6,status); + if ( rangeMarkerLocation > 0 ) { + char16_t endRange = regionName.charAt(rangeMarkerLocation+1); + buf[rangeMarkerLocation] = 0; + while ( buf[rangeMarkerLocation-1] <= endRange && U_SUCCESS(status)) { + LocalPointer newRegion(new UnicodeString(buf), status); + newMacroRegions->adoptElement(newRegion.orphan(),status); + buf[rangeMarkerLocation-1]++; + } + } else { + LocalPointer newRegion(new UnicodeString(regionName), status); + newMacroRegions->adoptElement(newRegion.orphan(),status); + } + } + return newMacroRegions.orphan(); } } // namespace @@ -325,16 +395,20 @@ void U_CALLCONV XLikelySubtags::initLikelySubtags(UErrorCode &errorCode) { data.load(errorCode); if (U_FAILURE(errorCode)) { return; } gLikelySubtags = new XLikelySubtags(data); - if (gLikelySubtags == nullptr) { + gMacroregions = loadMacroregions(errorCode); + if (U_FAILURE(errorCode) || gLikelySubtags == nullptr || gMacroregions == nullptr) { + delete gLikelySubtags; + delete gMacroregions; errorCode = U_MEMORY_ALLOCATION_ERROR; return; } - ucln_common_registerCleanup(UCLN_COMMON_LIKELY_SUBTAGS, loclikelysubtags_cleanup); + + ucln_common_registerCleanup(UCLN_COMMON_LIKELY_SUBTAGS, cleanup); } const XLikelySubtags *XLikelySubtags::getSingleton(UErrorCode &errorCode) { if (U_FAILURE(errorCode)) { return nullptr; } - umtx_initOnce(loclikelysubtags_gInitOnce, &XLikelySubtags::initLikelySubtags, errorCode); + umtx_initOnce(gInitOnce, &XLikelySubtags::initLikelySubtags, errorCode); return gLikelySubtags; } @@ -379,14 +453,32 @@ XLikelySubtags::~XLikelySubtags() { delete[] lsrs; } -LSR XLikelySubtags::makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const { +LSR XLikelySubtags::makeMaximizedLsrFrom(const Locale &locale, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const { + if (locale.isBogus()) { + errorCode = U_ILLEGAL_ARGUMENT_ERROR; + return LSR("", "", "", LSR::EXPLICIT_LSR); + } const char *name = locale.getName(); if (uprv_isAtSign(name[0]) && name[1] == 'x' && name[2] == '=') { // name.startsWith("@x=") - // Private use language tag x-subtag-subtag... - return LSR(name, "", ""); + // Private use language tag x-subtag-subtag... which CLDR changes to + // und-x-subtag-subtag... + return LSR(name, "", "", LSR::EXPLICIT_LSR); + } + LSR max = makeMaximizedLsr(locale.getLanguage(), locale.getScript(), locale.getCountry(), + locale.getVariant(), returnInputIfUnmatch, errorCode); + + if (uprv_strlen(max.language) == 0 && + uprv_strlen(max.script) == 0 && + uprv_strlen(max.region) == 0) { + // No match. ICU API mandate us to + // If the provided ULocale instance is already in the maximal form, or + // there is no data available available for maximization, it will be + // returned. + return LSR(locale.getLanguage(), locale.getScript(), locale.getCountry(), LSR::EXPLICIT_LSR, errorCode); } - return makeMaximizedLsr(locale.getLanguage(), locale.getScript(), locale.getCountry(), - locale.getVariant(), errorCode); + return max; } namespace { @@ -399,7 +491,9 @@ const char *getCanonical(const CharStringMap &aliases, const char *alias) { } // namespace LSR XLikelySubtags::makeMaximizedLsr(const char *language, const char *script, const char *region, - const char *variant, UErrorCode &errorCode) const { + const char *variant, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const { // Handle pseudolocales like en-XA, ar-XB, fr-PSCRACK. // They should match only themselves, // not other locales with what looks like the same language and script subtags. @@ -407,26 +501,31 @@ LSR XLikelySubtags::makeMaximizedLsr(const char *language, const char *script, c if (region[0] == 'X' && (c1 = region[1]) != 0 && region[2] == 0) { switch (c1) { case 'A': - return LSR(PSEUDO_ACCENTS_PREFIX, language, script, region, errorCode); + return LSR(PSEUDO_ACCENTS_PREFIX, language, script, region, + LSR::EXPLICIT_LSR, errorCode); case 'B': - return LSR(PSEUDO_BIDI_PREFIX, language, script, region, errorCode); + return LSR(PSEUDO_BIDI_PREFIX, language, script, region, + LSR::EXPLICIT_LSR, errorCode); case 'C': - return LSR(PSEUDO_CRACKED_PREFIX, language, script, region, errorCode); + return LSR(PSEUDO_CRACKED_PREFIX, language, script, region, + LSR::EXPLICIT_LSR, errorCode); default: // normal locale break; } } if (variant[0] == 'P' && variant[1] == 'S') { + int32_t lsrFlags = *region == 0 ? + LSR::EXPLICIT_LANGUAGE | LSR::EXPLICIT_SCRIPT : LSR::EXPLICIT_LSR; if (uprv_strcmp(variant, "PSACCENT") == 0) { return LSR(PSEUDO_ACCENTS_PREFIX, language, script, - *region == 0 ? "XA" : region, errorCode); + *region == 0 ? "XA" : region, lsrFlags, errorCode); } else if (uprv_strcmp(variant, "PSBIDI") == 0) { return LSR(PSEUDO_BIDI_PREFIX, language, script, - *region == 0 ? "XB" : region, errorCode); + *region == 0 ? "XB" : region, lsrFlags, errorCode); } else if (uprv_strcmp(variant, "PSCRACK") == 0) { return LSR(PSEUDO_CRACKED_PREFIX, language, script, - *region == 0 ? "XC" : region, errorCode); + *region == 0 ? "XC" : region, lsrFlags, errorCode); } // else normal locale } @@ -434,64 +533,91 @@ LSR XLikelySubtags::makeMaximizedLsr(const char *language, const char *script, c language = getCanonical(languageAliases, language); // (We have no script mappings.) region = getCanonical(regionAliases, region); - return maximize(language, script, region); + return maximize(language, script, region, returnInputIfUnmatch, errorCode); } -LSR XLikelySubtags::maximize(const char *language, const char *script, const char *region) const { - if (uprv_strcmp(language, "und") == 0) { +LSR XLikelySubtags::maximize(const char *language, const char *script, const char *region, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const { + return maximize({language, (int32_t)uprv_strlen(language)}, + {script, (int32_t)uprv_strlen(script)}, + {region, (int32_t)uprv_strlen(region)}, + returnInputIfUnmatch, + errorCode); +} + +bool XLikelySubtags::isMacroregion(StringPiece& region, UErrorCode& errorCode) const { + // In Java, we use Region class. In C++, since Region is under i18n, + // we read the same data used by Region into gMacroregions avoid dependency + // from common to i18n/region.cpp + if (U_FAILURE(errorCode)) { return false; } + umtx_initOnce(gInitOnce, &XLikelySubtags::initLikelySubtags, errorCode); + if (U_FAILURE(errorCode)) { return false; } + UnicodeString str(UnicodeString::fromUTF8(region)); + return gMacroregions->contains((void *)&str); +} + +LSR XLikelySubtags::maximize(StringPiece language, StringPiece script, StringPiece region, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const { + if (U_FAILURE(errorCode)) { + return LSR(language, script, region, LSR::EXPLICIT_LSR, errorCode); + } + if (language.compare("und") == 0) { language = ""; } - if (uprv_strcmp(script, "Zzzz") == 0) { + if (script.compare("Zzzz") == 0) { script = ""; } - if (uprv_strcmp(region, "ZZ") == 0) { + if (region.compare("ZZ") == 0) { region = ""; } - if (*script != 0 && *region != 0 && *language != 0) { - return LSR(language, script, region); // already maximized + if (!script.empty() && !region.empty() && !language.empty()) { + return LSR(language, script, region, LSR::EXPLICIT_LSR, errorCode); // already maximized } + bool retainLanguage = false; + bool retainScript = false; + bool retainRegion = false; - uint32_t retainOldMask = 0; BytesTrie iter(trie); uint64_t state; int32_t value; // Small optimization: Array lookup for first language letter. int32_t c0; - if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 && - language[1] != 0 && // language.length() >= 2 + if (0 <= (c0 = uprv_lowerOrdinal(language.data()[0])) && c0 <= 25 && + language.length() >= 2 && (state = trieFirstLetterStates[c0]) != 0) { value = trieNext(iter.resetToState64(state), language, 1); } else { value = trieNext(iter, language, 0); } + bool matchLanguage = (value >= 0); + bool matchScript = false; if (value >= 0) { - if (*language != 0) { - retainOldMask |= 4; - } + retainLanguage = !language.empty(); state = iter.getState64(); } else { - retainOldMask |= 4; + retainLanguage = true; iter.resetToState64(trieUndState); // "und" ("*") state = 0; } + if (value >= 0 && !script.empty()) { + matchScript = true; + } if (value > 0) { // Intermediate or final value from just language. if (value == SKIP_SCRIPT) { value = 0; } - if (*script != 0) { - retainOldMask |= 2; - } + retainScript = !script.empty(); } else { value = trieNext(iter, script, 0); if (value >= 0) { - if (*script != 0) { - retainOldMask |= 2; - } + retainScript = !script.empty(); state = iter.getState64(); } else { - retainOldMask |= 2; + retainScript = true; if (state == 0) { iter.resetToState64(trieUndZzzzState); // "und-Zzzz" ("**") } else { @@ -503,19 +629,19 @@ LSR XLikelySubtags::maximize(const char *language, const char *script, const cha } } + bool matchRegion = false; if (value > 0) { // Final value from just language or language+script. - if (*region != 0) { - retainOldMask |= 1; - } + retainRegion = !region.empty(); } else { value = trieNext(iter, region, 0); if (value >= 0) { - if (*region != 0) { - retainOldMask |= 1; + if (!region.empty() && !isMacroregion(region, errorCode)) { + retainRegion = true; + matchRegion = true; } } else { - retainOldMask |= 1; + retainRegion = true; if (state == 0) { value = defaultLsrIndex; } else { @@ -526,27 +652,133 @@ LSR XLikelySubtags::maximize(const char *language, const char *script, const cha } } U_ASSERT(value < lsrsLength); - const LSR &result = lsrs[value]; + const LSR &matched = lsrs[value]; - if (*language == 0) { - language = "und"; + if (returnInputIfUnmatch && + (!(matchLanguage || matchScript || (matchRegion && language.empty())))) { + return LSR("", "", "", LSR::EXPLICIT_LSR, errorCode); // no matching. + } + if (language.empty()) { + language = StringPiece("und"); } - if (retainOldMask == 0) { + if (!(retainLanguage || retainScript || retainRegion)) { // Quickly return a copy of the lookup-result LSR // without new allocation of the subtags. - return LSR(result.language, result.script, result.region); + return LSR(matched.language, matched.script, matched.region, matched.flags); + } + if (!retainLanguage) { + language = matched.language; + } + if (!retainScript) { + script = matched.script; + } + if (!retainRegion) { + region = matched.region; + } + int32_t retainMask = (retainLanguage ? 4 : 0) + (retainScript ? 2 : 0) + (retainRegion ? 1 : 0); + // retainOldMask flags = LSR explicit-subtag flags + return LSR(language, script, region, retainMask, errorCode); +} + +int32_t XLikelySubtags::compareLikely(const LSR &lsr, const LSR &other, int32_t likelyInfo) const { + // If likelyInfo >= 0: + // likelyInfo bit 1 is set if the previous comparison with lsr + // was for equal language and script. + // Otherwise the scripts differed. + if (uprv_strcmp(lsr.language, other.language) != 0) { + return 0xfffffffc; // negative, lsr not better than other + } + if (uprv_strcmp(lsr.script, other.script) != 0) { + int32_t index; + if (likelyInfo >= 0 && (likelyInfo & 2) == 0) { + index = likelyInfo >> 2; + } else { + index = getLikelyIndex(lsr.language, ""); + likelyInfo = index << 2; + } + const LSR &likely = lsrs[index]; + if (uprv_strcmp(lsr.script, likely.script) == 0) { + return likelyInfo | 1; + } else { + return likelyInfo & ~1; + } + } + if (uprv_strcmp(lsr.region, other.region) != 0) { + int32_t index; + if (likelyInfo >= 0 && (likelyInfo & 2) != 0) { + index = likelyInfo >> 2; + } else { + index = getLikelyIndex(lsr.language, lsr.region); + likelyInfo = (index << 2) | 2; + } + const LSR &likely = lsrs[index]; + if (uprv_strcmp(lsr.region, likely.region) == 0) { + return likelyInfo | 1; + } else { + return likelyInfo & ~1; + } + } + return likelyInfo & ~1; // lsr not better than other +} + +// Subset of maximize(). +int32_t XLikelySubtags::getLikelyIndex(const char *language, const char *script) const { + if (uprv_strcmp(language, "und") == 0) { + language = ""; } - if ((retainOldMask & 4) == 0) { - language = result.language; + if (uprv_strcmp(script, "Zzzz") == 0) { + script = ""; + } + + BytesTrie iter(trie); + uint64_t state; + int32_t value; + // Small optimization: Array lookup for first language letter. + int32_t c0; + if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 && + language[1] != 0 && // language.length() >= 2 + (state = trieFirstLetterStates[c0]) != 0) { + value = trieNext(iter.resetToState64(state), language, 1); + } else { + value = trieNext(iter, language, 0); } - if ((retainOldMask & 2) == 0) { - script = result.script; + if (value >= 0) { + state = iter.getState64(); + } else { + iter.resetToState64(trieUndState); // "und" ("*") + state = 0; } - if ((retainOldMask & 1) == 0) { - region = result.region; + + if (value > 0) { + // Intermediate or final value from just language. + if (value == SKIP_SCRIPT) { + value = 0; + } + } else { + value = trieNext(iter, script, 0); + if (value >= 0) { + state = iter.getState64(); + } else { + if (state == 0) { + iter.resetToState64(trieUndZzzzState); // "und-Zzzz" ("**") + } else { + iter.resetToState64(state); + value = trieNext(iter, "", 0); + U_ASSERT(value >= 0); + state = iter.getState64(); + } + } } - return LSR(language, script, region); + + if (value > 0) { + // Final value from just language or language+script. + } else { + value = trieNext(iter, "", 0); + U_ASSERT(value > 0); + } + U_ASSERT(value < lsrsLength); + return value; } int32_t XLikelySubtags::trieNext(BytesTrie &iter, const char *s, int32_t i) { @@ -582,57 +814,97 @@ int32_t XLikelySubtags::trieNext(BytesTrie &iter, const char *s, int32_t i) { default: return -1; } } +int32_t XLikelySubtags::trieNext(BytesTrie &iter, StringPiece s, int32_t i) { + UStringTrieResult result; + uint8_t c; + if (s.length() == i) { + result = iter.next(u'*'); + } else { + c = s.data()[i]; + for (;;) { + c = uprv_invCharToAscii(c); + // EBCDIC: If s[i] is not an invariant character, + // then c is now 0 and will simply not match anything, which is harmless. + if (i+1 != s.length()) { + if (!USTRINGTRIE_HAS_NEXT(iter.next(c))) { + return -1; + } + c = s.data()[++i]; + } else { + // last character of this subtag + result = iter.next(c | 0x80); + break; + } + } + } + switch (result) { + case USTRINGTRIE_NO_MATCH: return -1; + case USTRINGTRIE_NO_VALUE: return 0; + case USTRINGTRIE_INTERMEDIATE_VALUE: + U_ASSERT(iter.getValue() == SKIP_SCRIPT); + return SKIP_SCRIPT; + case USTRINGTRIE_FINAL_VALUE: return iter.getValue(); + default: return -1; + } +} -// TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code -// in loclikely.cpp to this new code, including activating this -// minimizeSubtags() function. The LocaleMatcher does not minimize. -#if 0 -LSR XLikelySubtags::minimizeSubtags(const char *languageIn, const char *scriptIn, - const char *regionIn, ULocale.Minimize fieldToFavor, +LSR XLikelySubtags::minimizeSubtags(StringPiece language, StringPiece script, + StringPiece region, + bool favorScript, UErrorCode &errorCode) const { - LSR result = maximize(languageIn, scriptIn, regionIn); - - // We could try just a series of checks, like: - // LSR result2 = addLikelySubtags(languageIn, "", ""); - // if result.equals(result2) return result2; - // However, we can optimize 2 of the cases: - // (languageIn, "", "") - // (languageIn, "", regionIn) - - // value00 = lookup(result.language, "", "") - BytesTrie iter = new BytesTrie(trie); - int value = trieNext(iter, result.language, 0); - U_ASSERT(value >= 0); - if (value == 0) { - value = trieNext(iter, "", 0); - U_ASSERT(value >= 0); - if (value == 0) { - value = trieNext(iter, "", 0); - } - } - U_ASSERT(value > 0); - LSR value00 = lsrs[value]; - boolean favorRegionOk = false; - if (result.script.equals(value00.script)) { //script is default - if (result.region.equals(value00.region)) { - return new LSR(result.language, "", ""); - } else if (fieldToFavor == ULocale.Minimize.FAVOR_REGION) { - return new LSR(result.language, "", result.region); - } else { - favorRegionOk = true; - } + LSR max = maximize(language, script, region, true, errorCode); + if (U_FAILURE(errorCode)) { + return max; + } + // If no match, return it. + if (uprv_strlen(max.language) == 0 && + uprv_strlen(max.script) == 0 && + uprv_strlen(max.region) == 0) { + // No match. ICU API mandate us to + // "If this Locale is already in the minimal form, or not valid, or + // there is no data available for minimization, the Locale will be + // unchanged." + return LSR(language, script, region, LSR::EXPLICIT_LSR, errorCode); + } + // try language + LSR test = maximize(max.language, "", "", true, errorCode); + if (U_FAILURE(errorCode)) { + return max; + } + if (test.isEquivalentTo(max)) { + return LSR(max.language, "", "", LSR::DONT_CARE_FLAGS, errorCode); } - // The last case is not as easy to optimize. - // Maybe do later, but for now use the straightforward code. - LSR result2 = maximize(languageIn, scriptIn, ""); - if (result2.equals(result)) { - return new LSR(result.language, result.script, ""); - } else if (favorRegionOk) { - return new LSR(result.language, "", result.region); + if (!favorScript) { + // favor Region + // try language and region + test = maximize(max.language, "", max.region, true, errorCode); + if (U_FAILURE(errorCode)) { + return max; + } + if (test.isEquivalentTo(max)) { + return LSR(max.language, "", max.region, LSR::DONT_CARE_FLAGS, errorCode); + } + } + // try language and script + test = maximize(max.language, max.script, "", true, errorCode); + if (U_FAILURE(errorCode)) { + return max; } - return result; + if (test.isEquivalentTo(max)) { + return LSR(max.language, max.script, "", LSR::DONT_CARE_FLAGS, errorCode); + } + if (favorScript) { + // try language and region + test = maximize(max.language, "", max.region, true, errorCode); + if (U_FAILURE(errorCode)) { + return max; + } + if (test.isEquivalentTo(max)) { + return LSR(max.language, "", max.region, LSR::DONT_CARE_FLAGS, errorCode); + } + } + return LSR(max.language, max.script, max.region, LSR::DONT_CARE_FLAGS, errorCode); } -#endif U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.h b/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.h index 8c8a08ac5..ebd9c1530 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.h +++ b/src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // loclikelysubtags.h // created: 2019may08 Markus W. Scherer @@ -11,51 +11,16 @@ #include "unicode/utypes.h" #include "unicode/bytestrie.h" #include "unicode/locid.h" +#include "unicode/stringpiece.h" #include "unicode/uobject.h" #include "unicode/ures.h" +#include "charstrmap.h" #include "lsr.h" -#include "uhash.h" U_NAMESPACE_BEGIN struct XLikelySubtagsData; -/** - * Map of const char * keys & values. - * Stores pointers as is: Does not own/copy/adopt/release strings. - */ -class CharStringMap final : public UMemory { -public: - /** Constructs an unusable non-map. */ - CharStringMap() : map(nullptr) {} - CharStringMap(int32_t size, UErrorCode &errorCode) { - map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars, - size, &errorCode); - } - CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) { - other.map = nullptr; - } - CharStringMap(const CharStringMap &other) = delete; - ~CharStringMap() { - uhash_close(map); - } - - CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT { - map = other.map; - other.map = nullptr; - return *this; - } - CharStringMap &operator=(const CharStringMap &other) = delete; - - const char *get(const char *key) const { return static_cast(uhash_get(map, key)); } - void put(const char *key, const char *value, UErrorCode &errorCode) { - uhash_put(map, const_cast(key), const_cast(value), &errorCode); - } - -private: - UHashtable *map; -}; - struct LocaleDistanceData { LocaleDistanceData() = default; LocaleDistanceData(LocaleDistanceData &&data); @@ -83,15 +48,25 @@ class XLikelySubtags final : public UMemory { static const XLikelySubtags *getSingleton(UErrorCode &errorCode); // VisibleForTesting - LSR makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const; - - // TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code - // in loclikely.cpp to this new code, including activating this - // minimizeSubtags() function. The LocaleMatcher does not minimize. -#if 0 - LSR minimizeSubtags(const char *languageIn, const char *scriptIn, const char *regionIn, - ULocale.Minimize fieldToFavor, UErrorCode &errorCode) const; -#endif + LSR makeMaximizedLsrFrom(const Locale &locale, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const; + + /** + * Tests whether lsr is "more likely" than other. + * For example, fr-Latn-FR is more likely than fr-Latn-CH because + * FR is the default region for fr-Latn. + * + * The likelyInfo caches lookup information between calls. + * The return value is an updated likelyInfo value, + * with bit 0 set if lsr is "more likely". + * The initial value of likelyInfo must be negative. + */ + int32_t compareLikely(const LSR &lsr, const LSR &other, int32_t likelyInfo) const; + + LSR minimizeSubtags(StringPiece language, StringPiece script, StringPiece region, + bool favorScript, + UErrorCode &errorCode) const; // visible for LocaleDistance const LocaleDistanceData &getDistanceData() const { return distanceData; } @@ -104,14 +79,25 @@ class XLikelySubtags final : public UMemory { static void initLikelySubtags(UErrorCode &errorCode); LSR makeMaximizedLsr(const char *language, const char *script, const char *region, - const char *variant, UErrorCode &errorCode) const; + const char *variant, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const; /** * Raw access to addLikelySubtags. Input must be in canonical format, eg "en", not "eng" or "EN". */ - LSR maximize(const char *language, const char *script, const char *region) const; + LSR maximize(const char *language, const char *script, const char *region, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const; + LSR maximize(StringPiece language, StringPiece script, StringPiece region, + bool returnInputIfUnmatch, + UErrorCode &errorCode) const; + + int32_t getLikelyIndex(const char *language, const char *script) const; + bool isMacroregion(StringPiece& region, UErrorCode &errorCode) const; static int32_t trieNext(BytesTrie &iter, const char *s, int32_t i); + static int32_t trieNext(BytesTrie &iter, StringPiece s, int32_t i); UResourceBundle *langInfoBundle; // We could store the strings by value, except that if there were few enough strings, diff --git a/src/duckdb/extension/icu/third_party/icu/common/locmap.cpp b/src/duckdb/extension/icu/third_party/icu/common/locmap.cpp index a63113435..e41cfd102 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locmap.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locmap.cpp @@ -28,8 +28,11 @@ */ #include "locmap.h" +#include "bytesinkutil.h" +#include "charstr.h" #include "cstring.h" #include "cmemory.h" +#include "ulocimp.h" #include "unicode/uloc.h" #if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API @@ -1050,8 +1053,8 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr { uint16_t langID; uint32_t localeIndex; - UBool bLookup = TRUE; - const char *pPosixID = NULL; + UBool bLookup = true; + const char *pPosixID = nullptr; #if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API static_assert(ULOC_FULLNAME_CAPACITY > LOCALE_NAME_MAX_LENGTH, "Windows locale names have smaller length than ICU locale names."); @@ -1071,7 +1074,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr if (tmpLen > 1) { int32_t i = 0; // Only need to look up in table if have _, eg for de-de_phoneb type alternate sort. - bLookup = FALSE; + bLookup = false; for (i = 0; i < UPRV_LENGTHOF(locName); i++) { locName[i] = (char)(windowsLocaleName[i]); @@ -1085,7 +1088,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr // TODO: Should these be mapped from _phoneb to @collation=phonebook, etc.? locName[i] = '\0'; tmpLen = i; - bLookup = TRUE; + bLookup = true; break; } else if (windowsLocaleName[i] == L'-') @@ -1107,7 +1110,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr #endif if (bLookup) { - const char *pCandidate = NULL; + const char *pCandidate = nullptr; langID = LANGUAGE_LCID(hostid); for (localeIndex = 0; localeIndex < gLocaleCount; localeIndex++) { @@ -1120,7 +1123,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr /* On Windows, when locale name has a variant, we still look up the hardcoded table. If a match in the hardcoded table is longer than the Windows locale name without variant, we use the one as the result */ - if (pCandidate && (pPosixID == NULL || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) { + if (pCandidate && (pPosixID == nullptr || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) { pPosixID = pCandidate; } } @@ -1167,15 +1170,18 @@ uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status) // conversion functionality when available. #if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API int32_t len; - char collVal[ULOC_KEYWORDS_CAPACITY] = {}; - char baseName[ULOC_FULLNAME_CAPACITY] = {}; + icu::CharString baseName; const char * mylocaleID = localeID; // Check any for keywords. if (uprv_strchr(localeID, '@')) { - len = uloc_getKeywordValue(localeID, "collation", collVal, UPRV_LENGTHOF(collVal) - 1, status); - if (U_SUCCESS(*status) && len > 0) + icu::CharString collVal; + { + icu::CharStringByteSink sink(&collVal); + ulocimp_getKeywordValue(localeID, "collation", sink, status); + } + if (U_SUCCESS(*status) && !collVal.isEmpty()) { // If it contains the keyword collation, return 0 so that the LCID lookup table will be used. return 0; @@ -1183,19 +1189,23 @@ uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status) else { // If the locale ID contains keywords other than collation, just use the base name. - len = uloc_getBaseName(localeID, baseName, UPRV_LENGTHOF(baseName) - 1, status); - - if (U_SUCCESS(*status) && len > 0) { - baseName[len] = 0; - mylocaleID = baseName; + icu::CharStringByteSink sink(&baseName); + ulocimp_getBaseName(localeID, sink, status); + } + if (U_SUCCESS(*status) && !baseName.isEmpty()) + { + mylocaleID = baseName.data(); } } } - char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {}; // this will change it from de_DE@collation=phonebook to de-DE-u-co-phonebk form - (void)uloc_toLanguageTag(mylocaleID, asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, status); + icu::CharString asciiBCP47Tag; + { + icu::CharStringByteSink sink(&asciiBCP47Tag); + ulocimp_toLanguageTag(mylocaleID, sink, false, status); + } if (U_SUCCESS(*status)) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/locresdata.cpp b/src/duckdb/extension/icu/third_party/icu/common/locresdata.cpp index d1d9a4729..c9d1cdddd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locresdata.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/locresdata.cpp @@ -24,6 +24,8 @@ #include "unicode/putil.h" #include "unicode/uloc.h" #include "unicode/ures.h" +#include "bytesinkutil.h" +#include "charstr.h" #include "cstring.h" #include "ulocimp.h" #include "uresimp.h" @@ -41,7 +43,7 @@ * default locale because that would result in a mix of languages that is * unpredictable to the programmer and most likely useless. */ -U_CAPI const UChar * U_EXPORT2 +U_CAPI const char16_t * U_EXPORT2 uloc_getTableStringWithFallback(const char *path, const char *locale, const char *tableKey, const char *subTableKey, const char *itemKey, @@ -49,7 +51,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale, UErrorCode *pErrorCode) { /* char localeBuffer[ULOC_FULLNAME_CAPACITY*4];*/ - const UChar *item=NULL; + const char16_t *item=nullptr; UErrorCode errorCode; char explicitFallbackName[ULOC_FULLNAME_CAPACITY] = {0}; @@ -63,7 +65,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale, if(U_FAILURE(errorCode)) { /* total failure, not even root could be opened */ *pErrorCode=errorCode; - return NULL; + return nullptr; } else if(errorCode==U_USING_DEFAULT_WARNING || (errorCode==U_USING_FALLBACK_WARNING && *pErrorCode!=U_USING_DEFAULT_WARNING) ) { @@ -76,7 +78,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale, icu::StackUResourceBundle subTable; ures_getByKeyWithFallback(rb.getAlias(), tableKey, table.getAlias(), &errorCode); - if (subTableKey != NULL) { + if (subTableKey != nullptr) { /* ures_getByKeyWithFallback(table.getAlias(), subTableKey, subTable.getAlias(), &errorCode); item = ures_getStringByKeyWithFallback(subTable.getAlias(), itemKey, pLength, &errorCode); @@ -91,7 +93,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale, if(U_SUCCESS(errorCode)){ item = ures_getStringByKeyWithFallback(table.getAlias(), itemKey, pLength, &errorCode); if(U_FAILURE(errorCode)){ - const char* replacement = NULL; + const char* replacement = nullptr; *pErrorCode = errorCode; /*save the errorCode*/ errorCode = U_ZERO_ERROR; /* may be a deprecated code */ @@ -101,7 +103,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale, replacement = uloc_getCurrentLanguageID(itemKey); } /*pointer comparison is ok since uloc_getCurrentCountryID & uloc_getCurrentLanguageID return the key itself is replacement is not found*/ - if(replacement!=NULL && itemKey != replacement){ + if(replacement!=nullptr && itemKey != replacement){ item = ures_getStringByKeyWithFallback(table.getAlias(), replacement, pLength, &errorCode); if(U_SUCCESS(errorCode)){ *pErrorCode = errorCode; @@ -117,7 +119,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale, /* still can't figure out ?.. try the fallback mechanism */ int32_t len = 0; - const UChar* fallbackLocale = NULL; + const char16_t* fallbackLocale = nullptr; *pErrorCode = errorCode; errorCode = U_ZERO_ERROR; @@ -156,18 +158,20 @@ _uloc_getOrientationHelper(const char* localeId, ULayoutType result = ULOC_LAYOUT_UNKNOWN; if (!U_FAILURE(*status)) { - int32_t length = 0; - char localeBuffer[ULOC_FULLNAME_CAPACITY]; - - uloc_canonicalize(localeId, localeBuffer, sizeof(localeBuffer), status); + icu::CharString localeBuffer; + { + icu::CharStringByteSink sink(&localeBuffer); + ulocimp_canonicalize(localeId, sink, status); + } if (!U_FAILURE(*status)) { - const UChar* const value = + int32_t length = 0; + const char16_t* const value = uloc_getTableStringWithFallback( - NULL, - localeBuffer, + nullptr, + localeBuffer.data(), "layout", - NULL, + nullptr, key, &length, status); diff --git a/src/duckdb/extension/icu/third_party/icu/common/locutil.cpp b/src/duckdb/extension/icu/third_party/icu/common/locutil.cpp deleted file mode 100644 index f2bf2b3dd..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/locutil.cpp +++ /dev/null @@ -1,275 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * Copyright (C) 2002-2014, International Business Machines Corporation and -// * others. All Rights Reserved. -// ******************************************************************************* -// */ -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_SERVICE || !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/resbund.h" -// #include "unicode/uenum.h" -// #include "cmemory.h" -// #include "ustrfmt.h" -// #include "locutil.h" -// #include "charstr.h" -// #include "ucln_cmn.h" -// #include "uassert.h" -// #include "umutex.h" - -// // see LocaleUtility::getAvailableLocaleNames -// static icu::UInitOnce LocaleUtilityInitOnce = U_INITONCE_INITIALIZER; -// static icu::Hashtable * LocaleUtility_cache = NULL; - -// #define UNDERSCORE_CHAR ((UChar)0x005f) -// #define AT_SIGN_CHAR ((UChar)64) -// #define PERIOD_CHAR ((UChar)46) - -// /* -// ****************************************************************** -// */ - -// /** -// * Release all static memory held by Locale Utility. -// */ -// U_CDECL_BEGIN -// static UBool U_CALLCONV service_cleanup(void) { -// if (LocaleUtility_cache) { -// delete LocaleUtility_cache; -// LocaleUtility_cache = NULL; -// } -// return TRUE; -// } - - -// static void U_CALLCONV locale_utility_init(UErrorCode &status) { -// using namespace icu; -// U_ASSERT(LocaleUtility_cache == NULL); -// ucln_common_registerCleanup(UCLN_COMMON_SERVICE, service_cleanup); -// LocaleUtility_cache = new Hashtable(status); -// if (U_FAILURE(status)) { -// delete LocaleUtility_cache; -// LocaleUtility_cache = NULL; -// return; -// } -// if (LocaleUtility_cache == NULL) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// LocaleUtility_cache->setValueDeleter(uhash_deleteHashtable); -// } - -// U_CDECL_END - -// U_NAMESPACE_BEGIN - -// UnicodeString& -// LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& result) -// { -// if (id == NULL) { -// result.setToBogus(); -// } else { -// // Fix case only (no other changes) up to the first '@' or '.' or -// // end of string, whichever comes first. In 3.0 I changed this to -// // stop at first '@' or '.'. It used to run out to the end of -// // string. My fix makes the tests pass but is probably -// // structurally incorrect. See below. [alan 3.0] - -// // TODO: Doug, you might want to revise this... -// result = *id; -// int32_t i = 0; -// int32_t end = result.indexOf(AT_SIGN_CHAR); -// int32_t n = result.indexOf(PERIOD_CHAR); -// if (n >= 0 && n < end) { -// end = n; -// } -// if (end < 0) { -// end = result.length(); -// } -// n = result.indexOf(UNDERSCORE_CHAR); -// if (n < 0) { -// n = end; -// } -// for (; i < n; ++i) { -// UChar c = result.charAt(i); -// if (c >= 0x0041 && c <= 0x005a) { -// c += 0x20; -// result.setCharAt(i, c); -// } -// } -// for (n = end; i < n; ++i) { -// UChar c = result.charAt(i); -// if (c >= 0x0061 && c <= 0x007a) { -// c -= 0x20; -// result.setCharAt(i, c); -// } -// } -// } -// return result; - -// #if 0 -// // This code does a proper full level 2 canonicalization of id. -// // It's nasty to go from UChar to char to char to UChar -- but -// // that's what you have to do to use the uloc_canonicalize -// // function on UnicodeStrings. - -// // I ended up doing the alternate fix (see above) not for -// // performance reasons, although performance will certainly be -// // better, but because doing a full level 2 canonicalization -// // causes some tests to fail. [alan 3.0] - -// // TODO: Doug, you might want to revisit this... -// result.setToBogus(); -// if (id != 0) { -// int32_t buflen = id->length() + 8; // space for NUL -// char* buf = (char*) uprv_malloc(buflen); -// char* canon = (buf == 0) ? 0 : (char*) uprv_malloc(buflen); -// if (buf != 0 && canon != 0) { -// U_ASSERT(id->extract(0, INT32_MAX, buf, buflen) < buflen); -// UErrorCode ec = U_ZERO_ERROR; -// uloc_canonicalize(buf, canon, buflen, &ec); -// if (U_SUCCESS(ec)) { -// result = UnicodeString(canon); -// } -// } -// uprv_free(buf); -// uprv_free(canon); -// } -// return result; -// #endif -// } - -// Locale& -// LocaleUtility::initLocaleFromName(const UnicodeString& id, Locale& result) -// { -// enum { BUFLEN = 128 }; // larger than ever needed - -// if (id.isBogus() || id.length() >= BUFLEN) { -// result.setToBogus(); -// } else { -// /* -// * We need to convert from a UnicodeString to char * in order to -// * create a Locale. -// * -// * Problem: Locale ID strings may contain '@' which is a variant -// * character and cannot be handled by invariant-character conversion. -// * -// * Hack: Since ICU code can handle locale IDs with multiple encodings -// * of '@' (at least for EBCDIC; it's not known to be a problem for -// * ASCII-based systems), -// * we use regular invariant-character conversion for everything else -// * and manually convert U+0040 into a compiler-char-constant '@'. -// * While this compilation-time constant may not match the runtime -// * encoding of '@', it should be one of the encodings which ICU -// * recognizes. -// * -// * There should be only at most one '@' in a locale ID. -// */ -// char buffer[BUFLEN]; -// int32_t prev, i; -// prev = 0; -// for(;;) { -// i = id.indexOf((UChar)0x40, prev); -// if(i < 0) { -// // no @ between prev and the rest of the string -// id.extract(prev, INT32_MAX, buffer + prev, BUFLEN - prev, US_INV); -// break; // done -// } else { -// // normal invariant-character conversion for text between @s -// id.extract(prev, i - prev, buffer + prev, BUFLEN - prev, US_INV); -// // manually "convert" U+0040 at id[i] into '@' at buffer[i] -// buffer[i] = '@'; -// prev = i + 1; -// } -// } -// result = Locale::createFromName(buffer); -// } -// return result; -// } - -// UnicodeString& -// LocaleUtility::initNameFromLocale(const Locale& locale, UnicodeString& result) -// { -// if (locale.isBogus()) { -// result.setToBogus(); -// } else { -// result.append(UnicodeString(locale.getName(), -1, US_INV)); -// } -// return result; -// } - -// const Hashtable* -// LocaleUtility::getAvailableLocaleNames(const UnicodeString& bundleID) -// { -// // LocaleUtility_cache is a hash-of-hashes. The top-level keys -// // are path strings ('bundleID') passed to -// // ures_openAvailableLocales. The top-level values are -// // second-level hashes. The second-level keys are result strings -// // from ures_openAvailableLocales. The second-level values are -// // garbage ((void*)1 or other random pointer). - -// UErrorCode status = U_ZERO_ERROR; -// umtx_initOnce(LocaleUtilityInitOnce, locale_utility_init, status); -// Hashtable *cache = LocaleUtility_cache; -// if (cache == NULL) { -// // Catastrophic failure. -// return NULL; -// } - -// Hashtable* htp; -// umtx_lock(NULL); -// htp = (Hashtable*) cache->get(bundleID); -// umtx_unlock(NULL); - -// if (htp == NULL) { -// htp = new Hashtable(status); -// if (htp && U_SUCCESS(status)) { -// CharString cbundleID; -// cbundleID.appendInvariantChars(bundleID, status); -// const char* path = cbundleID.isEmpty() ? NULL : cbundleID.data(); -// icu::LocalUEnumerationPointer uenum(ures_openAvailableLocales(path, &status)); -// for (;;) { -// const UChar* id = uenum_unext(uenum.getAlias(), NULL, &status); -// if (id == NULL) { -// break; -// } -// htp->put(UnicodeString(id), (void*)htp, status); -// } -// if (U_FAILURE(status)) { -// delete htp; -// return NULL; -// } -// umtx_lock(NULL); -// Hashtable *t = static_cast(cache->get(bundleID)); -// if (t != NULL) { -// // Another thread raced through this code, creating the cache entry first. -// // Discard ours and return theirs. -// umtx_unlock(NULL); -// delete htp; -// htp = t; -// } else { -// cache->put(bundleID, (void*)htp, status); -// umtx_unlock(NULL); -// } -// } -// } -// return htp; -// } - -// UBool -// LocaleUtility::isFallbackOf(const UnicodeString& root, const UnicodeString& child) -// { -// return child.indexOf(root) == 0 && -// (child.length() == root.length() || -// child.charAt(root.length()) == UNDERSCORE_CHAR); -// } - -// U_NAMESPACE_END - -// /* !UCONFIG_NO_SERVICE */ -// #endif - - diff --git a/src/duckdb/extension/icu/third_party/icu/common/locutil.h b/src/duckdb/extension/icu/third_party/icu/common/locutil.h index d5f9dbc7f..31bfffd7a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/locutil.h +++ b/src/duckdb/extension/icu/third_party/icu/common/locutil.h @@ -1,39 +1,39 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /** -// ******************************************************************************* -// * Copyright (C) 2002-2005, International Business Machines Corporation and * -// * others. All Rights Reserved. * -// ******************************************************************************* -// * -// ******************************************************************************* -// */ -// #ifndef LOCUTIL_H -// #define LOCUTIL_H +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/** + ******************************************************************************* + * Copyright (C) 2002-2005, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + * + ******************************************************************************* + */ +#ifndef LOCUTIL_H +#define LOCUTIL_H -// #include "unicode/utypes.h" -// #include "hash.h" +#include "unicode/utypes.h" +#include "hash.h" -// #if !UCONFIG_NO_SERVICE || !UCONFIG_NO_TRANSLITERATION +#if !UCONFIG_NO_SERVICE || !UCONFIG_NO_TRANSLITERATION -// U_NAMESPACE_BEGIN +U_NAMESPACE_BEGIN -// // temporary utility functions, till I know where to find them -// // in header so tests can also access them +// temporary utility functions, till I know where to find them +// in header so tests can also access them -// class U_COMMON_API LocaleUtility { -// public: -// static UnicodeString& canonicalLocaleString(const UnicodeString* id, UnicodeString& result); -// static Locale& initLocaleFromName(const UnicodeString& id, Locale& result); -// static UnicodeString& initNameFromLocale(const Locale& locale, UnicodeString& result); -// static const Hashtable* getAvailableLocaleNames(const UnicodeString& bundleID); -// static UBool isFallbackOf(const UnicodeString& root, const UnicodeString& child); -// }; +class U_COMMON_API LocaleUtility { +public: + static UnicodeString& canonicalLocaleString(const UnicodeString* id, UnicodeString& result); + static Locale& initLocaleFromName(const UnicodeString& id, Locale& result); + static UnicodeString& initNameFromLocale(const Locale& locale, UnicodeString& result); + static const Hashtable* getAvailableLocaleNames(const UnicodeString& bundleID); + static UBool isFallbackOf(const UnicodeString& root, const UnicodeString& child); +}; -// U_NAMESPACE_END +U_NAMESPACE_END -// #endif +#endif -// #endif +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/lsr.cpp b/src/duckdb/extension/icu/third_party/icu/common/lsr.cpp index 8dca9dbbe..bd231ecdb 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/lsr.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/lsr.cpp @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // lsr.cpp // created: 2019may08 Markus W. Scherer @@ -14,9 +14,10 @@ U_NAMESPACE_BEGIN -LSR::LSR(char prefix, const char *lang, const char *scr, const char *r, UErrorCode &errorCode) : +LSR::LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f, + UErrorCode &errorCode) : language(nullptr), script(nullptr), region(r), - regionIndex(indexForRegion(region)) { + regionIndex(indexForRegion(region)), flags(f) { if (U_SUCCESS(errorCode)) { CharString langScript; langScript.append(prefix, errorCode).append(lang, errorCode).append('\0', errorCode); @@ -30,9 +31,30 @@ LSR::LSR(char prefix, const char *lang, const char *scr, const char *r, UErrorCo } } -LSR::LSR(LSR &&other) U_NOEXCEPT : +LSR::LSR(StringPiece lang, StringPiece scr, StringPiece r, int32_t f, + UErrorCode &errorCode) : + language(nullptr), script(nullptr), region(nullptr), + regionIndex(indexForRegion(r.data())), flags(f) { + if (U_SUCCESS(errorCode)) { + CharString data; + data.append(lang, errorCode).append('\0', errorCode); + int32_t scriptOffset = data.length(); + data.append(scr, errorCode).append('\0', errorCode); + int32_t regionOffset = data.length(); + data.append(r, errorCode); + owned = data.cloneData(errorCode); + if (U_SUCCESS(errorCode)) { + language = owned; + script = owned + scriptOffset; + region = owned + regionOffset; + } + } +} + +LSR::LSR(LSR &&other) noexcept : language(other.language), script(other.script), region(other.region), owned(other.owned), - regionIndex(other.regionIndex), hashCode(other.hashCode) { + regionIndex(other.regionIndex), flags(other.flags), + hashCode(other.hashCode) { if (owned != nullptr) { other.language = other.script = ""; other.owned = nullptr; @@ -44,12 +66,13 @@ void LSR::deleteOwned() { uprv_free(owned); } -LSR &LSR::operator=(LSR &&other) U_NOEXCEPT { +LSR &LSR::operator=(LSR &&other) noexcept { this->~LSR(); language = other.language; script = other.script; region = other.region; regionIndex = other.regionIndex; + flags = other.flags; owned = other.owned; hashCode = other.hashCode; if (owned != nullptr) { @@ -60,7 +83,7 @@ LSR &LSR::operator=(LSR &&other) U_NOEXCEPT { return *this; } -bool LSR::operator==(const LSR &other) const { +UBool LSR::isEquivalentTo(const LSR &other) const { return uprv_strcmp(language, other.language) == 0 && uprv_strcmp(script, other.script) == 0 && @@ -69,6 +92,16 @@ bool LSR::operator==(const LSR &other) const { (regionIndex > 0 || uprv_strcmp(region, other.region) == 0); } +bool LSR::operator==(const LSR &other) const { + return + uprv_strcmp(language, other.language) == 0 && + uprv_strcmp(script, other.script) == 0 && + regionIndex == other.regionIndex && + // Compare regions if both are ill-formed (and their indexes are 0). + (regionIndex > 0 || uprv_strcmp(region, other.region) == 0) && + flags == other.flags; +} + int32_t LSR::indexForRegion(const char *region) { int32_t c = region[0]; int32_t a = c - '0'; @@ -90,10 +123,10 @@ int32_t LSR::indexForRegion(const char *region) { LSR &LSR::setHashCode() { if (hashCode == 0) { - hashCode = - (ustr_hashCharsN(language, static_cast(uprv_strlen(language))) * 37 + - ustr_hashCharsN(script, static_cast(uprv_strlen(script)))) * 37 + - regionIndex; + uint32_t h = ustr_hashCharsN(language, static_cast(uprv_strlen(language))); + h = h * 37 + ustr_hashCharsN(script, static_cast(uprv_strlen(script))); + h = h * 37 + regionIndex; + hashCode = h * 37 + flags; } return *this; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/lsr.h b/src/duckdb/extension/icu/third_party/icu/common/lsr.h index 84769cf74..313286e93 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/lsr.h +++ b/src/duckdb/extension/icu/third_party/icu/common/lsr.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // lsr.h // created: 2019may08 Markus W. Scherer @@ -7,6 +7,7 @@ #ifndef __LSR_H__ #define __LSR_H__ +#include "unicode/stringpiece.h" #include "unicode/utypes.h" #include "unicode/uobject.h" #include "cstring.h" @@ -16,27 +17,38 @@ U_NAMESPACE_BEGIN struct LSR final : public UMemory { static constexpr int32_t REGION_INDEX_LIMIT = 1001 + 26 * 26; + static constexpr int32_t EXPLICIT_LSR = 7; + static constexpr int32_t EXPLICIT_LANGUAGE = 4; + static constexpr int32_t EXPLICIT_SCRIPT = 2; + static constexpr int32_t EXPLICIT_REGION = 1; + static constexpr int32_t IMPLICIT_LSR = 0; + static constexpr int32_t DONT_CARE_FLAGS = 0; + const char *language; const char *script; const char *region; char *owned = nullptr; /** Index for region, 0 if ill-formed. @see indexForRegion */ int32_t regionIndex = 0; + int32_t flags = 0; /** Only set for LSRs that will be used in a hash table. */ int32_t hashCode = 0; LSR() : language("und"), script(""), region("") {} /** Constructor which aliases all subtag pointers. */ - LSR(const char *lang, const char *scr, const char *r) : + LSR(const char *lang, const char *scr, const char *r, int32_t f) : language(lang), script(scr), region(r), - regionIndex(indexForRegion(region)) {} + regionIndex(indexForRegion(region)), flags(f) {} /** * Constructor which prepends the prefix to the language and script, * copies those into owned memory, and aliases the region. */ - LSR(char prefix, const char *lang, const char *scr, const char *r, UErrorCode &errorCode); - LSR(LSR &&other) U_NOEXCEPT; + LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f, + UErrorCode &errorCode); + LSR(StringPiece lang, StringPiece scr, StringPiece r, int32_t f, + UErrorCode &errorCode); + LSR(LSR &&other) noexcept; LSR(const LSR &other) = delete; inline ~LSR() { // Pure inline code for almost all instances. @@ -45,7 +57,7 @@ struct LSR final : public UMemory { } } - LSR &operator=(LSR &&other) U_NOEXCEPT; + LSR &operator=(LSR &&other) noexcept; LSR &operator=(const LSR &other) = delete; /** @@ -55,6 +67,7 @@ struct LSR final : public UMemory { */ static int32_t indexForRegion(const char *region); + UBool isEquivalentTo(const LSR &other) const; bool operator==(const LSR &other) const; inline bool operator!=(const LSR &other) const { diff --git a/src/duckdb/extension/icu/third_party/icu/common/messageimpl.h b/src/duckdb/extension/icu/third_party/icu/common/messageimpl.h index dc7a6edd6..061df9189 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/messageimpl.h +++ b/src/duckdb/extension/icu/third_party/icu/common/messageimpl.h @@ -33,7 +33,7 @@ U_NAMESPACE_BEGIN class U_COMMON_API MessageImpl { public: /** - * @return TRUE if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED + * @return true if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED */ static UBool jdkAposMode(const MessagePattern &msgPattern) { return msgPattern.getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED; @@ -55,7 +55,7 @@ class U_COMMON_API MessageImpl { UnicodeString &result); private: - MessageImpl(); // no constructor: all static methods + MessageImpl() = delete; // no constructor: all static methods }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp b/src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp index b2956cb66..82cb638e4 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp @@ -32,56 +32,56 @@ U_NAMESPACE_BEGIN // Unicode character/code point constants ---------------------------------- *** -static const UChar u_pound=0x23; -static const UChar u_apos=0x27; -static const UChar u_plus=0x2B; -static const UChar u_comma=0x2C; -static const UChar u_minus=0x2D; -static const UChar u_dot=0x2E; -static const UChar u_colon=0x3A; -static const UChar u_lessThan=0x3C; -static const UChar u_equal=0x3D; -static const UChar u_A=0x41; -static const UChar u_C=0x43; -static const UChar u_D=0x44; -static const UChar u_E=0x45; -static const UChar u_H=0x48; -static const UChar u_I=0x49; -static const UChar u_L=0x4C; -static const UChar u_N=0x4E; -static const UChar u_O=0x4F; -static const UChar u_P=0x50; -static const UChar u_R=0x52; -static const UChar u_S=0x53; -static const UChar u_T=0x54; -static const UChar u_U=0x55; -static const UChar u_Z=0x5A; -static const UChar u_a=0x61; -static const UChar u_c=0x63; -static const UChar u_d=0x64; -static const UChar u_e=0x65; -static const UChar u_f=0x66; -static const UChar u_h=0x68; -static const UChar u_i=0x69; -static const UChar u_l=0x6C; -static const UChar u_n=0x6E; -static const UChar u_o=0x6F; -static const UChar u_p=0x70; -static const UChar u_r=0x72; -static const UChar u_s=0x73; -static const UChar u_t=0x74; -static const UChar u_u=0x75; -static const UChar u_z=0x7A; -static const UChar u_leftCurlyBrace=0x7B; -static const UChar u_pipe=0x7C; -static const UChar u_rightCurlyBrace=0x7D; -static const UChar u_lessOrEqual=0x2264; // U+2264 is <= - -static const UChar kOffsetColon[]={ // "offset:" +static const char16_t u_pound=0x23; +static const char16_t u_apos=0x27; +static const char16_t u_plus=0x2B; +static const char16_t u_comma=0x2C; +static const char16_t u_minus=0x2D; +static const char16_t u_dot=0x2E; +static const char16_t u_colon=0x3A; +static const char16_t u_lessThan=0x3C; +static const char16_t u_equal=0x3D; +static const char16_t u_A=0x41; +static const char16_t u_C=0x43; +static const char16_t u_D=0x44; +static const char16_t u_E=0x45; +static const char16_t u_H=0x48; +static const char16_t u_I=0x49; +static const char16_t u_L=0x4C; +static const char16_t u_N=0x4E; +static const char16_t u_O=0x4F; +static const char16_t u_P=0x50; +static const char16_t u_R=0x52; +static const char16_t u_S=0x53; +static const char16_t u_T=0x54; +static const char16_t u_U=0x55; +static const char16_t u_Z=0x5A; +static const char16_t u_a=0x61; +static const char16_t u_c=0x63; +static const char16_t u_d=0x64; +static const char16_t u_e=0x65; +static const char16_t u_f=0x66; +static const char16_t u_h=0x68; +static const char16_t u_i=0x69; +static const char16_t u_l=0x6C; +static const char16_t u_n=0x6E; +static const char16_t u_o=0x6F; +static const char16_t u_p=0x70; +static const char16_t u_r=0x72; +static const char16_t u_s=0x73; +static const char16_t u_t=0x74; +static const char16_t u_u=0x75; +static const char16_t u_z=0x7A; +static const char16_t u_leftCurlyBrace=0x7B; +static const char16_t u_pipe=0x7C; +static const char16_t u_rightCurlyBrace=0x7D; +static const char16_t u_lessOrEqual=0x2264; // U+2264 is <= + +static const char16_t kOffsetColon[]={ // "offset:" u_o, u_f, u_f, u_s, u_e, u_t, u_colon }; -static const UChar kOther[]={ // "other" +static const char16_t kOther[]={ // "other" u_o, u_t, u_h, u_e, u_r }; @@ -97,9 +97,9 @@ class MessagePatternList : public UMemory { UBool ensureCapacityForOneMore(int32_t oldLength, UErrorCode &errorCode); UBool equals(const MessagePatternList &other, int32_t length) const { for(int32_t i=0; i a; @@ -112,7 +112,7 @@ MessagePatternList::copyFrom( int32_t length, UErrorCode &errorCode) { if(U_SUCCESS(errorCode) && length>0) { - if(length>a.getCapacity() && NULL==a.resize(length)) { + if(length>a.getCapacity() && nullptr==a.resize(length)) { errorCode=U_MEMORY_ALLOCATION_ERROR; return; } @@ -124,13 +124,13 @@ template UBool MessagePatternList::ensureCapacityForOneMore(int32_t oldLength, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } - if(a.getCapacity()>oldLength || a.resize(2*oldLength, oldLength)!=NULL) { - return TRUE; + if(a.getCapacity()>oldLength || a.resize(2*oldLength, oldLength)!=nullptr) { + return true; } errorCode=U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } // MessagePatternList specializations -------------------------------------- *** @@ -145,25 +145,25 @@ class MessagePatternPartsList : public MessagePatternLista.getAlias(); - return TRUE; + return true; } MessagePattern::MessagePattern(const MessagePattern &other) : UObject(other), aposMode(other.aposMode), msg(other.msg), - partsList(NULL), parts(NULL), partsLength(0), - numericValuesList(NULL), numericValues(NULL), numericValuesLength(0), + partsList(nullptr), parts(nullptr), partsLength(0), + numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0), hasArgNames(other.hasArgNames), hasArgNumbers(other.hasArgNumbers), needsAutoQuoting(other.needsAutoQuoting) { UErrorCode errorCode=U_ZERO_ERROR; @@ -215,46 +215,46 @@ MessagePattern::operator=(const MessagePattern &other) { UBool MessagePattern::copyStorage(const MessagePattern &other, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } - parts=NULL; + parts=nullptr; partsLength=0; - numericValues=NULL; + numericValues=nullptr; numericValuesLength=0; - if(partsList==NULL) { + if(partsList==nullptr) { partsList=new MessagePatternPartsList(); - if(partsList==NULL) { + if(partsList==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } parts=partsList->a.getAlias(); } if(other.partsLength>0) { partsList->copyFrom(*other.partsList, other.partsLength, errorCode); if(U_FAILURE(errorCode)) { - return FALSE; + return false; } parts=partsList->a.getAlias(); partsLength=other.partsLength; } if(other.numericValuesLength>0) { - if(numericValuesList==NULL) { + if(numericValuesList==nullptr) { numericValuesList=new MessagePatternDoubleList(); - if(numericValuesList==NULL) { + if(numericValuesList==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } numericValues=numericValuesList->a.getAlias(); } numericValuesList->copyFrom( *other.numericValuesList, other.numericValuesLength, errorCode); if(U_FAILURE(errorCode)) { - return FALSE; + return false; } numericValues=numericValuesList->a.getAlias(); numericValuesLength=other.numericValuesLength; } - return TRUE; + return true; } MessagePattern::~MessagePattern() { @@ -303,8 +303,8 @@ void MessagePattern::clear() { // Mostly the same as preParse(). msg.remove(); - hasArgNames=hasArgNumbers=FALSE; - needsAutoQuoting=FALSE; + hasArgNames=hasArgNumbers=false; + needsAutoQuoting=false; partsLength=0; numericValuesLength=0; } @@ -312,7 +312,7 @@ MessagePattern::clear() { bool MessagePattern::operator==(const MessagePattern &other) const { if(this==&other) { - return TRUE; + return true; } return aposMode==other.aposMode && @@ -351,7 +351,7 @@ MessagePattern::autoQuoteApostropheDeep() const { for(int32_t i=count; i>0;) { const Part &part=getPart(--i); if(part.getType()==UMSGPAT_PART_TYPE_INSERT_CHAR) { - modified.insert(part.index, (UChar)part.value); + modified.insert(part.index, (char16_t)part.value); } } return modified; @@ -390,7 +390,7 @@ MessagePattern::getPluralOffset(int32_t pluralStart) const { bool MessagePattern::Part::operator==(const Part &other) const { if(this==&other) { - return TRUE; + return true; } return type==other.type && @@ -407,25 +407,25 @@ MessagePattern::preParse(const UnicodeString &pattern, UParseError *parseError, if(U_FAILURE(errorCode)) { return; } - if(parseError!=NULL) { + if(parseError!=nullptr) { parseError->line=0; parseError->offset=0; parseError->preContext[0]=0; parseError->postContext[0]=0; } msg=pattern; - hasArgNames=hasArgNumbers=FALSE; - needsAutoQuoting=FALSE; + hasArgNames=hasArgNumbers=false; + needsAutoQuoting=false; partsLength=0; numericValuesLength=0; } void MessagePattern::postParse() { - if(partsList!=NULL) { + if(partsList!=nullptr) { parts=partsList->a.getAlias(); } - if(numericValuesList!=NULL) { + if(numericValuesList!=nullptr) { numericValues=numericValuesList->a.getAlias(); } } @@ -451,14 +451,14 @@ MessagePattern::parseMessage(int32_t index, int32_t msgStartLength, if(index>=msg.length()) { break; } - UChar c=msg.charAt(index++); + char16_t c=msg.charAt(index++); if(c==u_apos) { if(index==msg.length()) { // The apostrophe is the last character in the pattern. // Add a Part for auto-quoting. addPart(UMSGPAT_PART_TYPE_INSERT_CHAR, index, 0, u_apos, errorCode); // value=char to be inserted - needsAutoQuoting=TRUE; + needsAutoQuoting=true; } else { c=msg.charAt(index); if(c==u_apos) { @@ -491,7 +491,7 @@ MessagePattern::parseMessage(int32_t index, int32_t msgStartLength, // Add a Part for auto-quoting. addPart(UMSGPAT_PART_TYPE_INSERT_CHAR, index, 0, u_apos, errorCode); // value=char to be inserted - needsAutoQuoting=TRUE; + needsAutoQuoting=true; break; } } @@ -500,7 +500,7 @@ MessagePattern::parseMessage(int32_t index, int32_t msgStartLength, // Add a Part for auto-quoting. addPart(UMSGPAT_PART_TYPE_INSERT_CHAR, index, 0, u_apos, errorCode); // value=char to be inserted - needsAutoQuoting=TRUE; + needsAutoQuoting=true; } } } else if(UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE(parentType) && c==u_pound) { @@ -560,7 +560,7 @@ MessagePattern::parseArg(int32_t index, int32_t argStartLength, int32_t nestingL errorCode=U_INDEX_OUTOFBOUNDS_ERROR; return 0; } - hasArgNumbers=TRUE; + hasArgNumbers=true; addPart(UMSGPAT_PART_TYPE_ARG_NUMBER, nameIndex, length, number, errorCode); } else if(number==UMSGPAT_ARG_NAME_NOT_NUMBER) { int32_t length=index-nameIndex; @@ -569,7 +569,7 @@ MessagePattern::parseArg(int32_t index, int32_t argStartLength, int32_t nestingL errorCode=U_INDEX_OUTOFBOUNDS_ERROR; return 0; } - hasArgNames=TRUE; + hasArgNames=true; addPart(UMSGPAT_PART_TYPE_ARG_NAME, nameIndex, length, 0, errorCode); } else { // number<-1 (ARG_NAME_NOT_VALID) setParseError(parseError, nameIndex); // Bad argument syntax. @@ -582,7 +582,7 @@ MessagePattern::parseArg(int32_t index, int32_t argStartLength, int32_t nestingL errorCode=U_UNMATCHED_BRACES; return 0; } - UChar c=msg.charAt(index); + char16_t c=msg.charAt(index); if(c==u_rightCurlyBrace) { // all done } else if(c!=u_comma) { @@ -663,7 +663,7 @@ MessagePattern::parseSimpleStyle(int32_t index, UParseError *parseError, UErrorC int32_t start=index; int32_t nestedBraces=0; while(index=INT32_MAX/10) { - badNumber=TRUE; // overflow + badNumber=true; // overflow } number=number*10+(c-0x30); } else { @@ -941,7 +941,7 @@ MessagePattern::parseDouble(int32_t start, int32_t limit, UBool allowInfinity, int32_t value=0; int32_t isNegative=0; // not boolean so that we can easily add it to value int32_t index=start; - UChar c=msg.charAt(index++); + char16_t c=msg.charAt(index++); if(c==u_minus) { isNegative=1; if(index==limit) { @@ -1004,17 +1004,17 @@ MessagePattern::parseDouble(int32_t start, int32_t limit, UBool allowInfinity, int32_t MessagePattern::skipWhiteSpace(int32_t index) { - const UChar *s=msg.getBuffer(); + const char16_t *s=msg.getBuffer(); int32_t msgLength=msg.length(); - const UChar *t=PatternProps::skipWhiteSpace(s+index, msgLength-index); + const char16_t *t=PatternProps::skipWhiteSpace(s+index, msgLength-index); return (int32_t)(t-s); } int32_t MessagePattern::skipIdentifier(int32_t index) { - const UChar *s=msg.getBuffer(); + const char16_t *s=msg.getBuffer(); int32_t msgLength=msg.length(); - const UChar *t=PatternProps::skipIdentifier(s+index, msgLength-index); + const char16_t *t=PatternProps::skipIdentifier(s+index, msgLength-index); return (int32_t)(t-s); } @@ -1022,7 +1022,7 @@ int32_t MessagePattern::skipDouble(int32_t index) { int32_t msgLength=msg.length(); while(index0x39 && c!=u_e && c!=u_E && c!=0x221e)) { break; @@ -1039,7 +1039,7 @@ MessagePattern::isArgTypeChar(UChar32 c) { UBool MessagePattern::isChoice(int32_t index) { - UChar c; + char16_t c; return ((c=msg.charAt(index++))==u_c || c==u_C) && ((c=msg.charAt(index++))==u_h || c==u_H) && @@ -1051,7 +1051,7 @@ MessagePattern::isChoice(int32_t index) { UBool MessagePattern::isPlural(int32_t index) { - UChar c; + char16_t c; return ((c=msg.charAt(index++))==u_p || c==u_P) && ((c=msg.charAt(index++))==u_l || c==u_L) && @@ -1063,7 +1063,7 @@ MessagePattern::isPlural(int32_t index) { UBool MessagePattern::isSelect(int32_t index) { - UChar c; + char16_t c; return ((c=msg.charAt(index++))==u_s || c==u_S) && ((c=msg.charAt(index++))==u_e || c==u_E) && @@ -1075,7 +1075,7 @@ MessagePattern::isSelect(int32_t index) { UBool MessagePattern::isOrdinal(int32_t index) { - UChar c; + char16_t c; return ((c=msg.charAt(index++))==u_o || c==u_O) && ((c=msg.charAt(index++))==u_r || c==u_R) && @@ -1127,9 +1127,9 @@ MessagePattern::addArgDoublePart(double numericValue, int32_t start, int32_t len return; } int32_t numericIndex=numericValuesLength; - if(numericValuesList==NULL) { + if(numericValuesList==nullptr) { numericValuesList=new MessagePatternDoubleList(); - if(numericValuesList==NULL) { + if(numericValuesList==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; return; } @@ -1147,7 +1147,7 @@ MessagePattern::addArgDoublePart(double numericValue, int32_t start, int32_t len void MessagePattern::setParseError(UParseError *parseError, int32_t index) { - if(parseError==NULL) { + if(parseError==nullptr) { return; } parseError->offset=index; diff --git a/src/duckdb/extension/icu/third_party/icu/common/msvcres.h b/src/duckdb/extension/icu/third_party/icu/common/msvcres.h index 0cace85e7..d71b5ac92 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/msvcres.h +++ b/src/duckdb/extension/icu/third_party/icu/common/msvcres.h @@ -19,7 +19,7 @@ STLPort's broken stddef.h from being used when rc.exe parses this file. #include "unicode/uversion.h" -#define ICU_WEBSITE "http://icu-project.org" +#define ICU_WEBSITE "https://icu.unicode.org/" #define ICU_COMPANY "The ICU Project" #define ICU_PRODUCT_PREFIX "ICU" #define ICU_PRODUCT "International Components for Unicode" diff --git a/src/duckdb/extension/icu/third_party/icu/common/norm2_nfc_data.h b/src/duckdb/extension/icu/third_party/icu/common/norm2_nfc_data.h index 7a80be9de..3dada06c5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/norm2_nfc_data.h +++ b/src/duckdb/extension/icu/third_party/icu/common/norm2_nfc_data.h @@ -1,6 +1,5 @@ -// © 2016 and later: Unicode, Inc. and others. +// Copyright (C) 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -// // Copyright (C) 1999-2016, International Business Machines // Corporation and others. All Rights Reserved. // @@ -8,31 +7,30 @@ // // machine-generated by: icu/source/tools/gennorm2/n2builder.cpp - #ifdef INCLUDED_FROM_NORMALIZER2_CPP -// static const UVersionInfo norm2_nfc_data_formatVersion={4,0,0,0}; -// static const UVersionInfo norm2_nfc_data_dataVersion={0xd,0,0,0}; +static const UVersionInfo norm2_nfc_data_formatVersion={4,0,0,0}; +static const UVersionInfo norm2_nfc_data_dataVersion={0xf,1,0,0}; static const int32_t norm2_nfc_data_indexes[Normalizer2Impl::IX_COUNT]={ -0x50,0x4bac,0x8814,0x8914,0x8914,0x8914,0x8914,0x8914,0xc0,0x300,0xae2,0x29e0,0x3c66,0xfc00,0x1288,0x3b9c, +0x50,0x4cb8,0x8920,0x8a20,0x8a20,0x8a20,0x8a20,0x8a20,0xc0,0x300,0xae2,0x29e0,0x3c66,0xfc00,0x1288,0x3b9c, 0x3c34,0x3c66,0x300,0 }; -static const uint16_t norm2_nfc_data_trieIndex[1746]={ +static const uint16_t norm2_nfc_data_trieIndex[1788]={ 0,0x40,0x7b,0xbb,0xfb,0x13a,0x17a,0x1b2,0x1f2,0x226,0x254,0x226,0x294,0x2d4,0x313,0x353, 0x393,0x3d2,0x40f,0x44e,0x226,0x226,0x488,0x4c8,0x4f8,0x530,0x226,0x570,0x59f,0x5de,0x226,0x5f3, -0x631,0x65f,0x226,0x68c,0x6cc,0x709,0x729,0x768,0x7a7,0x7e4,0x803,0x840,0x729,0x879,0x8a7,0x8e6, -0x226,0x920,0x937,0x977,0x98e,0x9cd,0x226,0xa03,0xa23,0xa5e,0xa6a,0xaa5,0xacd,0xb0a,0xb4a,0xb84, -0xb9f,0x226,0xbda,0x226,0xc1a,0xc39,0xc6f,0xcac,0x226,0x226,0x226,0x226,0x226,0xccf,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xcfb,0x226,0x226,0xd30, -0x226,0x226,0xd4e,0x226,0xd78,0x226,0x226,0x226,0xdb4,0xdd4,0xe14,0xe53,0xe8e,0xece,0xf02,0xf2e, -0x808,0x226,0x226,0xf62,0x226,0x226,0x226,0xfa2,0xfe2,0x1022,0x1062,0x10a2,0x10e2,0x1122,0x1162,0x11a2, -0x11e2,0x226,0x226,0x1212,0x1243,0x226,0x1273,0x12a6,0x12e3,0x1322,0x1362,0x1398,0x13c6,0x226,0x226,0x226, +0x631,0x65f,0x687,0x6bd,0x6fd,0x73a,0x75a,0x799,0x7d8,0x815,0x834,0x871,0x75a,0x8aa,0x8d8,0x917, +0x834,0x951,0x968,0x9a8,0x9bf,0x9fe,0x226,0xa34,0xa54,0xa8f,0xa9b,0xad6,0xafe,0xb3b,0xb7b,0xbb5, +0xbd0,0x226,0xc0b,0x226,0xc4b,0xc6a,0xca0,0xcdd,0x226,0x226,0x226,0x226,0x226,0xd00,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xd2c,0x226,0x226,0xd61, +0x226,0x226,0xd7f,0x226,0xda9,0x226,0x226,0x226,0xde5,0xe05,0xe45,0xe84,0xebf,0xeff,0xf33,0xf5f, +0x839,0x226,0x226,0xf93,0x226,0x226,0x226,0xfd3,0x1013,0x1053,0x1093,0x10d3,0x1113,0x1153,0x1193,0x11d3, +0x1213,0x226,0x226,0x1243,0x1274,0x226,0x12a4,0x12d7,0x1314,0x1353,0x1393,0x13c9,0x13f7,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x13f1,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0xcbd,0x226,0x140e,0x226,0x144e,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x148e,0x14c8,0x1506,0x1546,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1422,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0xcee,0x226,0x143f,0x226,0x147f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x14bf,0x14f9,0x1537,0x1577,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, @@ -61,20 +59,20 @@ static const uint16_t norm2_nfc_data_trieIndex[1746]={ 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1585,0x15c3,0x15e3,0x226,0x226,0x226,0x226, -0x161d,0x226,0x226,0x1645,0x1677,0x16a5,0x80c,0x16b8,0x226,0x226,0x16c8,0x1708,0x226,0x226,0x226,0x1420, -0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750, -0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760, -0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754, -0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748, -0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758, -0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c, -0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c, -0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750, -0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760, -0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754, -0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x175c,0x1748,0x1750,0x1758,0x1760,0x174c,0x1754,0x1794,0x226, -0x17d4,0x180f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x15b6,0x15f4,0x1614,0x226,0x226,0x226,0x226, +0x164e,0x226,0x226,0x1676,0x16a8,0x16d6,0x83d,0x16e9,0x226,0x226,0x16f9,0x1739,0x226,0x226,0x226,0x1451, +0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781, +0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791, +0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785, +0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779, +0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789, +0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d, +0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d, +0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781, +0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791, +0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785, +0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x178d,0x1779,0x1781,0x1789,0x1791,0x177d,0x1785,0x17c5,0x226, +0x1805,0x1840,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, @@ -82,57 +80,59 @@ static const uint16_t norm2_nfc_data_trieIndex[1746]={ 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x184f,0x188f,0x18cf,0x190f,0x194f,0x198f,0x19cf,0x1a0f,0x1a32,0x1a72,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1a92,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x655,0x664,0x67c,0x69b,0x6b0,0x6b0,0x6b0,0x6b4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x1880,0x18c0,0x1900,0x1940,0x1980,0x19c0,0x1a00,0x1a40,0x1a63,0x1aa3,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ac3,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x67e,0x68e,0x6a6,0x6c5,0x6da,0x6da,0x6da,0x6de,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbda,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xc0b,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x40c, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ac5,0x226,0x226,0x1ad5,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0xdc6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ae5,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x15d6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x1aef,0x54f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x7eb,0x226,0x226, -0x9ba,0x226,0x1aff,0x1b0c,0x1b18,0x226,0x226,0x226,0x226,0x414,0x226,0x1b23,0x1b33,0x226,0x226,0x226, -0x7e0,0x226,0x226,0x226,0x226,0x1b43,0x226,0x226,0x226,0x1b4e,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x1b55,0x226,0x226,0x226,0x226,0x1b60,0x1b6f,0x8f6,0x1b7d,0x412,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x1b8b,0x798,0x226,0x226,0x226,0x226,0x226,0x1b9b,0x1baa,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x8d6,0x1bb2,0x1bc2,0x226, -0x226,0x226,0x9ba,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bcc,0x226,0x226,0x226,0x226,0x226, -0x226,0x7e6,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bc9, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bdc, -0x7e0,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x84d,0x226,0x226,0x226,0x7ed,0x7ea, -0x226,0x226,0x226,0x226,0x7e8,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x9ba,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xbd4,0x226,0x226,0x226, -0x226,0x7ea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x1bec,0x226,0x226,0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1af6,0x226,0x226,0x1b06,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0xdf7,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1b16,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1607,0x226,0x226,0x226,0x226,0x66b,0x226,0x226,0x226, +0x226,0x1b20,0x54f,0x226,0x226,0x1b30,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x81c,0x226,0x226, +0x1b40,0x226,0x1b50,0x1b5d,0x1b69,0x226,0x226,0x226,0x226,0x414,0x226,0x1b74,0x1b84,0x226,0x226,0x226, +0x811,0x226,0x226,0x226,0x226,0x1b94,0x226,0x226,0x226,0x1b9f,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x1ba6,0x226,0x226,0x226,0x226,0x1bb1,0x1bc0,0x927,0x1bce,0x412,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x1bdc,0x7c9,0x226,0x226,0x226,0x226,0x226,0x1bec,0x1bfb,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x907,0x1c03,0x1c13,0x226, +0x226,0x226,0x9eb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c1d,0x226,0x226,0x226,0x226,0x226, +0x226,0x817,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c1a, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c2d, +0x811,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x87e,0x226,0x226,0x226,0x81e,0x81b, +0x226,0x226,0x226,0x226,0x819,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x9eb,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0xc05,0x226,0x226,0x226, +0x226,0x81b,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0xc08,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x1c3d,0x226,0x226,0x226,0xf2c,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x1bfc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1bfe, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c4d,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x1c4f,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c5e,0x1c6e,0x1c7c,0x1c89,0x226, +0x1c95,0x1ca3,0x1cb3,0x226,0x226,0x226,0x226,0xd1b,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x1c0d,0x1c1d,0x1c2b,0x1c38,0x226,0x1c44,0x1c52,0x1c62,0x226,0x226, -0x226,0x226,0xcea,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1c72,0x1c7a, -0x1c88,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0xefb,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x4fc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x1c98,0x226,0x226,0x226,0x226,0x226,0x226,0x1ca4,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x1cb4,0x1cc4,0x1cd4,0x1ce4,0x1cf4,0x1d04,0x1d14,0x1d24,0x1d34,0x1d44,0x1d54, -0x1d64,0x1d74,0x1d84,0x1d94,0x1da4,0x1db4,0x1dc4,0x1dd4,0x1de4,0x1df4,0x1e04,0x1e14,0x1e24,0x1e34,0x1e44,0x1e54, -0x1e64,0x1e74,0x1e84,0x1e94,0x1ea4,0x1eb4,0x1ec4,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x1cc3,0x1ccb,0x1cd9,0x226,0x226,0x226,0x226,0x226,0x4f9,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0xf2c,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x7c9,0x226,0x226,0x226,0x4fc,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1ce4,0x226,0x226,0x226,0x226,0x226,0x226, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1cf4,0x226,0x226,0x226,0x226, +0x226,0x226,0x1d00,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x1d10,0x1d20, +0x1d30,0x1d40,0x1d50,0x1d60,0x1d70,0x1d80,0x1d90,0x1da0,0x1db0,0x1dc0,0x1dd0,0x1de0,0x1df0,0x1e00,0x1e10,0x1e20, +0x1e30,0x1e40,0x1e50,0x1e60,0x1e70,0x1e80,0x1e90,0x1ea0,0x1eb0,0x1ec0,0x1ed0,0x1ee0,0x1ef0,0x1f00,0x1f10,0x1f20, 0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226, -0x226,0x226,0x226,0x226,0x226,0x408,0x428,0xc4,0xc4,0xc4,0x448,0x457,0x46d,0x489,0x4a6,0x4c2, -0x4df,0x4fc,0x51b,0x538,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, -0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x552,0xc4,0x566,0xc4,0xc4,0xc4,0xc4, +0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x226,0x408,0x428, +0xc4,0xc4,0xc4,0x448,0x457,0x46d,0x489,0x4a6,0x4c2,0x4df,0x4fc,0x51b,0x538,0x552,0xc4,0xc4, 0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, -0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x586,0xc4,0xc4,0xc4,0xc4,0xc4, -0xc4,0xc4,0xc4,0x591,0x5ae,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x5ce,0x5e2,0xc4,0xc4,0x5f5, +0xc4,0xc4,0xc4,0x567,0xc4,0x57b,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, 0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, +0xc4,0xc4,0xc4,0xc4,0x59b,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x5a6,0x5c3,0xc4, +0xc4,0xc4,0xc4,0xc4,0xc4,0x5e3,0x5f9,0x60b,0xc4,0x61e,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, 0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4, -0x615,0x635 +0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0xc4,0x63e,0x65e }; -static const uint16_t norm2_nfc_data_trieData[7892]={ +static const uint16_t norm2_nfc_data_trieData[7984]={ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -238,401 +238,406 @@ static const uint16_t norm2_nfc_data_trieData[7892]={ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,0xffb8,0xffb8,0xffb8,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffb8, -0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffb8, -0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xfe36,0xfe38,0xfe3a,0xffcc, -0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffcc, +0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8, +0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1, +0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xfe36,0xfe38,0xfe3a, +0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0x864,0x1993,1,1,1,1,1,1,0x868,0x1999,1,0x86c, -0x199f,1,1,1,1,1,1,1,0xfc0e,1,1,1,1,1,1,1, -1,1,1,1,1,1,0xfe12,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,1,1, -1,0x29ec,0x29f2,0x29f8,0x29fe,0x2a04,0x2a0a,0x2a10,0x2a16,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0x864,0x1993,1,1,1,1,1,1,0x868,0x1999,1, +0x86c,0x199f,1,1,1,1,1,1,1,0xfc0e,1,1,1,1,1,1, +1,1,1,1,1,1,1,0xfe12,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,1, +1,1,0x29ec,0x29f2,0x29f8,0x29fe,0x2a04,0x2a0a,0x2a10,0x2a16,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,0xfe0e,1,0xfc00,1,1,1,1,1,1,1,0x870, -1,1,1,0x19a5,0x19ab,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00, -1,1,1,1,0x2a1c,0x2a22,1,0x2a28,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,0xffcc,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0xfe0e,1,0xfc00,1,1,1,1,1,1,1, +0x870,1,1,1,0x19a5,0x19ab,0xfe12,1,1,1,1,1,1,1,1,1, +0xfc00,1,1,1,1,0x2a1c,0x2a22,1,0x2a28,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0xffcc,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,0x2a2e,1,1,0x2a34,1,1, -1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1, -1,0xfe12,1,1,1,1,1,1,1,1,1,1,1,0x2a3a,0x2a40,0x2a46, -1,1,0x2a4c,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0x2a2e,1,1,0x2a34,1, +1,1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,1,0x2a3a,0x2a40, +0x2a46,1,1,0x2a4c,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe0e, -1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -0x878,0x19b1,1,1,0x19b7,0x19bd,0xfe12,1,1,1,1,1,1,1,1,0xfc00, -0xfc00,1,1,1,1,0x2a52,0x2a58,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,0x884,1,0x19c3,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,0x878,0x19b1,1,1,0x19b7,0x19bd,0xfe12,1,1,1,1,1,1,1,1, +0xfc00,0xfc00,1,1,1,1,0x2a52,0x2a58,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,0xfc00,1,1,1,1,1,1,0x888,0x890,1,1, -0x19c9,0x19cf,0x19d5,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00,1,1, +1,1,1,1,1,1,1,1,1,1,0x884,1,0x19c3,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,0x894,1,0x19db,1,1,1,1,0xfe12,1,1, -1,1,1,1,1,0xfea8,0xfcb6,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0xfc00,1,1,1,1,1,1,0x888,0x890,1, +1,0x19c9,0x19cf,0x19d5,0xfe12,1,1,1,1,1,1,1,1,1,0xfc00,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0x894,1,0x19db,1,1,1,1,0xfe12,1, +1,1,1,1,1,1,0xfea8,0xfcb6,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0xfe0e,1,1,0x898,0x19e1,1,0xfc00,1,1,1,0x89c,0x19e7,0x19ed, -1,0xdca,0x19f5,1,0xfe12,1,1,1,1,1,1,1,0xfc00,0xfc00,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xfe0e,1,1,0x898,0x19e1,1,0xfc00,1,1,1,0x89c,0x19e7, +0x19ed,1,0xdca,0x19f5,1,0xfe12,1,1,1,1,1,1,1,0xfc00,0xfc00,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,0xfe12,0xfe12,1,0xfc00,1,1,1, -1,1,1,0x8a8,0x8b0,1,1,0x19fd,0x1a03,0x1a09,0xfe12,1,1,1,1,1, -1,1,1,1,0xfc00,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,0xfc12,1,1, -1,1,0xfc00,1,1,1,1,1,1,1,1,1,0x8b4,0x1a0f,1,0xdd4, -0x1a17,0x1a1f,0xfc00,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0xfe12,0xfe12,1,0xfc00,1,1, +1,1,1,1,0x8a8,0x8b0,1,1,0x19fd,0x1a03,0x1a09,0xfe12,1,1,1,1, +1,1,1,1,1,0xfc00,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,0xfece,0xfece,0xfe12,1,1, -1,1,1,1,1,1,0xfed6,0xfed6,0xfed6,0xfed6,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfc12,1, +1,1,1,0xfc00,1,1,1,1,1,1,1,1,1,0x8b4,0x1a0f,1, +0xdd4,0x1a17,0x1a1f,0xfc00,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xfece,0xfece,0xfe12,1, +1,1,1,1,1,1,1,0xfed6,0xfed6,0xfed6,0xfed6,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xfeec,0xfeec,0xfe12,1,1,1,1,1,1,1,1,0xfef4,0xfef4,0xfef4, -0xfef4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1, +1,1,1,0xfeec,0xfeec,0xfe12,1,1,1,1,1,1,1,1,0xfef4,0xfef4, +0xfef4,0xfef4,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xffb8,1,0xffb8,1,0xffb0,1,1,1,1,1,1,0x2a5f,1,1, -1,1,1,1,1,1,1,0x2a65,1,1,1,1,0x2a6b,1,1,1, -1,0x2a71,1,1,1,1,0x2a77,1,1,1,1,1,1,1,1,1, -1,1,1,0x2a7d,1,1,1,1,1,1,1,0xff02,0xff04,0x3c50,0xff08,0x3c58, -0x2a82,1,0x2a88,1,0xff04,0xff04,0xff04,0xff04,1,1,0xff04,0x3c60,0xffcc,0xffcc,0xfe12,1, -0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x2a8f,1,1, -1,1,1,1,1,1,1,0x2a95,1,1,1,1,0x2a9b,1,1,1, -1,0x2aa1,1,1,1,1,0x2aa7,1,1,1,1,1,1,1,1,1, -1,1,1,0x2aad,1,1,1,1,1,1,0xffb8,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0xffb8,0xffb8,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffb8,1,0xffb8,1,0xffb0,1,1,1,1,1,1,0x2a5f,1, +1,1,1,1,1,1,1,1,0x2a65,1,1,1,1,0x2a6b,1,1, +1,1,0x2a71,1,1,1,1,0x2a77,1,1,1,1,1,1,1,1, +1,1,1,1,0x2a7d,1,1,1,1,1,1,1,0xff02,0xff04,0x3c50,0xff08, +0x3c58,0x2a82,1,0x2a88,1,0xff04,0xff04,0xff04,0xff04,1,1,0xff04,0x3c60,0xffcc,0xffcc,0xfe12, +1,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x2a8f,1, +1,1,1,1,1,1,1,1,0x2a95,1,1,1,1,0x2a9b,1,1, +1,1,0x2aa1,1,1,1,1,0x2aa7,1,1,1,1,1,1,1,1, +1,1,1,1,0x2aad,1,1,1,1,1,1,0xffb8,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0x8c0,0x1a25,1,1,1,1,1,1,1,0xfc00,1,1, -1,1,1,1,1,1,0xfe0e,1,0xfe12,0xfe12,1,1,1,1,1,1, -1,1,1,1,1,1,1,0xffb8,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1, +1,1,1,1,1,0x8c0,0x1a25,1,1,1,1,1,1,1,0xfc00,1, +1,1,1,1,1,1,1,0xfe0e,1,0xfe12,0xfe12,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xffb8,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, -0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,1, +1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, -0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,1, +1,1,1,1,1,1,1,1,1,1,1,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, +0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, +0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00,0xfe00, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12, +1,1,1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,0xffcc,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xfe12,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,0xffc8,1,1,1,1,1,1,1,1, +0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,0xffcc,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xffc8,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,0xffbc,0xffcc,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, -0xffcc,1,1,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffbc,0xffcc,0xffb8,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc, -0xffcc,0xffb8,1,0xffb8,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,1,1,0xffb8,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8, +0xffcc,0xffcc,0xffb8,1,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc, +0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0x8c4,0x1a2b,0x8c8,0x1a31,0x8cc,0x1a37,0x8d0,0x1a3d,0x8d4,0x1a43,1,1,0x8d8, -0x1a49,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xfe0e,0xfc00,1,1,1,1,0x8dc,0x1a4f,0x8e0,0x1a55,0x8e4,0x8e8,0x1a5b,0x1a61, -0x8ec,0x1a67,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x8c4,0x1a2b,0x8c8,0x1a31,0x8cc,0x1a37,0x8d0,0x1a3d,0x8d4,0x1a43,1,1, +0x8d8,0x1a49,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, -0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xfe0e,0xfc00,1,1,1,1,0x8dc,0x1a4f,0x8e0,0x1a55,0x8e4,0x8e8,0x1a5b, +0x1a61,0x8ec,0x1a67,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,0xfe12,1,1, +1,1,1,1,1,1,1,1,1,1,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,0xfe12,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1,1, -0xfe12,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xffcc,0xffcc,0xffcc,1,0xfe02,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,0xffb8,0xffb8, -0xffb8,0xffb8,0xffcc,1,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,1,1,1,1,0xffb8, -1,1,1,1,1,1,0xffcc,1,1,1,0xffcc,0xffcc,1,1,1,1, -1,1,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffd4, -0xffac,0xffb8,0xff94,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0xfe0e,1,1,1,1,1,1,1,1,1,1, +1,0xfe12,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffcc,0xffcc,0xffcc,1,0xfe02,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffcc,0xffcc,0xffb8, +0xffb8,0xffb8,0xffb8,0xffcc,1,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,0xfe02,1,1,1,1, +0xffb8,1,1,1,1,1,1,0xffcc,1,1,1,0xffcc,0xffcc,1,1,1, +1,1,1,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffcc, +0xffd4,0xffac,0xffb8,0xff94,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, 0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, -0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffd0,0xffc8,0xffc8,0xffb8,1,0xffcc,0xffd2,0xffb8, -0xffcc,0xffb8,0x1a6c,0x1a72,0x1a78,0x1a7e,0x1a85,0x1a8b,0x1a91,0x1a97,0x1a9f,0x1aa9,0x1ab0,0x1ab6,0x1abc,0x1ac2, -0x1ac8,0x1ace,0x1ad5,0x1adb,0x1ae0,0x1ae6,0x1aee,0x1af8,0x1b02,0x1b0c,0x1b14,0x1b1a,0x1b20,0x1b26,0x1b2f,0x1b39, -0x1b41,0x1b47,0x1b4c,0x1b52,0x1b58,0x1b5e,0x1b64,0x1b6a,0x1b70,0x1b76,0x1b7d,0x1b83,0x1b88,0x1b8e,0x1b94,0x1b9a, -0x1ba2,0x1bac,0x1bb4,0x1bba,0x1bc0,0x1bc6,0x1bcc,0x1bd2,0xdde,0xde8,0x1bda,0x1be4,0x1bec,0x1bf2,0x1bf8,0x1bfe, -0x1c04,0x1c0a,0x1c10,0x1c16,0x1c1d,0x1c23,0x1c28,0x1c2e,0x1c34,0x1c3a,0x1c40,0x1c46,0x1c4c,0x1c52,0x1c5a,0x1c64, -0x1c6e,0x1c78,0x1c82,0x1c8c,0x1c96,0x1ca0,0x1ca9,0x1caf,0x1cb5,0x1cbb,0x1cc0,0x1cc6,0xdf2,0xdfc,0x1cce,0x1cd8, -0x1ce0,0x1ce6,0x1cec,0x1cf2,0xe06,0xe10,0x1cfa,0x1d04,0x1d0e,0x1d18,0x1d22,0x1d2c,0x1d34,0x1d3a,0x1d40,0x1d46, -0x1d4c,0x1d52,0x1d58,0x1d5e,0x1d64,0x1d6a,0x1d70,0x1d76,0x1d7c,0x1d82,0x1d8a,0x1d94,0x1d9e,0x1da8,0x1db0,0x1db6, -0x1dbd,0x1dc3,0x1dc8,0x1dce,0x1dd4,0x1dda,0x1de0,0x1de6,0x1dec,0x1df2,0x1df9,0x1dff,0x1e05,0x1e0b,0x1e11,0x1e17, -0x1e1c,0x1e22,0x1e28,0x1e2e,0x1e35,0x1e3b,0x1e41,0x1e47,0x1e4c,0x1e52,0x1e58,0x1e5e,1,0x1e65,1,1, -1,1,0xe1a,0xe28,0x1e6a,0x1e70,0x1e78,0x1e82,0x1e8c,0x1e96,0x1ea0,0x1eaa,0x1eb4,0x1ebe,0x1ec8,0x1ed2, -0x1edc,0x1ee6,0x1ef0,0x1efa,0x1f04,0x1f0e,0x1f18,0x1f22,0x1f2c,0x1f36,0xe36,0xe40,0x1f3e,0x1f44,0x1f4a,0x1f50, -0x1f58,0x1f62,0x1f6c,0x1f76,0x1f80,0x1f8a,0x1f94,0x1f9e,0x1fa8,0x1fb2,0x1fba,0x1fc0,0x1fc6,0x1fcc,0xe4a,0xe54, -0x1fd2,0x1fd8,0x1fe0,0x1fea,0x1ff4,0x1ffe,0x2008,0x2012,0x201c,0x2026,0x2030,0x203a,0x2044,0x204e,0x2058,0x2062, -0x206c,0x2076,0x2080,0x208a,0x2094,0x209e,0x20a6,0x20ac,0x20b2,0x20b8,0x20c0,0x20ca,0x20d4,0x20de,0x20e8,0x20f2, -0x20fc,0x2106,0x2110,0x211a,0x2122,0x2128,0x212f,0x2135,0x213a,0x2140,0x2146,0x214c,1,1,1,1, -1,1,0xe5e,0xe74,0xe8c,0xe9a,0xea8,0xeb6,0xec4,0xed2,0xede,0xef4,0xf0c,0xf1a,0xf28,0xf36, -0xf44,0xf52,0xf5e,0xf6c,0x2155,0x215f,0x2169,0x2173,1,1,0xf7a,0xf88,0x217d,0x2187,0x2191,0x219b, -1,1,0xf96,0xfac,0xfc4,0xfd2,0xfe0,0xfee,0xffc,0x100a,0x1016,0x102c,0x1044,0x1052,0x1060,0x106e, -0x107c,0x108a,0x1096,0x10a8,0x21a5,0x21af,0x21b9,0x21c3,0x21cd,0x21d7,0x10ba,0x10cc,0x21e1,0x21eb,0x21f5,0x21ff, -0x2209,0x2213,0x10de,0x10ec,0x221d,0x2227,0x2231,0x223b,1,1,0x10fa,0x1108,0x2245,0x224f,0x2259,0x2263, -1,1,0x1116,0x1128,0x226d,0x2277,0x2281,0x228b,0x2295,0x229f,1,0x113a,1,0x22a9,1,0x22b3, -1,0x22bd,0x114c,0x1162,0x117a,0x1188,0x1196,0x11a4,0x11b2,0x11c0,0x11cc,0x11e2,0x11fa,0x1208,0x1216,0x1224, -0x1232,0x1240,0x124c,0x3b9e,0x22c5,0x3ba6,0x1256,0x3bae,0x22cb,0x3bb6,0x22d1,0x3bbe,0x22d7,0x3bc6,0x1260,0x3bce, -1,1,0x22de,0x22e8,0x22f7,0x2307,0x2317,0x2327,0x2337,0x2347,0x2352,0x235c,0x236b,0x237b,0x238b,0x239b, -0x23ab,0x23bb,0x23c6,0x23d0,0x23df,0x23ef,0x23ff,0x240f,0x241f,0x242f,0x243a,0x2444,0x2453,0x2463,0x2473,0x2483, -0x2493,0x24a3,0x24ae,0x24b8,0x24c7,0x24d7,0x24e7,0x24f7,0x2507,0x2517,0x2522,0x252c,0x253b,0x254b,0x255b,0x256b, -0x257b,0x258b,0x2595,0x259b,0x25a3,0x25aa,0x25b3,1,0x126a,0x25bd,0x25c5,0x25cb,0x25d1,0x3bd6,0x25d6,1, -0x2ab2,0x8f0,1,0x25dd,0x25e5,0x25ec,0x25f5,1,0x1274,0x25ff,0x2607,0x3bde,0x260d,0x3be6,0x2612,0x2619, -0x261f,0x2625,0x262b,0x2631,0x2639,0x3bf0,1,1,0x2641,0x2649,0x2651,0x2657,0x265d,0x3bfa,1,0x2663, -0x2669,0x266f,0x2675,0x267b,0x2683,0x3c04,0x268b,0x2691,0x2697,0x269f,0x26a7,0x26ad,0x26b3,0x3c0e,0x26b9,0x26bf, -0x3c16,0x2ab7,1,1,0x26c7,0x26ce,0x26d7,1,0x127e,0x26e1,0x26e9,0x3c1e,0x26ef,0x3c26,0x26f4,0x2abb, -0x8fc,1,0xfa09,0xfa09,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xffcc,0xffcc,0xfe02,0xfe02,0xffcc,0xffcc,0xffcc,0xffcc,0xfe02,0xfe02,0xfe02,0xffcc,0xffcc,1, -1,1,1,0xffcc,1,1,1,0xfe02,0xfe02,0xffcc,0xffb8,0xffcc,0xfe02,0xfe02,0xffb8,0xffb8, -0xffb8,0xffb8,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,0x2abe,1,1,1,0x2ac2,0x3c2e,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0x908,1,0x90c,1,0x910,1,1,1,1,1,0x26fb,0x2701,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,0x2707,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0x270d,0x2713,0x2719,0x914,1,0x918,1,0x91c,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,0x920,0x271f,1,1,1,0x924,0x2725,1,0x928,0x272b, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,0x92c,0x2731,0x930,0x2737,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x934, -1,1,1,0x273d,1,0x938,0x2743,0x93c,1,0x2749,0x940,0x274f,1,1,1,0x944, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0x2755,0x948,0x275b,1,0x94c,0x950,1,1,1,1,1,1,1,0x2761, -0x2767,0x276d,0x2773,0x2779,0x954,0x958,0x277f,0x2785,0x95c,0x960,0x278b,0x2791,0x964,0x968,0x96c,0x970, -1,1,0x2797,0x279d,0x974,0x978,0x27a3,0x27a9,0x97c,0x980,0x27af,0x27b5,1,1,1,1, -1,1,1,0x984,0x988,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0x98c,1,1,1,1,1,0x990,0x994,1,0x998,0x27bb,0x27c1, -0x27c7,0x27cd,1,1,0x99c,0x9a0,0x9a4,0x9a8,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0x27d3,0x27d9,0x27df,0x27e5,1,1,1,1, -1,1,0x27eb,0x27f1,0x27f7,0x27fd,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x2ac7, -0x2acb,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,0x2acf,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1,1, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffd0,0xffc8,0xffc8,0xffb8,0xffb4,0xffcc,0xffd2, +0xffb8,0xffcc,0xffb8,0x1a6c,0x1a72,0x1a78,0x1a7e,0x1a85,0x1a8b,0x1a91,0x1a97,0x1a9f,0x1aa9,0x1ab0,0x1ab6,0x1abc, +0x1ac2,0x1ac8,0x1ace,0x1ad5,0x1adb,0x1ae0,0x1ae6,0x1aee,0x1af8,0x1b02,0x1b0c,0x1b14,0x1b1a,0x1b20,0x1b26,0x1b2f, +0x1b39,0x1b41,0x1b47,0x1b4c,0x1b52,0x1b58,0x1b5e,0x1b64,0x1b6a,0x1b70,0x1b76,0x1b7d,0x1b83,0x1b88,0x1b8e,0x1b94, +0x1b9a,0x1ba2,0x1bac,0x1bb4,0x1bba,0x1bc0,0x1bc6,0x1bcc,0x1bd2,0xdde,0xde8,0x1bda,0x1be4,0x1bec,0x1bf2,0x1bf8, +0x1bfe,0x1c04,0x1c0a,0x1c10,0x1c16,0x1c1d,0x1c23,0x1c28,0x1c2e,0x1c34,0x1c3a,0x1c40,0x1c46,0x1c4c,0x1c52,0x1c5a, +0x1c64,0x1c6e,0x1c78,0x1c82,0x1c8c,0x1c96,0x1ca0,0x1ca9,0x1caf,0x1cb5,0x1cbb,0x1cc0,0x1cc6,0xdf2,0xdfc,0x1cce, +0x1cd8,0x1ce0,0x1ce6,0x1cec,0x1cf2,0xe06,0xe10,0x1cfa,0x1d04,0x1d0e,0x1d18,0x1d22,0x1d2c,0x1d34,0x1d3a,0x1d40, +0x1d46,0x1d4c,0x1d52,0x1d58,0x1d5e,0x1d64,0x1d6a,0x1d70,0x1d76,0x1d7c,0x1d82,0x1d8a,0x1d94,0x1d9e,0x1da8,0x1db0, +0x1db6,0x1dbd,0x1dc3,0x1dc8,0x1dce,0x1dd4,0x1dda,0x1de0,0x1de6,0x1dec,0x1df2,0x1df9,0x1dff,0x1e05,0x1e0b,0x1e11, +0x1e17,0x1e1c,0x1e22,0x1e28,0x1e2e,0x1e35,0x1e3b,0x1e41,0x1e47,0x1e4c,0x1e52,0x1e58,0x1e5e,1,0x1e65,1, +1,1,1,0xe1a,0xe28,0x1e6a,0x1e70,0x1e78,0x1e82,0x1e8c,0x1e96,0x1ea0,0x1eaa,0x1eb4,0x1ebe,0x1ec8, +0x1ed2,0x1edc,0x1ee6,0x1ef0,0x1efa,0x1f04,0x1f0e,0x1f18,0x1f22,0x1f2c,0x1f36,0xe36,0xe40,0x1f3e,0x1f44,0x1f4a, +0x1f50,0x1f58,0x1f62,0x1f6c,0x1f76,0x1f80,0x1f8a,0x1f94,0x1f9e,0x1fa8,0x1fb2,0x1fba,0x1fc0,0x1fc6,0x1fcc,0xe4a, +0xe54,0x1fd2,0x1fd8,0x1fe0,0x1fea,0x1ff4,0x1ffe,0x2008,0x2012,0x201c,0x2026,0x2030,0x203a,0x2044,0x204e,0x2058, +0x2062,0x206c,0x2076,0x2080,0x208a,0x2094,0x209e,0x20a6,0x20ac,0x20b2,0x20b8,0x20c0,0x20ca,0x20d4,0x20de,0x20e8, +0x20f2,0x20fc,0x2106,0x2110,0x211a,0x2122,0x2128,0x212f,0x2135,0x213a,0x2140,0x2146,0x214c,1,1,1, +1,1,1,0xe5e,0xe74,0xe8c,0xe9a,0xea8,0xeb6,0xec4,0xed2,0xede,0xef4,0xf0c,0xf1a,0xf28, +0xf36,0xf44,0xf52,0xf5e,0xf6c,0x2155,0x215f,0x2169,0x2173,1,1,0xf7a,0xf88,0x217d,0x2187,0x2191, +0x219b,1,1,0xf96,0xfac,0xfc4,0xfd2,0xfe0,0xfee,0xffc,0x100a,0x1016,0x102c,0x1044,0x1052,0x1060, +0x106e,0x107c,0x108a,0x1096,0x10a8,0x21a5,0x21af,0x21b9,0x21c3,0x21cd,0x21d7,0x10ba,0x10cc,0x21e1,0x21eb,0x21f5, +0x21ff,0x2209,0x2213,0x10de,0x10ec,0x221d,0x2227,0x2231,0x223b,1,1,0x10fa,0x1108,0x2245,0x224f,0x2259, +0x2263,1,1,0x1116,0x1128,0x226d,0x2277,0x2281,0x228b,0x2295,0x229f,1,0x113a,1,0x22a9,1, +0x22b3,1,0x22bd,0x114c,0x1162,0x117a,0x1188,0x1196,0x11a4,0x11b2,0x11c0,0x11cc,0x11e2,0x11fa,0x1208,0x1216, +0x1224,0x1232,0x1240,0x124c,0x3b9e,0x22c5,0x3ba6,0x1256,0x3bae,0x22cb,0x3bb6,0x22d1,0x3bbe,0x22d7,0x3bc6,0x1260, +0x3bce,1,1,0x22de,0x22e8,0x22f7,0x2307,0x2317,0x2327,0x2337,0x2347,0x2352,0x235c,0x236b,0x237b,0x238b, +0x239b,0x23ab,0x23bb,0x23c6,0x23d0,0x23df,0x23ef,0x23ff,0x240f,0x241f,0x242f,0x243a,0x2444,0x2453,0x2463,0x2473, +0x2483,0x2493,0x24a3,0x24ae,0x24b8,0x24c7,0x24d7,0x24e7,0x24f7,0x2507,0x2517,0x2522,0x252c,0x253b,0x254b,0x255b, +0x256b,0x257b,0x258b,0x2595,0x259b,0x25a3,0x25aa,0x25b3,1,0x126a,0x25bd,0x25c5,0x25cb,0x25d1,0x3bd6,0x25d6, +1,0x2ab2,0x8f0,1,0x25dd,0x25e5,0x25ec,0x25f5,1,0x1274,0x25ff,0x2607,0x3bde,0x260d,0x3be6,0x2612, +0x2619,0x261f,0x2625,0x262b,0x2631,0x2639,0x3bf0,1,1,0x2641,0x2649,0x2651,0x2657,0x265d,0x3bfa,1, +0x2663,0x2669,0x266f,0x2675,0x267b,0x2683,0x3c04,0x268b,0x2691,0x2697,0x269f,0x26a7,0x26ad,0x26b3,0x3c0e,0x26b9, +0x26bf,0x3c16,0x2ab7,1,1,0x26c7,0x26ce,0x26d7,1,0x127e,0x26e1,0x26e9,0x3c1e,0x26ef,0x3c26,0x26f4, +0x2abb,0x8fc,1,0xfa09,0xfa09,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffcc,0xffcc,0xfe02,0xfe02,0xffcc,0xffcc,0xffcc,0xffcc,0xfe02,0xfe02,0xfe02,0xffcc,0xffcc, +1,1,1,1,0xffcc,1,1,1,0xfe02,0xfe02,0xffcc,0xffb8,0xffcc,0xfe02,0xfe02,0xffb8, +0xffb8,0xffb8,0xffb8,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0x2abe,1,1,1,0x2ac2,0x3c2e, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x908,1,0x90c,1,0x910,1,1,1,1,1,0x26fb,0x2701, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0x2707,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x270d,0x2713,0x2719,0x914,1,0x918,1,0x91c,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0x920,0x271f,1,1,1,0x924,0x2725,1,0x928, +0x272b,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0x92c,0x2731,0x930,0x2737,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0x934,1,1,1,0x273d,1,0x938,0x2743,0x93c,1,0x2749,0x940,0x274f,1,1,1, +0x944,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0x2755,0x948,0x275b,1,0x94c,0x950,1,1,1,1,1,1,1, +0x2761,0x2767,0x276d,0x2773,0x2779,0x954,0x958,0x277f,0x2785,0x95c,0x960,0x278b,0x2791,0x964,0x968,0x96c, +0x970,1,1,0x2797,0x279d,0x974,0x978,0x27a3,0x27a9,0x97c,0x980,0x27af,0x27b5,1,1,1, +1,1,1,1,0x984,0x988,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0x98c,1,1,1,1,1,0x990,0x994,1,0x998,0x27bb, +0x27c1,0x27c7,0x27cd,1,1,0x99c,0x9a0,0x9a4,0x9a8,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0x27d3,0x27d9,0x27df,0x27e5,1,1,1, +1,1,1,0x27eb,0x27f1,0x27f7,0x27fd,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0x2ac7,0x2acb,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x2acf,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xffcc, 0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, -0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0xffb4,0xffc8,0xffd0,0xffbc,0xffc0,0xffc0,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x9ac,1, -1,1,1,0x9b0,0x2803,0x9b4,0x2809,0x9b8,0x280f,0x9bc,0x2815,0x9c0,0x281b,0x9c4,0x2821,0x9c8, -0x2827,0x9cc,0x282d,0x9d0,0x2833,0x9d4,0x2839,0x9d8,0x283f,0x9dc,0x2845,1,0x9e0,0x284b,0x9e4,0x2851, -0x9e8,0x2857,1,1,1,1,1,0x9ec,0x285d,0x2863,0x9f4,0x2869,0x286f,0x9fc,0x2875,0x287b, -0xa04,0x2881,0x2887,0xa0c,0x288d,0x2893,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,0x2899,1,1,1,1,0xfc10, -0xfc10,1,1,0xa14,0x289f,1,1,1,1,1,1,1,0xa18,1,1,1, -1,0xa1c,0x28a5,0xa20,0x28ab,0xa24,0x28b1,0xa28,0x28b7,0xa2c,0x28bd,0xa30,0x28c3,0xa34,0x28c9,0xa38, -0x28cf,0xa3c,0x28d5,0xa40,0x28db,0xa44,0x28e1,0xa48,0x28e7,1,0xa4c,0x28ed,0xa50,0x28f3,0xa54,0x28f9, -1,1,1,1,1,0xa58,0x28ff,0x2905,0xa60,0x290b,0x2911,0xa68,0x2917,0x291d,0xa70,0x2923, -0x2929,0xa78,0x292f,0x2935,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,0xa80,0xa84,0xa88,0xa8c,1,0x293b,1,1,0x2941,0x2947,0x294d, -0x2953,1,1,0xa90,0x2959,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0xffcc,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, -0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xffb4,0xffc8,0xffd0,0xffbc,0xffc0,0xffc0,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x9ac, +1,1,1,1,0x9b0,0x2803,0x9b4,0x2809,0x9b8,0x280f,0x9bc,0x2815,0x9c0,0x281b,0x9c4,0x2821, +0x9c8,0x2827,0x9cc,0x282d,0x9d0,0x2833,0x9d4,0x2839,0x9d8,0x283f,0x9dc,0x2845,1,0x9e0,0x284b,0x9e4, +0x2851,0x9e8,0x2857,1,1,1,1,1,0x9ec,0x285d,0x2863,0x9f4,0x2869,0x286f,0x9fc,0x2875, +0x287b,0xa04,0x2881,0x2887,0xa0c,0x288d,0x2893,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0x2899,1,1,1,1, +0xfc10,0xfc10,1,1,0xa14,0x289f,1,1,1,1,1,1,1,0xa18,1,1, +1,1,0xa1c,0x28a5,0xa20,0x28ab,0xa24,0x28b1,0xa28,0x28b7,0xa2c,0x28bd,0xa30,0x28c3,0xa34,0x28c9, +0xa38,0x28cf,0xa3c,0x28d5,0xa40,0x28db,0xa44,0x28e1,0xa48,0x28e7,1,0xa4c,0x28ed,0xa50,0x28f3,0xa54, +0x28f9,1,1,1,1,1,0xa58,0x28ff,0x2905,0xa60,0x290b,0x2911,0xa68,0x2917,0x291d,0xa70, +0x2923,0x2929,0xa78,0x292f,0x2935,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,0xa80,0xa84,0xa88,0xa8c,1,0x293b,1,1,0x2941,0x2947, +0x294d,0x2953,1,1,0xa90,0x2959,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,0xfe12,1,1,1,1,1,1, +1,1,1,1,1,0xffcc,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, -0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,0xfe12,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xffb8,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0xfe12,1,1,1,1,1,1,1, +1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffb8,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0xfe12,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0xffcc,1,0xffcc,0xffcc,0xffb8,1,1,0xffcc, -0xffcc,1,1,1,1,1,0xffcc,0xffcc,1,0xffcc,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12,1, -1,1,1,1,1,1,1,1,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +1,1,1,1,1,1,1,1,1,0xffcc,1,0xffcc,0xffcc,0xffb8,1,1, +0xffcc,0xffcc,1,1,1,1,1,0xffcc,0xffcc,1,0xffcc,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12, +1,1,1,1,1,1,1,1,1,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, 0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, -0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, 0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, -0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, -0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289,0x1289, +0x1289,0xae2,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, +0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0xae2,0x1289,0x1289, 0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289, -0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0x3c66,1,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3c66,0x3c66, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0x3c66,1,1,1,1,0x3c66,1,1,1,0x3c66,1,0x3c66,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,0x3b97,1,0x2ad5, -0x2ad9,0x2add,0x2ae1,0x2ae5,0x2ae9,0x2aed,0x2af1,0x2af1,0x2af5,0x2af9,0x2afd,0x2b01,0x2b05,0x2b09,0x2b0d,0x2b11, -0x2b15,0x2b19,0x2b1d,0x2b21,0x2b25,0x2b29,0x2b2d,0x2b31,0x2b35,0x2b39,0x2b3d,0x2b41,0x2b45,0x2b49,0x2b4d,0x2b51, -0x2b55,0x2b59,0x2b5d,0x2b61,0x2b65,0x2b69,0x2b6d,0x2b71,0x2b75,0x2b79,0x2b7d,0x2b81,0x2b85,0x2b89,0x2b8d,0x2b91, -0x2b95,0x2b99,0x2b9d,0x2ba1,0x2ba5,0x2ba9,0x2bad,0x2bb1,0x2bb5,0x2bb9,0x2bbd,0x2bc1,0x2bc5,0x2bc9,0x2bcd,0x2bd1, -0x2bd5,0x2bd9,0x2bdd,0x2be1,0x2be5,0x2be9,0x2bed,0x2bf1,0x2bf5,0x2bf9,0x2bfd,0x2c01,0x2c05,0x2c09,0x2c0d,0x2c11, -0x2c15,0x2c19,0x2c1d,0x2c21,0x2c25,0x2c29,0x2c2d,0x2c31,0x2c35,0x2c39,0x2c3d,0x2b21,0x2c41,0x2c45,0x2c49,0x2c4d, -0x2c51,0x2c55,0x2c59,0x2c5d,0x2c61,0x2c65,0x2c69,0x2c6d,0x2c71,0x2c75,0x2c79,0x2c7d,0x2c81,0x2c85,0x2c89,0x2c8d, -0x2c91,0x2c95,0x2c99,0x2c9d,0x2ca1,0x2ca5,0x2ca9,0x2cad,0x2cb1,0x2cb5,0x2cb9,0x2cbd,0x2cc1,0x2cc5,0x2cc9,0x2ccd, -0x2cd1,0x2cd5,0x2cd9,0x2cdd,0x2ce1,0x2ce5,0x2ce9,0x2ced,0x2cf1,0x2cf5,0x2cf9,0x2cfd,0x2d01,0x2d05,0x2d09,0x2d0d, -0x2d11,0x2d15,0x2d19,0x2d1d,0x2d21,0x2d25,0x2d29,0x2d2d,0x2d31,0x2d35,0x2d39,0x2d3d,0x2d41,0x2d45,0x2d49,0x2d4d, -0x2c89,0x2d51,0x2d55,0x2d59,0x2d5d,0x2d61,0x2d65,0x2d69,0x2d6d,0x2c49,0x2d71,0x2d75,0x2d79,0x2d7d,0x2d81,0x2d85, -0x2d89,0x2d8d,0x2d91,0x2d95,0x2d99,0x2d9d,0x2da1,0x2da5,0x2da9,0x2dad,0x2db1,0x2db5,0x2db9,0x2dbd,0x2b21,0x2dc1, -0x2dc5,0x2dc9,0x2dcd,0x2dd1,0x2dd5,0x2dd9,0x2ddd,0x2de1,0x2de5,0x2de9,0x2ded,0x2df1,0x2df5,0x2df9,0x2dfd,0x2e01, -0x2e05,0x2e09,0x2e0d,0x2e11,0x2e15,0x2e19,0x2e1d,0x2e21,0x2e25,0x2e29,0x2c51,0x2e2d,0x2e31,0x2e35,0x2e39,0x2e3d, -0x2e41,0x2e45,0x2e49,0x2e4d,0x2e51,0x2e55,0x2e59,0x2e5d,0x2e61,0x2e65,0x2e69,0x2e6d,0x2e71,0x2e75,0x2e79,0x2e7d, -0x2e81,0x2e85,0x2e89,0x2e8d,0x2e91,0x2e95,0x2e99,0x2e9d,0x2ea1,0x2ea5,0x2ea9,0x2ead,0x2eb1,0x2eb5,0x2eb9,0x2ebd, -0x2ec1,0x2ec5,0x2ec9,0x2ecd,0x2ed1,0x2ed5,0x2ed9,0x2edd,0x2ee1,0x2ee5,0x2ee9,0x2eed,0x2ef1,1,1,0x2ef5, -1,0x2ef9,1,1,0x2efd,0x2f01,0x2f05,0x2f09,0x2f0d,0x2f11,0x2f15,0x2f19,0x2f1d,0x2f21,1,0x2f25, -1,0x2f29,1,1,0x2f2d,0x2f31,1,1,1,0x2f35,0x2f39,0x2f3d,0x2f41,0x2f45,0x2f49,0x2f4d, -0x2f51,0x2f55,0x2f59,0x2f5d,0x2f61,0x2f65,0x2f69,0x2f6d,0x2f71,0x2f75,0x2f79,0x2f7d,0x2f81,0x2f85,0x2f89,0x2f8d, -0x2f91,0x2f95,0x2f99,0x2f9d,0x2fa1,0x2fa5,0x2fa9,0x2fad,0x2fb1,0x2fb5,0x2fb9,0x2fbd,0x2fc1,0x2fc5,0x2fc9,0x2fcd, -0x2fd1,0x2fd5,0x2fd9,0x2fdd,0x2fe1,0x2fe5,0x2d25,0x2fe9,0x2fed,0x2ff1,0x2ff5,0x2ff9,0x2ffd,0x2ffd,0x3001,0x3005, -0x3009,0x300d,0x3011,0x3015,0x3019,0x301d,0x2f2d,0x3021,0x3025,0x3029,0x302d,0x3031,0x3037,1,1,0x303b, -0x303f,0x3043,0x3047,0x304b,0x304f,0x3053,0x3057,0x2f65,0x305b,0x305f,0x3063,0x2ef5,0x3067,0x306b,0x306f,0x3073, -0x3077,0x307b,0x307f,0x3083,0x3087,0x308b,0x308f,0x3093,0x2f89,0x3097,0x2f8d,0x309b,0x309f,0x30a3,0x30a7,0x30ab, -0x2ef9,0x2b75,0x30af,0x30b3,0x30b7,0x2c8d,0x2de9,0x30bb,0x30bf,0x2fa9,0x30c3,0x2fad,0x30c7,0x30cb,0x30cf,0x2f01, -0x30d3,0x30d7,0x30db,0x30df,0x30e3,0x2f05,0x30e7,0x30eb,0x30ef,0x30f3,0x30f7,0x30fb,0x2fe5,0x30ff,0x3103,0x2d25, -0x3107,0x2ff5,0x310b,0x310f,0x3113,0x3117,0x311b,0x3009,0x311f,0x2f29,0x3123,0x300d,0x2c41,0x3127,0x3011,0x312b, -0x3019,0x312f,0x3133,0x3137,0x313b,0x313f,0x3021,0x2f19,0x3143,0x3025,0x3147,0x3029,0x314b,0x2af1,0x314f,0x3155, -0x315b,0x3161,0x3165,0x3169,0x316d,0x3173,0x3179,0x317f,0x3183,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3186, -0xfe34,0x318c,1,1,1,1,1,1,1,1,1,1,0x3192,0x3198,0x31a0,0x31aa, -0x31b2,0x31b8,0x31be,0x31c4,0x31ca,0x31d0,0x31d6,0x31dc,0x31e2,1,0x31e8,0x31ee,0x31f4,0x31fa,0x3200,1, -0x3206,1,0x320c,0x3212,1,0x3218,0x321e,1,0x3224,0x322a,0x3230,0x3236,0x323c,0x3242,0x3248,0x324e, -0x3254,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8, -0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xffb8,1,0xffcc,1,1,1,1,1,1,1,1,0xffcc,0xfe02,0xffb8, -1,1,1,1,0xfe12,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1, -1,1,1,1,1,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8,1, -1,1,1,1,1,1,1,1,0xa94,0x295f,0xa9a,0x2969,1,1,1,1, -1,0xaa0,1,1,1,1,1,0x2973,1,1,1,1,1,1,1,1, -1,0xfe12,0xfc0e,1,1,1,1,1,1,1,0xfc00,1,1,1,1,1, -1,0x297d,0x2987,1,0xaa6,0xaac,0xfe12,0xfe12,1,1,1,1,1,1,1,1, -1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,0xfe0e,1,1, -1,1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe12, -1,1,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe0e,1,0xfc00,1, -1,1,1,1,1,1,0xab2,1,1,1,0x2991,0x299b,0xfe12,1,1,1, -1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,0xfe12,1,1, -1,0xfe0e,1,1,1,1,1,1,1,1,1,0xfc00,1,1,1,1, -1,1,1,1,0xabe,0xfc00,0x29a5,0x29af,0xfc00,0x29b9,1,1,0xfe12,0xfe0e,1,1, -1,1,1,1,1,1,1,1,1,1,0xad0,0xad6,0x29c3,0x29cd,1,1, -1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,0xfc00,1,1,1, -1,0xadc,1,1,0x29d7,1,1,1,1,0xfe12,0xfe12,1,0xfe02,0xfe02,0xfe02,0xfe02, -0xfe02,1,1,1,1,1,1,1,1,1,1,1,0xfe0c,0xfe0c,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0xfe02,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,0x325a,0x3264,0x3278,0x3290,0x32a8, -0x32c0,0x32d8,0xffb0,0xffb0,0xfe02,0xfe02,0xfe02,1,1,1,0xffc4,0xffb0,0xffb0,0xffb0,1,1, -1,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,0xffcc,0xffcc,0xffcc, -0xffcc,0xffcc,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,0xffcc,0xffcc, -0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x32e6,0x32f0,0x3304, -0x331c,0x3334,0x334c,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, -0xffcc,0xffcc,0xffcc,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,1,0xffcc,0xffcc, -0xffcc,0xffcc,0xffcc,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1, -1,1,1,1,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xfe0e,1, -1,1,1,1,0x335b,0x335f,0x3363,0x3367,0x336d,0x2f4d,0x3371,0x3375,0x3379,0x337d,0x2f51,0x3381, -0x3385,0x3389,0x2f55,0x338f,0x3393,0x3397,0x339b,0x33a1,0x33a5,0x33a9,0x33ad,0x33b3,0x33b7,0x33bb,0x33bf,0x303f, -0x33c3,0x33c9,0x33cd,0x33d1,0x33d5,0x33d9,0x33dd,0x33e1,0x33e5,0x3053,0x2f59,0x2f5d,0x3057,0x33e9,0x33ed,0x2c59, -0x33f1,0x2f61,0x33f5,0x33f9,0x33fd,0x3401,0x3401,0x3401,0x3405,0x340b,0x340f,0x3413,0x3417,0x341d,0x3421,0x3425, -0x3429,0x342d,0x3431,0x3435,0x3439,0x343d,0x3441,0x3445,0x3449,0x344d,0x344d,0x305f,0x3451,0x3455,0x3459,0x345d, -0x2f69,0x3461,0x3465,0x3469,0x2ebd,0x346d,0x3471,0x3475,0x3479,0x347d,0x3481,0x3485,0x3489,0x348d,0x3493,0x3497, -0x349b,0x349f,0x34a3,0x34a7,0x34ab,0x34b1,0x34b7,0x34bb,0x34bf,0x34c3,0x34c7,0x34cb,0x34cf,0x34d3,0x34d7,0x34d7, -0x34db,0x34e1,0x34e5,0x2c49,0x34e9,0x34ed,0x34f3,0x34f7,0x34fb,0x34ff,0x3503,0x3507,0x2f7d,0x350b,0x350f,0x3513, -0x3519,0x351d,0x3523,0x3527,0x352b,0x352f,0x3533,0x3537,0x353b,0x353f,0x3543,0x3547,0x354b,0x354f,0x3555,0x3559, -0x355d,0x3561,0x2b71,0x3565,0x356b,0x356f,0x356f,0x3575,0x3579,0x3579,0x357d,0x3581,0x3587,0x358d,0x3591,0x3595, -0x3599,0x359d,0x35a1,0x35a5,0x35a9,0x35ad,0x35b1,0x2f81,0x35b5,0x35bb,0x35bf,0x35c3,0x308f,0x35c3,0x35c7,0x2f89, -0x35cb,0x35cf,0x35d3,0x35d7,0x2f8d,0x2b05,0x35db,0x35df,0x35e3,0x35e7,0x35eb,0x35ef,0x35f3,0x35f9,0x35fd,0x3601, -0x3605,0x3609,0x360d,0x3613,0x3617,0x361b,0x361f,0x3623,0x3627,0x362b,0x362f,0x3633,0x2f91,0x3637,0x363b,0x3641, -0x3645,0x3649,0x364d,0x2f99,0x3651,0x3655,0x3659,0x365d,0x3661,0x3665,0x3669,0x366d,0x2b75,0x30af,0x3671,0x3675, -0x3679,0x367d,0x3683,0x3687,0x368b,0x368f,0x2f9d,0x3693,0x3699,0x369d,0x36a1,0x3161,0x36a5,0x36a9,0x36ad,0x36b1, -0x36b5,0x36bb,0x36bf,0x36c3,0x36c7,0x36cd,0x36d1,0x36d5,0x36d9,0x2c8d,0x36dd,0x36e1,0x36e7,0x36ed,0x36f3,0x36f7, -0x36fd,0x3701,0x3705,0x3709,0x370d,0x2fa1,0x2de9,0x3711,0x3715,0x3719,0x371d,0x3723,0x3727,0x372b,0x372f,0x30bf, -0x3733,0x3737,0x373d,0x3741,0x3745,0x374b,0x3751,0x3755,0x30c3,0x3759,0x375d,0x3761,0x3765,0x3769,0x376d,0x3771, -0x3777,0x377b,0x3781,0x3785,0x378b,0x30cb,0x378f,0x3793,0x3799,0x379d,0x37a1,0x37a7,0x37ad,0x37b1,0x37b5,0x37b9, -0x37bd,0x37bd,0x37c1,0x37c5,0x30d3,0x37c9,0x37cd,0x37d1,0x37d5,0x37d9,0x37df,0x37e3,0x2c55,0x37e9,0x37ef,0x37f3, -0x37f9,0x37ff,0x3805,0x3809,0x30eb,0x380d,0x3813,0x3819,0x381f,0x3825,0x3829,0x3829,0x30ef,0x3169,0x382d,0x3831, -0x3835,0x3839,0x383f,0x2bbd,0x30f7,0x3843,0x3847,0x2fcd,0x384d,0x3853,0x2f15,0x3859,0x385d,0x2fdd,0x3861,0x3865, -0x3869,0x386f,0x386f,0x3875,0x3879,0x387d,0x3883,0x3887,0x388b,0x388f,0x3895,0x3899,0x389d,0x38a1,0x38a5,0x38a9, -0x38af,0x38b3,0x38b7,0x38bb,0x38bf,0x38c3,0x38c7,0x38cd,0x38d3,0x38d7,0x38dd,0x38e1,0x38e7,0x38eb,0x2ff5,0x38ef, -0x38f5,0x38fb,0x38ff,0x3905,0x3909,0x390f,0x3913,0x3917,0x391b,0x391f,0x3923,0x3927,0x392d,0x3933,0x3939,0x3575, -0x393f,0x3943,0x3947,0x394b,0x394f,0x3953,0x3957,0x395b,0x395f,0x3963,0x3967,0x396b,0x2c9d,0x3971,0x3975,0x3979, -0x397d,0x3981,0x3985,0x3001,0x3989,0x398d,0x3991,0x3995,0x3999,0x399f,0x39a5,0x39ab,0x39af,0x39b3,0x39b7,0x39bb, -0x39c1,0x39c5,0x39cb,0x39cf,0x39d3,0x39d9,0x39df,0x39e3,0x2ba9,0x39e7,0x39eb,0x39ef,0x39f3,0x39f7,0x39fb,0x3113, -0x39ff,0x3a03,0x3a07,0x3a0b,0x3a0f,0x3a13,0x3a17,0x3a1b,0x3a1f,0x3a23,0x3a29,0x3a2d,0x3a31,0x3a35,0x3a39,0x3a3d, -0x3a43,0x3a49,0x3a4d,0x3a51,0x3127,0x312b,0x3a55,0x3a59,0x3a5f,0x3a63,0x3a67,0x3a6b,0x3a6f,0x3a75,0x3a7b,0x3a7f, -0x3a83,0x3a87,0x3a8d,0x312f,0x3a91,0x3a97,0x3a9d,0x3aa1,0x3aa5,0x3aa9,0x3aaf,0x3ab3,0x3ab7,0x3abb,0x3abf,0x3ac3, -0x3ac7,0x3acb,0x3ad1,0x3ad5,0x3ad9,0x3add,0x3ae3,0x3ae7,0x3aeb,0x3aef,0x3af3,0x3af9,0x3aff,0x3b03,0x3b07,0x3b0b, -0x3b11,0x3b15,0x3147,0x3147,0x3b1b,0x3b1f,0x3b25,0x3b29,0x3b2d,0x3b31,0x3b35,0x3b39,0x3b3d,0x3b41,0x314b,0x3b47, -0x3b4b,0x3b4f,0x3b53,0x3b57,0x3b5b,0x3b61,0x3b65,0x3b6b,0x3b71,0x3b77,0x3b7b,0x3b7f,0x3b83,0x3b87,0x3b8b,0x3b8f, -0x3b93,0x3b97,1,1 +0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,0x1289,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,0x3c66,1,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,0x3c66,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3c66, +0x3c66,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x3c66,1,1,1,1,0x3c66,1,1,1,0x3c66,0x3c66,0x3c66, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x3b97,1, +0x2ad5,0x2ad9,0x2add,0x2ae1,0x2ae5,0x2ae9,0x2aed,0x2af1,0x2af1,0x2af5,0x2af9,0x2afd,0x2b01,0x2b05,0x2b09,0x2b0d, +0x2b11,0x2b15,0x2b19,0x2b1d,0x2b21,0x2b25,0x2b29,0x2b2d,0x2b31,0x2b35,0x2b39,0x2b3d,0x2b41,0x2b45,0x2b49,0x2b4d, +0x2b51,0x2b55,0x2b59,0x2b5d,0x2b61,0x2b65,0x2b69,0x2b6d,0x2b71,0x2b75,0x2b79,0x2b7d,0x2b81,0x2b85,0x2b89,0x2b8d, +0x2b91,0x2b95,0x2b99,0x2b9d,0x2ba1,0x2ba5,0x2ba9,0x2bad,0x2bb1,0x2bb5,0x2bb9,0x2bbd,0x2bc1,0x2bc5,0x2bc9,0x2bcd, +0x2bd1,0x2bd5,0x2bd9,0x2bdd,0x2be1,0x2be5,0x2be9,0x2bed,0x2bf1,0x2bf5,0x2bf9,0x2bfd,0x2c01,0x2c05,0x2c09,0x2c0d, +0x2c11,0x2c15,0x2c19,0x2c1d,0x2c21,0x2c25,0x2c29,0x2c2d,0x2c31,0x2c35,0x2c39,0x2c3d,0x2b21,0x2c41,0x2c45,0x2c49, +0x2c4d,0x2c51,0x2c55,0x2c59,0x2c5d,0x2c61,0x2c65,0x2c69,0x2c6d,0x2c71,0x2c75,0x2c79,0x2c7d,0x2c81,0x2c85,0x2c89, +0x2c8d,0x2c91,0x2c95,0x2c99,0x2c9d,0x2ca1,0x2ca5,0x2ca9,0x2cad,0x2cb1,0x2cb5,0x2cb9,0x2cbd,0x2cc1,0x2cc5,0x2cc9, +0x2ccd,0x2cd1,0x2cd5,0x2cd9,0x2cdd,0x2ce1,0x2ce5,0x2ce9,0x2ced,0x2cf1,0x2cf5,0x2cf9,0x2cfd,0x2d01,0x2d05,0x2d09, +0x2d0d,0x2d11,0x2d15,0x2d19,0x2d1d,0x2d21,0x2d25,0x2d29,0x2d2d,0x2d31,0x2d35,0x2d39,0x2d3d,0x2d41,0x2d45,0x2d49, +0x2d4d,0x2c89,0x2d51,0x2d55,0x2d59,0x2d5d,0x2d61,0x2d65,0x2d69,0x2d6d,0x2c49,0x2d71,0x2d75,0x2d79,0x2d7d,0x2d81, +0x2d85,0x2d89,0x2d8d,0x2d91,0x2d95,0x2d99,0x2d9d,0x2da1,0x2da5,0x2da9,0x2dad,0x2db1,0x2db5,0x2db9,0x2dbd,0x2b21, +0x2dc1,0x2dc5,0x2dc9,0x2dcd,0x2dd1,0x2dd5,0x2dd9,0x2ddd,0x2de1,0x2de5,0x2de9,0x2ded,0x2df1,0x2df5,0x2df9,0x2dfd, +0x2e01,0x2e05,0x2e09,0x2e0d,0x2e11,0x2e15,0x2e19,0x2e1d,0x2e21,0x2e25,0x2e29,0x2c51,0x2e2d,0x2e31,0x2e35,0x2e39, +0x2e3d,0x2e41,0x2e45,0x2e49,0x2e4d,0x2e51,0x2e55,0x2e59,0x2e5d,0x2e61,0x2e65,0x2e69,0x2e6d,0x2e71,0x2e75,0x2e79, +0x2e7d,0x2e81,0x2e85,0x2e89,0x2e8d,0x2e91,0x2e95,0x2e99,0x2e9d,0x2ea1,0x2ea5,0x2ea9,0x2ead,0x2eb1,0x2eb5,0x2eb9, +0x2ebd,0x2ec1,0x2ec5,0x2ec9,0x2ecd,0x2ed1,0x2ed5,0x2ed9,0x2edd,0x2ee1,0x2ee5,0x2ee9,0x2eed,0x2ef1,1,1, +0x2ef5,1,0x2ef9,1,1,0x2efd,0x2f01,0x2f05,0x2f09,0x2f0d,0x2f11,0x2f15,0x2f19,0x2f1d,0x2f21,1, +0x2f25,1,0x2f29,1,1,0x2f2d,0x2f31,1,1,1,0x2f35,0x2f39,0x2f3d,0x2f41,0x2f45,0x2f49, +0x2f4d,0x2f51,0x2f55,0x2f59,0x2f5d,0x2f61,0x2f65,0x2f69,0x2f6d,0x2f71,0x2f75,0x2f79,0x2f7d,0x2f81,0x2f85,0x2f89, +0x2f8d,0x2f91,0x2f95,0x2f99,0x2f9d,0x2fa1,0x2fa5,0x2fa9,0x2fad,0x2fb1,0x2fb5,0x2fb9,0x2fbd,0x2fc1,0x2fc5,0x2fc9, +0x2fcd,0x2fd1,0x2fd5,0x2fd9,0x2fdd,0x2fe1,0x2fe5,0x2d25,0x2fe9,0x2fed,0x2ff1,0x2ff5,0x2ff9,0x2ffd,0x2ffd,0x3001, +0x3005,0x3009,0x300d,0x3011,0x3015,0x3019,0x301d,0x2f2d,0x3021,0x3025,0x3029,0x302d,0x3031,0x3037,1,1, +0x303b,0x303f,0x3043,0x3047,0x304b,0x304f,0x3053,0x3057,0x2f65,0x305b,0x305f,0x3063,0x2ef5,0x3067,0x306b,0x306f, +0x3073,0x3077,0x307b,0x307f,0x3083,0x3087,0x308b,0x308f,0x3093,0x2f89,0x3097,0x2f8d,0x309b,0x309f,0x30a3,0x30a7, +0x30ab,0x2ef9,0x2b75,0x30af,0x30b3,0x30b7,0x2c8d,0x2de9,0x30bb,0x30bf,0x2fa9,0x30c3,0x2fad,0x30c7,0x30cb,0x30cf, +0x2f01,0x30d3,0x30d7,0x30db,0x30df,0x30e3,0x2f05,0x30e7,0x30eb,0x30ef,0x30f3,0x30f7,0x30fb,0x2fe5,0x30ff,0x3103, +0x2d25,0x3107,0x2ff5,0x310b,0x310f,0x3113,0x3117,0x311b,0x3009,0x311f,0x2f29,0x3123,0x300d,0x2c41,0x3127,0x3011, +0x312b,0x3019,0x312f,0x3133,0x3137,0x313b,0x313f,0x3021,0x2f19,0x3143,0x3025,0x3147,0x3029,0x314b,0x2af1,0x314f, +0x3155,0x315b,0x3161,0x3165,0x3169,0x316d,0x3173,0x3179,0x317f,0x3183,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0x3186,0xfe34,0x318c,1,1,1,1,1,1,1,1,1,1,0x3192,0x3198,0x31a0, +0x31aa,0x31b2,0x31b8,0x31be,0x31c4,0x31ca,0x31d0,0x31d6,0x31dc,0x31e2,1,0x31e8,0x31ee,0x31f4,0x31fa,0x3200, +1,0x3206,1,0x320c,0x3212,1,0x3218,0x321e,1,0x3224,0x322a,0x3230,0x3236,0x323c,0x3242,0x3248, +0x324e,0x3254,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8, +0xffb8,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffb8,1,0xffcc,1,1,1,1,1,1,1,1,0xffcc,0xfe02, +0xffb8,1,1,1,1,0xfe12,1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,1,1, +1,1,1,1,1,1,0xffb8,0xffb8,0xffcc,0xffcc,0xffcc,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8, +1,1,0xffcc,0xffb8,0xffcc,0xffb8,1,1,1,1,1,1,1,1,1,1, +0xfe12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe12, +1,1,1,1,1,1,1,1,1,0xa94,0x295f,0xa9a,0x2969,1,1,1, +1,1,0xaa0,1,1,1,1,1,0x2973,1,1,1,1,1,1,1, +1,1,0xfe12,0xfc0e,1,1,1,1,1,1,1,0xfc00,1,1,1,1, +1,1,0x297d,0x2987,1,0xaa6,0xaac,0xfe12,0xfe12,1,1,1,1,1,1,1, +1,1,1,1,0xfe12,1,1,1,1,1,1,1,1,1,0xfe0e,1, +1,1,1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,0xfe0e, +0xfe12,1,1,1,1,1,1,1,1,1,1,1,0xfe0e,0xfe0e,1,0xfc00, +1,1,1,1,1,1,1,0xab2,1,1,1,0x2991,0x299b,0xfe12,1,1, +1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,0xfe12,1, +1,1,0xfe0e,1,1,1,1,1,1,1,1,1,0xfc00,1,1,1, +1,1,1,1,1,0xabe,0xfc00,0x29a5,0x29af,0xfc00,0x29b9,1,1,0xfe12,0xfe0e,1, +1,1,1,1,1,1,1,1,1,1,1,0xad0,0xad6,0x29c3,0x29cd,1, +1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xfe12,0xfe0e,1,1,1,1,1,1,1,1,0xfc00,1,1, +1,1,0xadc,1,1,0x29d7,1,1,1,1,0xfe12,0xfe12,1,0xfe02,0xfe02,0xfe02, +0xfe02,0xfe02,1,1,1,1,1,1,1,1,1,1,1,0xfe0c,0xfe0c,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,0xfe02,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0x325a,0x3264,0x3278,0x3290, +0x32a8,0x32c0,0x32d8,0xffb0,0xffb0,0xfe02,0xfe02,0xfe02,1,1,1,0xffc4,0xffb0,0xffb0,0xffb0,1, +1,1,1,1,1,1,1,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffb8,0xffb8,1,1,1,1,1,1,1,1,1,1,0xffcc, +0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,0x32e6,0x32f0, +0x3304,0x331c,0x3334,0x334c,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,1,0xffcc,0xffcc,1,0xffcc, +0xffcc,0xffcc,0xffcc,0xffcc,1,1,1,1,1,1,1,1,1,1,1,1, +0xffd0,0xffd0,0xffb8,0xffcc,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,0xffb8,1,1,1,1,1, +1,1,1,1,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xffcc,0xfe0e,1,1,1,1,1, +0x335b,0x335f,0x3363,0x3367,0x336d,0x2f4d,0x3371,0x3375,0x3379,0x337d,0x2f51,0x3381,0x3385,0x3389,0x2f55,0x338f, +0x3393,0x3397,0x339b,0x33a1,0x33a5,0x33a9,0x33ad,0x33b3,0x33b7,0x33bb,0x33bf,0x303f,0x33c3,0x33c9,0x33cd,0x33d1, +0x33d5,0x33d9,0x33dd,0x33e1,0x33e5,0x3053,0x2f59,0x2f5d,0x3057,0x33e9,0x33ed,0x2c59,0x33f1,0x2f61,0x33f5,0x33f9, +0x33fd,0x3401,0x3401,0x3401,0x3405,0x340b,0x340f,0x3413,0x3417,0x341d,0x3421,0x3425,0x3429,0x342d,0x3431,0x3435, +0x3439,0x343d,0x3441,0x3445,0x3449,0x344d,0x344d,0x305f,0x3451,0x3455,0x3459,0x345d,0x2f69,0x3461,0x3465,0x3469, +0x2ebd,0x346d,0x3471,0x3475,0x3479,0x347d,0x3481,0x3485,0x3489,0x348d,0x3493,0x3497,0x349b,0x349f,0x34a3,0x34a7, +0x34ab,0x34b1,0x34b7,0x34bb,0x34bf,0x34c3,0x34c7,0x34cb,0x34cf,0x34d3,0x34d7,0x34d7,0x34db,0x34e1,0x34e5,0x2c49, +0x34e9,0x34ed,0x34f3,0x34f7,0x34fb,0x34ff,0x3503,0x3507,0x2f7d,0x350b,0x350f,0x3513,0x3519,0x351d,0x3523,0x3527, +0x352b,0x352f,0x3533,0x3537,0x353b,0x353f,0x3543,0x3547,0x354b,0x354f,0x3555,0x3559,0x355d,0x3561,0x2b71,0x3565, +0x356b,0x356f,0x356f,0x3575,0x3579,0x3579,0x357d,0x3581,0x3587,0x358d,0x3591,0x3595,0x3599,0x359d,0x35a1,0x35a5, +0x35a9,0x35ad,0x35b1,0x2f81,0x35b5,0x35bb,0x35bf,0x35c3,0x308f,0x35c3,0x35c7,0x2f89,0x35cb,0x35cf,0x35d3,0x35d7, +0x2f8d,0x2b05,0x35db,0x35df,0x35e3,0x35e7,0x35eb,0x35ef,0x35f3,0x35f9,0x35fd,0x3601,0x3605,0x3609,0x360d,0x3613, +0x3617,0x361b,0x361f,0x3623,0x3627,0x362b,0x362f,0x3633,0x2f91,0x3637,0x363b,0x3641,0x3645,0x3649,0x364d,0x2f99, +0x3651,0x3655,0x3659,0x365d,0x3661,0x3665,0x3669,0x366d,0x2b75,0x30af,0x3671,0x3675,0x3679,0x367d,0x3683,0x3687, +0x368b,0x368f,0x2f9d,0x3693,0x3699,0x369d,0x36a1,0x3161,0x36a5,0x36a9,0x36ad,0x36b1,0x36b5,0x36bb,0x36bf,0x36c3, +0x36c7,0x36cd,0x36d1,0x36d5,0x36d9,0x2c8d,0x36dd,0x36e1,0x36e7,0x36ed,0x36f3,0x36f7,0x36fd,0x3701,0x3705,0x3709, +0x370d,0x2fa1,0x2de9,0x3711,0x3715,0x3719,0x371d,0x3723,0x3727,0x372b,0x372f,0x30bf,0x3733,0x3737,0x373d,0x3741, +0x3745,0x374b,0x3751,0x3755,0x30c3,0x3759,0x375d,0x3761,0x3765,0x3769,0x376d,0x3771,0x3777,0x377b,0x3781,0x3785, +0x378b,0x30cb,0x378f,0x3793,0x3799,0x379d,0x37a1,0x37a7,0x37ad,0x37b1,0x37b5,0x37b9,0x37bd,0x37bd,0x37c1,0x37c5, +0x30d3,0x37c9,0x37cd,0x37d1,0x37d5,0x37d9,0x37df,0x37e3,0x2c55,0x37e9,0x37ef,0x37f3,0x37f9,0x37ff,0x3805,0x3809, +0x30eb,0x380d,0x3813,0x3819,0x381f,0x3825,0x3829,0x3829,0x30ef,0x3169,0x382d,0x3831,0x3835,0x3839,0x383f,0x2bbd, +0x30f7,0x3843,0x3847,0x2fcd,0x384d,0x3853,0x2f15,0x3859,0x385d,0x2fdd,0x3861,0x3865,0x3869,0x386f,0x386f,0x3875, +0x3879,0x387d,0x3883,0x3887,0x388b,0x388f,0x3895,0x3899,0x389d,0x38a1,0x38a5,0x38a9,0x38af,0x38b3,0x38b7,0x38bb, +0x38bf,0x38c3,0x38c7,0x38cd,0x38d3,0x38d7,0x38dd,0x38e1,0x38e7,0x38eb,0x2ff5,0x38ef,0x38f5,0x38fb,0x38ff,0x3905, +0x3909,0x390f,0x3913,0x3917,0x391b,0x391f,0x3923,0x3927,0x392d,0x3933,0x3939,0x3575,0x393f,0x3943,0x3947,0x394b, +0x394f,0x3953,0x3957,0x395b,0x395f,0x3963,0x3967,0x396b,0x2c9d,0x3971,0x3975,0x3979,0x397d,0x3981,0x3985,0x3001, +0x3989,0x398d,0x3991,0x3995,0x3999,0x399f,0x39a5,0x39ab,0x39af,0x39b3,0x39b7,0x39bb,0x39c1,0x39c5,0x39cb,0x39cf, +0x39d3,0x39d9,0x39df,0x39e3,0x2ba9,0x39e7,0x39eb,0x39ef,0x39f3,0x39f7,0x39fb,0x3113,0x39ff,0x3a03,0x3a07,0x3a0b, +0x3a0f,0x3a13,0x3a17,0x3a1b,0x3a1f,0x3a23,0x3a29,0x3a2d,0x3a31,0x3a35,0x3a39,0x3a3d,0x3a43,0x3a49,0x3a4d,0x3a51, +0x3127,0x312b,0x3a55,0x3a59,0x3a5f,0x3a63,0x3a67,0x3a6b,0x3a6f,0x3a75,0x3a7b,0x3a7f,0x3a83,0x3a87,0x3a8d,0x312f, +0x3a91,0x3a97,0x3a9d,0x3aa1,0x3aa5,0x3aa9,0x3aaf,0x3ab3,0x3ab7,0x3abb,0x3abf,0x3ac3,0x3ac7,0x3acb,0x3ad1,0x3ad5, +0x3ad9,0x3add,0x3ae3,0x3ae7,0x3aeb,0x3aef,0x3af3,0x3af9,0x3aff,0x3b03,0x3b07,0x3b0b,0x3b11,0x3b15,0x3147,0x3147, +0x3b1b,0x3b1f,0x3b25,0x3b29,0x3b2d,0x3b31,0x3b35,0x3b39,0x3b3d,0x3b41,0x314b,0x3b47,0x3b4b,0x3b4f,0x3b53,0x3b57, +0x3b5b,0x3b61,0x3b65,0x3b6b,0x3b71,0x3b77,0x3b7b,0x3b7f,0x3b83,0x3b87,0x3b8b,0x3b8f,0x3b93,0x3b97,1,1 }; static const UCPTrie norm2_nfc_data_trie={ norm2_nfc_data_trieIndex, { norm2_nfc_data_trieData }, - 1746, 7892, + 1788, 7984, 0x2fc00, 0x30, 0, 0, 0, 0, @@ -1128,7 +1133,7 @@ static const uint16_t norm2_nfc_data_extraData[7732]={ }; static const uint8_t norm2_nfc_data_smallFCD[256]={ -0xc0,0xef,3,0x7f,0xdf,0x70,0xcf,0x87,0xc7,0xe6,0x66,0x46,0x64,0x46,0x66,0x5b, +0xc0,0xef,3,0x7f,0xdf,0x70,0xcf,0x87,0xd7,0xe6,0x66,0x46,0x66,0x46,0x66,0x5b, 0x12,0,0,4,0,0,0,0x43,0x20,2,0x69,0xae,0xc2,0xc0,0xff,0xff, 0xc0,0x72,0xbf,0,0,0,0,0,0,0,0x40,0,0x80,0x88,0,0, 0xfe,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/src/duckdb/extension/icu/third_party/icu/common/norm2allmodes.h b/src/duckdb/extension/icu/third_party/icu/common/norm2allmodes.h index 682ece28f..a2cfc89c1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/norm2allmodes.h +++ b/src/duckdb/extension/icu/third_party/icu/common/norm2allmodes.h @@ -38,13 +38,13 @@ class Normalizer2WithImpl : public Normalizer2 { virtual UnicodeString & normalize(const UnicodeString &src, UnicodeString &dest, - UErrorCode &errorCode) const { + UErrorCode &errorCode) const override { if(U_FAILURE(errorCode)) { dest.setToBogus(); return dest; } - const UChar *sArray=src.getBuffer(); - if(&dest==&src || sArray==NULL) { + const char16_t *sArray=src.getBuffer(); + if(&dest==&src || sArray==nullptr) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; dest.setToBogus(); return dest; @@ -57,21 +57,21 @@ class Normalizer2WithImpl : public Normalizer2 { return dest; } virtual void - normalize(const UChar *src, const UChar *limit, + normalize(const char16_t *src, const char16_t *limit, ReorderingBuffer &buffer, UErrorCode &errorCode) const = 0; // normalize and append virtual UnicodeString & normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, - UErrorCode &errorCode) const { - return normalizeSecondAndAppend(first, second, TRUE, errorCode); + UErrorCode &errorCode) const override { + return normalizeSecondAndAppend(first, second, true, errorCode); } virtual UnicodeString & append(UnicodeString &first, const UnicodeString &second, - UErrorCode &errorCode) const { - return normalizeSecondAndAppend(first, second, FALSE, errorCode); + UErrorCode &errorCode) const override { + return normalizeSecondAndAppend(first, second, false, errorCode); } UnicodeString & normalizeSecondAndAppend(UnicodeString &first, @@ -82,8 +82,8 @@ class Normalizer2WithImpl : public Normalizer2 { if(U_FAILURE(errorCode)) { return first; } - const UChar *secondArray=second.getBuffer(); - if(&first==&second || secondArray==NULL) { + const char16_t *secondArray=second.getBuffer(); + if(&first==&second || secondArray==nullptr) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; return first; } @@ -103,81 +103,81 @@ class Normalizer2WithImpl : public Normalizer2 { return first; } virtual void - normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize, UnicodeString &safeMiddle, ReorderingBuffer &buffer, UErrorCode &errorCode) const = 0; virtual UBool - getDecomposition(UChar32 c, UnicodeString &decomposition) const { - UChar buffer[4]; + getDecomposition(UChar32 c, UnicodeString &decomposition) const override { + char16_t buffer[4]; int32_t length; - const UChar *d=impl.getDecomposition(c, buffer, length); - if(d==NULL) { - return FALSE; + const char16_t *d=impl.getDecomposition(c, buffer, length); + if(d==nullptr) { + return false; } if(d==buffer) { decomposition.setTo(buffer, length); // copy the string (Jamos from Hangul syllable c) } else { - decomposition.setTo(FALSE, d, length); // read-only alias + decomposition.setTo(false, d, length); // read-only alias } - return TRUE; + return true; } virtual UBool - getRawDecomposition(UChar32 c, UnicodeString &decomposition) const { - UChar buffer[30]; + getRawDecomposition(UChar32 c, UnicodeString &decomposition) const override { + char16_t buffer[30]; int32_t length; - const UChar *d=impl.getRawDecomposition(c, buffer, length); - if(d==NULL) { - return FALSE; + const char16_t *d=impl.getRawDecomposition(c, buffer, length); + if(d==nullptr) { + return false; } if(d==buffer) { decomposition.setTo(buffer, length); // copy the string (algorithmic decomposition) } else { - decomposition.setTo(FALSE, d, length); // read-only alias + decomposition.setTo(false, d, length); // read-only alias } - return TRUE; + return true; } virtual UChar32 - composePair(UChar32 a, UChar32 b) const { + composePair(UChar32 a, UChar32 b) const override { return impl.composePair(a, b); } virtual uint8_t - getCombiningClass(UChar32 c) const { + getCombiningClass(UChar32 c) const override { return impl.getCC(impl.getNorm16(c)); } // quick checks virtual UBool - isNormalized(const UnicodeString &s, UErrorCode &errorCode) const { + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const override { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } - const UChar *sArray=s.getBuffer(); - if(sArray==NULL) { + const char16_t *sArray=s.getBuffer(); + if(sArray==nullptr) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } - const UChar *sLimit=sArray+s.length(); + const char16_t *sLimit=sArray+s.length(); return sLimit==spanQuickCheckYes(sArray, sLimit, errorCode); } virtual UNormalizationCheckResult - quickCheck(const UnicodeString &s, UErrorCode &errorCode) const { + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const override { return Normalizer2WithImpl::isNormalized(s, errorCode) ? UNORM_YES : UNORM_NO; } virtual int32_t - spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const { + spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const override { if(U_FAILURE(errorCode)) { return 0; } - const UChar *sArray=s.getBuffer(); - if(sArray==NULL) { + const char16_t *sArray=s.getBuffer(); + if(sArray==nullptr) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } return (int32_t)(spanQuickCheckYes(sArray, sArray+s.length(), errorCode)-sArray); } - virtual const UChar * - spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const = 0; + virtual const char16_t * + spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &errorCode) const = 0; virtual UNormalizationCheckResult getQuickCheck(UChar32) const { return UNORM_YES; @@ -193,28 +193,58 @@ class DecomposeNormalizer2 : public Normalizer2WithImpl { private: virtual void - normalize(const UChar *src, const UChar *limit, - ReorderingBuffer &buffer, UErrorCode &errorCode) const { + normalize(const char16_t *src, const char16_t *limit, + ReorderingBuffer &buffer, UErrorCode &errorCode) const override { impl.decompose(src, limit, &buffer, errorCode); } using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function. virtual void - normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize, UnicodeString &safeMiddle, - ReorderingBuffer &buffer, UErrorCode &errorCode) const { + ReorderingBuffer &buffer, UErrorCode &errorCode) const override { impl.decomposeAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode); } - virtual const UChar * - spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const { - return impl.decompose(src, limit, NULL, errorCode); + + void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const override { + if (U_FAILURE(errorCode)) { + return; + } + if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) { + edits->reset(); + } + const uint8_t *s = reinterpret_cast(src.data()); + impl.decomposeUTF8(options, s, s + src.length(), &sink, edits, errorCode); + sink.Flush(); + } + virtual UBool + isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const override { + if(U_FAILURE(errorCode)) { + return false; + } + const uint8_t *s = reinterpret_cast(sp.data()); + const uint8_t *sLimit = s + sp.length(); + return sLimit == impl.decomposeUTF8(0, s, sLimit, nullptr, nullptr, errorCode); + } + + virtual const char16_t * + spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &errorCode) const override { + return impl.decompose(src, limit, nullptr, errorCode); } using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function. - virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const { + virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const override { return impl.isDecompYes(impl.getNorm16(c)) ? UNORM_YES : UNORM_NO; } - virtual UBool hasBoundaryBefore(UChar32 c) const { return impl.hasDecompBoundaryBefore(c); } - virtual UBool hasBoundaryAfter(UChar32 c) const { return impl.hasDecompBoundaryAfter(c); } - virtual UBool isInert(UChar32 c) const { return impl.isDecompInert(c); } + virtual UBool hasBoundaryBefore(UChar32 c) const override { + return impl.hasDecompBoundaryBefore(c); + } + virtual UBool hasBoundaryAfter(UChar32 c) const override { + return impl.hasDecompBoundaryAfter(c); + } + virtual UBool isInert(UChar32 c) const override { + return impl.isDecompInert(c); + } }; class ComposeNormalizer2 : public Normalizer2WithImpl { @@ -225,15 +255,15 @@ class ComposeNormalizer2 : public Normalizer2WithImpl { private: virtual void - normalize(const UChar *src, const UChar *limit, - ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { - impl.compose(src, limit, onlyContiguous, TRUE, buffer, errorCode); + normalize(const char16_t *src, const char16_t *limit, + ReorderingBuffer &buffer, UErrorCode &errorCode) const 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 { + Edits *edits, UErrorCode &errorCode) const override { if (U_FAILURE(errorCode)) { return; } @@ -247,44 +277,44 @@ class ComposeNormalizer2 : public Normalizer2WithImpl { } virtual void - normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize, UnicodeString &safeMiddle, - ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE { + ReorderingBuffer &buffer, UErrorCode &errorCode) const override { impl.composeAndAppend(src, limit, doNormalize, onlyContiguous, safeMiddle, buffer, errorCode); } virtual UBool - isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const override { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } - const UChar *sArray=s.getBuffer(); - if(sArray==NULL) { + const char16_t *sArray=s.getBuffer(); + if(sArray==nullptr) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } UnicodeString temp; ReorderingBuffer buffer(impl, temp); if(!buffer.init(5, errorCode)) { // small destCapacity for substring normalization - return FALSE; + return false; } - return impl.compose(sArray, sArray+s.length(), onlyContiguous, FALSE, buffer, errorCode); + return impl.compose(sArray, sArray+s.length(), onlyContiguous, false, buffer, errorCode); } virtual UBool - isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE { + isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const override { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } const uint8_t *s = reinterpret_cast(sp.data()); return impl.composeUTF8(0, onlyContiguous, s, s + sp.length(), nullptr, nullptr, errorCode); } virtual UNormalizationCheckResult - quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE { + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const override { if(U_FAILURE(errorCode)) { return UNORM_MAYBE; } - const UChar *sArray=s.getBuffer(); - if(sArray==NULL) { + const char16_t *sArray=s.getBuffer(); + if(sArray==nullptr) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; return UNORM_MAYBE; } @@ -292,21 +322,21 @@ class ComposeNormalizer2 : public Normalizer2WithImpl { impl.composeQuickCheck(sArray, sArray+s.length(), onlyContiguous, &qcResult); return qcResult; } - virtual const UChar * - spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const U_OVERRIDE { - return impl.composeQuickCheck(src, limit, onlyContiguous, NULL); + virtual const char16_t * + spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &) const override { + return impl.composeQuickCheck(src, limit, onlyContiguous, nullptr); } using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function. - virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE { + virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const override { return impl.getCompQuickCheck(impl.getNorm16(c)); } - virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE { + virtual UBool hasBoundaryBefore(UChar32 c) const override { return impl.hasCompBoundaryBefore(c); } - virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE { + virtual UBool hasBoundaryAfter(UChar32 c) const override { return impl.hasCompBoundaryAfter(c, onlyContiguous); } - virtual UBool isInert(UChar32 c) const U_OVERRIDE { + virtual UBool isInert(UChar32 c) const override { return impl.isCompInert(c, onlyContiguous); } @@ -320,30 +350,36 @@ class FCDNormalizer2 : public Normalizer2WithImpl { private: virtual void - normalize(const UChar *src, const UChar *limit, - ReorderingBuffer &buffer, UErrorCode &errorCode) const { + normalize(const char16_t *src, const char16_t *limit, + ReorderingBuffer &buffer, UErrorCode &errorCode) const override { impl.makeFCD(src, limit, &buffer, errorCode); } using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function. virtual void - normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize, + normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize, UnicodeString &safeMiddle, - ReorderingBuffer &buffer, UErrorCode &errorCode) const { + ReorderingBuffer &buffer, UErrorCode &errorCode) const override { impl.makeFCDAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode); } - virtual const UChar * - spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const { - return impl.makeFCD(src, limit, NULL, errorCode); + virtual const char16_t * + spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &errorCode) const override { + return impl.makeFCD(src, limit, nullptr, errorCode); } using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function. - virtual UBool hasBoundaryBefore(UChar32 c) const { return impl.hasFCDBoundaryBefore(c); } - virtual UBool hasBoundaryAfter(UChar32 c) const { return impl.hasFCDBoundaryAfter(c); } - virtual UBool isInert(UChar32 c) const { return impl.isFCDInert(c); } + virtual UBool hasBoundaryBefore(UChar32 c) const override { + return impl.hasFCDBoundaryBefore(c); + } + virtual UBool hasBoundaryAfter(UChar32 c) const override { + return impl.hasFCDBoundaryAfter(c); + } + virtual UBool isInert(UChar32 c) const override { + return impl.isFCDInert(c); + } }; struct Norm2AllModes : public UMemory { Norm2AllModes(Normalizer2Impl *i) - : impl(i), comp(*i, FALSE), decomp(*i), fcd(*i), fcc(*i, TRUE) {} + : impl(i), comp(*i, false), decomp(*i), fcd(*i), fcc(*i, true) {} ~Norm2AllModes(); static Norm2AllModes *createInstance(Normalizer2Impl *impl, UErrorCode &errorCode); @@ -355,6 +391,7 @@ struct Norm2AllModes : public UMemory { static const Norm2AllModes *getNFCInstance(UErrorCode &errorCode); static const Norm2AllModes *getNFKCInstance(UErrorCode &errorCode); static const Norm2AllModes *getNFKC_CFInstance(UErrorCode &errorCode); + static const Norm2AllModes *getNFKC_SCFInstance(UErrorCode &errorCode); Normalizer2Impl *impl; ComposeNormalizer2 comp; diff --git a/src/duckdb/extension/icu/third_party/icu/common/normalizer2.cpp b/src/duckdb/extension/icu/third_party/icu/common/normalizer2.cpp index 6be7e0b21..6856736b8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/normalizer2.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/normalizer2.cpp @@ -62,7 +62,7 @@ Normalizer2::normalizeUTF8(uint32_t /*options*/, StringPiece src, ByteSink &sink UBool Normalizer2::getRawDecomposition(UChar32, UnicodeString &) const { - return FALSE; + return false; } UChar32 @@ -87,7 +87,7 @@ class NoopNormalizer2 : public Normalizer2 { virtual UnicodeString & normalize(const UnicodeString &src, UnicodeString &dest, - UErrorCode &errorCode) const U_OVERRIDE { + UErrorCode &errorCode) const override { if(U_SUCCESS(errorCode)) { if(&dest!=&src) { dest=src; @@ -99,7 +99,7 @@ class NoopNormalizer2 : public Normalizer2 { } virtual void normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, - Edits *edits, UErrorCode &errorCode) const U_OVERRIDE { + Edits *edits, UErrorCode &errorCode) const override { if(U_SUCCESS(errorCode)) { if (edits != nullptr) { if ((options & U_EDITS_NO_RESET) == 0) { @@ -117,7 +117,7 @@ class NoopNormalizer2 : public Normalizer2 { virtual UnicodeString & normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, - UErrorCode &errorCode) const U_OVERRIDE { + UErrorCode &errorCode) const override { if(U_SUCCESS(errorCode)) { if(&first!=&second) { first.append(second); @@ -130,7 +130,7 @@ class NoopNormalizer2 : public Normalizer2 { virtual UnicodeString & append(UnicodeString &first, const UnicodeString &second, - UErrorCode &errorCode) const U_OVERRIDE { + UErrorCode &errorCode) const override { if(U_SUCCESS(errorCode)) { if(&first!=&second) { first.append(second); @@ -141,29 +141,29 @@ class NoopNormalizer2 : public Normalizer2 { return first; } virtual UBool - getDecomposition(UChar32, UnicodeString &) const U_OVERRIDE { - return FALSE; + getDecomposition(UChar32, UnicodeString &) const override { + return false; } - // No need to U_OVERRIDE the default getRawDecomposition(). + // No need to override the default getRawDecomposition(). virtual UBool - isNormalized(const UnicodeString &, UErrorCode &errorCode) const U_OVERRIDE { + isNormalized(const UnicodeString &, UErrorCode &errorCode) const override { return U_SUCCESS(errorCode); } virtual UBool - isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const U_OVERRIDE { + isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const override { return U_SUCCESS(errorCode); } virtual UNormalizationCheckResult - quickCheck(const UnicodeString &, UErrorCode &) const U_OVERRIDE { + quickCheck(const UnicodeString &, UErrorCode &) const override { return UNORM_YES; } virtual int32_t - spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const U_OVERRIDE { + spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const override { return s.length(); } - virtual UBool hasBoundaryBefore(UChar32) const U_OVERRIDE { return TRUE; } - virtual UBool hasBoundaryAfter(UChar32) const U_OVERRIDE { return TRUE; } - virtual UBool isInert(UChar32) const U_OVERRIDE { return TRUE; } + virtual UBool hasBoundaryBefore(UChar32) const override { return true; } + virtual UBool hasBoundaryAfter(UChar32) const override { return true; } + virtual UBool isInert(UChar32) const override { return true; } }; NoopNormalizer2::~NoopNormalizer2() {} @@ -183,14 +183,14 @@ static UBool U_CALLCONV uprv_normalizer2_cleanup(); U_CDECL_END static Normalizer2 *noopSingleton; -static icu::UInitOnce noopInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce noopInitOnce {}; static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } noopSingleton=new NoopNormalizer2; - if(noopSingleton==NULL) { + if(noopSingleton==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; return; } @@ -198,7 +198,7 @@ static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) { } const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode); return noopSingleton; } @@ -216,13 +216,13 @@ Norm2AllModes * Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { delete impl; - return NULL; + return nullptr; } Norm2AllModes *allModes=new Norm2AllModes(impl); - if(allModes==NULL) { + if(allModes==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; delete impl; - return NULL; + return nullptr; } return allModes; } @@ -231,12 +231,12 @@ Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) { Norm2AllModes * Norm2AllModes::createNFCInstance(UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } Normalizer2Impl *impl=new Normalizer2Impl; - if(impl==NULL) { + if(impl==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } impl->init(norm2_nfc_data_indexes, &norm2_nfc_data_trie, norm2_nfc_data_extraData, norm2_nfc_data_smallFCD); @@ -245,7 +245,7 @@ Norm2AllModes::createNFCInstance(UErrorCode &errorCode) { static Norm2AllModes *nfcSingleton; -static icu::UInitOnce nfcInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce nfcInitOnce {}; static void U_CALLCONV initNFCSingleton(UErrorCode &errorCode) { nfcSingleton=Norm2AllModes::createNFCInstance(errorCode); @@ -254,7 +254,7 @@ static void U_CALLCONV initNFCSingleton(UErrorCode &errorCode) { const Norm2AllModes * Norm2AllModes::getNFCInstance(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } umtx_initOnce(nfcInitOnce, &initNFCSingleton, errorCode); return nfcSingleton; } @@ -262,29 +262,29 @@ Norm2AllModes::getNFCInstance(UErrorCode &errorCode) { const Normalizer2 * Normalizer2::getNFCInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->comp : NULL; + return allModes!=nullptr ? &allModes->comp : nullptr; } const Normalizer2 * Normalizer2::getNFDInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->decomp : NULL; + return allModes!=nullptr ? &allModes->decomp : nullptr; } const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->fcd : NULL; + return allModes!=nullptr ? &allModes->fcd : nullptr; } const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? &allModes->fcc : NULL; + return allModes!=nullptr ? &allModes->fcc : nullptr; } const Normalizer2Impl * Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) { const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode); - return allModes!=NULL ? allModes->impl : NULL; + return allModes!=nullptr ? allModes->impl : nullptr; } #endif // NORM2_HARDCODE_NFC_DATA @@ -292,14 +292,14 @@ U_CDECL_BEGIN static UBool U_CALLCONV uprv_normalizer2_cleanup() { delete noopSingleton; - noopSingleton = NULL; + noopSingleton = nullptr; noopInitOnce.reset(); #if NORM2_HARDCODE_NFC_DATA delete nfcSingleton; - nfcSingleton = NULL; + nfcSingleton = nullptr; nfcInitOnce.reset(); #endif - return TRUE; + return true; } U_CDECL_END @@ -327,29 +327,29 @@ unorm2_close(UNormalizer2 *norm2) { U_CAPI int32_t U_EXPORT2 unorm2_normalize(const UNormalizer2 *norm2, - const UChar *src, int32_t length, - UChar *dest, int32_t capacity, + const char16_t *src, int32_t length, + char16_t *dest, int32_t capacity, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return 0; } - if( (src==NULL ? length!=0 : length<-1) || - (dest==NULL ? capacity!=0 : capacity<0) || - (src==dest && src!=NULL) + if( (src==nullptr ? length!=0 : length<-1) || + (dest==nullptr ? capacity!=0 : capacity<0) || + (src==dest && src!=nullptr) ) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } UnicodeString destString(dest, 0, capacity); - // length==0: Nothing to do, and n2wi->normalize(NULL, NULL, buffer, ...) would crash. + // length==0: Nothing to do, and n2wi->normalize(nullptr, nullptr, buffer, ...) would crash. if(length!=0) { const Normalizer2 *n2=(const Normalizer2 *)norm2; const Normalizer2WithImpl *n2wi=dynamic_cast(n2); - if(n2wi!=NULL) { + if(n2wi!=nullptr) { // Avoid duplicate argument checking and support NUL-terminated src. ReorderingBuffer buffer(n2wi->impl, destString); if(buffer.init(length, *pErrorCode)) { - n2wi->normalize(src, length>=0 ? src+length : NULL, buffer, *pErrorCode); + n2wi->normalize(src, length>=0 ? src+length : nullptr, buffer, *pErrorCode); } } else { UnicodeString srcString(length<0, src, length); @@ -361,34 +361,34 @@ unorm2_normalize(const UNormalizer2 *norm2, static int32_t normalizeSecondAndAppend(const UNormalizer2 *norm2, - UChar *first, int32_t firstLength, int32_t firstCapacity, - const UChar *second, int32_t secondLength, + char16_t *first, int32_t firstLength, int32_t firstCapacity, + const char16_t *second, int32_t secondLength, UBool doNormalize, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return 0; } - if( (second==NULL ? secondLength!=0 : secondLength<-1) || - (first==NULL ? (firstCapacity!=0 || firstLength!=0) : + if( (second==nullptr ? secondLength!=0 : secondLength<-1) || + (first==nullptr ? (firstCapacity!=0 || firstLength!=0) : (firstCapacity<0 || firstLength<-1)) || - (first==second && first!=NULL) + (first==second && first!=nullptr) ) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } UnicodeString firstString(first, firstLength, firstCapacity); firstLength=firstString.length(); // In case it was -1. - // secondLength==0: Nothing to do, and n2wi->normalizeAndAppend(NULL, NULL, buffer, ...) would crash. + // secondLength==0: Nothing to do, and n2wi->normalizeAndAppend(nullptr, nullptr, buffer, ...) would crash. if(secondLength!=0) { const Normalizer2 *n2=(const Normalizer2 *)norm2; const Normalizer2WithImpl *n2wi=dynamic_cast(n2); - if(n2wi!=NULL) { + if(n2wi!=nullptr) { // Avoid duplicate argument checking and support NUL-terminated src. UnicodeString safeMiddle; { ReorderingBuffer buffer(n2wi->impl, firstString); if(buffer.init(firstLength+secondLength+1, *pErrorCode)) { // destCapacity>=-1 - n2wi->normalizeAndAppend(second, secondLength>=0 ? second+secondLength : NULL, + n2wi->normalizeAndAppend(second, secondLength>=0 ? second+secondLength : nullptr, doNormalize, safeMiddle, buffer, *pErrorCode); } } // The ReorderingBuffer destructor finalizes firstString. @@ -396,7 +396,7 @@ normalizeSecondAndAppend(const UNormalizer2 *norm2, // Restore the modified suffix of the first string. // This does not restore first[] array contents between firstLength and firstCapacity. // (That might be uninitialized memory, as far as we know.) - if(first!=NULL) { /* don't dereference NULL */ + if(first!=nullptr) { /* don't dereference nullptr */ safeMiddle.extract(0, 0x7fffffff, first+firstLength-safeMiddle.length()); if(firstLength length) { - return FALSE; + return false; } // Compare valid strings from between normalization boundaries. // (Invalid sequences are normalization-inert.) @@ -225,21 +225,21 @@ UBool ReorderingBuffer::equals(const uint8_t *otherStart, const uint8_t *otherLi if (i >= length) { return j >= otherLength; } else if (j >= otherLength) { - return FALSE; + return false; } // Not at the end of either string yet. UChar32 c, other; U16_NEXT_UNSAFE(start, i, c); U8_NEXT_UNSAFE(otherStart, j, other); if (c != other) { - return FALSE; + return false; } } } UBool ReorderingBuffer::appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &errorCode) { if(remainingCapacity<2 && !resize(2, errorCode)) { - return FALSE; + return false; } if(lastCC<=cc || cc==0) { limit[0]=U16_LEAD(c); @@ -253,17 +253,17 @@ UBool ReorderingBuffer::appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &e insert(c, cc); } remainingCapacity-=2; - return TRUE; + return true; } -UBool ReorderingBuffer::append(const UChar *s, int32_t length, UBool isNFD, +UBool ReorderingBuffer::append(const char16_t *s, int32_t length, UBool isNFD, uint8_t leadCC, uint8_t trailCC, UErrorCode &errorCode) { if(length==0) { - return TRUE; + return true; } if(remainingCapacitycc;) {} // insert c at codePointLimit, after the character with prevCC<=cc - UChar *q=limit; - UChar *r=limit+=U16_LENGTH(c); + char16_t *q=limit; + char16_t *r=limit+=U16_LENGTH(c); do { *--r=*--q; } while(codePointLimit!=q); @@ -429,9 +429,9 @@ Normalizer2Impl::~Normalizer2Impl() { void Normalizer2Impl::init(const int32_t *inIndexes, const UCPTrie *inTrie, const uint16_t *inExtraData, const uint8_t *inSmallFCD) { - minDecompNoCP = static_cast(inIndexes[IX_MIN_DECOMP_NO_CP]); - minCompNoMaybeCP = static_cast(inIndexes[IX_MIN_COMP_NO_MAYBE_CP]); - minLcccCP = static_cast(inIndexes[IX_MIN_LCCC_CP]); + minDecompNoCP = static_cast(inIndexes[IX_MIN_DECOMP_NO_CP]); + minCompNoMaybeCP = static_cast(inIndexes[IX_MIN_COMP_NO_MAYBE_CP]); + minLcccCP = static_cast(inIndexes[IX_MIN_LCCC_CP]); minYesNo = static_cast(inIndexes[IX_MIN_YES_NO]); minYesNoMappingsOnly = static_cast(inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY]); @@ -503,7 +503,7 @@ Normalizer2Impl::addPropertyStarts(const USetAdder *sa, UErrorCode & /*errorCode } /* add Hangul LV syllables and LV+1 because of skippables */ - for(UChar c=Hangul::HANGUL_BASE; cadd(sa->set, c); sa->add(sa->set, c+1); } @@ -524,8 +524,8 @@ Normalizer2Impl::addCanonIterPropertyStarts(const USetAdder *sa, UErrorCode &err } } -const UChar * -Normalizer2Impl::copyLowPrefixFromNulTerminated(const UChar *src, +const char16_t * +Normalizer2Impl::copyLowPrefixFromNulTerminated(const char16_t *src, UChar32 minNeedDataCP, ReorderingBuffer *buffer, UErrorCode &errorCode) const { @@ -534,13 +534,13 @@ Normalizer2Impl::copyLowPrefixFromNulTerminated(const UChar *src, // data and check the first part of the string. // After this prefix, determine the string length to simplify the rest // of the code. - const UChar *prevSrc=src; - UChar c; + const char16_t *prevSrc=src; + char16_t c; while((c=*src++)appendZeroCC(prevSrc, src, errorCode); } } @@ -554,8 +554,8 @@ Normalizer2Impl::decompose(const UnicodeString &src, UnicodeString &dest, dest.setToBogus(); return dest; } - const UChar *sArray=src.getBuffer(); - if(&dest==&src || sArray==NULL) { + const char16_t *sArray=src.getBuffer(); + if(&dest==&src || sArray==nullptr) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; dest.setToBogus(); return dest; @@ -565,11 +565,11 @@ Normalizer2Impl::decompose(const UnicodeString &src, UnicodeString &dest, } void -Normalizer2Impl::decompose(const UChar *src, const UChar *limit, +Normalizer2Impl::decompose(const char16_t *src, const char16_t *limit, UnicodeString &dest, int32_t destLengthEstimate, UErrorCode &errorCode) const { - if(destLengthEstimate<0 && limit!=NULL) { + if(destLengthEstimate<0 && limit!=nullptr) { destLengthEstimate=(int32_t)(limit-src); } dest.remove(); @@ -580,14 +580,14 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit, } // Dual functionality: -// buffer!=NULL: normalize -// buffer==NULL: isNormalized/spanQuickCheckYes -const UChar * -Normalizer2Impl::decompose(const UChar *src, const UChar *limit, +// buffer!=nullptr: normalize +// buffer==nullptr: isNormalized/spanQuickCheckYes +const char16_t * +Normalizer2Impl::decompose(const char16_t *src, const char16_t *limit, ReorderingBuffer *buffer, UErrorCode &errorCode) const { UChar32 minNoCP=minDecompNoCP; - if(limit==NULL) { + if(limit==nullptr) { src=copyLowPrefixFromNulTerminated(src, minNoCP, buffer, errorCode); if(U_FAILURE(errorCode)) { return src; @@ -595,12 +595,12 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit, limit=u_strchr(src, 0); } - const UChar *prevSrc; + const char16_t *prevSrc; UChar32 c=0; uint16_t norm16=0; // only for quick check - const UChar *prevBoundary=src; + const char16_t *prevBoundary=src; uint8_t prevCC=0; for(;;) { @@ -613,7 +613,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit, } else if(!U16_IS_LEAD(c)) { break; } else { - UChar c2; + char16_t c2; if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) { c=U16_GET_SUPPLEMENTARY(c, c2); norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c); @@ -629,7 +629,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit, } // copy these code units all at once if(src!=prevSrc) { - if(buffer!=NULL) { + if(buffer!=nullptr) { if(!buffer->appendZeroCC(prevSrc, src, errorCode)) { break; } @@ -644,7 +644,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit, // Check one above-minimum, relevant code point. src+=U16_LENGTH(c); - if(buffer!=NULL) { + if(buffer!=nullptr) { if(!decompose(c, norm16, *buffer, errorCode)) { break; } @@ -669,8 +669,8 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit, // fail the quick check loop and/or where the quick check loop's overhead // is unlikely to be amortized. // Called by the compose() and makeFCD() implementations. -const UChar * -Normalizer2Impl::decomposeShort(const UChar *src, const UChar *limit, +const char16_t * +Normalizer2Impl::decomposeShort(const char16_t *src, const char16_t *limit, UBool stopAtCompBoundary, UBool onlyContiguous, ReorderingBuffer &buffer, UErrorCode &errorCode) const { if (U_FAILURE(errorCode)) { @@ -680,7 +680,7 @@ Normalizer2Impl::decomposeShort(const UChar *src, const UChar *limit, if (stopAtCompBoundary && *src < minCompNoMaybeCP) { return src; } - const UChar *prevSrc = src; + const char16_t *prevSrc = src; UChar32 c; uint16_t norm16; UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, src, limit, c, norm16); @@ -714,7 +714,7 @@ UBool Normalizer2Impl::decompose(UChar32 c, uint16_t norm16, return buffer.append(c, 0, errorCode); } else if(isHangulLV(norm16) || isHangulLVT(norm16)) { // Hangul syllable: decompose algorithmically - UChar jamos[3]; + char16_t jamos[3]; return buffer.appendZeroCC(jamos, jamos+Hangul::decompose(c, jamos), errorCode); } // c decomposes, get everything from the variable-length extra data @@ -728,12 +728,134 @@ UBool Normalizer2Impl::decompose(UChar32 c, uint16_t norm16, } else { leadCC=0; } - return buffer.append((const UChar *)mapping+1, length, TRUE, leadCC, trailCC, errorCode); + return buffer.append((const char16_t *)mapping+1, length, true, leadCC, trailCC, errorCode); +} + +// Dual functionality: +// sink != nullptr: normalize +// sink == nullptr: isNormalized/spanQuickCheckYes +const uint8_t * +Normalizer2Impl::decomposeUTF8(uint32_t options, + const uint8_t *src, const uint8_t *limit, + ByteSink *sink, Edits *edits, UErrorCode &errorCode) const { + U_ASSERT(limit != nullptr); + UnicodeString s16; + uint8_t minNoLead = leadByteForCP(minDecompNoCP); + + const uint8_t *prevBoundary = src; + // only for quick check + uint8_t prevCC = 0; + + for (;;) { + // Fast path: Scan over a sequence of characters below the minimum "no" code point, + // or with (decompYes && ccc==0) properties. + const uint8_t *fastStart = src; + const uint8_t *prevSrc; + uint16_t norm16 = 0; + + for (;;) { + if (src == limit) { + if (prevBoundary != limit && sink != nullptr) { + ByteSinkUtil::appendUnchanged(prevBoundary, limit, + *sink, options, edits, errorCode); + } + return src; + } + if (*src < minNoLead) { + ++src; + } else { + prevSrc = src; + UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16); + if (!isMostDecompYesAndZeroCC(norm16)) { + break; + } + } + } + // isMostDecompYesAndZeroCC(norm16) is false, that is, norm16>=minYesNo, + // and the current character at [prevSrc..src[ is not a common case with cc=0 + // (MIN_NORMAL_MAYBE_YES or JAMO_VT). + // It could still be a maybeYes with cc=0. + if (prevSrc != fastStart) { + // The fast path looped over yes/0 characters before the current one. + if (sink != nullptr && + !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc, + *sink, options, edits, errorCode)) { + break; + } + prevBoundary = prevSrc; + prevCC = 0; + } + + // Medium-fast path: Quick check. + if (isMaybeOrNonZeroCC(norm16)) { + // Does not decompose. + uint8_t cc = getCCFromYesOrMaybe(norm16); + if (prevCC <= cc || cc == 0) { + prevCC = cc; + if (cc <= 1) { + if (sink != nullptr && + !ByteSinkUtil::appendUnchanged(prevBoundary, src, + *sink, options, edits, errorCode)) { + break; + } + prevBoundary = src; + } + continue; + } + } + if (sink == nullptr) { + return prevBoundary; // quick check: "no" or cc out of order + } + + // Slow path + // Decompose up to and including the current character. + if (prevBoundary != prevSrc && norm16HasDecompBoundaryBefore(norm16)) { + if (!ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc, + *sink, options, edits, errorCode)) { + break; + } + prevBoundary = prevSrc; + } + ReorderingBuffer buffer(*this, s16, errorCode); + if (U_FAILURE(errorCode)) { + break; + } + decomposeShort(prevBoundary, src, STOP_AT_LIMIT, false /* onlyContiguous */, + buffer, errorCode); + // Decompose until the next boundary. + if (buffer.getLastCC() > 1) { + src = decomposeShort(src, limit, STOP_AT_DECOMP_BOUNDARY, false /* onlyContiguous */, + buffer, errorCode); + } + if (U_FAILURE(errorCode)) { + break; + } + if ((src - prevSrc) > INT32_MAX) { // guard before buffer.equals() + errorCode = U_INDEX_OUTOFBOUNDS_ERROR; + break; + } + // We already know there was a change if the original character decomposed; + // otherwise compare. + if (isMaybeOrNonZeroCC(norm16) && buffer.equals(prevBoundary, src)) { + if (!ByteSinkUtil::appendUnchanged(prevBoundary, src, + *sink, options, edits, errorCode)) { + break; + } + } else { + if (!ByteSinkUtil::appendChange(prevBoundary, src, buffer.getStart(), buffer.length(), + *sink, edits, errorCode)) { + break; + } + } + prevBoundary = src; + prevCC = 0; + } + return src; } const uint8_t * Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit, - UBool stopAtCompBoundary, UBool onlyContiguous, + StopAt stopAt, UBool onlyContiguous, ReorderingBuffer &buffer, UErrorCode &errorCode) const { if (U_FAILURE(errorCode)) { return nullptr; @@ -746,21 +868,28 @@ Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit, UChar32 c = U_SENTINEL; if (norm16 >= limitNoNo) { if (isMaybeOrNonZeroCC(norm16)) { - // No boundaries around this character. + // No comp boundaries around this character. + uint8_t cc = getCCFromYesOrMaybe(norm16); + if (cc == 0 && stopAt == STOP_AT_DECOMP_BOUNDARY) { + return prevSrc; + } c = codePointFromValidUTF8(prevSrc, src); - if (!buffer.append(c, getCCFromYesOrMaybe(norm16), errorCode)) { + if (!buffer.append(c, cc, errorCode)) { return nullptr; } + if (stopAt == STOP_AT_DECOMP_BOUNDARY && buffer.getLastCC() <= 1) { + return src; + } continue; } // Maps to an isCompYesAndZeroCC. - if (stopAtCompBoundary) { + if (stopAt != STOP_AT_LIMIT) { return prevSrc; } c = codePointFromValidUTF8(prevSrc, src); c = mapAlgorithmic(c, norm16); norm16 = getRawNorm16(c); - } else if (stopAtCompBoundary && norm16 < minNoNoCompNoMaybeCC) { + } else if (stopAt != STOP_AT_LIMIT && norm16 < minNoNoCompNoMaybeCC) { return prevSrc; } // norm16!=INERT guarantees that [prevSrc, src[ is valid UTF-8. @@ -768,7 +897,8 @@ Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit, // its norm16==INERT is normalization-inert, // so it gets copied unchanged in the fast path, // and we stop the slow path where invalid UTF-8 begins. - U_ASSERT(norm16 != INERT); + // c >= 0 is the result of an algorithmic mapping. + U_ASSERT(c >= 0 || norm16 != INERT); if (norm16 < minYesNo) { if (c < 0) { c = codePointFromValidUTF8(prevSrc, src); @@ -798,25 +928,29 @@ Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit, } else { leadCC = 0; } - if (!buffer.append((const char16_t *)mapping+1, length, TRUE, leadCC, trailCC, errorCode)) { + if (leadCC == 0 && stopAt == STOP_AT_DECOMP_BOUNDARY) { + return prevSrc; + } + if (!buffer.append((const char16_t *)mapping+1, length, true, leadCC, trailCC, errorCode)) { return nullptr; } } - if (stopAtCompBoundary && norm16HasCompBoundaryAfter(norm16, onlyContiguous)) { + if ((stopAt == STOP_AT_COMP_BOUNDARY && norm16HasCompBoundaryAfter(norm16, onlyContiguous)) || + (stopAt == STOP_AT_DECOMP_BOUNDARY && buffer.getLastCC() <= 1)) { return src; } } return src; } -const UChar * -Normalizer2Impl::getDecomposition(UChar32 c, UChar buffer[4], int32_t &length) const { +const char16_t * +Normalizer2Impl::getDecomposition(UChar32 c, char16_t buffer[4], int32_t &length) const { uint16_t norm16; if(c= limitNoNo) { return norm16 <= MIN_NORMAL_MAYBE_YES || norm16 == JAMO_VT; @@ -938,23 +1072,23 @@ UBool Normalizer2Impl::norm16HasDecompBoundaryBefore(uint16_t norm16) const { // c decomposes, get everything from the variable-length extra data const uint16_t *mapping=getMapping(norm16); uint16_t firstUnit=*mapping; - // TRUE if leadCC==0 (hasFCDBoundaryBefore()) + // true if leadCC==0 (hasFCDBoundaryBefore()) return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (*(mapping-1)&0xff00)==0; } UBool Normalizer2Impl::hasDecompBoundaryAfter(UChar32 c) const { if (c < minDecompNoCP) { - return TRUE; + return true; } if (c <= 0xffff && !singleLeadMightHaveNonZeroFCD16(c)) { - return TRUE; + return true; } return norm16HasDecompBoundaryAfter(getNorm16(c)); } UBool Normalizer2Impl::norm16HasDecompBoundaryAfter(uint16_t norm16) const { if(norm16 <= minYesNo || isHangulLVT(norm16)) { - return TRUE; + return true; } if (norm16 >= limitNoNo) { if (isMaybeOrNonZeroCC(norm16)) { @@ -969,13 +1103,13 @@ UBool Normalizer2Impl::norm16HasDecompBoundaryAfter(uint16_t norm16) const { // decomp after-boundary: same as hasFCDBoundaryAfter(), // fcd16<=1 || trailCC==0 if(firstUnit>0x1ff) { - return FALSE; // trailCC>1 + return false; // trailCC>1 } if(firstUnit<=0xff) { - return TRUE; // trailCC==0 + return true; // trailCC==0 } // if(trailCC==1) test leadCC==0, same as checking for before-boundary - // TRUE if leadCC==0 (hasFCDBoundaryBefore()) + // true if leadCC==0 (hasFCDBoundaryBefore()) return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (*(mapping-1)&0xff00)==0; } @@ -1084,13 +1218,13 @@ void Normalizer2Impl::addComposites(const uint16_t *list, UnicodeSet &set) const */ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStartIndex, UBool onlyContiguous) const { - UChar *p=buffer.getStart()+recomposeStartIndex; - UChar *limit=buffer.getLimit(); + char16_t *p=buffer.getStart()+recomposeStartIndex; + char16_t *limit=buffer.getLimit(); if(p==limit) { return; } - UChar *starter, *pRemove, *q, *r; + char16_t *starter, *pRemove, *q, *r; const uint16_t *compositionsList; UChar32 c, compositeAndFwd; uint16_t norm16; @@ -1099,9 +1233,9 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart // Some of the following variables are not used until we have a forward-combining starter // and are only initialized now to avoid compiler warnings. - compositionsList=NULL; // used as indicator for whether we have a forward-combining starter - starter=NULL; - starterIsSupplementary=FALSE; + compositionsList=nullptr; // used as indicator for whether we have a forward-combining starter + starter=nullptr; + starterIsSupplementary=false; prevCC=0; for(;;) { @@ -1110,7 +1244,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart if( // this character combines backward and isMaybe(norm16) && // we have seen a starter that combines forward and - compositionsList!=NULL && + compositionsList!=nullptr && // the backward-combining character is not blocked (prevCC=0) { // The starter and the combining mark (c) do combine. @@ -1164,10 +1298,10 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart starter[0]=U16_LEAD(composite); starter[1]=U16_TRAIL(composite); } else { - *starter=(UChar)composite; + *starter=(char16_t)composite; // The composite is shorter than the starter, // move the intermediate characters forward one. - starterIsSupplementary=FALSE; + starterIsSupplementary=false; q=starter+1; r=q+1; while(r(getMapping(norm16)); + const char16_t *mapping = reinterpret_cast(getMapping(norm16)); int32_t length = *mapping++ & MAPPING_LENGTH_MASK; if(!buffer.appendZeroCC(mapping, mapping + length, errorCode)) { break; @@ -1418,14 +1552,14 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit, // Other "noNo" type, or need to examine more text around this character: // Fall through to the slow path. } else if (isJamoVT(norm16) && prevBoundary != prevSrc) { - UChar prev=*(prevSrc-1); + char16_t prev=*(prevSrc-1); if(c cc) { // Fails FCD test, need to decompose and contiguously recompose. if (!doCompose) { - return FALSE; + return false; } } else { // If !onlyContiguous (not FCC), then we ignore the tccc of // the previous character which passed the quick check "yes && ccc==0" test. - const UChar *nextSrc; + const char16_t *nextSrc; uint16_t n16; for (;;) { if (src == limit) { if (doCompose) { buffer.appendZeroCC(prevBoundary, limit, errorCode); } - return TRUE; + return true; } uint8_t prevCC = cc; nextSrc = src; @@ -1509,7 +1643,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit, cc = getCCFromNormalYesOrMaybe(n16); if (prevCC > cc) { if (!doCompose) { - return FALSE; + return false; } break; } @@ -1533,7 +1667,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit, // Slow path: Find the nearest boundaries around the current character, // decompose and recompose. if (prevBoundary != prevSrc && !norm16HasCompBoundaryBefore(norm16)) { - const UChar *p = prevSrc; + const char16_t *p = prevSrc; UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, norm16); if (!norm16HasCompBoundaryAfter(norm16, onlyContiguous)) { prevSrc = p; @@ -1544,42 +1678,42 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit, } int32_t recomposeStartIndex=buffer.length(); // We know there is not a boundary here. - decomposeShort(prevSrc, src, FALSE /* !stopAtCompBoundary */, onlyContiguous, + decomposeShort(prevSrc, src, false /* !stopAtCompBoundary */, onlyContiguous, buffer, errorCode); // Decompose until the next boundary. - src = decomposeShort(src, limit, TRUE /* stopAtCompBoundary */, onlyContiguous, + src = decomposeShort(src, limit, true /* stopAtCompBoundary */, onlyContiguous, buffer, errorCode); if (U_FAILURE(errorCode)) { break; } if ((src - prevSrc) > INT32_MAX) { // guard before buffer.equals() errorCode = U_INDEX_OUTOFBOUNDS_ERROR; - return TRUE; + return true; } recompose(buffer, recomposeStartIndex, onlyContiguous); if(!doCompose) { if(!buffer.equals(prevSrc, src)) { - return FALSE; + return false; } buffer.remove(); } prevBoundary=src; } - return TRUE; + return true; } // Very similar to compose(): Make the same changes in both places if relevant. -// pQCResult==NULL: spanQuickCheckYes -// pQCResult!=NULL: quickCheck (*pQCResult must be UNORM_YES) -const UChar * -Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit, +// pQCResult==nullptr: spanQuickCheckYes +// pQCResult!=nullptr: quickCheck (*pQCResult must be UNORM_YES) +const char16_t * +Normalizer2Impl::composeQuickCheck(const char16_t *src, const char16_t *limit, UBool onlyContiguous, UNormalizationCheckResult *pQCResult) const { - const UChar *prevBoundary=src; + const char16_t *prevBoundary=src; UChar32 minNoMaybeCP=minCompNoMaybeCP; - if(limit==NULL) { + if(limit==nullptr) { UErrorCode errorCode=U_ZERO_ERROR; - src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP, NULL, errorCode); + src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP, nullptr, errorCode); limit=u_strchr(src, 0); if (prevBoundary != src) { if (hasCompBoundaryAfter(*(src-1), onlyContiguous)) { @@ -1593,7 +1727,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit, for(;;) { // Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point, // or with (compYes && ccc==0) properties. - const UChar *prevSrc; + const char16_t *prevSrc; UChar32 c = 0; uint16_t norm16 = 0; for (;;) { @@ -1609,7 +1743,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit, if(!U16_IS_LEAD(c)) { break; } else { - UChar c2; + char16_t c2; if(src!=limit && U16_IS_TRAIL(c2=*src)) { ++src; c=U16_GET_SUPPLEMENTARY(c, c2); @@ -1632,7 +1766,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit, if (norm16HasCompBoundaryBefore(norm16)) { prevBoundary = prevSrc; } else { - const UChar *p = prevSrc; + const char16_t *p = prevSrc; uint16_t n16; UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, n16); if (norm16HasCompBoundaryAfter(n16, onlyContiguous)) { @@ -1654,7 +1788,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit, } else { // If !onlyContiguous (not FCC), then we ignore the tccc of // the previous character which passed the quick check "yes && ccc==0" test. - const UChar *nextSrc; + const char16_t *nextSrc; for (;;) { if (norm16 < MIN_YES_YES_WITH_CC) { if (pQCResult != nullptr) { @@ -1687,32 +1821,32 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit, } } } - if(pQCResult!=NULL) { + if(pQCResult!=nullptr) { *pQCResult=UNORM_NO; } return prevBoundary; } } -void Normalizer2Impl::composeAndAppend(const UChar *src, const UChar *limit, +void Normalizer2Impl::composeAndAppend(const char16_t *src, const char16_t *limit, UBool doCompose, UBool onlyContiguous, UnicodeString &safeMiddle, ReorderingBuffer &buffer, UErrorCode &errorCode) const { if(!buffer.isEmpty()) { - const UChar *firstStarterInSrc=findNextCompBoundary(src, limit, onlyContiguous); + const char16_t *firstStarterInSrc=findNextCompBoundary(src, limit, onlyContiguous); if(src!=firstStarterInSrc) { - const UChar *lastStarterInDest=findPreviousCompBoundary(buffer.getStart(), + const char16_t *lastStarterInDest=findPreviousCompBoundary(buffer.getStart(), buffer.getLimit(), onlyContiguous); int32_t destSuffixLength=(int32_t)(buffer.getLimit()-lastStarterInDest); UnicodeString middle(lastStarterInDest, destSuffixLength); buffer.removeSuffix(destSuffixLength); safeMiddle=middle; middle.append(src, (int32_t)(firstStarterInSrc-src)); - const UChar *middleStart=middle.getBuffer(); + const char16_t *middleStart=middle.getBuffer(); compose(middleStart, middleStart+middle.length(), onlyContiguous, - TRUE, buffer, errorCode); + true, buffer, errorCode); if(U_FAILURE(errorCode)) { return; } @@ -1720,9 +1854,9 @@ void Normalizer2Impl::composeAndAppend(const UChar *src, const UChar *limit, } } if(doCompose) { - compose(src, limit, onlyContiguous, TRUE, buffer, errorCode); + compose(src, limit, onlyContiguous, true, buffer, errorCode); } else { - if(limit==NULL) { // appendZeroCC() needs limit!=NULL + if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr limit=u_strchr(src, 0); } buffer.appendZeroCC(src, limit, errorCode); @@ -1749,7 +1883,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, ByteSinkUtil::appendUnchanged(prevBoundary, limit, *sink, options, edits, errorCode); } - return TRUE; + return true; } if (*src < minNoMaybeLead) { ++src; @@ -1770,7 +1904,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, // Medium-fast path: Handle cases that do not require full decomposition and recomposition. if (!isMaybeOrNonZeroCC(norm16)) { // minNoNo <= norm16 < minMaybeYes if (sink == nullptr) { - return FALSE; + return false; } // Fast path for mapping a character that is immediately surrounded by boundaries. // In this case, we need not decompose around the current character. @@ -1799,7 +1933,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, } const uint16_t *mapping = getMapping(norm16); int32_t length = *mapping++ & MAPPING_LENGTH_MASK; - if (!ByteSinkUtil::appendChange(prevSrc, src, (const UChar *)mapping, length, + if (!ByteSinkUtil::appendChange(prevSrc, src, (const char16_t *)mapping, length, *sink, edits, errorCode)) { break; } @@ -1838,7 +1972,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, UChar32 l = prev - Hangul::JAMO_L_BASE; if ((uint32_t)l < Hangul::JAMO_L_COUNT) { if (sink == nullptr) { - return FALSE; + return false; } int32_t t = getJamoTMinusBase(src, limit); if (t >= 0) { @@ -1874,7 +2008,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, // The current character is a Jamo Trailing consonant, // compose with previous Hangul LV that does not contain a Jamo T. if (sink == nullptr) { - return FALSE; + return false; } UChar32 syllable = prev + getJamoTMinusBase(prevSrc, src); prevSrc -= 3; // Replace the Hangul LV as well. @@ -1897,7 +2031,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, if (onlyContiguous /* FCC */ && getPreviousTrailCC(prevBoundary, prevSrc) > cc) { // Fails FCD test, need to decompose and contiguously recompose. if (sink == nullptr) { - return FALSE; + return false; } } else { // If !onlyContiguous (not FCC), then we ignore the tccc of @@ -1910,7 +2044,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, ByteSinkUtil::appendUnchanged(prevBoundary, limit, *sink, options, edits, errorCode); } - return TRUE; + return true; } uint8_t prevCC = cc; nextSrc = src; @@ -1919,7 +2053,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, cc = getCCFromNormalYesOrMaybe(n16); if (prevCC > cc) { if (sink == nullptr) { - return FALSE; + return false; } break; } @@ -1954,22 +2088,22 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, break; } // We know there is not a boundary here. - decomposeShort(prevSrc, src, FALSE /* !stopAtCompBoundary */, onlyContiguous, + decomposeShort(prevSrc, src, STOP_AT_LIMIT, onlyContiguous, buffer, errorCode); // Decompose until the next boundary. - src = decomposeShort(src, limit, TRUE /* stopAtCompBoundary */, onlyContiguous, + src = decomposeShort(src, limit, STOP_AT_COMP_BOUNDARY, onlyContiguous, buffer, errorCode); if (U_FAILURE(errorCode)) { break; } if ((src - prevSrc) > INT32_MAX) { // guard before buffer.equals() errorCode = U_INDEX_OUTOFBOUNDS_ERROR; - return TRUE; + return true; } recompose(buffer, 0, onlyContiguous); if (!buffer.equals(prevSrc, src)) { if (sink == nullptr) { - return FALSE; + return false; } if (prevBoundary != prevSrc && !ByteSinkUtil::appendUnchanged(prevBoundary, prevSrc, @@ -1983,12 +2117,12 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous, prevBoundary = src; } } - return TRUE; + return true; } -UBool Normalizer2Impl::hasCompBoundaryBefore(const UChar *src, const UChar *limit) const { +UBool Normalizer2Impl::hasCompBoundaryBefore(const char16_t *src, const char16_t *limit) const { if (src == limit || *src < minCompNoMaybeCP) { - return TRUE; + return true; } UChar32 c; uint16_t norm16; @@ -1998,17 +2132,17 @@ UBool Normalizer2Impl::hasCompBoundaryBefore(const UChar *src, const UChar *limi UBool Normalizer2Impl::hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const { if (src == limit) { - return TRUE; + return true; } uint16_t norm16; UCPTRIE_FAST_U8_NEXT(normTrie, UCPTRIE_16, src, limit, norm16); return norm16HasCompBoundaryBefore(norm16); } -UBool Normalizer2Impl::hasCompBoundaryAfter(const UChar *start, const UChar *p, +UBool Normalizer2Impl::hasCompBoundaryAfter(const char16_t *start, const char16_t *p, UBool onlyContiguous) const { if (start == p) { - return TRUE; + return true; } UChar32 c; uint16_t norm16; @@ -2019,17 +2153,17 @@ UBool Normalizer2Impl::hasCompBoundaryAfter(const UChar *start, const UChar *p, UBool Normalizer2Impl::hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p, UBool onlyContiguous) const { if (start == p) { - return TRUE; + return true; } uint16_t norm16; UCPTRIE_FAST_U8_PREV(normTrie, UCPTRIE_16, start, p, norm16); return norm16HasCompBoundaryAfter(norm16, onlyContiguous); } -const UChar *Normalizer2Impl::findPreviousCompBoundary(const UChar *start, const UChar *p, +const char16_t *Normalizer2Impl::findPreviousCompBoundary(const char16_t *start, const char16_t *p, UBool onlyContiguous) const { while (p != start) { - const UChar *codePointLimit = p; + const char16_t *codePointLimit = p; UChar32 c; uint16_t norm16; UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16); @@ -2043,10 +2177,10 @@ const UChar *Normalizer2Impl::findPreviousCompBoundary(const UChar *start, const return p; } -const UChar *Normalizer2Impl::findNextCompBoundary(const UChar *p, const UChar *limit, +const char16_t *Normalizer2Impl::findNextCompBoundary(const char16_t *p, const char16_t *limit, UBool onlyContiguous) const { while (p != limit) { - const UChar *codePointStart = p; + const char16_t *codePointStart = p; UChar32 c; uint16_t norm16; UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16); @@ -2060,7 +2194,7 @@ const UChar *Normalizer2Impl::findNextCompBoundary(const UChar *p, const UChar * return p; } -uint8_t Normalizer2Impl::getPreviousTrailCC(const UChar *start, const UChar *p) const { +uint8_t Normalizer2Impl::getPreviousTrailCC(const char16_t *start, const char16_t *p) const { if (start == p) { return 0; } @@ -2133,17 +2267,17 @@ uint16_t Normalizer2Impl::getFCD16FromNormData(UChar32 c) const { #endif // Dual functionality: -// buffer!=NULL: normalize -// buffer==NULL: isNormalized/quickCheck/spanQuickCheckYes -const UChar * -Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit, +// buffer!=nullptr: normalize +// buffer==nullptr: isNormalized/quickCheck/spanQuickCheckYes +const char16_t * +Normalizer2Impl::makeFCD(const char16_t *src, const char16_t *limit, ReorderingBuffer *buffer, UErrorCode &errorCode) const { // Tracks the last FCD-safe boundary, before lccc=0 or after properly-ordered tccc<=1. // Similar to the prevBoundary in the compose() implementation. - const UChar *prevBoundary=src; + const char16_t *prevBoundary=src; int32_t prevFCD16=0; - if(limit==NULL) { + if(limit==nullptr) { src=copyLowPrefixFromNulTerminated(src, minLcccCP, buffer, errorCode); if(U_FAILURE(errorCode)) { return src; @@ -2166,7 +2300,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit, // The exception is the call to decomposeShort() which uses the buffer // in the normal way. - const UChar *prevSrc; + const char16_t *prevSrc; UChar32 c=0; uint16_t fcd16=0; @@ -2181,7 +2315,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit, ++src; } else { if(U16_IS_LEAD(c)) { - UChar c2; + char16_t c2; if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) { c=U16_GET_SUPPLEMENTARY(c, c2); } @@ -2196,7 +2330,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit, } // copy these code units all at once if(src!=prevSrc) { - if(buffer!=NULL && !buffer->appendZeroCC(prevSrc, src, errorCode)) { + if(buffer!=nullptr && !buffer->appendZeroCC(prevSrc, src, errorCode)) { break; } if(src==limit) { @@ -2216,7 +2350,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit, } } } else { - const UChar *p=src-1; + const char16_t *p=src-1; if(U16_IS_TRAIL(*p) && prevSrc

appendZeroCC(c, errorCode)) { + if(buffer!=nullptr && !buffer->appendZeroCC(c, errorCode)) { break; } prevFCD16=fcd16; continue; - } else if(buffer==NULL) { + } else if(buffer==nullptr) { return prevBoundary; // quick check "no" } else { /* @@ -2265,7 +2399,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit, * The source text does not fulfill the conditions for FCD. * Decompose and reorder a limited piece of the text. */ - decomposeShort(prevBoundary, src, FALSE, FALSE, *buffer, errorCode); + decomposeShort(prevBoundary, src, false, false, *buffer, errorCode); if (U_FAILURE(errorCode)) { break; } @@ -2276,22 +2410,22 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit, return src; } -void Normalizer2Impl::makeFCDAndAppend(const UChar *src, const UChar *limit, +void Normalizer2Impl::makeFCDAndAppend(const char16_t *src, const char16_t *limit, UBool doMakeFCD, UnicodeString &safeMiddle, ReorderingBuffer &buffer, UErrorCode &errorCode) const { if(!buffer.isEmpty()) { - const UChar *firstBoundaryInSrc=findNextFCDBoundary(src, limit); + const char16_t *firstBoundaryInSrc=findNextFCDBoundary(src, limit); if(src!=firstBoundaryInSrc) { - const UChar *lastBoundaryInDest=findPreviousFCDBoundary(buffer.getStart(), + const char16_t *lastBoundaryInDest=findPreviousFCDBoundary(buffer.getStart(), buffer.getLimit()); int32_t destSuffixLength=(int32_t)(buffer.getLimit()-lastBoundaryInDest); UnicodeString middle(lastBoundaryInDest, destSuffixLength); buffer.removeSuffix(destSuffixLength); safeMiddle=middle; middle.append(src, (int32_t)(firstBoundaryInSrc-src)); - const UChar *middleStart=middle.getBuffer(); + const char16_t *middleStart=middle.getBuffer(); makeFCD(middleStart, middleStart+middle.length(), &buffer, errorCode); if(U_FAILURE(errorCode)) { return; @@ -2302,16 +2436,16 @@ void Normalizer2Impl::makeFCDAndAppend(const UChar *src, const UChar *limit, if(doMakeFCD) { makeFCD(src, limit, &buffer, errorCode); } else { - if(limit==NULL) { // appendZeroCC() needs limit!=NULL + if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr limit=u_strchr(src, 0); } buffer.appendZeroCC(src, limit, errorCode); } } -const UChar *Normalizer2Impl::findPreviousFCDBoundary(const UChar *start, const UChar *p) const { +const char16_t *Normalizer2Impl::findPreviousFCDBoundary(const char16_t *start, const char16_t *p) const { while(start lpSet(new UnicodeSet, errorCode); + set=lpSet.getAlias(); + if(U_FAILURE(errorCode)) { return; } UChar32 firstOrigin=(UChar32)(canonValue&CANON_VALUE_MASK); canonValue=(canonValue&~CANON_VALUE_MASK)|CANON_HAS_SET|(uint32_t)canonStartSets.size(); umutablecptrie_set(mutableTrie, decompLead, canonValue, &errorCode); - canonStartSets.addElement(set, errorCode); + canonStartSets.adoptElement(lpSet.orphan(), errorCode); + if (U_FAILURE(errorCode)) { + return; + } if(firstOrigin!=0) { set->add(firstOrigin); } @@ -2398,9 +2535,9 @@ initCanonIterData(Normalizer2Impl *impl, UErrorCode &errorCode) { U_CDECL_END void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) { - U_ASSERT(impl->fCanonIterData == NULL); + U_ASSERT(impl->fCanonIterData == nullptr); impl->fCanonIterData = new CanonIterData(errorCode); - if (impl->fCanonIterData == NULL) { + if (impl->fCanonIterData == nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } if (U_SUCCESS(errorCode)) { @@ -2425,7 +2562,7 @@ void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) { } if (U_FAILURE(errorCode)) { delete impl->fCanonIterData; - impl->fCanonIterData = NULL; + impl->fCanonIterData = nullptr; } } @@ -2528,7 +2665,7 @@ UBool Normalizer2Impl::isCanonSegmentStarter(UChar32 c) const { UBool Normalizer2Impl::getCanonStartSet(UChar32 c, UnicodeSet &set) const { int32_t canonValue=getCanonValue(c)&~CANON_NOT_SEGMENT_STARTER; if(canonValue==0) { - return FALSE; + return false; } set.clear(); int32_t value=canonValue&CANON_VALUE_MASK; @@ -2547,7 +2684,7 @@ UBool Normalizer2Impl::getCanonStartSet(UChar32 c, UnicodeSet &set) const { addComposites(getCompositionsList(norm16), set); } } - return TRUE; + return true; } U_NAMESPACE_END @@ -2573,7 +2710,7 @@ unorm2_swap(const UDataSwapper *ds, /* udata_swapDataHeader checks the arguments */ headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode); - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } @@ -2596,7 +2733,7 @@ unorm2_swap(const UDataSwapper *ds, } inBytes=(const uint8_t *)inData+headerSize; - outBytes=(uint8_t *)outData+headerSize; + outBytes=(outData == nullptr) ? nullptr : (uint8_t *)outData+headerSize; inIndexes=(const int32_t *)inBytes; int32_t minIndexesLength; diff --git a/src/duckdb/extension/icu/third_party/icu/common/normalizer2impl.h b/src/duckdb/extension/icu/third_party/icu/common/normalizer2impl.h index cf3015ea8..f5ede24fc 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/normalizer2impl.h +++ b/src/duckdb/extension/icu/third_party/icu/common/normalizer2impl.h @@ -99,16 +99,16 @@ class U_COMMON_API Hangul { * Decomposes c, which must be a Hangul syllable, into buffer * and returns the length of the decomposition (2 or 3). */ - static inline int32_t decompose(UChar32 c, UChar buffer[3]) { + static inline int32_t decompose(UChar32 c, char16_t buffer[3]) { c-=HANGUL_BASE; UChar32 c2=c%JAMO_T_COUNT; c/=JAMO_T_COUNT; - buffer[0]=(UChar)(JAMO_L_BASE+c/JAMO_V_COUNT); - buffer[1]=(UChar)(JAMO_V_BASE+c%JAMO_V_COUNT); + buffer[0]=(char16_t)(JAMO_L_BASE+c/JAMO_V_COUNT); + buffer[1]=(char16_t)(JAMO_V_BASE+c%JAMO_V_COUNT); if(c2==0) { return 2; } else { - buffer[2]=(UChar)(JAMO_T_BASE+c2); + buffer[2]=(char16_t)(JAMO_T_BASE+c2); return 3; } } @@ -117,21 +117,21 @@ class U_COMMON_API Hangul { * Decomposes c, which must be a Hangul syllable, into buffer. * This is the raw, not recursive, decomposition. Its length is always 2. */ - static inline void getRawDecomposition(UChar32 c, UChar buffer[2]) { + static inline void getRawDecomposition(UChar32 c, char16_t buffer[2]) { UChar32 orig=c; c-=HANGUL_BASE; UChar32 c2=c%JAMO_T_COUNT; if(c2==0) { c/=JAMO_T_COUNT; - buffer[0]=(UChar)(JAMO_L_BASE+c/JAMO_V_COUNT); - buffer[1]=(UChar)(JAMO_V_BASE+c%JAMO_V_COUNT); + buffer[0]=(char16_t)(JAMO_L_BASE+c/JAMO_V_COUNT); + buffer[1]=(char16_t)(JAMO_V_BASE+c%JAMO_V_COUNT); } else { - buffer[0]=(UChar)(orig-c2); // LV syllable - buffer[1]=(UChar)(JAMO_T_BASE+c2); + buffer[0]=(char16_t)(orig-c2); // LV syllable + buffer[1]=(char16_t)(JAMO_T_BASE+c2); } } private: - Hangul(); // no instantiation + Hangul() = delete; // no instantiation }; class Normalizer2Impl; @@ -154,24 +154,24 @@ class U_COMMON_API ReorderingBuffer : public UMemory { UBool isEmpty() const { return start==limit; } int32_t length() const { return (int32_t)(limit-start); } - UChar *getStart() { return start; } - UChar *getLimit() { return limit; } + char16_t *getStart() { return start; } + char16_t *getLimit() { return limit; } uint8_t getLastCC() const { return lastCC; } - UBool equals(const UChar *start, const UChar *limit) const; + UBool equals(const char16_t *start, const char16_t *limit) const; UBool equals(const uint8_t *otherStart, const uint8_t *otherLimit) const; UBool append(UChar32 c, uint8_t cc, UErrorCode &errorCode) { return (c<=0xffff) ? - appendBMP((UChar)c, cc, errorCode) : + appendBMP((char16_t)c, cc, errorCode) : appendSupplementary(c, cc, errorCode); } - UBool append(const UChar *s, int32_t length, UBool isNFD, + UBool append(const char16_t *s, int32_t length, UBool isNFD, uint8_t leadCC, uint8_t trailCC, UErrorCode &errorCode); - UBool appendBMP(UChar c, uint8_t cc, UErrorCode &errorCode) { + UBool appendBMP(char16_t c, uint8_t cc, UErrorCode &errorCode) { if(remainingCapacity==0 && !resize(1, errorCode)) { - return FALSE; + return false; } if(lastCC<=cc || cc==0) { *limit++=c; @@ -183,13 +183,13 @@ class U_COMMON_API ReorderingBuffer : public UMemory { insert(c, cc); } --remainingCapacity; - return TRUE; + return true; } UBool appendZeroCC(UChar32 c, UErrorCode &errorCode); - UBool appendZeroCC(const UChar *s, const UChar *sLimit, UErrorCode &errorCode); + UBool appendZeroCC(const char16_t *s, const char16_t *sLimit, UErrorCode &errorCode); void remove(); void removeSuffix(int32_t suffixLength); - void setReorderingLimit(UChar *newLimit) { + void setReorderingLimit(char16_t *newLimit) { remainingCapacity+=(int32_t)(limit-newLimit); reorderStart=limit=newLimit; lastCC=0; @@ -213,9 +213,9 @@ class U_COMMON_API ReorderingBuffer : public UMemory { UBool appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &errorCode); void insert(UChar32 c, uint8_t cc); - static void writeCodePoint(UChar *p, UChar32 c) { + static void writeCodePoint(char16_t *p, UChar32 c) { if(c<=0xffff) { - *p=(UChar)c; + *p=(char16_t)c; } else { p[0]=U16_LEAD(c); p[1]=U16_TRAIL(c); @@ -225,7 +225,7 @@ class U_COMMON_API ReorderingBuffer : public UMemory { const Normalizer2Impl &impl; UnicodeString &str; - UChar *start, *reorderStart, *limit; + char16_t *start, *reorderStart, *limit; int32_t remainingCapacity; uint8_t lastCC; @@ -234,14 +234,14 @@ class U_COMMON_API ReorderingBuffer : public UMemory { void skipPrevious(); // Requires start>8]; @@ -376,7 +376,7 @@ class U_COMMON_API Normalizer2Impl : public UObject { * @param length out-only, takes the length of the decomposition, if any * @return pointer to the decomposition, or NULL if none */ - const UChar *getDecomposition(UChar32 c, UChar buffer[4], int32_t &length) const; + const char16_t *getDecomposition(UChar32 c, char16_t buffer[4], int32_t &length) const; /** * Gets the raw decomposition for one code point. @@ -385,7 +385,7 @@ class U_COMMON_API Normalizer2Impl : public UObject { * @param length out-only, takes the length of the decomposition, if any * @return pointer to the decomposition, or NULL if none */ - const UChar *getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &length) const; + const char16_t *getRawDecomposition(UChar32 c, char16_t buffer[30], int32_t &length) const; UChar32 composePair(UChar32 a, UChar32 b) const; @@ -397,8 +397,8 @@ class U_COMMON_API Normalizer2Impl : public UObject { MIN_YES_YES_WITH_CC=0xfe02, JAMO_VT=0xfe00, MIN_NORMAL_MAYBE_YES=0xfc00, - JAMO_L=2, // offset=1 hasCompBoundaryAfter=FALSE - INERT=1, // offset=0 hasCompBoundaryAfter=TRUE + JAMO_L=2, // offset=1 hasCompBoundaryAfter=false + INERT=1, // offset=0 hasCompBoundaryAfter=true // norm16 bit 0 is comp-boundary-after. HAS_COMP_BOUNDARY_AFTER=1, @@ -480,26 +480,32 @@ class U_COMMON_API Normalizer2Impl : public UObject { * limit can be NULL if src is NUL-terminated. * destLengthEstimate is the initial dest buffer capacity and can be -1. */ - void decompose(const UChar *src, const UChar *limit, + void decompose(const char16_t *src, const char16_t *limit, UnicodeString &dest, int32_t destLengthEstimate, UErrorCode &errorCode) const; - const UChar *decompose(const UChar *src, const UChar *limit, + const char16_t *decompose(const char16_t *src, const char16_t *limit, ReorderingBuffer *buffer, UErrorCode &errorCode) const; - void decomposeAndAppend(const UChar *src, const UChar *limit, + void decomposeAndAppend(const char16_t *src, const char16_t *limit, UBool doDecompose, UnicodeString &safeMiddle, ReorderingBuffer &buffer, UErrorCode &errorCode) const; - UBool compose(const UChar *src, const UChar *limit, + + /** sink==nullptr: isNormalized()/spanQuickCheckYes() */ + const uint8_t *decomposeUTF8(uint32_t options, + const uint8_t *src, const uint8_t *limit, + ByteSink *sink, Edits *edits, UErrorCode &errorCode) const; + + UBool compose(const char16_t *src, const char16_t *limit, UBool onlyContiguous, UBool doCompose, ReorderingBuffer &buffer, UErrorCode &errorCode) const; - const UChar *composeQuickCheck(const UChar *src, const UChar *limit, + const char16_t *composeQuickCheck(const char16_t *src, const char16_t *limit, UBool onlyContiguous, UNormalizationCheckResult *pQCResult) const; - void composeAndAppend(const UChar *src, const UChar *limit, + void composeAndAppend(const char16_t *src, const char16_t *limit, UBool doCompose, UBool onlyContiguous, UnicodeString &safeMiddle, @@ -511,9 +517,9 @@ class U_COMMON_API Normalizer2Impl : public UObject { 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, + const char16_t *makeFCD(const char16_t *src, const char16_t *limit, ReorderingBuffer *buffer, UErrorCode &errorCode) const; - void makeFCDAndAppend(const UChar *src, const UChar *limit, + void makeFCDAndAppend(const char16_t *src, const char16_t *limit, UBool doMakeFCD, UnicodeString &safeMiddle, ReorderingBuffer &buffer, @@ -602,7 +608,7 @@ class U_COMMON_API Normalizer2Impl : public UObject { return (uint8_t)(*getMapping(norm16)>>8); // tccc from yesNo } } - uint8_t getPreviousTrailCC(const UChar *start, const UChar *p) const; + uint8_t getPreviousTrailCC(const char16_t *start, const char16_t *p) const; uint8_t getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const; // Requires algorithmic-NoNo. @@ -645,18 +651,21 @@ class U_COMMON_API Normalizer2Impl : public UObject { getCompositionsListForComposite(norm16); } - const UChar *copyLowPrefixFromNulTerminated(const UChar *src, + const char16_t *copyLowPrefixFromNulTerminated(const char16_t *src, UChar32 minNeedDataCP, ReorderingBuffer *buffer, UErrorCode &errorCode) const; - const UChar *decomposeShort(const UChar *src, const UChar *limit, + + enum StopAt { STOP_AT_LIMIT, STOP_AT_DECOMP_BOUNDARY, STOP_AT_COMP_BOUNDARY }; + + const char16_t *decomposeShort(const char16_t *src, const char16_t *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, + StopAt stopAt, UBool onlyContiguous, ReorderingBuffer &buffer, UErrorCode &errorCode) const; static int32_t combine(const uint16_t *list, UChar32 trail); @@ -670,9 +679,9 @@ class U_COMMON_API Normalizer2Impl : public UObject { UBool norm16HasCompBoundaryBefore(uint16_t norm16) const { return norm16 < minNoNoCompNoMaybeCC || isAlgorithmicNoNo(norm16); } - UBool hasCompBoundaryBefore(const UChar *src, const UChar *limit) const; + UBool hasCompBoundaryBefore(const char16_t *src, const char16_t *limit) const; UBool hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const; - UBool hasCompBoundaryAfter(const UChar *start, const UChar *p, + UBool hasCompBoundaryAfter(const char16_t *start, const char16_t *p, UBool onlyContiguous) const; UBool hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p, UBool onlyContiguous) const; @@ -686,11 +695,11 @@ class U_COMMON_API Normalizer2Impl : public UObject { (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 char16_t *findPreviousCompBoundary(const char16_t *start, const char16_t *p, UBool onlyContiguous) const; + const char16_t *findNextCompBoundary(const char16_t *p, const char16_t *limit, UBool onlyContiguous) const; - const UChar *findPreviousFCDBoundary(const UChar *start, const UChar *p) const; - const UChar *findNextFCDBoundary(const UChar *p, const UChar *limit) const; + const char16_t *findPreviousFCDBoundary(const char16_t *start, const char16_t *p) const; + const char16_t *findNextFCDBoundary(const char16_t *p, const char16_t *limit) const; void makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, const uint16_t norm16, CanonIterData &newData, UErrorCode &errorCode) const; @@ -701,9 +710,9 @@ class U_COMMON_API Normalizer2Impl : public UObject { // UVersionInfo dataVersion; // BMP code point thresholds for quick check loops looking at single UTF-16 code units. - UChar minDecompNoCP; - UChar minCompNoMaybeCP; - UChar minLcccCP; + char16_t minDecompNoCP; + char16_t minCompNoMaybeCP; + char16_t minLcccCP; // Norm16 value thresholds for quick check combinations and types of extra data. uint16_t minYesNo; @@ -721,7 +730,7 @@ class U_COMMON_API Normalizer2Impl : public UObject { const uint16_t *extraData; // mappings and/or compositions for yesYes, yesNo & noNo characters const uint8_t *smallFCD; // [0x100] one bit per 32 BMP code points, set if any FCD!=0 - UInitOnce fCanonIterDataInitOnce = U_INITONCE_INITIALIZER; + UInitOnce fCanonIterDataInitOnce {}; CanonIterData *fCanonIterData; }; @@ -750,7 +759,7 @@ class U_COMMON_API Normalizer2Factory { // Must be used only when it is known that norm2 is a Normalizer2WithImpl instance. static const Normalizer2Impl *getImpl(const Normalizer2 *norm2); private: - Normalizer2Factory(); // No instantiation. + Normalizer2Factory() = delete; // No instantiation. }; U_NAMESPACE_END @@ -780,7 +789,8 @@ unorm_getFCD16(UChar32 c); * * 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). + * NFC and NFD (nfc.nrm), NFKC and NFKD (nfkc.nrm), + * NFKC_Casefold (nfkc_cf.nrm) and NFKC_Simple_Casefold (nfkc_scf.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. @@ -797,7 +807,7 @@ unorm_getFCD16(UChar32 c); * Constants are defined as enum values of the Normalizer2Impl class. * * Many details of the data structures are described in the design doc - * which is at http://site.icu-project.org/design/normalization/custom + * which is at https://icu.unicode.org/design/normalization/custom * * int32_t indexes[indexesLength]; -- indexesLength=indexes[IX_NORM_TRIE_OFFSET]/4; * diff --git a/src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp b/src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp index 1f4fa1517..52b9ffd54 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp @@ -38,7 +38,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Normalizer) //------------------------------------------------------------------------- Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) : - UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0), + UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0), text(new StringCharacterIterator(str)), currentIndex(0), nextIndex(0), buffer(), bufferPos(0) @@ -47,7 +47,7 @@ Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) : } Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode) : - UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0), + UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0), text(new UCharCharacterIterator(str, length)), currentIndex(0), nextIndex(0), buffer(), bufferPos(0) @@ -56,7 +56,7 @@ Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mo } Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) : - UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0), + UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0), text(iter.clone()), currentIndex(0), nextIndex(0), buffer(), bufferPos(0) @@ -65,7 +65,7 @@ Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) : } Normalizer::Normalizer(const Normalizer ©) : - UObject(copy), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(copy.fUMode), fOptions(copy.fOptions), + UObject(copy), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(copy.fUMode), fOptions(copy.fOptions), text(copy.text->clone()), currentIndex(copy.currentIndex), nextIndex(copy.nextIndex), buffer(copy.buffer), bufferPos(copy.bufferPos) @@ -205,7 +205,7 @@ Normalizer::isNormalized(const UnicodeString& source, return n2->isNormalized(source, status); } } else { - return FALSE; + return false; } } @@ -410,7 +410,7 @@ Normalizer::setText(const UnicodeString& newText, return; } CharacterIterator *newIter = new StringCharacterIterator(newText); - if (newIter == NULL) { + if (newIter == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -431,7 +431,7 @@ Normalizer::setText(const CharacterIterator& newText, return; } CharacterIterator *newIter = newText.clone(); - if (newIter == NULL) { + if (newIter == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -449,7 +449,7 @@ Normalizer::setText(ConstChar16Ptr newText, return; } CharacterIterator *newIter = new UCharCharacterIterator(newText, length); - if (newIter == NULL) { + if (newIter == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -483,7 +483,7 @@ Normalizer::nextNormalize() { currentIndex=nextIndex; text->setIndex(nextIndex); if(!text->hasNext()) { - return FALSE; + return false; } // Skip at least one character so we make progress. UnicodeString segment(text->next32PostInc()); @@ -507,7 +507,7 @@ Normalizer::previousNormalize() { nextIndex=currentIndex; text->setIndex(currentIndex); if(!text->hasPrevious()) { - return FALSE; + return false; } UnicodeString segment; while(text->hasPrevious()) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/patternprops.cpp b/src/duckdb/extension/icu/third_party/icu/common/patternprops.cpp index c38a7e276..9922683cd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/patternprops.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/patternprops.cpp @@ -118,54 +118,54 @@ static const uint32_t syntaxOrWhiteSpace2000[]={ UBool PatternProps::isSyntax(UChar32 c) { if(c<0) { - return FALSE; + return false; } else if(c<=0xff) { return (UBool)(latin1[c]>>1)&1; } else if(c<0x2010) { - return FALSE; + return false; } else if(c<=0x3030) { uint32_t bits=syntax2000[index2000[(c-0x2000)>>5]]; return (UBool)((bits>>(c&0x1f))&1); } else if(0xfd3e<=c && c<=0xfe46) { return c<=0xfd3f || 0xfe45<=c; } else { - return FALSE; + return false; } } UBool PatternProps::isSyntaxOrWhiteSpace(UChar32 c) { if(c<0) { - return FALSE; + return false; } else if(c<=0xff) { return (UBool)(latin1[c]&1); } else if(c<0x200e) { - return FALSE; + return false; } else if(c<=0x3030) { uint32_t bits=syntaxOrWhiteSpace2000[index2000[(c-0x2000)>>5]]; return (UBool)((bits>>(c&0x1f))&1); } else if(0xfd3e<=c && c<=0xfe46) { return c<=0xfd3f || 0xfe45<=c; } else { - return FALSE; + return false; } } UBool PatternProps::isWhiteSpace(UChar32 c) { if(c<0) { - return FALSE; + return false; } else if(c<=0xff) { return (UBool)(latin1[c]>>2)&1; } else if(0x200e<=c && c<=0x2029) { return c<=0x200f || 0x2028<=c; } else { - return FALSE; + return false; } } -const UChar * -PatternProps::skipWhiteSpace(const UChar *s, int32_t length) { +const char16_t * +PatternProps::skipWhiteSpace(const char16_t *s, int32_t length) { while(length>0 && isWhiteSpace(*s)) { ++s; --length; @@ -183,8 +183,8 @@ PatternProps::skipWhiteSpace(const UnicodeString& s, int32_t start) { return i; } -const UChar * -PatternProps::trimWhiteSpace(const UChar *s, int32_t &length) { +const char16_t * +PatternProps::trimWhiteSpace(const char16_t *s, int32_t &length) { if(length<=0 || (!isWhiteSpace(s[0]) && !isWhiteSpace(s[length-1]))) { return s; } @@ -205,21 +205,21 @@ PatternProps::trimWhiteSpace(const UChar *s, int32_t &length) { } UBool -PatternProps::isIdentifier(const UChar *s, int32_t length) { +PatternProps::isIdentifier(const char16_t *s, int32_t length) { if(length<=0) { - return FALSE; + return false; } - const UChar *limit=s+length; + const char16_t *limit=s+length; do { if(isSyntaxOrWhiteSpace(*s++)) { - return FALSE; + return false; } } while(s0 && !isSyntaxOrWhiteSpace(*s)) { ++s; --length; diff --git a/src/duckdb/extension/icu/third_party/icu/common/patternprops.h b/src/duckdb/extension/icu/third_party/icu/common/patternprops.h index b57cdeb6e..23a88333f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/patternprops.h +++ b/src/duckdb/extension/icu/third_party/icu/common/patternprops.h @@ -44,17 +44,17 @@ U_NAMESPACE_BEGIN class U_COMMON_API PatternProps { public: /** - * @return TRUE if c is a Pattern_Syntax code point. + * @return true if c is a Pattern_Syntax code point. */ static UBool isSyntax(UChar32 c); /** - * @return TRUE if c is a Pattern_Syntax or Pattern_White_Space code point. + * @return true if c is a Pattern_Syntax or Pattern_White_Space code point. */ static UBool isSyntaxOrWhiteSpace(UChar32 c); /** - * @return TRUE if c is a Pattern_White_Space character. + * @return true if c is a Pattern_White_Space character. */ static UBool isWhiteSpace(UChar32 c); @@ -62,7 +62,7 @@ class U_COMMON_API PatternProps { * Skips over Pattern_White_Space starting at s. * @return The smallest pointer at or after s with a non-white space character. */ - static const UChar *skipWhiteSpace(const UChar *s, int32_t length); + static const char16_t *skipWhiteSpace(const char16_t *s, int32_t length); /** * Skips over Pattern_White_Space starting at index start in s. @@ -73,24 +73,24 @@ class U_COMMON_API PatternProps { /** * @return s except with leading and trailing Pattern_White_Space removed and length adjusted. */ - static const UChar *trimWhiteSpace(const UChar *s, int32_t &length); + static const char16_t *trimWhiteSpace(const char16_t *s, int32_t &length); /** * Tests whether the string contains a "pattern identifier", that is, * whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters. - * @return TRUE if there are no Pattern_White_Space or Pattern_Syntax characters in s. + * @return true if there are no Pattern_White_Space or Pattern_Syntax characters in s. */ - static UBool isIdentifier(const UChar *s, int32_t length); + static UBool isIdentifier(const char16_t *s, int32_t length); /** * Skips over a "pattern identifier" starting at index s. * @return The smallest pointer at or after s with * a Pattern_White_Space or Pattern_Syntax character. */ - static const UChar *skipIdentifier(const UChar *s, int32_t length); + static const char16_t *skipIdentifier(const char16_t *s, int32_t length); private: - PatternProps(); // no constructor: all static methods + PatternProps() = delete; // no constructor: all static methods }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/pluralmap.cpp b/src/duckdb/extension/icu/third_party/icu/common/pluralmap.cpp index ec87f0198..7e6156de8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/pluralmap.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/pluralmap.cpp @@ -36,7 +36,7 @@ PluralMapBase::toCategory(const UnicodeString &pluralForm) { const char *PluralMapBase::getCategoryName(Category c) { int32_t index = c; return (index < 0 || index >= UPRV_LENGTHOF(gPluralForms)) ? - NULL : gPluralForms[index]; + nullptr : gPluralForms[index]; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/pluralmap.h b/src/duckdb/extension/icu/third_party/icu/common/pluralmap.h index db644093a..11683599e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/pluralmap.h +++ b/src/duckdb/extension/icu/third_party/icu/common/pluralmap.h @@ -24,7 +24,7 @@ class U_COMMON_API PluralMapBase : public UMemory { public: /** * The names of all the plural categories. NONE is not an actual plural - * category, but rather represents the absense of a plural category. + * category, but rather represents the absence of a plural category. */ enum Category { NONE = -1, @@ -46,14 +46,14 @@ class U_COMMON_API PluralMapBase : public UMemory { /** * Converts a category name such as "zero", "one", "two", "few", "many" - * or "other" to a category enum. Returns NONE for urecongized + * or "other" to a category enum. Returns NONE for unrecognized * category name. */ static Category toCategory(const UnicodeString &categoryName); /** * Converts a category to a name. - * Passing NONE or CATEGORY_COUNT for category returns NULL. + * Passing NONE or CATEGORY_COUNT for category returns nullptr. */ static const char *getCategoryName(Category category); }; @@ -62,7 +62,7 @@ class U_COMMON_API PluralMapBase : public UMemory { * A Map of plural categories to values. It maintains ownership of the * values. * - * Type T is the value type. T must provide the followng: + * Type T is the value type. T must provide the following: * 1) Default constructor * 2) Copy constructor * 3) Assignment operator @@ -89,7 +89,7 @@ class PluralMap : public PluralMapBase { fVariants[0] = &fOtherVariant; for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) { fVariants[i] = other.fVariants[i] ? - new T(*other.fVariants[i]) : NULL; + new T(*other.fVariants[i]) : nullptr; } } @@ -98,12 +98,12 @@ class PluralMap : public PluralMapBase { return *this; } for (int32_t i = 0; i < UPRV_LENGTHOF(fVariants); ++i) { - if (fVariants[i] != NULL && other.fVariants[i] != NULL) { + if (fVariants[i] != nullptr && other.fVariants[i] != nullptr) { *fVariants[i] = *other.fVariants[i]; - } else if (fVariants[i] != NULL) { + } else if (fVariants[i] != nullptr) { delete fVariants[i]; - fVariants[i] = NULL; - } else if (other.fVariants[i] != NULL) { + fVariants[i] = nullptr; + } else if (other.fVariants[i] != nullptr) { fVariants[i] = new T(*other.fVariants[i]); } else { // do nothing @@ -125,28 +125,28 @@ class PluralMap : public PluralMapBase { *fVariants[0] = T(); for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) { delete fVariants[i]; - fVariants[i] = NULL; + fVariants[i] = nullptr; } } /** * Iterates through the mappings in this instance, set index to NONE * prior to using. Call next repeatedly to get the values until it - * returns NULL. Each time next returns, caller may pass index + * returns nullptr. Each time next returns, caller may pass index * to getCategoryName() to get the name of the plural category. - * When this function returns NULL, index is CATEGORY_COUNT + * When this function returns nullptr, index is CATEGORY_COUNT */ const T *next(Category &index) const { int32_t idx = index; ++idx; for (; idx < UPRV_LENGTHOF(fVariants); ++idx) { - if (fVariants[idx] != NULL) { + if (fVariants[idx] != nullptr) { index = static_cast(idx); return fVariants[idx]; } } index = static_cast(idx); - return NULL; + return nullptr; } /** @@ -172,7 +172,7 @@ class PluralMap : public PluralMapBase { */ const T &get(Category v) const { int32_t index = v; - if (index < 0 || index >= UPRV_LENGTHOF(fVariants) || fVariants[index] == NULL) { + if (index < 0 || index >= UPRV_LENGTHOF(fVariants) || fVariants[index] == nullptr) { return *fVariants[0]; } return *fVariants[index]; @@ -207,7 +207,7 @@ class PluralMap : public PluralMapBase { T *getMutable( Category category, UErrorCode &status) { - return getMutable(category, NULL, status); + return getMutable(category, nullptr, status); } /** @@ -218,7 +218,7 @@ class PluralMap : public PluralMapBase { T *getMutable( const char *category, UErrorCode &status) { - return getMutable(toCategory(category), NULL, status); + return getMutable(toCategory(category), nullptr, status); } /** @@ -234,7 +234,7 @@ class PluralMap : public PluralMapBase { } /** - * Returns TRUE if this object equals rhs. + * Returns true if this object equals rhs. */ UBool equals( const PluralMap &rhs, @@ -243,14 +243,14 @@ class PluralMap : public PluralMapBase { if (fVariants[i] == rhs.fVariants[i]) { continue; } - if (fVariants[i] == NULL || rhs.fVariants[i] == NULL) { - return FALSE; + if (fVariants[i] == nullptr || rhs.fVariants[i] == nullptr) { + return false; } if (!eqFunc(*fVariants[i], *rhs.fVariants[i])) { - return FALSE; + return false; } } - return TRUE; + return true; } private: @@ -262,15 +262,15 @@ class PluralMap : public PluralMapBase { const T *defaultValue, UErrorCode &status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } int32_t index = category; if (index < 0 || index >= UPRV_LENGTHOF(fVariants)) { status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if (fVariants[index] == NULL) { - fVariants[index] = defaultValue == NULL ? + if (fVariants[index] == nullptr) { + fVariants[index] = defaultValue == nullptr ? new T() : new T(*defaultValue); } if (!fVariants[index]) { @@ -282,7 +282,7 @@ class PluralMap : public PluralMapBase { void initializeNew() { fVariants[0] = &fOtherVariant; for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) { - fVariants[i] = NULL; + fVariants[i] = nullptr; } } }; diff --git a/src/duckdb/extension/icu/third_party/icu/common/propname.cpp b/src/duckdb/extension/icu/third_party/icu/common/propname.cpp index a12eb7d91..45062bfbd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/propname.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/propname.cpp @@ -204,21 +204,21 @@ int32_t PropNameData::findPropertyValueNameGroup(int32_t valueMapIndex, int32_t const char *PropNameData::getName(const char *nameGroup, int32_t nameIndex) { int32_t numNames=*nameGroup++; if(nameIndex<0 || numNames<=nameIndex) { - return NULL; + return nullptr; } // Skip nameIndex names. for(; nameIndex>0; --nameIndex) { nameGroup=uprv_strchr(nameGroup, 0)+1; } if(*nameGroup==0) { - return NULL; // no name (Property[Value]Aliases.txt has "n/a") + return nullptr; // no name (Property[Value]Aliases.txt has "n/a") } return nameGroup; } UBool PropNameData::containsName(BytesTrie &trie, const char *name) { - if(name==NULL) { - return FALSE; + if(name==nullptr) { + return false; } UStringTrieResult result=USTRINGTRIE_NO_VALUE; char c; @@ -229,7 +229,7 @@ UBool PropNameData::containsName(BytesTrie &trie, const char *name) { continue; } if(!USTRINGTRIE_HAS_NEXT(result)) { - return FALSE; + return false; } result=trie.next((uint8_t)c); } @@ -239,7 +239,7 @@ UBool PropNameData::containsName(BytesTrie &trie, const char *name) { const char *PropNameData::getPropertyName(int32_t property, int32_t nameChoice) { int32_t valueMapIndex=findProperty(property); if(valueMapIndex==0) { - return NULL; // Not a known property. + return nullptr; // Not a known property. } return getName(nameGroups+valueMaps[valueMapIndex], nameChoice); } @@ -247,11 +247,11 @@ const char *PropNameData::getPropertyName(int32_t property, int32_t nameChoice) const char *PropNameData::getPropertyValueName(int32_t property, int32_t value, int32_t nameChoice) { int32_t valueMapIndex=findProperty(property); if(valueMapIndex==0) { - return NULL; // Not a known property. + return nullptr; // Not a known property. } int32_t nameGroupOffset=findPropertyValueNameGroup(valueMaps[valueMapIndex+1], value); if(nameGroupOffset==0) { - return NULL; + return nullptr; } return getName(nameGroups+nameGroupOffset, nameChoice); } @@ -289,7 +289,10 @@ U_NAMESPACE_END U_CAPI const char* U_EXPORT2 u_getPropertyName(UProperty property, - UPropertyNameChoice nameChoice) { + UPropertyNameChoice nameChoice) UPRV_NO_SANITIZE_UNDEFINED { + // The nameChoice is really an integer with a couple of named constants. + // Unicode allows for names other than short and long ones. + // If present, these will be returned for U_LONG_PROPERTY_NAME + i, where i=1, 2,... U_NAMESPACE_USE return PropNameData::getPropertyName(property, nameChoice); } @@ -303,7 +306,10 @@ u_getPropertyEnum(const char* alias) { U_CAPI const char* U_EXPORT2 u_getPropertyValueName(UProperty property, int32_t value, - UPropertyNameChoice nameChoice) { + UPropertyNameChoice nameChoice) UPRV_NO_SANITIZE_UNDEFINED { + // The nameChoice is really an integer with a couple of named constants. + // Unicode allows for names other than short and long ones. + // If present, these will be returned for U_LONG_PROPERTY_NAME + i, where i=1, 2,... U_NAMESPACE_USE return PropNameData::getPropertyValueName(property, value, nameChoice); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/propname_data.h b/src/duckdb/extension/icu/third_party/icu/common/propname_data.h index 6f63e9cdd..7bdbe8ec4 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/propname_data.h +++ b/src/duckdb/extension/icu/third_party/icu/common/propname_data.h @@ -1,6 +1,5 @@ -// © 2016 and later: Unicode, Inc. and others. +// Copyright (C) 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -// // Copyright (C) 1999-2016, International Business Machines // Corporation and others. All Rights Reserved. // @@ -8,105 +7,107 @@ // // machine-generated by: icu/tools/unicode/c/genprops/pnamesbuilder.cpp - #ifdef INCLUDED_FROM_PROPNAME_CPP U_NAMESPACE_BEGIN -const int32_t PropNameData::indexes[8]={0x20,0x15b8,0x5048,0xa69a,0xa69a,0xa69a,0x2f,0}; +const int32_t PropNameData::indexes[8]={0x20,0x1690,0x5337,0xae61,0xae61,0xae61,0x31,0}; -const int32_t PropNameData::valueMaps[1382]={ -6,0,0x41,0,0xe3,0x368,0xe3,0x37e,0xe3,0x393,0xe3,0x3a9,0xe3,0x3b4,0xe3,0x3d5, -0xe3,0x3e5,0xe3,0x3f4,0xe3,0x402,0xe3,0x426,0xe3,0x43d,0xe3,0x455,0xe3,0x46c,0xe3,0x47b, -0xe3,0x48a,0xe3,0x49b,0xe3,0x4a9,0xe3,0x4bb,0xe3,0x4d5,0xe3,0x4f0,0xe3,0x505,0xe3,0x522, -0xe3,0x533,0xe3,0x53e,0xe3,0x55d,0xe3,0x573,0xe3,0x584,0xe3,0x594,0xe3,0x5af,0xe3,0x5c8, -0xe3,0x5d9,0xe3,0x5f3,0xe3,0x606,0xe3,0x616,0xe3,0x630,0xe3,0x649,0xe3,0x660,0xe3,0x674, -0xe3,0x68a,0xe3,0x69e,0xe3,0x6b4,0xe3,0x6ce,0xe3,0x6e6,0xe3,0x702,0xe3,0x70a,0xe3,0x712, -0xe3,0x71a,0xe3,0x722,0xe3,0x72b,0xe3,0x738,0xe3,0x74b,0xe3,0x768,0xe3,0x785,0xe3,0x7a2, -0xe3,0x7c0,0xe3,0x7de,0xe3,0x802,0xe3,0x80f,0xe3,0x829,0xe3,0x83e,0xe3,0x859,0xe3,0x870, -0xe3,0x887,0xe3,0x8a9,0xe3,0x1000,0x1019,0x8c8,0x15f,0xae8,0x17a,0x2f11,0xe9,0x2f30,0x2b3,0x306e, -0x2c9,0x30c8,0x2d3,0x3325,0x2f5,0x3c20,0x35f,0x3c90,0x369,0x3f2a,0x398,0x3f68,0x3a0,0x4a5b,0x465,0x4ad9, -0x46f,0x4afe,0x475,0x4b18,0x47b,0x4b39,0x482,0x4b53,0xe9,0x4b78,0xe9,0x4b9e,0x489,0x4c48,0x49f,0x4cc1, -0x4b2,0x4d73,0x4cd,0x4daa,0x4d4,0x4f8a,0x4e8,0x540a,0x510,0x2000,0x2001,0x5469,0x518,0x3000,0x3001,0x54f5, -0,0x4000,0x400e,0x5507,0,0x5510,0,0x552a,0,0x553b,0,0x554c,0,0x5562,0,0x556b, -0,0x5588,0,0x55a6,0,0x55c4,0,0x55e2,0,0x55f8,0,0x560c,0,0x5622,0,0x7000, -0x7001,0x563b,0,0x7d6,0x12,0,1,0x12,0x20,0x7f4,0x4a,0,1,6,7,8, -9,0xa,0xb,0xc,0xd,0xe,0xf,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, -0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x54,0x5b,0x67,0x6b, -0x76,0x7a,0x81,0x82,0x84,0x85,0xc8,0xca,0xd6,0xd8,0xda,0xdc,0xde,0xe0,0xe2,0xe4, -0xe6,0xe8,0xe9,0xea,0xf0,0x2e,0x40,0x4c,0x5e,0x68,0x79,0x84,0x91,0x9e,0xab,0xb8, -0xc5,0xd2,0xdf,0xec,0xf9,0x106,0x113,0x120,0x12d,0x13a,0x147,0x154,0x161,0x16e,0x17b,0x188, -0x195,0x1a2,0x1af,0x1bc,0x1c9,0x1d6,0x1e3,0x1f0,0x1fd,0x20c,0x21b,0x22a,0x239,0x248,0x257,0x266, -0x275,0x28f,0x2a3,0x2b7,0x2d2,0x2e1,0x2ea,0x2fa,0x302,0x30b,0x31a,0x323,0x333,0x344,0x355,0x995, -1,0,0x17,0x8d7,0x8e8,0x8f9,0x90d,0x924,0x93c,0x94e,0x963,0x97a,0x98f,0x99f,0x9b1,0x9ce, -0x9ea,0x9fc,0xa19,0xa35,0xa51,0xa66,0xa7b,0xa95,0xab0,0xacb,0xb37,1,0,0x135,0xaf3,0xb00, -0xb13,0xb3b,0xb59,0xb77,0xb8f,0xbba,0xbe4,0xbfc,0xc0f,0xc22,0xc31,0xc40,0xc4f,0xc5e,0xc75,0xc86, -0xc99,0xcac,0xcb9,0xcc6,0xcd5,0xce6,0xcfb,0xd0c,0xd17,0xd20,0xd31,0xd42,0xd55,0xd67,0xd7a,0xd8d, -0xdcc,0xdd9,0xde6,0xdf3,0xe08,0xe38,0xe52,0xe73,0xe9e,0xec1,0xf1f,0xf46,0xf61,0xf70,0xf97,0xfbf, -0xfe2,0x1005,0x102f,0x1048,0x1067,0x108a,0x10ae,0x10c1,0x10db,0x1105,0x111d,0x1145,0x116e,0x1181,0x1194,0x11a7, -0x11ce,0x11dd,0x11fd,0x122b,0x1249,0x1277,0x1293,0x12ae,0x12c7,0x12e0,0x1301,0x1331,0x1350,0x1372,0x13a6,0x13d3, -0x1418,0x1439,0x1463,0x1484,0x14ad,0x14c0,0x14f3,0x150a,0x1519,0x152a,0x1555,0x156c,0x159d,0x15cb,0x160e,0x1619, -0x1652,0x1663,0x1674,0x1681,0x1694,0x16ce,0x16f2,0x1716,0x1750,0x1788,0x17b3,0x17cb,0x17f7,0x1823,0x1830,0x183f, -0x185c,0x187e,0x18ac,0x18cc,0x18f3,0x191a,0x1939,0x194c,0x195d,0x196e,0x1993,0x19b8,0x19df,0x1a13,0x1a40,0x1a5e, -0x1a71,0x1a8a,0x1ac3,0x1ad2,0x1af2,0x1b14,0x1b36,0x1b4d,0x1b64,0x1b91,0x1baa,0x1bc3,0x1bf4,0x1c1e,0x1c39,0x1c4c, -0x1c6b,0x1c74,0x1c87,0x1ca5,0x1cc3,0x1cd6,0x1ced,0x1d02,0x1d37,0x1d5b,0x1d70,0x1d7f,0x1d92,0x1db6,0x1dbf,0x1de3, -0x1dfa,0x1e0d,0x1e1c,0x1e27,0x1e48,0x1e60,0x1e6f,0x1e7e,0x1e8d,0x1ea4,0x1eb9,0x1ece,0x1f07,0x1f1a,0x1f36,0x1f41, -0x1f4e,0x1f7c,0x1fa0,0x1fc3,0x1fd6,0x1ff8,0x200b,0x2026,0x2049,0x206c,0x2091,0x20a2,0x20d1,0x20fe,0x2115,0x2130, -0x213f,0x216a,0x21a2,0x21dc,0x220a,0x221b,0x2228,0x224c,0x225b,0x2277,0x2291,0x22ae,0x22e6,0x22fb,0x2328,0x2347, -0x2375,0x2395,0x23c9,0x23d8,0x2402,0x2425,0x2450,0x245b,0x246c,0x2487,0x24ab,0x24b8,0x24cd,0x24f4,0x251f,0x2556, -0x2569,0x257a,0x25aa,0x25bb,0x25ca,0x25df,0x25fd,0x2610,0x2623,0x263a,0x2657,0x2662,0x266b,0x268d,0x26a2,0x26c7, -0x26de,0x2707,0x2722,0x2737,0x2750,0x2771,0x27a6,0x27b7,0x27e8,0x280c,0x281d,0x2836,0x2841,0x286e,0x2890,0x28be, -0x28f1,0x2900,0x2911,0x292e,0x2970,0x2997,0x29a4,0x29b9,0x29dd,0x2a03,0x2a3c,0x2a4d,0x2a71,0x2a7c,0x2a89,0x2a98, -0x2abd,0x2aeb,0x2b07,0x2b24,0x2b31,0x2b42,0x2b60,0x2b83,0x2ba0,0x2bad,0x2bcd,0x2bea,0x2c0b,0x2c34,0x2c45,0x2c64, -0x2c7d,0x2c96,0x2ca7,0x2cf0,0x2d01,0x2d1a,0x2d49,0x2d76,0x2d9b,0x2ddd,0x2df9,0x2e08,0x2e1f,0x2e4d,0x2e66,0x2e8f, -0x2ea9,0x2ee4,0x2f02,0x1e85,1,0,0x12,0x2f47,0x2f57,0x2f6a,0x2f7a,0x2f8a,0x2f99,0x2fa9,0x2fbb,0x2fce, -0x2fe0,0x2ff0,0x3000,0x300f,0x301e,0x302e,0x303b,0x304a,0x305e,0x1f43,1,0,6,0x3083,0x308e,0x309b, -0x30a8,0x30b5,0x30c0,0x1f87,1,0,0x1e,0x30dd,0x30ec,0x3101,0x3116,0x312b,0x313f,0x3150,0x3164,0x3177, -0x3188,0x31a1,0x31b3,0x31c4,0x31d8,0x31eb,0x3203,0x3215,0x3220,0x3230,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae, -0x32be,0x32d2,0x32e6,0x32f7,0x330f,0x21b2,1,0,0x66,0x3337,0x335a,0x3363,0x3370,0x337b,0x3384,0x338f, -0x3398,0x33b1,0x33b6,0x33bf,0x33dc,0x33e5,0x33f2,0x33fb,0x341f,0x3426,0x342f,0x3442,0x344d,0x3456,0x3461,0x347a, -0x3483,0x3492,0x349d,0x34a6,0x34b1,0x34ba,0x34c1,0x34ca,0x34d5,0x34de,0x34f7,0x3500,0x350d,0x3518,0x3529,0x3534, -0x3549,0x3560,0x3569,0x3572,0x358b,0x3596,0x359f,0x35a8,0x35bf,0x35dc,0x35e7,0x35f8,0x3603,0x360a,0x3617,0x3624, -0x3651,0x3666,0x366f,0x368a,0x36ad,0x36ce,0x36ef,0x3714,0x373b,0x375c,0x377f,0x37a0,0x37c7,0x37e8,0x380d,0x382c, -0x384b,0x386a,0x3887,0x38a8,0x38c9,0x38ec,0x3911,0x3930,0x394f,0x3970,0x3997,0x39bc,0x39db,0x39fc,0x3a1f,0x3a3a, -0x3a53,0x3a6e,0x3a87,0x3aa4,0x3abf,0x3adc,0x3afb,0x3b18,0x3b35,0x3b54,0x3b71,0x3b8c,0x3ba9,0x3bc6,0x3bf9,0x24f7, -1,0,6,0x3c31,0x3c40,0x3c50,0x3c60,0x3c70,0x3c81,0x2555,1,0,0x2b,0x3c9f,0x3cab,0x3cb9, -0x3cc8,0x3cd7,0x3ce7,0x3cf8,0x3d0c,0x3d21,0x3d37,0x3d4a,0x3d5e,0x3d6e,0x3d77,0x3d82,0x3d92,0x3dae,0x3dc0,0x3dce, -0x3ddd,0x3de9,0x3dfe,0x3e12,0x3e25,0x3e33,0x3e47,0x3e55,0x3e5f,0x3e71,0x3e7d,0x3e8b,0x3e9b,0x3ea2,0x3ea9,0x3eb0, -0x3eb7,0x3ebe,0x3ed4,0x3ef5,0x870,0x3f07,0x3f12,0x3f21,0x27ae,1,0,4,0x3f3b,0x3f46,0x3f52,0x3f5c, -0x27d4,1,0,0xc1,0x3f73,0x3f80,0x3f95,0x3fa2,0x3fb1,0x3fbf,0x3fce,0x3fdd,0x3fef,0x3ffe,0x400c,0x401d, -0x402c,0x403b,0x4048,0x4054,0x4063,0x4072,0x407c,0x4089,0x4096,0x40a5,0x40b3,0x40c2,0x40ce,0x40d8,0x40e4,0x40f4, -0x4104,0x4112,0x411e,0x412f,0x413b,0x4147,0x4155,0x4162,0x416e,0x417b,0xd0c,0x4188,0x4196,0x41b0,0x41b9,0x41c7, -0x41d5,0x41e1,0x41f0,0x41fe,0x420c,0x4218,0x4227,0x4235,0x4243,0x4250,0x425f,0x427a,0x4289,0x429a,0x42ab,0x42be, -0x42d0,0x42df,0x42f1,0x4300,0x430c,0x4317,0x1e1c,0x4324,0x432f,0x433a,0x4345,0x4350,0x436b,0x4376,0x4381,0x438c, -0x439f,0x43b3,0x43be,0x43cd,0x43dc,0x43e7,0x43f2,0x43ff,0x440e,0x441c,0x4427,0x4442,0x444c,0x445d,0x446e,0x447d, -0x448e,0x4499,0x44a4,0x44af,0x44ba,0x44c5,0x44d0,0x44db,0x44e5,0x44f0,0x4500,0x450b,0x4519,0x4526,0x4531,0x4540, -0x454d,0x455a,0x4569,0x4576,0x4587,0x4599,0x45a9,0x45b4,0x45c7,0x45de,0x45ec,0x45f9,0x4604,0x4611,0x4622,0x463e, -0x4654,0x465f,0x467c,0x468c,0x469b,0x46a6,0x46b1,0x1f36,0x46bd,0x46c8,0x46e0,0x46f0,0x46ff,0x470d,0x471b,0x4726, -0x4731,0x4745,0x475c,0x4774,0x4784,0x4794,0x47a4,0x47b6,0x47c1,0x47cc,0x47d6,0x47e2,0x47f0,0x4803,0x480f,0x481c, -0x4827,0x4843,0x4850,0x485e,0x4877,0x2836,0x4886,0x2657,0x4893,0x48a1,0x48b3,0x48c1,0x48cd,0x48dd,0x2a71,0x48eb, -0x48f7,0x4902,0x490d,0x4918,0x492c,0x493a,0x4951,0x495d,0x4971,0x497f,0x4991,0x49a7,0x49b5,0x49c7,0x49d5,0x49f2, -0x4a04,0x4a11,0x4a22,0x4a34,0x4a4e,0x31cc,1,0,6,0x4a75,0x4a88,0x4a98,0x4aa6,0x4ab7,0x4ac7,0x3228, -0x12,0,1,0x4af1,0x4af7,0x3235,0x12,0,1,0x4af1,0x4af7,0x3242,1,0,3,0x4af1, -0x4af7,0x4b30,0x3258,1,0,3,0x4af1,0x4af7,0x4b30,0x326e,1,0,0x12,0x4bba,0x4bc4,0x4bd0, -0x4bd7,0x4be2,0x4be7,0x4bee,0x4bf5,0x4bfe,0x4c03,0x4c08,0x4c18,0x870,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x3317, -1,0,0xf,0x4bba,0x4c5b,0x4c65,0x4c6f,0x4c7a,0x3ddd,0x4c84,0x4c90,0x4c98,0x4c9f,0x4ca9,0x4bd0,0x4bd7, -0x4be7,0x4cb3,0x339e,1,0,0x17,0x4bba,0x4cd0,0x4c6f,0x4cdc,0x4ce9,0x4cf7,0x3ddd,0x4d02,0x4bd0,0x4d13, -0x4be7,0x4d22,0x4d30,0x870,0x3ef5,0x4d3c,0x4d4d,0x3f07,0x4c24,0x3f12,0x4c34,0x3f21,0x4d5e,0x34bb,1,0, -3,0x4d91,0x4d99,0x4da1,0x34d4,1,0,0x10,0x4dca,0x4dd1,0x4de0,0x4e01,0x4e24,0x4e2f,0x4e4e,0x4e65, -0x4e72,0x4e7b,0x4e9a,0x4ecd,0x4ee8,0x4f17,0x4f34,0x4f59,0x356d,1,0,0x24,0x4fa8,0x4fb5,0x4fc8,0x4fd5, -0x5002,0x5027,0x503c,0x505b,0x507c,0x50a9,0x50e2,0x5105,0x5128,0x5155,0x518a,0x51b1,0x51da,0x5211,0x5240,0x5261, -0x5286,0x5295,0x52b8,0x52cf,0x52dc,0x52eb,0x5308,0x5321,0x5344,0x5369,0x5382,0x5397,0x53a6,0x53b7,0x53c4,0x53e5, -0x373d,1,0,4,0x5423,0x542e,0x5446,0x545e,0x3779,0x36,1,2,4,8,0xe,0x10, -0x20,0x3e,0x40,0x80,0x100,0x1c0,0x200,0x400,0x800,0xe00,0x1000,0x2000,0x4000,0x7000,0x8000,0x10000, -0x20000,0x40000,0x78001,0x80000,0x100000,0x200000,0x400000,0x800000,0x1000000,0x2000000,0x4000000,0x8000000,0xf000000,0x10000000,0x20000000,0x30f80000, -0x30dd,0x30ec,0x3101,0x3116,0x5497,0x312b,0x313f,0x548d,0x3150,0x3164,0x3177,0x54a8,0x3188,0x31a1,0x31b3,0x54bf, -0x31c4,0x31d8,0x31eb,0x54e8,0x3203,0x3215,0x3220,0x3230,0x5484,0x323e,0x3253,0x3268,0x327e,0x3298,0x32ae,0x32be, -0x32d2,0x32e6,0x54de,0x32f7,0x330f,0x54c9 +const int32_t PropNameData::valueMaps[1436]={ +6,0,0x4b,0,0xf7,0x368,0xf7,0x37e,0xf7,0x393,0xf7,0x3a9,0xf7,0x3b4,0xf7,0x3d5, +0xf7,0x3e5,0xf7,0x3f4,0xf7,0x402,0xf7,0x426,0xf7,0x43d,0xf7,0x455,0xf7,0x46c,0xf7,0x47b, +0xf7,0x48a,0xf7,0x49b,0xf7,0x4a9,0xf7,0x4bb,0xf7,0x4d5,0xf7,0x4f0,0xf7,0x505,0xf7,0x522, +0xf7,0x533,0xf7,0x53e,0xf7,0x55d,0xf7,0x573,0xf7,0x584,0xf7,0x594,0xf7,0x5af,0xf7,0x5c8, +0xf7,0x5d9,0xf7,0x5f3,0xf7,0x606,0xf7,0x616,0xf7,0x630,0xf7,0x649,0xf7,0x660,0xf7,0x674, +0xf7,0x68a,0xf7,0x69e,0xf7,0x6b4,0xf7,0x6ce,0xf7,0x6e6,0xf7,0x702,0xf7,0x70a,0xf7,0x712, +0xf7,0x71a,0xf7,0x722,0xf7,0x72b,0xf7,0x738,0xf7,0x74b,0xf7,0x768,0xf7,0x785,0xf7,0x7a2, +0xf7,0x7c0,0xf7,0x7de,0xf7,0x802,0xf7,0x80f,0xf7,0x829,0xf7,0x83e,0xf7,0x859,0xf7,0x870, +0xf7,0x887,0xf7,0x8a9,0xf7,0x8c8,0xf7,0x8e1,0xf7,0x90e,0xf7,0x947,0xf7,0x978,0xf7,0x9a7, +0xf7,0x9d6,0xf7,0x9eb,0xf7,0xa04,0xf7,0xa2f,0xf7,0x1000,0x1019,0xa60,0x173,0xc80,0x18e,0x331c, +0xfd,0x333b,0x2db,0x3479,0x2f1,0x34d3,0x2fb,0x3730,0x31d,0x405b,0x389,0x40cb,0x393,0x43b0,0x3c7,0x43ee, +0x3cf,0x4f33,0x49b,0x4fb1,0x4a5,0x4fd6,0x4ab,0x4ff0,0x4b1,0x5011,0x4b8,0x502b,0xfd,0x5050,0xfd,0x5076, +0x4bf,0x5120,0x4d5,0x5199,0x4e8,0x524b,0x503,0x5282,0x50a,0x5462,0x51e,0x58e2,0x546,0x2000,0x2001,0x5941, +0x54e,0x3000,0x3001,0x59cd,0,0x4000,0x400e,0x59df,0,0x59e8,0,0x5a02,0,0x5a13,0,0x5a24, +0,0x5a3a,0,0x5a43,0,0x5a60,0,0x5a7e,0,0x5a9c,0,0x5aba,0,0x5ad0,0,0x5ae4, +0,0x5afa,0,0x7000,0x7001,0x5b13,0,0x87a,0x12,0,1,0x12,0x20,0x898,0x4a,0, +1,6,7,8,9,0xa,0xb,0xc,0xd,0xe,0xf,0x10,0x11,0x12,0x13,0x14, +0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24, +0x54,0x5b,0x67,0x6b,0x76,0x7a,0x81,0x82,0x84,0x85,0xc8,0xca,0xd6,0xd8,0xda,0xdc, +0xde,0xe0,0xe2,0xe4,0xe6,0xe8,0xe9,0xea,0xf0,0x2e,0x40,0x4c,0x5e,0x68,0x79,0x84, +0x91,0x9e,0xab,0xb8,0xc5,0xd2,0xdf,0xec,0xf9,0x106,0x113,0x120,0x12d,0x13a,0x147,0x154, +0x161,0x16e,0x17b,0x188,0x195,0x1a2,0x1af,0x1bc,0x1c9,0x1d6,0x1e3,0x1f0,0x1fd,0x20c,0x21b,0x22a, +0x239,0x248,0x257,0x266,0x275,0x28f,0x2a3,0x2b7,0x2d2,0x2e1,0x2ea,0x2fa,0x302,0x30b,0x31a,0x323, +0x333,0x344,0x355,0xa39,1,0,0x17,0xa6f,0xa80,0xa91,0xaa5,0xabc,0xad4,0xae6,0xafb,0xb12, +0xb27,0xb37,0xb49,0xb66,0xb82,0xb94,0xbb1,0xbcd,0xbe9,0xbfe,0xc13,0xc2d,0xc48,0xc63,0xbdb,1, +0,0x149,0xc8b,0xc98,0xcab,0xcd3,0xcf1,0xd0f,0xd27,0xd52,0xd7c,0xd94,0xda7,0xdba,0xdc9,0xdd8, +0xde7,0xdf6,0xe0d,0xe1e,0xe31,0xe44,0xe51,0xe5e,0xe6d,0xe7e,0xe93,0xea4,0xeaf,0xeb8,0xec9,0xeda, +0xeed,0xeff,0xf12,0xf25,0xf64,0xf71,0xf7e,0xf8b,0xfa0,0xfd0,0xfea,0x100b,0x1036,0x1059,0x10b7,0x10de, +0x10f9,0x1108,0x112f,0x1157,0x117a,0x119d,0x11c7,0x11e0,0x11ff,0x1222,0x1246,0x1259,0x1273,0x129d,0x12b5,0x12dd, +0x1306,0x1319,0x132c,0x133f,0x1366,0x1375,0x1395,0x13c3,0x13e1,0x140f,0x142b,0x1446,0x145f,0x1478,0x1499,0x14c9, +0x14e8,0x150a,0x153e,0x156b,0x15b0,0x15d1,0x15fb,0x161c,0x1645,0x1658,0x168b,0x16a2,0x16b1,0x16c2,0x16ed,0x1704, +0x1735,0x1763,0x17a6,0x17b1,0x17ea,0x17fb,0x180c,0x1819,0x182c,0x1866,0x188a,0x18ae,0x18e8,0x1920,0x194b,0x1963, +0x198f,0x19bb,0x19c8,0x19d7,0x19f4,0x1a16,0x1a44,0x1a64,0x1a8b,0x1ab2,0x1ad1,0x1ae4,0x1af5,0x1b06,0x1b2b,0x1b50, +0x1b77,0x1bab,0x1bd8,0x1bf6,0x1c09,0x1c22,0x1c5b,0x1c6a,0x1c8a,0x1cac,0x1cce,0x1ce5,0x1cfc,0x1d29,0x1d42,0x1d5b, +0x1d8c,0x1db6,0x1dd1,0x1de4,0x1e03,0x1e0c,0x1e1f,0x1e3d,0x1e5b,0x1e6e,0x1e85,0x1e9a,0x1ecf,0x1ef3,0x1f08,0x1f17, +0x1f2a,0x1f4e,0x1f57,0x1f7b,0x1f92,0x1fa5,0x1fb4,0x1fbf,0x1fe0,0x1ff8,0x2007,0x2016,0x2025,0x203c,0x2051,0x2066, +0x209f,0x20b2,0x20ce,0x20d9,0x20e6,0x2114,0x2138,0x215b,0x216e,0x2190,0x21a3,0x21be,0x21e1,0x2204,0x2229,0x223a, +0x2269,0x2296,0x22ad,0x22c8,0x22d7,0x2302,0x233a,0x2374,0x23a2,0x23b3,0x23c0,0x23e4,0x23f3,0x240f,0x2429,0x2446, +0x247e,0x2493,0x24c0,0x24df,0x250d,0x252d,0x2561,0x2570,0x259a,0x25bd,0x25e8,0x25f3,0x2604,0x261f,0x2643,0x2650, +0x2665,0x268c,0x26b7,0x26ee,0x2701,0x2712,0x2742,0x2753,0x2762,0x2777,0x2795,0x27a8,0x27bb,0x27d2,0x27ef,0x27fa, +0x2803,0x2825,0x283a,0x285f,0x2876,0x289f,0x28ba,0x28cf,0x28e8,0x2909,0x293e,0x294f,0x2980,0x29a4,0x29b5,0x29ce, +0x29d9,0x2a06,0x2a28,0x2a56,0x2a89,0x2a98,0x2aa9,0x2ac6,0x2b08,0x2b2f,0x2b3c,0x2b51,0x2b75,0x2b9b,0x2bd4,0x2be5, +0x2c09,0x2c14,0x2c21,0x2c30,0x2c55,0x2c83,0x2c9f,0x2cbc,0x2cc9,0x2cda,0x2cf8,0x2d1b,0x2d38,0x2d45,0x2d65,0x2d82, +0x2da3,0x2dcc,0x2ddd,0x2dfc,0x2e15,0x2e2e,0x2e3f,0x2e88,0x2e99,0x2eb2,0x2ee1,0x2f0e,0x2f33,0x2f75,0x2f91,0x2fa0, +0x2fb7,0x2fe5,0x2ffe,0x3027,0x3041,0x307c,0x309a,0x30a9,0x30c9,0x30e4,0x3108,0x3124,0x3142,0x3160,0x3177,0x3186, +0x3191,0x31ce,0x31e1,0x320b,0x322b,0x3259,0x327d,0x32a5,0x32ca,0x32d5,0x32ee,0x1fe5,1,0,0x12,0x3352, +0x3362,0x3375,0x3385,0x3395,0x33a4,0x33b4,0x33c6,0x33d9,0x33eb,0x33fb,0x340b,0x341a,0x3429,0x3439,0x3446,0x3455, +0x3469,0x20a3,1,0,6,0x348e,0x3499,0x34a6,0x34b3,0x34c0,0x34cb,0x20e7,1,0,0x1e,0x34e8, +0x34f7,0x350c,0x3521,0x3536,0x354a,0x355b,0x356f,0x3582,0x3593,0x35ac,0x35be,0x35cf,0x35e3,0x35f6,0x360e,0x3620, +0x362b,0x363b,0x3649,0x365e,0x3673,0x3689,0x36a3,0x36b9,0x36c9,0x36dd,0x36f1,0x3702,0x371a,0x2312,1,0, +0x68,0x3742,0x3765,0x376e,0x377b,0x3786,0x378f,0x379a,0x37a3,0x37bc,0x37c1,0x37ca,0x37e7,0x37f0,0x37fd,0x3806, +0x382a,0x3831,0x383a,0x384d,0x3858,0x3861,0x386c,0x3885,0x388e,0x389d,0x38a8,0x38b1,0x38bc,0x38c5,0x38cc,0x38d5, +0x38e0,0x38e9,0x3902,0x390b,0x3918,0x3923,0x3934,0x393f,0x3954,0x396b,0x3974,0x397d,0x3996,0x39a1,0x39aa,0x39b3, +0x39ca,0x39e7,0x39f2,0x3a03,0x3a0e,0x3a15,0x3a22,0x3a2f,0x3a5c,0x3a71,0x3a7a,0x3a95,0x3ab8,0x3ad9,0x3afa,0x3b1f, +0x3b46,0x3b67,0x3b8a,0x3bab,0x3bd2,0x3bf3,0x3c18,0x3c37,0x3c56,0x3c75,0x3c92,0x3cb3,0x3cd4,0x3cf7,0x3d1c,0x3d3b, +0x3d5a,0x3d7b,0x3da2,0x3dc7,0x3de6,0x3e07,0x3e2a,0x3e45,0x3e5e,0x3e79,0x3e92,0x3eaf,0x3eca,0x3ee7,0x3f06,0x3f23, +0x3f40,0x3f5f,0x3f7c,0x3f97,0x3fb4,0x3fd1,0x4004,0x402b,0x403e,0x2675,1,0,6,0x406c,0x407b,0x408b, +0x409b,0x40ab,0x40bc,0x26d3,1,0,0x30,0x40da,0x40e6,0x40f4,0x4103,0x4112,0x4122,0x4133,0x4147,0x415c, +0x4172,0x4185,0x4199,0x41a9,0x41b2,0x41bd,0x41cd,0x41e9,0x41fb,0x4209,0x4218,0x4224,0x4239,0x424d,0x4260,0x426e, +0x4282,0x4290,0x429a,0x42ac,0x42b8,0x42c6,0x42d6,0x42dd,0x42e4,0x42eb,0x42f2,0x42f9,0x430f,0x4330,0x870,0x4342, +0x434d,0x435c,0x4365,0x4370,0x4383,0x4394,0x43a5,0x2963,1,0,4,0x43c1,0x43cc,0x43d8,0x43e2,0x2989, +1,0,0xc8,0x43f9,0x4406,0x441b,0x4428,0x4437,0x4445,0x4454,0x4463,0x4475,0x4484,0x4492,0x44a3,0x44b2, +0x44c1,0x44ce,0x44da,0x44e9,0x44f8,0x4502,0x450f,0x451c,0x452b,0x4539,0x4548,0x4554,0x455e,0x456a,0x457a,0x458a, +0x4598,0x45a4,0x45b5,0x45c1,0x45cd,0x45db,0x45e8,0x45f4,0x4601,0xea4,0x460e,0x461c,0x4636,0x463f,0x464d,0x465b, +0x4667,0x4676,0x4684,0x4692,0x469e,0x46ad,0x46bb,0x46c9,0x46d6,0x46e5,0x4700,0x470f,0x4720,0x4731,0x4744,0x4756, +0x4765,0x4777,0x4786,0x4792,0x479d,0x1fb4,0x47aa,0x47b5,0x47c0,0x47cb,0x47d6,0x47f1,0x47fc,0x4807,0x4812,0x4825, +0x4839,0x4844,0x4853,0x4862,0x486d,0x4878,0x4885,0x4894,0x48a2,0x48ad,0x48c8,0x48d2,0x48e3,0x48f4,0x4903,0x4914, +0x491f,0x492a,0x4935,0x4940,0x494b,0x4956,0x4961,0x496b,0x4976,0x4986,0x4991,0x499f,0x49ac,0x49b7,0x49c6,0x49d3, +0x49e0,0x49ef,0x49fc,0x4a0d,0x4a1f,0x4a2f,0x4a3a,0x4a4d,0x4a64,0x4a72,0x4a7f,0x4a8a,0x4a97,0x4aa8,0x4ac4,0x4ada, +0x4ae5,0x4b02,0x4b12,0x4b21,0x4b2c,0x4b37,0x20ce,0x4b43,0x4b4e,0x4b66,0x4b76,0x4b85,0x4b93,0x4ba1,0x4bac,0x4bb7, +0x4bcb,0x4be2,0x4bfa,0x4c0a,0x4c1a,0x4c2a,0x4c3c,0x4c47,0x4c52,0x4c5c,0x4c68,0x4c76,0x4c89,0x4c95,0x4ca2,0x4cad, +0x4cc9,0x4cd6,0x4ce4,0x4cfd,0x29ce,0x4d0c,0x27ef,0x4d19,0x4d27,0x4d39,0x4d47,0x4d53,0x4d63,0x2c09,0x4d71,0x4d7d, +0x4d88,0x4d93,0x4d9e,0x4db2,0x4dc0,0x4dd7,0x4de3,0x4df7,0x4e05,0x4e17,0x4e2d,0x4e3b,0x4e4d,0x4e5b,0x4e78,0x4e8a, +0x4e97,0x4ea8,0x4eba,0x4ed4,0x4ee1,0x4ef4,0x4f05,0x3186,0x4f12,0x32ca,0x4f21,0x33e3,1,0,6,0x4f4d, +0x4f60,0x4f70,0x4f7e,0x4f8f,0x4f9f,0x343f,0x12,0,1,0x4fc9,0x4fcf,0x344c,0x12,0,1,0x4fc9, +0x4fcf,0x3459,1,0,3,0x4fc9,0x4fcf,0x5008,0x346f,1,0,3,0x4fc9,0x4fcf,0x5008,0x3485, +1,0,0x12,0x5092,0x509c,0x50a8,0x50af,0x50ba,0x50bf,0x50c6,0x50cd,0x50d6,0x50db,0x50e0,0x50f0,0x870, +0x4342,0x50fc,0x434d,0x510c,0x435c,0x352e,1,0,0xf,0x5092,0x5133,0x513d,0x5147,0x5152,0x4218,0x515c, +0x5168,0x5170,0x5177,0x5181,0x50a8,0x50af,0x50bf,0x518b,0x35b5,1,0,0x17,0x5092,0x51a8,0x5147,0x51b4, +0x51c1,0x51cf,0x4218,0x51da,0x50a8,0x51eb,0x50bf,0x51fa,0x5208,0x870,0x4330,0x5214,0x5225,0x4342,0x50fc,0x434d, +0x510c,0x435c,0x5236,0x36d2,1,0,3,0x5269,0x5271,0x5279,0x36eb,1,0,0x10,0x52a2,0x52a9, +0x52b8,0x52d9,0x52fc,0x5307,0x5326,0x533d,0x534a,0x5353,0x5372,0x53a5,0x53c0,0x53ef,0x540c,0x5431,0x3784,1, +0,0x24,0x5480,0x548d,0x54a0,0x54ad,0x54da,0x54ff,0x5514,0x5533,0x5554,0x5581,0x55ba,0x55dd,0x5600,0x562d, +0x5662,0x5689,0x56b2,0x56e9,0x5718,0x5739,0x575e,0x576d,0x5790,0x57a7,0x57b4,0x57c3,0x57e0,0x57f9,0x581c,0x5841, +0x585a,0x586f,0x587e,0x588f,0x589c,0x58bd,0x3954,1,0,4,0x58fb,0x5906,0x591e,0x5936,0x3990,0x36, +1,2,4,8,0xe,0x10,0x20,0x3e,0x40,0x80,0x100,0x1c0,0x200,0x400,0x800,0xe00, +0x1000,0x2000,0x4000,0x7000,0x8000,0x10000,0x20000,0x40000,0x78001,0x80000,0x100000,0x200000,0x400000,0x800000,0x1000000,0x2000000, +0x4000000,0x8000000,0xf000000,0x10000000,0x20000000,0x30f80000,0x34e8,0x34f7,0x350c,0x3521,0x596f,0x3536,0x354a,0x5965,0x355b,0x356f, +0x3582,0x5980,0x3593,0x35ac,0x35be,0x5997,0x35cf,0x35e3,0x35f6,0x59c0,0x360e,0x3620,0x362b,0x363b,0x595c,0x3649, +0x365e,0x3673,0x3689,0x36a3,0x36b9,0x36c9,0x36dd,0x36f1,0x59b6,0x3702,0x371a,0x59a1 }; -const uint8_t PropNameData::bytesTries[14992]={ -0,0x15,0x6d,0xc3,0x78,0x73,0xc2,0x12,0x76,0x7a,0x76,0x6a,0x77,0xa2,0x52,0x78, +const uint8_t PropNameData::bytesTries[15527]={ +0,0x15,0x6d,0xc3,0xc7,0x73,0xc2,0x12,0x76,0x7a,0x76,0x6a,0x77,0xa2,0x52,0x78, 1,0x64,0x50,0x69,0x10,0x64,1,0x63,0x30,0x73,0x62,0x13,0x74,0x61,0x72,0x74, 0x63,0x60,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x61,0x13,0x69,0x67,0x69,0x74, 0x81,3,0x61,0x2e,0x65,0x4c,0x6f,0xc3,0x18,0x73,0x69,0x1e,0x72,0x69,0x61,0x74, @@ -139,248 +140,263 @@ const uint8_t PropNameData::bytesTries[14992]={ 0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x11,0xd8,0x40,0xa,0x11,0x63, 0x63,0xc3,0x11,0x11,0x72,0x6d,0x58,0x1e,0x69,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63, 0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x59,0x1d,0x74,0x6c,0x65,0x63,0x61,0x73,0x65, -0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xa,0x6d,0x70,0x6e,0x76,0x70,0xa2, -0xf1,0x71,0xa4,0x43,0x72,2,0x61,0x28,0x65,0x32,0x69,0x9d,0x14,0x64,0x69,0x63, -0x61,0x6c,0x55,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,0x69,0x63,0x61, -0x74,0x6f,0x72,0x9d,0x12,0x61,0x74,0x68,0x4f,6,0x6f,0x39,0x6f,0x32,0x74,0xc3, -9,0x75,0x54,0x76,0xd9,0x30,0,0x12,0x6e,0x63,0x68,0x1f,0x61,0x72,0x61,0x63, -0x74,0x65,0x72,0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x51,0x14,0x6d,0x65, -0x72,0x69,0x63,1,0x74,0x32,0x76,0x13,0x61,0x6c,0x75,0x65,0xd9,0x30,0,0x12, -0x79,0x70,0x65,0xc3,9,0x61,0xa2,0x77,0x63,0xa2,0x82,0x66,2,0x63,0x98,0x64, -0xa2,0x53,0x6b,1,0x63,0x56,0x64,1,0x69,0x42,0x71,1,0x63,0xc3,0xd,0x75, -0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xd,0x13,0x6e,0x65,0x72,0x74, -0x6d,1,0x69,0x42,0x71,1,0x63,0xc3,0xf,0x75,0x17,0x69,0x63,0x6b,0x63,0x68, -0x65,0x63,0x6b,0xc3,0xf,0x13,0x6e,0x65,0x72,0x74,0x71,1,0x69,0x42,0x71,1, -0x63,0xc3,0xe,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xe,0x13, -0x6e,0x65,0x72,0x74,0x6f,1,0x69,0x42,0x71,1,0x63,0xc3,0xc,0x75,0x17,0x69, -0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xc,0x13,0x6e,0x65,0x72,0x74,0x6b,0xd8, -0x40,5,1,0x31,0xd9,0x40,0xb,0x6d,0x10,0x65,0xd9,0x40,5,0x12,0x68,0x61, -0x72,0x51,2,0x61,0x6c,0x63,0xa2,0x4c,0x72,1,0x65,0x2a,0x69,0x11,0x6e,0x74, -0x7f,0x16,0x70,0x65,0x6e,0x64,0x65,0x64,0x63,0x1f,0x6f,0x6e,0x63,0x61,0x74,0x65, -0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x9f,0x10,0x74,2,0x73,0x2c, -0x74,0x30,0x77,0x10,0x73,0x77,0x11,0x79,0x6e,0x75,0x12,0x65,0x72,0x6e,1,0x73, -0x38,0x77,0x18,0x68,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x77,0x14,0x79,0x6e, -0x74,0x61,0x78,0x75,0x10,0x6d,0x9f,1,0x6d,0x3c,0x75,0x1a,0x6f,0x74,0x61,0x74, -0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x53,0x12,0x61,0x72,0x6b,0x53,0x66,0xc1,0xf8, -0x69,0xc1,0x3c,0x69,0xa2,0x6f,0x6a,0xa4,9,0x6c,4,0x62,0xc3,8,0x63,0x8c, -0x65,0x98,0x69,0xa2,0x56,0x6f,2,0x65,0x4b,0x67,0x4c,0x77,0x11,0x65,0x72,0x4c, -0x13,0x63,0x61,0x73,0x65,0x4c,0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40, -4,0x11,0x69,0x63,0x1f,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x65,0x78,0x63,0x65, -0x70,0x74,0x69,0x6f,0x6e,0x4b,0xd8,0x40,4,0x11,0x63,0x63,0xc3,0x10,0x18,0x61, -0x64,0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69, -0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x10,0x16,0x6e,0x65,0x62,0x72, -0x65,0x61,0x6b,0xc3,8,2,0x64,0x4a,0x6e,0xa2,0x5b,0x73,1,0x63,0xd9,0x40, -3,0x6f,0x16,0x63,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0xd9,0x40,3,2,0x63,0x80, -0x65,0x90,0x73,0x40,1,0x62,0x52,0x74,0x46,1,0x61,0x40,0x72,0x1c,0x69,0x6e, -0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x47,0x11,0x72,0x74,0x41, -0x44,0x1c,0x69,0x6e,0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x45, -0x3e,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3f,0x10,0x6f,0x42,0x16,0x67,0x72, -0x61,0x70,0x68,0x69,0x63,0x43,2,0x64,0x2e,0x70,0x86,0x73,0x10,0x63,0xc3,0x17, -0x11,0x69,0x63,1,0x70,0x46,0x73,0x1e,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x63, -0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x17,0x10,0x6f,0x1f,0x73,0x69,0x74,0x69, -0x6f,0x6e,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x16,0x10,0x63, -0xc3,0x16,2,0x67,0xc3,6,0x6f,0x26,0x74,0xc3,7,0x11,0x69,0x6e,1,0x63, -0x4a,0x69,0x11,0x6e,0x67,1,0x67,0x2e,0x74,0x12,0x79,0x70,0x65,0xc3,7,0x13, -0x72,0x6f,0x75,0x70,0xc3,6,0x48,0x15,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x49,0x66, -0x86,0x67,0xa2,0x4a,0x68,3,0x61,0x36,0x65,0x58,0x73,0x68,0x79,0x13,0x70,0x68, -0x65,0x6e,0x3d,0x1f,0x6e,0x67,0x75,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65, -0x74,0x79,0x70,0x65,0xc3,0xb,0x10,0x78,0x3a,0x14,0x64,0x69,0x67,0x69,0x74,0x3b, -0x10,0x74,0xc3,0xb,0x16,0x75,0x6c,0x6c,0x63,0x6f,0x6d,0x70,0x1f,0x6f,0x73,0x69, -0x74,0x69,0x6f,0x6e,0x65,0x78,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x33,2,0x63, -0xa2,0x44,0x65,0xa2,0x4b,0x72,3,0x61,0x34,0x62,0x84,0x65,0x8a,0x6c,0x12,0x69, -0x6e,0x6b,0x39,0x11,0x70,0x68,0x7c,0x12,0x65,0x6d,0x65,3,0x62,0x5e,0x63,0x30, -0x65,0x48,0x6c,0x12,0x69,0x6e,0x6b,0x39,0x1a,0x6c,0x75,0x73,0x74,0x65,0x72,0x62, -0x72,0x65,0x61,0x6b,0xc3,0x12,0x14,0x78,0x74,0x65,0x6e,0x64,0x37,0x12,0x61,0x73, -0x65,0x35,0x11,0x78,0x74,0x37,0xc2,5,1,0x62,0xc3,0x12,0x6d,0xd9,0x20,0, -0x1c,0x6e,0x65,0x72,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc2,5, -0x13,0x6d,0x61,0x73,0x6b,0xd9,0x20,0,0x61,0xa2,0x90,0x62,0xa2,0xbe,0x63,0xa4, -0x30,0x64,0xa4,0xfd,0x65,5,0x6d,0x63,0x6d,0x6e,0x70,0xa2,0x59,0x78,0x10,0x74, -0x30,1,0x65,0x2c,0x70,0x12,0x69,0x63,0x74,0xa1,0x12,0x6e,0x64,0x65,1,0x64, -0x24,0x72,0x31,0x1b,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63, -0xa1,0x10,0x6f,1,0x64,0x97,0x6a,0x10,0x69,0x92,2,0x63,0x40,0x6d,0x50,0x70, -0x1a,0x72,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x95,0x17,0x6f,0x6d, -0x70,0x6f,0x6e,0x65,0x6e,0x74,0x9b,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x96, -0x13,0x62,0x61,0x73,0x65,0x99,0x12,0x72,0x65,0x73,0x95,0x61,0x30,0x62,0x4e,0x63, -0x12,0x6f,0x6d,0x70,0x9b,0xc2,4,0x1b,0x73,0x74,0x61,0x73,0x69,0x61,0x6e,0x77, -0x69,0x64,0x74,0x68,0xc3,4,0x12,0x61,0x73,0x65,0x99,3,0x67,0x44,0x68,0x4a, -0x6c,0x4e,0x73,0x1a,0x63,0x69,0x69,0x68,0x65,0x78,0x64,0x69,0x67,0x69,0x74,0x23, -0x10,0x65,0xd9,0x40,0,0x11,0x65,0x78,0x23,1,0x6e,0x38,0x70,0x11,0x68,0x61, -0x20,0x14,0x62,0x65,0x74,0x69,0x63,0x21,0x11,0x75,0x6d,0x79,4,0x63,0xc3,0, -0x69,0x3e,0x6c,0xa2,0x57,0x6d,0xa2,0x64,0x70,1,0x62,0xd9,0x40,0xd,0x74,0xc3, -0x15,0x11,0x64,0x69,2,0x63,0x54,0x6d,0x74,0x70,0x1b,0x61,0x69,0x72,0x65,0x64, -0x62,0x72,0x61,0x63,0x6b,0x65,0x74,0xd8,0x40,0xd,0x13,0x74,0x79,0x70,0x65,0xc3, -0x15,0x24,1,0x6c,0x30,0x6f,0x14,0x6e,0x74,0x72,0x6f,0x6c,0x25,0x12,0x61,0x73, -0x73,0xc3,0,0x26,0x14,0x69,0x72,0x72,0x6f,0x72,1,0x65,0x38,0x69,0x16,0x6e, -0x67,0x67,0x6c,0x79,0x70,0x68,0xd9,0x40,1,0x10,0x64,0x27,2,0x61,0x32,0x6b, -0xc3,1,0x6f,0x11,0x63,0x6b,0xc3,1,0x11,0x6e,0x6b,0x7b,0x10,0x67,0xd9,0x40, -1,6,0x68,0x7c,0x68,0x54,0x69,0x85,0x6f,0xa2,0x6f,0x77,4,0x63,0x30,0x6b, -0x36,0x6c,0x87,0x74,0x8b,0x75,0x89,1,0x66,0x8d,0x6d,0x8f,0x11,0x63,0x66,0x91, -0x18,0x61,0x6e,0x67,0x65,0x73,0x77,0x68,0x65,0x6e,4,0x63,0x44,0x6c,0x6c,0x6e, -0x7e,0x74,0x98,0x75,0x18,0x70,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x89,0x12, -0x61,0x73,0x65,1,0x66,0x30,0x6d,0x14,0x61,0x70,0x70,0x65,0x64,0x8f,0x14,0x6f, -0x6c,0x64,0x65,0x64,0x8d,0x18,0x6f,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x64,0x87, -0x1c,0x66,0x6b,0x63,0x63,0x61,0x73,0x65,0x66,0x6f,0x6c,0x64,0x65,0x64,0x91,0x18, -0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x64,0x8b,0x13,0x6d,0x70,0x65,0x78,0x33, -0x61,0x2e,0x63,0xa2,0x48,0x66,0xd9,0x40,2,1,0x6e,0x72,0x73,0x10,0x65,3, -0x64,0x83,0x66,0x3a,0x69,0x4a,0x73,0x17,0x65,0x6e,0x73,0x69,0x74,0x69,0x76,0x65, -0x65,0x15,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,2,0x17,0x67,0x6e,0x6f,0x72, -0x61,0x62,0x6c,0x65,0x85,0x13,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d, -0x62,0x69,0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,2,0x10,0x63,0xc3, -2,3,0x61,0x30,0x65,0x34,0x69,0xa2,0x41,0x74,0xc3,3,0x11,0x73,0x68,0x29, -2,0x63,0x3a,0x66,0x58,0x70,0x2c,0x16,0x72,0x65,0x63,0x61,0x74,0x65,0x64,0x2d, -0x1d,0x6f,0x6d,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x74,0x79,0x70,0x65,0xc3, -3,0x15,0x61,0x75,0x6c,0x74,0x69,0x67,0x1f,0x6e,0x6f,0x72,0x61,0x62,0x6c,0x65, -0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x2b,0x2a,0x10,0x61,0x2e,0x15,0x63, -0x72,0x69,0x74,0x69,0x63,0x2f,3,0x66,0x34,0x6e,0x3e,0x74,0x42,0x79,0x22,0x11, -0x65,0x73,0x23,0x20,0x13,0x61,0x6c,0x73,0x65,0x21,0x20,0x10,0x6f,0x21,0x22,0x12, -0x72,0x75,0x65,0x23,0xb,0x6b,0x5b,0x6f,0x23,0x6f,0x3c,0x72,0x4c,0x76,1,0x69, -0x24,0x72,0x33,0x13,0x72,0x61,0x6d,0x61,0x33,0x10,0x76,0x22,0x14,0x65,0x72,0x6c, -0x61,0x79,0x23,0xa2,0xe2,0x13,0x69,0x67,0x68,0x74,0xa3,0xe2,0x6b,0x58,0x6c,0x74, -0x6e,3,0x6b,0x2f,0x6f,0x30,0x72,0x21,0x75,0x12,0x6b,0x74,0x61,0x2f,0x19,0x74, -0x72,0x65,0x6f,0x72,0x64,0x65,0x72,0x65,0x64,0x21,1,0x61,0x24,0x76,0x31,0x18, -0x6e,0x61,0x76,0x6f,0x69,0x63,0x69,0x6e,0x67,0x31,0xa2,0xe0,0x12,0x65,0x66,0x74, -0xa3,0xe0,0x64,0x45,0x64,0x4e,0x68,0x88,0x69,1,0x6f,0x26,0x73,0xa3,0xf0,0x1a, -0x74,0x61,0x73,0x75,0x62,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xf0,2,0x61,0xa3, -0xea,0x62,0xa3,0xe9,0x6f,0x13,0x75,0x62,0x6c,0x65,1,0x61,0x30,0x62,0x13,0x65, -0x6c,0x6f,0x77,0xa3,0xe9,0x13,0x62,0x6f,0x76,0x65,0xa3,0xea,0x12,0x61,0x6e,0x72, -0x2c,0x15,0x65,0x61,0x64,0x69,0x6e,0x67,0x2d,0x61,0xa2,0x7b,0x62,0xa2,0xd4,0x63, -0x11,0x63,0x63,4,0x31,0x3c,0x32,0xa2,0x42,0x33,0xa2,0x56,0x38,0xa2,0x64,0x39, -0x10,0x31,0xa3,0x5b,9,0x35,0xa,0x35,0x3f,0x36,0x41,0x37,0x43,0x38,0x45,0x39, -0x47,0x30,0x30,0x31,0x3c,0x32,0x42,0x33,0x4e,0x34,0x3d,0x34,1,0x33,0xa3,0x67, -0x37,0xa3,0x6b,0x36,0x10,0x38,0xa3,0x76,0x38,1,0x32,0xa3,0x7a,0x39,0xa3,0x81, -0x3a,2,0x30,0xa3,0x82,0x32,0xa3,0x84,0x33,0xa3,0x85,9,0x35,0xa,0x35,0x53, -0x36,0x55,0x37,0x57,0x38,0x59,0x39,0x5b,0x30,0x49,0x31,0x4b,0x32,0x4d,0x33,0x4f, -0x34,0x51,6,0x33,8,0x33,0x63,0x34,0x65,0x35,0x67,0x36,0x69,0x30,0x5d,0x31, -0x5f,0x32,0x61,0x10,0x34,0xa3,0x54,0xa2,0xe6,3,0x62,0xa0,0x6c,0xa3,0xe4,0x72, -0xa3,0xe8,0x74,2,0x61,0x74,0x62,0x7c,0x74,0x14,0x61,0x63,0x68,0x65,0x64,1, -0x61,0x3e,0x62,0x13,0x65,0x6c,0x6f,0x77,0xa2,0xca,0x13,0x6c,0x65,0x66,0x74,0xa3, -0xc8,0x13,0x62,0x6f,0x76,0x65,0xa2,0xd6,0x14,0x72,0x69,0x67,0x68,0x74,0xa3,0xd8, -0xa2,0xd6,0x10,0x72,0xa3,0xd8,0xa2,0xca,0x10,0x6c,0xa3,0xc8,0x12,0x6f,0x76,0x65, -0xa2,0xe6,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xe8,0x12,0x65,0x66, -0x74,0xa3,0xe4,0xa2,0xdc,2,0x65,0x2c,0x6c,0xa3,0xda,0x72,0xa3,0xde,0x12,0x6c, -0x6f,0x77,0xa2,0xdc,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3,0xde,0x12, -0x65,0x66,0x74,0xa3,0xda,0xb,0x6e,0xc0,0xca,0x72,0x5f,0x72,0x46,0x73,0xa2,0x48, -0x77,1,0x68,0x24,0x73,0x33,0x17,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x33, -0x22,1,0x69,0x30,0x6c,2,0x65,0x3d,0x69,0x4b,0x6f,0x3f,0x18,0x67,0x68,0x74, -0x74,0x6f,0x6c,0x65,0x66,0x74,0x22,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65, -0x72,0x72,0x69,0x64,0x65,0x3f,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x3d, -0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4b,0x30,0x1e,0x65,0x67,0x6d,0x65,0x6e,0x74, -0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x31,0x6e,0xa2,0x41,0x6f,0xa2,0x53, -0x70,2,0x61,0x66,0x64,0x86,0x6f,0x1b,0x70,0x64,0x69,0x72,0x65,0x63,0x74,0x69, -0x6f,0x6e,0x61,0x6c,1,0x66,0x32,0x69,0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4d, -0x14,0x6f,0x72,0x6d,0x61,0x74,0x41,0x1f,0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73, -0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x2f,1,0x66,0x41,0x69,0x4d,1,0x6f, -0x28,0x73,0x10,0x6d,0x43,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,0x67,0x6d,0x61, -0x72,0x6b,0x43,1,0x6e,0x35,0x74,0x19,0x68,0x65,0x72,0x6e,0x65,0x75,0x74,0x72, -0x61,0x6c,0x35,0x65,0x88,0x65,0x98,0x66,0xa2,0x6a,0x6c,0x20,1,0x65,0x30,0x72, -2,0x65,0x37,0x69,0x49,0x6f,0x39,0x18,0x66,0x74,0x74,0x6f,0x72,0x69,0x67,0x68, -0x74,0x20,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65,0x72,0x72,0x69,0x64,0x65, -0x39,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x37,0x15,0x73,0x6f,0x6c,0x61, -0x74,0x65,0x49,3,0x6e,0x25,0x73,0x27,0x74,0x29,0x75,0x15,0x72,0x6f,0x70,0x65, -0x61,0x6e,2,0x6e,0x3c,0x73,0x46,0x74,0x18,0x65,0x72,0x6d,0x69,0x6e,0x61,0x74, -0x6f,0x72,0x29,0x14,0x75,0x6d,0x62,0x65,0x72,0x25,0x17,0x65,0x70,0x61,0x72,0x61, -0x74,0x6f,0x72,0x27,1,0x69,0x28,0x73,0x10,0x69,0x47,0x1f,0x72,0x73,0x74,0x73, -0x74,0x72,0x6f,0x6e,0x67,0x69,0x73,0x6f,0x6c,0x61,0x74,0x65,0x47,0x61,0x4e,0x62, -0x84,0x63,1,0x6f,0x24,0x73,0x2d,0x1c,0x6d,0x6d,0x6f,0x6e,0x73,0x65,0x70,0x61, -0x72,0x61,0x74,0x6f,0x72,0x2d,2,0x6c,0x3b,0x6e,0x2b,0x72,0x13,0x61,0x62,0x69, -0x63,1,0x6c,0x30,0x6e,0x14,0x75,0x6d,0x62,0x65,0x72,0x2b,0x14,0x65,0x74,0x74, -0x65,0x72,0x3b,0x2e,1,0x6e,0x45,0x6f,0x1c,0x75,0x6e,0x64,0x61,0x72,0x79,0x6e, -0x65,0x75,0x74,0x72,0x61,0x6c,0x45,0,0x16,0x6d,0xc8,0xc8,0x74,0xc1,0xee,0x77, -0x6a,0x77,0x48,0x79,0x70,0x7a,0x1d,0x61,0x6e,0x61,0x62,0x61,0x7a,0x61,0x72,0x73, -0x71,0x75,0x61,0x72,0x65,0xa5,0x18,0x10,0x61,1,0x6e,0x36,0x72,0x16,0x61,0x6e, -0x67,0x63,0x69,0x74,0x69,0xa3,0xfc,0x12,0x63,0x68,0x6f,0xa5,0x2c,1,0x65,0x88, -0x69,2,0x6a,0x3c,0x72,0x68,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73, -0xa3,0x48,0x12,0x69,0x6e,0x67,0xa2,0x74,0x1e,0x68,0x65,0x78,0x61,0x67,0x72,0x61, -0x6d,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x74,0x16,0x61,0x64,0x69,0x63,0x61, -0x6c,0x73,0xa3,0x49,0x13,0x7a,0x69,0x64,0x69,0xa5,0x34,0x74,0xa2,0x59,0x75,0xa4, -0x35,0x76,2,0x61,0x36,0x65,0x7a,0x73,0xa2,0x6c,0x12,0x73,0x75,0x70,0xa3,0x7d, -1,0x69,0xa3,0x9f,0x72,0x1e,0x69,0x61,0x74,0x69,0x6f,0x6e,0x73,0x65,0x6c,0x65, -0x63,0x74,0x6f,0x72,0x73,0xa2,0x6c,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65, -0x6e,0x74,0xa3,0x7d,1,0x64,0x3c,0x72,0x19,0x74,0x69,0x63,0x61,0x6c,0x66,0x6f, -0x72,0x6d,0x73,0xa3,0x91,0x14,0x69,0x63,0x65,0x78,0x74,0xa2,0xaf,0x16,0x65,0x6e, -0x73,0x69,0x6f,0x6e,0x73,0xa3,0xaf,4,0x61,0x68,0x65,0xa2,0xad,0x68,0xa2,0xb0, -0x69,0xa2,0xb8,0x72,0x1c,0x61,0x6e,0x73,0x70,0x6f,0x72,0x74,0x61,0x6e,0x64,0x6d, -0x61,0x70,0xa2,0xcf,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xcf,4,0x67, -0x7e,0x69,0xa2,0x41,0x6b,0xa2,0x6a,0x6d,0xa2,0x6c,0x6e,0x12,0x67,0x75,0x74,0xa4, -0x10,1,0x63,0x40,0x73,0x11,0x75,0x70,0xa4,0x33,0x16,0x70,0x6c,0x65,0x6d,0x65, -0x6e,0x74,0xa5,0x33,0x18,0x6f,0x6d,0x70,0x6f,0x6e,0x65,0x6e,0x74,0x73,0xa5,0x11, -2,0x61,0x2a,0x62,0x32,0x73,0xa3,0x60,0x12,0x6c,0x6f,0x67,0xa3,0x62,0x13,0x61, -0x6e,0x77,0x61,0xa3,0x65,3,0x6c,0x52,0x74,0x56,0x76,0x5e,0x78,0x16,0x75,0x61, -0x6e,0x6a,0x69,0x6e,0x67,0xa2,0x7c,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3, -0x7c,0x10,0x65,0xa3,0x70,0x12,0x68,0x61,0x6d,0xa3,0xae,0x12,0x69,0x65,0x74,0xa3, -0xb7,0x11,0x72,0x69,0xa3,0xdc,0x11,0x69,0x6c,0x48,0x12,0x73,0x75,0x70,0xa4,0x2b, -0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x2b,0x13,0x6c,0x75,0x67,0x75,0x4b, -0x10,0x61,1,0x61,0x24,0x69,0x53,0x11,0x6e,0x61,0x3d,2,0x62,0x34,0x66,0x3c, -0x72,0x13,0x68,0x75,0x74,0x61,0xa3,0xfb,0x13,0x65,0x74,0x61,0x6e,0x57,0x14,0x69, -0x6e,0x61,0x67,0x68,0xa3,0x90,2,0x63,0x82,0x67,0x92,0x6e,0x1f,0x69,0x66,0x69, -0x65,0x64,0x63,0x61,0x6e,0x61,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x1f,0x72,0x69, -0x67,0x69,0x6e,0x61,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x73,0x62,0x17, -0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,0xa3,0xad,0x11,0x61,0x73,0x62,0x12,0x65, -0x78,0x74,0xa3,0xad,0x15,0x61,0x72,0x69,0x74,0x69,0x63,0xa3,0x78,0x70,0xc3,0x4b, -0x70,0xa6,0x61,0x72,0xa8,0x1d,0x73,7,0x6f,0xc1,0xbe,0x6f,0xa2,0x69,0x70,0xa2, -0x85,0x75,0xa2,0xa4,0x79,2,0x6c,0x50,0x6d,0x62,0x72,0x12,0x69,0x61,0x63,0x3a, -0x12,0x73,0x75,0x70,0xa4,0x17,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x17, -0x17,0x6f,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,0xa3,0x8f,0x13,0x62,0x6f,0x6c,0x73, -1,0x61,0x4c,0x66,0x10,0x6f,0x1f,0x72,0x6c,0x65,0x67,0x61,0x63,0x79,0x63,0x6f, -0x6d,0x70,0x75,0x74,0x69,0x6e,0x67,0xa5,0x32,0x1f,0x6e,0x64,0x70,0x69,0x63,0x74, -0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x78,0x74,1,0x61,0xa5,0x2a,0x65,0x14, -0x6e,0x64,0x65,0x64,0x61,0xa5,0x2a,2,0x67,0x34,0x72,0x3e,0x79,0x13,0x6f,0x6d, -0x62,0x6f,0xa5,0x16,0x13,0x64,0x69,0x61,0x6e,0xa5,0x23,0x17,0x61,0x73,0x6f,0x6d, -0x70,0x65,0x6e,0x67,0xa3,0xda,1,0x61,0x32,0x65,0x14,0x63,0x69,0x61,0x6c,0x73, -0xa3,0x56,0x12,0x63,0x69,0x6e,0x1f,0x67,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72, -0x6c,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,2,0x6e,0x48,0x70,0x76,0x74,0x1d,0x74, -0x6f,0x6e,0x73,0x69,0x67,0x6e,0x77,0x72,0x69,0x74,0x69,0x6e,0x67,0xa5,6,0x15, -0x64,0x61,0x6e,0x65,0x73,0x65,0xa2,0x9b,0x12,0x73,0x75,0x70,0xa2,0xdb,0x16,0x70, -0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xdb,4,0x61,0xa2,0xa8,0x65,0x5c,0x6d,0x9e, -0x70,0xa2,0x4b,0x73,0x13,0x79,0x6d,0x62,0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70, -0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa5,5,0x10,0x72,1,0x61, -0x4e,0x73,0x12,0x63,0x72,0x69,0x1f,0x70,0x74,0x73,0x61,0x6e,0x64,0x73,0x75,0x62, -0x73,0x63,0x72,0x69,0x70,0x74,0x73,0x73,0x14,0x6e,0x64,0x73,0x75,0x62,0x73,0x1b, -0x61,0x74,0x68,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,1,0x6c, -0x40,0x75,1,0x61,0x6e,0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3, -0x8e,0x15,0x65,0x6d,0x65,0x6e,0x74,0x61,1,0x6c,0x50,0x72,0x1e,0x79,0x70,0x72, -0x69,0x76,0x61,0x74,0x65,0x75,0x73,0x65,0x61,0x72,0x65,0x61,1,0x61,0xa3,0x6d, -0x62,0xa3,0x6e,3,0x61,0x5c,0x6d,0x78,0x70,0xa2,0x41,0x73,0x13,0x79,0x6d,0x62, -0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70, -0x68,0x73,0xa5,5,0x14,0x72,0x72,0x6f,0x77,0x73,2,0x61,0xa3,0x67,0x62,0xa3, -0x68,0x63,0xa3,0xfa,0x13,0x61,0x74,0x68,0x65,0x1f,0x6d,0x61,0x74,0x69,0x63,0x61, -0x6c,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73,0xa3,0x6a,0x19,0x75,0x6e,0x63, -0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x8e,0x61,0x88,0x68,0xa2,0x48,0x69,0xa2, -0x71,0x6d,0x12,0x61,0x6c,0x6c,1,0x66,0x46,0x6b,0x15,0x61,0x6e,0x61,0x65,0x78, -0x74,0xa4,0x29,0x15,0x65,0x6e,0x73,0x69,0x6f,0x6e,0xa5,0x29,0x12,0x6f,0x72,0x6d, -1,0x73,0xa3,0x54,0x76,0x16,0x61,0x72,0x69,0x61,0x6e,0x74,0x73,0xa3,0x54,1, -0x6d,0x36,0x75,0x16,0x72,0x61,0x73,0x68,0x74,0x72,0x61,0xa3,0xa1,0x15,0x61,0x72, -0x69,0x74,0x61,0x6e,0xa3,0xac,1,0x61,0x52,0x6f,0x13,0x72,0x74,0x68,0x61,0x1f, -0x6e,0x64,0x66,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73, -0xa3,0xf7,1,0x72,0x2e,0x76,0x12,0x69,0x61,0x6e,0xa3,0x79,0x12,0x61,0x64,0x61, -0xa3,0xd9,1,0x64,0x50,0x6e,0x13,0x68,0x61,0x6c,0x61,0x50,0x1d,0x61,0x72,0x63, -0x68,0x61,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0xf9,0x13,0x64,0x68, -0x61,0x6d,0xa3,0xf8,5,0x72,0x35,0x72,0x44,0x73,0x64,0x75,1,0x61,0xa3,0x4e, -0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x71,0x17,0x69,0x76,0x61,0x74, -0x65,0x75,0x73,0x65,0xa2,0x4e,0x13,0x61,0x72,0x65,0x61,0xa3,0x4e,0x1b,0x61,0x6c, -0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0xf6,0x61,0x40,0x68,0x82, -0x6c,0x19,0x61,0x79,0x69,0x6e,0x67,0x63,0x61,0x72,0x64,0x73,0xa3,0xcc,2,0x68, -0x38,0x6c,0x4a,0x75,0x15,0x63,0x69,0x6e,0x68,0x61,0x75,0xa3,0xf5,0x17,0x61,0x77, -0x68,0x68,0x6d,0x6f,0x6e,0x67,0xa3,0xf3,0x15,0x6d,0x79,0x72,0x65,0x6e,0x65,0xa3, -0xf4,1,0x61,0x8e,0x6f,1,0x65,0x74,0x6e,0x16,0x65,0x74,0x69,0x63,0x65,0x78, -0x74,0xa2,0x72,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3,0x8d,0x15,0x6e,0x73,0x69, -0x6f,0x6e,0x73,0xa2,0x72,0x19,0x73,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74, -0xa3,0x8d,0x15,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x97,1,0x67,0x3e,0x69,0x13, -0x73,0x74,0x6f,0x73,0xa2,0xa6,0x13,0x64,0x69,0x73,0x63,0xa3,0xa6,0x12,0x73,0x70, -0x61,0xa3,0x96,1,0x65,0x5c,0x75,1,0x6d,0x2a,0x6e,0x11,0x69,0x63,0x67,0x10, -0x69,0xa2,0xc0,0x1d,0x6e,0x75,0x6d,0x65,0x72,0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f, -0x6c,0x73,0xa3,0xc0,0x13,0x6a,0x61,0x6e,0x67,0xa3,0xa3,0x6d,0xa2,0xe6,0x6e,0xa8, -0x19,0x6f,6,0x70,0x63,0x70,0x56,0x72,0x8a,0x73,0xa2,0x4c,0x74,0x10,0x74,0x1f, -0x6f,0x6d,0x61,0x6e,0x73,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73, -0xa5,0x28,0x18,0x74,0x69,0x63,0x61,0x6c,0x63,0x68,0x61,0x72,0x1f,0x61,0x63,0x74, -0x65,0x72,0x72,0x65,0x63,0x6f,0x67,0x6e,0x69,0x74,0x69,0x6f,0x6e,0x85,1,0x69, -0x46,0x6e,0x1e,0x61,0x6d,0x65,0x6e,0x74,0x61,0x6c,0x64,0x69,0x6e,0x67,0x62,0x61, -0x74,0x73,0xa3,0xf2,0x11,0x79,0x61,0x47,1,0x61,0x30,0x6d,0x13,0x61,0x6e,0x79, -0x61,0xa3,0x7a,0x11,0x67,0x65,0xa5,0xf,0x63,0xa2,0x71,0x67,0xa2,0x71,0x6c,1, -0x63,0xa2,0x62,0x64,5,0x70,0x38,0x70,0x36,0x73,0x56,0x74,0x14,0x75,0x72,0x6b, -0x69,0x63,0xa3,0xbf,0x11,0x65,0x72,1,0x6d,0x2e,0x73,0x12,0x69,0x61,0x6e,0xa3, -0x8c,0x11,0x69,0x63,0xa3,0xf1,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74,0x68,0x61, -0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0xbb,0x13,0x64,0x69,0x61,0x6e,0xa5,0x22,0x68, +0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,0xa,0x6d,0xa2,0x76,0x6e,0xa2,0x78, +0x70,0xa4,0x3e,0x71,0xa4,0x90,0x72,3,0x61,0x2c,0x65,0x36,0x67,0x54,0x69,0x9d, +0x14,0x64,0x69,0x63,0x61,0x6c,0x55,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e, +0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x9d,0x15,0x69,0x65,0x6d,0x6f,0x6a,0x69,0xa2, +0x47,3,0x66,0x44,0x6d,0x5c,0x74,0x7c,0x7a,0x19,0x77,0x6a,0x73,0x65,0x71,0x75, +0x65,0x6e,0x63,0x65,0xa3,0x46,0x1a,0x6c,0x61,0x67,0x73,0x65,0x71,0x75,0x65,0x6e, +0x63,0x65,0xa3,0x44,0x1e,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x73,0x65,0x71,0x75, +0x65,0x6e,0x63,0x65,0xa3,0x43,0x19,0x61,0x67,0x73,0x65,0x71,0x75,0x65,0x6e,0x63, +0x65,0xa3,0x45,0x12,0x61,0x74,0x68,0x4f,6,0x6f,0x39,0x6f,0x32,0x74,0xc3,9, +0x75,0x54,0x76,0xd9,0x30,0,0x12,0x6e,0x63,0x68,0x1f,0x61,0x72,0x61,0x63,0x74, +0x65,0x72,0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x51,0x14,0x6d,0x65,0x72, +0x69,0x63,1,0x74,0x32,0x76,0x13,0x61,0x6c,0x75,0x65,0xd9,0x30,0,0x12,0x79, +0x70,0x65,0xc3,9,0x61,0xa2,0x77,0x63,0xa2,0x82,0x66,2,0x63,0x98,0x64,0xa2, +0x53,0x6b,1,0x63,0x56,0x64,1,0x69,0x42,0x71,1,0x63,0xc3,0xd,0x75,0x17, +0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xd,0x13,0x6e,0x65,0x72,0x74,0x6d, +1,0x69,0x42,0x71,1,0x63,0xc3,0xf,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,0x65, +0x63,0x6b,0xc3,0xf,0x13,0x6e,0x65,0x72,0x74,0x71,1,0x69,0x42,0x71,1,0x63, +0xc3,0xe,0x75,0x17,0x69,0x63,0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xe,0x13,0x6e, +0x65,0x72,0x74,0x6f,1,0x69,0x42,0x71,1,0x63,0xc3,0xc,0x75,0x17,0x69,0x63, +0x6b,0x63,0x68,0x65,0x63,0x6b,0xc3,0xc,0x13,0x6e,0x65,0x72,0x74,0x6b,0xd8,0x40, +5,1,0x31,0xd9,0x40,0xb,0x6d,0x10,0x65,0xd9,0x40,5,0x12,0x68,0x61,0x72, +0x51,2,0x61,0x6c,0x63,0xa2,0x4c,0x72,1,0x65,0x2a,0x69,0x11,0x6e,0x74,0x7f, +0x16,0x70,0x65,0x6e,0x64,0x65,0x64,0x63,0x1f,0x6f,0x6e,0x63,0x61,0x74,0x65,0x6e, +0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x9f,0x10,0x74,2,0x73,0x2c,0x74, +0x30,0x77,0x10,0x73,0x77,0x11,0x79,0x6e,0x75,0x12,0x65,0x72,0x6e,1,0x73,0x38, +0x77,0x18,0x68,0x69,0x74,0x65,0x73,0x70,0x61,0x63,0x65,0x77,0x14,0x79,0x6e,0x74, +0x61,0x78,0x75,0x10,0x6d,0x9f,1,0x6d,0x3c,0x75,0x1a,0x6f,0x74,0x61,0x74,0x69, +0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x53,0x12,0x61,0x72,0x6b,0x53,0x66,0xc2,0x2e,0x69, +0xc1,0x72,0x69,0xa2,0x6f,0x6a,0xa4,0x3f,0x6c,4,0x62,0xc3,8,0x63,0x8c,0x65, +0x98,0x69,0xa2,0x56,0x6f,2,0x65,0x4b,0x67,0x4c,0x77,0x11,0x65,0x72,0x4c,0x13, +0x63,0x61,0x73,0x65,0x4c,0x16,0x6d,0x61,0x70,0x70,0x69,0x6e,0x67,0xd9,0x40,4, +0x11,0x69,0x63,0x1f,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x65,0x78,0x63,0x65,0x70, +0x74,0x69,0x6f,0x6e,0x4b,0xd8,0x40,4,0x11,0x63,0x63,0xc3,0x10,0x18,0x61,0x64, +0x63,0x61,0x6e,0x6f,0x6e,0x69,0x63,0x1f,0x61,0x6c,0x63,0x6f,0x6d,0x62,0x69,0x6e, +0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3,0x10,0x16,0x6e,0x65,0x62,0x72,0x65, +0x61,0x6b,0xc3,8,2,0x64,0x4a,0x6e,0xa2,0x91,0x73,1,0x63,0xd9,0x40,3, +0x6f,0x16,0x63,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0xd9,0x40,3,2,0x63,0xa2,0x44, +0x65,0xa2,0x6c,0x73,0x40,2,0x62,0x48,0x74,0x64,0x75,0xa2,0x48,0x1b,0x6e,0x61, +0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0xa3,0x48,0x44,0x1c,0x69,0x6e, +0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x45,0x46,1,0x61,0x40, +0x72,0x1c,0x69,0x6e,0x61,0x72,0x79,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x47, +0x11,0x72,0x74,0x41,0x3e,0x10,0x6f,1,0x6d,0x30,0x6e,0x14,0x74,0x69,0x6e,0x75, +0x65,0x3f,0x16,0x70,0x61,0x74,0x6d,0x61,0x74,0x68,1,0x63,0x30,0x73,0x13,0x74, +0x61,0x72,0x74,0xa3,0x49,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0xa3,0x4a,0x10, +0x6f,0x42,0x16,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x43,2,0x64,0x2e,0x70,0x86, +0x73,0x10,0x63,0xc3,0x17,0x11,0x69,0x63,1,0x70,0x46,0x73,0x1e,0x79,0x6c,0x6c, +0x61,0x62,0x69,0x63,0x63,0x61,0x74,0x65,0x67,0x6f,0x72,0x79,0xc3,0x17,0x10,0x6f, +0x1f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x63,0x61,0x74,0x65,0x67,0x6f,0x72, +0x79,0xc3,0x16,0x10,0x63,0xc3,0x16,2,0x67,0xc3,6,0x6f,0x26,0x74,0xc3,7, +0x11,0x69,0x6e,1,0x63,0x4a,0x69,0x11,0x6e,0x67,1,0x67,0x2e,0x74,0x12,0x79, +0x70,0x65,0xc3,7,0x13,0x72,0x6f,0x75,0x70,0xc3,6,0x48,0x15,0x6f,0x6e,0x74, +0x72,0x6f,0x6c,0x49,0x66,0x86,0x67,0xa2,0x4a,0x68,3,0x61,0x36,0x65,0x58,0x73, +0x68,0x79,0x13,0x70,0x68,0x65,0x6e,0x3d,0x1f,0x6e,0x67,0x75,0x6c,0x73,0x79,0x6c, +0x6c,0x61,0x62,0x6c,0x65,0x74,0x79,0x70,0x65,0xc3,0xb,0x10,0x78,0x3a,0x14,0x64, +0x69,0x67,0x69,0x74,0x3b,0x10,0x74,0xc3,0xb,0x16,0x75,0x6c,0x6c,0x63,0x6f,0x6d, +0x70,0x1f,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x65,0x78,0x63,0x6c,0x75,0x73,0x69, +0x6f,0x6e,0x33,2,0x63,0xa2,0x44,0x65,0xa2,0x4b,0x72,3,0x61,0x34,0x62,0x84, +0x65,0x8a,0x6c,0x12,0x69,0x6e,0x6b,0x39,0x11,0x70,0x68,0x7c,0x12,0x65,0x6d,0x65, +3,0x62,0x5e,0x63,0x30,0x65,0x48,0x6c,0x12,0x69,0x6e,0x6b,0x39,0x1a,0x6c,0x75, +0x73,0x74,0x65,0x72,0x62,0x72,0x65,0x61,0x6b,0xc3,0x12,0x14,0x78,0x74,0x65,0x6e, +0x64,0x37,0x12,0x61,0x73,0x65,0x35,0x11,0x78,0x74,0x37,0xc2,5,1,0x62,0xc3, +0x12,0x6d,0xd9,0x20,0,0x1c,0x6e,0x65,0x72,0x61,0x6c,0x63,0x61,0x74,0x65,0x67, +0x6f,0x72,0x79,0xc2,5,0x13,0x6d,0x61,0x73,0x6b,0xd9,0x20,0,0x61,0xa2,0xa2, +0x62,0xa2,0xd0,0x63,0xa4,0x4f,0x64,0xa6,0x1c,0x65,5,0x6d,0x75,0x6d,0x6e,0x70, +0xa2,0x6b,0x78,0x10,0x74,0x30,1,0x65,0x2c,0x70,0x12,0x69,0x63,0x74,0xa1,0x12, +0x6e,0x64,0x65,1,0x64,0x24,0x72,0x31,0x1b,0x70,0x69,0x63,0x74,0x6f,0x67,0x72, +0x61,0x70,0x68,0x69,0x63,0xa1,0x10,0x6f,1,0x64,0x97,0x6a,0x10,0x69,0x92,3, +0x63,0x44,0x6b,0x54,0x6d,0x70,0x70,0x1a,0x72,0x65,0x73,0x65,0x6e,0x74,0x61,0x74, +0x69,0x6f,0x6e,0x95,0x17,0x6f,0x6d,0x70,0x6f,0x6e,0x65,0x6e,0x74,0x9b,0x1c,0x65, +0x79,0x63,0x61,0x70,0x73,0x65,0x71,0x75,0x65,0x6e,0x63,0x65,0xa3,0x42,0x16,0x6f, +0x64,0x69,0x66,0x69,0x65,0x72,0x96,0x13,0x62,0x61,0x73,0x65,0x99,0x12,0x72,0x65, +0x73,0x95,0x61,0x30,0x62,0x4e,0x63,0x12,0x6f,0x6d,0x70,0x9b,0xc2,4,0x1b,0x73, +0x74,0x61,0x73,0x69,0x61,0x6e,0x77,0x69,0x64,0x74,0x68,0xc3,4,0x12,0x61,0x73, +0x65,0x99,3,0x67,0x44,0x68,0x4a,0x6c,0x4e,0x73,0x1a,0x63,0x69,0x69,0x68,0x65, +0x78,0x64,0x69,0x67,0x69,0x74,0x23,0x10,0x65,0xd9,0x40,0,0x11,0x65,0x78,0x23, +1,0x6e,0x38,0x70,0x11,0x68,0x61,0x20,0x14,0x62,0x65,0x74,0x69,0x63,0x21,0x11, +0x75,0x6d,0x79,5,0x6c,0x22,0x6c,0x36,0x6d,0x52,0x70,1,0x62,0xd9,0x40,0xd, +0x74,0xc3,0x15,2,0x61,0x32,0x6b,0xc3,1,0x6f,0x11,0x63,0x6b,0xc3,1,0x11, +0x6e,0x6b,0x7b,0x10,0x67,0xd9,0x40,1,0x61,0xa2,0x4f,0x63,0xc3,0,0x69,0x11, +0x64,0x69,2,0x63,0x54,0x6d,0x74,0x70,0x1b,0x61,0x69,0x72,0x65,0x64,0x62,0x72, +0x61,0x63,0x6b,0x65,0x74,0xd8,0x40,0xd,0x13,0x74,0x79,0x70,0x65,0xc3,0x15,0x24, +1,0x6c,0x30,0x6f,0x14,0x6e,0x74,0x72,0x6f,0x6c,0x25,0x12,0x61,0x73,0x73,0xc3, +0,0x26,0x14,0x69,0x72,0x72,0x6f,0x72,1,0x65,0x38,0x69,0x16,0x6e,0x67,0x67, +0x6c,0x79,0x70,0x68,0xd9,0x40,1,0x10,0x64,0x27,0x17,0x73,0x69,0x63,0x65,0x6d, +0x6f,0x6a,0x69,0xa3,0x41,6,0x68,0x7c,0x68,0x54,0x69,0x85,0x6f,0xa2,0x6f,0x77, +4,0x63,0x30,0x6b,0x36,0x6c,0x87,0x74,0x8b,0x75,0x89,1,0x66,0x8d,0x6d,0x8f, +0x11,0x63,0x66,0x91,0x18,0x61,0x6e,0x67,0x65,0x73,0x77,0x68,0x65,0x6e,4,0x63, +0x44,0x6c,0x6c,0x6e,0x7e,0x74,0x98,0x75,0x18,0x70,0x70,0x65,0x72,0x63,0x61,0x73, +0x65,0x64,0x89,0x12,0x61,0x73,0x65,1,0x66,0x30,0x6d,0x14,0x61,0x70,0x70,0x65, +0x64,0x8f,0x14,0x6f,0x6c,0x64,0x65,0x64,0x8d,0x18,0x6f,0x77,0x65,0x72,0x63,0x61, +0x73,0x65,0x64,0x87,0x1c,0x66,0x6b,0x63,0x63,0x61,0x73,0x65,0x66,0x6f,0x6c,0x64, +0x65,0x64,0x91,0x18,0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x64,0x8b,0x13,0x6d, +0x70,0x65,0x78,0x33,0x61,0x2e,0x63,0xa2,0x48,0x66,0xd9,0x40,2,1,0x6e,0x72, +0x73,0x10,0x65,3,0x64,0x83,0x66,0x3a,0x69,0x4a,0x73,0x17,0x65,0x6e,0x73,0x69, +0x74,0x69,0x76,0x65,0x65,0x15,0x6f,0x6c,0x64,0x69,0x6e,0x67,0xd9,0x40,2,0x17, +0x67,0x6e,0x6f,0x72,0x61,0x62,0x6c,0x65,0x85,0x13,0x6f,0x6e,0x69,0x63,0x1f,0x61, +0x6c,0x63,0x6f,0x6d,0x62,0x69,0x6e,0x69,0x6e,0x67,0x63,0x6c,0x61,0x73,0x73,0xc3, +2,0x10,0x63,0xc3,2,3,0x61,0x30,0x65,0x34,0x69,0xa2,0x41,0x74,0xc3,3, +0x11,0x73,0x68,0x29,2,0x63,0x3a,0x66,0x58,0x70,0x2c,0x16,0x72,0x65,0x63,0x61, +0x74,0x65,0x64,0x2d,0x1d,0x6f,0x6d,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x74, +0x79,0x70,0x65,0xc3,3,0x15,0x61,0x75,0x6c,0x74,0x69,0x67,0x1f,0x6e,0x6f,0x72, +0x61,0x62,0x6c,0x65,0x63,0x6f,0x64,0x65,0x70,0x6f,0x69,0x6e,0x74,0x2b,0x2a,0x10, +0x61,0x2e,0x15,0x63,0x72,0x69,0x74,0x69,0x63,0x2f,3,0x66,0x34,0x6e,0x3e,0x74, +0x42,0x79,0x22,0x11,0x65,0x73,0x23,0x20,0x13,0x61,0x6c,0x73,0x65,0x21,0x20,0x10, +0x6f,0x21,0x22,0x12,0x72,0x75,0x65,0x23,0xb,0x6b,0x5b,0x6f,0x23,0x6f,0x3c,0x72, +0x4c,0x76,1,0x69,0x24,0x72,0x33,0x13,0x72,0x61,0x6d,0x61,0x33,0x10,0x76,0x22, +0x14,0x65,0x72,0x6c,0x61,0x79,0x23,0xa2,0xe2,0x13,0x69,0x67,0x68,0x74,0xa3,0xe2, +0x6b,0x58,0x6c,0x74,0x6e,3,0x6b,0x2f,0x6f,0x30,0x72,0x21,0x75,0x12,0x6b,0x74, +0x61,0x2f,0x19,0x74,0x72,0x65,0x6f,0x72,0x64,0x65,0x72,0x65,0x64,0x21,1,0x61, +0x24,0x76,0x31,0x18,0x6e,0x61,0x76,0x6f,0x69,0x63,0x69,0x6e,0x67,0x31,0xa2,0xe0, +0x12,0x65,0x66,0x74,0xa3,0xe0,0x64,0x45,0x64,0x4e,0x68,0x88,0x69,1,0x6f,0x26, +0x73,0xa3,0xf0,0x1a,0x74,0x61,0x73,0x75,0x62,0x73,0x63,0x72,0x69,0x70,0x74,0xa3, +0xf0,2,0x61,0xa3,0xea,0x62,0xa3,0xe9,0x6f,0x13,0x75,0x62,0x6c,0x65,1,0x61, +0x30,0x62,0x13,0x65,0x6c,0x6f,0x77,0xa3,0xe9,0x13,0x62,0x6f,0x76,0x65,0xa3,0xea, +0x12,0x61,0x6e,0x72,0x2c,0x15,0x65,0x61,0x64,0x69,0x6e,0x67,0x2d,0x61,0xa2,0x7b, +0x62,0xa2,0xd4,0x63,0x11,0x63,0x63,4,0x31,0x3c,0x32,0xa2,0x42,0x33,0xa2,0x56, +0x38,0xa2,0x64,0x39,0x10,0x31,0xa3,0x5b,9,0x35,0xa,0x35,0x3f,0x36,0x41,0x37, +0x43,0x38,0x45,0x39,0x47,0x30,0x30,0x31,0x3c,0x32,0x42,0x33,0x4e,0x34,0x3d,0x34, +1,0x33,0xa3,0x67,0x37,0xa3,0x6b,0x36,0x10,0x38,0xa3,0x76,0x38,1,0x32,0xa3, +0x7a,0x39,0xa3,0x81,0x3a,2,0x30,0xa3,0x82,0x32,0xa3,0x84,0x33,0xa3,0x85,9, +0x35,0xa,0x35,0x53,0x36,0x55,0x37,0x57,0x38,0x59,0x39,0x5b,0x30,0x49,0x31,0x4b, +0x32,0x4d,0x33,0x4f,0x34,0x51,6,0x33,8,0x33,0x63,0x34,0x65,0x35,0x67,0x36, +0x69,0x30,0x5d,0x31,0x5f,0x32,0x61,0x10,0x34,0xa3,0x54,0xa2,0xe6,3,0x62,0xa0, +0x6c,0xa3,0xe4,0x72,0xa3,0xe8,0x74,2,0x61,0x74,0x62,0x7c,0x74,0x14,0x61,0x63, +0x68,0x65,0x64,1,0x61,0x3e,0x62,0x13,0x65,0x6c,0x6f,0x77,0xa2,0xca,0x13,0x6c, +0x65,0x66,0x74,0xa3,0xc8,0x13,0x62,0x6f,0x76,0x65,0xa2,0xd6,0x14,0x72,0x69,0x67, +0x68,0x74,0xa3,0xd8,0xa2,0xd6,0x10,0x72,0xa3,0xd8,0xa2,0xca,0x10,0x6c,0xa3,0xc8, +0x12,0x6f,0x76,0x65,0xa2,0xe6,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68,0x74,0xa3, +0xe8,0x12,0x65,0x66,0x74,0xa3,0xe4,0xa2,0xdc,2,0x65,0x2c,0x6c,0xa3,0xda,0x72, +0xa3,0xde,0x12,0x6c,0x6f,0x77,0xa2,0xdc,1,0x6c,0x30,0x72,0x13,0x69,0x67,0x68, +0x74,0xa3,0xde,0x12,0x65,0x66,0x74,0xa3,0xda,0xb,0x6e,0xc0,0xca,0x72,0x5f,0x72, +0x46,0x73,0xa2,0x48,0x77,1,0x68,0x24,0x73,0x33,0x17,0x69,0x74,0x65,0x73,0x70, +0x61,0x63,0x65,0x33,0x22,1,0x69,0x30,0x6c,2,0x65,0x3d,0x69,0x4b,0x6f,0x3f, +0x18,0x67,0x68,0x74,0x74,0x6f,0x6c,0x65,0x66,0x74,0x22,2,0x65,0x38,0x69,0x48, +0x6f,0x16,0x76,0x65,0x72,0x72,0x69,0x64,0x65,0x3f,0x17,0x6d,0x62,0x65,0x64,0x64, +0x69,0x6e,0x67,0x3d,0x15,0x73,0x6f,0x6c,0x61,0x74,0x65,0x4b,0x30,0x1e,0x65,0x67, +0x6d,0x65,0x6e,0x74,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x31,0x6e,0xa2, +0x41,0x6f,0xa2,0x53,0x70,2,0x61,0x66,0x64,0x86,0x6f,0x1b,0x70,0x64,0x69,0x72, +0x65,0x63,0x74,0x69,0x6f,0x6e,0x61,0x6c,1,0x66,0x32,0x69,0x15,0x73,0x6f,0x6c, +0x61,0x74,0x65,0x4d,0x14,0x6f,0x72,0x6d,0x61,0x74,0x41,0x1f,0x72,0x61,0x67,0x72, +0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x2f,1,0x66,0x41, +0x69,0x4d,1,0x6f,0x28,0x73,0x10,0x6d,0x43,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69, +0x6e,0x67,0x6d,0x61,0x72,0x6b,0x43,1,0x6e,0x35,0x74,0x19,0x68,0x65,0x72,0x6e, +0x65,0x75,0x74,0x72,0x61,0x6c,0x35,0x65,0x88,0x65,0x98,0x66,0xa2,0x6a,0x6c,0x20, +1,0x65,0x30,0x72,2,0x65,0x37,0x69,0x49,0x6f,0x39,0x18,0x66,0x74,0x74,0x6f, +0x72,0x69,0x67,0x68,0x74,0x20,2,0x65,0x38,0x69,0x48,0x6f,0x16,0x76,0x65,0x72, +0x72,0x69,0x64,0x65,0x39,0x17,0x6d,0x62,0x65,0x64,0x64,0x69,0x6e,0x67,0x37,0x15, +0x73,0x6f,0x6c,0x61,0x74,0x65,0x49,3,0x6e,0x25,0x73,0x27,0x74,0x29,0x75,0x15, +0x72,0x6f,0x70,0x65,0x61,0x6e,2,0x6e,0x3c,0x73,0x46,0x74,0x18,0x65,0x72,0x6d, +0x69,0x6e,0x61,0x74,0x6f,0x72,0x29,0x14,0x75,0x6d,0x62,0x65,0x72,0x25,0x17,0x65, +0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x27,1,0x69,0x28,0x73,0x10,0x69,0x47,0x1f, +0x72,0x73,0x74,0x73,0x74,0x72,0x6f,0x6e,0x67,0x69,0x73,0x6f,0x6c,0x61,0x74,0x65, +0x47,0x61,0x4e,0x62,0x84,0x63,1,0x6f,0x24,0x73,0x2d,0x1c,0x6d,0x6d,0x6f,0x6e, +0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0x2d,2,0x6c,0x3b,0x6e,0x2b,0x72, +0x13,0x61,0x62,0x69,0x63,1,0x6c,0x30,0x6e,0x14,0x75,0x6d,0x62,0x65,0x72,0x2b, +0x14,0x65,0x74,0x74,0x65,0x72,0x3b,0x2e,1,0x6e,0x45,0x6f,0x1c,0x75,0x6e,0x64, +0x61,0x72,0x79,0x6e,0x65,0x75,0x74,0x72,0x61,0x6c,0x45,0,0x16,0x6d,0xc9,0x20, +0x74,0xc2,0x30,0x77,0x89,0x77,0x86,0x79,0xa2,0x46,0x7a,1,0x61,0x58,0x6e,0x1a, +0x61,0x6d,0x65,0x6e,0x6e,0x79,0x6d,0x75,0x73,0x69,0x63,0xa4,0x40,0x19,0x61,0x6c, +0x6e,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0xa5,0x40,0x1c,0x6e,0x61,0x62,0x61,0x7a, +0x61,0x72,0x73,0x71,0x75,0x61,0x72,0x65,0xa5,0x18,0x10,0x61,1,0x6e,0x36,0x72, +0x16,0x61,0x6e,0x67,0x63,0x69,0x74,0x69,0xa3,0xfc,0x12,0x63,0x68,0x6f,0xa5,0x2c, +1,0x65,0x88,0x69,2,0x6a,0x3c,0x72,0x68,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62, +0x6c,0x65,0x73,0xa3,0x48,0x12,0x69,0x6e,0x67,0xa2,0x74,0x1e,0x68,0x65,0x78,0x61, +0x67,0x72,0x61,0x6d,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x74,0x16,0x61,0x64, +0x69,0x63,0x61,0x6c,0x73,0xa3,0x49,0x13,0x7a,0x69,0x64,0x69,0xa5,0x34,0x74,0xa2, +0x65,0x75,0xa4,0x4f,0x76,3,0x61,0x3c,0x65,0x80,0x69,0xa2,0x50,0x73,0xa2,0x6c, +0x12,0x73,0x75,0x70,0xa3,0x7d,1,0x69,0xa3,0x9f,0x72,0x1e,0x69,0x61,0x74,0x69, +0x6f,0x6e,0x73,0x65,0x6c,0x65,0x63,0x74,0x6f,0x72,0x73,0xa2,0x6c,0x19,0x73,0x75, +0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x7d,1,0x64,0x3c,0x72,0x19,0x74, +0x69,0x63,0x61,0x6c,0x66,0x6f,0x72,0x6d,0x73,0xa3,0x91,0x14,0x69,0x63,0x65,0x78, +0x74,0xa2,0xaf,0x16,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0xaf,0x15,0x74,0x68, +0x6b,0x75,0x71,0x69,0xa5,0x3f,5,0x69,0x3f,0x69,0x5a,0x6f,0x8c,0x72,0x1c,0x61, +0x6e,0x73,0x70,0x6f,0x72,0x74,0x61,0x6e,0x64,0x6d,0x61,0x70,0xa2,0xcf,0x16,0x73, +0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xcf,2,0x62,0x34,0x66,0x3c,0x72,0x13,0x68, +0x75,0x74,0x61,0xa3,0xfb,0x13,0x65,0x74,0x61,0x6e,0x57,0x14,0x69,0x6e,0x61,0x67, +0x68,0xa3,0x90,0x11,0x74,0x6f,0xa5,0x3d,0x61,0x3e,0x65,0xa2,0xa0,0x68,0x10,0x61, +1,0x61,0x24,0x69,0x53,0x11,0x6e,0x61,0x3d,4,0x67,0x8e,0x69,0xa2,0x49,0x6b, +0xa2,0x72,0x6d,0xa2,0x74,0x6e,0x10,0x67,1,0x73,0x68,0x75,0x10,0x74,0xa4,0x10, +1,0x63,0x40,0x73,0x11,0x75,0x70,0xa4,0x33,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e, +0x74,0xa5,0x33,0x18,0x6f,0x6d,0x70,0x6f,0x6e,0x65,0x6e,0x74,0x73,0xa5,0x11,0x10, +0x61,0xa5,0x3c,2,0x61,0x2a,0x62,0x32,0x73,0xa3,0x60,0x12,0x6c,0x6f,0x67,0xa3, +0x62,0x13,0x61,0x6e,0x77,0x61,0xa3,0x65,3,0x6c,0x52,0x74,0x56,0x76,0x5e,0x78, +0x16,0x75,0x61,0x6e,0x6a,0x69,0x6e,0x67,0xa2,0x7c,0x16,0x73,0x79,0x6d,0x62,0x6f, +0x6c,0x73,0xa3,0x7c,0x10,0x65,0xa3,0x70,0x12,0x68,0x61,0x6d,0xa3,0xae,0x12,0x69, +0x65,0x74,0xa3,0xb7,0x11,0x72,0x69,0xa3,0xdc,0x11,0x69,0x6c,0x48,0x12,0x73,0x75, +0x70,0xa4,0x2b,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x2b,0x13,0x6c,0x75, +0x67,0x75,0x4b,2,0x63,0x8c,0x67,0xa2,0x41,0x6e,0x1f,0x69,0x66,0x69,0x65,0x64, +0x63,0x61,0x6e,0x61,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x1f,0x72,0x69,0x67,0x69, +0x6e,0x61,0x6c,0x73,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x73,0x62,0x17,0x65,0x78, +0x74,0x65,0x6e,0x64,0x65,0x64,0xa2,0xad,0x10,0x61,0xa5,0x3e,0x11,0x61,0x73,0x62, +0x12,0x65,0x78,0x74,0xa2,0xad,0x10,0x61,0xa5,0x3e,0x15,0x61,0x72,0x69,0x74,0x69, +0x63,0xa3,0x78,0x70,0xc3,0x4b,0x70,0xa6,0x61,0x72,0xa8,0x1d,0x73,7,0x6f,0xc1, +0xbe,0x6f,0xa2,0x69,0x70,0xa2,0x85,0x75,0xa2,0xa4,0x79,2,0x6c,0x50,0x6d,0x62, +0x72,0x12,0x69,0x61,0x63,0x3a,0x12,0x73,0x75,0x70,0xa4,0x17,0x16,0x70,0x6c,0x65, +0x6d,0x65,0x6e,0x74,0xa5,0x17,0x17,0x6f,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,0xa3, +0x8f,0x13,0x62,0x6f,0x6c,0x73,1,0x61,0x4c,0x66,0x10,0x6f,0x1f,0x72,0x6c,0x65, +0x67,0x61,0x63,0x79,0x63,0x6f,0x6d,0x70,0x75,0x74,0x69,0x6e,0x67,0xa5,0x32,0x1f, +0x6e,0x64,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x78,0x74, +1,0x61,0xa5,0x2a,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa5,0x2a,2,0x67,0x34, +0x72,0x3e,0x79,0x13,0x6f,0x6d,0x62,0x6f,0xa5,0x16,0x13,0x64,0x69,0x61,0x6e,0xa5, +0x23,0x17,0x61,0x73,0x6f,0x6d,0x70,0x65,0x6e,0x67,0xa3,0xda,1,0x61,0x32,0x65, +0x14,0x63,0x69,0x61,0x6c,0x73,0xa3,0x56,0x12,0x63,0x69,0x6e,0x1f,0x67,0x6d,0x6f, +0x64,0x69,0x66,0x69,0x65,0x72,0x6c,0x65,0x74,0x74,0x65,0x72,0x73,0x2d,2,0x6e, +0x48,0x70,0x76,0x74,0x1d,0x74,0x6f,0x6e,0x73,0x69,0x67,0x6e,0x77,0x72,0x69,0x74, +0x69,0x6e,0x67,0xa5,6,0x15,0x64,0x61,0x6e,0x65,0x73,0x65,0xa2,0x9b,0x12,0x73, +0x75,0x70,0xa2,0xdb,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xdb,4,0x61, +0xa2,0xa8,0x65,0x5c,0x6d,0x9e,0x70,0xa2,0x4b,0x73,0x13,0x79,0x6d,0x62,0x6f,0x1f, +0x6c,0x73,0x61,0x6e,0x64,0x70,0x69,0x63,0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73, +0xa5,5,0x10,0x72,1,0x61,0x4e,0x73,0x12,0x63,0x72,0x69,0x1f,0x70,0x74,0x73, +0x61,0x6e,0x64,0x73,0x75,0x62,0x73,0x63,0x72,0x69,0x70,0x74,0x73,0x73,0x14,0x6e, +0x64,0x73,0x75,0x62,0x73,0x1b,0x61,0x74,0x68,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f, +0x72,0x73,0xa3,0x6a,1,0x6c,0x40,0x75,1,0x61,0x6e,0x6e,0x17,0x63,0x74,0x75, +0x61,0x74,0x69,0x6f,0x6e,0xa3,0x8e,0x15,0x65,0x6d,0x65,0x6e,0x74,0x61,1,0x6c, +0x50,0x72,0x1e,0x79,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x75,0x73,0x65,0x61,0x72, +0x65,0x61,1,0x61,0xa3,0x6d,0x62,0xa3,0x6e,3,0x61,0x5c,0x6d,0x78,0x70,0xa2, +0x41,0x73,0x13,0x79,0x6d,0x62,0x6f,0x1f,0x6c,0x73,0x61,0x6e,0x64,0x70,0x69,0x63, +0x74,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa5,5,0x14,0x72,0x72,0x6f,0x77,0x73, +2,0x61,0xa3,0x67,0x62,0xa3,0x68,0x63,0xa3,0xfa,0x13,0x61,0x74,0x68,0x65,0x1f, +0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,0x73, +0xa3,0x6a,0x19,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x8e,0x61, +0x88,0x68,0xa2,0x48,0x69,0xa2,0x71,0x6d,0x12,0x61,0x6c,0x6c,1,0x66,0x46,0x6b, +0x15,0x61,0x6e,0x61,0x65,0x78,0x74,0xa4,0x29,0x15,0x65,0x6e,0x73,0x69,0x6f,0x6e, +0xa5,0x29,0x12,0x6f,0x72,0x6d,1,0x73,0xa3,0x54,0x76,0x16,0x61,0x72,0x69,0x61, +0x6e,0x74,0x73,0xa3,0x54,1,0x6d,0x36,0x75,0x16,0x72,0x61,0x73,0x68,0x74,0x72, +0x61,0xa3,0xa1,0x15,0x61,0x72,0x69,0x74,0x61,0x6e,0xa3,0xac,1,0x61,0x52,0x6f, +0x13,0x72,0x74,0x68,0x61,0x1f,0x6e,0x64,0x66,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f, +0x6e,0x74,0x72,0x6f,0x6c,0x73,0xa3,0xf7,1,0x72,0x2e,0x76,0x12,0x69,0x61,0x6e, +0xa3,0x79,0x12,0x61,0x64,0x61,0xa3,0xd9,1,0x64,0x50,0x6e,0x13,0x68,0x61,0x6c, +0x61,0x50,0x1d,0x61,0x72,0x63,0x68,0x61,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72, +0x73,0xa3,0xf9,0x13,0x64,0x68,0x61,0x6d,0xa3,0xf8,5,0x72,0x35,0x72,0x44,0x73, +0x64,0x75,1,0x61,0xa3,0x4e,0x6e,0x17,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e, +0x71,0x17,0x69,0x76,0x61,0x74,0x65,0x75,0x73,0x65,0xa2,0x4e,0x13,0x61,0x72,0x65, +0x61,0xa3,0x4e,0x1b,0x61,0x6c,0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69, +0xa3,0xf6,0x61,0x40,0x68,0x82,0x6c,0x19,0x61,0x79,0x69,0x6e,0x67,0x63,0x61,0x72, +0x64,0x73,0xa3,0xcc,2,0x68,0x38,0x6c,0x4a,0x75,0x15,0x63,0x69,0x6e,0x68,0x61, +0x75,0xa3,0xf5,0x17,0x61,0x77,0x68,0x68,0x6d,0x6f,0x6e,0x67,0xa3,0xf3,0x15,0x6d, +0x79,0x72,0x65,0x6e,0x65,0xa3,0xf4,1,0x61,0x8e,0x6f,1,0x65,0x74,0x6e,0x16, +0x65,0x74,0x69,0x63,0x65,0x78,0x74,0xa2,0x72,1,0x65,0x2c,0x73,0x11,0x75,0x70, +0xa3,0x8d,0x15,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa2,0x72,0x19,0x73,0x75,0x70,0x70, +0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x8d,0x15,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3, +0x97,1,0x67,0x3e,0x69,0x13,0x73,0x74,0x6f,0x73,0xa2,0xa6,0x13,0x64,0x69,0x73, +0x63,0xa3,0xa6,0x12,0x73,0x70,0x61,0xa3,0x96,1,0x65,0x5c,0x75,1,0x6d,0x2a, +0x6e,0x11,0x69,0x63,0x67,0x10,0x69,0xa2,0xc0,0x1d,0x6e,0x75,0x6d,0x65,0x72,0x61, +0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xc0,0x13,0x6a,0x61,0x6e,0x67,0xa3, +0xa3,0x6d,0xa2,0xf0,0x6e,0xa8,0x23,0x6f,6,0x70,0x63,0x70,0x56,0x72,0x8a,0x73, +0xa2,0x4c,0x74,0x10,0x74,0x1f,0x6f,0x6d,0x61,0x6e,0x73,0x69,0x79,0x61,0x71,0x6e, +0x75,0x6d,0x62,0x65,0x72,0x73,0xa5,0x28,0x18,0x74,0x69,0x63,0x61,0x6c,0x63,0x68, +0x61,0x72,0x1f,0x61,0x63,0x74,0x65,0x72,0x72,0x65,0x63,0x6f,0x67,0x6e,0x69,0x74, +0x69,0x6f,0x6e,0x85,1,0x69,0x46,0x6e,0x1e,0x61,0x6d,0x65,0x6e,0x74,0x61,0x6c, +0x64,0x69,0x6e,0x67,0x62,0x61,0x74,0x73,0xa3,0xf2,0x11,0x79,0x61,0x47,1,0x61, +0x30,0x6d,0x13,0x61,0x6e,0x79,0x61,0xa3,0x7a,0x11,0x67,0x65,0xa5,0xf,0x63,0xa2, +0x7b,0x67,0xa2,0x7b,0x6c,1,0x63,0xa2,0x6c,0x64,6,0x70,0x42,0x70,0x3a,0x73, +0x5a,0x74,0x88,0x75,0x14,0x79,0x67,0x68,0x75,0x72,0xa5,0x3b,0x11,0x65,0x72,1, +0x6d,0x2e,0x73,0x12,0x69,0x61,0x6e,0xa3,0x8c,0x11,0x69,0x63,0xa3,0xf1,0x10,0x6f, +1,0x67,0x3a,0x75,0x18,0x74,0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0xbb, +0x13,0x64,0x69,0x61,0x6e,0xa5,0x22,0x14,0x75,0x72,0x6b,0x69,0x63,0xa3,0xbf,0x68, 0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e, 0xa3,0xf0,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa5,4,0x14,0x74,0x61, 0x6c,0x69,0x63,0xa3,0x58,0x13,0x68,0x69,0x6b,0x69,0xa3,0x9d,0x10,0x72,0x85,0x12, @@ -424,171 +440,178 @@ const uint8_t PropNameData::bytesTries[14992]={ 0x68,0x75,0x65,0x68,0x6d,0x6f,0x6e,0x67,0xa5,0x27,0x10,0x6f,0xa3,0x92,0x14,0x62, 0x6c,0x6f,0x63,0x6b,0x21,1,0x6d,0x2c,0x73,0x11,0x68,0x75,0xa5,0x15,0x17,0x62, 0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0x7b,0x61,0x44,0x62,0x21,0x65,0x10,0x77,1, -0x61,0xa5,0xe,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,0xa3,0x8b,1,0x62,0x38,0x6e, -0x17,0x64,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,0xa5,0x26,0x15,0x61,0x74,0x61,0x65, -0x61,0x6e,0xa3,0xef,0x67,0xc4,0x32,0x6a,0xc1,0xb9,0x6a,0xa2,0xd5,0x6b,0xa2,0xee, -0x6c,4,0x61,0x54,0x65,0xa2,0x61,0x69,0xa2,0x78,0x6f,0xa2,0xb7,0x79,1,0x63, -0x2e,0x64,0x12,0x69,0x61,0x6e,0xa3,0xa9,0x12,0x69,0x61,0x6e,0xa3,0xa7,1,0x6f, -0x55,0x74,0x11,0x69,0x6e,1,0x31,0x82,0x65,0x11,0x78,0x74,4,0x61,0x5c,0x62, -0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa2,0xe7,0x13,0x6e,0x64,0x65,0x64,4, -0x61,0x36,0x62,0x29,0x63,0xa3,0x94,0x64,0xa3,0x95,0x65,0xa3,0xe7,0x26,0x18,0x64, -0x64,0x69,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x6d,0x24,0x12,0x73,0x75,0x70,0x24,0x16, -0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x25,1,0x70,0x42,0x74,0x1d,0x74,0x65,0x72, -0x6c,0x69,0x6b,0x65,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x79,0x12,0x63,0x68,0x61, -0xa3,0x9c,2,0x6d,0x4e,0x6e,0x54,0x73,0x10,0x75,0xa2,0xb0,0x12,0x73,0x75,0x70, -0xa4,0x31,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0x31,0x11,0x62,0x75,0xa3, -0x6f,0x12,0x65,0x61,0x72,1,0x61,0xa3,0xe8,0x62,1,0x69,0x38,0x73,0x17,0x79, -0x6c,0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x75,0x17,0x64,0x65,0x6f,0x67,0x72,0x61, -0x6d,0x73,0xa3,0x76,0x1a,0x77,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73, -0xa3,0x4d,0x10,0x61,1,0x6d,0x32,0x76,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0xb5, -0x10,0x6f,0x5c,0x12,0x65,0x78,0x74,1,0x61,0xa3,0xb4,0x62,0xa3,0xb9,1,0x61, -0xa2,0x43,0x68,4,0x61,0x40,0x69,0x50,0x6d,0x6e,0x6f,0x86,0x75,0x15,0x64,0x61, -0x77,0x61,0x64,0x69,0xa3,0xe6,0x16,0x72,0x6f,0x73,0x68,0x74,0x68,0x69,0xa3,0x89, -0x1d,0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa5, -0x30,0x11,0x65,0x72,0x68,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x71,0x12, -0x6a,0x6b,0x69,0xa3,0xe5,3,0x69,0x3a,0x6e,0x42,0x74,0xa2,0x51,0x79,0x13,0x61, -0x68,0x6c,0x69,0xa3,0xa2,0x12,0x74,0x68,0x69,0xa3,0xc1,3,0x61,0x34,0x62,0x76, -0x67,0x7c,0x6e,0x12,0x61,0x64,0x61,0x4d,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2, -0xcb,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xcb,0x11,0x78,0x74,1,0x61, -0xa5,0x13,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa5,0x13,0x11,0x75,0x6e,0xa3,0x42, -0x11,0x78,0x69,0x96,0x17,0x72,0x61,0x64,0x69,0x63,0x61,0x6c,0x73,0x97,0x14,0x61, -0x6b,0x61,0x6e,0x61,0x9e,1,0x65,0x4c,0x70,0x10,0x68,0x1f,0x6f,0x6e,0x65,0x74, -0x69,0x63,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0x6b,0x11,0x78, -0x74,0xa3,0x6b,0x67,0xa2,0xb5,0x68,0xa4,0x84,0x69,3,0x64,0x4c,0x6d,0xa2,0x55, -0x6e,0xa2,0x62,0x70,0x13,0x61,0x65,0x78,0x74,0x2a,0x16,0x65,0x6e,0x73,0x69,0x6f, -0x6e,0x73,0x2b,1,0x63,0x99,0x65,0x17,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63, -1,0x64,0x56,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa4,0xb,0x1d,0x61,0x6e, -0x64,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa5,0xb,0x13,0x65, -0x73,0x63,0x72,0x1f,0x69,0x70,0x74,0x69,0x6f,0x6e,0x63,0x68,0x61,0x72,0x61,0x63, -0x74,0x65,0x72,0x73,0x99,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d, -0x61,0x69,0x63,0xa3,0xba,1,0x64,0x62,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69, -0x6f,0x6e,0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e, -0xa3,0xbd,0x13,0x6c,0x61,0x76,0x69,0xa3,0xbe,0x11,0x69,0x63,1,0x6e,0x3e,0x73, -0x1a,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa5,0x1e,0x19,0x75, -0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,0x73,0xa3,0xb2,4,0x65,0x74,0x6c,0xa2, -0x82,0x6f,0xa2,0x9a,0x72,0xa2,0x9e,0x75,2,0x6a,0x34,0x6e,0x3e,0x72,0x14,0x6d, -0x75,0x6b,0x68,0x69,0x43,0x14,0x61,0x72,0x61,0x74,0x69,0x45,0x18,0x6a,0x61,0x6c, -0x61,0x67,0x6f,0x6e,0x64,0x69,0xa5,0x1c,1,0x6e,0xa2,0x46,0x6f,1,0x6d,0x6e, -0x72,0x13,0x67,0x69,0x61,0x6e,0x5a,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x87, -0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x87,0x11,0x78,0x74,0xa4,0x1b,0x14, -0x65,0x6e,0x64,0x65,0x64,0xa5,0x1b,0x1a,0x65,0x74,0x72,0x69,0x63,0x73,0x68,0x61, -0x70,0x65,0x73,0x8c,0x12,0x65,0x78,0x74,0xa2,0xe3,0x14,0x65,0x6e,0x64,0x65,0x64, -0xa3,0xe3,0x1e,0x65,0x72,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69, -0x6f,0x6e,0x71,0x17,0x61,0x67,0x6f,0x6c,0x69,0x74,0x69,0x63,0xa2,0x88,0x12,0x73, -0x75,0x70,0xa4,0xa,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa5,0xa,0x13,0x74, -0x68,0x69,0x63,0xa3,0x59,1,0x61,0x5c,0x65,0x11,0x65,0x6b,0x30,1,0x61,0x38, -0x65,0x11,0x78,0x74,0x6e,0x14,0x65,0x6e,0x64,0x65,0x64,0x6f,0x17,0x6e,0x64,0x63, -0x6f,0x70,0x74,0x69,0x63,0x31,0x13,0x6e,0x74,0x68,0x61,0xa3,0xe4,2,0x61,0xa2, -0x48,0x65,0xa2,0xdf,0x69,1,0x67,0x30,0x72,0x14,0x61,0x67,0x61,0x6e,0x61,0x9d, -0x10,0x68,1,0x70,0x3a,0x73,0x18,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73, -0xa3,0x4b,1,0x72,0x3c,0x75,0x19,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65, -0x73,0xa3,0x4c,0x11,0x69,0x76,0x1f,0x61,0x74,0x65,0x75,0x73,0x65,0x73,0x75,0x72, -0x72,0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4c,2,0x6c,0x32,0x6e,0x9a,0x74,0x12, -0x72,0x61,0x6e,0xa5,2,0x10,0x66,2,0x61,0x58,0x6d,0x70,0x77,0x14,0x69,0x64, -0x74,0x68,0x61,0x1f,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x77,0x69,0x64,0x74,0x68,0x66, -0x6f,0x72,0x6d,0x73,0xa3,0x57,0x1a,0x6e,0x64,0x66,0x75,0x6c,0x6c,0x66,0x6f,0x72, -0x6d,0x73,0xa3,0x57,0x13,0x61,0x72,0x6b,0x73,0xa3,0x52,2,0x67,0x34,0x69,0xa2, -0x45,0x75,0x12,0x6e,0x6f,0x6f,0xa3,0x63,0x11,0x75,0x6c,0xa2,0x4a,2,0x63,0x3c, -0x6a,0x5e,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x73,0xa3,0x4a,0x1f,0x6f, -0x6d,0x70,0x61,0x74,0x69,0x62,0x69,0x6c,0x69,0x74,0x79,0x6a,0x61,0x6d,0x6f,0xa3, -0x41,0x12,0x61,0x6d,0x6f,0x5c,0x17,0x65,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,1, -0x61,0xa3,0xb4,0x62,0xa3,0xb9,0x19,0x66,0x69,0x72,0x6f,0x68,0x69,0x6e,0x67,0x79, -0x61,0xa5,0x1d,0x13,0x62,0x72,0x65,0x77,0x37,0x61,0xa4,5,0x62,0xa6,0x45,0x63, -0xa8,0x1a,0x64,0xac,0xb8,0x65,5,0x6d,0xa2,0x6d,0x86,0x6e,0x96,0x74,0x15,0x68, -0x69,0x6f,0x70,0x69,0x63,0x5e,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0x86,0x16, -0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x86,0x11,0x78,0x74,0xa2,0x85,1,0x61, -0xa3,0xc8,0x65,0x13,0x6e,0x64,0x65,0x64,0xa2,0x85,0x10,0x61,0xa3,0xc8,0x16,0x6f, -0x74,0x69,0x63,0x6f,0x6e,0x73,0xa3,0xce,0x15,0x63,0x6c,0x6f,0x73,0x65,0x64,2, -0x61,0x5a,0x63,0x9e,0x69,0x1c,0x64,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63, -0x73,0x75,0x70,0xa2,0xc4,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xc4,0x16, -0x6c,0x70,0x68,0x61,0x6e,0x75,0x6d,0x86,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3, -0xc3,0x13,0x72,0x69,0x63,0x73,0x86,0x18,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e, -0x74,0xa3,0xc3,0x11,0x6a,0x6b,0xa2,0x44,0x1f,0x6c,0x65,0x74,0x74,0x65,0x72,0x73, -0x61,0x6e,0x64,0x6d,0x6f,0x6e,0x74,0x68,0x73,0xa3,0x44,0x61,0x4a,0x67,0x76,0x6c, -1,0x62,0x30,0x79,0x13,0x6d,0x61,0x69,0x63,0xa5,0x25,0x13,0x61,0x73,0x61,0x6e, -0xa3,0xe2,0x13,0x72,0x6c,0x79,0x64,0x1f,0x79,0x6e,0x61,0x73,0x74,0x69,0x63,0x63, -0x75,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa5,1,0x1f,0x79,0x70,0x74,0x69,0x61, -0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,1,0x66,0x26,0x73,0xa3, -0xc2,0x1c,0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73,0xa5, -0x24,7,0x6e,0xc0,0xe5,0x6e,0x3e,0x72,0xa2,0x5d,0x73,0xa2,0xd8,0x76,0x14,0x65, -0x73,0x74,0x61,0x6e,0xa3,0xbc,1,0x61,0x92,0x63,0x13,0x69,0x65,0x6e,0x74,1, -0x67,0x34,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xa5,0x13,0x72,0x65,0x65, -0x6b,1,0x6d,0x34,0x6e,0x15,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x7f,0x13,0x75, -0x73,0x69,0x63,0xa2,0x7e,0x19,0x61,0x6c,0x6e,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e, -0xa3,0x7e,0x10,0x74,0x1f,0x6f,0x6c,0x69,0x61,0x6e,0x68,0x69,0x65,0x72,0x6f,0x67, -0x6c,0x79,0x70,0x68,0x73,0xa3,0xfe,2,0x61,0x32,0x6d,0xa2,0x71,0x72,0x12,0x6f, -0x77,0x73,0x7d,0x12,0x62,0x69,0x63,0x38,3,0x65,0x4a,0x6d,0x66,0x70,0xa2,0x43, -0x73,0x11,0x75,0x70,0xa2,0x80,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x80, -0x11,0x78,0x74,1,0x61,0xa3,0xd2,0x65,0x14,0x6e,0x64,0x65,0x64,0x61,0xa3,0xd2, -0x12,0x61,0x74,0x68,0xa2,0xd3,0x18,0x65,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,0x61, -0x1f,0x6c,0x70,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c, -0x73,0xa3,0xd3,1,0x66,0x42,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69, -0x6f,0x6e,0x66,0x6f,0x72,0x6d,0x73,1,0x61,0xa3,0x51,0x62,0xa3,0x55,0x14,0x65, -0x6e,0x69,0x61,0x6e,0x35,0x12,0x63,0x69,0x69,0x23,0x64,0x9e,0x65,0xa2,0x42,0x68, -0xa2,0x4d,0x6c,1,0x63,0x62,0x70,0x17,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x70, -1,0x66,0xa3,0x50,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e, -0x66,0x6f,0x72,0x6d,0x73,0xa3,0x50,0x16,0x68,0x65,0x6d,0x69,0x63,0x61,0x6c,0xa2, -0xd0,0x16,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xd0,0x12,0x6c,0x61,0x6d,0xa5, -7,0x1a,0x67,0x65,0x61,0x6e,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x77,0x11, -0x6f,0x6d,0xa3,0xfd,7,0x6f,0x71,0x6f,0x64,0x72,0xa2,0x41,0x75,0xa2,0x58,0x79, -0x1b,0x7a,0x61,0x6e,0x74,0x69,0x6e,0x65,0x6d,0x75,0x73,0x69,0x63,0xa2,0x5b,0x18, -0x61,0x6c,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0x5b,1,0x70,0x34,0x78,0x16, -0x64,0x72,0x61,0x77,0x69,0x6e,0x67,0x89,0x14,0x6f,0x6d,0x6f,0x66,0x6f,0xa0,0x12, -0x65,0x78,0x74,0xa2,0x43,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0x43,0x10,0x61,1, -0x68,0x40,0x69,0x12,0x6c,0x6c,0x65,0x92,0x17,0x70,0x61,0x74,0x74,0x65,0x72,0x6e, -0x73,0x93,0x11,0x6d,0x69,0xa3,0xc9,1,0x67,0x2c,0x68,0x11,0x69,0x64,0xa3,0x64, -0x14,0x69,0x6e,0x65,0x73,0x65,0xa3,0x81,0x61,0x48,0x65,0xa2,0x4e,0x68,0xa2,0x52, -0x6c,0x1a,0x6f,0x63,0x6b,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x73,0x8b,3,0x6c, -0x34,0x6d,0x40,0x73,0x66,0x74,0x11,0x61,0x6b,0xa3,0xc7,0x14,0x69,0x6e,0x65,0x73, -0x65,0xa3,0x93,0x11,0x75,0x6d,0xa2,0xb1,0x12,0x73,0x75,0x70,0xa2,0xca,0x16,0x70, -0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xca,1,0x69,0x30,0x73,0x13,0x61,0x76,0x61, -0x68,0xa3,0xdd,0x15,0x63,0x6c,0x61,0x74,0x69,0x6e,0x23,0x14,0x6e,0x67,0x61,0x6c, -0x69,0x41,0x16,0x61,0x69,0x6b,0x73,0x75,0x6b,0x69,0xa5,8,5,0x6f,0xc1,0x4c, -0x6f,0xa2,0x55,0x75,0xa4,0x10,0x79,1,0x70,0x9c,0x72,0x14,0x69,0x6c,0x6c,0x69, -0x63,0x32,1,0x65,0x4c,0x73,0x11,0x75,0x70,0xa2,0x61,0x16,0x70,0x6c,0x65,0x6d, -0x65,0x6e,0x74,0xa2,0x61,0x12,0x61,0x72,0x79,0xa3,0x61,0x11,0x78,0x74,3,0x61, -0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x65,0x13,0x6e,0x64,0x65,0x64,2,0x61, -0xa3,0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x1c,0x72,0x69,0x6f,0x74,0x73,0x79,0x6c, -0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x7b,3,0x6d,0x5a,0x6e,0xa2,0x95,0x70,0xa2, -0xa0,0x75,0x17,0x6e,0x74,0x69,0x6e,0x67,0x72,0x6f,0x64,0xa2,0x9a,0x17,0x6e,0x75, -0x6d,0x65,0x72,0x61,0x6c,0x73,0xa3,0x9a,2,0x62,0x3a,0x6d,0xa2,0x5f,0x70,0x15, -0x61,0x74,0x6a,0x61,0x6d,0x6f,0xa3,0x41,0x14,0x69,0x6e,0x69,0x6e,0x67,2,0x64, -0x46,0x68,0x9e,0x6d,0x1d,0x61,0x72,0x6b,0x73,0x66,0x6f,0x72,0x73,0x79,0x6d,0x62, -0x6f,0x6c,0x73,0x77,0x1e,0x69,0x61,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x6d, -0x61,0x72,0x6b,0x73,0x2e,2,0x65,0x40,0x66,0xa6,0x41,0x73,0x18,0x75,0x70,0x70, -0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x83,0x16,0x78,0x74,0x65,0x6e,0x64,0x65,0x64, -0xa3,0xe0,0x17,0x61,0x6c,0x66,0x6d,0x61,0x72,0x6b,0x73,0xa3,0x52,0x11,0x6f,0x6e, -0x1f,0x69,0x6e,0x64,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d, -0x73,0xa3,0xb2,0x1b,0x74,0x72,0x6f,0x6c,0x70,0x69,0x63,0x74,0x75,0x72,0x65,0x73, -0x83,0x12,0x74,0x69,0x63,0xa2,0x84,0x1b,0x65,0x70,0x61,0x63,0x74,0x6e,0x75,0x6d, -0x62,0x65,0x72,0x73,0xa3,0xdf,1,0x6e,0x3e,0x72,0x1b,0x72,0x65,0x6e,0x63,0x79, -0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x75,0x15,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa2, -0x98,0x16,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa2,0x99,0x1d,0x61,0x6e,0x64,0x70, -0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x99,0x61,0xa2,0xe1,0x68, -0xa4,0xb,0x6a,0x10,0x6b,0xa2,0x47,4,0x63,0x8c,0x65,0xa2,0x80,0x72,0xa2,0x98, -0x73,0xa2,0xaa,0x75,0x1f,0x6e,0x69,0x66,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67, -0x72,0x61,0x70,0x68,0x73,0xa2,0x47,0x18,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f, -0x6e,6,0x64,0x6b,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e, -0x14,0x6f,0x6d,0x70,0x61,0x74,0xa2,0x45,1,0x66,0x96,0x69,1,0x62,0x44,0x64, -0x17,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x12,0x73,0x75,0x70,0xa3, -0x5f,0x14,0x69,0x6c,0x69,0x74,0x79,0xa2,0x45,1,0x66,0x54,0x69,0x18,0x64,0x65, -0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x19,0x73,0x75,0x70,0x70,0x6c,0x65, -0x6d,0x65,0x6e,0x74,0xa3,0x5f,0x13,0x6f,0x72,0x6d,0x73,0xa3,0x53,0x11,0x78,0x74, -6,0x64,0xc,0x64,0xa3,0xd1,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,0x61, -0xa3,0x46,0x62,0xa3,0x5e,0x63,0xa3,0xc5,0x19,0x61,0x64,0x69,0x63,0x61,0x6c,0x73, -0x73,0x75,0x70,0x94,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x95,1,0x74,0x50, -0x79,0x14,0x6d,0x62,0x6f,0x6c,0x73,0x9a,0x1d,0x61,0x6e,0x64,0x70,0x75,0x6e,0x63, -0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x9b,0x14,0x72,0x6f,0x6b,0x65,0x73,0xa3,0x82, -2,0x6e,0x48,0x72,0x64,0x75,0x1d,0x63,0x61,0x73,0x69,0x61,0x6e,0x61,0x6c,0x62, -0x61,0x6e,0x69,0x61,0x6e,0xa3,0xde,0x1d,0x61,0x64,0x69,0x61,0x6e,0x73,0x79,0x6c, -0x6c,0x61,0x62,0x69,0x63,0x73,0x63,0x12,0x69,0x61,0x6e,0xa3,0xa8,2,0x61,0x3a, -0x65,0x4c,0x6f,0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa5,0x2d,1,0x6b,0x26, -0x6d,0xa3,0xa4,0x11,0x6d,0x61,0xa3,0xd4,1,0x72,0x38,0x73,0x17,0x73,0x73,0x79, -0x6d,0x62,0x6f,0x6c,0x73,0xa5,0x19,0x13,0x6f,0x6b,0x65,0x65,0x60,0x12,0x73,0x75, -0x70,0xa2,0xff,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xff,3,0x65,0x3e, -0x69,0x7e,0x6f,0xa2,0x69,0x75,0x15,0x70,0x6c,0x6f,0x79,0x61,0x6e,0xa3,0xe1,1, -0x73,0x50,0x76,0x16,0x61,0x6e,0x61,0x67,0x61,0x72,0x69,0x3e,0x12,0x65,0x78,0x74, -0xa2,0xb3,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0xb3,0x13,0x65,0x72,0x65,0x74,0xa3, +0x61,0xa5,0xe,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,0xa3,0x8b,2,0x62,0x3c,0x67, +0x4a,0x6e,0x17,0x64,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,0xa5,0x26,0x15,0x61,0x74, +0x61,0x65,0x61,0x6e,0xa3,0xef,0x16,0x6d,0x75,0x6e,0x64,0x61,0x72,0x69,0xa5,0x47, +0x67,0xc4,0x5d,0x6a,0xc1,0xe4,0x6a,0xa2,0xdf,0x6b,0xa2,0xf8,0x6c,4,0x61,0x54, +0x65,0xa2,0x6b,0x69,0xa2,0x82,0x6f,0xa2,0xc1,0x79,1,0x63,0x2e,0x64,0x12,0x69, +0x61,0x6e,0xa3,0xa9,0x12,0x69,0x61,0x6e,0xa3,0xa7,1,0x6f,0x55,0x74,0x11,0x69, +0x6e,1,0x31,0x96,0x65,0x11,0x78,0x74,6,0x64,0x21,0x64,0xa3,0x95,0x65,0x2c, +0x66,0xa5,0x39,0x67,0xa5,0x3a,0xa2,0xe7,0x13,0x6e,0x64,0x65,0x64,6,0x64,0xc, +0x64,0xa3,0x95,0x65,0xa3,0xe7,0x66,0xa5,0x39,0x67,0xa5,0x3a,0x61,0x2a,0x62,0x29, +0x63,0xa3,0x94,0x26,0x18,0x64,0x64,0x69,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x6d,0x24, +0x12,0x73,0x75,0x70,0x24,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x25,1,0x70, +0x42,0x74,0x1d,0x74,0x65,0x72,0x6c,0x69,0x6b,0x65,0x73,0x79,0x6d,0x62,0x6f,0x6c, +0x73,0x79,0x12,0x63,0x68,0x61,0xa3,0x9c,2,0x6d,0x4e,0x6e,0x54,0x73,0x10,0x75, +0xa2,0xb0,0x12,0x73,0x75,0x70,0xa4,0x31,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74, +0xa5,0x31,0x11,0x62,0x75,0xa3,0x6f,0x12,0x65,0x61,0x72,1,0x61,0xa3,0xe8,0x62, +1,0x69,0x38,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62,0x61,0x72,0x79,0xa3,0x75,0x17, +0x64,0x65,0x6f,0x67,0x72,0x61,0x6d,0x73,0xa3,0x76,0x1a,0x77,0x73,0x75,0x72,0x72, +0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4d,0x10,0x61,1,0x6d,0x32,0x76,0x14,0x61, +0x6e,0x65,0x73,0x65,0xa3,0xb5,0x10,0x6f,0x5c,0x12,0x65,0x78,0x74,1,0x61,0xa3, +0xb4,0x62,0xa3,0xb9,1,0x61,0xa2,0x43,0x68,4,0x61,0x40,0x69,0x50,0x6d,0x6e, +0x6f,0x86,0x75,0x15,0x64,0x61,0x77,0x61,0x64,0x69,0xa3,0xe6,0x16,0x72,0x6f,0x73, +0x68,0x74,0x68,0x69,0xa3,0x89,0x1d,0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73, +0x63,0x72,0x69,0x70,0x74,0xa5,0x30,0x11,0x65,0x72,0x68,0x16,0x73,0x79,0x6d,0x62, +0x6f,0x6c,0x73,0xa3,0x71,0x12,0x6a,0x6b,0x69,0xa3,0xe5,5,0x74,0x35,0x74,0x34, +0x77,0x7a,0x79,0x13,0x61,0x68,0x6c,0x69,0xa3,0xa2,0x14,0x61,0x6b,0x61,0x6e,0x61, +0x9e,1,0x65,0x4c,0x70,0x10,0x68,0x1f,0x6f,0x6e,0x65,0x74,0x69,0x63,0x65,0x78, +0x74,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0xa3,0x6b,0x11,0x78,0x74,0xa3,0x6b,0x10, +0x69,0xa5,0x46,0x69,0xa2,0x4e,0x6b,0xa2,0x51,0x6e,3,0x61,0x34,0x62,0x84,0x67, +0x8a,0x6e,0x12,0x61,0x64,0x61,0x4d,1,0x65,0x40,0x73,0x11,0x75,0x70,0xa2,0xcb, +0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xcb,0x11,0x78,0x74,2,0x61,0xa5, +0x13,0x62,0xa5,0x38,0x65,0x13,0x6e,0x64,0x65,0x64,1,0x61,0xa5,0x13,0x62,0xa5, +0x38,0x11,0x75,0x6e,0xa3,0x42,0x11,0x78,0x69,0x96,0x17,0x72,0x61,0x64,0x69,0x63, +0x61,0x6c,0x73,0x97,0x12,0x74,0x68,0x69,0xa3,0xc1,0x1c,0x74,0x6f,0x76,0x69,0x6b, +0x6e,0x75,0x6d,0x65,0x72,0x61,0x6c,0x73,0xa5,0x45,0x67,0xa2,0xb5,0x68,0xa4,0x84, +0x69,3,0x64,0x4c,0x6d,0xa2,0x55,0x6e,0xa2,0x62,0x70,0x13,0x61,0x65,0x78,0x74, +0x2a,0x16,0x65,0x6e,0x73,0x69,0x6f,0x6e,0x73,0x2b,1,0x63,0x99,0x65,0x17,0x6f, +0x67,0x72,0x61,0x70,0x68,0x69,0x63,1,0x64,0x56,0x73,0x15,0x79,0x6d,0x62,0x6f, +0x6c,0x73,0xa4,0xb,0x1d,0x61,0x6e,0x64,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74, +0x69,0x6f,0x6e,0xa5,0xb,0x13,0x65,0x73,0x63,0x72,0x1f,0x69,0x70,0x74,0x69,0x6f, +0x6e,0x63,0x68,0x61,0x72,0x61,0x63,0x74,0x65,0x72,0x73,0x99,0x1c,0x70,0x65,0x72, +0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,0x61,0x69,0x63,0xa3,0xba,1,0x64,0x62,0x73, +0x1b,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x70,0x61,1,0x68,0x32, +0x72,0x14,0x74,0x68,0x69,0x61,0x6e,0xa3,0xbd,0x13,0x6c,0x61,0x76,0x69,0xa3,0xbe, +0x11,0x69,0x63,1,0x6e,0x3e,0x73,0x1a,0x69,0x79,0x61,0x71,0x6e,0x75,0x6d,0x62, +0x65,0x72,0x73,0xa5,0x1e,0x19,0x75,0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,0x73, +0xa3,0xb2,4,0x65,0x74,0x6c,0xa2,0x82,0x6f,0xa2,0x9a,0x72,0xa2,0x9e,0x75,2, +0x6a,0x34,0x6e,0x3e,0x72,0x14,0x6d,0x75,0x6b,0x68,0x69,0x43,0x14,0x61,0x72,0x61, +0x74,0x69,0x45,0x18,0x6a,0x61,0x6c,0x61,0x67,0x6f,0x6e,0x64,0x69,0xa5,0x1c,1, +0x6e,0xa2,0x46,0x6f,1,0x6d,0x6e,0x72,0x13,0x67,0x69,0x61,0x6e,0x5a,1,0x65, +0x40,0x73,0x11,0x75,0x70,0xa2,0x87,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3, +0x87,0x11,0x78,0x74,0xa4,0x1b,0x14,0x65,0x6e,0x64,0x65,0x64,0xa5,0x1b,0x1a,0x65, +0x74,0x72,0x69,0x63,0x73,0x68,0x61,0x70,0x65,0x73,0x8c,0x12,0x65,0x78,0x74,0xa2, +0xe3,0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0xe3,0x1e,0x65,0x72,0x61,0x6c,0x70,0x75, +0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x71,0x17,0x61,0x67,0x6f,0x6c,0x69, +0x74,0x69,0x63,0xa2,0x88,0x12,0x73,0x75,0x70,0xa4,0xa,0x16,0x70,0x6c,0x65,0x6d, +0x65,0x6e,0x74,0xa5,0xa,0x13,0x74,0x68,0x69,0x63,0xa3,0x59,1,0x61,0x5c,0x65, +0x11,0x65,0x6b,0x30,1,0x61,0x38,0x65,0x11,0x78,0x74,0x6e,0x14,0x65,0x6e,0x64, +0x65,0x64,0x6f,0x17,0x6e,0x64,0x63,0x6f,0x70,0x74,0x69,0x63,0x31,0x13,0x6e,0x74, +0x68,0x61,0xa3,0xe4,2,0x61,0xa2,0x48,0x65,0xa2,0xdf,0x69,1,0x67,0x30,0x72, +0x14,0x61,0x67,0x61,0x6e,0x61,0x9d,0x10,0x68,1,0x70,0x3a,0x73,0x18,0x75,0x72, +0x72,0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4b,1,0x72,0x3c,0x75,0x19,0x73,0x75, +0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4c,0x11,0x69,0x76,0x1f,0x61,0x74, +0x65,0x75,0x73,0x65,0x73,0x75,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x73,0xa3,0x4c, +2,0x6c,0x32,0x6e,0x9a,0x74,0x12,0x72,0x61,0x6e,0xa5,2,0x10,0x66,2,0x61, +0x58,0x6d,0x70,0x77,0x14,0x69,0x64,0x74,0x68,0x61,0x1f,0x6e,0x64,0x66,0x75,0x6c, +0x6c,0x77,0x69,0x64,0x74,0x68,0x66,0x6f,0x72,0x6d,0x73,0xa3,0x57,0x1a,0x6e,0x64, +0x66,0x75,0x6c,0x6c,0x66,0x6f,0x72,0x6d,0x73,0xa3,0x57,0x13,0x61,0x72,0x6b,0x73, +0xa3,0x52,2,0x67,0x34,0x69,0xa2,0x45,0x75,0x12,0x6e,0x6f,0x6f,0xa3,0x63,0x11, +0x75,0x6c,0xa2,0x4a,2,0x63,0x3c,0x6a,0x5e,0x73,0x17,0x79,0x6c,0x6c,0x61,0x62, +0x6c,0x65,0x73,0xa3,0x4a,0x1f,0x6f,0x6d,0x70,0x61,0x74,0x69,0x62,0x69,0x6c,0x69, +0x74,0x79,0x6a,0x61,0x6d,0x6f,0xa3,0x41,0x12,0x61,0x6d,0x6f,0x5c,0x17,0x65,0x78, +0x74,0x65,0x6e,0x64,0x65,0x64,1,0x61,0xa3,0xb4,0x62,0xa3,0xb9,0x19,0x66,0x69, +0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,0xa5,0x1d,0x13,0x62,0x72,0x65,0x77,0x37, +0x61,0xa4,0xc,0x62,0xa6,0x59,0x63,0xa8,0x2e,0x64,0xac,0xe9,0x65,5,0x6d,0xa9, +0x6d,0x94,0x6e,0xa2,0x41,0x74,0x15,0x68,0x69,0x6f,0x70,0x69,0x63,0x5e,1,0x65, +0x40,0x73,0x11,0x75,0x70,0xa2,0x86,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3, +0x86,0x11,0x78,0x74,0xa2,0x85,2,0x61,0xa3,0xc8,0x62,0xa5,0x37,0x65,0x13,0x6e, +0x64,0x65,0x64,0xa2,0x85,1,0x61,0xa3,0xc8,0x62,0xa5,0x37,0x16,0x6f,0x74,0x69, +0x63,0x6f,0x6e,0x73,0xa3,0xce,0x15,0x63,0x6c,0x6f,0x73,0x65,0x64,2,0x61,0x5a, +0x63,0x9e,0x69,0x1c,0x64,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x73,0x75, +0x70,0xa2,0xc4,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0xc4,0x16,0x6c,0x70, +0x68,0x61,0x6e,0x75,0x6d,0x86,1,0x65,0x2c,0x73,0x11,0x75,0x70,0xa3,0xc3,0x13, +0x72,0x69,0x63,0x73,0x86,0x18,0x75,0x70,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3, +0xc3,0x11,0x6a,0x6b,0xa2,0x44,0x1f,0x6c,0x65,0x74,0x74,0x65,0x72,0x73,0x61,0x6e, +0x64,0x6d,0x6f,0x6e,0x74,0x68,0x73,0xa3,0x44,0x61,0x4a,0x67,0x76,0x6c,1,0x62, +0x30,0x79,0x13,0x6d,0x61,0x69,0x63,0xa5,0x25,0x13,0x61,0x73,0x61,0x6e,0xa3,0xe2, +0x13,0x72,0x6c,0x79,0x64,0x1f,0x79,0x6e,0x61,0x73,0x74,0x69,0x63,0x63,0x75,0x6e, +0x65,0x69,0x66,0x6f,0x72,0x6d,0xa5,1,0x1f,0x79,0x70,0x74,0x69,0x61,0x6e,0x68, +0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,1,0x66,0x26,0x73,0xa3,0xc2,0x1c, +0x6f,0x72,0x6d,0x61,0x74,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x73,0xa5,0x24,7, +0x6e,0xc0,0xf2,0x6e,0x3e,0x72,0xa2,0x5d,0x73,0xa2,0xe5,0x76,0x14,0x65,0x73,0x74, +0x61,0x6e,0xa3,0xbc,1,0x61,0x92,0x63,0x13,0x69,0x65,0x6e,0x74,1,0x67,0x34, +0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xa5,0x13,0x72,0x65,0x65,0x6b,1, +0x6d,0x34,0x6e,0x15,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x7f,0x13,0x75,0x73,0x69, +0x63,0xa2,0x7e,0x19,0x61,0x6c,0x6e,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x7e, +0x10,0x74,0x1f,0x6f,0x6c,0x69,0x61,0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79, +0x70,0x68,0x73,0xa3,0xfe,2,0x61,0x32,0x6d,0xa2,0x7e,0x72,0x12,0x6f,0x77,0x73, +0x7d,0x12,0x62,0x69,0x63,0x38,3,0x65,0x4a,0x6d,0x80,0x70,0xa2,0x50,0x73,0x11, +0x75,0x70,0xa2,0x80,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x80,0x11,0x78, +0x74,3,0x61,0xa3,0xd2,0x62,0xa5,0x35,0x63,0xa5,0x41,0x65,0x13,0x6e,0x64,0x65, +0x64,2,0x61,0xa3,0xd2,0x62,0xa5,0x35,0x63,0xa5,0x41,0x12,0x61,0x74,0x68,0xa2, +0xd3,0x18,0x65,0x6d,0x61,0x74,0x69,0x63,0x61,0x6c,0x61,0x1f,0x6c,0x70,0x68,0x61, +0x62,0x65,0x74,0x69,0x63,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa3,0xd3,1,0x66, +0x42,0x72,0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x66,0x6f,0x72, +0x6d,0x73,1,0x61,0xa3,0x51,0x62,0xa3,0x55,0x14,0x65,0x6e,0x69,0x61,0x6e,0x35, +0x12,0x63,0x69,0x69,0x23,0x64,0x9e,0x65,0xa2,0x42,0x68,0xa2,0x4d,0x6c,1,0x63, +0x62,0x70,0x17,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x70,1,0x66,0xa3,0x50,0x72, +0x1e,0x65,0x73,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x66,0x6f,0x72,0x6d,0x73, +0xa3,0x50,0x16,0x68,0x65,0x6d,0x69,0x63,0x61,0x6c,0xa2,0xd0,0x16,0x73,0x79,0x6d, +0x62,0x6f,0x6c,0x73,0xa3,0xd0,0x12,0x6c,0x61,0x6d,0xa5,7,0x1a,0x67,0x65,0x61, +0x6e,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa3,0x77,0x11,0x6f,0x6d,0xa3,0xfd,7, +0x6f,0x71,0x6f,0x64,0x72,0xa2,0x41,0x75,0xa2,0x58,0x79,0x1b,0x7a,0x61,0x6e,0x74, +0x69,0x6e,0x65,0x6d,0x75,0x73,0x69,0x63,0xa2,0x5b,0x18,0x61,0x6c,0x73,0x79,0x6d, +0x62,0x6f,0x6c,0x73,0xa3,0x5b,1,0x70,0x34,0x78,0x16,0x64,0x72,0x61,0x77,0x69, +0x6e,0x67,0x89,0x14,0x6f,0x6d,0x6f,0x66,0x6f,0xa0,0x12,0x65,0x78,0x74,0xa2,0x43, +0x14,0x65,0x6e,0x64,0x65,0x64,0xa3,0x43,0x10,0x61,1,0x68,0x40,0x69,0x12,0x6c, +0x6c,0x65,0x92,0x17,0x70,0x61,0x74,0x74,0x65,0x72,0x6e,0x73,0x93,0x11,0x6d,0x69, +0xa3,0xc9,1,0x67,0x2c,0x68,0x11,0x69,0x64,0xa3,0x64,0x14,0x69,0x6e,0x65,0x73, +0x65,0xa3,0x81,0x61,0x48,0x65,0xa2,0x4e,0x68,0xa2,0x52,0x6c,0x1a,0x6f,0x63,0x6b, +0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x73,0x8b,3,0x6c,0x34,0x6d,0x40,0x73,0x66, +0x74,0x11,0x61,0x6b,0xa3,0xc7,0x14,0x69,0x6e,0x65,0x73,0x65,0xa3,0x93,0x11,0x75, +0x6d,0xa2,0xb1,0x12,0x73,0x75,0x70,0xa2,0xca,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e, +0x74,0xa3,0xca,1,0x69,0x30,0x73,0x13,0x61,0x76,0x61,0x68,0xa3,0xdd,0x15,0x63, +0x6c,0x61,0x74,0x69,0x6e,0x23,0x14,0x6e,0x67,0x61,0x6c,0x69,0x41,0x16,0x61,0x69, +0x6b,0x73,0x75,0x6b,0x69,0xa5,8,5,0x6f,0xc1,0x60,0x6f,0xa2,0x69,0x75,0xa4, +0x24,0x79,1,0x70,0xa2,0x44,0x72,0x14,0x69,0x6c,0x6c,0x69,0x63,0x32,1,0x65, +0x4c,0x73,0x11,0x75,0x70,0xa2,0x61,0x16,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa2, +0x61,0x12,0x61,0x72,0x79,0xa3,0x61,0x11,0x78,0x74,4,0x61,0xa3,0x9e,0x62,0xa3, +0xa0,0x63,0xa5,9,0x64,0xa5,0x43,0x65,0x13,0x6e,0x64,0x65,0x64,3,0x61,0xa3, +0x9e,0x62,0xa3,0xa0,0x63,0xa5,9,0x64,0xa5,0x43,0x10,0x72,1,0x69,0x34,0x6f, +0x15,0x6d,0x69,0x6e,0x6f,0x61,0x6e,0xa5,0x36,0x1a,0x6f,0x74,0x73,0x79,0x6c,0x6c, +0x61,0x62,0x61,0x72,0x79,0xa3,0x7b,3,0x6d,0x5a,0x6e,0xa2,0x95,0x70,0xa2,0xa0, +0x75,0x17,0x6e,0x74,0x69,0x6e,0x67,0x72,0x6f,0x64,0xa2,0x9a,0x17,0x6e,0x75,0x6d, +0x65,0x72,0x61,0x6c,0x73,0xa3,0x9a,2,0x62,0x3a,0x6d,0xa2,0x5f,0x70,0x15,0x61, +0x74,0x6a,0x61,0x6d,0x6f,0xa3,0x41,0x14,0x69,0x6e,0x69,0x6e,0x67,2,0x64,0x46, +0x68,0x9e,0x6d,0x1d,0x61,0x72,0x6b,0x73,0x66,0x6f,0x72,0x73,0x79,0x6d,0x62,0x6f, +0x6c,0x73,0x77,0x1e,0x69,0x61,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x6d,0x61, +0x72,0x6b,0x73,0x2e,2,0x65,0x40,0x66,0xa6,0x52,0x73,0x18,0x75,0x70,0x70,0x6c, +0x65,0x6d,0x65,0x6e,0x74,0xa3,0x83,0x16,0x78,0x74,0x65,0x6e,0x64,0x65,0x64,0xa3, +0xe0,0x17,0x61,0x6c,0x66,0x6d,0x61,0x72,0x6b,0x73,0xa3,0x52,0x11,0x6f,0x6e,0x1f, +0x69,0x6e,0x64,0x69,0x63,0x6e,0x75,0x6d,0x62,0x65,0x72,0x66,0x6f,0x72,0x6d,0x73, +0xa3,0xb2,0x1b,0x74,0x72,0x6f,0x6c,0x70,0x69,0x63,0x74,0x75,0x72,0x65,0x73,0x83, +0x12,0x74,0x69,0x63,0xa2,0x84,0x1b,0x65,0x70,0x61,0x63,0x74,0x6e,0x75,0x6d,0x62, +0x65,0x72,0x73,0xa3,0xdf,1,0x6e,0x3e,0x72,0x1b,0x72,0x65,0x6e,0x63,0x79,0x73, +0x79,0x6d,0x62,0x6f,0x6c,0x73,0x75,0x15,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa2,0x98, +0x16,0x6e,0x75,0x6d,0x62,0x65,0x72,0x73,0xa2,0x99,0x1d,0x61,0x6e,0x64,0x70,0x75, +0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xa3,0x99,0x61,0xa2,0xea,0x68,0xa4, +0x14,0x6a,0x10,0x6b,0xa2,0x47,4,0x63,0x92,0x65,0xa2,0x83,0x72,0xa2,0xa1,0x73, +0xa2,0xb3,0x75,0x1f,0x6e,0x69,0x66,0x69,0x65,0x64,0x69,0x64,0x65,0x6f,0x67,0x72, +0x61,0x70,0x68,0x73,0xa2,0x47,0x18,0x65,0x78,0x74,0x65,0x6e,0x73,0x69,0x6f,0x6e, +8,0x65,0x71,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,0x68,0xa5,0x42,0x69, +0xa5,0x48,0x14,0x6f,0x6d,0x70,0x61,0x74,0xa2,0x45,1,0x66,0x96,0x69,1,0x62, +0x44,0x64,0x17,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x12,0x73,0x75, +0x70,0xa3,0x5f,0x14,0x69,0x6c,0x69,0x74,0x79,0xa2,0x45,1,0x66,0x54,0x69,0x18, +0x64,0x65,0x6f,0x67,0x72,0x61,0x70,0x68,0x73,0xa2,0x4f,0x19,0x73,0x75,0x70,0x70, +0x6c,0x65,0x6d,0x65,0x6e,0x74,0xa3,0x5f,0x13,0x6f,0x72,0x6d,0x73,0xa3,0x53,0x11, +0x78,0x74,8,0x65,0xf,0x65,0xa5,0,0x66,0xa5,0x12,0x67,0xa5,0x2e,0x68,0xa5, +0x42,0x69,0xa5,0x48,0x61,0xa3,0x46,0x62,0xa3,0x5e,0x63,0xa3,0xc5,0x64,0xa3,0xd1, +0x19,0x61,0x64,0x69,0x63,0x61,0x6c,0x73,0x73,0x75,0x70,0x94,0x16,0x70,0x6c,0x65, +0x6d,0x65,0x6e,0x74,0x95,1,0x74,0x50,0x79,0x14,0x6d,0x62,0x6f,0x6c,0x73,0x9a, +0x1d,0x61,0x6e,0x64,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x9b, +0x14,0x72,0x6f,0x6b,0x65,0x73,0xa3,0x82,2,0x6e,0x48,0x72,0x64,0x75,0x1d,0x63, +0x61,0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,0x61,0x6e,0x69,0x61,0x6e,0xa3,0xde,0x1d, +0x61,0x64,0x69,0x61,0x6e,0x73,0x79,0x6c,0x6c,0x61,0x62,0x69,0x63,0x73,0x63,0x12, +0x69,0x61,0x6e,0xa3,0xa8,2,0x61,0x3a,0x65,0x4c,0x6f,0x16,0x72,0x61,0x73,0x6d, +0x69,0x61,0x6e,0xa5,0x2d,1,0x6b,0x26,0x6d,0xa3,0xa4,0x11,0x6d,0x61,0xa3,0xd4, +1,0x72,0x38,0x73,0x17,0x73,0x73,0x79,0x6d,0x62,0x6f,0x6c,0x73,0xa5,0x19,0x13, +0x6f,0x6b,0x65,0x65,0x60,0x12,0x73,0x75,0x70,0xa2,0xff,0x16,0x70,0x6c,0x65,0x6d, +0x65,0x6e,0x74,0xa3,0xff,3,0x65,0x3e,0x69,0x8e,0x6f,0xa2,0x71,0x75,0x15,0x70, +0x6c,0x6f,0x79,0x61,0x6e,0xa3,0xe1,1,0x73,0x60,0x76,0x16,0x61,0x6e,0x61,0x67, +0x61,0x72,0x69,0x3e,0x12,0x65,0x78,0x74,0xa2,0xb3,1,0x61,0xa5,0x44,0x65,0x13, +0x6e,0x64,0x65,0x64,0xa2,0xb3,0x10,0x61,0xa5,0x44,0x13,0x65,0x72,0x65,0x74,0xa3, 0x5a,2,0x61,0x3a,0x6e,0x82,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa5, 0x2f,0x18,0x63,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x73,0x2e,2,0x65,0x30,0x66, 0x36,0x73,0x11,0x75,0x70,0xa3,0x83,0x11,0x78,0x74,0xa3,0xe0,0x18,0x6f,0x72,0x73, @@ -645,407 +668,419 @@ const uint8_t PropNameData::bytesTries[14992]={ 0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4b,2,0x61,0x30,0x65,0x4a, 0x69,0x12,0x67,0x69,0x74,0x33,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61, 0x74,0x69,0x6f,0x6e,0x47,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65, -0x72,0x33,0,0x12,0x6d,0xc2,0x3f,0x73,0xa1,0x73,0x4e,0x74,0xa2,0x56,0x77,0xa2, -0x72,0x79,0xa2,0x73,0x7a,1,0x61,0x2c,0x68,0x12,0x61,0x69,0x6e,0x8b,0x11,0x69, -0x6e,0x85,5,0x74,0x22,0x74,0x38,0x77,0x4c,0x79,0x16,0x72,0x69,0x61,0x63,0x77, -0x61,0x77,0x6f,0x18,0x72,0x61,0x69,0x67,0x68,0x74,0x77,0x61,0x77,0xa3,0x55,0x15, -0x61,0x73,0x68,0x6b,0x61,0x66,0x6d,0x61,0x2e,0x65,0x38,0x68,0x11,0x69,0x6e,0x6b, -0x10,0x64,0x62,0x11,0x68,0x65,0x65,1,0x65,0x2e,0x6d,0x13,0x6b,0x61,0x74,0x68, -0x69,0x10,0x6e,0x67,1,0x61,0x4e,0x65,1,0x68,0x28,0x74,0x10,0x68,0x77,0x16, -0x6d,0x61,0x72,0x62,0x75,0x74,0x61,0x74,0x13,0x67,0x6f,0x61,0x6c,0x3d,1,0x68, -0x71,0x77,0x73,0x11,0x61,0x77,0x79,1,0x65,0x32,0x75,0x11,0x64,0x68,0x80,0x11, -0x68,0x65,0x83,0x10,0x68,0x7a,1,0x62,0x34,0x77,0x16,0x69,0x74,0x68,0x74,0x61, -0x69,0x6c,0x7f,0x14,0x61,0x72,0x72,0x65,0x65,0x7d,0x6d,0x6c,0x6e,0xa4,0x6b,0x70, -0xa4,0x88,0x71,0xa4,0x88,0x72,1,0x65,0x38,0x6f,0x18,0x68,0x69,0x6e,0x67,0x79, -0x61,0x79,0x65,0x68,0x93,1,0x68,0x5f,0x76,0x16,0x65,0x72,0x73,0x65,0x64,0x70, -0x65,0x61,2,0x61,0x2e,0x65,0xa4,0x3e,0x69,0x10,0x6d,0x53,1,0x6c,0xa2,0xe7, -0x6e,0x16,0x69,0x63,0x68,0x61,0x65,0x61,0x6e,0,0x12,0x6e,0x76,0x73,0x51,0x73, -0x3e,0x74,0x5c,0x77,0xa0,0x79,0xa2,0x42,0x7a,0x13,0x61,0x79,0x69,0x6e,0xa3,0x54, -0x10,0x61,1,0x64,0x2e,0x6d,0x12,0x65,0x6b,0x68,0xa3,0x4c,0x11,0x68,0x65,0xa3, -0x4b,3,0x61,0x38,0x65,0x3c,0x68,0x4a,0x77,0x13,0x65,0x6e,0x74,0x79,0xa3,0x51, -0x10,0x77,0xa3,0x4d,1,0x6e,0xa3,0x4e,0x74,0x10,0x68,0xa3,0x4f,0x14,0x61,0x6d, -0x65,0x64,0x68,0xa3,0x50,0x11,0x61,0x77,0xa3,0x52,0x12,0x6f,0x64,0x68,0xa3,0x53, -0x6e,0x3a,0x6f,0x40,0x70,0x46,0x71,0x4a,0x72,0x12,0x65,0x73,0x68,0xa3,0x4a,0x11, -0x75,0x6e,0xa3,0x46,0x11,0x6e,0x65,0xa3,0x47,0x10,0x65,0xa3,0x48,0x12,0x6f,0x70, -0x68,0xa3,0x49,0x67,0x33,0x67,0x38,0x68,0x40,0x6b,0x5e,0x6c,0x66,0x6d,0x11,0x65, -0x6d,0xa3,0x45,0x13,0x69,0x6d,0x65,0x6c,0xa1,1,0x65,0x32,0x75,0x14,0x6e,0x64, -0x72,0x65,0x64,0xa3,0x42,0x11,0x74,0x68,0xa3,0x41,0x12,0x61,0x70,0x68,0xa3,0x43, -0x14,0x61,0x6d,0x65,0x64,0x68,0xa3,0x44,0x61,0x34,0x62,0x4a,0x64,0x50,0x66,0x12, -0x69,0x76,0x65,0x9f,1,0x6c,0x2a,0x79,0x11,0x69,0x6e,0x97,0x12,0x65,0x70,0x68, -0x95,0x12,0x65,0x74,0x68,0x99,1,0x61,0x30,0x68,0x14,0x61,0x6d,0x65,0x64,0x68, -0x9d,0x13,0x6c,0x65,0x74,0x68,0x9b,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,6,0x6e, -0x2c,0x6e,0x34,0x72,0x5e,0x73,0x62,0x74,0x11,0x74,0x61,0xa3,0x63,2,0x67,0x2e, -0x6e,0x32,0x79,0x10,0x61,0xa3,0x60,0x10,0x61,0xa3,0x5d,1,0x61,0xa3,0x5e,0x6e, -0x10,0x61,0xa3,0x5f,0x10,0x61,0xa3,0x61,0x11,0x73,0x61,0xa3,0x62,0x62,0x3c,0x6a, -0x42,0x6c,0x10,0x6c,1,0x61,0xa3,0x5b,0x6c,0x10,0x61,0xa3,0x5c,0x11,0x68,0x61, -0xa3,0x59,0x10,0x61,0xa3,0x5a,0x11,0x65,0x6d,0x51,2,0x6f,0x2c,0x75,0x50,0x79, -0x10,0x61,0x91,1,0x6a,0x28,0x6f,0x10,0x6e,0x55,0x1a,0x6f,0x69,0x6e,0x69,0x6e, -0x67,0x67,0x72,0x6f,0x75,0x70,0x21,0x10,0x6e,0x57,0x10,0x65,0x59,0x10,0x61,1, -0x66,0x5b,0x70,0x10,0x68,0x5d,0x66,0x9a,0x66,0x42,0x67,0x7a,0x68,0x8a,0x6b,0xa2, -0x75,0x6c,0x11,0x61,0x6d,0x4c,0x12,0x61,0x64,0x68,0x4f,2,0x61,0x3e,0x65,0x4a, +0x72,0x33,0,0x13,0x6e,0xc1,0xf,0x74,0x76,0x74,0x4c,0x76,0x9a,0x77,0xa2,0x48, +0x79,0xa2,0x49,0x7a,1,0x61,0x2c,0x68,0x12,0x61,0x69,0x6e,0x8b,0x11,0x69,0x6e, +0x85,2,0x61,0x36,0x65,0x3c,0x68,0x14,0x69,0x6e,0x79,0x65,0x68,0xa3,0x66,1, +0x68,0x71,0x77,0x73,1,0x68,0x28,0x74,0x10,0x68,0x77,0x16,0x6d,0x61,0x72,0x62, +0x75,0x74,0x61,0x74,0x13,0x67,0x6f,0x61,0x6c,0x3d,0x1a,0x65,0x72,0x74,0x69,0x63, +0x61,0x6c,0x74,0x61,0x69,0x6c,0xa3,0x67,0x11,0x61,0x77,0x79,1,0x65,0x32,0x75, +0x11,0x64,0x68,0x80,0x11,0x68,0x65,0x83,0x10,0x68,0x7a,1,0x62,0x34,0x77,0x16, +0x69,0x74,0x68,0x74,0x61,0x69,0x6c,0x7f,0x14,0x61,0x72,0x72,0x65,0x65,0x7d,0x6e, +0xa2,0x4c,0x70,0xa2,0x69,0x71,0xa2,0x69,0x72,0xa2,0x6f,0x73,5,0x74,0x22,0x74, +0x38,0x77,0x4c,0x79,0x16,0x72,0x69,0x61,0x63,0x77,0x61,0x77,0x6f,0x18,0x72,0x61, +0x69,0x67,0x68,0x74,0x77,0x61,0x77,0xa3,0x55,0x15,0x61,0x73,0x68,0x6b,0x61,0x66, +0x6d,0x61,0x2e,0x65,0x38,0x68,0x11,0x69,0x6e,0x6b,0x10,0x64,0x62,0x11,0x68,0x65, +0x65,1,0x65,0x2e,0x6d,0x13,0x6b,0x61,0x74,0x68,0x69,0x10,0x6e,0x67,2,0x6f, +0x2c,0x75,0x50,0x79,0x10,0x61,0x91,1,0x6a,0x28,0x6f,0x10,0x6e,0x55,0x1a,0x6f, +0x69,0x6e,0x69,0x6e,0x67,0x67,0x72,0x6f,0x75,0x70,0x21,0x10,0x6e,0x57,0x10,0x65, +0x59,0x10,0x61,1,0x66,0x5b,0x70,0x10,0x68,0x5d,1,0x65,0x38,0x6f,0x18,0x68, +0x69,0x6e,0x67,0x79,0x61,0x79,0x65,0x68,0x93,1,0x68,0x5f,0x76,0x16,0x65,0x72, +0x73,0x65,0x64,0x70,0x65,0x61,0x67,0xc1,0xc7,0x67,0xa4,0x52,0x68,0xa4,0x59,0x6b, +0xa4,0x99,0x6c,0xa4,0xb2,0x6d,2,0x61,0x2e,0x65,0xa4,0x3e,0x69,0x10,0x6d,0x53, +1,0x6c,0xa2,0xe7,0x6e,0x16,0x69,0x63,0x68,0x61,0x65,0x61,0x6e,0,0x12,0x6e, +0x76,0x73,0x51,0x73,0x3e,0x74,0x5c,0x77,0xa0,0x79,0xa2,0x42,0x7a,0x13,0x61,0x79, +0x69,0x6e,0xa3,0x54,0x10,0x61,1,0x64,0x2e,0x6d,0x12,0x65,0x6b,0x68,0xa3,0x4c, +0x11,0x68,0x65,0xa3,0x4b,3,0x61,0x38,0x65,0x3c,0x68,0x4a,0x77,0x13,0x65,0x6e, +0x74,0x79,0xa3,0x51,0x10,0x77,0xa3,0x4d,1,0x6e,0xa3,0x4e,0x74,0x10,0x68,0xa3, +0x4f,0x14,0x61,0x6d,0x65,0x64,0x68,0xa3,0x50,0x11,0x61,0x77,0xa3,0x52,0x12,0x6f, +0x64,0x68,0xa3,0x53,0x6e,0x3a,0x6f,0x40,0x70,0x46,0x71,0x4a,0x72,0x12,0x65,0x73, +0x68,0xa3,0x4a,0x11,0x75,0x6e,0xa3,0x46,0x11,0x6e,0x65,0xa3,0x47,0x10,0x65,0xa3, +0x48,0x12,0x6f,0x70,0x68,0xa3,0x49,0x67,0x33,0x67,0x38,0x68,0x40,0x6b,0x5e,0x6c, +0x66,0x6d,0x11,0x65,0x6d,0xa3,0x45,0x13,0x69,0x6d,0x65,0x6c,0xa1,1,0x65,0x32, +0x75,0x14,0x6e,0x64,0x72,0x65,0x64,0xa3,0x42,0x11,0x74,0x68,0xa3,0x41,0x12,0x61, +0x70,0x68,0xa3,0x43,0x14,0x61,0x6d,0x65,0x64,0x68,0xa3,0x44,0x61,0x34,0x62,0x4a, +0x64,0x50,0x66,0x12,0x69,0x76,0x65,0x9f,1,0x6c,0x2a,0x79,0x11,0x69,0x6e,0x97, +0x12,0x65,0x70,0x68,0x95,0x12,0x65,0x74,0x68,0x99,1,0x61,0x30,0x68,0x14,0x61, +0x6d,0x65,0x64,0x68,0x9d,0x13,0x6c,0x65,0x74,0x68,0x9b,0x15,0x61,0x79,0x61,0x6c, +0x61,0x6d,6,0x6e,0x2c,0x6e,0x34,0x72,0x5e,0x73,0x62,0x74,0x11,0x74,0x61,0xa3, +0x63,2,0x67,0x2e,0x6e,0x32,0x79,0x10,0x61,0xa3,0x60,0x10,0x61,0xa3,0x5d,1, +0x61,0xa3,0x5e,0x6e,0x10,0x61,0xa3,0x5f,0x10,0x61,0xa3,0x61,0x11,0x73,0x61,0xa3, +0x62,0x62,0x3c,0x6a,0x42,0x6c,0x10,0x6c,1,0x61,0xa3,0x5b,0x6c,0x10,0x61,0xa3, +0x5c,0x11,0x68,0x61,0xa3,0x59,0x10,0x61,0xa3,0x5a,0x11,0x65,0x6d,0x51,0x10,0x61, +1,0x66,0x37,0x6d,0x11,0x61,0x6c,0x39,1,0x61,0x40,0x65,0x3e,1,0x68,0x28, +0x74,0x10,0x68,0x45,0x40,0x13,0x67,0x6f,0x61,0x6c,0x43,2,0x68,0x3b,0x6d,0x5c, +0x6e,0x1a,0x69,0x66,0x69,0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,1,0x6b,0x2a, +0x70,0x10,0x61,0xa3,0x65,0x15,0x69,0x6e,0x6e,0x61,0x79,0x61,0xa3,0x64,0x1a,0x7a, +0x61,0x6f,0x6e,0x68,0x65,0x68,0x67,0x6f,0x61,0x6c,0x3d,2,0x61,0x3a,0x68,0x44, +0x6e,0x17,0x6f,0x74,0x74,0x65,0x64,0x68,0x65,0x68,0x4b,1,0x66,0x47,0x70,0x10, +0x68,0x49,0x12,0x61,0x70,0x68,0x89,0x11,0x61,0x6d,0x4c,0x12,0x61,0x64,0x68,0x4f, +0x61,0x6e,0x62,0xa2,0x54,0x64,0xa2,0x70,0x65,0x31,0x66,2,0x61,0x3e,0x65,0x4a, 0x69,0x19,0x6e,0x61,0x6c,0x73,0x65,0x6d,0x6b,0x61,0x74,0x68,0x35,0x15,0x72,0x73, -0x69,0x79,0x65,0x68,0x8f,0x86,0x10,0x68,0x33,0x10,0x61,1,0x66,0x37,0x6d,0x11, -0x61,0x6c,0x39,1,0x61,0x40,0x65,0x3e,1,0x68,0x28,0x74,0x10,0x68,0x45,0x40, -0x13,0x67,0x6f,0x61,0x6c,0x43,2,0x68,0x3b,0x6d,0x5c,0x6e,0x1a,0x69,0x66,0x69, -0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,1,0x6b,0x2a,0x70,0x10,0x61,0xa3,0x65, -0x15,0x69,0x6e,0x6e,0x61,0x79,0x61,0xa3,0x64,0x1a,0x7a,0x61,0x6f,0x6e,0x68,0x65, -0x68,0x67,0x6f,0x61,0x6c,0x3d,2,0x61,0x3a,0x68,0x44,0x6e,0x17,0x6f,0x74,0x74, -0x65,0x64,0x68,0x65,0x68,0x4b,1,0x66,0x47,0x70,0x10,0x68,0x49,0x12,0x61,0x70, -0x68,0x89,0x61,0x2e,0x62,0x8a,0x64,0xa2,0x51,0x65,0x31,2,0x66,0x3c,0x69,0x70, -0x6c,1,0x61,0x28,0x65,0x10,0x66,0x27,0x11,0x70,0x68,0x25,0x14,0x72,0x69,0x63, -0x61,0x6e,2,0x66,0x30,0x6e,0x36,0x71,0x11,0x61,0x66,0xa3,0x58,0x11,0x65,0x68, -0xa3,0x56,0x12,0x6f,0x6f,0x6e,0xa3,0x57,0x10,0x6e,0x23,1,0x65,0x4a,0x75,0x10, -0x72,0x1f,0x75,0x73,0x68,0x61,0x73,0x6b,0x69,0x79,0x65,0x68,0x62,0x61,0x72,0x72, -0x65,0x65,0x8d,1,0x68,0x29,0x74,0x10,0x68,0x2b,0x11,0x61,0x6c,0x2c,0x16,0x61, -0x74,0x68,0x72,0x69,0x73,0x68,0x2f,7,0x6e,0x2e,0x6e,0x2c,0x72,0x3e,0x74,0x56, -0x75,0x21,0x18,0x6f,0x6e,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x21,0x28,0x1a,0x69, -0x67,0x68,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x29,0x2a,0x19,0x72,0x61,0x6e, -0x73,0x70,0x61,0x72,0x65,0x6e,0x74,0x2b,0x63,0x23,0x64,0x40,0x6a,0x56,0x6c,0x26, -0x19,0x65,0x66,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x27,0x24,0x19,0x75,0x61, -0x6c,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x25,0x19,0x6f,0x69,0x6e,0x63,0x61,0x75, -0x73,0x69,0x6e,0x67,0x23,0,0x13,0x6e,0xc0,0xd0,0x73,0x49,0x73,0x48,0x75,0x78, -0x77,0x84,0x78,0x9c,0x7a,0x10,0x77,0x58,1,0x6a,0x75,0x73,0x13,0x70,0x61,0x63, -0x65,0x59,4,0x61,0x51,0x67,0x53,0x70,0x28,0x75,0x30,0x79,0x57,0x54,0x12,0x61, -0x63,0x65,0x55,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x53,0x15,0x6e,0x6b,0x6e, -0x6f,0x77,0x6e,0x21,1,0x6a,0x5d,0x6f,0x17,0x72,0x64,0x6a,0x6f,0x69,0x6e,0x65, -0x72,0x5d,0x10,0x78,0x21,0x6e,0x60,0x6f,0xa2,0x41,0x70,0xa2,0x50,0x71,0xa2,0x6e, -0x72,1,0x65,0x24,0x69,0x6f,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64, -0x69,0x63,0x61,0x74,0x6f,0x72,0x6f,4,0x65,0x3e,0x6c,0x5b,0x6f,0x46,0x73,0x45, -0x75,0x46,0x14,0x6d,0x65,0x72,0x69,0x63,0x47,0x15,0x78,0x74,0x6c,0x69,0x6e,0x65, -0x5b,0x17,0x6e,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x45,0x10,0x70,0x48,0x1c,0x65, -0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x49,1,0x6f,0x3e, -0x72,0x4c,0x1a,0x65,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4d,0x4a, -0x1b,0x73,0x74,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63,0x4b,0x10,0x75, -0x4e,0x16,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x68,0x7b,0x68,0x50,0x69,0x86, -0x6a,0xa2,0x61,0x6c,0xa2,0x65,0x6d,0x1c,0x61,0x6e,0x64,0x61,0x74,0x6f,0x72,0x79, -0x62,0x72,0x65,0x61,0x6b,0x2d,4,0x32,0x5f,0x33,0x61,0x65,0x34,0x6c,0x6d,0x79, -0x3a,0x13,0x70,0x68,0x65,0x6e,0x3b,0x19,0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74, -0x65,0x72,0x6d,2,0x64,0x28,0x6e,0x3c,0x73,0x41,0x3c,0x18,0x65,0x6f,0x67,0x72, -0x61,0x70,0x68,0x69,0x63,0x3d,0x3e,1,0x66,0x3e,0x73,0x11,0x65,0x70,1,0x61, -0x22,0x65,0x14,0x72,0x61,0x62,0x6c,0x65,0x3f,0x18,0x69,0x78,0x6e,0x75,0x6d,0x65, -0x72,0x69,0x63,0x41,2,0x6c,0x63,0x74,0x65,0x76,0x67,1,0x66,0x43,0x69,0x15, -0x6e,0x65,0x66,0x65,0x65,0x64,0x43,0x61,0x40,0x62,0x70,0x63,0xa2,0x55,0x65,0xa2, -0xdb,0x67,0x10,0x6c,0x38,0x11,0x75,0x65,0x39,2,0x69,0x23,0x6c,0x34,0x6d,0x16, -0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x24,0x17,0x70,0x68,0x61,0x62,0x65,0x74, -0x69,0x63,0x25,4,0x32,0x27,0x61,0x29,0x62,0x2b,0x6b,0x2d,0x72,0x12,0x65,0x61, -0x6b,2,0x61,0x36,0x62,0x3e,0x73,0x15,0x79,0x6d,0x62,0x6f,0x6c,0x73,0x57,0x13, -0x66,0x74,0x65,0x72,0x29,1,0x65,0x2a,0x6f,0x11,0x74,0x68,0x27,0x13,0x66,0x6f, -0x72,0x65,0x2b,7,0x6d,0x51,0x6d,0x33,0x6f,0x28,0x70,0x69,0x72,0x35,1,0x6d, -0x76,0x6e,1,0x64,0x3c,0x74,0x1a,0x69,0x6e,0x67,0x65,0x6e,0x74,0x62,0x72,0x65, -0x61,0x6b,0x2f,0x15,0x69,0x74,0x69,0x6f,0x6e,0x61,0x1f,0x6c,0x6a,0x61,0x70,0x61, -0x6e,0x65,0x73,0x65,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x6b,1,0x62,0x3a,0x70, -0x19,0x6c,0x65,0x78,0x63,0x6f,0x6e,0x74,0x65,0x78,0x74,0x51,0x18,0x69,0x6e,0x69, -0x6e,0x67,0x6d,0x61,0x72,0x6b,0x33,0x61,0x6a,0x62,0x2f,0x6a,0x6b,0x6c,0x30,0x13, -0x6f,0x73,0x65,0x70,1,0x61,0x38,0x75,0x18,0x6e,0x63,0x74,0x75,0x61,0x74,0x69, -0x6f,0x6e,0x31,0x18,0x72,0x65,0x6e,0x74,0x68,0x65,0x73,0x69,0x73,0x69,0x1b,0x72, -0x72,0x69,0x61,0x67,0x65,0x72,0x65,0x74,0x75,0x72,0x6e,0x35,2,0x62,0x3e,0x6d, -0x46,0x78,0x36,0x18,0x63,0x6c,0x61,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x37,0x70,0x12, -0x61,0x73,0x65,0x71,0x72,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x73,1,0x64, -0x42,0x6e,1,0x6f,0x32,0x75,0x26,0x14,0x6d,0x65,0x72,0x69,0x63,0x27,0x11,0x6e, -0x65,0x21,1,0x65,0x2e,0x69,0x24,0x12,0x67,0x69,0x74,0x25,0x22,0x14,0x63,0x69, -0x6d,0x61,0x6c,0x23,0,0x18,0x6e,0xc4,0x2a,0x74,0xc1,0x6d,0x77,0x96,0x77,0xa2, -0x4c,0x78,0xa2,0x70,0x79,0xa2,0x7a,0x7a,6,0x73,0x1e,0x73,0x34,0x78,0x42,0x79, -0x48,0x7a,0x11,0x7a,0x7a,0xa3,0x67,0x10,0x79,1,0x65,0xa3,0xae,0x6d,0xa3,0x81, -0x11,0x78,0x78,0xa3,0x66,0x11,0x79,0x79,0x21,0x61,0x30,0x69,0x58,0x6d,0x11,0x74, -0x68,0xa3,0x80,0x10,0x6e,1,0x61,0x26,0x62,0xa3,0xb1,0x1a,0x62,0x61,0x7a,0x61, -0x72,0x73,0x71,0x75,0x61,0x72,0x65,0xa3,0xb1,0x11,0x6e,0x68,0x23,2,0x61,0x30, -0x63,0x5a,0x6f,0x11,0x6c,0x65,0xa3,0x9b,1,0x6e,0x3c,0x72,0x10,0x61,0xa2,0x92, -0x15,0x6e,0x67,0x63,0x69,0x74,0x69,0xa3,0x92,0x12,0x63,0x68,0x6f,0xa3,0xbc,0x11, -0x68,0x6f,0xa3,0xbc,1,0x70,0x2c,0x73,0x11,0x75,0x78,0xa3,0x65,0x11,0x65,0x6f, -0x9b,1,0x65,0x2c,0x69,0x72,0x11,0x69,0x69,0x73,0x11,0x7a,0x69,0xa2,0xc0,0x11, -0x64,0x69,0xa3,0xc0,0x74,0x4a,0x75,0xa2,0xba,0x76,1,0x61,0x2c,0x69,0x11,0x73, -0x70,0xa3,0x64,0x10,0x69,0xa2,0x63,0x10,0x69,0xa3,0x63,5,0x67,0x36,0x67,0x68, -0x68,0x6c,0x69,2,0x62,0x3a,0x66,0x4a,0x72,0x10,0x68,0xa2,0x9e,0x12,0x75,0x74, -0x61,0xa3,0x9e,1,0x65,0x24,0x74,0x6f,0x12,0x74,0x61,0x6e,0x6f,0x14,0x69,0x6e, -0x61,0x67,0x68,0x99,0x11,0x6c,0x67,0x75,0x10,0x61,1,0x61,0x24,0x69,0x6d,0x6a, -0x11,0x6e,0x61,0x6b,0x61,0x30,0x65,0xa2,0x5b,0x66,0x11,0x6e,0x67,0x99,6,0x6c, -0x21,0x6c,0x32,0x6d,0x38,0x6e,0x44,0x76,0x10,0x74,0xa3,0x7f,1,0x65,0x89,0x75, -0x97,1,0x69,0x24,0x6c,0x67,0x10,0x6c,0x67,0x10,0x67,0xa2,0x9a,0x11,0x75,0x74, -0xa3,0x9a,0x67,0x36,0x69,0x52,0x6b,0x10,0x72,0xa2,0x99,0x10,0x69,0xa3,0x99,1, -0x61,0x30,0x62,0x7a,0x13,0x61,0x6e,0x77,0x61,0x7b,0x12,0x6c,0x6f,0x67,0x75,2, -0x6c,0x32,0x74,0x34,0x76,0x12,0x69,0x65,0x74,0xa3,0x7f,0x10,0x65,0x89,0x12,0x68, -0x61,0x6d,0xa3,0x6a,1,0x6c,0x2a,0x6e,0x10,0x67,0xa3,0x62,0x10,0x75,0x68,0x11, -0x67,0x75,0x69,1,0x67,0x32,0x6e,0x14,0x6b,0x6e,0x6f,0x77,0x6e,0xa3,0x67,0x11, -0x61,0x72,0x8a,0x13,0x69,0x74,0x69,0x63,0x8b,0x71,0xc1,0x13,0x71,0xa2,0xde,0x72, -0xa2,0xe3,0x73,6,0x69,0x8a,0x69,0x72,0x6f,0xa2,0x4c,0x75,0xa2,0x75,0x79,1, -0x6c,0x46,0x72,4,0x63,0x65,0x65,0xa3,0x5f,0x69,0x2c,0x6a,0xa3,0x60,0x6e,0xa3, -0x61,0x11,0x61,0x63,0x65,0x10,0x6f,0x94,0x16,0x74,0x69,0x6e,0x61,0x67,0x72,0x69, -0x95,2,0x64,0x3c,0x67,0x4c,0x6e,1,0x64,0xa3,0x91,0x68,0x62,0x12,0x61,0x6c, -0x61,0x63,0x10,0x64,0xa2,0xa6,0x12,0x68,0x61,0x6d,0xa3,0xa6,0x17,0x6e,0x77,0x72, -0x69,0x74,0x69,0x6e,0x67,0xa3,0x70,2,0x67,0x3a,0x72,0x52,0x79,0x10,0x6f,0xa2, -0xb0,0x12,0x6d,0x62,0x6f,0xa3,0xb0,1,0x64,0x26,0x6f,0xa3,0xb8,0xa2,0xb7,0x12, -0x69,0x61,0x6e,0xa3,0xb7,0x10,0x61,0xa2,0x98,0x16,0x73,0x6f,0x6d,0x70,0x65,0x6e, -0x67,0xa3,0x98,0x11,0x6e,0x64,0xa2,0x71,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0x71, -0x61,0x5c,0x67,0xa2,0x43,0x68,1,0x61,0x2a,0x72,0x10,0x64,0xa3,0x97,2,0x72, -0x28,0x76,0x30,0x77,0x87,0x12,0x61,0x64,0x61,0xa3,0x97,0x12,0x69,0x61,0x6e,0x87, -2,0x6d,0x40,0x72,0x58,0x75,0x10,0x72,0xa2,0x6f,0x15,0x61,0x73,0x68,0x74,0x72, -0x61,0xa3,0x6f,1,0x61,0x26,0x72,0xa3,0x7e,0x14,0x72,0x69,0x74,0x61,0x6e,0xa3, -0x7e,1,0x61,0xa3,0x5e,0x62,0xa3,0x85,0x11,0x6e,0x77,0xa3,0x70,0x11,0x61,0x61, -1,0x63,0x2f,0x69,0x23,3,0x65,0x3e,0x6a,0x48,0x6f,0x4e,0x75,0x10,0x6e,1, -0x69,0x24,0x72,0x61,0x10,0x63,0x61,0x13,0x6a,0x61,0x6e,0x67,0xa3,0x6e,0x11,0x6e, -0x67,0xa3,0x6e,1,0x68,0x2a,0x72,0x10,0x6f,0xa3,0x5d,0x10,0x67,0xa3,0xb6,0x6e, -0xa2,0x83,0x6f,0xa2,0xf2,0x70,5,0x6c,0x1e,0x6c,0x44,0x72,0x4a,0x73,0x1b,0x61, -0x6c,0x74,0x65,0x72,0x70,0x61,0x68,0x6c,0x61,0x76,0x69,0xa3,0x7b,0x11,0x72,0x64, -0xa3,0x5c,0x11,0x74,0x69,0xa3,0x7d,0x61,0x7c,0x65,0xa2,0x54,0x68,3,0x61,0x3e, -0x6c,0x4e,0x6e,0x5e,0x6f,0x16,0x65,0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x5b,0x10, -0x67,0xa2,0x5a,0x12,0x73,0x70,0x61,0xa3,0x5a,2,0x69,0xa3,0x7a,0x70,0xa3,0x7b, -0x76,0xa3,0x7c,0x10,0x78,0xa3,0x5b,2,0x68,0x3e,0x6c,0x50,0x75,0x10,0x63,0xa2, -0xa5,0x14,0x69,0x6e,0x68,0x61,0x75,0xa3,0xa5,0x17,0x61,0x77,0x68,0x68,0x6d,0x6f, -0x6e,0x67,0xa3,0x4b,0x10,0x6d,0xa2,0x90,0x14,0x79,0x72,0x65,0x6e,0x65,0xa3,0x90, -0x11,0x72,0x6d,0xa3,0x59,6,0x6b,0x36,0x6b,0x56,0x73,0x6e,0x75,0x74,0x79,0x11, -0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67,0x70,0x75,0x61,0x63,0x68,0x75,0x65,0x68,0x6d, -0x6f,0x6e,0x67,0xa3,0xba,1,0x67,0x2e,0x6f,0xa2,0x57,0x10,0x6f,0xa3,0x57,0x10, -0x62,0xa3,0x84,0x11,0x68,0x75,0xa3,0x96,0x12,0x73,0x68,0x75,0xa3,0x96,0x61,0x42, -0x62,0x80,0x65,0x10,0x77,1,0x61,0xa3,0xaa,0x74,0x14,0x61,0x69,0x6c,0x75,0x65, -0x97,2,0x62,0x2e,0x6e,0x3c,0x72,0x10,0x62,0xa3,0x8e,0x15,0x61,0x74,0x61,0x65, -0x61,0x6e,0xa3,0x8f,0x10,0x64,0xa2,0xbb,0x16,0x69,0x6e,0x61,0x67,0x61,0x72,0x69, -0xa3,0xbb,0x11,0x61,0x74,0xa3,0x8f,3,0x67,0x5a,0x6c,0x6c,0x72,0xa2,0x93,0x73, -2,0x61,0x36,0x67,0x3c,0x6d,0x10,0x61,0x84,0x12,0x6e,0x79,0x61,0x85,0x11,0x67, -0x65,0xa3,0xab,0x10,0x65,0xa3,0xab,1,0x61,0x2a,0x68,0x11,0x61,0x6d,0x5b,0x10, -0x6d,0x5b,1,0x63,0xa2,0x60,0x64,5,0x70,0x37,0x70,0x36,0x73,0x54,0x74,0x14, -0x75,0x72,0x6b,0x69,0x63,0xa3,0x58,0x11,0x65,0x72,1,0x6d,0x2c,0x73,0x12,0x69, -0x61,0x6e,0x9b,0x11,0x69,0x63,0xa3,0x59,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74, -0x68,0x61,0x72,0x61,0x62,0x69,0x61,0x6e,0xa3,0x85,0x13,0x64,0x69,0x61,0x6e,0xa3, -0xb8,0x68,0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72,0x61,0x62,0x69, -0x61,0x6e,0xa3,0x8e,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e,0xa3,0x4c,0x14, -0x74,0x61,0x6c,0x69,0x63,0x5d,1,0x68,0x26,0x6b,0xa3,0x6d,0x12,0x69,0x6b,0x69, -0xa3,0x6d,2,0x69,0x2c,0x6b,0x30,0x79,0x10,0x61,0x5f,0x11,0x79,0x61,0x5f,0x10, -0x68,0xa3,0x58,0x68,0xc3,0xd,0x6b,0xc2,0x24,0x6b,0xa4,0x17,0x6c,0xa4,0xb2,0x6d, -8,0x6f,0x46,0x6f,0x48,0x72,0x74,0x74,0x80,0x75,0x86,0x79,1,0x61,0x28,0x6d, -0x10,0x72,0x59,0x13,0x6e,0x6d,0x61,0x72,0x59,2,0x64,0x2e,0x6e,0x32,0x6f,0x10, -0x6e,0xa3,0x72,0x10,0x69,0xa3,0xa3,0x10,0x67,0x56,0x14,0x6f,0x6c,0x69,0x61,0x6e, -0x57,0x10,0x6f,0xa2,0x95,0x10,0x6f,0xa3,0x95,0x11,0x65,0x69,0xa3,0x73,0x11,0x6c, -0x74,0xa2,0xa4,0x12,0x61,0x6e,0x69,0xa3,0xa4,0x61,0x36,0x65,0xa2,0x67,0x69,0xa2, -0xbd,0x6c,0x11,0x79,0x6d,0x55,6,0x6e,0x38,0x6e,0x32,0x72,0x5c,0x73,0x6c,0x79, -0x10,0x61,0xa3,0x55,1,0x64,0x38,0x69,0xa2,0x79,0x15,0x63,0x68,0x61,0x65,0x61, -0x6e,0xa3,0x79,0xa2,0x54,0x12,0x61,0x69,0x63,0xa3,0x54,0x10,0x63,0xa2,0xa9,0x12, -0x68,0x65,0x6e,0xa3,0xa9,0x18,0x61,0x72,0x61,0x6d,0x67,0x6f,0x6e,0x64,0x69,0xa3, -0xaf,0x68,0x36,0x6b,0x4c,0x6c,0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x55,1,0x61, -0x26,0x6a,0xa3,0xa0,0x13,0x6a,0x61,0x6e,0x69,0xa3,0xa0,0x10,0x61,0xa2,0xb4,0x12, -0x73,0x61,0x72,0xa3,0xb4,3,0x64,0x78,0x65,0x94,0x6e,0xa2,0x42,0x72,1,0x63, -0xa3,0x8d,0x6f,0xa2,0x56,0x13,0x69,0x74,0x69,0x63,1,0x63,0x3c,0x68,0x19,0x69, -0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x56,0x15,0x75,0x72,0x73,0x69, -0x76,0x65,0xa3,0x8d,1,0x65,0x26,0x66,0xa3,0xb5,0x16,0x66,0x61,0x69,0x64,0x72, -0x69,0x6e,0xa3,0xb5,0x17,0x74,0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa3,0x73,0x10, -0x64,0xa2,0x8c,0x17,0x65,0x6b,0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0x8c,0x11,0x61, -0x6f,0xa3,0x5c,6,0x6e,0x1a,0x6e,0x34,0x6f,0x38,0x70,0x3e,0x74,0x11,0x68,0x69, -0xa3,0x78,0x11,0x64,0x61,0x4b,0x11,0x72,0x65,0xa3,0x77,0x11,0x65,0x6c,0xa3,0x8a, -0x61,0x30,0x68,0x9a,0x69,0x11,0x74,0x73,0xa3,0xbf,4,0x69,0x3c,0x6c,0x44,0x6e, -0x48,0x74,0x56,0x79,0x13,0x61,0x68,0x6c,0x69,0xa3,0x4f,0x12,0x74,0x68,0x69,0xa3, -0x78,0x10,0x69,0xa3,0x4f,1,0x61,0x4d,0x6e,0x12,0x61,0x64,0x61,0x4b,0x14,0x61, -0x6b,0x61,0x6e,0x61,0x4c,0x19,0x6f,0x72,0x68,0x69,0x72,0x61,0x67,0x61,0x6e,0x61, -0x8d,4,0x61,0x40,0x69,0x52,0x6d,0x70,0x6f,0x7c,0x75,0x15,0x64,0x61,0x77,0x61, -0x64,0x69,0xa3,0x91,0x10,0x72,0x92,0x15,0x6f,0x73,0x68,0x74,0x68,0x69,0x93,0x1d, -0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74,0xa3,0xbf, -1,0x65,0x24,0x72,0x4f,0x10,0x72,0x4f,0x10,0x6a,0xa2,0x9d,0x11,0x6b,0x69,0xa3, -0x9d,4,0x61,0x5c,0x65,0x90,0x69,0xa0,0x6f,0xa2,0x5d,0x79,1,0x63,0x34,0x64, -0x10,0x69,0xa2,0x6c,0x11,0x61,0x6e,0xa3,0x6c,0x10,0x69,0xa2,0x6b,0x11,0x61,0x6e, -0xa3,0x6b,2,0x6e,0x42,0x6f,0x46,0x74,3,0x66,0xa3,0x50,0x67,0xa3,0x51,0x69, -0x24,0x6e,0x53,0x10,0x6e,0x53,0x10,0x61,0xa3,0x6a,0x50,0x10,0x6f,0x51,0x11,0x70, -0x63,0xa2,0x52,0x11,0x68,0x61,0xa3,0x52,2,0x6d,0x2e,0x6e,0x36,0x73,0x10,0x75, -0xa3,0x83,0x10,0x62,0x80,0x10,0x75,0x81,2,0x61,0xa3,0x53,0x62,0x83,0x65,0x11, -0x61,0x72,1,0x61,0xa3,0x53,0x62,0x83,0x11,0x6d,0x61,0xa3,0x8b,0x68,0x6e,0x69, -0xa2,0x95,0x6a,2,0x61,0x30,0x70,0x52,0x75,0x11,0x72,0x63,0xa3,0x94,1,0x6d, -0x38,0x76,0x10,0x61,0xa2,0x4e,0x13,0x6e,0x65,0x73,0x65,0xa3,0x4e,0x10,0x6f,0xa3, -0xad,0x11,0x61,0x6e,0xa3,0x69,6,0x6c,0x1e,0x6c,0x34,0x6d,0x3a,0x72,0x48,0x75, -0x11,0x6e,0x67,0xa3,0x4c,0x11,0x75,0x77,0xa3,0x9c,0x10,0x6e,1,0x67,0xa3,0x4b, -0x70,0xa3,0xba,0x11,0x6b,0x74,0x8d,0x61,0x3c,0x65,0xa2,0x43,0x69,0x11,0x72,0x61, -0x48,0x13,0x67,0x61,0x6e,0x61,0x49,1,0x6e,0x34,0x74,0x10,0x72,0xa2,0xa2,0x11, -0x61,0x6e,0xa3,0xa2,0x42,6,0x6f,0xe,0x6f,0x77,0x73,0xa3,0x49,0x74,0xa3,0x4a, -0x75,0x12,0x6e,0x6f,0x6f,0x77,0x62,0xa3,0xac,0x67,0x3e,0x69,0x42,0x19,0x66,0x69, -0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,0xa3,0xb6,0x44,0x11,0x75,0x6c,0x45,0x11, -0x62,0x72,0x46,0x11,0x65,0x77,0x47,2,0x6d,0x2e,0x6e,0x4a,0x74,0x11,0x61,0x6c, -0x5d,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,0x61,0x69,0x63,0xa3, -0x74,2,0x64,0x66,0x68,0x6a,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e, -0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e,0xa3,0x7d, -0x13,0x6c,0x61,0x76,0x69,0xa3,0x7a,0x10,0x73,0xa3,0x4d,0x15,0x65,0x72,0x69,0x74, -0x65,0x64,0x23,0x64,0xc1,0xd,0x64,0xa2,0x7a,0x65,0xa2,0xc1,0x67,4,0x65,0x82, -0x6c,0x9a,0x6f,0xa2,0x46,0x72,0xa2,0x55,0x75,2,0x6a,0x3c,0x6e,0x4e,0x72,1, -0x6d,0x24,0x75,0x41,0x13,0x75,0x6b,0x68,0x69,0x41,1,0x61,0x24,0x72,0x3f,0x13, -0x72,0x61,0x74,0x69,0x3f,0x18,0x6a,0x61,0x6c,0x61,0x67,0x6f,0x6e,0x64,0x69,0xa3, -0xb3,0x10,0x6f,1,0x6b,0xa3,0x48,0x72,0x38,0x13,0x67,0x69,0x61,0x6e,0x39,0x11, -0x61,0x67,0x90,0x15,0x6f,0x6c,0x69,0x74,0x69,0x63,0x91,1,0x6e,0x30,0x74,0x10, -0x68,0x3a,0x11,0x69,0x63,0x3b,1,0x67,0xa3,0xb3,0x6d,0xa3,0xaf,1,0x61,0x32, -0x65,1,0x65,0x24,0x6b,0x3d,0x10,0x6b,0x3d,0x10,0x6e,0xa2,0x89,0x12,0x74,0x68, -0x61,0xa3,0x89,4,0x65,0x46,0x69,0x6c,0x6f,0x8c,0x73,0x9a,0x75,0x11,0x70,0x6c, -0xa2,0x87,0x13,0x6f,0x79,0x61,0x6e,0xa3,0x87,1,0x73,0x38,0x76,0x10,0x61,0x34, -0x15,0x6e,0x61,0x67,0x61,0x72,0x69,0x35,0x13,0x65,0x72,0x65,0x74,0x33,1,0x61, -0x36,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa3,0xbe,0x10,0x6b,0xa3,0xbe, -0x11,0x67,0x72,0xa2,0xb2,0x10,0x61,0xa3,0xb2,0x11,0x72,0x74,0x33,2,0x67,0x3a, -0x6c,0x72,0x74,0x11,0x68,0x69,0x36,0x13,0x6f,0x70,0x69,0x63,0x37,0x10,0x79,2, -0x64,0xa3,0x45,0x68,0xa3,0x46,0x70,0xa2,0x47,0x1e,0x74,0x69,0x61,0x6e,0x68,0x69, -0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x47,1,0x62,0x36,0x79,0x10, -0x6d,0xa2,0xb9,0x12,0x61,0x69,0x63,0xa3,0xb9,0x10,0x61,0xa2,0x88,0x12,0x73,0x61, -0x6e,0xa3,0x88,0x61,0xa2,0xb4,0x62,0xa4,0x19,0x63,6,0x6f,0x3d,0x6f,0x5a,0x70, -0x76,0x75,0x7a,0x79,1,0x70,0x3e,0x72,2,0x69,0x2a,0x6c,0x31,0x73,0xa3,0x44, -0x13,0x6c,0x6c,0x69,0x63,0x31,0x13,0x72,0x69,0x6f,0x74,0x7f,1,0x6d,0x30,0x70, -0x10,0x74,0x2e,0x11,0x69,0x63,0x2f,0x12,0x6d,0x6f,0x6e,0x21,0x11,0x72,0x74,0x7f, -0x16,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa3,0x65,0x61,0x32,0x68,0xa2,0x41,0x69, -0x11,0x72,0x74,0xa3,0x43,3,0x6b,0x4c,0x6e,0x50,0x72,0x76,0x75,0x1d,0x63,0x61, -0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,0x61,0x6e,0x69,0x61,0x6e,0xa3,0x9f,0x10,0x6d, -0xa3,0x76,1,0x61,0x24,0x73,0x71,0x1d,0x64,0x69,0x61,0x6e,0x61,0x62,0x6f,0x72, -0x69,0x67,0x69,0x6e,0x61,0x6c,0x71,0x10,0x69,0xa2,0x68,0x11,0x61,0x6e,0xa3,0x68, -3,0x61,0x32,0x65,0x44,0x6f,0x52,0x72,0x10,0x73,0xa3,0xbd,1,0x6b,0x26,0x6d, -0xa3,0x42,0x11,0x6d,0x61,0xa3,0x76,0x10,0x72,0x2c,0x13,0x6f,0x6b,0x65,0x65,0x2d, -0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa3,0xbd,6,0x68,0x4a,0x68,0x48,0x6e, -0x4e,0x72,0x76,0x76,1,0x65,0x2a,0x73,0x10,0x74,0xa3,0x75,0x13,0x73,0x74,0x61, -0x6e,0xa3,0x75,0x11,0x6f,0x6d,0xa3,0xa1,0x11,0x61,0x74,0x1f,0x6f,0x6c,0x69,0x61, -0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x9c,1,0x61, -0x3e,0x6d,2,0x65,0x2a,0x69,0xa3,0x74,0x6e,0x27,0x13,0x6e,0x69,0x61,0x6e,0x27, -0x10,0x62,0x24,0x11,0x69,0x63,0x25,0x64,0x30,0x66,0x44,0x67,0x11,0x68,0x62,0xa3, -0x9f,0x10,0x6c,1,0x61,0x26,0x6d,0xa3,0xa7,0x10,0x6d,0xa3,0xa7,0x11,0x61,0x6b, -0xa3,0x93,6,0x6c,0x3c,0x6c,0x52,0x6f,0x56,0x72,0x66,0x75,1,0x67,0x30,0x68, -1,0x64,0x79,0x69,0x10,0x64,0x79,0x10,0x69,0x8e,0x13,0x6e,0x65,0x73,0x65,0x8f, -0x11,0x69,0x73,0xa1,0x11,0x70,0x6f,0x2a,0x13,0x6d,0x6f,0x66,0x6f,0x2b,0x10,0x61, -1,0x68,0x2e,0x69,0x7c,0x12,0x6c,0x6c,0x65,0x7d,0xa2,0x41,0x11,0x6d,0x69,0xa3, -0x41,0x61,0x48,0x65,0x9c,0x68,1,0x61,0x2a,0x6b,0x10,0x73,0xa3,0xa8,0x15,0x69, -0x6b,0x73,0x75,0x6b,0x69,0xa3,0xa8,3,0x6c,0x3a,0x6d,0x48,0x73,0x54,0x74,1, -0x61,0x24,0x6b,0x9f,0x10,0x6b,0x9f,0x10,0x69,0x9c,0x13,0x6e,0x65,0x73,0x65,0x9d, -0x10,0x75,0xa2,0x82,0x10,0x6d,0xa3,0x82,0x10,0x73,0xa2,0x86,0x13,0x61,0x76,0x61, -0x68,0xa3,0x86,0x11,0x6e,0x67,0x28,0x12,0x61,0x6c,0x69,0x29,3,0x6c,0x42,0x6e, -0x90,0x74,0xa2,0x46,0x76,0x24,0x17,0x6f,0x77,0x65,0x6c,0x6a,0x61,0x6d,0x6f,0x25, -0x22,1,0x65,0x54,0x76,0x28,1,0x73,0x38,0x74,0x2a,0x17,0x73,0x79,0x6c,0x6c, -0x61,0x62,0x6c,0x65,0x2b,0x16,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x29,0x18,0x61, -0x64,0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x23,1,0x61,0x21,0x6f,0x1a,0x74,0x61, -0x70,0x70,0x6c,0x69,0x63,0x61,0x62,0x6c,0x65,0x21,0x26,0x1a,0x72,0x61,0x69,0x6c, -0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x27,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73, -0x23,0x20,0x10,0x6f,0x21,1,0x6e,0x2c,0x79,0x22,0x11,0x65,0x73,0x23,0x20,0x10, -0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11,0x65,0x73,0x23,0x24,0x13,0x61, -0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11, -0x65,0x73,0x23,0x24,0x13,0x61,0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,0xb,0x72, -0x39,0x76,0xc,0x76,0x33,0x78,0x2a,0x7a,0x11,0x77,0x6a,0x43,0x10,0x78,0x21,0x72, -0x28,0x73,0x50,0x74,0x31,1,0x65,0x24,0x69,0x39,0x1e,0x67,0x69,0x6f,0x6e,0x61, -0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x39,1,0x6d,0x35,0x70,0x18, -0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x35,0x6c,0x1f,0x6c,0x3c,0x6f,0x4a, -0x70,1,0x70,0x37,0x72,0x14,0x65,0x70,0x65,0x6e,0x64,0x37,0x28,1,0x66,0x2b, -0x76,0x2c,0x10,0x74,0x2f,0x13,0x74,0x68,0x65,0x72,0x21,0x63,0x4c,0x65,0x64,0x67, -1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66,0x74,0x65,0x72,0x7a,0x77,0x6a,0x41, -0x10,0x7a,0x41,2,0x6e,0x23,0x6f,0x24,0x72,0x25,0x14,0x6e,0x74,0x72,0x6f,0x6c, -0x23,2,0x62,0x34,0x6d,0x4e,0x78,0x26,0x13,0x74,0x65,0x6e,0x64,0x27,0x3a,1, -0x61,0x24,0x67,0x3d,0x11,0x73,0x65,0x3a,0x12,0x67,0x61,0x7a,0x3d,0x3e,0x16,0x6f, -0x64,0x69,0x66,0x69,0x65,0x72,0x3f,9,0x6e,0x4a,0x6e,0x34,0x6f,0x44,0x73,0x60, -0x75,0x94,0x78,0x10,0x78,0x21,0x10,0x75,0x2a,0x14,0x6d,0x65,0x72,0x69,0x63,0x2b, -1,0x6c,0x2c,0x74,0x12,0x68,0x65,0x72,0x21,0x14,0x65,0x74,0x74,0x65,0x72,0x2d, -3,0x63,0x36,0x65,0x46,0x70,0x31,0x74,0x32,0x12,0x65,0x72,0x6d,0x33,0x3c,0x16, -0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3d,0x2e,0x10,0x70,0x2f,0x10,0x70,0x34,0x12, -0x70,0x65,0x72,0x35,0x61,0x46,0x63,0x52,0x65,0x64,0x66,0x72,0x6c,2,0x65,0x2d, -0x66,0x3b,0x6f,0x28,0x12,0x77,0x65,0x72,0x29,0x10,0x74,0x22,0x12,0x65,0x72,0x6d, -0x23,1,0x6c,0x24,0x72,0x37,0x24,0x12,0x6f,0x73,0x65,0x25,0x10,0x78,0x38,0x13, -0x74,0x65,0x6e,0x64,0x39,0x10,0x6f,0x26,0x13,0x72,0x6d,0x61,0x74,0x27,0,0x10, -0x6c,0x88,0x72,0x40,0x72,0x36,0x73,0x5e,0x77,0x7a,0x78,0x8a,0x7a,0x11,0x77,0x6a, -0x4b,1,0x65,0x24,0x69,0x3b,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64, -0x69,0x63,0x61,0x74,0x6f,0x72,0x3b,1,0x69,0x24,0x71,0x3f,0x18,0x6e,0x67,0x6c, -0x65,0x71,0x75,0x6f,0x74,0x65,0x3f,0x17,0x73,0x65,0x67,0x73,0x70,0x61,0x63,0x65, -0x4d,0x10,0x78,0x21,0x6c,0x36,0x6d,0x3c,0x6e,0x76,0x6f,0x13,0x74,0x68,0x65,0x72, -0x21,1,0x65,0x23,0x66,0x35,3,0x62,0x37,0x69,0x28,0x6c,0x29,0x6e,0x2b,0x10, -0x64,1,0x6c,0x34,0x6e,0x11,0x75,0x6d,0x2a,0x12,0x6c,0x65,0x74,0x37,0x14,0x65, -0x74,0x74,0x65,0x72,0x29,2,0x65,0x36,0x6c,0x39,0x75,0x2c,0x14,0x6d,0x65,0x72, -0x69,0x63,0x2d,0x14,0x77,0x6c,0x69,0x6e,0x65,0x39,0x66,0x3f,0x66,0x40,0x67,0x4e, -0x68,0x70,0x6b,0x10,0x61,0x26,0x15,0x74,0x61,0x6b,0x61,0x6e,0x61,0x27,0x10,0x6f, -0x24,0x13,0x72,0x6d,0x61,0x74,0x25,1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66, -0x74,0x65,0x72,0x7a,0x77,0x6a,0x49,0x10,0x7a,0x49,1,0x65,0x24,0x6c,0x3d,0x19, -0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74,0x65,0x72,0x3d,0x61,0x86,0x63,0x92,0x64, -0x94,0x65,2,0x62,0x44,0x6d,0x5e,0x78,0x2e,0x13,0x74,0x65,0x6e,0x64,0x32,0x15, -0x6e,0x75,0x6d,0x6c,0x65,0x74,0x2f,0x42,1,0x61,0x24,0x67,0x45,0x11,0x73,0x65, -0x42,0x12,0x67,0x61,0x7a,0x45,0x46,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x47, -0x15,0x6c,0x65,0x74,0x74,0x65,0x72,0x23,0x10,0x72,0x31,1,0x6f,0x24,0x71,0x41, -0x18,0x75,0x62,0x6c,0x65,0x71,0x75,0x6f,0x74,0x65,0x41,2,0x63,0x32,0x6e,0x3c, -0x6f,0x22,0x12,0x70,0x65,0x6e,0x23,0x24,0x13,0x6c,0x6f,0x73,0x65,0x25,0x20,0x12, -0x6f,0x6e,0x65,0x21,6,0x6f,0x65,0x6f,0x4a,0x72,0x5c,0x74,0x64,0x76,0x1d,0x69, -0x73,0x75,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72,0x6c,0x65,0x66,0x74,0x3d,0x18,0x76, -0x65,0x72,0x73,0x74,0x72,0x75,0x63,0x6b,0x2d,0x13,0x69,0x67,0x68,0x74,0x2f,0x11, -0x6f,0x70,0x30,0x12,0x61,0x6e,0x64,2,0x62,0x32,0x6c,0x62,0x72,0x13,0x69,0x67, -0x68,0x74,0x3b,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x32,0x12,0x61,0x6e,0x64,1,0x6c, -0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x35,0x12,0x65,0x66,0x74,0x3f,0x12,0x65,0x66, -0x74,0x36,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x39,0x62,0x2c,0x6c,0x5c, -0x6e,0x10,0x61,0x21,0x14,0x6f,0x74,0x74,0x6f,0x6d,0x22,0x12,0x61,0x6e,0x64,1, -0x6c,0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x27,0x12,0x65,0x66,0x74,0x25,0x12,0x65, -0x66,0x74,0x28,0x17,0x61,0x6e,0x64,0x72,0x69,0x67,0x68,0x74,0x2b,0xd,0x6e,0xaa, -0x72,0x70,0x72,0x92,0x73,0xa2,0x46,0x74,0xa2,0x54,0x76,1,0x69,0x60,0x6f,0x12, -0x77,0x65,0x6c,0x62,1,0x64,0x3a,0x69,0x19,0x6e,0x64,0x65,0x70,0x65,0x6e,0x64, -0x65,0x6e,0x74,0x67,0x17,0x65,0x70,0x65,0x6e,0x64,0x65,0x6e,0x74,0x65,1,0x72, -0x2e,0x73,0x13,0x61,0x72,0x67,0x61,0x61,0x12,0x61,0x6d,0x61,0x5f,0x1d,0x65,0x67, -0x69,0x73,0x74,0x65,0x72,0x73,0x68,0x69,0x66,0x74,0x65,0x72,0x57,0x1e,0x79,0x6c, -0x6c,0x61,0x62,0x6c,0x65,0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x59,0x12,0x6f, -0x6e,0x65,1,0x6c,0x2c,0x6d,0x12,0x61,0x72,0x6b,0x5d,0x14,0x65,0x74,0x74,0x65, -0x72,0x5b,0x6e,0x3c,0x6f,0x7c,0x70,0x18,0x75,0x72,0x65,0x6b,0x69,0x6c,0x6c,0x65, -0x72,0x55,1,0x6f,0x4c,0x75,1,0x6b,0x3c,0x6d,0x12,0x62,0x65,0x72,0x50,0x15, -0x6a,0x6f,0x69,0x6e,0x65,0x72,0x53,0x11,0x74,0x61,0x4f,0x16,0x6e,0x6a,0x6f,0x69, -0x6e,0x65,0x72,0x4d,0x13,0x74,0x68,0x65,0x72,0x21,0x67,0x3e,0x67,0x4a,0x69,0x64, -0x6a,0x82,0x6d,0x1d,0x6f,0x64,0x69,0x66,0x79,0x69,0x6e,0x67,0x6c,0x65,0x74,0x74, -0x65,0x72,0x4b,0x1c,0x65,0x6d,0x69,0x6e,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72, -0x6b,0x45,0x1e,0x6e,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x73,0x74,0x61,0x63,0x6b, -0x65,0x72,0x47,0x14,0x6f,0x69,0x6e,0x65,0x72,0x49,0x61,0xa2,0xba,0x62,0xa2,0xc0, -0x63,1,0x61,0xa2,0xa2,0x6f,0x16,0x6e,0x73,0x6f,0x6e,0x61,0x6e,0x74,0x2a,8, -0x6b,0x67,0x6b,0x48,0x6d,0x52,0x70,0x5c,0x73,0xa2,0x42,0x77,0x19,0x69,0x74,0x68, -0x73,0x74,0x61,0x63,0x6b,0x65,0x72,0x43,0x14,0x69,0x6c,0x6c,0x65,0x72,0x35,0x14, -0x65,0x64,0x69,0x61,0x6c,0x37,1,0x6c,0x52,0x72,0x10,0x65,1,0x63,0x2e,0x66, -0x13,0x69,0x78,0x65,0x64,0x3d,0x19,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68, -0x61,0x3b,0x18,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x39,0x10,0x75,1, -0x62,0x3e,0x63,0x1b,0x63,0x65,0x65,0x64,0x69,0x6e,0x67,0x72,0x65,0x70,0x68,0x61, -0x41,0x15,0x6a,0x6f,0x69,0x6e,0x65,0x64,0x3f,0x64,0x4c,0x66,0x52,0x68,0x5a,0x69, -0x1e,0x6e,0x69,0x74,0x69,0x61,0x6c,0x70,0x6f,0x73,0x74,0x66,0x69,0x78,0x65,0x64, -0x33,0x12,0x65,0x61,0x64,0x2d,0x13,0x69,0x6e,0x61,0x6c,0x2f,0x18,0x65,0x61,0x64, -0x6c,0x65,0x74,0x74,0x65,0x72,0x31,0x1d,0x6e,0x74,0x69,0x6c,0x6c,0x61,0x74,0x69, -0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x29,0x16,0x76,0x61,0x67,0x72,0x61,0x68,0x61,0x23, -1,0x69,0x4a,0x72,0x10,0x61,0x1f,0x68,0x6d,0x69,0x6a,0x6f,0x69,0x6e,0x69,0x6e, -0x67,0x6e,0x75,0x6d,0x62,0x65,0x72,0x27,0x12,0x6e,0x64,0x75,0x25,2,0x72,0x38, -0x74,0x46,0x75,0x26,0x15,0x70,0x72,0x69,0x67,0x68,0x74,0x27,0x20,0x15,0x6f,0x74, -0x61,0x74,0x65,0x64,0x21,1,0x72,0x24,0x75,0x25,0x22,0x18,0x61,0x6e,0x73,0x66, -0x6f,0x72,0x6d,0x65,0x64,1,0x72,0x32,0x75,0x15,0x70,0x72,0x69,0x67,0x68,0x74, -0x25,0x15,0x6f,0x74,0x61,0x74,0x65,0x64,0x23,0xd,0x6e,0xc1,0x86,0x73,0xa8,0x73, -0x4c,0x74,0xa2,0x76,0x75,0xa2,0x83,0x7a,0xd8,0x70,0,2,0x6c,0xd9,0x20,0, -0x70,0xd9,0x40,0,0x73,0xc3,0,0xfe,0xf,0,0,0,7,0x6f,0x3c,0x6f, -0xff,8,0,0,0,0x70,0x3a,0x75,0x6e,0x79,0x13,0x6d,0x62,0x6f,0x6c,0xff, -0xf,0,0,0,0x11,0x61,0x63,1,0x65,0x34,0x69,0x15,0x6e,0x67,0x6d,0x61, -0x72,0x6b,0xa5,0,0x18,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xc3,0, -0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0xe1,0,0,0x63,0xff,2,0,0, -0,0x65,0x38,0x6b,0xff,4,0,0,0,0x6d,0xff,1,0,0,0,0x16, -0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x70,0,0x1d,0x69,0x74,0x6c,0x65,0x63, -0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x31,1,0x6e,0x40,0x70,0x1c,0x70, -0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x25,0x17,0x61,0x73, -0x73,0x69,0x67,0x6e,0x65,0x64,0x23,0x6e,0xa2,0x69,0x6f,0xa2,0x89,0x70,0xfe,0x30, -0xf8,0,0,9,0x69,0x33,0x69,0xff,0x10,0,0,0,0x6f,0xfd,0x80,0, -0,0x72,0x54,0x73,0xf9,0,0,0x75,0x12,0x6e,0x63,0x74,0xfe,0x30,0xf8,0, -0,0x15,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x30,0xf8,0,0,0x17,0x69,0x76, -0x61,0x74,0x65,0x75,0x73,0x65,0xdd,0,0,0x61,0x48,0x63,0xfd,0x40,0,0, -0x64,0xe9,0,0,0x65,0xfd,0x20,0,0,0x66,0xff,0x20,0,0,0,0x1f, -0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72, -0xd9,0x40,0,0xbe,0,3,0x64,0xa7,0,0x6c,0xab,0,0x6f,0x30,0x75,0x13, -0x6d,0x62,0x65,0x72,0xbf,0,0xb2,0,0x1b,0x6e,0x73,0x70,0x61,0x63,0x69,0x6e, -0x67,0x6d,0x61,0x72,0x6b,0xa1,1,0x70,0x92,0x74,0x12,0x68,0x65,0x72,0xe6,0x80, -1,3,0x6c,0x40,0x6e,0x4a,0x70,0x56,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff, -8,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x61,0x14,0x75,0x6d,0x62,0x65, -0x72,0xb3,0,0x19,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x80, -0,0,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e, -0xf9,0,0,0x66,0xc0,0xc4,0x66,0xa2,0x47,0x69,0xa2,0x64,0x6c,0xa2,0x79,0x6d, -0xa4,0xc0,4,0x61,0x6c,0x63,0xa5,0,0x65,0xa3,0x80,0x6e,0xa1,0x6f,0x15,0x64, -0x69,0x66,0x69,0x65,0x72,1,0x6c,0x38,0x73,0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff, -4,0,0,0,0x14,0x65,0x74,0x74,0x65,0x72,0x41,1,0x72,0x3c,0x74,0x16, -0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,1,0,0,0,0x10,0x6b,0xa5,0xc0, -1,0x69,0x32,0x6f,0x13,0x72,0x6d,0x61,0x74,0xdb,0,0,0x1d,0x6e,0x61,0x6c, -0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x20,0,0,0, -0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74, -0x69,0x6f,0x6e,0xff,0x10,0,0,0,0x9c,7,0x6d,0x18,0x6d,0x41,0x6f,0x28, -0x74,0x31,0x75,0x25,0x60,0x1c,0x77,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74, -0x74,0x65,0x72,0x29,0x63,0x3d,0x65,0x28,0x69,0x42,0x6c,0x29,0x13,0x74,0x74,0x65, -0x72,0x9c,0x15,0x6e,0x75,0x6d,0x62,0x65,0x72,0xab,0,0x1a,0x6e,0x65,0x73,0x65, -0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x20,0,0x63,0x46,0x64,0xa2,0x96,0x65, -0x1b,0x6e,0x63,0x6c,0x6f,0x73,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa3,0x80,0xe6, -0x80,1,7,0x6e,0x57,0x6e,0x52,0x6f,0x5e,0x73,0xe1,0,0,0x75,0x1b,0x72, -0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,2,0,0,0, -0x22,0x12,0x74,0x72,0x6c,0xd9,0x80,0,0xdc,0,0,1,0x6d,0x62,0x6e,1, -0x6e,0x30,0x74,0x12,0x72,0x6f,0x6c,0xd9,0x80,0,0x1f,0x65,0x63,0x74,0x6f,0x72, -0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x40,0,0,0x19, -0x62,0x69,0x6e,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa5,0xc0,0x61,0x58,0x63,0xd9, -0x80,0,0x66,0xdb,0,0,0x6c,0x1d,0x6f,0x73,0x65,0x70,0x75,0x6e,0x63,0x74, -0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x20,0,0,0x18,0x73,0x65,0x64,0x6c,0x65, -0x74,0x74,0x65,0x72,0x3d,2,0x61,0x32,0x65,0x50,0x69,0x12,0x67,0x69,0x74,0xa7, -0,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xe9, -0,0,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e,0x75,0x6d,0x62,0x65,0x72,0xa7,0 +0x69,0x79,0x65,0x68,0x8f,0x86,0x10,0x68,0x33,2,0x66,0x3c,0x69,0x70,0x6c,1, +0x61,0x28,0x65,0x10,0x66,0x27,0x11,0x70,0x68,0x25,0x14,0x72,0x69,0x63,0x61,0x6e, +2,0x66,0x30,0x6e,0x36,0x71,0x11,0x61,0x66,0xa3,0x58,0x11,0x65,0x68,0xa3,0x56, +0x12,0x6f,0x6f,0x6e,0xa3,0x57,0x10,0x6e,0x23,1,0x65,0x4a,0x75,0x10,0x72,0x1f, +0x75,0x73,0x68,0x61,0x73,0x6b,0x69,0x79,0x65,0x68,0x62,0x61,0x72,0x72,0x65,0x65, +0x8d,1,0x68,0x29,0x74,0x10,0x68,0x2b,0x11,0x61,0x6c,0x2c,0x16,0x61,0x74,0x68, +0x72,0x69,0x73,0x68,0x2f,7,0x6e,0x2e,0x6e,0x2c,0x72,0x3e,0x74,0x56,0x75,0x21, +0x18,0x6f,0x6e,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x21,0x28,0x1a,0x69,0x67,0x68, +0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x29,0x2a,0x19,0x72,0x61,0x6e,0x73,0x70, +0x61,0x72,0x65,0x6e,0x74,0x2b,0x63,0x23,0x64,0x40,0x6a,0x56,0x6c,0x26,0x19,0x65, +0x66,0x74,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x27,0x24,0x19,0x75,0x61,0x6c,0x6a, +0x6f,0x69,0x6e,0x69,0x6e,0x67,0x25,0x19,0x6f,0x69,0x6e,0x63,0x61,0x75,0x73,0x69, +0x6e,0x67,0x23,0,0x14,0x6e,0xc0,0xe5,0x73,0x5e,0x77,0x23,0x77,0x40,0x78,0x58, +0x7a,0x10,0x77,0x58,1,0x6a,0x75,0x73,0x13,0x70,0x61,0x63,0x65,0x59,1,0x6a, +0x5d,0x6f,0x17,0x72,0x64,0x6a,0x6f,0x69,0x6e,0x65,0x72,0x5d,0x10,0x78,0x21,0x73, +0x4a,0x75,0x7a,0x76,1,0x66,0x7d,0x69,0x7e,0x13,0x72,0x61,0x6d,0x61,0x7e,0x14, +0x66,0x69,0x6e,0x61,0x6c,0x7d,4,0x61,0x51,0x67,0x53,0x70,0x28,0x75,0x30,0x79, +0x57,0x54,0x12,0x61,0x63,0x65,0x55,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0x53, +0x15,0x6e,0x6b,0x6e,0x6f,0x77,0x6e,0x21,0x6e,0x60,0x6f,0xa2,0x41,0x70,0xa2,0x50, +0x71,0xa2,0x6e,0x72,1,0x65,0x24,0x69,0x6f,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c, +0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x6f,4,0x65,0x3e,0x6c,0x5b,0x6f, +0x46,0x73,0x45,0x75,0x46,0x14,0x6d,0x65,0x72,0x69,0x63,0x47,0x15,0x78,0x74,0x6c, +0x69,0x6e,0x65,0x5b,0x17,0x6e,0x73,0x74,0x61,0x72,0x74,0x65,0x72,0x45,0x10,0x70, +0x48,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x49, +1,0x6f,0x3e,0x72,0x4c,0x1a,0x65,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69, +0x63,0x4d,0x4a,0x1b,0x73,0x74,0x66,0x69,0x78,0x6e,0x75,0x6d,0x65,0x72,0x69,0x63, +0x4b,0x10,0x75,0x4e,0x16,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x4f,0x68,0x7b,0x68, +0x50,0x69,0x86,0x6a,0xa2,0x61,0x6c,0xa2,0x65,0x6d,0x1c,0x61,0x6e,0x64,0x61,0x74, +0x6f,0x72,0x79,0x62,0x72,0x65,0x61,0x6b,0x2d,4,0x32,0x5f,0x33,0x61,0x65,0x34, +0x6c,0x6d,0x79,0x3a,0x13,0x70,0x68,0x65,0x6e,0x3b,0x19,0x62,0x72,0x65,0x77,0x6c, +0x65,0x74,0x74,0x65,0x72,0x6d,2,0x64,0x28,0x6e,0x3c,0x73,0x41,0x3c,0x18,0x65, +0x6f,0x67,0x72,0x61,0x70,0x68,0x69,0x63,0x3d,0x3e,1,0x66,0x3e,0x73,0x11,0x65, +0x70,1,0x61,0x22,0x65,0x14,0x72,0x61,0x62,0x6c,0x65,0x3f,0x18,0x69,0x78,0x6e, +0x75,0x6d,0x65,0x72,0x69,0x63,0x41,2,0x6c,0x63,0x74,0x65,0x76,0x67,1,0x66, +0x43,0x69,0x15,0x6e,0x65,0x66,0x65,0x65,0x64,0x43,0x61,0x42,0x62,0xa2,0x49,0x63, +0xa2,0x76,0x65,0xa2,0xfc,0x67,0x10,0x6c,0x38,0x11,0x75,0x65,0x39,5,0x6d,0xf, +0x6d,0x28,0x70,0x79,0x73,0x7b,0x16,0x62,0x69,0x67,0x75,0x6f,0x75,0x73,0x23,0x69, +0x23,0x6b,0x38,0x6c,0x24,0x17,0x70,0x68,0x61,0x62,0x65,0x74,0x69,0x63,0x25,0x76, +0x13,0x73,0x61,0x72,0x61,0x76,1,0x70,0x2e,0x73,0x13,0x74,0x61,0x72,0x74,0x7b, +0x15,0x72,0x65,0x62,0x61,0x73,0x65,0x79,4,0x32,0x27,0x61,0x29,0x62,0x2b,0x6b, +0x2d,0x72,0x12,0x65,0x61,0x6b,2,0x61,0x36,0x62,0x3e,0x73,0x15,0x79,0x6d,0x62, +0x6f,0x6c,0x73,0x57,0x13,0x66,0x74,0x65,0x72,0x29,1,0x65,0x2a,0x6f,0x11,0x74, +0x68,0x27,0x13,0x66,0x6f,0x72,0x65,0x2b,7,0x6d,0x51,0x6d,0x33,0x6f,0x28,0x70, +0x69,0x72,0x35,1,0x6d,0x76,0x6e,1,0x64,0x3c,0x74,0x1a,0x69,0x6e,0x67,0x65, +0x6e,0x74,0x62,0x72,0x65,0x61,0x6b,0x2f,0x15,0x69,0x74,0x69,0x6f,0x6e,0x61,0x1f, +0x6c,0x6a,0x61,0x70,0x61,0x6e,0x65,0x73,0x65,0x73,0x74,0x61,0x72,0x74,0x65,0x72, +0x6b,1,0x62,0x3a,0x70,0x19,0x6c,0x65,0x78,0x63,0x6f,0x6e,0x74,0x65,0x78,0x74, +0x51,0x18,0x69,0x6e,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0x33,0x61,0x6a,0x62,0x2f, +0x6a,0x6b,0x6c,0x30,0x13,0x6f,0x73,0x65,0x70,1,0x61,0x38,0x75,0x18,0x6e,0x63, +0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0x31,0x18,0x72,0x65,0x6e,0x74,0x68,0x65,0x73, +0x69,0x73,0x69,0x1b,0x72,0x72,0x69,0x61,0x67,0x65,0x72,0x65,0x74,0x75,0x72,0x6e, +0x35,2,0x62,0x3e,0x6d,0x46,0x78,0x36,0x18,0x63,0x6c,0x61,0x6d,0x61,0x74,0x69, +0x6f,0x6e,0x37,0x70,0x12,0x61,0x73,0x65,0x71,0x72,0x16,0x6f,0x64,0x69,0x66,0x69, +0x65,0x72,0x73,1,0x64,0x42,0x6e,1,0x6f,0x32,0x75,0x26,0x14,0x6d,0x65,0x72, +0x69,0x63,0x27,0x11,0x6e,0x65,0x21,1,0x65,0x2e,0x69,0x24,0x12,0x67,0x69,0x74, +0x25,0x22,0x14,0x63,0x69,0x6d,0x61,0x6c,0x23,0,0x18,0x6e,0xc4,0x6f,0x74,0xc1, +0x91,0x77,0x96,0x77,0xa2,0x4c,0x78,0xa2,0x70,0x79,0xa2,0x7a,0x7a,6,0x73,0x1e, +0x73,0x34,0x78,0x42,0x79,0x48,0x7a,0x11,0x7a,0x7a,0xa3,0x67,0x10,0x79,1,0x65, +0xa3,0xae,0x6d,0xa3,0x81,0x11,0x78,0x78,0xa3,0x66,0x11,0x79,0x79,0x21,0x61,0x30, +0x69,0x58,0x6d,0x11,0x74,0x68,0xa3,0x80,0x10,0x6e,1,0x61,0x26,0x62,0xa3,0xb1, +0x1a,0x62,0x61,0x7a,0x61,0x72,0x73,0x71,0x75,0x61,0x72,0x65,0xa3,0xb1,0x11,0x6e, +0x68,0x23,2,0x61,0x30,0x63,0x5a,0x6f,0x11,0x6c,0x65,0xa3,0x9b,1,0x6e,0x3c, +0x72,0x10,0x61,0xa2,0x92,0x15,0x6e,0x67,0x63,0x69,0x74,0x69,0xa3,0x92,0x12,0x63, +0x68,0x6f,0xa3,0xbc,0x11,0x68,0x6f,0xa3,0xbc,1,0x70,0x2c,0x73,0x11,0x75,0x78, +0xa3,0x65,0x11,0x65,0x6f,0x9b,1,0x65,0x2c,0x69,0x72,0x11,0x69,0x69,0x73,0x11, +0x7a,0x69,0xa2,0xc0,0x11,0x64,0x69,0xa3,0xc0,0x74,0x66,0x75,0xa2,0xde,0x76,1, +0x61,0x48,0x69,1,0x73,0x38,0x74,0x10,0x68,0xa2,0xc5,0x13,0x6b,0x75,0x71,0x69, +0xa3,0xc5,0x10,0x70,0xa3,0x64,0x10,0x69,0xa2,0x63,0x10,0x69,0xa3,0x63,7,0x68, +0x3e,0x68,0x34,0x69,0x48,0x6e,0x86,0x6f,0x11,0x74,0x6f,0xa3,0xc4,0x10,0x61,1, +0x61,0x24,0x69,0x6d,0x6a,0x11,0x6e,0x61,0x6b,2,0x62,0x3a,0x66,0x4a,0x72,0x10, +0x68,0xa2,0x9e,0x12,0x75,0x74,0x61,0xa3,0x9e,1,0x65,0x24,0x74,0x6f,0x12,0x74, +0x61,0x6e,0x6f,0x14,0x69,0x6e,0x61,0x67,0x68,0x99,0x11,0x73,0x61,0xa3,0xc3,0x61, +0x36,0x65,0xa2,0x65,0x66,0xa2,0x71,0x67,0x11,0x6c,0x67,0x75,6,0x6c,0x28,0x6c, +0x32,0x6d,0x38,0x6e,0x44,0x76,0x10,0x74,0xa3,0x7f,1,0x65,0x89,0x75,0x97,1, +0x69,0x24,0x6c,0x67,0x10,0x6c,0x67,0x10,0x67,0xa2,0x9a,1,0x73,0x2a,0x75,0x10, +0x74,0xa3,0x9a,0x10,0x61,0xa3,0xc3,0x67,0x36,0x69,0x52,0x6b,0x10,0x72,0xa2,0x99, +0x10,0x69,0xa3,0x99,1,0x61,0x30,0x62,0x7a,0x13,0x61,0x6e,0x77,0x61,0x7b,0x12, +0x6c,0x6f,0x67,0x75,2,0x6c,0x32,0x74,0x34,0x76,0x12,0x69,0x65,0x74,0xa3,0x7f, +0x10,0x65,0x89,0x12,0x68,0x61,0x6d,0xa3,0x6a,1,0x6c,0x2a,0x6e,0x10,0x67,0xa3, +0x62,0x10,0x75,0x68,0x11,0x67,0x75,0x69,0x11,0x6e,0x67,0x99,1,0x67,0x32,0x6e, +0x14,0x6b,0x6e,0x6f,0x77,0x6e,0xa3,0x67,0x11,0x61,0x72,0x8a,0x13,0x69,0x74,0x69, +0x63,0x8b,0x71,0xc1,0x13,0x71,0xa2,0xde,0x72,0xa2,0xe3,0x73,6,0x69,0x8a,0x69, +0x72,0x6f,0xa2,0x4c,0x75,0xa2,0x75,0x79,1,0x6c,0x46,0x72,4,0x63,0x65,0x65, +0xa3,0x5f,0x69,0x2c,0x6a,0xa3,0x60,0x6e,0xa3,0x61,0x11,0x61,0x63,0x65,0x10,0x6f, +0x94,0x16,0x74,0x69,0x6e,0x61,0x67,0x72,0x69,0x95,2,0x64,0x3c,0x67,0x4c,0x6e, +1,0x64,0xa3,0x91,0x68,0x62,0x12,0x61,0x6c,0x61,0x63,0x10,0x64,0xa2,0xa6,0x12, +0x68,0x61,0x6d,0xa3,0xa6,0x17,0x6e,0x77,0x72,0x69,0x74,0x69,0x6e,0x67,0xa3,0x70, +2,0x67,0x3a,0x72,0x52,0x79,0x10,0x6f,0xa2,0xb0,0x12,0x6d,0x62,0x6f,0xa3,0xb0, +1,0x64,0x26,0x6f,0xa3,0xb8,0xa2,0xb7,0x12,0x69,0x61,0x6e,0xa3,0xb7,0x10,0x61, +0xa2,0x98,0x16,0x73,0x6f,0x6d,0x70,0x65,0x6e,0x67,0xa3,0x98,0x11,0x6e,0x64,0xa2, +0x71,0x14,0x61,0x6e,0x65,0x73,0x65,0xa3,0x71,0x61,0x5c,0x67,0xa2,0x43,0x68,1, +0x61,0x2a,0x72,0x10,0x64,0xa3,0x97,2,0x72,0x28,0x76,0x30,0x77,0x87,0x12,0x61, +0x64,0x61,0xa3,0x97,0x12,0x69,0x61,0x6e,0x87,2,0x6d,0x40,0x72,0x58,0x75,0x10, +0x72,0xa2,0x6f,0x15,0x61,0x73,0x68,0x74,0x72,0x61,0xa3,0x6f,1,0x61,0x26,0x72, +0xa3,0x7e,0x14,0x72,0x69,0x74,0x61,0x6e,0xa3,0x7e,1,0x61,0xa3,0x5e,0x62,0xa3, +0x85,0x11,0x6e,0x77,0xa3,0x70,0x11,0x61,0x61,1,0x63,0x2f,0x69,0x23,3,0x65, +0x3e,0x6a,0x48,0x6f,0x4e,0x75,0x10,0x6e,1,0x69,0x24,0x72,0x61,0x10,0x63,0x61, +0x13,0x6a,0x61,0x6e,0x67,0xa3,0x6e,0x11,0x6e,0x67,0xa3,0x6e,1,0x68,0x2a,0x72, +0x10,0x6f,0xa3,0x5d,0x10,0x67,0xa3,0xb6,0x6e,0xa2,0x83,0x6f,0xa4,1,0x70,5, +0x6c,0x1e,0x6c,0x44,0x72,0x4a,0x73,0x1b,0x61,0x6c,0x74,0x65,0x72,0x70,0x61,0x68, +0x6c,0x61,0x76,0x69,0xa3,0x7b,0x11,0x72,0x64,0xa3,0x5c,0x11,0x74,0x69,0xa3,0x7d, +0x61,0x7c,0x65,0xa2,0x54,0x68,3,0x61,0x3e,0x6c,0x4e,0x6e,0x5e,0x6f,0x16,0x65, +0x6e,0x69,0x63,0x69,0x61,0x6e,0xa3,0x5b,0x10,0x67,0xa2,0x5a,0x12,0x73,0x70,0x61, +0xa3,0x5a,2,0x69,0xa3,0x7a,0x70,0xa3,0x7b,0x76,0xa3,0x7c,0x10,0x78,0xa3,0x5b, +2,0x68,0x3e,0x6c,0x50,0x75,0x10,0x63,0xa2,0xa5,0x14,0x69,0x6e,0x68,0x61,0x75, +0xa3,0xa5,0x17,0x61,0x77,0x68,0x68,0x6d,0x6f,0x6e,0x67,0xa3,0x4b,0x10,0x6d,0xa2, +0x90,0x14,0x79,0x72,0x65,0x6e,0x65,0xa3,0x90,0x11,0x72,0x6d,0xa3,0x59,6,0x6b, +0x36,0x6b,0x56,0x73,0x6e,0x75,0x74,0x79,0x11,0x69,0x61,0x1f,0x6b,0x65,0x6e,0x67, +0x70,0x75,0x61,0x63,0x68,0x75,0x65,0x68,0x6d,0x6f,0x6e,0x67,0xa3,0xba,1,0x67, +0x2e,0x6f,0xa2,0x57,0x10,0x6f,0xa3,0x57,0x10,0x62,0xa3,0x84,0x11,0x68,0x75,0xa3, +0x96,0x12,0x73,0x68,0x75,0xa3,0x96,0x61,0x42,0x62,0x9e,0x65,0x10,0x77,1,0x61, +0xa3,0xaa,0x74,0x14,0x61,0x69,0x6c,0x75,0x65,0x97,3,0x62,0x32,0x67,0x40,0x6e, +0x56,0x72,0x10,0x62,0xa3,0x8e,0x15,0x61,0x74,0x61,0x65,0x61,0x6e,0xa3,0x8f,0x10, +0x6d,0xa2,0xc7,0x15,0x75,0x6e,0x64,0x61,0x72,0x69,0xa3,0xc7,0x10,0x64,0xa2,0xbb, +0x16,0x69,0x6e,0x61,0x67,0x61,0x72,0x69,0xa3,0xbb,0x11,0x61,0x74,0xa3,0x8f,4, +0x67,0x3c,0x6c,0x4e,0x72,0xa2,0x8e,0x73,0xa2,0x9c,0x75,0x11,0x67,0x72,0xa3,0xc2, +1,0x61,0x2a,0x68,0x11,0x61,0x6d,0x5b,0x10,0x6d,0x5b,1,0x63,0xa2,0x6a,0x64, +6,0x70,0x41,0x70,0x3a,0x73,0x58,0x74,0x86,0x75,0x14,0x79,0x67,0x68,0x75,0x72, +0xa3,0xc2,0x11,0x65,0x72,1,0x6d,0x2c,0x73,0x12,0x69,0x61,0x6e,0x9b,0x11,0x69, +0x63,0xa3,0x59,0x10,0x6f,1,0x67,0x3a,0x75,0x18,0x74,0x68,0x61,0x72,0x61,0x62, +0x69,0x61,0x6e,0xa3,0x85,0x13,0x64,0x69,0x61,0x6e,0xa3,0xb8,0x14,0x75,0x72,0x6b, +0x69,0x63,0xa3,0x58,0x68,0x42,0x69,0x54,0x6e,0x1a,0x6f,0x72,0x74,0x68,0x61,0x72, +0x61,0x62,0x69,0x61,0x6e,0xa3,0x8e,0x17,0x75,0x6e,0x67,0x61,0x72,0x69,0x61,0x6e, +0xa3,0x4c,0x14,0x74,0x61,0x6c,0x69,0x63,0x5d,1,0x68,0x26,0x6b,0xa3,0x6d,0x12, +0x69,0x6b,0x69,0xa3,0x6d,2,0x69,0x2c,0x6b,0x30,0x79,0x10,0x61,0x5f,0x11,0x79, +0x61,0x5f,0x10,0x68,0xa3,0x58,2,0x61,0x36,0x67,0x3c,0x6d,0x10,0x61,0x84,0x12, +0x6e,0x79,0x61,0x85,0x11,0x67,0x65,0xa3,0xab,0x10,0x65,0xa3,0xab,0x68,0xc3,0x15, +0x6b,0xc2,0x2c,0x6b,0xa4,0x17,0x6c,0xa4,0xba,0x6d,8,0x6f,0x46,0x6f,0x48,0x72, +0x74,0x74,0x80,0x75,0x86,0x79,1,0x61,0x28,0x6d,0x10,0x72,0x59,0x13,0x6e,0x6d, +0x61,0x72,0x59,2,0x64,0x2e,0x6e,0x32,0x6f,0x10,0x6e,0xa3,0x72,0x10,0x69,0xa3, +0xa3,0x10,0x67,0x56,0x14,0x6f,0x6c,0x69,0x61,0x6e,0x57,0x10,0x6f,0xa2,0x95,0x10, +0x6f,0xa3,0x95,0x11,0x65,0x69,0xa3,0x73,0x11,0x6c,0x74,0xa2,0xa4,0x12,0x61,0x6e, +0x69,0xa3,0xa4,0x61,0x36,0x65,0xa2,0x67,0x69,0xa2,0xbd,0x6c,0x11,0x79,0x6d,0x55, +6,0x6e,0x38,0x6e,0x32,0x72,0x5c,0x73,0x6c,0x79,0x10,0x61,0xa3,0x55,1,0x64, +0x38,0x69,0xa2,0x79,0x15,0x63,0x68,0x61,0x65,0x61,0x6e,0xa3,0x79,0xa2,0x54,0x12, +0x61,0x69,0x63,0xa3,0x54,0x10,0x63,0xa2,0xa9,0x12,0x68,0x65,0x6e,0xa3,0xa9,0x18, +0x61,0x72,0x61,0x6d,0x67,0x6f,0x6e,0x64,0x69,0xa3,0xaf,0x68,0x36,0x6b,0x4c,0x6c, +0x15,0x61,0x79,0x61,0x6c,0x61,0x6d,0x55,1,0x61,0x26,0x6a,0xa3,0xa0,0x13,0x6a, +0x61,0x6e,0x69,0xa3,0xa0,0x10,0x61,0xa2,0xb4,0x12,0x73,0x61,0x72,0xa3,0xb4,3, +0x64,0x78,0x65,0x94,0x6e,0xa2,0x42,0x72,1,0x63,0xa3,0x8d,0x6f,0xa2,0x56,0x13, +0x69,0x74,0x69,0x63,1,0x63,0x3c,0x68,0x19,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79, +0x70,0x68,0x73,0xa3,0x56,0x15,0x75,0x72,0x73,0x69,0x76,0x65,0xa3,0x8d,1,0x65, +0x26,0x66,0xa3,0xb5,0x16,0x66,0x61,0x69,0x64,0x72,0x69,0x6e,0xa3,0xb5,0x17,0x74, +0x65,0x69,0x6d,0x61,0x79,0x65,0x6b,0xa3,0x73,0x10,0x64,0xa2,0x8c,0x17,0x65,0x6b, +0x69,0x6b,0x61,0x6b,0x75,0x69,0xa3,0x8c,0x11,0x61,0x6f,0xa3,0x5c,6,0x6e,0x1a, +0x6e,0x34,0x6f,0x38,0x70,0x3e,0x74,0x11,0x68,0x69,0xa3,0x78,0x11,0x64,0x61,0x4b, +0x11,0x72,0x65,0xa3,0x77,0x11,0x65,0x6c,0xa3,0x8a,0x61,0x32,0x68,0xa2,0x44,0x69, +0x11,0x74,0x73,0xa3,0xbf,5,0x74,0x23,0x74,0x34,0x77,0x56,0x79,0x13,0x61,0x68, +0x6c,0x69,0xa3,0x4f,0x14,0x61,0x6b,0x61,0x6e,0x61,0x4c,0x19,0x6f,0x72,0x68,0x69, +0x72,0x61,0x67,0x61,0x6e,0x61,0x8d,0x10,0x69,0xa3,0xc6,0x69,0x38,0x6c,0x40,0x6e, +1,0x61,0x4d,0x6e,0x12,0x61,0x64,0x61,0x4b,0x12,0x74,0x68,0x69,0xa3,0x78,0x10, +0x69,0xa3,0x4f,4,0x61,0x40,0x69,0x52,0x6d,0x70,0x6f,0x7c,0x75,0x15,0x64,0x61, +0x77,0x61,0x64,0x69,0xa3,0x91,0x10,0x72,0x92,0x15,0x6f,0x73,0x68,0x74,0x68,0x69, +0x93,0x1d,0x74,0x61,0x6e,0x73,0x6d,0x61,0x6c,0x6c,0x73,0x63,0x72,0x69,0x70,0x74, +0xa3,0xbf,1,0x65,0x24,0x72,0x4f,0x10,0x72,0x4f,0x10,0x6a,0xa2,0x9d,0x11,0x6b, +0x69,0xa3,0x9d,4,0x61,0x5c,0x65,0x90,0x69,0xa0,0x6f,0xa2,0x5d,0x79,1,0x63, +0x34,0x64,0x10,0x69,0xa2,0x6c,0x11,0x61,0x6e,0xa3,0x6c,0x10,0x69,0xa2,0x6b,0x11, +0x61,0x6e,0xa3,0x6b,2,0x6e,0x42,0x6f,0x46,0x74,3,0x66,0xa3,0x50,0x67,0xa3, +0x51,0x69,0x24,0x6e,0x53,0x10,0x6e,0x53,0x10,0x61,0xa3,0x6a,0x50,0x10,0x6f,0x51, +0x11,0x70,0x63,0xa2,0x52,0x11,0x68,0x61,0xa3,0x52,2,0x6d,0x2e,0x6e,0x36,0x73, +0x10,0x75,0xa3,0x83,0x10,0x62,0x80,0x10,0x75,0x81,2,0x61,0xa3,0x53,0x62,0x83, +0x65,0x11,0x61,0x72,1,0x61,0xa3,0x53,0x62,0x83,0x11,0x6d,0x61,0xa3,0x8b,0x68, +0x6e,0x69,0xa2,0x95,0x6a,2,0x61,0x30,0x70,0x52,0x75,0x11,0x72,0x63,0xa3,0x94, +1,0x6d,0x38,0x76,0x10,0x61,0xa2,0x4e,0x13,0x6e,0x65,0x73,0x65,0xa3,0x4e,0x10, +0x6f,0xa3,0xad,0x11,0x61,0x6e,0xa3,0x69,6,0x6c,0x1e,0x6c,0x34,0x6d,0x3a,0x72, +0x48,0x75,0x11,0x6e,0x67,0xa3,0x4c,0x11,0x75,0x77,0xa3,0x9c,0x10,0x6e,1,0x67, +0xa3,0x4b,0x70,0xa3,0xba,0x11,0x6b,0x74,0x8d,0x61,0x3c,0x65,0xa2,0x43,0x69,0x11, +0x72,0x61,0x48,0x13,0x67,0x61,0x6e,0x61,0x49,1,0x6e,0x34,0x74,0x10,0x72,0xa2, +0xa2,0x11,0x61,0x6e,0xa3,0xa2,0x42,6,0x6f,0xe,0x6f,0x77,0x73,0xa3,0x49,0x74, +0xa3,0x4a,0x75,0x12,0x6e,0x6f,0x6f,0x77,0x62,0xa3,0xac,0x67,0x3e,0x69,0x42,0x19, +0x66,0x69,0x72,0x6f,0x68,0x69,0x6e,0x67,0x79,0x61,0xa3,0xb6,0x44,0x11,0x75,0x6c, +0x45,0x11,0x62,0x72,0x46,0x11,0x65,0x77,0x47,2,0x6d,0x2e,0x6e,0x4a,0x74,0x11, +0x61,0x6c,0x5d,0x1c,0x70,0x65,0x72,0x69,0x61,0x6c,0x61,0x72,0x61,0x6d,0x61,0x69, +0x63,0xa3,0x74,2,0x64,0x66,0x68,0x6a,0x73,0x1b,0x63,0x72,0x69,0x70,0x74,0x69, +0x6f,0x6e,0x61,0x6c,0x70,0x61,1,0x68,0x32,0x72,0x14,0x74,0x68,0x69,0x61,0x6e, +0xa3,0x7d,0x13,0x6c,0x61,0x76,0x69,0xa3,0x7a,0x10,0x73,0xa3,0x4d,0x15,0x65,0x72, +0x69,0x74,0x65,0x64,0x23,0x64,0xc1,0xd,0x64,0xa2,0x7a,0x65,0xa2,0xc1,0x67,4, +0x65,0x82,0x6c,0x9a,0x6f,0xa2,0x46,0x72,0xa2,0x55,0x75,2,0x6a,0x3c,0x6e,0x4e, +0x72,1,0x6d,0x24,0x75,0x41,0x13,0x75,0x6b,0x68,0x69,0x41,1,0x61,0x24,0x72, +0x3f,0x13,0x72,0x61,0x74,0x69,0x3f,0x18,0x6a,0x61,0x6c,0x61,0x67,0x6f,0x6e,0x64, +0x69,0xa3,0xb3,0x10,0x6f,1,0x6b,0xa3,0x48,0x72,0x38,0x13,0x67,0x69,0x61,0x6e, +0x39,0x11,0x61,0x67,0x90,0x15,0x6f,0x6c,0x69,0x74,0x69,0x63,0x91,1,0x6e,0x30, +0x74,0x10,0x68,0x3a,0x11,0x69,0x63,0x3b,1,0x67,0xa3,0xb3,0x6d,0xa3,0xaf,1, +0x61,0x32,0x65,1,0x65,0x24,0x6b,0x3d,0x10,0x6b,0x3d,0x10,0x6e,0xa2,0x89,0x12, +0x74,0x68,0x61,0xa3,0x89,4,0x65,0x46,0x69,0x6c,0x6f,0x8c,0x73,0x9a,0x75,0x11, +0x70,0x6c,0xa2,0x87,0x13,0x6f,0x79,0x61,0x6e,0xa3,0x87,1,0x73,0x38,0x76,0x10, +0x61,0x34,0x15,0x6e,0x61,0x67,0x61,0x72,0x69,0x35,0x13,0x65,0x72,0x65,0x74,0x33, +1,0x61,0x36,0x76,0x16,0x65,0x73,0x61,0x6b,0x75,0x72,0x75,0xa3,0xbe,0x10,0x6b, +0xa3,0xbe,0x11,0x67,0x72,0xa2,0xb2,0x10,0x61,0xa3,0xb2,0x11,0x72,0x74,0x33,2, +0x67,0x3a,0x6c,0x72,0x74,0x11,0x68,0x69,0x36,0x13,0x6f,0x70,0x69,0x63,0x37,0x10, +0x79,2,0x64,0xa3,0x45,0x68,0xa3,0x46,0x70,0xa2,0x47,0x1e,0x74,0x69,0x61,0x6e, +0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79,0x70,0x68,0x73,0xa3,0x47,1,0x62,0x36, +0x79,0x10,0x6d,0xa2,0xb9,0x12,0x61,0x69,0x63,0xa3,0xb9,0x10,0x61,0xa2,0x88,0x12, +0x73,0x61,0x6e,0xa3,0x88,0x61,0xa2,0xc9,0x62,0xa4,0x2e,0x63,6,0x6f,0x52,0x6f, +0x76,0x70,0x92,0x75,0xa2,0x41,0x79,1,0x70,0x3e,0x72,2,0x69,0x2a,0x6c,0x31, +0x73,0xa3,0x44,0x13,0x6c,0x6c,0x69,0x63,0x31,0x10,0x72,1,0x69,0x34,0x6f,0x15, +0x6d,0x69,0x6e,0x6f,0x61,0x6e,0xa3,0xc1,0x11,0x6f,0x74,0x7f,1,0x6d,0x30,0x70, +0x10,0x74,0x2e,0x11,0x69,0x63,0x2f,0x12,0x6d,0x6f,0x6e,0x21,1,0x6d,0x28,0x72, +0x10,0x74,0x7f,0x10,0x6e,0xa3,0xc1,0x16,0x6e,0x65,0x69,0x66,0x6f,0x72,0x6d,0xa3, +0x65,0x61,0x32,0x68,0xa2,0x41,0x69,0x11,0x72,0x74,0xa3,0x43,3,0x6b,0x4c,0x6e, +0x50,0x72,0x76,0x75,0x1d,0x63,0x61,0x73,0x69,0x61,0x6e,0x61,0x6c,0x62,0x61,0x6e, +0x69,0x61,0x6e,0xa3,0x9f,0x10,0x6d,0xa3,0x76,1,0x61,0x24,0x73,0x71,0x1d,0x64, +0x69,0x61,0x6e,0x61,0x62,0x6f,0x72,0x69,0x67,0x69,0x6e,0x61,0x6c,0x71,0x10,0x69, +0xa2,0x68,0x11,0x61,0x6e,0xa3,0x68,3,0x61,0x32,0x65,0x44,0x6f,0x52,0x72,0x10, +0x73,0xa3,0xbd,1,0x6b,0x26,0x6d,0xa3,0x42,0x11,0x6d,0x61,0xa3,0x76,0x10,0x72, +0x2c,0x13,0x6f,0x6b,0x65,0x65,0x2d,0x16,0x72,0x61,0x73,0x6d,0x69,0x61,0x6e,0xa3, +0xbd,6,0x68,0x4a,0x68,0x48,0x6e,0x4e,0x72,0x76,0x76,1,0x65,0x2a,0x73,0x10, +0x74,0xa3,0x75,0x13,0x73,0x74,0x61,0x6e,0xa3,0x75,0x11,0x6f,0x6d,0xa3,0xa1,0x11, +0x61,0x74,0x1f,0x6f,0x6c,0x69,0x61,0x6e,0x68,0x69,0x65,0x72,0x6f,0x67,0x6c,0x79, +0x70,0x68,0x73,0xa3,0x9c,1,0x61,0x3e,0x6d,2,0x65,0x2a,0x69,0xa3,0x74,0x6e, +0x27,0x13,0x6e,0x69,0x61,0x6e,0x27,0x10,0x62,0x24,0x11,0x69,0x63,0x25,0x64,0x30, +0x66,0x44,0x67,0x11,0x68,0x62,0xa3,0x9f,0x10,0x6c,1,0x61,0x26,0x6d,0xa3,0xa7, +0x10,0x6d,0xa3,0xa7,0x11,0x61,0x6b,0xa3,0x93,6,0x6c,0x3c,0x6c,0x52,0x6f,0x56, +0x72,0x66,0x75,1,0x67,0x30,0x68,1,0x64,0x79,0x69,0x10,0x64,0x79,0x10,0x69, +0x8e,0x13,0x6e,0x65,0x73,0x65,0x8f,0x11,0x69,0x73,0xa1,0x11,0x70,0x6f,0x2a,0x13, +0x6d,0x6f,0x66,0x6f,0x2b,0x10,0x61,1,0x68,0x2e,0x69,0x7c,0x12,0x6c,0x6c,0x65, +0x7d,0xa2,0x41,0x11,0x6d,0x69,0xa3,0x41,0x61,0x48,0x65,0x9c,0x68,1,0x61,0x2a, +0x6b,0x10,0x73,0xa3,0xa8,0x15,0x69,0x6b,0x73,0x75,0x6b,0x69,0xa3,0xa8,3,0x6c, +0x3a,0x6d,0x48,0x73,0x54,0x74,1,0x61,0x24,0x6b,0x9f,0x10,0x6b,0x9f,0x10,0x69, +0x9c,0x13,0x6e,0x65,0x73,0x65,0x9d,0x10,0x75,0xa2,0x82,0x10,0x6d,0xa3,0x82,0x10, +0x73,0xa2,0x86,0x13,0x61,0x76,0x61,0x68,0xa3,0x86,0x11,0x6e,0x67,0x28,0x12,0x61, +0x6c,0x69,0x29,3,0x6c,0x42,0x6e,0x90,0x74,0xa2,0x46,0x76,0x24,0x17,0x6f,0x77, +0x65,0x6c,0x6a,0x61,0x6d,0x6f,0x25,0x22,1,0x65,0x54,0x76,0x28,1,0x73,0x38, +0x74,0x2a,0x17,0x73,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x2b,0x16,0x79,0x6c,0x6c, +0x61,0x62,0x6c,0x65,0x29,0x18,0x61,0x64,0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x23, +1,0x61,0x21,0x6f,0x1a,0x74,0x61,0x70,0x70,0x6c,0x69,0x63,0x61,0x62,0x6c,0x65, +0x21,0x26,0x1a,0x72,0x61,0x69,0x6c,0x69,0x6e,0x67,0x6a,0x61,0x6d,0x6f,0x27,1, +0x6e,0x2c,0x79,0x22,0x11,0x65,0x73,0x23,0x20,0x10,0x6f,0x21,1,0x6e,0x2c,0x79, +0x22,0x11,0x65,0x73,0x23,0x20,0x10,0x6f,0x21,2,0x6d,0x30,0x6e,0x3a,0x79,0x22, +0x11,0x65,0x73,0x23,0x24,0x13,0x61,0x79,0x62,0x65,0x25,0x20,0x10,0x6f,0x21,2, +0x6d,0x30,0x6e,0x3a,0x79,0x22,0x11,0x65,0x73,0x23,0x24,0x13,0x61,0x79,0x62,0x65, +0x25,0x20,0x10,0x6f,0x21,0xb,0x72,0x39,0x76,0xc,0x76,0x33,0x78,0x2a,0x7a,0x11, +0x77,0x6a,0x43,0x10,0x78,0x21,0x72,0x28,0x73,0x50,0x74,0x31,1,0x65,0x24,0x69, +0x39,0x1e,0x67,0x69,0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f, +0x72,0x39,1,0x6d,0x35,0x70,0x18,0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b, +0x35,0x6c,0x1f,0x6c,0x3c,0x6f,0x4a,0x70,1,0x70,0x37,0x72,0x14,0x65,0x70,0x65, +0x6e,0x64,0x37,0x28,1,0x66,0x2b,0x76,0x2c,0x10,0x74,0x2f,0x13,0x74,0x68,0x65, +0x72,0x21,0x63,0x4c,0x65,0x64,0x67,1,0x61,0x3a,0x6c,0x19,0x75,0x65,0x61,0x66, +0x74,0x65,0x72,0x7a,0x77,0x6a,0x41,0x10,0x7a,0x41,2,0x6e,0x23,0x6f,0x24,0x72, +0x25,0x14,0x6e,0x74,0x72,0x6f,0x6c,0x23,2,0x62,0x34,0x6d,0x4e,0x78,0x26,0x13, +0x74,0x65,0x6e,0x64,0x27,0x3a,1,0x61,0x24,0x67,0x3d,0x11,0x73,0x65,0x3a,0x12, +0x67,0x61,0x7a,0x3d,0x3e,0x16,0x6f,0x64,0x69,0x66,0x69,0x65,0x72,0x3f,9,0x6e, +0x4a,0x6e,0x34,0x6f,0x44,0x73,0x60,0x75,0x94,0x78,0x10,0x78,0x21,0x10,0x75,0x2a, +0x14,0x6d,0x65,0x72,0x69,0x63,0x2b,1,0x6c,0x2c,0x74,0x12,0x68,0x65,0x72,0x21, +0x14,0x65,0x74,0x74,0x65,0x72,0x2d,3,0x63,0x36,0x65,0x46,0x70,0x31,0x74,0x32, +0x12,0x65,0x72,0x6d,0x33,0x3c,0x16,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,0x3d,0x2e, +0x10,0x70,0x2f,0x10,0x70,0x34,0x12,0x70,0x65,0x72,0x35,0x61,0x46,0x63,0x52,0x65, +0x64,0x66,0x72,0x6c,2,0x65,0x2d,0x66,0x3b,0x6f,0x28,0x12,0x77,0x65,0x72,0x29, +0x10,0x74,0x22,0x12,0x65,0x72,0x6d,0x23,1,0x6c,0x24,0x72,0x37,0x24,0x12,0x6f, +0x73,0x65,0x25,0x10,0x78,0x38,0x13,0x74,0x65,0x6e,0x64,0x39,0x10,0x6f,0x26,0x13, +0x72,0x6d,0x61,0x74,0x27,0,0x10,0x6c,0x88,0x72,0x40,0x72,0x36,0x73,0x5e,0x77, +0x7a,0x78,0x8a,0x7a,0x11,0x77,0x6a,0x4b,1,0x65,0x24,0x69,0x3b,0x1e,0x67,0x69, +0x6f,0x6e,0x61,0x6c,0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x3b,1,0x69, +0x24,0x71,0x3f,0x18,0x6e,0x67,0x6c,0x65,0x71,0x75,0x6f,0x74,0x65,0x3f,0x17,0x73, +0x65,0x67,0x73,0x70,0x61,0x63,0x65,0x4d,0x10,0x78,0x21,0x6c,0x36,0x6d,0x3c,0x6e, +0x76,0x6f,0x13,0x74,0x68,0x65,0x72,0x21,1,0x65,0x23,0x66,0x35,3,0x62,0x37, +0x69,0x28,0x6c,0x29,0x6e,0x2b,0x10,0x64,1,0x6c,0x34,0x6e,0x11,0x75,0x6d,0x2a, +0x12,0x6c,0x65,0x74,0x37,0x14,0x65,0x74,0x74,0x65,0x72,0x29,2,0x65,0x36,0x6c, +0x39,0x75,0x2c,0x14,0x6d,0x65,0x72,0x69,0x63,0x2d,0x14,0x77,0x6c,0x69,0x6e,0x65, +0x39,0x66,0x3f,0x66,0x40,0x67,0x4e,0x68,0x70,0x6b,0x10,0x61,0x26,0x15,0x74,0x61, +0x6b,0x61,0x6e,0x61,0x27,0x10,0x6f,0x24,0x13,0x72,0x6d,0x61,0x74,0x25,1,0x61, +0x3a,0x6c,0x19,0x75,0x65,0x61,0x66,0x74,0x65,0x72,0x7a,0x77,0x6a,0x49,0x10,0x7a, +0x49,1,0x65,0x24,0x6c,0x3d,0x19,0x62,0x72,0x65,0x77,0x6c,0x65,0x74,0x74,0x65, +0x72,0x3d,0x61,0x86,0x63,0x92,0x64,0x94,0x65,2,0x62,0x44,0x6d,0x5e,0x78,0x2e, +0x13,0x74,0x65,0x6e,0x64,0x32,0x15,0x6e,0x75,0x6d,0x6c,0x65,0x74,0x2f,0x42,1, +0x61,0x24,0x67,0x45,0x11,0x73,0x65,0x42,0x12,0x67,0x61,0x7a,0x45,0x46,0x16,0x6f, +0x64,0x69,0x66,0x69,0x65,0x72,0x47,0x15,0x6c,0x65,0x74,0x74,0x65,0x72,0x23,0x10, +0x72,0x31,1,0x6f,0x24,0x71,0x41,0x18,0x75,0x62,0x6c,0x65,0x71,0x75,0x6f,0x74, +0x65,0x41,2,0x63,0x32,0x6e,0x3c,0x6f,0x22,0x12,0x70,0x65,0x6e,0x23,0x24,0x13, +0x6c,0x6f,0x73,0x65,0x25,0x20,0x12,0x6f,0x6e,0x65,0x21,6,0x6f,0x65,0x6f,0x4a, +0x72,0x5c,0x74,0x64,0x76,0x1d,0x69,0x73,0x75,0x61,0x6c,0x6f,0x72,0x64,0x65,0x72, +0x6c,0x65,0x66,0x74,0x3d,0x18,0x76,0x65,0x72,0x73,0x74,0x72,0x75,0x63,0x6b,0x2d, +0x13,0x69,0x67,0x68,0x74,0x2f,0x11,0x6f,0x70,0x30,0x12,0x61,0x6e,0x64,2,0x62, +0x32,0x6c,0x62,0x72,0x13,0x69,0x67,0x68,0x74,0x3b,0x14,0x6f,0x74,0x74,0x6f,0x6d, +0x32,0x12,0x61,0x6e,0x64,1,0x6c,0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x35,0x12, +0x65,0x66,0x74,0x3f,0x12,0x65,0x66,0x74,0x36,0x17,0x61,0x6e,0x64,0x72,0x69,0x67, +0x68,0x74,0x39,0x62,0x2c,0x6c,0x5c,0x6e,0x10,0x61,0x21,0x14,0x6f,0x74,0x74,0x6f, +0x6d,0x22,0x12,0x61,0x6e,0x64,1,0x6c,0x2e,0x72,0x13,0x69,0x67,0x68,0x74,0x27, +0x12,0x65,0x66,0x74,0x25,0x12,0x65,0x66,0x74,0x28,0x17,0x61,0x6e,0x64,0x72,0x69, +0x67,0x68,0x74,0x2b,0xd,0x6e,0xaa,0x72,0x70,0x72,0x92,0x73,0xa2,0x46,0x74,0xa2, +0x54,0x76,1,0x69,0x60,0x6f,0x12,0x77,0x65,0x6c,0x62,1,0x64,0x3a,0x69,0x19, +0x6e,0x64,0x65,0x70,0x65,0x6e,0x64,0x65,0x6e,0x74,0x67,0x17,0x65,0x70,0x65,0x6e, +0x64,0x65,0x6e,0x74,0x65,1,0x72,0x2e,0x73,0x13,0x61,0x72,0x67,0x61,0x61,0x12, +0x61,0x6d,0x61,0x5f,0x1d,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x73,0x68,0x69,0x66, +0x74,0x65,0x72,0x57,0x1e,0x79,0x6c,0x6c,0x61,0x62,0x6c,0x65,0x6d,0x6f,0x64,0x69, +0x66,0x69,0x65,0x72,0x59,0x12,0x6f,0x6e,0x65,1,0x6c,0x2c,0x6d,0x12,0x61,0x72, +0x6b,0x5d,0x14,0x65,0x74,0x74,0x65,0x72,0x5b,0x6e,0x3c,0x6f,0x7c,0x70,0x18,0x75, +0x72,0x65,0x6b,0x69,0x6c,0x6c,0x65,0x72,0x55,1,0x6f,0x4c,0x75,1,0x6b,0x3c, +0x6d,0x12,0x62,0x65,0x72,0x50,0x15,0x6a,0x6f,0x69,0x6e,0x65,0x72,0x53,0x11,0x74, +0x61,0x4f,0x16,0x6e,0x6a,0x6f,0x69,0x6e,0x65,0x72,0x4d,0x13,0x74,0x68,0x65,0x72, +0x21,0x67,0x3e,0x67,0x4a,0x69,0x64,0x6a,0x82,0x6d,0x1d,0x6f,0x64,0x69,0x66,0x79, +0x69,0x6e,0x67,0x6c,0x65,0x74,0x74,0x65,0x72,0x4b,0x1c,0x65,0x6d,0x69,0x6e,0x61, +0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x45,0x1e,0x6e,0x76,0x69,0x73,0x69,0x62, +0x6c,0x65,0x73,0x74,0x61,0x63,0x6b,0x65,0x72,0x47,0x14,0x6f,0x69,0x6e,0x65,0x72, +0x49,0x61,0xa2,0xba,0x62,0xa2,0xc0,0x63,1,0x61,0xa2,0xa2,0x6f,0x16,0x6e,0x73, +0x6f,0x6e,0x61,0x6e,0x74,0x2a,8,0x6b,0x67,0x6b,0x48,0x6d,0x52,0x70,0x5c,0x73, +0xa2,0x42,0x77,0x19,0x69,0x74,0x68,0x73,0x74,0x61,0x63,0x6b,0x65,0x72,0x43,0x14, +0x69,0x6c,0x6c,0x65,0x72,0x35,0x14,0x65,0x64,0x69,0x61,0x6c,0x37,1,0x6c,0x52, +0x72,0x10,0x65,1,0x63,0x2e,0x66,0x13,0x69,0x78,0x65,0x64,0x3d,0x19,0x65,0x64, +0x69,0x6e,0x67,0x72,0x65,0x70,0x68,0x61,0x3b,0x18,0x61,0x63,0x65,0x68,0x6f,0x6c, +0x64,0x65,0x72,0x39,0x10,0x75,1,0x62,0x3e,0x63,0x1b,0x63,0x65,0x65,0x64,0x69, +0x6e,0x67,0x72,0x65,0x70,0x68,0x61,0x41,0x15,0x6a,0x6f,0x69,0x6e,0x65,0x64,0x3f, +0x64,0x4c,0x66,0x52,0x68,0x5a,0x69,0x1e,0x6e,0x69,0x74,0x69,0x61,0x6c,0x70,0x6f, +0x73,0x74,0x66,0x69,0x78,0x65,0x64,0x33,0x12,0x65,0x61,0x64,0x2d,0x13,0x69,0x6e, +0x61,0x6c,0x2f,0x18,0x65,0x61,0x64,0x6c,0x65,0x74,0x74,0x65,0x72,0x31,0x1d,0x6e, +0x74,0x69,0x6c,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x6d,0x61,0x72,0x6b,0x29,0x16,0x76, +0x61,0x67,0x72,0x61,0x68,0x61,0x23,1,0x69,0x4a,0x72,0x10,0x61,0x1f,0x68,0x6d, +0x69,0x6a,0x6f,0x69,0x6e,0x69,0x6e,0x67,0x6e,0x75,0x6d,0x62,0x65,0x72,0x27,0x12, +0x6e,0x64,0x75,0x25,2,0x72,0x38,0x74,0x46,0x75,0x26,0x15,0x70,0x72,0x69,0x67, +0x68,0x74,0x27,0x20,0x15,0x6f,0x74,0x61,0x74,0x65,0x64,0x21,1,0x72,0x24,0x75, +0x25,0x22,0x18,0x61,0x6e,0x73,0x66,0x6f,0x72,0x6d,0x65,0x64,1,0x72,0x32,0x75, +0x15,0x70,0x72,0x69,0x67,0x68,0x74,0x25,0x15,0x6f,0x74,0x61,0x74,0x65,0x64,0x23, +0xd,0x6e,0xc1,0x86,0x73,0xa8,0x73,0x4c,0x74,0xa2,0x76,0x75,0xa2,0x83,0x7a,0xd8, +0x70,0,2,0x6c,0xd9,0x20,0,0x70,0xd9,0x40,0,0x73,0xc3,0,0xfe,0xf, +0,0,0,7,0x6f,0x3c,0x6f,0xff,8,0,0,0,0x70,0x3a,0x75,0x6e, +0x79,0x13,0x6d,0x62,0x6f,0x6c,0xff,0xf,0,0,0,0x11,0x61,0x63,1,0x65, +0x34,0x69,0x15,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa5,0,0x18,0x73,0x65,0x70,0x61, +0x72,0x61,0x74,0x6f,0x72,0xc3,0,0x16,0x72,0x72,0x6f,0x67,0x61,0x74,0x65,0xe1, +0,0,0x63,0xff,2,0,0,0,0x65,0x38,0x6b,0xff,4,0,0,0, +0x6d,0xff,1,0,0,0,0x16,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x70, +0,0x1d,0x69,0x74,0x6c,0x65,0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72, +0x31,1,0x6e,0x40,0x70,0x1c,0x70,0x65,0x72,0x63,0x61,0x73,0x65,0x6c,0x65,0x74, +0x74,0x65,0x72,0x25,0x17,0x61,0x73,0x73,0x69,0x67,0x6e,0x65,0x64,0x23,0x6e,0xa2, +0x69,0x6f,0xa2,0x89,0x70,0xfe,0x30,0xf8,0,0,9,0x69,0x33,0x69,0xff,0x10, +0,0,0,0x6f,0xfd,0x80,0,0,0x72,0x54,0x73,0xf9,0,0,0x75,0x12, +0x6e,0x63,0x74,0xfe,0x30,0xf8,0,0,0x15,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff, +0x30,0xf8,0,0,0x17,0x69,0x76,0x61,0x74,0x65,0x75,0x73,0x65,0xdd,0,0, +0x61,0x48,0x63,0xfd,0x40,0,0,0x64,0xe9,0,0,0x65,0xfd,0x20,0,0, +0x66,0xff,0x20,0,0,0,0x1f,0x72,0x61,0x67,0x72,0x61,0x70,0x68,0x73,0x65, +0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x40,0,0xbe,0,3,0x64,0xa7,0, +0x6c,0xab,0,0x6f,0x30,0x75,0x13,0x6d,0x62,0x65,0x72,0xbf,0,0xb2,0,0x1b, +0x6e,0x73,0x70,0x61,0x63,0x69,0x6e,0x67,0x6d,0x61,0x72,0x6b,0xa1,1,0x70,0x92, +0x74,0x12,0x68,0x65,0x72,0xe6,0x80,1,3,0x6c,0x40,0x6e,0x4a,0x70,0x56,0x73, +0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff,8,0,0,0,0x14,0x65,0x74,0x74,0x65, +0x72,0x61,0x14,0x75,0x6d,0x62,0x65,0x72,0xb3,0,0x19,0x75,0x6e,0x63,0x74,0x75, +0x61,0x74,0x69,0x6f,0x6e,0xfd,0x80,0,0,0x1c,0x65,0x6e,0x70,0x75,0x6e,0x63, +0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xf9,0,0,0x66,0xc0,0xc4,0x66,0xa2,0x47, +0x69,0xa2,0x64,0x6c,0xa2,0x79,0x6d,0xa4,0xc0,4,0x61,0x6c,0x63,0xa5,0,0x65, +0xa3,0x80,0x6e,0xa1,0x6f,0x15,0x64,0x69,0x66,0x69,0x65,0x72,1,0x6c,0x38,0x73, +0x14,0x79,0x6d,0x62,0x6f,0x6c,0xff,4,0,0,0,0x14,0x65,0x74,0x74,0x65, +0x72,0x41,1,0x72,0x3c,0x74,0x16,0x68,0x73,0x79,0x6d,0x62,0x6f,0x6c,0xff,1, +0,0,0,0x10,0x6b,0xa5,0xc0,1,0x69,0x32,0x6f,0x13,0x72,0x6d,0x61,0x74, +0xdb,0,0,0x1d,0x6e,0x61,0x6c,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69, +0x6f,0x6e,0xff,0x20,0,0,0,0x10,0x6e,0x1f,0x69,0x74,0x69,0x61,0x6c,0x70, +0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xff,0x10,0,0,0,0x9c, +7,0x6d,0x18,0x6d,0x41,0x6f,0x28,0x74,0x31,0x75,0x25,0x60,0x1c,0x77,0x65,0x72, +0x63,0x61,0x73,0x65,0x6c,0x65,0x74,0x74,0x65,0x72,0x29,0x63,0x3d,0x65,0x28,0x69, +0x42,0x6c,0x29,0x13,0x74,0x74,0x65,0x72,0x9c,0x15,0x6e,0x75,0x6d,0x62,0x65,0x72, +0xab,0,0x1a,0x6e,0x65,0x73,0x65,0x70,0x61,0x72,0x61,0x74,0x6f,0x72,0xd9,0x20, +0,0x63,0x46,0x64,0xa2,0x96,0x65,0x1b,0x6e,0x63,0x6c,0x6f,0x73,0x69,0x6e,0x67, +0x6d,0x61,0x72,0x6b,0xa3,0x80,0xe6,0x80,1,7,0x6e,0x57,0x6e,0x52,0x6f,0x5e, +0x73,0xe1,0,0,0x75,0x1b,0x72,0x72,0x65,0x6e,0x63,0x79,0x73,0x79,0x6d,0x62, +0x6f,0x6c,0xff,2,0,0,0,0x22,0x12,0x74,0x72,0x6c,0xd9,0x80,0,0xdc, +0,0,1,0x6d,0x62,0x6e,1,0x6e,0x30,0x74,0x12,0x72,0x6f,0x6c,0xd9,0x80, +0,0x1f,0x65,0x63,0x74,0x6f,0x72,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69, +0x6f,0x6e,0xfd,0x40,0,0,0x19,0x62,0x69,0x6e,0x69,0x6e,0x67,0x6d,0x61,0x72, +0x6b,0xa5,0xc0,0x61,0x58,0x63,0xd9,0x80,0,0x66,0xdb,0,0,0x6c,0x1d,0x6f, +0x73,0x65,0x70,0x75,0x6e,0x63,0x74,0x75,0x61,0x74,0x69,0x6f,0x6e,0xfd,0x20,0, +0,0x18,0x73,0x65,0x64,0x6c,0x65,0x74,0x74,0x65,0x72,0x3d,2,0x61,0x32,0x65, +0x50,0x69,0x12,0x67,0x69,0x74,0xa7,0,0x1c,0x73,0x68,0x70,0x75,0x6e,0x63,0x74, +0x75,0x61,0x74,0x69,0x6f,0x6e,0xe9,0,0,0x1a,0x63,0x69,0x6d,0x61,0x6c,0x6e, +0x75,0x6d,0x62,0x65,0x72,0xa7,0 }; -const char PropNameData::nameGroups[22098]={ +const char PropNameData::nameGroups[23338]={ 2,'A','l','p','h','a',0,'A','l','p','h','a','b','e','t','i','c',0, 4,'N',0,'N','o',0,'F',0,'F','a','l','s','e',0,4,'Y',0,'Y','e','s',0,'T',0,'T','r','u','e',0, 2,'N','R',0,'N','o','t','_','R','e','o','r','d','e','r','e','d',0, @@ -1138,8 +1173,22 @@ const char PropNameData::nameGroups[22098]={ 2,'R','I',0,'R','e','g','i','o','n','a','l','_','I','n','d','i','c','a','t','o','r',0, 2,'P','C','M',0,'P','r','e','p','e','n','d','e','d','_','C','o','n','c','a','t','e','n','a','t','i','o','n','_','M','a','r', 'k',0,2,'E','x','t','P','i','c','t',0,'E','x','t','e','n','d','e','d','_','P','i','c','t','o','g','r','a','p','h','i','c', -0,2,'b','c',0,'B','i','d','i','_','C','l','a','s','s',0, -2,'L',0,'L','e','f','t','_','T','o','_','R','i','g','h','t',0, +0,2,'B','a','s','i','c','_','E','m','o','j','i',0,'B','a','s','i','c','_','E','m','o','j','i',0, +2,'E','m','o','j','i','_','K','e','y','c','a','p','_','S','e','q','u','e','n','c','e',0,'E','m','o','j','i','_','K','e','y', +'c','a','p','_','S','e','q','u','e','n','c','e',0,2,'R','G','I','_','E','m','o','j','i','_','M','o','d','i','f','i','e','r', +'_','S','e','q','u','e','n','c','e',0,'R','G','I','_','E','m','o','j','i','_','M','o','d','i','f','i','e','r','_','S','e','q', +'u','e','n','c','e',0,2,'R','G','I','_','E','m','o','j','i','_','F','l','a','g','_','S','e','q','u','e','n','c','e',0, +'R','G','I','_','E','m','o','j','i','_','F','l','a','g','_','S','e','q','u','e','n','c','e',0, +2,'R','G','I','_','E','m','o','j','i','_','T','a','g','_','S','e','q','u','e','n','c','e',0, +'R','G','I','_','E','m','o','j','i','_','T','a','g','_','S','e','q','u','e','n','c','e',0, +2,'R','G','I','_','E','m','o','j','i','_','Z','W','J','_','S','e','q','u','e','n','c','e',0, +'R','G','I','_','E','m','o','j','i','_','Z','W','J','_','S','e','q','u','e','n','c','e',0, +2,'R','G','I','_','E','m','o','j','i',0,'R','G','I','_','E','m','o','j','i',0, +2,'I','D','S','U',0,'I','D','S','_','U','n','a','r','y','_','O','p','e','r','a','t','o','r',0, +2,'I','D','_','C','o','m','p','a','t','_','M','a','t','h','_','S','t','a','r','t',0,'I','D','_','C','o','m','p','a','t','_', +'M','a','t','h','_','S','t','a','r','t',0,2,'I','D','_','C','o','m','p','a','t','_','M','a','t','h','_','C','o','n','t','i', +'n','u','e',0,'I','D','_','C','o','m','p','a','t','_','M','a','t','h','_','C','o','n','t','i','n','u','e',0, +2,'b','c',0,'B','i','d','i','_','C','l','a','s','s',0,2,'L',0,'L','e','f','t','_','T','o','_','R','i','g','h','t',0, 2,'R',0,'R','i','g','h','t','_','T','o','_','L','e','f','t',0, 2,'E','N',0,'E','u','r','o','p','e','a','n','_','N','u','m','b','e','r',0, 2,'E','S',0,'E','u','r','o','p','e','a','n','_','S','e','p','a','r','a','t','o','r',0, @@ -1509,9 +1558,33 @@ const char PropNameData::nameGroups[22098]={ 'n','t',0,2,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g', 0,'S','y','m','b','o','l','s','_','F','o','r','_','L','e','g','a','c','y','_','C','o','m','p','u','t','i','n','g',0, 2,'T','a','n','g','u','t','_','S','u','p',0,'T','a','n','g','u','t','_','S','u','p','p','l','e','m','e','n','t',0, -2,'Y','e','z','i','d','i',0,'Y','e','z','i','d','i',0,2,'c','c','c',0,'C','a','n','o','n','i','c','a','l','_','C','o', -'m','b','i','n','i','n','g','_','C','l','a','s','s',0,2,'d','t',0,'D','e','c','o','m','p','o','s','i','t','i','o','n','_', -'T','y','p','e',0,3,'N','o','n','e',0,'N','o','n','e',0,'n','o','n','e',0, +2,'Y','e','z','i','d','i',0,'Y','e','z','i','d','i',0,2,'A','r','a','b','i','c','_','E','x','t','_','B',0, +'A','r','a','b','i','c','_','E','x','t','e','n','d','e','d','_','B',0, +2,'C','y','p','r','o','_','M','i','n','o','a','n',0,'C','y','p','r','o','_','M','i','n','o','a','n',0, +2,'E','t','h','i','o','p','i','c','_','E','x','t','_','B',0,'E','t','h','i','o','p','i','c','_','E','x','t','e','n','d','e', +'d','_','B',0,2,'K','a','n','a','_','E','x','t','_','B',0,'K','a','n','a','_','E','x','t','e','n','d','e','d','_','B',0, +2,'L','a','t','i','n','_','E','x','t','_','F',0,'L','a','t','i','n','_','E','x','t','e','n','d','e','d','_','F',0, +2,'L','a','t','i','n','_','E','x','t','_','G',0,'L','a','t','i','n','_','E','x','t','e','n','d','e','d','_','G',0, +2,'O','l','d','_','U','y','g','h','u','r',0,'O','l','d','_','U','y','g','h','u','r',0, +2,'T','a','n','g','s','a',0,'T','a','n','g','s','a',0,2,'T','o','t','o',0,'T','o','t','o',0, +2,'U','C','A','S','_','E','x','t','_','A',0,'U','n','i','f','i','e','d','_','C','a','n','a','d','i','a','n','_','A','b','o', +'r','i','g','i','n','a','l','_','S','y','l','l','a','b','i','c','s','_','E','x','t','e','n','d','e','d','_','A',0, +2,'V','i','t','h','k','u','q','i',0,'V','i','t','h','k','u','q','i',0, +2,'Z','n','a','m','e','n','n','y','_','M','u','s','i','c',0,'Z','n','a','m','e','n','n','y','_','M','u','s','i','c','a','l', +'_','N','o','t','a','t','i','o','n',0,2,'A','r','a','b','i','c','_','E','x','t','_','C',0, +'A','r','a','b','i','c','_','E','x','t','e','n','d','e','d','_','C',0, +2,'C','J','K','_','E','x','t','_','H',0,'C','J','K','_','U','n','i','f','i','e','d','_','I','d','e','o','g','r','a','p','h', +'s','_','E','x','t','e','n','s','i','o','n','_','H',0,2,'C','y','r','i','l','l','i','c','_','E','x','t','_','D',0, +'C','y','r','i','l','l','i','c','_','E','x','t','e','n','d','e','d','_','D',0, +2,'D','e','v','a','n','a','g','a','r','i','_','E','x','t','_','A',0,'D','e','v','a','n','a','g','a','r','i','_','E','x','t', +'e','n','d','e','d','_','A',0,2,'K','a','k','t','o','v','i','k','_','N','u','m','e','r','a','l','s',0, +'K','a','k','t','o','v','i','k','_','N','u','m','e','r','a','l','s',0, +2,'K','a','w','i',0,'K','a','w','i',0,2,'N','a','g','_','M','u','n','d','a','r','i',0, +'N','a','g','_','M','u','n','d','a','r','i',0,2,'C','J','K','_','E','x','t','_','I',0,'C','J','K','_','U','n','i','f','i', +'e','d','_','I','d','e','o','g','r','a','p','h','s','_','E','x','t','e','n','s','i','o','n','_','I',0, +2,'c','c','c',0,'C','a','n','o','n','i','c','a','l','_','C','o','m','b','i','n','i','n','g','_','C','l','a','s','s',0, +2,'d','t',0,'D','e','c','o','m','p','o','s','i','t','i','o','n','_','T','y','p','e',0, +3,'N','o','n','e',0,'N','o','n','e',0,'n','o','n','e',0, 3,'C','a','n',0,'C','a','n','o','n','i','c','a','l',0,'c','a','n',0, 3,'C','o','m',0,'C','o','m','p','a','t',0,'c','o','m',0, 3,'E','n','c',0,'C','i','r','c','l','e',0,'e','n','c',0, @@ -1644,7 +1717,9 @@ const char PropNameData::nameGroups[22098]={ 2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0, 'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','K','i','n','n','a','_','Y','a',0, 2,'H','a','n','i','f','i','_','R','o','h','i','n','g','y','a','_','P','a',0,'H','a','n','i','f','i','_','R','o','h','i','n', -'g','y','a','_','P','a',0,2,'j','t',0,'J','o','i','n','i','n','g','_','T','y','p','e',0, +'g','y','a','_','P','a',0,2,'T','h','i','n','_','Y','e','h',0,'T','h','i','n','_','Y','e','h',0, +2,'V','e','r','t','i','c','a','l','_','T','a','i','l',0,'V','e','r','t','i','c','a','l','_','T','a','i','l',0, +2,'j','t',0,'J','o','i','n','i','n','g','_','T','y','p','e',0, 2,'U',0,'N','o','n','_','J','o','i','n','i','n','g',0,2,'C',0,'J','o','i','n','_','C','a','u','s','i','n','g',0, 2,'D',0,'D','u','a','l','_','J','o','i','n','i','n','g',0, 2,'L',0,'L','e','f','t','_','J','o','i','n','i','n','g',0, @@ -1678,7 +1753,11 @@ const char PropNameData::nameGroups[22098]={ 's','i','s',0,2,'C','J',0,'C','o','n','d','i','t','i','o','n','a','l','_','J','a','p','a','n','e','s','e','_','S','t','a', 'r','t','e','r',0,2,'H','L',0,'H','e','b','r','e','w','_','L','e','t','t','e','r',0, 2,'E','B',0,'E','_','B','a','s','e',0,2,'E','M',0,'E','_','M','o','d','i','f','i','e','r',0, -2,'Z','W','J',0,'Z','W','J',0,2,'n','t',0,'N','u','m','e','r','i','c','_','T','y','p','e',0, +2,'Z','W','J',0,'Z','W','J',0,2,'A','K',0,'A','k','s','a','r','a',0, +2,'A','P',0,'A','k','s','a','r','a','_','P','r','e','b','a','s','e',0, +2,'A','S',0,'A','k','s','a','r','a','_','S','t','a','r','t',0, +2,'V','F',0,'V','i','r','a','m','a','_','F','i','n','a','l',0, +2,'V','I',0,'V','i','r','a','m','a',0,2,'n','t',0,'N','u','m','e','r','i','c','_','T','y','p','e',0, 2,'N','o','n','e',0,'N','o','n','e',0,2,'D','e',0,'D','e','c','i','m','a','l',0, 2,'D','i',0,'D','i','g','i','t',0,2,'N','u',0,'N','u','m','e','r','i','c',0, 2,'s','c',0,'S','c','r','i','p','t',0,2,'Z','y','y','y',0,'C','o','m','m','o','n',0, @@ -1795,8 +1874,12 @@ const char PropNameData::nameGroups[22098]={ 2,'W','c','h','o',0,'W','a','n','c','h','o',0,2,'C','h','r','s',0,'C','h','o','r','a','s','m','i','a','n',0, 2,'D','i','a','k',0,'D','i','v','e','s','_','A','k','u','r','u',0, 2,'K','i','t','s',0,'K','h','i','t','a','n','_','S','m','a','l','l','_','S','c','r','i','p','t',0, -2,'Y','e','z','i',0,'Y','e','z','i','d','i',0,2,'h','s','t',0,'H','a','n','g','u','l','_','S','y','l','l','a','b','l', -'e','_','T','y','p','e',0,2,'N','A',0,'N','o','t','_','A','p','p','l','i','c','a','b','l','e',0, +2,'Y','e','z','i',0,'Y','e','z','i','d','i',0,2,'C','p','m','n',0,'C','y','p','r','o','_','M','i','n','o','a','n',0, +2,'O','u','g','r',0,'O','l','d','_','U','y','g','h','u','r',0, +2,'T','n','s','a',0,'T','a','n','g','s','a',0,2,'V','i','t','h',0,'V','i','t','h','k','u','q','i',0, +2,'N','a','g','m',0,'N','a','g','_','M','u','n','d','a','r','i',0, +2,'h','s','t',0,'H','a','n','g','u','l','_','S','y','l','l','a','b','l','e','_','T','y','p','e',0, +2,'N','A',0,'N','o','t','_','A','p','p','l','i','c','a','b','l','e',0, 2,'L',0,'L','e','a','d','i','n','g','_','J','a','m','o',0, 2,'V',0,'V','o','w','e','l','_','J','a','m','o',0,2,'T',0,'T','r','a','i','l','i','n','g','_','J','a','m','o',0, 2,'L','V',0,'L','V','_','S','y','l','l','a','b','l','e',0, diff --git a/src/duckdb/extension/icu/third_party/icu/common/propsvec.cpp b/src/duckdb/extension/icu/third_party/icu/common/propsvec.cpp index 056fcda9c..18cc3e8cd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/propsvec.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/propsvec.cpp @@ -47,21 +47,21 @@ upvec_open(int32_t columns, UErrorCode *pErrorCode) { uint32_t cp; if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } if(columns<1) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } columns+=2; /* count range start and limit columns */ pv=(UPropsVectors *)uprv_malloc(sizeof(UPropsVectors)); v=(uint32_t *)uprv_malloc(UPVEC_INITIAL_ROWS*columns*4); - if(pv==NULL || v==NULL) { + if(pv==nullptr || v==nullptr) { uprv_free(pv); uprv_free(v); *pErrorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uprv_memset(pv, 0, sizeof(UPropsVectors)); pv->v=v; @@ -85,7 +85,7 @@ upvec_open(int32_t columns, UErrorCode *pErrorCode) { U_CAPI void U_EXPORT2 upvec_close(UPropsVectors *pv) { - if(pv!=NULL) { + if(pv!=nullptr) { uprv_free(pv->v); uprv_free(pv); } @@ -165,7 +165,7 @@ upvec_setValue(UPropsVectors *pv, if(U_FAILURE(*pErrorCode)) { return; } - if( pv==NULL || + if( pv==nullptr || start<0 || start>end || end>UPVEC_MAX_CP || column<0 || column>=(pv->columns-2) ) { @@ -216,7 +216,7 @@ upvec_setValue(UPropsVectors *pv, return; } newVectors=(uint32_t *)uprv_malloc(newMaxRows*columns*4); - if(newVectors==NULL) { + if(newVectors==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return; } @@ -296,15 +296,15 @@ upvec_getRow(const UPropsVectors *pv, int32_t rowIndex, int32_t columns; if(pv->isCompacted || rowIndex<0 || rowIndex>=pv->rows) { - return NULL; + return nullptr; } columns=pv->columns; row=pv->v+rowIndex*columns; - if(pRangeStart!=NULL) { + if(pRangeStart!=nullptr) { *pRangeStart=(UChar32)row[0]; } - if(pRangeEnd!=NULL) { + if(pRangeEnd!=nullptr) { *pRangeEnd=(UChar32)row[1]-1; } return row+2; @@ -342,7 +342,7 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE if(U_FAILURE(*pErrorCode)) { return; } - if(handler==NULL) { + if(handler==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -351,7 +351,7 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE } /* Set the flag now: Sorting and compacting destroys the builder data structure. */ - pv->isCompacted=TRUE; + pv->isCompacted=true; rows=pv->rows; columns=pv->columns; @@ -360,7 +360,7 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE /* sort the properties vectors to find unique vector values */ uprv_sortArray(pv->v, rows, columns*4, - upvec_compareRows, pv, FALSE, pErrorCode); + upvec_compareRows, pv, false, pErrorCode); if(U_FAILURE(*pErrorCode)) { return; } @@ -437,12 +437,12 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE U_CAPI const uint32_t * U_EXPORT2 upvec_getArray(const UPropsVectors *pv, int32_t *pRows, int32_t *pColumns) { if(!pv->isCompacted) { - return NULL; + return nullptr; } - if(pRows!=NULL) { + if(pRows!=nullptr) { *pRows=pv->rows; } - if(pColumns!=NULL) { + if(pColumns!=nullptr) { *pColumns=pv->columns-2; } return pv->v; @@ -455,23 +455,23 @@ upvec_cloneArray(const UPropsVectors *pv, int32_t byteLength; if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } if(!pv->isCompacted) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } byteLength=pv->rows*(pv->columns-2)*4; clonedArray=(uint32_t *)uprv_malloc(byteLength); - if(clonedArray==NULL) { + if(clonedArray==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uprv_memcpy(clonedArray, pv->v, byteLength); - if(pRows!=NULL) { + if(pRows!=nullptr) { *pRows=pv->rows; } - if(pColumns!=NULL) { + if(pColumns!=nullptr) { *pColumns=pv->columns-2; } return clonedArray; @@ -479,12 +479,12 @@ upvec_cloneArray(const UPropsVectors *pv, U_CAPI UTrie2 * U_EXPORT2 upvec_compactToUTrie2WithRowIndexes(UPropsVectors *pv, UErrorCode *pErrorCode) { - UPVecToUTrie2Context toUTrie2={ NULL, 0, 0, 0 }; + UPVecToUTrie2Context toUTrie2={ nullptr, 0, 0, 0 }; upvec_compact(pv, upvec_compactToUTrie2Handler, &toUTrie2, pErrorCode); utrie2_freeze(toUTrie2.trie, UTRIE2_16_VALUE_BITS, pErrorCode); if(U_FAILURE(*pErrorCode)) { utrie2_close(toUTrie2.trie); - toUTrie2.trie=NULL; + toUTrie2.trie=nullptr; } return toUTrie2.trie; } @@ -503,7 +503,7 @@ upvec_compactToUTrie2Handler(void *context, (void)columns; UPVecToUTrie2Context *toUTrie2=(UPVecToUTrie2Context *)context; if(starttrie, start, end, (uint32_t)rowIndex, TRUE, pErrorCode); + utrie2_setRange32(toUTrie2->trie, start, end, (uint32_t)rowIndex, true, pErrorCode); } else { switch(start) { case UPVEC_INITIAL_VALUE_CP: diff --git a/src/duckdb/extension/icu/third_party/icu/common/punycode.cpp b/src/duckdb/extension/icu/third_party/icu/common/punycode.cpp deleted file mode 100644 index 8122b7724..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/punycode.cpp +++ /dev/null @@ -1,589 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * -// * Copyright (C) 2002-2011, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ******************************************************************************* -// * file name: punycode.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2002jan31 -// * created by: Markus W. Scherer -// */ - - -// /* This ICU code derived from: */ -// /* -// punycode.c 0.4.0 (2001-Nov-17-Sat) -// http://www.cs.berkeley.edu/~amc/idn/ -// Adam M. Costello -// http://www.nicemice.net/amc/ - -// Disclaimer and license - -// Regarding this entire document or any portion of it (including -// the pseudocode and C code), the author makes no guarantees and -// is not responsible for any damage resulting from its use. The -// author grants irrevocable permission to anyone to use, modify, -// and distribute it in any way that does not diminish the rights -// of anyone else to use, modify, and distribute it, provided that -// redistributed derivative works do not contain misleading author or -// version information. Derivative works need not be licensed under -// similar terms. -// */ -// /* -// * ICU modifications: -// * - ICU data types and coding conventions -// * - ICU string buffer handling with implicit source lengths -// * and destination preflighting -// * - UTF-16 handling -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_IDNA - -// #include "unicode/ustring.h" -// #include "unicode/utf.h" -// #include "unicode/utf16.h" -// #include "ustr_imp.h" -// #include "cstring.h" -// #include "cmemory.h" -// #include "punycode.h" -// #include "uassert.h" - - -// /* Punycode ----------------------------------------------------------------- */ - -// /* Punycode parameters for Bootstring */ -// #define BASE 36 -// #define TMIN 1 -// #define TMAX 26 -// #define SKEW 38 -// #define DAMP 700 -// #define INITIAL_BIAS 72 -// #define INITIAL_N 0x80 - -// /* "Basic" Unicode/ASCII code points */ -// #define _HYPHEN 0X2d -// #define DELIMITER _HYPHEN - -// #define _ZERO_ 0X30 -// #define _NINE 0x39 - -// #define _SMALL_A 0X61 -// #define _SMALL_Z 0X7a - -// #define _CAPITAL_A 0X41 -// #define _CAPITAL_Z 0X5a - -// #define IS_BASIC(c) ((c)<0x80) -// #define IS_BASIC_UPPERCASE(c) (_CAPITAL_A<=(c) && (c)<=_CAPITAL_Z) - -// /** -// * digitToBasic() returns the basic code point whose value -// * (when used for representing integers) is d, which must be in the -// * range 0 to BASE-1. The lowercase form is used unless the uppercase flag is -// * nonzero, in which case the uppercase form is used. -// */ -// static inline char -// digitToBasic(int32_t digit, UBool uppercase) { -// /* 0..25 map to ASCII a..z or A..Z */ -// /* 26..35 map to ASCII 0..9 */ -// if(digit<26) { -// if(uppercase) { -// return (char)(_CAPITAL_A+digit); -// } else { -// return (char)(_SMALL_A+digit); -// } -// } else { -// return (char)((_ZERO_-26)+digit); -// } -// } - -// /** -// * basicToDigit[] contains the numeric value of a basic code -// * point (for use in representing integers) in the range 0 to -// * BASE-1, or -1 if b is does not represent a value. -// */ -// static const int8_t -// basicToDigit[256]={ -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -// 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, - -// -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -// 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - -// -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -// 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 -// }; - -// static inline char -// asciiCaseMap(char b, UBool uppercase) { -// if(uppercase) { -// if(_SMALL_A<=b && b<=_SMALL_Z) { -// b-=(_SMALL_A-_CAPITAL_A); -// } -// } else { -// if(_CAPITAL_A<=b && b<=_CAPITAL_Z) { -// b+=(_SMALL_A-_CAPITAL_A); -// } -// } -// return b; -// } - -// /* Punycode-specific Bootstring code ---------------------------------------- */ - -// /* -// * The following code omits the {parts} of the pseudo-algorithm in the spec -// * that are not used with the Punycode parameter set. -// */ - -// /* Bias adaptation function. */ -// static int32_t -// adaptBias(int32_t delta, int32_t length, UBool firstTime) { -// int32_t count; - -// if(firstTime) { -// delta/=DAMP; -// } else { -// delta/=2; -// } - -// delta+=delta/length; -// for(count=0; delta>((BASE-TMIN)*TMAX)/2; count+=BASE) { -// delta/=(BASE-TMIN); -// } - -// return count+(((BASE-TMIN+1)*delta)/(delta+SKEW)); -// } - -// #define MAX_CP_COUNT 200 - -// U_CFUNC int32_t -// u_strToPunycode(const UChar *src, int32_t srcLength, -// UChar *dest, int32_t destCapacity, -// const UBool *caseFlags, -// UErrorCode *pErrorCode) { - -// int32_t cpBuffer[MAX_CP_COUNT]; -// int32_t n, delta, handledCPCount, basicLength, destLength, bias, j, m, q, k, t, srcCPCount; -// UChar c, c2; - -// /* argument checking */ -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// if(src==NULL || srcLength<-1 || (dest==NULL && destCapacity!=0)) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// /* -// * Handle the basic code points and -// * convert extended ones to UTF-32 in cpBuffer (caseFlag in sign bit): -// */ -// srcCPCount=destLength=0; -// if(srcLength==-1) { -// /* NUL-terminated input */ -// for(j=0; /* no condition */; ++j) { -// if((c=src[j])==0) { -// break; -// } -// if(srcCPCount==MAX_CP_COUNT) { -// /* too many input code points */ -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } -// if(IS_BASIC(c)) { -// cpBuffer[srcCPCount++]=0; -// if(destLength0) { -// if(destLength state to , but guard against overflow: -// */ -// if(m-n>(0x7fffffff-MAX_CP_COUNT-delta)/(handledCPCount+1)) { -// *pErrorCode=U_INTERNAL_PROGRAM_ERROR; -// return 0; -// } -// delta+=(m-n)*(handledCPCount+1); -// n=m; - -// /* Encode a sequence of same code points n */ -// for(j=0; jTMAX) { -// t=TMAX; -// } -// */ - -// t=k-bias; -// if(t=(bias+TMAX)) { -// t=TMAX; -// } - -// if(q0;) { -// if(src[--j]==DELIMITER) { -// break; -// } -// } -// destLength=basicLength=destCPCount=j; -// U_ASSERT(destLength>=0); - -// while(j>0) { -// b=src[--j]; -// if(!IS_BASIC(b)) { -// *pErrorCode=U_INVALID_CHAR_FOUND; -// return 0; -// } - -// if(j0 ? basicLength+1 : 0; in=srcLength) { -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return 0; -// } - -// digit=basicToDigit[(uint8_t)src[in++]]; -// if(digit<0) { -// *pErrorCode=U_INVALID_CHAR_FOUND; -// return 0; -// } -// if(digit>(0x7fffffff-i)/w) { -// /* integer overflow */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return 0; -// } - -// i+=digit*w; -// /** RAM: comment out the old code for conformance with draft-ietf-idn-punycode-03.txt -// t=k-bias; -// if(tTMAX) { -// t=TMAX; -// } -// */ -// t=k-bias; -// if(t=(bias+TMAX)) { -// t=TMAX; -// } -// if(digit0x7fffffff/(BASE-t)) { -// /* integer overflow */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return 0; -// } -// w*=BASE-t; -// } - -// /* -// * Modification from sample code: -// * Increments destCPCount here, -// * where needed instead of in for() loop tail. -// */ -// ++destCPCount; -// bias=adaptBias(i-oldi, destCPCount, (UBool)(oldi==0)); - -// /* -// * i was supposed to wrap around from (incremented) destCPCount to 0, -// * incrementing n each time, so we'll fix that now: -// */ -// if(i/destCPCount>(0x7fffffff-n)) { -// /* integer overflow */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return 0; -// } - -// n+=i/destCPCount; -// i%=destCPCount; -// /* not needed for Punycode: */ -// /* if (decode_digit(n) <= BASE) return punycode_invalid_input; */ - -// if(n>0x10ffff || U_IS_SURROGATE(n)) { -// /* Unicode code point overflow */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return 0; -// } - -// /* Insert n at position i of the output: */ -// cpLength=U16_LENGTH(n); -// if(dest!=NULL && ((destLength+cpLength)<=destCapacity)) { -// int32_t codeUnitIndex; - -// /* -// * Handle indexes when supplementary code points are present. -// * -// * In almost all cases, there will be only BMP code points before i -// * and even in the entire string. -// * This is handled with the same efficiency as with UTF-32. -// * -// * Only the rare cases with supplementary code points are handled -// * more slowly - but not too bad since this is an insertion anyway. -// */ -// if(i<=firstSupplementaryIndex) { -// codeUnitIndex=i; -// if(cpLength>1) { -// firstSupplementaryIndex=codeUnitIndex; -// } else { -// ++firstSupplementaryIndex; -// } -// } else { -// codeUnitIndex=firstSupplementaryIndex; -// U16_FWD_N(dest, codeUnitIndex, destLength, i-codeUnitIndex); -// } - -// /* use the UChar index codeUnitIndex instead of the code point index i */ -// if(codeUnitIndex=0); -// ++i; -// } - -// return u_terminateUChars(dest, destCapacity, destLength, pErrorCode); -// } - -// /* ### check notes on overflow handling - only necessary if not IDNA? are these Punycode functions to be public? */ - -// #endif /* #if !UCONFIG_NO_IDNA */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/punycode.h b/src/duckdb/extension/icu/third_party/icu/common/punycode.h index 5d8a24317..9e28f770c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/punycode.h +++ b/src/duckdb/extension/icu/third_party/icu/common/punycode.h @@ -50,7 +50,7 @@ Adam M. Costello * @param caseFlags Vector of boolean values, one per input UChar, * indicating that the corresponding character is to be * marked for the decoder optionally - * uppercasing (TRUE) or lowercasing (FALSE) + * uppercasing (true) or lowercasing (false) * the character. * ASCII characters are output directly in the case as marked. * Flags corresponding to trail surrogates are ignored. @@ -65,7 +65,7 @@ Adam M. Costello * * @see u_strFromPunycode */ -U_CFUNC int32_t +U_CAPI int32_t u_strToPunycode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, const UBool *caseFlags, @@ -83,10 +83,10 @@ u_strToPunycode(const UChar *src, int32_t srcLength, * and of caseFlags in numbers of UBools. * @param caseFlags Output array for case flags as * defined by the Punycode string. - * The caller should uppercase (TRUE) or lowercase (FASLE) + * The caller should uppercase (true) or lowercase (FASLE) * the corresponding character in dest. * For supplementary characters, only the lead surrogate - * is marked, and FALSE is stored for the trail surrogate. + * is marked, and false is stored for the trail surrogate. * This is redundant and not necessary for ASCII characters * because they are already in the case indicated. * Can be NULL if the case flags are not needed. @@ -100,7 +100,7 @@ u_strToPunycode(const UChar *src, int32_t srcLength, * * @see u_strToPunycode */ -U_CFUNC int32_t +U_CAPI int32_t u_strFromPunycode(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, UBool *caseFlags, diff --git a/src/duckdb/extension/icu/third_party/icu/common/putil.cpp b/src/duckdb/extension/icu/third_party/icu/common/putil.cpp index 0c3fd9376..ab25f3b99 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/putil.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/putil.cpp @@ -46,6 +46,11 @@ // 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. */ @@ -76,7 +81,7 @@ #include #ifndef U_COMMON_IMPLEMENTATION -#error U_COMMON_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see http://userguide.icu-project.org/howtouseicu +#error U_COMMON_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see https://unicode-org.github.io/icu/userguide/howtouseicu #endif @@ -113,11 +118,15 @@ # ifndef _XPG4_2 # define _XPG4_2 # endif +# elif U_PLATFORM == U_PF_ANDROID +# include +# include # endif #elif U_PLATFORM == U_PF_QNX # include #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. @@ -159,7 +168,7 @@ U_NAMESPACE_USE #define DATA_TYPE "dat" /* Leave this copyright notice here! */ -// static const char copyright[] = U_COPYRIGHT_STRING; +static const char copyright[] = U_COPYRIGHT_STRING; /* floating point implementations ------------------------------------------- */ @@ -235,11 +244,11 @@ u_signBit(double d) { */ UDate fakeClock_t0 = 0; /** Time to start the clock from **/ UDate fakeClock_dt = 0; /** Offset (fake time - real time) **/ -UBool fakeClock_set = FALSE; /** True if fake clock has spun up **/ +UBool fakeClock_set = false; /** True if fake clock has spun up **/ static UDate getUTCtime_real() { struct timeval posixTime; - gettimeofday(&posixTime, NULL); + gettimeofday(&posixTime, nullptr); return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000)); } @@ -249,7 +258,7 @@ static UDate getUTCtime_fake() { if(!fakeClock_set) { UDate real = getUTCtime_real(); const char *fake_start = getenv("U_FAKETIME_START"); - if((fake_start!=NULL) && (fake_start[0]!=0)) { + if((fake_start!=nullptr) && (fake_start[0]!=0)) { sscanf(fake_start,"%lf",&fakeClock_t0); fakeClock_dt = fakeClock_t0 - real; fprintf(stderr,"U_DEBUG_FAKETIME was set at compile time, so the ICU clock will start at a preset value\n" @@ -260,7 +269,7 @@ static UDate getUTCtime_fake() { fprintf(stderr,"U_DEBUG_FAKETIME was set at compile time, but U_FAKETIME_START was not set.\n" "Set U_FAKETIME_START to the number of milliseconds since 1/1/1970 to set the ICU clock.\n"); } - fakeClock_set = TRUE; + fakeClock_set = true; } umtx_unlock(&fakeClockMutex); @@ -310,7 +319,7 @@ uprv_getRawUTCtime() #if HAVE_GETTIMEOFDAY struct timeval posixTime; - gettimeofday(&posixTime, NULL); + gettimeofday(&posixTime, nullptr); return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000)); #else time_t epochtime; @@ -571,7 +580,7 @@ uprv_trunc(double d) * type of arbitrary bit length. */ U_CAPI double U_EXPORT2 -uprv_maxMantissa(void) +uprv_maxMantissa() { return pow(2.0, DBL_MANT_DIG + 1.0) - 1.0; } @@ -603,11 +612,11 @@ uprv_maximumPtr(void * base) * Unlike other operating systems, the pointer model isn't determined at * compile time on i5/OS. */ - if ((base != NULL) && (_TESTPTR(base, _C_TERASPACE_CHECK))) { + if ((base != nullptr) && (_TESTPTR(base, _C_TERASPACE_CHECK))) { /* if it is a TERASPACE pointer the max is 2GB - 4k */ return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0x7fffefff))); } - /* otherwise 16MB since NULL ptr is not checkable or the ptr is not TERASPACE */ + /* otherwise 16MB since nullptr ptr is not checkable or the ptr is not TERASPACE */ return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0xffefff))); #else @@ -708,18 +717,20 @@ extern U_IMPORT char *U_TZNAME[]; /* Some Linux distributions have 'localtime' in /usr/share/zoneinfo symlinked to /etc/localtime, which makes searchForTZFile return 'localtime' when it's the first match. */ -#define TZFILE_putil_SKIP2 "localtime" +#define TZFILE_SKIP2 "localtime" #define SEARCH_TZFILE #include /* Needed to search through system timezone files */ #endif static char gTimeZoneBuffer[PATH_MAX]; -static char *gTimeZoneBufferPtr = NULL; +static const char *gTimeZoneBufferPtr = nullptr; #endif #if !U_PLATFORM_USES_ONLY_WIN32_API #define isNonDigit(ch) (ch < '0' || '9' < ch) +#define isDigit(ch) ('0' <= ch && ch <= '9') static UBool isValidOlsonID(const char *id) { int32_t idx = 0; + int32_t idxMax = 0; /* Determine if this is something like Iceland (Olson ID) or AST4ADT (non-Olson ID) */ @@ -727,6 +738,13 @@ static UBool isValidOlsonID(const char *id) { idx++; } + /* Allow at maximum 2 numbers at the end of the id to support zone id's + like GMT+11. */ + idxMax = idx + 2; + while (id[idx] && isDigit(id[idx]) && idx < idxMax) { + idx++; + } + /* If we went through the whole string, then it might be okay. The timezone is sometimes set to "CST-7CDT", "CST6CDT5,J129,J131/19:30", "GRNLNDST3GRNLNDDT" or similar, so we cannot use it. @@ -861,7 +879,7 @@ static const char* remapShortTimeZone(const char *stdID, const char *dstID, int3 return OFFSET_ZONE_MAPPINGS[idx].olsonID; } } - return NULL; + return nullptr; } #endif @@ -887,16 +905,16 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil int32_t sizeFileRead; int32_t sizeFileToRead; char bufferFile[MAX_READ_SIZE]; - UBool result = TRUE; + UBool result = true; - if (tzInfo->defaultTZFilePtr == NULL) { + if (tzInfo->defaultTZFilePtr == nullptr) { tzInfo->defaultTZFilePtr = fopen(defaultTZFileName, "r"); } file = fopen(TZFileName, "r"); tzInfo->defaultTZPosition = 0; /* reset position to begin search */ - if (file != NULL && tzInfo->defaultTZFilePtr != NULL) { + if (file != nullptr && tzInfo->defaultTZFilePtr != nullptr) { /* First check that the file size are equal. */ if (tzInfo->defaultTZFileSize == 0) { fseek(tzInfo->defaultTZFilePtr, 0, SEEK_END); @@ -907,12 +925,12 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil sizeFileLeft = sizeFile; if (sizeFile != tzInfo->defaultTZFileSize) { - result = FALSE; + result = false; } else { - /* Store the data from the files in seperate buffers and + /* Store the data from the files in separate buffers and * compare each byte to determine equality. */ - if (tzInfo->defaultTZBuffer == NULL) { + if (tzInfo->defaultTZBuffer == nullptr) { rewind(tzInfo->defaultTZFilePtr); tzInfo->defaultTZBuffer = (char*)uprv_malloc(sizeof(char) * tzInfo->defaultTZFileSize); sizeFileRead = fread(tzInfo->defaultTZBuffer, 1, tzInfo->defaultTZFileSize, tzInfo->defaultTZFilePtr); @@ -924,7 +942,7 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil sizeFileRead = fread(bufferFile, 1, sizeFileToRead, file); if (memcmp(tzInfo->defaultTZBuffer + tzInfo->defaultTZPosition, bufferFile, sizeFileRead) != 0) { - result = FALSE; + result = false; break; } sizeFileLeft -= sizeFileRead; @@ -932,10 +950,10 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil } } } else { - result = FALSE; + result = false; } - if (file != NULL) { + if (file != nullptr) { fclose(file); } @@ -944,19 +962,19 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil /* dirent also lists two entries: "." and ".." that we can safely ignore. */ -#define putil_SKIP1 "." -#define putil_SKIP2 ".." -static UBool U_CALLCONV putil_cleanup(void); -static CharString *gSearchTZFileResult = NULL; +#define SKIP1 "." +#define SKIP2 ".." +static UBool U_CALLCONV putil_cleanup(); +static CharString *gSearchTZFileResult = nullptr; /* * This method recursively traverses the directory given for a matching TZ file and returns the first match. * This function is not thread safe - it uses a global, gSearchTZFileResult, to hold its results. */ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) { - DIR* dirp = NULL; - struct dirent* dirEntry = NULL; - char* result = NULL; + DIR* dirp = nullptr; + struct dirent* dirEntry = nullptr; + char* result = nullptr; UErrorCode status = U_ZERO_ERROR; /* Save the current path */ @@ -966,23 +984,23 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) { } dirp = opendir(path); - if (dirp == NULL) { + if (dirp == nullptr) { goto cleanupAndReturn; } - if (gSearchTZFileResult == NULL) { + if (gSearchTZFileResult == nullptr) { gSearchTZFileResult = new CharString; - if (gSearchTZFileResult == NULL) { + if (gSearchTZFileResult == nullptr) { goto cleanupAndReturn; } ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup); } /* Check each entry in the directory. */ - while((dirEntry = readdir(dirp)) != NULL) { + while((dirEntry = readdir(dirp)) != nullptr) { const char* dirName = dirEntry->d_name; - if (uprv_strcmp(dirName, putil_SKIP1) != 0 && uprv_strcmp(dirName, putil_SKIP2) != 0 - && uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_putil_SKIP2, dirName) != 0) { + if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0 + && uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_SKIP2, dirName) != 0) { /* Create a newpath with the new entry to test each entry in the directory. */ CharString newpath(curpath, status); newpath.append(dirName, -1, status); @@ -990,8 +1008,8 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) { break; } - DIR* subDirp = NULL; - if ((subDirp = opendir(newpath.data())) != NULL) { + DIR* subDirp = nullptr; + if ((subDirp = opendir(newpath.data())) != nullptr) { /* If this new path is a directory, make a recursive call with the newpath. */ closedir(subDirp); newpath.append('/', status); @@ -1003,11 +1021,11 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) { Have to get out here. Otherwise, we'd keep looking and return the first match in the top-level directory if there's a match in the top-level. If not, this function - would return NULL and set gTimeZoneBufferPtr to NULL in initDefault(). + would return nullptr and set gTimeZoneBufferPtr to nullptr in initDefault(). It worked without this in most cases because we have a fallback of calling localtime_r to figure out the default timezone. */ - if (result != NULL) + if (result != nullptr) break; } else { if(compareBinaryFiles(TZDEFAULT, newpath.data(), tzInfo)) { @@ -1038,11 +1056,55 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) { } #endif +#if U_PLATFORM == U_PF_ANDROID +typedef int(system_property_read_callback)(const prop_info* info, + void (*callback)(void* cookie, + const char* name, + const char* value, + uint32_t serial), + void* cookie); +typedef int(system_property_get)(const char*, char*); + +static char gAndroidTimeZone[PROP_VALUE_MAX] = { '\0' }; + +static void u_property_read(void* cookie, const char* name, const char* value, + uint32_t serial) { + uprv_strcpy((char* )cookie, value); +} +#endif + U_CAPI void U_EXPORT2 uprv_tzname_clear_cache() { +#if U_PLATFORM == U_PF_ANDROID + /* Android's timezone is stored in system property. */ + gAndroidTimeZone[0] = '\0'; + void* libc = dlopen("libc.so", RTLD_NOLOAD); + if (libc) { + /* Android API 26+ has new API to get system property and old API + * (__system_property_get) is deprecated */ + system_property_read_callback* property_read_callback = + (system_property_read_callback*)dlsym( + libc, "__system_property_read_callback"); + if (property_read_callback) { + const prop_info* info = + __system_property_find("persist.sys.timezone"); + if (info) { + property_read_callback(info, &u_property_read, gAndroidTimeZone); + } + } else { + system_property_get* property_get = + (system_property_get*)dlsym(libc, "__system_property_get"); + if (property_get) { + property_get("persist.sys.timezone", gAndroidTimeZone); + } + } + dlclose(libc); + } +#endif + #if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK) - gTimeZoneBufferPtr = NULL; + gTimeZoneBufferPtr = nullptr; #endif } @@ -1050,11 +1112,11 @@ U_CAPI const char* U_EXPORT2 uprv_tzname(int n) { (void)n; // Avoid unreferenced parameter warning. - const char *tzid = NULL; + const char *tzid = nullptr; #if U_PLATFORM_USES_ONLY_WIN32_API tzid = uprv_detectWindowsTimeZone(); - if (tzid != NULL) { + if (tzid != nullptr) { return tzid; } @@ -1072,17 +1134,21 @@ uprv_tzname(int n) int ret; tzid = getenv("TZFILE"); - if (tzid != NULL) { + if (tzid != nullptr) { return tzid; } #endif*/ /* This code can be temporarily disabled to test tzname resolution later on. */ #ifndef DEBUG_TZNAME +#if U_PLATFORM == U_PF_ANDROID + tzid = gAndroidTimeZone; +#else tzid = getenv("TZ"); - if (tzid != NULL && isValidOlsonID(tzid) +#endif + if (tzid != nullptr && isValidOlsonID(tzid) #if U_PLATFORM == U_PF_SOLARIS - /* When TZ equals localtime on Solaris, check the /etc/localtime file. */ + /* Don't misinterpret TZ "localtime" on Solaris as a time zone name. */ && uprv_strcmp(tzid, TZ_ENV_CHECK) != 0 #endif ) { @@ -1090,61 +1156,70 @@ uprv_tzname(int n) if (tzid[0] == ':') { tzid++; } -#if defined(TZDEFAULT) - if (uprv_strcmp(tzid, TZDEFAULT) != 0) { -#endif - /* This might be a good Olson ID. */ - skipZoneIDPrefix(&tzid); - return tzid; -#if defined(TZDEFAULT) - } -#endif + /* This might be a good Olson ID. */ + skipZoneIDPrefix(&tzid); + return tzid; } /* else U_TZNAME will give a better result. */ #endif #if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK) /* Caller must handle threading issues */ - if (gTimeZoneBufferPtr == NULL) { + if (gTimeZoneBufferPtr == nullptr) { /* This is a trick to look at the name of the link to get the Olson ID because the tzfile contents is underspecified. This isn't guaranteed to work because it may not be a symlink. */ - int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1); - if (0 < ret) { + char *ret = realpath(TZDEFAULT, gTimeZoneBuffer); + if (ret != nullptr && uprv_strcmp(TZDEFAULT, gTimeZoneBuffer) != 0) { int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL); - gTimeZoneBuffer[ret] = 0; - char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL); - - if (tzZoneInfoTailPtr != NULL - && isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen)) - { - return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen); + const char *tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL); + // MacOS14 has the realpath as something like + // /usr/share/zoneinfo.default/Australia/Melbourne + // which will not have "/zoneinfo/" in the path. + // Therefore if we fail, we fall back to read the link which is + // /var/db/timezone/zoneinfo/Australia/Melbourne + // We also fall back to reading the link if the realpath leads to something like + // /usr/share/zoneinfo/posixrules + if (tzZoneInfoTailPtr == nullptr || + uprv_strcmp(tzZoneInfoTailPtr + tzZoneInfoTailLen, "posixrules") == 0) { + ssize_t size = readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1); + if (size > 0) { + gTimeZoneBuffer[size] = 0; + tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL); + } + } + if (tzZoneInfoTailPtr != nullptr) { + tzZoneInfoTailPtr += tzZoneInfoTailLen; + skipZoneIDPrefix(&tzZoneInfoTailPtr); + if (isValidOlsonID(tzZoneInfoTailPtr)) { + return (gTimeZoneBufferPtr = tzZoneInfoTailPtr); + } } } else { #if defined(SEARCH_TZFILE) DefaultTZInfo* tzInfo = (DefaultTZInfo*)uprv_malloc(sizeof(DefaultTZInfo)); - if (tzInfo != NULL) { - tzInfo->defaultTZBuffer = NULL; + if (tzInfo != nullptr) { + tzInfo->defaultTZBuffer = nullptr; tzInfo->defaultTZFileSize = 0; - tzInfo->defaultTZFilePtr = NULL; - tzInfo->defaultTZstatus = FALSE; + tzInfo->defaultTZFilePtr = nullptr; + tzInfo->defaultTZstatus = false; tzInfo->defaultTZPosition = 0; gTimeZoneBufferPtr = searchForTZFile(TZZONEINFO, tzInfo); /* Free previously allocated memory */ - if (tzInfo->defaultTZBuffer != NULL) { + if (tzInfo->defaultTZBuffer != nullptr) { uprv_free(tzInfo->defaultTZBuffer); } - if (tzInfo->defaultTZFilePtr != NULL) { + if (tzInfo->defaultTZFilePtr != nullptr) { fclose(tzInfo->defaultTZFilePtr); } uprv_free(tzInfo); } - if (gTimeZoneBufferPtr != NULL && isValidOlsonID(gTimeZoneBufferPtr)) { + if (gTimeZoneBufferPtr != nullptr && isValidOlsonID(gTimeZoneBufferPtr)) { return gTimeZoneBufferPtr; } #endif @@ -1187,7 +1262,7 @@ uprv_tzname(int n) daylightType = U_DAYLIGHT_NONE; } tzid = remapShortTimeZone(U_TZNAME[0], U_TZNAME[1], daylightType, uprv_timezone()); - if (tzid != NULL) { + if (tzid != nullptr) { return tzid; } } @@ -1200,42 +1275,42 @@ uprv_tzname(int n) /* Get and set the ICU data directory --------------------------------------- */ -static icu::UInitOnce gDataDirInitOnce = U_INITONCE_INITIALIZER; -static char *gDataDirectory = NULL; +static icu::UInitOnce gDataDirInitOnce {}; +static char *gDataDirectory = nullptr; -UInitOnce gTimeZoneFilesInitOnce = U_INITONCE_INITIALIZER; -static CharString *gTimeZoneFilesDirectory = NULL; +UInitOnce gTimeZoneFilesInitOnce {}; +static CharString *gTimeZoneFilesDirectory = nullptr; #if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API - static const char *gCorrectedPOSIXLocale = NULL; /* Sometimes heap allocated */ + static const char *gCorrectedPOSIXLocale = nullptr; /* Sometimes heap allocated */ static bool gCorrectedPOSIXLocaleHeapAllocated = false; #endif -static UBool U_CALLCONV putil_cleanup(void) +static UBool U_CALLCONV putil_cleanup() { if (gDataDirectory && *gDataDirectory) { uprv_free(gDataDirectory); } - gDataDirectory = NULL; + gDataDirectory = nullptr; gDataDirInitOnce.reset(); delete gTimeZoneFilesDirectory; - gTimeZoneFilesDirectory = NULL; + gTimeZoneFilesDirectory = nullptr; gTimeZoneFilesInitOnce.reset(); #ifdef SEARCH_TZFILE delete gSearchTZFileResult; - gSearchTZFileResult = NULL; + gSearchTZFileResult = nullptr; #endif #if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API if (gCorrectedPOSIXLocale && gCorrectedPOSIXLocaleHeapAllocated) { uprv_free(const_cast(gCorrectedPOSIXLocale)); - gCorrectedPOSIXLocale = NULL; + gCorrectedPOSIXLocale = nullptr; gCorrectedPOSIXLocaleHeapAllocated = false; } #endif - return TRUE; + return true; } /* @@ -1247,9 +1322,9 @@ u_setDataDirectory(const char *directory) { char *newDataDir; int32_t length; - if(directory==NULL || *directory==0) { + if(directory==nullptr || *directory==0) { /* A small optimization to prevent the malloc and copy when the - shared library is used, and this is a way to make sure that NULL + shared library is used, and this is a way to make sure that nullptr is never returned. */ newDataDir = (char *)""; @@ -1258,7 +1333,7 @@ u_setDataDirectory(const char *directory) { length=(int32_t)uprv_strlen(directory); newDataDir = (char *)uprv_malloc(length + 2); /* Exit out if newDataDir could not be created. */ - if (newDataDir == NULL) { + if (newDataDir == nullptr) { return; } uprv_strcpy(newDataDir, directory); @@ -1266,7 +1341,7 @@ u_setDataDirectory(const char *directory) { #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) { char *p; - while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) { + while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != nullptr) { *p = U_FILE_SEP_CHAR; } } @@ -1284,16 +1359,16 @@ U_CAPI UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path) { if(!path || !*path) { - return FALSE; + return false; } if(*path == U_FILE_SEP_CHAR) { - return TRUE; + return true; } #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) if(*path == U_FILE_ALT_SEP_CHAR) { - return TRUE; + return true; } #endif @@ -1301,16 +1376,16 @@ uprv_pathIsAbsolute(const char *path) if( (((path[0] >= 'A') && (path[0] <= 'Z')) || ((path[0] >= 'a') && (path[0] <= 'z'))) && path[1] == ':' ) { - return TRUE; + return true; } #endif - return FALSE; + return false; } /* Backup setting of ICU_DATA_DIR_PREFIX_ENV_VAR (needed for some Darwin ICU build environments) */ -#if U_PLATFORM_IS_DARWIN_BASED && TARGET_OS_SIMULATOR +#if U_PLATFORM_IS_DARWIN_BASED && defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR # if !defined(ICU_DATA_DIR_PREFIX_ENV_VAR) # define ICU_DATA_DIR_PREFIX_ENV_VAR "IPHONE_SIMULATOR_ROOT" # endif @@ -1329,7 +1404,7 @@ static BOOL U_CALLCONV getIcuDataDirectoryUnderWindowsDirectory(char* directoryB UErrorCode status = U_ZERO_ERROR; int32_t windowsPathUtf8Len = 0; u_strToUTF8(windowsPathUtf8, static_cast(UPRV_LENGTHOF(windowsPathUtf8)), - &windowsPathUtf8Len, reinterpret_cast(windowsPath), -1, &status); + &windowsPathUtf8Len, reinterpret_cast(windowsPath), -1, &status); if (U_SUCCESS(status) && (status != U_STRING_NOT_TERMINATED_WARNING) && (windowsPathUtf8Len < (UPRV_LENGTHOF(windowsPathUtf8) - 1))) { @@ -1342,12 +1417,12 @@ static BOOL U_CALLCONV getIcuDataDirectoryUnderWindowsDirectory(char* directoryB if ((windowsPathUtf8Len + UPRV_LENGTHOF(ICU_DATA_DIR_WINDOWS)) < bufferLength) { uprv_strcpy(directoryBuffer, windowsPathUtf8); uprv_strcat(directoryBuffer, ICU_DATA_DIR_WINDOWS); - return TRUE; + return true; } } } - return FALSE; + return false; } #endif @@ -1359,7 +1434,7 @@ static void U_CALLCONV dataDirectoryInitFn() { return; } - const char *path = NULL; + const char *path = nullptr; #if defined(ICU_DATA_DIR_PREFIX_ENV_VAR) char datadir_path_buffer[PATH_MAX]; #endif @@ -1392,7 +1467,7 @@ static void U_CALLCONV dataDirectoryInitFn() { * set their own path. */ #if defined(ICU_DATA_DIR) || defined(U_ICU_DATA_DEFAULT_DIR) - if(path==NULL || *path==0) { + if(path==nullptr || *path==0) { # if defined(ICU_DATA_DIR_PREFIX_ENV_VAR) const char *prefix = getenv(ICU_DATA_DIR_PREFIX_ENV_VAR); # endif @@ -1402,8 +1477,8 @@ static void U_CALLCONV dataDirectoryInitFn() { path=U_ICU_DATA_DEFAULT_DIR; # endif # if defined(ICU_DATA_DIR_PREFIX_ENV_VAR) - if (prefix != NULL) { - snprintf(datadir_path_buffer, PATH_MAX, "%s%s", prefix, path); + if (prefix != nullptr) { + snprintf(datadir_path_buffer, sizeof(datadir_path_buffer), "%s%s", prefix, path); path=datadir_path_buffer; } # endif @@ -1417,7 +1492,7 @@ static void U_CALLCONV dataDirectoryInitFn() { } #endif - if(path==NULL) { + if(path==nullptr) { /* It looks really bad, set it to something. */ path = ""; } @@ -1427,7 +1502,7 @@ static void U_CALLCONV dataDirectoryInitFn() { } U_CAPI const char * U_EXPORT2 -u_getDataDirectory(void) { +u_getDataDirectory() { umtx_initOnce(gDataDirInitOnce, &dataDirectoryInitFn); return gDataDirectory; } @@ -1440,26 +1515,31 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) { gTimeZoneFilesDirectory->append(path, status); #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) char *p = gTimeZoneFilesDirectory->data(); - while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) { + while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != nullptr) { *p = U_FILE_SEP_CHAR; } #endif } -#define PUTIL_TO_STRING(x) PUTIL_TO_STRING_2(x) -#define PUTIL_TO_STRING_2(x) #x +#define TO_STRING(x) TO_STRING_2(x) +#define TO_STRING_2(x) #x static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) { - U_ASSERT(gTimeZoneFilesDirectory == NULL); + U_ASSERT(gTimeZoneFilesDirectory == nullptr); ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup); gTimeZoneFilesDirectory = new CharString(); - if (gTimeZoneFilesDirectory == NULL) { + if (gTimeZoneFilesDirectory == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } const char *dir = ""; +#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR) + char timezonefilesdir_path_buffer[PATH_MAX]; + const char *prefix = getenv(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR); +#endif + #if U_PLATFORM_HAS_WINUWP_API == 1 // The UWP version does not support the environment variable setting. @@ -1476,16 +1556,23 @@ static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) { #endif // U_PLATFORM_HAS_WINUWP_API #if defined(U_TIMEZONE_FILES_DIR) - if (dir == NULL) { + if (dir == nullptr) { // Build time configuration setting. - dir = PUTIL_TO_STRING(U_TIMEZONE_FILES_DIR); + dir = TO_STRING(U_TIMEZONE_FILES_DIR); } #endif - if (dir == NULL) { + if (dir == nullptr) { dir = ""; } +#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR) + if (prefix != nullptr) { + snprintf(timezonefilesdir_path_buffer, sizeof(timezonefilesdir_path_buffer), "%s%s", prefix, dir); + dir = timezonefilesdir_path_buffer; + } +#endif + setTimeZoneFilesDir(dir, status); } @@ -1514,7 +1601,7 @@ u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status) { */ static const char *uprv_getPOSIXIDForCategory(int category) { - const char* posixID = NULL; + const char* posixID = nullptr; if (category == LC_MESSAGES || category == LC_CTYPE) { /* * On Solaris two different calls to setlocale can result in @@ -1524,7 +1611,7 @@ static const char *uprv_getPOSIXIDForCategory(int category) * * LC_ALL can't be used because it's platform dependent. The LANG * environment variable seems to affect LC_CTYPE variable by default. - * Here is what setlocale(LC_ALL, NULL) can return. + * Here is what setlocale(LC_ALL, nullptr) can return. * HPUX can return 'C C C C C C C' * Solaris can return /en_US/C/C/C/C/C on the second try. * Linux can return LC_CTYPE=C;LC_NUMERIC=C;... @@ -1532,9 +1619,9 @@ static const char *uprv_getPOSIXIDForCategory(int category) * The default codepage detection also needs to use LC_CTYPE. * * Do not call setlocale(LC_*, "")! Using an empty string instead - * of NULL, will modify the libc behavior. + * of nullptr, will modify the libc behavior. */ - posixID = setlocale(category, NULL); + posixID = setlocale(category, nullptr); if ((posixID == 0) || (uprv_strcmp("C", posixID) == 0) || (uprv_strcmp("POSIX", posixID) == 0)) @@ -1575,9 +1662,9 @@ static const char *uprv_getPOSIXIDForCategory(int category) /* Return just the POSIX id for the default locale, whatever happens to be in * it. It gets the value from LC_MESSAGES and indirectly from LC_ALL and LANG. */ -static const char *uprv_getPOSIXIDForDefaultLocale(void) +static const char *uprv_getPOSIXIDForDefaultLocale() { - static const char* posixID = NULL; + static const char* posixID = nullptr; if (posixID == 0) { posixID = uprv_getPOSIXIDForCategory(LC_MESSAGES); } @@ -1588,9 +1675,9 @@ static const char *uprv_getPOSIXIDForDefaultLocale(void) /* Return just the POSIX id for the default codepage, whatever happens to be in * it. It gets the value from LC_CTYPE and indirectly from LC_ALL and LANG. */ -static const char *uprv_getPOSIXIDForDefaultCodepage(void) +static const char *uprv_getPOSIXIDForDefaultCodepage() { - static const char* posixID = NULL; + static const char* posixID = nullptr; if (posixID == 0) { posixID = uprv_getPOSIXIDForCategory(LC_CTYPE); } @@ -1789,16 +1876,16 @@ The leftmost codepage (.xxx) wins. const char *localeID = getenv("LC_ALL"); char *p; - if (localeID == NULL) + if (localeID == nullptr) localeID = getenv("LANG"); - if (localeID == NULL) - localeID = setlocale(LC_ALL, NULL); + if (localeID == nullptr) + localeID = setlocale(LC_ALL, nullptr); /* Make sure we have something... */ - if (localeID == NULL) + if (localeID == nullptr) return "en_US_POSIX"; /* Extract the locale name from the path. */ - if((p = uprv_strrchr(localeID, '/')) != NULL) + if((p = uprv_strrchr(localeID, '/')) != nullptr) { /* Increment p to start of locale name. */ p++; @@ -1809,7 +1896,7 @@ The leftmost codepage (.xxx) wins. uprv_strcpy(correctedLocale, localeID); /* Strip off the '.locale' extension. */ - if((p = uprv_strchr(correctedLocale, '.')) != NULL) { + if((p = uprv_strchr(correctedLocale, '.')) != nullptr) { *p = 0; } @@ -1889,12 +1976,12 @@ names to the ICU alias table in the data directory. */ static const char* remapPlatformDependentCodepage(const char *locale, const char *name) { - if (locale != NULL && *locale == 0) { + if (locale != nullptr && *locale == 0) { /* Make sure that an empty locale is handled the same way. */ - locale = NULL; + locale = nullptr; } - if (name == NULL) { - return NULL; + if (name == nullptr) { + return nullptr; } #if U_PLATFORM == U_PF_AIX if (uprv_strcmp(name, "IBM-943") == 0) { @@ -1906,7 +1993,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { name = "IBM-5348"; } #elif U_PLATFORM == U_PF_SOLARIS - if (locale != NULL && uprv_strcmp(name, "EUC") == 0) { + if (locale != nullptr && uprv_strcmp(name, "EUC") == 0) { /* Solaris underspecifies the "EUC" name. */ if (uprv_strcmp(locale, "zh_CN") == 0) { name = "EUC-CN"; @@ -1933,7 +2020,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { name = "ISO-8859-1"; } #elif U_PLATFORM_IS_DARWIN_BASED - if (locale == NULL && *name == 0) { + if (locale == nullptr && *name == 0) { /* No locale was specified, and an empty name was passed in. This usually indicates that nl_langinfo didn't return valid information. @@ -1945,7 +2032,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { /* Remap CP949 to a similar codepage to avoid issues with backslash and won symbol. */ name = "EUC-KR"; } - else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 && uprv_strcmp(name, "US-ASCII") == 0) { + else if (locale != nullptr && uprv_strcmp(locale, "en_US_POSIX") != 0 && uprv_strcmp(name, "US-ASCII") == 0) { /* * For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII. */ @@ -1957,7 +2044,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { name = "EUC-KR"; } #elif U_PLATFORM == U_PF_HPUX - if (locale != NULL && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) { + if (locale != nullptr && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) { /* HP decided to extend big5 as hkbig5 even though it's not compatible :-( */ /* zh_TW.big5 is not the same charset as zh_HK.big5! */ name = "hkbig5"; @@ -1971,7 +2058,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { name = "eucjis"; } #elif U_PLATFORM == U_PF_LINUX - if (locale != NULL && uprv_strcmp(name, "euc") == 0) { + if (locale != nullptr && uprv_strcmp(name, "euc") == 0) { /* Linux underspecifies the "EUC" name. */ if (uprv_strcmp(locale, "korean") == 0) { name = "EUC-KR"; @@ -1989,7 +2076,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { */ name = "eucjis"; } - else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 && + else if (locale != nullptr && uprv_strcmp(locale, "en_US_POSIX") != 0 && (uprv_strcmp(name, "ANSI_X3.4-1968") == 0 || uprv_strcmp(name, "US-ASCII") == 0)) { /* * For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII. @@ -1998,13 +2085,13 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { } /* * Linux returns ANSI_X3.4-1968 for C/POSIX, but the call site takes care of - * it by falling back to 'US-ASCII' when NULL is returned from this + * it by falling back to 'US-ASCII' when nullptr is returned from this * function. So, we don't have to worry about it here. */ #endif - /* return NULL when "" is passed in */ + /* return nullptr when "" is passed in */ if (*name == 0) { - name = NULL; + name = nullptr; } return name; } @@ -2013,16 +2100,16 @@ static const char* getCodepageFromPOSIXID(const char *localeName, char * buffer, int32_t buffCapacity) { char localeBuf[100]; - const char *name = NULL; - char *variant = NULL; + const char *name = nullptr; + char *variant = nullptr; - if (localeName != NULL && (name = (uprv_strchr(localeName, '.'))) != NULL) { + if (localeName != nullptr && (name = (uprv_strchr(localeName, '.'))) != nullptr) { size_t localeCapacity = uprv_min(sizeof(localeBuf), (name-localeName)+1); uprv_strncpy(localeBuf, localeName, localeCapacity); - localeBuf[localeCapacity-1] = 0; /* ensure NULL termination */ + localeBuf[localeCapacity-1] = 0; /* ensure NUL termination */ name = uprv_strncpy(buffer, name+1, buffCapacity); - buffer[buffCapacity-1] = 0; /* ensure NULL termination */ - if ((variant = const_cast(uprv_strchr(name, '@'))) != NULL) { + buffer[buffCapacity-1] = 0; /* ensure NUL termination */ + if ((variant = const_cast(uprv_strchr(name, '@'))) != nullptr) { *variant = 0; } name = remapPlatformDependentCodepage(localeBuf, name); @@ -2052,7 +2139,7 @@ int_getDefaultCodepage() } /* else use the default */ } - sprintf(codepage,"ibm-%d", ccsid); + snprintf(codepage, sizeof(codepage), "ibm-%d", ccsid); return codepage; #elif U_PLATFORM == U_PF_OS390 @@ -2060,7 +2147,7 @@ int_getDefaultCodepage() strncpy(codepage, nl_langinfo(CODESET),63-strlen(UCNV_SWAP_LFNL_OPTION_STRING)); strcat(codepage,UCNV_SWAP_LFNL_OPTION_STRING); - codepage[63] = 0; /* NULL terminate */ + codepage[63] = 0; /* NUL terminate */ return codepage; @@ -2089,7 +2176,7 @@ int_getDefaultCodepage() // are between 3 and 19999 if (codepageNumber > 0 && codepageNumber < 20000) { - sprintf(codepage, "windows-%ld", codepageNumber); + snprintf(codepage, sizeof(codepage), "windows-%ld", codepageNumber); return codepage; } // If the codepage number call failed then return UTF-8 @@ -2097,8 +2184,8 @@ int_getDefaultCodepage() #elif U_POSIX_LOCALE static char codesetName[100]; - const char *localeName = NULL; - const char *name = NULL; + const char *localeName = nullptr; + const char *name = nullptr; localeName = uprv_getPOSIXIDForDefaultCodepage(); uprv_memset(codesetName, 0, sizeof(codesetName)); @@ -2121,10 +2208,10 @@ int_getDefaultCodepage() } else #endif { - codeset = remapPlatformDependentCodepage(NULL, codeset); + codeset = remapPlatformDependentCodepage(nullptr, codeset); } - if (codeset != NULL) { + if (codeset != nullptr) { uprv_strncpy(codesetName, codeset, sizeof(codesetName)); codesetName[sizeof(codesetName)-1] = 0; return codesetName; @@ -2157,12 +2244,12 @@ int_getDefaultCodepage() U_CAPI const char* U_EXPORT2 uprv_getDefaultCodepage() { - static char const *name = NULL; - umtx_lock(NULL); - if (name == NULL) { + static char const *name = nullptr; + umtx_lock(nullptr); + if (name == nullptr) { name = int_getDefaultCodepage(); } - umtx_unlock(NULL); + umtx_unlock(nullptr); return name; } #endif /* !U_CHARSET_IS_UTF8 */ @@ -2177,11 +2264,11 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString) { char *end; uint16_t part=0; - if(versionArray==NULL) { + if(versionArray==nullptr) { return; } - if(versionString!=NULL) { + if(versionString!=nullptr) { for(;;) { versionArray[part]=(uint8_t)uprv_strtoul(versionString, &end, 10); if(end==versionString || ++part==U_MAX_VERSION_LENGTH || *end!=U_VERSION_DELIMITER) { @@ -2197,8 +2284,8 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString) { } U_CAPI void U_EXPORT2 -u_versionFromUString(UVersionInfo versionArray, const UChar *versionString) { - if(versionArray!=NULL && versionString!=NULL) { +u_versionFromUString(UVersionInfo versionArray, const char16_t *versionString) { + if(versionArray!=nullptr && versionString!=nullptr) { char versionChars[U_MAX_VERSION_STRING_LENGTH+1]; int32_t len = u_strlen(versionString); if(len>U_MAX_VERSION_STRING_LENGTH) { @@ -2215,11 +2302,11 @@ u_versionToString(const UVersionInfo versionArray, char *versionString) { uint16_t count, part; uint8_t field; - if(versionString==NULL) { + if(versionString==nullptr) { return; } - if(versionArray==NULL) { + if(versionArray==nullptr) { versionString[0]=0; return; } @@ -2269,10 +2356,146 @@ u_versionToString(const UVersionInfo versionArray, char *versionString) { U_CAPI void U_EXPORT2 u_getVersion(UVersionInfo versionArray) { - // (void)copyright; // Suppress unused variable warning from clang. + (void)copyright; // Suppress unused variable warning from clang. u_versionFromString(versionArray, U_ICU_VERSION); } +/** + * icucfg.h dependent code + */ + +#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 +#endif /* HAVE_DLFCN_H */ + +U_CAPI void * U_EXPORT2 +uprv_dl_open(const char *libName, UErrorCode *status) { + void *ret = nullptr; + if(U_FAILURE(*status)) return ret; + ret = dlopen(libName, RTLD_NOW|RTLD_GLOBAL); + if(ret==nullptr) { +#ifdef U_TRACE_DYLOAD + printf("dlerror on dlopen(%s): %s\n", libName, dlerror()); +#endif + *status = U_MISSING_RESOURCE_ERROR; + } + return ret; +} + +U_CAPI void U_EXPORT2 +uprv_dl_close(void *lib, UErrorCode *status) { + if(U_FAILURE(*status)) return; + dlclose(lib); +} + +U_CAPI UVoidFunction* U_EXPORT2 +uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { + union { + UVoidFunction *fp; + void *vp; + } uret; + uret.fp = nullptr; + if(U_FAILURE(*status)) return uret.fp; + uret.vp = dlsym(lib, sym); + if(uret.vp == nullptr) { +#ifdef U_TRACE_DYLOAD + printf("dlerror on dlsym(%p,%s): %s\n", lib,sym, dlerror()); +#endif + *status = U_MISSING_RESOURCE_ERROR; + } + return uret.fp; +} + +#elif U_ENABLE_DYLOAD && U_PLATFORM_USES_ONLY_WIN32_API && !U_PLATFORM_HAS_WINUWP_API + +/* Windows API implementation. */ +// Note: UWP does not expose/allow these APIs, so the UWP version gets the null implementation. */ + +U_CAPI void * U_EXPORT2 +uprv_dl_open(const char *libName, UErrorCode *status) { + HMODULE lib = nullptr; + + if(U_FAILURE(*status)) return nullptr; + + lib = LoadLibraryA(libName); + + if(lib==nullptr) { + *status = U_MISSING_RESOURCE_ERROR; + } + + return (void*)lib; +} + +U_CAPI void U_EXPORT2 +uprv_dl_close(void *lib, UErrorCode *status) { + HMODULE handle = (HMODULE)lib; + if(U_FAILURE(*status)) return; + + FreeLibrary(handle); + + return; +} + +U_CAPI UVoidFunction* U_EXPORT2 +uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { + HMODULE handle = (HMODULE)lib; + UVoidFunction* addr = nullptr; + + if(U_FAILURE(*status) || lib==nullptr) return nullptr; + + addr = (UVoidFunction*)GetProcAddress(handle, sym); + + if(addr==nullptr) { + DWORD lastError = GetLastError(); + if(lastError == ERROR_PROC_NOT_FOUND) { + *status = U_MISSING_RESOURCE_ERROR; + } else { + *status = U_UNSUPPORTED_ERROR; /* other unknown error. */ + } + } + + return addr; +} + +#else + +/* No dynamic loading, null (nonexistent) implementation. */ + +U_CAPI void * U_EXPORT2 +uprv_dl_open(const char *libName, UErrorCode *status) { + (void)libName; + if(U_FAILURE(*status)) return nullptr; + *status = U_UNSUPPORTED_ERROR; + return nullptr; +} + +U_CAPI void U_EXPORT2 +uprv_dl_close(void *lib, UErrorCode *status) { + (void)lib; + if(U_FAILURE(*status)) return; + *status = U_UNSUPPORTED_ERROR; + return; +} + +U_CAPI UVoidFunction* U_EXPORT2 +uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { + (void)lib; + (void)sym; + if(U_SUCCESS(*status)) { + *status = U_UNSUPPORTED_ERROR; + } + return (UVoidFunction*)nullptr; +} + +#endif + /* * Hey, Emacs, please set the following: * diff --git a/src/duckdb/extension/icu/third_party/icu/common/putilimp.h b/src/duckdb/extension/icu/third_party/icu/common/putilimp.h index 29e55b35c..5b95a6841 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/putilimp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/putilimp.h @@ -210,93 +210,93 @@ typedef size_t uintptr_t; * Floating point utility to determine if a double is Not a Number (NaN). * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isNaN(double d); +U_CAPI UBool U_EXPORT2 uprv_isNaN(double d); /** * Floating point utility to determine if a double has an infinite value. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isInfinite(double d); +U_CAPI UBool U_EXPORT2 uprv_isInfinite(double d); /** * Floating point utility to determine if a double has a positive infinite value. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isPositiveInfinity(double d); +U_CAPI UBool U_EXPORT2 uprv_isPositiveInfinity(double d); /** * Floating point utility to determine if a double has a negative infinite value. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_isNegativeInfinity(double d); +U_CAPI UBool U_EXPORT2 uprv_isNegativeInfinity(double d); /** * Floating point utility that returns a Not a Number (NaN) value. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_getNaN(void); +U_CAPI double U_EXPORT2 uprv_getNaN(void); /** * Floating point utility that returns an infinite value. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_getInfinity(void); +U_CAPI double U_EXPORT2 uprv_getInfinity(void); /** * Floating point utility to truncate a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_trunc(double d); +U_CAPI double U_EXPORT2 uprv_trunc(double d); /** * Floating point utility to calculate the floor of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_floor(double d); +U_CAPI double U_EXPORT2 uprv_floor(double d); /** * Floating point utility to calculate the ceiling of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_ceil(double d); +U_CAPI double U_EXPORT2 uprv_ceil(double d); /** * Floating point utility to calculate the absolute value of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fabs(double d); +U_CAPI double U_EXPORT2 uprv_fabs(double d); /** * Floating point utility to calculate the fractional and integer parts of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_modf(double d, double* pinteger); +U_CAPI double U_EXPORT2 uprv_modf(double d, double* pinteger); /** * Floating point utility to calculate the remainder of a double divided by another double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fmod(double d, double y); +U_CAPI double U_EXPORT2 uprv_fmod(double d, double y); /** * Floating point utility to calculate d to the power of exponent (d^exponent). * @internal */ -U_INTERNAL double U_EXPORT2 uprv_pow(double d, double exponent); +U_CAPI double U_EXPORT2 uprv_pow(double d, double exponent); /** * Floating point utility to calculate 10 to the power of exponent (10^exponent). * @internal */ -U_INTERNAL double U_EXPORT2 uprv_pow10(int32_t exponent); +U_CAPI double U_EXPORT2 uprv_pow10(int32_t exponent); /** * Floating point utility to calculate the maximum value of two doubles. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fmax(double d, double y); +U_CAPI double U_EXPORT2 uprv_fmax(double d, double y); /** * Floating point utility to calculate the minimum value of two doubles. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_fmin(double d, double y); +U_CAPI double U_EXPORT2 uprv_fmin(double d, double y); /** * Private utility to calculate the maximum value of two integers. * @internal */ -U_INTERNAL int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y); +U_CAPI int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y); /** * Private utility to calculate the minimum value of two integers. * @internal */ -U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y); +U_CAPI int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y); #if U_IS_BIG_ENDIAN # define uprv_isNegative(number) (*((signed char *)&(number))<0) @@ -309,13 +309,13 @@ U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y); * type of arbitrary bit length. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_maxMantissa(void); +U_CAPI double U_EXPORT2 uprv_maxMantissa(void); /** * Floating point utility to calculate the logarithm of a double. * @internal */ -U_INTERNAL double U_EXPORT2 uprv_log(double d); +U_CAPI double U_EXPORT2 uprv_log(double d); /** * Does common notion of rounding e.g. uprv_floor(x + 0.5); @@ -323,7 +323,7 @@ U_INTERNAL double U_EXPORT2 uprv_log(double d); * @return the rounded double * @internal */ -U_INTERNAL double U_EXPORT2 uprv_round(double x); +U_CAPI double U_EXPORT2 uprv_round(double x); /** * Adds the signed integers a and b, storing the result in res. @@ -336,7 +336,7 @@ U_INTERNAL double U_EXPORT2 uprv_round(double x); * @return true if overflow occurred; false if no overflow occurred. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res); +U_CAPI UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res); /** * Multiplies the signed integers a and b, storing the result in res. @@ -349,7 +349,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* re * @return true if overflow occurred; false if no overflow occurred. * @internal */ -U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res); +U_CAPI UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res); #if 0 /** @@ -359,7 +359,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re * @return the number of digits after the decimal point in a double number x. * @internal */ -/*U_INTERNAL int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/ +/*U_CAPI int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/ #endif #if !U_CHARSET_IS_UTF8 @@ -371,7 +371,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re * @return the default codepage for this platform * @internal */ -U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void); +U_CAPI const char* U_EXPORT2 uprv_getDefaultCodepage(void); #endif /** @@ -383,7 +383,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void); * @return the default locale ID string * @internal */ -U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void); +U_CAPI const char* U_EXPORT2 uprv_getDefaultLocaleID(void); /** * Time zone utilities @@ -417,7 +417,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void); * Date/Time application. * @internal */ -U_INTERNAL void U_EXPORT2 uprv_tzset(void); +U_CAPI void U_EXPORT2 uprv_tzset(void); /** * Difference in seconds between coordinated universal @@ -425,7 +425,7 @@ U_INTERNAL void U_EXPORT2 uprv_tzset(void); * @return the difference in seconds between coordinated universal time and local time. * @internal */ -U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void); +U_CAPI int32_t U_EXPORT2 uprv_timezone(void); /** * tzname(0) Three-letter time-zone name derived from TZ environment @@ -435,13 +435,13 @@ U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void); * tzname(1) is an empty string. * @internal */ -U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n); +U_CAPI const char* U_EXPORT2 uprv_tzname(int n); /** * Reset the global tzname cache. * @internal */ -U_INTERNAL void uprv_tzname_clear_cache(); +U_CAPI void uprv_tzname_clear_cache(void); /** * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. @@ -449,7 +449,7 @@ U_INTERNAL void uprv_tzname_clear_cache(); * @return the UTC time measured in milliseconds * @internal */ -U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void); +U_CAPI UDate U_EXPORT2 uprv_getUTCtime(void); /** * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970. @@ -458,15 +458,15 @@ U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void); * @return the UTC time measured in milliseconds * @internal */ -U_INTERNAL UDate U_EXPORT2 uprv_getRawUTCtime(void); +U_CAPI UDate U_EXPORT2 uprv_getRawUTCtime(void); /** * Determine whether a pathname is absolute or not, as defined by the platform. * @param path Pathname to test - * @return TRUE if the path is absolute + * @return true if the path is absolute * @internal (ICU 3.0) */ -U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path); +U_CAPI UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path); /** * Use U_MAX_PTR instead of this function. @@ -474,7 +474,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path); * @return the largest possible pointer greater than the base * @internal (ICU 3.8) */ -U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base); +U_CAPI void * U_EXPORT2 uprv_maximumPtr(void *base); /** * Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer. @@ -527,7 +527,7 @@ U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base); * 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 is a valid pointer according to the machine architecture (AS/400, 64-bit, etc.) * - (dest + capacity) >= dest * - The size (in bytes) of T[capacity] does not exceed 0x7fffffff * @@ -567,6 +567,34 @@ inline int32_t pinCapacity(T *dest, int32_t capacity) { typedef void (UVoidFunction)(void); +#if U_ENABLE_DYLOAD +/** + * Load a library + * @internal (ICU 4.4) + */ +U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status); + +/** + * Close a library + * @internal (ICU 4.4) + */ +U_CAPI void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status); + +/** + * Extract a symbol from a library (function) + * @internal (ICU 4.8) + */ +U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status); + +/** + * Extract a symbol from a library (function) + * Not implemented, no clients. + * @internal + */ +/* U_CAPI void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */ + +#endif + /** * Define malloc and related functions * @internal diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbi.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbi.cpp deleted file mode 100644 index fb1df2ea4..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbi.cpp +++ /dev/null @@ -1,1266 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -*************************************************************************** -* Copyright (C) 1999-2016 International Business Machines Corporation -* and others. All rights reserved. -*************************************************************************** -*/ -// -// file: rbbi.cpp Contains the implementation of the rule based break iterator -// runtime engine and the API implementation for -// class RuleBasedBreakIterator -// - -#include "utypeinfo.h" // for 'typeid' to work - -#include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include - -// #include "unicode/rbbi.h" -// #include "unicode/schriter.h" -// #include "unicode/uchriter.h" -// #include "unicode/uclean.h" -// #include "unicode/udata.h" - -// #include "brkeng.h" -// #include "ucln_cmn.h" -// #include "cmemory.h" -// #include "cstring.h" -// #include "localsvc.h" -// #include "rbbidata.h" -// #include "rbbi_cache.h" -// #include "rbbirb.h" -// #include "uassert.h" -// #include "umutex.h" -// #include "uvectr32.h" - -// #ifdef RBBI_DEBUG -// static UBool gTrace = FALSE; -// #endif - -// U_NAMESPACE_BEGIN - -// // The state number of the starting state -// constexpr int32_t START_STATE = 1; - -// // The state-transition value indicating "stop" -// constexpr int32_t STOP_STATE = 0; - - -// UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedBreakIterator) - - -// //======================================================================= -// // constructors -// //======================================================================= - -// /** -// * Constructs a RuleBasedBreakIterator that uses the already-created -// * tables object that is passed in as a parameter. -// */ -// RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status) -// : fSCharIter(UnicodeString()) -// { -// init(status); -// fData = new RBBIDataWrapper(data, status); // status checked in constructor -// if (U_FAILURE(status)) {return;} -// if(fData == 0) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// } - -// // -// // Construct from precompiled binary rules (tables). This constructor is public API, -// // taking the rules as a (const uint8_t *) to match the type produced by getBinaryRules(). -// // -// RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules, -// uint32_t ruleLength, -// UErrorCode &status) -// : fSCharIter(UnicodeString()) -// { -// init(status); -// if (U_FAILURE(status)) { -// return; -// } -// if (compiledRules == NULL || ruleLength < sizeof(RBBIDataHeader)) { -// status = U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } -// const RBBIDataHeader *data = (const RBBIDataHeader *)compiledRules; -// if (data->fLength > ruleLength) { -// status = U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } -// fData = new RBBIDataWrapper(data, RBBIDataWrapper::kDontAdopt, status); -// if (U_FAILURE(status)) {return;} -// if(fData == 0) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// } - - -// //------------------------------------------------------------------------------- -// // -// // Constructor from a UDataMemory handle to precompiled break rules -// // stored in an ICU data file. -// // -// //------------------------------------------------------------------------------- -// RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &status) -// : fSCharIter(UnicodeString()) -// { -// init(status); -// fData = new RBBIDataWrapper(udm, status); // status checked in constructor -// if (U_FAILURE(status)) {return;} -// if(fData == 0) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// } - - - -// //------------------------------------------------------------------------------- -// // -// // Constructor from a set of rules supplied as a string. -// // -// //------------------------------------------------------------------------------- -// RuleBasedBreakIterator::RuleBasedBreakIterator( const UnicodeString &rules, -// UParseError &parseError, -// UErrorCode &status) -// : fSCharIter(UnicodeString()) -// { -// init(status); -// if (U_FAILURE(status)) {return;} -// RuleBasedBreakIterator *bi = (RuleBasedBreakIterator *) -// RBBIRuleBuilder::createRuleBasedBreakIterator(rules, &parseError, status); -// // Note: This is a bit awkward. The RBBI ruleBuilder has a factory method that -// // creates and returns a complete RBBI. From here, in a constructor, we -// // can't just return the object created by the builder factory, hence -// // the assignment of the factory created object to "this". -// if (U_SUCCESS(status)) { -// *this = *bi; -// delete bi; -// } -// } - - -// //------------------------------------------------------------------------------- -// // -// // Default Constructor. Create an empty shell that can be set up later. -// // Used when creating a RuleBasedBreakIterator from a set -// // of rules. -// //------------------------------------------------------------------------------- -// RuleBasedBreakIterator::RuleBasedBreakIterator() -// : fSCharIter(UnicodeString()) -// { -// UErrorCode status = U_ZERO_ERROR; -// init(status); -// } - - -// //------------------------------------------------------------------------------- -// // -// // Copy constructor. Will produce a break iterator with the same behavior, -// // and which iterates over the same text, as the one passed in. -// // -// //------------------------------------------------------------------------------- -// RuleBasedBreakIterator::RuleBasedBreakIterator(const RuleBasedBreakIterator& other) -// : BreakIterator(other), -// fSCharIter(UnicodeString()) -// { -// UErrorCode status = U_ZERO_ERROR; -// this->init(status); -// *this = other; -// } - - -// /** -// * Destructor -// */ -// RuleBasedBreakIterator::~RuleBasedBreakIterator() { -// if (fCharIter != &fSCharIter) { -// // fCharIter was adopted from the outside. -// delete fCharIter; -// } -// fCharIter = NULL; - -// utext_close(&fText); - -// if (fData != NULL) { -// fData->removeReference(); -// fData = NULL; -// } -// delete fBreakCache; -// fBreakCache = NULL; - -// delete fDictionaryCache; -// fDictionaryCache = NULL; - -// delete fLanguageBreakEngines; -// fLanguageBreakEngines = NULL; - -// delete fUnhandledBreakEngine; -// fUnhandledBreakEngine = NULL; -// } - -// /** -// * Assignment operator. Sets this iterator to have the same behavior, -// * and iterate over the same text, as the one passed in. -// */ -// RuleBasedBreakIterator& -// RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) { -// if (this == &that) { -// return *this; -// } -// BreakIterator::operator=(that); - -// if (fLanguageBreakEngines != NULL) { -// delete fLanguageBreakEngines; -// fLanguageBreakEngines = NULL; // Just rebuild for now -// } -// // TODO: clone fLanguageBreakEngines from "that" -// UErrorCode status = U_ZERO_ERROR; -// utext_clone(&fText, &that.fText, FALSE, TRUE, &status); - -// if (fCharIter != &fSCharIter) { -// delete fCharIter; -// } -// fCharIter = &fSCharIter; - -// if (that.fCharIter != NULL && that.fCharIter != &that.fSCharIter) { -// // This is a little bit tricky - it will intially appear that -// // this->fCharIter is adopted, even if that->fCharIter was -// // not adopted. That's ok. -// fCharIter = that.fCharIter->clone(); -// } -// fSCharIter = that.fSCharIter; -// if (fCharIter == NULL) { -// fCharIter = &fSCharIter; -// } - -// if (fData != NULL) { -// fData->removeReference(); -// fData = NULL; -// } -// if (that.fData != NULL) { -// fData = that.fData->addReference(); -// } - -// fPosition = that.fPosition; -// fRuleStatusIndex = that.fRuleStatusIndex; -// fDone = that.fDone; - -// // TODO: both the dictionary and the main cache need to be copied. -// // Current position could be within a dictionary range. Trying to continue -// // the iteration without the caches present would go to the rules, with -// // the assumption that the current position is on a rule boundary. -// fBreakCache->reset(fPosition, fRuleStatusIndex); -// fDictionaryCache->reset(); - -// return *this; -// } - - - -// //----------------------------------------------------------------------------- -// // -// // init() Shared initialization routine. Used by all the constructors. -// // Initializes all fields, leaving the object in a consistent state. -// // -// //----------------------------------------------------------------------------- -// void RuleBasedBreakIterator::init(UErrorCode &status) { -// fCharIter = NULL; -// fData = NULL; -// fPosition = 0; -// fRuleStatusIndex = 0; -// fDone = false; -// fDictionaryCharCount = 0; -// fLanguageBreakEngines = NULL; -// fUnhandledBreakEngine = NULL; -// fBreakCache = NULL; -// fDictionaryCache = NULL; - -// // Note: IBM xlC is unable to assign or initialize member fText from UTEXT_INITIALIZER. -// // fText = UTEXT_INITIALIZER; -// static const UText initializedUText = UTEXT_INITIALIZER; -// uprv_memcpy(&fText, &initializedUText, sizeof(UText)); - -// if (U_FAILURE(status)) { -// return; -// } - -// utext_openUChars(&fText, NULL, 0, &status); -// fDictionaryCache = new DictionaryCache(this, status); -// fBreakCache = new BreakCache(this, status); -// if (U_SUCCESS(status) && (fDictionaryCache == NULL || fBreakCache == NULL)) { -// status = U_MEMORY_ALLOCATION_ERROR; -// } - -// #ifdef RBBI_DEBUG -// static UBool debugInitDone = FALSE; -// if (debugInitDone == FALSE) { -// char *debugEnv = getenv("U_RBBIDEBUG"); -// if (debugEnv && uprv_strstr(debugEnv, "trace")) { -// gTrace = TRUE; -// } -// debugInitDone = TRUE; -// } -// #endif -// } - - - -// //----------------------------------------------------------------------------- -// // -// // clone - Returns a newly-constructed RuleBasedBreakIterator with the same -// // behavior, and iterating over the same text, as this one. -// // Virtual function: does the right thing with subclasses. -// // -// //----------------------------------------------------------------------------- -// RuleBasedBreakIterator* -// RuleBasedBreakIterator::clone() const { -// return new RuleBasedBreakIterator(*this); -// } - -// /** -// * Equality operator. Returns TRUE if both BreakIterators are of the -// * same class, have the same behavior, and iterate over the same text. -// */ -// UBool -// RuleBasedBreakIterator::operator==(const BreakIterator& that) const { -// if (typeid(*this) != typeid(that)) { -// return FALSE; -// } -// if (this == &that) { -// return TRUE; -// } - -// // The base class BreakIterator carries no state that participates in equality, -// // and does not implement an equality function that would otherwise be -// // checked at this point. - -// const RuleBasedBreakIterator& that2 = (const RuleBasedBreakIterator&) that; - -// if (!utext_equals(&fText, &that2.fText)) { -// // The two break iterators are operating on different text, -// // or have a different iteration position. -// // Note that fText's position is always the same as the break iterator's position. -// return FALSE; -// } - -// if (!(fPosition == that2.fPosition && -// fRuleStatusIndex == that2.fRuleStatusIndex && -// fDone == that2.fDone)) { -// return FALSE; -// } - -// if (that2.fData == fData || -// (fData != NULL && that2.fData != NULL && *that2.fData == *fData)) { -// // The two break iterators are using the same rules. -// return TRUE; -// } -// return FALSE; -// } - -// /** -// * Compute a hash code for this BreakIterator -// * @return A hash code -// */ -// int32_t -// RuleBasedBreakIterator::hashCode(void) const { -// int32_t hash = 0; -// if (fData != NULL) { -// hash = fData->hashCode(); -// } -// return hash; -// } - - -// void RuleBasedBreakIterator::setText(UText *ut, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return; -// } -// fBreakCache->reset(); -// fDictionaryCache->reset(); -// utext_clone(&fText, ut, FALSE, TRUE, &status); - -// // Set up a dummy CharacterIterator to be returned if anyone -// // calls getText(). With input from UText, there is no reasonable -// // way to return a characterIterator over the actual input text. -// // Return one over an empty string instead - this is the closest -// // we can come to signaling a failure. -// // (GetText() is obsolete, this failure is sort of OK) -// fSCharIter.setText(UnicodeString()); - -// if (fCharIter != &fSCharIter) { -// // existing fCharIter was adopted from the outside. Delete it now. -// delete fCharIter; -// } -// fCharIter = &fSCharIter; - -// this->first(); -// } - - -// UText *RuleBasedBreakIterator::getUText(UText *fillIn, UErrorCode &status) const { -// UText *result = utext_clone(fillIn, &fText, FALSE, TRUE, &status); -// return result; -// } - - -// //======================================================================= -// // BreakIterator overrides -// //======================================================================= - -// /** -// * Return a CharacterIterator over the text being analyzed. -// */ -// CharacterIterator& -// RuleBasedBreakIterator::getText() const { -// return *fCharIter; -// } - -// /** -// * Set the iterator to analyze a new piece of text. This function resets -// * the current iteration position to the beginning of the text. -// * @param newText An iterator over the text to analyze. -// */ -// void -// RuleBasedBreakIterator::adoptText(CharacterIterator* newText) { -// // If we are holding a CharacterIterator adopted from a -// // previous call to this function, delete it now. -// if (fCharIter != &fSCharIter) { -// delete fCharIter; -// } - -// fCharIter = newText; -// UErrorCode status = U_ZERO_ERROR; -// fBreakCache->reset(); -// fDictionaryCache->reset(); -// if (newText==NULL || newText->startIndex() != 0) { -// // startIndex !=0 wants to be an error, but there's no way to report it. -// // Make the iterator text be an empty string. -// utext_openUChars(&fText, NULL, 0, &status); -// } else { -// utext_openCharacterIterator(&fText, newText, &status); -// } -// this->first(); -// } - -// /** -// * Set the iterator to analyze a new piece of text. This function resets -// * the current iteration position to the beginning of the text. -// * @param newText An iterator over the text to analyze. -// */ -// void -// RuleBasedBreakIterator::setText(const UnicodeString& newText) { -// UErrorCode status = U_ZERO_ERROR; -// fBreakCache->reset(); -// fDictionaryCache->reset(); -// utext_openConstUnicodeString(&fText, &newText, &status); - -// // Set up a character iterator on the string. -// // Needed in case someone calls getText(). -// // Can not, unfortunately, do this lazily on the (probably never) -// // call to getText(), because getText is const. -// fSCharIter.setText(newText); - -// if (fCharIter != &fSCharIter) { -// // old fCharIter was adopted from the outside. Delete it. -// delete fCharIter; -// } -// fCharIter = &fSCharIter; - -// this->first(); -// } - - -// /** -// * Provide a new UText for the input text. Must reference text with contents identical -// * to the original. -// * Intended for use with text data originating in Java (garbage collected) environments -// * where the data may be moved in memory at arbitrary times. -// */ -// RuleBasedBreakIterator &RuleBasedBreakIterator::refreshInputText(UText *input, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return *this; -// } -// if (input == NULL) { -// status = U_ILLEGAL_ARGUMENT_ERROR; -// return *this; -// } -// int64_t pos = utext_getNativeIndex(&fText); -// // Shallow read-only clone of the new UText into the existing input UText -// utext_clone(&fText, input, FALSE, TRUE, &status); -// if (U_FAILURE(status)) { -// return *this; -// } -// utext_setNativeIndex(&fText, pos); -// if (utext_getNativeIndex(&fText) != pos) { -// // Sanity check. The new input utext is supposed to have the exact same -// // contents as the old. If we can't set to the same position, it doesn't. -// // The contents underlying the old utext might be invalid at this point, -// // so it's not safe to check directly. -// status = U_ILLEGAL_ARGUMENT_ERROR; -// } -// return *this; -// } - - -// /** -// * Sets the current iteration position to the beginning of the text, position zero. -// * @return The new iterator position, which is zero. -// */ -// int32_t RuleBasedBreakIterator::first(void) { -// UErrorCode status = U_ZERO_ERROR; -// if (!fBreakCache->seek(0)) { -// fBreakCache->populateNear(0, status); -// } -// fBreakCache->current(); -// U_ASSERT(fPosition == 0); -// return 0; -// } - -// /** -// * Sets the current iteration position to the end of the text. -// * @return The text's past-the-end offset. -// */ -// int32_t RuleBasedBreakIterator::last(void) { -// int32_t endPos = (int32_t)utext_nativeLength(&fText); -// UBool endShouldBeBoundary = isBoundary(endPos); // Has side effect of setting iterator position. -// (void)endShouldBeBoundary; -// U_ASSERT(endShouldBeBoundary); -// U_ASSERT(fPosition == endPos); -// return endPos; -// } - -// /** -// * Advances the iterator either forward or backward the specified number of steps. -// * Negative values move backward, and positive values move forward. This is -// * equivalent to repeatedly calling next() or previous(). -// * @param n The number of steps to move. The sign indicates the direction -// * (negative is backwards, and positive is forwards). -// * @return The character offset of the boundary position n boundaries away from -// * the current one. -// */ -// int32_t RuleBasedBreakIterator::next(int32_t n) { -// int32_t result = 0; -// if (n > 0) { -// for (; n > 0 && result != UBRK_DONE; --n) { -// result = next(); -// } -// } else if (n < 0) { -// for (; n < 0 && result != UBRK_DONE; ++n) { -// result = previous(); -// } -// } else { -// result = current(); -// } -// return result; -// } - -// /** -// * Advances the iterator to the next boundary position. -// * @return The position of the first boundary after this one. -// */ -// int32_t RuleBasedBreakIterator::next(void) { -// fBreakCache->next(); -// return fDone ? UBRK_DONE : fPosition; -// } - -// /** -// * Move the iterator backwards, to the boundary preceding the current one. -// * -// * Starts from the current position within fText. -// * Starting position need not be on a boundary. -// * -// * @return The position of the boundary position immediately preceding the starting position. -// */ -// int32_t RuleBasedBreakIterator::previous(void) { -// UErrorCode status = U_ZERO_ERROR; -// fBreakCache->previous(status); -// return fDone ? UBRK_DONE : fPosition; -// } - -// /** -// * Sets the iterator to refer to the first boundary position following -// * the specified position. -// * @param startPos The position from which to begin searching for a break position. -// * @return The position of the first break after the current position. -// */ -// int32_t RuleBasedBreakIterator::following(int32_t startPos) { -// // if the supplied position is before the beginning, return the -// // text's starting offset -// if (startPos < 0) { -// return first(); -// } - -// // Move requested offset to a code point start. It might be on a trail surrogate, -// // or on a trail byte if the input is UTF-8. Or it may be beyond the end of the text. -// utext_setNativeIndex(&fText, startPos); -// startPos = (int32_t)utext_getNativeIndex(&fText); - -// UErrorCode status = U_ZERO_ERROR; -// fBreakCache->following(startPos, status); -// return fDone ? UBRK_DONE : fPosition; -// } - -// /** -// * Sets the iterator to refer to the last boundary position before the -// * specified position. -// * @param offset The position to begin searching for a break from. -// * @return The position of the last boundary before the starting position. -// */ -// int32_t RuleBasedBreakIterator::preceding(int32_t offset) { -// if (offset > utext_nativeLength(&fText)) { -// return last(); -// } - -// // Move requested offset to a code point start. It might be on a trail surrogate, -// // or on a trail byte if the input is UTF-8. - -// utext_setNativeIndex(&fText, offset); -// int32_t adjustedOffset = static_cast(utext_getNativeIndex(&fText)); - -// UErrorCode status = U_ZERO_ERROR; -// fBreakCache->preceding(adjustedOffset, status); -// return fDone ? UBRK_DONE : fPosition; -// } - -// /** -// * Returns true if the specfied position is a boundary position. As a side -// * effect, leaves the iterator pointing to the first boundary position at -// * or after "offset". -// * -// * @param offset the offset to check. -// * @return True if "offset" is a boundary position. -// */ -// UBool RuleBasedBreakIterator::isBoundary(int32_t offset) { -// // out-of-range indexes are never boundary positions -// if (offset < 0) { -// first(); // For side effects on current position, tag values. -// return FALSE; -// } - -// // Adjust offset to be on a code point boundary and not beyond the end of the text. -// // Note that isBoundary() is always false for offsets that are not on code point boundaries. -// // But we still need the side effect of leaving iteration at the following boundary. - -// utext_setNativeIndex(&fText, offset); -// int32_t adjustedOffset = static_cast(utext_getNativeIndex(&fText)); - -// bool result = false; -// UErrorCode status = U_ZERO_ERROR; -// if (fBreakCache->seek(adjustedOffset) || fBreakCache->populateNear(adjustedOffset, status)) { -// result = (fBreakCache->current() == offset); -// } - -// if (result && adjustedOffset < offset && utext_char32At(&fText, offset) == U_SENTINEL) { -// // Original offset is beyond the end of the text. Return FALSE, it's not a boundary, -// // but the iteration position remains set to the end of the text, which is a boundary. -// return FALSE; -// } -// if (!result) { -// // Not on a boundary. isBoundary() must leave iterator on the following boundary. -// // Cache->seek(), above, left us on the preceding boundary, so advance one. -// next(); -// } -// return result; -// } - - -// /** -// * Returns the current iteration position. -// * @return The current iteration position. -// */ -// int32_t RuleBasedBreakIterator::current(void) const { -// return fPosition; -// } - - -// //======================================================================= -// // implementation -// //======================================================================= - -// // -// // RBBIRunMode - the state machine runs an extra iteration at the beginning and end -// // of user text. A variable with this enum type keeps track of where we -// // are. The state machine only fetches user input while in the RUN mode. -// // -// enum RBBIRunMode { -// RBBI_START, // state machine processing is before first char of input -// RBBI_RUN, // state machine processing is in the user text -// RBBI_END // state machine processing is after end of user text. -// }; - - -// // Map from look-ahead break states (corresponds to rules) to boundary positions. -// // Allows multiple lookahead break rules to be in flight at the same time. -// // -// // This is a temporary approach for ICU 57. A better fix is to make the look-ahead numbers -// // in the state table be sequential, then we can just index an array. And the -// // table could also tell us in advance how big that array needs to be. -// // -// // Before ICU 57 there was just a single simple variable for a look-ahead match that -// // was in progress. Two rules at once did not work. - -// static const int32_t kMaxLookaheads = 8; -// struct LookAheadResults { -// int32_t fUsedSlotLimit; -// int32_t fPositions[8]; -// int16_t fKeys[8]; - -// LookAheadResults() : fUsedSlotLimit(0), fPositions(), fKeys() {} - -// int32_t getPosition(int16_t key) { -// for (int32_t i=0; i= kMaxLookaheads) { -// UPRV_UNREACHABLE; -// } -// fKeys[i] = key; -// fPositions[i] = position; -// U_ASSERT(fUsedSlotLimit == i); -// fUsedSlotLimit = i + 1; -// } -// }; - - -// //----------------------------------------------------------------------------------- -// // -// // handleNext() -// // Run the state machine to find a boundary -// // -// //----------------------------------------------------------------------------------- -// int32_t RuleBasedBreakIterator::handleNext() { -// int32_t state; -// uint16_t category = 0; -// RBBIRunMode mode; - -// RBBIStateTableRow *row; -// UChar32 c; -// LookAheadResults lookAheadMatches; -// int32_t result = 0; -// int32_t initialPosition = 0; -// const RBBIStateTable *statetable = fData->fForwardTable; -// const char *tableData = statetable->fTableData; -// uint32_t tableRowLen = statetable->fRowLen; -// #ifdef RBBI_DEBUG -// if (gTrace) { -// RBBIDebugPuts("Handle Next pos char state category"); -// } -// #endif - -// // handleNext alway sets the break tag value. -// // Set the default for it. -// fRuleStatusIndex = 0; - -// fDictionaryCharCount = 0; - -// // if we're already at the end of the text, return DONE. -// initialPosition = fPosition; -// UTEXT_SETNATIVEINDEX(&fText, initialPosition); -// result = initialPosition; -// c = UTEXT_NEXT32(&fText); -// if (c==U_SENTINEL) { -// fDone = TRUE; -// return UBRK_DONE; -// } - -// // Set the initial state for the state machine -// state = START_STATE; -// row = (RBBIStateTableRow *) -// //(statetable->fTableData + (statetable->fRowLen * state)); -// (tableData + tableRowLen * state); - - -// mode = RBBI_RUN; -// if (statetable->fFlags & RBBI_BOF_REQUIRED) { -// category = 2; -// mode = RBBI_START; -// } - - -// // loop until we reach the end of the text or transition to state 0 -// // -// for (;;) { -// if (c == U_SENTINEL) { -// // Reached end of input string. -// if (mode == RBBI_END) { -// // We have already run the loop one last time with the -// // character set to the psueudo {eof} value. Now it is time -// // to unconditionally bail out. -// break; -// } -// // Run the loop one last time with the fake end-of-input character category. -// mode = RBBI_END; -// category = 1; -// } - -// // -// // Get the char category. An incoming category of 1 or 2 means that -// // we are preset for doing the beginning or end of input, and -// // that we shouldn't get a category from an actual text input character. -// // -// if (mode == RBBI_RUN) { -// // look up the current character's character category, which tells us -// // which column in the state table to look at. -// // Note: the 16 in UTRIE_GET16 refers to the size of the data being returned, -// // not the size of the character going in, which is a UChar32. -// // -// category = UTRIE2_GET16(fData->fTrie, c); - -// // Check the dictionary bit in the character's category. -// // Counter is only used by dictionary based iteration. -// // Chars that need to be handled by a dictionary have a flag bit set -// // in their category values. -// // -// if ((category & 0x4000) != 0) { -// fDictionaryCharCount++; -// // And off the dictionary flag bit. -// category &= ~0x4000; -// } -// } - -// #ifdef RBBI_DEBUG -// if (gTrace) { -// RBBIDebugPrintf(" %4" PRId64 " ", utext_getNativeIndex(&fText)); -// if (0x20<=c && c<0x7f) { -// RBBIDebugPrintf("\"%c\" ", c); -// } else { -// RBBIDebugPrintf("%5x ", c); -// } -// RBBIDebugPrintf("%3d %3d\n", state, category); -// } -// #endif - -// // State Transition - move machine to its next state -// // - -// // fNextState is a variable-length array. -// U_ASSERT(categoryfHeader->fCatCount); -// state = row->fNextState[category]; /*Not accessing beyond memory*/ -// row = (RBBIStateTableRow *) -// // (statetable->fTableData + (statetable->fRowLen * state)); -// (tableData + tableRowLen * state); - - -// if (row->fAccepting == -1) { -// // Match found, common case. -// if (mode != RBBI_START) { -// result = (int32_t)UTEXT_GETNATIVEINDEX(&fText); -// } -// fRuleStatusIndex = row->fTagIdx; // Remember the break status (tag) values. -// } - -// int16_t completedRule = row->fAccepting; -// if (completedRule > 0) { -// // Lookahead match is completed. -// int32_t lookaheadResult = lookAheadMatches.getPosition(completedRule); -// if (lookaheadResult >= 0) { -// fRuleStatusIndex = row->fTagIdx; -// fPosition = lookaheadResult; -// return lookaheadResult; -// } -// } -// int16_t rule = row->fLookAhead; -// if (rule != 0) { -// // At the position of a '/' in a look-ahead match. Record it. -// int32_t pos = (int32_t)UTEXT_GETNATIVEINDEX(&fText); -// lookAheadMatches.setPosition(rule, pos); -// } - -// if (state == STOP_STATE) { -// // This is the normal exit from the lookup state machine. -// // We have advanced through the string until it is certain that no -// // longer match is possible, no matter what characters follow. -// break; -// } - -// // Advance to the next character. -// // If this is a beginning-of-input loop iteration, don't advance -// // the input position. The next iteration will be processing the -// // first real input character. -// if (mode == RBBI_RUN) { -// c = UTEXT_NEXT32(&fText); -// } else { -// if (mode == RBBI_START) { -// mode = RBBI_RUN; -// } -// } -// } - -// // The state machine is done. Check whether it found a match... - -// // If the iterator failed to advance in the match engine, force it ahead by one. -// // (This really indicates a defect in the break rules. They should always match -// // at least one character.) -// if (result == initialPosition) { -// utext_setNativeIndex(&fText, initialPosition); -// utext_next32(&fText); -// result = (int32_t)utext_getNativeIndex(&fText); -// fRuleStatusIndex = 0; -// } - -// // Leave the iterator at our result position. -// fPosition = result; -// #ifdef RBBI_DEBUG -// if (gTrace) { -// RBBIDebugPrintf("result = %d\n\n", result); -// } -// #endif -// return result; -// } - - -// //----------------------------------------------------------------------------------- -// // -// // handleSafePrevious() -// // -// // Iterate backwards using the safe reverse rules. -// // The logic of this function is similar to handleNext(), but simpler -// // because the safe table does not require as many options. -// // -// //----------------------------------------------------------------------------------- -// int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) { -// int32_t state; -// uint16_t category = 0; -// RBBIStateTableRow *row; -// UChar32 c; -// int32_t result = 0; - -// const RBBIStateTable *stateTable = fData->fReverseTable; -// UTEXT_SETNATIVEINDEX(&fText, fromPosition); -// #ifdef RBBI_DEBUG -// if (gTrace) { -// RBBIDebugPuts("Handle Previous pos char state category"); -// } -// #endif - -// // if we're already at the start of the text, return DONE. -// if (fData == NULL || UTEXT_GETNATIVEINDEX(&fText)==0) { -// return BreakIterator::DONE; -// } - -// // Set the initial state for the state machine -// c = UTEXT_PREVIOUS32(&fText); -// state = START_STATE; -// row = (RBBIStateTableRow *) -// (stateTable->fTableData + (stateTable->fRowLen * state)); - -// // loop until we reach the start of the text or transition to state 0 -// // -// for (; c != U_SENTINEL; c = UTEXT_PREVIOUS32(&fText)) { - -// // look up the current character's character category, which tells us -// // which column in the state table to look at. -// // Note: the 16 in UTRIE_GET16 refers to the size of the data being returned, -// // not the size of the character going in, which is a UChar32. -// // -// // And off the dictionary flag bit. For reverse iteration it is not used. -// category = UTRIE2_GET16(fData->fTrie, c); -// category &= ~0x4000; - -// #ifdef RBBI_DEBUG -// if (gTrace) { -// RBBIDebugPrintf(" %4d ", (int32_t)utext_getNativeIndex(&fText)); -// if (0x20<=c && c<0x7f) { -// RBBIDebugPrintf("\"%c\" ", c); -// } else { -// RBBIDebugPrintf("%5x ", c); -// } -// RBBIDebugPrintf("%3d %3d\n", state, category); -// } -// #endif - -// // State Transition - move machine to its next state -// // -// // fNextState is a variable-length array. -// U_ASSERT(categoryfHeader->fCatCount); -// state = row->fNextState[category]; /*Not accessing beyond memory*/ -// row = (RBBIStateTableRow *) -// (stateTable->fTableData + (stateTable->fRowLen * state)); - -// if (state == STOP_STATE) { -// // This is the normal exit from the lookup state machine. -// // Transistion to state zero means we have found a safe point. -// break; -// } -// } - -// // The state machine is done. Check whether it found a match... -// result = (int32_t)UTEXT_GETNATIVEINDEX(&fText); -// #ifdef RBBI_DEBUG -// if (gTrace) { -// RBBIDebugPrintf("result = %d\n\n", result); -// } -// #endif -// return result; -// } - -// //------------------------------------------------------------------------------- -// // -// // getRuleStatus() Return the break rule tag associated with the current -// // iterator position. If the iterator arrived at its current -// // position by iterating forwards, the value will have been -// // cached by the handleNext() function. -// // -// //------------------------------------------------------------------------------- - -// int32_t RuleBasedBreakIterator::getRuleStatus() const { - -// // fLastRuleStatusIndex indexes to the start of the appropriate status record -// // (the number of status values.) -// // This function returns the last (largest) of the array of status values. -// int32_t idx = fRuleStatusIndex + fData->fRuleStatusTable[fRuleStatusIndex]; -// int32_t tagVal = fData->fRuleStatusTable[idx]; - -// return tagVal; -// } - - -// int32_t RuleBasedBreakIterator::getRuleStatusVec( -// int32_t *fillInVec, int32_t capacity, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return 0; -// } - -// int32_t numVals = fData->fRuleStatusTable[fRuleStatusIndex]; -// int32_t numValsToCopy = numVals; -// if (numVals > capacity) { -// status = U_BUFFER_OVERFLOW_ERROR; -// numValsToCopy = capacity; -// } -// int i; -// for (i=0; ifRuleStatusTable[fRuleStatusIndex + i + 1]; -// } -// return numVals; -// } - - - -// //------------------------------------------------------------------------------- -// // -// // getBinaryRules Access to the compiled form of the rules, -// // for use by build system tools that save the data -// // for standard iterator types. -// // -// //------------------------------------------------------------------------------- -// const uint8_t *RuleBasedBreakIterator::getBinaryRules(uint32_t &length) { -// const uint8_t *retPtr = NULL; -// length = 0; - -// if (fData != NULL) { -// retPtr = (const uint8_t *)fData->fHeader; -// length = fData->fHeader->fLength; -// } -// return retPtr; -// } - - -// RuleBasedBreakIterator *RuleBasedBreakIterator::createBufferClone( -// void * /*stackBuffer*/, int32_t &bufferSize, UErrorCode &status) { -// if (U_FAILURE(status)){ -// return NULL; -// } - -// if (bufferSize == 0) { -// bufferSize = 1; // preflighting for deprecated functionality -// return NULL; -// } - -// BreakIterator *clonedBI = clone(); -// if (clonedBI == NULL) { -// status = U_MEMORY_ALLOCATION_ERROR; -// } else { -// status = U_SAFECLONE_ALLOCATED_WARNING; -// } -// return (RuleBasedBreakIterator *)clonedBI; -// } - -// U_NAMESPACE_END - - -// static icu::UStack *gLanguageBreakFactories = nullptr; -// static const icu::UnicodeString *gEmptyString = nullptr; -// static icu::UInitOnce gLanguageBreakFactoriesInitOnce = U_INITONCE_INITIALIZER; -// static icu::UInitOnce gRBBIInitOnce = U_INITONCE_INITIALIZER; - -// /** -// * Release all static memory held by breakiterator. -// */ -// U_CDECL_BEGIN -// static UBool U_CALLCONV rbbi_cleanup(void) { -// delete gLanguageBreakFactories; -// gLanguageBreakFactories = nullptr; -// delete gEmptyString; -// gEmptyString = nullptr; -// gLanguageBreakFactoriesInitOnce.reset(); -// gRBBIInitOnce.reset(); -// return TRUE; -// } -// U_CDECL_END - -// U_CDECL_BEGIN -// static void U_CALLCONV _deleteFactory(void *obj) { -// delete (icu::LanguageBreakFactory *) obj; -// } -// U_CDECL_END -// U_NAMESPACE_BEGIN - -// static void U_CALLCONV rbbiInit() { -// gEmptyString = new UnicodeString(); -// ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup); -// } - -// static void U_CALLCONV initLanguageFactories() { -// UErrorCode status = U_ZERO_ERROR; -// U_ASSERT(gLanguageBreakFactories == NULL); -// gLanguageBreakFactories = new UStack(_deleteFactory, NULL, status); -// if (gLanguageBreakFactories != NULL && U_SUCCESS(status)) { -// ICULanguageBreakFactory *builtIn = new ICULanguageBreakFactory(status); -// gLanguageBreakFactories->push(builtIn, status); -// #ifdef U_LOCAL_SERVICE_HOOK -// LanguageBreakFactory *extra = (LanguageBreakFactory *)uprv_svc_hook("languageBreakFactory", &status); -// if (extra != NULL) { -// gLanguageBreakFactories->push(extra, status); -// } -// #endif -// } -// ucln_common_registerCleanup(UCLN_COMMON_RBBI, rbbi_cleanup); -// } - - -// static const LanguageBreakEngine* -// getLanguageBreakEngineFromFactory(UChar32 c) -// { -// umtx_initOnce(gLanguageBreakFactoriesInitOnce, &initLanguageFactories); -// if (gLanguageBreakFactories == NULL) { -// return NULL; -// } - -// int32_t i = gLanguageBreakFactories->size(); -// const LanguageBreakEngine *lbe = NULL; -// while (--i >= 0) { -// LanguageBreakFactory *factory = (LanguageBreakFactory *)(gLanguageBreakFactories->elementAt(i)); -// lbe = factory->getEngineFor(c); -// if (lbe != NULL) { -// break; -// } -// } -// return lbe; -// } - - -// //------------------------------------------------------------------------------- -// // -// // getLanguageBreakEngine Find an appropriate LanguageBreakEngine for the -// // the character c. -// // -// //------------------------------------------------------------------------------- -// const LanguageBreakEngine * -// RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) { -// const LanguageBreakEngine *lbe = NULL; -// UErrorCode status = U_ZERO_ERROR; - -// if (fLanguageBreakEngines == NULL) { -// fLanguageBreakEngines = new UStack(status); -// if (fLanguageBreakEngines == NULL || U_FAILURE(status)) { -// delete fLanguageBreakEngines; -// fLanguageBreakEngines = 0; -// return NULL; -// } -// } - -// int32_t i = fLanguageBreakEngines->size(); -// while (--i >= 0) { -// lbe = (const LanguageBreakEngine *)(fLanguageBreakEngines->elementAt(i)); -// if (lbe->handles(c)) { -// return lbe; -// } -// } - -// // No existing dictionary took the character. See if a factory wants to -// // give us a new LanguageBreakEngine for this character. -// lbe = getLanguageBreakEngineFromFactory(c); - -// // If we got one, use it and push it on our stack. -// if (lbe != NULL) { -// fLanguageBreakEngines->push((void *)lbe, status); -// // Even if we can't remember it, we can keep looking it up, so -// // return it even if the push fails. -// return lbe; -// } - -// // No engine is forthcoming for this character. Add it to the -// // reject set. Create the reject break engine if needed. -// if (fUnhandledBreakEngine == NULL) { -// fUnhandledBreakEngine = new UnhandledEngine(status); -// if (U_SUCCESS(status) && fUnhandledBreakEngine == NULL) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return nullptr; -// } -// // Put it last so that scripts for which we have an engine get tried -// // first. -// fLanguageBreakEngines->insertElementAt(fUnhandledBreakEngine, 0, status); -// // If we can't insert it, or creation failed, get rid of it -// if (U_FAILURE(status)) { -// delete fUnhandledBreakEngine; -// fUnhandledBreakEngine = 0; -// return NULL; -// } -// } - -// // Tell the reject engine about the character; at its discretion, it may -// // add more than just the one character. -// fUnhandledBreakEngine->handleCharacter(c); - -// return fUnhandledBreakEngine; -// } - -// void RuleBasedBreakIterator::dumpCache() { -// fBreakCache->dumpCache(); -// } - -// void RuleBasedBreakIterator::dumpTables() { -// fData->printData(); -// } - -// /** -// * Returns the description used to create this iterator -// */ - -// const UnicodeString& -// RuleBasedBreakIterator::getRules() const { -// if (fData != NULL) { -// return fData->getRuleSourceString(); -// } else { -// umtx_initOnce(gRBBIInitOnce, &rbbiInit); -// return *gEmptyString; -// } -// } - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.cpp deleted file mode 100644 index bbbbf3d0b..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.cpp +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// file: rbbi_cache.cpp - -#include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/ubrk.h" -// #include "unicode/rbbi.h" - -// #include "rbbi_cache.h" - -// #include "brkeng.h" -// #include "cmemory.h" -// #include "rbbidata.h" -// #include "rbbirb.h" -// #include "uassert.h" -// #include "uvectr32.h" - -// U_NAMESPACE_BEGIN - -// /* -// * DictionaryCache implementation -// */ - -// RuleBasedBreakIterator::DictionaryCache::DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status) : -// fBI(bi), fBreaks(status), fPositionInCache(-1), -// fStart(0), fLimit(0), fFirstRuleStatusIndex(0), fOtherRuleStatusIndex(0) { -// } - -// RuleBasedBreakIterator::DictionaryCache::~DictionaryCache() { -// } - -// void RuleBasedBreakIterator::DictionaryCache::reset() { -// fPositionInCache = -1; -// fStart = 0; -// fLimit = 0; -// fFirstRuleStatusIndex = 0; -// fOtherRuleStatusIndex = 0; -// fBreaks.removeAllElements(); -// } - -// UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_t *result, int32_t *statusIndex) { -// if (fromPos >= fLimit || fromPos < fStart) { -// fPositionInCache = -1; -// return FALSE; -// } - -// // Sequential iteration, move from previous boundary to the following - -// int32_t r = 0; -// if (fPositionInCache >= 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) { -// ++fPositionInCache; -// if (fPositionInCache >= fBreaks.size()) { -// fPositionInCache = -1; -// return FALSE; -// } -// r = fBreaks.elementAti(fPositionInCache); -// U_ASSERT(r > fromPos); -// *result = r; -// *statusIndex = fOtherRuleStatusIndex; -// return TRUE; -// } - -// // Random indexing. Linear search for the boundary following the given position. - -// for (fPositionInCache = 0; fPositionInCache < fBreaks.size(); ++fPositionInCache) { -// r= fBreaks.elementAti(fPositionInCache); -// if (r > fromPos) { -// *result = r; -// *statusIndex = fOtherRuleStatusIndex; -// return TRUE; -// } -// } -// UPRV_UNREACHABLE; -// } - - -// UBool RuleBasedBreakIterator::DictionaryCache::preceding(int32_t fromPos, int32_t *result, int32_t *statusIndex) { -// if (fromPos <= fStart || fromPos > fLimit) { -// fPositionInCache = -1; -// return FALSE; -// } - -// if (fromPos == fLimit) { -// fPositionInCache = fBreaks.size() - 1; -// if (fPositionInCache >= 0) { -// U_ASSERT(fBreaks.elementAti(fPositionInCache) == fromPos); -// } -// } - -// int32_t r; -// if (fPositionInCache > 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) { -// --fPositionInCache; -// r = fBreaks.elementAti(fPositionInCache); -// U_ASSERT(r < fromPos); -// *result = r; -// *statusIndex = ( r== fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex; -// return TRUE; -// } - -// if (fPositionInCache == 0) { -// fPositionInCache = -1; -// return FALSE; -// } - -// for (fPositionInCache = fBreaks.size()-1; fPositionInCache >= 0; --fPositionInCache) { -// r = fBreaks.elementAti(fPositionInCache); -// if (r < fromPos) { -// *result = r; -// *statusIndex = ( r == fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex; -// return TRUE; -// } -// } -// UPRV_UNREACHABLE; -// } - -// void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPos, int32_t endPos, -// int32_t firstRuleStatus, int32_t otherRuleStatus) { -// if ((endPos - startPos) <= 1) { -// return; -// } - -// reset(); -// fFirstRuleStatusIndex = firstRuleStatus; -// fOtherRuleStatusIndex = otherRuleStatus; - -// int32_t rangeStart = startPos; -// int32_t rangeEnd = endPos; - -// uint16_t category; -// int32_t current; -// UErrorCode status = U_ZERO_ERROR; -// int32_t foundBreakCount = 0; -// UText *text = &fBI->fText; - -// // Loop through the text, looking for ranges of dictionary characters. -// // For each span, find the appropriate break engine, and ask it to find -// // any breaks within the span. - -// utext_setNativeIndex(text, rangeStart); -// UChar32 c = utext_current32(text); -// category = UTRIE2_GET16(fBI->fData->fTrie, c); - -// while(U_SUCCESS(status)) { -// while((current = (int32_t)UTEXT_GETNATIVEINDEX(text)) < rangeEnd && (category & 0x4000) == 0) { -// utext_next32(text); // TODO: cleaner loop structure. -// c = utext_current32(text); -// category = UTRIE2_GET16(fBI->fData->fTrie, c); -// } -// if (current >= rangeEnd) { -// break; -// } - -// // We now have a dictionary character. Get the appropriate language object -// // to deal with it. -// const LanguageBreakEngine *lbe = fBI->getLanguageBreakEngine(c); - -// // Ask the language object if there are any breaks. It will add them to the cache and -// // leave the text pointer on the other side of its range, ready to search for the next one. -// if (lbe != NULL) { -// foundBreakCount += lbe->findBreaks(text, rangeStart, rangeEnd, fBreaks); -// } - -// // Reload the loop variables for the next go-round -// c = utext_current32(text); -// category = UTRIE2_GET16(fBI->fData->fTrie, c); -// } - -// // If we found breaks, ensure that the first and last entries are -// // the original starting and ending position. And initialize the -// // cache iteration position to the first entry. - -// // printf("foundBreakCount = %d\n", foundBreakCount); -// if (foundBreakCount > 0) { -// U_ASSERT(foundBreakCount == fBreaks.size()); -// if (startPos < fBreaks.elementAti(0)) { -// // The dictionary did not place a boundary at the start of the segment of text. -// // Add one now. This should not commonly happen, but it would be easy for interactions -// // of the rules for dictionary segments and the break engine implementations to -// // inadvertently cause it. Cover it here, just in case. -// fBreaks.insertElementAt(startPos, 0, status); -// } -// if (endPos > fBreaks.peeki()) { -// fBreaks.push(endPos, status); -// } -// fPositionInCache = 0; -// // Note: Dictionary matching may extend beyond the original limit. -// fStart = fBreaks.elementAti(0); -// fLimit = fBreaks.peeki(); -// } else { -// // there were no language-based breaks, even though the segment contained -// // dictionary characters. Subsequent attempts to fetch boundaries from the dictionary cache -// // for this range will fail, and the calling code will fall back to the rule based boundaries. -// } -// } - - -// /* -// * BreakCache implemetation -// */ - -// RuleBasedBreakIterator::BreakCache::BreakCache(RuleBasedBreakIterator *bi, UErrorCode &status) : -// fBI(bi), fSideBuffer(status) { -// reset(); -// } - - -// RuleBasedBreakIterator::BreakCache::~BreakCache() { -// } - - -// void RuleBasedBreakIterator::BreakCache::reset(int32_t pos, int32_t ruleStatus) { -// fStartBufIdx = 0; -// fEndBufIdx = 0; -// fTextIdx = pos; -// fBufIdx = 0; -// fBoundaries[0] = pos; -// fStatuses[0] = (uint16_t)ruleStatus; -// } - - -// int32_t RuleBasedBreakIterator::BreakCache::current() { -// fBI->fPosition = fTextIdx; -// fBI->fRuleStatusIndex = fStatuses[fBufIdx]; -// fBI->fDone = FALSE; -// return fTextIdx; -// } - - -// void RuleBasedBreakIterator::BreakCache::following(int32_t startPos, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return; -// } -// if (startPos == fTextIdx || seek(startPos) || populateNear(startPos, status)) { -// // startPos is in the cache. Do a next() from that position. -// // TODO: an awkward set of interactions with bi->fDone -// // seek() does not clear it; it can't because of interactions with populateNear(). -// // next() does not clear it in the fast-path case, where everything matters. Maybe it should. -// // So clear it here, for the case where seek() succeeded on an iterator that had previously run off the end. -// fBI->fDone = false; -// next(); -// } -// return; -// } - - -// void RuleBasedBreakIterator::BreakCache::preceding(int32_t startPos, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return; -// } -// if (startPos == fTextIdx || seek(startPos) || populateNear(startPos, status)) { -// if (startPos == fTextIdx) { -// previous(status); -// } else { -// // seek() leaves the BreakCache positioned at the preceding boundary -// // if the requested position is between two bounaries. -// // current() pushes the BreakCache position out to the BreakIterator itself. -// U_ASSERT(startPos > fTextIdx); -// current(); -// } -// } -// return; -// } - - -// /* -// * Out-of-line code for BreakCache::next(). -// * Cache does not already contain the boundary -// */ -// void RuleBasedBreakIterator::BreakCache::nextOL() { -// fBI->fDone = !populateFollowing(); -// fBI->fPosition = fTextIdx; -// fBI->fRuleStatusIndex = fStatuses[fBufIdx]; -// return; -// } - - -// void RuleBasedBreakIterator::BreakCache::previous(UErrorCode &status) { -// if (U_FAILURE(status)) { -// return; -// } -// int32_t initialBufIdx = fBufIdx; -// if (fBufIdx == fStartBufIdx) { -// // At start of cache. Prepend to it. -// populatePreceding(status); -// } else { -// // Cache already holds the next boundary -// fBufIdx = modChunkSize(fBufIdx - 1); -// fTextIdx = fBoundaries[fBufIdx]; -// } -// fBI->fDone = (fBufIdx == initialBufIdx); -// fBI->fPosition = fTextIdx; -// fBI->fRuleStatusIndex = fStatuses[fBufIdx]; -// return; -// } - - -// UBool RuleBasedBreakIterator::BreakCache::seek(int32_t pos) { -// if (pos < fBoundaries[fStartBufIdx] || pos > fBoundaries[fEndBufIdx]) { -// return FALSE; -// } -// if (pos == fBoundaries[fStartBufIdx]) { -// // Common case: seek(0), from BreakIterator::first() -// fBufIdx = fStartBufIdx; -// fTextIdx = fBoundaries[fBufIdx]; -// return TRUE; -// } -// if (pos == fBoundaries[fEndBufIdx]) { -// fBufIdx = fEndBufIdx; -// fTextIdx = fBoundaries[fBufIdx]; -// return TRUE; -// } - -// int32_t min = fStartBufIdx; -// int32_t max = fEndBufIdx; -// while (min != max) { -// int32_t probe = (min + max + (min>max ? CACHE_SIZE : 0)) / 2; -// probe = modChunkSize(probe); -// if (fBoundaries[probe] > pos) { -// max = probe; -// } else { -// min = modChunkSize(probe + 1); -// } -// } -// U_ASSERT(fBoundaries[max] > pos); -// fBufIdx = modChunkSize(max - 1); -// fTextIdx = fBoundaries[fBufIdx]; -// U_ASSERT(fTextIdx <= pos); -// return TRUE; -// } - - -// UBool RuleBasedBreakIterator::BreakCache::populateNear(int32_t position, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return FALSE; -// } -// U_ASSERT(position < fBoundaries[fStartBufIdx] || position > fBoundaries[fEndBufIdx]); - -// // Find a boundary somewhere in the vicinity of the requested position. -// // Depending on the safe rules and the text data, it could be either before, at, or after -// // the requested position. - - -// // If the requested position is not near already cached positions, clear the existing cache, -// // find a near-by boundary and begin new cache contents there. - -// if ((position < fBoundaries[fStartBufIdx] - 15) || position > (fBoundaries[fEndBufIdx] + 15)) { -// int32_t aBoundary = 0; -// int32_t ruleStatusIndex = 0; -// if (position > 20) { -// int32_t backupPos = fBI->handleSafePrevious(position); - -// if (backupPos > 0) { -// // Advance to the boundary following the backup position. -// // There is a complication: the safe reverse rules identify pairs of code points -// // that are safe. If advancing from the safe point moves forwards by less than -// // two code points, we need to advance one more time to ensure that the boundary -// // is good, including a correct rules status value. -// // -// fBI->fPosition = backupPos; -// aBoundary = fBI->handleNext(); -// if (aBoundary <= backupPos + 4) { -// // +4 is a quick test for possibly having advanced only one codepoint. -// // Four being the length of the longest potential code point, a supplementary in UTF-8 -// utext_setNativeIndex(&fBI->fText, aBoundary); -// if (backupPos == utext_getPreviousNativeIndex(&fBI->fText)) { -// // The initial handleNext() only advanced by a single code point. Go again. -// aBoundary = fBI->handleNext(); // Safe rules identify safe pairs. -// } -// } -// ruleStatusIndex = fBI->fRuleStatusIndex; -// } -// } -// reset(aBoundary, ruleStatusIndex); // Reset cache to hold aBoundary as a single starting point. -// } - -// // Fill in boundaries between existing cache content and the new requested position. - -// if (fBoundaries[fEndBufIdx] < position) { -// // The last position in the cache precedes the requested position. -// // Add following position(s) to the cache. -// while (fBoundaries[fEndBufIdx] < position) { -// if (!populateFollowing()) { -// UPRV_UNREACHABLE; -// } -// } -// fBufIdx = fEndBufIdx; // Set iterator position to the end of the buffer. -// fTextIdx = fBoundaries[fBufIdx]; // Required because populateFollowing may add extra boundaries. -// while (fTextIdx > position) { // Move backwards to a position at or preceding the requested pos. -// previous(status); -// } -// return true; -// } - -// if (fBoundaries[fStartBufIdx] > position) { -// // The first position in the cache is beyond the requested position. -// // back up more until we get a boundary <= the requested position. -// while (fBoundaries[fStartBufIdx] > position) { -// populatePreceding(status); -// } -// fBufIdx = fStartBufIdx; // Set iterator position to the start of the buffer. -// fTextIdx = fBoundaries[fBufIdx]; // Required because populatePreceding may add extra boundaries. -// while (fTextIdx < position) { // Move forwards to a position at or following the requested pos. -// next(); -// } -// if (fTextIdx > position) { -// // If position is not itself a boundary, the next() loop above will overshoot. -// // Back up one, leaving cache position at the boundary preceding the requested position. -// previous(status); -// } -// return true; -// } - -// U_ASSERT(fTextIdx == position); -// return true; -// } - - - -// UBool RuleBasedBreakIterator::BreakCache::populateFollowing() { -// int32_t fromPosition = fBoundaries[fEndBufIdx]; -// int32_t fromRuleStatusIdx = fStatuses[fEndBufIdx]; -// int32_t pos = 0; -// int32_t ruleStatusIdx = 0; - -// if (fBI->fDictionaryCache->following(fromPosition, &pos, &ruleStatusIdx)) { -// addFollowing(pos, ruleStatusIdx, UpdateCachePosition); -// return TRUE; -// } - -// fBI->fPosition = fromPosition; -// pos = fBI->handleNext(); -// if (pos == UBRK_DONE) { -// return FALSE; -// } - -// ruleStatusIdx = fBI->fRuleStatusIndex; -// if (fBI->fDictionaryCharCount > 0) { -// // The text segment obtained from the rules includes dictionary characters. -// // Subdivide it, with subdivided results going into the dictionary cache. -// fBI->fDictionaryCache->populateDictionary(fromPosition, pos, fromRuleStatusIdx, ruleStatusIdx); -// if (fBI->fDictionaryCache->following(fromPosition, &pos, &ruleStatusIdx)) { -// addFollowing(pos, ruleStatusIdx, UpdateCachePosition); -// return TRUE; -// // TODO: may want to move a sizable chunk of dictionary cache to break cache at this point. -// // But be careful with interactions with populateNear(). -// } -// } - -// // Rule based segment did not include dictionary characters. -// // Or, it did contain dictionary chars, but the dictionary segmenter didn't handle them, -// // meaning that we didn't take the return, above. -// // Add its end point to the cache. -// addFollowing(pos, ruleStatusIdx, UpdateCachePosition); - -// // Add several non-dictionary boundaries at this point, to optimize straight forward iteration. -// // (subsequent calls to BreakIterator::next() will take the fast path, getting cached results. -// // -// for (int count=0; count<6; ++count) { -// pos = fBI->handleNext(); -// if (pos == UBRK_DONE || fBI->fDictionaryCharCount > 0) { -// break; -// } -// addFollowing(pos, fBI->fRuleStatusIndex, RetainCachePosition); -// } - -// return TRUE; -// } - - -// UBool RuleBasedBreakIterator::BreakCache::populatePreceding(UErrorCode &status) { -// if (U_FAILURE(status)) { -// return FALSE; -// } - -// int32_t fromPosition = fBoundaries[fStartBufIdx]; -// if (fromPosition == 0) { -// return FALSE; -// } - -// int32_t position = 0; -// int32_t positionStatusIdx = 0; - -// if (fBI->fDictionaryCache->preceding(fromPosition, &position, &positionStatusIdx)) { -// addPreceding(position, positionStatusIdx, UpdateCachePosition); -// return TRUE; -// } - -// int32_t backupPosition = fromPosition; - -// // Find a boundary somewhere preceding the first already-cached boundary -// do { -// backupPosition = backupPosition - 30; -// if (backupPosition <= 0) { -// backupPosition = 0; -// } else { -// backupPosition = fBI->handleSafePrevious(backupPosition); -// } -// if (backupPosition == UBRK_DONE || backupPosition == 0) { -// position = 0; -// positionStatusIdx = 0; -// } else { -// // Advance to the boundary following the backup position. -// // There is a complication: the safe reverse rules identify pairs of code points -// // that are safe. If advancing from the safe point moves forwards by less than -// // two code points, we need to advance one more time to ensure that the boundary -// // is good, including a correct rules status value. -// // -// fBI->fPosition = backupPosition; -// position = fBI->handleNext(); -// if (position <= backupPosition + 4) { -// // +4 is a quick test for possibly having advanced only one codepoint. -// // Four being the length of the longest potential code point, a supplementary in UTF-8 -// utext_setNativeIndex(&fBI->fText, position); -// if (backupPosition == utext_getPreviousNativeIndex(&fBI->fText)) { -// // The initial handleNext() only advanced by a single code point. Go again. -// position = fBI->handleNext(); // Safe rules identify safe pairs. -// } -// } -// positionStatusIdx = fBI->fRuleStatusIndex; -// } -// } while (position >= fromPosition); - -// // Find boundaries between the one we just located and the first already-cached boundary -// // Put them in a side buffer, because we don't yet know where they will fall in the circular cache buffer.. - -// fSideBuffer.removeAllElements(); -// fSideBuffer.addElement(position, status); -// fSideBuffer.addElement(positionStatusIdx, status); - -// do { -// int32_t prevPosition = fBI->fPosition = position; -// int32_t prevStatusIdx = positionStatusIdx; -// position = fBI->handleNext(); -// positionStatusIdx = fBI->fRuleStatusIndex; -// if (position == UBRK_DONE) { -// break; -// } - -// UBool segmentHandledByDictionary = FALSE; -// if (fBI->fDictionaryCharCount != 0) { -// // Segment from the rules includes dictionary characters. -// // Subdivide it, with subdivided results going into the dictionary cache. -// int32_t dictSegEndPosition = position; -// fBI->fDictionaryCache->populateDictionary(prevPosition, dictSegEndPosition, prevStatusIdx, positionStatusIdx); -// while (fBI->fDictionaryCache->following(prevPosition, &position, &positionStatusIdx)) { -// segmentHandledByDictionary = true; -// U_ASSERT(position > prevPosition); -// if (position >= fromPosition) { -// break; -// } -// U_ASSERT(position <= dictSegEndPosition); -// fSideBuffer.addElement(position, status); -// fSideBuffer.addElement(positionStatusIdx, status); -// prevPosition = position; -// } -// U_ASSERT(position==dictSegEndPosition || position>=fromPosition); -// } - -// if (!segmentHandledByDictionary && position < fromPosition) { -// fSideBuffer.addElement(position, status); -// fSideBuffer.addElement(positionStatusIdx, status); -// } -// } while (position < fromPosition); - -// // Move boundaries from the side buffer to the main circular buffer. -// UBool success = FALSE; -// if (!fSideBuffer.isEmpty()) { -// positionStatusIdx = fSideBuffer.popi(); -// position = fSideBuffer.popi(); -// addPreceding(position, positionStatusIdx, UpdateCachePosition); -// success = TRUE; -// } - -// while (!fSideBuffer.isEmpty()) { -// positionStatusIdx = fSideBuffer.popi(); -// position = fSideBuffer.popi(); -// if (!addPreceding(position, positionStatusIdx, RetainCachePosition)) { -// // No space in circular buffer to hold a new preceding result while -// // also retaining the current cache (iteration) position. -// // Bailing out is safe; the cache will refill again if needed. -// break; -// } -// } - -// return success; -// } - - -// void RuleBasedBreakIterator::BreakCache::addFollowing(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update) { -// U_ASSERT(position > fBoundaries[fEndBufIdx]); -// U_ASSERT(ruleStatusIdx <= UINT16_MAX); -// int32_t nextIdx = modChunkSize(fEndBufIdx + 1); -// if (nextIdx == fStartBufIdx) { -// fStartBufIdx = modChunkSize(fStartBufIdx + 6); // TODO: experiment. Probably revert to 1. -// } -// fBoundaries[nextIdx] = position; -// fStatuses[nextIdx] = static_cast(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(ruleStatusIdx); -// fStartBufIdx = nextIdx; -// if (update == UpdateCachePosition) { -// fBufIdx = nextIdx; -// fTextIdx = position; -// } -// return true; -// } - - -// void RuleBasedBreakIterator::BreakCache::dumpCache() { -// #ifdef RBBI_DEBUG -// RBBIDebugPrintf("fTextIdx:%d fBufIdx:%d\n", fTextIdx, fBufIdx); -// for (int32_t i=fStartBufIdx; ; i=modChunkSize(i+1)) { -// RBBIDebugPrintf("%d %d\n", i, fBoundaries[i]); -// if (i == fEndBufIdx) { -// break; -// } -// } -// #endif -// } - -// U_NAMESPACE_END - -// #endif // #if !UCONFIG_NO_BREAK_ITERATION diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.h b/src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.h index 21f134031..597312e85 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.h @@ -8,196 +8,196 @@ #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 +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/rbbi.h" +#include "unicode/uobject.h" + +#include "uvectr32.h" + +U_NAMESPACE_BEGIN + +/* DictionaryCache stores the boundaries obtained from a run of dictionary characters. + * Dictionary boundaries are moved first to this cache, then from here + * to the main BreakCache, where they may inter-leave with non-dictionary + * boundaries. The public BreakIterator API always fetches directly + * from the main BreakCache, not from here. + * + * In common situations, the number of boundaries in a single dictionary run + * should be quite small, it will be terminated by punctuation, spaces, + * or any other non-dictionary characters. The main BreakCache may end + * up with boundaries from multiple dictionary based runs. + * + * The boundaries are stored in a simple ArrayList (vector), with the + * assumption that they will be accessed sequentially. + */ +class RuleBasedBreakIterator::DictionaryCache: public UMemory { + public: + DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status); + ~DictionaryCache(); + + void reset(); + + UBool following(int32_t fromPos, int32_t *pos, int32_t *statusIndex); + UBool preceding(int32_t fromPos, int32_t *pos, int32_t *statusIndex); + + /** + * Populate the cache with the dictionary based boundaries within a region of text. + * @param startPos The start position of a range of text + * @param endPos The end position of a range of text + * @param firstRuleStatus The rule status index that applies to the break at startPos + * @param otherRuleStatus The rule status index that applies to boundaries other than startPos + * @internal + */ + void populateDictionary(int32_t startPos, int32_t endPos, + int32_t firstRuleStatus, int32_t otherRuleStatus); + + + + RuleBasedBreakIterator *fBI; + + UVector32 fBreaks; // A vector containing the boundaries. + int32_t fPositionInCache; // Index in fBreaks of last boundary returned by following() + // or preceding(). Optimizes sequential access. + int32_t fStart; // Text position of first boundary in cache. + int32_t fLimit; // Last boundary in cache. Which is the limit of the + // text segment being handled by the dictionary. + int32_t fFirstRuleStatusIndex; // Rule status info for first boundary. + int32_t fOtherRuleStatusIndex; // Rule status info for 2nd through last boundaries. +}; + + +/* + * class BreakCache + * + * Cache of break boundary positions and rule status values. + * Break iterator API functions, next(), previous(), etc., will use cached results + * when possible, and otherwise cache new results as they are obtained. + * + * Uniformly caches both dictionary and rule based (non-dictionary) boundaries. + * + * The cache is implemented as a single circular buffer. + */ + +/* + * size of the circular cache buffer. + */ + +class RuleBasedBreakIterator::BreakCache: public UMemory { + public: + BreakCache(RuleBasedBreakIterator *bi, UErrorCode &status); + virtual ~BreakCache(); + void reset(int32_t pos = 0, int32_t ruleStatus = 0); + void next() { if (fBufIdx == fEndBufIdx) { + nextOL(); + } else { + fBufIdx = modChunkSize(fBufIdx + 1); + fTextIdx = fBI->fPosition = fBoundaries[fBufIdx]; + fBI->fRuleStatusIndex = fStatuses[fBufIdx]; + } + } + + + void nextOL(); + void previous(UErrorCode &status); + + // Move the iteration state to the position following the startPosition. + // Input position must be pinned to the input length. + void following(int32_t startPosition, UErrorCode &status); + + void preceding(int32_t startPosition, UErrorCode &status); + + /* + * Update the state of the public BreakIterator (fBI) to reflect the + * current state of the break iterator cache (this). + */ + int32_t current(); + + /** + * Add boundaries to the cache near the specified position. + * The given position need not be a boundary itself. + * The input position must be within the range of the text, and + * on a code point boundary. + * If the requested position is a break boundary, leave the iteration + * position on it. + * If the requested position is not a boundary, leave the iteration + * position on the preceding boundary and include both the + * preceding and following boundaries in the cache. + * Additional boundaries, either preceding or following, may be added + * to the cache as a side effect. + * + * Return false if the operation failed. + */ + UBool populateNear(int32_t position, UErrorCode &status); + + /** + * Add boundary(s) to the cache following the current last boundary. + * Return false if at the end of the text, and no more boundaries can be added. + * Leave iteration position at the first newly added boundary, or unchanged if no boundary was added. + */ + UBool populateFollowing(); + + /** + * Add one or more boundaries to the cache preceding the first currently cached boundary. + * Leave the iteration position on the first added boundary. + * Return false if no boundaries could be added (if at the start of the text.) + */ + UBool populatePreceding(UErrorCode &status); + + enum UpdatePositionValues { + RetainCachePosition = 0, + UpdateCachePosition = 1 + }; + + /* + * Add the boundary following the current position. + * The current position can be left as it was, or changed to the newly added boundary, + * as specified by the update parameter. + */ + void addFollowing(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update); + + + /* + * Add the boundary preceding the current position. + * The current position can be left as it was, or changed to the newly added boundary, + * as specified by the update parameter. + */ + bool addPreceding(int32_t position, int32_t ruleStatusIdx, UpdatePositionValues update); + + /** + * Set the cache position to the specified position, or, if the position + * falls between to cached boundaries, to the preceding boundary. + * Fails if the requested position is outside of the range of boundaries currently held by the cache. + * The startPosition must be on a code point boundary. + * + * Return true if successful, false if the specified position is after + * the last cached boundary or before the first. + */ + UBool seek(int32_t startPosition); + + void dumpCache(); + + private: + static inline int32_t modChunkSize(int index) { return index & (CACHE_SIZE - 1); } + + static constexpr int32_t CACHE_SIZE = 128; + static_assert((CACHE_SIZE & (CACHE_SIZE-1)) == 0, "CACHE_SIZE must be power of two."); + + RuleBasedBreakIterator *fBI; + int32_t fStartBufIdx; + int32_t fEndBufIdx; // inclusive + + int32_t fTextIdx; + int32_t fBufIdx; + + int32_t fBoundaries[CACHE_SIZE]; + uint16_t fStatuses[CACHE_SIZE]; + + UVector32 fSideBuffer; +}; + +U_NAMESPACE_END + +#endif // #if !UCONFIG_NO_BREAK_ITERATION + +#endif // RBBI_CACHE_H diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbidata.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbidata.cpp deleted file mode 100644 index e1b6b569e..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbidata.cpp +++ /dev/null @@ -1,425 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -*************************************************************************** -* Copyright (C) 1999-2014 International Business Machines Corporation * -* and others. All rights reserved. * -*************************************************************************** -*/ - -#include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/utypes.h" -// #include "rbbidata.h" -// #include "rbbirb.h" -// #include "utrie2.h" -// #include "udatamem.h" -// #include "cmemory.h" -// #include "cstring.h" -// #include "umutex.h" - -// #include "uassert.h" - - -// U_NAMESPACE_BEGIN - -// //----------------------------------------------------------------------------- -// // -// // Constructors. -// // -// //----------------------------------------------------------------------------- -// RBBIDataWrapper::RBBIDataWrapper(const RBBIDataHeader *data, UErrorCode &status) { -// init0(); -// init(data, status); -// } - -// RBBIDataWrapper::RBBIDataWrapper(const RBBIDataHeader *data, enum EDontAdopt, UErrorCode &status) { -// init0(); -// init(data, status); -// fDontFreeData = TRUE; -// } - -// RBBIDataWrapper::RBBIDataWrapper(UDataMemory* udm, UErrorCode &status) { -// init0(); -// if (U_FAILURE(status)) { -// return; -// } -// const DataHeader *dh = udm->pHeader; -// int32_t headerSize = dh->dataHeader.headerSize; -// if ( !(headerSize >= 20 && -// dh->info.isBigEndian == U_IS_BIG_ENDIAN && -// dh->info.charsetFamily == U_CHARSET_FAMILY && -// dh->info.dataFormat[0] == 0x42 && // dataFormat="Brk " -// dh->info.dataFormat[1] == 0x72 && -// dh->info.dataFormat[2] == 0x6b && -// dh->info.dataFormat[3] == 0x20 && -// isDataVersionAcceptable(dh->info.formatVersion)) -// ) { -// status = U_INVALID_FORMAT_ERROR; -// return; -// } -// const char *dataAsBytes = reinterpret_cast(dh); -// const RBBIDataHeader *rbbidh = reinterpret_cast(dataAsBytes + headerSize); -// init(rbbidh, 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 -// // constructors. -// // -// //----------------------------------------------------------------------------- -// void RBBIDataWrapper::init0() { -// fHeader = NULL; -// fForwardTable = NULL; -// fReverseTable = NULL; -// fRuleSource = NULL; -// fRuleStatusTable = NULL; -// fTrie = NULL; -// fUDataMem = NULL; -// fRefCount = 0; -// fDontFreeData = TRUE; -// } - -// void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) { -// if (U_FAILURE(status)) { -// return; -// } -// fHeader = data; -// if (fHeader->fMagic != 0xb1a0 || !isDataVersionAcceptable(fHeader->fFormatVersion)) { -// status = U_INVALID_FORMAT_ERROR; -// return; -// } -// // Note: in ICU version 3.2 and earlier, there was a formatVersion 1 -// // that is no longer supported. At that time fFormatVersion was -// // an int32_t field, rather than an array of 4 bytes. - -// fDontFreeData = FALSE; -// if (data->fFTableLen != 0) { -// fForwardTable = (RBBIStateTable *)((char *)data + fHeader->fFTable); -// } -// if (data->fRTableLen != 0) { -// fReverseTable = (RBBIStateTable *)((char *)data + fHeader->fRTable); -// } - -// fTrie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS, -// (uint8_t *)data + fHeader->fTrie, -// fHeader->fTrieLen, -// NULL, // *actual length -// &status); -// if (U_FAILURE(status)) { -// return; -// } - -// fRuleSource = (UChar *)((char *)data + fHeader->fRuleSource); -// fRuleString.setTo(TRUE, fRuleSource, -1); -// U_ASSERT(data->fRuleSourceLen > 0); - -// fRuleStatusTable = (int32_t *)((char *)data + fHeader->fStatusTable); -// fStatusMaxIdx = data->fStatusTableLen / sizeof(int32_t); - -// fRefCount = 1; - -// #ifdef RBBI_DEBUG -// char *debugEnv = getenv("U_RBBIDEBUG"); -// if (debugEnv && uprv_strstr(debugEnv, "data")) {this->printData();} -// #endif -// } - - -// //----------------------------------------------------------------------------- -// // -// // Destructor. Don't call this - use removeReference() instead. -// // -// //----------------------------------------------------------------------------- -// RBBIDataWrapper::~RBBIDataWrapper() { -// U_ASSERT(fRefCount == 0); -// utrie2_close(fTrie); -// fTrie = NULL; -// if (fUDataMem) { -// udata_close(fUDataMem); -// } else if (!fDontFreeData) { -// uprv_free((void *)fHeader); -// } -// } - - - -// //----------------------------------------------------------------------------- -// // -// // Operator == Consider two RBBIDataWrappers to be equal if they -// // refer to the same underlying data. Although -// // the data wrappers are normally shared between -// // iterator instances, it's possible to independently -// // open the same data twice, and get two instances, which -// // should still be ==. -// // -// //----------------------------------------------------------------------------- -// UBool RBBIDataWrapper::operator ==(const RBBIDataWrapper &other) const { -// if (fHeader == other.fHeader) { -// return TRUE; -// } -// if (fHeader->fLength != other.fHeader->fLength) { -// return FALSE; -// } -// if (uprv_memcmp(fHeader, other.fHeader, fHeader->fLength) == 0) { -// return TRUE; -// } -// return FALSE; -// } - -// int32_t RBBIDataWrapper::hashCode() { -// return fHeader->fFTableLen; -// } - - - -// //----------------------------------------------------------------------------- -// // -// // Reference Counting. A single RBBIDataWrapper object is shared among -// // however many RulesBasedBreakIterator instances are -// // referencing the same data. -// // -// //----------------------------------------------------------------------------- -// void RBBIDataWrapper::removeReference() { -// if (umtx_atomic_dec(&fRefCount) == 0) { -// delete this; -// } -// } - - -// RBBIDataWrapper *RBBIDataWrapper::addReference() { -// umtx_atomic_inc(&fRefCount); -// return this; -// } - - - -// //----------------------------------------------------------------------------- -// // -// // getRuleSourceString -// // -// //----------------------------------------------------------------------------- -// const UnicodeString &RBBIDataWrapper::getRuleSourceString() const { -// return fRuleString; -// } - - -// //----------------------------------------------------------------------------- -// // -// // print - debugging function to dump the runtime data tables. -// // -// //----------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *table) { -// uint32_t c; -// uint32_t s; - -// RBBIDebugPrintf(" %s\n", heading); - -// RBBIDebugPrintf("State | Acc LA TagIx"); -// for (c=0; cfCatCount; c++) {RBBIDebugPrintf("%3d ", c);} -// RBBIDebugPrintf("\n------|---------------"); for (c=0;cfCatCount; c++) { -// RBBIDebugPrintf("----"); -// } -// RBBIDebugPrintf("\n"); - -// if (table == NULL) { -// RBBIDebugPrintf(" N U L L T A B L E\n\n"); -// return; -// } -// for (s=0; sfNumStates; s++) { -// RBBIStateTableRow *row = (RBBIStateTableRow *) -// (table->fTableData + (table->fRowLen * s)); -// RBBIDebugPrintf("%4d | %3d %3d %3d ", s, row->fAccepting, row->fLookAhead, row->fTagIdx); -// for (c=0; cfCatCount; c++) { -// RBBIDebugPrintf("%3d ", row->fNextState[c]); -// } -// RBBIDebugPrintf("\n"); -// } -// RBBIDebugPrintf("\n"); -// } -// #endif - - -// 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]); -// RBBIDebugPrintf(" total length of data = %d\n", fHeader->fLength); -// RBBIDebugPrintf(" number of character categories = %d\n\n", fHeader->fCatCount); - -// printTable("Forward State Transition Table", fForwardTable); -// printTable("Reverse State Transition Table", fReverseTable); - -// 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 -// U_NAMESPACE_USE - -// //----------------------------------------------------------------------------- -// // -// // ubrk_swap - byte swap and char encoding swap of RBBI data -// // -// //----------------------------------------------------------------------------- - -// U_CAPI int32_t U_EXPORT2 -// ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, -// UErrorCode *status) { - -// if (status == NULL || U_FAILURE(*status)) { -// return 0; -// } -// if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) { -// *status=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// // -// // Check that the data header is for for break data. -// // (Header contents are defined in genbrk.cpp) -// // -// const UDataInfo *pInfo = (const UDataInfo *)((const char *)inData+4); -// if(!( pInfo->dataFormat[0]==0x42 && /* dataFormat="Brk " */ -// pInfo->dataFormat[1]==0x72 && -// pInfo->dataFormat[2]==0x6b && -// pInfo->dataFormat[3]==0x20 && -// 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], -// pInfo->formatVersion[0]); -// *status=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// // -// // Swap the data header. (This is the generic ICU Data Header, not the RBBI Specific -// // RBBIDataHeader). This swap also conveniently gets us -// // the size of the ICU d.h., which lets us locate the start -// // of the RBBI specific data. -// // -// int32_t headerSize=udata_swapDataHeader(ds, inData, length, outData, status); - - -// // -// // Get the RRBI Data Header, and check that it appears to be OK. -// // -// const uint8_t *inBytes =(const uint8_t *)inData+headerSize; -// RBBIDataHeader *rbbiDH = (RBBIDataHeader *)inBytes; -// if (ds->readUInt32(rbbiDH->fMagic) != 0xb1a0 || -// !RBBIDataWrapper::isDataVersionAcceptable(rbbiDH->fFormatVersion) || -// ds->readUInt32(rbbiDH->fLength) < sizeof(RBBIDataHeader)) { -// udata_printError(ds, "ubrk_swap(): RBBI Data header is invalid.\n"); -// *status=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// // -// // Prefight operation? Just return the size -// // -// int32_t breakDataLength = ds->readUInt32(rbbiDH->fLength); -// int32_t totalSize = headerSize + breakDataLength; -// if (length < 0) { -// return totalSize; -// } - -// // -// // Check that length passed in is consistent with length from RBBI data header. -// // -// if (length < totalSize) { -// udata_printError(ds, "ubrk_swap(): too few bytes (%d after ICU Data header) for break data.\n", -// breakDataLength); -// *status=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } - - -// // -// // Swap the Data. Do the data itself first, then the RBBI Data Header, because -// // we need to reference the header to locate the data, and an -// // inplace swap of the header leaves it unusable. -// // -// uint8_t *outBytes = (uint8_t *)outData + headerSize; -// RBBIDataHeader *outputDH = (RBBIDataHeader *)outBytes; - -// int32_t tableStartOffset; -// int32_t tableLength; - -// // -// // If not swapping in place, zero out the output buffer before starting. -// // Individual tables and other data items within are aligned to 8 byte boundaries -// // when originally created. Any unused space between items needs to be zero. -// // -// if (inBytes != outBytes) { -// uprv_memset(outBytes, 0, breakDataLength); -// } - -// // -// // Each state table begins with several 32 bit fields. Calculate the size -// // in bytes of these. -// // -// int32_t topSize = offsetof(RBBIStateTable, fTableData); - -// // Forward state table. -// tableStartOffset = ds->readUInt32(rbbiDH->fFTable); -// tableLength = ds->readUInt32(rbbiDH->fFTableLen); - -// if (tableLength > 0) { -// ds->swapArray32(ds, inBytes+tableStartOffset, topSize, -// outBytes+tableStartOffset, status); -// ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize, -// outBytes+tableStartOffset+topSize, status); -// } - -// // Reverse state table. Same layout as forward table, above. -// tableStartOffset = ds->readUInt32(rbbiDH->fRTable); -// tableLength = ds->readUInt32(rbbiDH->fRTableLen); - -// 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 -// 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), -// outBytes+ds->readUInt32(rbbiDH->fRuleSource), status); - -// // Table of rule status values. It's all int_32 values -// ds->swapArray32(ds, inBytes+ds->readUInt32(rbbiDH->fStatusTable), ds->readUInt32(rbbiDH->fStatusTableLen), -// outBytes+ds->readUInt32(rbbiDH->fStatusTable), status); - -// // And, last, the header. -// // It is all int32_t values except for fFormataVersion, which is an array of four bytes. -// // Swap the whole thing as int32_t, then re-swap the one field. -// // -// ds->swapArray32(ds, inBytes, sizeof(RBBIDataHeader), outBytes, status); -// ds->swapArray32(ds, outputDH->fFormatVersion, 4, outputDH->fFormatVersion, status); - -// return totalSize; -// } - - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbidata.h b/src/duckdb/extension/icu/third_party/icu/common/rbbidata.h index b7de6ce07..c48de3d93 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbidata.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbidata.h @@ -49,16 +49,17 @@ ubrk_swap(const UDataSwapper *ds, #ifdef __cplusplus +#include "unicode/ucptrie.h" #include "unicode/uobject.h" #include "unicode/unistr.h" #include "unicode/uversion.h" #include "umutex.h" -#include "utrie2.h" + U_NAMESPACE_BEGIN // The current RBBI data format version. -static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {5, 0, 0, 0}; +static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {6, 0, 0, 0}; /* * The following structs map exactly onto the raw data from ICU common data file. @@ -84,7 +85,7 @@ struct RBBIDataHeader { uint32_t fTrie; /* Offset to Trie data for character categories */ uint32_t fTrieLen; uint32_t fRuleSource; /* Offset to the source for for the break */ - uint32_t fRuleSourceLen; /* rules. Stored UChar *. */ + uint32_t fRuleSourceLen; /* rules. Stored char16_t *. */ uint32_t fStatusTable; /* Offset to the table of rule status values */ uint32_t fStatusTableLen; @@ -94,49 +95,61 @@ struct RBBIDataHeader { -struct RBBIStateTableRow { - int16_t fAccepting; /* Non-zero if this row is for an accepting state. */ - /* Value 0: not an accepting state. */ - /* -1: Unconditional Accepting state. */ - /* positive: Look-ahead match has completed. */ - /* Actual boundary position happened earlier */ - /* Value here == fLookAhead in earlier */ - /* state, at actual boundary pos. */ - int16_t fLookAhead; /* Non-zero if this row is for a state that */ - /* corresponds to a '/' in the rule source. */ - /* Value is the same as the fAccepting */ - /* value for the rule (which will appear */ - /* in a different state. */ - int16_t fTagIdx; /* Non-zero if this row covers a {tagged} position */ - /* from a rule. Value is the index in the */ - /* StatusTable of the set of matching */ - /* tags (rule status values) */ - int16_t fReserved; - uint16_t fNextState[1]; /* Next State, indexed by char category. */ - /* Variable-length array declared with length 1 */ - /* to disable bounds checkers. */ - /* Array Size is actually fData->fHeader->fCatCount*/ - /* CAUTION: see RBBITableBuilder::getTableSize() */ - /* before changing anything here. */ +template +struct RBBIStateTableRowT { + T fAccepting; // Non-zero if this row is for an accepting state. + // Value 0: not an accepting state. + // 1: (ACCEPTING_UNCONDITIONAL) Unconditional Accepting state. + // >1: Look-ahead match has completed. + // Actual boundary position happened earlier. + // Value here == fLookAhead in earlier + // state, at actual boundary pos. + T fLookAhead; // Non-zero if this row is for a state that + // corresponds to a '/' in the rule source. + // Value is the same as the fAccepting + // value for the rule (which will appear + // in a different state. + T fTagsIdx; // Non-zero if this row covers a {tagged} position + // from a rule. Value is the index in the + // StatusTable of the set of matching + // tags (rule status values) + T fNextState[1]; // Next State, indexed by char category. + // Variable-length array declared with length 1 + // to disable bounds checkers. + // Array Size is actually fData->fHeader->fCatCount + // CAUTION: see RBBITableBuilder::getTableSize() + // before changing anything here. }; +typedef RBBIStateTableRowT RBBIStateTableRow8; +typedef RBBIStateTableRowT RBBIStateTableRow16; + +constexpr uint16_t ACCEPTING_UNCONDITIONAL = 1; // Value constant for RBBIStateTableRow::fAccepting + +union RBBIStateTableRow { + RBBIStateTableRow16 r16; + RBBIStateTableRow8 r8; +}; struct RBBIStateTable { - uint32_t fNumStates; /* Number of states. */ - uint32_t fRowLen; /* Length of a state table row, in bytes. */ - uint32_t fFlags; /* Option Flags for this state table */ - uint32_t fReserved; /* reserved */ - char fTableData[1]; /* First RBBIStateTableRow begins here. */ - /* Variable-length array declared with length 1 */ - /* to disable bounds checkers. */ - /* (making it char[] simplifies ugly address */ - /* arithmetic for indexing variable length rows.) */ + uint32_t fNumStates; // Number of states. + uint32_t fRowLen; // Length of a state table row, in bytes. + uint32_t fDictCategoriesStart; // Char category number of the first dictionary + // char class, or the the largest category number + 1 + // if there are no dictionary categories. + uint32_t fLookAheadResultsSize; // Size of run-time array required for holding + // look-ahead results. Indexed by row.fLookAhead. + uint32_t fFlags; // Option Flags for this state table. + char fTableData[1]; // First RBBIStateTableRow begins here. + // Variable-length array declared with length 1 + // to disable bounds checkers. + // (making it char[] simplifies ugly address + // arithmetic for indexing variable length rows.) }; -typedef enum { - RBBI_LOOKAHEAD_HARD_BREAK = 1, - RBBI_BOF_REQUIRED = 2 -} RBBIStateTableFlags; +constexpr uint32_t RBBI_LOOKAHEAD_HARD_BREAK = 1; +constexpr uint32_t RBBI_BOF_REQUIRED = 2; +constexpr uint32_t RBBI_8BITS_ROWS = 4; /* */ @@ -158,7 +171,7 @@ class RBBIDataWrapper : public UMemory { void init(const RBBIDataHeader *data, UErrorCode &status); RBBIDataWrapper *addReference(); void removeReference(); - UBool operator ==(const RBBIDataWrapper &other) const; + bool operator ==(const RBBIDataWrapper &other) const; int32_t hashCode(); const UnicodeString &getRuleSourceString() const; void printData(); @@ -170,13 +183,13 @@ class RBBIDataWrapper : public UMemory { const RBBIDataHeader *fHeader; const RBBIStateTable *fForwardTable; const RBBIStateTable *fReverseTable; - const UChar *fRuleSource; + const char *fRuleSource; const int32_t *fRuleStatusTable; /* number of int32_t values in the rule status table. Used to sanity check indexing */ int32_t fStatusMaxIdx; - UTrie2 *fTrie; + UCPTrie *fTrie; private: u_atomic_int32_t fRefCount; @@ -184,14 +197,16 @@ class RBBIDataWrapper : public UMemory { UnicodeString fRuleString; UBool fDontFreeData; - RBBIDataWrapper(const RBBIDataWrapper &other); /* forbid copying of this class */ - RBBIDataWrapper &operator=(const RBBIDataWrapper &other); /* forbid copying of this class */ + RBBIDataWrapper(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */ + RBBIDataWrapper &operator=(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */ }; U_NAMESPACE_END +U_CFUNC UBool rbbi_cleanup(); + #endif /* C++ */ #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbinode.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbinode.cpp deleted file mode 100644 index 4f6c379a4..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbinode.cpp +++ /dev/null @@ -1,372 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -*************************************************************************** -* Copyright (C) 2002-2016 International Business Machines Corporation * -* and others. All rights reserved. * -*************************************************************************** -*/ - -// -// File: rbbinode.cpp -// -// Implementation of class RBBINode, which represents a node in the -// tree generated when parsing the Rules Based Break Iterator rules. -// -// This "Class" is actually closer to a struct. -// Code using it is expected to directly access fields much of the time. -// - -#include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/unistr.h" -// #include "unicode/uniset.h" -// #include "unicode/uchar.h" -// #include "unicode/parsepos.h" - -// #include "cstr.h" -// #include "uvector.h" - -// #include "rbbirb.h" -// #include "rbbinode.h" - -// #include "uassert.h" - - -// U_NAMESPACE_BEGIN - -// #ifdef RBBI_DEBUG -// static int gLastSerial = 0; -// #endif - - -// //------------------------------------------------------------------------- -// // -// // Constructor. Just set the fields to reasonable default values. -// // -// //------------------------------------------------------------------------- -// RBBINode::RBBINode(NodeType t) : UMemory() { -// #ifdef RBBI_DEBUG -// fSerialNum = ++gLastSerial; -// #endif -// fType = t; -// fParent = NULL; -// fLeftChild = NULL; -// fRightChild = NULL; -// fInputSet = NULL; -// fFirstPos = 0; -// fLastPos = 0; -// fNullable = FALSE; -// fLookAheadEnd = FALSE; -// fRuleRoot = FALSE; -// fChainIn = FALSE; -// fVal = 0; -// fPrecedence = precZero; - -// UErrorCode status = U_ZERO_ERROR; -// fFirstPosSet = new UVector(status); // TODO - get a real status from somewhere -// fLastPosSet = new UVector(status); -// fFollowPos = new UVector(status); -// if (t==opCat) {fPrecedence = precOpCat;} -// else if (t==opOr) {fPrecedence = precOpOr;} -// else if (t==opStart) {fPrecedence = precStart;} -// else if (t==opLParen) {fPrecedence = precLParen;} - -// } - - -// RBBINode::RBBINode(const RBBINode &other) : UMemory(other) { -// #ifdef RBBI_DEBUG -// fSerialNum = ++gLastSerial; -// #endif -// fType = other.fType; -// fParent = NULL; -// fLeftChild = NULL; -// fRightChild = NULL; -// fInputSet = other.fInputSet; -// fPrecedence = other.fPrecedence; -// fText = other.fText; -// fFirstPos = other.fFirstPos; -// fLastPos = other.fLastPos; -// fNullable = other.fNullable; -// fVal = other.fVal; -// fRuleRoot = FALSE; -// fChainIn = other.fChainIn; -// UErrorCode status = U_ZERO_ERROR; -// fFirstPosSet = new UVector(status); // TODO - get a real status from somewhere -// fLastPosSet = new UVector(status); -// fFollowPos = new UVector(status); -// } - - -// //------------------------------------------------------------------------- -// // -// // Destructor. Deletes both this node AND any child nodes, -// // except in the case of variable reference nodes. For -// // these, the l. child points back to the definition, which -// // is common for all references to the variable, meaning -// // it can't be deleted here. -// // -// //------------------------------------------------------------------------- -// RBBINode::~RBBINode() { -// // printf("deleting node %8x serial %4d\n", this, this->fSerialNum); -// delete fInputSet; -// fInputSet = NULL; - -// switch (this->fType) { -// case varRef: -// case setRef: -// // for these node types, multiple instances point to the same "children" -// // Storage ownership of children handled elsewhere. Don't delete here. -// break; - -// default: -// delete fLeftChild; -// fLeftChild = NULL; -// delete fRightChild; -// fRightChild = NULL; -// } - - -// delete fFirstPosSet; -// delete fLastPosSet; -// delete fFollowPos; - -// } - - -// //------------------------------------------------------------------------- -// // -// // cloneTree Make a copy of the subtree rooted at this node. -// // Discard any variable references encountered along the way, -// // and replace with copies of the variable's definitions. -// // Used to replicate the expression underneath variable -// // references in preparation for generating the DFA tables. -// // -// //------------------------------------------------------------------------- -// RBBINode *RBBINode::cloneTree() { -// RBBINode *n; - -// if (fType == RBBINode::varRef) { -// // If the current node is a variable reference, skip over it -// // and clone the definition of the variable instead. -// n = fLeftChild->cloneTree(); -// } else if (fType == RBBINode::uset) { -// n = this; -// } else { -// n = new RBBINode(*this); -// // Check for null pointer. -// if (n != NULL) { -// if (fLeftChild != NULL) { -// n->fLeftChild = fLeftChild->cloneTree(); -// n->fLeftChild->fParent = n; -// } -// if (fRightChild != NULL) { -// n->fRightChild = fRightChild->cloneTree(); -// n->fRightChild->fParent = n; -// } -// } -// } -// return n; -// } - - - -// //------------------------------------------------------------------------- -// // -// // flattenVariables Walk a parse tree, replacing any variable -// // references with a copy of the variable's definition. -// // Aside from variables, the tree is not changed. -// // -// // Return the root of the tree. If the root was not a variable -// // reference, it remains unchanged - the root we started with -// // is the root we return. If, however, the root was a variable -// // reference, the root of the newly cloned replacement tree will -// // be returned, and the original tree deleted. -// // -// // This function works by recursively walking the tree -// // without doing anything until a variable reference is -// // found, then calling cloneTree() at that point. Any -// // nested references are handled by cloneTree(), not here. -// // -// //------------------------------------------------------------------------- -// RBBINode *RBBINode::flattenVariables() { -// if (fType == varRef) { -// RBBINode *retNode = fLeftChild->cloneTree(); -// if (retNode != NULL) { -// retNode->fRuleRoot = this->fRuleRoot; -// retNode->fChainIn = this->fChainIn; -// } -// delete this; // TODO: undefined behavior. Fix. -// return retNode; -// } - -// if (fLeftChild != NULL) { -// fLeftChild = fLeftChild->flattenVariables(); -// fLeftChild->fParent = this; -// } -// if (fRightChild != NULL) { -// fRightChild = fRightChild->flattenVariables(); -// fRightChild->fParent = this; -// } -// return this; -// } - - -// //------------------------------------------------------------------------- -// // -// // flattenSets Walk the parse tree, replacing any nodes of type setRef -// // with a copy of the expression tree for the set. A set's -// // equivalent expression tree is precomputed and saved as -// // the left child of the uset node. -// // -// //------------------------------------------------------------------------- -// void RBBINode::flattenSets() { -// U_ASSERT(fType != setRef); - -// if (fLeftChild != NULL) { -// if (fLeftChild->fType==setRef) { -// RBBINode *setRefNode = fLeftChild; -// RBBINode *usetNode = setRefNode->fLeftChild; -// RBBINode *replTree = usetNode->fLeftChild; -// fLeftChild = replTree->cloneTree(); -// fLeftChild->fParent = this; -// delete setRefNode; -// } else { -// fLeftChild->flattenSets(); -// } -// } - -// if (fRightChild != NULL) { -// if (fRightChild->fType==setRef) { -// RBBINode *setRefNode = fRightChild; -// RBBINode *usetNode = setRefNode->fLeftChild; -// RBBINode *replTree = usetNode->fLeftChild; -// fRightChild = replTree->cloneTree(); -// fRightChild->fParent = this; -// delete setRefNode; -// } else { -// fRightChild->flattenSets(); -// } -// } -// } - - - -// //------------------------------------------------------------------------- -// // -// // findNodes() Locate all the nodes of the specified type, starting -// // at the specified root. -// // -// //------------------------------------------------------------------------- -// void RBBINode::findNodes(UVector *dest, RBBINode::NodeType kind, UErrorCode &status) { -// /* test for buffer overflows */ -// if (U_FAILURE(status)) { -// return; -// } -// if (fType == kind) { -// dest->addElement(this, status); -// } -// if (fLeftChild != NULL) { -// fLeftChild->findNodes(dest, kind, status); -// } -// if (fRightChild != NULL) { -// fRightChild->findNodes(dest, kind, status); -// } -// } - - -// //------------------------------------------------------------------------- -// // -// // print. Print out a single node, for debugging. -// // -// //------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG - -// static int32_t serial(const RBBINode *node) { -// return (node == NULL? -1 : node->fSerialNum); -// } - - -// void RBBINode::printNode(const RBBINode *node) { -// static const char * const nodeTypeNames[] = { -// "setRef", -// "uset", -// "varRef", -// "leafChar", -// "lookAhead", -// "tag", -// "endMark", -// "opStart", -// "opCat", -// "opOr", -// "opStar", -// "opPlus", -// "opQuestion", -// "opBreak", -// "opReverse", -// "opLParen" -// }; - -// if (node==NULL) { -// RBBIDebugPrintf("%10p", (void *)node); -// } else { -// RBBIDebugPrintf("%10p %5d %12s %c%c %5d %5d %5d %6d %d ", -// (void *)node, node->fSerialNum, nodeTypeNames[node->fType], -// node->fRuleRoot?'R':' ', node->fChainIn?'C':' ', -// serial(node->fLeftChild), serial(node->fRightChild), serial(node->fParent), -// node->fFirstPos, node->fVal); -// if (node->fType == varRef) { -// RBBI_DEBUG_printUnicodeString(node->fText); -// } -// } -// RBBIDebugPrintf("\n"); -// } -// #endif - - -// #ifdef RBBI_DEBUG -// U_CFUNC void RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth) { -// RBBIDebugPrintf("%*s", minWidth, CStr(s)()); -// } -// #endif - - -// //------------------------------------------------------------------------- -// // -// // print. Print out the tree of nodes rooted at "this" -// // -// //------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// void RBBINode::printNodeHeader() { -// RBBIDebugPrintf(" Address serial type LeftChild RightChild Parent position value\n"); -// } - -// void RBBINode::printTree(const RBBINode *node, UBool printHeading) { -// if (printHeading) { -// printNodeHeader(); -// } -// printNode(node); -// if (node != NULL) { -// // Only dump the definition under a variable reference if asked to. -// // Unconditinally dump children of all other node types. -// if (node->fType != varRef) { -// if (node->fLeftChild != NULL) { -// printTree(node->fLeftChild, FALSE); -// } - -// if (node->fRightChild != NULL) { -// printTree(node->fRightChild, FALSE); -// } -// } -// } -// } -// #endif - - - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbinode.h b/src/duckdb/extension/icu/third_party/icu/common/rbbinode.h index a30cccc0b..4ed84d4e0 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbinode.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbinode.h @@ -71,7 +71,7 @@ class RBBINode : public UMemory { int fLastPos; // Last position in the rule source string // of any text associated with this node. // If there's a right child, this will be the same - // as that child's last postion. + // as that child's last position. UBool fNullable; // See Aho. int32_t fVal; // For leafChar nodes, the value. @@ -79,7 +79,7 @@ class RBBINode : public UMemory { // corresponds to columns in the final // state transition table. - UBool fLookAheadEnd; // For endMark nodes, set TRUE if + UBool fLookAheadEnd; // For endMark nodes, set true if // marking the end of a look-ahead rule. UBool fRuleRoot; // True if this node is the root of a rule. @@ -108,7 +108,7 @@ class RBBINode : public UMemory { private: RBBINode &operator = (const RBBINode &other); // No defs. - bool operator == (const RBBINode &other); // Private, so these functions won't accidently be used. + bool operator == (const RBBINode &other); // Private, so these functions won't accidentally be used. #ifdef RBBI_DEBUG public: diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbirb.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbirb.cpp deleted file mode 100644 index 17a33143a..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbirb.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -// -// file: rbbirb.cpp -// -// Copyright (C) 2002-2011, International Business Machines Corporation and others. -// All Rights Reserved. -// -// This file contains the RBBIRuleBuilder class implementation. This is the main class for -// building (compiling) break rules into the tables required by the runtime -// RBBI engine. -// - -#include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/brkiter.h" -// #include "unicode/rbbi.h" -// #include "unicode/ubrk.h" -// #include "unicode/unistr.h" -// #include "unicode/uniset.h" -// #include "unicode/uchar.h" -// #include "unicode/uchriter.h" -// #include "unicode/parsepos.h" -// #include "unicode/parseerr.h" - -// #include "cmemory.h" -// #include "cstring.h" -// #include "rbbirb.h" -// #include "rbbinode.h" -// #include "rbbiscan.h" -// #include "rbbisetb.h" -// #include "rbbitblb.h" -// #include "rbbidata.h" -// #include "uassert.h" - - -// U_NAMESPACE_BEGIN - - -// //---------------------------------------------------------------------------------------- -// // -// // Constructor. -// // -// //---------------------------------------------------------------------------------------- -// RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString &rules, -// UParseError *parseErr, -// UErrorCode &status) -// : fRules(rules), fStrippedRules(rules) -// { -// fStatus = &status; // status is checked below -// fParseError = parseErr; -// fDebugEnv = NULL; -// #ifdef RBBI_DEBUG -// fDebugEnv = getenv("U_RBBIDEBUG"); -// #endif - - -// fForwardTree = NULL; -// fReverseTree = NULL; -// fSafeFwdTree = NULL; -// fSafeRevTree = NULL; -// fDefaultTree = &fForwardTree; -// fForwardTable = NULL; -// fRuleStatusVals = NULL; -// fChainRules = FALSE; -// fLBCMNoChain = FALSE; -// fLookAheadHardBreak = FALSE; -// fUSetNodes = NULL; -// fRuleStatusVals = NULL; -// fScanner = NULL; -// fSetBuilder = NULL; -// if (parseErr) { -// uprv_memset(parseErr, 0, sizeof(UParseError)); -// } - -// if (U_FAILURE(status)) { -// return; -// } - -// fUSetNodes = new UVector(status); // bcos status gets overwritten here -// fRuleStatusVals = new UVector(status); -// fScanner = new RBBIRuleScanner(this); -// fSetBuilder = new RBBISetBuilder(this); -// if (U_FAILURE(status)) { -// return; -// } -// if(fSetBuilder == 0 || fScanner == 0 || fUSetNodes == 0 || fRuleStatusVals == 0) { -// status = U_MEMORY_ALLOCATION_ERROR; -// } -// } - - - -// //---------------------------------------------------------------------------------------- -// // -// // Destructor -// // -// //---------------------------------------------------------------------------------------- -// RBBIRuleBuilder::~RBBIRuleBuilder() { - -// int i; -// for (i=0; ; i++) { -// RBBINode *n = (RBBINode *)fUSetNodes->elementAt(i); -// if (n==NULL) { -// break; -// } -// delete n; -// } - -// delete fUSetNodes; -// delete fSetBuilder; -// delete fForwardTable; -// delete fForwardTree; -// delete fReverseTree; -// delete fSafeFwdTree; -// delete fSafeRevTree; -// delete fScanner; -// delete fRuleStatusVals; -// } - - - - - -// //---------------------------------------------------------------------------------------- -// // -// // flattenData() - Collect up the compiled RBBI rule data and put it into -// // the format for saving in ICU data files, -// // which is also the format needed by the RBBI runtime engine. -// // -// //---------------------------------------------------------------------------------------- -// static int32_t align8(int32_t i) {return (i+7) & 0xfffffff8;} - -// RBBIDataHeader *RBBIRuleBuilder::flattenData() { -// int32_t i; - -// if (U_FAILURE(*fStatus)) { -// return NULL; -// } - -// // Remove whitespace from the rules to make it smaller. -// // The rule parser has already removed comments. -// fStrippedRules = fScanner->stripRules(fStrippedRules); - -// // Calculate the size of each section in the data. -// // Sizes here are padded up to a multiple of 8 for better memory alignment. -// // Sections sizes actually stored in the header are for the actual data -// // without the padding. -// // -// int32_t headerSize = align8(sizeof(RBBIDataHeader)); -// int32_t forwardTableSize = align8(fForwardTable->getTableSize()); -// int32_t reverseTableSize = align8(fForwardTable->getSafeTableSize()); -// int32_t trieSize = align8(fSetBuilder->getTrieSize()); -// int32_t statusTableSize = align8(fRuleStatusVals->size() * sizeof(int32_t)); -// int32_t rulesSize = align8((fStrippedRules.length()+1) * sizeof(UChar)); - -// int32_t totalSize = headerSize -// + forwardTableSize -// + reverseTableSize -// + statusTableSize + trieSize + rulesSize; - -// RBBIDataHeader *data = (RBBIDataHeader *)uprv_malloc(totalSize); -// if (data == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// uprv_memset(data, 0, totalSize); - - -// data->fMagic = 0xb1a0; -// data->fFormatVersion[0] = RBBI_DATA_FORMAT_VERSION[0]; -// data->fFormatVersion[1] = RBBI_DATA_FORMAT_VERSION[1]; -// data->fFormatVersion[2] = RBBI_DATA_FORMAT_VERSION[2]; -// data->fFormatVersion[3] = RBBI_DATA_FORMAT_VERSION[3]; -// data->fLength = totalSize; -// data->fCatCount = fSetBuilder->getNumCharCategories(); - -// data->fFTable = headerSize; -// data->fFTableLen = forwardTableSize; - -// data->fRTable = data->fFTable + data->fFTableLen; -// data->fRTableLen = reverseTableSize; - -// data->fTrie = data->fRTable + data->fRTableLen; -// data->fTrieLen = fSetBuilder->getTrieSize(); -// data->fStatusTable = data->fTrie + trieSize; -// data->fStatusTableLen= statusTableSize; -// data->fRuleSource = data->fStatusTable + statusTableSize; -// data->fRuleSourceLen = fStrippedRules.length() * sizeof(UChar); - -// uprv_memset(data->fReserved, 0, sizeof(data->fReserved)); - -// fForwardTable->exportTable((uint8_t *)data + data->fFTable); -// fForwardTable->exportSafeTable((uint8_t *)data + data->fRTable); -// fSetBuilder->serializeTrie ((uint8_t *)data + data->fTrie); - -// int32_t *ruleStatusTable = (int32_t *)((uint8_t *)data + data->fStatusTable); -// for (i=0; isize(); i++) { -// ruleStatusTable[i] = fRuleStatusVals->elementAti(i); -// } - -// fStrippedRules.extract((UChar *)((uint8_t *)data+data->fRuleSource), rulesSize/2+1, *fStatus); - -// return data; -// } - - -// //---------------------------------------------------------------------------------------- -// // -// // createRuleBasedBreakIterator construct from source rules that are passed in -// // in a UnicodeString -// // -// //---------------------------------------------------------------------------------------- -// BreakIterator * -// RBBIRuleBuilder::createRuleBasedBreakIterator( const UnicodeString &rules, -// UParseError *parseError, -// UErrorCode &status) -// { -// // -// // Read the input rules, generate a parse tree, symbol table, -// // and list of all Unicode Sets referenced by the rules. -// // -// RBBIRuleBuilder builder(rules, parseError, status); -// if (U_FAILURE(status)) { // status checked here bcos build below doesn't -// return NULL; -// } - -// RBBIDataHeader *data = builder.build(status); - -// if (U_FAILURE(status)) { -// return nullptr; -// } - -// // -// // Create a break iterator from the compiled rules. -// // (Identical to creation from stored pre-compiled rules) -// // -// // status is checked after init in construction. -// RuleBasedBreakIterator *This = new RuleBasedBreakIterator(data, status); -// if (U_FAILURE(status)) { -// delete This; -// This = NULL; -// } -// else if(This == NULL) { // test for NULL -// status = U_MEMORY_ALLOCATION_ERROR; -// } -// return This; -// } - -// RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) { -// if (U_FAILURE(status)) { -// return nullptr; -// } - -// fScanner->parse(); -// if (U_FAILURE(status)) { -// return nullptr; -// } - -// // -// // UnicodeSet processing. -// // Munge the Unicode Sets to create a set of character categories. -// // Generate the mapping tables (TRIE) from input code points to -// // the character categories. -// // -// fSetBuilder->buildRanges(); - -// // -// // Generate the DFA state transition table. -// // -// fForwardTable = new RBBITableBuilder(this, &fForwardTree, status); -// if (fForwardTable == nullptr) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return nullptr; -// } - -// fForwardTable->buildForwardTable(); -// optimizeTables(); -// fForwardTable->buildSafeReverseTable(status); - - -// #ifdef RBBI_DEBUG -// if (fDebugEnv && uprv_strstr(fDebugEnv, "states")) { -// fForwardTable->printStates(); -// fForwardTable->printRuleStatusTable(); -// fForwardTable->printReverseTable(); -// } -// #endif - -// fSetBuilder->buildTrie(); - -// // -// // Package up the compiled data into a memory image -// // in the run-time format. -// // -// RBBIDataHeader *data = flattenData(); // returns NULL if error -// if (U_FAILURE(status)) { -// return nullptr; -// } -// return data; -// } - -// void RBBIRuleBuilder::optimizeTables() { -// bool didSomething; -// do { -// didSomething = false; - -// // Begin looking for duplicates with char class 3. -// // Classes 0, 1 and 2 are special; they are unused, {bof} and {eof} respectively, -// // and should not have other categories merged into them. -// IntPair duplPair = {3, 0}; -// while (fForwardTable->findDuplCharClassFrom(&duplPair)) { -// fSetBuilder->mergeCategories(duplPair); -// fForwardTable->removeColumn(duplPair.second); -// didSomething = true; -// } - -// while (fForwardTable->removeDuplicateStates() > 0) { -// didSomething = true; -// } -// } while (didSomething); -// } - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbirb.h b/src/duckdb/extension/icu/third_party/icu/common/rbbirb.h index 203936cb4..96d3aa643 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbirb.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbirb.h @@ -1,237 +1,234 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// // -// // rbbirb.h -// // -// // Copyright (C) 2002-2008, International Business Machines Corporation and others. -// // All Rights Reserved. -// // -// // This file contains declarations for several classes from the -// // Rule Based Break Iterator rule builder. -// // - - -// #ifndef RBBIRB_H -// #define RBBIRB_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include - -// #include "unicode/uobject.h" -// #include "unicode/rbbi.h" -// #include "unicode/uniset.h" -// #include "unicode/parseerr.h" -// #include "uhash.h" -// #include "uvector.h" -// #include "unicode/symtable.h"// For UnicodeSet parsing, is the interface that -// // looks up references to $variables within a set. - - -// U_NAMESPACE_BEGIN - -// class RBBIRuleScanner; -// struct RBBIRuleTableEl; -// class RBBISetBuilder; -// class RBBINode; -// class RBBITableBuilder; - - - -// //-------------------------------------------------------------------------------- -// // -// // RBBISymbolTable. Implements SymbolTable interface that is used by the -// // UnicodeSet parser to resolve references to $variables. -// // -// //-------------------------------------------------------------------------------- -// class RBBISymbolTableEntry : public UMemory { // The symbol table hash table contains one -// public: // of these structs for each entry. -// RBBISymbolTableEntry(); -// UnicodeString key; -// RBBINode *val; -// ~RBBISymbolTableEntry(); - -// private: -// RBBISymbolTableEntry(const RBBISymbolTableEntry &other); // forbid copying of this class -// RBBISymbolTableEntry &operator=(const RBBISymbolTableEntry &other); // forbid copying of this class -// }; - - -// class RBBISymbolTable : public UMemory, public SymbolTable { -// private: -// const UnicodeString &fRules; -// UHashtable *fHashTable; -// RBBIRuleScanner *fRuleScanner; - -// // These next two fields are part of the mechanism for passing references to -// // already-constructed UnicodeSets back to the UnicodeSet constructor -// // when the pattern includes $variable references. -// const UnicodeString ffffString; // = "/uffff" -// UnicodeSet *fCachedSetLookup; - -// public: -// // API inherited from class SymbolTable -// virtual const UnicodeString* lookup(const UnicodeString& s) const; -// virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const; -// virtual UnicodeString parseReference(const UnicodeString& text, -// ParsePosition& pos, int32_t limit) const; - -// // Additional Functions -// RBBISymbolTable(RBBIRuleScanner *, const UnicodeString &fRules, UErrorCode &status); -// virtual ~RBBISymbolTable(); - -// virtual RBBINode *lookupNode(const UnicodeString &key) const; -// virtual void addEntry (const UnicodeString &key, RBBINode *val, UErrorCode &err); - -// #ifdef RBBI_DEBUG -// virtual void rbbiSymtablePrint() const; -// #else -// // A do-nothing inline function for non-debug builds. Member funcs can't be empty -// // or the call sites won't compile. -// int32_t fFakeField; -// #define rbbiSymtablePrint() fFakeField=0; -// #endif - -// private: -// RBBISymbolTable(const RBBISymbolTable &other); // forbid copying of this class -// RBBISymbolTable &operator=(const RBBISymbolTable &other); // forbid copying of this class -// }; - - -// //-------------------------------------------------------------------------------- -// // -// // class RBBIRuleBuilder The top-level class handling RBBI rule compiling. -// // -// //-------------------------------------------------------------------------------- -// class RBBIRuleBuilder : public UMemory { -// public: - -// // Create a rule based break iterator from a set of rules. -// // This function is the main entry point into the rule builder. The -// // public ICU API for creating RBBIs uses this function to do the actual work. -// // -// static BreakIterator * createRuleBasedBreakIterator( const UnicodeString &rules, -// UParseError *parseError, -// UErrorCode &status); - -// public: -// // The "public" functions and data members that appear below are accessed -// // (and shared) by the various parts that make up the rule builder. They -// // are NOT intended to be accessed by anything outside of the -// // rule builder implementation. -// RBBIRuleBuilder(const UnicodeString &rules, -// UParseError *parseErr, -// UErrorCode &status -// ); - -// virtual ~RBBIRuleBuilder(); - -// /** -// * Build the state tables and char class Trie from the source rules. -// */ -// RBBIDataHeader *build(UErrorCode &status); - - -// /** -// * Fold together redundant character classes (table columns) and -// * redundant states (table rows). Done after initial table generation, -// * before serializing the result. -// */ -// void optimizeTables(); - -// char *fDebugEnv; // controls debug trace output -// UErrorCode *fStatus; // Error reporting. Keeping status -// UParseError *fParseError; // here avoids passing it everywhere. -// const UnicodeString &fRules; // The rule string that we are compiling -// UnicodeString fStrippedRules; // The rule string, with comments stripped. - -// RBBIRuleScanner *fScanner; // The scanner. -// RBBINode *fForwardTree; // The parse trees, generated by the scanner, -// RBBINode *fReverseTree; // then manipulated by subsequent steps. -// RBBINode *fSafeFwdTree; -// RBBINode *fSafeRevTree; - -// RBBINode **fDefaultTree; // For rules not qualified with a ! -// // the tree to which they belong to. - -// UBool fChainRules; // True for chained Unicode TR style rules. -// // False for traditional regexp rules. - -// UBool fLBCMNoChain; // True: suppress chaining of rules on -// // chars with LineBreak property == CM. - -// UBool fLookAheadHardBreak; // True: Look ahead matches cause an -// // immediate break, no continuing for the -// // longest match. - -// RBBISetBuilder *fSetBuilder; // Set and Character Category builder. -// UVector *fUSetNodes; // Vector of all uset nodes. - -// RBBITableBuilder *fForwardTable; // State transition table, build time form. - -// UVector *fRuleStatusVals; // The values that can be returned -// // from getRuleStatus(). - -// RBBIDataHeader *flattenData(); // Create the flattened (runtime format) -// // data tables.. -// private: -// RBBIRuleBuilder(const RBBIRuleBuilder &other); // forbid copying of this class -// RBBIRuleBuilder &operator=(const RBBIRuleBuilder &other); // forbid copying of this class -// }; - - - - -// //---------------------------------------------------------------------------- -// // -// // RBBISetTableEl is an entry in the hash table of UnicodeSets that have -// // been encountered. The val Node will be of nodetype uset -// // and contain pointers to the actual UnicodeSets. -// // The Key is the source string for initializing the set. -// // -// // The hash table is used to avoid creating duplicate -// // unnamed (not $var references) UnicodeSets. -// // -// // Memory Management: -// // The Hash Table owns these RBBISetTableEl structs and -// // the key strings. It does NOT own the val nodes. -// // -// //---------------------------------------------------------------------------- -// struct RBBISetTableEl { -// UnicodeString *key; -// RBBINode *val; -// }; - -// /** -// * A pair of ints, used to bundle pairs of states or pairs of character classes. -// */ -// typedef std::pair IntPair; - - -// //---------------------------------------------------------------------------- -// // -// // RBBIDebugPrintf Printf equivalent, for debugging output. -// // Conditional compilation of the implementation lets us -// // get rid of the stdio dependency in environments where it -// // is unavailable. -// // -// //---------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// #include -// #define RBBIDebugPrintf printf -// #define RBBIDebugPuts puts -// #else -// #undef RBBIDebugPrintf -// #define RBBIDebugPuts(arg) -// #endif - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// rbbirb.h +// +// Copyright (C) 2002-2008, International Business Machines Corporation and others. +// All Rights Reserved. +// +// This file contains declarations for several classes from the +// Rule Based Break Iterator rule builder. +// + + +#ifndef RBBIRB_H +#define RBBIRB_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include + +#include "unicode/uobject.h" +#include "unicode/rbbi.h" +#include "unicode/uniset.h" +#include "unicode/parseerr.h" +#include "uhash.h" +#include "uvector.h" +#include "unicode/symtable.h"// For UnicodeSet parsing, is the interface that + // looks up references to $variables within a set. + + +U_NAMESPACE_BEGIN + +class RBBIRuleScanner; +struct RBBIRuleTableEl; +class RBBISetBuilder; +class RBBINode; +class RBBITableBuilder; + + + +//-------------------------------------------------------------------------------- +// +// RBBISymbolTable. Implements SymbolTable interface that is used by the +// UnicodeSet parser to resolve references to $variables. +// +//-------------------------------------------------------------------------------- +class RBBISymbolTableEntry : public UMemory { // The symbol table hash table contains one +public: // of these structs for each entry. + RBBISymbolTableEntry(); + UnicodeString key; + RBBINode *val; + ~RBBISymbolTableEntry(); + +private: + RBBISymbolTableEntry(const RBBISymbolTableEntry &other) = delete; // forbid copying of this class + RBBISymbolTableEntry &operator=(const RBBISymbolTableEntry &other) = delete; // forbid copying of this class +}; + + +class RBBISymbolTable : public UMemory, public SymbolTable { +private: + const UnicodeString &fRules; + UHashtable *fHashTable; + RBBIRuleScanner *fRuleScanner; + + // These next two fields are part of the mechanism for passing references to + // already-constructed UnicodeSets back to the UnicodeSet constructor + // when the pattern includes $variable references. + const UnicodeString ffffString; // = "/uffff" + UnicodeSet *fCachedSetLookup; + +public: + // API inherited from class SymbolTable + virtual const UnicodeString* lookup(const UnicodeString& s) const override; + virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const override; + virtual UnicodeString parseReference(const UnicodeString& text, + ParsePosition& pos, int32_t limit) const override; + + // Additional Functions + RBBISymbolTable(RBBIRuleScanner *, const UnicodeString &fRules, UErrorCode &status); + virtual ~RBBISymbolTable(); + + virtual RBBINode *lookupNode(const UnicodeString &key) const; + virtual void addEntry (const UnicodeString &key, RBBINode *val, UErrorCode &err); + +#ifdef RBBI_DEBUG + virtual void rbbiSymtablePrint() const; +#else + // A do-nothing inline function for non-debug builds. Member funcs can't be empty + // or the call sites won't compile. + int32_t fFakeField; + #define rbbiSymtablePrint() fFakeField=0; +#endif + +private: + RBBISymbolTable(const RBBISymbolTable &other); // forbid copying of this class + RBBISymbolTable &operator=(const RBBISymbolTable &other); // forbid copying of this class +}; + + +//-------------------------------------------------------------------------------- +// +// class RBBIRuleBuilder The top-level class handling RBBI rule compiling. +// +//-------------------------------------------------------------------------------- +class RBBIRuleBuilder : public UMemory { +public: + + // Create a rule based break iterator from a set of rules. + // This function is the main entry point into the rule builder. The + // public ICU API for creating RBBIs uses this function to do the actual work. + // + static BreakIterator * createRuleBasedBreakIterator( const UnicodeString &rules, + UParseError *parseError, + UErrorCode &status); + +public: + // The "public" functions and data members that appear below are accessed + // (and shared) by the various parts that make up the rule builder. They + // are NOT intended to be accessed by anything outside of the + // rule builder implementation. + RBBIRuleBuilder(const UnicodeString &rules, + UParseError *parseErr, + UErrorCode &status + ); + + virtual ~RBBIRuleBuilder(); + + /** + * Build the state tables and char class Trie from the source rules. + */ + RBBIDataHeader *build(UErrorCode &status); + + + /** + * Fold together redundant character classes (table columns) and + * redundant states (table rows). Done after initial table generation, + * before serializing the result. + */ + void optimizeTables(); + + char *fDebugEnv; // controls debug trace output + UErrorCode *fStatus; // Error reporting. Keeping status + UParseError *fParseError; // here avoids passing it everywhere. + const UnicodeString &fRules; // The rule string that we are compiling + UnicodeString fStrippedRules; // The rule string, with comments stripped. + + RBBIRuleScanner *fScanner; // The scanner. + RBBINode *fForwardTree; // The parse trees, generated by the scanner, + RBBINode *fReverseTree; // then manipulated by subsequent steps. + RBBINode *fSafeFwdTree; + RBBINode *fSafeRevTree; + + RBBINode **fDefaultTree; // For rules not qualified with a ! + // the tree to which they belong to. + + UBool fChainRules; // True for chained Unicode TR style rules. + // False for traditional regexp rules. + + UBool fLookAheadHardBreak; // True: Look ahead matches cause an + // immediate break, no continuing for the + // longest match. + + RBBISetBuilder *fSetBuilder; // Set and Character Category builder. + UVector *fUSetNodes; // Vector of all uset nodes. + + RBBITableBuilder *fForwardTable; // State transition table, build time form. + + UVector *fRuleStatusVals; // The values that can be returned + // from getRuleStatus(). + + RBBIDataHeader *flattenData(); // Create the flattened (runtime format) + // data tables.. +private: + RBBIRuleBuilder(const RBBIRuleBuilder &other) = delete; // forbid copying of this class + RBBIRuleBuilder &operator=(const RBBIRuleBuilder &other) = delete; // forbid copying of this class +}; + + + + +//---------------------------------------------------------------------------- +// +// RBBISetTableEl is an entry in the hash table of UnicodeSets that have +// been encountered. The val Node will be of nodetype uset +// and contain pointers to the actual UnicodeSets. +// The Key is the source string for initializing the set. +// +// The hash table is used to avoid creating duplicate +// unnamed (not $var references) UnicodeSets. +// +// Memory Management: +// The Hash Table owns these RBBISetTableEl structs and +// the key strings. It does NOT own the val nodes. +// +//---------------------------------------------------------------------------- +struct RBBISetTableEl { + UnicodeString *key; + RBBINode *val; +}; + +/** + * A pair of ints, used to bundle pairs of states or pairs of character classes. + */ +typedef std::pair IntPair; + + +//---------------------------------------------------------------------------- +// +// RBBIDebugPrintf Printf equivalent, for debugging output. +// Conditional compilation of the implementation lets us +// get rid of the stdio dependency in environments where it +// is unavailable. +// +//---------------------------------------------------------------------------- +#ifdef RBBI_DEBUG +#include +#define RBBIDebugPrintf printf +#define RBBIDebugPuts puts +#else +#undef RBBIDebugPrintf +#define RBBIDebugPuts(arg) +#endif + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbirpt.h b/src/duckdb/extension/icu/third_party/icu/common/rbbirpt.h index 586953c90..ca1bcf45d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbirpt.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbirpt.h @@ -79,110 +79,110 @@ struct RBBIRuleTableEl { }; static const struct RBBIRuleTableEl gRuleParseStateTable[] = { - {doNOP, 0, 0, 0, TRUE} - , {doExprStart, 254, 29, 9, FALSE} // 1 start - , {doNOP, 132, 1,0, TRUE} // 2 - , {doNoChain, 94 /* ^ */, 12, 9, TRUE} // 3 - , {doExprStart, 36 /* $ */, 88, 98, FALSE} // 4 - , {doNOP, 33 /* ! */, 19,0, TRUE} // 5 - , {doNOP, 59 /* ; */, 1,0, TRUE} // 6 - , {doNOP, 252, 0,0, FALSE} // 7 - , {doExprStart, 255, 29, 9, FALSE} // 8 - , {doEndOfRule, 59 /* ; */, 1,0, TRUE} // 9 break-rule-end - , {doNOP, 132, 9,0, TRUE} // 10 - , {doRuleError, 255, 103,0, FALSE} // 11 - , {doExprStart, 254, 29,0, FALSE} // 12 start-after-caret - , {doNOP, 132, 12,0, TRUE} // 13 - , {doRuleError, 94 /* ^ */, 103,0, FALSE} // 14 - , {doExprStart, 36 /* $ */, 88, 37, FALSE} // 15 - , {doRuleError, 59 /* ; */, 103,0, FALSE} // 16 - , {doRuleError, 252, 103,0, FALSE} // 17 - , {doExprStart, 255, 29,0, FALSE} // 18 - , {doNOP, 33 /* ! */, 21,0, TRUE} // 19 rev-option - , {doReverseDir, 255, 28, 9, FALSE} // 20 - , {doOptionStart, 130, 23,0, TRUE} // 21 option-scan1 - , {doRuleError, 255, 103,0, FALSE} // 22 - , {doNOP, 129, 23,0, TRUE} // 23 option-scan2 - , {doOptionEnd, 255, 25,0, FALSE} // 24 - , {doNOP, 59 /* ; */, 1,0, TRUE} // 25 option-scan3 - , {doNOP, 132, 25,0, TRUE} // 26 - , {doRuleError, 255, 103,0, FALSE} // 27 - , {doExprStart, 255, 29, 9, FALSE} // 28 reverse-rule - , {doRuleChar, 254, 38,0, TRUE} // 29 term - , {doNOP, 132, 29,0, TRUE} // 30 - , {doRuleChar, 131, 38,0, TRUE} // 31 - , {doNOP, 91 /* [ */, 94, 38, FALSE} // 32 - , {doLParen, 40 /* ( */, 29, 38, TRUE} // 33 - , {doNOP, 36 /* $ */, 88, 37, FALSE} // 34 - , {doDotAny, 46 /* . */, 38,0, TRUE} // 35 - , {doRuleError, 255, 103,0, FALSE} // 36 - , {doCheckVarDef, 255, 38,0, FALSE} // 37 term-var-ref - , {doNOP, 132, 38,0, TRUE} // 38 expr-mod - , {doUnaryOpStar, 42 /* * */, 43,0, TRUE} // 39 - , {doUnaryOpPlus, 43 /* + */, 43,0, TRUE} // 40 - , {doUnaryOpQuestion, 63 /* ? */, 43,0, TRUE} // 41 - , {doNOP, 255, 43,0, FALSE} // 42 - , {doExprCatOperator, 254, 29,0, FALSE} // 43 expr-cont - , {doNOP, 132, 43,0, TRUE} // 44 - , {doExprCatOperator, 131, 29,0, FALSE} // 45 - , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 46 - , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 47 - , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 48 - , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 49 - , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 50 - , {doExprCatOperator, 123 /* { */, 67,0, TRUE} // 51 - , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 52 - , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 53 - , {doExprFinished, 255, 255,0, FALSE} // 54 - , {doSlash, 47 /* / */, 57,0, TRUE} // 55 look-ahead - , {doNOP, 255, 103,0, FALSE} // 56 - , {doExprCatOperator, 254, 29,0, FALSE} // 57 expr-cont-no-slash - , {doNOP, 132, 43,0, TRUE} // 58 - , {doExprCatOperator, 131, 29,0, FALSE} // 59 - , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 60 - , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 61 - , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 62 - , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 63 - , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 64 - , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 65 - , {doExprFinished, 255, 255,0, FALSE} // 66 - , {doNOP, 132, 67,0, TRUE} // 67 tag-open - , {doStartTagValue, 128, 70,0, FALSE} // 68 - , {doTagExpectedError, 255, 103,0, FALSE} // 69 - , {doNOP, 132, 74,0, TRUE} // 70 tag-value - , {doNOP, 125 /* } */, 74,0, FALSE} // 71 - , {doTagDigit, 128, 70,0, TRUE} // 72 - , {doTagExpectedError, 255, 103,0, FALSE} // 73 - , {doNOP, 132, 74,0, TRUE} // 74 tag-close - , {doTagValue, 125 /* } */, 77,0, TRUE} // 75 - , {doTagExpectedError, 255, 103,0, FALSE} // 76 - , {doExprCatOperator, 254, 29,0, FALSE} // 77 expr-cont-no-tag - , {doNOP, 132, 77,0, TRUE} // 78 - , {doExprCatOperator, 131, 29,0, FALSE} // 79 - , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 80 - , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 81 - , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 82 - , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 83 - , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 84 - , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 85 - , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 86 - , {doExprFinished, 255, 255,0, FALSE} // 87 - , {doStartVariableName, 36 /* $ */, 90,0, TRUE} // 88 scan-var-name - , {doNOP, 255, 103,0, FALSE} // 89 - , {doNOP, 130, 92,0, TRUE} // 90 scan-var-start - , {doVariableNameExpectedErr, 255, 103,0, FALSE} // 91 - , {doNOP, 129, 92,0, TRUE} // 92 scan-var-body - , {doEndVariableName, 255, 255,0, FALSE} // 93 - , {doScanUnicodeSet, 91 /* [ */, 255,0, TRUE} // 94 scan-unicode-set - , {doScanUnicodeSet, 112 /* p */, 255,0, TRUE} // 95 - , {doScanUnicodeSet, 80 /* P */, 255,0, TRUE} // 96 - , {doNOP, 255, 103,0, FALSE} // 97 - , {doNOP, 132, 98,0, TRUE} // 98 assign-or-rule - , {doStartAssign, 61 /* = */, 29, 101, TRUE} // 99 - , {doNOP, 255, 37, 9, FALSE} // 100 - , {doEndAssign, 59 /* ; */, 1,0, TRUE} // 101 assign-end - , {doRuleErrorAssignExpr, 255, 103,0, FALSE} // 102 - , {doExit, 255, 103,0, TRUE} // 103 errorDeath + {doNOP, 0, 0, 0, true} + , {doExprStart, 254, 29, 9, false} // 1 start + , {doNOP, 132, 1,0, true} // 2 + , {doNoChain, 94 /* ^ */, 12, 9, true} // 3 + , {doExprStart, 36 /* $ */, 88, 98, false} // 4 + , {doNOP, 33 /* ! */, 19,0, true} // 5 + , {doNOP, 59 /* ; */, 1,0, true} // 6 + , {doNOP, 252, 0,0, false} // 7 + , {doExprStart, 255, 29, 9, false} // 8 + , {doEndOfRule, 59 /* ; */, 1,0, true} // 9 break-rule-end + , {doNOP, 132, 9,0, true} // 10 + , {doRuleError, 255, 103,0, false} // 11 + , {doExprStart, 254, 29,0, false} // 12 start-after-caret + , {doNOP, 132, 12,0, true} // 13 + , {doRuleError, 94 /* ^ */, 103,0, false} // 14 + , {doExprStart, 36 /* $ */, 88, 37, false} // 15 + , {doRuleError, 59 /* ; */, 103,0, false} // 16 + , {doRuleError, 252, 103,0, false} // 17 + , {doExprStart, 255, 29,0, false} // 18 + , {doNOP, 33 /* ! */, 21,0, true} // 19 rev-option + , {doReverseDir, 255, 28, 9, false} // 20 + , {doOptionStart, 130, 23,0, true} // 21 option-scan1 + , {doRuleError, 255, 103,0, false} // 22 + , {doNOP, 129, 23,0, true} // 23 option-scan2 + , {doOptionEnd, 255, 25,0, false} // 24 + , {doNOP, 59 /* ; */, 1,0, true} // 25 option-scan3 + , {doNOP, 132, 25,0, true} // 26 + , {doRuleError, 255, 103,0, false} // 27 + , {doExprStart, 255, 29, 9, false} // 28 reverse-rule + , {doRuleChar, 254, 38,0, true} // 29 term + , {doNOP, 132, 29,0, true} // 30 + , {doRuleChar, 131, 38,0, true} // 31 + , {doNOP, 91 /* [ */, 94, 38, false} // 32 + , {doLParen, 40 /* ( */, 29, 38, true} // 33 + , {doNOP, 36 /* $ */, 88, 37, false} // 34 + , {doDotAny, 46 /* . */, 38,0, true} // 35 + , {doRuleError, 255, 103,0, false} // 36 + , {doCheckVarDef, 255, 38,0, false} // 37 term-var-ref + , {doNOP, 132, 38,0, true} // 38 expr-mod + , {doUnaryOpStar, 42 /* * */, 43,0, true} // 39 + , {doUnaryOpPlus, 43 /* + */, 43,0, true} // 40 + , {doUnaryOpQuestion, 63 /* ? */, 43,0, true} // 41 + , {doNOP, 255, 43,0, false} // 42 + , {doExprCatOperator, 254, 29,0, false} // 43 expr-cont + , {doNOP, 132, 43,0, true} // 44 + , {doExprCatOperator, 131, 29,0, false} // 45 + , {doExprCatOperator, 91 /* [ */, 29,0, false} // 46 + , {doExprCatOperator, 40 /* ( */, 29,0, false} // 47 + , {doExprCatOperator, 36 /* $ */, 29,0, false} // 48 + , {doExprCatOperator, 46 /* . */, 29,0, false} // 49 + , {doExprCatOperator, 47 /* / */, 55,0, false} // 50 + , {doExprCatOperator, 123 /* { */, 67,0, true} // 51 + , {doExprOrOperator, 124 /* | */, 29,0, true} // 52 + , {doExprRParen, 41 /* ) */, 255,0, true} // 53 + , {doExprFinished, 255, 255,0, false} // 54 + , {doSlash, 47 /* / */, 57,0, true} // 55 look-ahead + , {doNOP, 255, 103,0, false} // 56 + , {doExprCatOperator, 254, 29,0, false} // 57 expr-cont-no-slash + , {doNOP, 132, 43,0, true} // 58 + , {doExprCatOperator, 131, 29,0, false} // 59 + , {doExprCatOperator, 91 /* [ */, 29,0, false} // 60 + , {doExprCatOperator, 40 /* ( */, 29,0, false} // 61 + , {doExprCatOperator, 36 /* $ */, 29,0, false} // 62 + , {doExprCatOperator, 46 /* . */, 29,0, false} // 63 + , {doExprOrOperator, 124 /* | */, 29,0, true} // 64 + , {doExprRParen, 41 /* ) */, 255,0, true} // 65 + , {doExprFinished, 255, 255,0, false} // 66 + , {doNOP, 132, 67,0, true} // 67 tag-open + , {doStartTagValue, 128, 70,0, false} // 68 + , {doTagExpectedError, 255, 103,0, false} // 69 + , {doNOP, 132, 74,0, true} // 70 tag-value + , {doNOP, 125 /* } */, 74,0, false} // 71 + , {doTagDigit, 128, 70,0, true} // 72 + , {doTagExpectedError, 255, 103,0, false} // 73 + , {doNOP, 132, 74,0, true} // 74 tag-close + , {doTagValue, 125 /* } */, 77,0, true} // 75 + , {doTagExpectedError, 255, 103,0, false} // 76 + , {doExprCatOperator, 254, 29,0, false} // 77 expr-cont-no-tag + , {doNOP, 132, 77,0, true} // 78 + , {doExprCatOperator, 131, 29,0, false} // 79 + , {doExprCatOperator, 91 /* [ */, 29,0, false} // 80 + , {doExprCatOperator, 40 /* ( */, 29,0, false} // 81 + , {doExprCatOperator, 36 /* $ */, 29,0, false} // 82 + , {doExprCatOperator, 46 /* . */, 29,0, false} // 83 + , {doExprCatOperator, 47 /* / */, 55,0, false} // 84 + , {doExprOrOperator, 124 /* | */, 29,0, true} // 85 + , {doExprRParen, 41 /* ) */, 255,0, true} // 86 + , {doExprFinished, 255, 255,0, false} // 87 + , {doStartVariableName, 36 /* $ */, 90,0, true} // 88 scan-var-name + , {doNOP, 255, 103,0, false} // 89 + , {doNOP, 130, 92,0, true} // 90 scan-var-start + , {doVariableNameExpectedErr, 255, 103,0, false} // 91 + , {doNOP, 129, 92,0, true} // 92 scan-var-body + , {doEndVariableName, 255, 255,0, false} // 93 + , {doScanUnicodeSet, 91 /* [ */, 255,0, true} // 94 scan-unicode-set + , {doScanUnicodeSet, 112 /* p */, 255,0, true} // 95 + , {doScanUnicodeSet, 80 /* P */, 255,0, true} // 96 + , {doNOP, 255, 103,0, false} // 97 + , {doNOP, 132, 98,0, true} // 98 assign-or-rule + , {doStartAssign, 61 /* = */, 29, 101, true} // 99 + , {doNOP, 255, 37, 9, false} // 100 + , {doEndAssign, 59 /* ; */, 1,0, true} // 101 assign-end + , {doRuleErrorAssignExpr, 255, 103,0, false} // 102 + , {doExit, 255, 103,0, true} // 103 errorDeath }; #ifdef RBBI_DEBUG static const char * const RBBIRuleStateNames[] = { 0, diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.cpp deleted file mode 100644 index 143bb5914..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.cpp +++ /dev/null @@ -1,1279 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// // -// // file: rbbiscan.cpp -// // -// // Copyright (C) 2002-2016, International Business Machines Corporation and others. -// // All Rights Reserved. -// // -// // This file contains the Rule Based Break Iterator Rule Builder functions for -// // scanning the rules and assembling a parse tree. This is the first phase -// // of compiling the rules. -// // -// // The overall of the rules is managed by class RBBIRuleBuilder, which will -// // create and use an instance of this class as part of the process. -// // - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/unistr.h" -// #include "unicode/uniset.h" -// #include "unicode/uchar.h" -// #include "unicode/uchriter.h" -// #include "unicode/parsepos.h" -// #include "unicode/parseerr.h" -// #include "cmemory.h" -// #include "cstring.h" - -// #include "rbbirpt.h" // Contains state table for the rbbi rules parser. -// // generated by a Perl script. -// #include "rbbirb.h" -// #include "rbbinode.h" -// #include "rbbiscan.h" -// #include "rbbitblb.h" - -// #include "uassert.h" - -// //------------------------------------------------------------------------------ -// // -// // Unicode Set init strings for each of the character classes needed for parsing a rule file. -// // (Initialized with hex values for portability to EBCDIC based machines. -// // Really ugly, but there's no good way to avoid it.) -// // -// // The sets are referred to by name in the rbbirpt.txt, which is the -// // source form of the state transition table for the RBBI rule parser. -// // -// //------------------------------------------------------------------------------ -// static const UChar gRuleSet_rule_char_pattern[] = { -// // Characters that may appear as literals in patterns without escaping or quoting. -// // [ ^ [ \ p { Z } \ u 0 0 2 0 -// 0x5b, 0x5e, 0x5b, 0x5c, 0x70, 0x7b, 0x5a, 0x7d, 0x5c, 0x75, 0x30, 0x30, 0x32, 0x30, -// // - \ u 0 0 7 f ] - [ \ p -// 0x2d, 0x5c, 0x75, 0x30, 0x30, 0x37, 0x66, 0x5d, 0x2d, 0x5b, 0x5c, 0x70, -// // { L } ] - [ \ p { N } ] ] -// 0x7b, 0x4c, 0x7d, 0x5d, 0x2d, 0x5b, 0x5c, 0x70, 0x7b, 0x4e, 0x7d, 0x5d, 0x5d, 0}; - -// static const UChar gRuleSet_name_char_pattern[] = { -// // [ _ \ p { L } \ p { N } ] -// 0x5b, 0x5f, 0x5c, 0x70, 0x7b, 0x4c, 0x7d, 0x5c, 0x70, 0x7b, 0x4e, 0x7d, 0x5d, 0}; - -// static const UChar gRuleSet_digit_char_pattern[] = { -// // [ 0 - 9 ] -// 0x5b, 0x30, 0x2d, 0x39, 0x5d, 0}; - -// static const UChar gRuleSet_name_start_char_pattern[] = { -// // [ _ \ p { L } ] -// 0x5b, 0x5f, 0x5c, 0x70, 0x7b, 0x4c, 0x7d, 0x5d, 0 }; - -// static const UChar kAny[] = {0x61, 0x6e, 0x79, 0x00}; // "any" - - -// U_CDECL_BEGIN -// static void U_CALLCONV RBBISetTable_deleter(void *p) { -// icu::RBBISetTableEl *px = (icu::RBBISetTableEl *)p; -// delete px->key; -// // Note: px->val is owned by the linked list "fSetsListHead" in scanner. -// // Don't delete the value nodes here. -// uprv_free(px); -// } -// U_CDECL_END - -// U_NAMESPACE_BEGIN - -// //------------------------------------------------------------------------------ -// // -// // Constructor. -// // -// //------------------------------------------------------------------------------ -// RBBIRuleScanner::RBBIRuleScanner(RBBIRuleBuilder *rb) -// { -// fRB = rb; -// fScanIndex = 0; -// fNextIndex = 0; -// fQuoteMode = FALSE; -// fLineNum = 1; -// fCharNum = 0; -// fLastChar = 0; - -// fStateTable = NULL; -// fStack[0] = 0; -// fStackPtr = 0; -// fNodeStack[0] = NULL; -// fNodeStackPtr = 0; - -// fReverseRule = FALSE; -// fLookAheadRule = FALSE; -// fNoChainInRule = FALSE; - -// fSymbolTable = NULL; -// fSetTable = NULL; -// fRuleNum = 0; -// fOptionStart = 0; - -// // Do not check status until after all critical fields are sufficiently initialized -// // that the destructor can run cleanly. -// if (U_FAILURE(*rb->fStatus)) { -// return; -// } - -// // -// // Set up the constant Unicode Sets. -// // Note: These could be made static, lazily initialized, and shared among -// // all instances of RBBIRuleScanners. BUT this is quite a bit simpler, -// // and the time to build these few sets should be small compared to a -// // full break iterator build. -// fRuleSets[kRuleSet_rule_char-128] -// = UnicodeSet(UnicodeString(gRuleSet_rule_char_pattern), *rb->fStatus); -// // fRuleSets[kRuleSet_white_space-128] = [:Pattern_White_Space:] -// fRuleSets[kRuleSet_white_space-128]. -// add(9, 0xd).add(0x20).add(0x85).add(0x200e, 0x200f).add(0x2028, 0x2029); -// fRuleSets[kRuleSet_name_char-128] -// = UnicodeSet(UnicodeString(gRuleSet_name_char_pattern), *rb->fStatus); -// fRuleSets[kRuleSet_name_start_char-128] -// = UnicodeSet(UnicodeString(gRuleSet_name_start_char_pattern), *rb->fStatus); -// fRuleSets[kRuleSet_digit_char-128] -// = UnicodeSet(UnicodeString(gRuleSet_digit_char_pattern), *rb->fStatus); -// if (*rb->fStatus == U_ILLEGAL_ARGUMENT_ERROR) { -// // This case happens if ICU's data is missing. UnicodeSet tries to look up property -// // names from the init string, can't find them, and claims an illegal argument. -// // Change the error so that the actual problem will be clearer to users. -// *rb->fStatus = U_BRK_INIT_ERROR; -// } -// if (U_FAILURE(*rb->fStatus)) { -// return; -// } - -// fSymbolTable = new RBBISymbolTable(this, rb->fRules, *rb->fStatus); -// if (fSymbolTable == NULL) { -// *rb->fStatus = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// fSetTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, rb->fStatus); -// if (U_FAILURE(*rb->fStatus)) { -// return; -// } -// uhash_setValueDeleter(fSetTable, RBBISetTable_deleter); -// } - - - -// //------------------------------------------------------------------------------ -// // -// // Destructor -// // -// //------------------------------------------------------------------------------ -// RBBIRuleScanner::~RBBIRuleScanner() { -// delete fSymbolTable; -// if (fSetTable != NULL) { -// uhash_close(fSetTable); -// fSetTable = NULL; - -// } - - -// // Node Stack. -// // Normally has one entry, which is the entire parse tree for the rules. -// // If errors occurred, there may be additional subtrees left on the stack. -// while (fNodeStackPtr > 0) { -// delete fNodeStack[fNodeStackPtr]; -// fNodeStackPtr--; -// } - -// } - -// //------------------------------------------------------------------------------ -// // -// // doParseAction Do some action during rule parsing. -// // Called by the parse state machine. -// // Actions build the parse tree and Unicode Sets, -// // and maintain the parse stack for nested expressions. -// // -// // TODO: unify EParseAction and RBBI_RuleParseAction enum types. -// // They represent exactly the same thing. They're separate -// // only to work around enum forward declaration restrictions -// // in some compilers, while at the same time avoiding multiple -// // definitions problems. I'm sure that there's a better way. -// // -// //------------------------------------------------------------------------------ -// UBool RBBIRuleScanner::doParseActions(int32_t action) -// { -// RBBINode *n = NULL; - -// UBool returnVal = TRUE; - -// switch (action) { - -// case doExprStart: -// pushNewNode(RBBINode::opStart); -// fRuleNum++; -// break; - - -// case doNoChain: -// // Scanned a '^' while on the rule start state. -// fNoChainInRule = TRUE; -// break; - - -// case doExprOrOperator: -// { -// fixOpStack(RBBINode::precOpCat); -// RBBINode *operandNode = fNodeStack[fNodeStackPtr--]; -// RBBINode *orNode = pushNewNode(RBBINode::opOr); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// orNode->fLeftChild = operandNode; -// operandNode->fParent = orNode; -// } -// break; - -// case doExprCatOperator: -// // concatenation operator. -// // For the implicit concatenation of adjacent terms in an expression that are -// // not separated by any other operator. Action is invoked between the -// // actions for the two terms. -// { -// fixOpStack(RBBINode::precOpCat); -// RBBINode *operandNode = fNodeStack[fNodeStackPtr--]; -// RBBINode *catNode = pushNewNode(RBBINode::opCat); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// catNode->fLeftChild = operandNode; -// operandNode->fParent = catNode; -// } -// break; - -// case doLParen: -// // Open Paren. -// // The openParen node is a dummy operation type with a low precedence, -// // which has the affect of ensuring that any real binary op that -// // follows within the parens binds more tightly to the operands than -// // stuff outside of the parens. -// pushNewNode(RBBINode::opLParen); -// break; - -// case doExprRParen: -// fixOpStack(RBBINode::precLParen); -// break; - -// case doNOP: -// break; - -// case doStartAssign: -// // We've just scanned "$variable = " -// // The top of the node stack has the $variable ref node. - -// // Save the start position of the RHS text in the StartExpression node -// // that precedes the $variableReference node on the stack. -// // This will eventually be used when saving the full $variable replacement -// // text as a string. -// n = fNodeStack[fNodeStackPtr-1]; -// n->fFirstPos = fNextIndex; // move past the '=' - -// // Push a new start-of-expression node; needed to keep parse of the -// // RHS expression happy. -// pushNewNode(RBBINode::opStart); -// break; - - - - -// case doEndAssign: -// { -// // We have reached the end of an assignement statement. -// // Current scan char is the ';' that terminates the assignment. - -// // Terminate expression, leaves expression parse tree rooted in TOS node. -// fixOpStack(RBBINode::precStart); - -// RBBINode *startExprNode = fNodeStack[fNodeStackPtr-2]; -// RBBINode *varRefNode = fNodeStack[fNodeStackPtr-1]; -// RBBINode *RHSExprNode = fNodeStack[fNodeStackPtr]; - -// // Save original text of right side of assignment, excluding the terminating ';' -// // in the root of the node for the right-hand-side expression. -// RHSExprNode->fFirstPos = startExprNode->fFirstPos; -// RHSExprNode->fLastPos = fScanIndex; -// fRB->fRules.extractBetween(RHSExprNode->fFirstPos, RHSExprNode->fLastPos, RHSExprNode->fText); - -// // Expression parse tree becomes l. child of the $variable reference node. -// varRefNode->fLeftChild = RHSExprNode; -// RHSExprNode->fParent = varRefNode; - -// // Make a symbol table entry for the $variableRef node. -// fSymbolTable->addEntry(varRefNode->fText, varRefNode, *fRB->fStatus); -// if (U_FAILURE(*fRB->fStatus)) { -// // This is a round-about way to get the parse position set -// // so that duplicate symbols error messages include a line number. -// UErrorCode t = *fRB->fStatus; -// *fRB->fStatus = U_ZERO_ERROR; -// error(t); -// } - -// // Clean up the stack. -// delete startExprNode; -// fNodeStackPtr-=3; -// break; -// } - -// case doEndOfRule: -// { -// fixOpStack(RBBINode::precStart); // Terminate expression, leaves expression -// if (U_FAILURE(*fRB->fStatus)) { // parse tree rooted in TOS node. -// break; -// } -// #ifdef RBBI_DEBUG -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "rtree")) {printNodeStack("end of rule");} -// #endif -// U_ASSERT(fNodeStackPtr == 1); -// RBBINode *thisRule = fNodeStack[fNodeStackPtr]; - -// // If this rule includes a look-ahead '/', add a endMark node to the -// // expression tree. -// if (fLookAheadRule) { -// RBBINode *endNode = pushNewNode(RBBINode::endMark); -// RBBINode *catNode = pushNewNode(RBBINode::opCat); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// fNodeStackPtr -= 2; -// catNode->fLeftChild = thisRule; -// catNode->fRightChild = endNode; -// fNodeStack[fNodeStackPtr] = catNode; -// endNode->fVal = fRuleNum; -// endNode->fLookAheadEnd = TRUE; -// thisRule = catNode; - -// // TODO: Disable chaining out of look-ahead (hard break) rules. -// // The break on rule match is forced, so there is no point in building up -// // the state table to chain into another rule for a longer match. -// } - -// // Mark this node as being the root of a rule. -// thisRule->fRuleRoot = TRUE; - -// // Flag if chaining into this rule is wanted. -// // -// if (fRB->fChainRules && // If rule chaining is enabled globally via !!chain -// !fNoChainInRule) { // and no '^' chain-in inhibit was on this rule -// thisRule->fChainIn = TRUE; -// } - - -// // All rule expressions are ORed together. -// // The ';' that terminates an expression really just functions as a '|' with -// // a low operator prededence. -// // -// // Each of the four sets of rules are collected separately. -// // (forward, reverse, safe_forward, safe_reverse) -// // OR this rule into the appropriate group of them. -// // -// RBBINode **destRules = (fReverseRule? &fRB->fSafeRevTree : fRB->fDefaultTree); - -// if (*destRules != NULL) { -// // This is not the first rule encounted. -// // OR previous stuff (from *destRules) -// // with the current rule expression (on the Node Stack) -// // with the resulting OR expression going to *destRules -// // -// thisRule = fNodeStack[fNodeStackPtr]; -// RBBINode *prevRules = *destRules; -// RBBINode *orNode = pushNewNode(RBBINode::opOr); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// orNode->fLeftChild = prevRules; -// prevRules->fParent = orNode; -// orNode->fRightChild = thisRule; -// thisRule->fParent = orNode; -// *destRules = orNode; -// } -// else -// { -// // This is the first rule encountered (for this direction). -// // Just move its parse tree from the stack to *destRules. -// *destRules = fNodeStack[fNodeStackPtr]; -// } -// fReverseRule = FALSE; // in preparation for the next rule. -// fLookAheadRule = FALSE; -// fNoChainInRule = FALSE; -// fNodeStackPtr = 0; -// } -// break; - - -// case doRuleError: -// error(U_BRK_RULE_SYNTAX); -// returnVal = FALSE; -// break; - - -// case doVariableNameExpectedErr: -// error(U_BRK_RULE_SYNTAX); -// break; - - -// // -// // Unary operands + ? * -// // These all appear after the operand to which they apply. -// // When we hit one, the operand (may be a whole sub expression) -// // will be on the top of the stack. -// // Unary Operator becomes TOS, with the old TOS as its one child. -// case doUnaryOpPlus: -// { -// RBBINode *operandNode = fNodeStack[fNodeStackPtr--]; -// RBBINode *plusNode = pushNewNode(RBBINode::opPlus); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// plusNode->fLeftChild = operandNode; -// operandNode->fParent = plusNode; -// } -// break; - -// case doUnaryOpQuestion: -// { -// RBBINode *operandNode = fNodeStack[fNodeStackPtr--]; -// RBBINode *qNode = pushNewNode(RBBINode::opQuestion); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// qNode->fLeftChild = operandNode; -// operandNode->fParent = qNode; -// } -// break; - -// case doUnaryOpStar: -// { -// RBBINode *operandNode = fNodeStack[fNodeStackPtr--]; -// RBBINode *starNode = pushNewNode(RBBINode::opStar); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// starNode->fLeftChild = operandNode; -// operandNode->fParent = starNode; -// } -// break; - -// case doRuleChar: -// // A "Rule Character" is any single character that is a literal part -// // of the regular expression. Like a, b and c in the expression "(abc*) | [:L:]" -// // These are pretty uncommon in break rules; the terms are more commonly -// // sets. To keep things uniform, treat these characters like as -// // sets that just happen to contain only one character. -// { -// n = pushNewNode(RBBINode::setRef); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// findSetFor(UnicodeString(fC.fChar), n); -// n->fFirstPos = fScanIndex; -// n->fLastPos = fNextIndex; -// fRB->fRules.extractBetween(n->fFirstPos, n->fLastPos, n->fText); -// break; -// } - -// case doDotAny: -// // scanned a ".", meaning match any single character. -// { -// n = pushNewNode(RBBINode::setRef); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// findSetFor(UnicodeString(TRUE, kAny, 3), n); -// n->fFirstPos = fScanIndex; -// n->fLastPos = fNextIndex; -// fRB->fRules.extractBetween(n->fFirstPos, n->fLastPos, n->fText); -// break; -// } - -// case doSlash: -// // Scanned a '/', which identifies a look-ahead break position in a rule. -// n = pushNewNode(RBBINode::lookAhead); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// n->fVal = fRuleNum; -// n->fFirstPos = fScanIndex; -// n->fLastPos = fNextIndex; -// fRB->fRules.extractBetween(n->fFirstPos, n->fLastPos, n->fText); -// fLookAheadRule = TRUE; -// break; - - -// case doStartTagValue: -// // Scanned a '{', the opening delimiter for a tag value within a rule. -// n = pushNewNode(RBBINode::tag); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// n->fVal = 0; -// n->fFirstPos = fScanIndex; -// n->fLastPos = fNextIndex; -// break; - -// case doTagDigit: -// // Just scanned a decimal digit that's part of a tag value -// { -// n = fNodeStack[fNodeStackPtr]; -// uint32_t v = u_charDigitValue(fC.fChar); -// U_ASSERT(v < 10); -// n->fVal = n->fVal*10 + v; -// break; -// } - -// case doTagValue: -// n = fNodeStack[fNodeStackPtr]; -// n->fLastPos = fNextIndex; -// fRB->fRules.extractBetween(n->fFirstPos, n->fLastPos, n->fText); -// break; - -// case doTagExpectedError: -// error(U_BRK_MALFORMED_RULE_TAG); -// returnVal = FALSE; -// break; - -// case doOptionStart: -// // Scanning a !!option. At the start of string. -// fOptionStart = fScanIndex; -// break; - -// case doOptionEnd: -// { -// UnicodeString opt(fRB->fRules, fOptionStart, fScanIndex-fOptionStart); -// if (opt == UNICODE_STRING("chain", 5)) { -// fRB->fChainRules = TRUE; -// } else if (opt == UNICODE_STRING("LBCMNoChain", 11)) { -// fRB->fLBCMNoChain = TRUE; -// } else if (opt == UNICODE_STRING("forward", 7)) { -// fRB->fDefaultTree = &fRB->fForwardTree; -// } else if (opt == UNICODE_STRING("reverse", 7)) { -// fRB->fDefaultTree = &fRB->fReverseTree; -// } else if (opt == UNICODE_STRING("safe_forward", 12)) { -// fRB->fDefaultTree = &fRB->fSafeFwdTree; -// } else if (opt == UNICODE_STRING("safe_reverse", 12)) { -// fRB->fDefaultTree = &fRB->fSafeRevTree; -// } else if (opt == UNICODE_STRING("lookAheadHardBreak", 18)) { -// fRB->fLookAheadHardBreak = TRUE; -// } else if (opt == UNICODE_STRING("quoted_literals_only", 20)) { -// fRuleSets[kRuleSet_rule_char-128].clear(); -// } else if (opt == UNICODE_STRING("unquoted_literals", 17)) { -// fRuleSets[kRuleSet_rule_char-128].applyPattern(UnicodeString(gRuleSet_rule_char_pattern), *fRB->fStatus); -// } else { -// error(U_BRK_UNRECOGNIZED_OPTION); -// } -// } -// break; - -// case doReverseDir: -// fReverseRule = TRUE; -// break; - -// case doStartVariableName: -// n = pushNewNode(RBBINode::varRef); -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } -// n->fFirstPos = fScanIndex; -// break; - -// case doEndVariableName: -// n = fNodeStack[fNodeStackPtr]; -// if (n==NULL || n->fType != RBBINode::varRef) { -// error(U_BRK_INTERNAL_ERROR); -// break; -// } -// n->fLastPos = fScanIndex; -// fRB->fRules.extractBetween(n->fFirstPos+1, n->fLastPos, n->fText); -// // Look the newly scanned name up in the symbol table -// // If there's an entry, set the l. child of the var ref to the replacement expression. -// // (We also pass through here when scanning assignments, but no harm is done, other -// // than a slight wasted effort that seems hard to avoid. Lookup will be null) -// n->fLeftChild = fSymbolTable->lookupNode(n->fText); -// break; - -// case doCheckVarDef: -// n = fNodeStack[fNodeStackPtr]; -// if (n->fLeftChild == NULL) { -// error(U_BRK_UNDEFINED_VARIABLE); -// returnVal = FALSE; -// } -// break; - -// case doExprFinished: -// break; - -// case doRuleErrorAssignExpr: -// error(U_BRK_ASSIGN_ERROR); -// returnVal = FALSE; -// break; - -// case doExit: -// returnVal = FALSE; -// break; - -// case doScanUnicodeSet: -// scanSet(); -// break; - -// default: -// error(U_BRK_INTERNAL_ERROR); -// returnVal = FALSE; -// break; -// } -// return returnVal && U_SUCCESS(*fRB->fStatus); -// } - - - - -// //------------------------------------------------------------------------------ -// // -// // Error Report a rule parse error. -// // Only report it if no previous error has been recorded. -// // -// //------------------------------------------------------------------------------ -// void RBBIRuleScanner::error(UErrorCode e) { -// if (U_SUCCESS(*fRB->fStatus)) { -// *fRB->fStatus = e; -// if (fRB->fParseError) { -// fRB->fParseError->line = fLineNum; -// fRB->fParseError->offset = fCharNum; -// fRB->fParseError->preContext[0] = 0; -// fRB->fParseError->postContext[0] = 0; -// } -// } -// } - - - - -// //------------------------------------------------------------------------------ -// // -// // fixOpStack The parse stack holds partially assembled chunks of the parse tree. -// // An entry on the stack may be as small as a single setRef node, -// // or as large as the parse tree -// // for an entire expression (this will be the one item left on the stack -// // when the parsing of an RBBI rule completes. -// // -// // This function is called when a binary operator is encountered. -// // It looks back up the stack for operators that are not yet associated -// // with a right operand, and if the precedence of the stacked operator >= -// // the precedence of the current operator, binds the operand left, -// // to the previously encountered operator. -// // -// //------------------------------------------------------------------------------ -// void RBBIRuleScanner::fixOpStack(RBBINode::OpPrecedence p) { -// RBBINode *n; -// // printNodeStack("entering fixOpStack()"); -// for (;;) { -// n = fNodeStack[fNodeStackPtr-1]; // an operator node -// if (n->fPrecedence == 0) { -// RBBIDebugPuts("RBBIRuleScanner::fixOpStack, bad operator node"); -// error(U_BRK_INTERNAL_ERROR); -// return; -// } - -// if (n->fPrecedence < p || n->fPrecedence <= RBBINode::precLParen) { -// // The most recent operand goes with the current operator, -// // not with the previously stacked one. -// break; -// } -// // Stack operator is a binary op ( '|' or concatenation) -// // TOS operand becomes right child of this operator. -// // Resulting subexpression becomes the TOS operand. -// n->fRightChild = fNodeStack[fNodeStackPtr]; -// fNodeStack[fNodeStackPtr]->fParent = n; -// fNodeStackPtr--; -// // printNodeStack("looping in fixOpStack() "); -// } - -// if (p <= RBBINode::precLParen) { -// // Scan is at a right paren or end of expression. -// // The scanned item must match the stack, or else there was an error. -// // Discard the left paren (or start expr) node from the stack, -// // leaving the completed (sub)expression as TOS. -// if (n->fPrecedence != p) { -// // Right paren encountered matched start of expression node, or -// // end of expression matched with a left paren node. -// error(U_BRK_MISMATCHED_PAREN); -// } -// fNodeStack[fNodeStackPtr-1] = fNodeStack[fNodeStackPtr]; -// fNodeStackPtr--; -// // Delete the now-discarded LParen or Start node. -// delete n; -// } -// // printNodeStack("leaving fixOpStack()"); -// } - - - - -// //------------------------------------------------------------------------------ -// // -// // findSetFor given a UnicodeString, -// // - find the corresponding Unicode Set (uset node) -// // (create one if necessary) -// // - Set fLeftChild of the caller's node (should be a setRef node) -// // to the uset node -// // Maintain a hash table of uset nodes, so the same one is always used -// // for the same string. -// // If a "to adopt" set is provided and we haven't seen this key before, -// // add the provided set to the hash table. -// // If the string is one (32 bit) char in length, the set contains -// // just one element which is the char in question. -// // If the string is "any", return a set containing all chars. -// // -// //------------------------------------------------------------------------------ -// void RBBIRuleScanner::findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt) { - -// RBBISetTableEl *el; - -// // First check whether we've already cached a set for this string. -// // If so, just use the cached set in the new node. -// // delete any set provided by the caller, since we own it. -// el = (RBBISetTableEl *)uhash_get(fSetTable, &s); -// if (el != NULL) { -// delete setToAdopt; -// node->fLeftChild = el->val; -// U_ASSERT(node->fLeftChild->fType == RBBINode::uset); -// return; -// } - -// // Haven't seen this set before. -// // If the caller didn't provide us with a prebuilt set, -// // create a new UnicodeSet now. -// if (setToAdopt == NULL) { -// if (s.compare(kAny, -1) == 0) { -// setToAdopt = new UnicodeSet(0x000000, 0x10ffff); -// } else { -// UChar32 c; -// c = s.char32At(0); -// setToAdopt = new UnicodeSet(c, c); -// } -// } - -// // -// // Make a new uset node to refer to this UnicodeSet -// // This new uset node becomes the child of the caller's setReference node. -// // -// RBBINode *usetNode = new RBBINode(RBBINode::uset); -// if (usetNode == NULL) { -// error(U_MEMORY_ALLOCATION_ERROR); -// return; -// } -// usetNode->fInputSet = setToAdopt; -// usetNode->fParent = node; -// node->fLeftChild = usetNode; -// usetNode->fText = s; - - -// // -// // Add the new uset node to the list of all uset nodes. -// // -// fRB->fUSetNodes->addElement(usetNode, *fRB->fStatus); - - -// // -// // Add the new set to the set hash table. -// // -// el = (RBBISetTableEl *)uprv_malloc(sizeof(RBBISetTableEl)); -// UnicodeString *tkey = new UnicodeString(s); -// if (tkey == NULL || el == NULL || setToAdopt == NULL) { -// // Delete to avoid memory leak -// delete tkey; -// tkey = NULL; -// uprv_free(el); -// el = NULL; -// delete setToAdopt; -// setToAdopt = NULL; - -// error(U_MEMORY_ALLOCATION_ERROR); -// return; -// } -// el->key = tkey; -// el->val = usetNode; -// uhash_put(fSetTable, el->key, el, fRB->fStatus); - -// return; -// } - - - -// // -// // Assorted Unicode character constants. -// // Numeric because there is no portable way to enter them as literals. -// // (Think EBCDIC). -// // -// static const UChar chCR = 0x0d; // New lines, for terminating comments. -// static const UChar chLF = 0x0a; -// static const UChar chNEL = 0x85; // NEL newline variant -// static const UChar chLS = 0x2028; // Unicode Line Separator -// static const UChar chApos = 0x27; // single quote, for quoted chars. -// static const UChar chPound = 0x23; // '#', introduces a comment. -// static const UChar chBackSlash = 0x5c; // '\' introduces a char escape -// static const UChar chLParen = 0x28; -// static const UChar chRParen = 0x29; - - -// //------------------------------------------------------------------------------ -// // -// // stripRules Return a rules string without extra spaces. -// // (Comments are removed separately, during rule parsing.) -// // -// //------------------------------------------------------------------------------ -// UnicodeString RBBIRuleScanner::stripRules(const UnicodeString &rules) { -// UnicodeString strippedRules; -// int32_t rulesLength = rules.length(); -// bool skippingSpaces = false; - -// for (int32_t idx=0; idx= fRB->fRules.length()) { -// return (UChar32)-1; -// } -// ch = fRB->fRules.char32At(fNextIndex); -// fNextIndex = fRB->fRules.moveIndex32(fNextIndex, 1); - -// if (ch == chCR || -// ch == chNEL || -// ch == chLS || -// (ch == chLF && fLastChar != chCR)) { -// // Character is starting a new line. Bump up the line number, and -// // reset the column to 0. -// fLineNum++; -// fCharNum=0; -// if (fQuoteMode) { -// error(U_BRK_NEW_LINE_IN_QUOTED_STRING); -// fQuoteMode = FALSE; -// } -// } -// else { -// // Character is not starting a new line. Except in the case of a -// // LF following a CR, increment the column position. -// if (ch != chLF) { -// fCharNum++; -// } -// } -// fLastChar = ch; -// return ch; -// } - - -// //------------------------------------------------------------------------------ -// // -// // nextChar for rules scanning. At this level, we handle stripping -// // out comments and processing backslash character escapes. -// // The rest of the rules grammar is handled at the next level up. -// // -// //------------------------------------------------------------------------------ -// void RBBIRuleScanner::nextChar(RBBIRuleChar &c) { - -// // Unicode Character constants needed for the processing done by nextChar(), -// // in hex because literals wont work on EBCDIC machines. - -// fScanIndex = fNextIndex; -// c.fChar = nextCharLL(); -// c.fEscaped = FALSE; - -// // -// // check for '' sequence. -// // These are recognized in all contexts, whether in quoted text or not. -// // -// if (c.fChar == chApos) { -// if (fRB->fRules.char32At(fNextIndex) == chApos) { -// c.fChar = nextCharLL(); // get nextChar officially so character counts -// c.fEscaped = TRUE; // stay correct. -// } -// else -// { -// // Single quote, by itself. -// // Toggle quoting mode. -// // Return either '(' or ')', because quotes cause a grouping of the quoted text. -// fQuoteMode = !fQuoteMode; -// if (fQuoteMode == TRUE) { -// c.fChar = chLParen; -// } else { -// c.fChar = chRParen; -// } -// c.fEscaped = FALSE; // The paren that we return is not escaped. -// return; -// } -// } - -// if (fQuoteMode) { -// c.fEscaped = TRUE; -// } -// else -// { -// // We are not in a 'quoted region' of the source. -// // -// if (c.fChar == chPound) { -// // Start of a comment. Consume the rest of it. -// // The new-line char that terminates the comment is always returned. -// // It will be treated as white-space, and serves to break up anything -// // that might otherwise incorrectly clump together with a comment in -// // the middle (a variable name, for example.) -// int32_t commentStart = fScanIndex; -// for (;;) { -// c.fChar = nextCharLL(); -// if (c.fChar == (UChar32)-1 || // EOF -// c.fChar == chCR || -// c.fChar == chLF || -// c.fChar == chNEL || -// c.fChar == chLS) {break;} -// } -// for (int32_t i=commentStart; ifStrippedRules.setCharAt(i, u' '); -// } -// } -// if (c.fChar == (UChar32)-1) { -// return; -// } - -// // -// // check for backslash escaped characters. -// // Use UnicodeString::unescapeAt() to handle them. -// // -// if (c.fChar == chBackSlash) { -// c.fEscaped = TRUE; -// int32_t startX = fNextIndex; -// c.fChar = fRB->fRules.unescapeAt(fNextIndex); -// if (fNextIndex == startX) { -// error(U_BRK_HEX_DIGITS_EXPECTED); -// } -// fCharNum += fNextIndex-startX; -// } -// } -// // putc(c.fChar, stdout); -// } - -// //------------------------------------------------------------------------------ -// // -// // Parse RBBI rules. The state machine for rules parsing is here. -// // The state tables are hand-written in the file rbbirpt.txt, -// // and converted to the form used here by a perl -// // script rbbicst.pl -// // -// //------------------------------------------------------------------------------ -// void RBBIRuleScanner::parse() { -// uint16_t state; -// const RBBIRuleTableEl *tableEl; - -// if (U_FAILURE(*fRB->fStatus)) { -// return; -// } - -// state = 1; -// nextChar(fC); -// // -// // Main loop for the rule parsing state machine. -// // Runs once per state transition. -// // Each time through optionally performs, depending on the state table, -// // - an advance to the the next input char -// // - an action to be performed. -// // - pushing or popping a state to/from the local state return stack. -// // -// for (;;) { -// // Bail out if anything has gone wrong. -// // RBBI rule file parsing stops on the first error encountered. -// if (U_FAILURE(*fRB->fStatus)) { -// break; -// } - -// // Quit if state == 0. This is the normal way to exit the state machine. -// // -// if (state == 0) { -// break; -// } - -// // Find the state table element that matches the input char from the rule, or the -// // class of the input character. Start with the first table row for this -// // state, then linearly scan forward until we find a row that matches the -// // character. The last row for each state always matches all characters, so -// // the search will stop there, if not before. -// // -// tableEl = &gRuleParseStateTable[state]; -// #ifdef RBBI_DEBUG -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "scan")) { -// RBBIDebugPrintf("char, line, col = (\'%c\', %d, %d) state=%s ", -// fC.fChar, fLineNum, fCharNum, RBBIRuleStateNames[state]); -// } -// #endif - -// for (;;) { -// #ifdef RBBI_DEBUG -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "scan")) { RBBIDebugPrintf("."); fflush(stdout);} -// #endif -// if (tableEl->fCharClass < 127 && fC.fEscaped == FALSE && tableEl->fCharClass == fC.fChar) { -// // Table row specified an individual character, not a set, and -// // the input character is not escaped, and -// // the input character matched it. -// break; -// } -// if (tableEl->fCharClass == 255) { -// // Table row specified default, match anything character class. -// break; -// } -// if (tableEl->fCharClass == 254 && fC.fEscaped) { -// // Table row specified "escaped" and the char was escaped. -// break; -// } -// if (tableEl->fCharClass == 253 && fC.fEscaped && -// (fC.fChar == 0x50 || fC.fChar == 0x70 )) { -// // Table row specified "escaped P" and the char is either 'p' or 'P'. -// break; -// } -// if (tableEl->fCharClass == 252 && fC.fChar == (UChar32)-1) { -// // Table row specified eof and we hit eof on the input. -// break; -// } - -// if (tableEl->fCharClass >= 128 && tableEl->fCharClass < 240 && // Table specs a char class && -// fC.fEscaped == FALSE && // char is not escaped && -// fC.fChar != (UChar32)-1) { // char is not EOF -// U_ASSERT((tableEl->fCharClass-128) < UPRV_LENGTHOF(fRuleSets)); -// if (fRuleSets[tableEl->fCharClass-128].contains(fC.fChar)) { -// // Table row specified a character class, or set of characters, -// // and the current char matches it. -// break; -// } -// } - -// // No match on this row, advance to the next row for this state, -// tableEl++; -// } -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "scan")) { RBBIDebugPuts("");} - -// // -// // We've found the row of the state table that matches the current input -// // character from the rules string. -// // Perform any action specified by this row in the state table. -// if (doParseActions((int32_t)tableEl->fAction) == FALSE) { -// // Break out of the state machine loop if the -// // the action signalled some kind of error, or -// // the action was to exit, occurs on normal end-of-rules-input. -// break; -// } - -// if (tableEl->fPushState != 0) { -// fStackPtr++; -// if (fStackPtr >= kStackSize) { -// error(U_BRK_INTERNAL_ERROR); -// RBBIDebugPuts("RBBIRuleScanner::parse() - state stack overflow."); -// fStackPtr--; -// } -// fStack[fStackPtr] = tableEl->fPushState; -// } - -// if (tableEl->fNextChar) { -// nextChar(fC); -// } - -// // Get the next state from the table entry, or from the -// // state stack if the next state was specified as "pop". -// if (tableEl->fNextState != 255) { -// state = tableEl->fNextState; -// } else { -// state = fStack[fStackPtr]; -// fStackPtr--; -// if (fStackPtr < 0) { -// error(U_BRK_INTERNAL_ERROR); -// RBBIDebugPuts("RBBIRuleScanner::parse() - state stack underflow."); -// fStackPtr++; -// } -// } - -// } - -// if (U_FAILURE(*fRB->fStatus)) { -// return; -// } - -// // If there are no forward rules set an error. -// // -// if (fRB->fForwardTree == NULL) { -// error(U_BRK_RULE_SYNTAX); -// return; -// } - -// // -// // Parsing of the input RBBI rules is complete. -// // We now have a parse tree for the rule expressions -// // and a list of all UnicodeSets that are referenced. -// // -// #ifdef RBBI_DEBUG -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "symbols")) {fSymbolTable->rbbiSymtablePrint();} -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ptree")) { -// RBBIDebugPrintf("Completed Forward Rules Parse Tree...\n"); -// RBBINode::printTree(fRB->fForwardTree, TRUE); -// RBBIDebugPrintf("\nCompleted Reverse Rules Parse Tree...\n"); -// RBBINode::printTree(fRB->fReverseTree, TRUE); -// RBBIDebugPrintf("\nCompleted Safe Point Forward Rules Parse Tree...\n"); -// RBBINode::printTree(fRB->fSafeFwdTree, TRUE); -// RBBIDebugPrintf("\nCompleted Safe Point Reverse Rules Parse Tree...\n"); -// RBBINode::printTree(fRB->fSafeRevTree, TRUE); -// } -// #endif -// } - - -// //------------------------------------------------------------------------------ -// // -// // printNodeStack for debugging... -// // -// //------------------------------------------------------------------------------ -// #ifdef RBBI_DEBUG -// void RBBIRuleScanner::printNodeStack(const char *title) { -// int i; -// RBBIDebugPrintf("%s. Dumping node stack...\n", title); -// for (i=fNodeStackPtr; i>0; i--) {RBBINode::printTree(fNodeStack[i], TRUE);} -// } -// #endif - - - - -// //------------------------------------------------------------------------------ -// // -// // pushNewNode create a new RBBINode of the specified type and push it -// // onto the stack of nodes. -// // -// //------------------------------------------------------------------------------ -// RBBINode *RBBIRuleScanner::pushNewNode(RBBINode::NodeType t) { -// if (U_FAILURE(*fRB->fStatus)) { -// return NULL; -// } -// if (fNodeStackPtr >= kStackSize - 1) { -// error(U_BRK_RULE_SYNTAX); -// RBBIDebugPuts("RBBIRuleScanner::pushNewNode - stack overflow."); -// return NULL; -// } -// fNodeStackPtr++; -// fNodeStack[fNodeStackPtr] = new RBBINode(t); -// if (fNodeStack[fNodeStackPtr] == NULL) { -// *fRB->fStatus = U_MEMORY_ALLOCATION_ERROR; -// } -// return fNodeStack[fNodeStackPtr]; -// } - - - -// //------------------------------------------------------------------------------ -// // -// // scanSet Construct a UnicodeSet from the text at the current scan -// // position. Advance the scan position to the first character -// // after the set. -// // -// // A new RBBI setref node referring to the set is pushed onto the node -// // stack. -// // -// // The scan position is normally under the control of the state machine -// // that controls rule parsing. UnicodeSets, however, are parsed by -// // the UnicodeSet constructor, not by the RBBI rule parser. -// // -// //------------------------------------------------------------------------------ -// void RBBIRuleScanner::scanSet() { -// UnicodeSet *uset; -// ParsePosition pos; -// int startPos; -// int i; - -// if (U_FAILURE(*fRB->fStatus)) { -// return; -// } - -// pos.setIndex(fScanIndex); -// startPos = fScanIndex; -// UErrorCode localStatus = U_ZERO_ERROR; -// uset = new UnicodeSet(); -// if (uset == NULL) { -// localStatus = U_MEMORY_ALLOCATION_ERROR; -// } else { -// uset->applyPatternIgnoreSpace(fRB->fRules, pos, fSymbolTable, localStatus); -// } -// if (U_FAILURE(localStatus)) { -// // TODO: Get more accurate position of the error from UnicodeSet's return info. -// // UnicodeSet appears to not be reporting correctly at this time. -// #ifdef RBBI_DEBUG -// RBBIDebugPrintf("UnicodeSet parse postion.ErrorIndex = %d\n", pos.getIndex()); -// #endif -// error(localStatus); -// delete uset; -// return; -// } - -// // Verify that the set contains at least one code point. -// // -// U_ASSERT(uset!=NULL); -// if (uset->isEmpty()) { -// // This set is empty. -// // Make it an error, because it almost certainly is not what the user wanted. -// // Also, avoids having to think about corner cases in the tree manipulation code -// // that occurs later on. -// error(U_BRK_RULE_EMPTY_SET); -// delete uset; -// return; -// } - - -// // Advance the RBBI parse postion over the UnicodeSet pattern. -// // Don't just set fScanIndex because the line/char positions maintained -// // for error reporting would be thrown off. -// i = pos.getIndex(); -// for (;;) { -// if (fNextIndex >= i) { -// break; -// } -// nextCharLL(); -// } - -// if (U_SUCCESS(*fRB->fStatus)) { -// RBBINode *n; - -// n = pushNewNode(RBBINode::setRef); -// if (U_FAILURE(*fRB->fStatus)) { -// return; -// } -// n->fFirstPos = startPos; -// n->fLastPos = fNextIndex; -// fRB->fRules.extractBetween(n->fFirstPos, n->fLastPos, n->fText); -// // findSetFor() serves several purposes here: -// // - Adopts storage for the UnicodeSet, will be responsible for deleting. -// // - Mantains collection of all sets in use, needed later for establishing -// // character categories for run time engine. -// // - Eliminates mulitiple instances of the same set. -// // - Creates a new uset node if necessary (if this isn't a duplicate.) -// findSetFor(n->fText, n, uset); -// } - -// } - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.h b/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.h index c51b4cf2a..8a419b9d7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.h @@ -54,7 +54,7 @@ class RBBIRuleScanner : public UMemory { struct RBBIRuleChar { UChar32 fChar; UBool fEscaped; - RBBIRuleChar() : fChar(0), fEscaped(FALSE) {} + RBBIRuleChar() : fChar(0), fEscaped(false) {} }; RBBIRuleScanner(RBBIRuleBuilder *rb); @@ -73,6 +73,8 @@ class RBBIRuleScanner : public UMemory { // reverse rules, // and a list of UnicodeSets encountered. + int32_t numRules(); // Return the number of rules that have been seen. + /** * Return a rules string without unnecessary * characters. @@ -84,7 +86,7 @@ class RBBIRuleScanner : public UMemory { void error(UErrorCode e); // error reporting convenience function. void fixOpStack(RBBINode::OpPrecedence p); // a character. - void findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt = NULL); + void findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt = nullptr); UChar32 nextCharLL(); #ifdef RBBI_DEBUG @@ -142,7 +144,7 @@ class RBBIRuleScanner : public UMemory { UnicodeSet fRuleSets[10]; // Unicode Sets that are needed during // the scanning of RBBI rules. The - // indicies for these are assigned by the + // indices for these are assigned by the // perl script that builds the state tables. // See rbbirpt.h. @@ -156,8 +158,8 @@ class RBBIRuleScanner : public UMemory { UnicodeSet *gRuleSet_name_char; UnicodeSet *gRuleSet_name_start_char; - RBBIRuleScanner(const RBBIRuleScanner &other); // forbid copying of this class - RBBIRuleScanner &operator=(const RBBIRuleScanner &other); // forbid copying of this class + RBBIRuleScanner(const RBBIRuleScanner &other) = delete; // forbid copying of this class + RBBIRuleScanner &operator=(const RBBIRuleScanner &other) = delete; // forbid copying of this class }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbisetb.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbisetb.cpp deleted file mode 100644 index 14ceafa3c..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbisetb.cpp +++ /dev/null @@ -1,684 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// // -// // rbbisetb.cpp -// // -// /* -// *************************************************************************** -// * Copyright (C) 2002-2008 International Business Machines Corporation * -// * and others. All rights reserved. * -// *************************************************************************** -// */ -// // -// // RBBISetBuilder Handles processing of Unicode Sets from RBBI rules -// // (part of the rule building process.) -// // -// // Starting with the rules parse tree from the scanner, -// // -// // - Enumerate the set of UnicodeSets that are referenced -// // by the RBBI rules. -// // - compute a set of non-overlapping character ranges -// // with all characters within a range belonging to the same -// // set of input uniocde sets. -// // - Derive a set of non-overlapping UnicodeSet (like things) -// // that will correspond to columns in the state table for -// // the RBBI execution engine. All characters within one -// // of these sets belong to the same set of the original -// // UnicodeSets from the user's rules. -// // - construct the trie table that maps input characters -// // to the index of the matching non-overlapping set of set from -// // the previous step. -// // - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/uniset.h" -// #include "utrie2.h" -// #include "uvector.h" -// #include "uassert.h" -// #include "cmemory.h" -// #include "cstring.h" - -// #include "rbbisetb.h" -// #include "rbbinode.h" - -// U_NAMESPACE_BEGIN - -// //------------------------------------------------------------------------ -// // -// // Constructor -// // -// //------------------------------------------------------------------------ -// RBBISetBuilder::RBBISetBuilder(RBBIRuleBuilder *rb) -// { -// fRB = rb; -// fStatus = rb->fStatus; -// fRangeList = 0; -// fTrie = 0; -// fTrieSize = 0; -// fGroupCount = 0; -// fSawBOF = FALSE; -// } - - -// //------------------------------------------------------------------------ -// // -// // Destructor -// // -// //------------------------------------------------------------------------ -// RBBISetBuilder::~RBBISetBuilder() -// { -// RangeDescriptor *nextRangeDesc; - -// // Walk through & delete the linked list of RangeDescriptors -// for (nextRangeDesc = fRangeList; nextRangeDesc!=NULL;) { -// RangeDescriptor *r = nextRangeDesc; -// nextRangeDesc = r->fNext; -// delete r; -// } - -// utrie2_close(fTrie); -// } - - - - -// //------------------------------------------------------------------------ -// // -// // build Build the list of non-overlapping character ranges -// // from the Unicode Sets. -// // -// //------------------------------------------------------------------------ -// void RBBISetBuilder::buildRanges() { -// RBBINode *usetNode; -// RangeDescriptor *rlRange; - -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "usets")) {printSets();} - -// // -// // Initialize the process by creating a single range encompassing all characters -// // that is in no sets. -// // -// fRangeList = new RangeDescriptor(*fStatus); // will check for status here -// if (fRangeList == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// fRangeList->fStartChar = 0; -// fRangeList->fEndChar = 0x10ffff; - -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// // -// // Find the set of non-overlapping ranges of characters -// // -// int ni; -// for (ni=0; ; ni++) { // Loop over each of the UnicodeSets encountered in the input rules -// usetNode = (RBBINode *)this->fRB->fUSetNodes->elementAt(ni); -// if (usetNode==NULL) { -// break; -// } - -// UnicodeSet *inputSet = usetNode->fInputSet; -// int32_t inputSetRangeCount = inputSet->getRangeCount(); -// int inputSetRangeIndex = 0; -// rlRange = fRangeList; - -// for (;;) { -// if (inputSetRangeIndex >= inputSetRangeCount) { -// break; -// } -// UChar32 inputSetRangeBegin = inputSet->getRangeStart(inputSetRangeIndex); -// UChar32 inputSetRangeEnd = inputSet->getRangeEnd(inputSetRangeIndex); - -// // skip over ranges from the range list that are completely -// // below the current range from the input unicode set. -// while (rlRange->fEndChar < inputSetRangeBegin) { -// rlRange = rlRange->fNext; -// } - -// // If the start of the range from the range list is before with -// // the start of the range from the unicode set, split the range list range -// // in two, with one part being before (wholly outside of) the unicode set -// // and the other containing the rest. -// // Then continue the loop; the post-split current range will then be skipped -// // over -// if (rlRange->fStartChar < inputSetRangeBegin) { -// rlRange->split(inputSetRangeBegin, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } -// continue; -// } - -// // Same thing at the end of the ranges... -// // If the end of the range from the range list doesn't coincide with -// // the end of the range from the unicode set, split the range list -// // range in two. The first part of the split range will be -// // wholly inside the Unicode set. -// if (rlRange->fEndChar > inputSetRangeEnd) { -// rlRange->split(inputSetRangeEnd+1, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } -// } - -// // The current rlRange is now entirely within the UnicodeSet range. -// // Add this unicode set to the list of sets for this rlRange -// if (rlRange->fIncludesSets->indexOf(usetNode) == -1) { -// rlRange->fIncludesSets->addElement(usetNode, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } -// } - -// // Advance over ranges that we are finished with. -// if (inputSetRangeEnd == rlRange->fEndChar) { -// inputSetRangeIndex++; -// } -// rlRange = rlRange->fNext; -// } -// } - -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "range")) { printRanges();} - -// // -// // Group the above ranges, with each group consisting of one or more -// // ranges that are in exactly the same set of original UnicodeSets. -// // The groups are numbered, and these group numbers are the set of -// // input symbols recognized by the run-time state machine. -// // -// // Numbering: # 0 (state table column 0) is unused. -// // # 1 is reserved - table column 1 is for end-of-input -// // # 2 is reserved - table column 2 is for beginning-in-input -// // # 3 is the first range list. -// // -// RangeDescriptor *rlSearchRange; -// for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { -// for (rlSearchRange=fRangeList; rlSearchRange != rlRange; rlSearchRange=rlSearchRange->fNext) { -// if (rlRange->fIncludesSets->equals(*rlSearchRange->fIncludesSets)) { -// rlRange->fNum = rlSearchRange->fNum; -// break; -// } -// } -// if (rlRange->fNum == 0) { -// fGroupCount ++; -// rlRange->fNum = fGroupCount+2; -// rlRange->setDictionaryFlag(); -// addValToSets(rlRange->fIncludesSets, fGroupCount+2); -// } -// } - -// // Handle input sets that contain the special string {eof}. -// // Column 1 of the state table is reserved for EOF on input. -// // Column 2 is reserved for before-the-start-input. -// // (This column can be optimized away later if there are no rule -// // references to {bof}.) -// // Add this column value (1 or 2) to the equivalent expression -// // subtree for each UnicodeSet that contains the string {eof} -// // Because {bof} and {eof} are not a characters in the normal sense, -// // they doesn't affect the computation of ranges or TRIE. -// static const UChar eofUString[] = {0x65, 0x6f, 0x66, 0}; -// static const UChar bofUString[] = {0x62, 0x6f, 0x66, 0}; - -// UnicodeString eofString(eofUString); -// UnicodeString bofString(bofUString); -// for (ni=0; ; ni++) { // Loop over each of the UnicodeSets encountered in the input rules -// usetNode = (RBBINode *)this->fRB->fUSetNodes->elementAt(ni); -// if (usetNode==NULL) { -// break; -// } -// UnicodeSet *inputSet = usetNode->fInputSet; -// if (inputSet->contains(eofString)) { -// addValToSet(usetNode, 1); -// } -// if (inputSet->contains(bofString)) { -// addValToSet(usetNode, 2); -// fSawBOF = TRUE; -// } -// } - - -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "rgroup")) {printRangeGroups();} -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "esets")) {printSets();} -// } - - -// // -// // Build the Trie table for mapping UChar32 values to the corresponding -// // range group number. -// // -// void RBBISetBuilder::buildTrie() { -// RangeDescriptor *rlRange; - -// fTrie = utrie2_open(0, // Initial value for all code points. -// 0, // Error value for out-of-range input. -// fStatus); - -// for (rlRange = fRangeList; rlRange!=0 && U_SUCCESS(*fStatus); rlRange=rlRange->fNext) { -// utrie2_setRange32(fTrie, -// rlRange->fStartChar, // Range start -// rlRange->fEndChar, // Range end (inclusive) -// rlRange->fNum, // value for range -// TRUE, // Overwrite previously written values -// fStatus); -// } -// } - - -// void RBBISetBuilder::mergeCategories(IntPair categories) { -// U_ASSERT(categories.first >= 1); -// U_ASSERT(categories.second > categories.first); -// for (RangeDescriptor *rd = fRangeList; rd != nullptr; rd = rd->fNext) { -// int32_t rangeNum = rd->fNum & ~DICT_BIT; -// int32_t rangeDict = rd->fNum & DICT_BIT; -// if (rangeNum == categories.second) { -// rd->fNum = categories.first | rangeDict; -// } else if (rangeNum > categories.second) { -// rd->fNum--; -// } -// } -// --fGroupCount; -// } - - -// //----------------------------------------------------------------------------------- -// // -// // getTrieSize() Return the size that will be required to serialize the Trie. -// // -// //----------------------------------------------------------------------------------- -// int32_t RBBISetBuilder::getTrieSize() { -// if (U_FAILURE(*fStatus)) { -// return 0; -// } -// utrie2_freeze(fTrie, UTRIE2_16_VALUE_BITS, fStatus); -// fTrieSize = utrie2_serialize(fTrie, -// NULL, // Buffer -// 0, // Capacity -// fStatus); -// if (*fStatus == U_BUFFER_OVERFLOW_ERROR) { -// *fStatus = U_ZERO_ERROR; -// } -// // RBBIDebugPrintf("Trie table size is %d\n", trieSize); -// return fTrieSize; -// } - - -// //----------------------------------------------------------------------------------- -// // -// // serializeTrie() Put the serialized trie at the specified address. -// // Trust the caller to have given us enough memory. -// // getTrieSize() MUST be called first. -// // -// //----------------------------------------------------------------------------------- -// void RBBISetBuilder::serializeTrie(uint8_t *where) { -// utrie2_serialize(fTrie, -// where, // Buffer -// fTrieSize, // Capacity -// fStatus); -// } - -// //------------------------------------------------------------------------ -// // -// // addValToSets Add a runtime-mapped input value to each uset from a -// // list of uset nodes. (val corresponds to a state table column.) -// // For each of the original Unicode sets - which correspond -// // directly to uset nodes - a logically equivalent expression -// // is constructed in terms of the remapped runtime input -// // symbol set. This function adds one runtime input symbol to -// // a list of sets. -// // -// // The "logically equivalent expression" is the tree for an -// // or-ing together of all of the symbols that go into the set. -// // -// //------------------------------------------------------------------------ -// void RBBISetBuilder::addValToSets(UVector *sets, uint32_t val) { -// int32_t ix; - -// for (ix=0; ixsize(); ix++) { -// RBBINode *usetNode = (RBBINode *)sets->elementAt(ix); -// addValToSet(usetNode, val); -// } -// } - -// void RBBISetBuilder::addValToSet(RBBINode *usetNode, uint32_t val) { -// RBBINode *leafNode = new RBBINode(RBBINode::leafChar); -// if (leafNode == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// leafNode->fVal = (unsigned short)val; -// if (usetNode->fLeftChild == NULL) { -// usetNode->fLeftChild = leafNode; -// leafNode->fParent = usetNode; -// } else { -// // There are already input symbols present for this set. -// // Set up an OR node, with the previous stuff as the left child -// // and the new value as the right child. -// RBBINode *orNode = new RBBINode(RBBINode::opOr); -// if (orNode == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// orNode->fLeftChild = usetNode->fLeftChild; -// orNode->fRightChild = leafNode; -// orNode->fLeftChild->fParent = orNode; -// orNode->fRightChild->fParent = orNode; -// usetNode->fLeftChild = orNode; -// orNode->fParent = usetNode; -// } -// } - - -// //------------------------------------------------------------------------ -// // -// // getNumCharCategories -// // -// //------------------------------------------------------------------------ -// int32_t RBBISetBuilder::getNumCharCategories() const { -// return fGroupCount + 3; -// } - - -// //------------------------------------------------------------------------ -// // -// // sawBOF -// // -// //------------------------------------------------------------------------ -// UBool RBBISetBuilder::sawBOF() const { -// return fSawBOF; -// } - - -// //------------------------------------------------------------------------ -// // -// // getFirstChar Given a runtime RBBI character category, find -// // the first UChar32 that is in the set of chars -// // in the category. -// //------------------------------------------------------------------------ -// UChar32 RBBISetBuilder::getFirstChar(int32_t category) const { -// RangeDescriptor *rlRange; -// UChar32 retVal = (UChar32)-1; -// for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { -// if (rlRange->fNum == category) { -// retVal = rlRange->fStartChar; -// break; -// } -// } -// return retVal; -// } - - - -// //------------------------------------------------------------------------ -// // -// // printRanges A debugging function. -// // dump out all of the range definitions. -// // -// //------------------------------------------------------------------------ -// #ifdef RBBI_DEBUG -// void RBBISetBuilder::printRanges() { -// RangeDescriptor *rlRange; -// int i; - -// RBBIDebugPrintf("\n\n Nonoverlapping Ranges ...\n"); -// for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { -// RBBIDebugPrintf("%2i %4x-%4x ", rlRange->fNum, rlRange->fStartChar, rlRange->fEndChar); - -// for (i=0; ifIncludesSets->size(); i++) { -// RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i); -// UnicodeString setName = UNICODE_STRING("anon", 4); -// RBBINode *setRef = usetNode->fParent; -// if (setRef != NULL) { -// RBBINode *varRef = setRef->fParent; -// if (varRef != NULL && varRef->fType == RBBINode::varRef) { -// setName = varRef->fText; -// } -// } -// RBBI_DEBUG_printUnicodeString(setName); RBBIDebugPrintf(" "); -// } -// RBBIDebugPrintf("\n"); -// } -// } -// #endif - - -// //------------------------------------------------------------------------ -// // -// // printRangeGroups A debugging function. -// // dump out all of the range groups. -// // -// //------------------------------------------------------------------------ -// #ifdef RBBI_DEBUG -// void RBBISetBuilder::printRangeGroups() { -// RangeDescriptor *rlRange; -// RangeDescriptor *tRange; -// int i; -// int lastPrintedGroupNum = 0; - -// RBBIDebugPrintf("\nRanges grouped by Unicode Set Membership...\n"); -// for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) { -// int groupNum = rlRange->fNum & 0xbfff; -// if (groupNum > lastPrintedGroupNum) { -// lastPrintedGroupNum = groupNum; -// RBBIDebugPrintf("%2i ", groupNum); - -// if (rlRange->fNum & DICT_BIT) { RBBIDebugPrintf(" ");} - -// for (i=0; ifIncludesSets->size(); i++) { -// RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i); -// UnicodeString setName = UNICODE_STRING("anon", 4); -// RBBINode *setRef = usetNode->fParent; -// if (setRef != NULL) { -// RBBINode *varRef = setRef->fParent; -// if (varRef != NULL && varRef->fType == RBBINode::varRef) { -// setName = varRef->fText; -// } -// } -// RBBI_DEBUG_printUnicodeString(setName); RBBIDebugPrintf(" "); -// } - -// i = 0; -// for (tRange = rlRange; tRange != 0; tRange = tRange->fNext) { -// if (tRange->fNum == rlRange->fNum) { -// if (i++ % 5 == 0) { -// RBBIDebugPrintf("\n "); -// } -// RBBIDebugPrintf(" %05x-%05x", tRange->fStartChar, tRange->fEndChar); -// } -// } -// RBBIDebugPrintf("\n"); -// } -// } -// RBBIDebugPrintf("\n"); -// } -// #endif - - -// //------------------------------------------------------------------------ -// // -// // printSets A debugging function. -// // dump out all of the set definitions. -// // -// //------------------------------------------------------------------------ -// #ifdef RBBI_DEBUG -// void RBBISetBuilder::printSets() { -// int i; - -// RBBIDebugPrintf("\n\nUnicode Sets List\n------------------\n"); -// for (i=0; ; i++) { -// RBBINode *usetNode; -// RBBINode *setRef; -// RBBINode *varRef; -// UnicodeString setName; - -// usetNode = (RBBINode *)fRB->fUSetNodes->elementAt(i); -// if (usetNode == NULL) { -// break; -// } - -// RBBIDebugPrintf("%3d ", i); -// setName = UNICODE_STRING("anonymous", 9); -// setRef = usetNode->fParent; -// if (setRef != NULL) { -// varRef = setRef->fParent; -// if (varRef != NULL && varRef->fType == RBBINode::varRef) { -// setName = varRef->fText; -// } -// } -// RBBI_DEBUG_printUnicodeString(setName); -// RBBIDebugPrintf(" "); -// RBBI_DEBUG_printUnicodeString(usetNode->fText); -// RBBIDebugPrintf("\n"); -// if (usetNode->fLeftChild != NULL) { -// RBBINode::printTree(usetNode->fLeftChild, TRUE); -// } -// } -// RBBIDebugPrintf("\n"); -// } -// #endif - - - -// //------------------------------------------------------------------------------------- -// // -// // RangeDescriptor copy constructor -// // -// //------------------------------------------------------------------------------------- - -// RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &status) { -// int i; - -// this->fStartChar = other.fStartChar; -// this->fEndChar = other.fEndChar; -// this->fNum = other.fNum; -// this->fNext = NULL; -// UErrorCode oldstatus = status; -// this->fIncludesSets = new UVector(status); -// if (U_FAILURE(oldstatus)) { -// status = oldstatus; -// } -// if (U_FAILURE(status)) { -// return; -// } -// /* test for NULL */ -// if (this->fIncludesSets == 0) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return; -// } - -// for (i=0; isize(); i++) { -// this->fIncludesSets->addElement(other.fIncludesSets->elementAt(i), status); -// } -// } - - -// //------------------------------------------------------------------------------------- -// // -// // RangeDesriptor default constructor -// // -// //------------------------------------------------------------------------------------- -// RangeDescriptor::RangeDescriptor(UErrorCode &status) { -// this->fStartChar = 0; -// this->fEndChar = 0; -// this->fNum = 0; -// this->fNext = NULL; -// UErrorCode oldstatus = status; -// this->fIncludesSets = new UVector(status); -// if (U_FAILURE(oldstatus)) { -// status = oldstatus; -// } -// if (U_FAILURE(status)) { -// return; -// } -// /* test for NULL */ -// if(this->fIncludesSets == 0) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return; -// } - -// } - - -// //------------------------------------------------------------------------------------- -// // -// // RangeDesriptor Destructor -// // -// //------------------------------------------------------------------------------------- -// RangeDescriptor::~RangeDescriptor() { -// delete fIncludesSets; -// fIncludesSets = NULL; -// } - -// //------------------------------------------------------------------------------------- -// // -// // RangeDesriptor::split() -// // -// //------------------------------------------------------------------------------------- -// void RangeDescriptor::split(UChar32 where, UErrorCode &status) { -// U_ASSERT(where>fStartChar && where<=fEndChar); -// RangeDescriptor *nr = new RangeDescriptor(*this, status); -// if(nr == 0) { -// status = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// if (U_FAILURE(status)) { -// delete nr; -// return; -// } -// // RangeDescriptor copy constructor copies all fields. -// // Only need to update those that are different after the split. -// nr->fStartChar = where; -// this->fEndChar = where-1; -// nr->fNext = this->fNext; -// this->fNext = nr; -// } - - -// //------------------------------------------------------------------------------------- -// // -// // RangeDescriptor::setDictionaryFlag -// // -// // Character Category Numbers that include characters from -// // the original Unicode Set named "dictionary" have bit 14 -// // set to 1. The RBBI runtime engine uses this to trigger -// // use of the word dictionary. -// // -// // This function looks through the Unicode Sets that it -// // (the range) includes, and sets the bit in fNum when -// // "dictionary" is among them. -// // -// // TODO: a faster way would be to find the set node for -// // "dictionary" just once, rather than looking it -// // up by name every time. -// // -// //------------------------------------------------------------------------------------- -// void RangeDescriptor::setDictionaryFlag() { -// int i; - -// static const char16_t *dictionary = u"dictionary"; -// for (i=0; isize(); i++) { -// RBBINode *usetNode = (RBBINode *)fIncludesSets->elementAt(i); -// RBBINode *setRef = usetNode->fParent; -// if (setRef != nullptr) { -// RBBINode *varRef = setRef->fParent; -// if (varRef && varRef->fType == RBBINode::varRef) { -// const UnicodeString *setName = &varRef->fText; -// if (setName->compare(dictionary, -1) == 0) { -// fNum |= RBBISetBuilder::DICT_BIT; -// break; -// } -// } -// } -// } -// } - - - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbisetb.h b/src/duckdb/extension/icu/third_party/icu/common/rbbisetb.h index ed6a76b12..cd09d3317 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbisetb.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbisetb.h @@ -16,9 +16,10 @@ #if !UCONFIG_NO_BREAK_ITERATION +#include "unicode/ucptrie.h" +#include "unicode/umutablecptrie.h" #include "unicode/uobject.h" #include "rbbirb.h" -#include "utrie2.h" #include "uvector.h" U_NAMESPACE_BEGIN @@ -40,25 +41,26 @@ U_NAMESPACE_BEGIN // class RangeDescriptor : public UMemory { public: - UChar32 fStartChar; // Start of range, unicode 32 bit value. - UChar32 fEndChar; // End of range, unicode 32 bit value. - int32_t fNum; // runtime-mapped input value for this range. - UVector *fIncludesSets; // vector of the the original - // Unicode sets that include this range. - // (Contains ptrs to uset nodes) - RangeDescriptor *fNext; // Next RangeDescriptor in the linked list. + UChar32 fStartChar {}; // Start of range, unicode 32 bit value. + UChar32 fEndChar {}; // End of range, unicode 32 bit value. + int32_t fNum {0}; // runtime-mapped input value for this range. + bool fIncludesDict {false}; // True if the range includes $dictionary. + bool fFirstInGroup {false}; // True if first range in a group with the same fNum. + UVector *fIncludesSets {nullptr}; // vector of the the original + // Unicode sets that include this range. + // (Contains ptrs to uset nodes) + RangeDescriptor *fNext {nullptr}; // Next RangeDescriptor in the linked list. RangeDescriptor(UErrorCode &status); RangeDescriptor(const RangeDescriptor &other, UErrorCode &status); ~RangeDescriptor(); void split(UChar32 where, UErrorCode &status); // Spit this range in two at "where", with // where appearing in the second (higher) part. - void setDictionaryFlag(); // Check whether this range appears as part of + bool isDictionaryRange(); // Check whether this range appears as part of // the Unicode set named "dictionary" -private: - RangeDescriptor(const RangeDescriptor &other); // forbid copying of this class - RangeDescriptor &operator=(const RangeDescriptor &other); // forbid copying of this class + RangeDescriptor(const RangeDescriptor &other) = delete; // forbid default copying of this class + RangeDescriptor &operator=(const RangeDescriptor &other) = delete; // forbid assigning of this class }; @@ -89,6 +91,8 @@ class RBBISetBuilder : public UMemory { int32_t getNumCharCategories() const; // CharCategories are the same as input symbol set to the // runtime state machine, which are the same as // columns in the DFA state table + int32_t getDictCategoriesStart() const; // First char category that includes $dictionary, or + // last category + 1 if there are no dictionary categories. int32_t getTrieSize() /*const*/; // Size in bytes of the serialized Trie. void serializeTrie(uint8_t *where); // write out the serialized Trie. UChar32 getFirstChar(int32_t val) const; @@ -101,8 +105,6 @@ class RBBISetBuilder : public UMemory { */ void mergeCategories(IntPair categories); - static constexpr int32_t DICT_BIT = 0x4000; - #ifdef RBBI_DEBUG void printSets(); void printRanges(); @@ -114,28 +116,26 @@ class RBBISetBuilder : public UMemory { #endif private: - void numberSets(); - RBBIRuleBuilder *fRB; // The RBBI Rule Compiler that owns us. UErrorCode *fStatus; RangeDescriptor *fRangeList; // Head of the linked list of RangeDescriptors - UTrie2 *fTrie; // The mapping TRIE that is the end result of processing - uint32_t fTrieSize; // the Unicode Sets. + UMutableCPTrie *fMutableTrie; // The mapping TRIE that is the end result of processing + UCPTrie *fTrie; // the Unicode Sets. + uint32_t fTrieSize; - // Groups correspond to character categories - - // groups of ranges that are in the same original UnicodeSets. - // fGroupCount is the index of the last used group. - // fGroupCount+1 is also the number of columns in the RBBI state table being compiled. - // State table column 0 is not used. Column 1 is for end-of-input. - // column 2 is for group 0. Funny counting. + // Number of range groups, which are groups of ranges that are in the same original UnicodeSets. int32_t fGroupCount; + // The number of the first dictionary char category. + // If there are no Dictionary categories, set to the last category + 1. + int32_t fDictCategoriesStart; + UBool fSawBOF; - RBBISetBuilder(const RBBISetBuilder &other); // forbid copying of this class - RBBISetBuilder &operator=(const RBBISetBuilder &other); // forbid copying of this class + RBBISetBuilder(const RBBISetBuilder &other) = delete; // forbid copying of this class + RBBISetBuilder &operator=(const RBBISetBuilder &other) = delete; // forbid copying of this class }; diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbistbl.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbistbl.cpp deleted file mode 100644 index 2aec19bb0..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbistbl.cpp +++ /dev/null @@ -1,270 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// // -// // file: rbbistbl.cpp Implementation of the ICU RBBISymbolTable class -// // -// /* -// *************************************************************************** -// * Copyright (C) 2002-2014 International Business Machines Corporation -// * and others. All rights reserved. -// *************************************************************************** -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/unistr.h" -// #include "unicode/uniset.h" -// #include "unicode/uchar.h" -// #include "unicode/parsepos.h" - -// #include "cstr.h" -// #include "rbbinode.h" -// #include "rbbirb.h" -// #include "umutex.h" - - -// // -// // RBBISymbolTableEntry_deleter Used by the UHashTable to delete the contents -// // when the hash table is deleted. -// // -// U_CDECL_BEGIN -// static void U_CALLCONV RBBISymbolTableEntry_deleter(void *p) { -// icu::RBBISymbolTableEntry *px = (icu::RBBISymbolTableEntry *)p; -// delete px; -// } -// U_CDECL_END - - - -// U_NAMESPACE_BEGIN - -// RBBISymbolTable::RBBISymbolTable(RBBIRuleScanner *rs, const UnicodeString &rules, UErrorCode &status) -// :fRules(rules), fRuleScanner(rs), ffffString(UChar(0xffff)) -// { -// fHashTable = NULL; -// fCachedSetLookup = NULL; - -// fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status); -// // uhash_open checks status -// if (U_FAILURE(status)) { -// return; -// } -// uhash_setValueDeleter(fHashTable, RBBISymbolTableEntry_deleter); -// } - - - -// RBBISymbolTable::~RBBISymbolTable() -// { -// uhash_close(fHashTable); -// } - - -// // -// // RBBISymbolTable::lookup This function from the abstract symbol table inteface -// // looks up a variable name and returns a UnicodeString -// // containing the substitution text. -// // -// // The variable name does NOT include the leading $. -// // -// const UnicodeString *RBBISymbolTable::lookup(const UnicodeString& s) const -// { -// RBBISymbolTableEntry *el; -// RBBINode *varRefNode; -// RBBINode *exprNode; -// RBBINode *usetNode; -// const UnicodeString *retString; -// RBBISymbolTable *This = (RBBISymbolTable *)this; // cast off const - -// el = (RBBISymbolTableEntry *)uhash_get(fHashTable, &s); -// if (el == NULL) { -// return NULL; -// } - -// varRefNode = el->val; -// exprNode = varRefNode->fLeftChild; // Root node of expression for variable -// if (exprNode->fType == RBBINode::setRef) { -// // The $variable refers to a single UnicodeSet -// // return the ffffString, which will subsequently be interpreted as a -// // stand-in character for the set by RBBISymbolTable::lookupMatcher() -// usetNode = exprNode->fLeftChild; -// This->fCachedSetLookup = usetNode->fInputSet; -// retString = &ffffString; -// } -// else -// { -// // The variable refers to something other than just a set. -// // return the original source string for the expression -// retString = &exprNode->fText; -// This->fCachedSetLookup = NULL; -// } -// return retString; -// } - - - -// // -// // RBBISymbolTable::lookupMatcher This function from the abstract symbol table -// // interface maps a single stand-in character to a -// // pointer to a Unicode Set. The Unicode Set code uses this -// // mechanism to get all references to the same $variable -// // name to refer to a single common Unicode Set instance. -// // -// // This implementation cheats a little, and does not maintain a map of stand-in chars -// // to sets. Instead, it takes advantage of the fact that the UnicodeSet -// // constructor will always call this function right after calling lookup(), -// // and we just need to remember what set to return between these two calls. -// const UnicodeFunctor *RBBISymbolTable::lookupMatcher(UChar32 ch) const -// { -// UnicodeSet *retVal = NULL; -// RBBISymbolTable *This = (RBBISymbolTable *)this; // cast off const -// if (ch == 0xffff) { -// retVal = fCachedSetLookup; -// This->fCachedSetLookup = 0; -// } -// return retVal; -// } - -// // -// // RBBISymbolTable::parseReference This function from the abstract symbol table interface -// // looks for a $variable name in the source text. -// // It does not look it up, only scans for it. -// // It is used by the UnicodeSet parser. -// // -// // This implementation is lifted pretty much verbatim -// // from the rules based transliterator implementation. -// // I didn't see an obvious way of sharing it. -// // -// UnicodeString RBBISymbolTable::parseReference(const UnicodeString& text, -// ParsePosition& pos, int32_t limit) const -// { -// int32_t start = pos.getIndex(); -// int32_t i = start; -// UnicodeString result; -// while (i < limit) { -// UChar c = text.charAt(i); -// if ((i==start && !u_isIDStart(c)) || !u_isIDPart(c)) { -// break; -// } -// ++i; -// } -// if (i == start) { // No valid name chars -// return result; // Indicate failure with empty string -// } -// pos.setIndex(i); -// text.extractBetween(start, i, result); -// return result; -// } - - - -// // -// // RBBISymbolTable::lookupNode Given a key (a variable name), return the -// // corresponding RBBI Node. If there is no entry -// // in the table for this name, return NULL. -// // -// RBBINode *RBBISymbolTable::lookupNode(const UnicodeString &key) const{ - -// RBBINode *retNode = NULL; -// RBBISymbolTableEntry *el; - -// el = (RBBISymbolTableEntry *)uhash_get(fHashTable, &key); -// if (el != NULL) { -// retNode = el->val; -// } -// return retNode; -// } - - -// // -// // RBBISymbolTable::addEntry Add a new entry to the symbol table. -// // Indicate an error if the name already exists - -// // this will only occur in the case of duplicate -// // variable assignments. -// // -// void RBBISymbolTable::addEntry (const UnicodeString &key, RBBINode *val, UErrorCode &err) { -// RBBISymbolTableEntry *e; -// /* test for buffer overflows */ -// if (U_FAILURE(err)) { -// return; -// } -// e = (RBBISymbolTableEntry *)uhash_get(fHashTable, &key); -// if (e != NULL) { -// err = U_BRK_VARIABLE_REDFINITION; -// return; -// } - -// e = new RBBISymbolTableEntry; -// if (e == NULL) { -// err = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// e->key = key; -// e->val = val; -// uhash_put( fHashTable, &e->key, e, &err); -// } - - -// RBBISymbolTableEntry::RBBISymbolTableEntry() : UMemory(), key(), val(NULL) {} - -// RBBISymbolTableEntry::~RBBISymbolTableEntry() { -// // The "val" of a symbol table entry is a variable reference node. -// // The l. child of the val is the rhs expression from the assignment. -// // Unlike other node types, children of variable reference nodes are not -// // automatically recursively deleted. We do it manually here. -// delete val->fLeftChild; -// val->fLeftChild = NULL; - -// delete val; - -// // Note: the key UnicodeString is destructed by virtue of being in the object by value. -// } - - -// // -// // RBBISymbolTable::print Debugging function, dump out the symbol table contents. -// // -// #ifdef RBBI_DEBUG -// void RBBISymbolTable::rbbiSymtablePrint() const { -// RBBIDebugPrintf("Variable Definitions Symbol Table\n" -// "Name Node serial String Val\n" -// "-------------------------------------------------------------------\n"); - -// int32_t pos = UHASH_FIRST; -// const UHashElement *e = NULL; -// for (;;) { -// e = uhash_nextElement(fHashTable, &pos); -// if (e == NULL ) { -// break; -// } -// RBBISymbolTableEntry *s = (RBBISymbolTableEntry *)e->value.pointer; - -// RBBIDebugPrintf("%-19s %8p %7d ", CStr(s->key)(), (void *)s->val, s->val->fSerialNum); -// RBBIDebugPrintf(" %s\n", CStr(s->val->fLeftChild->fText)()); -// } - -// RBBIDebugPrintf("\nParsed Variable Definitions\n"); -// pos = -1; -// for (;;) { -// e = uhash_nextElement(fHashTable, &pos); -// if (e == NULL ) { -// break; -// } -// RBBISymbolTableEntry *s = (RBBISymbolTableEntry *)e->value.pointer; -// RBBIDebugPrintf("%s\n", CStr(s->key)()); -// RBBINode::printTree(s->val, TRUE); -// RBBINode::printTree(s->val->fLeftChild, FALSE); -// RBBIDebugPrintf("\n"); -// } -// } -// #endif - - - - - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.cpp b/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.cpp deleted file mode 100644 index d3f76262f..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.cpp +++ /dev/null @@ -1,1684 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (c) 2002-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// */ -// // -// // rbbitblb.cpp -// // - - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/unistr.h" -// #include "rbbitblb.h" -// #include "rbbirb.h" -// #include "rbbisetb.h" -// #include "rbbidata.h" -// #include "cstring.h" -// #include "uassert.h" -// #include "uvectr32.h" -// #include "cmemory.h" - -// U_NAMESPACE_BEGIN - -// RBBITableBuilder::RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status) : -// fRB(rb), -// fTree(*rootNode), -// fStatus(&status), -// fDStates(nullptr), -// fSafeTable(nullptr) { -// if (U_FAILURE(status)) { -// return; -// } -// // fDStates is UVector -// fDStates = new UVector(status); -// if (U_SUCCESS(status) && fDStates == nullptr ) { -// status = U_MEMORY_ALLOCATION_ERROR; -// } -// } - - - -// RBBITableBuilder::~RBBITableBuilder() { -// int i; -// for (i=0; isize(); i++) { -// delete (RBBIStateDescriptor *)fDStates->elementAt(i); -// } -// delete fDStates; -// delete fSafeTable; -// } - - -// //----------------------------------------------------------------------------- -// // -// // RBBITableBuilder::buildForwardTable - This is the main function for building -// // the DFA state transition table from the RBBI rules parse tree. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::buildForwardTable() { - -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// // If there were no rules, just return. This situation can easily arise -// // for the reverse rules. -// if (fTree==NULL) { -// return; -// } - -// // -// // Walk through the tree, replacing any references to $variables with a copy of the -// // parse tree for the substition expression. -// // -// fTree = fTree->flattenVariables(); -// #ifdef RBBI_DEBUG -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "ftree")) { -// RBBIDebugPuts("\nParse tree after flattening variable references."); -// RBBINode::printTree(fTree, TRUE); -// } -// #endif - -// // -// // If the rules contained any references to {bof} -// // add a {bof} to the -// // tree. Means that all matches must start out with the -// // {bof} fake character. -// // -// if (fRB->fSetBuilder->sawBOF()) { -// RBBINode *bofTop = new RBBINode(RBBINode::opCat); -// RBBINode *bofLeaf = new RBBINode(RBBINode::leafChar); -// // Delete and exit if memory allocation failed. -// if (bofTop == NULL || bofLeaf == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// delete bofTop; -// delete bofLeaf; -// return; -// } -// bofTop->fLeftChild = bofLeaf; -// bofTop->fRightChild = fTree; -// bofLeaf->fParent = bofTop; -// bofLeaf->fVal = 2; // Reserved value for {bof}. -// fTree = bofTop; -// } - -// // -// // Add a unique right-end marker to the expression. -// // Appears as a cat-node, left child being the original tree, -// // right child being the end marker. -// // -// RBBINode *cn = new RBBINode(RBBINode::opCat); -// // Exit if memory allocation failed. -// if (cn == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// cn->fLeftChild = fTree; -// fTree->fParent = cn; -// cn->fRightChild = new RBBINode(RBBINode::endMark); -// // Delete and exit if memory allocation failed. -// if (cn->fRightChild == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// delete cn; -// return; -// } -// cn->fRightChild->fParent = cn; -// fTree = cn; - -// // -// // Replace all references to UnicodeSets with the tree for the equivalent -// // expression. -// // -// fTree->flattenSets(); -// #ifdef RBBI_DEBUG -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "stree")) { -// RBBIDebugPuts("\nParse tree after flattening Unicode Set references."); -// RBBINode::printTree(fTree, TRUE); -// } -// #endif - - -// // -// // calculate the functions nullable, firstpos, lastpos and followpos on -// // nodes in the parse tree. -// // See the alogrithm description in Aho. -// // Understanding how this works by looking at the code alone will be -// // nearly impossible. -// // -// calcNullable(fTree); -// calcFirstPos(fTree); -// calcLastPos(fTree); -// calcFollowPos(fTree); -// if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "pos")) { -// RBBIDebugPuts("\n"); -// printPosSets(fTree); -// } - -// // -// // For "chained" rules, modify the followPos sets -// // -// if (fRB->fChainRules) { -// calcChainedFollowPos(fTree); -// } - -// // -// // BOF (start of input) test fixup. -// // -// if (fRB->fSetBuilder->sawBOF()) { -// bofFixup(); -// } - -// // -// // Build the DFA state transition tables. -// // -// buildStateTable(); -// flagAcceptingStates(); -// flagLookAheadStates(); -// flagTaggedStates(); - -// // -// // Update the global table of rule status {tag} values -// // The rule builder has a global vector of status values that are common -// // for all tables. Merge the ones from this table into the global set. -// // -// mergeRuleStatusVals(); -// } - - - -// //----------------------------------------------------------------------------- -// // -// // calcNullable. Impossible to explain succinctly. See Aho, section 3.9 -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::calcNullable(RBBINode *n) { -// if (n == NULL) { -// return; -// } -// if (n->fType == RBBINode::setRef || -// n->fType == RBBINode::endMark ) { -// // These are non-empty leaf node types. -// n->fNullable = FALSE; -// return; -// } - -// if (n->fType == RBBINode::lookAhead || n->fType == RBBINode::tag) { -// // Lookahead marker node. It's a leaf, so no recursion on children. -// // It's nullable because it does not match any literal text from the input stream. -// n->fNullable = TRUE; -// return; -// } - - -// // The node is not a leaf. -// // Calculate nullable on its children. -// calcNullable(n->fLeftChild); -// calcNullable(n->fRightChild); - -// // Apply functions from table 3.40 in Aho -// if (n->fType == RBBINode::opOr) { -// n->fNullable = n->fLeftChild->fNullable || n->fRightChild->fNullable; -// } -// else if (n->fType == RBBINode::opCat) { -// n->fNullable = n->fLeftChild->fNullable && n->fRightChild->fNullable; -// } -// else if (n->fType == RBBINode::opStar || n->fType == RBBINode::opQuestion) { -// n->fNullable = TRUE; -// } -// else { -// n->fNullable = FALSE; -// } -// } - - - - -// //----------------------------------------------------------------------------- -// // -// // calcFirstPos. Impossible to explain succinctly. See Aho, section 3.9 -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::calcFirstPos(RBBINode *n) { -// if (n == NULL) { -// return; -// } -// if (n->fType == RBBINode::leafChar || -// n->fType == RBBINode::endMark || -// n->fType == RBBINode::lookAhead || -// n->fType == RBBINode::tag) { -// // These are non-empty leaf node types. -// // Note: In order to maintain the sort invariant on the set, -// // this function should only be called on a node whose set is -// // empty to start with. -// n->fFirstPosSet->addElement(n, *fStatus); -// return; -// } - -// // The node is not a leaf. -// // Calculate firstPos on its children. -// calcFirstPos(n->fLeftChild); -// calcFirstPos(n->fRightChild); - -// // Apply functions from table 3.40 in Aho -// if (n->fType == RBBINode::opOr) { -// setAdd(n->fFirstPosSet, n->fLeftChild->fFirstPosSet); -// setAdd(n->fFirstPosSet, n->fRightChild->fFirstPosSet); -// } -// else if (n->fType == RBBINode::opCat) { -// setAdd(n->fFirstPosSet, n->fLeftChild->fFirstPosSet); -// if (n->fLeftChild->fNullable) { -// setAdd(n->fFirstPosSet, n->fRightChild->fFirstPosSet); -// } -// } -// else if (n->fType == RBBINode::opStar || -// n->fType == RBBINode::opQuestion || -// n->fType == RBBINode::opPlus) { -// setAdd(n->fFirstPosSet, n->fLeftChild->fFirstPosSet); -// } -// } - - - -// //----------------------------------------------------------------------------- -// // -// // calcLastPos. Impossible to explain succinctly. See Aho, section 3.9 -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::calcLastPos(RBBINode *n) { -// if (n == NULL) { -// return; -// } -// if (n->fType == RBBINode::leafChar || -// n->fType == RBBINode::endMark || -// n->fType == RBBINode::lookAhead || -// n->fType == RBBINode::tag) { -// // These are non-empty leaf node types. -// // Note: In order to maintain the sort invariant on the set, -// // this function should only be called on a node whose set is -// // empty to start with. -// n->fLastPosSet->addElement(n, *fStatus); -// return; -// } - -// // The node is not a leaf. -// // Calculate lastPos on its children. -// calcLastPos(n->fLeftChild); -// calcLastPos(n->fRightChild); - -// // Apply functions from table 3.40 in Aho -// if (n->fType == RBBINode::opOr) { -// setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); -// setAdd(n->fLastPosSet, n->fRightChild->fLastPosSet); -// } -// else if (n->fType == RBBINode::opCat) { -// setAdd(n->fLastPosSet, n->fRightChild->fLastPosSet); -// if (n->fRightChild->fNullable) { -// setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); -// } -// } -// else if (n->fType == RBBINode::opStar || -// n->fType == RBBINode::opQuestion || -// n->fType == RBBINode::opPlus) { -// setAdd(n->fLastPosSet, n->fLeftChild->fLastPosSet); -// } -// } - - - -// //----------------------------------------------------------------------------- -// // -// // calcFollowPos. Impossible to explain succinctly. See Aho, section 3.9 -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::calcFollowPos(RBBINode *n) { -// if (n == NULL || -// n->fType == RBBINode::leafChar || -// n->fType == RBBINode::endMark) { -// return; -// } - -// calcFollowPos(n->fLeftChild); -// calcFollowPos(n->fRightChild); - -// // Aho rule #1 -// if (n->fType == RBBINode::opCat) { -// RBBINode *i; // is 'i' in Aho's description -// uint32_t ix; - -// UVector *LastPosOfLeftChild = n->fLeftChild->fLastPosSet; - -// for (ix=0; ix<(uint32_t)LastPosOfLeftChild->size(); ix++) { -// i = (RBBINode *)LastPosOfLeftChild->elementAt(ix); -// setAdd(i->fFollowPos, n->fRightChild->fFirstPosSet); -// } -// } - -// // Aho rule #2 -// if (n->fType == RBBINode::opStar || -// n->fType == RBBINode::opPlus) { -// RBBINode *i; // again, n and i are the names from Aho's description. -// uint32_t ix; - -// for (ix=0; ix<(uint32_t)n->fLastPosSet->size(); ix++) { -// i = (RBBINode *)n->fLastPosSet->elementAt(ix); -// setAdd(i->fFollowPos, n->fFirstPosSet); -// } -// } - - - -// } - -// //----------------------------------------------------------------------------- -// // -// // addRuleRootNodes Recursively walk a parse tree, adding all nodes flagged -// // as roots of a rule to a destination vector. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::addRuleRootNodes(UVector *dest, RBBINode *node) { -// if (node == NULL || U_FAILURE(*fStatus)) { -// return; -// } -// if (node->fRuleRoot) { -// dest->addElement(node, *fStatus); -// // Note: rules cannot nest. If we found a rule start node, -// // no child node can also be a start node. -// return; -// } -// addRuleRootNodes(dest, node->fLeftChild); -// addRuleRootNodes(dest, node->fRightChild); -// } - -// //----------------------------------------------------------------------------- -// // -// // calcChainedFollowPos. Modify the previously calculated followPos sets -// // to implement rule chaining. NOT described by Aho -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree) { - -// UVector endMarkerNodes(*fStatus); -// UVector leafNodes(*fStatus); -// int32_t i; - -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// // get a list of all endmarker nodes. -// tree->findNodes(&endMarkerNodes, RBBINode::endMark, *fStatus); - -// // get a list all leaf nodes -// tree->findNodes(&leafNodes, RBBINode::leafChar, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// // Collect all leaf nodes that can start matches for rules -// // with inbound chaining enabled, which is the union of the -// // firstPosition sets from each of the rule root nodes. - -// UVector ruleRootNodes(*fStatus); -// addRuleRootNodes(&ruleRootNodes, tree); - -// UVector matchStartNodes(*fStatus); -// for (int j=0; j(ruleRootNodes.elementAt(j)); -// if (node->fChainIn) { -// setAdd(&matchStartNodes, node->fFirstPosSet); -// } -// } -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// int32_t endNodeIx; -// int32_t startNodeIx; - -// for (endNodeIx=0; endNodeIxfFollowPos->contains(endMarkerNodes.elementAt(i))) { -// endNode = tNode; -// break; -// } -// } -// if (endNode == NULL) { -// // node wasn't an end node. Try again with the next. -// continue; -// } - -// // We've got a node that can end a match. - -// // Line Break Specific hack: If this node's val correspond to the $CM char class, -// // don't chain from it. -// // TODO: Add rule syntax for this behavior, get specifics out of here and -// // into the rule file. -// if (fRB->fLBCMNoChain) { -// UChar32 c = this->fRB->fSetBuilder->getFirstChar(endNode->fVal); -// if (c != -1) { -// // c == -1 occurs with sets containing only the {eof} marker string. -// ULineBreak cLBProp = (ULineBreak)u_getIntPropertyValue(c, UCHAR_LINE_BREAK); -// if (cLBProp == U_LB_COMBINING_MARK) { -// continue; -// } -// } -// } - - -// // Now iterate over the nodes that can start a match, looking for ones -// // with the same char class as our ending node. -// RBBINode *startNode; -// for (startNodeIx = 0; startNodeIxfType != RBBINode::leafChar) { -// continue; -// } - -// if (endNode->fVal == startNode->fVal) { -// // The end val (character class) of one possible match is the -// // same as the start of another. - -// // Add all nodes from the followPos of the start node to the -// // followPos set of the end node, which will have the effect of -// // letting matches transition from a match state at endNode -// // to the second char of a match starting with startNode. -// setAdd(endNode->fFollowPos, startNode->fFollowPos); -// } -// } -// } -// } - - -// //----------------------------------------------------------------------------- -// // -// // bofFixup. Fixup for state tables that include {bof} beginning of input testing. -// // Do an swizzle similar to chaining, modifying the followPos set of -// // the bofNode to include the followPos nodes from other {bot} nodes -// // scattered through the tree. -// // -// // This function has much in common with calcChainedFollowPos(). -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::bofFixup() { - -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// // The parse tree looks like this ... -// // fTree root ---> -// // / \ . -// // <#end node> -// // / \ . -// // rest -// // of tree -// // -// // We will be adding things to the followPos set of the -// // -// RBBINode *bofNode = fTree->fLeftChild->fLeftChild; -// U_ASSERT(bofNode->fType == RBBINode::leafChar); -// U_ASSERT(bofNode->fVal == 2); - -// // Get all nodes that can be the start a match of the user-written rules -// // (excluding the fake bofNode) -// // We want the nodes that can start a match in the -// // part labeled "rest of tree" -// // -// UVector *matchStartNodes = fTree->fLeftChild->fRightChild->fFirstPosSet; - -// RBBINode *startNode; -// int startNodeIx; -// for (startNodeIx = 0; startNodeIxsize(); startNodeIx++) { -// startNode = (RBBINode *)matchStartNodes->elementAt(startNodeIx); -// if (startNode->fType != RBBINode::leafChar) { -// continue; -// } - -// if (startNode->fVal == bofNode->fVal) { -// // We found a leaf node corresponding to a {bof} that was -// // explicitly written into a rule. -// // Add everything from the followPos set of this node to the -// // followPos set of the fake bofNode at the start of the tree. -// // -// setAdd(bofNode->fFollowPos, startNode->fFollowPos); -// } -// } -// } - -// //----------------------------------------------------------------------------- -// // -// // buildStateTable() Determine the set of runtime DFA states and the -// // transition tables for these states, by the algorithm -// // of fig. 3.44 in Aho. -// // -// // Most of the comments are quotes of Aho's psuedo-code. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::buildStateTable() { -// if (U_FAILURE(*fStatus)) { -// return; -// } -// RBBIStateDescriptor *failState; -// // Set it to NULL to avoid uninitialized warning -// RBBIStateDescriptor *initialState = NULL; -// // -// // Add a dummy state 0 - the stop state. Not from Aho. -// int lastInputSymbol = fRB->fSetBuilder->getNumCharCategories() - 1; -// failState = new RBBIStateDescriptor(lastInputSymbol, fStatus); -// if (failState == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// goto ExitBuildSTdeleteall; -// } -// failState->fPositions = new UVector(*fStatus); -// if (failState->fPositions == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// } -// if (failState->fPositions == NULL || U_FAILURE(*fStatus)) { -// goto ExitBuildSTdeleteall; -// } -// fDStates->addElement(failState, *fStatus); -// if (U_FAILURE(*fStatus)) { -// goto ExitBuildSTdeleteall; -// } - -// // initially, the only unmarked state in Dstates is firstpos(root), -// // where toot is the root of the syntax tree for (r)#; -// initialState = new RBBIStateDescriptor(lastInputSymbol, fStatus); -// if (initialState == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// } -// if (U_FAILURE(*fStatus)) { -// goto ExitBuildSTdeleteall; -// } -// initialState->fPositions = new UVector(*fStatus); -// if (initialState->fPositions == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// } -// if (U_FAILURE(*fStatus)) { -// goto ExitBuildSTdeleteall; -// } -// setAdd(initialState->fPositions, fTree->fFirstPosSet); -// fDStates->addElement(initialState, *fStatus); -// if (U_FAILURE(*fStatus)) { -// goto ExitBuildSTdeleteall; -// } - -// // while there is an unmarked state T in Dstates do begin -// for (;;) { -// RBBIStateDescriptor *T = NULL; -// int32_t tx; -// for (tx=1; txsize(); tx++) { -// RBBIStateDescriptor *temp; -// temp = (RBBIStateDescriptor *)fDStates->elementAt(tx); -// if (temp->fMarked == FALSE) { -// T = temp; -// break; -// } -// } -// if (T == NULL) { -// break; -// } - -// // mark T; -// T->fMarked = TRUE; - -// // for each input symbol a do begin -// int32_t a; -// for (a = 1; a<=lastInputSymbol; a++) { -// // let U be the set of positions that are in followpos(p) -// // for some position p in T -// // such that the symbol at position p is a; -// UVector *U = NULL; -// RBBINode *p; -// int32_t px; -// for (px=0; pxfPositions->size(); px++) { -// p = (RBBINode *)T->fPositions->elementAt(px); -// if ((p->fType == RBBINode::leafChar) && (p->fVal == a)) { -// if (U == NULL) { -// U = new UVector(*fStatus); -// if (U == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// goto ExitBuildSTdeleteall; -// } -// } -// setAdd(U, p->fFollowPos); -// } -// } - -// // if U is not empty and not in DStates then -// int32_t ux = 0; -// UBool UinDstates = FALSE; -// if (U != NULL) { -// U_ASSERT(U->size() > 0); -// int ix; -// for (ix=0; ixsize(); ix++) { -// RBBIStateDescriptor *temp2; -// temp2 = (RBBIStateDescriptor *)fDStates->elementAt(ix); -// if (setEquals(U, temp2->fPositions)) { -// delete U; -// U = temp2->fPositions; -// ux = ix; -// UinDstates = TRUE; -// break; -// } -// } - -// // Add U as an unmarked state to Dstates -// if (!UinDstates) -// { -// RBBIStateDescriptor *newState = new RBBIStateDescriptor(lastInputSymbol, fStatus); -// if (newState == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// } -// if (U_FAILURE(*fStatus)) { -// goto ExitBuildSTdeleteall; -// } -// newState->fPositions = U; -// fDStates->addElement(newState, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } -// ux = fDStates->size()-1; -// } - -// // Dtran[T, a] := U; -// T->fDtran->setElementAt(ux, a); -// } -// } -// } -// return; -// // delete local pointers only if error occurred. -// ExitBuildSTdeleteall: -// delete initialState; -// delete failState; -// } - - - -// //----------------------------------------------------------------------------- -// // -// // flagAcceptingStates Identify accepting states. -// // First get a list of all of the end marker nodes. -// // Then, for each state s, -// // if s contains one of the end marker nodes in its list of tree positions then -// // s is an accepting state. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::flagAcceptingStates() { -// if (U_FAILURE(*fStatus)) { -// return; -// } -// UVector endMarkerNodes(*fStatus); -// RBBINode *endMarker; -// int32_t i; -// int32_t n; - -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// fTree->findNodes(&endMarkerNodes, RBBINode::endMark, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } - -// for (i=0; isize(); n++) { -// RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n); -// if (sd->fPositions->indexOf(endMarker) >= 0) { -// // Any non-zero value for fAccepting means this is an accepting node. -// // The value is what will be returned to the user as the break status. -// // If no other value was specified, force it to -1. - -// if (sd->fAccepting==0) { -// // State hasn't been marked as accepting yet. Do it now. -// sd->fAccepting = endMarker->fVal; -// if (sd->fAccepting == 0) { -// sd->fAccepting = -1; -// } -// } -// if (sd->fAccepting==-1 && endMarker->fVal != 0) { -// // Both lookahead and non-lookahead accepting for this state. -// // Favor the look-ahead. Expedient for line break. -// // TODO: need a more elegant resolution for conflicting rules. -// sd->fAccepting = endMarker->fVal; -// } -// // implicit else: -// // if sd->fAccepting already had a value other than 0 or -1, leave it be. - -// // If the end marker node is from a look-ahead rule, set -// // the fLookAhead field for this state also. -// if (endMarker->fLookAheadEnd) { -// // TODO: don't change value if already set? -// // TODO: allow for more than one active look-ahead rule in engine. -// // Make value here an index to a side array in engine? -// sd->fLookAhead = sd->fAccepting; -// } -// } -// } -// } -// } - - -// //----------------------------------------------------------------------------- -// // -// // flagLookAheadStates Very similar to flagAcceptingStates, above. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::flagLookAheadStates() { -// if (U_FAILURE(*fStatus)) { -// return; -// } -// UVector lookAheadNodes(*fStatus); -// RBBINode *lookAheadNode; -// int32_t i; -// int32_t n; - -// fTree->findNodes(&lookAheadNodes, RBBINode::lookAhead, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } -// for (i=0; isize(); n++) { -// RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n); -// if (sd->fPositions->indexOf(lookAheadNode) >= 0) { -// sd->fLookAhead = lookAheadNode->fVal; -// } -// } -// } -// } - - - - -// //----------------------------------------------------------------------------- -// // -// // flagTaggedStates -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::flagTaggedStates() { -// if (U_FAILURE(*fStatus)) { -// return; -// } -// UVector tagNodes(*fStatus); -// RBBINode *tagNode; -// int32_t i; -// int32_t n; - -// if (U_FAILURE(*fStatus)) { -// return; -// } -// fTree->findNodes(&tagNodes, RBBINode::tag, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } -// for (i=0; isize(); n++) { // For each state s (row in the state table) -// RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n); -// if (sd->fPositions->indexOf(tagNode) >= 0) { // if s include the tag node t -// sortedAdd(&sd->fTagVals, tagNode->fVal); -// } -// } -// } -// } - - - - -// //----------------------------------------------------------------------------- -// // -// // mergeRuleStatusVals -// // -// // Update the global table of rule status {tag} values -// // The rule builder has a global vector of status values that are common -// // for all tables. Merge the ones from this table into the global set. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::mergeRuleStatusVals() { -// // -// // The basic outline of what happens here is this... -// // -// // for each state in this state table -// // if the status tag list for this state is in the global statuses list -// // record where and -// // continue with the next state -// // else -// // add the tag list for this state to the global list. -// // -// int i; -// int n; - -// // Pre-set a single tag of {0} into the table. -// // We will need this as a default, for rule sets with no explicit tagging. -// if (fRB->fRuleStatusVals->size() == 0) { -// fRB->fRuleStatusVals->addElement(1, *fStatus); // Num of statuses in group -// fRB->fRuleStatusVals->addElement((int32_t)0, *fStatus); // and our single status of zero -// } - -// // For each state -// for (n=0; nsize(); n++) { -// RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n); -// UVector *thisStatesTagValues = sd->fTagVals; -// if (thisStatesTagValues == NULL) { -// // No tag values are explicitly associated with this state. -// // Set the default tag value. -// sd->fTagsIdx = 0; -// continue; -// } - -// // There are tag(s) associated with this state. -// // fTagsIdx will be the index into the global tag list for this state's tag values. -// // Initial value of -1 flags that we haven't got it set yet. -// sd->fTagsIdx = -1; -// int32_t thisTagGroupStart = 0; // indexes into the global rule status vals list -// int32_t nextTagGroupStart = 0; - -// // Loop runs once per group of tags in the global list -// while (nextTagGroupStart < fRB->fRuleStatusVals->size()) { -// thisTagGroupStart = nextTagGroupStart; -// nextTagGroupStart += fRB->fRuleStatusVals->elementAti(thisTagGroupStart) + 1; -// if (thisStatesTagValues->size() != fRB->fRuleStatusVals->elementAti(thisTagGroupStart)) { -// // The number of tags for this state is different from -// // the number of tags in this group from the global list. -// // Continue with the next group from the global list. -// continue; -// } -// // The lengths match, go ahead and compare the actual tag values -// // between this state and the group from the global list. -// for (i=0; isize(); i++) { -// if (thisStatesTagValues->elementAti(i) != -// fRB->fRuleStatusVals->elementAti(thisTagGroupStart + 1 + i) ) { -// // Mismatch. -// break; -// } -// } - -// if (i == thisStatesTagValues->size()) { -// // We found a set of tag values in the global list that match -// // those for this state. Use them. -// sd->fTagsIdx = thisTagGroupStart; -// break; -// } -// } - -// if (sd->fTagsIdx == -1) { -// // No suitable entry in the global tag list already. Add one -// sd->fTagsIdx = fRB->fRuleStatusVals->size(); -// fRB->fRuleStatusVals->addElement(thisStatesTagValues->size(), *fStatus); -// for (i=0; isize(); i++) { -// fRB->fRuleStatusVals->addElement(thisStatesTagValues->elementAti(i), *fStatus); -// } -// } -// } -// } - - - - - - - -// //----------------------------------------------------------------------------- -// // -// // sortedAdd Add a value to a vector of sorted values (ints). -// // Do not replicate entries; if the value is already there, do not -// // add a second one. -// // Lazily create the vector if it does not already exist. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::sortedAdd(UVector **vector, int32_t val) { -// int32_t i; - -// if (*vector == NULL) { -// *vector = new UVector(*fStatus); -// } -// if (*vector == NULL || U_FAILURE(*fStatus)) { -// return; -// } -// UVector *vec = *vector; -// int32_t vSize = vec->size(); -// for (i=0; ielementAti(i); -// if (valAtI == val) { -// // The value is already in the vector. Don't add it again. -// return; -// } -// if (valAtI > val) { -// break; -// } -// } -// vec->insertElementAt(val, i, *fStatus); -// } - - - -// //----------------------------------------------------------------------------- -// // -// // setAdd Set operation on UVector -// // dest = dest union source -// // Elements may only appear once and must be sorted. -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::setAdd(UVector *dest, UVector *source) { -// int32_t destOriginalSize = dest->size(); -// int32_t sourceSize = source->size(); -// int32_t di = 0; -// MaybeStackArray destArray, sourceArray; // Handle small cases without malloc -// void **destPtr, **sourcePtr; -// void **destLim, **sourceLim; - -// if (destOriginalSize > destArray.getCapacity()) { -// if (destArray.resize(destOriginalSize) == NULL) { -// return; -// } -// } -// destPtr = destArray.getAlias(); -// destLim = destPtr + destOriginalSize; // destArray.getArrayLimit()? - -// if (sourceSize > sourceArray.getCapacity()) { -// if (sourceArray.resize(sourceSize) == NULL) { -// return; -// } -// } -// sourcePtr = sourceArray.getAlias(); -// sourceLim = sourcePtr + sourceSize; // sourceArray.getArrayLimit()? - -// // Avoid multiple "get element" calls by getting the contents into arrays -// (void) dest->toArray(destPtr); -// (void) source->toArray(sourcePtr); - -// dest->setSize(sourceSize+destOriginalSize, *fStatus); - -// while (sourcePtr < sourceLim && destPtr < destLim) { -// if (*destPtr == *sourcePtr) { -// dest->setElementAt(*sourcePtr++, di++); -// destPtr++; -// } -// // This check is required for machines with segmented memory, like i5/OS. -// // Direct pointer comparison is not recommended. -// else if (uprv_memcmp(destPtr, sourcePtr, sizeof(void *)) < 0) { -// dest->setElementAt(*destPtr++, di++); -// } -// else { /* *sourcePtr < *destPtr */ -// dest->setElementAt(*sourcePtr++, di++); -// } -// } - -// // At most one of these two cleanup loops will execute -// while (destPtr < destLim) { -// dest->setElementAt(*destPtr++, di++); -// } -// while (sourcePtr < sourceLim) { -// dest->setElementAt(*sourcePtr++, di++); -// } - -// dest->setSize(di, *fStatus); -// } - - - -// //----------------------------------------------------------------------------- -// // -// // setEqual Set operation on UVector. -// // Compare for equality. -// // Elements must be sorted. -// // -// //----------------------------------------------------------------------------- -// UBool RBBITableBuilder::setEquals(UVector *a, UVector *b) { -// return a->equals(*b); -// } - - -// //----------------------------------------------------------------------------- -// // -// // printPosSets Debug function. Dump Nullable, firstpos, lastpos and followpos -// // for each node in the tree. -// // -// //----------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// void RBBITableBuilder::printPosSets(RBBINode *n) { -// if (n==NULL) { -// return; -// } -// printf("\n"); -// RBBINode::printNodeHeader(); -// RBBINode::printNode(n); -// RBBIDebugPrintf(" Nullable: %s\n", n->fNullable?"TRUE":"FALSE"); - -// RBBIDebugPrintf(" firstpos: "); -// printSet(n->fFirstPosSet); - -// RBBIDebugPrintf(" lastpos: "); -// printSet(n->fLastPosSet); - -// RBBIDebugPrintf(" followpos: "); -// printSet(n->fFollowPos); - -// printPosSets(n->fLeftChild); -// printPosSets(n->fRightChild); -// } -// #endif - -// // -// // findDuplCharClassFrom() -// // -// bool RBBITableBuilder::findDuplCharClassFrom(IntPair *categories) { -// int32_t numStates = fDStates->size(); -// int32_t numCols = fRB->fSetBuilder->getNumCharCategories(); - -// for (; categories->first < numCols-1; categories->first++) { -// for (categories->second=categories->first+1; categories->second < numCols; categories->second++) { -// // Initialized to different values to prevent returning true if numStates = 0 (implies no duplicates). -// uint16_t table_base = 0; -// uint16_t table_dupl = 1; -// for (int32_t state=0; stateelementAt(state); -// table_base = (uint16_t)sd->fDtran->elementAti(categories->first); -// table_dupl = (uint16_t)sd->fDtran->elementAti(categories->second); -// if (table_base != table_dupl) { -// break; -// } -// } -// if (table_base == table_dupl) { -// return true; -// } -// } -// } -// return false; -// } - - -// // -// // removeColumn() -// // -// void RBBITableBuilder::removeColumn(int32_t column) { -// int32_t numStates = fDStates->size(); -// for (int32_t state=0; stateelementAt(state); -// U_ASSERT(column < sd->fDtran->size()); -// sd->fDtran->removeElementAt(column); -// } -// } - -// /* -// * findDuplicateState -// */ -// bool RBBITableBuilder::findDuplicateState(IntPair *states) { -// int32_t numStates = fDStates->size(); -// int32_t numCols = fRB->fSetBuilder->getNumCharCategories(); - -// for (; states->firstfirst++) { -// RBBIStateDescriptor *firstSD = (RBBIStateDescriptor *)fDStates->elementAt(states->first); -// for (states->second=states->first+1; states->secondsecond++) { -// RBBIStateDescriptor *duplSD = (RBBIStateDescriptor *)fDStates->elementAt(states->second); -// if (firstSD->fAccepting != duplSD->fAccepting || -// firstSD->fLookAhead != duplSD->fLookAhead || -// firstSD->fTagsIdx != duplSD->fTagsIdx) { -// continue; -// } -// bool rowsMatch = true; -// for (int32_t col=0; col < numCols; ++col) { -// int32_t firstVal = firstSD->fDtran->elementAti(col); -// int32_t duplVal = duplSD->fDtran->elementAti(col); -// if (!((firstVal == duplVal) || -// ((firstVal == states->first || firstVal == states->second) && -// (duplVal == states->first || duplVal == states->second)))) { -// rowsMatch = false; -// break; -// } -// } -// if (rowsMatch) { -// return true; -// } -// } -// } -// return false; -// } - - -// bool RBBITableBuilder::findDuplicateSafeState(IntPair *states) { -// int32_t numStates = fSafeTable->size(); - -// for (; states->firstfirst++) { -// UnicodeString *firstRow = static_cast(fSafeTable->elementAt(states->first)); -// for (states->second=states->first+1; states->secondsecond++) { -// UnicodeString *duplRow = static_cast(fSafeTable->elementAt(states->second)); -// bool rowsMatch = true; -// int32_t numCols = firstRow->length(); -// for (int32_t col=0; col < numCols; ++col) { -// int32_t firstVal = firstRow->charAt(col); -// int32_t duplVal = duplRow->charAt(col); -// if (!((firstVal == duplVal) || -// ((firstVal == states->first || firstVal == states->second) && -// (duplVal == states->first || duplVal == states->second)))) { -// rowsMatch = false; -// break; -// } -// } -// if (rowsMatch) { -// return true; -// } -// } -// } -// return false; -// } - - -// void RBBITableBuilder::removeState(IntPair duplStates) { -// const int32_t keepState = duplStates.first; -// const int32_t duplState = duplStates.second; -// U_ASSERT(keepState < duplState); -// U_ASSERT(duplState < fDStates->size()); - -// RBBIStateDescriptor *duplSD = (RBBIStateDescriptor *)fDStates->elementAt(duplState); -// fDStates->removeElementAt(duplState); -// delete duplSD; - -// int32_t numStates = fDStates->size(); -// int32_t numCols = fRB->fSetBuilder->getNumCharCategories(); -// for (int32_t state=0; stateelementAt(state); -// for (int32_t col=0; colfDtran->elementAti(col); -// int32_t newVal = existingVal; -// if (existingVal == duplState) { -// newVal = keepState; -// } else if (existingVal > duplState) { -// newVal = existingVal - 1; -// } -// sd->fDtran->setElementAt(newVal, col); -// } -// if (sd->fAccepting == duplState) { -// sd->fAccepting = keepState; -// } else if (sd->fAccepting > duplState) { -// sd->fAccepting--; -// } -// if (sd->fLookAhead == duplState) { -// sd->fLookAhead = keepState; -// } else if (sd->fLookAhead > duplState) { -// sd->fLookAhead--; -// } -// } -// } - -// void RBBITableBuilder::removeSafeState(IntPair duplStates) { -// const int32_t keepState = duplStates.first; -// const int32_t duplState = duplStates.second; -// U_ASSERT(keepState < duplState); -// U_ASSERT(duplState < fSafeTable->size()); - -// fSafeTable->removeElementAt(duplState); // Note that fSafeTable has a deleter function -// // and will auto-delete the removed element. -// int32_t numStates = fSafeTable->size(); -// for (int32_t state=0; stateelementAt(state); -// int32_t numCols = sd->length(); -// for (int32_t col=0; colcharAt(col); -// int32_t newVal = existingVal; -// if (existingVal == duplState) { -// newVal = keepState; -// } else if (existingVal > duplState) { -// newVal = existingVal - 1; -// } -// sd->setCharAt(col, static_cast(newVal)); -// } -// } -// } - - -// /* -// * RemoveDuplicateStates -// */ -// int32_t RBBITableBuilder::removeDuplicateStates() { -// IntPair dupls = {3, 0}; -// int32_t numStatesRemoved = 0; - -// while (findDuplicateState(&dupls)) { -// // printf("Removing duplicate states (%d, %d)\n", dupls.first, dupls.second); -// removeState(dupls); -// ++numStatesRemoved; -// } -// return numStatesRemoved; -// } - - -// //----------------------------------------------------------------------------- -// // -// // getTableSize() Calculate the size of the runtime form of this -// // state transition table. -// // -// //----------------------------------------------------------------------------- -// int32_t RBBITableBuilder::getTableSize() const { -// int32_t size = 0; -// int32_t numRows; -// int32_t numCols; -// int32_t rowSize; - -// if (fTree == NULL) { -// return 0; -// } - -// size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table. - -// numRows = fDStates->size(); -// numCols = fRB->fSetBuilder->getNumCharCategories(); - -// rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols; -// size += numRows * rowSize; -// return size; -// } - - -// //----------------------------------------------------------------------------- -// // -// // exportTable() export the state transition table in the format required -// // by the runtime engine. getTableSize() bytes of memory -// // must be available at the output address "where". -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::exportTable(void *where) { -// RBBIStateTable *table = (RBBIStateTable *)where; -// uint32_t state; -// int col; - -// if (U_FAILURE(*fStatus) || fTree == NULL) { -// return; -// } - -// int32_t catCount = fRB->fSetBuilder->getNumCharCategories(); -// if (catCount > 0x7fff || -// fDStates->size() > 0x7fff) { -// *fStatus = U_BRK_INTERNAL_ERROR; -// return; -// } - -// table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount; -// table->fNumStates = fDStates->size(); -// table->fFlags = 0; -// if (fRB->fLookAheadHardBreak) { -// table->fFlags |= RBBI_LOOKAHEAD_HARD_BREAK; -// } -// if (fRB->fSetBuilder->sawBOF()) { -// table->fFlags |= RBBI_BOF_REQUIRED; -// } -// table->fReserved = 0; - -// for (state=0; statefNumStates; state++) { -// RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state); -// RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen); -// U_ASSERT (-32768 < sd->fAccepting && sd->fAccepting <= 32767); -// U_ASSERT (-32768 < sd->fLookAhead && sd->fLookAhead <= 32767); -// row->fAccepting = (int16_t)sd->fAccepting; -// row->fLookAhead = (int16_t)sd->fLookAhead; -// row->fTagIdx = (int16_t)sd->fTagsIdx; -// for (col=0; colfNextState[col] = (uint16_t)sd->fDtran->elementAti(col); -// } -// } -// } - - -// /** -// * Synthesize a safe state table from the main state table. -// */ -// void RBBITableBuilder::buildSafeReverseTable(UErrorCode &status) { -// // The safe table creation has three steps: - -// // 1. Identifiy pairs of character classes that are "safe." Safe means that boundaries -// // following the pair do not depend on context or state before the pair. To test -// // whether a pair is safe, run it through the main forward state table, starting -// // from each state. If the the final state is the same, no matter what the starting state, -// // the pair is safe. -// // -// // 2. Build a state table that recognizes the safe pairs. It's similar to their -// // forward table, with a column for each input character [class], and a row for -// // each state. Row 1 is the start state, and row 0 is the stop state. Initially -// // create an additional state for each input character category; being in -// // one of these states means that the character has been seen, and is potentially -// // the first of a pair. In each of these rows, the entry for the second character -// // of a safe pair is set to the stop state (0), indicating that a match was found. -// // All other table entries are set to the state corresponding the current input -// // character, allowing that charcter to be the of a start following pair. -// // -// // Because the safe rules are to be run in reverse, moving backwards in the text, -// // the first and second pair categories are swapped when building the table. -// // -// // 3. Compress the table. There are typically many rows (states) that are -// // equivalent - that have zeroes (match completed) in the same columns - -// // and can be folded together. - -// // Each safe pair is stored as two UChars in the safePair string. -// UnicodeString safePairs; - -// int32_t numCharClasses = fRB->fSetBuilder->getNumCharCategories(); -// int32_t numStates = fDStates->size(); - -// for (int32_t c1=0; c1(fDStates->elementAt(startState)); -// int32_t s2 = startStateD->fDtran->elementAti(c1); -// RBBIStateDescriptor *s2StateD = static_cast(fDStates->elementAt(s2)); -// endState = s2StateD->fDtran->elementAti(c2); -// if (wantedEndState < 0) { -// wantedEndState = endState; -// } else { -// if (wantedEndState != endState) { -// break; -// } -// } -// } -// if (wantedEndState == endState) { -// safePairs.append((char16_t)c1); -// safePairs.append((char16_t)c2); -// // printf("(%d, %d) ", c1, c2); -// } -// } -// // printf("\n"); -// } - -// // Populate the initial safe table. -// // The table as a whole is UVector -// // Each row is represented by a UnicodeString, being used as a Vector. -// // Row 0 is the stop state. -// // Row 1 is the start sate. -// // Row 2 and beyond are other states, initially one per char class, but -// // after initial construction, many of the states will be combined, compacting the table. -// // The String holds the nextState data only. The four leading fields of a row, fAccepting, -// // fLookAhead, etc. are not needed for the safe table, and are omitted at this stage of building. - -// U_ASSERT(fSafeTable == nullptr); -// fSafeTable = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, numCharClasses + 2, status); -// for (int32_t row=0; rowaddElement(new UnicodeString(numCharClasses, 0, numCharClasses+4), status); -// } - -// // From the start state, each input char class transitions to the state for that input. -// UnicodeString &startState = *static_cast(fSafeTable->elementAt(1)); -// for (int32_t charClass=0; charClass < numCharClasses; ++charClass) { -// // Note: +2 for the start & stop state. -// startState.setCharAt(charClass, static_cast(charClass+2)); -// } - -// // Initially make every other state table row look like the start state row, -// for (int32_t row=2; row(fSafeTable->elementAt(row)); -// rowState = startState; // UnicodeString assignment, copies contents. -// } - -// // Run through the safe pairs, set the next state to zero when pair has been seen. -// // Zero being the stop state, meaning we found a safe point. -// for (int32_t pairIdx=0; pairIdx(fSafeTable->elementAt(c2 + 2)); -// rowState.setCharAt(c1, 0); -// } - -// // Remove duplicate or redundant rows from the table. -// IntPair states = {1, 0}; -// while (findDuplicateSafeState(&states)) { -// // printf("Removing duplicate safe states (%d, %d)\n", states.first, states.second); -// removeSafeState(states); -// } -// } - - -// //----------------------------------------------------------------------------- -// // -// // getSafeTableSize() Calculate the size of the runtime form of this -// // safe state table. -// // -// //----------------------------------------------------------------------------- -// int32_t RBBITableBuilder::getSafeTableSize() const { -// int32_t size = 0; -// int32_t numRows; -// int32_t numCols; -// int32_t rowSize; - -// if (fSafeTable == nullptr) { -// return 0; -// } - -// size = offsetof(RBBIStateTable, fTableData); // The header, with no rows to the table. - -// numRows = fSafeTable->size(); -// numCols = fRB->fSetBuilder->getNumCharCategories(); - -// rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols; -// size += numRows * rowSize; -// return size; -// } - - -// //----------------------------------------------------------------------------- -// // -// // exportSafeTable() export the state transition table in the format required -// // by the runtime engine. getTableSize() bytes of memory -// // must be available at the output address "where". -// // -// //----------------------------------------------------------------------------- -// void RBBITableBuilder::exportSafeTable(void *where) { -// RBBIStateTable *table = (RBBIStateTable *)where; -// uint32_t state; -// int col; - -// if (U_FAILURE(*fStatus) || fSafeTable == nullptr) { -// return; -// } - -// int32_t catCount = fRB->fSetBuilder->getNumCharCategories(); -// if (catCount > 0x7fff || -// fSafeTable->size() > 0x7fff) { -// *fStatus = U_BRK_INTERNAL_ERROR; -// return; -// } - -// table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount; -// table->fNumStates = fSafeTable->size(); -// table->fFlags = 0; -// table->fReserved = 0; - -// for (state=0; statefNumStates; state++) { -// UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(state); -// RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen); -// row->fAccepting = 0; -// row->fLookAhead = 0; -// row->fTagIdx = 0; -// row->fReserved = 0; -// for (col=0; colfNextState[col] = rowString->charAt(col); -// } -// } -// } - - - - -// //----------------------------------------------------------------------------- -// // -// // printSet Debug function. Print the contents of a UVector -// // -// //----------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// void RBBITableBuilder::printSet(UVector *s) { -// int32_t i; -// for (i=0; isize(); i++) { -// const RBBINode *v = static_cast(s->elementAt(i)); -// RBBIDebugPrintf("%5d", v==NULL? -1 : v->fSerialNum); -// } -// RBBIDebugPrintf("\n"); -// } -// #endif - - -// //----------------------------------------------------------------------------- -// // -// // printStates Debug Function. Dump the fully constructed state transition table. -// // -// //----------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// void RBBITableBuilder::printStates() { -// int c; // input "character" -// int n; // state number - -// RBBIDebugPrintf("state | i n p u t s y m b o l s \n"); -// RBBIDebugPrintf(" | Acc LA Tag"); -// for (c=0; cfSetBuilder->getNumCharCategories(); c++) { -// RBBIDebugPrintf(" %2d", c); -// } -// RBBIDebugPrintf("\n"); -// RBBIDebugPrintf(" |---------------"); -// for (c=0; cfSetBuilder->getNumCharCategories(); c++) { -// RBBIDebugPrintf("---"); -// } -// RBBIDebugPrintf("\n"); - -// for (n=0; nsize(); n++) { -// RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n); -// RBBIDebugPrintf(" %3d | " , n); -// RBBIDebugPrintf("%3d %3d %5d ", sd->fAccepting, sd->fLookAhead, sd->fTagsIdx); -// for (c=0; cfSetBuilder->getNumCharCategories(); c++) { -// RBBIDebugPrintf(" %2d", sd->fDtran->elementAti(c)); -// } -// RBBIDebugPrintf("\n"); -// } -// RBBIDebugPrintf("\n\n"); -// } -// #endif - - -// //----------------------------------------------------------------------------- -// // -// // printSafeTable Debug Function. Dump the fully constructed safe table. -// // -// //----------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// void RBBITableBuilder::printReverseTable() { -// int c; // input "character" -// int n; // state number - -// RBBIDebugPrintf(" Safe Reverse Table \n"); -// if (fSafeTable == nullptr) { -// RBBIDebugPrintf(" --- nullptr ---\n"); -// return; -// } -// RBBIDebugPrintf("state | i n p u t s y m b o l s \n"); -// RBBIDebugPrintf(" | Acc LA Tag"); -// for (c=0; cfSetBuilder->getNumCharCategories(); c++) { -// RBBIDebugPrintf(" %2d", c); -// } -// RBBIDebugPrintf("\n"); -// RBBIDebugPrintf(" |---------------"); -// for (c=0; cfSetBuilder->getNumCharCategories(); c++) { -// RBBIDebugPrintf("---"); -// } -// RBBIDebugPrintf("\n"); - -// for (n=0; nsize(); n++) { -// UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(n); -// RBBIDebugPrintf(" %3d | " , n); -// RBBIDebugPrintf("%3d %3d %5d ", 0, 0, 0); // Accepting, LookAhead, Tags -// for (c=0; cfSetBuilder->getNumCharCategories(); c++) { -// RBBIDebugPrintf(" %2d", rowString->charAt(c)); -// } -// RBBIDebugPrintf("\n"); -// } -// RBBIDebugPrintf("\n\n"); -// } -// #endif - - - -// //----------------------------------------------------------------------------- -// // -// // printRuleStatusTable Debug Function. Dump the common rule status table -// // -// //----------------------------------------------------------------------------- -// #ifdef RBBI_DEBUG -// void RBBITableBuilder::printRuleStatusTable() { -// int32_t thisRecord = 0; -// int32_t nextRecord = 0; -// int i; -// UVector *tbl = fRB->fRuleStatusVals; - -// RBBIDebugPrintf("index | tags \n"); -// RBBIDebugPrintf("-------------------\n"); - -// while (nextRecord < tbl->size()) { -// thisRecord = nextRecord; -// nextRecord = thisRecord + tbl->elementAti(thisRecord) + 1; -// RBBIDebugPrintf("%4d ", thisRecord); -// for (i=thisRecord+1; ielementAti(i)); -// } -// RBBIDebugPrintf("\n"); -// } -// RBBIDebugPrintf("\n\n"); -// } -// #endif - - -// //----------------------------------------------------------------------------- -// // -// // RBBIStateDescriptor Methods. This is a very struct-like class -// // Most access is directly to the fields. -// // -// //----------------------------------------------------------------------------- - -// RBBIStateDescriptor::RBBIStateDescriptor(int lastInputSymbol, UErrorCode *fStatus) { -// fMarked = FALSE; -// fAccepting = 0; -// fLookAhead = 0; -// fTagsIdx = 0; -// fTagVals = NULL; -// fPositions = NULL; -// fDtran = NULL; - -// fDtran = new UVector32(lastInputSymbol+1, *fStatus); -// if (U_FAILURE(*fStatus)) { -// return; -// } -// if (fDtran == NULL) { -// *fStatus = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// fDtran->setSize(lastInputSymbol+1); // fDtran needs to be pre-sized. -// // It is indexed by input symbols, and will -// // hold the next state number for each -// // symbol. -// } - - -// RBBIStateDescriptor::~RBBIStateDescriptor() { -// delete fPositions; -// delete fDtran; -// delete fTagVals; -// fPositions = NULL; -// fDtran = NULL; -// fTagVals = NULL; -// } - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.h b/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.h index 9b66ab680..01eee3da4 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.h +++ b/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.h @@ -1,216 +1,232 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// // -// // rbbitblb.h -// // - -// /* -// ********************************************************************** -// * Copyright (c) 2002-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// */ - -// #ifndef RBBITBLB_H -// #define RBBITBLB_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/uobject.h" -// #include "unicode/rbbi.h" -// #include "rbbirb.h" -// #include "rbbinode.h" - - -// U_NAMESPACE_BEGIN - -// class RBBIRuleScanner; -// class RBBIRuleBuilder; -// class UVector32; - -// // -// // class RBBITableBuilder is part of the RBBI rule compiler. -// // It builds the state transition table used by the RBBI runtime -// // from the expression syntax tree generated by the rule scanner. -// // -// // This class is part of the RBBI implementation only. -// // There is no user-visible public API here. -// // - -// class RBBITableBuilder : public UMemory { -// public: -// RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status); -// ~RBBITableBuilder(); - -// void buildForwardTable(); - -// /** Return the runtime size in bytes of the built state table. */ -// int32_t getTableSize() const; - -// /** Fill in the runtime state table. Sufficient memory must exist at the specified location. -// */ -// void exportTable(void *where); - -// /** -// * Find duplicate (redundant) character classes. Begin looking with categories.first. -// * Duplicate, if found are returned in the categories parameter. -// * This is an iterator-like function, used to identify character classes -// * (state table columns) that can be eliminated. -// * @param categories in/out parameter, specifies where to start looking for duplicates, -// * and returns the first pair of duplicates found, if any. -// * @return true if duplicate char classes were found, false otherwise. -// */ -// bool findDuplCharClassFrom(IntPair *categories); - -// /** Remove a column from the state table. Used when two character categories -// * have been found equivalent, and merged together, to eliminate the uneeded table column. -// */ -// void removeColumn(int32_t column); - -// /** -// * Check for, and remove dupicate states (table rows). -// * @return the number of states removed. -// */ -// int32_t removeDuplicateStates(); - -// /** Build the safe reverse table from the already-constructed forward table. */ -// void buildSafeReverseTable(UErrorCode &status); - -// /** Return the runtime size in bytes of the built safe reverse state table. */ -// int32_t getSafeTableSize() const; - -// /** Fill in the runtime safe state table. Sufficient memory must exist at the specified location. -// */ -// void exportSafeTable(void *where); - - -// private: -// void calcNullable(RBBINode *n); -// void calcFirstPos(RBBINode *n); -// void calcLastPos(RBBINode *n); -// void calcFollowPos(RBBINode *n); -// void calcChainedFollowPos(RBBINode *n); -// void bofFixup(); -// void buildStateTable(); -// void flagAcceptingStates(); -// void flagLookAheadStates(); -// void flagTaggedStates(); -// void mergeRuleStatusVals(); - -// /** -// * Merge redundant state table columns, eliminating character classes with identical behavior. -// * Done after the state tables are generated, just before converting to their run-time format. -// */ -// int32_t mergeColumns(); - -// void addRuleRootNodes(UVector *dest, RBBINode *node); - -// /** -// * Find duplicate (redundant) states, beginning at the specified pair, -// * within this state table. This is an iterator-like function, used to -// * identify states (state table rows) that can be eliminated. -// * @param states in/out parameter, specifies where to start looking for duplicates, -// * and returns the first pair of duplicates found, if any. -// * @return true if duplicate states were found, false otherwise. -// */ -// bool findDuplicateState(IntPair *states); - -// /** Remove a duplicate state. -// * @param duplStates The duplicate states. The first is kept, the second is removed. -// * All references to the second in the state table are retargeted -// * to the first. -// */ -// void removeState(IntPair duplStates); - -// /** Find the next duplicate state in the safe reverse table. An iterator function. -// * @param states in/out parameter, specifies where to start looking for duplicates, -// * and returns the first pair of duplicates found, if any. -// * @return true if a duplicate pair of states was found. -// */ -// bool findDuplicateSafeState(IntPair *states); - -// /** Remove a duplicate state from the safe table. -// * @param duplStates The duplicate states. The first is kept, the second is removed. -// * All references to the second in the state table are retargeted -// * to the first. -// */ -// void removeSafeState(IntPair duplStates); - -// // Set functions for UVector. -// // TODO: make a USet subclass of UVector - -// void setAdd(UVector *dest, UVector *source); -// UBool setEquals(UVector *a, UVector *b); - -// void sortedAdd(UVector **dest, int32_t val); - -// public: -// #ifdef RBBI_DEBUG -// void printSet(UVector *s); -// void printPosSets(RBBINode *n /* = NULL*/); -// void printStates(); -// void printRuleStatusTable(); -// void printReverseTable(); -// #else -// #define printSet(s) -// #define printPosSets(n) -// #define printStates() -// #define printRuleStatusTable() -// #define printReverseTable() -// #endif - -// private: -// RBBIRuleBuilder *fRB; -// RBBINode *&fTree; // The root node of the parse tree to build a -// // table for. -// UErrorCode *fStatus; - -// /** State Descriptors, UVector */ -// UVector *fDStates; // D states (Aho's terminology) -// // Index is state number -// // Contents are RBBIStateDescriptor pointers. - -// /** Synthesized safe table, UVector of UnicodeString, one string per table row. */ -// UVector *fSafeTable; - - -// RBBITableBuilder(const RBBITableBuilder &other); // forbid copying of this class -// RBBITableBuilder &operator=(const RBBITableBuilder &other); // forbid copying of this class -// }; - -// // -// // RBBIStateDescriptor - The DFA is constructed as a set of these descriptors, -// // one for each state. -// class RBBIStateDescriptor : public UMemory { -// public: -// UBool fMarked; -// int32_t fAccepting; -// int32_t fLookAhead; -// UVector *fTagVals; -// int32_t fTagsIdx; -// UVector *fPositions; // Set of parse tree positions associated -// // with this state. Unordered (it's a set). -// // UVector contents are RBBINode * - -// UVector32 *fDtran; // Transitions out of this state. -// // indexed by input character -// // contents is int index of dest state -// // in RBBITableBuilder.fDStates - -// RBBIStateDescriptor(int maxInputSymbol, UErrorCode *fStatus); -// ~RBBIStateDescriptor(); - -// private: -// RBBIStateDescriptor(const RBBIStateDescriptor &other); // forbid copying of this class -// RBBIStateDescriptor &operator=(const RBBIStateDescriptor &other); // forbid copying of this class -// }; - - - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// +// rbbitblb.h +// + +/* +********************************************************************** +* Copyright (c) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef RBBITBLB_H +#define RBBITBLB_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/uobject.h" +#include "unicode/rbbi.h" +#include "rbbidata.h" +#include "rbbirb.h" +#include "rbbinode.h" + + +U_NAMESPACE_BEGIN + +class RBBIRuleScanner; +class RBBIRuleBuilder; +class UVector32; + +// +// class RBBITableBuilder is part of the RBBI rule compiler. +// It builds the state transition table used by the RBBI runtime +// from the expression syntax tree generated by the rule scanner. +// +// This class is part of the RBBI implementation only. +// There is no user-visible public API here. +// + +class RBBITableBuilder : public UMemory { +public: + RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status); + ~RBBITableBuilder(); + + void buildForwardTable(); + + /** Return the runtime size in bytes of the built state table. */ + int32_t getTableSize() const; + + /** Fill in the runtime state table. Sufficient memory must exist at the specified location. + */ + void exportTable(void *where); + + /** Use 8 bits to encode the forward table */ + bool use8BitsForTable() const; + + /** + * Find duplicate (redundant) character classes. Begin looking with categories.first. + * Duplicate, if found are returned in the categories parameter. + * This is an iterator-like function, used to identify character classes + * (state table columns) that can be eliminated. + * @param categories in/out parameter, specifies where to start looking for duplicates, + * and returns the first pair of duplicates found, if any. + * @return true if duplicate char classes were found, false otherwise. + */ + bool findDuplCharClassFrom(IntPair *categories); + + /** Remove a column from the state table. Used when two character categories + * have been found equivalent, and merged together, to eliminate the unneeded table column. + */ + void removeColumn(int32_t column); + + /** + * Check for, and remove duplicate states (table rows). + * @return the number of states removed. + */ + int32_t removeDuplicateStates(); + + /** Build the safe reverse table from the already-constructed forward table. */ + void buildSafeReverseTable(UErrorCode &status); + + /** Return the runtime size in bytes of the built safe reverse state table. */ + int32_t getSafeTableSize() const; + + /** Fill in the runtime safe state table. Sufficient memory must exist at the specified location. + */ + void exportSafeTable(void *where); + + /** Use 8 bits to encode the safe reverse table */ + bool use8BitsForSafeTable() const; + +private: + void calcNullable(RBBINode *n); + void calcFirstPos(RBBINode *n); + void calcLastPos(RBBINode *n); + void calcFollowPos(RBBINode *n); + void calcChainedFollowPos(RBBINode *n, RBBINode *endMarkNode); + void bofFixup(); + void buildStateTable(); + void mapLookAheadRules(); + void flagAcceptingStates(); + void flagLookAheadStates(); + void flagTaggedStates(); + void mergeRuleStatusVals(); + + /** + * Merge redundant state table columns, eliminating character classes with identical behavior. + * Done after the state tables are generated, just before converting to their run-time format. + */ + int32_t mergeColumns(); + + void addRuleRootNodes(UVector *dest, RBBINode *node); + + /** + * Find duplicate (redundant) states, beginning at the specified pair, + * within this state table. This is an iterator-like function, used to + * identify states (state table rows) that can be eliminated. + * @param states in/out parameter, specifies where to start looking for duplicates, + * and returns the first pair of duplicates found, if any. + * @return true if duplicate states were found, false otherwise. + */ + bool findDuplicateState(IntPair *states); + + /** Remove a duplicate state. + * @param duplStates The duplicate states. The first is kept, the second is removed. + * All references to the second in the state table are retargeted + * to the first. + */ + void removeState(IntPair duplStates); + + /** Find the next duplicate state in the safe reverse table. An iterator function. + * @param states in/out parameter, specifies where to start looking for duplicates, + * and returns the first pair of duplicates found, if any. + * @return true if a duplicate pair of states was found. + */ + bool findDuplicateSafeState(IntPair *states); + + /** Remove a duplicate state from the safe table. + * @param duplStates The duplicate states. The first is kept, the second is removed. + * All references to the second in the state table are retargeted + * to the first. + */ + void removeSafeState(IntPair duplStates); + + // Set functions for UVector. + // TODO: make a USet subclass of UVector + + void setAdd(UVector *dest, UVector *source); + UBool setEquals(UVector *a, UVector *b); + + void sortedAdd(UVector **dest, int32_t val); + +public: +#ifdef RBBI_DEBUG + void printSet(UVector *s); + void printPosSets(RBBINode *n /* = nullptr */); + void printStates(); + void printRuleStatusTable(); + void printReverseTable(); +#else + #define printSet(s) + #define printPosSets(n) + #define printStates() + #define printRuleStatusTable() + #define printReverseTable() +#endif + +private: + RBBIRuleBuilder *fRB; + RBBINode *&fTree; // The root node of the parse tree to build a + // table for. + UErrorCode *fStatus; + + /** State Descriptors, UVector */ + UVector *fDStates; // D states (Aho's terminology) + // Index is state number + // Contents are RBBIStateDescriptor pointers. + + /** Synthesized safe table, UVector of UnicodeString, one string per table row. */ + UVector *fSafeTable; + + /** Map from rule number (fVal in look ahead nodes) to sequential lookahead index. */ + UVector32 *fLookAheadRuleMap = nullptr; + + /* Counter used when assigning lookahead rule numbers. + * Contains the last look-ahead number already in use. + * The first look-ahead number is 2; Number 1 (ACCEPTING_UNCONDITIONAL) is reserved + * for non-lookahead accepting states. See the declarations of RBBIStateTableRowT. */ + int32_t fLASlotsInUse = ACCEPTING_UNCONDITIONAL; + + + RBBITableBuilder(const RBBITableBuilder &other) = delete; // forbid copying of this class + RBBITableBuilder &operator=(const RBBITableBuilder &other) = delete; // forbid copying of this class +}; + +// +// RBBIStateDescriptor - The DFA is constructed as a set of these descriptors, +// one for each state. +class RBBIStateDescriptor : public UMemory { +public: + UBool fMarked; + uint32_t fAccepting; + uint32_t fLookAhead; + UVector *fTagVals; + int32_t fTagsIdx; + UVector *fPositions; // Set of parse tree positions associated + // with this state. Unordered (it's a set). + // UVector contents are RBBINode * + + UVector32 *fDtran; // Transitions out of this state. + // indexed by input character + // contents is int index of dest state + // in RBBITableBuilder.fDStates + + RBBIStateDescriptor(int maxInputSymbol, UErrorCode *fStatus); + ~RBBIStateDescriptor(); + +private: + RBBIStateDescriptor(const RBBIStateDescriptor &other) = delete; // forbid copying of this class + RBBIStateDescriptor &operator=(const RBBIStateDescriptor &other) = delete; // forbid copying of this class +}; + + + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/resbund.cpp b/src/duckdb/extension/icu/third_party/icu/common/resbund.cpp index 5ec7541b4..54383c981 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/resbund.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/resbund.cpp @@ -135,7 +135,7 @@ U_NAMESPACE_BEGIN * so forth, until the chain is exhausted or the tag is found. * * Thread-safety is implemented around caches, both the cache that - * stores all the resouce data, and the cache that stores flags + * stores all the resource data, and the cache that stores flags * indicating whether or not a file has been visited. These caches * delete their storage at static cleanup time, when the process * quits. @@ -177,13 +177,13 @@ U_NAMESPACE_BEGIN UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ResourceBundle) ResourceBundle::ResourceBundle(UErrorCode &err) - :UObject(), fLocale(NULL) + :UObject(), fLocale(nullptr) { fResource = ures_open(0, Locale::getDefault().getName(), &err); } ResourceBundle::ResourceBundle(const ResourceBundle &other) - :UObject(other), fLocale(NULL) + :UObject(other), fLocale(nullptr) { UErrorCode status = U_ZERO_ERROR; @@ -191,23 +191,23 @@ ResourceBundle::ResourceBundle(const ResourceBundle &other) fResource = ures_copyResb(0, other.fResource, &status); } else { /* Copying a bad resource bundle */ - fResource = NULL; + fResource = nullptr; } } ResourceBundle::ResourceBundle(UResourceBundle *res, UErrorCode& err) - :UObject(), fLocale(NULL) + :UObject(), fLocale(nullptr) { if (res) { fResource = ures_copyResb(0, res, &err); } else { /* Copying a bad resource bundle */ - fResource = NULL; + fResource = nullptr; } } -ResourceBundle::ResourceBundle(const char* path, const Locale& locale, UErrorCode& err) - :UObject(), fLocale(NULL) +ResourceBundle::ResourceBundle(const char* path, const Locale& locale, UErrorCode& err) + :UObject(), fLocale(nullptr) { fResource = ures_open(path, locale.getName(), &err); } @@ -220,18 +220,18 @@ ResourceBundle& ResourceBundle::operator=(const ResourceBundle& other) } if(fResource != 0) { ures_close(fResource); - fResource = NULL; + fResource = nullptr; } - if (fLocale != NULL) { + if (fLocale != nullptr) { delete fLocale; - fLocale = NULL; + fLocale = nullptr; } UErrorCode status = U_ZERO_ERROR; if (other.fResource) { fResource = ures_copyResb(0, other.fResource, &status); } else { /* Copying a bad resource bundle */ - fResource = NULL; + fResource = nullptr; } return *this; } @@ -241,7 +241,7 @@ ResourceBundle::~ResourceBundle() if(fResource != 0) { ures_close(fResource); } - if(fLocale != NULL) { + if(fLocale != nullptr) { delete(fLocale); } } @@ -253,8 +253,8 @@ ResourceBundle::clone() const { UnicodeString ResourceBundle::getString(UErrorCode& status) const { int32_t len = 0; - const UChar *r = ures_getString(fResource, &len, &status); - return UnicodeString(TRUE, r, len); + const char16_t *r = ures_getString(fResource, &len, &status); + return UnicodeString(true, r, len); } const uint8_t *ResourceBundle::getBinary(int32_t& len, UErrorCode& status) const { @@ -273,27 +273,27 @@ int32_t ResourceBundle::getInt(UErrorCode& status) const { return ures_getInt(fResource, &status); } -const char *ResourceBundle::getName(void) const { +const char *ResourceBundle::getName() const { return ures_getName(fResource); } -const char *ResourceBundle::getKey(void) const { +const char *ResourceBundle::getKey() const { return ures_getKey(fResource); } -UResType ResourceBundle::getType(void) const { +UResType ResourceBundle::getType() const { return ures_getType(fResource); } -int32_t ResourceBundle::getSize(void) const { +int32_t ResourceBundle::getSize() const { return ures_getSize(fResource); } -UBool ResourceBundle::hasNext(void) const { +UBool ResourceBundle::hasNext() const { return ures_hasNext(fResource); } -void ResourceBundle::resetIterator(void) { +void ResourceBundle::resetIterator() { ures_resetIterator(fResource); } @@ -311,14 +311,14 @@ ResourceBundle ResourceBundle::getNext(UErrorCode& status) { UnicodeString ResourceBundle::getNextString(UErrorCode& status) { int32_t len = 0; - const UChar* r = ures_getNextString(fResource, &len, 0, &status); - return UnicodeString(TRUE, r, len); + const char16_t* r = ures_getNextString(fResource, &len, 0, &status); + return UnicodeString(true, r, len); } UnicodeString ResourceBundle::getNextString(const char ** key, UErrorCode& status) { int32_t len = 0; - const UChar* r = ures_getNextString(fResource, &len, key, &status); - return UnicodeString(TRUE, r, len); + const char16_t* r = ures_getNextString(fResource, &len, key, &status); + return UnicodeString(true, r, len); } ResourceBundle ResourceBundle::get(int32_t indexR, UErrorCode& status) const { @@ -335,8 +335,8 @@ ResourceBundle ResourceBundle::get(int32_t indexR, UErrorCode& status) const { UnicodeString ResourceBundle::getStringEx(int32_t indexS, UErrorCode& status) const { int32_t len = 0; - const UChar* r = ures_getStringByIndex(fResource, indexS, &len, &status); - return UnicodeString(TRUE, r, len); + const char16_t* r = ures_getStringByIndex(fResource, indexS, &len, &status); + return UnicodeString(true, r, len); } ResourceBundle ResourceBundle::get(const char* key, UErrorCode& status) const { @@ -363,8 +363,8 @@ ResourceBundle ResourceBundle::getWithFallback(const char* key, UErrorCode& stat } UnicodeString ResourceBundle::getStringEx(const char* key, UErrorCode& status) const { int32_t len = 0; - const UChar* r = ures_getStringByKey(fResource, key, &len, &status); - return UnicodeString(TRUE, r, len); + const char16_t* r = ures_getStringByKey(fResource, key, &len, &status); + return UnicodeString(true, r, len); } const char* @@ -377,17 +377,17 @@ void ResourceBundle::getVersion(UVersionInfo versionInfo) const { ures_getVersion(fResource, versionInfo); } -const Locale &ResourceBundle::getLocale(void) const { +const Locale &ResourceBundle::getLocale() const { static UMutex gLocaleLock; Mutex lock(&gLocaleLock); - if (fLocale != NULL) { + if (fLocale != nullptr) { return *fLocale; } UErrorCode status = U_ZERO_ERROR; const char *localeName = ures_getLocaleInternal(fResource, &status); ResourceBundle *ncThis = const_cast(this); ncThis->fLocale = new Locale(localeName); - return ncThis->fLocale != NULL ? *ncThis->fLocale : Locale::getDefault(); + return ncThis->fLocale != nullptr ? *ncThis->fLocale : Locale::getDefault(); } const Locale ResourceBundle::getLocale(ULocDataLocaleType type, UErrorCode &status) const diff --git a/src/duckdb/extension/icu/third_party/icu/common/resbund_cnv.cpp b/src/duckdb/extension/icu/third_party/icu/common/resbund_cnv.cpp index 45c0b399b..7f83f06f0 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/resbund_cnv.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/resbund_cnv.cpp @@ -27,14 +27,14 @@ U_NAMESPACE_BEGIN ResourceBundle::ResourceBundle( const UnicodeString& path, const Locale& locale, UErrorCode& error) - :UObject(), fLocale(NULL) + :UObject(), fLocale(nullptr) { constructForLocale(path, locale, error); } ResourceBundle::ResourceBundle( const UnicodeString& path, UErrorCode& error) - :UObject(), fLocale(NULL) + :UObject(), fLocale(nullptr) { constructForLocale(path, Locale::getDefault(), error); } @@ -45,11 +45,11 @@ ResourceBundle::constructForLocale(const UnicodeString& path, UErrorCode& error) { if (path.isEmpty()) { - fResource = ures_open(NULL, locale.getName(), &error); + fResource = ures_open(nullptr, locale.getName(), &error); } else { UnicodeString nullTerminatedPath(path); - nullTerminatedPath.append((UChar)0); + nullTerminatedPath.append((char16_t)0); fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error); } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/resource.h b/src/duckdb/extension/icu/third_party/icu/common/resource.h index 5199b8588..79ed897bd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/resource.h +++ b/src/duckdb/extension/icu/third_party/icu/common/resource.h @@ -45,7 +45,7 @@ class ResourceValue; class U_COMMON_API ResourceArray { public: /** Constructs an empty array object. */ - ResourceArray() : items16(NULL), items32(NULL), length(0) {} + ResourceArray() : items16(nullptr), items32(nullptr), length(0) {} /** Only for implementation use. @internal */ ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len, @@ -60,7 +60,7 @@ class U_COMMON_API ResourceArray { /** * @param i Array item index. * @param value Output-only, receives the value of the i'th item. - * @return TRUE if i is non-negative and less than getSize(). + * @return true if i is non-negative and less than getSize(). */ UBool getValue(int32_t i, ResourceValue &value) const; @@ -80,7 +80,7 @@ class U_COMMON_API ResourceArray { class U_COMMON_API ResourceTable { public: /** Constructs an empty table object. */ - ResourceTable() : keys16(NULL), keys32(NULL), items16(NULL), items32(NULL), length(0) {} + ResourceTable() : keys16(nullptr), keys32(nullptr), items16(nullptr), items32(nullptr), length(0) {} /** Only for implementation use. @internal */ ResourceTable(const uint16_t *k16, const int32_t *k32, @@ -97,14 +97,14 @@ class U_COMMON_API ResourceTable { * @param i Table item index. * @param key Output-only, receives the key of the i'th item. * @param value Output-only, receives the value of the i'th item. - * @return TRUE if i is non-negative and less than getSize(). + * @return true if i is non-negative and less than getSize(). */ UBool getKeyAndValue(int32_t i, const char *&key, ResourceValue &value) const; /** * @param key Key string to find in the table. * @param value Output-only, receives the value of the item with that key. - * @return TRUE if the table contains the key. + * @return true if the table contains the key. */ UBool findValue(const char *key, ResourceValue &value) const; @@ -136,23 +136,23 @@ class U_COMMON_API ResourceValue : public UObject { * * @see ures_getString() */ - virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const = 0; + virtual const char16_t *getString(int32_t &length, UErrorCode &errorCode) const = 0; inline UnicodeString getUnicodeString(UErrorCode &errorCode) const { int32_t len = 0; - const UChar *r = getString(len, errorCode); - return UnicodeString(TRUE, r, len); + const char16_t *r = getString(len, errorCode); + return UnicodeString(true, r, len); } /** * Sets U_RESOURCE_TYPE_MISMATCH if this is not an alias resource. */ - virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const = 0; + virtual const char16_t *getAliasString(int32_t &length, UErrorCode &errorCode) const = 0; inline UnicodeString getAliasUnicodeString(UErrorCode &errorCode) const { int32_t len = 0; - const UChar *r = getAliasString(len, errorCode); - return UnicodeString(TRUE, r, len); + const char16_t *r = getAliasString(len, errorCode); + return UnicodeString(true, r, len); } /** @@ -199,7 +199,7 @@ class U_COMMON_API ResourceValue : public UObject { * CLDR no-fallback data values of (three empty-set symbols)=={2205, 2205, 2205} * when enumerating tables with fallback from the specific resource bundle to root. * - * @return TRUE if this is a no-inheritance marker string + * @return true if this is a no-inheritance marker string */ virtual UBool isNoInheritanceMarker() const = 0; @@ -274,8 +274,10 @@ class U_COMMON_API ResourceSink : public UObject { * * @param key The key string of the enumeration-start resource. * Empty if the enumeration starts at the top level of the bundle. - * @param value Call getArray() or getTable() as appropriate. - * Then reuse for output values from Array and Table getters. + * @param value Call getArray() or getTable() as appropriate. Then reuse for + * output values from Array and Table getters. Note: ResourceTable and + * ResourceArray instances must outlive the ResourceValue instance for + * ResourceTracer to be happy. * @param noFallback true if the bundle has no parent; * that is, its top-level table has the nofallback attribute, * or it is the root bundle of a locale tree. @@ -284,8 +286,8 @@ class U_COMMON_API ResourceSink : public UObject { UErrorCode &errorCode) = 0; private: - ResourceSink(const ResourceSink &); // no copy constructor - ResourceSink &operator=(const ResourceSink &); // no assignment operator + ResourceSink(const ResourceSink &) = delete; // no copy constructor + ResourceSink &operator=(const ResourceSink &) = delete; // no assignment operator }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/restrace.cpp b/src/duckdb/extension/icu/third_party/icu/common/restrace.cpp deleted file mode 100644 index f30a09cf1..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/restrace.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#include "unicode/utypes.h" - -// #if U_ENABLE_TRACING - -// #include "restrace.h" -// #include "charstr.h" -// #include "cstring.h" -// #include "utracimp.h" -// #include "uresimp.h" -// #include "uassert.h" -// #include "util.h" - -// U_NAMESPACE_BEGIN - -// ResourceTracer::~ResourceTracer() = default; - -// void ResourceTracer::trace(const char* resType) const { -// U_ASSERT(fResB || fParent); -// UTRACE_ENTRY(UTRACE_UDATA_RESOURCE); -// UErrorCode status = U_ZERO_ERROR; - -// CharString filePath; -// getFilePath(filePath, status); - -// CharString resPath; -// getResPath(resPath, status); - -// // The longest type ("intvector") is 9 chars -// const char kSpaces[] = " "; -// CharString format; -// format.append(kSpaces, sizeof(kSpaces) - 1 - uprv_strlen(resType), status); -// format.append("(%s) %s @ %s", status); - -// UTRACE_DATA3(UTRACE_VERBOSE, -// format.data(), -// resType, -// filePath.data(), -// resPath.data()); -// UTRACE_EXIT_STATUS(status); -// } - -// void ResourceTracer::traceOpen() const { -// U_ASSERT(fResB); -// UTRACE_ENTRY(UTRACE_UDATA_BUNDLE); -// UErrorCode status = U_ZERO_ERROR; - -// CharString filePath; -// UTRACE_DATA1(UTRACE_VERBOSE, "%s", getFilePath(filePath, status).data()); -// UTRACE_EXIT_STATUS(status); -// } - -// CharString& ResourceTracer::getFilePath(CharString& output, UErrorCode& status) const { -// if (fResB) { -// output.append(fResB->fData->fPath, status); -// output.append('/', status); -// output.append(fResB->fData->fName, status); -// output.append(".res", status); -// } else { -// fParent->getFilePath(output, status); -// } -// return output; -// } - -// CharString& ResourceTracer::getResPath(CharString& output, UErrorCode& status) const { -// if (fResB) { -// output.append('/', status); -// output.append(fResB->fResPath, status); -// // removing the trailing / -// U_ASSERT(output[output.length()-1] == '/'); -// output.truncate(output.length()-1); -// } else { -// fParent->getResPath(output, status); -// } -// if (fKey) { -// output.append('/', status); -// output.append(fKey, status); -// } -// if (fIndex != -1) { -// output.append('[', status); -// UnicodeString indexString; -// ICU_Utility::appendNumber(indexString, fIndex); -// output.appendInvariantChars(indexString, status); -// output.append(']', status); -// } -// return output; -// } - -// void FileTracer::traceOpen(const char* path, const char* type, const char* name) { -// if (uprv_strcmp(type, "res") == 0) { -// traceOpenResFile(path, name); -// } else { -// traceOpenDataFile(path, type, name); -// } -// } - -// void FileTracer::traceOpenDataFile(const char* path, const char* type, const char* name) { -// UTRACE_ENTRY(UTRACE_UDATA_DATA_FILE); -// UErrorCode status = U_ZERO_ERROR; - -// CharString filePath; -// filePath.append(path, status); -// filePath.append('/', status); -// filePath.append(name, status); -// filePath.append('.', status); -// filePath.append(type, status); - -// UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data()); -// UTRACE_EXIT_STATUS(status); -// } - -// void FileTracer::traceOpenResFile(const char* path, const char* name) { -// UTRACE_ENTRY(UTRACE_UDATA_RES_FILE); -// UErrorCode status = U_ZERO_ERROR; - -// CharString filePath; -// filePath.append(path, status); -// filePath.append('/', status); -// filePath.append(name, status); -// filePath.append(".res", status); - -// UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data()); -// UTRACE_EXIT_STATUS(status); -// } - -// U_NAMESPACE_END - -// #endif // U_ENABLE_TRACING diff --git a/src/duckdb/extension/icu/third_party/icu/common/ruleiter.cpp b/src/duckdb/extension/icu/third_party/icu/common/ruleiter.cpp index 41eea23c0..690635a90 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ruleiter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ruleiter.cpp @@ -39,7 +39,7 @@ UChar32 RuleCharacterIterator::next(int32_t options, UBool& isEscaped, UErrorCod if (U_FAILURE(ec)) return DONE; UChar32 c = DONE; - isEscaped = FALSE; + isEscaped = false; for (;;) { c = _current(); @@ -75,7 +75,7 @@ UChar32 RuleCharacterIterator::next(int32_t options, UBool& isEscaped, UErrorCod int32_t offset = 0; c = lookahead(tempEscape, MAX_U_NOTATION_LEN).unescapeAt(offset); jumpahead(offset); - isEscaped = TRUE; + isEscaped = true; if (c < 0) { ec = U_MALFORMED_UNICODE_ESCAPE; return DONE; @@ -130,7 +130,7 @@ void RuleCharacterIterator::jumpahead(int32_t count) { UnicodeString& RuleCharacterIterator::toString(UnicodeString& result) const { int32_t b = pos.getIndex(); text.extract(0, b, result); - return result.append((UChar) 0x7C).append(text, b, 0x7FFFFFFF); // Insert '|' at index + return result.append((char16_t) 0x7C).append(text, b, 0x7FFFFFFF); // Insert '|' at index } */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ruleiter.h b/src/duckdb/extension/icu/third_party/icu/common/ruleiter.h index 4e1be5382..41731407d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ruleiter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ruleiter.h @@ -66,35 +66,35 @@ class RuleCharacterIterator : public UMemory { /** * Value returned when there are no more characters to iterate. */ - enum { DONE = -1 }; + static constexpr int32_t DONE = -1; /** * Bitmask option to enable parsing of variable names. If (options & * PARSE_VARIABLES) != 0, then an embedded variable will be expanded to * its value. Variables are parsed using the SymbolTable API. */ - enum { PARSE_VARIABLES = 1 }; + static constexpr int32_t PARSE_VARIABLES = 1; /** * Bitmask option to enable parsing of escape sequences. If (options & * PARSE_ESCAPES) != 0, then an embedded escape sequence will be expanded * to its value. Escapes are parsed using Utility.unescapeAt(). */ - enum { PARSE_ESCAPES = 2 }; + static constexpr int32_t PARSE_ESCAPES = 2; /** * Bitmask option to enable skipping of whitespace. If (options & * SKIP_WHITESPACE) != 0, then Pattern_White_Space characters will be silently * skipped, as if they were not present in the input. */ - enum { SKIP_WHITESPACE = 4 }; + static constexpr int32_t SKIP_WHITESPACE = 4; /** * Constructs an iterator over the given text, starting at the given * position. * @param text the text to be iterated * @param sym the symbol table, or null if there is none. If sym is null, - * then variables will not be deferenced, even if the PARSE_VARIABLES + * then variables will not be dereferenced, even if the PARSE_VARIABLES * option is set. * @param pos upon input, the index of the next character to return. If a * variable has been dereferenced, then pos will not increment as @@ -114,7 +114,7 @@ class RuleCharacterIterator : public UMemory { * character. * @param options one or more of the following options, bitwise-OR-ed * together: PARSE_VARIABLES, PARSE_ESCAPES, SKIP_WHITESPACE. - * @param isEscaped output parameter set to TRUE if the character + * @param isEscaped output parameter set to true if the character * was escaped * @param ec input-output error code. An error will only be set by * this routing if options includes PARSE_VARIABLES and an unknown diff --git a/src/duckdb/extension/icu/third_party/icu/common/schriter.cpp b/src/duckdb/extension/icu/third_party/icu/common/schriter.cpp index f781bd43f..d4bac8fd4 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/schriter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/schriter.cpp @@ -82,7 +82,7 @@ StringCharacterIterator::operator=(const StringCharacterIterator& that) { bool StringCharacterIterator::operator==(const ForwardCharacterIterator& that) const { if (this == &that) { - return TRUE; + return true; } // do not call UCharCharacterIterator::operator==() @@ -90,10 +90,10 @@ StringCharacterIterator::operator==(const ForwardCharacterIterator& that) const // while we compare UnicodeString objects if (typeid(*this) != typeid(that)) { - return FALSE; + return false; } - StringCharacterIterator& realThat = (StringCharacterIterator&)that; + const StringCharacterIterator& realThat = static_cast(that); return text == realThat.text && pos == realThat.pos diff --git a/src/duckdb/extension/icu/third_party/icu/common/serv.cpp b/src/duckdb/extension/icu/third_party/icu/common/serv.cpp deleted file mode 100644 index ce545b9db..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/serv.cpp +++ /dev/null @@ -1,982 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** -******************************************************************************* -* Copyright (C) 2001-2014, International Business Machines Corporation. -* All Rights Reserved. -******************************************************************************* -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_SERVICE - -#include "serv.h" -#include "umutex.h" - -#undef SERVICE_REFCOUNT - -// in case we use the refcount stuff - -U_NAMESPACE_BEGIN - -/* -****************************************************************** -*/ - -const UChar ICUServiceKey::PREFIX_DELIMITER = 0x002F; /* '/' */ - -ICUServiceKey::ICUServiceKey(const UnicodeString& id) -: _id(id) { -} - -ICUServiceKey::~ICUServiceKey() -{ -} - -const UnicodeString& -ICUServiceKey::getID() const -{ - return _id; -} - -UnicodeString& -ICUServiceKey::canonicalID(UnicodeString& result) const -{ - return result.append(_id); -} - -UnicodeString& -ICUServiceKey::currentID(UnicodeString& result) const -{ - return canonicalID(result); -} - -UnicodeString& -ICUServiceKey::currentDescriptor(UnicodeString& result) const -{ - prefix(result); - result.append(PREFIX_DELIMITER); - return currentID(result); -} - -UBool -ICUServiceKey::fallback() -{ - return FALSE; -} - -UBool -ICUServiceKey::isFallbackOf(const UnicodeString& id) const -{ - return id == _id; -} - -UnicodeString& -ICUServiceKey::prefix(UnicodeString& result) const -{ - return result; -} - -UnicodeString& -ICUServiceKey::parsePrefix(UnicodeString& result) -{ - int32_t n = result.indexOf(PREFIX_DELIMITER); - if (n < 0) { - n = 0; - } - result.remove(n); - return result; -} - -UnicodeString& -ICUServiceKey::parseSuffix(UnicodeString& result) -{ - int32_t n = result.indexOf(PREFIX_DELIMITER); - if (n >= 0) { - result.remove(0, n+1); - } - return result; -} - -#ifdef SERVICE_DEBUG -UnicodeString& -ICUServiceKey::debug(UnicodeString& result) const -{ - debugClass(result); - result.append((UnicodeString)" id: "); - result.append(_id); - return result; -} - -UnicodeString& -ICUServiceKey::debugClass(UnicodeString& result) const -{ - return result.append((UnicodeString)"ICUServiceKey"); -} -#endif - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUServiceKey) - -/* -****************************************************************** -*/ - -ICUServiceFactory::~ICUServiceFactory() {} - -SimpleFactory::SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible) -: _instance(instanceToAdopt), _id(id), _visible(visible) -{ -} - -SimpleFactory::~SimpleFactory() -{ - delete _instance; -} - -UObject* -SimpleFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const -{ - if (U_SUCCESS(status)) { - UnicodeString temp; - if (_id == key.currentID(temp)) { - return service->cloneInstance(_instance); - } - } - return NULL; -} - -void -SimpleFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const -{ - if (_visible) { - result.put(_id, (void*)this, status); // cast away const - } else { - result.remove(_id); - } -} - -UnicodeString& -SimpleFactory::getDisplayName(const UnicodeString& id, const Locale& /* locale */, UnicodeString& result) const -{ - if (_visible && _id == id) { - result = _id; - } else { - result.setToBogus(); - } - return result; -} - -#ifdef SERVICE_DEBUG -UnicodeString& -SimpleFactory::debug(UnicodeString& toAppendTo) const -{ - debugClass(toAppendTo); - toAppendTo.append((UnicodeString)" id: "); - toAppendTo.append(_id); - toAppendTo.append((UnicodeString)", visible: "); - toAppendTo.append(_visible ? (UnicodeString)"T" : (UnicodeString)"F"); - return toAppendTo; -} - -UnicodeString& -SimpleFactory::debugClass(UnicodeString& toAppendTo) const -{ - return toAppendTo.append((UnicodeString)"SimpleFactory"); -} -#endif - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleFactory) - -/* -****************************************************************** -*/ - -ServiceListener::~ServiceListener() {} - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceListener) - -/* -****************************************************************** -*/ - -// Record the actual id for this service in the cache, so we can return it -// even if we succeed later with a different id. -class CacheEntry : public UMemory { -private: - int32_t refcount; - -public: - UnicodeString actualDescriptor; - UObject* service; - - /** - * Releases a reference to the shared resource. - */ - ~CacheEntry() { - delete service; - } - - CacheEntry(const UnicodeString& _actualDescriptor, UObject* _service) - : refcount(1), actualDescriptor(_actualDescriptor), service(_service) { - } - - /** - * Instantiation creates an initial reference, so don't call this - * unless you're creating a new pointer to this. Management of - * that pointer will have to know how to deal with refcounts. - * Return true if the resource has not already been released. - */ - CacheEntry* ref() { - ++refcount; - return this; - } - - /** - * Destructions removes a reference, so don't call this unless - * you're removing pointer to this somewhere. Management of that - * pointer will have to know how to deal with refcounts. Once - * the refcount drops to zero, the resource is released. Return - * false if the resouce has been released. - */ - CacheEntry* unref() { - if ((--refcount) == 0) { - delete this; - return NULL; - } - return this; - } - - /** - * Return TRUE if there is at least one reference to this and the - * resource has not been released. - */ - UBool isShared() const { - return refcount > 1; - } -}; - -// UObjectDeleter for serviceCache -U_CDECL_BEGIN -static void U_CALLCONV -cacheDeleter(void* obj) { - U_NAMESPACE_USE ((CacheEntry*)obj)->unref(); -} - -/** -* Deleter for UObjects -*/ -static void U_CALLCONV -deleteUObject(void *obj) { - U_NAMESPACE_USE delete (UObject*) obj; -} -U_CDECL_END - -/* -****************************************************************** -*/ - -class DNCache : public UMemory { -public: - Hashtable cache; - const Locale locale; - - DNCache(const Locale& _locale) - : cache(), locale(_locale) - { - // cache.setKeyDeleter(uprv_deleteUObject); - } -}; - - -/* -****************************************************************** -*/ - -StringPair* -StringPair::create(const UnicodeString& displayName, - const UnicodeString& id, - UErrorCode& status) -{ - if (U_SUCCESS(status)) { - StringPair* sp = new StringPair(displayName, id); - if (sp == NULL || sp->isBogus()) { - status = U_MEMORY_ALLOCATION_ERROR; - delete sp; - return NULL; - } - return sp; - } - return NULL; -} - -UBool -StringPair::isBogus() const { - return displayName.isBogus() || id.isBogus(); -} - -StringPair::StringPair(const UnicodeString& _displayName, - const UnicodeString& _id) -: displayName(_displayName) -, id(_id) -{ -} - -U_CDECL_BEGIN -static void U_CALLCONV -userv_deleteStringPair(void *obj) { - U_NAMESPACE_USE delete (StringPair*) obj; -} -U_CDECL_END - -/* -****************************************************************** -*/ - -static UMutex lock; - -ICUService::ICUService() -: name() -, timestamp(0) -, factories(NULL) -, serviceCache(NULL) -, idCache(NULL) -, dnCache(NULL) -{ -} - -ICUService::ICUService(const UnicodeString& newName) -: name(newName) -, timestamp(0) -, factories(NULL) -, serviceCache(NULL) -, idCache(NULL) -, dnCache(NULL) -{ -} - -ICUService::~ICUService() -{ - { - Mutex mutex(&lock); - clearCaches(); - delete factories; - factories = NULL; - } -} - -UObject* -ICUService::get(const UnicodeString& descriptor, UErrorCode& status) const -{ - return get(descriptor, NULL, status); -} - -UObject* -ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const -{ - UObject* result = NULL; - ICUServiceKey* key = createKey(&descriptor, status); - if (key) { - result = getKey(*key, actualReturn, status); - delete key; - } - return result; -} - -UObject* -ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const -{ - return getKey(key, NULL, status); -} - -// this is a vector that subclasses of ICUService can override to further customize the result object -// before returning it. All other public get functions should call this one. - -UObject* -ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const -{ - return getKey(key, actualReturn, NULL, status); -} - -// make it possible to call reentrantly on systems that don't have reentrant mutexes. -// we can use this simple approach since we know the situation where we're calling -// reentrantly even without knowing the thread. -class XMutex : public UMemory { -public: - inline XMutex(UMutex *mutex, UBool reentering) - : fMutex(mutex) - , fActive(!reentering) - { - if (fActive) umtx_lock(fMutex); - } - inline ~XMutex() { - if (fActive) umtx_unlock(fMutex); - } - -private: - UMutex *fMutex; - UBool fActive; -}; - -struct UVectorDeleter { - UVector* _obj; - UVectorDeleter() : _obj(NULL) {} - ~UVectorDeleter() { delete _obj; } -}; - -// called only by factories, treat as private -UObject* -ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const -{ - if (U_FAILURE(status)) { - return NULL; - } - - if (isDefault()) { - return handleDefault(key, actualReturn, status); - } - - ICUService* ncthis = (ICUService*)this; // cast away semantic const - - CacheEntry* result = NULL; - { - // The factory list can't be modified until we're done, - // otherwise we might update the cache with an invalid result. - // The cache has to stay in synch with the factory list. - // ICU doesn't have monitors so we can't use rw locks, so - // we single-thread everything using this service, for now. - - // if factory is not null, we're calling from within the mutex, - // and since some unix machines don't have reentrant mutexes we - // need to make sure not to try to lock it again. - XMutex mutex(&lock, factory != NULL); - - if (serviceCache == NULL) { - ncthis->serviceCache = new Hashtable(status); - if (ncthis->serviceCache == NULL) { - return NULL; - } - if (U_FAILURE(status)) { - delete serviceCache; - return NULL; - } - serviceCache->setValueDeleter(cacheDeleter); - } - - UnicodeString currentDescriptor; - UVectorDeleter cacheDescriptorList; - UBool putInCache = FALSE; - - int32_t startIndex = 0; - int32_t limit = factories->size(); - UBool cacheResult = TRUE; - - if (factory != NULL) { - for (int32_t i = 0; i < limit; ++i) { - if (factory == (const ICUServiceFactory*)factories->elementAt(i)) { - startIndex = i + 1; - break; - } - } - if (startIndex == 0) { - // throw new InternalError("Factory " + factory + "not registered with service: " + this); - status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; - } - cacheResult = FALSE; - } - - do { - currentDescriptor.remove(); - key.currentDescriptor(currentDescriptor); - result = (CacheEntry*)serviceCache->get(currentDescriptor); - if (result != NULL) { - break; - } - - // first test of cache failed, so we'll have to update - // the cache if we eventually succeed-- that is, if we're - // going to update the cache at all. - putInCache = TRUE; - - int32_t index = startIndex; - while (index < limit) { - ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(index++); - UObject* service = f->create(key, this, status); - if (U_FAILURE(status)) { - delete service; - return NULL; - } - if (service != NULL) { - result = new CacheEntry(currentDescriptor, service); - if (result == NULL) { - delete service; - status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - - goto outerEnd; - } - } - - // prepare to load the cache with all additional ids that - // will resolve to result, assuming we'll succeed. We - // don't want to keep querying on an id that's going to - // fallback to the one that succeeded, we want to hit the - // cache the first time next goaround. - if (cacheDescriptorList._obj == NULL) { - cacheDescriptorList._obj = new UVector(uprv_deleteUObject, NULL, 5, status); - if (U_FAILURE(status)) { - return NULL; - } - } - UnicodeString* idToCache = new UnicodeString(currentDescriptor); - if (idToCache == NULL || idToCache->isBogus()) { - status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - - cacheDescriptorList._obj->addElement(idToCache, status); - if (U_FAILURE(status)) { - return NULL; - } - } while (key.fallback()); -outerEnd: - - if (result != NULL) { - if (putInCache && cacheResult) { - serviceCache->put(result->actualDescriptor, result, status); - if (U_FAILURE(status)) { - return NULL; - } - - if (cacheDescriptorList._obj != NULL) { - for (int32_t i = cacheDescriptorList._obj->size(); --i >= 0;) { - UnicodeString* desc = (UnicodeString*)cacheDescriptorList._obj->elementAt(i); - - serviceCache->put(*desc, result, status); - if (U_FAILURE(status)) { - return NULL; - } - - result->ref(); - cacheDescriptorList._obj->removeElementAt(i); - } - } - } - - if (actualReturn != NULL) { - // strip null prefix - if (result->actualDescriptor.indexOf((UChar)0x2f) == 0) { // U+002f=slash (/) - actualReturn->remove(); - actualReturn->append(result->actualDescriptor, - 1, - result->actualDescriptor.length() - 1); - } else { - *actualReturn = result->actualDescriptor; - } - - if (actualReturn->isBogus()) { - status = U_MEMORY_ALLOCATION_ERROR; - delete result; - return NULL; - } - } - - UObject* service = cloneInstance(result->service); - if (putInCache && !cacheResult) { - delete result; - } - return service; - } - } - - return handleDefault(key, actualReturn, status); -} - -UObject* -ICUService::handleDefault(const ICUServiceKey& /* key */, UnicodeString* /* actualIDReturn */, UErrorCode& /* status */) const -{ - return NULL; -} - -UVector& -ICUService::getVisibleIDs(UVector& result, UErrorCode& status) const { - return getVisibleIDs(result, NULL, status); -} - -UVector& -ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorCode& status) const -{ - result.removeAllElements(); - - if (U_FAILURE(status)) { - return result; - } - - { - Mutex mutex(&lock); - const Hashtable* map = getVisibleIDMap(status); - if (map != NULL) { - ICUServiceKey* fallbackKey = createKey(matchID, status); - - for (int32_t pos = UHASH_FIRST;;) { - const UHashElement* e = map->nextElement(pos); - if (e == NULL) { - break; - } - - const UnicodeString* id = (const UnicodeString*)e->key.pointer; - if (fallbackKey != NULL) { - if (!fallbackKey->isFallbackOf(*id)) { - continue; - } - } - - UnicodeString* idClone = new UnicodeString(*id); - if (idClone == NULL || idClone->isBogus()) { - delete idClone; - status = U_MEMORY_ALLOCATION_ERROR; - break; - } - result.addElement(idClone, status); - if (U_FAILURE(status)) { - delete idClone; - break; - } - } - delete fallbackKey; - } - } - if (U_FAILURE(status)) { - result.removeAllElements(); - } - return result; -} - -const Hashtable* -ICUService::getVisibleIDMap(UErrorCode& status) const { - if (U_FAILURE(status)) return NULL; - - // must only be called when lock is already held - - ICUService* ncthis = (ICUService*)this; // cast away semantic const - if (idCache == NULL) { - ncthis->idCache = new Hashtable(status); - if (idCache == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; - } else if (factories != NULL) { - for (int32_t pos = factories->size(); --pos >= 0;) { - ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(pos); - f->updateVisibleIDs(*idCache, status); - } - if (U_FAILURE(status)) { - delete idCache; - ncthis->idCache = NULL; - } - } - } - - return idCache; -} - - -UnicodeString& -ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result) const -{ - return getDisplayName(id, result, Locale::getDefault()); -} - -UnicodeString& -ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const Locale& locale) const -{ - { - UErrorCode status = U_ZERO_ERROR; - Mutex mutex(&lock); - const Hashtable* map = getVisibleIDMap(status); - if (map != NULL) { - ICUServiceFactory* f = (ICUServiceFactory*)map->get(id); - if (f != NULL) { - f->getDisplayName(id, locale, result); - return result; - } - - // fallback - status = U_ZERO_ERROR; - ICUServiceKey* fallbackKey = createKey(&id, status); - while (fallbackKey != NULL && fallbackKey->fallback()) { - UnicodeString us; - fallbackKey->currentID(us); - f = (ICUServiceFactory*)map->get(us); - if (f != NULL) { - f->getDisplayName(id, locale, result); - delete fallbackKey; - return result; - } - } - delete fallbackKey; - } - } - result.setToBogus(); - return result; -} - -UVector& -ICUService::getDisplayNames(UVector& result, UErrorCode& status) const -{ - return getDisplayNames(result, Locale::getDefault(), NULL, status); -} - - -UVector& -ICUService::getDisplayNames(UVector& result, const Locale& locale, UErrorCode& status) const -{ - return getDisplayNames(result, locale, NULL, status); -} - -UVector& -ICUService::getDisplayNames(UVector& result, - const Locale& locale, - const UnicodeString* matchID, - UErrorCode& status) const -{ - result.removeAllElements(); - result.setDeleter(userv_deleteStringPair); - if (U_SUCCESS(status)) { - ICUService* ncthis = (ICUService*)this; // cast away semantic const - Mutex mutex(&lock); - - if (dnCache != NULL && dnCache->locale != locale) { - delete dnCache; - ncthis->dnCache = NULL; - } - - if (dnCache == NULL) { - const Hashtable* m = getVisibleIDMap(status); - if (U_FAILURE(status)) { - return result; - } - ncthis->dnCache = new DNCache(locale); - if (dnCache == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; - return result; - } - - int32_t pos = UHASH_FIRST; - const UHashElement* entry = NULL; - while ((entry = m->nextElement(pos)) != NULL) { - const UnicodeString* id = (const UnicodeString*)entry->key.pointer; - ICUServiceFactory* f = (ICUServiceFactory*)entry->value.pointer; - UnicodeString dname; - f->getDisplayName(*id, locale, dname); - if (dname.isBogus()) { - status = U_MEMORY_ALLOCATION_ERROR; - } else { - dnCache->cache.put(dname, (void*)id, status); // share pointer with visibleIDMap - if (U_SUCCESS(status)) { - continue; - } - } - delete dnCache; - ncthis->dnCache = NULL; - return result; - } - } - } - - ICUServiceKey* matchKey = createKey(matchID, status); - /* To ensure that all elements in the hashtable are iterated, set pos to -1. - * nextElement(pos) will skip the position at pos and begin the iteration - * at the next position, which in this case will be 0. - */ - int32_t pos = UHASH_FIRST; - const UHashElement *entry = NULL; - while ((entry = dnCache->cache.nextElement(pos)) != NULL) { - const UnicodeString* id = (const UnicodeString*)entry->value.pointer; - if (matchKey != NULL && !matchKey->isFallbackOf(*id)) { - continue; - } - const UnicodeString* dn = (const UnicodeString*)entry->key.pointer; - StringPair* sp = StringPair::create(*id, *dn, status); - result.addElement(sp, status); - if (U_FAILURE(status)) { - result.removeAllElements(); - break; - } - } - delete matchKey; - - return result; -} - -URegistryKey -ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UErrorCode& status) -{ - return registerInstance(objToAdopt, id, TRUE, status); -} - -URegistryKey -ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status) -{ - ICUServiceKey* key = createKey(&id, status); - if (key != NULL) { - UnicodeString canonicalID; - key->canonicalID(canonicalID); - delete key; - - ICUServiceFactory* f = createSimpleFactory(objToAdopt, canonicalID, visible, status); - if (f != NULL) { - return registerFactory(f, status); - } - } - delete objToAdopt; - return NULL; -} - -ICUServiceFactory* -ICUService::createSimpleFactory(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status) -{ - if (U_SUCCESS(status)) { - if ((objToAdopt != NULL) && (!id.isBogus())) { - return new SimpleFactory(objToAdopt, id, visible); - } - status = U_ILLEGAL_ARGUMENT_ERROR; - } - return NULL; -} - -URegistryKey -ICUService::registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& status) -{ - if (U_SUCCESS(status) && factoryToAdopt != NULL) { - Mutex mutex(&lock); - - if (factories == NULL) { - factories = new UVector(deleteUObject, NULL, status); - if (U_FAILURE(status)) { - delete factories; - return NULL; - } - } - factories->insertElementAt(factoryToAdopt, 0, status); - if (U_SUCCESS(status)) { - clearCaches(); - } else { - delete factoryToAdopt; - factoryToAdopt = NULL; - } - } - - if (factoryToAdopt != NULL) { - notifyChanged(); - } - - return (URegistryKey)factoryToAdopt; -} - -UBool -ICUService::unregister(URegistryKey rkey, UErrorCode& status) -{ - ICUServiceFactory *factory = (ICUServiceFactory*)rkey; - UBool result = FALSE; - if (factory != NULL && factories != NULL) { - Mutex mutex(&lock); - - if (factories->removeElement(factory)) { - clearCaches(); - result = TRUE; - } else { - status = U_ILLEGAL_ARGUMENT_ERROR; - delete factory; - } - } - if (result) { - notifyChanged(); - } - return result; -} - -void -ICUService::reset() -{ - { - Mutex mutex(&lock); - reInitializeFactories(); - clearCaches(); - } - notifyChanged(); -} - -void -ICUService::reInitializeFactories() -{ - if (factories != NULL) { - factories->removeAllElements(); - } -} - -UBool -ICUService::isDefault() const -{ - return countFactories() == 0; -} - -ICUServiceKey* -ICUService::createKey(const UnicodeString* id, UErrorCode& status) const -{ - return (U_FAILURE(status) || id == NULL) ? NULL : new ICUServiceKey(*id); -} - -void -ICUService::clearCaches() -{ - // callers synchronize before use - ++timestamp; - delete dnCache; - dnCache = NULL; - delete idCache; - idCache = NULL; - delete serviceCache; serviceCache = NULL; -} - -void -ICUService::clearServiceCache() -{ - // callers synchronize before use - delete serviceCache; serviceCache = NULL; -} - -UBool -ICUService::acceptsListener(const EventListener& l) const -{ - return dynamic_cast(&l) != NULL; -} - -void -ICUService::notifyListener(EventListener& l) const -{ - ((ServiceListener&)l).serviceChanged(*this); -} - -UnicodeString& -ICUService::getName(UnicodeString& result) const -{ - return result.append(name); -} - -int32_t -ICUService::countFactories() const -{ - return factories == NULL ? 0 : factories->size(); -} - -int32_t -ICUService::getTimestamp() const -{ - return timestamp; -} - -U_NAMESPACE_END - -/* UCONFIG_NO_SERVICE */ -#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/serv.h b/src/duckdb/extension/icu/third_party/icu/common/serv.h index e1f69cd41..9aea548fc 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/serv.h +++ b/src/duckdb/extension/icu/third_party/icu/common/serv.h @@ -74,7 +74,7 @@ class U_COMMON_API ICUServiceKey : public UObject { const UnicodeString _id; protected: - static const UChar PREFIX_DELIMITER; + static const char16_t PREFIX_DELIMITER; public: @@ -138,16 +138,16 @@ class U_COMMON_API ICUServiceKey : public UObject { * must eventually return false. This implementation has no fallbacks * and always returns false.

* - * @return TRUE if the ICUServiceKey changed to a valid fallback value. + * @return true if the ICUServiceKey changed to a valid fallback value. */ virtual UBool fallback(); /** - *

Return TRUE if a key created from id matches, or would eventually + *

Return true if a key created from id matches, or would eventually * fallback to match, the canonical ID of this ICUServiceKey.

* * @param id the id to test. - * @return TRUE if this ICUServiceKey's canonical ID is a fallback of id. + * @return true if this ICUServiceKey's canonical ID is a fallback of id. */ virtual UBool isFallbackOf(const UnicodeString& id) const; @@ -191,7 +191,7 @@ class U_COMMON_API ICUServiceKey : public UObject { /** * UObject RTTI boilerplate. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; #ifdef SERVICE_DEBUG public: @@ -217,7 +217,7 @@ class U_COMMON_API ICUServiceFactory : public UObject { /** *

Create a service object from the key, if this factory - * supports the key. Otherwise, return NULL.

+ * supports the key. Otherwise, return nullptr.

* *

If the factory supports the key, then it can call * the service's getKey(ICUServiceKey, String[], ICUServiceFactory) method @@ -230,7 +230,7 @@ class U_COMMON_API ICUServiceFactory : public UObject { * @param key the service key. * @param service the service with which this factory is registered. * @param status the error code status. - * @return the service object, or NULL if the factory does not support the key. + * @return the service object, or nullptr if the factory does not support the key. */ virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const = 0; @@ -291,15 +291,15 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { public: /** *

Construct a SimpleFactory that maps a single ID to a single - * service instance. If visible is TRUE, the ID will be visible. - * The instance must not be NULL. The SimpleFactory will adopt + * service instance. If visible is true, the ID will be visible. + * The instance must not be nullptr. The SimpleFactory will adopt * the instance, which must not be changed subsequent to this call.

* * @param instanceToAdopt the service instance to adopt. * @param id the ID to assign to this service instance. - * @param visible if TRUE, the ID will be visible. + * @param visible if true, the ID will be visible. */ - SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible = TRUE); + SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible = true); /** *

Destructor.

@@ -313,21 +313,21 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { * @param key the service key. * @param service the service with which this factory is registered. * @param status the error code status. - * @return the service object, or NULL if the factory does not support the key. + * @return the service object, or nullptr if the factory does not support the key. */ - virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override; /** - *

This implementation adds a mapping from ID -> this to result if visible is TRUE, + *

This implementation adds a mapping from ID -> this to result if visible is true, * otherwise it removes ID from result.

* * @param result the mapping table to update. * @param status the error code status. */ - virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const override; /** - *

This implementation returns the factory ID if it equals id and visible is TRUE, + *

This implementation returns the factory ID if it equals id and visible is true, * otherwise it returns the empty string. (This implementation provides * no localized id information.)

* @@ -336,7 +336,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { * @param result output parameter to hold the display name. * @return result. */ - virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; + virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const override; public: /** @@ -347,7 +347,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { /** * UObject RTTI boilerplate. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; #ifdef SERVICE_DEBUG public: @@ -363,7 +363,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { /** *

ServiceListener is the listener that ICUService provides by default. - * ICUService will notifiy this listener when factories are added to + * ICUService will notify this listener when factories are added to * or removed from the service. Subclasses can provide * different listener interfaces that extend EventListener, and modify * acceptsListener and notifyListener as appropriate.

@@ -390,7 +390,7 @@ class U_COMMON_API ServiceListener : public EventListener { /** * UObject RTTI boilerplate. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; }; @@ -420,15 +420,15 @@ class U_COMMON_API StringPair : public UMemory { * @param displayName the displayName. * @param id the ID. * @param status the error code status. - * @return a StringPair if the creation was successful, otherwise NULL. + * @return a StringPair if the creation was successful, otherwise nullptr. */ static StringPair* create(const UnicodeString& displayName, const UnicodeString& id, UErrorCode& status); /** - *

Return TRUE if either string of the pair is bogus.

- * @return TRUE if either string of the pair is bogus. + *

Return true if either string of the pair is bogus.

+ * @return true if either string of the pair is bogus. */ UBool isBogus() const; @@ -593,7 +593,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param descriptor the descriptor. * @param status the error code status. - * @return the service instance, or NULL. + * @return the service instance, or nullptr. */ UObject* get(const UnicodeString& descriptor, UErrorCode& status) const; @@ -602,9 +602,9 @@ class U_COMMON_API ICUService : public ICUNotifier { * createKey to create a key from the provided descriptor.

* * @param descriptor the descriptor. - * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr. * @param status the error code status. - * @return the service instance, or NULL. + * @return the service instance, or nullptr. */ UObject* get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const; @@ -613,15 +613,15 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param key the key. * @param status the error code status. - * @return the service instance, or NULL. + * @return the service instance, or nullptr. */ UObject* getKey(ICUServiceKey& key, UErrorCode& status) const; /** *

Given a key, return a service object, and, if actualReturn - * is not NULL, the descriptor with which it was found in the + * is not nullptr, the descriptor with which it was found in the * first element of actualReturn. If no service object matches - * this key, returns NULL and leaves actualReturn unchanged.

+ * this key, returns nullptr and leaves actualReturn unchanged.

* *

This queries the cache using the key's descriptor, and if no * object in the cache matches, tries the key on each @@ -635,9 +635,9 @@ class U_COMMON_API ICUService : public ICUNotifier { * result before returning it. * * @param key the key. - * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr. * @param status the error code status. - * @return the service instance, or NULL. + * @return the service instance, or nullptr. */ virtual UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const; @@ -648,10 +648,10 @@ class U_COMMON_API ICUService : public ICUNotifier { * should not call it directly, but call through one of the other get functions.

* * @param key the key. - * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr. * @param factory the factory making the recursive call. * @param status the error code status. - * @return the service instance, or NULL. + * @return the service instance, or nullptr. */ UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const; @@ -677,11 +677,11 @@ class U_COMMON_API ICUService : public ICUNotifier { * new elements, if any, are added.

* *

matchID is passed to createKey to create a key. If the key - * is not NULL, its isFallbackOf method is used to filter out IDs + * is not nullptr, its isFallbackOf method is used to filter out IDs * that don't match the key or have it as a fallback.

* * @param result a vector to hold the returned IDs. - * @param matchID an ID used to filter the result, or NULL if all IDs are desired. + * @param matchID an ID used to filter the result, or nullptr if all IDs are desired. * @param status the error code status. * @return the result vector. */ @@ -711,7 +711,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that - * uses the current default Locale as the locale and NULL for + * uses the current default Locale as the locale and nullptr for * the matchID.

* * @param result a vector to hold the returned displayName/id StringPairs. @@ -722,7 +722,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that - * uses NULL for the matchID.

+ * uses nullptr for the matchID.

* * @param result a vector to hold the returned displayName/id StringPairs. * @param locale the locale in which to localize the ID. @@ -746,12 +746,12 @@ class U_COMMON_API ICUService : public ICUNotifier { * discarded before new elements, if any, are added.

* *

matchID is passed to createKey to create a key. If the key - * is not NULL, its isFallbackOf method is used to filter out IDs + * is not nullptr, its isFallbackOf method is used to filter out IDs * that don't match the key or have it as a fallback.

* * @param result a vector to hold the returned displayName/id StringPairs. * @param locale the locale in which to localize the ID. - * @param matchID an ID used to filter the result, or NULL if all IDs are desired. + * @param matchID an ID used to filter the result, or nullptr if all IDs are desired. * @param status the error code status. * @return the result vector. */ UVector& getDisplayNames(UVector& result, @@ -761,7 +761,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

A convenience override of registerInstance(UObject*, const UnicodeString&, UBool) - * that defaults visible to TRUE.

+ * that defaults visible to true.

* * @param objToAdopt the object to register and adopt. * @param id the ID to assign to this object. @@ -774,7 +774,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

Register a service instance with the provided ID. The ID will be * canonicalized. The canonicalized ID will be returned by - * getVisibleIDs if visible is TRUE. The service instance will be adopted and + * getVisibleIDs if visible is true. The service instance will be adopted and * must not be modified subsequent to this call.

* *

This issues a serviceChanged notification to registered listeners.

@@ -784,7 +784,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param objToAdopt the object to register and adopt. * @param id the ID to assign to this object. - * @param visible TRUE if getVisibleIDs is to return this ID. + * @param visible true if getVisibleIDs is to return this ID. * @param status the error code status. * @return a registry key that can be passed to unregister() to unregister * (and discard) this instance. @@ -820,7 +820,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param rkey the registry key. * @param status the error code status. - * @return TRUE if the call successfully unregistered the factory. + * @return true if the call successfully unregistered the factory. */ virtual UBool unregister(URegistryKey rkey, UErrorCode& status); @@ -830,18 +830,18 @@ class U_COMMON_API ICUService : public ICUNotifier { * *

This issues a serviceChanged notification to registered listeners.

*/ - virtual void reset(void); + virtual void reset(); /** - *

Return TRUE if the service is in its default state.

+ *

Return true if the service is in its default state.

* - *

The default implementation returns TRUE if there are no + *

The default implementation returns true if there are no * factories registered.

*/ - virtual UBool isDefault(void) const; + virtual UBool isDefault() const; /** - *

Create a key from an ID. If ID is NULL, returns NULL.

+ *

Create a key from an ID. If ID is nullptr, returns nullptr.

* *

The default implementation creates an ICUServiceKey instance. * Subclasses can override to define more useful keys appropriate @@ -849,7 +849,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param a pointer to the ID for which to create a default ICUServiceKey. * @param status the error code status. - * @return the ICUServiceKey corresponding to ID, or NULL. + * @return the ICUServiceKey corresponding to ID, or nullptr. */ virtual ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const; @@ -859,7 +859,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * This is public so factories can call it, but should really be protected.

* * @param instance the service instance to clone. - * @return a clone of the passed-in instance, or NULL if cloning was unsuccessful. + * @return a clone of the passed-in instance, or nullptr if cloning was unsuccessful. */ virtual UObject* cloneInstance(UObject* instance) const = 0; @@ -877,7 +877,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param instanceToAdopt the service instance to adopt. * @param id the ID to assign to this service instance. - * @param visible if TRUE, the ID will be visible. + * @param visible if true, the ID will be visible. * @param status the error code status. * @return an instance of ICUServiceFactory that maps this instance to the provided ID. */ @@ -885,7 +885,7 @@ class U_COMMON_API ICUService : public ICUNotifier { /** *

Reinitialize the factory list to its default state. After this call, isDefault() - * must return TRUE.

+ * must return true.

* *

This issues a serviceChanged notification to registered listeners.

* @@ -895,18 +895,18 @@ class U_COMMON_API ICUService : public ICUNotifier { * directly, since it must only be called while holding write * access to the factory list.

*/ - virtual void reInitializeFactories(void); + virtual void reInitializeFactories(); /** *

Default handler for this service if no factory in the factory list * handled the key passed to getKey.

* - *

The default implementation returns NULL.

+ *

The default implementation returns nullptr.

* * @param key the key. - * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL. + * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr. * @param status the error code status. - * @return the service instance, or NULL. + * @return the service instance, or nullptr. */ virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const; @@ -918,7 +918,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * should generally not call this method directly, as it must only * be called while synchronized on the factory lock.

*/ - virtual void clearCaches(void); + virtual void clearCaches(); /** *

Return true if the listener is accepted.

@@ -928,9 +928,9 @@ class U_COMMON_API ICUService : public ICUNotifier { * different listeners.

* * @param l the listener to test. - * @return TRUE if the service accepts the listener. + * @return true if the service accepts the listener. */ - virtual UBool acceptsListener(const EventListener& l) const; + virtual UBool acceptsListener(const EventListener& l) const override; /** *

Notify the listener of a service change.

@@ -941,7 +941,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @param l the listener to notify. */ - virtual void notifyListener(EventListener& l) const; + virtual void notifyListener(EventListener& l) const override; /************************************************************************ * Utilities for subclasses. @@ -955,7 +955,7 @@ class U_COMMON_API ICUService : public ICUNotifier { * the resolution of IDs also changes, requiring the cache to be * flushed, but not the visible IDs themselves.

*/ - void clearServiceCache(void); + void clearServiceCache(); /** *

Return a map from visible IDs to factories. @@ -972,14 +972,14 @@ class U_COMMON_API ICUService : public ICUNotifier { * * @return the timestamp. */ - int32_t getTimestamp(void) const; + int32_t getTimestamp() const; /** *

Return the number of registered factories.

* * @return the number of factories registered at the time of the call. */ - int32_t countFactories(void) const; + int32_t countFactories() const; private: diff --git a/src/duckdb/extension/icu/third_party/icu/common/servlk.cpp b/src/duckdb/extension/icu/third_party/icu/common/servlk.cpp deleted file mode 100644 index 538982ca3..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/servlk.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** - ******************************************************************************* - * Copyright (C) 2001-2014, International Business Machines Corporation and * - * others. All Rights Reserved. * - ******************************************************************************* - * - ******************************************************************************* - */ -#include "unicode/utypes.h" - -#if !UCONFIG_NO_SERVICE - -#include "unicode/resbund.h" -#include "uresimp.h" -#include "cmemory.h" -#include "servloc.h" -#include "ustrfmt.h" -#include "uhash.h" -#include "charstr.h" -#include "uassert.h" - -#define UNDERSCORE_CHAR ((UChar)0x005f) -#define AT_SIGN_CHAR ((UChar)64) -#define PERIOD_CHAR ((UChar)46) - -U_NAMESPACE_BEGIN - -LocaleKey* -LocaleKey::createWithCanonicalFallback(const UnicodeString* primaryID, - const UnicodeString* canonicalFallbackID, - UErrorCode& status) -{ - return LocaleKey::createWithCanonicalFallback(primaryID, canonicalFallbackID, KIND_ANY, status); -} - -LocaleKey* -LocaleKey::createWithCanonicalFallback(const UnicodeString* primaryID, - const UnicodeString* canonicalFallbackID, - int32_t kind, - UErrorCode& status) -{ - if (primaryID == NULL || U_FAILURE(status)) { - return NULL; - } - UnicodeString canonicalPrimaryID; - LocaleUtility::canonicalLocaleString(primaryID, canonicalPrimaryID); - return new LocaleKey(*primaryID, canonicalPrimaryID, canonicalFallbackID, kind); -} - -LocaleKey::LocaleKey(const UnicodeString& primaryID, - const UnicodeString& canonicalPrimaryID, - const UnicodeString* canonicalFallbackID, - int32_t kind) - : ICUServiceKey(primaryID) - , _kind(kind) - , _primaryID(canonicalPrimaryID) - , _fallbackID() - , _currentID() -{ - _fallbackID.setToBogus(); - if (_primaryID.length() != 0) { - if (canonicalFallbackID != NULL && _primaryID != *canonicalFallbackID) { - _fallbackID = *canonicalFallbackID; - } - } - - _currentID = _primaryID; -} - -LocaleKey::~LocaleKey() {} - -UnicodeString& -LocaleKey::prefix(UnicodeString& result) const { - if (_kind != KIND_ANY) { - UChar buffer[64]; - uprv_itou(buffer, 64, _kind, 10, 0); - UnicodeString temp(buffer); - result.append(temp); - } - return result; -} - -int32_t -LocaleKey::kind() const { - return _kind; -} - -UnicodeString& -LocaleKey::canonicalID(UnicodeString& result) const { - return result.append(_primaryID); -} - -UnicodeString& -LocaleKey::currentID(UnicodeString& result) const { - if (!_currentID.isBogus()) { - result.append(_currentID); - } - return result; -} - -UnicodeString& -LocaleKey::currentDescriptor(UnicodeString& result) const { - if (!_currentID.isBogus()) { - prefix(result).append(PREFIX_DELIMITER).append(_currentID); - } else { - result.setToBogus(); - } - return result; -} - -Locale& -LocaleKey::canonicalLocale(Locale& result) const { - return LocaleUtility::initLocaleFromName(_primaryID, result); -} - -Locale& -LocaleKey::currentLocale(Locale& result) const { - return LocaleUtility::initLocaleFromName(_currentID, result); -} - -UBool -LocaleKey::fallback() { - if (!_currentID.isBogus()) { - int x = _currentID.lastIndexOf(UNDERSCORE_CHAR); - if (x != -1) { - _currentID.remove(x); // truncate current or fallback, whichever we're pointing to - return TRUE; - } - - if (!_fallbackID.isBogus()) { - _currentID = _fallbackID; - _fallbackID.setToBogus(); - return TRUE; - } - - if (_currentID.length() > 0) { - _currentID.remove(0); // completely truncate - return TRUE; - } - - _currentID.setToBogus(); - } - - return FALSE; -} - -UBool -LocaleKey::isFallbackOf(const UnicodeString& id) const { - UnicodeString temp(id); - parseSuffix(temp); - return temp.indexOf(_primaryID) == 0 && - (temp.length() == _primaryID.length() || - temp.charAt(_primaryID.length()) == UNDERSCORE_CHAR); -} - -#ifdef SERVICE_DEBUG -UnicodeString& -LocaleKey::debug(UnicodeString& result) const -{ - ICUServiceKey::debug(result); - result.append((UnicodeString)" kind: "); - result.append(_kind); - result.append((UnicodeString)" primaryID: "); - result.append(_primaryID); - result.append((UnicodeString)" fallbackID: "); - result.append(_fallbackID); - result.append((UnicodeString)" currentID: "); - result.append(_currentID); - return result; -} - -UnicodeString& -LocaleKey::debugClass(UnicodeString& result) const -{ - return result.append((UnicodeString)"LocaleKey "); -} -#endif - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocaleKey) - -U_NAMESPACE_END - -/* !UCONFIG_NO_SERVICE */ -#endif - - diff --git a/src/duckdb/extension/icu/third_party/icu/common/servlkf.cpp b/src/duckdb/extension/icu/third_party/icu/common/servlkf.cpp deleted file mode 100644 index 84f2347cd..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/servlkf.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** - ******************************************************************************* - * Copyright (C) 2001-2014, International Business Machines Corporation and * - * others. All Rights Reserved. * - ******************************************************************************* - * - ******************************************************************************* - */ -#include "unicode/utypes.h" - -#if !UCONFIG_NO_SERVICE - -#include "unicode/resbund.h" -#include "uresimp.h" -#include "cmemory.h" -#include "servloc.h" -#include "ustrfmt.h" -#include "uhash.h" -#include "charstr.h" -#include "ucln_cmn.h" -#include "uassert.h" - -#define UNDERSCORE_CHAR ((UChar)0x005f) -#define AT_SIGN_CHAR ((UChar)64) -#define PERIOD_CHAR ((UChar)46) - - -U_NAMESPACE_BEGIN - -LocaleKeyFactory::LocaleKeyFactory(int32_t coverage) - : _name() - , _coverage(coverage) -{ -} - -LocaleKeyFactory::LocaleKeyFactory(int32_t coverage, const UnicodeString& name) - : _name(name) - , _coverage(coverage) -{ -} - -LocaleKeyFactory::~LocaleKeyFactory() { -} - -UObject* -LocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const { - if (handlesKey(key, status)) { - const LocaleKey& lkey = (const LocaleKey&)key; - int32_t kind = lkey.kind(); - Locale loc; - lkey.currentLocale(loc); - - return handleCreate(loc, kind, service, status); - } - return NULL; -} - -UBool -LocaleKeyFactory::handlesKey(const ICUServiceKey& key, UErrorCode& status) const { - const Hashtable* supported = getSupportedIDs(status); - if (supported) { - UnicodeString id; - key.currentID(id); - return supported->get(id) != NULL; - } - return FALSE; -} - -void -LocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const { - const Hashtable* supported = getSupportedIDs(status); - if (supported) { - UBool visible = (_coverage & 0x1) == 0; - const UHashElement* elem = NULL; - int32_t pos = UHASH_FIRST; - while ((elem = supported->nextElement(pos)) != NULL) { - const UnicodeString& id = *((const UnicodeString*)elem->key.pointer); - if (!visible) { - result.remove(id); - } else { - result.put(id, (void*)this, status); // this is dummy non-void marker used for set semantics - if (U_FAILURE(status)) { - break; - } - } - } - } -} - -UnicodeString& -LocaleKeyFactory::getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const { - if ((_coverage & 0x1) == 0) { - //UErrorCode status = U_ZERO_ERROR; - // assume if this is called on us, we support some fallback of this id - // if (isSupportedID(id, status)) { - Locale loc; - LocaleUtility::initLocaleFromName(id, loc); - return loc.getDisplayName(locale, result); - // } - } - result.setToBogus(); - return result; -} - -UObject* -LocaleKeyFactory::handleCreate(const Locale& /* loc */, - int32_t /* kind */, - const ICUService* /* service */, - UErrorCode& /* status */) const { - return NULL; -} - -//UBool -//LocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& status) const { -// const Hashtable* ids = getSupportedIDs(status); -// return ids && ids->get(id); -//} - -const Hashtable* -LocaleKeyFactory::getSupportedIDs(UErrorCode& /* status */) const { - return NULL; -} - -#ifdef SERVICE_DEBUG -UnicodeString& -LocaleKeyFactory::debug(UnicodeString& result) const -{ - debugClass(result); - result.append((UnicodeString)", name: "); - result.append(_name); - result.append((UnicodeString)", coverage: "); - result.append(_coverage); - return result; -} - -UnicodeString& -LocaleKeyFactory::debugClass(UnicodeString& result) const -{ - return result.append((UnicodeString)"LocaleKeyFactory"); -} -#endif - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocaleKeyFactory) - -U_NAMESPACE_END - -/* !UCONFIG_NO_SERVICE */ -#endif - - diff --git a/src/duckdb/extension/icu/third_party/icu/common/servloc.h b/src/duckdb/extension/icu/third_party/icu/common/servloc.h index ccf643337..49d124090 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/servloc.h +++ b/src/duckdb/extension/icu/third_party/icu/common/servloc.h @@ -106,7 +106,7 @@ class U_COMMON_API LocaleKey : public ICUServiceKey { /** * Append the prefix associated with the kind, or nothing if the kind is KIND_ANY. */ - virtual UnicodeString& prefix(UnicodeString& result) const; + virtual UnicodeString& prefix(UnicodeString& result) const override; /** * Return the kind code associated with this key. @@ -116,17 +116,17 @@ class U_COMMON_API LocaleKey : public ICUServiceKey { /** * Return the canonicalID. */ - virtual UnicodeString& canonicalID(UnicodeString& result) const; + virtual UnicodeString& canonicalID(UnicodeString& result) const override; /** * Return the currentID. */ - virtual UnicodeString& currentID(UnicodeString& result) const; + virtual UnicodeString& currentID(UnicodeString& result) const override; /** * Return the (canonical) current descriptor, or null if no current id. */ - virtual UnicodeString& currentDescriptor(UnicodeString& result) const; + virtual UnicodeString& currentDescriptor(UnicodeString& result) const override; /** * Convenience method to return the locale corresponding to the (canonical) original ID. @@ -147,13 +147,13 @@ class U_COMMON_API LocaleKey : public ICUServiceKey { * unless the primary id was the empty string, in which case * there is no fallback. */ - virtual UBool fallback(); + virtual UBool fallback() override; /** * Return true if a key created from id matches, or would eventually * fallback to match, the canonical ID of this key. */ - virtual UBool isFallbackOf(const UnicodeString& id) const; + virtual UBool isFallbackOf(const UnicodeString& id) const override; public: /** @@ -161,7 +161,7 @@ class U_COMMON_API LocaleKey : public ICUServiceKey { */ static UClassID U_EXPORT2 getStaticClassID(); - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; /** * Destructor. @@ -238,7 +238,7 @@ class U_COMMON_API LocaleKeyFactory : public ICUServiceFactory { * kind off to handleCreate (which subclasses must implement). */ public: - virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override; protected: virtual UBool handlesKey(const ICUServiceKey& key, UErrorCode& status) const; @@ -248,17 +248,17 @@ class U_COMMON_API LocaleKeyFactory : public ICUServiceFactory { * Override of superclass method. This adjusts the result based * on the coverage rule for this factory. */ - virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const override; /** * Return a localized name for the locale represented by id. */ - virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; + virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const override; protected: /** * Utility method used by create(ICUServiceKey, ICUService). Subclasses can implement - * this instead of create. The default returns NULL. + * this instead of create. The default returns nullptr. */ virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const; @@ -281,7 +281,7 @@ class U_COMMON_API LocaleKeyFactory : public ICUServiceFactory { */ static UClassID U_EXPORT2 getStaticClassID(); - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; #ifdef SERVICE_DEBUG public: @@ -324,13 +324,13 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory { /** * Override of superclass method. Returns the service object if kind/locale match. Service is not used. */ - virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override; /** * Override of superclass method. This adjusts the result based * on the coverage rule for this factory. */ - virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const override; protected: /** @@ -345,7 +345,7 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory { */ static UClassID U_EXPORT2 getStaticClassID(); - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; #ifdef SERVICE_DEBUG public: @@ -394,20 +394,20 @@ class U_COMMON_API ICUResourceBundleFactory : public LocaleKeyFactory /** * Return the supported IDs. This is the set of all locale names in ICULocaleData. */ - virtual const Hashtable* getSupportedIDs(UErrorCode& status) const; + virtual const Hashtable* getSupportedIDs(UErrorCode& status) const override; /** * Create the service. The default implementation returns the resource bundle * for the locale, ignoring kind, and service. */ - virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const; + virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const override; public: /** * UObject boilerplate. */ static UClassID U_EXPORT2 getStaticClassID(); - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; #ifdef SERVICE_DEBUG @@ -512,13 +512,13 @@ class U_COMMON_API ICULocaleService : public ICUService * We really need a flag that is understood by all compilers that will suppress the warning about * hidden overrides. */ - virtual URegistryKey registerInstance(UObject* objToAdopt, const UnicodeString& locale, UBool visible, UErrorCode& status); + virtual URegistryKey registerInstance(UObject* objToAdopt, const UnicodeString& locale, UBool visible, UErrorCode& status) override; /** * Convenience method for callers using locales. This returns the standard * service ID enumeration. */ - virtual StringEnumeration* getAvailableLocales(void) const; + virtual StringEnumeration* getAvailableLocales() const; protected: @@ -531,7 +531,7 @@ class U_COMMON_API ICULocaleService : public ICUService /** * Override superclass createKey method. */ - virtual ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const; + virtual ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const override; /** * Additional createKey that takes a kind. diff --git a/src/duckdb/extension/icu/third_party/icu/common/servls.cpp b/src/duckdb/extension/icu/third_party/icu/common/servls.cpp deleted file mode 100644 index 81dc4f750..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/servls.cpp +++ /dev/null @@ -1,295 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** - ******************************************************************************* - * Copyright (C) 2001-2014, International Business Machines Corporation and * - * others. All Rights Reserved. * - ******************************************************************************* - * - ******************************************************************************* - */ -#include "unicode/utypes.h" - -#if !UCONFIG_NO_SERVICE - -#include "unicode/resbund.h" -#include "uresimp.h" -#include "cmemory.h" -#include "servloc.h" -#include "ustrfmt.h" -#include "charstr.h" -#include "uassert.h" - -#define UNDERSCORE_CHAR ((UChar)0x005f) -#define AT_SIGN_CHAR ((UChar)64) -#define PERIOD_CHAR ((UChar)46) - -U_NAMESPACE_BEGIN - -ICULocaleService::ICULocaleService() - : fallbackLocale(Locale::getDefault()) -{ -} - -ICULocaleService::ICULocaleService(const UnicodeString& dname) - : ICUService(dname) - , fallbackLocale(Locale::getDefault()) -{ -} - -ICULocaleService::~ICULocaleService() -{ -} - -UObject* -ICULocaleService::get(const Locale& locale, UErrorCode& status) const -{ - return get(locale, LocaleKey::KIND_ANY, NULL, status); -} - -UObject* -ICULocaleService::get(const Locale& locale, int32_t kind, UErrorCode& status) const -{ - return get(locale, kind, NULL, status); -} - -UObject* -ICULocaleService::get(const Locale& locale, Locale* actualReturn, UErrorCode& status) const -{ - return get(locale, LocaleKey::KIND_ANY, actualReturn, status); -} - -UObject* -ICULocaleService::get(const Locale& locale, int32_t kind, Locale* actualReturn, UErrorCode& status) const -{ - UObject* result = NULL; - if (U_FAILURE(status)) { - return result; - } - - UnicodeString locName(locale.getName(), -1, US_INV); - if (locName.isBogus()) { - status = U_MEMORY_ALLOCATION_ERROR; - } else { - ICUServiceKey* key = createKey(&locName, kind, status); - if (key) { - if (actualReturn == NULL) { - result = getKey(*key, status); - } else { - UnicodeString temp; - result = getKey(*key, &temp, status); - - if (result != NULL) { - key->parseSuffix(temp); - LocaleUtility::initLocaleFromName(temp, *actualReturn); - } - } - delete key; - } - } - return result; -} - - -URegistryKey -ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale, - UBool visible, UErrorCode& status) -{ - Locale loc; - LocaleUtility::initLocaleFromName(locale, loc); - return registerInstance(objToAdopt, loc, LocaleKey::KIND_ANY, - visible ? LocaleKeyFactory::VISIBLE : LocaleKeyFactory::INVISIBLE, status); -} - -URegistryKey -ICULocaleService::registerInstance(UObject* objToAdopt, const Locale& locale, UErrorCode& status) -{ - return registerInstance(objToAdopt, locale, LocaleKey::KIND_ANY, LocaleKeyFactory::VISIBLE, status); -} - -URegistryKey -ICULocaleService::registerInstance(UObject* objToAdopt, const Locale& locale, int32_t kind, UErrorCode& status) -{ - return registerInstance(objToAdopt, locale, kind, LocaleKeyFactory::VISIBLE, status); -} - -URegistryKey -ICULocaleService::registerInstance(UObject* objToAdopt, const Locale& locale, int32_t kind, int32_t coverage, UErrorCode& status) -{ - ICUServiceFactory * factory = new SimpleLocaleKeyFactory(objToAdopt, locale, kind, coverage); - if (factory != NULL) { - return registerFactory(factory, status); - } - delete objToAdopt; - return NULL; -} - -#if 0 -URegistryKey -ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale, UErrorCode& status) -{ - return registerInstance(objToAdopt, locale, LocaleKey::KIND_ANY, LocaleKeyFactory::VISIBLE, status); -} - -URegistryKey -ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale, UBool visible, UErrorCode& status) -{ - return registerInstance(objToAdopt, locale, LocaleKey::KIND_ANY, - visible ? LocaleKeyFactory::VISIBLE : LocaleKeyFactory::INVISIBLE, - status); -} - -URegistryKey -ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale, int32_t kind, int32_t coverage, UErrorCode& status) -{ - ICUServiceFactory * factory = new SimpleLocaleKeyFactory(objToAdopt, locale, kind, coverage); - if (factory != NULL) { - return registerFactory(factory, status); - } - delete objToAdopt; - return NULL; -} -#endif - -class ServiceEnumeration : public StringEnumeration { -private: - const ICULocaleService* _service; - int32_t _timestamp; - UVector _ids; - int32_t _pos; - -private: - ServiceEnumeration(const ICULocaleService* service, UErrorCode &status) - : _service(service) - , _timestamp(service->getTimestamp()) - , _ids(uprv_deleteUObject, NULL, status) - , _pos(0) - { - _service->getVisibleIDs(_ids, status); - } - - ServiceEnumeration(const ServiceEnumeration &other, UErrorCode &status) - : _service(other._service) - , _timestamp(other._timestamp) - , _ids(uprv_deleteUObject, NULL, status) - , _pos(0) - { - if(U_SUCCESS(status)) { - int32_t i, length; - - length = other._ids.size(); - for(i = 0; i < length; ++i) { - _ids.addElement(((UnicodeString *)other._ids.elementAt(i))->clone(), status); - } - - if(U_SUCCESS(status)) { - _pos = other._pos; - } - } - } - -public: - static ServiceEnumeration* create(const ICULocaleService* service) { - UErrorCode status = U_ZERO_ERROR; - ServiceEnumeration* result = new ServiceEnumeration(service, status); - if (U_SUCCESS(status)) { - return result; - } - delete result; - return NULL; - } - - virtual ~ServiceEnumeration(); - - virtual StringEnumeration *clone() const { - UErrorCode status = U_ZERO_ERROR; - ServiceEnumeration *cl = new ServiceEnumeration(*this, status); - if(U_FAILURE(status)) { - delete cl; - cl = NULL; - } - return cl; - } - - UBool upToDate(UErrorCode& status) const { - if (U_SUCCESS(status)) { - if (_timestamp == _service->getTimestamp()) { - return TRUE; - } - status = U_ENUM_OUT_OF_SYNC_ERROR; - } - return FALSE; - } - - virtual int32_t count(UErrorCode& status) const { - return upToDate(status) ? _ids.size() : 0; - } - - virtual const UnicodeString* snext(UErrorCode& status) { - if (upToDate(status) && (_pos < _ids.size())) { - return (const UnicodeString*)_ids[_pos++]; - } - return NULL; - } - - virtual void reset(UErrorCode& status) { - if (status == U_ENUM_OUT_OF_SYNC_ERROR) { - status = U_ZERO_ERROR; - } - if (U_SUCCESS(status)) { - _timestamp = _service->getTimestamp(); - _pos = 0; - _service->getVisibleIDs(_ids, status); - } - } - -public: - static UClassID U_EXPORT2 getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; -}; - -ServiceEnumeration::~ServiceEnumeration() {} - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceEnumeration) - -StringEnumeration* -ICULocaleService::getAvailableLocales(void) const -{ - return ServiceEnumeration::create(this); -} - -const UnicodeString& -ICULocaleService::validateFallbackLocale() const -{ - const Locale& loc = Locale::getDefault(); - ICULocaleService* ncThis = (ICULocaleService*)this; - static UMutex llock; - { - Mutex mutex(&llock); - if (loc != fallbackLocale) { - ncThis->fallbackLocale = loc; - LocaleUtility::initNameFromLocale(loc, ncThis->fallbackLocaleName); - ncThis->clearServiceCache(); - } - } - return fallbackLocaleName; -} - -ICUServiceKey* -ICULocaleService::createKey(const UnicodeString* id, UErrorCode& status) const -{ - return LocaleKey::createWithCanonicalFallback(id, &validateFallbackLocale(), status); -} - -ICUServiceKey* -ICULocaleService::createKey(const UnicodeString* id, int32_t kind, UErrorCode& status) const -{ - return LocaleKey::createWithCanonicalFallback(id, &validateFallbackLocale(), kind, status); -} - -U_NAMESPACE_END - -/* !UCONFIG_NO_SERVICE */ -#endif - - diff --git a/src/duckdb/extension/icu/third_party/icu/common/servnotf.cpp b/src/duckdb/extension/icu/third_party/icu/common/servnotf.cpp deleted file mode 100644 index f577795ca..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/servnotf.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** - ******************************************************************************* - * Copyright (C) 2001-2012, International Business Machines Corporation and * - * others. All Rights Reserved. * - ******************************************************************************* - */ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_SERVICE - -#include "servnotf.h" -#ifdef NOTIFIER_DEBUG -#include -#endif - -U_NAMESPACE_BEGIN - -EventListener::~EventListener() {} -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener) - -static UMutex notifyLock; - -ICUNotifier::ICUNotifier(void) -: listeners(NULL) -{ -} - -ICUNotifier::~ICUNotifier(void) { - { - Mutex lmx(¬ifyLock); - delete listeners; - listeners = NULL; - } -} - - -void -ICUNotifier::addListener(const EventListener* l, UErrorCode& status) -{ - if (U_SUCCESS(status)) { - if (l == NULL) { - status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - - if (acceptsListener(*l)) { - Mutex lmx(¬ifyLock); - if (listeners == NULL) { - listeners = new UVector(5, status); - } else { - for (int i = 0, e = listeners->size(); i < e; ++i) { - const EventListener* el = (const EventListener*)(listeners->elementAt(i)); - if (l == el) { - return; - } - } - } - - listeners->addElement((void*)l, status); // cast away const - } -#ifdef NOTIFIER_DEBUG - else { - fprintf(stderr, "Listener invalid for this notifier."); - exit(1); - } -#endif - } -} - -void -ICUNotifier::removeListener(const EventListener *l, UErrorCode& status) -{ - if (U_SUCCESS(status)) { - if (l == NULL) { - status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - - { - Mutex lmx(¬ifyLock); - if (listeners != NULL) { - // identity equality check - for (int i = 0, e = listeners->size(); i < e; ++i) { - const EventListener* el = (const EventListener*)listeners->elementAt(i); - if (l == el) { - listeners->removeElementAt(i); - if (listeners->size() == 0) { - delete listeners; - listeners = NULL; - } - return; - } - } - } - } - } -} - -void -ICUNotifier::notifyChanged(void) -{ - if (listeners != NULL) { - Mutex lmx(¬ifyLock); - if (listeners != NULL) { - for (int i = 0, e = listeners->size(); i < e; ++i) { - EventListener* el = (EventListener*)listeners->elementAt(i); - notifyListener(*el); - } - } - } -} - -U_NAMESPACE_END - -/* UCONFIG_NO_SERVICE */ -#endif - diff --git a/src/duckdb/extension/icu/third_party/icu/common/servnotf.h b/src/duckdb/extension/icu/third_party/icu/common/servnotf.h index dba7a0fea..840fe1ae8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/servnotf.h +++ b/src/duckdb/extension/icu/third_party/icu/common/servnotf.h @@ -40,7 +40,7 @@ class U_COMMON_API EventListener : public UObject { public: static UClassID U_EXPORT2 getStaticClassID(); - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; public: #ifdef SERVICE_DEBUG @@ -75,14 +75,14 @@ class U_COMMON_API ICUNotifier : public UMemory { private: UVector* listeners; public: - ICUNotifier(void); + ICUNotifier(); - virtual ~ICUNotifier(void); + virtual ~ICUNotifier(); /** * Add a listener to be notified when notifyChanged is called. * The listener must not be null. AcceptsListener must return - * true for the listener. Attempts to concurrently + * true for the listener. Attempts to concurrently * register the identical listener more than once will be * silently ignored. */ @@ -90,7 +90,7 @@ private: UVector* listeners; /** * Stop notifying this listener. The listener must - * not be null. Attemps to remove a listener that is + * not be null. Attempts to remove a listener that is * not registered will be silently ignored. */ virtual void removeListener(const EventListener* l, UErrorCode& status); @@ -101,11 +101,11 @@ private: UVector* listeners; * indefinitely block the calling thread. Callers should beware of * deadlock situations. */ - virtual void notifyChanged(void); + virtual void notifyChanged(); protected: /** - * Subclasses implement this to return TRUE if the listener is + * Subclasses implement this to return true if the listener is * of the appropriate type. */ virtual UBool acceptsListener(const EventListener& l) const = 0; diff --git a/src/duckdb/extension/icu/third_party/icu/common/servrbf.cpp b/src/duckdb/extension/icu/third_party/icu/common/servrbf.cpp deleted file mode 100644 index 94279ab3a..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/servrbf.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** - ******************************************************************************* - * Copyright (C) 2001-2014, International Business Machines Corporation and * - * others. All Rights Reserved. * - ******************************************************************************* - * - ******************************************************************************* - */ -#include "unicode/utypes.h" - -#if !UCONFIG_NO_SERVICE - -#include "unicode/resbund.h" -#include "uresimp.h" -#include "cmemory.h" -#include "servloc.h" -#include "ustrfmt.h" -#include "uhash.h" -#include "charstr.h" -#include "ucln_cmn.h" -#include "uassert.h" - -#define UNDERSCORE_CHAR ((UChar)0x005f) -#define AT_SIGN_CHAR ((UChar)64) -#define PERIOD_CHAR ((UChar)46) - -U_NAMESPACE_BEGIN - -ICUResourceBundleFactory::ICUResourceBundleFactory() - : LocaleKeyFactory(VISIBLE) - , _bundleName() -{ -} - -ICUResourceBundleFactory::ICUResourceBundleFactory(const UnicodeString& bundleName) - : LocaleKeyFactory(VISIBLE) - , _bundleName(bundleName) -{ -} - -ICUResourceBundleFactory::~ICUResourceBundleFactory() {} - -const Hashtable* -ICUResourceBundleFactory::getSupportedIDs(UErrorCode& status) const -{ - if (U_SUCCESS(status)) { - return LocaleUtility::getAvailableLocaleNames(_bundleName); - } - return NULL; -} - -UObject* -ICUResourceBundleFactory::handleCreate(const Locale& loc, int32_t /* kind */, const ICUService* /* service */, UErrorCode& status) const -{ - if (U_SUCCESS(status)) { - // _bundleName is a package name - // and should only contain invariant characters - // ??? is it always true that the max length of the bundle name is 19? - // who made this change? -- dlf - char pkg[20]; - int32_t length; - length=_bundleName.extract(0, INT32_MAX, pkg, (int32_t)sizeof(pkg), US_INV); - if(length>=(int32_t)sizeof(pkg)) { - return NULL; - } - return new ResourceBundle(pkg, loc, status); - } - return NULL; -} - -#ifdef SERVICE_DEBUG -UnicodeString& -ICUResourceBundleFactory::debug(UnicodeString& result) const -{ - LocaleKeyFactory::debug(result); - result.append((UnicodeString)", bundle: "); - return result.append(_bundleName); -} - -UnicodeString& -ICUResourceBundleFactory::debugClass(UnicodeString& result) const -{ - return result.append((UnicodeString)"ICUResourceBundleFactory"); -} -#endif - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUResourceBundleFactory) - -U_NAMESPACE_END - -/* !UCONFIG_NO_SERVICE */ -#endif - - diff --git a/src/duckdb/extension/icu/third_party/icu/common/servslkf.cpp b/src/duckdb/extension/icu/third_party/icu/common/servslkf.cpp deleted file mode 100644 index 09154d1b9..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/servslkf.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/** - ******************************************************************************* - * Copyright (C) 2001-2014, International Business Machines Corporation and * - * others. All Rights Reserved. * - ******************************************************************************* - * - ******************************************************************************* - */ -#include "unicode/utypes.h" - -#if !UCONFIG_NO_SERVICE - -#include "unicode/resbund.h" -#include "uresimp.h" -#include "cmemory.h" -#include "servloc.h" -#include "ustrfmt.h" -#include "uhash.h" -#include "charstr.h" -#include "uassert.h" - -#define UNDERSCORE_CHAR ((UChar)0x005f) -#define AT_SIGN_CHAR ((UChar)64) -#define PERIOD_CHAR ((UChar)46) - -U_NAMESPACE_BEGIN - -/* - ****************************************************************** - */ - -SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt, - const UnicodeString& locale, - int32_t kind, - int32_t coverage) - : LocaleKeyFactory(coverage) - , _obj(objToAdopt) - , _id(locale) - , _kind(kind) -{ -} - -SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt, - const Locale& locale, - int32_t kind, - int32_t coverage) - : LocaleKeyFactory(coverage) - , _obj(objToAdopt) - , _id() - , _kind(kind) -{ - LocaleUtility::initNameFromLocale(locale, _id); -} - -SimpleLocaleKeyFactory::~SimpleLocaleKeyFactory() -{ - delete _obj; - _obj = NULL; -} - -UObject* -SimpleLocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const -{ - if (U_SUCCESS(status)) { - const LocaleKey& lkey = (const LocaleKey&)key; - if (_kind == LocaleKey::KIND_ANY || _kind == lkey.kind()) { - UnicodeString keyID; - lkey.currentID(keyID); - if (_id == keyID) { - return service->cloneInstance(_obj); - } - } - } - return NULL; -} - -//UBool -//SimpleLocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& /* status */) const -//{ -// return id == _id; -//} - -void -SimpleLocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const -{ - if (U_SUCCESS(status)) { - if (_coverage & 0x1) { - result.remove(_id); - } else { - result.put(_id, (void*)this, status); - } - } -} - -#ifdef SERVICE_DEBUG -UnicodeString& -SimpleLocaleKeyFactory::debug(UnicodeString& result) const -{ - LocaleKeyFactory::debug(result); - result.append((UnicodeString)", id: "); - result.append(_id); - result.append((UnicodeString)", kind: "); - result.append(_kind); - return result; -} - -UnicodeString& -SimpleLocaleKeyFactory::debugClass(UnicodeString& result) const -{ - return result.append((UnicodeString)"SimpleLocaleKeyFactory"); -} -#endif - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleLocaleKeyFactory) - -U_NAMESPACE_END - -/* !UCONFIG_NO_SERVICE */ -#endif - - diff --git a/src/duckdb/extension/icu/third_party/icu/common/sharedobject.h b/src/duckdb/extension/icu/third_party/icu/common/sharedobject.h index c0a5aba47..5532ec48d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/sharedobject.h +++ b/src/duckdb/extension/icu/third_party/icu/common/sharedobject.h @@ -38,8 +38,8 @@ class U_COMMON_API UnifiedCacheBase : public UObject { virtual ~UnifiedCacheBase(); private: - UnifiedCacheBase(const UnifiedCacheBase &); - UnifiedCacheBase &operator=(const UnifiedCacheBase &); + UnifiedCacheBase(const UnifiedCacheBase &) = delete; + UnifiedCacheBase &operator=(const UnifiedCacheBase &) = delete; }; /** @@ -57,14 +57,14 @@ class U_COMMON_API SharedObject : public UObject { SharedObject() : softRefCount(0), hardRefCount(0), - cachePtr(NULL) {} + cachePtr(nullptr) {} /** Initializes totalRefCount, softRefCount to 0. */ SharedObject(const SharedObject &other) : UObject(other), softRefCount(0), hardRefCount(0), - cachePtr(NULL) {} + cachePtr(nullptr) {} virtual ~SharedObject(); @@ -90,13 +90,13 @@ class U_COMMON_API SharedObject : public UObject { int32_t getRefCount() const; /** - * If noHardReferences() == TRUE then this object has no hard references. + * If noHardReferences() == true then this object has no hard references. * Must be called only from within the internals of UnifiedCache. */ inline UBool noHardReferences() const { return getRefCount() == 0; } /** - * If hasHardReferences() == TRUE then this object has hard references. + * If hasHardReferences() == true then this object has hard references. * Must be called only from within the internals of UnifiedCache. */ inline UBool hasHardReferences() const { return getRefCount() != 0; } @@ -116,7 +116,7 @@ class U_COMMON_API SharedObject : public UObject { * If there are multiple owners, then ptr is replaced with a * copy-constructed clone, * and that is returned. - * Returns NULL if cloning failed. + * Returns nullptr if cloning failed. * * T must be a subclass of SharedObject. */ @@ -125,7 +125,7 @@ class U_COMMON_API SharedObject : public UObject { const T *p = ptr; if(p->getRefCount() <= 1) { return const_cast(p); } T *p2 = new T(*p); - if(p2 == NULL) { return NULL; } + if(p2 == nullptr) { return nullptr; } p->removeRef(); ptr = p2; p2->addRef(); @@ -135,7 +135,7 @@ class U_COMMON_API SharedObject : public UObject { /** * Makes dest an owner of the object pointed to by src while adjusting * reference counts and deleting the previous object dest pointed to - * if necessary. Before this call is made, dest must either be NULL or + * if necessary. Before this call is made, dest must either be nullptr or * be included in the reference count of the object it points to. * * T must be a subclass of SharedObject. @@ -143,20 +143,20 @@ class U_COMMON_API SharedObject : public UObject { template static void copyPtr(const T *src, const T *&dest) { if(src != dest) { - if(dest != NULL) { dest->removeRef(); } + if(dest != nullptr) { dest->removeRef(); } dest = src; - if(src != NULL) { src->addRef(); } + if(src != nullptr) { src->addRef(); } } } /** - * Equivalent to copyPtr(NULL, dest). + * Equivalent to copyPtr(nullptr, dest). */ template static void clearPtr(const T *&ptr) { - if (ptr != NULL) { + if (ptr != nullptr) { ptr->removeRef(); - ptr = NULL; + ptr = nullptr; } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/simpleformatter.cpp b/src/duckdb/extension/icu/third_party/icu/common/simpleformatter.cpp index 5e77b2ade..162562707 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/simpleformatter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/simpleformatter.cpp @@ -23,17 +23,17 @@ namespace { * This is currently the only unused char value in compiled patterns, * except it is the maximum value of the first unit (max arg +1). */ -const int32_t SIMPLE_FORMATTER_ARG_NUM_LIMIT = 0x100; +const int32_t ARG_NUM_LIMIT = 0x100; /** - * Initial and maximum char/UChar value set for a text segment. - * Segment length char values are from SIMPLE_FORMATTER_ARG_NUM_LIMIT+1 to this value here. - * Normally 0xffff, but can be as small as SIMPLE_FORMATTER_ARG_NUM_LIMIT+1 for testing. + * Initial and maximum char/char16_t value set for a text segment. + * Segment length char values are from ARG_NUM_LIMIT+1 to this value here. + * Normally 0xffff, but can be as small as ARG_NUM_LIMIT+1 for testing. */ -const UChar SEGMENT_LENGTH_PLACEHOLDER_CHAR = 0xffff; +const char16_t SEGMENT_LENGTH_PLACEHOLDER_CHAR = 0xffff; /** * Maximum length of a text segment. Longer segments are split into shorter ones. */ -const int32_t MAX_SEGMENT_LENGTH = SEGMENT_LENGTH_PLACEHOLDER_CHAR - SIMPLE_FORMATTER_ARG_NUM_LIMIT; +const int32_t MAX_SEGMENT_LENGTH = SEGMENT_LENGTH_PLACEHOLDER_CHAR - ARG_NUM_LIMIT; enum { APOS = 0x27, @@ -45,7 +45,7 @@ enum { }; inline UBool isInvalidArray(const void *array, int32_t length) { - return (length < 0 || (array == NULL && length != 0)); + return (length < 0 || (array == nullptr && length != 0)); } } // namespace @@ -65,32 +65,32 @@ UBool SimpleFormatter::applyPatternMinMaxArguments( int32_t min, int32_t max, UErrorCode &errorCode) { if (U_FAILURE(errorCode)) { - return FALSE; + return false; } // Parse consistent with MessagePattern, but // - support only simple numbered arguments // - build a simple binary structure into the result string - const UChar *patternBuffer = pattern.getBuffer(); + const char16_t *patternBuffer = pattern.getBuffer(); int32_t patternLength = pattern.length(); // Reserve the first char for the number of arguments. - compiledPattern.setTo((UChar)0); + compiledPattern.setTo((char16_t)0); int32_t textLength = 0; int32_t maxArg = -1; - UBool inQuote = FALSE; + UBool inQuote = false; for (int32_t i = 0; i < patternLength;) { - UChar c = patternBuffer[i++]; + char16_t c = patternBuffer[i++]; if (c == APOS) { if (i < patternLength && (c = patternBuffer[i]) == APOS) { // double apostrophe, skip the second one ++i; } else if (inQuote) { // skip the quote-ending apostrophe - inQuote = FALSE; + inQuote = false; continue; } else if (c == OPEN_BRACE || c == CLOSE_BRACE) { // Skip the quote-starting apostrophe, find the end of the quoted literal text. ++i; - inQuote = TRUE; + inQuote = true; } else { // The apostrophe is part of literal text. c = APOS; @@ -98,7 +98,7 @@ UBool SimpleFormatter::applyPatternMinMaxArguments( } else if (!inQuote && c == OPEN_BRACE) { if (textLength > 0) { compiledPattern.setCharAt(compiledPattern.length() - textLength - 1, - (UChar)(SIMPLE_FORMATTER_ARG_NUM_LIMIT + textLength)); + (char16_t)(ARG_NUM_LIMIT + textLength)); textLength = 0; } int32_t argNumber; @@ -116,20 +116,20 @@ UBool SimpleFormatter::applyPatternMinMaxArguments( while (i < patternLength && DIGIT_ZERO <= (c = patternBuffer[i++]) && c <= DIGIT_NINE) { argNumber = argNumber * 10 + (c - DIGIT_ZERO); - if (argNumber >= SIMPLE_FORMATTER_ARG_NUM_LIMIT) { + if (argNumber >= ARG_NUM_LIMIT) { break; } } } if (argNumber < 0 || c != CLOSE_BRACE) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } } if (argNumber > maxArg) { maxArg = argNumber; } - compiledPattern.append((UChar)argNumber); + compiledPattern.append((char16_t)argNumber); continue; } // else: c is part of literal text // Append c and track the literal-text segment length. @@ -144,22 +144,22 @@ UBool SimpleFormatter::applyPatternMinMaxArguments( } if (textLength > 0) { compiledPattern.setCharAt(compiledPattern.length() - textLength - 1, - (UChar)(SIMPLE_FORMATTER_ARG_NUM_LIMIT + textLength)); + (char16_t)(ARG_NUM_LIMIT + textLength)); } int32_t argCount = maxArg + 1; if (argCount < min || max < argCount) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } - compiledPattern.setCharAt(0, (UChar)argCount); - return TRUE; + compiledPattern.setCharAt(0, (char16_t)argCount); + return true; } UnicodeString& SimpleFormatter::format( const UnicodeString &value0, UnicodeString &appendTo, UErrorCode &errorCode) const { const UnicodeString *values[] = { &value0 }; - return formatAndAppend(values, 1, appendTo, NULL, 0, errorCode); + return formatAndAppend(values, 1, appendTo, nullptr, 0, errorCode); } UnicodeString& SimpleFormatter::format( @@ -167,7 +167,7 @@ UnicodeString& SimpleFormatter::format( const UnicodeString &value1, UnicodeString &appendTo, UErrorCode &errorCode) const { const UnicodeString *values[] = { &value0, &value1 }; - return formatAndAppend(values, 2, appendTo, NULL, 0, errorCode); + return formatAndAppend(values, 2, appendTo, nullptr, 0, errorCode); } UnicodeString& SimpleFormatter::format( @@ -176,7 +176,7 @@ UnicodeString& SimpleFormatter::format( const UnicodeString &value2, UnicodeString &appendTo, UErrorCode &errorCode) const { const UnicodeString *values[] = { &value0, &value1, &value2 }; - return formatAndAppend(values, 3, appendTo, NULL, 0, errorCode); + return formatAndAppend(values, 3, appendTo, nullptr, 0, errorCode); } UnicodeString& SimpleFormatter::formatAndAppend( @@ -192,7 +192,7 @@ UnicodeString& SimpleFormatter::formatAndAppend( return appendTo; } return format(compiledPattern.getBuffer(), compiledPattern.length(), values, - appendTo, NULL, TRUE, + appendTo, nullptr, true, offsets, offsetsLength, errorCode); } @@ -207,7 +207,7 @@ UnicodeString &SimpleFormatter::formatAndReplace( errorCode = U_ILLEGAL_ARGUMENT_ERROR; return result; } - const UChar *cp = compiledPattern.getBuffer(); + const char16_t *cp = compiledPattern.getBuffer(); int32_t cpLength = compiledPattern.length(); if (valuesLength < getArgumentLimit(cp, cpLength)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; @@ -224,7 +224,7 @@ UnicodeString &SimpleFormatter::formatAndReplace( if (getArgumentLimit(cp, cpLength) > 0) { for (int32_t i = 1; i < cpLength;) { int32_t n = cp[i++]; - if (n < SIMPLE_FORMATTER_ARG_NUM_LIMIT) { + if (n < ARG_NUM_LIMIT) { if (values[n] == &result) { if (i == 2) { firstArg = n; @@ -233,7 +233,7 @@ UnicodeString &SimpleFormatter::formatAndReplace( } } } else { - i += n - SIMPLE_FORMATTER_ARG_NUM_LIMIT; + i += n - ARG_NUM_LIMIT; } } } @@ -241,12 +241,12 @@ UnicodeString &SimpleFormatter::formatAndReplace( result.remove(); } return format(cp, cpLength, values, - result, &resultCopy, FALSE, + result, &resultCopy, false, offsets, offsetsLength, errorCode); } UnicodeString SimpleFormatter::getTextWithNoArguments( - const UChar *compiledPattern, + const char16_t *compiledPattern, int32_t compiledPatternLength, int32_t* offsets, int32_t offsetsLength) { @@ -258,11 +258,13 @@ UnicodeString SimpleFormatter::getTextWithNoArguments( UnicodeString sb(capacity, 0, 0); // Java: StringBuilder for (int32_t i = 1; i < compiledPatternLength;) { int32_t n = compiledPattern[i++]; - if (n > SIMPLE_FORMATTER_ARG_NUM_LIMIT) { - n -= SIMPLE_FORMATTER_ARG_NUM_LIMIT; + if (n > ARG_NUM_LIMIT) { + n -= ARG_NUM_LIMIT; sb.append(compiledPattern + i, n); i += n; } else if (n < offsetsLength) { + // TODO(ICU-20406): This does not distinguish between "{0}{1}" and "{1}{0}". + // Consider removing this function and replacing it with an iterator interface. offsets[n] = sb.length(); } } @@ -270,7 +272,7 @@ UnicodeString SimpleFormatter::getTextWithNoArguments( } UnicodeString &SimpleFormatter::format( - const UChar *compiledPattern, int32_t compiledPatternLength, + const char16_t *compiledPattern, int32_t compiledPatternLength, const UnicodeString *const *values, UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue, int32_t *offsets, int32_t offsetsLength, @@ -283,9 +285,9 @@ UnicodeString &SimpleFormatter::format( } for (int32_t i = 1; i < compiledPatternLength;) { int32_t n = compiledPattern[i++]; - if (n < SIMPLE_FORMATTER_ARG_NUM_LIMIT) { + if (n < ARG_NUM_LIMIT) { const UnicodeString *value = values[n]; - if (value == NULL) { + if (value == nullptr) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return result; } @@ -312,7 +314,7 @@ UnicodeString &SimpleFormatter::format( result.append(*value); } } else { - int32_t length = n - SIMPLE_FORMATTER_ARG_NUM_LIMIT; + int32_t length = n - ARG_NUM_LIMIT; result.append(compiledPattern + i, length); i += length; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.cpp b/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.cpp index 43a74974d..0db5ea000 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "static_unicode_sets.h" #include "umutex.h" @@ -25,7 +23,7 @@ using namespace icu::unisets; namespace { -UnicodeSet* gUnicodeSets[UNISET_KEY_UNISETS_KEY_COUNT] = {}; +UnicodeSet* gUnicodeSets[UNISETS_KEY_COUNT] = {}; // Save the empty instance in static memory to have well-defined behavior if a // regular UnicodeSet cannot be allocated. @@ -33,7 +31,7 @@ alignas(UnicodeSet) char gEmptyUnicodeSet[sizeof(UnicodeSet)]; // Whether the gEmptyUnicodeSet is initialized and ready to use. -UBool gEmptyUnicodeSetInitialized = FALSE; +UBool gEmptyUnicodeSetInitialized = false; inline UnicodeSet* getImpl(Key key) { UnicodeSet* candidate = gUnicodeSets[key]; @@ -74,7 +72,7 @@ void saveSet(Key key, const UnicodeString& unicodeSetPattern, UErrorCode& status class ParseDataSink : public ResourceSink { public: - void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE { + void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) override { ResourceTable contextsTable = value.getTable(status); if (U_FAILURE(status)) { return; } for (int i = 0; contextsTable.getKeyAndValue(i, key, value); i++) { @@ -94,33 +92,33 @@ class ParseDataSink : public ResourceSink { // There is both lenient and strict data for comma/period, // but not for any of the other symbols. if (str.indexOf(u'.') != -1) { - saveSet(isLenient ? UNISET_KEY_PERIOD : UNISET_KEY_STRICT_PERIOD, str, status); + saveSet(isLenient ? PERIOD : STRICT_PERIOD, str, status); } else if (str.indexOf(u',') != -1) { - saveSet(isLenient ? UNISET_KEY_COMMA : UNISET_KEY_STRICT_COMMA, str, status); + saveSet(isLenient ? COMMA : STRICT_COMMA, str, status); } else if (str.indexOf(u'+') != -1) { - saveSet(UNISET_KEY_PLUS_SIGN, str, status); + saveSet(PLUS_SIGN, str, status); } else if (str.indexOf(u'-') != -1) { - saveSet(UNISET_KEY_MINUS_SIGN, str, status); + saveSet(MINUS_SIGN, str, status); } else if (str.indexOf(u'$') != -1) { - saveSet(UNISET_KEY_DOLLAR_SIGN, str, status); - } else if (str.indexOf(u'\xa3') != -1) { - saveSet(UNISET_KEY_POUND_SIGN, str, status); - } else if (str.indexOf(u'\x20b9') != -1) { - saveSet(UNISET_KEY_RUPEE_SIGN, str, status); - } else if (str.indexOf(u'\xa5') != -1) { - saveSet(UNISET_KEY_YEN_SIGN, str, status); - } else if (str.indexOf(u'\x20a9') != -1) { - saveSet(UNISET_KEY_WON_SIGN, str, status); + saveSet(DOLLAR_SIGN, str, status); + } else if (str.indexOf(u'£') != -1) { + saveSet(POUND_SIGN, str, status); + } else if (str.indexOf(u'₹') != -1) { + saveSet(RUPEE_SIGN, str, status); + } else if (str.indexOf(u'¥') != -1) { + saveSet(YEN_SIGN, str, status); + } else if (str.indexOf(u'₩') != -1) { + saveSet(WON_SIGN, str, status); } else if (str.indexOf(u'%') != -1) { - saveSet(UNISET_KEY_PERCENT_SIGN, str, status); - } else if (str.indexOf(u'\x2030') != -1) { - saveSet(UNISET_KEY_PERMILLE_SIGN, str, status); - } else if (str.indexOf(u'\x2019') != -1) { - saveSet(UNISET_KEY_APOSTROPHE_SIGN, str, status); + saveSet(PERCENT_SIGN, str, status); + } else if (str.indexOf(u'‰') != -1) { + saveSet(PERMILLE_SIGN, str, status); + } else if (str.indexOf(u'’') != -1) { + saveSet(APOSTROPHE_SIGN, str, status); } else { // Unknown class of parse lenients // TODO(ICU-20428): Make ICU automatically accept new classes? - U_ASSERT(FALSE); + U_ASSERT(false); } if (U_FAILURE(status)) { return; } } @@ -131,19 +129,19 @@ class ParseDataSink : public ResourceSink { }; -icu::UInitOnce gNumberParseUniSetsInitOnce = U_INITONCE_INITIALIZER; +icu::UInitOnce gNumberParseUniSetsInitOnce {}; UBool U_CALLCONV cleanupNumberParseUniSets() { if (gEmptyUnicodeSetInitialized) { reinterpret_cast(gEmptyUnicodeSet)->~UnicodeSet(); - gEmptyUnicodeSetInitialized = FALSE; + gEmptyUnicodeSetInitialized = false; } - for (int32_t i = 0; i < UNISET_KEY_UNISETS_KEY_COUNT; i++) { + for (int32_t i = 0; i < UNISETS_KEY_COUNT; i++) { delete gUnicodeSets[i]; gUnicodeSets[i] = nullptr; } gNumberParseUniSetsInitOnce.reset(); - return TRUE; + return true; } void U_CALLCONV initNumberParseUniSets(UErrorCode& status) { @@ -152,13 +150,13 @@ void U_CALLCONV initNumberParseUniSets(UErrorCode& status) { // Initialize the empty instance for well-defined fallback behavior new(gEmptyUnicodeSet) UnicodeSet(); reinterpret_cast(gEmptyUnicodeSet)->freeze(); - gEmptyUnicodeSetInitialized = TRUE; + gEmptyUnicodeSetInitialized = true; // These sets were decided after discussion with icu-design@. See tickets #13084 and #13309. // Zs+TAB is "horizontal whitespace" according to UTS #18 (blank property). - gUnicodeSets[UNISET_KEY_DEFAULT_IGNORABLES] = new UnicodeSet( + gUnicodeSets[DEFAULT_IGNORABLES] = new UnicodeSet( u"[[:Zs:][\\u0009][:Bidi_Control:][:Variation_Selector:]]", status); - gUnicodeSets[UNISET_KEY_STRICT_IGNORABLES] = new UnicodeSet(u"[[:Bidi_Control:]]", status); + gUnicodeSets[STRICT_IGNORABLES] = new UnicodeSet(u"[[:Bidi_Control:]]", status); LocalUResourceBundlePointer rb(ures_open(nullptr, "root", &status)); if (U_FAILURE(status)) { return; } @@ -167,41 +165,41 @@ void U_CALLCONV initNumberParseUniSets(UErrorCode& status) { if (U_FAILURE(status)) { return; } // NOTE: It is OK for these assertions to fail if there was a no-data build. - U_ASSERT(gUnicodeSets[UNISET_KEY_COMMA] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_STRICT_COMMA] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_PERIOD] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_STRICT_PERIOD] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_APOSTROPHE_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[COMMA] != nullptr); + U_ASSERT(gUnicodeSets[STRICT_COMMA] != nullptr); + U_ASSERT(gUnicodeSets[PERIOD] != nullptr); + U_ASSERT(gUnicodeSets[STRICT_PERIOD] != nullptr); + U_ASSERT(gUnicodeSets[APOSTROPHE_SIGN] != nullptr); LocalPointer otherGrouping(new UnicodeSet( u"[٬‘\\u0020\\u00A0\\u2000-\\u200A\\u202F\\u205F\\u3000]", status ), status); if (U_FAILURE(status)) { return; } - otherGrouping->addAll(*gUnicodeSets[UNISET_KEY_APOSTROPHE_SIGN]); - gUnicodeSets[UNISET_KEY_OTHER_GROUPING_SEPARATORS] = otherGrouping.orphan(); - gUnicodeSets[UNISET_KEY_ALL_SEPARATORS] = computeUnion(UNISET_KEY_COMMA, UNISET_KEY_PERIOD, UNISET_KEY_OTHER_GROUPING_SEPARATORS); - gUnicodeSets[UNISET_KEY_STRICT_ALL_SEPARATORS] = computeUnion( - UNISET_KEY_STRICT_COMMA, UNISET_KEY_STRICT_PERIOD, UNISET_KEY_OTHER_GROUPING_SEPARATORS); - - U_ASSERT(gUnicodeSets[UNISET_KEY_MINUS_SIGN] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_PLUS_SIGN] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_PERCENT_SIGN] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_PERMILLE_SIGN] != nullptr); - - gUnicodeSets[UNISET_KEY_INFINITY_SIGN] = new UnicodeSet(u"[∞]", status); + otherGrouping->addAll(*gUnicodeSets[APOSTROPHE_SIGN]); + gUnicodeSets[OTHER_GROUPING_SEPARATORS] = otherGrouping.orphan(); + gUnicodeSets[ALL_SEPARATORS] = computeUnion(COMMA, PERIOD, OTHER_GROUPING_SEPARATORS); + gUnicodeSets[STRICT_ALL_SEPARATORS] = computeUnion( + STRICT_COMMA, STRICT_PERIOD, OTHER_GROUPING_SEPARATORS); + + U_ASSERT(gUnicodeSets[MINUS_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[PLUS_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[PERCENT_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[PERMILLE_SIGN] != nullptr); + + gUnicodeSets[INFINITY_SIGN] = new UnicodeSet(u"[∞]", status); if (U_FAILURE(status)) { return; } - U_ASSERT(gUnicodeSets[UNISET_KEY_DOLLAR_SIGN] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_POUND_SIGN] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_RUPEE_SIGN] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_YEN_SIGN] != nullptr); - U_ASSERT(gUnicodeSets[UNISET_KEY_WON_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[DOLLAR_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[POUND_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[RUPEE_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[YEN_SIGN] != nullptr); + U_ASSERT(gUnicodeSets[WON_SIGN] != nullptr); - gUnicodeSets[UNISET_KEY_DIGITS] = new UnicodeSet(u"[:digit:]", status); + gUnicodeSets[DIGITS] = new UnicodeSet(u"[:digit:]", status); if (U_FAILURE(status)) { return; } - gUnicodeSets[UNISET_KEY_DIGITS_OR_ALL_SEPARATORS] = computeUnion(UNISET_KEY_DIGITS, UNISET_KEY_ALL_SEPARATORS); - gUnicodeSets[UNISET_KEY_DIGITS_OR_STRICT_ALL_SEPARATORS] = computeUnion(UNISET_KEY_DIGITS, UNISET_KEY_STRICT_ALL_SEPARATORS); + gUnicodeSets[DIGITS_OR_ALL_SEPARATORS] = computeUnion(DIGITS, ALL_SEPARATORS); + gUnicodeSets[DIGITS_OR_STRICT_ALL_SEPARATORS] = computeUnion(DIGITS, STRICT_ALL_SEPARATORS); for (auto* uniset : gUnicodeSets) { if (uniset != nullptr) { @@ -222,7 +220,7 @@ const UnicodeSet* unisets::get(Key key) { } Key unisets::chooseFrom(UnicodeString str, Key key1) { - return get(key1)->contains(str) ? key1 : UNISET_KEY_NONE; + return get(key1)->contains(str) ? key1 : NONE; } Key unisets::chooseFrom(UnicodeString str, Key key1, Key key2) { @@ -230,16 +228,16 @@ Key unisets::chooseFrom(UnicodeString str, Key key1, Key key2) { } //Key unisets::chooseCurrency(UnicodeString str) { -// if (get(UNISET_KEY_DOLLAR_SIGN)->contains(str)) { -// return UNISET_KEY_DOLLAR_SIGN; -// } else if (get(UNISET_KEY_POUND_SIGN)->contains(str)) { -// return UNISET_KEY_POUND_SIGN; -// } else if (get(UNISET_KEY_RUPEE_SIGN)->contains(str)) { -// return UNISET_KEY_RUPEE_SIGN; -// } else if (get(UNISET_KEY_YEN_SIGN)->contains(str)) { -// return UNISET_KEY_YEN_SIGN; +// if (get(DOLLAR_SIGN)->contains(str)) { +// return DOLLAR_SIGN; +// } else if (get(POUND_SIGN)->contains(str)) { +// return POUND_SIGN; +// } else if (get(RUPEE_SIGN)->contains(str)) { +// return RUPEE_SIGN; +// } else if (get(YEN_SIGN)->contains(str)) { +// return YEN_SIGN; // } else { -// return UNISET_KEY_NONE; +// return NONE; // } //} diff --git a/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.h b/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.h index a3d0530ba..5d90ce590 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.h +++ b/src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.h @@ -26,53 +26,53 @@ U_NAMESPACE_BEGIN namespace unisets { enum Key { - // UNISET_KEY_NONE is used to indicate null in chooseFrom(). - // UNISET_KEY_EMPTY is used to get an empty UnicodeSet. - UNISET_KEY_NONE = -1, - UNISET_KEY_EMPTY = 0, + // NONE is used to indicate null in chooseFrom(). + // EMPTY is used to get an empty UnicodeSet. + NONE = -1, + EMPTY = 0, // Ignorables - UNISET_KEY_DEFAULT_IGNORABLES, - UNISET_KEY_STRICT_IGNORABLES, + DEFAULT_IGNORABLES, + STRICT_IGNORABLES, // Separators // Notes: - // - UNISET_KEY_COMMA is a superset of UNISET_KEY_STRICT_COMMA - // - UNISET_KEY_PERIOD is a superset of SCRICT_UNISET_KEY_PERIOD - // - UNISET_KEY_ALL_SEPARATORS is the union of UNISET_KEY_COMMA, UNISET_KEY_PERIOD, and UNISET_KEY_OTHER_GROUPING_SEPARATORS - // - UNISET_KEY_STRICT_ALL_SEPARATORS is the union of UNISET_KEY_STRICT_COMMA, UNISET_KEY_STRICT_PERIOD, and OTHER_GRP_SEPARATORS - UNISET_KEY_COMMA, - UNISET_KEY_PERIOD, - UNISET_KEY_STRICT_COMMA, - UNISET_KEY_STRICT_PERIOD, - UNISET_KEY_APOSTROPHE_SIGN, - UNISET_KEY_OTHER_GROUPING_SEPARATORS, - UNISET_KEY_ALL_SEPARATORS, - UNISET_KEY_STRICT_ALL_SEPARATORS, + // - COMMA is a superset of STRICT_COMMA + // - PERIOD is a superset of SCRICT_PERIOD + // - ALL_SEPARATORS is the union of COMMA, PERIOD, and OTHER_GROUPING_SEPARATORS + // - STRICT_ALL_SEPARATORS is the union of STRICT_COMMA, STRICT_PERIOD, and OTHER_GRP_SEPARATORS + COMMA, + PERIOD, + STRICT_COMMA, + STRICT_PERIOD, + APOSTROPHE_SIGN, + OTHER_GROUPING_SEPARATORS, + ALL_SEPARATORS, + STRICT_ALL_SEPARATORS, // Symbols - UNISET_KEY_MINUS_SIGN, - UNISET_KEY_PLUS_SIGN, - UNISET_KEY_PERCENT_SIGN, - UNISET_KEY_PERMILLE_SIGN, - UNISET_KEY_INFINITY_SIGN, + MINUS_SIGN, + PLUS_SIGN, + PERCENT_SIGN, + PERMILLE_SIGN, + INFINITY_SIGN, // Currency Symbols - UNISET_KEY_DOLLAR_SIGN, - UNISET_KEY_POUND_SIGN, - UNISET_KEY_RUPEE_SIGN, - UNISET_KEY_YEN_SIGN, - UNISET_KEY_WON_SIGN, + DOLLAR_SIGN, + POUND_SIGN, + RUPEE_SIGN, + YEN_SIGN, + WON_SIGN, // Other - UNISET_KEY_DIGITS, + DIGITS, // Combined Separators with Digits (for lead code points) - UNISET_KEY_DIGITS_OR_ALL_SEPARATORS, - UNISET_KEY_DIGITS_OR_STRICT_ALL_SEPARATORS, + DIGITS_OR_ALL_SEPARATORS, + DIGITS_OR_STRICT_ALL_SEPARATORS, // The number of elements in the enum. - UNISET_KEY_UNISETS_KEY_COUNT + UNISETS_KEY_COUNT }; /** @@ -83,10 +83,10 @@ enum Key { * * This method is always safe and OK to chain: in the case of a memory or other * error, it returns an empty set from static memory. - * + * * Example: - * - * UBool hasIgnorables = unisets::get(unisets::UNISET_KEY_DEFAULT_IGNORABLES)->contains(...); + * + * UBool hasIgnorables = unisets::get(unisets::DEFAULT_IGNORABLES)->contains(...); * * @param key The desired UnicodeSet according to the enum in this file. * @return The requested UnicodeSet. Guaranteed to be frozen and non-null, but @@ -101,7 +101,7 @@ U_COMMON_API const UnicodeSet* get(Key key); * * @param str The string to check. * @param key1 The set to check. - * @return key1 if the set contains str, or UNISET_KEY_NONE if not. + * @return key1 if the set contains str, or NONE if not. */ U_COMMON_API Key chooseFrom(UnicodeString str, Key key1); @@ -114,7 +114,7 @@ U_COMMON_API Key chooseFrom(UnicodeString str, Key key1); * @param key1 The first set to check. * @param key2 The second set to check. * @return key1 if that set contains str; key2 if that set contains str; or - * UNISET_KEY_NONE if neither set contains str. + * NONE if neither set contains str. */ U_COMMON_API Key chooseFrom(UnicodeString str, Key key1, Key key2); @@ -126,11 +126,11 @@ static const struct { Key key; UChar32 exemplar; } kCurrencyEntries[] = { - {UNISET_KEY_DOLLAR_SIGN, u'\x24'}, // u'$' - {UNISET_KEY_POUND_SIGN, u'\xa3'}, // u'£' - {UNISET_KEY_RUPEE_SIGN, u'\x20b9'}, // u'₹' - {UNISET_KEY_YEN_SIGN, u'\xa5'}, // u'¥' - {UNISET_KEY_WON_SIGN, u'\x20a9'}, // u'₩' + {DOLLAR_SIGN, u'$'}, + {POUND_SIGN, u'£'}, + {RUPEE_SIGN, u'₹'}, + {YEN_SIGN, u'¥'}, + {WON_SIGN, u'₩'}, }; } // namespace unisets diff --git a/src/duckdb/extension/icu/third_party/icu/common/stringpiece.cpp b/src/duckdb/extension/icu/third_party/icu/common/stringpiece.cpp index d4f7f310b..eb9766c01 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/stringpiece.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/stringpiece.cpp @@ -16,7 +16,7 @@ U_NAMESPACE_BEGIN StringPiece::StringPiece(const char* str) - : ptr_(str), length_((str == NULL) ? 0 : static_cast(uprv_strlen(str))) { } + : ptr_(str), length_((str == nullptr) ? 0 : static_cast(uprv_strlen(str))) { } StringPiece::StringPiece(const StringPiece& x, int32_t pos) { if (pos < 0) { @@ -45,12 +45,53 @@ StringPiece::StringPiece(const StringPiece& x, int32_t pos, int32_t len) { void StringPiece::set(const char* str) { ptr_ = str; - if (str != NULL) + if (str != nullptr) length_ = static_cast(uprv_strlen(str)); else length_ = 0; } +int32_t StringPiece::find(StringPiece needle, int32_t offset) { + if (length() == 0 && needle.length() == 0) { + return 0; + } + // TODO: Improve to be better than O(N^2)? + for (int32_t i = offset; i < length(); i++) { + int32_t j = 0; + for (; j < needle.length(); i++, j++) { + if (data()[i] != needle.data()[j]) { + i -= j; + goto outer_end; + } + } + return i - j; + outer_end: void(); + } + return -1; +} + +int32_t StringPiece::compare(StringPiece other) { + int32_t i = 0; + for (; i < length(); i++) { + if (i == other.length()) { + // this is longer + return 1; + } + char a = data()[i]; + char b = other.data()[i]; + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } + } + if (i < other.length()) { + // other is longer + return -1; + } + return 0; +} + U_EXPORT UBool U_EXPORT2 operator==(const StringPiece& x, const StringPiece& y) { int32_t len = x.size(); diff --git a/src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp b/src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp index 978ef9dbc..2a40dc88f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp @@ -36,7 +36,7 @@ U_CDECL_END U_NAMESPACE_BEGIN -StringTrieBuilder::StringTrieBuilder() : nodes(NULL) {} +StringTrieBuilder::StringTrieBuilder() : nodes(nullptr) {} StringTrieBuilder::~StringTrieBuilder() { deleteCompactBuilder(); @@ -47,10 +47,10 @@ StringTrieBuilder::createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode if(U_FAILURE(errorCode)) { return; } - nodes=uhash_openSize(hashStringTrieNode, equalStringTrieNodes, NULL, + nodes=uhash_openSize(hashStringTrieNode, equalStringTrieNodes, nullptr, sizeGuess, &errorCode); if(U_SUCCESS(errorCode)) { - if(nodes==NULL) { + if(nodes==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } else { uhash_setKeyDeleter(nodes, uprv_deleteUObject); @@ -61,7 +61,7 @@ StringTrieBuilder::createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode void StringTrieBuilder::deleteCompactBuilder() { uhash_close(nodes); - nodes=NULL; + nodes=nullptr; } void @@ -85,16 +85,16 @@ StringTrieBuilder::build(UStringTrieBuildOption buildOption, int32_t elementsLen // have a common prefix of length unitIndex. int32_t StringTrieBuilder::writeNode(int32_t start, int32_t limit, int32_t unitIndex) { - UBool hasValue=FALSE; + UBool hasValue=false; int32_t value=0; int32_t type; if(unitIndex==getElementStringLength(start)) { // An intermediate or final value. value=getElementValue(start++); if(start==limit) { - return writeValueAndFinal(value, TRUE); // final-value node + return writeValueAndFinal(value, true); // final-value node } - hasValue=TRUE; + hasValue=true; } // Now all [start..limit[ strings are longer than unitIndex. int32_t minUnit=getElementUnit(start, unitIndex); @@ -133,7 +133,7 @@ StringTrieBuilder::writeNode(int32_t start, int32_t limit, int32_t unitIndex) { // length different units at unitIndex int32_t StringTrieBuilder::writeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex, int32_t length) { - UChar middleUnits[kMaxSplitBranchLevels]; + char16_t middleUnits[kMaxSplitBranchLevels]; int32_t lessThan[kMaxSplitBranchLevels]; int32_t ltLength=0; while(length>getMaxBranchLinearSubNodeLength()) { @@ -154,7 +154,7 @@ StringTrieBuilder::writeBranchSubNode(int32_t start, int32_t limit, int32_t unit int32_t unitNumber=0; do { int32_t i=starts[unitNumber]=start; - UChar unit=getElementUnit(i++, unitIndex); + char16_t unit=getElementUnit(i++, unitIndex); i=indexOfElementWithNextUnit(i, unitIndex, unit); isFinal[unitNumber]= start==i-1 && unitIndex+1==getElementStringLength(start); start=i; @@ -207,9 +207,9 @@ StringTrieBuilder::writeBranchSubNode(int32_t start, int32_t limit, int32_t unit StringTrieBuilder::Node * StringTrieBuilder::makeNode(int32_t start, int32_t limit, int32_t unitIndex, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } - UBool hasValue=FALSE; + UBool hasValue=false; int32_t value=0; if(unitIndex==getElementStringLength(start)) { // An intermediate or final value. @@ -217,7 +217,7 @@ StringTrieBuilder::makeNode(int32_t start, int32_t limit, int32_t unitIndex, UEr if(start==limit) { return registerFinalValue(value, errorCode); } - hasValue=TRUE; + hasValue=true; } Node *node; // Now all [start..limit[ strings are longer than unitIndex. @@ -244,7 +244,7 @@ StringTrieBuilder::makeNode(int32_t start, int32_t limit, int32_t unitIndex, UEr Node *subNode=makeBranchSubNode(start, limit, unitIndex, length, errorCode); node=new BranchHeadNode(length, subNode); } - if(hasValue && node!=NULL) { + if(hasValue && node!=nullptr) { if(matchNodesCanHaveValues()) { ((ValueNode *)node)->setValue(value); } else { @@ -260,9 +260,9 @@ StringTrieBuilder::Node * StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex, int32_t length, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } - UChar middleUnits[kMaxSplitBranchLevels]; + char16_t middleUnits[kMaxSplitBranchLevels]; Node *lessThan[kMaxSplitBranchLevels]; int32_t ltLength=0; while(length>getMaxBranchLinearSubNodeLength()) { @@ -278,18 +278,18 @@ StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitI length=length-length/2; } if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } ListBranchNode *listNode=new ListBranchNode(); - if(listNode==NULL) { + if(listNode==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } // For each unit, find its elements array start and whether it has a final value. int32_t unitNumber=0; do { int32_t i=start; - UChar unit=getElementUnit(i++, unitIndex); + char16_t unit=getElementUnit(i++, unitIndex); i=indexOfElementWithNextUnit(i, unitIndex, unit); if(start==i-1 && unitIndex+1==getElementStringLength(start)) { listNode->add(unit, getElementValue(start)); @@ -299,7 +299,7 @@ StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitI start=i; } while(++unitNumberadd(unit, getElementValue(start)); } else { @@ -319,14 +319,14 @@ StringTrieBuilder::Node * StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { delete newNode; - return NULL; + return nullptr; } - if(newNode==NULL) { + if(newNode==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } const UHashElement *old=uhash_find(nodes, newNode); - if(old!=NULL) { + if(old!=nullptr) { delete newNode; return (Node *)old->key.pointer; } @@ -339,7 +339,7 @@ StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) { U_ASSERT(oldValue==0); if(U_FAILURE(errorCode)) { delete newNode; - return NULL; + return nullptr; } return newNode; } @@ -347,17 +347,17 @@ StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) { StringTrieBuilder::Node * StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } FinalValueNode key(value); const UHashElement *old=uhash_find(nodes, &key); - if(old!=NULL) { + if(old!=nullptr) { return (Node *)old->key.pointer; } Node *newNode=new FinalValueNode(value); - if(newNode==NULL) { + if(newNode==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } // If uhash_puti() returns a non-zero value from an equivalent, previously // registered node, then uhash_find() failed to find that and we will leak newNode. @@ -368,7 +368,7 @@ StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) { U_ASSERT(oldValue==0); if(U_FAILURE(errorCode)) { delete newNode; - return NULL; + return nullptr; } return newNode; } @@ -399,41 +399,41 @@ StringTrieBuilder::Node::markRightEdgesFirst(int32_t edgeNumber) { bool StringTrieBuilder::FinalValueNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!Node::operator==(other)) { - return FALSE; + return false; } - const FinalValueNode &o=(const FinalValueNode &)other; + const FinalValueNode &o=static_cast(other); return value==o.value; } void StringTrieBuilder::FinalValueNode::write(StringTrieBuilder &builder) { - offset=builder.writeValueAndFinal(value, TRUE); + offset=builder.writeValueAndFinal(value, true); } bool StringTrieBuilder::ValueNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!Node::operator==(other)) { - return FALSE; + return false; } - const ValueNode &o=(const ValueNode &)other; + const ValueNode &o=static_cast(other); return hasValue==o.hasValue && (!hasValue || value==o.value); } bool StringTrieBuilder::IntermediateValueNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!ValueNode::operator==(other)) { - return FALSE; + return false; } - const IntermediateValueNode &o=(const IntermediateValueNode &)other; + const IntermediateValueNode &o=static_cast(other); return next==o.next; } @@ -448,18 +448,18 @@ StringTrieBuilder::IntermediateValueNode::markRightEdgesFirst(int32_t edgeNumber void StringTrieBuilder::IntermediateValueNode::write(StringTrieBuilder &builder) { next->write(builder); - offset=builder.writeValueAndFinal(value, FALSE); + offset=builder.writeValueAndFinal(value, false); } bool StringTrieBuilder::LinearMatchNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!ValueNode::operator==(other)) { - return FALSE; + return false; } - const LinearMatchNode &o=(const LinearMatchNode &)other; + const LinearMatchNode &o=static_cast(other); return length==o.length && next==o.next; } @@ -474,18 +474,18 @@ StringTrieBuilder::LinearMatchNode::markRightEdgesFirst(int32_t edgeNumber) { bool StringTrieBuilder::ListBranchNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!Node::operator==(other)) { - return FALSE; + return false; } - const ListBranchNode &o=(const ListBranchNode &)other; + const ListBranchNode &o=static_cast(other); for(int32_t i=0; imarkRightEdgesFirst(edgeNumber-step); } // For all but the rightmost edge, decrement the edge number. @@ -515,18 +515,18 @@ StringTrieBuilder::ListBranchNode::write(StringTrieBuilder &builder) { // Instead we write the minUnit sub-node last, for a shorter delta. int32_t unitNumber=length-1; Node *rightEdge=equal[unitNumber]; - int32_t rightEdgeNumber= rightEdge==NULL ? firstEdgeNumber : rightEdge->getOffset(); + int32_t rightEdgeNumber= rightEdge==nullptr ? firstEdgeNumber : rightEdge->getOffset(); do { --unitNumber; - if(equal[unitNumber]!=NULL) { + if(equal[unitNumber]!=nullptr) { equal[unitNumber]->writeUnlessInsideRightEdge(firstEdgeNumber, rightEdgeNumber, builder); } } while(unitNumber>0); // The maxUnit sub-node is written as the very last one because we do // not jump for it at all. unitNumber=length-1; - if(rightEdge==NULL) { - builder.writeValueAndFinal(values[unitNumber], TRUE); + if(rightEdge==nullptr) { + builder.writeValueAndFinal(values[unitNumber], true); } else { rightEdge->write(builder); } @@ -535,15 +535,15 @@ StringTrieBuilder::ListBranchNode::write(StringTrieBuilder &builder) { while(--unitNumber>=0) { int32_t value; UBool isFinal; - if(equal[unitNumber]==NULL) { + if(equal[unitNumber]==nullptr) { // Write the final value for the one string ending with this unit. value=values[unitNumber]; - isFinal=TRUE; + isFinal=true; } else { // Write the delta to the start position of the sub-node. U_ASSERT(equal[unitNumber]->getOffset()>0); value=offset-equal[unitNumber]->getOffset(); - isFinal=FALSE; + isFinal=false; } builder.writeValueAndFinal(value, isFinal); offset=builder.write(units[unitNumber]); @@ -553,12 +553,12 @@ StringTrieBuilder::ListBranchNode::write(StringTrieBuilder &builder) { bool StringTrieBuilder::SplitBranchNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!Node::operator==(other)) { - return FALSE; + return false; } - const SplitBranchNode &o=(const SplitBranchNode &)other; + const SplitBranchNode &o=static_cast(other); return unit==o.unit && lessThan==o.lessThan && greaterOrEqual==o.greaterOrEqual; } @@ -587,12 +587,12 @@ StringTrieBuilder::SplitBranchNode::write(StringTrieBuilder &builder) { bool StringTrieBuilder::BranchHeadNode::operator==(const Node &other) const { if(this==&other) { - return TRUE; + return true; } if(!ValueNode::operator==(other)) { - return FALSE; + return false; } - const BranchHeadNode &o=(const BranchHeadNode &)other; + const BranchHeadNode &o=static_cast(other); return length==o.length && next==o.next; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uarrsort.cpp b/src/duckdb/extension/icu/third_party/icu/common/uarrsort.cpp index 609058216..f9daa4b30 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uarrsort.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uarrsort.cpp @@ -18,6 +18,8 @@ * Internal function for sorting arrays. */ +#include + #include "unicode/utypes.h" #include "cmemory.h" #include "uarrsort.h" @@ -35,7 +37,7 @@ enum { }; static constexpr int32_t sizeInMaxAlignTs(int32_t sizeInBytes) { - return (sizeInBytes + sizeof(max_align_t) - 1) / sizeof(max_align_t); + return (sizeInBytes + sizeof(std::max_align_t) - 1) / sizeof(std::max_align_t); } /* UComparator convenience implementations ---------------------------------- */ @@ -73,7 +75,7 @@ U_CAPI int32_t U_EXPORT2 uprv_stableBinarySearch(char *array, int32_t limit, void *item, int32_t itemSize, UComparator *cmp, const void *context) { int32_t start=0; - UBool found=FALSE; + UBool found=false; /* Binary search until we get down to a tiny sub-array. */ while((limit-start)>=MIN_QSORT) { @@ -88,10 +90,10 @@ uprv_stableBinarySearch(char *array, int32_t limit, void *item, int32_t itemSize * However, if there are many equal items, then it should be * faster to continue with the binary search. * It seems likely that we either have all unique items - * (where found will never become TRUE in the insertion sort) + * (where found will never become true in the insertion sort) * or potentially many duplicates. */ - found=TRUE; + found=true; start=i+1; } else if(diff<0) { limit=i; @@ -104,7 +106,7 @@ uprv_stableBinarySearch(char *array, int32_t limit, void *item, int32_t itemSize while(start v; + icu::MaybeStackArray v; if (sizeInMaxAlignTs(itemSize) > v.getCapacity() && v.resize(sizeInMaxAlignTs(itemSize)) == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; @@ -233,7 +235,7 @@ static void quickSort(char *array, int32_t length, int32_t itemSize, UComparator *cmp, const void *context, UErrorCode *pErrorCode) { /* allocate two intermediate item variables (x and w) */ - icu::MaybeStackArray xw; + icu::MaybeStackArray xw; if(sizeInMaxAlignTs(itemSize)*2 > xw.getCapacity() && xw.resize(sizeInMaxAlignTs(itemSize) * 2) == nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; @@ -254,10 +256,10 @@ U_CAPI void U_EXPORT2 uprv_sortArray(void *array, int32_t length, int32_t itemSize, UComparator *cmp, const void *context, UBool sortStable, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return; } - if((length>0 && array==NULL) || length<0 || itemSize<=0 || cmp==NULL) { + if((length>0 && array==nullptr) || length<0 || itemSize<=0 || cmp==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uassert.h b/src/duckdb/extension/icu/third_party/icu/common/uassert.h index f0f7a9257..521875289 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uassert.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uassert.h @@ -10,7 +10,7 @@ * * File uassert.h * -* Contains the U_ASSERT and UPRV_UNREACHABLE macros +* Contains the U_ASSERT and UPRV_UNREACHABLE_* macros * ****************************************************************************** */ @@ -31,19 +31,41 @@ #if U_DEBUG # include # define U_ASSERT(exp) assert(exp) +#elif U_CPLUSPLUS_VERSION +# define U_ASSERT(exp) (void)0 #else # define U_ASSERT(exp) #endif /** - * \def UPRV_UNREACHABLE + * \def UPRV_UNREACHABLE_ASSERT + * This macro is used in places that we had believed were unreachable, but + * experience has shown otherwise (possibly due to memory corruption, etc). + * In this case we call assert() in debug versions as with U_ASSERT, instead + * of unconditionally calling abort(). However we also allow redefinition as + * with UPRV_UNREACHABLE_EXIT. + * @internal +*/ +#if defined(UPRV_UNREACHABLE_ASSERT) + // Use the predefined value. +#elif U_DEBUG +# include +# define UPRV_UNREACHABLE_ASSERT assert(false) +#elif U_CPLUSPLUS_VERSION +# define UPRV_UNREACHABLE_ASSERT (void)0 +#else +# define UPRV_UNREACHABLE_ASSERT +#endif + +/** + * \def UPRV_UNREACHABLE_EXIT * This macro is used to unconditionally abort if unreachable code is ever executed. * @internal */ -#if defined(UPRV_UNREACHABLE) +#if defined(UPRV_UNREACHABLE_EXIT) // Use the predefined value. #else -# define UPRV_UNREACHABLE abort() +# define UPRV_UNREACHABLE_EXIT abort() #endif #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubidi.cpp b/src/duckdb/extension/icu/third_party/icu/common/ubidi.cpp index 358b8fd97..fcf82fa97 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ubidi.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ubidi.cpp @@ -34,14 +34,14 @@ * rules of the BiDi algorithm, in this example to the second rule of the * resolution of weak types. * - * For handling surrogate pairs, where two UChar's form one "abstract" (or UTF-32) - * character according to UTF-16, the second UChar gets the directional property of + * For handling surrogate pairs, where two char16_t's form one "abstract" (or UTF-32) + * character according to UTF-16, the second char16_t gets the directional property of * the entire character assigned, while the first one gets a BN, a boundary * neutral, type, which is ignored by most of the algorithm according to * rule (X9) and the implementation suggestions of the BiDi algorithm. * * Later, adjustWSLevels() will set the level for each BN to that of the - * following character (UChar), which results in surrogate pairs getting the + * following character (char16_t), which results in surrogate pairs getting the * same level on each of their surrogates. * * In a UTF-8 implementation, the same thing could be done: the last byte of @@ -124,7 +124,7 @@ static const Flags flagO[2]={ DIRPROP_FLAG(LRO), DIRPROP_FLAG(RLO) }; /* UBiDi object management -------------------------------------------------- */ U_CAPI UBiDi * U_EXPORT2 -ubidi_open(void) +ubidi_open() { UErrorCode errorCode=U_ZERO_ERROR; return ubidi_openSized(0, 0, &errorCode); @@ -135,21 +135,21 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode) UBiDi *pBiDi; /* check the argument values */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return NULL; + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { + return nullptr; } else if(maxLength<0 || maxRunCount<0) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; /* invalid arguments */ + return nullptr; /* invalid arguments */ } /* allocate memory for the object */ pBiDi=(UBiDi *)uprv_malloc(sizeof(UBiDi)); - if(pBiDi==NULL) { + if(pBiDi==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - /* reset the object, all pointers NULL, all flags FALSE, all sizes 0 */ + /* reset the object, all pointers nullptr, all flags false, all sizes 0 */ uprv_memset(pBiDi, 0, sizeof(UBiDi)); /* allocate memory for arrays as requested */ @@ -160,7 +160,7 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode) *pErrorCode=U_MEMORY_ALLOCATION_ERROR; } } else { - pBiDi->mayAllocateText=TRUE; + pBiDi->mayAllocateText=true; } if(maxRunCount>0) { @@ -171,25 +171,25 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode) *pErrorCode=U_MEMORY_ALLOCATION_ERROR; } } else { - pBiDi->mayAllocateRuns=TRUE; + pBiDi->mayAllocateRuns=true; } if(U_SUCCESS(*pErrorCode)) { return pBiDi; } else { ubidi_close(pBiDi); - return NULL; + return nullptr; } } /* - * We are allowed to allocate memory if memory==NULL or - * mayAllocate==TRUE for each array that we need. + * We are allowed to allocate memory if memory==nullptr or + * mayAllocate==true for each array that we need. * We also try to grow memory as needed if we * allocate it. * * Assume sizeNeeded>0. - * If *pMemory!=NULL, then assume *pSize>0. + * If *pMemory!=nullptr, then assume *pSize>0. * * ### this realloc() may unnecessarily copy the old data, * which we know we don't need any more; @@ -199,22 +199,22 @@ U_CFUNC UBool ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded) { void **pMemory = (void **)bidiMem; /* check for existing memory */ - if(*pMemory==NULL) { + if(*pMemory==nullptr) { /* we need to allocate memory */ - if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=NULL) { + if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=nullptr) { *pSize=sizeNeeded; - return TRUE; + return true; } else { - return FALSE; + return false; } } else { if(sizeNeeded<=*pSize) { /* there is already enough memory */ - return TRUE; + return true; } else if(!mayAllocate) { /* not enough memory, and we must not allocate */ - return FALSE; + return false; } else { /* we try to grow */ void *memory; @@ -222,13 +222,13 @@ ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAlloc * realloc, but it is needed when adding runs using getRunsMemory() * in setParaRunsOnly() */ - if((memory=uprv_realloc(*pMemory, sizeNeeded))!=NULL) { + if((memory=uprv_realloc(*pMemory, sizeNeeded))!=nullptr) { *pMemory=memory; *pSize=sizeNeeded; - return TRUE; + return true; } else { /* we failed to grow */ - return FALSE; + return false; } } } @@ -236,27 +236,27 @@ ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAlloc U_CAPI void U_EXPORT2 ubidi_close(UBiDi *pBiDi) { - if(pBiDi!=NULL) { - pBiDi->pParaBiDi=NULL; /* in case one tries to reuse this block */ - if(pBiDi->dirPropsMemory!=NULL) { + if(pBiDi!=nullptr) { + pBiDi->pParaBiDi=nullptr; /* in case one tries to reuse this block */ + if(pBiDi->dirPropsMemory!=nullptr) { uprv_free(pBiDi->dirPropsMemory); } - if(pBiDi->levelsMemory!=NULL) { + if(pBiDi->levelsMemory!=nullptr) { uprv_free(pBiDi->levelsMemory); } - if(pBiDi->openingsMemory!=NULL) { + if(pBiDi->openingsMemory!=nullptr) { uprv_free(pBiDi->openingsMemory); } - if(pBiDi->parasMemory!=NULL) { + if(pBiDi->parasMemory!=nullptr) { uprv_free(pBiDi->parasMemory); } - if(pBiDi->runsMemory!=NULL) { + if(pBiDi->runsMemory!=nullptr) { uprv_free(pBiDi->runsMemory); } - if(pBiDi->isolatesMemory!=NULL) { + if(pBiDi->isolatesMemory!=nullptr) { uprv_free(pBiDi->isolatesMemory); } - if(pBiDi->insertPoints.points!=NULL) { + if(pBiDi->insertPoints.points!=nullptr) { uprv_free(pBiDi->insertPoints.points); } @@ -268,7 +268,7 @@ ubidi_close(UBiDi *pBiDi) { U_CAPI void U_EXPORT2 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) { - if(pBiDi!=NULL) { + if(pBiDi!=nullptr) { pBiDi->isInverse=isInverse; pBiDi->reorderingMode = isInverse ? UBIDI_REORDER_INVERSE_NUMBERS_AS_L : UBIDI_REORDER_DEFAULT; @@ -277,10 +277,10 @@ ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) { U_CAPI UBool U_EXPORT2 ubidi_isInverse(UBiDi *pBiDi) { - if(pBiDi!=NULL) { + if(pBiDi!=nullptr) { return pBiDi->isInverse; } else { - return FALSE; + return false; } } @@ -300,8 +300,8 @@ ubidi_isInverse(UBiDi *pBiDi) { * fallbacks for unsupported combinations. */ U_CAPI void U_EXPORT2 -ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) { - if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT) +ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) UPRV_NO_SANITIZE_UNDEFINED { + if ((pBiDi!=nullptr) && (reorderingMode >= UBIDI_REORDER_DEFAULT) && (reorderingMode < UBIDI_REORDER_COUNT)) { pBiDi->reorderingMode = reorderingMode; pBiDi->isInverse = (UBool)(reorderingMode == UBIDI_REORDER_INVERSE_NUMBERS_AS_L); @@ -310,7 +310,7 @@ ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) { U_CAPI UBiDiReorderingMode U_EXPORT2 ubidi_getReorderingMode(UBiDi *pBiDi) { - if (pBiDi!=NULL) { + if (pBiDi!=nullptr) { return pBiDi->reorderingMode; } else { return UBIDI_REORDER_DEFAULT; @@ -322,14 +322,14 @@ ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions) { if (reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) { reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS; } - if (pBiDi!=NULL) { + if (pBiDi!=nullptr) { pBiDi->reorderingOptions=reorderingOptions; } } U_CAPI uint32_t U_EXPORT2 ubidi_getReorderingOptions(UBiDi *pBiDi) { - if (pBiDi!=NULL) { + if (pBiDi!=nullptr) { return pBiDi->reorderingOptions; } else { return 0; @@ -337,14 +337,14 @@ ubidi_getReorderingOptions(UBiDi *pBiDi) { } U_CAPI UBiDiDirection U_EXPORT2 -ubidi_getBaseDirection(const UChar *text, +ubidi_getBaseDirection(const char16_t *text, int32_t length){ int32_t i; UChar32 uchar; UCharDirection dir; - if( text==NULL || length<-1 ){ + if( text==nullptr || length<-1 ){ return UBIDI_NEUTRAL; } @@ -373,7 +373,7 @@ int32_t length){ */ static DirProp firstL_R_AL(UBiDi *pBiDi) { - const UChar *text=pBiDi->prologue; + const char16_t *text=pBiDi->prologue; int32_t length=pBiDi->proLength; int32_t i; UChar32 uchar; @@ -403,17 +403,17 @@ checkParaCount(UBiDi *pBiDi) { int32_t count=pBiDi->paraCount; if(pBiDi->paras==pBiDi->simpleParas) { if(count<=SIMPLE_PARAS_COUNT) - return TRUE; + return true; if(!getInitialParasMemory(pBiDi, SIMPLE_PARAS_COUNT * 2)) - return FALSE; + return false; pBiDi->paras=pBiDi->parasMemory; uprv_memcpy(pBiDi->parasMemory, pBiDi->simpleParas, SIMPLE_PARAS_COUNT * sizeof(Para)); - return TRUE; + return true; } if(!getInitialParasMemory(pBiDi, count * 2)) - return FALSE; + return false; pBiDi->paras=pBiDi->parasMemory; - return TRUE; + return true; } /* @@ -426,7 +426,7 @@ checkParaCount(UBiDi *pBiDi) { */ static UBool getDirProps(UBiDi *pBiDi) { - const UChar *text=pBiDi->text; + const char16_t *text=pBiDi->text; DirProp *dirProps=pBiDi->dirPropsMemory; /* pBiDi->dirProps is const */ int32_t i=0, originalLength=pBiDi->originalLength; @@ -566,7 +566,7 @@ getDirProps(UBiDi *pBiDi) { continue; } if(dirProp==B) { - if(iparas[pBiDi->paraCount-1].limit=i; if(isDefaultLevelInverse && lastStrong==R) @@ -579,8 +579,8 @@ getDirProps(UBiDi *pBiDi) { } if(iparaCount++; - if(checkParaCount(pBiDi)==FALSE) /* not enough memory for a new para entry */ - return FALSE; + if(checkParaCount(pBiDi)==false) /* not enough memory for a new para entry */ + return false; if(isDefaultLevel) { pBiDi->paras[pBiDi->paraCount-1].level=defaultParaLevel; state=SEEKING_STRONG_FOR_PARA; @@ -636,7 +636,7 @@ getDirProps(UBiDi *pBiDi) { } pBiDi->flags=flags; pBiDi->lastArabicPos=lastArabicPos; - return TRUE; + return true; } /* determine the paragraph level at position index */ @@ -743,14 +743,14 @@ bracketProcessPDI(BracketData *bd) { } /* newly found opening bracket: create an openings entry */ -static UBool /* return TRUE if success */ -bracketAddOpening(BracketData *bd, UChar match, int32_t position) { +static UBool /* return true if success */ +bracketAddOpening(BracketData *bd, char16_t match, int32_t position) { IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast]; Opening *pOpening; if(pLastIsoRun->limit>=bd->openingsCount) { /* no available new entry */ UBiDi *pBiDi=bd->pBiDi; if(!getInitialOpeningsMemory(pBiDi, pLastIsoRun->limit * 2)) - return FALSE; + return false; if(bd->openings==bd->simpleOpenings) uprv_memcpy(pBiDi->openingsMemory, bd->simpleOpenings, SIMPLE_OPENINGS_COUNT * sizeof(Opening)); @@ -764,7 +764,7 @@ bracketAddOpening(BracketData *bd, UChar match, int32_t position) { pOpening->contextPos=pLastIsoRun->contextPos; pOpening->flags=0; pLastIsoRun->limit++; - return TRUE; + return true; } /* change N0c1 to N0c2 when a preceding bracket is assigned the embedding level */ @@ -804,7 +804,7 @@ bracketProcessClosing(BracketData *bd, int32_t openIdx, int32_t position) { DirProp newProp; pOpening=&bd->openings[openIdx]; direction=(UBiDiDirection)(pLastIsoRun->level&1); - stable=TRUE; /* assume stable until proved otherwise */ + stable=true; /* assume stable until proved otherwise */ /* The stable flag is set when brackets are paired and their level is resolved and cannot be changed by what will be @@ -873,7 +873,7 @@ bracketProcessClosing(BracketData *bd, int32_t openIdx, int32_t position) { } /* handle strong characters, digits and candidates for closing brackets */ -static UBool /* return TRUE if success */ +static UBool /* return true if success */ bracketProcessChar(BracketData *bd, int32_t position) { IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast]; DirProp *dirProps, dirProp, newProp; @@ -881,7 +881,7 @@ bracketProcessChar(BracketData *bd, int32_t position) { dirProps=bd->pBiDi->dirProps; dirProp=dirProps[position]; if(dirProp==ON) { - UChar c, match; + char16_t c, match; int32_t idx; /* First see if it is a matching closing bracket. Hopefully, this is more efficient than checking if it is a closing bracket at all */ @@ -912,13 +912,13 @@ bracketProcessChar(BracketData *bd, int32_t position) { } /* matching brackets are not overridden by LRO/RLO */ bd->pBiDi->levels[bd->openings[idx].position]&=~UBIDI_LEVEL_OVERRIDE; - return TRUE; + return true; } /* We get here only if the ON character is not a matching closing bracket or it is a case of N0d */ /* Now see if it is an opening bracket */ if(c) - match= static_cast(u_getBidiPairedBracket(c)); /* get the matching char */ + match= static_cast(u_getBidiPairedBracket(c)); /* get the matching char */ else match=0; if(match!=c && /* has a matching char */ @@ -927,14 +927,14 @@ bracketProcessChar(BracketData *bd, int32_t position) { create an opening entry for each synonym */ if(match==0x232A) { /* RIGHT-POINTING ANGLE BRACKET */ if(!bracketAddOpening(bd, 0x3009, position)) - return FALSE; + return false; } else if(match==0x3009) { /* RIGHT ANGLE BRACKET */ if(!bracketAddOpening(bd, 0x232A, position)) - return FALSE; + return false; } if(!bracketAddOpening(bd, match, position)) - return FALSE; + return false; } } level=bd->pBiDi->levels[position]; @@ -998,7 +998,7 @@ bracketProcessChar(BracketData *bd, int32_t position) { if(position>bd->openings[i].position) bd->openings[i].flags|=flag; } - return TRUE; + return true; } /* perform (X1)..(X9) ------------------------------------------------------- */ @@ -1072,7 +1072,7 @@ static UBiDiDirection resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { DirProp *dirProps=pBiDi->dirProps; UBiDiLevel *levels=pBiDi->levels; - const UChar *text=pBiDi->text; + const char16_t *text=pBiDi->text; int32_t i=0, length=pBiDi->length; Flags flags=pBiDi->flags; /* collect all directionalities in the text */ @@ -1127,7 +1127,7 @@ resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { continue; if(dirProp==B) { if((i+1)capacity == 0) { pInsertPoints->points=static_cast(uprv_malloc(sizeof(Point)*FIRSTALLOC)); - if (pInsertPoints->points == NULL) + if (pInsertPoints->points == nullptr) { pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR; return; @@ -1809,7 +1809,7 @@ addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag) Point * savePoints=pInsertPoints->points; pInsertPoints->points=static_cast(uprv_realloc(pInsertPoints->points, pInsertPoints->capacity*2*sizeof(Point))); - if (pInsertPoints->points == NULL) + if (pInsertPoints->points == nullptr) { pInsertPoints->points=savePoints; pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR; @@ -2047,7 +2047,7 @@ processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop, break; default: /* we should never get here */ - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } if((addLevel) || (start < start0)) { @@ -2068,7 +2068,7 @@ processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop, */ static DirProp lastL_R_AL(UBiDi *pBiDi) { - const UChar *text=pBiDi->prologue; + const char16_t *text=pBiDi->prologue; int32_t length=pBiDi->proLength; int32_t i; UChar32 uchar; @@ -2096,7 +2096,7 @@ lastL_R_AL(UBiDi *pBiDi) { */ static DirProp firstL_R_AL_EN_AN(UBiDi *pBiDi) { - const UChar *text=pBiDi->epilogue; + const char16_t *text=pBiDi->epilogue; int32_t length=pBiDi->epiLength; int32_t i; UChar32 uchar; @@ -2250,7 +2250,7 @@ resolveImplicitLevels(UBiDi *pBiDi, start2=i; break; default: /* we should never get here */ - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } } @@ -2326,13 +2326,13 @@ adjustWSLevels(UBiDi *pBiDi) { U_CAPI void U_EXPORT2 ubidi_setContext(UBiDi *pBiDi, - const UChar *prologue, int32_t proLength, - const UChar *epilogue, int32_t epiLength, + const char16_t *prologue, int32_t proLength, + const char16_t *epilogue, int32_t epiLength, UErrorCode *pErrorCode) { /* check the argument values */ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode); - if(pBiDi==NULL || proLength<-1 || epiLength<-1 || - (prologue==NULL && proLength!=0) || (epilogue==NULL && epiLength!=0)) { + if(pBiDi==nullptr || proLength<-1 || epiLength<-1 || + (prologue==nullptr && proLength!=0) || (epilogue==nullptr && epiLength!=0)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -2362,11 +2362,11 @@ setParaSuccess(UBiDi *pBiDi) { #define BIDI_ABS(x) ((x)>=0 ? (x) : (-(x))) static void -setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, +setParaRunsOnly(UBiDi *pBiDi, const char16_t *text, int32_t length, UBiDiLevel paraLevel, UErrorCode *pErrorCode) { - int32_t *runsOnlyMemory = NULL; + int32_t *runsOnlyMemory = nullptr; int32_t *visualMap; - UChar *visualText; + char16_t *visualText; int32_t saveLength, saveTrailingWSStart; const UBiDiLevel *levels; UBiDiLevel *saveLevels; @@ -2381,17 +2381,17 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT; if(length==0) { - ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); + ubidi_setPara(pBiDi, text, length, paraLevel, nullptr, pErrorCode); goto cleanup3; } /* obtain memory for mapping table and visual text */ - runsOnlyMemory=static_cast(uprv_malloc(length*(sizeof(int32_t)+sizeof(UChar)+sizeof(UBiDiLevel)))); - if(runsOnlyMemory==NULL) { + runsOnlyMemory=static_cast(uprv_malloc(length*(sizeof(int32_t)+sizeof(char16_t)+sizeof(UBiDiLevel)))); + if(runsOnlyMemory==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; goto cleanup3; } visualMap=runsOnlyMemory; - visualText=(UChar *)&visualMap[length]; + visualText=(char16_t *)&visualMap[length]; saveLevels=(UBiDiLevel *)&visualText[length]; saveOptions=pBiDi->reorderingOptions; if(saveOptions & UBIDI_OPTION_INSERT_MARKS) { @@ -2399,7 +2399,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS; } paraLevel&=1; /* accept only 0 or 1 */ - ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode); + ubidi_setPara(pBiDi, text, length, paraLevel, nullptr, pErrorCode); if(U_FAILURE(*pErrorCode)) { goto cleanup3; } @@ -2432,12 +2432,12 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, * than the original text. But we don't want the levels memory to be * reallocated shorter than the original length, since we need to restore * the levels as after the first call to ubidi_setpara() before returning. - * We will force mayAllocateText to FALSE before the second call to + * We will force mayAllocateText to false before the second call to * ubidi_setpara(), and will restore it afterwards. */ saveMayAllocateText=pBiDi->mayAllocateText; - pBiDi->mayAllocateText=FALSE; - ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode); + pBiDi->mayAllocateText=false; + ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, nullptr, pErrorCode); pBiDi->mayAllocateText=saveMayAllocateText; ubidi_getRuns(pBiDi, pErrorCode); if(U_FAILURE(*pErrorCode)) { @@ -2551,7 +2551,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, /* ubidi_setPara ------------------------------------------------------------ */ U_CAPI void U_EXPORT2 -ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, +ubidi_setPara(UBiDi *pBiDi, const char16_t *text, int32_t length, UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, UErrorCode *pErrorCode) { UBiDiDirection direction; @@ -2559,7 +2559,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, /* check the argument values */ RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode); - if(pBiDi==NULL || text==NULL || length<-1 || + if(pBiDi==nullptr || text==nullptr || length<-1 || (paraLevel>UBIDI_MAX_EXPLICIT_LEVEL && paraLevelpParaBiDi=NULL; /* mark unfinished setPara */ + pBiDi->pParaBiDi=nullptr; /* mark unfinished setPara */ pBiDi->text=text; pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length; pBiDi->paraLevel=paraLevel; pBiDi->direction=(UBiDiDirection)(paraLevel&1); pBiDi->paraCount=1; - pBiDi->dirProps=NULL; - pBiDi->levels=NULL; - pBiDi->runs=NULL; + pBiDi->dirProps=nullptr; + pBiDi->levels=nullptr; + pBiDi->runs=nullptr; pBiDi->insertPoints.size=0; /* clean up from last call */ pBiDi->insertPoints.confirmed=0; /* clean up from last call */ @@ -2640,7 +2640,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */ /* are explicit levels specified? */ - if(embeddingLevels==NULL) { + if(embeddingLevels==nullptr) { /* no: determine explicit levels according to the (Xn) rules */\ if(getLevelsMemory(pBiDi, length)) { pBiDi->levels=pBiDi->levelsMemory; @@ -2724,7 +2724,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, break; default: /* we should never get here */ - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } /* * If there are no external levels specified and there @@ -2737,7 +2737,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, * Examples for "insignificant" ones are empty embeddings * LRE-PDF, LRE-RLE-PDF-PDF, etc. */ - if(embeddingLevels==NULL && pBiDi->paraCount<=1 && + if(embeddingLevels==nullptr && pBiDi->paraCount<=1 && !(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) { resolveImplicitLevels(pBiDi, 0, length, GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)), @@ -2856,17 +2856,17 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, U_CAPI void U_EXPORT2 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) { - if(pBiDi!=NULL) { + if(pBiDi!=nullptr) { pBiDi->orderParagraphsLTR=orderParagraphsLTR; } } U_CAPI UBool U_EXPORT2 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) { - if(pBiDi!=NULL) { + if(pBiDi!=nullptr) { return pBiDi->orderParagraphsLTR; } else { - return FALSE; + return false; } } @@ -2879,12 +2879,12 @@ ubidi_getDirection(const UBiDi *pBiDi) { } } -U_CAPI const UChar * U_EXPORT2 +U_CAPI const char16_t * U_EXPORT2 ubidi_getText(const UBiDi *pBiDi) { if(IS_VALID_PARA_OR_LINE(pBiDi)) { return pBiDi->text; } else { - return NULL; + return nullptr; } } @@ -2952,13 +2952,13 @@ ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, } else { paraStart=0; } - if(pParaStart!=NULL) { + if(pParaStart!=nullptr) { *pParaStart=paraStart; } - if(pParaLimit!=NULL) { + if(pParaLimit!=nullptr) { *pParaLimit=pBiDi->paras[paraIndex].limit; } - if(pParaLevel!=NULL) { + if(pParaLevel!=nullptr) { *pParaLevel=GET_PARALEVEL(pBiDi, paraStart); } } @@ -2987,7 +2987,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, const void **oldContext, UErrorCode *pErrorCode) { RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode); - if(pBiDi==NULL) { + if(pBiDi==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -3006,7 +3006,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, U_CAPI void U_EXPORT2 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context) { - if(pBiDi==NULL) { + if(pBiDi==nullptr) { return; } if( fn ) @@ -3024,7 +3024,7 @@ ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c) { UCharDirection dir; - if( pBiDi->fnClassCallback == NULL || + if( pBiDi->fnClassCallback == nullptr || (dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT ) { dir = ubidi_getClass(c); diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubidi_props.cpp b/src/duckdb/extension/icu/third_party/icu/common/ubidi_props.cpp index ff9c64883..8f3f6a65c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ubidi_props.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ubidi_props.cpp @@ -47,13 +47,13 @@ struct UBiDiProps { /* set of property starts for UnicodeSet ------------------------------------ */ static UBool U_CALLCONV -ubidi_props_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) { +_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) { (void)end; (void)value; /* add the start code point to the USet */ const USetAdder *sa=(const USetAdder *)context; sa->add(sa->set, start); - return TRUE; + return true; } U_CFUNC void @@ -69,7 +69,7 @@ ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) { } /* add the start code point of each same-value range of the trie */ - utrie2_enum(&ubidi_props_singleton.trie, NULL, ubidi_props_enumPropertyStartsRange, sa); + utrie2_enum(&ubidi_props_singleton.trie, nullptr, _enumPropertyStartsRange, sa); /* add the code points from the bidi mirroring table */ length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH]; @@ -248,7 +248,7 @@ u_charMirror(UChar32 c) { return ubidi_getMirror(c); } -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 u_getBidiPairedBracket(UChar32 c) { return ubidi_getPairedBracket(c); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubidi_props_data.h b/src/duckdb/extension/icu/third_party/icu/common/ubidi_props_data.h index 65c35567e..f85dc0967 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ubidi_props_data.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ubidi_props_data.h @@ -1,6 +1,5 @@ -// © 2016 and later: Unicode, Inc. and others. +// Copyright (C) 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -// // Copyright (C) 1999-2016, International Business Machines // Corporation and others. All Rights Reserved. // @@ -8,798 +7,826 @@ // // machine-generated by: icu/tools/unicode/c/genprops/bidipropsbuilder.cpp - #ifdef INCLUDED_FROM_UBIDI_PROPS_C -// static const UVersionInfo ubidi_props_dataVersion={0xd,0,0,0}; +static const UVersionInfo ubidi_props_dataVersion={0xf,1,0,0}; -static const int32_t ubidi_props_indexes[UBIDI_IX_TOP]={0x10,0x67ec,0x6200,0x28,0x620,0x8c8,0x10ac0,0x10d24,0,0,0,0,0,0,0,0x6502b6}; +static const int32_t ubidi_props_indexes[UBIDI_IX_TOP]={0x10,0x6ba0,0x65b0,0x28,0x620,0x8cc,0x10ac0,0x10d24,0,0,0,0,0,0,0,0x6702b6}; -static const uint16_t ubidi_props_trieIndex[12536]={ -0x37c,0x384,0x38c,0x394,0x3ac,0x3b4,0x3bc,0x3c4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4, -0x39c,0x3a4,0x39c,0x3a4,0x3ca,0x3d2,0x3da,0x3e2,0x3ea,0x3f2,0x3ee,0x3f6,0x3fe,0x406,0x401,0x409, -0x39c,0x3a4,0x39c,0x3a4,0x411,0x419,0x39c,0x3a4,0x39c,0x3a4,0x39c,0x3a4,0x41f,0x427,0x42f,0x437, -0x43f,0x447,0x44f,0x457,0x45d,0x465,0x46d,0x475,0x47d,0x485,0x48b,0x493,0x49b,0x4a3,0x4ab,0x4b3, -0x4bf,0x4bb,0x4c7,0x4cf,0x431,0x4df,0x4e6,0x4d7,0x4ee,0x4f0,0x4f8,0x500,0x508,0x509,0x511,0x519, -0x521,0x509,0x529,0x52e,0x521,0x509,0x536,0x53e,0x508,0x546,0x54e,0x500,0x556,0x39c,0x55e,0x562, -0x56a,0x56c,0x574,0x57c,0x508,0x584,0x58c,0x500,0x413,0x590,0x511,0x500,0x508,0x39c,0x598,0x39c, -0x39c,0x59e,0x5a6,0x39c,0x39c,0x5aa,0x5b2,0x39c,0x5b6,0x5bd,0x39c,0x5c5,0x5cd,0x5d4,0x555,0x39c, -0x39c,0x5dc,0x5e4,0x5ec,0x5f4,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x5fc,0x39c,0x604,0x39c,0x39c,0x39c, -0x60c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x614,0x39c,0x39c,0x39c,0x61c,0x61c,0x515,0x515,0x39c,0x622,0x62a,0x604, -0x640,0x632,0x632,0x648,0x64f,0x638,0x39c,0x39c,0x39c,0x657,0x65f,0x39c,0x39c,0x39c,0x661,0x669, -0x671,0x39c,0x678,0x680,0x39c,0x688,0x56b,0x39c,0x545,0x690,0x556,0x698,0x413,0x6a0,0x39c,0x6a7, -0x39c,0x6ac,0x39c,0x39c,0x39c,0x39c,0x6b2,0x6ba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0x6c2, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x6ca,0x6d2,0x6d6, -0x6ee,0x6f4,0x6de,0x6e6,0x6fc,0x704,0x708,0x5d7,0x710,0x718,0x720,0x39c,0x728,0x669,0x669,0x669, -0x738,0x740,0x748,0x750,0x755,0x75d,0x765,0x730,0x76d,0x775,0x39c,0x77b,0x782,0x669,0x669,0x669, -0x669,0x582,0x788,0x669,0x790,0x39c,0x39c,0x666,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669, -0x669,0x669,0x669,0x669,0x669,0x798,0x669,0x669,0x669,0x669,0x669,0x79e,0x669,0x669,0x7a6,0x7ae, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x7be,0x7c6,0x7ce,0x7b6, -0x7de,0x7e6,0x7ee,0x7f5,0x7fc,0x804,0x808,0x7d6,0x669,0x669,0x669,0x810,0x816,0x669,0x669,0x81c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x824,0x39c,0x39c,0x39c,0x82c,0x39c,0x39c,0x39c,0x3ea, -0x834,0x83c,0x840,0x39c,0x848,0x669,0x669,0x66c,0x669,0x669,0x669,0x669,0x669,0x669,0x84f,0x855, -0x865,0x85d,0x39c,0x39c,0x86d,0x60c,0x39c,0x3c3,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x82b, -0x3d1,0x39c,0x875,0x87d,0x39c,0x885,0x88d,0x39c,0x39c,0x39c,0x39c,0x891,0x39c,0x39c,0x661,0x3c2, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x875,0x669,0x582,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x898,0x39c,0x39c,0x89d,0x56c,0x39c,0x39c,0x5b8,0x669,0x660,0x39c,0x39c,0x8a5,0x39c,0x39c,0x39c, -0x8ad,0x8b4,0x632,0x8bc,0x39c,0x39c,0x58e,0x8c4,0x39c,0x8cc,0x8d3,0x39c,0x4ee,0x8d8,0x39c,0x507, -0x39c,0x8e0,0x8e8,0x509,0x39c,0x8ec,0x508,0x8f4,0x39c,0x39c,0x39c,0x8fa,0x39c,0x39c,0x39c,0x901, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x915,0x909,0x90d,0x49b,0x49b,0x49b,0x49b,0x49b, -0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x49b,0x91d,0x49b,0x49b,0x49b,0x49b,0x925,0x929, -0x931,0x939,0x93d,0x945,0x49b,0x49b,0x49b,0x949,0x951,0x38c,0x959,0x961,0x39c,0x39c,0x39c,0x969, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0xe70,0xe70,0xeb0,0xef0,0xe70,0xe70,0xe70,0xe70,0xe70,0xe70,0xf28,0xf68,0xfa8,0xfb8,0xff8,0x1004, -0xe70,0xe70,0x1044,0xe70,0xe70,0xe70,0x107c,0x10bc,0x10fc,0x113c,0x1174,0x11b4,0x11f4,0x122c,0x126c,0x12ac, +static const uint16_t ubidi_props_trieIndex[13008]={ +0x387,0x38f,0x397,0x39f,0x3b7,0x3bf,0x3c7,0x3cf,0x3a7,0x3af,0x3a7,0x3af,0x3a7,0x3af,0x3a7,0x3af, +0x3a7,0x3af,0x3a7,0x3af,0x3d5,0x3dd,0x3e5,0x3ed,0x3f5,0x3fd,0x3f9,0x401,0x409,0x411,0x40c,0x414, +0x3a7,0x3af,0x3a7,0x3af,0x41c,0x424,0x3a7,0x3af,0x3a7,0x3af,0x3a7,0x3af,0x42a,0x432,0x43a,0x442, +0x44a,0x452,0x45a,0x462,0x468,0x470,0x478,0x480,0x488,0x490,0x496,0x49e,0x4a6,0x4ae,0x4b6,0x4be, +0x4ca,0x4c6,0x4d2,0x4da,0x4e2,0x4f2,0x4f9,0x4ea,0x501,0x503,0x50b,0x513,0x51b,0x51c,0x524,0x52c, +0x534,0x51c,0x53c,0x541,0x534,0x51c,0x549,0x551,0x51b,0x559,0x561,0x513,0x569,0x3a7,0x571,0x575, +0x57d,0x57f,0x587,0x58f,0x51b,0x597,0x59f,0x513,0x41e,0x5a3,0x524,0x513,0x51b,0x3a7,0x5ab,0x3a7, +0x3a7,0x5b1,0x5b9,0x3a7,0x3a7,0x5bd,0x5c5,0x3a7,0x5c9,0x5d0,0x3a7,0x5d8,0x5e0,0x5e7,0x568,0x3a7, +0x3a7,0x5ef,0x5f7,0x5ff,0x607,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x60f,0x3a7,0x617,0x3a7,0x3a7,0x3a7, +0x61f,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x627,0x3a7,0x3a7,0x3a7,0x62f,0x528,0x528,0x528,0x3a7,0x635,0x63d,0x617, +0x653,0x645,0x645,0x65b,0x662,0x64b,0x3a7,0x3a7,0x3a7,0x66a,0x672,0x3a7,0x3a7,0x3a7,0x674,0x67c, +0x684,0x3a7,0x68b,0x693,0x3a7,0x69b,0x4fe,0x3a7,0x558,0x6a3,0x569,0x6ab,0x41e,0x6b3,0x3a7,0x6ba, +0x3a7,0x6bf,0x3a7,0x3a7,0x3a7,0x3a7,0x6c5,0x6cd,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3f5,0x3f5, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x6d4,0x6dc,0x6e0, +0x6f8,0x6fe,0x6e8,0x6f0,0x706,0x70e,0x712,0x5ea,0x71a,0x722,0x72a,0x3a7,0x732,0x67c,0x67c,0x67c, +0x742,0x74a,0x752,0x75a,0x75f,0x767,0x76f,0x73a,0x777,0x77f,0x3a7,0x785,0x78c,0x67c,0x67c,0x67c, +0x67c,0x595,0x792,0x67c,0x79a,0x3a7,0x3a7,0x679,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c, +0x67c,0x67c,0x67c,0x67c,0x67c,0x7a2,0x67c,0x67c,0x67c,0x67c,0x67c,0x7a8,0x67c,0x67c,0x7b0,0x7b8, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x67c,0x67c,0x67c,0x67c,0x7c8,0x7d0,0x7d8,0x7c0, +0x7e8,0x7f0,0x7f8,0x7ff,0x806,0x80e,0x812,0x7e0,0x67c,0x67c,0x67c,0x81a,0x820,0x67c,0x67c,0x826, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x82e,0x3a7,0x3a7,0x3a7,0x836,0x3a7,0x3a7,0x3a7,0x3f5, +0x83e,0x846,0x849,0x3a7,0x851,0x67c,0x67c,0x67f,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x858,0x85e, +0x86e,0x866,0x3a7,0x3a7,0x876,0x61f,0x3a7,0x3ce,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x67c,0x87e, +0x3dc,0x3a7,0x85e,0x882,0x3a7,0x88a,0x892,0x3a7,0x3a7,0x3a7,0x3a7,0x896,0x3a7,0x3a7,0x674,0x3cd, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x67c,0x67c, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x85e,0x67c,0x595,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x89d,0x3a7,0x3a7,0x8a2,0x8aa,0x3a7,0x3a7,0x5cb,0x67c,0x673,0x3a7,0x3a7,0x8b2,0x3a7,0x3a7,0x3a7, +0x8ba,0x8c1,0x645,0x8c9,0x3a7,0x3a7,0x5a1,0x8d1,0x3a7,0x8d9,0x8e0,0x3a7,0x501,0x8e5,0x3a7,0x51a, +0x3a7,0x8ed,0x8f5,0x51c,0x3a7,0x8f9,0x51b,0x901,0x3a7,0x3a7,0x3a7,0x907,0x3a7,0x3a7,0x3a7,0x90e, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x922,0x916,0x91a,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6, +0x4a6,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6,0x92a,0x932,0x4a6,0x4a6,0x4a6,0x937,0x93b, +0x943,0x94b,0x94f,0x957,0x4a6,0x4a6,0x4a6,0x95b,0x963,0x397,0x96b,0x973,0x3a7,0x3a7,0x3a7,0x97b, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0xe9c,0xe9c,0xedc,0xf1c,0xe9c,0xe9c,0xe9c,0xe9c,0xe9c,0xe9c,0xf54,0xf94,0xfd4,0xfe4,0x1024,0x1030, +0xe9c,0xe9c,0x1070,0xe9c,0xe9c,0xe9c,0x10a8,0x10e8,0x1128,0x1168,0x11a0,0x11e0,0x1220,0x1258,0x1298,0x12d8, 0xa40,0xa80,0xac0,0xaff,0x1a0,0x1a0,0xb3f,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xb68,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xba8,0x1a0,0x1a0,0xbdd,0xc1d,0xc5d,0xc9d,0xcdd,0xd1d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xba8,0x1a0,0xbce,0xc09,0xc49,0xc89,0xcc9,0xd09,0xd49, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, -0xd9d,0xdad,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, +0xdc9,0xdd9,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, 0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0, -0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd5d, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x971,0x39c,0x669,0x669,0x979,0x60c,0x39c,0x501, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x981,0x39c,0x39c,0x39c,0x988,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x990,0x431,0x431,0x431,0x431,0x431,0x431,0x431, -0x998,0x99c,0x431,0x431,0x431,0x431,0x9ac,0x9a4,0x431,0x9b4,0x431,0x431,0x9bc,0x9c2,0x431,0x431, -0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x9d2,0x9ca,0x431,0x431,0x431,0x431,0x431,0x431, -0x431,0x431,0x431,0x9da,0x431,0x9e2,0x431,0x431,0x431,0x9e6,0x9ed,0x9f3,0x431,0x9f7,0x9ff,0x431, -0x508,0xa07,0xa0e,0xa15,0x413,0xa18,0x39c,0x39c,0x4ee,0xa1f,0x39c,0xa25,0x413,0xa2a,0xa32,0x39c, -0x39c,0xa37,0x39c,0x39c,0x39c,0x39c,0x82c,0xa3f,0x413,0x590,0x56b,0xa46,0x39c,0x39c,0x39c,0x39c, -0x39c,0xa07,0xa4e,0x39c,0x39c,0xa56,0xa5e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa62,0xa6a,0x39c, -0x39c,0xa72,0x56b,0xa7a,0x39c,0xa80,0x39c,0x39c,0x5fc,0xa88,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0xa8d,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xa94,0xa9c,0x39c,0x39c,0x39c,0xa9f,0x56b,0xaa7, -0xaab,0xab3,0x39c,0xaba,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0xac1,0x39c,0x39c,0xacf,0xac9,0x39c,0x39c,0x39c,0xad7,0xadf,0x39c,0xae3,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x592,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaf0,0xaeb,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0xaf8,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xaff, -0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0xa26,0x39c,0xb0b,0x39c,0x39c,0xb13,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x522,0xb1b,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb22,0xb2a,0xb30,0x39c,0x39c,0x669,0x669,0xb38, -0x39c,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x83f,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0xb3a,0x39c,0xb41,0x39c,0xb3d,0x39c,0xb44,0x39c,0xb4c,0xb50,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x3ea,0xb58,0x3ea, -0xb5f,0xb66,0xb6e,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb76,0xb7e,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xb05,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0xb83,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x431,0x431,0x431, -0x431,0x431,0x431,0xb8b,0x431,0xb93,0xb93,0xb9a,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431, -0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431, -0x90d,0x49b,0x49b,0x431,0x431,0x49b,0x49b,0x9f3,0x431,0x431,0x431,0x431,0x431,0x49b,0x49b,0x49b, -0x49b,0x49b,0x49b,0x49b,0xba2,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x431,0x669,0xbaa,0x669, -0x669,0x66c,0xbaf,0xbb3,0x84f,0xbbb,0x3be,0x39c,0xbc1,0x39c,0xbc6,0x39c,0x39c,0x39c,0x39c,0x39c, -0x779,0x39c,0x39c,0x39c,0x39c,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669, -0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669,0x669, -0x669,0x669,0x669,0x66b,0x979,0x669,0x669,0x669,0x66c,0x669,0x669,0xbce,0x66e,0xbaa,0x669,0xbd6, -0x669,0xbde,0xbe3,0x39c,0x39c,0x669,0x669,0x669,0xbeb,0x669,0x669,0x798,0x669,0x669,0x669,0x66c, -0xbf2,0xbfa,0xc00,0xc05,0x39c,0x669,0x669,0x669,0x669,0xc0d,0x669,0x788,0xc15,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c, -0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xc1c,0xc2c,0xc24,0xc24, -0xc24,0xc2d,0xc2d,0xc2d,0xc2d,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0xc35,0xc2d,0xc2d,0xc2d, -0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, -0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, -0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, -0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0x37b,0x37b,0x37b, -0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,8,7,8,9,7,0x12,0x12, -0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,7,7,7,8, -9,0xa,0xa,4,4,4,0xa,0xa,0x310a,0xf20a,0xa,3,6,3,6,6, -2,2,2,2,2,2,2,2,2,2,6,0xa,0x500a,0xa,0xd00a,0xa, -0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0xa, -0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0x12, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x12,0x12,0x12,0x12,0x12,7,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, -0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, -6,0xa,4,4,4,4,0xa,0xa,0xa,0xa,0,0x900a,0xa,0xb2,0xa,0xa, -4,4,2,2,0xa,0,0xa,0xa,0xa,2,0,0x900a,0xa,0xa,0xa,0xa, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0xa,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0xa,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0xa,0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd89, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x983,0x3a7,0x67c,0x67c,0x98b,0x61f,0x3a7,0x514, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x993,0x3a7,0x3a7,0x3a7,0x99a,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x9a2,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c, +0x9aa,0x9ae,0x43c,0x43c,0x43c,0x43c,0x9be,0x9b6,0x43c,0x9c6,0x43c,0x43c,0x9ce,0x9d4,0x43c,0x43c, +0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x9e4,0x9dc,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c, +0x43c,0x43c,0x43c,0x9ec,0x43c,0x9f4,0x4a6,0x9fc,0x43c,0xa04,0xa0b,0xa11,0xa19,0xa1d,0xa25,0x43c, +0x51b,0xa2d,0xa34,0xa3b,0x41e,0xa43,0x569,0x3a7,0x501,0xa4a,0x3a7,0xa50,0x41e,0xa55,0xa5d,0x3a7, +0x3a7,0xa62,0x51b,0x3a7,0x3a7,0x3a7,0x836,0xa6a,0x41e,0x5a3,0x57e,0xa71,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0xa2d,0xa79,0x3a7,0x3a7,0xa81,0xa89,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xa8d,0xa95,0x3a7, +0x3a7,0xa9d,0x57e,0xaa5,0x3a7,0xaab,0x3a7,0x3a7,0x60f,0xab3,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0xab8,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xabf,0xac7,0x3a7,0x3a7,0x3a7,0xaca,0x57e,0xad2, +0xad6,0xade,0x3a7,0xae5,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0xaec,0x3a7,0x3a7,0xafa,0xaf4,0x3a7,0x3a7,0x3a7,0xb02,0xb0a,0x3a7,0xb0e,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x5a5,0x41e,0x99a,0xb16,0x3a7,0x3a7,0x3a7,0xb23,0xb1e,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0xb2b,0xb33,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xb39, +0x3a7,0xb3f,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0xa51,0x3a7,0xb45,0x3a7,0x3a7,0xb4d,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x535,0xb55,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3f5,0xb5d,0x500,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0xb65,0xb6d,0xb73,0x3a7,0xb79,0x67c,0x67c,0xb81,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x67c,0x67c,0xb89,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xb8f, +0x3a7,0xb96,0x3a7,0xb92,0x3a7,0xb99,0x3a7,0xba1,0xba5,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3f5,0xbad,0x3f5,0xbb4,0xbbb,0xbc3,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xbcb,0xbd3,0x3a7,0x3a7,0xa51,0x3a7,0x3a7, +0x3a7,0x3a7,0xb3f,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xa7d,0x3a7, +0xbd8,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0xbe0,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0xbe8, +0x43c,0xbf0,0xbf0,0xbf7,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c, +0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x91a,0x4a6,0x4a6,0x43c, +0x43c,0x4a6,0x4a6,0xbff,0x43c,0x43c,0x43c,0x43c,0x43c,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6,0x4a6, +0xc07,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x43c,0x67c,0xc0f,0x67c,0x67c,0x67f,0xc14,0xc18, +0x858,0xc20,0x3c9,0x3a7,0xc26,0x3a7,0xc2b,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x783,0x3a7,0x3a7,0x3a7, +0x3a7,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c, +0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0xc33, +0x98b,0x67c,0x67c,0x67c,0xc3a,0x67c,0x67c,0xc41,0xc49,0xc0f,0x67c,0xc51,0x67c,0xc59,0xc5e,0x3a7, +0x3a7,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67c,0x67f,0xc66,0xc6f,0xc73,0xc7b, +0xc6b,0x67c,0x67c,0x67c,0x67c,0xc83,0x67c,0x792,0xc8b,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xc92,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7, +0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0x3a7,0xc92,0xca2,0xc9a,0xc9a,0xc9a,0xca3,0xca3,0xca3, +0xca3,0x3f5,0x3f5,0x3f5,0x3f5,0x3f5,0x3f5,0x3f5,0xcab,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3, +0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3, +0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3, +0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3, +0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0xca3,0x386,0x386,0x386,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,8,7,8,9,7,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,7,7,7,8,9,0xa,0xa,4, +4,4,0xa,0xa,0x310a,0xf20a,0xa,3,6,3,6,6,2,2,2,2, +2,2,2,2,2,2,6,0xa,0x500a,0xa,0xd00a,0xa,0xa,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0xa,0xa,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0x12,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x12,0x12,0x12,0x12, +0x12,7,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,6,0xa,4,4, +4,4,0xa,0xa,0xa,0xa,0,0x900a,0xa,0xb2,0xa,0xa,4,4,2,2, +0xa,0,0xa,0xa,0xa,2,0,0x900a,0xa,0xa,0xa,0xa,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0, +0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, 0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, 0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, 0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xa,0xa,0,0, -0,0,0,0,0,0,0xa,0,0,0,0,0,0xa,0xa,0,0xa, +0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xa,0xa,0,0,0,0,0,0, +0,0,0xa,0,0,0,0,0,0xa,0xa,0,0xa,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0xa,0,0,0,0,0, -0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0xa,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0xa,0,0,0xa,0xa,4,1,0xb1,0xb1,0xb1, +0,0,0xa,0,0,0xa,0xa,4,1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, 0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, 0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,0xb1,1,0xb1,0xb1,1, -0xb1,0xb1,1,0xb1,1,1,1,1,1,1,1,1,1,1,1,1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,0xb1,1,0xb1,0xb1,1,0xb1,0xb1,1,0xb1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5, -5,5,0xa,0xa,0xd,4,4,0xd,6,0xd,0xa,0xa,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0x8ad,0xd,0xd,0xd,0x4d,0xd,0x8d,0x8d, -0x8d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x2d,0x4d,0x4d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,5,5,5, -5,5,5,5,5,5,4,5,5,0xd,0x4d,0x4d,0xb1,0x8d,0x8d,0x8d, -0xd,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d, -0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d, +1,1,1,1,1,1,1,1,5,5,5,5,5,5,0xa,0xa, +0xd,4,4,0xd,6,0xd,0xa,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xd,0x8ad,0xd,0xd,0xd,0x4d,0xd,0x8d,0x8d,0x8d,0x8d,0x4d,0x8d, +0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x2d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x8d,0x4d,0x4d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,5,5,5,5,5,5,5, +5,5,4,5,5,0xd,0x4d,0x4d,0xb1,0x8d,0x8d,0x8d,0xd,0x8d,0x8d,0x8d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, +0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, -0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,0xd,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,5,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xb1,0xb1,0xa,0xb1,0xb1, -0xb1,0xb1,0x8d,0x8d,2,2,2,2,2,2,2,2,2,2,0x4d,0x4d, -0x4d,0xd,0xd,0x4d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xad,0x8d,0xb1,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d, -0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x4d, -0x8d,0x4d,0x4d,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d, -0x8d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0x8d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x8d,0x4d,0x8d, +0x4d,0x4d,0x8d,0x8d,0xd,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,0xa,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xb1,0xb1,0xa,0xb1,0xb1,0xb1,0xb1,0x8d,0x8d, +2,2,2,2,2,2,2,2,2,2,0x4d,0x4d,0x4d,0xd,0xd,0x4d, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xad, +0x8d,0xb1,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d, +0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x8d, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xd,0xd,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d, +0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, 0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xd, -0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1, -1,1,1,1,1,1,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1,1,1,1,1, +1,1,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, -0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -1,1,0xa,0xa,0xa,0xa,0x21,1,1,0xb1,1,1,0xb1,0xb1,0xb1,0xb1, -1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,0xb1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,0x81,0x41,0x41,0x41, -0x41,0x41,0x81,0x81,0x41,0x81,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, -0x81,0x41,0x81,0x81,0x81,0xb1,0xb1,0xb1,1,1,1,1,0x4d,0xd,0x4d,0x4d, -0x4d,0x4d,0xd,0x8d,0x4d,0x8d,0x8d,0xd,0xd,0xd,0xd,0xd,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,5,0xb1, +0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,0xa,0xa, +0xa,0xa,0x21,1,1,0xb1,1,1,0xb1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1, +1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1, +0xb1,0xb1,1,0xb1,0xb1,0xb1,0xb1,0xb1,0x81,0x41,0x41,0x41,0x41,0x41,0x81,0x81, +0x41,0x81,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x81,0x41,0x81,0x81, +0x81,0xb1,0xb1,0xb1,1,1,1,1,0x4d,0xd,0x4d,0x4d,0x4d,0x4d,0xd,0x8d, +0x4d,0x8d,0x8d,0xd,0xd,0xd,0xd,0xd,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, +0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x2d,0x2d,0x2d,0x4d,0xd, +0xd,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0xd,5,5,0xd,0xd,0xd,0xd,0xd,0xd, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x8d,0x8d,0x8d,0xd,0x8d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xb1,0xb1, 0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0xd,0x8d,0x4d,0x4d,0x8d,0x8d,0x4d, -0x4d,0xd,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, -0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0,0, -0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0,0, -0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0,0xb1,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0, +0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,4,0,0,0,0,0,0,0,4,0,0,0xb1,0, +0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0,0, 0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0xb1,0,0,0,0xb1,0,0,0,0,0,0, +0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0, 0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,4, -0,0,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0,0,0xb1, -0xb1,0xb1,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0xb1,0,0, -0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1, -0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0, -0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0xb1,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, +0,0xb1,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xb1,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,0, -0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0xb1,0xb1,0, -0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0, +0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0, +0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,4,0xa,0, +0,0,0,0,0xb1,0,0,0,0xb1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0, -0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa, -0xa,4,0xa,0,0,0,0,0,0xb1,0,0,0,0xb1,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0,0, +0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0, +0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, -0xb1,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0, -0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0xa0, -0,0,0,0,0,0,0xa0,0,0,0,0,0,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0,0xb1,0,0,0xa0,0,0,0,0, +0,0,0xa0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0, -0,0,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0,0,0,0,4,0,0,0,0,0,0,0,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0,0,0,4,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0xb1,0x310a,0xf20a, -0x310a,0xf20a,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0, -0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, -0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0xb1,0xb1,0, +0,0,0,0,0,0xb1,0,0xb1,0,0xb1,0x310a,0xf20a,0x310a,0xf20a,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1, -0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0, +0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0xb1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0, +0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0, -0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0xa,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0x310a,0xf20a,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0, -0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, -0,0,0,4,0,0xb1,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0,0,0,0,0,0,0,0x310a,0xf20a,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,4, +0,0xb1,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0x40,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x4a,0xa,0xa,0x2a,0xb1,0xb1,0xb1,0x12,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x40,0x40,0x40,0x40,0x40,0xb1,0x40,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0x4a,0xa,0xa,0x2a,0xb1,0xb1,0xb1,0x12,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x40,0x40,0x40,0x40, 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0,0,0,0,0,0,0, -0,0xb1,0xb1,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0xb1,0xb1,0, -0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0, -0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,0xa,0,0,0, -0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x40,0x40,0x40,0x40,0x40,0,0,0,0,0,0,0,0,0xb1,0xb1,0x40, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0xb1,0xb1,0,0,0,0,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0, +0,0xb1,0xb1,0xb1,0,0,0,0,0xa,0,0,0,0xa,0xa,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0xb1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, -0xb1,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, -0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0,0,0,0,0,0,0,0xb1,0xb1,0,0,0xb1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0xb1,0,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0, +0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0xb1,0, +0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0xb1,0,0,0, -0xb1,0xb1,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0, -0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xa,0xa,0,0xa,0xa,0xa,0xa,6,0x310a,0xf20a,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0x814,0x815, -0x813,0x816,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,2,0,0,0,2,2,2,2, -2,2,3,3,0xa,0x310a,0xf20a,0,9,9,9,9,9,9,9,9, -9,9,9,0xb2,0x412,0x432,0x8a0,0x8a1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,9,7,0x8ab,0x8ae,0x8b0,0x8ac,0x8af,6, -4,4,4,4,4,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa, -2,2,2,2,2,2,2,2,2,2,3,3,0xa,0x310a,0xf20a,0, +0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0, +0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, +0,0xb1,0,0,0,0,0,0,0xb1,0,0,0,0xb1,0xb1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0,0xa, +0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0, +0xa,0xa,0xa,0xa,6,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,9, +0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0x814,0x815,0x813,0x816,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, +2,0,0,0,2,2,2,2,2,2,3,3,0xa,0x310a,0xf20a,0, +9,9,9,9,9,9,9,9,9,9,9,0xb2,0x412,0x432,0x8a0,0x8a1, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +9,7,0x8ab,0x8ae,0x8b0,0x8ac,0x8af,6,4,4,4,4,4,0xa,0xa,0xa, +0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,2,2,2,2,2,2,2,2, +2,2,3,3,0xa,0x310a,0xf20a,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xa,0xa,0,0xa,0xa,0xa,0xa,0,0xa,0xa,0,0,0,0,0,0, -0,0,0,0,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa, -0xa,0xa,0xa,0xa,0,0xa,0,0xa,0,0xa,0,0,0,0,4,0, -0,0,0,0,0,0,0,0,0,0,0xa,0xa,0,0,0,0, -0x100a,0xa,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0,0, +4,4,4,4,4,4,4,4,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0,0xa,0xa,0xa,0xa,0, +0xa,0xa,0,0,0,0,0,0,0,0,0,0,0xa,0,0xa,0xa, +0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0,0xa, +0,0xa,0,0,0,0,4,0,0,0,0,0,0,0,0,0, +0,0,0xa,0xa,0,0,0,0,0x100a,0xa,0xa,0xa,0xa,0,0,0, +0,0,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a, +0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,0x900a,0x900a,0x900a,0x100a,0x900a,0x900a, +0x100a,0x100a,0x900a,0x900a,0x900a,0x900a,0x900a,0x100a,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa, +0x700a,0x700a,0x700a,0xb00a,0xb00a,0xb00a,0xa,0xa,0xa,0x100a,3,4,0xa,0x900a,0x100a,0xa, +0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x900a,0x900a,0x900a,0x900a,0xa,0x900a,0xa,0x100a,0xa, +0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0xa, +0xa,0x100a,0xa,0x100a,0x300a,0xf00a,0x100a,0x100a,0x100a,0x100a,0x100a,0x900a,0x100a,0x900a,0x100a,0x100a, +0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a, +0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a, +0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa, +0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a, +0xa,0xa,0x900a,0x100a,0x900a,0x900a,0x100a,0x900a,0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a, +0x300a,0xf00a,0x300a,0xf00a,0x900a,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x900a,0xa,0xa,0x300a,0xf00a,0xa,0xa, +0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0,0,0,0, +0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a, +0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0x100a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0xa,0x300a,0xf00a,0xa,0x500a,0x100a,0xd00a,0xa,0xa, +0xa,0xa,0xa,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x900a,0x300a,0xf00a,0xa, +0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa, -0x300a,0xf00a,0x900a,0x900a,0x900a,0x100a,0x900a,0x900a,0x100a,0x100a,0x900a,0x900a,0x900a,0x900a,0x900a,0x100a, -0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0x700a,0x700a,0x700a,0xb00a,0xb00a,0xb00a,0xa,0xa, -0xa,0x100a,3,4,0xa,0x900a,0x100a,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x900a, -0x900a,0x900a,0x900a,0xa,0x900a,0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a, -0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x300a,0xf00a,0x100a,0x100a, -0x100a,0x100a,0x100a,0x900a,0x100a,0x900a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0xa,0xa, -0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a, -0x100a,0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a, -0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a, -0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0x900a,0x100a,0x900a,0x900a,0x100a,0x900a, -0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x900a,0xa,0xa,0xa, -0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a, -0xf00a,0x900a,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a, -0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a, +0xa,0x100a,0xa,0x100a,0x100a,0x100a,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0x100a,0x900a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,0x310a,0xf20a,0xa,0xa, +0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x710a,0x320a,0xf10a, +0xb20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0x900a,0x100a,0x100a,0x100a,0x100a, +0x900a,0xa,0x100a,0x900a,0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x300a, +0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x100a,0xa,0xa,0xa, +0xa,0xa,0x100a,0x900a,0x900a,0x900a,0x100a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x900a,0xa, +0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x100a,0xa,0x100a,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a, +0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a, +0x100a,0x100a,0xa,0xa,0x100a,0xa,0x100a,0xa,0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa, +0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0xa, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0xa, -0x300a,0xf00a,0xa,0x500a,0x100a,0xd00a,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0x300a,0xf00a,0xa, -0xa,0xa,0xa,0xa,0x900a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x310a,0xf20a, -0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x100a,0x100a,0xa,0xa, -0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x100a,0x100a, -0x300a,0xf00a,0xa,0xa,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a, -0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x710a,0x320a,0xf10a,0xb20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a, -0xf20a,0xa,0xa,0x900a,0x100a,0x100a,0x100a,0x100a,0x900a,0xa,0x100a,0x900a,0x300a,0xf00a,0x100a,0x100a, -0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa, -0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa, -0x310a,0xf20a,0x310a,0xf20a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x900a,0x900a,0x100a,0xa, -0xa,0xa,0xa,0xa,0x300a,0xf00a,0x900a,0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0x300a, -0xf00a,0x300a,0xf00a,0x100a,0xa,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a, -0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0x100a,0xa,0x100a,0xa, -0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa, -0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a, -0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0x100a,0x100a, -0x100a,0x100a,0xa,0x100a,0x100a,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0x300a,0xf00a,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,0xa,0xa,0x100a, +0x100a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, 0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, -0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, -0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a, -0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, -0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x900a,0xa, +0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0x300a,0xf00a, +0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a, +0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa, +0xa,0xa,0xa,0xa,0x100a,0xa,0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0,0,0,0,0,0xa,0xa,0xa, +0xa,0xa,0xa,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0, +0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa, +0xa,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a, +0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a, +0xf20a,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x900a,0xa, -0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xb1, -0xb1,0xb1,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0, +0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xa,0,0,0,0,0,0xa,0xa, +0,0,0,0,0,0xa,0xa,0xa,9,0xa,0xa,0xa,0xa,0,0,0, +0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a, +0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, -0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa, -0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0,0,0,0,0xa,0,0,0,0,0,0,0,0,0,0xb1,0xb1, -0xb1,0xb1,0,0,0xa,0,0,0,0,0,0xa,0xa,0,0,0,0, -0,0xa,0xa,0xa,9,0xa,0xa,0xa,0xa,0,0,0,0x310a,0xf20a,0x310a,0xf20a, -0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a, -0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xa, -0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0xb1,0xb1,0xa,0xa,0,0,0,0xa,0xa,0xa,0xa,0,0,0,0, +0,0,0,0,0,0,0,0xa,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa, 0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, -0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0xb1,0xb1,0xb1,0xb1,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xa,0xa,0,0,0,0,0,0,0,0,0xa,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0xb1,0,0,0,0xb1,0,0,0,0,0xb1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xb1,0xb1,0,0xa,0xa,0xa,0xa,0xb1,0,0,0, -0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0, -0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, -0x40,0x40,0x60,0,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, -0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0, +0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xa,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0, -0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, -0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xb1,0,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1, -0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0, -0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0,0,0, -0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,1,1,1,1,1,1,1,1,3,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xd,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0, +0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0xb1,0, +0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xa,0xa,0xa,0xa, +0xb1,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0, +0,0,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, +0x40,0x40,0x40,0x40,0x40,0x40,0x60,0,0xa,0xa,0xa,0xa,0,0,0,0, +0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0, +0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0, +0,0,0,0,0,0,0xa,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0, +0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, +1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1,0xb1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0,0,0,0,0,1,0xb1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, 0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xa,0xa,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xd,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, -0x12,0x12,0x12,0x12,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xa,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0, -0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,6,0xa,6,0,0xa,6,0xa,0xa,0xa,0x310a,0xf20a,0x310a, -0xf20a,0x310a,0xf20a,4,0xa,0xa,3,3,0x300a,0xf00a,0xa,0,0xa,4,4,0xa, -0,0,0,0,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,6,0xa,6,0, +0xa,6,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,4,0xa,0xa,3,3, +0x300a,0xf00a,0xa,0,0xa,4,4,0xa,0,0,0,0,0xd,0xd,0xd,0xd, 0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xb2,0,0xa,0xa,4,4,4,0xa,0xa,0x310a,0xf20a,0xa,3, -6,3,6,6,2,2,2,2,2,2,2,2,2,2,6,0xa, -0x500a,0xa,0xd00a,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x510a, -0xa,0xd20a,0xa,0x310a,0xf20a,0xa,0x310a,0xf20a,0xa,0xa,0,0,0,0,0,0, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb2,0,0xa,0xa,4, +4,4,0xa,0xa,0x310a,0xf20a,0xa,3,6,3,6,6,2,2,2,2, +2,2,2,2,2,2,6,0xa,0x500a,0xa,0xd00a,0xa,0xa,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,4,0xa,0xa,0xa,4,4,0,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0xaa,0xaa,0xaa, -0xa,0xa,0x12,0x12,0,0xa,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0x310a,0xf20a,0xa,0x310a,0xf20a, +0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,4,0xa,0xa, +0xa,4,4,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0xaa,0xaa,0xaa,0xa,0xa,0x12,0x12,0,0xa,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0,0,0,0xb1,2,2,2,2,2,2,2,2,2,2,2, +0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0xb1,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, +2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,0,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0xa, -1,0xb1,0xb1,0xb1,1,0xb1,0xb1,1,1,1,1,1,0xb1,0xb1,0xb1,0xb1, +1,1,1,1,1,1,1,0xa,1,0xb1,0xb1,0xb1,1,0xb1,0xb1,1, +1,1,1,1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0xb1,0xb1,0xb1,1,1,1,1,0xb1, -0x41,0x81,1,1,0x81,0xb1,0xb1,1,1,1,1,0x41,0x41,0x41,0x41,0x81, +0xb1,0xb1,0xb1,1,1,1,1,0xb1,0x41,0x81,1,1,0x81,0xb1,0xb1,1, +1,1,1,0x41,0x41,0x41,0x41,0x81,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,0x41,0x41,0x41,0x41,0x41,0x81,1,0x81, +1,0x81,0x81,1,1,0x61,0x81,0x81,0x81,0x81,0x81,0x41,0x41,0x41,0x41,0x61, +0x41,0x41,0x41,0x41,0x41,0x81,0x41,0x41,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -0x41,0x41,0x41,0x41,0x41,0x81,1,0x81,1,0x81,0x81,1,1,0x61,0x81,0x81, -0x81,0x81,0x81,0x41,0x41,0x41,0x41,0x61,0x41,0x41,0x41,0x41,0x41,0x81,0x41,0x41, +1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x41,0x81,0x41,0x81,0x81,0x81,0x41,0x41, +0x41,0x81,0x41,0x41,0x81,0x41,0x81,0x81,0x41,0x81,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0x81,0x81,0x81,0x81,0x41,0x41,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0x41,0x81,0x41,0x81,0x81,0x81,0x41,0x41,0x41,0x81,0x41,0x41,0x81,0x41,0x81,0x81, -0x41,0x81,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,0x81,0x81,0x81,0x81,0x41,0x41,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0x4d,0x4d,0x8d,0x4d,0xb1,0xb1,0xb1,0xb1, -0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,5,5,5,5,5,5,5,5, -5,5,0xd,0xd,0xd,0xd,0xd,0xd,0x6d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0x4d,0x8d,0x4d,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +5,5,5,5,5,5,5,5,5,5,0xd,0xd,0xd,0xd,0xd,0xd, +0x6d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,1,1,1,1,1,1,1,1,1, -1,1,1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d, -0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x8d,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0x41,1,0x41,0x41, -0x81,0x81,0x81,1,0x41,0x81,0x81,0x41,0x41,0x81,0x41,0x41,1,0x41,0x81,0x81, -0x41,1,1,1,1,0x81,0x41,0x61,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1, +1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1,0xb1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, +0x4d,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d, +0x8d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0x41,0x41,0x41,0x41,0x81,0x81,0x41,0x41,0x41,0x41,0x41,0x41, +0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0x41,1,0x41,0x41,0x81,0x81,0x81,1,0x41,0x81,0x81,0x41, +0x41,0x81,0x41,0x41,1,0x41,0x81,0x81,0x41,1,1,1,1,0x81,0x41,0x61, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1, +0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, -0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0, +0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, +0xb1,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0xb1,0,0xb1,0xb1, +0,0,0,0,0,0,0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0, -0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, -0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0, -0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0,0,0,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, -0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0, +0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0, +0,0,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0,0xb1,0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0, +0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0,0xb1,0,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0, -0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,0,0,0,0,0xb1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa0, +0xa0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0,0,0xb1,0,0xb1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0, -0,0,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, +0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1, +0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xa0, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0,0,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,0, -0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0xb1,0,0xb1, +0,0,0,0,0,0,0,0,0xb1,0,0xb1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xa0,0xa0,0xb1,0xb1,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, -0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, -0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, +0,0,0,0,0,0,0,0,4,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,4,4,4,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xa0,0xa0,0xa0,0xa0, +0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xb1,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, 0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0,0xa0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0, -0,0xb1,0,0xb1,0,0,0,0,0,0,0,0,4,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0, +0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0xa,0,0xb1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,4,4,4, +0,0,0,0,0xb2,0xb2,0xb2,0xb2,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, -0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0, -0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0xb2,0xb2,0xb2,0xb2, +0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1, -0xb1,0xb1,0,0,0,0,0,0,0,0,0,0xb2,0xb2,0xb2,0xb2,0xb2, -0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0, +0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xa,0xa,0xb1,0xb1,0xb1,0xa,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xb1,0xb1,0xb1,0xa,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0x100a,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0x100a,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0x100a,0,0,0,0,0,0,0,0,0,0,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +0,0,0,0,0,0,0,0x100a,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0x100a,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0x100a,0,0,0,0,0,0,0,0, +0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0, -0,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0, +2,2,2,2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0, +0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0, +0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1, +0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0, -0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1, -0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,4,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,0x41,0x41,0x41,0x41, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1, 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, -0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xa1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xd,0xd,0xd,0xd,0xd,0xd, -0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,2,2,2,2, -2,2,2,2,2,2,2,0xa,0xa,0xa,0xa,0xa,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa, -0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0xa,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0,0, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xd,0xd, +0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0, +0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +2,2,2,2,2,2,2,2,2,2,2,0xa,0xa,0xa,0xa,0xa, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0xa,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa, 0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0,0,0, -0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0, -0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0, -0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0, +0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0, +0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0, 0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, -0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,2,2,2,2,2,2,2,2,2,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x12,0x12, -0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, +0,0,0,0,0xa,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0, +0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0, +0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2, +2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0x12,0x12,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, 0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, -0x12,0xb2,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0xb2,0x12,0x12,0x12,0x12,0x12,0x12, 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, -0x12,0x12,0x12,0x12,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, -0x12,0x12,0x12,0x12,0,0,0,0 +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0xb1,0xb1,0xb1,0xb1, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x12,0x12,0x12,0x12, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0,0,0,0 }; static const uint32_t ubidi_props_mirrors[40]={ @@ -808,7 +835,7 @@ static const uint32_t ubidi_props_mirrors[40]={ 0x16029b8,0x4029f5,0x1802ade,0x1c02ae3,0x1a02ae4,0x1e02ae5,0xe02aee,0x602bfe }; -static const uint8_t ubidi_props_jgArray[680]={ +static const uint8_t ubidi_props_jgArray[684]={ 0x2d,0,3,3,0x2c,3,0x2d,3,4,0x2a,4,4,0xd,0xd,0xd,6, 6,0x1f,0x1f,0x23,0x23,0x21,0x21,0x28,0x28,1,1,0xb,0xb,0x37,0x37,0x37, 0,9,0x1d,0x13,0x16,0x18,0x1a,0x10,0x2c,0x2d,0x2d,0,0,0,0,0, @@ -846,12 +873,12 @@ static const uint8_t ubidi_props_jgArray[680]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x5d,0x5a,0x60,0x63,0x5e,0x5f,0x59,0x61,0x5b,0x5c,0x62,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +3,3,3,0,0,0,0x66,0,0,0x1a,0xd,0x28,0x28,0xb,0x67,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 4,4,0xd,0x28,9,0x1d,0x16,0x18,0x2d,0x2d,0x1f,0x2c,0x39,0,6,0x21, -0xb,0x55,0x1f,1,0x13,0,4,4,4,0x1f,0x2d,0x56,0x58,0x57,4,4, -4,0xd,0xb,1,0x58,0xd,0xd,0x16 +0xb,0x55,0x1f,1,0x13,0x1d,4,4,4,0x1f,0x2d,0x56,0x58,0x57,4,4, +4,0xd,0xb,1,0x58,0xd,0xd,0x16,0xb,0,0,0 }; static const uint8_t ubidi_props_jgArray2[612]={ @@ -897,24 +924,24 @@ static const uint8_t ubidi_props_jgArray2[612]={ }; static const UBiDiProps ubidi_props_singleton={ - NULL, + nullptr, ubidi_props_indexes, ubidi_props_mirrors, ubidi_props_jgArray, ubidi_props_jgArray2, { ubidi_props_trieIndex, - ubidi_props_trieIndex+3568, - NULL, - 3568, - 8968, + ubidi_props_trieIndex+3612, + nullptr, + 3612, + 9396, 0x1a0, - 0xe70, + 0xe9c, 0x0, 0x0, 0x110000, - 0x30f4, - NULL, 0, FALSE, FALSE, 0, NULL + 0x32cc, + nullptr, 0, false, false, 0, nullptr }, { 2,2,0,0 } }; diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubidiimp.h b/src/duckdb/extension/icu/third_party/icu/common/ubidiimp.h index d068c8a17..e48fc6f94 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ubidiimp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ubidiimp.h @@ -26,6 +26,14 @@ /* miscellaneous definitions ---------------------------------------------- */ +// ICU-20853=ICU-20935 Solaris #defines CS and ES in sys/regset.h +#ifdef CS +# undef CS +#endif +#ifdef ES +# undef ES +#endif + typedef uint8_t DirProp; typedef uint32_t Flags; @@ -128,8 +136,8 @@ ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t index); /* number of isolate run entries for paired brackets allocated initially without malloc */ #define SIMPLE_OPENINGS_COUNT 20 -#define UBIDIIMP_CR 0x000D -#define UBIDIIMP_LF 0x000A +#define CR 0x000D +#define LF 0x000A /* Run structure for reordering --------------------------------------------- */ enum { @@ -451,26 +459,26 @@ ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAlloc /* additional macros used by ubidi_open() - always allow allocation */ #define getInitialDirPropsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \ - TRUE, (length)) + true, (length)) #define getInitialLevelsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \ - TRUE, (length)) + true, (length)) #define getInitialOpeningsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->openingsMemory, &(pBiDi)->openingsSize, \ - TRUE, (length)*sizeof(Opening)) + true, (length)*sizeof(Opening)) #define getInitialParasMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->parasMemory, &(pBiDi)->parasSize, \ - TRUE, (length)*sizeof(Para)) + true, (length)*sizeof(Para)) #define getInitialRunsMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \ - TRUE, (length)*sizeof(Run)) + true, (length)*sizeof(Run)) #define getInitialIsolatesMemory(pBiDi, length) \ ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->isolatesMemory, &(pBiDi)->isolatesSize, \ - TRUE, (length)*sizeof(Isolate)) + true, (length)*sizeof(Isolate)) #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubidiln.cpp b/src/duckdb/extension/icu/third_party/icu/common/ubidiln.cpp index 3545f4e11..63c4f9190 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ubidiln.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ubidiln.cpp @@ -31,13 +31,13 @@ * text in a single paragraph or in a line of a single paragraph * which has already been processed according to * the Unicode 6.3 BiDi algorithm as defined in - * http://www.unicode.org/unicode/reports/tr9/ , version 28, + * https://www.unicode.org/reports/tr9/ , version 28, * also described in The Unicode Standard, Version 6.3.0 . * * This means that there is a UBiDi object with a levels * and a dirProps array. * paraLevel and direction are also set. - * Only if the length of the text is zero, then levels==dirProps==NULL. + * Only if the length of the text is zero, then levels==dirProps==nullptr. * * The overall directionality of the paragraph * or line is used to bypass the reordering steps if possible. @@ -101,7 +101,7 @@ setTrailingWSStart(UBiDi *pBiDi) { are already set to paragraph level. Setting trailingWSStart to pBidi->length will avoid changing the level of B chars from 0 to paraLevel in ubidi_getLevels when - orderParagraphsLTR==TRUE. + orderParagraphsLTR==true. */ if(dirProps[start-1]==B) { pBiDi->trailingWSStart=start; /* currently == pBiDi->length */ @@ -134,25 +134,25 @@ ubidi_setLine(const UBiDi *pParaBiDi, RETURN_VOID_IF_NOT_VALID_PARA(pParaBiDi, *pErrorCode); RETURN_VOID_IF_BAD_RANGE(start, 0, limit, *pErrorCode); RETURN_VOID_IF_BAD_RANGE(limit, 0, pParaBiDi->length+1, *pErrorCode); - if(pLineBiDi==NULL) { + if(pLineBiDi==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } - if(ubidi_getParagraph(pParaBiDi, start, NULL, NULL, NULL, pErrorCode) != - ubidi_getParagraph(pParaBiDi, limit-1, NULL, NULL, NULL, pErrorCode)) { + if(ubidi_getParagraph(pParaBiDi, start, nullptr, nullptr, nullptr, pErrorCode) != + ubidi_getParagraph(pParaBiDi, limit-1, nullptr, nullptr, nullptr, pErrorCode)) { /* the line crosses a paragraph boundary */ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } /* set the values in pLineBiDi from its pParaBiDi parent */ - pLineBiDi->pParaBiDi=NULL; /* mark unfinished setLine */ + pLineBiDi->pParaBiDi=nullptr; /* mark unfinished setLine */ pLineBiDi->text=pParaBiDi->text+start; length=pLineBiDi->length=limit-start; pLineBiDi->resultLength=pLineBiDi->originalLength=length; pLineBiDi->paraLevel=GET_PARALEVEL(pParaBiDi, start); pLineBiDi->paraCount=pParaBiDi->paraCount; - pLineBiDi->runs=NULL; + pLineBiDi->runs=nullptr; pLineBiDi->flags=0; pLineBiDi->reorderingMode=pParaBiDi->reorderingMode; pLineBiDi->reorderingOptions=pParaBiDi->reorderingOptions; @@ -263,11 +263,11 @@ U_CAPI const UBiDiLevel * U_EXPORT2 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { int32_t start, length; - RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, NULL); - RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, NULL); + RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, nullptr); + RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, nullptr); if((length=pBiDi->length)<=0) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } if((start=pBiDi->trailingWSStart)==length) { /* the current levels array reflects the WS run */ @@ -297,7 +297,7 @@ ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { } else { /* out of memory */ *pErrorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } } @@ -373,10 +373,10 @@ ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR); start=pBiDi->runs[runIndex].logicalStart; - if(pLogicalStart!=NULL) { + if(pLogicalStart!=nullptr) { *pLogicalStart=GET_INDEX(start); } - if(pLength!=NULL) { + if(pLength!=nullptr) { if(runIndex>0) { *pLength=pBiDi->runs[runIndex].visualLimit- pBiDi->runs[runIndex-1].visualLimit; @@ -530,12 +530,12 @@ static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex) { visualStart+=length; } /* we should never get here */ - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } /* * Compute the runs array from the levels array. - * After ubidi_getRuns() returns TRUE, runCount is guaranteed to be >0 + * After ubidi_getRuns() returns true, runCount is guaranteed to be >0 * and the runs are reordered. * Odd-level runs have visualStart on their visual right edge and * they progress visually to the left. @@ -551,7 +551,7 @@ ubidi_getRuns(UBiDi *pBiDi, UErrorCode*) { * includes the case of length==0 (handled in setPara).. */ if (pBiDi->runCount>=0) { - return TRUE; + return true; } if(pBiDi->direction!=UBIDI_MIXED) { @@ -608,7 +608,7 @@ ubidi_getRuns(UBiDi *pBiDi, UErrorCode*) { if(getRunsMemory(pBiDi, runCount)) { runs=pBiDi->runsMemory; } else { - return FALSE; + return false; } /* set the runs */ @@ -694,7 +694,7 @@ ubidi_getRuns(UBiDi *pBiDi, UErrorCode*) { /* handle remove BiDi control characters */ if(pBiDi->controlCount>0) { int32_t runIndex; - const UChar *start=pBiDi->text, *limit=start+pBiDi->length, *pu; + const char16_t *start=pBiDi->text, *limit=start+pBiDi->length, *pu; for(pu=start; pu0;) { level=levels[--start]; if(level>UBIDI_MAX_EXPLICIT_LEVEL+1) { - return FALSE; + return false; } if(levelruns; int32_t i, j, start, limit, length, insertRemove; int32_t visualStart=0, controlFound=0; - UChar uchar=pBiDi->text[logicalIndex]; + char16_t uchar=pBiDi->text[logicalIndex]; /* is the logical index pointing to a control ? */ if(IS_BIDI_CONTROL_CHAR(uchar)) { return UBIDI_MAP_NOWHERE; @@ -1036,7 +1036,7 @@ ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode) /* handle removed BiDi control characters */ int32_t controlFound=0, insertRemove, length; int32_t logicalStart, logicalEnd, visualStart=0, j, k; - UChar uchar; + char16_t uchar; UBool evenRun; /* add number of controls until visual index */ for(i=0; ; i++, visualStart+=length) { @@ -1113,7 +1113,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) { ubidi_countRuns(pBiDi, pErrorCode); if(U_FAILURE(*pErrorCode)) { /* no op */ - } else if(indexMap==NULL) { + } else if(indexMap==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } else { /* fill a logical-to-visual index map using the runs[] */ @@ -1171,7 +1171,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) { int32_t controlFound=0, runCount=pBiDi->runCount; int32_t length, insertRemove; UBool evenRun; - UChar uchar; + char16_t uchar; visualStart=0; /* subtract number of controls found until each index */ for(i=0; icontrolCount>0) { int32_t runCount=pBiDi->runCount, logicalEnd; int32_t insertRemove, length, i, j, k, m; - UChar uchar; + char16_t uchar; UBool evenRun; runs=pBiDi->runs; visualStart=0; @@ -1317,7 +1317,7 @@ ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) { U_CAPI void U_EXPORT2 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length) { - if(srcMap!=NULL && destMap!=NULL && length>0) { + if(srcMap!=nullptr && destMap!=nullptr && length>0) { const int32_t *pi; int32_t destLength=-1, count=0; /* find highest value and count positive indexes in srcMap */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubiditransform.cpp b/src/duckdb/extension/icu/third_party/icu/common/ubiditransform.cpp index 5b0d5cf96..01f5901a2 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ubiditransform.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ubiditransform.cpp @@ -78,8 +78,8 @@ typedef struct { struct UBiDiTransform { UBiDi *pBidi; /* pointer to a UBiDi object */ const ReorderingScheme *pActiveScheme; /* effective reordering scheme */ - UChar *src; /* input text */ - UChar *dest; /* output text */ + char16_t *src; /* input text */ + char16_t *dest; /* output text */ uint32_t srcLength; /* input text length - not really needed as we are zero-terminated and can u_strlen */ uint32_t srcSize; /* input text capacity excluding the trailing zero */ uint32_t destSize; /* output text capacity */ @@ -89,27 +89,27 @@ struct UBiDiTransform { uint32_t letters; /* letter option for ArabicShaping */ }; -U_DRAFT UBiDiTransform* U_EXPORT2 +U_CAPI UBiDiTransform* U_EXPORT2 ubiditransform_open(UErrorCode *pErrorCode) { - UBiDiTransform *pBiDiTransform = NULL; + UBiDiTransform *pBiDiTransform = nullptr; if (U_SUCCESS(*pErrorCode)) { pBiDiTransform = (UBiDiTransform*) uprv_calloc(1, sizeof(UBiDiTransform)); - if (pBiDiTransform == NULL) { + if (pBiDiTransform == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; } } return pBiDiTransform; } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 ubiditransform_close(UBiDiTransform *pBiDiTransform) { - if (pBiDiTransform != NULL) { - if (pBiDiTransform->pBidi != NULL) { + if (pBiDiTransform != nullptr) { + if (pBiDiTransform->pBidi != nullptr) { ubidi_close(pBiDiTransform->pBidi); } - if (pBiDiTransform->src != NULL) { + if (pBiDiTransform->src != nullptr) { uprv_free(pBiDiTransform->src); } uprv_free(pBiDiTransform); @@ -129,8 +129,8 @@ static UBool action_resolve(UBiDiTransform *pTransform, UErrorCode *pErrorCode) { ubidi_setPara(pTransform->pBidi, pTransform->src, pTransform->srcLength, - pTransform->pActiveScheme->baseLevel, NULL, pErrorCode); - return FALSE; + pTransform->pActiveScheme->baseLevel, nullptr, pErrorCode); + return false; } /** @@ -150,7 +150,7 @@ action_reorder(UBiDiTransform *pTransform, UErrorCode *pErrorCode) *pTransform->pDestLength = pTransform->srcLength; pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT; - return TRUE; + return true; } /** @@ -166,9 +166,9 @@ static UBool action_setInverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode) { (void)pErrorCode; - ubidi_setInverse(pTransform->pBidi, TRUE); + ubidi_setInverse(pTransform->pBidi, true); ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_INVERSE_LIKE_DIRECT); - return FALSE; + return false; } /** @@ -186,7 +186,7 @@ action_setRunsOnly(UBiDiTransform *pTransform, UErrorCode *pErrorCode) { (void)pErrorCode; ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_RUNS_ONLY); - return FALSE; + return false; } /** @@ -205,7 +205,7 @@ action_reverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode) pTransform->dest, pTransform->destSize, UBIDI_REORDER_DEFAULT, pErrorCode); *pTransform->pDestLength = pTransform->srcLength; - return TRUE; + return true; } /** @@ -215,12 +215,12 @@ action_reverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode) * * @param pTransform A pointer to the UBiDiTransform structure. * @param newSrc A pointer whose value is to be used as input text. - * @param newLength A length of the new text in UChars. - * @param newSize A new source capacity in UChars. + * @param newLength A length of the new text in char16_ts. + * @param newSize A new source capacity in char16_ts. * @param pErrorCode Pointer to the error code value. */ static void -updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength, +updateSrc(UBiDiTransform *pTransform, const char16_t *newSrc, uint32_t newLength, uint32_t newSize, UErrorCode *pErrorCode) { if (newSize < newLength) { @@ -229,12 +229,12 @@ updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength, } if (newSize > pTransform->srcSize) { newSize += 50; // allocate slightly more than needed right now - if (pTransform->src != NULL) { + if (pTransform->src != nullptr) { uprv_free(pTransform->src); - pTransform->src = NULL; + pTransform->src = nullptr; } - pTransform->src = (UChar *)uprv_malloc(newSize * sizeof(UChar)); - if (pTransform->src == NULL) { + pTransform->src = (char16_t *)uprv_malloc(newSize * sizeof(char16_t)); + if (pTransform->src == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; //pTransform->srcLength = pTransform->srcSize = 0; return; @@ -274,7 +274,7 @@ static UBool action_shapeArabic(UBiDiTransform *pTransform, UErrorCode *pErrorCode) { if ((pTransform->letters | pTransform->digits) == 0) { - return FALSE; + return false; } if (pTransform->pActiveScheme->lettersDir == pTransform->pActiveScheme->digitsDir) { doShape(pTransform, pTransform->letters | pTransform->digits | pTransform->pActiveScheme->lettersDir, @@ -288,7 +288,7 @@ action_shapeArabic(UBiDiTransform *pTransform, UErrorCode *pErrorCode) pErrorCode); } } - return TRUE; + return true; } /** @@ -306,11 +306,11 @@ action_mirror(UBiDiTransform *pTransform, UErrorCode *pErrorCode) UChar32 c; uint32_t i = 0, j = 0; if (0 == (pTransform->reorderingOptions & UBIDI_DO_MIRRORING)) { - return FALSE; + return false; } if (pTransform->destSize < pTransform->srcLength) { *pErrorCode = U_BUFFER_OVERFLOW_ERROR; - return FALSE; + return false; } do { UBool isOdd = ubidi_getLevelAt(pTransform->pBidi, i) & 1; @@ -320,7 +320,7 @@ action_mirror(UBiDiTransform *pTransform, UErrorCode *pErrorCode) *pTransform->pDestLength = pTransform->srcLength; pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT; - return TRUE; + return true; } /** @@ -331,52 +331,52 @@ static const ReorderingScheme Schemes[] = { /* 0: Logical LTR => Visual LTR */ {LTR, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR, - {action_shapeArabic, action_resolve, action_reorder, NULL}}, + {action_shapeArabic, action_resolve, action_reorder, nullptr}}, /* 1: Logical RTL => Visual LTR */ {RTL, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL, - {action_resolve, action_reorder, action_shapeArabic, NULL}}, + {action_resolve, action_reorder, action_shapeArabic, nullptr}}, /* 2: Logical LTR => Visual RTL */ {LTR, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR, - {action_shapeArabic, action_resolve, action_reorder, action_reverse, NULL}}, + {action_shapeArabic, action_resolve, action_reorder, action_reverse, nullptr}}, /* 3: Logical RTL => Visual RTL */ {RTL, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL, - {action_resolve, action_reorder, action_shapeArabic, action_reverse, NULL}}, + {action_resolve, action_reorder, action_shapeArabic, action_reverse, nullptr}}, /* 4: Visual LTR => Logical RTL */ {LTR, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL, - {action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}}, + {action_shapeArabic, action_setInverse, action_resolve, action_reorder, nullptr}}, /* 5: Visual RTL => Logical RTL */ {RTL, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL, - {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}}, + {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, nullptr}}, /* 6: Visual LTR => Logical LTR */ {LTR, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR, - {action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}}, + {action_setInverse, action_resolve, action_reorder, action_shapeArabic, nullptr}}, /* 7: Visual RTL => Logical LTR */ {RTL, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR, - {action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}}, + {action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, nullptr}}, /* 8: Logical LTR => Logical RTL */ {LTR, LOGICAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR, - {action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, NULL}}, + {action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, nullptr}}, /* 9: Logical RTL => Logical LTR */ {RTL, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, RTL, - {action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, NULL}}, + {action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, nullptr}}, /* 10: Visual LTR => Visual RTL */ {LTR, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR, - {action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, NULL}}, + {action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, nullptr}}, /* 11: Visual RTL => Visual LTR */ {RTL, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR, - {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, NULL}}, + {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, nullptr}}, /* 12: Logical LTR => Logical LTR */ {LTR, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR, - {action_resolve, action_mirror, action_shapeArabic, NULL}}, + {action_resolve, action_mirror, action_shapeArabic, nullptr}}, /* 13: Logical RTL => Logical RTL */ {RTL, LOGICAL, RTL, LOGICAL, SHAPE_VISUAL, SHAPE_LOGICAL, RTL, - {action_resolve, action_mirror, action_shapeArabic, NULL}}, + {action_resolve, action_mirror, action_shapeArabic, nullptr}}, /* 14: Visual LTR => Visual LTR */ {LTR, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR, - {action_resolve, action_mirror, action_shapeArabic, NULL}}, + {action_resolve, action_mirror, action_shapeArabic, nullptr}}, /* 15: Visual RTL => Visual RTL */ {RTL, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR, - {action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, NULL}} + {action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, nullptr}} }; static const uint32_t nSchemes = sizeof(Schemes) / sizeof(*Schemes); @@ -387,7 +387,7 @@ static const uint32_t nSchemes = sizeof(Schemes) / sizeof(*Schemes); * of the first strong bidi character. */ static void -resolveBaseDirection(const UChar *text, uint32_t length, +resolveBaseDirection(const char16_t *text, uint32_t length, UBiDiLevel *pInLevel, UBiDiLevel *pOutLevel) { switch (*pInLevel) { @@ -417,7 +417,7 @@ resolveBaseDirection(const UChar *text, uint32_t length, * Finds a valid ReorderingScheme matching the * caller-defined scheme. * - * @return A valid ReorderingScheme object or NULL + * @return A valid ReorderingScheme object or nullptr */ static const ReorderingScheme* findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel, @@ -431,34 +431,34 @@ findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel, return pScheme; } } - return NULL; + return nullptr; } -U_DRAFT uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ubiditransform_transform(UBiDiTransform *pBiDiTransform, - const UChar *src, int32_t srcLength, - UChar *dest, int32_t destSize, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destSize, UBiDiLevel inParaLevel, UBiDiOrder inOrder, UBiDiLevel outParaLevel, UBiDiOrder outOrder, UBiDiMirroring doMirroring, uint32_t shapingOptions, UErrorCode *pErrorCode) { uint32_t destLength = 0; - UBool textChanged = FALSE; + UBool textChanged = false; const UBiDiTransform *pOrigTransform = pBiDiTransform; - const UBiDiAction *action = NULL; + const UBiDiAction *action = nullptr; if (U_FAILURE(*pErrorCode)) { return 0; } - if (src == NULL || dest == NULL) { + if (src == nullptr || dest == nullptr) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } CHECK_LEN(src, srcLength, pErrorCode); CHECK_LEN(dest, destSize, pErrorCode); - if (pBiDiTransform == NULL) { + if (pBiDiTransform == nullptr) { pBiDiTransform = ubiditransform_open(pErrorCode); if (U_FAILURE(*pErrorCode)) { return 0; @@ -470,7 +470,7 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform, pBiDiTransform->pActiveScheme = findMatchingScheme(inParaLevel, outParaLevel, inOrder, outOrder); - if (pBiDiTransform->pActiveScheme == NULL) { + if (pBiDiTransform->pActiveScheme == nullptr) { goto cleanup; } pBiDiTransform->reorderingOptions = doMirroring ? UBIDI_DO_MIRRORING @@ -486,7 +486,7 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform, if (U_FAILURE(*pErrorCode)) { goto cleanup; } - if (pBiDiTransform->pBidi == NULL) { + if (pBiDiTransform->pBidi == nullptr) { pBiDiTransform->pBidi = ubidi_openSized(0, 0, pErrorCode); if (U_FAILURE(*pErrorCode)) { goto cleanup; @@ -503,10 +503,10 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform, updateSrc(pBiDiTransform, pBiDiTransform->dest, *pBiDiTransform->pDestLength, *pBiDiTransform->pDestLength, pErrorCode); } - textChanged = TRUE; + textChanged = true; } } - ubidi_setInverse(pBiDiTransform->pBidi, FALSE); + ubidi_setInverse(pBiDiTransform->pBidi, false); if (!textChanged && U_SUCCESS(*pErrorCode)) { /* Text was not changed - just copy src to dest */ @@ -521,8 +521,8 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform, if (pOrigTransform != pBiDiTransform) { ubiditransform_close(pBiDiTransform); } else { - pBiDiTransform->dest = NULL; - pBiDiTransform->pDestLength = NULL; + pBiDiTransform->dest = nullptr; + pBiDiTransform->pDestLength = nullptr; pBiDiTransform->srcLength = 0; pBiDiTransform->destSize = 0; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubidiwrt.cpp b/src/duckdb/extension/icu/third_party/icu/common/ubidiwrt.cpp index a69c0a4b8..969807c24 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ubidiwrt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ubidiwrt.cpp @@ -56,8 +56,8 @@ * we are writing RTL output in reverse. */ static int32_t -doWriteForward(const UChar *src, int32_t srcLength, - UChar *dest, int32_t destSize, +doWriteForward(const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode) { /* optimize for several combinations of options */ @@ -93,7 +93,7 @@ doWriteForward(const UChar *src, int32_t srcLength, case UBIDI_REMOVE_BIDI_CONTROLS: { /* copy the LTR run and remove any BiDi control characters */ int32_t remaining=destSize; - UChar c; + char16_t c; do { c=*src++; if(!IS_BIDI_CONTROL_CHAR(c)) { @@ -149,8 +149,8 @@ doWriteForward(const UChar *src, int32_t srcLength, } static int32_t -doWriteReverse(const UChar *src, int32_t srcLength, - UChar *dest, int32_t destSize, +doWriteReverse(const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode) { /* @@ -248,7 +248,7 @@ doWriteReverse(const UChar *src, int32_t srcLength, /* we need to find out the destination length of the run, which will not include the BiDi control characters */ int32_t length=srcLength; - UChar ch; + char16_t ch; i=0; do { @@ -306,26 +306,26 @@ doWriteReverse(const UChar *src, int32_t srcLength, } U_CAPI int32_t U_EXPORT2 -ubidi_writeReverse(const UChar *src, int32_t srcLength, - UChar *dest, int32_t destSize, +ubidi_writeReverse(const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode) { int32_t destLength; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } /* more error checking */ - if( src==NULL || srcLength<-1 || - destSize<0 || (destSize>0 && dest==NULL)) + if( src==nullptr || srcLength<-1 || + destSize<0 || (destSize>0 && dest==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } /* do input and output overlap? */ - if( dest!=NULL && + if( dest!=nullptr && ((src>=dest && src=src && desttext)==NULL || (length=pBiDi->length)<0 || - destSize<0 || (destSize>0 && dest==NULL)) + if( pBiDi==nullptr || + (text=pBiDi->text)==nullptr || (length=pBiDi->length)<0 || + destSize<0 || (destSize>0 && dest==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } /* do input and output overlap? */ - if( dest!=NULL && + if( dest!=nullptr && ((text>=dest && text=text && destoriginalLength))) { @@ -451,7 +451,7 @@ ubidi_writeReordered(UBiDi *pBiDi, dest, destSize, options, pErrorCode); } - if(dest!=NULL) { + if(dest!=nullptr) { dest+=runLength; } destSize-=runLength; @@ -459,8 +459,8 @@ ubidi_writeReordered(UBiDi *pBiDi, } else { /* insert BiDi controls for "inverse BiDi" */ const DirProp *dirProps=pBiDi->dirProps; - const UChar *src; - UChar uc; + const char16_t *src; + char16_t uc; UBiDiDirection dir; int32_t markFlag; @@ -495,7 +495,7 @@ ubidi_writeReordered(UBiDi *pBiDi, runLength=doWriteForward(src, runLength, dest, destSize, (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode); - if(dest!=NULL) { + if(dest!=nullptr) { dest+=runLength; } destSize-=runLength; @@ -539,7 +539,7 @@ ubidi_writeReordered(UBiDi *pBiDi, runLength=doWriteReverse(src, runLength, dest, destSize, options, pErrorCode); - if(dest!=NULL) { + if(dest!=nullptr) { dest+=runLength; } destSize-=runLength; @@ -578,7 +578,7 @@ ubidi_writeReordered(UBiDi *pBiDi, dest, destSize, options, pErrorCode); } - if(dest!=NULL) { + if(dest!=nullptr) { dest+=runLength; } destSize-=runLength; @@ -586,7 +586,7 @@ ubidi_writeReordered(UBiDi *pBiDi, } else { /* insert BiDi controls for "inverse BiDi" */ const DirProp *dirProps=pBiDi->dirProps; - const UChar *src; + const char16_t *src; UBiDiDirection dir; for(run=runCount; --run>=0;) { @@ -605,7 +605,7 @@ ubidi_writeReordered(UBiDi *pBiDi, runLength=doWriteReverse(src, runLength, dest, destSize, (uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode); - if(dest!=NULL) { + if(dest!=nullptr) { dest+=runLength; } destSize-=runLength; @@ -627,7 +627,7 @@ ubidi_writeReordered(UBiDi *pBiDi, runLength=doWriteForward(src, runLength, dest, destSize, options, pErrorCode); - if(dest!=NULL) { + if(dest!=nullptr) { dest+=runLength; } destSize-=runLength; diff --git a/src/duckdb/extension/icu/third_party/icu/common/ubrk.cpp b/src/duckdb/extension/icu/third_party/icu/common/ubrk.cpp deleted file mode 100644 index 936d48c50..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ubrk.cpp +++ /dev/null @@ -1,357 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************** -// * Copyright (C) 1996-2015, International Business Machines -// * Corporation and others. All Rights Reserved. -// ******************************************************************************** -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/ubrk.h" - -// #include "unicode/brkiter.h" -// #include "unicode/uloc.h" -// #include "unicode/ustring.h" -// #include "unicode/uchriter.h" -// #include "unicode/rbbi.h" -// #include "rbbirb.h" -// #include "uassert.h" -// #include "cmemory.h" - -// U_NAMESPACE_USE - -// //------------------------------------------------------------------------------ -// // -// // ubrk_open Create a canned type of break iterator based on type (word, line, etc.) -// // and locale. -// // -// //------------------------------------------------------------------------------ -// U_CAPI UBreakIterator* U_EXPORT2 -// ubrk_open(UBreakIteratorType type, -// const char *locale, -// const UChar *text, -// int32_t textLength, -// UErrorCode *status) -// { - -// if(U_FAILURE(*status)) return 0; - -// BreakIterator *result = 0; - -// switch(type) { - -// case UBRK_CHARACTER: -// result = BreakIterator::createCharacterInstance(Locale(locale), *status); -// break; - -// case UBRK_WORD: -// result = BreakIterator::createWordInstance(Locale(locale), *status); -// break; - -// case UBRK_LINE: -// result = BreakIterator::createLineInstance(Locale(locale), *status); -// break; - -// case UBRK_SENTENCE: -// result = BreakIterator::createSentenceInstance(Locale(locale), *status); -// break; - -// case UBRK_TITLE: -// result = BreakIterator::createTitleInstance(Locale(locale), *status); -// break; - -// default: -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// } - -// // check for allocation error -// if (U_FAILURE(*status)) { -// return 0; -// } -// if(result == 0) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return 0; -// } - - -// UBreakIterator *uBI = (UBreakIterator *)result; -// if (text != NULL) { -// ubrk_setText(uBI, text, textLength, status); -// } -// return uBI; -// } - - - -// //------------------------------------------------------------------------------ -// // -// // ubrk_openRules open a break iterator from a set of break rules. -// // Invokes the rule builder. -// // -// //------------------------------------------------------------------------------ -// U_CAPI UBreakIterator* U_EXPORT2 -// ubrk_openRules( const UChar *rules, -// int32_t rulesLength, -// const UChar *text, -// int32_t textLength, -// UParseError *parseErr, -// UErrorCode *status) { - -// if (status == NULL || U_FAILURE(*status)){ -// return 0; -// } - -// BreakIterator *result = 0; -// UnicodeString ruleString(rules, rulesLength); -// result = RBBIRuleBuilder::createRuleBasedBreakIterator(ruleString, parseErr, *status); -// if(U_FAILURE(*status)) { -// return 0; -// } - -// UBreakIterator *uBI = (UBreakIterator *)result; -// if (text != NULL) { -// ubrk_setText(uBI, text, textLength, status); -// } -// return uBI; -// } - - -// U_CAPI UBreakIterator* U_EXPORT2 -// ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, -// const UChar * text, int32_t textLength, -// UErrorCode * status) -// { -// if (U_FAILURE(*status)) { -// return NULL; -// } -// if (rulesLength < 0) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return NULL; -// } -// LocalPointer lpRBBI(new RuleBasedBreakIterator(binaryRules, rulesLength, *status), *status); -// if (U_FAILURE(*status)) { -// return NULL; -// } -// UBreakIterator *uBI = reinterpret_cast(lpRBBI.orphan()); -// if (text != NULL) { -// ubrk_setText(uBI, text, textLength, status); -// } -// return uBI; -// } - - -// U_CAPI UBreakIterator * U_EXPORT2 -// ubrk_safeClone( -// const UBreakIterator *bi, -// void * /*stackBuffer*/, -// int32_t *pBufferSize, -// UErrorCode *status) -// { -// if (status == NULL || U_FAILURE(*status)){ -// return NULL; -// } -// if (bi == NULL) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return NULL; -// } -// if (pBufferSize != NULL) { -// int32_t inputSize = *pBufferSize; -// *pBufferSize = 1; -// if (inputSize == 0) { -// return NULL; // preflighting for deprecated functionality -// } -// } -// BreakIterator *newBI = ((BreakIterator *)bi)->clone(); -// if (newBI == NULL) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// } else { -// *status = U_SAFECLONE_ALLOCATED_WARNING; -// } -// return (UBreakIterator *)newBI; -// } - - - -// U_CAPI void U_EXPORT2 -// ubrk_close(UBreakIterator *bi) -// { -// delete (BreakIterator *)bi; -// } - -// U_CAPI void U_EXPORT2 -// ubrk_setText(UBreakIterator* bi, -// const UChar* text, -// int32_t textLength, -// UErrorCode* status) -// { -// UText ut = UTEXT_INITIALIZER; -// utext_openUChars(&ut, text, textLength, status); -// ((BreakIterator*)bi)->setText(&ut, *status); -// // A stack allocated UText wrapping a UChar * string -// // can be dumped without explicitly closing it. -// } - - - -// U_CAPI void U_EXPORT2 -// ubrk_setUText(UBreakIterator *bi, -// UText *text, -// UErrorCode *status) -// { -// ((BreakIterator*)bi)->setText(text, *status); -// } - - - - - -// U_CAPI int32_t U_EXPORT2 -// ubrk_current(const UBreakIterator *bi) -// { - -// return ((BreakIterator*)bi)->current(); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_next(UBreakIterator *bi) -// { - -// return ((BreakIterator*)bi)->next(); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_previous(UBreakIterator *bi) -// { - -// return ((BreakIterator*)bi)->previous(); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_first(UBreakIterator *bi) -// { - -// return ((BreakIterator*)bi)->first(); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_last(UBreakIterator *bi) -// { - -// return ((BreakIterator*)bi)->last(); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_preceding(UBreakIterator *bi, -// int32_t offset) -// { - -// return ((BreakIterator*)bi)->preceding(offset); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_following(UBreakIterator *bi, -// int32_t offset) -// { - -// return ((BreakIterator*)bi)->following(offset); -// } - -// U_CAPI const char* U_EXPORT2 -// ubrk_getAvailable(int32_t index) -// { - -// return uloc_getAvailable(index); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_countAvailable() -// { - -// return uloc_countAvailable(); -// } - - -// U_CAPI UBool U_EXPORT2 -// ubrk_isBoundary(UBreakIterator *bi, int32_t offset) -// { -// return ((BreakIterator*)bi)->isBoundary(offset); -// } - - -// U_CAPI int32_t U_EXPORT2 -// ubrk_getRuleStatus(UBreakIterator *bi) -// { -// return ((BreakIterator*)bi)->getRuleStatus(); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status) -// { -// return ((BreakIterator*)bi)->getRuleStatusVec(fillInVec, capacity, *status); -// } - - -// U_CAPI const char* U_EXPORT2 -// ubrk_getLocaleByType(const UBreakIterator *bi, -// ULocDataLocaleType type, -// UErrorCode* status) -// { -// if (bi == NULL) { -// if (U_SUCCESS(*status)) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// } -// return NULL; -// } -// return ((BreakIterator*)bi)->getLocaleID(type, *status); -// } - - -// U_CAPI void U_EXPORT2 -// ubrk_refreshUText(UBreakIterator *bi, -// UText *text, -// UErrorCode *status) -// { -// BreakIterator *bii = reinterpret_cast(bi); -// bii->refreshInputText(text, *status); -// } - -// U_CAPI int32_t U_EXPORT2 -// ubrk_getBinaryRules(UBreakIterator *bi, -// uint8_t * binaryRules, int32_t rulesCapacity, -// UErrorCode * status) -// { -// if (U_FAILURE(*status)) { -// return 0; -// } -// if ((binaryRules == NULL && rulesCapacity > 0) || rulesCapacity < 0) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } -// RuleBasedBreakIterator* rbbi; -// if ((rbbi = dynamic_cast(reinterpret_cast(bi))) == NULL) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } -// uint32_t rulesLength; -// const uint8_t * returnedRules = rbbi->getBinaryRules(rulesLength); -// if (rulesLength > INT32_MAX) { -// *status = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } -// if (binaryRules != NULL) { // if not preflighting -// // Here we know rulesLength <= INT32_MAX and rulesCapacity >= 0, can cast safely -// if ((int32_t)rulesLength > rulesCapacity) { -// *status = U_BUFFER_OVERFLOW_ERROR; -// } else { -// uprv_memcpy(binaryRules, returnedRules, rulesLength); -// } -// } -// return (int32_t)rulesLength; -// } - - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucase.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucase.cpp index 511c647cc..4fd23fc93 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucase.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucase.cpp @@ -22,38 +22,25 @@ #include "unicode/utypes.h" #include "unicode/unistr.h" #include "unicode/uset.h" -#include "unicode/udata.h" /* UDataInfo */ #include "unicode/utf16.h" -#include "ucmndata.h" /* DataHeader */ -#include "udatamem.h" -#include "umutex.h" -#include "uassert.h" #include "cmemory.h" -#include "utrie2.h" +#include "uassert.h" #include "ucase.h" +#include "umutex.h" +#include "utrie2.h" -struct UCaseProps { - UDataMemory *mem; - const int32_t *indexes; - const uint16_t *exceptions; - const uint16_t *unfold; - - UTrie2 trie; - uint8_t formatVersion[4]; -}; - -/* ucase_props_data.h is machine-generated by gencase --csource */ +/* ucase_props_data.h is machine-generated by genprops/casepropsbuilder.cpp */ #define INCLUDED_FROM_UCASE_CPP #include "ucase_props_data.h" /* set of property starts for UnicodeSet ------------------------------------ */ static UBool U_CALLCONV -ucase_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 /*end*/, uint32_t /*value*/) { +_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 /*end*/, uint32_t /*value*/) { /* add the start code point to the USet */ const USetAdder *sa=(const USetAdder *)context; sa->add(sa->set, start); - return TRUE; + return true; } U_CFUNC void U_EXPORT2 @@ -63,7 +50,7 @@ ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) { } /* add the start code point of each same-value range of the trie */ - utrie2_enum(&ucase_props_singleton.trie, NULL, ucase_enumPropertyStartsRange, sa); + utrie2_enum(&ucase_props_singleton.trie, nullptr, _enumPropertyStartsRange, sa); /* add code points with hardcoded properties, plus the ones following them */ @@ -77,6 +64,13 @@ ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) { /* data access primitives --------------------------------------------------- */ +U_CAPI const struct UCaseProps * U_EXPORT2 +ucase_getSingleton(int32_t *pExceptionsLength, int32_t *pUnfoldLength) { + *pExceptionsLength = UPRV_LENGTHOF(ucase_props_exceptions); + *pUnfoldLength = UPRV_LENGTHOF(ucase_props_unfold); + return &ucase_props_singleton; +} + U_CFUNC const UTrie2 * U_EXPORT2 ucase_getTrie() { return &ucase_props_singleton.trie; @@ -201,47 +195,17 @@ ucase_totitle(UChar32 c) { return c; } -static const UChar iDot[2] = { 0x69, 0x307 }; -static const UChar jDot[2] = { 0x6a, 0x307 }; -static const UChar iOgonekDot[3] = { 0x12f, 0x307 }; -static const UChar iDotGrave[3] = { 0x69, 0x307, 0x300 }; -static const UChar iDotAcute[3] = { 0x69, 0x307, 0x301 }; -static const UChar iDotTilde[3] = { 0x69, 0x307, 0x303 }; +static const char16_t iDot[2] = { 0x69, 0x307 }; +static const char16_t jDot[2] = { 0x6a, 0x307 }; +static const char16_t iOgonekDot[3] = { 0x12f, 0x307 }; +static const char16_t iDotGrave[3] = { 0x69, 0x307, 0x300 }; +static const char16_t iDotAcute[3] = { 0x69, 0x307, 0x301 }; +static const char16_t iDotTilde[3] = { 0x69, 0x307, 0x303 }; U_CFUNC void U_EXPORT2 ucase_addCaseClosure(UChar32 c, const USetAdder *sa) { - uint16_t props; - - /* - * Hardcode the case closure of i and its relatives and ignore the - * data file data for these characters. - * The Turkic dotless i and dotted I with their case mapping conditions - * and case folding option make the related characters behave specially. - * This code matches their closure behavior to their case folding behavior. - */ - - switch(c) { - case 0x49: - /* regular i and I are in one equivalence class */ - sa->add(sa->set, 0x69); - return; - case 0x69: - sa->add(sa->set, 0x49); - return; - case 0x130: - /* dotted I is in a class with <0069 0307> (for canonical equivalence with <0049 0307>) */ - sa->addString(sa->set, iDot, 2); - return; - case 0x131: - /* dotless i is in a class by itself */ - return; - default: - /* otherwise use the data file data */ - break; - } - - props=UTRIE2_GET16(&ucase_props_singleton.trie, c); + uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c); if(!UCASE_HAS_EXCEPTION(props)) { if(UCASE_GET_TYPE(props)!=UCASE_NONE) { /* add the one simple case mapping, no matter what type it is */ @@ -255,19 +219,42 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) { * c has exceptions, so there may be multiple simple and/or * full case mappings. Add them all. */ - const uint16_t *pe0, *pe=GET_EXCEPTIONS(&ucase_props_singleton, props); - const UChar *closure; + const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props); uint16_t excWord=*pe++; - int32_t idx, closureLength, fullLength, length; - - pe0=pe; + const uint16_t *pe0=pe; + + // Hardcode the case closure of i and its relatives and ignore the + // data file data for these characters. + // The Turkic dotless i and dotted I with their case mapping conditions + // and case folding option make the related characters behave specially. + // This code matches their closure behavior to their case folding behavior. + if (excWord&UCASE_EXC_CONDITIONAL_FOLD) { + // These characters have Turkic case foldings. Hardcode their closure. + if (c == 0x49) { + // Regular i and I are in one equivalence class. + sa->add(sa->set, 0x69); + return; + } else if (c == 0x130) { + // Dotted I is in a class with <0069 0307> + // (for canonical equivalence with <0049 0307>). + sa->addString(sa->set, iDot, 2); + return; + } + } else if (c == 0x69) { + sa->add(sa->set, 0x49); + return; + } else if (c == 0x131) { + // Dotless i is in a class by itself. + return; + } /* add all simple case mappings */ - for(idx=UCASE_EXC_LOWER; idx<=UCASE_EXC_TITLE; ++idx) { + for(int32_t idx=UCASE_EXC_LOWER; idx<=UCASE_EXC_TITLE; ++idx) { if(HAS_SLOT(excWord, idx)) { pe=pe0; - GET_SLOT_VALUE(excWord, idx, pe, c); - sa->add(sa->set, c); + UChar32 mapping; + GET_SLOT_VALUE(excWord, idx, pe, mapping); + sa->add(sa->set, mapping); } } if(HAS_SLOT(excWord, UCASE_EXC_DELTA)) { @@ -278,19 +265,22 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) { } /* get the closure string pointer & length */ + const char16_t *closure; + int32_t closureLength; if(HAS_SLOT(excWord, UCASE_EXC_CLOSURE)) { pe=pe0; GET_SLOT_VALUE(excWord, UCASE_EXC_CLOSURE, pe, closureLength); closureLength&=UCASE_CLOSURE_MAX_LENGTH; /* higher bits are reserved */ - closure=(const UChar *)pe+1; /* behind this slot, unless there are full case mappings */ + closure=(const char16_t *)pe+1; /* behind this slot, unless there are full case mappings */ } else { closureLength=0; - closure=NULL; + closure=nullptr; } /* add the full case folding */ if(HAS_SLOT(excWord, UCASE_EXC_FULL_MAPPINGS)) { pe=pe0; + int32_t fullLength; GET_SLOT_VALUE(excWord, UCASE_EXC_FULL_MAPPINGS, pe, fullLength); /* start of full case mapping strings */ @@ -303,9 +293,9 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) { fullLength>>=4; /* add the full case folding string */ - length=fullLength&0xf; + int32_t length=fullLength&0xf; if(length!=0) { - sa->addString(sa->set, (const UChar *)pe, length); + sa->addString(sa->set, (const char16_t *)pe, length); pe+=length; } @@ -315,13 +305,113 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) { fullLength>>=4; pe+=fullLength; - closure=(const UChar *)pe; /* behind full case mappings */ + closure=(const char16_t *)pe; /* behind full case mappings */ } /* add each code point in the closure string */ - for(idx=0; idxadd(sa->set, c); + for(int32_t idx=0; idxadd(sa->set, mapping); + } + } +} + +U_CFUNC void U_EXPORT2 +ucase_addSimpleCaseClosure(UChar32 c, const USetAdder *sa) { + uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c); + if(!UCASE_HAS_EXCEPTION(props)) { + if(UCASE_GET_TYPE(props)!=UCASE_NONE) { + /* add the one simple case mapping, no matter what type it is */ + int32_t delta=UCASE_GET_DELTA(props); + if(delta!=0) { + sa->add(sa->set, c+delta); + } + } + } else { + // c has exceptions. Add the mappings relevant for scf=Simple_Case_Folding. + const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props); + uint16_t excWord=*pe++; + const uint16_t *pe0=pe; + + // Hardcode the case closure of i and its relatives and ignore the + // data file data for these characters, like in ucase_addCaseClosure(). + if (excWord&UCASE_EXC_CONDITIONAL_FOLD) { + // These characters have Turkic case foldings. Hardcode their closure. + if (c == 0x49) { + // Regular i and I are in one equivalence class. + sa->add(sa->set, 0x69); + return; + } else if (c == 0x130) { + // For scf=Simple_Case_Folding, dotted I is in a class by itself. + return; + } + } else if (c == 0x69) { + sa->add(sa->set, 0x49); + return; + } else if (c == 0x131) { + // Dotless i is in a class by itself. + return; + } + + // Add all simple case mappings. + for(int32_t idx=UCASE_EXC_LOWER; idx<=UCASE_EXC_TITLE; ++idx) { + if(HAS_SLOT(excWord, idx)) { + pe=pe0; + UChar32 mapping; + GET_SLOT_VALUE(excWord, idx, pe, mapping); + sa->add(sa->set, mapping); + } + } + if(HAS_SLOT(excWord, UCASE_EXC_DELTA)) { + pe=pe0; + int32_t delta; + GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta); + UChar32 mapping = (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta; + sa->add(sa->set, mapping); + } + + /* get the closure string pointer & length */ + const char16_t *closure; + int32_t closureLength; + if(HAS_SLOT(excWord, UCASE_EXC_CLOSURE)) { + pe=pe0; + GET_SLOT_VALUE(excWord, UCASE_EXC_CLOSURE, pe, closureLength); + closureLength&=UCASE_CLOSURE_MAX_LENGTH; /* higher bits are reserved */ + closure=(const char16_t *)pe+1; /* behind this slot, unless there are full case mappings */ + } else { + closureLength=0; + closure=nullptr; + } + + // Skip the full case mappings. + if(closureLength > 0 && HAS_SLOT(excWord, UCASE_EXC_FULL_MAPPINGS)) { + pe=pe0; + int32_t fullLength; + GET_SLOT_VALUE(excWord, UCASE_EXC_FULL_MAPPINGS, pe, fullLength); + + /* start of full case mapping strings */ + ++pe; + + fullLength&=0xffff; /* bits 16 and higher are reserved */ + + // Skip all 4 full case mappings. + pe+=fullLength&UCASE_FULL_LOWER; + fullLength>>=4; + pe+=fullLength&0xf; + fullLength>>=4; + pe+=fullLength&0xf; + fullLength>>=4; + pe+=fullLength; + + closure=(const char16_t *)pe; /* behind full case mappings */ + } + + // Add each code point in the closure string whose scf maps back to c. + for(int32_t idx=0; idxadd(sa->set, mapping); } } } @@ -331,7 +421,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) { * must be length>0 and max>0 and length<=max */ static inline int32_t -strcmpMax(const UChar *s, int32_t length, const UChar *t, int32_t max) { +strcmpMax(const char16_t *s, int32_t length, const char16_t *t, int32_t max) { int32_t c1, c2; max-=length; /* we require length<=max, so no need to decrement max in the loop */ @@ -351,16 +441,16 @@ strcmpMax(const UChar *s, int32_t length, const UChar *t, int32_t max) { if(max==0 || *t==0) { return 0; /* equal to length of both strings */ } else { - return -max; /* return lengh difference */ + return -max; /* return length difference */ } } U_CFUNC UBool U_EXPORT2 -ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) { +ucase_addStringCaseClosure(const char16_t *s, int32_t length, const USetAdder *sa) { int32_t i, start, limit, result, unfoldRows, unfoldRowWidth, unfoldStringWidth; - if(ucase_props_singleton.unfold==NULL || s==NULL) { - return FALSE; /* no reverse case folding data, or no string */ + if(ucase_props_singleton.unfold==nullptr || s==nullptr) { + return false; /* no reverse case folding data, or no string */ } if(length<=1) { /* the string is too short to find any match */ @@ -370,7 +460,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) * but this does not make much practical difference because * a single supplementary code point would just not be found */ - return FALSE; + return false; } const uint16_t *unfold=ucase_props_singleton.unfold; @@ -381,7 +471,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) if(length>unfoldStringWidth) { /* the string is too long to find any match */ - return FALSE; + return false; } /* do a binary search for the string */ @@ -389,7 +479,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) limit=unfoldRows; while(start(unfold+(i*unfoldRowWidth)); + const char16_t *p=reinterpret_cast(unfold+(i*unfoldRowWidth)); result=strcmpMax(s, length, p, unfoldStringWidth); if(result==0) { @@ -401,7 +491,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) sa->add(sa->set, c); ucase_addCaseClosure(c, sa); } - return TRUE; + return true; } else if(result<0) { limit=i; } else /* result>0 */ { @@ -409,13 +499,13 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) } } - return FALSE; /* string not found */ + return false; /* string not found */ } U_NAMESPACE_BEGIN FullCaseFoldingIterator::FullCaseFoldingIterator() - : unfold(reinterpret_cast(ucase_props_singleton.unfold)), + : unfold(reinterpret_cast(ucase_props_singleton.unfold)), unfoldRows(unfold[UCASE_UNFOLD_ROWS]), unfoldRowWidth(unfold[UCASE_UNFOLD_ROW_WIDTH]), unfoldStringWidth(unfold[UCASE_UNFOLD_STRING_WIDTH]), @@ -427,7 +517,7 @@ FullCaseFoldingIterator::FullCaseFoldingIterator() UChar32 FullCaseFoldingIterator::next(UnicodeString &full) { // Advance past the last-delivered code point. - const UChar *p=unfold+(currentRow*unfoldRowWidth); + const char16_t *p=unfold+(currentRow*unfoldRowWidth); if(rowCpIndex>=unfoldRowWidth || p[rowCpIndex]==0) { ++currentRow; p+=unfoldRowWidth; @@ -437,7 +527,7 @@ FullCaseFoldingIterator::next(UnicodeString &full) { // Set "full" to the NUL-terminated string in the first unfold column. int32_t length=unfoldStringWidth; while(length>0 && p[length-1]==0) { --length; } - full.setTo(FALSE, p, length); + full.setTo(false, p, length); // Return the code point. UChar32 c; U16_NEXT_UNSAFE(p, rowCpIndex, c); @@ -681,7 +771,7 @@ ucase_isCaseSensitive(UChar32 c) { * - In [CoreProps], C has one of the properties Uppercase, or Lowercase * - Given D = NFD(C), then it is not the case that: * D = UCD_lower(D) = UCD_upper(D) = UCD_title(D) - * (This third criterium does not add any characters to the list + * (This third criterion does not add any characters to the list * for Unicode 3.2. Ignored.) * * D2. A character C is defined to be case-ignorable @@ -707,13 +797,14 @@ ucase_isCaseSensitive(UChar32 c) { #define is_r(c) ((c)=='r' || (c)=='R') #define is_t(c) ((c)=='t' || (c)=='T') #define is_u(c) ((c)=='u' || (c)=='U') +#define is_y(c) ((c)=='y' || (c)=='Y') #define is_z(c) ((c)=='z' || (c)=='Z') /* separator? */ #define is_sep(c) ((c)=='_' || (c)=='-' || (c)==0) /** - * Requires non-NULL locale ID but otherwise does the equivalent of + * Requires non-nullptr locale ID but otherwise does the equivalent of * checking for language codes as if uloc_getLanguage() were called: * Accepts both 2- and 3-letter codes and accepts case variants. */ @@ -726,7 +817,7 @@ ucase_getCaseLocale(const char *locale) { * examined and copied/transformed. * * Because this code does not want to depend on uloc, the caller must - * pass in a non-NULL locale, i.e., may need to call uloc_getDefault(). + * pass in a non-nullptr locale, i.e., may need to call uloc_getDefault(). */ char c=*locale++; // Fastpath for English "en" which is often used for default (=root locale) case mappings, @@ -804,6 +895,18 @@ ucase_getCaseLocale(const char *locale) { return UCASE_LOC_DUTCH; } } + } else if(c=='h') { + /* hy or hye? *not* hyw */ + c=*locale++; + if(is_y(c)) { + c=*locale++; + if(is_e(c)) { + c=*locale; + } + if(is_sep(c)) { + return UCASE_LOC_ARMENIAN; + } + } } } else { // uppercase c @@ -868,6 +971,18 @@ ucase_getCaseLocale(const char *locale) { return UCASE_LOC_DUTCH; } } + } else if(c=='H') { + /* hy or hye? *not* hyw */ + c=*locale++; + if(is_y(c)) { + c=*locale++; + if(is_e(c)) { + c=*locale; + } + if(is_sep(c)) { + return UCASE_LOC_ARMENIAN; + } + } } } return UCASE_LOC_ROOT; @@ -885,8 +1000,8 @@ static UBool isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) { UChar32 c; - if(iter==NULL) { - return FALSE; + if(iter==nullptr) { + return false; } for(/* dir!=0 sets direction */; (c=iter(context, dir))>=0; dir=0) { @@ -894,13 +1009,13 @@ isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) { if(type&4) { /* case-ignorable, continue with the loop */ } else if(type!=UCASE_NONE) { - return TRUE; /* followed by cased letter */ + return true; /* followed by cased letter */ } else { - return FALSE; /* uncased and not case-ignorable */ + return false; /* uncased and not case-ignorable */ } } - return FALSE; /* not followed by cased letter */ + return false; /* not followed by cased letter */ } /* Is preceded by Soft_Dotted character with no intervening cc=230 ? */ @@ -910,20 +1025,20 @@ isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) { int32_t dotType; int8_t dir; - if(iter==NULL) { - return FALSE; + if(iter==nullptr) { + return false; } for(dir=-1; (c=iter(context, dir))>=0; dir=0) { dotType=getDotType(c); if(dotType==UCASE_SOFT_DOTTED) { - return TRUE; /* preceded by TYPE_i */ + return true; /* preceded by TYPE_i */ } else if(dotType!=UCASE_OTHER_ACCENT) { - return FALSE; /* preceded by different base character (not TYPE_i), or intervening cc==230 */ + return false; /* preceded by different base character (not TYPE_i), or intervening cc==230 */ } } - return FALSE; /* not preceded by TYPE_i */ + return false; /* not preceded by TYPE_i */ } /* @@ -967,21 +1082,21 @@ isPrecededBy_I(UCaseContextIterator *iter, void *context) { int32_t dotType; int8_t dir; - if(iter==NULL) { - return FALSE; + if(iter==nullptr) { + return false; } for(dir=-1; (c=iter(context, dir))>=0; dir=0) { if(c==0x49) { - return TRUE; /* preceded by I */ + return true; /* preceded by I */ } dotType=getDotType(c); if(dotType!=UCASE_OTHER_ACCENT) { - return FALSE; /* preceded by different base character (not I), or intervening cc==230 */ + return false; /* preceded by different base character (not I), or intervening cc==230 */ } } - return FALSE; /* not preceded by I */ + return false; /* not preceded by I */ } /* Is followed by one or more cc==230 ? */ @@ -991,20 +1106,20 @@ isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) { int32_t dotType; int8_t dir; - if(iter==NULL) { - return FALSE; + if(iter==nullptr) { + return false; } for(dir=1; (c=iter(context, dir))>=0; dir=0) { dotType=getDotType(c); if(dotType==UCASE_ABOVE) { - return TRUE; /* at least one cc==230 following */ + return true; /* at least one cc==230 following */ } else if(dotType!=UCASE_OTHER_ACCENT) { - return FALSE; /* next base character, no more cc==230 following */ + return false; /* next base character, no more cc==230 following */ } } - return FALSE; /* no more cc==230 following */ + return false; /* no more cc==230 following */ } /* Is followed by a dot above (without cc==230 in between) ? */ @@ -1014,31 +1129,33 @@ isFollowedByDotAbove(UCaseContextIterator *iter, void *context) { int32_t dotType; int8_t dir; - if(iter==NULL) { - return FALSE; + if(iter==nullptr) { + return false; } for(dir=1; (c=iter(context, dir))>=0; dir=0) { if(c==0x307) { - return TRUE; + return true; } dotType=getDotType(c); if(dotType!=UCASE_OTHER_ACCENT) { - return FALSE; /* next base character or cc==230 in between */ + return false; /* next base character or cc==230 in between */ } } - return FALSE; /* no dot above following */ + return false; /* no dot above following */ } U_CAPI int32_t U_EXPORT2 ucase_toFullLower(UChar32 c, UCaseContextIterator *iter, void *context, - const UChar **pString, + const char16_t **pString, int32_t loc) { // The sign of the result has meaning, input must be non-negative so that it can be returned as is. U_ASSERT(c >= 0); UChar32 result=c; + // Reset the output pointer in case it was uninitialized. + *pString=nullptr; uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c); if(!UCASE_HAS_EXCEPTION(props)) { if(UCASE_IS_UPPER_OR_TITLE(props)) { @@ -1123,7 +1240,6 @@ ucase_toFullLower(UChar32 c, 0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE 0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE */ - *pString=nullptr; return 0; /* remove the dot (continue without output) */ } else if(loc==UCASE_LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(iter, context)) { /* @@ -1160,7 +1276,7 @@ ucase_toFullLower(UChar32 c, full&=UCASE_FULL_LOWER; if(full!=0) { /* set the output pointer to the lowercase mapping */ - *pString=reinterpret_cast(pe+1); + *pString=reinterpret_cast(pe+1); /* return the string length */ return full; @@ -1184,12 +1300,14 @@ ucase_toFullLower(UChar32 c, static int32_t toUpperOrTitle(UChar32 c, UCaseContextIterator *iter, void *context, - const UChar **pString, + const char16_t **pString, int32_t loc, UBool upperNotTitle) { // The sign of the result has meaning, input must be non-negative so that it can be returned as is. U_ASSERT(c >= 0); UChar32 result=c; + // Reset the output pointer in case it was uninitialized. + *pString=nullptr; uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c); if(!UCASE_HAS_EXCEPTION(props)) { if(UCASE_GET_TYPE(props)==UCASE_LOWER) { @@ -1227,8 +1345,18 @@ toUpperOrTitle(UChar32 c, 0307; 0307; ; ; lt After_Soft_Dotted; # COMBINING DOT ABOVE */ - *pString=nullptr; return 0; /* remove the dot (continue without output) */ + } else if(c==0x0587) { + // See ICU-13416: + // և ligature ech-yiwn + // uppercases to ԵՒ=ech+yiwn by default and in Western Armenian, + // but to ԵՎ=ech+vew in Eastern Armenian. + if(loc==UCASE_LOC_ARMENIAN) { + *pString=upperNotTitle ? u"ԵՎ" : u"Եվ"; + } else { + *pString=upperNotTitle ? u"ԵՒ" : u"Եւ"; + } + return 2; } else { /* no known conditional special case mapping, use a normal mapping */ } @@ -1254,7 +1382,7 @@ toUpperOrTitle(UChar32 c, if(full!=0) { /* set the output pointer to the result string */ - *pString=reinterpret_cast(pe); + *pString=reinterpret_cast(pe); /* return the string length */ return full; @@ -1283,17 +1411,17 @@ toUpperOrTitle(UChar32 c, U_CAPI int32_t U_EXPORT2 ucase_toFullUpper(UChar32 c, UCaseContextIterator *iter, void *context, - const UChar **pString, + const char16_t **pString, int32_t caseLocale) { - return toUpperOrTitle(c, iter, context, pString, caseLocale, TRUE); + return toUpperOrTitle(c, iter, context, pString, caseLocale, true); } U_CAPI int32_t U_EXPORT2 ucase_toFullTitle(UChar32 c, UCaseContextIterator *iter, void *context, - const UChar **pString, + const char16_t **pString, int32_t caseLocale) { - return toUpperOrTitle(c, iter, context, pString, caseLocale, FALSE); + return toUpperOrTitle(c, iter, context, pString, caseLocale, false); } /* case folding ------------------------------------------------------------- */ @@ -1408,11 +1536,13 @@ ucase_fold(UChar32 c, uint32_t options) { U_CAPI int32_t U_EXPORT2 ucase_toFullFolding(UChar32 c, - const UChar **pString, + const char16_t **pString, uint32_t options) { // The sign of the result has meaning, input must be non-negative so that it can be returned as is. U_ASSERT(c >= 0); UChar32 result=c; + // Reset the output pointer in case it was uninitialized. + *pString=nullptr; uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c); if(!UCASE_HAS_EXCEPTION(props)) { if(UCASE_IS_UPPER_OR_TITLE(props)) { @@ -1459,7 +1589,7 @@ ucase_toFullFolding(UChar32 c, if(full!=0) { /* set the output pointer to the result string */ - *pString=reinterpret_cast(pe); + *pString=reinterpret_cast(pe); /* return the string length */ return full; @@ -1528,7 +1658,7 @@ u_foldCase(UChar32 c, uint32_t options) { U_CFUNC int32_t U_EXPORT2 ucase_hasBinaryProperty(UChar32 c, UProperty which) { /* case mapping properties */ - const UChar *resultString; + const char16_t *resultString; switch(which) { case UCHAR_LOWERCASE: return (UBool)(UCASE_LOWER==ucase_getType(c)); @@ -1555,18 +1685,18 @@ ucase_hasBinaryProperty(UChar32 c, UProperty which) { * start sets for normalization and case mappings. */ case UCHAR_CHANGES_WHEN_LOWERCASED: - return (UBool)(ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0); + return (UBool)(ucase_toFullLower(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0); case UCHAR_CHANGES_WHEN_UPPERCASED: - return (UBool)(ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0); + return (UBool)(ucase_toFullUpper(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0); case UCHAR_CHANGES_WHEN_TITLECASED: - return (UBool)(ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0); + return (UBool)(ucase_toFullTitle(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0); /* case UCHAR_CHANGES_WHEN_CASEFOLDED: -- in uprops.c */ case UCHAR_CHANGES_WHEN_CASEMAPPED: return (UBool)( - ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 || - ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 || - ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0); + ucase_toFullLower(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0 || + ucase_toFullUpper(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0 || + ucase_toFullTitle(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0); default: - return FALSE; + return false; } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucase.h b/src/duckdb/extension/icu/third_party/icu/common/ucase.h index b0a453b87..e03b31187 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucase.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucase.h @@ -56,7 +56,8 @@ enum { UCASE_LOC_TURKISH, UCASE_LOC_LITHUANIAN, UCASE_LOC_GREEK, - UCASE_LOC_DUTCH + UCASE_LOC_DUTCH, + UCASE_LOC_ARMENIAN }; /** @@ -107,6 +108,10 @@ ucase_fold(UChar32 c, uint32_t options); U_CFUNC void U_EXPORT2 ucase_addCaseClosure(UChar32 c, const USetAdder *sa); +/** Case closure with only scf=Simple_Case_Folding. */ +U_CFUNC void U_EXPORT2 +ucase_addSimpleCaseClosure(UChar32 c, const USetAdder *sa); + /** * Maps the string to single code points and adds the associated case closure * mappings. @@ -117,7 +122,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa); * the string itself is added as well as part of its code points' closure. * It must be length>=0. * - * @return TRUE if the string was found + * @return true if the string was found */ U_CFUNC UBool U_EXPORT2 ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa); @@ -138,10 +143,10 @@ class U_COMMON_API FullCaseFoldingIterator { */ UChar32 next(UnicodeString &full); private: - FullCaseFoldingIterator(const FullCaseFoldingIterator &); // no copy - FullCaseFoldingIterator &operator=(const FullCaseFoldingIterator &); // no assignment + FullCaseFoldingIterator(const FullCaseFoldingIterator &) = delete; // no copy + FullCaseFoldingIterator &operator=(const FullCaseFoldingIterator &) = delete; // no assignment - const UChar *unfold; + const char16_t *unfold; int32_t unfoldRows; int32_t unfoldRowWidth; int32_t unfoldStringWidth; @@ -158,9 +163,9 @@ class U_COMMON_API FullCaseFoldingIterator { namespace LatinCase { /** Case mapping/folding data for code points up to U+017F. */ -constexpr UChar LIMIT = 0x180; +constexpr char16_t LIMIT = 0x180; /** U+017F case-folds and uppercases crossing the ASCII boundary. */ -constexpr UChar LONG_S = 0x17f; +constexpr char16_t LONG_S = 0x17f; /** Exception: Complex mapping, or too-large delta. */ constexpr int8_t EXC = -0x80; @@ -311,6 +316,21 @@ UCaseMapFull(UChar32 c, U_CDECL_END +/* for icuexportdata -------------------------------------------------------- */ + +struct UCaseProps { + void *mem; // TODO: was unused, and type UDataMemory -- remove + const int32_t *indexes; + const uint16_t *exceptions; + const uint16_t *unfold; + + UTrie2 trie; + uint8_t formatVersion[4]; +}; + +U_CAPI const struct UCaseProps * U_EXPORT2 +ucase_getSingleton(int32_t *pExceptionsLength, int32_t *pUnfoldLength); + /* file definitions --------------------------------------------------------- */ #define UCASE_DATA_NAME "ucase" diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucase_props_data.h b/src/duckdb/extension/icu/third_party/icu/common/ucase_props_data.h index fe0ed0e57..92b59520c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucase_props_data.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucase_props_data.h @@ -1,6 +1,5 @@ -// © 2016 and later: Unicode, Inc. and others. +// Copyright (C) 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -// // Copyright (C) 1999-2016, International Business Machines // Corporation and others. All Rights Reserved. // @@ -8,148 +7,147 @@ // // machine-generated by: icu/tools/unicode/c/genprops/casepropsbuilder.cpp - #ifdef INCLUDED_FROM_UCASE_CPP -// static const UVersionInfo ucase_props_dataVersion={0xd,0,0,0}; +static const UVersionInfo ucase_props_dataVersion={0xf,1,0,0}; -static const int32_t ucase_props_indexes[UCASE_IX_TOP]={0x10,0x70ca,0x6098,0x687,0x172,0,0,0,0,0,0,0,0,0,0,3}; +static const int32_t ucase_props_indexes[UCASE_IX_TOP]={0x10,0x76ec,0x66c8,0x680,0x172,0,0,0,0,0,0,0,0,0,0,3}; -static const uint16_t ucase_props_trieIndex[12356]={ -0x336,0x33e,0x346,0x34e,0x35c,0x364,0x36c,0x374,0x37c,0x384,0x38b,0x393,0x39b,0x3a3,0x3ab,0x3b3, -0x3b9,0x3c1,0x3c9,0x3d1,0x3d9,0x3e1,0x3e9,0x3f1,0x3f9,0x401,0x409,0x411,0x419,0x421,0x429,0x431, -0x439,0x441,0x449,0x451,0x459,0x461,0x469,0x471,0x46d,0x475,0x47a,0x482,0x489,0x491,0x499,0x4a1, -0x4a9,0x4b1,0x4b9,0x4c1,0x355,0x35d,0x4c6,0x4ce,0x4d3,0x4db,0x4e3,0x4eb,0x4ea,0x4f2,0x4f7,0x4ff, -0x507,0x50e,0x512,0x355,0x355,0x355,0x519,0x521,0x529,0x52b,0x533,0x53b,0x53f,0x540,0x548,0x550, -0x558,0x540,0x560,0x565,0x558,0x540,0x56d,0x575,0x53f,0x57d,0x585,0x58d,0x595,0x355,0x59d,0x355, -0x5a5,0x4ec,0x5ad,0x58d,0x53f,0x57d,0x5b4,0x58d,0x5bc,0x5be,0x548,0x58d,0x53f,0x355,0x5c6,0x355, -0x355,0x5cc,0x5d3,0x355,0x355,0x5d7,0x5df,0x355,0x5e3,0x5ea,0x355,0x5f1,0x5f9,0x600,0x608,0x355, -0x355,0x60d,0x615,0x61d,0x625,0x62d,0x634,0x63c,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x644,0x355,0x355,0x654,0x654,0x64c, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x65c,0x65c,0x54c,0x54c,0x355,0x662,0x66a,0x355, -0x672,0x355,0x67a,0x355,0x681,0x687,0x355,0x355,0x355,0x68f,0x355,0x355,0x355,0x355,0x355,0x355, -0x696,0x355,0x69d,0x6a5,0x355,0x6ad,0x6b5,0x355,0x57c,0x6b8,0x6c0,0x6c6,0x5bc,0x6ce,0x355,0x6d5, -0x355,0x6da,0x355,0x6e0,0x6e8,0x6ec,0x6f4,0x6fc,0x704,0x709,0x70c,0x714,0x724,0x71c,0x734,0x72c, -0x37c,0x73c,0x37c,0x744,0x747,0x37c,0x74f,0x37c,0x757,0x75f,0x767,0x76f,0x777,0x77f,0x787,0x78f, -0x797,0x79e,0x355,0x7a6,0x7ae,0x355,0x7b6,0x7be,0x7c6,0x7ce,0x7d6,0x7de,0x7e6,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x7e9,0x7ef,0x7f5,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x7fd,0x802,0x806,0x80e,0x37c,0x37c,0x37c,0x816,0x81e,0x825,0x355,0x82a,0x355,0x355,0x355,0x832, -0x355,0x677,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x53e,0x83a,0x355,0x355,0x841,0x355,0x355,0x849,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x851,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x6e0,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x857,0x355,0x85f,0x864,0x86c,0x355,0x355,0x874,0x87c,0x884,0x37c,0x889,0x891,0x897,0x89f,0x8a2, -0x8aa,0x8b1,0x355,0x355,0x355,0x355,0x8b8,0x8c0,0x355,0x8c8,0x8cf,0x355,0x529,0x8d4,0x8dc,0x681, -0x355,0x8e2,0x8ea,0x8ee,0x355,0x8f6,0x8fe,0x906,0x355,0x90c,0x910,0x918,0x928,0x920,0x355,0x930, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x938,0x355,0x355,0x355,0x355,0x940,0x5bc,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x945,0x94d,0x951,0x355,0x355,0x355,0x355,0x338,0x33e,0x959,0x961,0x968,0x4ec,0x355,0x355,0x970, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0xd58,0xd58,0xd70,0xdb0,0xdf0,0xe2c,0xe6c,0xeac,0xee4,0xf24,0xf64,0xfa4,0xfe4,0x1024,0x1064,0x10a4, -0x10e4,0x1124,0x1164,0x11a4,0x11b4,0x11e8,0x1224,0x1264,0x12a4,0x12e4,0xd54,0x1318,0x134c,0x138c,0x13a8,0x13dc, -0x9e1,0xa11,0xa51,0xa90,0x188,0x188,0xac8,0x188,0x188,0x188,0x188,0x188,0x188,0xaf1,0x188,0x188, -0x188,0x188,0x188,0x188,0x188,0x188,0x188,0xb31,0x188,0x188,0xb66,0xba5,0xbe5,0xc1f,0xc56,0x188, +static const uint16_t ucase_props_trieIndex[13148]={ +0x355,0x35d,0x365,0x36d,0x37b,0x383,0x38b,0x393,0x39b,0x3a3,0x3aa,0x3b2,0x3ba,0x3c2,0x3ca,0x3d2, +0x3d8,0x3e0,0x3e8,0x3f0,0x3f8,0x400,0x408,0x410,0x418,0x420,0x428,0x430,0x438,0x440,0x448,0x450, +0x458,0x460,0x468,0x470,0x478,0x480,0x488,0x490,0x48c,0x494,0x499,0x4a1,0x4a8,0x4b0,0x4b8,0x4c0, +0x4c8,0x4d0,0x4d8,0x4e0,0x374,0x37c,0x4e5,0x4ed,0x4f2,0x4fa,0x502,0x50a,0x509,0x511,0x516,0x51e, +0x526,0x52d,0x531,0x374,0x538,0x355,0x548,0x540,0x550,0x552,0x55a,0x562,0x566,0x567,0x56f,0x577, +0x57f,0x567,0x587,0x58c,0x57f,0x567,0x594,0x59c,0x566,0x5a4,0x5ac,0x5b4,0x5bc,0x374,0x5c4,0x374, +0x5cc,0x5ce,0x5d6,0x5b4,0x566,0x5a4,0x5dd,0x5b4,0x5e5,0x5e7,0x56f,0x5b4,0x566,0x374,0x5ef,0x374, +0x374,0x5f5,0x5fc,0x374,0x374,0x600,0x608,0x374,0x60c,0x613,0x374,0x61a,0x622,0x629,0x631,0x374, +0x374,0x636,0x63e,0x646,0x64e,0x656,0x65d,0x665,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x66d,0x374,0x374,0x67d,0x67d,0x675, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x685,0x68b,0x573,0x573,0x374,0x691,0x699,0x374, +0x6a1,0x374,0x6a9,0x374,0x6b0,0x6b6,0x374,0x374,0x374,0x6be,0x374,0x374,0x374,0x374,0x374,0x374, +0x6c5,0x374,0x6cc,0x6d4,0x374,0x6dc,0x6e4,0x374,0x5a3,0x6e8,0x6f0,0x6f6,0x5e5,0x6fe,0x374,0x705, +0x374,0x70a,0x374,0x710,0x718,0x71c,0x724,0x72c,0x734,0x739,0x73c,0x744,0x754,0x74c,0x764,0x75c, +0x39b,0x76c,0x39b,0x774,0x777,0x39b,0x77f,0x39b,0x787,0x78f,0x797,0x79f,0x7a7,0x7af,0x7b7,0x7bf, +0x7c7,0x7ce,0x374,0x7d6,0x7de,0x374,0x7e6,0x7ee,0x7f6,0x7fe,0x806,0x80e,0x816,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x819,0x81f,0x825,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x82d,0x831,0x835,0x83d,0x39b,0x39b,0x39b,0x845,0x84d,0x854,0x374,0x859,0x374,0x374,0x374,0x861, +0x374,0x6a6,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x565,0x869,0x374,0x374,0x870,0x374,0x374,0x878,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x880,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x710,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x886,0x374,0x88e,0x893,0x89b,0x374,0x374,0x8a3,0x8ab,0x8b3,0x39b,0x8b8,0x8c0,0x8c6,0x8cd,0x8d4, +0x8dc,0x8e3,0x374,0x374,0x374,0x374,0x8ea,0x8f2,0x374,0x8fa,0x901,0x374,0x550,0x906,0x90e,0x6b0, +0x374,0x914,0x91c,0x920,0x374,0x928,0x930,0x938,0x374,0x93e,0x942,0x94a,0x95a,0x952,0x374,0x962, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x96a,0x374,0x374,0x374,0x374,0x972,0x550,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x977,0x97f,0x983,0x374,0x374,0x374,0x374,0x357,0x35d,0x98b,0x993,0x99a,0x50b,0x374,0x374,0x9a2, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0xdd4,0xdd4,0xdec,0xe2c,0xe6c,0xea8,0xee8,0xf28,0xf60,0xfa0,0xfe0,0x1020,0x1060,0x10a0,0x10e0,0x1120, +0x1160,0x11a0,0x11e0,0x1220,0x1230,0x1264,0x12a0,0x12e0,0x1320,0x1360,0xdd0,0x1394,0x13c8,0x1408,0x1424,0x1458, +0x9e1,0xa1f,0xa5f,0xa9e,0x188,0x188,0xad9,0x188,0x188,0x188,0x188,0x188,0x188,0xb02,0x188,0x188, +0x188,0x188,0x188,0x188,0x188,0xb42,0x188,0xb82,0x188,0xba8,0xbe3,0xc22,0xc62,0xc9c,0xcd3,0x188, 0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188, 0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188, 0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188, @@ -174,278 +172,290 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188, 0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188, 0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188,0x188, -0xc96,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x977,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x6b5,0x355,0x355,0x355,0x97f,0x355,0x355,0x355, -0x355,0x987,0x98d,0x991,0x355,0x355,0x995,0x999,0x99f,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x9a7,0x9ab,0x355,0x355,0x355,0x355,0x355,0x9b3,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x9bb,0x9bf,0x9c7,0x9cb,0x355,0x9d2,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x9d8,0x355,0x355,0x355,0x355,0x9df,0x355,0x355,0x355,0x355, -0x355,0x53f,0x9e4,0x9eb,0x5bd,0x5bc,0x9ef,0x53c,0x355,0x9f7,0x9fe,0x355,0xa04,0x5bc,0xa09,0xa11, -0x355,0x355,0xa16,0x355,0x355,0x355,0x355,0x338,0xa1e,0x5bc,0x5be,0xa26,0xa2d,0x355,0x355,0x355, -0x355,0x355,0x9e4,0xa35,0x355,0x355,0xa3d,0xa45,0x355,0x355,0x355,0x355,0x355,0x355,0xa49,0xa51, -0x355,0x355,0xa59,0x4b0,0x355,0x355,0xa61,0x355,0x355,0xa67,0xa6f,0x355,0x355,0x355,0x355,0x355, -0x355,0xa74,0x355,0x355,0x355,0xa7c,0xa84,0x355,0x355,0xa8c,0xa94,0x355,0x355,0x355,0xa97,0x6b5, -0xa9f,0xaa3,0xaab,0x355,0xab2,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0xab9,0x355,0x355,0x940,0xac1,0x355,0x355,0x355,0xac7,0xacf,0x355,0xad3,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xad9,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xadf,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xae6,0x355,0xaec,0x57c,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0xa7c,0xa84,0x355,0x355,0x355,0x355,0x355,0x355,0x677,0x355,0xaf2,0x355,0x355, -0xafa,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0xaff,0x57c,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0xb07,0xb0f,0xb15,0x355,0x355,0x355,0x355,0xb1d,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0xb25,0xb2d,0xb32,0xb38,0xb40,0xb48,0xb50,0xb29,0xb58,0xb60, -0xb68,0xb6f,0xb2a,0xb25,0xb2d,0xb28,0xb38,0xb2b,0xb26,0xb77,0xb29,0xb7f,0xb87,0xb8f,0xb96,0xb82, -0xb8a,0xb92,0xb99,0xb85,0xba1,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x87c,0xba9,0x87c,0xbb0,0xbb7,0xbbf,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0xbc7,0xbcf,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xbd3,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x9d0,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0xbdb,0x355,0xbe3,0xbeb,0xbf2,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0xb21, -0xbfa,0xbfa,0xc00,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x9f9,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x53f,0x87c,0x87c,0x87c,0x355,0x355,0x355,0x355,0x87c,0x87c, -0x87c,0x87c,0x87c,0x87c,0x87c,0xc08,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355,0x355, -0x355,0x355,0x355,0x355,0x355,0x355,0x335,0x335,0,0,0,0,0,0,0,0, +0xd13,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x9a9,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x9b1,0x374,0x374,0x374,0x9b4,0x374,0x374,0x374, +0x374,0x9bc,0x9c2,0x9c6,0x374,0x374,0x9ca,0x9ce,0x9d4,0x374,0x374,0x374,0x9db,0x9df,0x9e7,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x9f7,0x9ef,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x9ff, +0xa03,0x374,0x374,0x374,0x374,0x374,0xa0b,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0xa13,0xa17,0xa1f,0xa23,0x374,0xa2a,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0xa30,0x374,0xa34,0x374,0x374,0xa3c,0x374,0xa44,0x374,0x374,0x374,0x566, +0xa46,0xa4d,0xa51,0x5e5,0xa59,0xa61,0x374,0xa69,0xa70,0x374,0xa76,0x5e5,0xa7b,0xa83,0x374,0x374, +0xa88,0x566,0x374,0x374,0x374,0x357,0xa90,0x5e5,0x5e7,0xa98,0xa9f,0x374,0x374,0x374,0x374,0x374, +0xa46,0xaa7,0x374,0x374,0xaaf,0xab7,0x374,0x374,0x374,0x374,0x374,0x374,0xabb,0xac3,0x374,0x374, +0xacb,0x4cf,0x374,0x374,0xad3,0x374,0x374,0xad9,0xae1,0x374,0x374,0x374,0x374,0x374,0x374,0xae6, +0x374,0x374,0x374,0xaee,0xaf6,0x374,0x374,0xafe,0xb06,0x374,0x374,0x374,0xb09,0x9b1,0xb11,0xb15, +0xb1d,0x374,0xb24,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xb2b, +0x374,0x374,0x972,0xb33,0x374,0x374,0x374,0xb39,0xb41,0x374,0xb45,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0xb4b,0x5e5,0xb51,0xb59,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xb5d,0xb65,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xb6b,0x374,0xb71,0x5a3,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0xaee,0xaf6,0x374,0x374,0x374,0x374,0x374,0x374,0x6a6,0x374,0xb77,0x374, +0x374,0xb7f,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0xb84,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0xb8c,0x5a3,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x8ab,0xb94,0xb9b,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xba2,0xbaa, +0xbb0,0x374,0x374,0x374,0x374,0xbb8,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0xbc0,0xbc8,0xbcd,0xbd3,0xbdb,0xbe3,0xbeb,0xbc4,0xbf3,0xbfb,0xc03,0xc0a,0xbc5, +0xbc0,0xbc8,0xbc3,0xbd3,0xbc6,0xbc1,0xc12,0xbc4,0xc1a,0xc22,0xc2a,0xc31,0xc1d,0xc25,0xc2d,0xc34, +0xc20,0xc3c,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x8ab,0xc44,0x8ab,0xc4b,0xc52,0xc5a,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xc6a,0xc72,0x374,0x374,0x374,0x374, +0x374,0x374,0xc62,0xc7a,0xc8d,0xc80,0xc85,0x374,0x374,0x374,0x374,0xc95,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xaab,0x374,0xa28,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xc9d,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0xca1,0x374,0xca9,0xcb1,0xcb8,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0xbbc,0xcc0,0xcc0,0xcc6, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0xa6b,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x566,0x8ab,0x8ab,0x8ab,0x374,0x374,0x374,0x374,0x8ab,0x8ab,0x8ab,0x8ab,0x8ab, +0x8ab,0x8ab,0xcce,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374,0x374, +0x374,0x374,0x374,0x354,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, +0,0,4,0,0,0,0,0,0,0,0,0,0,0,4,0, +0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0xa,0x5a,0x7a, +0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0xba,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0, +0,0,4,0,4,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf9,0xf031,0x149, +0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x189,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0, -0,0,4,0,0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, -0x1012,0xa,0x5a,0x7a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0xba,0x1012,0x1012,0x1012,0x1012, -0x1012,0x1012,0x1012,0,0,0,4,0,4,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, -0xf011,0xf9,0xf031,0x149,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x189,0xf011,0xf011,0xf011,0xf011, -0xf011,0xf011,0xf011,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,0,1,0,0,4,0,4, -0,0,0,0,4,0x1c9,0,4,4,0,1,0,0,0,0,0, -0x1012,0x1012,0x1012,0x1012,0x1012,0x1fa,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x5a,0x5a,0x1012,0x1012, -0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x239, -0xf011,0xf011,0xf011,0xf011,0xf011,0x2d9,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, -0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x3c91, +0,0,0,0,4,0,1,0,0,4,0,4,0,0,0,0, +4,0x1c9,0,4,4,0,1,0,0,0,0,0,0x1012,0x1012,0x1012,0x1012, +0x1012,0x1fa,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x5a,0x5a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, +0x1012,0x1012,0x1012,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x239,0xf011,0xf011,0xf011,0xf011, +0xf011,0x2d9,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, +0xf011,0xf011,0xf011,0,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x3c91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x31a,0xff91,0x92,0xff91,0x92,0xff91,0x31a,0xffb1,0x33a,0x389,0x92,0xff91, +0x92,0xff91,0x92,0xff91,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92, +0xff91,0x3d9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x31a,0xff91,0x92,0xff91,0x92,0xff91,0x31a,0xffb1, -0x33a,0x389,0x92,0xff91,0x92,0xff91,0x92,0xff91,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92, -0xff91,0x92,0xff91,0x92,0xff91,0x3d9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0xc392,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x459,0x6191,0x6912,0x92,0xff91,0x92,0xff91,0x6712,0x92, +0xff91,0x6692,0x6692,0x92,0xff91,1,0x2792,0x6512,0x6592,0x92,0xff91,0x6692,0x6792,0x3091,0x6992,0x6892, +0x92,0xff91,0x5191,1,0x6992,0x6a92,0x4111,0x6b12,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x6d12,0x92, +0xff91,0x6d12,1,1,0x92,0xff91,0x6d12,0x92,0xff91,0x6c92,0x6c92,0x92,0xff91,0x92,0xff91,0x6d92, +0x92,0xff91,1,0,0x92,0xff91,1,0x1c11,0,0,0,0,0x48a,0x4bb,0x4f9,0x52a, +0x55b,0x599,0x5ca,0x5fb,0x639,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92, +0xff91,0x92,0xff91,0x92,0xff91,0xd891,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x669,0x6ea,0x71b,0x759,0x92,0xff91,0xcf92,0xe412, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0xc392,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x459,0x6191,0x6912,0x92,0xff91, -0x92,0xff91,0x6712,0x92,0xff91,0x6692,0x6692,0x92,0xff91,1,0x2792,0x6512,0x6592,0x92,0xff91,0x6692, -0x6792,0x3091,0x6992,0x6892,0x92,0xff91,0x5191,1,0x6992,0x6a92,0x4111,0x6b12,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x6d12,0x92,0xff91,0x6d12,1,1,0x92,0xff91,0x6d12,0x92,0xff91,0x6c92,0x6c92,0x92, -0xff91,0x92,0xff91,0x6d92,0x92,0xff91,1,0,0x92,0xff91,1,0x1c11,0,0,0,0, -0x48a,0x4bb,0x4f9,0x52a,0x55b,0x599,0x5ca,0x5fb,0x639,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92, -0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0xd891,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x669,0x6ea,0x71b,0x759, -0x92,0xff91,0xcf92,0xe412,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0xbf12,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,1,1,1,1,1,1,0x78a,0x92, -0xff91,0xae92,0x7aa,0x7c9,0x7c9,0x92,0xff91,0x9e92,0x2292,0x2392,0x92,0xff91,0x92,0xffb1,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x7e9,0x809,0x829,0x9711,0x9911,1,0x9991,0x9991,1,0x9b11,1,0x9a91, -0x849,1,1,1,0x9991,0x869,1,0x9891,1,0x889,0x8a9,1,0x97b1,0x9691,0x8a9,0x8c9, -0x8e9,1,1,0x9691,1,0x909,0x9591,1,1,0x9511,1,1,1,1,1,1, -1,0x929,1,1,0x9311,1,0x949,0x9311,1,1,1,0x969,0x9311,0xdd91,0x9391,0x9391, -0xdc91,1,1,1,1,1,0x9291,1,0,1,1,1,1,1,1,1, -1,0x989,0x9a9,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,5,5,0x25,5,5,5,5,5,5,4,4,4, -0x14,4,0x14,4,5,5,4,4,4,4,4,4,4,4,4,4, +0xbf12,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,1,1,1,1,1,1,0x78a,0x92,0xff91,0xae92,0x7aa,0x7c9, +0x7c9,0x92,0xff91,0x9e92,0x2292,0x2392,0x92,0xff91,0x92,0xffb1,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x7e9,0x809,0x829,0x9711,0x9911,1,0x9991,0x9991,1,0x9b11,1,0x9a91,0x849,1,1,1, +0x9991,0x869,1,0x9891,1,0x889,0x8a9,1,0x97b1,0x9691,0x8a9,0x8c9,0x8e9,1,1,0x9691, +1,0x909,0x9591,1,1,0x9511,1,1,1,1,1,1,1,0x929,1,1, +0x9311,1,0x949,0x9311,1,1,1,0x969,0x9311,0xdd91,0x9391,0x9391,0xdc91,1,1,1, +1,1,0x9291,1,0,1,1,1,1,1,1,1,1,0x989,0x9a9,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +5,5,0x25,5,5,5,5,5,5,4,4,4,0x14,4,0x14,4, +5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,4,4,5,5,5,5,5,4,4,4,4,4,4,4, +5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,4,4,0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x9cc,0x54,0x44,0x54,0x44, -0x54,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64, +0x54,0x54,0x44,0x44,0x44,0x44,0x44,0x9cc,0x54,0x44,0x54,0x44,0x54,0x44,0x44,0x44, +0x44,0x44,0x44,0x54,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64, 0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64, -0x64,0x64,0x64,0x64,0x64,0x74,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64, -0x64,0x44,0x44,0x44,0x44,0x44,0x54,0x44,0x44,0x9dd,0x44,0x64,0x64,0x64,0x44,0x44, -0x44,0x64,0x64,4,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x44,0x64,0x64,0x64,0x44, -0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,0x44,0x92,0xff91,0x92,0xff91,4,4,0x92,0xff91,0,0,5,0x4111, -0x4111,0x4111,0,0x3a12,0,0,0,0,4,4,0x1312,4,0x1292,0x1292,0x1292,0, -0x2012,0,0x1f92,0x1f92,0xa29,0x1012,0xafa,0x1012,0x1012,0xb3a,0x1012,0x1012,0xb7a,0xbca,0xc1a,0x1012, -0xc5a,0x1012,0x1012,0x1012,0xc9a,0xcda,0,0xd1a,0x1012,0x1012,0xd5a,0x1012,0x1012,0xd9a,0x1012,0x1012, -0xed11,0xed91,0xed91,0xed91,0xdd9,0xf011,0xea9,0xf011,0xf011,0xee9,0xf011,0xf011,0xf29,0xf79,0xfc9,0xf011, -0x1009,0xf011,0xf011,0xf011,0x1049,0x1089,0x10c9,0x10f9,0xf011,0xf011,0x1139,0xf011,0xf011,0x1179,0xf011,0xf011, -0xe011,0xe091,0xe091,0x412,0x11b9,0x11e9,2,2,2,0x1239,0x1269,0xfc11,0x92,0xff91,0x92,0xff91, +0x64,0x74,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x44, +0x44,0x44,0x54,0x44,0x44,0x9dd,0x44,0x64,0x64,0x64,0x44,0x44,0x44,0x64,0x64,4, +0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x44,0x64,0x64,0x64,0x44,0x64,0x64,0x64,0x64, +0x64,0x64,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, +0x92,0xff91,0x92,0xff91,4,4,0x92,0xff91,0,0,5,0x4111,0x4111,0x4111,0,0x3a12, +0,0,0,0,4,4,0x1312,4,0x1292,0x1292,0x1292,0,0x2012,0,0x1f92,0x1f92, +0xa29,0x1012,0xafa,0x1012,0x1012,0xb3a,0x1012,0x1012,0xb7a,0xbca,0xc1a,0x1012,0xc5a,0x1012,0x1012,0x1012, +0xc9a,0xcda,0,0xd1a,0x1012,0x1012,0xd5a,0x1012,0x1012,0xd9a,0x1012,0x1012,0xed11,0xed91,0xed91,0xed91, +0xdd9,0xf011,0xea9,0xf011,0xf011,0xee9,0xf011,0xf011,0xf29,0xf79,0xfc9,0xf011,0x1009,0xf011,0xf011,0xf011, +0x1049,0x1089,0x10c9,0x10f9,0xf011,0xf011,0x1139,0xf011,0xf011,0x1179,0xf011,0xf011,0xe011,0xe091,0xe091,0x412, +0x11b9,0x11e9,2,2,2,0x1239,0x1269,0xfc11,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x1299,0x12c9,0x391,0xc631,0x12fa,0x1349,0,0x92,0xff91,0xfc92,0x92,0xff91,1,0xbf12,0xbf12,0xbf12, +0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812, +0x1012,0x1012,0x137a,0x1012,0x13ba,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x13fa,0x1012, +0x1012,0x143a,0x147a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x14ca,0x1012,0x1012,0x1012,0x1012,0x1012, +0xf011,0xf011,0x1509,0xf011,0x1549,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x1589,0xf011, +0xf011,0x15c9,0x1609,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x1659,0xf011,0xf011,0xf011,0xf011,0xf011, +0xd811,0xd811,0xd811,0xd811,0xd811,0xd811,0xd831,0xd811,0xd831,0xd811,0xd811,0xd811,0xd811,0xd811,0xd811,0xd811, +0x92,0xff91,0x169a,0x16d9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x1299,0x12c9,0x391,0xc631,0x12fa,0x1349,0,0x92,0xff91,0xfc92,0x92,0xff91, -1,0xbf12,0xbf12,0xbf12,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812,0x2812, -0x2812,0x2812,0x2812,0x2812,0x1012,0x1012,0x137a,0x1012,0x13ba,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, -0x1012,0x1012,0x13fa,0x1012,0x1012,0x143a,0x147a,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x14ca,0x1012, -0x1012,0x1012,0x1012,0x1012,0xf011,0xf011,0x1509,0xf011,0x1549,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, -0xf011,0xf011,0x1589,0xf011,0xf011,0x15c9,0x1609,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0x1659,0xf011, -0xf011,0xf011,0xf011,0xf011,0xd811,0xd811,0xd811,0xd811,0xd811,0xd811,0xd831,0xd811,0xd831,0xd811,0xd811,0xd811, -0xd811,0xd811,0xd811,0xd811,0x92,0xff91,0x169a,0x16d9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0,0x44,0x44,0x44,0x44,0x44,4,4,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0x44,0x44,0x44,0x44,0x44,4,4,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x792,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0xf891, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x792,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92, -0xff91,0x92,0xff91,0xf891,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812, -0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0, -0,4,0,0,0,0,0,4,1,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, +0,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812, +0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0,0,4,0,0, +0,0,0,4,1,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, 0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, -0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0x1719,1,0,0,0, -0,0,0,0,0,0x64,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x44,0x64,0x64, -0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x44, -0x44,0x64,0x64,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64, -0x64,0x64,0,0x64,0,0x64,0x64,0,0x44,0x64,0,0x64,0,0,0,0, +0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0x1719,1,0,0,0,0,0,0,0, +0,0x64,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x44,0x64,0x64,0x44,0x44,0x44,0x44, +0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x44,0x44,0x64,0x64,0x44, +0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,0x64, +0,0x64,0x64,0,0x44,0x64,0,0x64,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, -0,0,0,0,4,4,4,4,4,4,0,0,0,0,0,0, -0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0, +4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0, +0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0,4,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0x64, -0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x64,0x44,0x44,0x44,0x44,0x44, -0x64,0x44,0x44,0x64,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0x64,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44, -0x44,0x44,0x44,0x44,0x44,4,0,0x44,0x44,0x44,0x44,0x64,0x44,4,4,0x44, -0x44,0,0x64,0x44,0x44,0x64,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,4,0,0x64,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x64,0x44,0x44, -0x64,0x44,0x44,0x64,0x64,0x64,0x44,0x64,0x64,0x44,0x64,0x44,0x44,0x44,0x64,0x44, -0x64,0x44,0x64,0x44,0x64,0x44,0x44,0,0,0,0,0,0,0,0,0, +4,0,0,0,0,0,0,0,0,0,0,0x64,0x64,0x64,0x64,0x64, +0x64,0x64,0x64,0x44,0x44,0x64,0x64,0x44,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x64, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44, +0x44,4,0,0x44,0x44,0x44,0x44,0x64,0x44,4,4,0x44,0x44,0,0x64,0x44, +0x44,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,0,0x64,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x44,0x64,0x44,0x44,0x64,0x44,0x44,0x64, +0x64,0x64,0x44,0x64,0x64,0x44,0x64,0x44,0x44,0x44,0x64,0x44,0x64,0x44,0x64,0x44, +0x64,0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4, +4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, -4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x44,4,4,0,0, +0,0,4,0,0,0x64,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44, +0x44,0x44,4,0x44,0x44,0x44,0x44,0x44,4,0x44,0x44,0x44,4,0x44,0x44,0x44, +0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0x64,0x64,0x64, +0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, +4,4,0,0,0,0,0,0,0x44,0x64,0x64,0x64,0x44,0x44,0x44,0x44, +0x44,0x44,4,0x64,0x44,0x44,0x64,0x44,0x44,0x64,0x44,0x44,0x44,0x64,0x64,0x64, +0x64,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x44,0x64,0x64,0x44,0x44,0x44,0x44,0x44, +0,0,0,0,0,0,0,0,0,4,0x44,0x44,0x44,0x44,0x44,0x64, +0x64,0x64,0x64,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, +4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x44, -4,4,0,0,0,0,4,0,0,0x64,0,0,0,0,0,0, +0,0,4,0,0x64,0,0,0,0,4,4,4,4,4,4,4, +4,0,0,0,0,0x64,0,0,0,0x44,0x64,0x44,0x44,4,4,4, +0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0x44,0x44,0x44,0x44,4,0x44,0x44,0x44,0x44,0x44,4,0x44,0x44,0x44, -4,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x64,0,0,0,0,4,4,4, +4,0,0,0,0,0,0,0,0,0x64,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0x64,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,0x44,0x44,0x44,4,0x64,0x44,0x44,0x64,0x44,0x44,0x64,0x44,0x44, -0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x44,0x64,0x64,0x44, -0x44,0x44,0x44,0x44,4,4,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0x44,0,0,4,4,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,0,0x64,0,0,0,0,4,4,4, -4,4,4,4,4,0,0,0,0,0x64,0,0,0,0x44,0x64,0x44, -0x44,4,4,4,0,0,0,0,0,0,0,0,0,0,4,4, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0, +0,0,0,4,4,0,0,4,4,0x64,0,0,0,4,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0,0, -0,4,4,4,4,0,0,0,0,0,0,0,0,0x64,0,0, +4,4,0,0,0,4,0,0,0,0,0,0,0,0,0,0, +0,4,4,4,4,4,0,4,4,0,0,0,0,0x64,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0, -0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,4,4,0,0,0,0,4,4,0,0,4,4,0x64,0,0, -0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,4,0,0,0,4,0,0,0,0,0,0, -0,0,0,0,0,4,4,4,4,4,0,4,4,0,0,0, -0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, -4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0,4, +0,4,4,4,4,0,0,0,0,0,0,0,0,0x64,0,0, +0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0, +0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x64,0,0,4,0,4,4,4,4,0,0,0,0,0,0,0, -0,0x64,0,0,0,0,0,0,0,4,4,0,0,0,0,0, -0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0, +0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0, +4,0,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0, -0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,0,0,0,4,0,0,0,0,0,0,0, +4,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,0,0,0,0,0,4,4,4,0,4,4, -4,0x64,0,0,0,0,0,0,0,0x64,0x64,0,0,0,0,0, -0,0,0,0,0,0,4,0,0,0,0,0,4,0x64,0,0, +0,0,0,0,0x64,0,4,4,4,0,0,0,0,0,4,4, +4,0,4,4,4,0x64,0,0,0,0,0,0,0,0x64,0x64,0, +0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0, +4,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0x64,0x64,0,0,0,0,0,0,0, +0,0,0,0,0,0,0x64,0,0,0,0,0,0,0,4,4, +4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,0,0,4,4,4,4,0x64,0x64,0x64,0, +0,0,0,0,0,0,4,4,0x64,0x64,0x64,0x64,4,4,4,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0, -0,0,0x64,0,0,0,0,0,0,0,4,4,4,0,4,0, +0,4,0,0,4,4,4,4,0x64,0x64,0x64,4,4,0,0,0, +0,0,0,0,0,0,4,0,0x64,0x64,0x64,0x64,4,4,4,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,4,0,0,4,4,4,4,0x64,0x64,0x64,0,0,0,0,0, -0,0,4,4,0x64,0x64,0x64,0x64,4,4,4,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, -4,4,4,4,0x64,0x64,0x64,4,4,0,0,0,0,0,0,0, -0,0,4,0,0x64,0x64,0x64,0x64,4,4,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x64,0x64,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0x64,0x64,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0x64,0,0x64, -0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0x64,0x64,4,0x64,4,4,4,4,4,0x64,0x64, -0x64,0x64,4,0,0x64,4,0x44,0x44,0x64,0,0x44,0x44,0,0,0,0, -0,4,4,4,4,4,4,4,4,4,4,4,0,4,4,4, +0,0x64,0,0x64,0,0x64,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0x64,0x64,4,0x64,4,4,4, +4,4,0x64,0x64,0x64,0x64,4,0,0x64,4,0x44,0x44,0x64,0,0x44,0x44, +0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4, +0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0, -0,0,0,0,0,0,0x64,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,4,4,4,4,0,4,4,4,4,4,0x64,0,0x64,0x64,0, -0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0, -0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,0,0,4,4,0,0,0,0,0, -0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,4,0,0,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a, -0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a, -0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0,0x179a,0,0,0,0,0,0x179a,0,0, -0x17b9,0x17e9,0x1819,0x1849,0x1879,0x18a9,0x18d9,0x1909,0x1939,0x1969,0x1999,0x19c9,0x19f9,0x1a29,0x1a59,0x1a89, -0x1ab9,0x1ae9,0x1b19,0x1b49,0x1b79,0x1ba9,0x1bd9,0x1c09,0x1c39,0x1c69,0x1c99,0x1cc9,0x1cf9,0x1d29,0x1d59,0x1d89, -0x1db9,0x1de9,0x1e19,0x1e49,0x1e79,0x1ea9,0x1ed9,0x1f09,0x1f39,0x1f69,0x1f99,0,4,0x1fc9,0x1ff9,0x2029, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44, -0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a, -0x207a,0x207a,0x207a,0x207a,0x207a,0x207a,0,0,0x2099,0x20c9,0x20f9,0x2129,0x2159,0x2189,0,0, -0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a, -0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,4,0x64,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,4, -4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,0, -0,4,4,4,4,4,4,4,4,4,0x64,4,0,0,0,4, -0,0,0,0,0,0x44,0,0,0,0,0,0,0,0,0,0, -0,0,0,4,4,4,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, +4,0,0,0,0,0,0,0,0,0,0x64,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0, +0,0,0,0,0,4,4,4,4,0,4,4,4,4,4,0x64, +0,0x64,0x64,0,0,4,4,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,4,0,0,0,0,4,4,4,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,4,4,4,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,0,0,4,4,0, 0,0,0,0,0,0x64,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0, -0,0,0,4,4,0,0,0,0,0,0,0,0,0,4,0, -0,0,0,0,0,0x64,0x44,0x64,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x44, -0x64,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,4,0,4,4,4,4, -4,4,4,0,0x64,0,4,0,0,4,4,4,4,4,4,4, -4,0,0,0,0,0,0,4,4,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0,0,0x64,0,0,0,0,0,0,0,4,0,0,0,0, -0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44, -0x44,0x64,4,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,0,0,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a, +0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a, +0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0,0x175a,0,0,0,0, +0,0x175a,0,0,0x1779,0x17a9,0x17d9,0x1809,0x1839,0x1869,0x1899,0x18c9,0x18f9,0x1929,0x1959,0x1989, +0x19b9,0x19e9,0x1a19,0x1a49,0x1a79,0x1aa9,0x1ad9,0x1b09,0x1b39,0x1b69,0x1b99,0x1bc9,0x1bf9,0x1c29,0x1c59,0x1c89, +0x1cb9,0x1ce9,0x1d19,0x1d49,0x1d79,0x1da9,0x1dd9,0x1e09,0x1e39,0x1e69,0x1e99,0x1ec9,0x1ef9,0x1f29,0x1f59,0, +5,0x1f89,0x1fb9,0x1fe9,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0x44,0x44,0x44,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a, +0x201a,0x201a,0x201a,0x201a,0x203a,0x203a,0x203a,0x203a,0x203a,0x203a,0,0,0x2059,0x2089,0x20b9,0x20e9, +0x2119,0x2149,0,0,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a, +0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a, +0x201a,0x201a,0x201a,0x201a,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,4,0x64,0x60,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, +0x60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,4,0,4,4,4,4,4, +4,4,0,0,0,0,0,0,0,0,4,0,0,4,4,4, +4,4,4,4,4,4,0x64,4,0,0,0,4,0,0,0,0, +0,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,4,4,0,0,0,0,4, +4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0, +0,0x64,0x44,0x64,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x44,0x64,0,0,4, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,4,0,4,4,4,4,4,4,4,0, +0x64,0,4,0,0,4,4,4,4,4,4,4,4,0,0,0, +0,0,0,4,4,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0x64, +0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0, +0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,4,0x64, +0x64,0x44,0x44,0x64,0x64,0x44,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x44,0x44,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0x64,0,4,4,4,4,4,0,4,0,0,0, 0,0,4,0,0x60,0,0,0,0,0,0,0,0,0,0,0, @@ -458,9 +468,9 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0,4,4,4,4,4,4,4,4,0,0,4,0x64, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0, -0x21b9,0x21e9,0x2219,0x2249,0x2279,0x22c9,0x2319,0x2349,0x2379,0,0,0,0,0,0,0, -0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa, -0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0,0,0x23aa,0x23aa,0x23aa, +0x2179,0x21a9,0x21d9,0x2209,0x2239,0x2289,0x22d9,0x2309,0x2339,0,0,0,0,0,0,0, +0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a, +0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0,0,0x236a,0x236a,0x236a, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x44,0x44,0x44,0,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x64,0x64,0x64, 0x44,0,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,0,0,0,0x64,0,0, @@ -470,38 +480,38 @@ static const uint16_t ucase_props_trieIndex[12356]={ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,0x25,5,5,5,5,5,5,5,5,1,1,1,1,1, -1,1,1,1,1,1,1,1,5,0x23c9,1,1,1,0x23e9,1,1, +1,1,1,1,1,1,1,1,5,0x2389,1,1,1,0x23a9,1,1, 5,5,5,5,0x25,5,5,5,0x25,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x2409,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x23c9,1, 1,1,1,1,1,1,0x21,1,1,1,1,5,5,5,5,5, 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0,0x44,0x64,0x64,0x44,0x64, +0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x44,0x64,0x64,0x44,0x64, 0x44,0x44,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x44,0x44,0x64,0x64,0x64, 0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xffb1,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x242a,0x2469,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x23ea,0x2429,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x24a9,0x2529,0x25a9,0x2629,0x26a9,0x2729,1,1,0x275a,1,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x2469,0x24e9,0x2569,0x25e9,0x2669,0x26e9,1,1,0x271a,1,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xffb1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, 0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411, 0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411, -0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x27a9,0x411,0x2829,0x411, -0x28d9,0x411,0x2989,0x411,0,0xfc12,0,0xfc12,0,0xfc12,0,0xfc12,0x411,0x411,0x411,0x411, +0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x2769,0x411,0x27e9,0x411, +0x2899,0x411,0x2949,0x411,0,0xfc12,0,0xfc12,0,0xfc12,0,0xfc12,0x411,0x411,0x411,0x411, 0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x2511,0x2511,0x2b11,0x2b11, -0x2b11,0x2b11,0x3211,0x3211,0x4011,0x4011,0x3811,0x3811,0x3f11,0x3f11,0,0,0x2a39,0x2aa9,0x2b19,0x2b89, -0x2bf9,0x2c69,0x2cd9,0x2d49,0x2dbb,0x2e2b,0x2e9b,0x2f0b,0x2f7b,0x2feb,0x305b,0x30cb,0x3139,0x31a9,0x3219,0x3289, -0x32f9,0x3369,0x33d9,0x3449,0x34bb,0x352b,0x359b,0x360b,0x367b,0x36eb,0x375b,0x37cb,0x3839,0x38a9,0x3919,0x3989, -0x39f9,0x3a69,0x3ad9,0x3b49,0x3bbb,0x3c2b,0x3c9b,0x3d0b,0x3d7b,0x3deb,0x3e5b,0x3ecb,0x411,0x411,0x3f39,0x3fb9, -0x4029,0,0x40a9,0x4129,0xfc12,0xfc12,0xdb12,0xdb12,0x41db,4,0x4249,4,4,4,0x4299,0x4319, -0x4389,0,0x4409,0x4489,0xd512,0xd512,0xd512,0xd512,0x453b,4,4,4,0x411,0x411,0x45a9,0x4659, -0,0,0x4729,0x47a9,0xfc12,0xfc12,0xce12,0xce12,0,4,4,4,0x411,0x411,0x4859,0x4909, -0x49d9,0x391,0x4a59,0x4ad9,0xfc12,0xfc12,0xc812,0xc812,0xfc92,4,4,4,0,0,0x4b89,0x4c09, -0x4c79,0,0x4cf9,0x4d79,0xc012,0xc012,0xc112,0xc112,0x4e2b,4,4,0,0,0,0,0, +0x2b11,0x2b11,0x3211,0x3211,0x4011,0x4011,0x3811,0x3811,0x3f11,0x3f11,0,0,0x29f9,0x2a69,0x2ad9,0x2b49, +0x2bb9,0x2c29,0x2c99,0x2d09,0x2d7b,0x2deb,0x2e5b,0x2ecb,0x2f3b,0x2fab,0x301b,0x308b,0x30f9,0x3169,0x31d9,0x3249, +0x32b9,0x3329,0x3399,0x3409,0x347b,0x34eb,0x355b,0x35cb,0x363b,0x36ab,0x371b,0x378b,0x37f9,0x3869,0x38d9,0x3949, +0x39b9,0x3a29,0x3a99,0x3b09,0x3b7b,0x3beb,0x3c5b,0x3ccb,0x3d3b,0x3dab,0x3e1b,0x3e8b,0x411,0x411,0x3ef9,0x3f79, +0x3fe9,0,0x4069,0x40e9,0xfc12,0xfc12,0xdb12,0xdb12,0x419b,4,0x4209,4,4,4,0x4259,0x42d9, +0x4349,0,0x43c9,0x4449,0xd512,0xd512,0xd512,0xd512,0x44fb,4,4,4,0x411,0x411,0x4569,0x4619, +0,0,0x46d9,0x4759,0xfc12,0xfc12,0xce12,0xce12,0,4,4,4,0x411,0x411,0x4809,0x48b9, +0x4979,0x391,0x49f9,0x4a79,0xfc12,0xfc12,0xc812,0xc812,0xfc92,4,4,4,0,0,0x4b29,0x4ba9, +0x4c19,0,0x4c99,0x4d19,0xc012,0xc012,0xc112,0xc112,0x4dcb,4,4,0,0,0,0,0, 0,0,0,0,0,0,0,4,4,4,4,4,0,0,0,0, 0,0,0,0,4,4,0,0,0,0,0,0,4,0,0,4, 0,0,4,4,4,4,4,0,0,0,0,0,0,0,0,0, @@ -515,8 +525,8 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0x64,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2, 0,0,1,2,2,2,1,1,2,2,2,1,0,2,0,0, -0,2,2,2,2,2,0,0,0,0,0,0,2,0,0x4e9a,0, -2,0,0x4eda,0x4f1a,2,2,0,1,2,2,0xe12,2,1,0,0,0, +0,2,2,2,2,2,0,0,0,0,0,0,2,0,0x4e3a,0, +2,0,0x4e7a,0x4eba,2,2,0,1,2,2,0xe12,2,1,0,0,0, 0,1,0,0,1,1,2,2,0,0,0,0,0,2,1,1, 0x21,0x21,0,0,0,0,0xf211,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0x812,0x812,0x812,0x812,0x812,0x812,0x812,0x812, @@ -529,111 +539,121 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812, 0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812, -0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, +0x1812,0x1812,0x1812,0x1812,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, 0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811, -0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0,0x92,0xff91,0x4f5a,0x4f7a,0x4f9a,0x4fb9,0x4fd9,0x92, -0xff91,0x92,0xff91,0x92,0xff91,0x4ffa,0x501a,0x503a,0x505a,1,0x92,0xff91,1,0x92,0xff91,1, -1,1,1,1,0x25,5,0x507a,0x507a,0x92,0xff91,0x92,0xff91,1,0,0,0, -0,0,0,0x92,0xff91,0x92,0xff91,0x44,0x44,0x44,0x92,0xff91,0,0,0,0, -0,0,0,0,0,0,0,0,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099, -0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099, -0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0,0x5099,0,0,0,0, -0,0x5099,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0, -0,0,0x64,0x64,0x64,0x64,0x60,0x60,0,4,4,4,4,4,0,0, -0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0x64,0x64,4, -4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xe811,0xe811,0xe811,0xe811,0x92,0xff91,0x4efa,0x4f1a,0x4f3a,0x4f59,0x4f79,0x92,0xff91,0x92,0xff91,0x92, +0xff91,0x4f9a,0x4fba,0x4fda,0x4ffa,1,0x92,0xff91,1,0x92,0xff91,1,1,1,1,1, +0x25,5,0x501a,0x501a,0x92,0xff91,0x92,0xff91,1,0,0,0,0,0,0,0x92, +0xff91,0x92,0xff91,0x44,0x44,0x44,0x92,0xff91,0,0,0,0,0,0,0,0, +0,0,0,0,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039, +0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0x5039, +0x5039,0x5039,0x5039,0x5039,0x5039,0x5039,0,0x5039,0,0,0,0,0,0x5039,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x50ba,0x50f9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0x44, -4,4,4,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,4, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,5,5,0x44,0x44, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -1,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,5,1,1,1,1,1,1,1,1,0x92,0xff91,0x92, -0xff91,0x513a,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,4,4,4,0x92, -0xff91,0x515a,1,0,0x92,0xff91,0x92,0xff91,0x1811,1,0x92,0xff91,0x92,0xff91,0x92,0xff91, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x517a,0x519a,0x51ba,0x51da,0x517a,1,0x51fa,0x521a,0x523a,0x525a, -0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0,0x92,0xff91, -0xe812,0x527a,0x529a,0x92,0xff91,0x92,0xff91,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0x92,0xff91,0, -5,5,1,0,0,0,0,0,0,0,4,0,0,0,0x64,0, 0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0, -0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0x64,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -0,0,0,0,0,0,4,4,4,4,4,0x64,0x64,0x64,0,0, +0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0,0,0x64,0x64, +0x64,0x64,0x60,0x60,0,4,4,4,4,4,0,0,0,0,0,4, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,4,4,4,4,4,4,4,4,4,4,4,0,0x60, +0,0,0,0,0,0,0,0,0,0x64,0x64,4,4,4,4,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0x64,0,0,4,4,4,4,0,0,4,4,0,0, -0x60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,4,4,4,4,4,4,0,0,4,4,0,0,4,4,0, -0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, -0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, +0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x44,0,0x44,0x44,0x64,0,0,0x44, -0x44,0,0,0,0,0,0x44,0x44,0,0x44,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x505a,0x5099,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0x44,4,4,4,0, +0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,4,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,5,5,0x44,0x44,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,1,1,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +5,1,1,1,1,1,1,1,1,0x92,0xff91,0x92,0xff91,0x50da,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,4,4,4,0x92,0xff91,0x50fa,1,0, +0x92,0xff91,0x92,0xff91,0x1811,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x511a,0x513a,0x515a,0x517a,0x511a,1,0x519a,0x51ba,0x51da,0x51fa,0x92,0xff91,0x92,0xff91, +0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0xe812,0x521a,0x523a,0x92,0xff91,0x92,0xff91,0, +0,0,0,0,0x92,0xff91,0,1,0,1,0x92,0xff91,0x92,0xff91,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,5,5,5,0x92,0xff91,0,5,5,1,0,0,0,0,0, +0,0,4,0,0,0,0x64,0,0,0,0,4,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,4,4,0,0,0,0,0,0x64,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x64,4,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, +0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,4, +4,4,4,0x64,0x64,0x64,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4, +4,4,4,4,4,4,0,0x60,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x64,0,0,4,4, +4,4,0,0,4,4,0,0,0x60,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,0, +0,4,4,0,0,4,4,0,0,0,0,0,0,0,0,0, +0,0,0,4,0,0,0,0,0,0,0,0,4,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,4,0,0,0,0,0,4,4,0,0x64,0, +4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,0x52b9,1,1,1,1,1,1,1,4,5,5,5,5, -1,1,1,1,1,1,1,1,1,4,4,4,0,0,0,0, -0x52d9,0x5309,0x5339,0x5369,0x5399,0x53c9,0x53f9,0x5429,0x5459,0x5489,0x54b9,0x54e9,0x5519,0x5549,0x5579,0x55a9, -0x5bd9,0x5c09,0x5c39,0x5c69,0x5c99,0x5cc9,0x5cf9,0x5d29,0x5d59,0x5d89,0x5db9,0x5de9,0x5e19,0x5e49,0x5e79,0x5ea9, -0x5ed9,0x5f09,0x5f39,0x5f69,0x5f99,0x5fc9,0x5ff9,0x6029,0x6059,0x6089,0x60b9,0x60e9,0x6119,0x6149,0x6179,0x61a9, -0x55d9,0x5609,0x5639,0x5669,0x5699,0x56c9,0x56f9,0x5729,0x5759,0x5789,0x57b9,0x57e9,0x5819,0x5849,0x5879,0x58a9, -0x58d9,0x5909,0x5939,0x5969,0x5999,0x59c9,0x59f9,0x5a29,0x5a59,0x5a89,0x5ab9,0x5ae9,0x5b19,0x5b49,0x5b79,0x5ba9, -0,0,0,0,0,4,0,0,4,0,0,0,0,0x64,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x61d9,0x6259,0x62d9,0x6359,0x6409,0x64b9,0x6559,0,0,0,0,0,0,0,0,0, -0,0,0,0x65f9,0x6679,0x66f9,0x6779,0x67f9,0,0,0,0,0,0,0x64,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,4,4,0,0,0,4,0,0,0,0,0,0,0,0, -0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64, -0x64,0x64,0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,0,0,4,0,0,0,0,0,0, -0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, -0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0, -0,0,4,0,4,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, -0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0, +0x44,0,0x44,0x44,0x64,0,0,0x44,0x44,0,0,0,0,0,0x44,0x44, +0,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0, +0,0,0,4,4,0,0x64,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0x5259,1,1,1,1, +1,1,1,4,5,5,5,5,1,1,1,1,1,1,1,1, +1,5,4,4,0,0,0,0,0x5279,0x52a9,0x52d9,0x5309,0x5339,0x5369,0x5399,0x53c9, +0x53f9,0x5429,0x5459,0x5489,0x54b9,0x54e9,0x5519,0x5549,0x5b79,0x5ba9,0x5bd9,0x5c09,0x5c39,0x5c69,0x5c99,0x5cc9, +0x5cf9,0x5d29,0x5d59,0x5d89,0x5db9,0x5de9,0x5e19,0x5e49,0x5e79,0x5ea9,0x5ed9,0x5f09,0x5f39,0x5f69,0x5f99,0x5fc9, +0x5ff9,0x6029,0x6059,0x6089,0x60b9,0x60e9,0x6119,0x6149,0x5579,0x55a9,0x55d9,0x5609,0x5639,0x5669,0x5699,0x56c9, +0x56f9,0x5729,0x5759,0x5789,0x57b9,0x57e9,0x5819,0x5849,0x5879,0x58a9,0x58d9,0x5909,0x5939,0x5969,0x5999,0x59c9, +0x59f9,0x5a29,0x5a59,0x5a89,0x5ab9,0x5ae9,0x5b19,0x5b49,0,0,0,0,0,4,0,0, +4,0,0,0,0,0x64,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x6179,0x61f9,0x6279,0x62f9,0x63a9,0x6459,0x64e9,0, +0,0,0,0,0,0,0,0,0,0,0,0x6589,0x6609,0x6689,0x6709,0x6789, +0,0,0,0,0,0,0x64,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,4, +0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44, +0x44,0x44,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0, +0,4,0,0,0,0,0,0,0,0,0,0,0,0x1012,0x1012,0x1012, +0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, +0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0,0,0,4,0,4,0xf011,0xf011,0xf011, +0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, +0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,4,4,0,0,0,0, +0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0x64,0,0,0,0,0,0, +0,0x64,0,0,0x64,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0x1412,0x1412,0x1412,0x1412, +0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0, +0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412, 0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412, -0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0xec11,0xec11,0xec11,0xec11, 0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11, -0xec11,0xec11,0xec11,0xec11,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412, -0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0,0,0,0,0xec11,0xec11,0xec11,0xec11, +0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412, +0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0x1412,0,0,0,0, 0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11, -0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0,0,0,0,0,4,4,4, +0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0xec11,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1392,0x1392,0x1392,0x1392, +0x1392,0x1392,0x1392,0x1392,0x1392,0x1392,0x1392,0,0x1392,0x1392,0x1392,0x1392,0x1392,0x1392,0x1392,0, +0x1392,0x1392,0,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0,0xec91, +0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0,0xec91, +0xec91,0xec91,0xec91,0xec91,0xec91,0xec91,0,0xec91,0xec91,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5, +5,5,5,5,5,5,5,0,0,0,0,0,5,4,4,5, +5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0,4,4,4, 0,4,4,0,0,0,0,0,4,0x64,4,0x44,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0x44,0x64,0x64,0,0,0,0,0x64,0,0,0,0, @@ -648,150 +668,177 @@ static const uint16_t ucase_props_trieIndex[12356]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x64,0x64,0x64,0x64,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4, -4,4,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -4,4,4,0,0,0x64,0x64,0,0,4,0,0,0x44,0x44,0x44,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0x64,0x64,0x64, +0,0,0,0,0,0,0x64,0x64,0x44,0x44,0x44,0x64,0x44,0x64,0x64,0x64, +0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0x44,0x64,0x44,0x64,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -4,4,4,4,0,4,4,4,4,4,4,0x64,0x64,0,0,0, +4,4,4,4,4,4,4,4,4,4,0x64,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x64,0,0,4,4,0,0,0,0,0,0,0, 0,0,0,0x64,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4, -4,4,4,0,0x60,0,0,0,0,0,0,0,0,4,0x64,4, -4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,4,4,0,0,4,0x60,0x64,4, -0,0,0,0,0,0,4,0,0,0,0,4,4,4,4,4, -4,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, -0,0,0,0,0,0x60,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0,0,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0, -0,0,0,0,0,0,0x64,4,4,0,0x64,0,0,0,0,0, +0,0,0,0,0,0,0,4,4,4,4,0,0,0x64,0x64,0, +0,4,0,0,0,0,4,0,0,0,0,0,0,0,0,0, +0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,4,4,4,4,0,4,4,4, +4,4,4,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x64,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,4,4,4,4,4,4,4,4,0,0x60,0,0,0, +0,0,0,0,0,4,0x64,4,4,0,0,4,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +4,4,0,0,4,0x60,0x64,4,0,0,0,0,0,0,4,0, +0,0,0,4,4,4,4,4,4,0x64,0x64,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,4,4,4,4,4,0,4,0, -0,0,0,4,4,0,0x64,0x64,0,0,0,0,0,0,0,0, +4,0,0,0,0,0,0,0,0,0,0,0,0,0x60,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0, -4,4,0,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0, +0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0,0x44,0x44,0x44,0x44, +0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0x64,4, +4,0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0x44,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +4,4,4,4,4,0,4,0,0,0,0,4,4,0,0x64,0x64, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0, -0,4,0,0x64,0,0,0,0,0,0,0,0,0,0,0,4, -0,4,0,0,4,4,4,4,4,4,0x60,0x64,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, +4,4,0,0,0,0,0,0,4,4,0,0x64,0x64,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,4,4,0,0,4,4, -4,4,0,4,4,4,4,0x64,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -4,4,4,4,4,4,4,4,0,0x64,0x64,0,0,0,0,0, -0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, +4,4,4,4,4,4,4,0,0,4,0,0x64,0,0,0,0, +0,0,0,0,0,0,0,4,0,4,0,0,4,4,4,4, +4,4,0x60,0x64,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,4,4,4,0,0,4,4,4,4,0,4,4,4,4,0x64, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4, +0,0x64,0x64,0,0,0,0,0,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, 0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012, +0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0x1012,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, 0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, -0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011, +0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0xf011,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,4,4,0x60,0x64,0, -0,0,0,0x64,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,4,4,0x60,0x64,0,0,0,0,0x64,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,4,4,4,0,0,4,4,0,0,0,0,0,4,4,4, -4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, -0x64,4,4,4,4,0,0,4,4,4,4,0,0,0,0,0, -0,0,0,0x64,0,0,0,0,0,0,0,0,0,4,4,4, -4,4,4,0,0,4,4,4,0,0,0,0,0,0,0,0, -0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,0, -4,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,4,4,4,4,4,4,0,4,4,4,4, -4,4,0,0x64,4,4,4,4,4,4,4,4,0,0,4,4, -4,4,4,4,4,0,4,4,0,4,4,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4, -4,4,4,0,0,0,4,0,4,4,0,4,4,4,0x64,4, -0x64,0x64,0,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0, -0,4,0,0x64,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,4,4,4,0,0,4,4, +0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,4,0x64,4,4,4,4,0,0,4, +4,4,4,0,0,0,0,0,0,0,0,0x64,0,0,0,0, +0,0,0,0,0,4,4,4,4,4,4,0,0,4,4,4, +0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4, +4,4,4,4,4,4,4,0,4,0x64,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4, -4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x64,0x64,0x64,0x64,0x64,0,0,0, +4,4,4,0,4,4,4,4,4,4,0,0x64,4,4,4,4, +4,4,4,4,0,0,4,4,4,4,4,4,4,0,4,4, +0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,4,4,4,4,4,4,0,0,0,4,0, +4,4,0,4,4,4,0x64,4,0x64,0x64,0,4,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4, -4,4,4,4,4,4,4,4,4,4,0,4,4,0,0,0, -0,0,0,0,0,0,0,0,0x60,0x60,0,0,0,0,0,0, +0,0,0,0,4,4,0,0,0,4,0,0x64,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,0, +0,0,0,0,4,0x60,0x64,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,0x64,0,0,0,0,0, -0,0x60,0x60,0x64,0x64,0x64,0,0,0,0x60,0x60,0x60,0x60,0x60,0x60,4, -4,4,4,4,4,4,4,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0, -0,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44, -0x44,0x44,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0x44,0x44,0x44,0,0,0,0,0,0,0, +0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,4,4,0,0,0,0,0,0,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x64,0x64,0x64,0x64, +0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,4, +4,0,0,0,0,0,0,0,0,0,0,0,0x60,0x60,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,4,4,4,0,4,4,4,4,4,4,4,0,4,4,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2, +0,0,0,0,0,0,0,0,0,0,0,0,0,4,0x64,0, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0x60,0x60,0x64, +0x64,0x64,0,0,0,0x60,0x60,0x60,0x60,0x60,0x60,4,4,4,4,4, +4,4,4,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,0,0x44,0x44,0x44, +0x44,0x44,0x64,0x64,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1, +1,1,0x21,0x21,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,1,1,1,1,1,1,1,0,0x21,0x21,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1, 1,1,1,1,1,1,0x21,0x21,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,1,1,1,1,1,1,1,0,0x21,0x21, -1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,1,1,1,1,1,1,1,1,0x21,0x21,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,2,0,2,2, -0,0,2,0,0,2,2,0,0,2,2,2,2,0,2,2, -2,2,2,2,2,2,1,1,1,1,0,1,0,1,0x21,0x21, -1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -1,1,1,1,2,2,0,2,2,2,2,0,0,2,2,2, -2,2,2,2,2,0,2,2,2,2,2,2,2,0,1,1, +1,1,1,1,1,1,1,1,2,0,2,2,0,0,2,0, +0,2,2,0,0,2,2,2,2,0,2,2,2,2,2,2, +2,2,1,1,1,1,0,1,0,1,0x21,0x21,1,1,1,1, +0,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, +2,2,0,2,2,2,2,0,0,2,2,2,2,2,2,2, +2,0,2,2,2,2,2,2,2,0,1,1,1,1,1,1, +1,1,0x21,0x21,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,2,2,0,2,2,2,2,0,2,2,2,2, +2,0,2,0,0,0,2,2,2,2,2,2,2,0,1,1, 1,1,1,1,1,1,0x21,0x21,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,2,2,0,2,2,2,2,0, -2,2,2,2,2,0,2,0,0,0,2,2,2,2,2,2, -2,0,1,1,1,1,1,1,1,1,0x21,0x21,1,1,1,1, +1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, -1,1,0,0,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1, +2,2,2,2,2,2,2,2,1,1,1,1,1,1,0,0, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,0,1,1,1,1,1,1,2,2, +1,1,1,0,1,1,1,1,1,1,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1, -1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,1,1,1,0,1,1,1,1,1,1,2,1, +2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +1,1,1,0,1,1,1,1,1,1,2,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4, -4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,4, -4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0, -0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0, -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,4,4,4,4,0,4,4,4, -4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,0x44,0x44,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,0x44, -0x44,0,0x44,0x44,0x44,0x44,0x44,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44, -0x44,0x44,0x44,4,4,4,4,4,4,4,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x64,0x64,0x64,0x64, -0x64,0x64,0x64,0,0,0,0,0,0,0,0,0,0x1112,0x1112,0x1112,0x1112, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,4,4,4,4,0,0,0,0,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0, +0,4,0,0,0,0,0,0,0,0,0,0,4,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,4,4,4,4,4,0,4,4,4,4,4,4,4, +4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0, +0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, +0x44,0,0,0x44,0x44,0x44,0x44,0x44,1,1,1,1,1,1,1,1, +1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,0x21,1,1,1,1,0,0,0,0,0,0,1,1,1, +1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x44,0x44,0,0x44,0x44,0,0x44,0x44, +0x44,0x44,0x44,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x25,5,5,5,5,5,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0x44,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +0x25,0x25,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,4,4,4,4,4, +4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4, +0x64,0x64,0x64,0x44,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,0,0,0,0, +0,0,0,0,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112, 0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112, -0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0xef11,0xef11, +0x1112,0x1112,0x1112,0x1112,0x1112,0x1112,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11, 0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11, -0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0xef11,0x44,0x44,0x44,0x44, -0x44,0x44,0x64,4,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2, -2,2,0,0,0,0,0,0,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0, +0xef11,0xef11,0xef11,0xef11,0x44,0x44,0x44,0x44,0x44,0x44,0x64,4,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0 +2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4, +4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0 }; -static const uint16_t ucase_props_exceptions[1671]={ +static const uint16_t ucase_props_exceptions[1664]={ 0xc850,0x20,2,0x130,0x131,0x4810,0x20,0x841,0x6b,1,0x212a,0x841,0x73,1,0x17f,0x5c50, 0x20,2,0x130,0x131,0x844,0x4b,1,0x212a,0x844,0x53,1,0x17f,0x806,0x3bc,0x39c,0x841, 0xe5,1,0x212b,0x8c0,1,0x2220,0x73,0x73,0x53,0x53,0x53,0x73,0x1e9e,0x844,0xc5,1, @@ -815,88 +862,87 @@ static const uint16_t ucase_props_exceptions[1671]={ 0x43e,1,0x1c82,0x841,0x441,1,0x1c83,0x841,0x442,2,0x1c84,0x1c85,0x841,0x44a,1,0x1c86, 0x844,0x412,1,0x1c80,0x844,0x414,1,0x1c81,0x844,0x41e,1,0x1c82,0x844,0x421,1,0x1c83, 0x844,0x422,2,0x1c84,0x1c85,0x844,0x42a,1,0x1c86,0x841,0x463,1,0x1c87,0x844,0x462,1, -0x1c87,0x880,0x2220,0x565,0x582,0x535,0x552,0x535,0x582,0x810,0x1c60,0x80c,0x1c90,0x10d0,0x80c,0x1c91, -0x10d1,0x80c,0x1c92,0x10d2,0x80c,0x1c93,0x10d3,0x80c,0x1c94,0x10d4,0x80c,0x1c95,0x10d5,0x80c,0x1c96,0x10d6, -0x80c,0x1c97,0x10d7,0x80c,0x1c98,0x10d8,0x80c,0x1c99,0x10d9,0x80c,0x1c9a,0x10da,0x80c,0x1c9b,0x10db,0x80c, -0x1c9c,0x10dc,0x80c,0x1c9d,0x10dd,0x80c,0x1c9e,0x10de,0x80c,0x1c9f,0x10df,0x80c,0x1ca0,0x10e0,0x80c,0x1ca1, -0x10e1,0x80c,0x1ca2,0x10e2,0x80c,0x1ca3,0x10e3,0x80c,0x1ca4,0x10e4,0x80c,0x1ca5,0x10e5,0x80c,0x1ca6,0x10e6, -0x80c,0x1ca7,0x10e7,0x80c,0x1ca8,0x10e8,0x80c,0x1ca9,0x10e9,0x80c,0x1caa,0x10ea,0x80c,0x1cab,0x10eb,0x80c, -0x1cac,0x10ec,0x80c,0x1cad,0x10ed,0x80c,0x1cae,0x10ee,0x80c,0x1caf,0x10ef,0x80c,0x1cb0,0x10f0,0x80c,0x1cb1, -0x10f1,0x80c,0x1cb2,0x10f2,0x80c,0x1cb3,0x10f3,0x80c,0x1cb4,0x10f4,0x80c,0x1cb5,0x10f5,0x80c,0x1cb6,0x10f6, -0x80c,0x1cb7,0x10f7,0x80c,0x1cb8,0x10f8,0x80c,0x1cb9,0x10f9,0x80c,0x1cba,0x10fa,0x80c,0x1cbd,0x10fd,0x80c, -0x1cbe,0x10fe,0x80c,0x1cbf,0x10ff,0xa10,0x97d0,0xa10,8,0x806,0x13f0,0x13f0,0x806,0x13f1,0x13f1,0x806, -0x13f2,0x13f2,0x806,0x13f3,0x13f3,0x806,0x13f4,0x13f4,0x806,0x13f5,0x13f5,0x806,0x432,0x412,0x806,0x434, -0x414,0x806,0x43e,0x41e,0x806,0x441,0x421,0x846,0x442,0x422,1,0x1c85,0x846,0x442,0x422,1, -0x1c84,0x806,0x44a,0x42a,0x806,0x463,0x462,0x806,0xa64b,0xa64a,0xc10,0xbc0,0x810,0x8a04,0x810,0xee6, -0x810,0x8a38,0x841,0x1e61,1,0x1e9b,0x844,0x1e60,1,0x1e9b,0x880,0x2220,0x68,0x331,0x48,0x331, -0x48,0x331,0x880,0x2220,0x74,0x308,0x54,0x308,0x54,0x308,0x880,0x2220,0x77,0x30a,0x57,0x30a, -0x57,0x30a,0x880,0x2220,0x79,0x30a,0x59,0x30a,0x59,0x30a,0x880,0x2220,0x61,0x2be,0x41,0x2be, -0x41,0x2be,0x806,0x1e61,0x1e60,0xc90,0x1dbf,0x20,0x73,0x73,0x880,0x2220,0x3c5,0x313,0x3a5,0x313, -0x3a5,0x313,0x880,0x3330,0x3c5,0x313,0x300,0x3a5,0x313,0x300,0x3a5,0x313,0x300,0x880,0x3330,0x3c5, -0x313,0x301,0x3a5,0x313,0x301,0x3a5,0x313,0x301,0x880,0x3330,0x3c5,0x313,0x342,0x3a5,0x313,0x342, -0x3a5,0x313,0x342,0x890,8,0x220,0x1f00,0x3b9,0x1f08,0x399,0x890,8,0x220,0x1f01,0x3b9,0x1f09, -0x399,0x890,8,0x220,0x1f02,0x3b9,0x1f0a,0x399,0x890,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0x890, -8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0x890,8,0x220,0x1f05,0x3b9,0x1f0d,0x399,0x890,8,0x220, -0x1f06,0x3b9,0x1f0e,0x399,0x890,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0xc90,8,0x220,0x1f00,0x3b9, -0x1f08,0x399,0xc90,8,0x220,0x1f01,0x3b9,0x1f09,0x399,0xc90,8,0x220,0x1f02,0x3b9,0x1f0a,0x399, -0xc90,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0xc90,8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0xc90,8, -0x220,0x1f05,0x3b9,0x1f0d,0x399,0xc90,8,0x220,0x1f06,0x3b9,0x1f0e,0x399,0xc90,8,0x220,0x1f07, -0x3b9,0x1f0f,0x399,0x890,8,0x220,0x1f20,0x3b9,0x1f28,0x399,0x890,8,0x220,0x1f21,0x3b9,0x1f29, -0x399,0x890,8,0x220,0x1f22,0x3b9,0x1f2a,0x399,0x890,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0x890, -8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0x890,8,0x220,0x1f25,0x3b9,0x1f2d,0x399,0x890,8,0x220, -0x1f26,0x3b9,0x1f2e,0x399,0x890,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0xc90,8,0x220,0x1f20,0x3b9, -0x1f28,0x399,0xc90,8,0x220,0x1f21,0x3b9,0x1f29,0x399,0xc90,8,0x220,0x1f22,0x3b9,0x1f2a,0x399, -0xc90,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0xc90,8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0xc90,8, -0x220,0x1f25,0x3b9,0x1f2d,0x399,0xc90,8,0x220,0x1f26,0x3b9,0x1f2e,0x399,0xc90,8,0x220,0x1f27, -0x3b9,0x1f2f,0x399,0x890,8,0x220,0x1f60,0x3b9,0x1f68,0x399,0x890,8,0x220,0x1f61,0x3b9,0x1f69, -0x399,0x890,8,0x220,0x1f62,0x3b9,0x1f6a,0x399,0x890,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0x890, -8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0x890,8,0x220,0x1f65,0x3b9,0x1f6d,0x399,0x890,8,0x220, -0x1f66,0x3b9,0x1f6e,0x399,0x890,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0xc90,8,0x220,0x1f60,0x3b9, -0x1f68,0x399,0xc90,8,0x220,0x1f61,0x3b9,0x1f69,0x399,0xc90,8,0x220,0x1f62,0x3b9,0x1f6a,0x399, -0xc90,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0xc90,8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0xc90,8, -0x220,0x1f65,0x3b9,0x1f6d,0x399,0xc90,8,0x220,0x1f66,0x3b9,0x1f6e,0x399,0xc90,8,0x220,0x1f67, -0x3b9,0x1f6f,0x399,0x880,0x2220,0x1f70,0x3b9,0x1fba,0x399,0x1fba,0x345,0x890,9,0x220,0x3b1,0x3b9, -0x391,0x399,0x880,0x2220,0x3ac,0x3b9,0x386,0x399,0x386,0x345,0x880,0x2220,0x3b1,0x342,0x391,0x342, -0x391,0x342,0x880,0x3330,0x3b1,0x342,0x3b9,0x391,0x342,0x399,0x391,0x342,0x345,0xc90,9,0x220, -0x3b1,0x3b9,0x391,0x399,0x846,0x3b9,0x399,1,0x345,0x880,0x2220,0x1f74,0x3b9,0x1fca,0x399,0x1fca, -0x345,0x890,9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x2220,0x3ae,0x3b9,0x389,0x399,0x389,0x345, -0x880,0x2220,0x3b7,0x342,0x397,0x342,0x397,0x342,0x880,0x3330,0x3b7,0x342,0x3b9,0x397,0x342,0x399, -0x397,0x342,0x345,0xc90,9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x3330,0x3b9,0x308,0x300,0x399, -0x308,0x300,0x399,0x308,0x300,0x8c0,1,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308, -0x301,0x390,0x880,0x2220,0x3b9,0x342,0x399,0x342,0x399,0x342,0x880,0x3330,0x3b9,0x308,0x342,0x399, -0x308,0x342,0x399,0x308,0x342,0x880,0x3330,0x3c5,0x308,0x300,0x3a5,0x308,0x300,0x3a5,0x308,0x300, -0x8c0,1,0x3330,0x3c5,0x308,0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x3b0,0x880,0x2220,0x3c1, -0x313,0x3a1,0x313,0x3a1,0x313,0x880,0x2220,0x3c5,0x342,0x3a5,0x342,0x3a5,0x342,0x880,0x3330,0x3c5, -0x308,0x342,0x3a5,0x308,0x342,0x3a5,0x308,0x342,0x880,0x2220,0x1f7c,0x3b9,0x1ffa,0x399,0x1ffa,0x345, -0x890,9,0x220,0x3c9,0x3b9,0x3a9,0x399,0x880,0x2220,0x3ce,0x3b9,0x38f,0x399,0x38f,0x345,0x880, -0x2220,0x3c9,0x342,0x3a9,0x342,0x3a9,0x342,0x880,0x3330,0x3c9,0x342,0x3b9,0x3a9,0x342,0x399,0x3a9, -0x342,0x345,0xc90,9,0x220,0x3c9,0x3b9,0x3a9,0x399,0xc50,0x1d5d,1,0x3a9,0xc50,0x20bf,1, -0x4b,0xc50,0x2046,1,0xc5,0xc10,0x29f7,0xc10,0xee6,0xc10,0x29e7,0xc10,0x2a2b,0xc10,0x2a28,0xc10, -0x2a1c,0xc10,0x29fd,0xc10,0x2a1f,0xc10,0x2a1e,0xc10,0x2a3f,0xc10,0x1c60,0x841,0xa64b,1,0x1c88,0x844, -0xa64a,1,0x1c88,0xc10,0x8a04,0xc10,0xa528,0xc10,0xa544,0xc10,0xa54f,0xc10,0xa54b,0xc10,0xa541,0xc10, -0xa512,0xc10,0xa52a,0xc10,0xa515,0x810,0x3a0,0xc10,0xa543,0xc10,0x8a38,0xc10,0x3a0,0x806,0x13a0,0x13a0, -0x806,0x13a1,0x13a1,0x806,0x13a2,0x13a2,0x806,0x13a3,0x13a3,0x806,0x13a4,0x13a4,0x806,0x13a5,0x13a5,0x806, -0x13a6,0x13a6,0x806,0x13a7,0x13a7,0x806,0x13a8,0x13a8,0x806,0x13a9,0x13a9,0x806,0x13aa,0x13aa,0x806,0x13ab, -0x13ab,0x806,0x13ac,0x13ac,0x806,0x13ad,0x13ad,0x806,0x13ae,0x13ae,0x806,0x13af,0x13af,0x806,0x13b0,0x13b0, -0x806,0x13b1,0x13b1,0x806,0x13b2,0x13b2,0x806,0x13b3,0x13b3,0x806,0x13b4,0x13b4,0x806,0x13b5,0x13b5,0x806, -0x13b6,0x13b6,0x806,0x13b7,0x13b7,0x806,0x13b8,0x13b8,0x806,0x13b9,0x13b9,0x806,0x13ba,0x13ba,0x806,0x13bb, -0x13bb,0x806,0x13bc,0x13bc,0x806,0x13bd,0x13bd,0x806,0x13be,0x13be,0x806,0x13bf,0x13bf,0x806,0x13c0,0x13c0, -0x806,0x13c1,0x13c1,0x806,0x13c2,0x13c2,0x806,0x13c3,0x13c3,0x806,0x13c4,0x13c4,0x806,0x13c5,0x13c5,0x806, -0x13c6,0x13c6,0x806,0x13c7,0x13c7,0x806,0x13c8,0x13c8,0x806,0x13c9,0x13c9,0x806,0x13ca,0x13ca,0x806,0x13cb, -0x13cb,0x806,0x13cc,0x13cc,0x806,0x13cd,0x13cd,0x806,0x13ce,0x13ce,0x806,0x13cf,0x13cf,0x806,0x13d0,0x13d0, -0x806,0x13d1,0x13d1,0x806,0x13d2,0x13d2,0x806,0x13d3,0x13d3,0x806,0x13d4,0x13d4,0x806,0x13d5,0x13d5,0x806, -0x13d6,0x13d6,0x806,0x13d7,0x13d7,0x806,0x13d8,0x13d8,0x806,0x13d9,0x13d9,0x806,0x13da,0x13da,0x806,0x13db, -0x13db,0x806,0x13dc,0x13dc,0x806,0x13dd,0x13dd,0x806,0x13de,0x13de,0x806,0x13df,0x13df,0x806,0x13e0,0x13e0, -0x806,0x13e1,0x13e1,0x806,0x13e2,0x13e2,0x806,0x13e3,0x13e3,0x806,0x13e4,0x13e4,0x806,0x13e5,0x13e5,0x806, -0x13e6,0x13e6,0x806,0x13e7,0x13e7,0x806,0x13e8,0x13e8,0x806,0x13e9,0x13e9,0x806,0x13ea,0x13ea,0x806,0x13eb, -0x13eb,0x806,0x13ec,0x13ec,0x806,0x13ed,0x13ed,0x806,0x13ee,0x13ee,0x806,0x13ef,0x13ef,0x880,0x2220,0x66, -0x66,0x46,0x46,0x46,0x66,0x880,0x2220,0x66,0x69,0x46,0x49,0x46,0x69,0x880,0x2220,0x66, -0x6c,0x46,0x4c,0x46,0x6c,0x880,0x3330,0x66,0x66,0x69,0x46,0x46,0x49,0x46,0x66,0x69, -0x880,0x3330,0x66,0x66,0x6c,0x46,0x46,0x4c,0x46,0x66,0x6c,0x8c0,1,0x2220,0x73,0x74, -0x53,0x54,0x53,0x74,0xfb06,0x8c0,1,0x2220,0x73,0x74,0x53,0x54,0x53,0x74,0xfb05,0x880, -0x2220,0x574,0x576,0x544,0x546,0x544,0x576,0x880,0x2220,0x574,0x565,0x544,0x535,0x544,0x565,0x880, -0x2220,0x574,0x56b,0x544,0x53b,0x544,0x56b,0x880,0x2220,0x57e,0x576,0x54e,0x546,0x54e,0x576,0x880, -0x2220,0x574,0x56d,0x544,0x53d,0x544,0x56d +0x1c87,0x4880,0x20,0x565,0x582,0x810,0x1c60,0x80c,0x1c90,0x10d0,0x80c,0x1c91,0x10d1,0x80c,0x1c92,0x10d2, +0x80c,0x1c93,0x10d3,0x80c,0x1c94,0x10d4,0x80c,0x1c95,0x10d5,0x80c,0x1c96,0x10d6,0x80c,0x1c97,0x10d7,0x80c, +0x1c98,0x10d8,0x80c,0x1c99,0x10d9,0x80c,0x1c9a,0x10da,0x80c,0x1c9b,0x10db,0x80c,0x1c9c,0x10dc,0x80c,0x1c9d, +0x10dd,0x80c,0x1c9e,0x10de,0x80c,0x1c9f,0x10df,0x80c,0x1ca0,0x10e0,0x80c,0x1ca1,0x10e1,0x80c,0x1ca2,0x10e2, +0x80c,0x1ca3,0x10e3,0x80c,0x1ca4,0x10e4,0x80c,0x1ca5,0x10e5,0x80c,0x1ca6,0x10e6,0x80c,0x1ca7,0x10e7,0x80c, +0x1ca8,0x10e8,0x80c,0x1ca9,0x10e9,0x80c,0x1caa,0x10ea,0x80c,0x1cab,0x10eb,0x80c,0x1cac,0x10ec,0x80c,0x1cad, +0x10ed,0x80c,0x1cae,0x10ee,0x80c,0x1caf,0x10ef,0x80c,0x1cb0,0x10f0,0x80c,0x1cb1,0x10f1,0x80c,0x1cb2,0x10f2, +0x80c,0x1cb3,0x10f3,0x80c,0x1cb4,0x10f4,0x80c,0x1cb5,0x10f5,0x80c,0x1cb6,0x10f6,0x80c,0x1cb7,0x10f7,0x80c, +0x1cb8,0x10f8,0x80c,0x1cb9,0x10f9,0x80c,0x1cba,0x10fa,0x80c,0x1cbd,0x10fd,0x80c,0x1cbe,0x10fe,0x80c,0x1cbf, +0x10ff,0xa10,0x97d0,0xa10,8,0x806,0x13f0,0x13f0,0x806,0x13f1,0x13f1,0x806,0x13f2,0x13f2,0x806,0x13f3, +0x13f3,0x806,0x13f4,0x13f4,0x806,0x13f5,0x13f5,0x806,0x432,0x412,0x806,0x434,0x414,0x806,0x43e,0x41e, +0x806,0x441,0x421,0x846,0x442,0x422,1,0x1c85,0x846,0x442,0x422,1,0x1c84,0x806,0x44a,0x42a, +0x806,0x463,0x462,0x806,0xa64b,0xa64a,0xc10,0xbc0,0x810,0x8a04,0x810,0xee6,0x810,0x8a38,0x841,0x1e61, +1,0x1e9b,0x844,0x1e60,1,0x1e9b,0x880,0x2220,0x68,0x331,0x48,0x331,0x48,0x331,0x880,0x2220, +0x74,0x308,0x54,0x308,0x54,0x308,0x880,0x2220,0x77,0x30a,0x57,0x30a,0x57,0x30a,0x880,0x2220, +0x79,0x30a,0x59,0x30a,0x59,0x30a,0x880,0x2220,0x61,0x2be,0x41,0x2be,0x41,0x2be,0x806,0x1e61, +0x1e60,0xc90,0x1dbf,0x20,0x73,0x73,0x880,0x2220,0x3c5,0x313,0x3a5,0x313,0x3a5,0x313,0x880,0x3330, +0x3c5,0x313,0x300,0x3a5,0x313,0x300,0x3a5,0x313,0x300,0x880,0x3330,0x3c5,0x313,0x301,0x3a5,0x313, +0x301,0x3a5,0x313,0x301,0x880,0x3330,0x3c5,0x313,0x342,0x3a5,0x313,0x342,0x3a5,0x313,0x342,0x890, +8,0x220,0x1f00,0x3b9,0x1f08,0x399,0x890,8,0x220,0x1f01,0x3b9,0x1f09,0x399,0x890,8,0x220, +0x1f02,0x3b9,0x1f0a,0x399,0x890,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0x890,8,0x220,0x1f04,0x3b9, +0x1f0c,0x399,0x890,8,0x220,0x1f05,0x3b9,0x1f0d,0x399,0x890,8,0x220,0x1f06,0x3b9,0x1f0e,0x399, +0x890,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0xc90,8,0x220,0x1f00,0x3b9,0x1f08,0x399,0xc90,8, +0x220,0x1f01,0x3b9,0x1f09,0x399,0xc90,8,0x220,0x1f02,0x3b9,0x1f0a,0x399,0xc90,8,0x220,0x1f03, +0x3b9,0x1f0b,0x399,0xc90,8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0xc90,8,0x220,0x1f05,0x3b9,0x1f0d, +0x399,0xc90,8,0x220,0x1f06,0x3b9,0x1f0e,0x399,0xc90,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0x890, +8,0x220,0x1f20,0x3b9,0x1f28,0x399,0x890,8,0x220,0x1f21,0x3b9,0x1f29,0x399,0x890,8,0x220, +0x1f22,0x3b9,0x1f2a,0x399,0x890,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0x890,8,0x220,0x1f24,0x3b9, +0x1f2c,0x399,0x890,8,0x220,0x1f25,0x3b9,0x1f2d,0x399,0x890,8,0x220,0x1f26,0x3b9,0x1f2e,0x399, +0x890,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0xc90,8,0x220,0x1f20,0x3b9,0x1f28,0x399,0xc90,8, +0x220,0x1f21,0x3b9,0x1f29,0x399,0xc90,8,0x220,0x1f22,0x3b9,0x1f2a,0x399,0xc90,8,0x220,0x1f23, +0x3b9,0x1f2b,0x399,0xc90,8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0xc90,8,0x220,0x1f25,0x3b9,0x1f2d, +0x399,0xc90,8,0x220,0x1f26,0x3b9,0x1f2e,0x399,0xc90,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0x890, +8,0x220,0x1f60,0x3b9,0x1f68,0x399,0x890,8,0x220,0x1f61,0x3b9,0x1f69,0x399,0x890,8,0x220, +0x1f62,0x3b9,0x1f6a,0x399,0x890,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0x890,8,0x220,0x1f64,0x3b9, +0x1f6c,0x399,0x890,8,0x220,0x1f65,0x3b9,0x1f6d,0x399,0x890,8,0x220,0x1f66,0x3b9,0x1f6e,0x399, +0x890,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0xc90,8,0x220,0x1f60,0x3b9,0x1f68,0x399,0xc90,8, +0x220,0x1f61,0x3b9,0x1f69,0x399,0xc90,8,0x220,0x1f62,0x3b9,0x1f6a,0x399,0xc90,8,0x220,0x1f63, +0x3b9,0x1f6b,0x399,0xc90,8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0xc90,8,0x220,0x1f65,0x3b9,0x1f6d, +0x399,0xc90,8,0x220,0x1f66,0x3b9,0x1f6e,0x399,0xc90,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0x880, +0x2220,0x1f70,0x3b9,0x1fba,0x399,0x1fba,0x345,0x890,9,0x220,0x3b1,0x3b9,0x391,0x399,0x880,0x2220, +0x3ac,0x3b9,0x386,0x399,0x386,0x345,0x880,0x2220,0x3b1,0x342,0x391,0x342,0x391,0x342,0x880,0x3330, +0x3b1,0x342,0x3b9,0x391,0x342,0x399,0x391,0x342,0x345,0xc90,9,0x220,0x3b1,0x3b9,0x391,0x399, +0x846,0x3b9,0x399,1,0x345,0x880,0x2220,0x1f74,0x3b9,0x1fca,0x399,0x1fca,0x345,0x890,9,0x220, +0x3b7,0x3b9,0x397,0x399,0x880,0x2220,0x3ae,0x3b9,0x389,0x399,0x389,0x345,0x880,0x2220,0x3b7,0x342, +0x397,0x342,0x397,0x342,0x880,0x3330,0x3b7,0x342,0x3b9,0x397,0x342,0x399,0x397,0x342,0x345,0xc90, +9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x3330,0x3b9,0x308,0x300,0x399,0x308,0x300,0x399,0x308, +0x300,0x882,0x390,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308,0x301,0x880,0x2220,0x3b9, +0x342,0x399,0x342,0x399,0x342,0x880,0x3330,0x3b9,0x308,0x342,0x399,0x308,0x342,0x399,0x308,0x342, +0x880,0x3330,0x3c5,0x308,0x300,0x3a5,0x308,0x300,0x3a5,0x308,0x300,0x882,0x3b0,0x3330,0x3c5,0x308, +0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x880,0x2220,0x3c1,0x313,0x3a1,0x313,0x3a1,0x313,0x880, +0x2220,0x3c5,0x342,0x3a5,0x342,0x3a5,0x342,0x880,0x3330,0x3c5,0x308,0x342,0x3a5,0x308,0x342,0x3a5, +0x308,0x342,0x880,0x2220,0x1f7c,0x3b9,0x1ffa,0x399,0x1ffa,0x345,0x890,9,0x220,0x3c9,0x3b9,0x3a9, +0x399,0x880,0x2220,0x3ce,0x3b9,0x38f,0x399,0x38f,0x345,0x880,0x2220,0x3c9,0x342,0x3a9,0x342,0x3a9, +0x342,0x880,0x3330,0x3c9,0x342,0x3b9,0x3a9,0x342,0x399,0x3a9,0x342,0x345,0xc90,9,0x220,0x3c9, +0x3b9,0x3a9,0x399,0xc50,0x1d5d,1,0x3a9,0xc50,0x20bf,1,0x4b,0xc50,0x2046,1,0xc5,0xc10, +0x29f7,0xc10,0xee6,0xc10,0x29e7,0xc10,0x2a2b,0xc10,0x2a28,0xc10,0x2a1c,0xc10,0x29fd,0xc10,0x2a1f,0xc10, +0x2a1e,0xc10,0x2a3f,0xc10,0x1c60,0x841,0xa64b,1,0x1c88,0x844,0xa64a,1,0x1c88,0xc10,0x8a04,0xc10, +0xa528,0xc10,0xa544,0xc10,0xa54f,0xc10,0xa54b,0xc10,0xa541,0xc10,0xa512,0xc10,0xa52a,0xc10,0xa515,0x810, +0x3a0,0xc10,0xa543,0xc10,0x8a38,0xc10,0x3a0,0x806,0x13a0,0x13a0,0x806,0x13a1,0x13a1,0x806,0x13a2,0x13a2, +0x806,0x13a3,0x13a3,0x806,0x13a4,0x13a4,0x806,0x13a5,0x13a5,0x806,0x13a6,0x13a6,0x806,0x13a7,0x13a7,0x806, +0x13a8,0x13a8,0x806,0x13a9,0x13a9,0x806,0x13aa,0x13aa,0x806,0x13ab,0x13ab,0x806,0x13ac,0x13ac,0x806,0x13ad, +0x13ad,0x806,0x13ae,0x13ae,0x806,0x13af,0x13af,0x806,0x13b0,0x13b0,0x806,0x13b1,0x13b1,0x806,0x13b2,0x13b2, +0x806,0x13b3,0x13b3,0x806,0x13b4,0x13b4,0x806,0x13b5,0x13b5,0x806,0x13b6,0x13b6,0x806,0x13b7,0x13b7,0x806, +0x13b8,0x13b8,0x806,0x13b9,0x13b9,0x806,0x13ba,0x13ba,0x806,0x13bb,0x13bb,0x806,0x13bc,0x13bc,0x806,0x13bd, +0x13bd,0x806,0x13be,0x13be,0x806,0x13bf,0x13bf,0x806,0x13c0,0x13c0,0x806,0x13c1,0x13c1,0x806,0x13c2,0x13c2, +0x806,0x13c3,0x13c3,0x806,0x13c4,0x13c4,0x806,0x13c5,0x13c5,0x806,0x13c6,0x13c6,0x806,0x13c7,0x13c7,0x806, +0x13c8,0x13c8,0x806,0x13c9,0x13c9,0x806,0x13ca,0x13ca,0x806,0x13cb,0x13cb,0x806,0x13cc,0x13cc,0x806,0x13cd, +0x13cd,0x806,0x13ce,0x13ce,0x806,0x13cf,0x13cf,0x806,0x13d0,0x13d0,0x806,0x13d1,0x13d1,0x806,0x13d2,0x13d2, +0x806,0x13d3,0x13d3,0x806,0x13d4,0x13d4,0x806,0x13d5,0x13d5,0x806,0x13d6,0x13d6,0x806,0x13d7,0x13d7,0x806, +0x13d8,0x13d8,0x806,0x13d9,0x13d9,0x806,0x13da,0x13da,0x806,0x13db,0x13db,0x806,0x13dc,0x13dc,0x806,0x13dd, +0x13dd,0x806,0x13de,0x13de,0x806,0x13df,0x13df,0x806,0x13e0,0x13e0,0x806,0x13e1,0x13e1,0x806,0x13e2,0x13e2, +0x806,0x13e3,0x13e3,0x806,0x13e4,0x13e4,0x806,0x13e5,0x13e5,0x806,0x13e6,0x13e6,0x806,0x13e7,0x13e7,0x806, +0x13e8,0x13e8,0x806,0x13e9,0x13e9,0x806,0x13ea,0x13ea,0x806,0x13eb,0x13eb,0x806,0x13ec,0x13ec,0x806,0x13ed, +0x13ed,0x806,0x13ee,0x13ee,0x806,0x13ef,0x13ef,0x880,0x2220,0x66,0x66,0x46,0x46,0x46,0x66,0x880, +0x2220,0x66,0x69,0x46,0x49,0x46,0x69,0x880,0x2220,0x66,0x6c,0x46,0x4c,0x46,0x6c,0x880, +0x3330,0x66,0x66,0x69,0x46,0x46,0x49,0x46,0x66,0x69,0x880,0x3330,0x66,0x66,0x6c,0x46, +0x46,0x4c,0x46,0x66,0x6c,0x882,0xfb06,0x2220,0x73,0x74,0x53,0x54,0x53,0x74,0x8c0,1, +0x2220,0x73,0x74,0x53,0x54,0x53,0x74,0xfb05,0x880,0x2220,0x574,0x576,0x544,0x546,0x544,0x576, +0x880,0x2220,0x574,0x565,0x544,0x535,0x544,0x565,0x880,0x2220,0x574,0x56b,0x544,0x53b,0x544,0x56b, +0x880,0x2220,0x57e,0x576,0x54e,0x546,0x54e,0x576,0x880,0x2220,0x574,0x56d,0x544,0x53d,0x544,0x56d }; static const uint16_t ucase_props_unfold[370]={ @@ -927,23 +973,23 @@ static const uint16_t ucase_props_unfold[370]={ }; static const UCaseProps ucase_props_singleton={ - NULL, + nullptr, ucase_props_indexes, ucase_props_exceptions, ucase_props_unfold, { ucase_props_trieIndex, - ucase_props_trieIndex+3288, - NULL, - 3288, - 9068, + ucase_props_trieIndex+3412, + nullptr, + 3412, + 9736, 0x188, - 0xd54, + 0xdd0, 0x0, 0x0, 0xe0800, - 0x3040, - NULL, 0, FALSE, FALSE, 0, NULL + 0x3358, + nullptr, 0, false, false, 0, nullptr }, { 4,0,0,0 } }; diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucasemap.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucasemap.cpp index fd5d45ee9..f6a0106ae 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucasemap.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucasemap.cpp @@ -49,7 +49,7 @@ U_NAMESPACE_USE UCaseMap::UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode) : #if !UCONFIG_NO_BREAK_ITERATION - iter(NULL), + iter(nullptr), #endif caseLocale(UCASE_LOC_UNKNOWN), options(opts) { ucasemap_setLocale(this, localeID, pErrorCode); @@ -64,15 +64,15 @@ UCaseMap::~UCaseMap() { U_CAPI UCaseMap * U_EXPORT2 ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } UCaseMap *csm = new UCaseMap(locale, options, pErrorCode); - if(csm==NULL) { + if(csm==nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } else if (U_FAILURE(*pErrorCode)) { delete csm; - return NULL; + return nullptr; } return csm; } @@ -97,7 +97,7 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return; } - if (locale != NULL && *locale == 0) { + if (locale != nullptr && *locale == 0) { csm->locale[0] = 0; csm->caseLocale = UCASE_LOC_ROOT; return; @@ -112,8 +112,7 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) { if(length==sizeof(csm->locale)) { *pErrorCode=U_BUFFER_OVERFLOW_ERROR; } - if(U_SUCCESS(*pErrorCode)) { - csm->caseLocale=UCASE_LOC_UNKNOWN; + if(U_SUCCESS(*pErrorCode)) { csm->caseLocale = ucase_getCaseLocale(csm->locale); } else { csm->locale[0]=0; @@ -137,14 +136,14 @@ namespace { /* append a full case mapping result, see UCASE_MAX_STRING_LENGTH */ inline UBool -appendResult(int32_t cpLength, int32_t result, const UChar *s, +appendResult(int32_t cpLength, int32_t result, const char16_t *s, ByteSink &sink, uint32_t options, icu::Edits *edits, UErrorCode &errorCode) { U_ASSERT(U_SUCCESS(errorCode)); /* decode the result */ if(result<0) { /* (not) original code point */ - if(edits!=NULL) { + if(edits!=nullptr) { edits->addUnchanged(cpLength); } if((options & U_OMIT_UNCHANGED_TEXT) == 0) { @@ -158,12 +157,12 @@ appendResult(int32_t cpLength, int32_t result, const UChar *s, ByteSinkUtil::appendCodePoint(cpLength, result, sink, edits); } } - return TRUE; + return true; } // See unicode/utf8.h U8_APPEND_UNSAFE(). -uint8_t ucasemap_getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); } -uint8_t ucasemap_getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); } +inline uint8_t getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); } +inline uint8_t getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); } UChar32 U_CALLCONV utf8_caseContextIterator(void *context, int8_t dir) { @@ -293,7 +292,7 @@ void toLower(int32_t caseLocale, uint32_t options, break; } // slow path - const UChar *s; + const char16_t *s; if (caseLocale >= 0) { csc->cpStart = cpStart; csc->cpLimit = srcIndex; @@ -403,7 +402,7 @@ void toUpper(int32_t caseLocale, uint32_t options, // slow path csc->cpStart = cpStart; csc->cpLimit = srcIndex; - const UChar *s; + const char16_t *s; c = ucase_toFullUpper(c, utf8_caseContextIterator, csc, &s, caseLocale); if (c >= 0) { ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev, @@ -420,6 +419,97 @@ void toUpper(int32_t caseLocale, uint32_t options, #if !UCONFIG_NO_BREAK_ITERATION +namespace { + +constexpr uint8_t ACUTE_BYTE0 = u8"\u0301"[0]; + +constexpr uint8_t ACUTE_BYTE1 = u8"\u0301"[1]; + +/** + * Input: c is a letter I with or without acute accent. + * start is the index in src after c, and is less than segmentLimit. + * If a plain i/I is followed by a plain j/J, + * or an i/I with acute (precomposed or decomposed) is followed by a j/J with acute, + * then we output accordingly. + * + * @return the src index after the titlecased sequence, or the start index if no Dutch IJ + */ +int32_t maybeTitleDutchIJ(const uint8_t *src, UChar32 c, int32_t start, int32_t segmentLimit, + ByteSink &sink, uint32_t options, icu::Edits *edits, UErrorCode &errorCode) { + U_ASSERT(start < segmentLimit); + + int32_t index = start; + bool withAcute = false; + + // If the conditions are met, then the following variables tell us what to output. + int32_t unchanged1 = 0; // code units before the j, or the whole sequence (0..3) + bool doTitleJ = false; // true if the j needs to be titlecased + int32_t unchanged2 = 0; // after the j (0 or 1) + + // next character after the first letter + UChar32 c2; + c2 = src[index++]; + + // Is the first letter an i/I with accent? + if (c == u'I') { + if (c2 == ACUTE_BYTE0 && index < segmentLimit && src[index++] == ACUTE_BYTE1) { + withAcute = true; + unchanged1 = 2; // ACUTE is 2 code units in UTF-8 + if (index == segmentLimit) { return start; } + c2 = src[index++]; + } + } else { // Í + withAcute = true; + } + + // Is the next character a j/J? + if (c2 == u'j') { + doTitleJ = true; + } else if (c2 == u'J') { + ++unchanged1; + } else { + return start; + } + + // A plain i/I must be followed by a plain j/J. + // An i/I with acute must be followed by a j/J with acute. + if (withAcute) { + if ((index + 1) >= segmentLimit || src[index++] != ACUTE_BYTE0 || src[index++] != ACUTE_BYTE1) { + return start; + } + if (doTitleJ) { + unchanged2 = 2; // ACUTE is 2 code units in UTF-8 + } else { + unchanged1 = unchanged1 + 2; // ACUTE is 2 code units in UTF-8 + } + } + + // There must not be another combining mark. + if (index < segmentLimit) { + int32_t cp; + int32_t i = index; + U8_NEXT(src, i, segmentLimit, cp); + uint32_t typeMask = U_GET_GC_MASK(cp); + if ((typeMask & U_GC_M_MASK) != 0) { + return start; + } + } + + // Output the rest of the Dutch IJ. + ByteSinkUtil::appendUnchanged(src + start, unchanged1, sink, options, edits, errorCode); + start += unchanged1; + if (doTitleJ) { + ByteSinkUtil::appendCodePoint(1, u'J', sink, edits); + ++start; + } + ByteSinkUtil::appendUnchanged(src + start, unchanged2, sink, options, edits, errorCode); + + U_ASSERT(start + unchanged2 == index); + return index; +} + +} // namespace + U_CFUNC void U_CALLCONV ucasemap_internalUTF8ToTitle( int32_t caseLocale, uint32_t options, BreakIterator *iter, @@ -435,14 +525,14 @@ ucasemap_internalUTF8ToTitle( csc.p=(void *)src; csc.limit=srcLength; int32_t prev=0; - UBool isFirstIndex=TRUE; + UBool isFirstIndex=true; /* titlecasing loop */ while(prevfirst(); } else { index=iter->next(); @@ -490,7 +580,7 @@ ucasemap_internalUTF8ToTitle( if(c>=0) { csc.cpStart=titleStart; csc.cpLimit=titleLimit; - const UChar *s; + const char16_t *s; c=ucase_toFullTitle(c, utf8_caseContextIterator, &csc, &s, caseLocale); if (!appendResult(titleLimit-titleStart, c, s, sink, options, edits, errorCode)) { return; @@ -504,19 +594,14 @@ ucasemap_internalUTF8ToTitle( } /* Special case Dutch IJ titlecasing */ - if (titleStart+1 < index && - caseLocale == UCASE_LOC_DUTCH && - (src[titleStart] == 0x0049 || src[titleStart] == 0x0069)) { - if (src[titleStart+1] == 0x006A) { - ByteSinkUtil::appendCodePoint(1, 0x004A, sink, edits); - titleLimit++; - } else if (src[titleStart+1] == 0x004A) { - // Keep the capital J from getting lowercased. - if (!ByteSinkUtil::appendUnchanged(src+titleStart+1, 1, - sink, options, edits, errorCode)) { - return; - } - titleLimit++; + if (titleLimit < index && + caseLocale == UCASE_LOC_DUTCH) { + if (c < 0) { + c = ~c; + } + + if (c == u'I' || c == u'Í') { + titleLimit = maybeTitleDutchIJ(src, c, titleLimit, index, sink, options, edits, errorCode); } } @@ -558,12 +643,12 @@ UBool isFollowedByCasedLetter(const uint8_t *s, int32_t i, int32_t length) { if ((type & UCASE_IGNORABLE) != 0) { // Case-ignorable, continue with the loop. } else if (type != UCASE_NONE) { - return TRUE; // Followed by cased letter. + return true; // Followed by cased letter. } else { - return FALSE; // Uncased and not case-ignorable. + return false; // Uncased and not case-ignorable. } } - return FALSE; // Not followed by cased letter. + return false; // Not followed by cased letter. } // Keep this consistent with the UTF-16 version in ustrcase.cpp and the Java version in CaseMap.java. @@ -594,14 +679,18 @@ void toUpper(uint32_t options, // Adding one only to the final vowel in a longer sequence // (which does not occur in normal writing) would require lookahead. // Set the same flag as for preserving an existing dialytika. - if ((data & HAS_VOWEL) != 0 && (state & AFTER_VOWEL_WITH_ACCENT) != 0 && - (upper == 0x399 || upper == 0x3A5)) { - data |= HAS_DIALYTIKA; + if ((data & HAS_VOWEL) != 0 && + (state & (AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT | AFTER_VOWEL_WITH_COMBINING_ACCENT)) != + 0 && + (upper == 0x399 || upper == 0x3A5)) { + data |= (state & AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT) != 0 ? HAS_DIALYTIKA + : HAS_COMBINING_DIALYTIKA; } int32_t numYpogegrammeni = 0; // Map each one to a trailing, spacing, capital iota. if ((data & HAS_YPOGEGRAMMENI) != 0) { numYpogegrammeni = 1; } + const UBool hasPrecomposedAccent = (data & HAS_ACCENT) != 0; // Skip combining diacritics after this Greek letter. int32_t nextNextIndex = nextIndex; while (nextIndex < srcLength) { @@ -619,10 +708,11 @@ void toUpper(uint32_t options, } } if ((data & HAS_VOWEL_AND_ACCENT_AND_DIALYTIKA) == HAS_VOWEL_AND_ACCENT) { - nextState |= AFTER_VOWEL_WITH_ACCENT; + nextState |= hasPrecomposedAccent ? AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT + : AFTER_VOWEL_WITH_COMBINING_ACCENT; } // Map according to Greek rules. - UBool addTonos = FALSE; + UBool addTonos = false; if (upper == 0x397 && (data & HAS_ACCENT) != 0 && numYpogegrammeni == 0 && @@ -630,10 +720,10 @@ void toUpper(uint32_t options, !isFollowedByCasedLetter(src, nextIndex, srcLength)) { // Keep disjunctive "or" with (only) a tonos. // We use the same "word boundary" conditions as for the Final_Sigma test. - if (i == nextIndex) { + if (hasPrecomposedAccent) { upper = 0x389; // Preserve the precomposed form. } else { - addTonos = TRUE; + addTonos = true; } } else if ((data & HAS_DIALYTIKA) != 0) { // Preserve a vowel with dialytika in precomposed form if it exists. @@ -648,12 +738,12 @@ void toUpper(uint32_t options, UBool change; if (edits == nullptr && (options & U_OMIT_UNCHANGED_TEXT) == 0) { - change = TRUE; // common, simple usage + change = true; // common, simple usage } else { // Find out first whether we are changing the text. U_ASSERT(0x370 <= upper && upper <= 0x3ff); // 2-byte UTF-8, main Greek block change = (i + 2) > nextIndex || - src[i] != ucasemap_getTwoByteLead(upper) || src[i + 1] != ucasemap_getTwoByteTrail(upper) || + src[i] != getTwoByteLead(upper) || src[i + 1] != getTwoByteTrail(upper) || numYpogegrammeni > 0; int32_t i2 = i + 2; if ((data & HAS_EITHER_DIALYTIKA) != 0) { @@ -672,11 +762,11 @@ void toUpper(uint32_t options, int32_t newLength = (i2 - i) + numYpogegrammeni * 2; // 2 bytes per U+0399 change |= oldLength != newLength; if (change) { - if (edits != NULL) { + if (edits != nullptr) { edits->addReplace(oldLength, newLength); } } else { - if (edits != NULL) { + if (edits != nullptr) { edits->addUnchanged(oldLength); } // Write unchanged text? @@ -687,19 +777,19 @@ void toUpper(uint32_t options, if (change) { ByteSinkUtil::appendTwoBytes(upper, sink); if ((data & HAS_EITHER_DIALYTIKA) != 0) { - sink.Append(reinterpret_cast(u8"\u0308"), 2); // restore or add a dialytika + sink.AppendU8(u8"\u0308", 2); // restore or add a dialytika } if (addTonos) { - sink.Append(reinterpret_cast(u8"\u0301"), 2); + sink.AppendU8(u8"\u0301", 2); } while (numYpogegrammeni > 0) { - sink.Append(reinterpret_cast(u8"\u0399"), 2); + sink.AppendU8(u8"\u0399", 2); --numYpogegrammeni; } } } else if(c>=0) { - const UChar *s; - c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK); + const char16_t *s; + c=ucase_toFullUpper(c, nullptr, nullptr, &s, UCASE_LOC_GREEK); if (!appendResult(nextIndex - i, c, s, sink, options, edits, errorCode)) { return; } @@ -806,8 +896,8 @@ ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_P return 0; } if( destCapacity<0 || - (dest==NULL && destCapacity>0) || - (src==NULL && srcLength!=0) || srcLength<-1 + (dest==nullptr && destCapacity>0) || + (src==nullptr && srcLength!=0) || srcLength<-1 ) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; @@ -819,7 +909,7 @@ ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_P } /* check for overlapping source and destination */ - if( dest!=NULL && + if( dest!=nullptr && ((src>=dest && src<(dest+destCapacity)) || (dest>=src && dest<(src+srcLength))) ) { @@ -855,7 +945,7 @@ ucasemap_utf8ToLower(const UCaseMap *csm, csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL dest, destCapacity, src, srcLength, - ucasemap_internalUTF8ToLower, NULL, *pErrorCode); + ucasemap_internalUTF8ToLower, nullptr, *pErrorCode); } U_CAPI int32_t U_EXPORT2 @@ -867,7 +957,7 @@ ucasemap_utf8ToUpper(const UCaseMap *csm, csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL dest, destCapacity, src, srcLength, - ucasemap_internalUTF8ToUpper, NULL, *pErrorCode); + ucasemap_internalUTF8ToUpper, nullptr, *pErrorCode); } U_CAPI int32_t U_EXPORT2 @@ -879,7 +969,7 @@ ucasemap_utf8FoldCase(const UCaseMap *csm, UCASE_LOC_ROOT, csm->options, UCASEMAP_BREAK_ITERATOR_NULL dest, destCapacity, src, srcLength, - ucasemap_internalUTF8Fold, NULL, *pErrorCode); + ucasemap_internalUTF8Fold, nullptr, *pErrorCode); } U_NAMESPACE_BEGIN diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucasemap_imp.h b/src/duckdb/extension/icu/third_party/icu/common/ucasemap_imp.h index 7788fd937..bc83c6bd7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucasemap_imp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucasemap_imp.h @@ -68,15 +68,15 @@ class BreakIterator; // unicode/brkiter.h class ByteSink; class Locale; // unicode/locid.h -/** Returns TRUE if the options are valid. Otherwise FALSE, and sets an error. */ +/** Returns true if the options are valid. Otherwise false, and sets an error. */ inline UBool ustrcase_checkTitleAdjustmentOptions(uint32_t options, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return FALSE; } + if (U_FAILURE(errorCode)) { return false; } if ((options & U_TITLECASE_ADJUSTMENT_MASK) == U_TITLECASE_ADJUSTMENT_MASK) { // Both options together. errorCode = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } - return TRUE; + return true; } inline UBool ustrcase_isLNS(UChar32 c) { @@ -139,16 +139,16 @@ ustrcase_getCaseLocale(const char *locale); /** Implements UStringCaseMapper. */ U_CFUNC int32_t U_CALLCONV ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode); /** Implements UStringCaseMapper. */ U_CFUNC int32_t U_CALLCONV ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode); @@ -158,8 +158,8 @@ ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_IT U_CFUNC int32_t U_CALLCONV ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, icu::BreakIterator *iter, - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode); @@ -168,8 +168,8 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, /** Implements UStringCaseMapper. */ U_CFUNC int32_t U_CALLCONV ustrcase_internalFold(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode); @@ -179,8 +179,8 @@ ustrcase_internalFold(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERA */ U_CFUNC int32_t ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, UStringCaseMapper *stringCaseMapper, icu::Edits *edits, UErrorCode &errorCode); @@ -192,8 +192,8 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM */ U_CFUNC int32_t ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, UStringCaseMapper *stringCaseMapper, UErrorCode &errorCode); @@ -263,7 +263,8 @@ static const uint32_t HAS_EITHER_DIALYTIKA = HAS_DIALYTIKA | HAS_COMBINING_DIALY // State bits. static const uint32_t AFTER_CASED = 1; -static const uint32_t AFTER_VOWEL_WITH_ACCENT = 2; +static const uint32_t AFTER_VOWEL_WITH_COMBINING_ACCENT = 2; +static const uint32_t AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT = 4; uint32_t getLetterData(UChar32 c); diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucasemap_titlecase_brkiter.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucasemap_titlecase_brkiter.cpp deleted file mode 100644 index 2cba58fad..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucasemap_titlecase_brkiter.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * Copyright (C) 2011, International Business Machines -// * Corporation and others. All Rights Reserved. -// ******************************************************************************* -// * file name: ucasemap_titlecase_brkiter.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2011jun02 -// * created by: Markus W. Scherer -// * -// * Titlecasing functions that are based on BreakIterator -// * were moved here to break dependency cycles among parts of the common library. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/brkiter.h" -// #include "unicode/ubrk.h" -// #include "unicode/casemap.h" -// #include "unicode/ucasemap.h" -// #include "cmemory.h" -// #include "ucase.h" -// #include "ucasemap_imp.h" - -// U_NAMESPACE_BEGIN - -// void CaseMap::utf8ToTitle( -// const char *locale, uint32_t options, BreakIterator *iter, -// StringPiece src, ByteSink &sink, Edits *edits, -// UErrorCode &errorCode) { -// if (U_FAILURE(errorCode)) { -// return; -// } -// UText utext = UTEXT_INITIALIZER; -// utext_openUTF8(&utext, src.data(), src.length(), &errorCode); -// LocalPointer ownedIter; -// iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode); -// if (iter == nullptr) { -// utext_close(&utext); -// return; -// } -// iter->setText(&utext, errorCode); -// ucasemap_mapUTF8( -// ustrcase_getCaseLocale(locale), options, iter, -// src.data(), src.length(), -// ucasemap_internalUTF8ToTitle, sink, edits, errorCode); -// utext_close(&utext); -// } - -// int32_t CaseMap::utf8ToTitle( -// const char *locale, uint32_t options, BreakIterator *iter, -// const char *src, int32_t srcLength, -// char *dest, int32_t destCapacity, Edits *edits, -// UErrorCode &errorCode) { -// if (U_FAILURE(errorCode)) { -// return 0; -// } -// UText utext=UTEXT_INITIALIZER; -// utext_openUTF8(&utext, src, srcLength, &errorCode); -// LocalPointer ownedIter; -// iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode); -// if(iter==NULL) { -// utext_close(&utext); -// return 0; -// } -// iter->setText(&utext, errorCode); -// int32_t length=ucasemap_mapUTF8( -// ustrcase_getCaseLocale(locale), options, iter, -// dest, destCapacity, -// src, srcLength, -// ucasemap_internalUTF8ToTitle, edits, errorCode); -// utext_close(&utext); -// return length; -// } - -// U_NAMESPACE_END - -// U_NAMESPACE_USE - -// U_CAPI const UBreakIterator * U_EXPORT2 -// ucasemap_getBreakIterator(const UCaseMap *csm) { -// return reinterpret_cast(csm->iter); -// } - -// U_CAPI void U_EXPORT2 -// ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode) { -// if(U_FAILURE(*pErrorCode)) { -// return; -// } -// delete csm->iter; -// csm->iter=reinterpret_cast(iterToAdopt); -// } - -// U_CAPI int32_t U_EXPORT2 -// ucasemap_utf8ToTitle(UCaseMap *csm, -// char *dest, int32_t destCapacity, -// const char *src, int32_t srcLength, -// UErrorCode *pErrorCode) { -// if (U_FAILURE(*pErrorCode)) { -// return 0; -// } -// UText utext=UTEXT_INITIALIZER; -// utext_openUTF8(&utext, (const char *)src, srcLength, pErrorCode); -// if (U_FAILURE(*pErrorCode)) { -// return 0; -// } -// if(csm->iter==NULL) { -// LocalPointer ownedIter; -// BreakIterator *iter = ustrcase_getTitleBreakIterator( -// nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode); -// if (iter == nullptr) { -// utext_close(&utext); -// return 0; -// } -// csm->iter = ownedIter.orphan(); -// } -// csm->iter->setText(&utext, *pErrorCode); -// int32_t length=ucasemap_mapUTF8( -// csm->caseLocale, csm->options, csm->iter, -// dest, destCapacity, -// src, srcLength, -// ucasemap_internalUTF8ToTitle, NULL, *pErrorCode); -// utext_close(&utext); -// return length; -// } - -// #endif // !UCONFIG_NO_BREAK_ITERATION diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucat.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucat.cpp index 4929e3504..2f7fdcd98 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucat.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucat.cpp @@ -43,33 +43,33 @@ u_catopen(const char* name, const char* locale, UErrorCode* ec) { U_CAPI void U_EXPORT2 u_catclose(u_nl_catd catd) { - ures_close((UResourceBundle*) catd); /* may be NULL */ + ures_close((UResourceBundle*) catd); /* may be nullptr */ } -U_CAPI const UChar* U_EXPORT2 +U_CAPI const char16_t* U_EXPORT2 u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num, - const UChar* s, + const char16_t* s, int32_t* len, UErrorCode* ec) { char key[MAX_KEY_LEN]; - const UChar* result; + const char16_t* result; - if (ec == NULL || U_FAILURE(*ec)) { - goto ucat_ERROR; + if (ec == nullptr || U_FAILURE(*ec)) { + goto ERROR; } result = ures_getStringByKey((const UResourceBundle*) catd, _catkey(key, set_num, msg_num), len, ec); if (U_FAILURE(*ec)) { - goto ucat_ERROR; + goto ERROR; } return result; - ucat_ERROR: + ERROR: /* In case of any failure, return s */ - if (len != NULL) { + if (len != nullptr) { *len = u_strlen(s); } return s; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uchar.cpp b/src/duckdb/extension/icu/third_party/icu/common/uchar.cpp index c8c197c8f..ff12962ba 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uchar.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uchar.cpp @@ -14,7 +14,7 @@ * 04/02/97 aliu Creation. * 4/15/99 Madhu Updated all the function definitions for C Implementation * 5/20/99 Madhu Added the function u_getVersion() -* 8/19/1999 srl Upgraded scripts to Unicode3.0 +* 8/19/1999 srl Upgraded scripts to Unicode3.0 * 11/11/1999 weiv added u_isalnum(), cleaned comments * 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion. * 06/20/2000 helena OS/400 port changes; mostly typecast. @@ -76,7 +76,7 @@ U_CAPI void U_EXPORT2 u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context) { struct _EnumTypeCallback callback; - if(enumRange==NULL) { + if(enumRange==nullptr) { return; } @@ -126,7 +126,7 @@ u_isxdigit(UChar32 c) { (c<=0x66 && c>=0x41 && (c<=0x46 || c>=0x61)) || (c>=0xff21 && c<=0xff46 && (c<=0xff26 || c>=0xff41)) ) { - return TRUE; + return true; } GET_PROPS(c, props); @@ -194,11 +194,11 @@ u_isISOControl(UChar32 c) { /* Some control characters that are used as space. */ #define IS_THAT_CONTROL_SPACE(c) \ - (c<=0x9f && ((c>=uprops_TAB && c<=uprops_CR) || (c>=0x1c && c <=0x1f) || c==uprops_NL)) + (c<=0x9f && ((c>=TAB && c<=CR) || (c>=0x1c && c <=0x1f) || c==0x85)) /* Java has decided that U+0085 New Line is not whitespace any more. */ #define IS_THAT_ASCII_CONTROL_SPACE(c) \ - (c<=0x1f && c>=uprops_TAB && (c<=uprops_CR || c>=0x1c)) + (c<=0x1f && c>=TAB && (c<=CR || c>=0x1c)) /* Checks if the Unicode character is a space character.*/ U_CAPI UBool U_EXPORT2 @@ -222,7 +222,7 @@ u_isWhitespace(UChar32 c) { GET_PROPS(c, props); return (UBool)( ((CAT_MASK(props)&U_GC_Z_MASK)!=0 && - c!=uprops_NBSP && c!=uprops_FIGURESP && c!=uprops_NNBSP) || /* exclude no-break spaces */ + c!=NBSP && c!=FIGURESP && c!=NNBSP) || /* exclude no-break spaces */ IS_THAT_ASCII_CONTROL_SPACE(c) ); } @@ -230,7 +230,7 @@ u_isWhitespace(UChar32 c) { U_CAPI UBool U_EXPORT2 u_isblank(UChar32 c) { if((uint32_t)c<=0x9f) { - return c==9 || c==0x20; /* uprops_TAB or SPACE */ + return c==9 || c==0x20; /* TAB or SPACE */ } else { /* Zs */ uint32_t props; @@ -249,7 +249,7 @@ U_CAPI UBool U_EXPORT2 u_isprint(UChar32 c) { uint32_t props; GET_PROPS(c, props); - /* comparing ==0 returns FALSE for the categories mentioned */ + /* comparing ==0 returns false for the categories mentioned */ return (UBool)((CAT_MASK(props)&U_GC_C_MASK)==0); } @@ -263,8 +263,8 @@ u_isprintPOSIX(UChar32 c) { uint32_t props; GET_PROPS(c, props); /* - * The only cntrl character in graph+blank is uprops_TAB (in blank). - * Here we implement (blank-uprops_TAB)=Zs instead of calling u_isblank(). + * The only cntrl character in graph+blank is TAB (in blank). + * Here we implement (blank-TAB)=Zs instead of calling u_isblank(). */ return (UBool)((GET_CATEGORY(props)==U_SPACE_SEPARATOR) || u_isgraphPOSIX(c)); } @@ -273,7 +273,7 @@ U_CAPI UBool U_EXPORT2 u_isgraph(UChar32 c) { uint32_t props; GET_PROPS(c, props); - /* comparing ==0 returns FALSE for the categories mentioned */ + /* comparing ==0 returns false for the categories mentioned */ return (UBool)((CAT_MASK(props)& (U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK)) ==0); @@ -291,7 +291,7 @@ u_isgraphPOSIX(UChar32 c) { uint32_t props; GET_PROPS(c, props); /* \p{space}\p{gc=Control} == \p{gc=Z}\p{Control} */ - /* comparing ==0 returns FALSE for the categories mentioned */ + /* comparing ==0 returns false for the categories mentioned */ return (UBool)((CAT_MASK(props)& (U_GC_CC_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK)) ==0); @@ -304,30 +304,6 @@ u_ispunct(UChar32 c) { return (UBool)((CAT_MASK(props)&U_GC_P_MASK)!=0); } -/* Checks if the Unicode character can start a Unicode identifier.*/ -U_CAPI UBool U_EXPORT2 -u_isIDStart(UChar32 c) { - /* same as u_isalpha() */ - uint32_t props; - GET_PROPS(c, props); - return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_NL_MASK))!=0); -} - -/* Checks if the Unicode character can be a Unicode identifier part other than starting the - identifier.*/ -U_CAPI UBool U_EXPORT2 -u_isIDPart(UChar32 c) { - uint32_t props; - GET_PROPS(c, props); - return (UBool)( - (CAT_MASK(props)& - (U_GC_ND_MASK|U_GC_NL_MASK| - U_GC_L_MASK| - U_GC_PC_MASK|U_GC_MC_MASK|U_GC_MN_MASK) - )!=0 || - u_isIDIgnorable(c)); -} - /*Checks if the Unicode character can be ignorable in a Java or Unicode identifier.*/ U_CAPI UBool U_EXPORT2 u_isIDIgnorable(UChar32 c) { @@ -509,7 +485,7 @@ u_forDigit(int32_t digit, int8_t radix) { U_CAPI void U_EXPORT2 u_getUnicodeVersion(UVersionInfo versionArray) { - if(versionArray!=NULL) { + if(versionArray!=nullptr) { uprv_memcpy(versionArray, dataVersion, U_MAX_VERSION_LENGTH); } } @@ -546,7 +522,7 @@ uprv_getMaxValues(int32_t column) { U_CAPI void U_EXPORT2 u_charAge(UChar32 c, UVersionInfo versionArray) { - if(versionArray!=NULL) { + if(versionArray!=nullptr) { uint32_t version=u_getUnicodeProperties(c, 0)>>UPROPS_AGE_SHIFT; versionArray[0]=(uint8_t)(version>>4); versionArray[1]=(uint8_t)(version&0xf); @@ -556,7 +532,7 @@ u_charAge(UChar32 c, UVersionInfo versionArray) { U_CAPI UScriptCode U_EXPORT2 uscript_getScript(UChar32 c, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return USCRIPT_INVALID_CODE; } if((uint32_t)c>0x10ffff) { @@ -577,7 +553,7 @@ uscript_getScript(UChar32 c, UErrorCode *pErrorCode) { } U_CAPI UBool U_EXPORT2 -uscript_hasScript(UChar32 c, UScriptCode sc) { +uscript_hasScript(UChar32 c, UScriptCode sc) UPRV_NO_SANITIZE_UNDEFINED { uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK; uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX); if(scriptX0x7fff) { /* Guard against bogus input that would make us go past the Script_Extensions terminator. */ - return FALSE; + return false; } while(sc32>*scx) { ++scx; @@ -603,10 +579,10 @@ U_CAPI int32_t U_EXPORT2 uscript_getScriptExtensions(UChar32 c, UScriptCode *scripts, int32_t capacity, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(capacity<0 || (capacity>0 && scripts==NULL)) { + if(capacity<0 || (capacity>0 && scripts==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -648,13 +624,13 @@ ublock_getCode(UChar32 c) { /* property starts for UnicodeSet ------------------------------------------- */ static UBool U_CALLCONV -uchar_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) { +_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) { /* add the start code point to the USet */ const USetAdder *sa=(const USetAdder *)context; sa->add(sa->set, start); (void)end; (void)value; - return TRUE; + return true; } #define USET_ADD_CP_AND_NEXT(sa, cp) sa->add(sa->set, cp); sa->add(sa->set, cp+1) @@ -666,57 +642,59 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) { } /* add the start code point of each same-value range of the main trie */ - utrie2_enum(&propsTrie, NULL, uchar_enumPropertyStartsRange, sa); + utrie2_enum(&propsTrie, nullptr, _enumPropertyStartsRange, sa); /* add code points with hardcoded properties, plus the ones following them */ /* add for u_isblank() */ - USET_ADD_CP_AND_NEXT(sa, uprops_TAB); + USET_ADD_CP_AND_NEXT(sa, TAB); /* add for IS_THAT_CONTROL_SPACE() */ - sa->add(sa->set, uprops_CR+1); /* range uprops_TAB..uprops_CR */ + sa->add(sa->set, CR+1); /* range TAB..CR */ sa->add(sa->set, 0x1c); sa->add(sa->set, 0x1f+1); - USET_ADD_CP_AND_NEXT(sa, uprops_NL); + USET_ADD_CP_AND_NEXT(sa, 0x85); // NEXT LINE (NEL) /* add for u_isIDIgnorable() what was not added above */ - sa->add(sa->set, uprops_DEL); /* range uprops_DEL..uprops_NBSP-1, uprops_NBSP added below */ - sa->add(sa->set, uprops_HAIRSP); - sa->add(sa->set, uprops_RLM+1); - sa->add(sa->set, uprops_INHSWAP); - sa->add(sa->set, uprops_NOMDIG+1); - USET_ADD_CP_AND_NEXT(sa, uprops_ZWNBSP); + sa->add(sa->set, 0x7f); /* range DEL..NBSP-1, NBSP added below */ + sa->add(sa->set, HAIRSP); + sa->add(sa->set, RLM+1); + sa->add(sa->set, 0x206a); // INHIBIT SYMMETRIC SWAPPING + sa->add(sa->set, 0x206f+1); // NOMINAL DIGIT SHAPES + USET_ADD_CP_AND_NEXT(sa, ZWNBSP); /* add no-break spaces for u_isWhitespace() what was not added above */ - USET_ADD_CP_AND_NEXT(sa, uprops_NBSP); - USET_ADD_CP_AND_NEXT(sa, uprops_FIGURESP); - USET_ADD_CP_AND_NEXT(sa, uprops_NNBSP); + USET_ADD_CP_AND_NEXT(sa, NBSP); + USET_ADD_CP_AND_NEXT(sa, FIGURESP); + USET_ADD_CP_AND_NEXT(sa, NNBSP); /* add for u_digit() */ - sa->add(sa->set, uprops_U_a); - sa->add(sa->set, uprops_U_z+1); - sa->add(sa->set, uprops_U_A); - sa->add(sa->set, uprops_U_Z+1); - sa->add(sa->set, uprops_U_FW_a); - sa->add(sa->set, uprops_U_FW_z+1); - sa->add(sa->set, uprops_U_FW_A); - sa->add(sa->set, uprops_U_FW_Z+1); + sa->add(sa->set, u'a'); + sa->add(sa->set, u'z'+1); + sa->add(sa->set, u'A'); + sa->add(sa->set, u'Z'+1); + // fullwidth + sa->add(sa->set, u'a'); + sa->add(sa->set, u'z'+1); + sa->add(sa->set, u'A'); + sa->add(sa->set, u'Z'+1); /* add for u_isxdigit() */ - sa->add(sa->set, uprops_U_f+1); - sa->add(sa->set, uprops_U_F+1); - sa->add(sa->set, uprops_U_FW_f+1); - sa->add(sa->set, uprops_U_FW_F+1); + sa->add(sa->set, u'f'+1); + sa->add(sa->set, u'F'+1); + // fullwidth + sa->add(sa->set, u'f'+1); + sa->add(sa->set, u'F'+1); /* add for UCHAR_DEFAULT_IGNORABLE_CODE_POINT what was not added above */ - sa->add(sa->set, uprops_WJ); /* range uprops_WJ..uprops_NOMDIG */ + sa->add(sa->set, 0x2060); /* range 2060..206f */ sa->add(sa->set, 0xfff0); sa->add(sa->set, 0xfffb+1); sa->add(sa->set, 0xe0000); sa->add(sa->set, 0xe0fff+1); /* add for UCHAR_GRAPHEME_BASE and others */ - USET_ADD_CP_AND_NEXT(sa, uprops_CGJ); + USET_ADD_CP_AND_NEXT(sa, CGJ); } U_CFUNC void U_EXPORT2 @@ -726,5 +704,5 @@ upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) { } /* add the start code point of each same-value range of the properties vectors trie */ - utrie2_enum(&propsVectorsTrie, NULL, uchar_enumPropertyStartsRange, sa); + utrie2_enum(&propsVectorsTrie, nullptr, _enumPropertyStartsRange, sa); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uchar_props_data.h b/src/duckdb/extension/icu/third_party/icu/common/uchar_props_data.h index 254cf6b2d..032422397 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uchar_props_data.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uchar_props_data.h @@ -1,6 +1,5 @@ -// © 2016 and later: Unicode, Inc. and others. +// Copyright (C) 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -// // Copyright (C) 1999-2016, International Business Machines // Corporation and others. All Rights Reserved. // @@ -8,149 +7,148 @@ // // machine-generated by: icu/tools/unicode/c/genprops/corepropsbuilder.cpp - #ifdef INCLUDED_FROM_UCHAR_C -static const UVersionInfo dataVersion={0xd,0,0,0}; +static const UVersionInfo dataVersion={0xf,1,0,0}; -static const uint16_t propsTrie_index[22276]={ -0x46d,0x475,0x47d,0x485,0x49d,0x4a5,0x4ad,0x4b5,0x4bd,0x4c5,0x4cb,0x4d3,0x4db,0x4e3,0x4eb,0x4f3, -0x4f9,0x501,0x509,0x511,0x514,0x51c,0x524,0x52c,0x534,0x53c,0x538,0x540,0x548,0x550,0x555,0x55d, -0x565,0x56d,0x571,0x579,0x581,0x589,0x591,0x599,0x595,0x59d,0x5a2,0x5aa,0x5b0,0x5b8,0x5c0,0x5c8, -0x5d0,0x5d8,0x5e0,0x5e8,0x5ed,0x5f5,0x5f8,0x600,0x608,0x610,0x616,0x61e,0x61d,0x625,0x62d,0x635, -0x645,0x63d,0x64d,0x655,0x48d,0x665,0x66b,0x65d,0x67b,0x67d,0x685,0x673,0x695,0x69b,0x6a3,0x68d, -0x6b3,0x6b9,0x6c1,0x6ab,0x6d1,0x6d7,0x6df,0x6c9,0x6ef,0x6f5,0x6fd,0x6e7,0x70d,0x715,0x71d,0x705, -0x72d,0x733,0x73b,0x725,0x74b,0x751,0x759,0x743,0x769,0x76e,0x776,0x761,0x786,0x78d,0x795,0x77e, -0x619,0x79d,0x7a5,0x48d,0x7ad,0x7b4,0x7bc,0x48d,0x7c4,0x7cc,0x7d4,0x7d9,0x7e1,0x7e8,0x7f0,0x48d, -0x5d8,0x7f8,0x800,0x808,0x810,0x565,0x820,0x818,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x828,0x5d8,0x830,0x834,0x83c,0x5d8,0x842,0x5d8,0x848,0x850,0x858,0x565,0x565,0x860, -0x868,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x86d,0x875,0x5d8,0x5d8,0x87d,0x885,0x88d,0x895,0x89d,0x5d8,0x8a5,0x8ad,0x8b5, -0x8c5,0x5d8,0x8cd,0x8cf,0x8d7,0x8bd,0x5d8,0x8da,0x8ee,0x8e2,0x8ea,0x8f6,0x5d8,0x8fe,0x904,0x90c, -0x914,0x5d8,0x924,0x92c,0x934,0x91c,0x944,0x48d,0x94c,0x94f,0x957,0x93c,0x967,0x95f,0x5d8,0x96e, -0x5d8,0x97d,0x976,0x985,0x98d,0x991,0x999,0x9a1,0x50d,0x9a9,0x9ac,0x9b2,0x9b9,0x9ac,0x534,0x9c1, -0x4bd,0x4bd,0x4bd,0x4bd,0x9c9,0x4bd,0x4bd,0x4bd,0x9d9,0x9e1,0x9e9,0x9f1,0x9f9,0x9fd,0xa05,0x9d1, -0xa1d,0xa25,0xa0d,0xa15,0xa2d,0xa35,0xa3d,0xa45,0xa5d,0xa4d,0xa55,0xa65,0xa6d,0xa7c,0xa81,0xa74, -0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa91,0xa99,0x90c,0xa9c,0xaa4,0xaab,0xab0,0xab8, -0x90c,0xabf,0xabe,0xacf,0xad2,0x90c,0x90c,0xac7,0x90c,0x90c,0x90c,0x90c,0x90c,0xae1,0xae9,0xad9, -0x90c,0x90c,0x90c,0xaee,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xaf4,0xafc,0x90c,0xb04,0xb0b, -0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xa89,0xa89,0xa89,0xa89,0xb13,0xa89,0xb1a,0xb21, -0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x90c,0xb29,0xb30,0xb34,0xb3a,0x90c,0x90c,0x90c, -0x565,0xb4a,0xb42,0xb52,0x4bd,0x4bd,0x4bd,0xb5a,0x50d,0xb62,0x5d8,0xb68,0xb78,0xb70,0xb70,0x534, -0xb80,0xb88,0xb90,0x48d,0xb98,0x90c,0x90c,0xb9f,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0xbad, -0xbbd,0xbb5,0x619,0x5d8,0xbc5,0x868,0x5d8,0xbcd,0xbd5,0xbd9,0x5d8,0x5d8,0xbde,0x5d8,0x90c,0xbe5, -0xab9,0xbed,0xbf3,0x90c,0xbed,0xbfb,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, -0xc03,0x5d8,0x5d8,0x5d8,0xc0b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0xc11,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc16,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x90c,0x90c, -0xc1e,0x5d8,0xc21,0x5d8,0xc29,0xc2f,0xc37,0xc3f,0xc44,0x5d8,0x5d8,0xc48,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc4f,0x5d8,0xc56,0xc5c,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc64,0x5d8,0x5d8,0x5d8,0xc6c,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc6e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc75,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0xc7c,0x5d8,0x5d8,0x5d8,0xc83,0xc8b,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc90,0x5d8,0x5d8,0xc98,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9c,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xc9f,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xca2,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0xca8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0xcb0,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0xcb5,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcba,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0xcc7,0xcce,0xcd2,0x5d8,0x5d8,0x5d8,0xcd9,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ce, -0xce7,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0xcdf,0x90c,0xcef,0x985,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0xcf4,0xcfc,0x4bd,0xd0c,0xd04,0x5d8,0x5d8,0xd14,0xd1c,0xd2c,0x4bd,0xd31,0xd39,0xd3f,0xd47,0xd24, -0xd4f,0xd57,0x5d8,0xd5f,0xd6f,0xd72,0xd67,0xd7a,0x62d,0xd82,0xd89,0x8ce,0x67b,0xd99,0xd91,0xda1, -0x5d8,0xda9,0xdb1,0xdb9,0x5d8,0xdc1,0xdc9,0xdd1,0xdd9,0xde1,0xde5,0xded,0x50d,0x50d,0x5d8,0xdf5, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xdfd,0xe09,0xe01, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, -0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0x5d8,0x5d8,0x5d8,0xe21,0x5d8,0xcda,0xe28,0xe2d, -0x5d8,0x5d8,0x5d8,0xe35,0x5d8,0x5d8,0x8d9,0x48d,0xe4b,0xe3b,0xe43,0x5d8,0x5d8,0xe53,0xe5b,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe60,0xe68,0x5d8,0xe6c,0x5d8,0xe72,0xe76, -0xe7e,0xe86,0xe8d,0xe95,0x5d8,0x5d8,0x5d8,0xe9b,0xeb3,0x47d,0xebb,0xec3,0xec8,0x8ee,0xea3,0xeab, -0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, -0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11,0xe11, -0x1234,0x1234,0x1274,0x12b4,0x12f4,0x132c,0x136c,0x13ac,0x13e4,0x1424,0x1450,0x1490,0x14d0,0x14e0,0x1520,0x1554, -0x1594,0x15c4,0x1604,0x1644,0x1654,0x1688,0x16c0,0x1700,0x1740,0x1780,0x17b4,0x17e0,0x1820,0x1858,0x1874,0x18b4, -0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xbc0,0xa40,0xbe2,0xa40,0xa40,0xa40,0xa40,0xc22,0x1db,0x1db, -0xc62,0xca2,0xa40,0xa40,0xa40,0xa40,0xce2,0xd02,0xa40,0xa40,0xd42,0xd82,0xdc2,0xe02,0xe42,0xe82, -0xec2,0xef9,0x1db,0x1db,0xf1d,0xf51,0x1db,0xf79,0x1db,0x1db,0x1db,0x1db,0xfa6,0x1db,0x1db,0x1db, -0x1db,0x1db,0x1db,0x1db,0xfba,0x1db,0xff2,0x1032,0x1db,0x103d,0x1db,0x1db,0x1db,0x1073,0xa40,0x10b3, -0x1db,0x1db,0x10f3,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +static const uint16_t propsTrie_index[23156]={ +0x495,0x49d,0x4a5,0x4ad,0x4c5,0x4cd,0x4d5,0x4dd,0x4e5,0x4ed,0x4f3,0x4fb,0x503,0x50b,0x513,0x51b, +0x521,0x529,0x531,0x539,0x53c,0x544,0x54c,0x554,0x55c,0x564,0x560,0x568,0x570,0x578,0x57d,0x585, +0x58d,0x595,0x599,0x5a1,0x5a9,0x5b1,0x5b9,0x5c1,0x5bd,0x5c5,0x5ca,0x5d2,0x5d8,0x5e0,0x5e8,0x5f0, +0x5f8,0x600,0x608,0x610,0x615,0x61d,0x620,0x628,0x630,0x638,0x63e,0x646,0x645,0x64d,0x655,0x65d, +0x66d,0x665,0x675,0x67d,0x683,0x600,0x693,0x68b,0x6a3,0x6a5,0x6ad,0x69b,0x6bd,0x6c3,0x6cb,0x6b5, +0x6db,0x6e1,0x6e9,0x6d3,0x6f9,0x6ff,0x707,0x6f1,0x717,0x71d,0x725,0x70f,0x735,0x73d,0x745,0x72d, +0x755,0x75b,0x763,0x74d,0x773,0x779,0x781,0x76b,0x791,0x796,0x79e,0x789,0x7ae,0x7b5,0x7bd,0x7a6, +0x641,0x7c5,0x7cd,0x4b5,0x7d5,0x7dc,0x7e4,0x4b5,0x7ec,0x7f4,0x7fc,0x801,0x809,0x810,0x818,0x4b5, +0x600,0x820,0x828,0x830,0x838,0x58d,0x848,0x840,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x850,0x600,0x858,0x85c,0x864,0x600,0x86a,0x600,0x870,0x878,0x880,0x58d,0x58d,0x888, +0x890,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x895,0x89d,0x600,0x600,0x8a5,0x8ad,0x8b5,0x8bd,0x8c5,0x600,0x8cd,0x8d5,0x8dd, +0x8ed,0x600,0x8f5,0x8f7,0x8ff,0x8e5,0x600,0x902,0x916,0x90a,0x912,0x91e,0x600,0x926,0x92c,0x934, +0x93c,0x600,0x94c,0x954,0x95c,0x944,0x96c,0x4b5,0x974,0x977,0x97f,0x964,0x98f,0x987,0x600,0x996, +0x600,0x9a5,0x99e,0x9ad,0x9b5,0x9b9,0x9c1,0x9c9,0x535,0x9d1,0x9d4,0x9da,0x9e1,0x9d4,0x55c,0x55c, +0x4e5,0x4e5,0x4e5,0x4e5,0x9e9,0x4e5,0x4e5,0x4e5,0x9f9,0xa01,0xa09,0xa11,0xa19,0xa1d,0xa25,0x9f1, +0xa3d,0xa45,0xa2d,0xa35,0xa4d,0xa55,0xa5d,0xa65,0xa7d,0xa6d,0xa75,0xa85,0xa8d,0xa9c,0xaa1,0xa94, +0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0xab1,0xab9,0x934,0xabc,0xac4,0xacb,0xad0,0xad8, +0x934,0xadf,0xade,0xaef,0xaf2,0x934,0x934,0xae7,0x934,0x934,0x934,0x934,0x934,0xb01,0xb09,0xaf9, +0x934,0x934,0x934,0xb0e,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0xb14,0xb1c,0x934,0xb24,0xb2b, +0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0xaa9,0xaa9,0xaa9,0xaa9,0xb33,0xaa9,0xb3a,0xb41, +0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0xaa9,0x934,0xb49,0xb50,0xb54,0xb5a,0x934,0x934,0x934, +0x58d,0x595,0x535,0xb62,0x4e5,0x4e5,0x4e5,0xb6a,0x535,0xb72,0x600,0xb78,0xb88,0xb80,0xb80,0x55c, +0xb90,0xb98,0xba0,0x4b5,0xba8,0x934,0x934,0xbaf,0x934,0x934,0x934,0x934,0x934,0x934,0xbb7,0xbbd, +0xbcd,0xbc5,0x641,0x600,0xbd5,0x890,0x600,0xbdd,0xbe5,0xbe9,0x600,0x600,0xbee,0x600,0x934,0xbf5, +0xad9,0xbfd,0xc03,0x934,0xbfd,0xc0b,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934, +0xc13,0x600,0x600,0x600,0xc1b,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0xc21,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xc26,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x934,0x934, +0xc2e,0xc35,0xc37,0x600,0xc3f,0xc45,0xc4d,0xc55,0xc5a,0x600,0x600,0xc5e,0x600,0x600,0x600,0xc64, +0xc6b,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xc72,0x600,0xc79,0xc7f,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xc87,0x600,0x600,0x600,0xc8f,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0xc91,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xc98,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0xc9f,0x600,0x600,0x600,0xca6,0xcae,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0xcb3,0xcb8,0x600,0x600,0xcc0,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xcc4,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xcc9,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xcc7,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xcd1,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0xcd7,0xcdf,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xce5, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0xcec,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0xcf1,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0xcf6,0x600,0x600,0x600,0xc32,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0xcd3,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0xcfc,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0xd04,0xd0b,0xd0f,0x600,0x600,0x600,0xccb,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0xd1e,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0xd16,0x934,0xd26,0x9ad,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0xd2b,0xd33,0x4e5,0xd43,0xd3b,0x600,0x600,0xd4b,0xd53,0xd63,0x4e5,0xd68,0xd70,0xd76,0xd7d,0xd5b, +0xd85,0xd8d,0x600,0xd95,0xda5,0xda8,0xd9d,0xdb0,0x655,0xdb8,0xdbf,0x8f6,0x6a3,0xdcf,0xdc7,0xdd7, +0x600,0xddf,0xde7,0xdef,0x600,0xdf7,0xdff,0xe07,0xe0f,0xe17,0xe1b,0xe23,0x535,0x535,0x600,0xe2b, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xe33,0xe3f,0xe37, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47, +0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0x600,0x600,0x600,0xe57,0x600,0xccc,0xe5e,0xe63, +0x600,0x600,0x600,0xe6b,0x600,0x600,0x901,0x4b5,0xe81,0xe71,0xe79,0x600,0x600,0xe89,0xe91,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xe96,0x938,0x600,0xe9e,0x600,0xea4,0xea8, +0xeb0,0xeb8,0xebf,0xec7,0x600,0x600,0x600,0xecd,0xee5,0x4a5,0xeed,0xef5,0xefa,0x916,0xed5,0xedd, +0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47, +0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47,0xe47, +0x12d4,0x12d4,0x1314,0x1354,0x1394,0x13cc,0x140c,0x144c,0x1484,0x14c4,0x14f0,0x1530,0x1570,0x1580,0x15c0,0x15f4, +0x1634,0x1664,0x16a4,0x16e4,0x16f4,0x1728,0x1760,0x17a0,0x17e0,0x1820,0x1854,0x1880,0x18c0,0x18f8,0x1914,0x1954, +0xa80,0xac0,0xb00,0xb40,0xb80,0xbab,0xbeb,0xa40,0xc0e,0xa40,0xa40,0xa40,0xa40,0xc4e,0x1db,0x1db, +0xc8e,0xcce,0xa40,0xa40,0xa40,0xcf7,0xd37,0xd57,0xa40,0xd7d,0xdbd,0xdfd,0xe3d,0xe7d,0xebd,0xefd, +0xf3d,0xf74,0x1db,0x1db,0xf98,0xfcc,0x1db,0xff4,0x1db,0x1db,0x1db,0x1db,0x1021,0x1db,0x1db,0x1db, +0x1db,0x1db,0x1db,0x1db,0x1035,0x1db,0x106d,0x10ad,0x1db,0x10b8,0x1db,0x1db,0x1db,0x10ee,0xa40,0x112e, +0x1db,0x1db,0x116e,0x1db,0x1191,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, @@ -172,132 +170,142 @@ static const uint16_t propsTrie_index[22276]={ 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0x1133,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0x11d1,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, 0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700, -0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173, +0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1211, 0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700, -0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1173, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0xed0,0xed7,0xedf,0x48d,0x5d8,0x5d8,0x5d8,0xee7,0xef7,0xeef,0xf0e,0xeff,0xf06,0xf16,0xf1a,0xf1e, -0x48d,0x48d,0x48d,0x48d,0x8ce,0x5d8,0xf26,0xf2e,0x5d8,0xf36,0xf3e,0xf42,0xf4a,0x5d8,0xf52,0x48d, -0x565,0x56f,0xf5a,0x5d8,0xf5e,0xf66,0xf76,0xf6e,0x5d8,0xf7e,0x5d8,0xf85,0x48d,0x48d,0x48d,0x48d, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xb78,0x8da,0xe72,0x48d,0x48d,0x48d,0x48d, -0xf95,0xf8d,0xf98,0xfa0,0x8ee,0xfa8,0x48d,0xfb0,0xfb8,0xfc0,0x48d,0x48d,0x5d8,0xfd0,0xfd8,0xfc8, -0xfe8,0xfef,0xfe0,0xff7,0xfff,0x48d,0x100f,0x1007,0x5d8,0x1012,0x101a,0x1022,0x102a,0x1032,0x48d,0x48d, -0x5d8,0x5d8,0x103a,0x48d,0x565,0x1042,0x50d,0x104a,0x5d8,0x1052,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x105a,0x5d8,0x1062,0x48d,0x48d,0x106a,0x1072,0x1079,0x48d,0x48d,0xe68,0x1081,0xb78, -0x1091,0x60e,0x1099,0x1089,0x967,0x10a1,0x10a9,0x10af,0x10c7,0x10b7,0x10bf,0x10cb,0x967,0x10db,0x10d3,0x10e3, -0x10f3,0x10eb,0x48d,0x48d,0x10fa,0x1102,0x630,0x110a,0x111a,0x1120,0x1128,0x1112,0x48d,0x48d,0x48d,0x48d, -0x5d8,0x1130,0x1138,0x1140,0x5d8,0x1148,0x1150,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1158,0x1160,0x48d, -0x5d8,0x1168,0x1170,0x1178,0x5d8,0x1188,0x1180,0x48d,0x848,0x1190,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x5d8,0x1198,0x48d,0x48d,0x48d,0x565,0x50d,0x11a0,0x11b0,0x11b6,0x11a8,0x48d,0x48d,0x11c6,0x11ca,0x11be, -0x11e2,0x11d2,0x11da,0x5d8,0x11f2,0x11ea,0x5d8,0x8cf,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x1208,0x120d,0x11fa,0x1202,0x121d,0x1215,0x48d,0x48d,0x122c,0x1230,0x1224,0x1240,0x1238,0x1180,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x1244,0x48d,0x48d,0x48d,0x48d,0x48d,0x124b,0x125b,0x1253, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8d9,0x48d,0x48d,0x48d, -0x126b,0x1273,0x127b,0x1263,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1283,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x128b,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x1293,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x8cf,0x8ee,0x129b,0x48d,0x48d,0xe68,0x12a3,0x5d8,0x12b3,0x12bb,0x12c3,0x12ab,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x565,0x50d,0x12cb,0x48d,0x48d,0x48d,0x5d8,0x5d8,0x12d3,0x12d8,0x12de,0x48d, -0x48d,0x12e6,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x12ee,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8da,0x48d,0x103a,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x8ee,0x48d,0x12f4,0x12fb,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xe01,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x1301,0x1306,0x130e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0xba7,0x90c,0x1316,0x90c,0x131d,0x1325,0x132b, -0x90c,0x1331,0x90c,0x90c,0x1339,0x48d,0x48d,0x48d,0x48d,0x1341,0x90c,0x90c,0xabb,0x1349,0x48d,0x48d, -0x48d,0x48d,0x1359,0x1360,0x1365,0x136b,0x1373,0x137b,0x1383,0x135d,0x138b,0x1393,0x139b,0x13a0,0x1372,0x1359, -0x1360,0x135c,0x136b,0x13a8,0x135a,0x13ab,0x135d,0x13b3,0x13bb,0x13c3,0x13ca,0x13b6,0x13be,0x13c6,0x13cd,0x13b9, -0x13d5,0x1351,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, -0x90c,0x90c,0x534,0x13e5,0x534,0x13ec,0x13f3,0x13dd,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x13fa,0x1402,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x1412,0x140a,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x5d8,0x141a,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1422,0x48d,0x565,0x1432,0x142a,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x143a,0x144a,0x1442,0x48d,0x48d,0x145a,0x1452,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x146a,0x1472,0x147a,0x1482,0x148a,0x1492,0x48d,0x1462,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x90c,0x149a,0x90c,0x90c,0xb9f,0x149f,0x14a3,0xba7,0x14ab,0x90c,0x90c,0x90c,0x90c,0xba9, -0x48d,0x14b3,0x14bb,0x14bf,0x14c7,0x14cf,0x48d,0x48d,0x48d,0x48d,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, -0x90c,0x14d7,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, -0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x14df,0x14e7,0x90c,0x90c,0x90c,0xb9f,0x90c,0x90c, -0x14ef,0x14f7,0x149a,0x90c,0x14ff,0x90c,0x1507,0x150c,0x48d,0x48d,0x90c,0x90c,0x90c,0x1514,0x90c,0x90c, -0x151b,0x90c,0x90c,0x90c,0xb9f,0x1520,0x1528,0x152e,0x1533,0x48d,0x90c,0x90c,0x90c,0x90c,0x153b,0x90c, -0xabe,0x117c,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x1543,0x5d8,0x5d8,0x154a,0x5d8,0x5d8,0x5d8,0x1552,0x5d8,0x155a,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0xc80,0x5d8,0x5d8,0x1562,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x156a,0x1572,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0xcbf,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1579,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x1580,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x1587,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0xf5e,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x158b,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0xf5e,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x1066,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x1590,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x1598,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0xf5e,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8, -0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x5d8,0x655,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x15a8,0x15a0,0x15a0,0x15a0,0x48d,0x48d,0x48d,0x48d,0x534,0x534,0x534,0x534,0x534, -0x534,0x534,0x15b0,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d,0x48d, -0x48d,0x48d,0x48d,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19,0xe19, -0xe19,0xe19,0x15b8,0x46c,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf, +0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x700,0x1211, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0xf02,0xf09,0xf11,0x4b5,0x600,0x600,0x600,0xf19,0xf29,0xf21,0xf40,0xf31,0xf38,0xf48,0xbbd,0xf50, +0x4b5,0x4b5,0x4b5,0x4b5,0x8f6,0x600,0xf58,0xf60,0x600,0xf68,0xf70,0xf74,0xf7c,0x600,0xf84,0x4b5, +0x58d,0x597,0xf8c,0x600,0xf90,0xf98,0xfa8,0xfa0,0x600,0xfb0,0x600,0xfb7,0xfc7,0xfbf,0x4b5,0x4b5, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xb88,0x902,0xfcf,0xfdf,0xfd7,0x4b5,0x4b5, +0xfef,0xfe7,0xff2,0xffa,0x916,0x1002,0x4b5,0x100a,0x1012,0x101a,0x4b5,0x4b5,0x600,0x102a,0x1032,0x1022, +0x1042,0x1049,0x103a,0x1051,0x1059,0x4b5,0x1069,0x1061,0x600,0x106c,0x1074,0x107c,0x1084,0x108c,0x4b5,0x4b5, +0x600,0x600,0x1094,0x4b5,0x58d,0x109c,0x535,0x10a4,0x600,0x10ac,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x10b4,0x600,0x10bc,0x4b5,0x10c1,0x10c9,0x10d1,0x10d8,0x1006,0x10e0,0x1006,0x10e8,0xb88, +0x10f8,0x636,0x1100,0x10f0,0x98f,0x1108,0x1110,0x1116,0x112e,0x111e,0x1126,0x1132,0x98f,0x1142,0x113a,0x114a, +0x1162,0x1152,0x115a,0x4b5,0x1169,0x1171,0x658,0x1179,0x1189,0x118f,0x1197,0x1181,0x4b5,0x4b5,0x4b5,0x4b5, +0x600,0x119f,0x11a7,0x10c0,0x600,0x11af,0x11b7,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x600,0x11bf,0x11c7,0x4b5, +0x600,0x11cf,0x11d7,0x11df,0x600,0x11ef,0x11e7,0x4b5,0x870,0x11f7,0x11ff,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x600,0x1207,0x4b5,0x4b5,0x4b5,0x58d,0x535,0x120f,0x121f,0x1225,0x1217,0x4b5,0x4b5,0x1235,0x1239,0x122d, +0x1251,0x1241,0x1249,0x600,0x125f,0x1259,0x600,0x8f7,0x126f,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x127d,0x1282,0x1267,0x1277,0x1292,0x128a,0x4b5,0x4b5,0x12a1,0x12a5,0x1299,0x12b5,0x12ad,0x11e7,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x12b9,0x12c9,0x12ce,0x12c1,0x4b5,0x4b5,0x12d6,0x12e6,0x12de, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x901,0x4b5,0x4b5,0x4b5, +0x12f6,0x12fe,0x1306,0x12ee,0x600,0x600,0x600,0x600,0x600,0x600,0x130e,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x1006,0x600,0x600,0x1316,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x131e,0x1326,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x11ff,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x8f7, +0x916,0xdcb,0x600,0x916,0x132e,0x1333,0x600,0x1343,0x134b,0x1353,0x133b,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x58d,0x535,0x135b,0x4b5,0x4b5,0x4b5,0x600,0x600,0x1363,0x1368,0x136e,0x4b5,0x4b5,0x1376,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x137e,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x902,0x4b5,0x1094,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x1384,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x138c,0x1391,0x1398,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xe37,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x600,0x600,0x600,0x139e,0x13a3,0x13ab,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x55c,0x13bb,0x13c2,0x934,0x934,0x934,0x13b3,0x4b5,0x934,0x934,0x934, +0x934,0x934,0x934,0x934,0xbb7,0x934,0x13c9,0x934,0x13d0,0x13d8,0x13de,0x934,0xade,0x934,0x934,0x13e6, +0x4b5,0x4b5,0x4b5,0x13ee,0x13ee,0x934,0x934,0xadb,0x13f6,0x4b5,0x4b5,0x4b5,0x4b5,0x1406,0x140d,0x1412, +0x1418,0x1420,0x1428,0x1430,0x140a,0x1438,0x1440,0x1448,0x144d,0x141f,0x1406,0x140d,0x1409,0x1418,0x1455,0x1407, +0x1458,0x140a,0x1460,0x1468,0x1470,0x1477,0x1463,0x146b,0x1473,0x147a,0x1466,0x1482,0x13fe,0x934,0x934,0x934, +0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x55c,0x1492,0x55c, +0x1499,0x14a0,0x148a,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x14af,0x14b7,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x14a7,0x14bf,0x9d4, +0x14cf,0x14c7,0x4b5,0x4b5,0x4b5,0x600,0x14df,0x14d7,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x1006,0x14e7,0x600,0x14ef,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x1006,0x14f7,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x14ff,0x600,0x600,0x600, +0x600,0x600,0x600,0x1507,0x4b5,0x58d,0x1517,0x150f,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x151f,0x152f,0x1527,0x4b5,0x4b5,0x153f,0x1537,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x154f,0x1557,0x155f, +0x1567,0x156f,0x1577,0x4b5,0x1547,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x934,0x157f,0x934, +0x934,0xbaf,0x13c7,0x1587,0xbb7,0x158f,0x934,0x934,0x934,0x934,0xbb9,0x4b5,0x1597,0x159f,0x15a3,0x15ab, +0x15b3,0x4b5,0x4b5,0x4b5,0x4b5,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x15bb,0x934,0x934,0x934, +0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934, +0x934,0x934,0x934,0x15a4,0x15c3,0x934,0x934,0x934,0x15cb,0x934,0x934,0x15d2,0x15da,0x157f,0x934,0x15e2, +0x934,0x15ea,0x15ef,0x4b5,0x4b5,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0x934,0xbaf, +0x15f7,0x1600,0x1604,0x160c,0x15fc,0x934,0x934,0x934,0x934,0x1614,0x934,0xade,0x11e3,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x161c,0x600,0x600, +0x1623,0x600,0x600,0x600,0x162b,0x600,0x1633,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xca3,0x600,0x600, +0x163b,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x1643,0x164b,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0xc32,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x1652,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x1659,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x1660,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x4b5,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x901,0x600,0x600,0x600,0x600,0x600,0x600,0xf90,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x1668,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x1670,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0xf90,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x600,0x600, +0x600,0x600,0x1674,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0xf90,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x67d,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x133b,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x1684,0x167c,0x167c,0x167c,0x4b5,0x4b5,0x4b5,0x4b5,0x55c,0x55c,0x55c,0x55c,0x55c,0x55c,0x55c, +0x168c,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5,0x4b5, +0x4b5,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0x1694,0x494,0x494,0x494,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf, 0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf, 0xf,0xf,0xf,0xf,0xc,0x17,0x17,0x17,0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18, 0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17, @@ -387,7 +395,7 @@ static const uint16_t propsTrie_index[22276]={ 5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,5, 5,5,5,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0, 0x10,0x10,0x10,0x10,0x10,0x10,0x18,0x18,0x18,0x17,0x17,0x19,0x17,0x17,0x1b,0x1b, -6,6,6,6,6,6,6,6,6,6,6,0x17,0x10,0,0x17,0x17, +6,6,6,6,6,6,6,6,6,6,6,0x17,0x10,0x17,0x17,0x17, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6, @@ -420,12 +428,12 @@ static const uint16_t propsTrie_index[22276]={ 6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6, 0,0,0x17,0,5,5,5,5,5,5,5,5,5,5,5,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,6,6,0x10,6,6,6,6,6,6,6,6,6, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0x1a,5,5,5,5,5,5,0,0x10,0x10,0,0, +0,0,0,0,6,6,6,6,6,6,6,6,6,6,0x10,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, -6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5, -5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,6, +6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5, +5,5,5,5,5,4,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,5,5,6,6, 0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,4,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,8, @@ -476,17 +484,17 @@ static const uint16_t propsTrie_index[22276]={ 0x58b,0x5cb,0x60b,0x1b,6,8,8,8,6,5,5,5,5,5,5,5, 5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,0,0,0,5,6,6,6,8,8,8, +5,5,5,5,5,5,0,0,6,5,6,6,6,8,8,8, 8,0,6,6,6,0,6,6,6,6,0,0,0,0,0,0, -0,6,6,0,5,5,5,0,0,0,0,0,5,5,6,6, -0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,5,5,0, +0,6,6,0,5,5,5,0,0,5,0,0,5,5,6,6, +0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,5,5,8, 0,0,0,0,0,0,0,0,0,0,0,0,5,6,8,8, 0x17,5,5,5,5,5,5,5,5,0,5,5,5,0,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5, 5,5,5,5,5,5,5,5,0,5,5,5,5,5,0,0, 6,5,8,6,8,8,8,8,8,0,6,8,8,0,8,8, 6,6,0,0,0,0,0,0,0,8,8,0,0,0,0,0, -0,0,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189, +0,5,5,0,5,5,6,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189, 0x1c9,0x209,0x249,0x289,0x7cb,0x1e4b,0x784b,0x34cb,0x344b,0x3ccb,0x37cb,0x35cb,0x3fcb,0x1b,5,5, 5,5,5,5,6,6,8,8,5,5,5,5,5,5,5,5, 5,0,5,5,5,0,5,5,5,5,5,5,5,5,5,5, @@ -509,7 +517,7 @@ static const uint16_t propsTrie_index[22276]={ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,0,5,0,5,5,5,5,5,5,5,5,5, 5,6,5,5,6,6,6,6,6,6,6,6,6,5,0,0, -5,5,5,5,5,0,4,0,6,6,6,6,6,6,0,0, +5,5,5,5,5,0,4,0,6,6,6,6,6,6,6,0, 0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,5,5,5,5, 5,0x1b,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, 0x17,0x17,0x17,0x1b,0x17,0x1b,0x1b,0x1b,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, @@ -560,9 +568,9 @@ static const uint16_t propsTrie_index[22276]={ 0x15,0,0,0,5,5,5,5,5,5,5,5,5,5,5,0x17, 0x17,0x17,0x98a,0x9ca,0xa0a,5,5,5,5,5,5,5,5,0,0,0, 0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,0,5,5,5,5,6,6,6,0,0,0,0,0,0,0, -0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,6,6,6,0x17,0x17,0,0,0,0,0, +5,5,5,5,5,5,6,6,6,8,0,0,0,0,0,0, +0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,6,6,8,0x17,0x17,0,0,0,0,0, 0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,6,6,0,0,0,0,0,0,0,0, 0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, @@ -576,7 +584,7 @@ static const uint16_t propsTrie_index[22276]={ 0,0,0,0,5,5,5,5,5,5,5,5,5,6,5,0, 0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x17,0x17,0x17,0x17,6, -6,6,0x10,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +6,6,0x10,6,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, 0,0,0,0,5,5,5,4,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,0,0,0,0,0,0,0,5,5,5,5, @@ -606,13 +614,13 @@ static const uint16_t propsTrie_index[22276]={ 0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, 0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, 0x17,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,6,6, -6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0, -6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x17,0x17,0, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 6,6,6,6,8,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,8,6,6,6,6,6,8,6,8,8,8,8,8,6,8, -8,5,5,5,5,5,5,5,0,0,0,0,0x49,0x89,0xc9,0x109, +8,5,5,5,5,5,5,5,5,0,0,0,0x49,0x89,0xc9,0x109, 0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,0x17,0x17,5,8,6,6, 6,6,8,8,6,6,8,6,6,6,5,5,0x49,0x89,0xc9,0x109, 0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,5,5,5,5,6,6,8,5, @@ -638,9 +646,7 @@ static const uint16_t propsTrie_index[22276]={ 4,4,4,2,2,2,2,2,2,2,2,2,2,2,2,2, 4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4, -4,4,4,4,6,6,6,6,6,6,6,6,6,6,6,6, -6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,6, -6,6,6,6,1,2,1,2,1,2,1,2,1,2,1,2, +4,4,4,4,1,2,1,2,1,2,1,2,1,2,1,2, 1,2,1,2,1,2,1,2,1,2,2,2,2,2,2,2, 2,2,1,2,2,2,2,2,2,2,2,2,1,1,1,1, 1,0x1a,0x1a,0x1a,0,0,2,2,2,0,2,2,1,1,1,1, @@ -669,7 +675,7 @@ static const uint16_t propsTrie_index[22276]={ 0x18,0x14,0x15,0,4,4,4,4,4,4,4,4,4,4,4,4, 4,0,0,0,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, -0x19,0x19,0x19,0x19,0,0,0,0,0,0,0,0,0,0,0,0, +0x19,0x19,0x19,0x19,0x19,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6, 6,7,7,7,7,6,7,7,7,6,6,6,6,6,6,6, 6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0, @@ -734,11 +740,7 @@ static const uint16_t propsTrie_index[22276]={ 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,1,2,1,1,1,2,2,1, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,1,2,1,1,1,2,2,1, 2,1,2,1,2,1,1,1,1,2,1,2,2,1,2,2, 2,2,2,2,4,4,1,1,1,2,1,2,2,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,1,2,1,2,6,6,6,1,2,0,0,0,0, @@ -755,7 +757,7 @@ static const uint16_t propsTrie_index[22276]={ 0x1c,0x1d,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x17,0x17,0x17,4, 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x13,0x13,0x17,0x17,0x17,0x17, 0x13,0x17,0x14,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, -0x1b,0x1b,0x17,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x17,0x17,0x17,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x13,0,0, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, @@ -763,7 +765,7 @@ static const uint16_t propsTrie_index[22276]={ 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0,0,0,0,0x1b,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,6,6, +0x1b,0x1b,0x1b,0x1b,0x1b,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,6,6, 6,6,8,8,0x13,4,4,4,4,4,0x1b,0x1b,0x7ca,0xa4a,0xcca,4, 5,0x17,0x1b,0x1b,0xc,0x17,0x17,0x17,0x1b,4,5,0x54a,0x14,0x15,0x14,0x15, 0x14,0x15,0x14,0x15,0x14,0x15,0x1b,0x1b,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15, @@ -776,7 +778,7 @@ static const uint16_t propsTrie_index[22276]={ 5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,0,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0, -0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +0,0,0,0x1b,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1b,0xa8b,0xacb,0xb0b, @@ -791,422 +793,454 @@ static const uint16_t propsTrie_index[22276]={ 5,5,5,5,5,0x705,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,0x585,5,5,0x705,5,5,5,0x7885, 5,0x605,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x5c5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0x5c5,5,5,5,5,5,5,5,0x685,5,0x645,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x785,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x5c5,5,5,5,5,5,5,5, +0x685,5,0x645,5,5,5,5,5,5,5,5,5,5,5,5,5, +0x7b85,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,0x7985,0x7c5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,0x7985,0x7c5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,0x7845,5,5,5,5, -5,5,5,5,0x605,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,0x685,5,5, +5,5,5,0x7845,5,5,5,5,5,5,5,5,0x605,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0x1e45,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0x7985,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x7a85,5, +5,5,5,5,5,0x685,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x1e45,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x5c5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0x5c5,5,0x745,5,0x6c5,5,5, +5,5,0x5c5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x7985,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,0x7c5,5,0x7845,0xa45,0xcc5,5,5,5,5,5,5,0xf45,5,5,5, +5,5,5,5,5,5,5,5,5,5,0x7905,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,0x605,0x605,0x605,0x605,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0x5c5,5,0x745,5,0x6c5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0x7c5,5,0x7845, +0xa45,0xcc5,5,5,5,5,5,5,0xf45,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0x605,0x605,0x605, +0x605,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x645, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,0x645,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,0x585,5,5,5,5,5,5,5,0x585,5,5, +5,0x585,5,5,5,5,5,5,5,0x585,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0x585,5,5,5,5,5, +5,5,5,5,5,5,0x585,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0x785,0xa45,5,5,5,5, -5,5,5,5,5,5,5,5,0x585,0x5c5,0x605,5,0x5c5,5,5,5, +5,5,5,5,5,5,0x785,0xa45,5,5,5,5,5,5,5,5, +5,5,5,5,0x585,0x5c5,0x605,5,0x5c5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x705,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x7c5,5, 5,5,5,5,5,5,5,5,5,5,5,5,0x745,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,0x705,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x785,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x1e45,5, +5,5,0x545,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0x785,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0x1e45,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x8005,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x79c5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,0x645,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 0x7885,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,0x5c5,5,5,5,5,0x5c5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,0x5c5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,0x7845,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x6c5,5, -5,5,5,5,0x1e45,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x785,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0x6c5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0x545,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,5,5,5, +5,0x7845,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,4,5,5,5,5,5,5,5,5,5,5,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,4,0x17,0x17,0x17, +5,5,0x6c5,5,5,5,5,5,0x1e45,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,0x6c5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5, +5,5,5,5,5,5,5,5,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,4,0x17,0x17,0x17,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,2,1,2, 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, -1,2,1,2,1,2,1,2,1,2,1,2,4,4,6,6, -1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,6, -7,7,7,0x17,6,6,6,6,6,6,6,6,6,6,0x17,4, -5,5,5,5,5,5,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x54a, -6,6,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0, +1,2,1,2,1,2,1,2,4,4,6,6,1,2,1,2, +1,2,1,2,1,2,1,2,1,2,5,6,7,7,7,0x17, +6,6,6,6,6,6,6,6,6,6,0x17,4,5,5,5,5, +5,5,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x54a,6,6,0x17,0x17, +0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0x1a,0x1a,0x1a,0x1a, 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, -0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,2,5,4,4,2,5,5,5,5,5, -0x1a,0x1a,1,2,1,2,1,2,1,2,1,2,1,2,1,2, -2,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, -1,2,1,2,4,2,2,2,2,2,2,2,2,1,2,1, -2,1,1,2,1,2,1,2,1,2,1,2,4,0x1a,0x1a,1, -2,1,2,5,1,2,1,2,2,2,1,2,1,2,1,2, -1,2,1,2,1,2,1,1,1,1,1,2,1,1,1,1, -1,2,1,2,1,2,1,2,1,2,1,2,0,0,1,2, -1,1,1,1,2,1,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,5,5,6,5, -5,5,6,5,5,5,5,6,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8, -8,6,6,8,0x1b,0x1b,0x1b,0x1b,6,0,0,0,0x34cb,0x344b,0x3ccb,0x37cb, -0x35cb,0x3fcb,0x1b,0x1b,0x19,0x1b,0,0,0,0,0,0,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,8,8,8,8, -6,6,0,0,0,0,0,0,0,0,0x17,0x17,0x49,0x89,0xc9,0x109, -0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,8,8,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,8, -8,8,8,8,8,8,8,8,6,6,6,6,6,6,6,6, -6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5, -0x17,0x17,0x17,5,0x17,5,5,6,5,5,5,5,5,5,6,6, -6,6,6,6,6,6,0x17,0x17,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6, -6,6,6,6,6,6,8,8,0,0,0,0,0,0,0,0, -0,0,0,0x17,8,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, -0x17,0x17,0,4,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, -0,0,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,6,8,8,6,6,6,6,8,8, -6,6,8,8,5,5,5,5,5,6,4,5,5,5,5,5, -5,5,5,5,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,5,5, -5,5,5,0,5,5,5,5,5,5,5,5,5,6,6,6, -6,6,6,8,8,6,6,8,8,6,6,0,0,0,0,0, -0,0,0,0,5,5,5,6,5,5,5,5,5,5,5,5, -6,8,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, -0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,4,5,5,5,5,5,5,0x1b,0x1b,0x1b,5,8, -6,8,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,6,5,6,6,6,5,5,6,6,5,5,5, -5,5,6,6,5,6,5,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, -5,4,0x17,0x17,5,5,5,5,5,5,5,5,5,5,5,8, -6,6,8,8,0x17,0x17,5,4,4,8,6,0,0,0,0,0, -0,0,0,0,0,5,5,5,5,5,5,0,0,5,5,5, -5,5,5,0,0,5,5,5,5,5,5,0,0,0,0,0, -0,0,0,0,5,5,5,5,5,5,5,0,5,5,5,5, -5,5,5,0,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x1a, -4,4,4,4,2,2,2,2,2,2,2,2,2,4,0x1a,0x1a, -0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,5,5,5,8,8,6,8,8,6,8,8,0x17, -8,6,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, -0,0,0,0,5,5,5,5,0,0,0,0,0,0,0,0, +0x1a,0x1a,0x1a,4,4,4,4,4,4,4,4,4,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, +4,1,2,5,4,4,2,5,5,5,5,5,0x1a,0x1a,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,2,2,1,2, +1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, +4,2,2,2,2,2,2,2,2,1,2,1,2,1,1,2, +1,2,1,2,1,2,1,2,4,0x1a,0x1a,1,2,1,2,5, +1,2,1,2,2,2,1,2,1,2,1,2,1,2,1,2, +1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2, +1,2,1,2,1,2,1,2,1,1,1,1,2,1,2,0, +0,0,0,0,1,2,0,2,0,2,1,2,1,2,0,0, +0,0,0,0,5,5,6,5,5,5,6,5,5,5,5,6, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,8,8,6,6,8,0x1b,0x1b,0x1b,0x1b, +6,0,0,0,0x34cb,0x344b,0x3ccb,0x37cb,0x35cb,0x3fcb,0x1b,0x1b,0x19,0x1b,0,0, 0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x17,0x17,0x17,0x17,0,0,0,0, +0,0,0,0,8,8,8,8,6,6,0,0,0,0,0,0, +0,0,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0,0,8,8,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0,0,0,0,5,5,5,5,5,5,5,0,0,0,0,5, +5,5,5,5,8,8,8,8,8,8,8,8,8,8,8,8, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,5,5,5,5,5,5,0x17,0x17,0x17,5,0x17,5,5,6, +5,5,5,5,5,5,6,6,6,6,6,6,6,6,0x17,0x17, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +5,5,5,6,6,6,6,6,6,6,6,6,6,6,8,8, +0,0,0,0,0,0,0,0,0,0,0,0x17,8,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,4,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0x17,0x17,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6, +8,8,6,6,6,6,8,8,6,6,8,8,5,5,5,5, +5,6,4,5,5,5,5,5,5,5,5,5,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,5,5,5,5,5,0,5,5,5,5, +5,5,5,5,5,6,6,6,6,6,6,8,8,6,6,8, +8,6,6,0,0,0,0,0,0,0,0,0,5,5,5,6, +5,5,5,5,5,5,5,5,6,8,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0x17,0x17,0x17,0x17,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5, +5,5,5,0x1b,0x1b,0x1b,5,8,6,8,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,6,5,6,6, +6,5,5,6,6,5,5,5,5,5,6,6,5,6,5,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,5,4,0x17,0x17,5,5,5,5, +5,5,5,5,5,5,5,8,6,6,8,8,0x17,0x17,5,4, +4,8,6,0,0,0,0,0,0,0,0,0,0,5,5,5, +5,5,5,0,0,5,5,5,5,5,5,0,0,5,5,5, +5,5,5,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,0,5,5,5,5,5,5,5,0,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,0x1a,4,4,4,4,2,2,2,2, +2,2,2,2,2,4,0x1a,0x1a,0,0,0,0,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,5,5,5,8, +8,6,8,8,6,8,8,0x17,8,6,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,0,0,5,5,5,5, +5,5,5,0,0,0,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0x12,0x12,0x12,0x12, 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, -0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11, 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, -0x11,0x11,0x11,0x11,5,5,5,5,5,5,5,5,5,5,5,0x605, -5,5,5,5,5,5,5,0x7c5,5,5,5,5,0x5c5,5,5,5, +0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,5,5,5,5, +5,5,5,5,5,5,5,0x605,5,5,5,5,5,5,5,0x7c5, +5,5,5,5,0x5c5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x6c5,5,0x6c5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x7c5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0x18,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,5,5,5,5, +5,0,5,0,5,5,0,5,5,0,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,2,2,2,2,2,2,2,0,0,0,0,0, +0,0,0,0,0,0,0,2,2,2,2,2,0,0,0,0, +0,5,6,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, +0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,0x15,0x14,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0x1b, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,0x19,0x1b,0x1b,0x1b, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,0x15,0x17,0,0,0,0,0,0, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +0x17,0x13,0x13,0x16,0x16,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14, +0x15,0x17,0x17,0x14,0x15,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x17,0x17,0x17,0, +0x17,0x17,0x17,0x17,0x13,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x17,0x18,0x13, +0x18,0x18,0x18,0,0x17,0x19,0x17,0x17,0,0,0,0,5,5,5,5, +5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,0x6c5,5,0x6c5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,0,0x10,0,0,5,5,5,5,5,5,0,0,5,5, +5,5,5,5,0,0,5,5,5,5,5,5,0,0,5,5, +5,0,0,0,0x19,0x19,0x18,0x1a,0x1b,0x19,0x19,0,0x1b,0x18,0x18,0x18, +0x18,0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0x10,0x10,0x10, +0x1b,0x1b,0,0,0,0x17,0x17,0x17,0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18, +0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17, +0x18,0x18,0x18,0x17,0x1a,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0x14, +0x18,0x15,0x18,0x14,0x15,0x17,0x14,0x15,0x17,0x17,5,5,5,5,5,5, +5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,0x7c5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,4,4,5,5,5,5,5,5,5,5, +5,5,5,5,0,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0, +5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,0,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,0x18,5,5,5,5,5,5,5,5,5,5, -5,5,5,0,5,5,5,5,5,0,5,0,5,5,0,5, -5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,2,2,2,2, -2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2, -2,2,2,2,0,0,0,0,0,5,6,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x1a,0x1a, -0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x15,0x14, +5,5,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0, +0,0,0,0,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b, +0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x17,0x17,0x17,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b, +0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b, +0x900b,0x980b,0xa00b,0xa80b,0x7ca,0x7ca,0x7ca,0x7ca,0x7ca,0xcca,0x11ca,0x11ca,0x11ca,0x11ca,0x1e4a,0x880a, +0x980a,0x980a,0x980a,0x980a,0x980a,0x784a,0x984a,0x68a,0x11ca,0x344b,0x344b,0x388b,0x3ccb,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x54b,0x34cb,0x1b,0x1b,0x1b,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0, +0x34ca,0x344a,0x58a,0x68a,0x11ca,0x980a,0x984a,0x988a,0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x984a,0x68a, +0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x788a,0x988a,0x7ca,0x58a,0x58a,0x58a,0x5ca,0x5ca,0x5ca,0x5ca,0x68a, +0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,0,0, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,0x19,0x1b,0,0,6,6,6,6,6,6,6,6, -6,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14, -0x15,0x17,0,0,0,0,0,0,6,6,6,6,6,6,6,6, -6,6,6,6,6,6,6,6,0x17,0x13,0x13,0x16,0x16,0x14,0x15,0x14, -0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x14,0x15,0x17,0x17,0x14,0x15,0x17,0x17,0x17, -0x17,0x16,0x16,0x16,0x17,0x17,0x17,0,0x17,0x17,0x17,0x17,0x13,0x14,0x15,0x14, -0x15,0x14,0x15,0x17,0x17,0x17,0x18,0x13,0x18,0x18,0x18,0,0x17,0x19,0x17,0x17, -0,0,0,0,5,5,5,5,5,0,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0,0,0x10,0,0,5,5, -5,5,5,5,0,0,5,5,5,5,5,5,0,0,5,5, -5,5,5,5,0,0,5,5,5,0,0,0,0x19,0x19,0x18,0x1a, -0x1b,0x19,0x19,0,0x1b,0x18,0x18,0x18,0x18,0x1b,0x1b,0,0,0,0,0, -0,0,0,0,0,0x10,0x10,0x10,0x1b,0x1b,0,0,0,0x17,0x17,0x17, -0x19,0x17,0x17,0x17,0x14,0x15,0x17,0x18,0x17,0x13,0x17,0x17,0x49,0x89,0xc9,0x109, -0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x18,0x18,0x18,0x17,0x1a,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,0x14,0x18,0x15,0x18,0x14,0x15,0x17,0x14,0x15, -0x17,0x17,5,5,5,5,5,5,5,5,5,5,4,5,5,5, +5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +6,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b, +0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0,0,0,0, +0x58b,0x68b,0x7cb,0x11cb,0,0,0,0,0,0,0,0,0,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4, -5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,5, +5,0x1bca,5,5,5,5,5,5,5,5,0xb80a,0,0,0,0,0, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0,0,5,5,5,5, +5,5,5,5,5,5,6,6,6,6,6,0,0,0,0,0, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,0,0,0,0,0,0xb00b,0xb80b,0x784b,0x804b, -0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b, -0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x17,0x17,0x17,0, -0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b, -0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0x7ca,0x7ca,0x7ca,0x7ca, -0x7ca,0xcca,0x11ca,0x11ca,0x11ca,0x11ca,0x1e4a,0x880a,0x980a,0x980a,0x980a,0x980a,0x980a,0x784a,0x984a,0x68a, -0x11ca,0x344b,0x344b,0x388b,0x3ccb,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x54b,0x34cb,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x34ca,0x344a,0x58a,0x68a,0x11ca,0x980a,0x984a,0x988a, -0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x984a,0x68a,0x7ca,0x11ca,0x1e4a,0x980a,0x784a,0x788a,0x988a,0x7ca, -0x58a,0x58a,0x58a,0x5ca,0x5ca,0x5ca,0x5ca,0x68a,0x1b,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,6,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,6,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, -0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b, -0xa00b,0xa80b,0xb00b,0xb80b,0,0,0,0,0x58b,0x68b,0x7cb,0x11cb,0,0,0,0, -0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0x1bca,5,5,5,5,5,5, -5,5,0xb80a,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6, -6,6,6,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,0,0x17,5,5,5,5,0,0,0,0, -5,5,5,5,5,5,5,5,0x17,0x58a,0x5ca,0x7ca,0xa4a,0x1e4a,0,0, -0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, -0x249,0x289,0,0,0,0,0,0,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0x17, +5,5,5,5,0,0,0,0,5,5,5,5,5,5,5,5, +0x17,0x58a,0x5ca,0x7ca,0xa4a,0x1e4a,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,0,0,0,0,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, -2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5, -0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0, -0,0,0,0x17,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0,5,5,0,0,0, -5,0,0,5,5,5,5,5,5,5,0,0,5,0,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,0,0x17,0x58b,0x5cb,0x60b,0x7cb,0xa4b,0x1e4b,0x784b,0x788b, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,0,0,0,0,2,2,2,2,2,2,2,2, +5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,0x1b,0x1b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b, -0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x64b,0x68b,0x7cb,0xa4b,0x1e4b, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0x17,1,1,1,1, +1,1,1,1,1,1,1,0,1,1,1,1,2,2,0,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2, +2,2,2,2,2,2,0,2,2,0,0,0,1,1,1,1, +1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0, +1,1,0,2,2,2,2,2,2,2,2,2,5,5,5,5, +5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,4,0,4,4, +4,4,4,4,4,4,4,0,0,0,0,0,4,4,4,4, +4,4,0,4,4,4,4,4,4,4,4,4,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,0,5,5,0,0,0,5,0,0,5,5,5,5,5, +5,5,0,0,5,0,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0x17, +0x58b,0x5cb,0x60b,0x7cb,0xa4b,0x1e4b,0x784b,0x788b,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x1b, +0x1b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,0,0,0,0,0,0,0,0x58b, +0x5cb,0x60b,0x64b,0x64b,0x68b,0x7cb,0xa4b,0x1e4b,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,5,5,0,0, +0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x58b,0x7cb, +0xa4b,0x1e4b,0x5cb,0x60b,0,0,0,0x17,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,0,5,5,0,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b, +5,5,0,0,0,0,0,0x17,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b, +0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x88cb,0x90cb,0x98cb,0xa0cb,0xa8cb,0xb0cb,0xb8cb,0x36cb,0x354b, +0x34cb,0x348b,0x46cb,0x344b,0x4ecb,0x388b,0x3ccb,0x454b,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,0x58b,0x7cb,0xa4b,0x1e4b,0x5cb,0x60b,0,0,0,0x17, +0,0,0,0,0x5ecb,0x344b,5,5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b, +0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0,0,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b, +0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,0x30b,0x34b,0x38b,0x3cb,0x7cb,0xa4b,0x1e4b,0x784b, +0x344b,0,0,0,0,0,0,0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0,0,0,0,0,0,0,5,6,6,6,0,6,6,0, +0,0,0,0,6,6,6,6,5,5,5,5,0,5,5,5, +0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,0,0,6,6,6,0, +0,0,0,6,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0x17, -0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x88cb, -0x90cb,0x98cb,0xa0cb,0xa8cb,0xb0cb,0xb8cb,0x36cb,0x354b,0x34cb,0x348b,0x46cb,0x344b,0x4ecb,0x388b,0x3ccb,0x454b, +5,0x58b,0x11cb,0x17,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,0,0,0,0,0x5ecb,0x344b,5,5, -0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb, -0,0,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b, -0x30b,0x34b,0x38b,0x3cb,0x7cb,0xa4b,0x1e4b,0x784b,0x344b,0,0,0,0,0,0,0, -0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0, -5,6,6,6,0,6,6,0,0,0,0,0,6,6,6,6, -5,5,5,5,0,5,5,5,0,5,5,5,5,5,5,5, +5,0x58b,0x7cb,0xa4b,5,5,5,5,5,6,6,0,0,0,0,0x58b, +0x68b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,0x1b,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,0,0,6,6,6,0,0,0,0,6,5,5,5,5, +5,5,5,5,5,5,0,0,0,0x17,0x17,0x17,0x17,0x17,0x17,0x17, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0x58b,0x11cb,0x17,5,5,5,5, +5,5,5,5,5,5,0,0,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0x58b,0x7cb,0xa4b,5,5,5,5, -5,6,6,0,0,0,0,0x58b,0x68b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17, -0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,5,5,5,5, -5,5,5,5,0x1b,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0, -0,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0, -0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0, -0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0, -0,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0,0, -0,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0, -0,0,0x58b,0x68b,0x7cb,0x11cb,0x1e4b,0x784b,5,5,5,5,6,6,6,6, -0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, -0x249,0x289,0,0,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb, -0x50b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b, -0xa80b,0xb00b,0xb80b,0x344b,0x34cb,0x348b,0x388b,0,5,5,5,5,5,5,5,5, -5,5,0,6,6,0x13,0,0,5,5,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0x784b, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,0xccb,0x1e4b,0x344b,5, -0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6, -6,6,6,6,6,0x58b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,0x17,0,0, -0,0,0,0,5,5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b, +5,5,0,0,0,0,0,0,0,0x17,0x17,0x17,0x17,0,0,0, +0,0,0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x784b,0x49,0x89,0xc9,0x109,0x149,0x189, -0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,6,8,6,8,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17, -0x17,0x17,0,0,0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb, -0xa4b,0xccb,0xf4b,0x11cb,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,8,8,8,6,6,6,6,8,8,6,6,0x17, -0x17,0x10,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0, -0,0x10,0,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, -0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5, -5,5,5,6,6,6,6,6,8,6,6,6,6,6,6,6, -6,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17, -5,8,8,5,0,0,0,0,0,0,0,0,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6, -0x17,0x17,5,0,0,0,0,0,0,0,0,0,8,5,5,5, -5,0x17,0x17,0x17,0x17,6,6,6,6,0x17,8,6,0x49,0x89,0xc9,0x109, -0x149,0x189,0x1c9,0x209,0x249,0x289,5,0x17,5,0x17,0x17,0x17,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8, -8,8,6,6,6,6,6,6,6,6,6,8,0,0x58b,0x5cb,0x60b, -0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b, -0x784b,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, -5,5,5,5,5,5,5,5,8,8,8,6,6,6,8,8, -6,8,6,6,0x17,0x17,0x17,0x17,0x17,0x17,6,0,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0, -5,0,5,5,5,5,0,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5, -5,0x17,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,8,8,8,6,6,6,6,6, -6,6,6,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, -0x249,0x289,0,0,0,0,0,0,5,5,8,8,0,0,6,6, -6,6,6,6,6,0,0,0,6,6,6,6,6,0,0,0, -0,0,0,0,0,0,0,0,6,6,8,8,0,5,5,5, -5,5,5,5,5,0,0,5,5,0,0,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5, -5,0,5,5,0,5,5,5,5,5,0,6,6,5,8,8, -6,8,8,8,8,0,0,8,8,0,0,8,8,8,0,0, -5,0,0,0,0,0,0,8,0,0,0,0,0,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,8,8,8,6,6,6,6,6,6,6,6, -8,8,6,6,6,8,6,5,5,5,5,0x17,0x17,0x17,0x17,0x17, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0,0x17,6,5, -5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -8,8,8,6,6,6,6,6,6,8,6,8,8,8,8,6, -6,8,6,6,5,5,0x17,5,0,0,0,0,0,0,0,0, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,8, -8,8,6,6,6,6,0,0,8,8,8,8,6,6,8,6, -6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, -0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,5,5,5,5,6,6,0,0, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -8,8,8,6,6,6,6,6,6,6,6,8,8,6,8,6, -6,0x17,0x17,0x17,5,0,0,0,0,0,0,0,0,0,0,0, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,0,0,0,0,0,0,0,0x58b,0x68b,0x7cb,0x11cb,0x1e4b,0x784b, +5,5,5,5,6,6,6,6,0,0,0,0,0,0,0,0, 0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, -0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0, +0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb, +0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0x344b,0x34cb,0x348b,0x388b,0, +5,5,5,5,5,5,5,5,5,5,0,6,6,0x13,0,0, +5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, +0,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0x58b,0x5cb,0x60b,0x64b,0x68b,0x7cb,0xa4b,0xccb,0x1e4b,0x344b,5,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6, +6,0x58b,0x7cb,0xa4b,0x1e4b,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0, +5,5,6,6,6,6,0x17,0x17,0x17,0x17,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,5,5,5,5,5,5,5,5,5,5,6,8,6,8,8, -6,6,6,6,6,6,8,6,5,0,0,0,0,0,0,0, -8,8,6,6,6,6,8,6,6,6,6,6,0,0,0,0, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0x17,0x17,0x17,0x1b, -5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,6, -6,6,6,6,6,6,6,6,8,6,6,0x17,0,0,0,0, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b, -0x16cb,0x194b,0x1bcb,0,0,0,0,0,0,0,0,0,0,0,0,5, -8,5,8,6,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, -5,5,5,5,5,5,5,0,0,5,0,0,5,5,5,5, -5,5,5,5,0,5,5,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,8,8,8,8,8,8,0,8, -8,0,0,6,6,8,6,5,6,5,0x17,5,8,0,0,0, +5,5,5,5,5,0x58b,0x5cb,0x60b,0x64b,0x7cb,0xa4b,0x1e4b,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x784b,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289, +6,5,5,6,6,5,0,0,0,0,0,0,0,0,0,6, +8,6,8,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +6,6,6,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0, +0,0,0x30b,0x34b,0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +8,8,8,6,6,6,6,8,8,6,6,0x17,0x17,0x10,0x17,0x17, +0x17,0x17,6,0,0,0,0,0,0,0,0,0,0,0x10,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,0,0,5,5,5,5,5,5,5,6, +6,6,6,6,8,6,6,6,6,6,6,6,6,0,0x49,0x89, +0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0x17,0x17,5,8,8,5, 0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,8,8,8,6,6,6,6, -0,0,6,6,8,8,8,8,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6, -6,8,5,6,6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,6, -0,0,0,0,0,0,0,0,5,6,6,6,6,6,6,8, -8,6,6,6,5,5,5,5,5,6,6,6,6,6,6,6, -6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,0x17,0x17,0x17,0,0,0,0,0, +5,5,5,5,5,5,5,5,6,6,6,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,6,0x17,0x17,5,0, +0,0,0,0,0,0,0,0,8,5,5,5,5,0x17,0x17,0x17, +0x17,6,6,6,6,0x17,8,6,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,5,0x17,5,0x17,0x17,0x17,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,8,8,8,6,6, +6,6,6,6,6,6,6,8,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, +0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x784b,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,8,8,8,6,6,6,8,8,6,8,6,6, +0x17,0x17,0x17,0x17,0x17,0x17,6,5,5,6,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,8, -6,6,0x17,0x17,0x17,5,0x17,0x17,5,0x17,0x17,0x17,0x17,0x17,0,0, -0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, -0x249,0x289,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb, -0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0,0,0,0x17,0x17,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,8,6,6,6,6,6,6,6,0,6,6,6,6, -6,6,8,6,6,6,6,6,6,6,6,6,0,8,6,6, -6,6,6,6,6,8,6,6,8,6,6,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,0,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,5,0,5,5, +5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,0,5,5,5,5,5,5,5,5,5,5,0x17,0,0, 0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,0,0,6,6,6,6,6,6,6,6,6,6, -6,6,6,6,6,6,5,6,0,0,0,0,0,0,0,0, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0, -5,5,5,5,5,5,5,0,5,5,0,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,6,6,6,6,6,6,0,0,0,6,0,6,6,0,6, -5,5,5,5,5,5,5,5,5,5,8,8,8,8,8,0, -6,6,0,8,8,6,8,6,5,0,0,0,0,0,0,0, -5,5,5,5,5,5,0,5,5,0,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,6,6,8,8,0x17,0x17,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x19,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0, -0,0,0,0,0,0,0,0,0,0,0,0x17,0xcd0b,0xcc0b,0xcb0b,0xd00b, -0xca0b,0xcf0b,0xcb4b,0xd04b,0xc90b,0x37cb,0x37cb,0x364b,0x35cb,0xc94b,0x3fcb,0x350b,0x34cb,0x344b,0x344b,0x3ccb, -0xcd0b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x19,0x19,0x34ca,0x354a,0x34ca,0x34ca, -0x344a,0x348a,0x388a,0xf4a,0x11ca,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0,0x17,0x17,0x17,0x17, -0x17,0,0,0,0,0,0,0,0,0,0,0,0x5ca,0x60a,0x64a,0x68a, -0x6ca,0x70a,0x74a,0x78a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x64a,0x68a,0x6ca,0x70a,0x74a, -0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x5ca, -0x60a,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0xc08a,0xc18a, -0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0x60a,0x60a,0x64a,0x64a,0x64a,0x64a,0x6ca,0x70a,0x70a,0x70a, -0x74a,0x74a,0x78a,0x78a,0x78a,0x78a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x58a,0x5ca,0x60a,0x64a,0x64a, -0x68a,0x68a,0x5ca,0x60a,0x58a,0x5ca,0x348a,0x388a,0x454a,0x348a,0x388a,0x35ca,5,5,5,5, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +5,5,5,5,8,8,8,6,6,6,6,6,6,6,6,0, +0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0,0,5,5,8,8,0,0,6,6,6,6,6,6, +6,0,0,0,6,6,6,6,6,0,0,0,0,0,0,0, +0,0,0,0,6,6,8,8,0,5,5,5,5,5,5,5, +5,0,0,5,5,0,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,5,5,5,5,5,5,5,0,5,5, +0,5,5,5,5,5,0,6,6,5,8,8,6,8,8,8, +8,0,0,8,8,0,0,8,8,8,0,0,5,0,0,0, +0,0,0,8,0,0,0,0,0,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,8,8,8,6,6,6,6,6,6,6,6,8,8,6,6, +6,8,6,5,5,5,5,0x17,0x17,0x17,0x17,0x17,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0x17,0x17,0,0x17,6,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,6, +6,6,6,6,6,8,6,8,8,8,8,6,6,8,6,6, +5,5,0x17,5,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,8,8,8,6,6, +6,6,0,0,8,8,8,8,6,6,8,6,6,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,5,5,5,5,6,6,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,8,8,8,6, +6,6,6,6,6,6,6,8,8,6,8,6,6,0x17,0x17,0x17, +5,0,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,0,0x10,0x10,0x10,0x10, -0x10,0x10,0x10,0x10,0x10,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,6,8,6,8,8,6,6,6,6, +6,6,8,6,5,0x17,0,0,0,0,0,0,8,8,6,6, +6,6,8,6,6,6,6,6,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0x17,0x17,0x17,0x1b,5,5,5,5, 5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, -0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0x17,0x17,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,8,8,8,6,6,6,6,6, +6,6,6,6,8,6,6,0x17,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0, +0,0,0,0,0,0,0,0,0,0,0,5,8,5,8,6, +0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5, +5,5,5,0,0,5,0,0,5,5,5,5,5,5,5,5, +0,5,5,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,8,8,8,8,8,8,0,8,8,0,0,6, +6,8,6,5,6,5,0x17,5,8,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,0,0,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,8,8,8,6,6,6,6,0,0,6,6, +8,8,8,8,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,6,6,6,6,6,6,8,5,6, +6,6,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,6,0,0,0,0, +0,0,0,0,5,6,6,6,6,6,6,8,8,6,6,6, +5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6, +6,6,6,8,6,6,0x17,0x17,0x17,5,0x17,0x17,5,0x17,0x17,0x17, +0x17,0x17,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x70b,0x74b,0x78b,0x7cb, +0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0,0,0,0x17,0x17,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,8,6,6,6,6,6,6,6,0, +6,6,6,6,6,6,8,6,6,6,6,6,6,6,6,6, +0,8,6,6,6,6,6,6,6,8,6,6,8,6,6,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,5,6,0,0,0,0, +0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0,0,5,5,5,5,5,5,5,0,5,5,0,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,6,6,6,6,6,6,0,0,0,6,0, +6,6,0,6,5,5,5,5,5,5,5,5,5,5,8,8, +8,8,8,0,6,6,0,8,8,6,8,6,5,0,0,0, +0,0,0,0,5,5,5,5,5,5,0,5,5,0,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,6,6,8,8,0x17,0x17,0,0,0, +0,0,0,0,6,8,6,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x17,0x17,0x17,0x17,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0,0, +0,0,0,0,6,6,5,8,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,8,8,6,6, +6,6,6,0,0,0,8,8,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x19,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0, +0,0,0,0,0,0,0,0x17,0xcd0b,0xcc0b,0xcb0b,0xd00b,0xca0b,0xcf0b,0xcb4b,0xd04b, +0xc90b,0x37cb,0x37cb,0x364b,0x35cb,0xc94b,0x3fcb,0x350b,0x34cb,0x344b,0x344b,0x3ccb,0xcd0b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x19,0x19,0x34ca,0x354a,0x34ca,0x34ca,0x344a,0x348a,0x388a,0xf4a, +0x11ca,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0,0x17,0x17,0x17,0x17,0x17,0,0,0, +0,0,0,0,0,0,0,0,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a, +0x60a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a, +0x64a,0x68a,0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x64a,0x68a,0x5ca,0x60a,0x60a,0x64a,0x68a, +0x6ca,0x70a,0x74a,0x78a,0x58a,0x5ca,0x60a,0x60a,0x64a,0x68a,0xc08a,0xc18a,0x58a,0x5ca,0x60a,0x60a, +0x64a,0x68a,0x60a,0x60a,0x64a,0x64a,0x64a,0x64a,0x6ca,0x70a,0x70a,0x70a,0x74a,0x74a,0x78a,0x78a, +0x78a,0x78a,0x5ca,0x60a,0x64a,0x68a,0x6ca,0x58a,0x5ca,0x60a,0x64a,0x64a,0x68a,0x68a,0x5ca,0x60a, +0x58a,0x5ca,0x348a,0x388a,0x454a,0x348a,0x388a,0x35ca,5,5,5,5,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x17,0x17,0,0,0,0,0, +0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,6,5,5,5,5,5,5,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0, +0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, +0x249,0x289,0,0,0,0,0,0,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,0,0,6,6,6,6, 6,0x17,0,0,0,0,0,0,0,0,0,0,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0, @@ -1228,113 +1262,134 @@ static const uint16_t propsTrie_index[22276]={ 0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +4,4,4,4,0,4,4,4,4,4,4,4,0,4,4,0, 5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,5,5,5,0,0,0,0,0,0,0,0,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0, -0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5, -5,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,0,0,0x1b,6,6,0x17,0x10,0x10,0x10,0x10,0,0,0,0, +0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,5,5,5,0,0,5,0,0,0,0,0,0, +0,0,0,0,5,5,5,5,0,0,0,0,0,0,0,0, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,0,0,0,0,0,5,5,5,5,5,5,5,5, +5,5,5,5,5,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,0,0,0x1b,6,6,0x17,0x10,0x10,0x10,0x10, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, -0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,8,8,6,6,6,0x1b,0x1b, -0x1b,8,8,8,8,8,8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,6, -6,6,6,6,6,6,6,0x1b,0x1b,6,6,6,6,6,6,6, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0x1b,0x1b,6,6,6,0x1b,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,0,0,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0, +0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,8,8,6,6,6,0x1b,0x1b,0x1b,8,8,8, +8,8,8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,6,6,6,6,6, +6,6,6,0x1b,0x1b,6,6,6,6,6,6,6,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,6,6,6,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,6,6,0x1b,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0x54b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0x80b, -0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,0,0,0,0,0,0,0,0, -0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb, -0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x58b,0x5cb,0x60b,0x64b,0x68b,0x58b,0x68b,0,0,0, -0,0,0,0,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289, -0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189, -0x1c9,0x209,0x249,0x289,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,2,2,2,2,2,2,2,0,2,2,2,2,2,2, -2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,1,0,1,1,0,0,1,0, -0,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1, -1,1,2,2,2,2,0,2,0,2,2,2,2,2,2,2, -0,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2, -1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1, -1,0,1,1,1,1,1,1,1,0,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,1,1,0,1,1,1,1,0,1,1,1,1, -1,0,1,0,0,0,1,1,1,1,1,1,1,0,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, +0,0,0,0,0,0,0,0,0x54b,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, +0x74b,0x78b,0x7cb,0x80b,0x84b,0x88b,0x8cb,0x90b,0x94b,0x98b,0x9cb,0xa0b,0,0,0,0, +0,0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b, +0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x58b,0x5cb,0x60b,0x64b,0x68b,0x58b, +0x68b,0,0,0,0,0,0,0,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189, +0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89, +0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,2,2,2,2,2,2,2,0,2,2, +2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2, -2,2,0,0,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,0x18,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,1,0,1,1, +0,0,1,0,0,1,1,0,0,1,1,1,1,0,1,1, +1,1,1,1,1,1,2,2,2,2,0,2,0,2,2,2, +2,2,2,2,0,2,2,2,2,2,2,2,2,2,2,2, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +2,2,2,2,1,1,0,1,1,1,1,0,0,1,1,1, +1,1,1,1,1,0,1,1,1,1,1,1,1,0,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,0x18,2,2,2,2,2,2,1,1, +2,2,2,2,2,2,2,2,1,1,0,1,1,1,1,0, +1,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1, +1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,0x18,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,0x18,2,2, -2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,2,2,2,0x18,2,2,2,2,2,2,1,2, -0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289,0x49,0x89,0xc9,0x109, -0x149,0x189,0x1c9,0x209,0,6,6,6,6,6,6,6,6,6,6,6, -6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6, -6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b,0x1b,6, -6,6,6,6,6,6,6,6,6,6,6,6,6,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -6,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,0, -6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, -6,0,0,6,6,6,6,6,6,6,0,6,6,0,6,6, -6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, -0x249,0x289,0,0,0,0,5,0x1b,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,5,0,0,0,6,6,6,6,6,6,6,4, -4,4,4,4,4,4,0,0,5,5,5,5,5,5,5,5, -5,5,5,5,6,6,6,6,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, -0x249,0x289,0,0,0,0,0,0x19,5,5,5,5,5,0,0,0x58b, -0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,6,6,6,6,6,6,6,0, -0,0,0,0,0,0,0,0,2,2,2,2,6,6,6,6, -6,6,6,4,0,0,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209, -0x249,0x289,0,0,0,0,0x17,0x17,1,1,2,2,2,2,2,2, +1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, -0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x78cb,0x794b,0x814b,0x58b,0x5cb,0x60b,0x64b,0x68b, -0x6cb,0x70b,0x74b,0x78b,0x1b,0x34cb,0x344b,0x3ccb,0x19,0x58b,0x5cb,0x788b,0x78cb,0,0,0, -0,0,0,0,0,0,0,0,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b, -0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b, -0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x984b,0xa04b,0xa84b,0xb04b,0xb84b,0x788b,0x808b,0x888b, -0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x1b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb, -0x900b,0xa00b,0x804b,0x788b,0x344b,0x354b,0,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b, -0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b,0x800b,0x880b,0x900b,0x980b, -0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x18,0x18,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,5,5,5,5,0,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,0,5,5,0,5,0,0,5, -0,5,5,5,5,5,5,5,5,5,5,0,5,5,5,5, -0,5,0,5,0,0,0,0,0,0,5,0,0,0,0,5, -0,5,0,5,0,5,5,5,0,5,5,0,5,0,0,5, -0,5,0,5,0,5,0,5,0,5,5,0,5,0,0,5, -5,5,5,0,5,5,5,5,5,5,5,0,5,5,5,5, -0,5,5,5,5,0,5,0,5,5,5,5,5,5,5,5, -5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,0,0,0,0,0,5,5,5,0,5,5,5, -5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +2,2,2,2,2,2,0,0,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,0x18,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,0x18,2,2,2,2, +2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,0x18,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,0x18,2,2,2,2,2,2,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,2,2,2,0x18,2,2,2,2, +2,2,1,2,0,0,0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0x249,0x289, +0x49,0x89,0xc9,0x109,0x149,0x189,0x1c9,0x209,0,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0x1b, +0x1b,0x1b,0x1b,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,6,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,6,0x1b,0x1b,0x17,0x17,0x17,0x17,0x17,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6, +6,6,6,0,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,0,0,6,6,6,6,6,2,2,2,2, +2,2,2,2,2,2,5,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0, +0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,6,6,0,6, +6,0,6,6,6,6,6,0,0,0,0,0,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4, +4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,5,0x1b,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,0,0,0,6,6,6,6, +6,6,6,4,4,4,4,4,4,4,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,6,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +5,5,5,5,5,5,5,5,6,6,6,6,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0x19,5,5,5,5, +5,5,5,5,5,5,5,4,6,6,6,6,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0,0,5,5,5,5, +5,5,5,0,5,5,5,5,0,5,5,0,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,0,5,5,5,5, +5,0,0,0x58b,0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,6,6,6,6, +6,6,6,0,0,0,0,0,0,0,0,0,2,2,2,2, +6,6,6,6,6,6,6,4,0,0,0,0,0x49,0x89,0xc9,0x109, +0x149,0x189,0x1c9,0x209,0x249,0x289,0,0,0,0,0x17,0x17,1,1,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0x58b,0x5cb,0x60b, +0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x78cb,0x794b,0x814b,0x58b, +0x5cb,0x60b,0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x1b,0x34cb,0x344b,0x3ccb,0x19,0x58b,0x5cb,0x788b, +0x78cb,0,0,0,0,0,0,0,0,0,0,0,0x16cb,0x194b,0x1bcb,0x1e4b, +0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0x984b,0xa04b,0xa84b,0xb04b, +0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x78cb,0x80cb,0x984b,0xa04b,0xa84b,0xb04b, +0xb84b,0x788b,0x808b,0x888b,0x908b,0x988b,0xa08b,0xa88b,0xb08b,0xb88b,0x1b,0x5cb,0x60b,0x64b,0x68b,0x6cb, +0x70b,0x74b,0x78b,0x7cb,0x900b,0xa00b,0x804b,0x788b,0x344b,0x354b,0,0,0,0x58b,0x5cb,0x60b, +0x64b,0x68b,0x6cb,0x70b,0x74b,0x78b,0x7cb,0xa4b,0xccb,0xf4b,0x11cb,0x144b,0x16cb,0x194b,0x1bcb,0x1e4b, +0x800b,0x880b,0x900b,0x980b,0xa00b,0xa80b,0xb00b,0xb80b,0x784b,0x804b,0x884b,0x904b,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0x18,0x18,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5, +0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,0,5,5,0, +5,0,0,5,0,5,5,5,5,5,5,5,5,5,5,0, +5,5,5,5,0,5,0,5,0,0,0,0,0,0,5,0, +0,0,0,5,0,5,0,5,0,5,5,5,0,5,5,0, +5,0,0,5,0,5,0,5,0,5,0,5,0,5,5,0, +5,0,0,5,5,5,5,0,5,5,5,5,5,5,5,0, +5,5,5,5,0,5,5,5,5,0,5,0,5,5,5,5, +5,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,0,0,0,5,5,5, +0,5,5,5,5,5,0,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x2cb,0x2cb,0x30b,0x34b, 0x38b,0x3cb,0x40b,0x44b,0x48b,0x4cb,0x50b,0x54b,0x54b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, @@ -1350,52 +1405,50 @@ static const uint16_t propsTrie_index[22276]={ 0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0x1b, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0,0,0,0,0x1b,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0, -0x1b,0x1b,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0, -0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0x1b,0x1b,0x1b,0,0,0,0,0, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0,0,0,0, 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, -0,0,0,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0,0,0,0,0,0,0,0,0,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0, -0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,5,0x705,5,5, +0x1b,0x1b,0x1b,0,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, +5,0x705,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,0x645,5,5,5, +0x645,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x645,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,0x645,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,0x685,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,0x685,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0xcc5, +5,5,5,5,5,5,5,5,0xf45,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,0xf45,5,5,5,5,5,5,5, +5,5,5,5,5,5,0x6c5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,0x605,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,0xcc5,5,5,5,5, -5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,0xf45,5,5,5,5,5,5,5,5,5,5,5, -5,5,0x6c5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,0x605,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,0x605,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,0x605,5,5,5, +0x605,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0x605, +5,5,5,5,5,5,5,5,5,5,5,5,5,0x645,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,0x605,5,5,5,5, -5,5,5,5,5,5,5,5,5,0x645,5,5,5,5,5,5, +5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 0x785,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, @@ -1411,2450 +1464,2564 @@ static const uint16_t propsTrie_index[22276]={ static const UTrie2 propsTrie={ propsTrie_index, - propsTrie_index+4532, - NULL, - 4532, - 17744, + propsTrie_index+4692, + nullptr, + 4692, + 18464, 0xa40, - 0x1234, + 0x12d4, 0x0, 0x0, 0x110000, - 0x5700, - NULL, 0, FALSE, FALSE, 0, NULL + 0x5a70, + nullptr, 0, false, false, 0, nullptr }; -static const uint16_t propsVectorsTrie_index[31228]={ -0x4e8,0x4f0,0x4f8,0x500,0x518,0x520,0x528,0x530,0x538,0x540,0x548,0x550,0x558,0x560,0x568,0x570, -0x577,0x57f,0x587,0x58f,0x592,0x59a,0x5a2,0x5aa,0x5b2,0x5ba,0x5c2,0x5ca,0x5d2,0x5da,0x5e2,0x5ea, -0x5f2,0x5fa,0x601,0x609,0x611,0x619,0x621,0x629,0x631,0x639,0x63e,0x646,0x64d,0x655,0x65d,0x665, -0x66d,0x675,0x67d,0x685,0x68c,0x694,0x69c,0x6a4,0x6ac,0x6b4,0x6bc,0x6c4,0x6cc,0x6d4,0x6dc,0x6e4, -0x1a38,0xd5e,0xe35,0x6ec,0x508,0xe9c,0xea4,0x1bf2,0x1300,0x1310,0x12f8,0x1308,0x7c5,0x7cb,0x7d3,0x7db, -0x7e3,0x7e9,0x7f1,0x7f9,0x801,0x807,0x80f,0x817,0x81f,0x825,0x82d,0x835,0x83d,0x845,0x84d,0x854, -0x85c,0x862,0x86a,0x872,0x87a,0x880,0x888,0x890,0x898,0x1318,0x8a0,0x8a8,0x8b0,0x8b7,0x8bf,0x8c7, -0x8cf,0x8d3,0x8db,0x8e2,0x8ea,0x8f2,0x8fa,0x902,0x162c,0x1634,0x90a,0x912,0x91a,0x922,0x92a,0x931, -0x1692,0x1682,0x168a,0x1973,0x197b,0x1328,0x939,0x1320,0x1572,0x1572,0x1574,0x133c,0x133d,0x1330,0x1332,0x1334, -0x169a,0x169c,0x941,0x169c,0x949,0x94e,0x956,0x16a1,0x95c,0x169c,0x962,0x96a,0xc39,0x16a9,0x16a9,0x972, -0x16b9,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba,0x16ba, -0x16ba,0x16ba,0x16ba,0x16b1,0x97a,0x16c2,0x16c2,0x982,0xb59,0xb61,0xb69,0xb71,0x16d2,0x16ca,0x98a,0x992, -0x99a,0x16dc,0x16e4,0x9a2,0x16da,0x9aa,0x1a40,0xd66,0xb79,0xb81,0xb89,0xb8e,0x18e1,0xc6c,0xc73,0x1849, -0xc09,0x1a48,0xd6e,0xd76,0xd7e,0xd86,0xf47,0xf48,0x1939,0x193e,0xca8,0xcb0,0x19af,0x19b7,0x1b11,0xe3d, -0x19bf,0xcf2,0xcfa,0x19c7,0x10f6,0x1196,0xf27,0xd8e,0x1869,0x1851,0x1861,0x1859,0x18f9,0x18f1,0x18b9,0xc19, -0x1345,0x1345,0x1345,0x1345,0x1348,0x1345,0x1345,0x1350,0x9b2,0x1358,0x9b6,0x9be,0x1358,0x9c6,0x9ce,0x9d6, -0x1368,0x1360,0x1370,0x9de,0x9e6,0x1378,0x9ee,0x9f6,0x1380,0x1388,0x1390,0x1398,0x9fe,0x13a0,0x13a7,0x13af, -0x13b7,0x13bf,0x13c7,0x13cf,0x13d7,0x13de,0x13e6,0x13ee,0x13f6,0x13fe,0x1401,0x1403,0x16ec,0x17dc,0x17e2,0x1929, -0x140b,0xa06,0xa0e,0x1525,0x152a,0x152d,0x1535,0x1413,0x153d,0x153d,0x1423,0x141b,0x142b,0x1433,0x143b,0x1443, -0x144b,0x1453,0x145b,0x1463,0x17ea,0x1841,0x1983,0x1ad9,0x1473,0x147a,0x1482,0x148a,0x146b,0x1492,0x17f2,0x17f9, -0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x16f4,0x1801,0x1804,0x1801,0x1801,0x180c,0x1813,0x1815,0x181c, -0x1824,0x1828,0x1828,0x182b,0x1828,0x1828,0x1831,0x1828,0x1871,0x1931,0x198b,0xb96,0xb9c,0x1c36,0x1c3e,0x1d15, -0x18d1,0xc49,0xc4d,0x1946,0x18c1,0x18c1,0x18c1,0xc21,0x18c9,0xc41,0x1911,0xc98,0xc29,0xc31,0xc31,0x19cf, -0x1901,0x1993,0xc83,0xc88,0xa16,0x16fc,0x16fc,0xa1e,0x1704,0x1704,0x1704,0x1704,0x1704,0x1704,0xa26,0x6f0, -0x155a,0x157c,0xa2e,0x1584,0xa36,0x158c,0x1594,0x159c,0xa3e,0xa43,0x15a4,0x15ab,0xa48,0x170c,0x1921,0xc11, -0xa50,0x1606,0x160d,0x15b3,0x1615,0x161c,0x15bb,0x15bf,0x15d8,0x15d8,0x15da,0x15c7,0x15cf,0x15cf,0x15d0,0x1624, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714, -0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1714,0x1717,0x1879,0x1879, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2, -0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e2,0x15e9,0x1a30,0x12b5, -0x171f,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725, -0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725,0x1725, -0x1725,0x1725,0x1725,0x1725,0xa58,0x172d,0xa60,0x1a50,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db,0x19db, -0x19d7,0xd02,0x19eb,0x19e3,0x19ed,0x1a58,0x1a58,0xd96,0x18d9,0x194e,0x19a3,0x19a7,0x199b,0x1b09,0xcb8,0xcbb, -0x1909,0xc90,0x1956,0xcc3,0x19f5,0x19f8,0xd0a,0x1a60,0x1a08,0x1a00,0xd12,0xd9e,0x1a68,0x1a6c,0xda6,0xff0, -0x1a10,0xd1a,0xd22,0x1a74,0x1a84,0x1a7c,0xdae,0xef7,0xe45,0xe4d,0x1c85,0xfa8,0x1d32,0x1d32,0x1a8c,0xdb6, -0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675, -0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677, -0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679, -0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674, -0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676, -0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678, -0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a, -0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675, -0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677, -0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679, -0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674, -0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676, -0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678, -0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a, -0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675, -0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677, -0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679, -0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674, -0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676, -0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678, -0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a, -0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0x167a,0x1674,0x1675,0x1676,0x1677,0x1678,0x1679,0xa68,0xdbe,0xdc1, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c, -0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c,0x164c, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, -0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1,0x15f1, -0x15f6,0x15fe,0x1839,0x12bd,0x1919,0x1919,0x12c1,0x12c8,0xa70,0xa78,0xa80,0x14b2,0x14b9,0x14c1,0xa88,0x14c9, -0x14fa,0x14fa,0x14a2,0x14aa,0x14d1,0x14f1,0x14f2,0x1502,0x14d9,0x149a,0xa90,0x14e1,0xa98,0x14e9,0xaa0,0xaa4, -0xca0,0x150a,0xaac,0xab4,0x1512,0x1518,0x151d,0xabc,0xacc,0x1562,0x156a,0x154d,0x1552,0xad4,0xadc,0xac4, -0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c, -0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x163c,0x1644,0x1644,0x1644,0x1644, -0x1420,0x1420,0x1460,0x14a0,0x14e0,0x1520,0x1560,0x15a0,0x15dc,0x161c,0x1648,0x1688,0x16c8,0x1708,0x1748,0x1788, -0x17c8,0x1804,0x1844,0x1884,0x18c4,0x18f8,0x1934,0x1974,0x19b4,0x19f4,0x1a30,0x1a70,0x1ab0,0x1af0,0x1b30,0x1b70, -0xa80,0xac0,0xb00,0xb40,0xb80,0xa40,0xe75,0xa40,0xe97,0xa40,0xa40,0xa40,0xa40,0xbc0,0x12dd,0x12dd, -0xed7,0xc00,0xa40,0xa40,0xa40,0xa40,0xf17,0xc2d,0xa40,0xa40,0xc6d,0xcad,0xced,0xd2d,0xe35,0xda5, -0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d,0x121d, -0x121d,0x121d,0x121d,0x121d,0xf57,0x125d,0x1092,0x10d2,0x129d,0x10dd,0x131d,0x131d,0x131d,0xf97,0xfb7,0xff7, -0x135d,0x135d,0x1037,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7, -0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0xfb7,0x1052, +static const uint16_t propsVectorsTrie_index[32764]={ +0x53e,0x546,0x54e,0x556,0x56e,0x576,0x57e,0x586,0x58e,0x596,0x59e,0x5a6,0x5ae,0x5b6,0x5be,0x5c6, +0x5cd,0x5d5,0x5dd,0x5e5,0x5e8,0x5f0,0x5f8,0x600,0x608,0x610,0x618,0x620,0x628,0x630,0x638,0x640, +0x648,0x650,0x657,0x65f,0x667,0x66f,0x677,0x67f,0x687,0x68f,0x694,0x69c,0x6a3,0x6ab,0x6b3,0x6bb, +0x6c3,0x6cb,0x6d3,0x6db,0x6e2,0x6ea,0x6f2,0x6fa,0x702,0x70a,0x712,0x71a,0x722,0x72a,0x732,0x73a, +0x1b43,0xd8f,0xe5b,0x1192,0x12d1,0x1d0b,0x1eaa,0x1d03,0x13f0,0x1400,0x13e8,0x13f8,0x80f,0x815,0x81d,0x825, +0x82d,0x833,0x83b,0x843,0x84b,0x851,0x859,0x861,0x869,0x86f,0x877,0x87f,0x887,0x88f,0x897,0x89e, +0x8a6,0x8ac,0x8b4,0x8bc,0x8c4,0x8ca,0x8d2,0x8da,0x8e2,0x1408,0x8ea,0x8f2,0x8fa,0x901,0x909,0x911, +0x919,0x91d,0x925,0x92c,0x934,0x93c,0x944,0x94c,0x1723,0x172b,0x954,0x95c,0x964,0x96c,0x974,0x97b, +0x1789,0x1779,0x1781,0x1a7e,0x1a86,0x1418,0x983,0x1410,0x166c,0x166c,0x166e,0x142c,0x142d,0x1420,0x1422,0x1424, +0x1791,0x1793,0x98b,0x1793,0x993,0x998,0x9a0,0x1798,0x9a6,0x1793,0x9ac,0x9b4,0xc6f,0x17a0,0x17a0,0x9bc, +0x17b0,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1,0x17b1, +0x17b1,0x17b1,0x17b1,0x17a8,0x9c4,0x17b9,0x17b9,0x9cc,0xb97,0xb9f,0xba7,0xbaf,0x17c9,0x17c1,0x9d4,0x9dc, +0x9e4,0x17d3,0x17db,0x9ec,0x17d1,0x9f4,0x1b4b,0xd97,0xbb7,0xbbf,0xbc7,0xbcc,0x19e4,0xc96,0xc9d,0x1940, +0xc47,0x1b53,0xd9f,0xda7,0xdaf,0xdb7,0xf65,0xf69,0x1a44,0x1a49,0xcd5,0xcdd,0x1aba,0x1ac2,0x1c23,0xe63, +0x1aca,0xd23,0xd2b,0x1ad2,0x110a,0x11ba,0xf3d,0xdbf,0x1960,0x1948,0x1958,0x1950,0x19fc,0x19f4,0x19b0,0x1a3c, +0x1435,0x1435,0x1435,0x1435,0x1438,0x1435,0x1435,0x1440,0x9fc,0x1448,0xa00,0xa08,0x1448,0xa10,0xa18,0xa20, +0x1458,0x1450,0x1460,0xa28,0xa30,0x1468,0xa38,0xa40,0x1470,0x1478,0x1480,0x1488,0xa48,0x1490,0x1497,0x149f, +0x14a7,0x14af,0x14b7,0x14bf,0x14c7,0x14ce,0x14d6,0x14de,0x14e6,0x14ee,0x14f1,0x14f3,0x17e3,0x18d6,0x18dc,0x1a2c, +0x14fb,0xa50,0xa58,0x1621,0x1626,0x1629,0x162f,0x1503,0x1637,0x1637,0x1513,0x150b,0x151b,0x1523,0x152b,0x1533, +0x153b,0x1543,0x154b,0x1553,0x18e4,0x1938,0x1a8e,0x1beb,0x1563,0x1569,0x1571,0x1579,0x155b,0x1581,0x18ec,0x18f3, +0x17eb,0x17eb,0x17eb,0x17eb,0x17eb,0x17eb,0x17eb,0x17eb,0x18fb,0x18fb,0x18fb,0x18fb,0x1903,0x190a,0x190c,0x1913, +0x191b,0x191f,0x191f,0x1922,0x191f,0x191f,0x1928,0x191f,0x1968,0x1a34,0x1a96,0xbd4,0xbda,0x1d4f,0x1d57,0x1e35, +0x19d4,0x19c8,0x19cc,0x1a51,0x19b8,0x19b8,0x19b8,0xc57,0x19c0,0xc77,0x1a14,0xcc5,0xc5f,0xc67,0xc67,0x1ada, +0x1a04,0x1a9e,0xcad,0xcb5,0xa60,0x17f3,0x17f3,0xa68,0x17fb,0x17fb,0x17fb,0x17fb,0x17fb,0x17fb,0xa70,0x742, +0x1654,0x1676,0xa78,0x167e,0xa80,0x1686,0x168e,0x1696,0xa88,0xa8d,0x169e,0x16a5,0xa92,0x1803,0x1a24,0xc4f, +0xa9a,0x1700,0x1707,0x16ad,0x170f,0x1713,0x16b5,0x16b9,0x16d2,0x16d2,0x16d4,0x16c1,0x16c9,0x16c9,0x16ca,0x171b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b, +0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180b,0x180e,0x1970,0x1970, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc, +0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16dc,0x16e3,0x1b3b,0x1f16, +0x1816,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c, +0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c,0x181c, +0x181c,0x181c,0x181c,0x181c,0xaa2,0x1824,0xaaa,0x1b5b,0x1ae6,0x1ae6,0x1ae6,0x1ae6,0x1ae6,0x1ae6,0x1ae6,0x1ae6, +0x1ae2,0xd33,0x1af6,0x1aee,0x1af8,0x1b63,0x1b63,0xdc7,0x19dc,0x1a59,0x1aae,0x1ab2,0x1aa6,0x1c1b,0xce5,0xcec, +0x1a0c,0xcbd,0x1a61,0xcf4,0x1b00,0x1b03,0xd3b,0x1b6b,0x1b13,0x1b0b,0xd43,0xdcf,0x1b73,0x1b77,0xdd7,0x1014, +0x1b1b,0xd4b,0xd53,0x1b7f,0x1b8f,0x1b87,0xddf,0xf0d,0xe6b,0xe73,0x1da5,0xfc4,0x1e52,0x1e52,0x1b97,0xde7, +0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c, +0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e, +0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770, +0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b, +0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d, +0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f, +0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771, +0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c, +0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e, +0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770, +0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b, +0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d, +0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f, +0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771, +0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c, +0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e, +0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770, +0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b, +0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d, +0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f, +0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771, +0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0x1771,0x176b,0x176c,0x176d,0x176e,0x176f,0x1770,0xab2,0xdef,0xdf2, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743, +0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743,0x1743, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f, +0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x163f,0x16eb,0x16eb,0x16eb,0x16eb,0x16eb,0x16eb,0x16eb,0x16eb, +0x16f0,0x16f8,0x1930,0x139d,0x1a1c,0x1a1c,0x13a1,0x13a8,0xaba,0xac2,0xaca,0x15a1,0x15a8,0x15b0,0xad2,0x15b8, +0x15f6,0x15f6,0x1589,0x1591,0x15c0,0x15ed,0x15ee,0x15fe,0x15c8,0x15cd,0x15d5,0x15dd,0xada,0x15e5,0xae2,0x1599, +0xccd,0x1606,0xaea,0xaf2,0x160e,0x1614,0x1619,0xafa,0xb0a,0x165c,0x1664,0x1647,0x164c,0xb12,0xb1a,0xb02, +0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733, +0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x1733,0x173b,0x173b,0x173b,0x173b, +0x1578,0x1578,0x15b8,0x15f8,0x1638,0x1678,0x16b8,0x16f8,0x1734,0x1774,0x17a0,0x17e0,0x1820,0x1860,0x18a0,0x18e0, +0x1920,0x195c,0x199c,0x19dc,0x1a1c,0x1a50,0x1a8c,0x1acc,0x1b0c,0x1b4c,0x1b88,0x1bc8,0x1c08,0x1c48,0x1c88,0x1cc8, +0xe59,0xa80,0xac0,0xb00,0xb40,0xb6b,0xf99,0xa40,0xed9,0xa40,0xa40,0xa40,0xa40,0xbab,0x13f5,0x13f5, +0xf19,0xfd9,0xa40,0xa40,0xa40,0xbeb,0xf59,0xc2b,0xa40,0xc51,0xc91,0xcd1,0xd11,0xd51,0xe99,0xdc9, +0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335,0x1335, +0x1335,0x1335,0x1335,0x1335,0x1019,0x1375,0x116a,0x11aa,0x13b5,0x11b5,0x1435,0x1435,0x1435,0x1059,0x108c,0x10cc, +0x1475,0x1475,0x11f5,0x14b5,0x110c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c, +0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x108c,0x112a, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, 0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, -0xde5,0xdf5,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, -0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd65, -0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d, -0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x111d, -0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd, -0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x11dd,0x115d, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0xba4,0xbab,0xbb3,0xbbb,0x1881,0x1881,0x1881,0xbc3,0xbcb,0xbce,0x18b1,0x18a9,0xc01,0xd2a,0xd2e,0xd32, -0x508,0x508,0x508,0x508,0xd3a,0x1a18,0xd42,0xf3f,0x1735,0xae4,0xaea,0x1000,0xbd6,0x18e9,0xc7b,0x508, -0x174a,0x173d,0x1742,0x1889,0xbde,0xbe6,0x1134,0x113a,0x1c6d,0xf5d,0x1c5d,0x6f8,0x508,0x508,0x508,0x508, -0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0x1c8d,0xfb0,0xfb8,0xfc0,0x508,0x508,0x508,0x508, -0xbee,0xbf1,0xdc9,0x1cd5,0xff8,0x700,0x508,0x1092,0xccb,0xd4a,0x508,0x508,0x1c02,0xeff,0xf07,0x1d1d, -0xc55,0xc5c,0xc64,0x1a94,0x1cb5,0x508,0x1c95,0xfd0,0x1a9c,0xdd1,0xdd9,0xde1,0x1020,0x708,0x508,0x508, -0x1aa4,0x1aa4,0x710,0x508,0x1d4a,0x10aa,0x1d42,0x10b2,0x1e0e,0x11ac,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0xde9,0x1e66,0x1291,0x508,0x508,0x1e2e,0x11d4,0x11db,0x718,0x508,0x71c,0x1248,0x11e3, -0x1b19,0x1b1b,0xe55,0xe5c,0x1aac,0x1ab4,0xdf1,0xf1f,0x1bfa,0xee7,0xeef,0xfc8,0x1c1a,0x1c1e,0x1c26,0x1040, -0xf93,0xf98,0x724,0x508,0x109a,0x10a2,0x1c7d,0xfa0,0xf75,0xf7b,0xf83,0xf8b,0x508,0x508,0x508,0x508, -0x1daa,0x1da2,0x1124,0x112c,0x1cfd,0x1cf5,0x1068,0x508,0x508,0x508,0x508,0x508,0x1ce5,0x1028,0x1030,0x1038, -0x1cad,0x1ca5,0xfe0,0x111c,0x1c2e,0xf2f,0x72c,0x508,0x1078,0x1080,0x508,0x508,0x508,0x508,0x508,0x508, -0x1e06,0x118e,0x734,0x508,0x508,0x1d0d,0x1d05,0x1070,0x1250,0x1256,0x125e,0x508,0x508,0x11eb,0x11ef,0x11f7, -0x1dde,0x1dd6,0x1176,0x1dce,0x1dc6,0x73c,0x1cdd,0x1018,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x10da,0x10df,0x10e7,0x10ee,0x110e,0x1114,0x508,0x508,0x115a,0x115e,0x1166,0x119e,0x11a4,0x744,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x11bc,0x508,0x508,0x508,0x508,0x508,0x748,0x1e4e,0x1238, -0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e, -0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x195e,0x1963,0xcd3,0xcda,0xcda,0xcda, -0x196b,0x196b,0x196b,0xce2,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x1d3a,0x750,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23,0x1b23, -0x1b23,0xe64,0xfe8,0x758,0x508,0x508,0x75c,0xf37,0x1ccd,0x1cc5,0x1008,0x1010,0x764,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x1e26,0x1e1e,0x11cc,0x508,0x508,0x508,0x1c12,0x1c12,0xf0f,0x1c0a,0xf17,0x508,0x508,0x1106, -0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba, -0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dba,0x1dbe,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76, -0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1e76,0x1266,0x126c,0x1286,0x1289,0x1289,0x1289,0x76c,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c65,0x1c65,0x1c65, -0xf50,0xf55,0x774,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1752,0x1752,0x1752, -0x1752,0x1752,0x1752,0x1752,0xaf2,0x1762,0xafa,0x1763,0x175a,0x176b,0x1771,0x1779,0xb02,0x18a1,0x18a1,0x77c, -0x508,0x508,0x508,0x508,0x11c4,0x1891,0x1891,0xbf9,0xcea,0x508,0x508,0x508,0x508,0x17aa,0x17b1,0xb0a, -0x17b4,0xb12,0xb1a,0xb22,0x17ae,0xb2a,0xb32,0xb3a,0x17b3,0x17bb,0x17aa,0x17b1,0x17ad,0x17b4,0x17bc,0x17ab, -0x17b2,0x17ae,0xb41,0x1781,0x1789,0x1790,0x1797,0x1784,0x178c,0x1793,0x179a,0xb49,0x17a2,0x1d62,0x1d62,0x1d62, -0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d62,0x1d52,0x1d55,0x1d52, -0x1d5c,0x10ca,0x784,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x10fe,0x78c,0x508, -0x508,0x508,0x508,0x508,0x508,0x1e46,0x11ff,0x794,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x1e56,0x1240,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1c9d,0x1c9d,0x1c9d, -0x1c9d,0x1c9d,0x1c9d,0xfd8,0x508,0x1d9a,0x1d92,0x10d2,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x798,0x1e16,0x11b4,0x508,0x508,0x1207,0x1208,0x7a0,0x508,0x508,0x508,0x508,0x508,0xeac,0xeb4,0xebc, -0xec4,0xecc,0xed4,0xedb,0xedf,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x7a4,0x1048,0x1ced,0x104e,0x1ced,0x1056,0x105b,0x1060,0x1060,0x1d72,0x1d82,0x1d8a, -0x10ba,0x1d7a,0x1e36,0x10c2,0x1dee,0x1e3e,0x1e3e,0x117e,0x1186,0x121f,0x1225,0x122a,0x1230,0x1e5e,0x1e5e,0x1e5e, -0x1e5e,0x1274,0x1e5e,0x127a,0x127e,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac, -0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac,0x7ac, -0x7ac,0x7ac,0x7ac,0x7ac,0x7ad,0xb51,0x17c4,0x17c4,0x17c4,0x7b5,0x7b5,0x7b5,0x7b5,0x1899,0x1899,0x1899, -0x1899,0x1899,0x1899,0x1899,0x7bd,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, -0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, -0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, -0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x7b5, -0x7b5,0x7b5,0x7b5,0x7b5,0x7b5,0x1a20,0xd52,0x1a28,0x1a28,0xd56,0xe6c,0xe74,0xe7c,0x1ae9,0x1ad1,0x1af1, -0x1af9,0x1ae1,0xe01,0xe05,0xe0c,0xe14,0xe1b,0xe23,0xe2b,0xe2d,0xe2d,0xe2d,0xe2d,0x1b5a,0x1b62,0x1b5a, -0x1b68,0x1b70,0x1b3b,0x1b78,0x1b80,0x1b5a,0x1b88,0x1b90,0x1b97,0x1b9f,0x1b43,0x1b5a,0x1ba4,0x1b4b,0x1b52,0x1bac, -0x1bb2,0x1c4e,0x1c55,0x1c46,0x1bba,0x1bc2,0x1bca,0x1bd2,0x1cbd,0x1bda,0x1be2,0xe84,0xe8c,0x1b2b,0x1b2b,0x1b2b, -0xe94,0x1c75,0x1c75,0xf65,0xf6d,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc, -0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abe,0x1abc,0x1ac6,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc, -0x1ac9,0x1abc,0x1abc,0x1abc,0x1abc,0x1abc,0xdf9,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d25, -0x1d25,0x1d25,0x1d25,0x1d25,0x1d25,0x1d2a,0x1d25,0x1d25,0x1d25,0x1088,0x108a,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1142,0x1b33,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x1de6,0x114a, -0x1152,0x1210,0x1217,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x1dfe,0x116e,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x508, -0x508,0x508,0x508,0x508,0x508,0x508,0x508,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, -0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, -0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, -0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x12d0,0x1299,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, -0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, -0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x12a1,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4, -0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x17d4,0x12d8,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x12a5,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, -0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, -0x1e6e,0x12ad,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299,0x1299, -0x1299,0x12a5,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x12e0,0x1bea,0x1bea,0x1bea,0x1bea, -0x1bea,0x1bea,0x12e8,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x12f0,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1654,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x165c,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664, -0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x1664,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c, -0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x166c,0x17cc,0x17cc,0x17cc, -0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, -0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, -0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc, -0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x17cc,0x1b01,0x1b01,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01, -0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1b01,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a, -0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1d6a,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2, -0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1db2,0x1df6,0x1df6,0x1df6, -0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, -0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, -0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6, -0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1df6,0x1e6e,0x1e6e,0x1e6e, -0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, -0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, -0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e, -0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x1e6e,0x4e7,0x4e7,0x4e7, -0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2ca,0x2d3,0x2cd,0x2cd,0x2d0,0x2c7,0x2c7, -0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7, -0x7fb,0x7f5,0x7da,0x7d1,0x7c8,0x7c5,0x7bc,0x7d7,0x7c2,0x7ce,0x7d1,0x7ec,0x7e3,0x7d4,0x7f8,0x7cb, -0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7e0,0x7dd,0x7e6,0x7e6,0x7e6,0x7f5, -0x7bc,0x807,0x807,0x807,0x807,0x807,0x807,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801, -0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x801,0x7c2,0x7c8,0x7ce,0x7f2,0x7b6, -0x7ef,0x804,0x804,0x804,0x804,0x804,0x804,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe, -0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7fe,0x7c2,0x7e9,0x7bf,0x7e6,0x2c7, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, +0xe09,0xe19,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40, +0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xa40,0xd89, +0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5, +0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x12b5,0x1235, +0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5, +0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x12f5,0x1275, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0xc2c,0xc2f,0xdfa,0x1df5,0x101c,0x74a,0x55e,0x10b6,0xcfc,0xd7b,0x55e,0x55e,0x1d1b,0xf15,0xf1d,0x1e3d, +0xc7f,0xc86,0xc8e,0x1b9f,0x1dd5,0x55e,0x1db5,0xfec,0x1ba7,0xe02,0xe0a,0xe12,0x1044,0x752,0x55e,0x55e, +0x1baf,0x1baf,0x75a,0x55e,0x1e6a,0x10ce,0x1e62,0x10d6,0x1f56,0x11d0,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0xe1a,0x1fae,0x12c9,0x134b,0x134c,0x1f76,0x11f8,0x11ff,0x1206,0x1308,0x130c,0x1280,0x1216, +0x1c2b,0x1c2d,0xe7b,0xe82,0x1bb7,0x1bbf,0xe22,0xf35,0x1d13,0xefd,0xf05,0xfe4,0x1d33,0x1d37,0x1d3f,0x1064, +0xfb4,0x1d95,0x762,0x55e,0x10be,0x10c6,0x1d9d,0xfbc,0xf96,0xf9c,0xfa4,0xfac,0x55e,0x55e,0x55e,0x55e, +0x1eda,0x1ed2,0x1140,0x1148,0x1e1d,0x1e15,0x108c,0x55e,0x55e,0x55e,0x55e,0x55e,0x1e05,0x104c,0x1054,0x105c, +0x1dcd,0x1dc5,0xffc,0x1138,0x1d47,0xf45,0x76a,0x55e,0x109c,0x10a4,0x772,0x55e,0x55e,0x55e,0x55e,0x55e, +0x1f4e,0x11b2,0x77a,0x55e,0x55e,0x1e2d,0x1e25,0x1094,0x1288,0x128e,0x1296,0x55e,0x55e,0x121e,0x1222,0x122a, +0x1f0e,0x1f06,0x119a,0x1efe,0x1ef6,0x118a,0x1dfd,0x103c,0x135c,0x135f,0x135f,0x55e,0x55e,0x55e,0x55e,0x55e, +0x10ee,0x10f3,0x10fb,0x1102,0x112a,0x1130,0x55e,0x55e,0x116e,0x1172,0x117a,0x11c2,0x11c8,0x782,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x11e0,0x136f,0x1374,0x137c,0x55e,0x55e,0x786,0x1f96,0x1270, +0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69, +0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a69,0x1a6e,0xd04,0xd0b,0xd0b,0xd0b, +0x1a76,0x1a76,0x1a76,0xd13,0x1e5a,0x1e5a,0x1e5a,0x1e5a,0x1e5a,0x1e5a,0x78e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x792,0x1fc6,0x1fc6,0x12d9,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35, +0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0xe8a,0x1004,0x100c,0x1fce, +0x1314,0x131c,0xf4d,0x1ded,0x1de5,0x102c,0x1034,0x79a,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x1f6e,0x1f66,0x11f0, +0x55e,0x55e,0x55e,0x1d2b,0x1d2b,0xf25,0x1d23,0xf2d,0x55e,0x55e,0x1122,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x79e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x1d7d,0x1d7d,0x1d7d,0xf71,0xf76, +0x7a6,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x1fde,0x133c,0x1343,0x1fd6,0x1fd6,0x1fd6,0x7ae, +0x55e,0x1849,0x1849,0x1849,0x1849,0x1849,0x1849,0x1849,0xb30,0x1859,0xb38,0x185a,0x1851,0x1862,0x1868,0x1870, +0xb40,0x1998,0x1998,0x7b6,0x55e,0x55e,0x55e,0x1367,0x11e8,0x1988,0x1988,0xc37,0xd1b,0x55e,0x55e,0x55e, +0x55e,0x18a1,0x18a8,0xb48,0x18ab,0xb50,0xb58,0xb60,0x18a5,0xb68,0xb70,0xb78,0x18aa,0x18b2,0x18a1,0x18a8, +0x18a4,0x18ab,0x18b3,0x18a2,0x18a9,0x18a5,0xb7f,0x1878,0x1880,0x1887,0x188e,0x187b,0x1883,0x188a,0x1891,0xb87, +0x1899,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82,0x1e82, +0x1e82,0x1e72,0x1e75,0x1e72,0x1e7c,0x10de,0x7be,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x12f5,0x12fd,0x1300,0x1300,0x1300,0x1300,0x1300, +0x1300,0x1112,0x111a,0x1fe6,0x1354,0x7c6,0x55e,0x55e,0x55e,0x1f8e,0x1232,0x7ce,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x7d2,0x1324,0x1f9e,0x1278,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x7da,0x1384,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x12e1,0x1dbd,0x1dbd,0x1dbd,0x1dbd,0x1dbd,0x1dbd,0xff4,0x55e,0x1eca,0x1ec2,0x10e6,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x7e2,0x1f5e,0x11d8,0x55e,0x55e,0x123a,0x123b,0x7ea,0x55e,0x55e,0x55e,0x55e, +0x55e,0xec2,0xeca,0xed2,0xeda,0xee2,0xeea,0xef1,0xef5,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x7ee,0x106c,0x1e0d,0x1072,0x1e0d,0x107a,0x107f,0x1084, +0x1084,0x1e92,0x1eb2,0x1eba,0x1f26,0x1e9a,0x1f7e,0x1ea2,0x1f2e,0x1f86,0x1f86,0x11a2,0x11aa,0x1252,0x1258,0x1260, +0x1268,0x1fa6,0x1fa6,0x1fa6,0x1fa6,0x12ac,0x1fa6,0x12b2,0x12b6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6, +0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6, +0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f6,0x7f7,0xb8f,0x18bb,0x18bb,0x18bb,0x7ff,0x7ff,0x7ff, +0x7ff,0x1990,0x1990,0x1990,0x1990,0x1990,0x1990,0x1990,0x807,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff, +0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff, +0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff, +0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff, +0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0x7ff,0xbe2,0xbe9,0xbf1,0xbf9,0x1978,0x1978,0x1978, +0xc01,0xc09,0xc0c,0x19a8,0x19a0,0xc3f,0xd5b,0xd5f,0xd63,0x55e,0x55e,0x55e,0x55e,0xd6b,0x1b23,0xd73, +0xf5d,0x182c,0xb22,0xb28,0x1024,0xc14,0x19ec,0xca5,0x55e,0x1841,0x1834,0x1839,0x1980,0xc1c,0xc24,0x1150, +0x1156,0x1d85,0xf7e,0x1d75,0xf55,0x132c,0x1334,0x55e,0x55e,0x1dad,0x1dad,0x1dad,0x1dad,0x1dad,0x1dad,0x1dad, +0x1dad,0x1dad,0xfcc,0xfd4,0xfdc,0x12e9,0x12ed,0x55e,0x55e,0x1b2b,0xd83,0x1b33,0x1b33,0xd87,0xe92,0xe9a, +0xea2,0x1bfb,0x1be3,0x1c03,0x1c0b,0x1bf3,0xe2a,0xe2e,0xe35,0xe3d,0xe41,0xe49,0xe51,0xe53,0xe53,0xe53, +0xe53,0x1c6c,0x1c74,0x1c6c,0x1c7a,0x1c82,0x1c4d,0x1c8a,0x1c92,0x1c6c,0x1c9a,0x1ca2,0x1ca9,0x1cb1,0x1c55,0x1c6c, +0x1cb6,0x1c5d,0x1c64,0x1cbe,0x1cc4,0x1d66,0x1d6d,0x1d5f,0x1ccb,0x1cd3,0x1cdb,0x1ce3,0x1ddd,0x1ceb,0x1cf3,0xeaa, +0xeb2,0x1c3d,0x1c3d,0x1c3d,0xeba,0x1d8d,0x1d8d,0xf86,0xf8e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x1e45,0x1e45,0x1e45,0x1e45,0x1e45,0x1e45,0x1e45, +0x1e45,0x1e45,0x1e45,0x1e45,0x1e45,0x1e45,0x1e45,0x1e4a,0x1e45,0x1e45,0x1e45,0x10ac,0x10ae,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x115e,0x1c45,0x1f1e,0x1f1e,0x1f1e,0x1f1e,0x1f1e,0x1f1e, +0x1f1e,0x1f3e,0x1166,0x1243,0x124a,0x1f46,0x1f46,0x1f46,0x1f46,0x1f46,0x1f46,0x1f46,0x1f46,0x1f46,0x1f46,0x1f46, +0x1182,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7, +0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc9,0x1bc7,0x1bd1,0x1bc7,0x1bc7, +0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bd4,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bc7,0x1bdb,0x120e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea, +0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea,0x1eea, +0x1eee,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x1fbe,0x129e, +0x12a4,0x12be,0x12c1,0x12c1,0x12c1,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e, +0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x55e,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3, +0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3, +0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3, +0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c6, +0x138c,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36, +0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36, +0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x13d0,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6, +0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x1ff6,0x13e0,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x18ce,0x18ce,0x18ce,0x18ce, +0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x18ce,0x13b0,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138d,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1395,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138d,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x13b8,0x1cfb,0x1cfb,0x1cfb,0x1cfb,0x1cfb,0x1cfb,0x13c0,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x13c8,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36, +0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6, +0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x13d8, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x174b,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1753,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b,0x175b, +0x175b,0x175b,0x175b,0x175b,0x175b,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763,0x1763, +0x1763,0x1763,0x1763,0x1763,0x1763,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3, +0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3, +0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3, +0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x18c3, +0x18c3,0x18c3,0x18c3,0x18c3,0x18c3,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1c13, +0x1c13,0x1c13,0x1c13,0x1c13,0x1c13,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a, +0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1e8a,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2, +0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1ee2,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36, +0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36, +0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36, +0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1f36, +0x1f36,0x1f36,0x1f36,0x1f36,0x1f36,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6, +0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6, +0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6, +0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6, +0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fb6,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x1fee, +0x1fee,0x1fee,0x1fee,0x1fee,0x1fee,0x53d,0x53d,0x53d,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2, +0x2e2,0x2e5,0x2ee,0x2e8,0x2e8,0x2eb,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2, +0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x2e2,0x7da,0x7d4,0x7b9,0x79e,0x7aa,0x7a7,0x79e,0x7b6, +0x7a4,0x7b0,0x79e,0x7cb,0x7c2,0x7b3,0x7d7,0x7ad,0x79b,0x79b,0x79b,0x79b,0x79b,0x79b,0x79b,0x79b, +0x79b,0x79b,0x7bf,0x7bc,0x7c5,0x7c5,0x7c5,0x7d4,0x79e,0x7e6,0x7e6,0x7e6,0x7e6,0x7e6,0x7e6,0x7e0, +0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0, +0x7e0,0x7e0,0x7e0,0x7a4,0x7aa,0x7b0,0x7d1,0x798,0x7ce,0x7e3,0x7e3,0x7e3,0x7e3,0x7e3,0x7e3,0x7dd, +0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd, +0x7dd,0x7dd,0x7dd,0x7a4,0x7c8,0x7a1,0x7c5,0x2e2,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2e5,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6, -0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6, -0x2d9,0x651,0x810,0x813,0x657,0x813,0x80d,0x64e,0x645,0x2df,0x663,0x2e2,0x816,0x63c,0x65a,0x80a, -0x654,0x660,0x642,0x642,0x648,0x2dc,0x64e,0x64b,0x645,0x642,0x663,0x2e2,0x63f,0x63f,0x63f,0x651, -0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb, -0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x65d,0x66c,0x2eb,0x2eb,0x2eb,0x2eb,0x2eb,0x66c,0x666, -0x669,0x669,0x2e8,0x2e8,0x2e8,0x2e8,0x666,0x2e8,0x669,0x669,0x669,0x2e8,0x669,0x669,0x2e8,0x2e8, -0x666,0x2e8,0x669,0x669,0x2e8,0x2e8,0x2e8,0x65d,0x666,0x669,0x669,0x2e8,0x669,0x2e8,0x666,0x2e8, -0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee, -0x2f4,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee, -0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee, -0x2f7,0x66f,0x67b,0x675,0x2f7,0x2ee,0x2f7,0x2ee,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x67b, -0x675,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x672,0x67e,0x678,0x66f,0x2f7,0x672,0x2f7,0x2ee, -0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee, -0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x678,0x66f,0x2f7,0x2ee,0x2f7,0x672,0x2f7,0x2ee,0x2f7,0x2ee, -0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2f7,0x2ee,0x2f7,0x2ee,0x2f7,0x2ee,0x2f1, -0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x306,0x306, -0x306,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x306,0x306,0x2fa,0x2fa,0x2fa,0x306,0x306,0x2fa,0x306, -0x309,0x2fd,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x306,0x2fa,0x2fa,0x306,0x2fa,0x306,0x309, -0x2fd,0x306,0x306,0x306,0x2fa,0x306,0x2fa,0x306,0x306,0x2fa,0x2fa,0x303,0x306,0x2fa,0x2fa,0x2fa, -0x303,0x303,0x303,0x303,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x30c,0x30c,0x300,0x309,0x681,0x309, -0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x309,0x681,0x2fa,0x309,0x2fd, -0x309,0x2fd,0x309,0x2fd,0x306,0x2fa,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd, -0x2fd,0x30c,0x30c,0x300,0x309,0x2fd,0x9ea,0x9ea,0x9ed,0x9e7,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd, -0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd,0x309,0x2fd, -0x309,0x2fd,0x309,0x2fd,0x9ed,0x9e7,0x9ed,0x9e7,0x9ea,0x9e4,0x9ed,0x9e7,0xbaf,0xcb7,0x9ea,0x9e4, -0x9ea,0x9e4,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7,0x9ed,0x9e7, -0xcb7,0xcb7,0xcb7,0xdb6,0xdb6,0xdb6,0xdb9,0xdb9,0xdb6,0xdb9,0xdb9,0xdb6,0xdb6,0xdb9,0xefa,0xefd, -0xefd,0xefd,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0xefd,0xefa,0x30f,0x684,0x30f,0x30f, -0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x684,0x30f,0x30f, -0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f, -0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x312,0x30f,0x30f,0x30f, -0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f,0x30f, -0x30f,0x9f0,0x9f0,0x9f0,0x9f0,0x9f0,0xcba,0xcba,0x327,0x327,0x327,0x327,0x327,0x327,0x327,0x327, -0x327,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31e,0x31b,0x31b,0x318,0x318,0x68a,0x318,0x31e,0x68d, -0x321,0x68d,0x68d,0x68d,0x321,0x68d,0x31e,0x31e,0x690,0x324,0x318,0x318,0x318,0x318,0x318,0x318, -0x687,0x687,0x687,0x687,0x315,0x687,0x318,0xb25,0x327,0x327,0x327,0x327,0x327,0x318,0x318,0x318, -0x318,0x318,0x9f9,0x9f9,0x9f6,0x9f3,0x9f6,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd, -0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0xcbd,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, -0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, -0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, -0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, -0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x696,0x696,0x94b,0x696,0x696,0x94e,0xb28,0xb28, -0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xb28,0xc6c,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83,0xd83, -0xebe,0xebe,0xebe,0xebe,0xec1,0xd86,0xd86,0xd86,0x699,0x699,0xb2b,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4, -0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xcb4,0xfa8,0xfa5,0xfa8,0xfa5,0x333,0x33c,0xfa8,0xfa5, -9,9,0x342,0xf00,0xf00,0xf00,0x32a,0x14fd,9,9,9,9,0x33f,0x32d,0x351,0x330, -0x351,0x351,0x351,9,0x351,9,0x351,0x351,0x348,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f, -0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,9,0x69f,0x69f,0x69f,0x69f,0x69f, -0x69f,0x69f,0x351,0x351,0x348,0x348,0x348,0x348,0x348,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c, -0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x69c,0x345,0x69c,0x69c,0x69c,0x69c,0x69c, -0x69c,0x69c,0x348,0x348,0x348,0x348,0x348,0xfa8,0x354,0x354,0x357,0x351,0x351,0x354,0x34b,0x9fc, -0xbb8,0xbb5,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x34e,0x9fc,0x339,0x336,0x339,0x336,0x339,0x336, -0x339,0x336,0x339,0x336,0x339,0x336,0x339,0x336,0x354,0x354,0x34b,0x345,0xb67,0xb64,0xbb2,0xcc3, -0xcc0,0xcc6,0xcc3,0xcc0,0xdbc,0xdbf,0xdbf,0xdbf,0xa0b,0x6ab,0x363,0x366,0x363,0x363,0x363,0x366, -0x363,0x363,0x363,0x363,0x366,0xa0b,0x366,0x363,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8, -0x6a8,0x6ab,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8, -0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a8,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2, -0x6a2,0x6a5,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2,0x6a2, -0x6a2,0x6a2,0x6a2,0x6a2,0xa05,0x6a5,0x35d,0x360,0x35d,0x35d,0x35d,0x360,0x35d,0x35d,0x35d,0x35d, -0x360,0xa05,0x360,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, -0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x366,0x360,0x363,0x35d,0x363,0x35d, -0x363,0x35d,0x363,0x35d,0x363,0x35d,0x35a,0x957,0x95a,0x93c,0x93c,0x114f,0x9ff,0x9ff,0xbbe,0xbbb, -0xa08,0xa02,0xa08,0xa02,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, -0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, -0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d,0x363,0x35d, -0x363,0x35d,0x363,0x35d,0x363,0x366,0x360,0x363,0x35d,0xbbe,0xbbb,0x363,0x35d,0xbbe,0xbbb,0x363, -0x35d,0xbbe,0xbbb,0xf03,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x363,0x35d,0x366,0x360, -0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360,0x366,0x360,0x366,0x360,0x363,0x35d,0x366,0x360, -0xa0b,0xa05,0x366,0x360,0x366,0x360,0x366,0x360,0x366,0x360,0xdc5,0xdc2,0x366,0x360,0xf06,0xf03, -0xf06,0xf03,0xf06,0xf03,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a,0xc2d,0xc2a, -0xc2d,0xc2a,0xc2d,0xc2a,0xf33,0xf30,0xf33,0xf30,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020, -0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1023,0x1020,0x1188,0x1185,0x1371,0x136e,0x1536,0x1533,0x1536,0x1533, -0x1536,0x1533,0x1536,0x1533,0xc,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378, -0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0xc, -0xc,0x37b,0x369,0x369,0x369,0x36f,0x369,0x36c,0x1941,0x372,0x372,0x372,0x372,0x372,0x372,0x372, -0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372, -0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x372,0x375,0x1941,0x37e,0xa0e,0xc, -0xc,0x1500,0x1500,0x141c,0xf,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e, -0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0xdc8,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e,0x97e, -0x97e,0x97e,0x97e,0x97e,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0x381,0xf09,0x381, -0x381,0x381,0x38d,0x381,0x384,0x381,0x381,0x390,0x981,0xdcb,0xdce,0xdcb,0xf,0xf,0xf,0xf, -0xf,0xf,0xf,0xf,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393, -0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0xf, -0xf,0xf,0xf,0x1944,0x393,0x393,0x393,0x38a,0x387,0xf,0xf,0xf,0xf,0xf,0xf,0xf, -0xf,0xf,0xf,0xf,0xcdb,0xcdb,0xcdb,0xcdb,0x141f,0x1503,0xfb1,0xfb1,0xfb1,0xfae,0xfae,0xdd4, -0x8c7,0xcd5,0xcd2,0xcd2,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xcc9,0xfab,0xfab,0xfab,0xfab,0xfab,0x8c4, -0x14fa,0x12,0xdd7,0x8ca,0x1338,0x3ae,0x3b1,0x3b1,0x3b1,0x3b1,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, -0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xfb4, -0xfb4,0xfb4,0xfb4,0xfb4,0x8cd,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x942, -0x942,0x942,0x942,0x942,0x942,0x942,0x942,0xb5e,0xb5e,0xb5e,0xcc9,0xccf,0xccc,0xdd1,0xdd1,0xdd1, -0xdd1,0xdd1,0xdd1,0x1335,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x3a8,0x3a5, -0x3a2,0x39f,0xbc1,0xbc1,0x93f,0x3ae,0x3ae,0x3ba,0x3ae,0x3b4,0x3b4,0x3b4,0x3b4,0x3ae,0x3ae,0x3ae, -0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, -0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, +0,0,0,0,0,0,0,0,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x300,0x2f1,0x2f1, +0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1, +0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f1,0x2f4,0x64b,0x7ef,0x7f2,0x651,0x7f2,0x7ec,0x645, +0x63c,0x2fa,0x65a,0x2fd,0x7f5,0x633,0x648,0x7e9,0x64e,0x657,0x639,0x639,0x63f,0x2f7,0x645,0x642, +0x63c,0x639,0x65a,0x2fd,0x636,0x636,0x636,0x64b,0x306,0x306,0x306,0x306,0x306,0x306,0x663,0x306, +0x306,0x306,0x306,0x306,0x306,0x306,0x306,0x306,0x663,0x306,0x306,0x306,0x306,0x306,0x306,0x654, +0x663,0x306,0x306,0x306,0x306,0x306,0x663,0x65d,0x660,0x660,0x303,0x303,0x303,0x303,0x65d,0x303, +0x660,0x660,0x660,0x303,0x660,0x660,0x303,0x303,0x65d,0x303,0x660,0x660,0x303,0x303,0x303,0x654, +0x65d,0x660,0x660,0x303,0x660,0x303,0x65d,0x303,0x312,0x669,0x312,0x309,0x312,0x309,0x312,0x309, +0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x30f,0x666,0x312,0x669,0x312,0x309,0x312,0x309, +0x312,0x309,0x312,0x669,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x66f,0x666, +0x312,0x309,0x312,0x669,0x312,0x309,0x312,0x309,0x312,0x666,0x672,0x66c,0x312,0x309,0x312,0x309, +0x666,0x312,0x309,0x312,0x309,0x312,0x309,0x672,0x66c,0x66f,0x666,0x312,0x669,0x312,0x309,0x312, +0x669,0x675,0x66f,0x666,0x312,0x669,0x312,0x309,0x312,0x309,0x66f,0x666,0x312,0x309,0x312,0x309, +0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x66f,0x666, +0x312,0x309,0x312,0x669,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309,0x312,0x309, +0x312,0x312,0x309,0x312,0x309,0x312,0x309,0x30c,0x315,0x321,0x321,0x315,0x321,0x315,0x321,0x321, +0x315,0x321,0x321,0x321,0x315,0x315,0x321,0x321,0x321,0x321,0x315,0x321,0x321,0x315,0x321,0x321, +0x321,0x315,0x315,0x315,0x321,0x321,0x315,0x321,0x324,0x318,0x321,0x315,0x321,0x315,0x321,0x321, +0x315,0x321,0x315,0x315,0x321,0x315,0x321,0x324,0x318,0x321,0x321,0x321,0x315,0x321,0x315,0x321, +0x321,0x315,0x315,0x31e,0x321,0x315,0x315,0x315,0x31e,0x31e,0x31e,0x31e,0x327,0x327,0x31b,0x327, +0x327,0x31b,0x327,0x327,0x31b,0x324,0x678,0x324,0x678,0x324,0x678,0x324,0x678,0x324,0x678,0x324, +0x678,0x324,0x678,0x324,0x678,0x315,0x324,0x318,0x324,0x318,0x324,0x318,0x321,0x315,0x324,0x318, +0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318,0x318,0x327,0x327,0x31b,0x324,0x318,0x9cf,0x9cf, +0x9d2,0x9cc,0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318, +0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318,0x324,0x318,0x9d2,0x9cc,0x9d2,0x9cc, +0x9cf,0x9c9,0x9d2,0x9cc,0xb8e,0xc87,0x9cf,0x9c9,0x9cf,0x9c9,0x9d2,0x9cc,0x9d2,0x9cc,0x9d2,0x9cc, +0x9d2,0x9cc,0x9d2,0x9cc,0x9d2,0x9cc,0x9d2,0x9cc,0xc87,0xc87,0xc87,0xd80,0xd80,0xd80,0xd83,0xd83, +0xd80,0xd83,0xd83,0xd80,0xd80,0xd83,0xec1,0xec4,0xec4,0xec4,0xec4,0xec1,0xec4,0xec1,0xec4,0xec1, +0xec4,0xec1,0xec4,0xec1,0x32a,0x67b,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a, +0x32a,0x32a,0x32a,0x32a,0x32a,0x67b,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a, +0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a, +0x32a,0x32a,0x32a,0x32a,0x32d,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a, +0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x32a,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0xc8a,0xc8a, +0x342,0x342,0x342,0x342,0x342,0x342,0x342,0x342,0x342,0x339,0x339,0x339,0x339,0x339,0x339,0x339, +0x336,0x336,0x333,0x333,0x681,0x333,0x339,0x684,0x33c,0x684,0x684,0x684,0x33c,0x684,0x339,0x339, +0x687,0x33f,0x333,0x333,0x333,0x333,0x333,0x333,0x67e,0x67e,0x67e,0x67e,0x330,0x67e,0x333,0xb04, +0x342,0x342,0x342,0x342,0x342,0x333,0x333,0x333,0x333,0x333,0x9de,0x9de,0x9db,0x9d8,0x9db,0xc8d, +0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d,0xc8d, +0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a, +0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a, +0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a, +0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a,0x68a, +0x68d,0x68d,0x92d,0x68d,0x68d,0x930,0xb07,0xb07,0xb07,0xb07,0xb07,0xb07,0xb07,0xb07,0xb07,0xc3f, +0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xe85,0xe85,0xe85,0xe85,0xe88,0xd4d,0xd4d,0xd4d, +0x690,0x690,0xb0a,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84,0xc84, +0xf6f,0xf6c,0xf6f,0xf6c,0x34e,0x357,0xf6f,0xf6c,9,9,0x35d,0xec7,0xec7,0xec7,0x345,0x14b8, +9,9,9,9,0x35a,0x348,0x36c,0x34b,0x36c,0x36c,0x36c,9,0x36c,9,0x36c,0x36c, +0x363,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x696, +0x696,0x696,9,0x696,0x696,0x696,0x696,0x696,0x696,0x696,0x36c,0x36c,0x363,0x363,0x363,0x363, +0x363,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x693, +0x693,0x693,0x360,0x693,0x693,0x693,0x693,0x693,0x693,0x693,0x363,0x363,0x363,0x363,0x363,0xf6f, +0x36f,0x36f,0x372,0x36c,0x36c,0x36f,0x366,0x9e1,0xb97,0xb94,0x369,0x9e1,0x369,0x9e1,0x369,0x9e1, +0x369,0x9e1,0x354,0x351,0x354,0x351,0x354,0x351,0x354,0x351,0x354,0x351,0x354,0x351,0x354,0x351, +0x36f,0x36f,0x366,0x360,0xb46,0xb43,0xb91,0xc93,0xc90,0xc96,0xc93,0xc90,0xd86,0xd89,0xd89,0xd89, +0x9f0,0x6a2,0x37e,0x381,0x37e,0x37e,0x37e,0x381,0x37e,0x37e,0x37e,0x37e,0x381,0x9f0,0x381,0x37e, +0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x6a2,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f, +0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f,0x69f, +0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x69c,0x699,0x699,0x699,0x699,0x699,0x699, +0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x699,0x9ea,0x69c,0x378,0x37b, +0x378,0x378,0x378,0x37b,0x378,0x378,0x378,0x378,0x37b,0x9ea,0x37b,0x378,0x37e,0x378,0x37e,0x378, +0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378, +0x37e,0x378,0x381,0x37b,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x375,0x939, +0x93c,0x91e,0x91e,0x111c,0x9e4,0x9e4,0xb9d,0xb9a,0x9ed,0x9e7,0x9ed,0x9e7,0x37e,0x378,0x37e,0x378, +0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378, +0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378, +0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x378,0x37e,0x381,0x37b,0x37e, +0x378,0xb9d,0xb9a,0x37e,0x378,0xb9d,0xb9a,0x37e,0x378,0xb9d,0xb9a,0xeca,0x381,0x37b,0x381,0x37b, +0x37e,0x378,0x381,0x37b,0x37e,0x378,0x381,0x37b,0x381,0x37b,0x381,0x37b,0x37e,0x378,0x381,0x37b, +0x381,0x37b,0x381,0x37b,0x37e,0x378,0x381,0x37b,0x9f0,0x9ea,0x381,0x37b,0x381,0x37b,0x381,0x37b, +0x381,0x37b,0xd8f,0xd8c,0x381,0x37b,0xecd,0xeca,0xecd,0xeca,0xecd,0xeca,0xc03,0xc00,0xc03,0xc00, +0xc03,0xc00,0xc03,0xc00,0xc03,0xc00,0xc03,0xc00,0xc03,0xc00,0xc03,0xc00,0xefa,0xef7,0xefa,0xef7, +0xfea,0xfe7,0xfea,0xfe7,0xfea,0xfe7,0xfea,0xfe7,0xfea,0xfe7,0xfea,0xfe7,0xfea,0xfe7,0xfea,0xfe7, +0x1155,0x1152,0x132f,0x132c,0x14ee,0x14eb,0x14ee,0x14eb,0x14ee,0x14eb,0x14ee,0x14eb,0xc,0x393,0x393,0x393, +0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393,0x393, +0x393,0x393,0x393,0x393,0x393,0x393,0x393,0xc,0xc,0x396,0x384,0x384,0x384,0x38a,0x384,0x387, +0x18f9,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d, +0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d,0x38d, +0x38d,0x38d,0x38d,0x390,0x18f9,0x399,0x9f3,0xc,0xc,0x14bb,0x14bb,0x13d7,0xf,0x960,0x960,0x960, +0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0xd92,0x960, +0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x960,0x39c,0x39c,0x39c,0x39c, +0x39c,0x39c,0x39c,0x39c,0x39c,0x39c,0xed0,0x39c,0x39c,0x39c,0x3a8,0x39c,0x39f,0x39c,0x39c,0x3ab, +0x963,0xd95,0xd98,0xd95,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0x3ae,0x3ae,0x3ae,0x3ae, 0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae, -0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14,0xa14,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14, -0x3b1,0x3ae,0x3b1,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xa14, -0x3ae,0x3ae,0x3ae,0x3b1,0x95d,0x3ae,0x399,0x399,0x399,0x399,0x399,0x399,0x399,0x396,0x39f,0x39c, -0x39c,0x399,0x399,0x399,0x399,0x3b7,0x3b7,0x399,0x399,0x39f,0x39c,0x39c,0x39c,0x399,0xcd8,0xcd8, -0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0x3ab,0xa14,0xa14,0xa14,0xa11,0xa11,0xcd8, -0xa29,0xa29,0xa29,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa23,0xa20,0xa23,0xa20,0x15,0xa2c, -0xa26,0xa17,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26, -0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xa26,0xcde,0xcde,0xcde, -0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d,0xa1d, -0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0xa1a,0x15,0x15,0xcde,0xcde,0xcde, -0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37, -0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0xe37,0x1035,0x1035, -0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035,0x1035, -0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32, -0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32, -0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f,0xa2f, -0xa2f,0xbc4,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, -0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4b,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e, -0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e, -0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf4e,0xf42,0xf42,0xf42,0xf42,0xf42, -0xf42,0xf42,0xf42,0xf42,0xf51,0xf51,0xf45,0xf45,0xf48,0xf57,0xf54,0x10b,0x10b,0x1968,0x196b,0x196b, -0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x18f9,0x252,0x252,0x252,0x252,0x252, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xb37,0xb37,0xb3a,0xb3a,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0xb37,0x72,0x72,0x72,0x72, -0x15ba,0x15ba,0x15ba,0x15ba,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x15b7, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674,0x1674, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad,0x16ad, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x174,0x174,0x174,0x174,0x174,0x174,0x174, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af7, -0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b,0x25b, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x18e7,0x18ea,0x18ea,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f, +0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0x3ae,0xf,0xf,0xf,0xf,0x18fc,0x3ae,0x3ae,0x3ae,0x3a5, +0x3a2,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xcab,0xcab,0xcab,0xcab, +0x13da,0x14be,0xf78,0xf78,0xf78,0xf75,0xf75,0xd9e,0x8a6,0xca5,0xca2,0xca2,0xc99,0xc99,0xc99,0xc99, +0xc99,0xc99,0xf72,0xf72,0xf72,0xf72,0xf72,0x8a3,0x14b5,0x1b0f,0xda1,0x8a9,0x12f6,0x3c9,0x3cc,0x3cc, +0x3cc,0x3cc,0x3cc,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9, +0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0xf7b,0xf7b,0xf7b,0xf7b,0xf7b,0x8ac,0x3c9,0x3c9,0x3c9, +0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x924,0x924,0x924,0x924,0x924,0x924,0x924,0x924,0xb3d, +0xb3d,0xb3d,0xc99,0xc9f,0xc9c,0xd9b,0xd9b,0xd9b,0xd9b,0xd9b,0xd9b,0x12f3,0x93f,0x93f,0x93f,0x93f, +0x93f,0x93f,0x93f,0x93f,0x93f,0x93f,0x3c3,0x3c0,0x3bd,0x3ba,0xba0,0xba0,0x921,0x3c9,0x3c9,0x3d5, +0x3c9,0x3cf,0x3cf,0x3cf,0x3cf,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9, +0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9, +0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9, +0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9, +0x9f9,0x9f9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x9f9,0x3cc,0x3c9,0x3cc,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9, +0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x3c9,0x9f9,0x3c9,0x3c9,0x3c9,0x3cc,0x942,0x3c9,0x3b4,0x3b4, +0x3b4,0x3b4,0x3b4,0x3b4,0x3b4,0x3b1,0x3ba,0x3b7,0x3b7,0x3b4,0x3b4,0x3b4,0x3b4,0x3d2,0x3d2,0x3b4, +0x3b4,0x3ba,0x3b7,0x3b7,0x3b7,0x3b4,0xca8,0xca8,0x3c6,0x3c6,0x3c6,0x3c6,0x3c6,0x3c6,0x3c6,0x3c6, +0x3c6,0x3c6,0x9f9,0x9f9,0x9f9,0x9f6,0x9f6,0xca8,0xa0e,0xa0e,0xa0e,0xa08,0xa08,0xa08,0xa08,0xa08, +0xa08,0xa08,0xa08,0xa05,0xa08,0xa05,0x12,0xa11,0xa0b,0x9fc,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b, +0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xa0b, +0xa0b,0xa0b,0xa0b,0xa0b,0xa0b,0xcae,0xcae,0xcae,0xa02,0xa02,0xa02,0xa02,0xa02,0xa02,0xa02,0xa02, +0xa02,0xa02,0xa02,0xa02,0xa02,0xa02,0xa02,0xa02,0x9ff,0x9ff,0x9ff,0x9ff,0x9ff,0x9ff,0x9ff,0x9ff, +0x9ff,0x9ff,0x9ff,0x12,0x12,0xcae,0xcae,0xcae,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe, +0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe, +0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xdfe,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc, +0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17, +0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17, +0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa17,0xa14,0xa14, +0xa14,0xa14,0xa14,0xa14,0xa14,0xa14,0xa14,0xa14,0xa14,0xba3,0x15,0x15,0x15,0x15,0x15,0x15, +0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xf12,0xf12,0xf12,0xf12,0xf12,0xf12,0xf12,0xf12, +0xf12,0xf12,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15, +0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15,0xf15, +0xf15,0xf15,0xf15,0xf09,0xf09,0xf09,0xf09,0xf09,0xf09,0xf09,0xf09,0xf09,0xf18,0xf18,0xf0c,0xf0c, +0xf0f,0xf1e,0xf1b,0xff,0xff,0x1920,0x1923,0x1923,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xb16,0xb16,0xb19,0xb19,0xb16,0xb16,0xb16,0xb16, +0xb16,0xb16,0xb16,0xb16,0x1c53,0x1c53,0x1c50,0x1c50,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1626, +0x1626,0x1626,0x1626,0x1626,0x1626,0x1626,0x1626,0x1626,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1e9,0x1e9,0x1e9,0x1e9,0x1e9,0x1e9,0x1e9,0x1e9, +0x1e9,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248, +0x1248,0x168,0x168,0x168,0x168,0x168,0x168,0x168,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1bed,0x1bea,0x1bf,0x1bf,0x1bf,0x1bf,0x1bf,0x1bf, +0x1bf,0x1bf,0x1bf,0x1bf,0x1bf,0x1bf,0x1bf,0x1bf,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x1491, +0x1491,0x1491,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1b6c,0x1b6c,0x1b6c,0x1b6c,0x1b6c,0x1b6c,0x1b6c,0x1fe, +0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246, +0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x196e,0x196e,0x196e,0x196e,0x196e,0x196e,0x196e,0x196e, +0x196e,0x196e,0x24c,0x24c,0x24c,0x24c,0x24c,0x24c,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1ad3,0x288,0x288,0x288,0x288,0x288,0x288,0x288, +0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x1761,0x1761,0x1761,0x1761,0x204,0x204,0x204,0x204, +0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e, +0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d, +0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1bd5,0x1bd5,0x1bd5,0x1bd5,0x29d,0x1bd5,0x1bd5,0x1bd5, +0x1bd5,0x1bd5,0x1bd5,0x1bd5,0x29d,0x1bd5,0x1bd5,0x29d,0x16c5,0x16c5,0x16c5,0x16c5,0x1ec,0x1ec,0x1ec,0x1ec, +0x1ec,0x1ec,0x1ec,0x1ec,0x1ec,0x1ec,0x1ec,0x1ec,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x2b2,0x2b2,0x2b2,0x2b2, +0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0xdf5,0xdf5,0xdf2,0xdf2,0xdf2,0xdf5,0xd2,0xd2, +0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0xd2,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x210,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779, +0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8, +0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x1c08,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1a25,0x1a25,0x1a25,0x1a25,0x1a25,0x1a25,0x1a25,0x1a25, +0x1a25,0x1a25,0x26d,0x26d,0x26d,0x26d,0x1a28,0x1a22,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5, +0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38, +0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x252,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983, +0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x270,0x270,0x270,0x270,0x270,0x270,0x270,0x270, +0x270,0x270,0x270,0x270,0x270,0x270,0x270,0x270,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x261,0x261,0x261,0x261,0x261,0x261, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x1b1b,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d,0x29d, -0x17a9,0x17a9,0x17a9,0x17a9,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x165f,0x1e9,0x1e9,0x1e9,0x1e9,0x1665,0x1665, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1, -0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x1713,0x1713,0x1713,0x1713,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe,0x1fe, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0xe2e,0xe2e,0xe2b,0xe2b,0xe2b,0xe2e,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x1845,0x1845,0x231,0x1845,0x1845,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x231,0x231,0x231,0x231,0x231, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x1a6d,0x282,0x282,0x282,0x282,0x1a70,0x1a6a, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x267,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb, -0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x97b,0x97b, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +0,0,0,0,0,0,0x95d,0x95d,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,0x97b,0x97b,6,6,6,6,6,6,6,6,6,6,6,6, +3,3,3,3,3,3,3,3,3,3,0x95d,0x95d,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, -6,6,6,6,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c, -0xd8c,0xd8c,0xd8c,0xd8c,6,6,6,6,6,6,6,6,6,6,6,6, -6,6,6,6,0x1509,0x3d5,0x3e4,0x3e4,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea, -0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea, -0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x3ea,0x1b, -0x1b,0x1b,0x3ea,0x3ea,0x3ea,0x3ea,0x1b,0x1b,0x3d8,0xce4,0x3d5,0x3e4,0x3e4,0x3d5,0x3d5,0x3d5, -0x3d5,0x1b,0x1b,0x3e4,0x3e4,0x1b,0x1b,0x3e7,0x3e7,0x3db,0xddd,0x1b,0x1b,0x1b,0x1b,0x1b, -0x1b,0x1b,0x1b,0x3d5,0x1b,0x1b,0x1b,0x1b,0x3ed,0x3ed,0x1b,0x3ed,0x3ea,0x3ea,0x3d5,0x3d5, -0x1b,0x1b,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0x3ea,0x3ea,0x3e1,0x3e1, -0x3de,0x3de,0x3de,0x3de,0x3de,0x3e1,0x3de,0x115e,0x18a2,0x189f,0x1947,0x1b,0x1e,0xce7,0x3f0,0xcea, -0x1e,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x1e,0x1e,0x1e,0x3fc,0x3fc,0x1e,0x1e,0x3fc, -0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3fc, -0x3fc,0x3fc,0x3fc,0x3fc,0x3fc,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3ff,0x1e,0x3fc,0x3fc,0x1e,0x1e, -0x3f3,0x1e,0x3f9,0x3f9,0x3f9,0x3f0,0x3f0,0x1e,0x1e,0x1e,0x1e,0x3f0,0x3f0,0x1e,0x1e,0x3f0, -0x3f0,0x3f6,0x1e,0x1e,0x1e,0xfbd,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x3ff,0x3ff,0x3ff, -0x3fc,0x1e,0x3ff,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x969,0x969,0x969,0x969,0x969,0x969, -0x969,0x969,0x969,0x969,0x3f0,0x3f0,0x3fc,0x3fc,0x3fc,0xfbd,0x194a,0x1e,0x1e,0x1e,0x1e,0x1e, -0x1e,0x1e,0x1e,0x1e,0x21,0x402,0x402,0x40b,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e, -0xcf3,0x40e,0x21,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e, -0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x40e,0x40e, -0x21,0x40e,0x40e,0x40e,0x40e,0x40e,0x21,0x21,0x405,0x40e,0x40b,0x40b,0x40b,0x402,0x402,0x402, -0x402,0x402,0x21,0x402,0x402,0x40b,0x21,0x40b,0x40b,0x408,0x21,0x21,0x40e,0x21,0x21,0x21, -0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x40e,0xcf3,0xced,0xced, -0x21,0x21,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x96c,0x1422,0xcf0,0x21,0x21, -0x21,0x21,0x21,0x21,0x21,0x1725,0x18a5,0x18a5,0x18a5,0x18a8,0x18a8,0x18a8,0x24,0x411,0x420,0x420, -0x24,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x24,0x426,0x426,0x24,0x24,0x426, -0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426, -0x426,0x426,0x426,0x426,0x426,0x24,0x426,0x426,0x24,0xcf6,0x426,0x426,0x426,0x426,0x24,0x24, -0x414,0x426,0x411,0x411,0x420,0x411,0x411,0x411,0xfc0,0x24,0x24,0x420,0x423,0x24,0x24,0x423, -0x423,0x417,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x1ab5,0x411,0x411,0x24,0x24,0x24,0x24, -0x429,0x429,0x24,0x426,0x426,0x426,0xfc0,0xfc0,0x24,0x24,0x41d,0x41d,0x41d,0x41d,0x41d,0x41d, -0x41d,0x41d,0x41d,0x41d,0x41a,0xcf6,0x1344,0x1344,0x1344,0x1344,0x1344,0x1344,0x24,0x24,0x24,0x24, -0x24,0x24,0x24,0x24,0x27,0x27,0x42c,0x438,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x27, -0x27,0x27,0x438,0x438,0x438,0x27,0x438,0x438,0x43b,0x438,0x27,0x27,0x27,0x438,0x438,0x27, -0x438,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x27,0x27,0x27,0x438,0x438,0x438,0x27, -0x27,0x27,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0xde0,0x438,0x438,0x438,0x27,0x27, -0x27,0x27,0x42c,0x432,0x42c,0x432,0x432,0x27,0x27,0x27,0x432,0x432,0x432,0x27,0x435,0x435, -0x435,0x42f,0x27,0x27,0xfc3,0x27,0x27,0x27,0x27,0x27,0x27,0x42c,0x27,0x27,0x27,0x27, -0x27,0x27,0x27,0x27,0x27,0x27,0xef7,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972,0x972, -0x96f,0x96f,0x96f,0xdb0,0xcf9,0xcf9,0xcf9,0xcf9,0xcf9,0xcfc,0xcf9,0x27,0x27,0x27,0x27,0x27, -0x150c,0x44a,0x44a,0x44a,0x194d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x2a,0x44d,0x44d, -0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d, -0x44d,0x2a,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x44d,0x150f,0x44d,0x44d,0x44d, -0x44d,0x44d,0x2a,0x2a,0x2a,0xfcc,0x43e,0x43e,0x43e,0x44a,0x44a,0x44a,0x44a,0x2a,0x43e,0x43e, -0x441,0x2a,0x43e,0x43e,0x43e,0x444,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x43e,0x43e,0x2a, -0xfcc,0xfcc,0x1728,0x2a,0x2a,0x2a,0x2a,0x2a,0x44d,0x44d,0xfc6,0xfc6,0x2a,0x2a,0x447,0x447, -0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x447,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x1a19, -0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0xfc9,0x17e5,0x1512,0x456,0x456,0x1950,0x45c,0x45c,0x45c, -0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c, -0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x45c, -0x45c,0x45c,0x45c,0x45c,0x2d,0x45c,0x45c,0x45c,0x45c,0x45c,0x2d,0x2d,0xcff,0xd02,0x456,0x450, -0x459,0x456,0x450,0x456,0x456,0x2d,0x450,0x459,0x459,0x2d,0x459,0x459,0x450,0x453,0x2d,0x2d, -0x2d,0x2d,0x2d,0x2d,0x2d,0x450,0x450,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x45c,0x2d, -0x45c,0x45c,0xf0f,0xf0f,0x2d,0x2d,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975,0x975, -0x2d,0xf12,0xf12,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, -0x18ab,0x1515,0x468,0x468,0x1ab8,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x30,0x46e,0x46e, -0x46e,0x30,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e, -0x468,0x45f,0x45f,0x45f,0xfcf,0x30,0x468,0x468,0x468,0x30,0x46b,0x46b,0x46b,0x462,0x134a,0x17e8, -0x30,0x30,0x30,0x30,0x17eb,0x17eb,0x17eb,0x45f,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x17e8,0x172b, -0x46e,0x46e,0xfcf,0xfcf,0x30,0x30,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465, -0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0xfd2,0x17e8,0x17e8,0x17e8,0xfd5,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8,0xfd8, -0x33,0x1abb,0xa3e,0xa3e,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44, -0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44, -0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44, -0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0xa44,0x33,0xa44,0x33,0x33,0xa44,0xa44,0xa44,0xa44, -0xa44,0xa44,0xa44,0x33,0x33,0x33,0xa38,0x33,0x33,0x33,0x33,0xa35,0xa3e,0xa3e,0xa35,0xa35, -0xa35,0x33,0xa35,0x33,0xa3e,0xa3e,0xa41,0xa3e,0xa41,0xa41,0xa41,0xa35,0x33,0x33,0x33,0x33, -0x33,0x33,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x1518,0x33,0x33,0xa3e,0xa3e, -0xa3b,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x489,0x489,0x489, -0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489, -0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x474,0x489,0x486, -0x474,0x474,0x474,0x474,0x474,0x474,0x47a,0x36,0x36,0x36,0x36,0x471,0x48f,0x48f,0x48f,0x48f, -0x48f,0x489,0x48c,0x477,0x477,0x477,0x477,0x477,0x477,0x474,0x477,0x47d,0x483,0x483,0x483,0x483, -0x483,0x483,0x483,0x483,0x483,0x483,0x480,0x480,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +6,6,6,6,6,6,6,6,6,6,6,6,0xd53,0xd53,0xd53,0xd53, +0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,0x14c4,0x3f0,0x3ff,0x3ff, +0x18,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x18,0x18,0x405,0x405,0x18,0x18,0x405, +0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x405,0x18,0x405,0x405, +0x405,0x405,0x405,0x405,0x405,0x18,0x405,0x18,0x18,0x18,0x405,0x405,0x405,0x405,0x18,0x18, +0x3f3,0xcb4,0x3f0,0x3ff,0x3ff,0x3f0,0x3f0,0x3f0,0x3f0,0x18,0x18,0x3ff,0x3ff,0x18,0x18,0x402, +0x402,0x3f6,0xda7,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3f0,0x18,0x18,0x18,0x18, +0x408,0x408,0x18,0x408,0x405,0x405,0x3f0,0x3f0,0x18,0x18,0x948,0x948,0x948,0x948,0x948,0x948, +0x948,0x948,0x948,0x948,0x405,0x405,0x3fc,0x3fc,0x3f9,0x3f9,0x3f9,0x3f9,0x3f9,0x3fc,0x3f9,0x112b, +0x185a,0x1857,0x18ff,0x18,0x1b,0xcb7,0x40b,0xcba,0x1b,0x417,0x417,0x417,0x417,0x417,0x417,0x1b, +0x1b,0x1b,0x1b,0x417,0x417,0x1b,0x1b,0x417,0x417,0x417,0x417,0x417,0x417,0x417,0x417,0x417, +0x417,0x417,0x417,0x417,0x417,0x1b,0x417,0x417,0x417,0x417,0x417,0x417,0x417,0x1b,0x417,0x41a, +0x1b,0x417,0x41a,0x1b,0x417,0x417,0x1b,0x1b,0x40e,0x1b,0x414,0x414,0x414,0x40b,0x40b,0x1b, +0x1b,0x1b,0x1b,0x40b,0x40b,0x1b,0x1b,0x40b,0x40b,0x411,0x1b,0x1b,0x1b,0xf84,0x1b,0x1b, +0x1b,0x1b,0x1b,0x1b,0x1b,0x41a,0x41a,0x41a,0x417,0x1b,0x41a,0x1b,0x1b,0x1b,0x1b,0x1b, +0x1b,0x1b,0x94b,0x94b,0x94b,0x94b,0x94b,0x94b,0x94b,0x94b,0x94b,0x94b,0x40b,0x40b,0x417,0x417, +0x417,0xf84,0x1902,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1e,0x41d,0x41d,0x426, +0x1e,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0xcc3,0x429,0x1e,0x429,0x429,0x429,0x1e,0x429, +0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x1e,0x429,0x429, +0x429,0x429,0x429,0x429,0x429,0x1e,0x429,0x429,0x1e,0x429,0x429,0x429,0x429,0x429,0x1e,0x1e, +0x420,0x429,0x426,0x426,0x426,0x41d,0x41d,0x41d,0x41d,0x41d,0x1e,0x41d,0x41d,0x426,0x1e,0x426, +0x426,0x423,0x1e,0x1e,0x429,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, +0x1e,0x1e,0x1e,0x1e,0x429,0xcc3,0xcbd,0xcbd,0x1e,0x1e,0x94e,0x94e,0x94e,0x94e,0x94e,0x94e, +0x94e,0x94e,0x94e,0x94e,0x13dd,0xcc0,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x16da,0x185d,0x185d, +0x185d,0x1860,0x1860,0x1860,0x21,0x42c,0x43b,0x43b,0x21,0x441,0x441,0x441,0x441,0x441,0x441,0x441, +0x441,0x21,0x21,0x441,0x441,0x21,0x21,0x441,0x441,0x441,0x441,0x441,0x441,0x441,0x441,0x441, +0x441,0x441,0x441,0x441,0x441,0x21,0x441,0x441,0x441,0x441,0x441,0x441,0x441,0x21,0x441,0x441, +0x21,0xcc6,0x441,0x441,0x441,0x441,0x21,0x21,0x42f,0x441,0x42c,0x42c,0x43b,0x42c,0x42c,0x42c, +0xf87,0x21,0x21,0x43b,0x43e,0x21,0x21,0x43e,0x43e,0x432,0x21,0x21,0x21,0x21,0x21,0x21, +0x21,0x1a6d,0x42c,0x42c,0x21,0x21,0x21,0x21,0x444,0x444,0x21,0x441,0x441,0x441,0xf87,0xf87, +0x21,0x21,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x438,0x435,0xcc6,0x1302,0x1302, +0x1302,0x1302,0x1302,0x1302,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x24,0x24,0x447,0x453, +0x24,0x453,0x453,0x453,0x453,0x453,0x453,0x24,0x24,0x24,0x453,0x453,0x453,0x24,0x453,0x453, +0x456,0x453,0x24,0x24,0x24,0x453,0x453,0x24,0x453,0x24,0x453,0x453,0x24,0x24,0x24,0x453, +0x453,0x24,0x24,0x24,0x453,0x453,0x453,0x24,0x24,0x24,0x453,0x453,0x453,0x453,0x453,0x453, +0x453,0x453,0xdaa,0x453,0x453,0x453,0x24,0x24,0x24,0x24,0x447,0x44d,0x447,0x44d,0x44d,0x24, +0x24,0x24,0x44d,0x44d,0x44d,0x24,0x450,0x450,0x450,0x44a,0x24,0x24,0xf8a,0x24,0x24,0x24, +0x24,0x24,0x24,0x447,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xebe,0x954, +0x954,0x954,0x954,0x954,0x954,0x954,0x954,0x954,0x951,0x951,0x951,0xd7a,0xcc9,0xcc9,0xcc9,0xcc9, +0xcc9,0xccc,0xcc9,0x24,0x24,0x24,0x24,0x24,0x14c7,0x465,0x465,0x465,0x1905,0x468,0x468,0x468, +0x468,0x468,0x468,0x468,0x468,0x27,0x468,0x468,0x468,0x27,0x468,0x468,0x468,0x468,0x468,0x468, +0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x27,0x468,0x468,0x468,0x468,0x468,0x468, +0x468,0x468,0x468,0x468,0x14ca,0x468,0x468,0x468,0x468,0x468,0x27,0x27,0x1b12,0xf93,0x459,0x459, +0x459,0x465,0x465,0x465,0x465,0x27,0x459,0x459,0x45c,0x27,0x459,0x459,0x459,0x45f,0x27,0x27, +0x27,0x27,0x27,0x27,0x27,0x459,0x459,0x27,0xf93,0xf93,0x16dd,0x27,0x27,0x1b15,0x27,0x27, +0x468,0x468,0xf8d,0xf8d,0x27,0x27,0x462,0x462,0x462,0x462,0x462,0x462,0x462,0x462,0x462,0x462, +0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x19d1,0xf90,0xf90,0xf90,0xf90,0xf90,0xf90,0xf90,0xf90, +0x179d,0x14cd,0x471,0x471,0x1908,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x2a,0x477,0x477, +0x477,0x2a,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477, +0x477,0x2a,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x477,0x2a,0x477,0x477,0x477, +0x477,0x477,0x2a,0x2a,0xccf,0xcd2,0x471,0x46b,0x474,0x471,0x46b,0x471,0x471,0x2a,0x46b,0x474, +0x474,0x2a,0x474,0x474,0x46b,0x46e,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x46b,0x46b,0x2a, +0x2a,0x2a,0x2a,0x2a,0x2a,0x1b18,0x477,0x2a,0x477,0x477,0xed6,0xed6,0x2a,0x2a,0x957,0x957, +0x957,0x957,0x957,0x957,0x957,0x957,0x957,0x957,0x2a,0xed9,0xed9,0x1bdb,0x2a,0x2a,0x2a,0x2a, +0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x1863,0x14d0,0x483,0x483,0x1a70,0x489,0x489,0x489, +0x489,0x489,0x489,0x489,0x489,0x2d,0x489,0x489,0x489,0x2d,0x489,0x489,0x489,0x489,0x489,0x489, +0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x483,0x47a,0x47a,0x47a,0xf96,0x2d,0x483,0x483, +0x483,0x2d,0x486,0x486,0x486,0x47d,0x1308,0x17a0,0x2d,0x2d,0x2d,0x2d,0x17a3,0x17a3,0x17a3,0x47a, +0x17a0,0x17a0,0x17a0,0x17a0,0x17a0,0x17a0,0x17a0,0x16e0,0x489,0x489,0xf96,0xf96,0x2d,0x2d,0x480,0x480, +0x480,0x480,0x480,0x480,0x480,0x480,0x480,0x480,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0x17a0,0x17a0, +0x17a0,0xf9c,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0x30,0x1a73,0xa23,0xa23,0x30,0xa29,0xa29,0xa29, +0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0x30, +0x30,0x30,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29, +0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0x30,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29, +0x30,0xa29,0x30,0x30,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0xa29,0x30,0x30,0x30,0xa1d,0x30, +0x30,0x30,0x30,0xa1a,0xa23,0xa23,0xa1a,0xa1a,0xa1a,0x30,0xa1a,0x30,0xa23,0xa23,0xa26,0xa23, +0xa26,0xa26,0xa26,0xa1a,0x30,0x30,0x30,0x30,0x30,0x30,0x14d3,0x14d3,0x14d3,0x14d3,0x14d3,0x14d3, +0x14d3,0x14d3,0x14d3,0x14d3,0x30,0x30,0xa23,0xa23,0xa20,0x30,0x30,0x30,0x30,0x30,0x30,0x30, +0x30,0x30,0x30,0x30,0x33,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4, +0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x4a4, +0x4a4,0x4a4,0x4a4,0x4a4,0x4a4,0x48f,0x4a4,0x4a1,0x48f,0x48f,0x48f,0x48f,0x48f,0x48f,0x495,0x33, +0x33,0x33,0x33,0x48c,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4a4,0x4a7,0x492,0x492,0x492,0x492,0x492, +0x492,0x48f,0x492,0x498,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49b,0x49b, +0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, +0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, +0x36,0x4b9,0x4b9,0x36,0x4b9,0x36,0x19d7,0x4b9,0x4b9,0x19d7,0x4b9,0x36,0x19d7,0x4b9,0x19d7,0x19d7, +0x19d7,0x19d7,0x19d7,0x19d7,0x4b9,0x4b9,0x4b9,0x4b9,0x19d7,0x4b9,0x4b9,0x4b9,0x4b9,0x4b9,0x4b9,0x4b9, +0x19d7,0x4b9,0x4b9,0x4b9,0x36,0x4b9,0x36,0x4b9,0x19d7,0x19d7,0x4b9,0x4b9,0x19d7,0x4b9,0x4b9,0x4b9, +0x4b9,0x4ad,0x4b9,0x4b6,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x19d4,0x4ad,0x4ad,0x4b9,0x36,0x36, +0x4c2,0x4c2,0x4c2,0x4c2,0x4c2,0x36,0x4bf,0x36,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4ad,0x1bde,0x36, +0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x36,0x36,0x4bc,0x4bc,0x13e0,0x13e0, 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, -0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x39,0x49e,0x49e,0x39,0x49e,0x39,0x1a1f,0x49e, -0x49e,0x1a1f,0x49e,0x39,0x1a1f,0x49e,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x49e,0x49e,0x49e,0x49e, -0x1a1f,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x39,0x49e,0x39,0x49e, -0x1a1f,0x1a1f,0x49e,0x49e,0x1a1f,0x49e,0x49e,0x49e,0x49e,0x492,0x49e,0x49b,0x492,0x492,0x492,0x492, -0x492,0x492,0x1a1c,0x492,0x492,0x49e,0x39,0x39,0x4a7,0x4a7,0x4a7,0x4a7,0x4a7,0x39,0x4a4,0x39, -0x495,0x495,0x495,0x495,0x495,0x492,0x39,0x39,0x498,0x498,0x498,0x498,0x498,0x498,0x498,0x498, -0x498,0x498,0x39,0x39,0x4a1,0x4a1,0x1425,0x1425,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +0x99c,0x99c,0x99c,0x99f,0x99c,0x99c,0x99c,0x99c,0x39,0x99c,0x99c,0x99c,0x99c,0x99f,0x99c,0x99c, +0x99c,0x99c,0x99f,0x99c,0x99c,0x99c,0x99c,0x99f,0x99c,0x99c,0x99c,0x99c,0x99f,0x99c,0x99c,0x99c, +0x99c,0x99c,0x99c,0x99c,0x99c,0x99c,0x99c,0x99c,0x99c,0x99f,0xa38,0xfab,0xfab,0x39,0x39,0x39, +0x39,0x966,0x966,0x969,0x966,0x969,0x969,0x975,0x969,0x975,0x966,0x966,0x966,0x966,0x966,0x996, +0x966,0x969,0x96f,0x96f,0x972,0x97b,0x96c,0x96c,0x99c,0x99c,0x99c,0x99c,0x1311,0x130b,0x130b,0x130b, +0x966,0x966,0x966,0x969,0x966,0x966,0xa2c,0x966,0x39,0x966,0x966,0x966,0x966,0x969,0x966,0x966, +0x966,0x966,0x969,0x966,0x966,0x966,0x966,0x969,0x966,0x966,0x966,0x966,0x969,0x966,0xa2c,0xa2c, +0xa2c,0x966,0x966,0x966,0x966,0x966,0x966,0x966,0xa2c,0x969,0xa2c,0xa2c,0xa2c,0x39,0xa35,0xa35, +0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0xa2f,0xa32,0xa32,0xa32,0xa32,0xa32,0xa32,0x39,0xfa2,0xa32, +0xdad,0xdad,0xfa5,0xfa8,0xfa2,0x112e,0x112e,0x112e,0x112e,0x130e,0x130e,0x39,0x39,0x39,0x39,0x39, 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, -0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7, -0x3c,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba, -0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7, -0x9b7,0x9ba,0xa53,0xfe4,0xfe4,0x3c,0x3c,0x3c,0x3c,0x984,0x984,0x987,0x984,0x987,0x987,0x990, -0x987,0x990,0x984,0x984,0x984,0x984,0x984,0x9b1,0x984,0x987,0x98a,0x98a,0x98d,0x996,0x98a,0x98a, -0x9b7,0x9b7,0x9b7,0x9b7,0x1353,0x134d,0x134d,0x134d,0x984,0x984,0x984,0x987,0x984,0x984,0xa47,0x984, -0x3c,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987,0x984,0x984,0x984,0x984,0x987, -0x984,0x984,0x984,0x984,0x987,0x984,0xa47,0xa47,0xa47,0x984,0x984,0x984,0x984,0x984,0x984,0x984, -0xa47,0x987,0xa47,0xa47,0xa47,0x3c,0xa50,0xa50,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4a,0xa4d, -0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0x3c,0xfdb,0xa4d,0xde3,0xde3,0xfde,0xfe1,0xfdb,0x1161,0x1161,0x1161, -0x1161,0x1350,0x1350,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, -0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, -0x3c,0x3c,0x3c,0x3c,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x3f,0x142b,0x3f,0x3f,0x3f,0x3f, -0x3f,0x142b,0x3f,0x3f,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa, -0x4aa,0x4aa,0x4aa,0x4aa,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d, -0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d, -0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d, -0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, -0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42, -0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42, -0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0x42, -0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2, -0xa7d,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0x42,0x42,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2, -0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, -0xa7d,0xa7d,0xa7d,0x42,0x42,0x1356,0x1356,0xdec,0xdef,0xa77,0xa80,0xa74,0xa74,0xa74,0xa74,0xa80, -0xa80,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa7a,0xa71,0xa71,0xa71,0xa71,0xa71,0xa71, -0xa71,0xa71,0xa71,0xa71,0xa71,0x42,0x42,0x42,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83, -0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0x1731,0x45,0x45, -0x172e,0x172e,0x172e,0x172e,0x172e,0x172e,0x45,0x45,0xa95,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98, -0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98,0xa98, -0xa98,0xa98,0xa98,0xa92,0xa8f,0x48,0x48,0x48,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e, -0xa9e,0xa9e,0xa9e,0xa9b,0xa9b,0xa9b,0xa9e,0xa9e,0xa9e,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b, -0x151b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0xabf,0xabf,0xabf,0xabf,0xabf,0xabf,0xaa1,0xabf, -0xabf,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa7,0xaa4,0xab6,0xab6,0xab9,0xac2, -0xab0,0xaad,0xab6,0xab3,0xac2,0xd05,0x4e,0x4e,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc,0xabc, -0xabc,0xabc,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08,0xd08, -0xd08,0xd08,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0xad1,0xad1,0xb52,0xb55,0xad7,0xb4f,0xad4,0xad1, -0xada,0xae9,0xadd,0xaec,0xaec,0xaec,0xac8,0x51,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0,0xae0, -0xae0,0xae0,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, -0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, -0x1953,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, -0xae3,0xacb,0x1002,0x51,0x51,0x51,0x51,0x51,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, -0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, -0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x54,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, -0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c5,0x4cb,0x4c5,0x4c5,0x4c2,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x54,0x54,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x54,0x4c2,0x4c2,0x4c2,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c2,0x4c2,0x4c2,0x54,0x54,0x4cb,0x4cb,0x4cb,0x54,0x4cb,0x4cb, -0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4c8,0x4c5,0x54,0xbca,0xbcd,0xbcd,0xbcd,0x100b,0x57,0x14f7,0x14f7, -0x14f7,0x14f7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x4d7,0x522,0xbdf,0x5a,0x5a,0x6e1,0x522,0x522,0x522, -0x522,0x522,0x528,0x53a,0x528,0x534,0x52e,0x6e4,0x51f,0x6de,0x6de,0x6de,0x6de,0x51f,0x51f,0x51f, -0x51f,0x51f,0x525,0x537,0x525,0x531,0x52b,0x5a,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0x1359,0x1359,0x1359, -0x1359,0x1359,0x1359,0x1359,0x1359,0x5a,0x5a,0x5a,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d, -0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x549,0x549,0x549,0x549,0x549,0x549,0x549,0x549, -0x549,0x549,0x549,0x549,0x549,0x546,0x546,0x546,0x546,0x549,0xafb,0xafe,0xbe5,0xbeb,0xbeb,0xbe8, -0xbe8,0xbe8,0xbe8,0xe01,0xf15,0xf15,0xf15,0xf15,0x114c,0x60,0x60,0x60,0x60,0x60,0x60,0x60, -0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x579,0x579,0x579,0xb07,0xf1e,0x1011,0x1011,0x1011, -0x1011,0x12ab,0x1737,0x1737,0x63,0x63,0x63,0x63,0x70b,0x70b,0x70b,0x70b,0x70e,0x70e,0x70e,0x70e, -0x70e,0x70e,0x585,0x585,0x582,0x582,0x582,0x582,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0xb13,0xb13,0x66, +0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x4c8,0x4c8,0x4c8,0x4c8, +0x4c8,0x4c8,0x3c,0x13e6,0x3c,0x3c,0x3c,0x3c,0x3c,0x13e6,0x3c,0x3c,0x4c5,0x4c5,0x4c5,0x4c5, +0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0xdbc,0xa62,0x3f,0xa62,0xa62,0xa62,0xa62,0x3f,0x3f,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0x3f,0xa62,0x3f,0xa62,0xa62,0xa62,0xa62,0x3f,0x3f,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0xdbc,0xa62,0x3f,0xa62,0xa62,0xa62,0xa62,0x3f,0x3f,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xdbc, +0xa62,0x3f,0xa62,0xa62,0xa62,0xa62,0x3f,0x3f,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0x3f, +0xa62,0x3f,0xa62,0xa62,0xa62,0xa62,0x3f,0x3f,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xdbc, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0x3f,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xdbc,0xa62,0x3f,0xa62,0xa62,0xa62,0xa62,0x3f,0x3f, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xdbc,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0x3f,0x3f,0x1314,0x1314,0xdb6, +0xdb9,0xa5c,0xa65,0xa59,0xa59,0xa59,0xa59,0xa65,0xa65,0xa5f,0xa5f,0xa5f,0xa5f,0xa5f,0xa5f,0xa5f, +0xa5f,0xa5f,0xa56,0xa56,0xa56,0xa56,0xa56,0xa56,0xa56,0xa56,0xa56,0xa56,0xa56,0x3f,0x3f,0x3f, +0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68, +0xa68,0xa68,0xa68,0xa68,0xa68,0x16e6,0x42,0x42,0x16e3,0x16e3,0x16e3,0x16e3,0x16e3,0x16e3,0x42,0x42, +0xa7a,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, +0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa77,0xa74,0x45,0x45,0x45, +0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa80,0xa80,0xa80,0xa83,0xa83, +0xa83,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x48,0x48,0x48,0x48,0x48,0x48,0x48, +0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xaa4,0xa86,0xaa4,0xaa4,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89, +0xa89,0xa89,0xa8c,0xa89,0xaad,0xaad,0xa9e,0xaa7,0xa95,0xa92,0xa9b,0xa98,0xaa7,0xcd5,0x4b,0x4b, +0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b, +0xcd8,0xcd8,0xcd8,0xcd8,0xcd8,0xcd8,0xcd8,0xcd8,0xcd8,0xcd8,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b, +0xab9,0xab9,0xb31,0xb34,0xabf,0xb2e,0xabc,0xab9,0xac2,0xad1,0xac5,0xad4,0xad4,0xad4,0xab0,0x1b1b, +0xac8,0xac8,0xac8,0xac8,0xac8,0xac8,0xac8,0xac8,0xac8,0xac8,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, +0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb, +0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0x190b,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, +0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xab3,0xfc9,0x4e,0x4e,0x4e,0x4e,0x4e, +0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x51,0x51,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x51,0x51, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x51,0x4e9,0x51,0x4e9,0x51,0x4e9,0x51,0x4e9, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x51,0x51, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x51,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e0,0x4e6,0x4e0, +0x4e0,0x4dd,0x4e6,0x4e6,0x4e6,0x51,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4dd,0x4dd,0x4dd, +0x4e6,0x4e6,0x4e6,0x4e6,0x51,0x51,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x51,0x4dd,0x4dd,0x4dd, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4dd,0x4dd,0x4dd, +0x51,0x51,0x4e6,0x4e6,0x4e6,0x51,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e3,0x4e0,0x51, +0xba9,0xbac,0xbac,0xbac,0xfd2,0x54,0x14b2,0x14b2,0x14b2,0x14b2,0x4f2,0x4f2,0x4f2,0x4f2,0x4f2,0x4f2, +0x53d,0xbbe,0x57,0x57,0x6d8,0x53d,0x53d,0x53d,0x53d,0x53d,0x543,0x555,0x543,0x54f,0x549,0x6db, +0x53a,0x6d5,0x6d5,0x6d5,0x6d5,0x53a,0x53a,0x53a,0x53a,0x53a,0x540,0x552,0x540,0x54c,0x546,0x57, +0xdc5,0xdc5,0xdc5,0xdc5,0xdc5,0x1317,0x1317,0x1317,0x1317,0x1317,0x1317,0x1317,0x1317,0x57,0x57,0x57, +0x1b1e,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, +0x564,0x564,0x564,0x564,0x564,0x564,0x564,0x564,0x564,0x564,0x564,0x564,0x564,0x561,0x561,0x561, +0x561,0x564,0xae0,0xae0,0xbc4,0xbca,0xbca,0xbc7,0xbc7,0xbc7,0xbc7,0xdcb,0xedc,0xedc,0xedc,0xedc, +0x1119,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d, +0x594,0x594,0x594,0xae9,0xee5,0xfd8,0xfd8,0xfd8,0xfd8,0x1275,0x16ec,0x16ec,0x60,0x60,0x60,0x60, +0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x5a0,0x5a0,0x59d,0x59d,0x59d,0x59d, +0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0xaf2,0xaf2,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63, +0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63, +0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x66,0x66,0x66,0x66,0x66, 0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66, -0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af,0x5af, -0x5af,0x5af,0x5af,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, -0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, -0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, -0xb2e,0xb2e,0x6c,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, -0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb31,0x6c,0x6c,0x6c,0x6c, -0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34, -0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0x6f,0x6f, -0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x75,0x843,0x83d,0x843,0x83d,0x843,0x83d,0x843, -0x83d,0x843,0x83d,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d, -0x840,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x843,0x83d,0x843, -0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x843,0x83d,0x83d,0x83d,0x83d,0x83d,0x840,0xc93,0xc93,0x75, -0x75,0x954,0x954,0x91e,0x91e,0x846,0x849,0xc90,0x78,0x78,0x78,0x78,0x78,0x85b,0x85b,0x85b, -0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b, -0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x85b,0x113a,0x191a,0x1a01,0x7b,0x85e,0x85e,0x85e, -0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x7b, -0x927,0x927,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a,0x92a, -0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867, -0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0x867,0xd98,0xd98,0x7e, -0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0x81,0x81,0x81, -0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c, -0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, -0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df, -0x9db,0x9db,0x9db,0x9db,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87, -0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254, -0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, -0x8a,0x8a,0x8a,0x5fa,0x5fa,0x5fa,0x5fa,0x5fa,0x8a,0x8a,0x8a,0x8a,0x8a,0xb1f,0x5fd,0x603, -0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x600,0x603,0x603,0x603,0x603,0x603,0x603, -0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x8a,0x603,0x8a, -0x603,0x603,0x8a,0x603,0x603,0x8a,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x603,0x606, -0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, -0x136b,0x136b,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, -0x8d,0x8d,0x8d,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x61e,0x618, -0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, -0x61b,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x61b,0x618,0x618, -0x618,0x618,0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x61b,0x618,0x61b,0x61b,0x61b,0x61b, -0x8d,0x8d,0x61b,0x61b,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x618,0x618,0x618,0x61b,0x618,0x618, -0x618,0x618,0x618,0x61b,0x61b,0x61b,0x618,0x618,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, -0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a, -0x61e,0x61e,0x978,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0xc24,0xdb3,0x8d,0x8d, -0x87f,0x891,0x88e,0x891,0x88e,0xcb1,0xcb1,0xda4,0xda1,0x882,0x882,0x882,0x882,0x894,0x894,0x894, -0x8ac,0x8af,0x8be,0x90,0x8b2,0x8b5,0x8c1,0x8c1,0x8a9,0x8a0,0x89a,0x8a0,0x89a,0x8a0,0x89a,0x89d, -0x89d,0x8b8,0x8b8,0x8bb,0x8b8,0x8b8,0x8b8,0x90,0x8b8,0x8a6,0x8a3,0x89d,0x90,0x90,0x90,0x90, -0x62a,0x636,0x62a,0xc27,0x62a,0x93,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636,0x62a,0x636, -0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633, -0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x93,0x93,0x627, -0x77d,0x780,0x795,0x798,0x777,0x780,0x780,0x99,0x75f,0x762,0x762,0x762,0x762,0x75f,0x75f,0x99, -0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0xb22,0xb22,0xb22,0x9de,0x759,0x639,0x639, -0x99,0x7a7,0x786,0x777,0x780,0x77d,0x777,0x789,0x77a,0x774,0x777,0x795,0x78c,0x783,0x7a4,0x777, -0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x7a1,0x792,0x78f,0x795,0x795,0x795,0x7a7, -0x768,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765, -0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x99, -0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765, -0x99,0x99,0x765,0x765,0x765,0x765,0x765,0x765,0x99,0x99,0x765,0x765,0x765,0x99,0x99,0x99, -0xb6d,0xb6d,0xb6d,0xb6d,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x18b7,0x18b7,0x18b7, -0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73,0xb73, -0xb73,0xb73,0xb73,0x9f,0x9f,0x9f,0x9f,0x9f,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683, -0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, -0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xa2,0xa2, -0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xa5, -0xa5,0x101d,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, -0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d,0x173d, -0x173d,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5, -0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xa8,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xa8,0xba0,0xba0,0xa8,0xa8,0xba0,0xa8,0xa8,0xba0,0xba0,0xa8, -0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d, -0xb9d,0xb9d,0xa8,0xb9d,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xd29,0xb9d,0xb9d,0xa8,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xa8,0xba0, -0xba0,0xba0,0xba0,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xba0,0xa8, -0xa8,0xa8,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xa8,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xe16,0xe16,0xa8,0xa8,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xf2d,0xf2a, -0xa8,0xa8,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a, -0xb9a,0xb9a,0xb9a,0xb9a,0xab,0xba6,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab, -0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab, -0xab,0xab,0xab,0xab,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36, -0xc36,0xae,0xc36,0xc36,0xc36,0xc36,0xc30,0xc30,0xc33,0xae,0xae,0xae,0xae,0xae,0xae,0xae, -0xae,0xae,0xae,0xae,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f, -0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc3f,0xc39,0xc39,0xc3c,0xca5,0xca5,0xb1,0xb1,0xb1,0xb1,0xb1, -0xb1,0xb1,0xb1,0xb1,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45, -0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc42,0xc42,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4,0xb4, -0xb4,0xb4,0xb4,0xb4,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b, -0xc4b,0xb7,0xc4b,0xc4b,0xc4b,0xb7,0xc48,0xc48,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7, -0xb7,0xb7,0xb7,0xb7,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b, -0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b, -0xd3b,0x1539,0x1539,0xba,0xd2c,0xd2c,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd2c,0xd2c,0xd38,0xd38,0xd38, -0xba,0xba,0xba,0xba,0xd38,0xd38,0xd2c,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd2f,0xd2f,0xd2f, -0xba,0xba,0xba,0xba,0xd32,0xba,0xba,0xba,0xd3e,0xd3e,0xd35,0xd35,0xd35,0xd35,0xd35,0xd35, -0xd35,0xd35,0xd35,0xd35,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41, -0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xd41,0xd41,0xd41,0xd41,0xd41,0xbd,0xbd,0xbd, -0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, -0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0xc0,0x153c,0x153c, -0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, -0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0xc0,0x1abe,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, -0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68, -0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68, -0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68, -0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xd68,0xd68,0xc3,0xd68,0xd68,0xd68,0xd68,0xd68, -0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xd68,0xd68,0xd68,0xd68, -0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xd68,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, -0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3, -0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xd6b,0xd6b,0xd6b,0xd6b, -0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b, -0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xc6,0xc6,0xc6,0xc6,0xc6,0xdad,0xdad,0xdad,0xc9, -0xc9,0xc9,0xc9,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7, -0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xda7,0xc9,0xc9,0xc9,0xdaa, -0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xdaa,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71, -0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xd71, -0xd71,0xd71,0xd71,0xd71,0xd71,0xd71,0xcc,0xd6e,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a, -0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a, -0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xd7a,0xcf,0xcf,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77,0xd77, -0xd77,0xd77,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b, -0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd2, -0xd7d,0xd2,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d, -0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd7d,0xd2,0xd7d,0xd7d,0xd2,0xd2,0xd2, -0xd7d,0xd2,0xd2,0xd7d,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80, -0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd5,0xd5,0xd5,0xd5,0xd5, -0xd5,0xd5,0xd5,0xd5,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0x153f, -0x153f,0x17f1,0x17f1,0xdb,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119,0x1119, -0x1acd,0x132,0x132,0x132,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43, -0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe43,0xe3a,0xe3a,0xe40,0xe40,0xe3a, -0xde,0xde,0xe3d,0xe3d,0x1149,0x1149,0x1149,0x1149,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1, -0xe1,0xe1,0xe1,0xe1,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2,0xca2, -0xca2,0xca2,0xca2,0xca2,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1542,0x1542,0x1542,0x1542,0x1542, -0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1545,0x18bd,0x18bd,0x193e,0x18bd,0xe4,0x17f4, -0x1377,0x118b,0xf3c,0xf3c,0xe55,0xe52,0xe55,0xe52,0xe52,0xe49,0xe49,0xe49,0xe49,0xe49,0xe49,0x1194, -0x1191,0x1194,0x1191,0x118e,0x118e,0x118e,0x1434,0x1431,0xe7,0xe7,0xe7,0xe7,0xe7,0xe4f,0xe4c,0xe4c, -0xe4c,0xe49,0xe4f,0xe4c,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58, -0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xea,0xea,0xea,0xea, -0xea,0xea,0xea,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58, -0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xea,0xe58,0xe58,0xe58,0xe58, -0xe58,0xe58,0xe58,0xea,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e, -0xe5e,0xe5e,0xe5e,0xe5e,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xe5b,0xed,0xed, -0xed,0xed,0xed,0xed,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xf0,0x1437,0xf0,0xf0,0xf0,0xf0, -0xf0,0x1437,0xf0,0xf0,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8, -0xeb8,0xeb8,0xeb8,0xeb8,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67, -0xe67,0xe67,0xe67,0xf3,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64, -0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64,0xe64, -0xe64,0xe64,0xe64,0xf3,0xe79,0xe6d,0xe6d,0xe6d,0xf6,0xe6d,0xe6d,0xf6,0xf6,0xf6,0xf6,0xf6, -0xe6d,0xe6d,0xe6d,0xe6d,0xe79,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79,0xf6,0xe79,0xe79,0xe79, -0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79, -0xe79,0xe79,0xe79,0xe79,0x195c,0x195c,0xf6,0xf6,0xe6a,0xe6a,0xe6a,0xf6,0xf6,0xf6,0xf6,0xe70, -0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0xe73,0x1959,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6, -0xe76,0xe76,0xe76,0xe76,0xe76,0xe76,0xe7c,0xe7c,0xe73,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6, -0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0x119a,0x119a,0xf9,0xf9,0xf9,0xf9, -0xe88,0xe88,0xe88,0xe88,0xe88,0xe8b,0xe8b,0xe8b,0xe88,0xe88,0xe8b,0xe88,0xe88,0xe88,0xe88,0xe88, -0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xe85,0xe85,0xe85,0xe85, -0xe85,0xe85,0xe85,0xe85,0xe85,0xe85,0x1197,0xf9,0xf9,0xf9,0xe82,0xe82,0xe91,0xe91,0xe91,0xe91, -0xfc,0xfc,0xfc,0xfc,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe8e,0xe91,0xe91,0xe91, -0xe91,0xe91,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0x154e,0x1554,0x1551,0x189c, -0x17f7,0x18c0,0x18c0,0x18c0,0x18c0,0x18c0,0x1962,0x195f,0x1965,0x195f,0x1965,0x1a25,0x1ac1,0x1ac1,0x1ac1,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xeb5,0xeb5,0xeb5,0xeb2,0xeb2,0xea9,0xea9,0xeb2,0xeaf,0xeaf,0xeaf,0xeaf,0x1ac4,0x102,0x102,0x102, -0x1314,0x1314,0x1314,0x1317,0x1317,0x1317,0x130e,0x130e,0x1311,0x130e,0x156,0x156,0x156,0x156,0x156,0x156, -0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0x1443,0x1443,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0xebb, -0x137d,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x137a, -0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc75, -0xee8,0xed9,0xed3,0xee5,0xee2,0xedc,0xedc,0xeeb,0xed6,0xedf,0x108,0x108,0x108,0x108,0x108,0x108, -0xf6f,0xf6f,0xf5a,0xf6f,0xf72,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0x10e,0x10e,0x10e,0x10e, -0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf7b,0xf7b,0xf60,0xf66,0xf7b,0xf7b, -0xf63,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d, -0xf5d,0xf5d,0xf5d,0xf5d,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0x10e,0x10e,0x10e, -0x111,0x111,0x1a2b,0x1a28,0x1a2b,0x1a2b,0x1a2b,0x1aca,0x1ac7,0x1aca,0x1ac7,0x111,0x111,0x111,0x111,0x111, -0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111, -0x111,0x1aca,0x1ac7,0x155d,0x144c,0x144c,0x1380,0x1074,0x1074,0x1074,0x1074,0x1074,0xf8a,0xf8a,0xf8a,0xf8a, -0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a, -0xf87,0xf87,0xf8d,0xf8d,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0xf96,0xf96,0xf96,0xf96, -0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96,0xf96, -0xf96,0xf96,0xf90,0xf90,0xf90,0xf90,0x11a3,0x11a3,0x117,0x117,0x117,0xf93,0x1563,0x1563,0x1563,0x1563, -0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563, -0x1563,0x1563,0x1563,0x1563,0x1563,0x174c,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a, -0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a, -0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0xf9f,0xf9f,0xf9f,0x1569,0x1569,0x1569,0x1569,0x1569, -0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x1569,0x11d,0xf9c,0xf9c,0xf9c,0xf9c,0x1566,0x11d,0x11d,0x11d, -0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2, -0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0xfa2,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974, -0x1974,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x109b,0x109b,0x109b,0x109b,0x1098,0x1098,0x1098,0x1098, -0x1098,0x1098,0x1098,0x1098,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1089,0x1098,0x1098,0x108f,0x108c, -0x123,0x123,0x123,0x109e,0x109e,0x1092,0x1092,0x1092,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095,0x1095, -0x1095,0x1095,0x123,0x123,0x123,0x109b,0x109b,0x109b,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1,0x10a1, -0x10a1,0x10a1,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6,0x10b6, -0x10b6,0x10b6,0x10b9,0x10b9,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126, -0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x10e0,0x10e0,0x10e0,0x10e0,0x10da,0x17fd,0x129,0x129, -0x129,0x129,0x129,0x129,0x129,0x129,0x10e6,0x10e6,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd, -0x10dd,0x10dd,0x129,0x129,0x129,0x129,0x129,0x129,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x10f8, -0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10fe,0x1101,0x12c,0x12c,0x12c,0x12c, -0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x12c,0x10fb,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113, -0x1113,0x1107,0x1107,0x1107,0x1107,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x1110,0x1110,0x1107,0x1107,0x12f, -0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x1113,0x1113,0x1113,0x1107,0x1113,0x1113,0x1113,0x1113, -0x1113,0x1113,0x1113,0x1113,0x1107,0x1110,0x12f,0x12f,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d,0x110d, -0x110d,0x110d,0x12f,0x12f,0x110a,0x1116,0x1116,0x1116,0x1575,0x132,0x132,0x132,0x132,0x132,0x132,0x132, -0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132, -0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x132,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c, -0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c,0x111c, -0x111c,0x111c,0x111c,0x111c,0x111c,0x111f,0x135,0x135,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122, -0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122,0x1122, -0x1122,0x1122,0x1122,0x1122,0x1122,0x138,0x138,0x138,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125, -0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b, -0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x13b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b, -0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b,0x112b, -0x112b,0x112b,0x13e,0x13e,0x13e,0x13e,0x13e,0x1128,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e, -0x112e,0x112e,0x112e,0x112e,0x141,0x141,0x141,0x141,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131, -0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x144,0x144,0x144,0x144, -0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x144,0x11a9,0x11a9,0x11a9,0x11a9,0x11b2,0x11a9,0x11a9,0x11a9, -0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a6,0x147,0x147,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11af,0x11b5, -0x11af,0x11b5,0x11af,0x11af,0x11af,0x11b5,0x11b5,0x147,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, -0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x14a,0x14a, -0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x14a,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3, -0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d0,0x11bb,0x11d0, -0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x14d,0x11c4,0x11cd,0x11bb,0x11cd,0x11cd,0x11bb,0x11bb,0x11bb, -0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11d0,0x11bb,0x11bb,0x11c1,0x11c1,0x11c1, -0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x14d,0x14d,0x11be,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca, -0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca,0x11ca, -0x11ca,0x11ca,0x14d,0x14d,0x14d,0x14d,0x14d,0x14d,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11c7,0x11d6, -0x11d9,0x11d9,0x11d9,0x11d9,0x11c7,0x11c7,0x14d,0x14d,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0, -0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15bd,0x1adf,0x1329,0x1302,0x1320,0x1320,0x1320,0x1320,0x1320,0x1320, -0x1320,0x1308,0x1305,0x12fc,0x12fc,0x1326,0x12fc,0x12fc,0x12fc,0x12fc,0x130b,0x14eb,0x14f1,0x14ee,0x14ee,0x193b, -0x1716,0x1716,0x1aac,0x150,0x150,0x150,0x150,0x150,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee, -0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11e5,0x11e5,0x11e8,0x11f1,0x11eb,0x11eb,0x11eb,0x11f1, -0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea, -0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x12ea, -0x12ea,0x12ea,0x12ea,0x12ea,0x12ea,0x159,0x159,0x159,0x120f,0x1203,0x1203,0x1203,0x1203,0x1203,0x1203,0x1206, -0x1215,0x1215,0x1203,0x1203,0x1203,0x1203,0x15c,0x131a,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209,0x1209, -0x1209,0x1209,0x15c,0x15c,0x15c,0x15c,0x1203,0x1203,0x1233,0x1227,0x1233,0x15f,0x15f,0x15f,0x15f,0x15f, -0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f,0x15f, -0x15f,0x15f,0x15f,0x1230,0x1230,0x1236,0x122a,0x122d,0x124b,0x124b,0x124b,0x1245,0x1245,0x123c,0x1245,0x1245, -0x123c,0x1245,0x1245,0x124e,0x1248,0x123f,0x162,0x162,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242, -0x1242,0x1242,0x162,0x162,0x162,0x162,0x162,0x162,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x1254,0x165, -0x165,0x165,0x165,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251, -0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251,0x1251, -0x165,0x165,0x165,0x165,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d, -0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x168,0x125a,0x1257,0x1257,0x1257,0x1257, -0x1257,0x1257,0x1257,0x1257,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c, -0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x16b,0x16b,0x16b,0x1266,0x1269,0x1269, -0x1269,0x1269,0x1269,0x1269,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272, -0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x1272,0x16e,0x16e,0x126f,0x126f,0x126f,0x126f, -0x126f,0x126f,0x126f,0x126f,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278, -0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x171,0x171,0x171,0x171,0x171,0x1275,0x1275,0x1275,0x1275, -0x1275,0x1275,0x1275,0x1275,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e, -0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e,0x127e, -0x127e,0x127e,0x127e,0x177,0x1299,0x1299,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a, -0x17a,0x197d,0x17a,0x17a,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x14ca, -0x14ca,0x14ca,0x14ca,0x14ca,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, -0x129f,0x129f,0x129f,0x17d,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a4f,0x1a52,0x1a4c,0x279,0x279,0x279, -0x279,0x279,0x279,0x279,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e, -0x187e,0x1ad0,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180, -0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x180, -0x180,0x180,0x180,0x180,0x180,0x180,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, -0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, -0x12f6,0x13f5,0x13f2,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183, -0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0, -0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f0,0x12f3,0x12f0,0x12f0,0x13f5,0x13f5, -0x13f5,0x13f5,0x13f5,0x13f2,0x13f5,0x13f5,0x13f5,0x1881,0x183,0x183,0x183,0x183,0x12ed,0x12ed,0x12ed,0x12ed, -0x12ed,0x12ed,0x12ed,0x12ed,0x12ed,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1419,0x1419,0x183,0x183, -0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1920,0x1920,0x1920,0x1920, -0x1920,0x1920,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183, -0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x183, -0x183,0x183,0x183,0x183,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395, -0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x138f,0x138f,0x138f, -0x186,0x186,0x1392,0x186,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x1398,0x13a1,0x139b,0x139b,0x13a1,0x13a1, -0x13a1,0x139b,0x13a1,0x139b,0x139b,0x139b,0x13a4,0x13a4,0x189,0x189,0x189,0x189,0x189,0x189,0x189,0x189, -0x139e,0x139e,0x139e,0x139e,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa, -0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x18c,0x18c,0x18c,0x18c, -0x18c,0x18c,0x18c,0x18c,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x13aa,0x18c,0x13aa,0x13aa,0x13aa,0x13aa, -0x13aa,0x13aa,0x13aa,0x18c,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d, -0x161d,0x161d,0x161d,0x161d,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13b0,0x13c2,0x13c2,0x13b6,0x13b6,0x13b6, -0x13b6,0x13b6,0x18f,0x18f,0x18f,0x18f,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3, -0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b3,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9,0x13b9, -0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x1584, -0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5, -0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x192,0x192,0x192,0x192,0x192,0x192,0x192, -0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x195, -0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x1587, -0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13fe, -0x195,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8, -0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587, -0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195,0x195, -0x1413,0x1410,0x1410,0x1410,0x1410,0x1410,0x159c,0x159c,0x159c,0x159c,0x159c,0x159f,0x170d,0x159f,0x159f,0x159f, -0x17d9,0x188a,0x188a,0x18c3,0x18c3,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198,0x198,0x198,0x198,0x198,0x198, -0x159f,0x159f,0x159f,0x159f,0x159f,0x159f,0x159c,0x159c,0x159c,0x159f,0x159c,0x170a,0x170a,0x198,0x198,0x198, -0x159f,0x159c,0x159c,0x159f,0x188a,0x188a,0x188a,0x1926,0x1926,0x1a07,0x1a8e,0x1b39,0x1b39,0x198,0x198,0x198, -0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb, -0x13cb,0x13cb,0x13cb,0x13cb,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b,0x19b, -0x1467,0x15a5,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x15a5,0x15a5,0x15a5, -0x15a5,0x15a5,0x15a5,0x175e,0x175e,0x19e,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1809,0x1ad3,0x1ad3, -0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x1ad3,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e,0x19e, -0x19e,0x19e,0x19e,0x1983,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806,0x1806, -0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d, -0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d, -0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d, -0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1, -0x1a1,0x1a1,0x146d,0x1a1,0x1a1,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x146d,0x146d, -0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d,0x1a1,0x146d, -0x1a1,0x146d,0x146d,0x1a1,0x146d,0x1a1,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d, -0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x1a1, -0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d, -0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1, -0x1a1,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x146d,0x146d,0x146d,0x146d,0x146d, -0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x146d,0x1a1,0x1a1,0x1a1,0x1a1, -0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1, -0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x146a,0x146a,0x1a1,0x1a1, -0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1a1,0x1482,0x1482,0x1482,0x1482, -0x1482,0x1482,0x1482,0x1470,0x1470,0x1470,0x1470,0x1470,0x147f,0x1470,0x1473,0x1473,0x1470,0x1470,0x1470,0x1476, -0x1476,0x1a4,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x147c,0x1479,0x1485,0x1485,0x1485, -0x1989,0x1986,0x1986,0x1ad6,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x1a4,0x162f,0x162f,0x162f,0x162f, -0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x1491,0x1491,0x1491,0x1491, -0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x1491,0x148e,0x1488,0x1488,0x148e,0x148e,0x1497,0x1497,0x1491,0x1494, -0x1494,0x148e,0x148b,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x149a,0x149a,0x149a,0x149a, -0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a, -0x149a,0x149a,0x149a,0x149a,0x1aa,0x1aa,0x1aa,0x1aa,0x1761,0x1761,0x149a,0x149a,0x1761,0x1761,0x1761,0x1761, -0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1aa,0x1aa,0x1761,0x1761, -0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x14a6,0x14a6,0x14a6,0x14a6, -0x14a6,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1a37,0x1ad,0x1ad,0x1ad,0x1ad,0x1a31,0x14a6,0x14a3,0x14a3,0x14a3, -0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x1a34,0x1a34,0x1a34, -0x1a34,0x1a34,0x1a34,0x1a34,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x1ad,0x14a0,0x14a0,0x14a0,0x14a0,0x14a9, -0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14a9,0x14ca,0x14ca,0x14ca,0x14ca, -0x14ca,0x14ca,0x14ca,0x14ca,0x14ca,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14c7,0x14c7,0x14c7,0x14c7, -0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x14c7,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x14cd,0x14cd,0x14cd,0x14cd, -0x14cd,0x14cd,0x14cd,0x14cd,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1323,0x1320,0x1323,0x12ff, -0x1320,0x1326,0x1326,0x1329,0x1326,0x1329,0x132c,0x1320,0x1329,0x1329,0x1320,0x1320,0x14df,0x14df,0x14df,0x14df, -0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14d0,0x14d9,0x14d0,0x14d9,0x14d9,0x14d0,0x14d0,0x14d0,0x14d0, -0x14d0,0x14d0,0x14dc,0x14d3,0x1a3a,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x15b1,0x15b1,0x15b1,0x15b1, -0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x1b9,0x1b9,0x15ae,0x15ae,0x15ae,0x15ae, -0x15ae,0x15b4,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1719,0x1710,0x1710,0x1710, -0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710, -0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1710,0x1bf,0x1bf,0x1bf,0x1bf,0x1adf,0x1c2,0x1c2,0x1c2, -0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2, -0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2, -0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5,0x1c5,0x1c5, -0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5,0x1c5, -0x1c5,0x1c5,0x1c5,0x1c5,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x1c5,0x1c5, -0x15c9,0x15c3,0x15c6,0x15cf,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x1c8,0x1c8,0x1c8,0x1c8, -0x1c8,0x1c8,0x1c8,0x1c8,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba, -0x15ba,0x15ba,0x15ba,0x15ba,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, -0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x198c,0x198c,0x198c,0x198c,0x1cb,0x1cb,0x1cb, -0x1cb,0x1cb,0x1cb,0x1cb,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91,0x1a91, -0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb, -0x1cb,0x1cb,0x1cb,0x1cb,0x1776,0x171c,0x15de,0x1722,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7, -0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x1ce,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7, -0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x15e7,0x15e7, -0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7,0x1ce,0x1a16,0x171f,0x15e7,0x15d8,0x15de,0x15d8,0x15de,0x15de,0x15de, -0x15de,0x1ce,0x1ce,0x15de,0x15de,0x1ce,0x1ce,0x15e1,0x15e1,0x15e4,0x1ce,0x1ce,0x1779,0x1ce,0x1ce,0x1ce, -0x1ce,0x1ce,0x1ce,0x15d8,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ea,0x15e7,0x15e7,0x15e7,0x15e7,0x15de,0x15de, -0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x15db,0x1ce,0x1ce,0x1ce,0x15db,0x15db,0x15db,0x15db, -0x15db,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x15ff,0x15ff,0x15ff,0x15ff, -0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x1d1,0x15ff, -0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15ff,0x15f9,0x15f9,0x15f9,0x15ed, -0x15ed,0x15ed,0x15f9,0x15f9,0x15ed,0x15fc,0x15f0,0x15ed,0x1602,0x1602,0x15f6,0x1602,0x1602,0x15f3,0x180c,0x1d1, -0x1611,0x1611,0x1611,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1608,0x160b,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4, -0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x160e,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4, -0x177c,0x177c,0x177c,0x177c,0x161d,0x161a,0x1a3d,0x1a3d,0x1ae5,0x1ae8,0x1ae2,0x1ae2,0x1d7,0x1d7,0x1d7,0x1d7, -0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6, -0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, -0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, -0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, -0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, -0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, -0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da,0x1da, -0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f, -0x162f,0x162f,0x162f,0x1626,0x1629,0x162c,0x162f,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd,0x1dd, -0x163e,0x163e,0x163e,0x163e,0x163e,0x1632,0x1632,0x1e0,0x1e0,0x1e0,0x1e0,0x1635,0x1635,0x1635,0x1635,0x1635, -0x163b,0x163b,0x163b,0x163b,0x163b,0x163b,0x1638,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0, -0x1647,0x1647,0x1647,0x1647,0x1647,0x1e3,0x1e3,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644,0x1644, -0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3, -0x164a,0x165c,0x165c,0x1650,0x1659,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6, -0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1653,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6, -0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662, -0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1662,0x1e9, -0x166e,0x166e,0x166e,0x166e,0x166e,0x1668,0x1671,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e,0x166e, -0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166b,0x166e,0x166e,0x166e,0x166e,0x166e,0x1ec, -0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677, -0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1677,0x1ef, -0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1683, -0x1683,0x1683,0x1683,0x1683,0x1683,0x1683,0x1680,0x1680,0x1680,0x1680,0x1680,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2, -0x169b,0x169b,0x169e,0x169e,0x16a1,0x1692,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5, -0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1f5,0x1692,0x1692,0x1692,0x1692,0x1692, -0x1692,0x1692,0x1f5,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, -0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x169b,0x169b,0x169b, -0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa, -0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8, -0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3,0x16b3, -0x16b3,0x16b3,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16b0,0x16b0,0x16b0,0x16b0,0x1fb,0x1fb,0x1fb, -0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16b6, -0x16c8,0x16c8,0x16b6,0x16b6,0x16b6,0x16b6,0x201,0x201,0x16c8,0x16c8,0x16cb,0x16cb,0x16b6,0x16b6,0x16c8,0x16bc, -0x16b9,0x16bf,0x16d1,0x16d1,0x16c2,0x16c2,0x16c5,0x16c5,0x16c5,0x16d1,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785, -0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1782,0x1782,0x1782,0x1782,0x177f,0x177f,0x201,0x201, -0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201, +0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d, +0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0x69,0xb0d,0xb0d,0xb0d,0xb0d,0xb10, +0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d, +0xb0d,0xb0d,0xb0d,0xb10,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, +0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13, +0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c, +0x6f,0x822,0x81c,0x822,0x81c,0x822,0x81c,0x822,0x81c,0x822,0x81c,0x81c,0x81f,0x81c,0x81f,0x81c, +0x81f,0x81c,0x81f,0x81c,0x81f,0x81c,0x81f,0x81c,0x81f,0x81c,0x81f,0x81c,0x81f,0x81c,0x81f,0x81c, +0x81c,0x81c,0x81c,0x822,0x81c,0x822,0x81c,0x822,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x822,0x81c, +0x81c,0x81c,0x81c,0x81c,0x81f,0xc63,0xc63,0x6f,0x6f,0x936,0x936,0x8fd,0x8fd,0x825,0x828,0xc60, +0x72,0x72,0x72,0x72,0x72,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a, +0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a,0x83a, +0x83a,0x1107,0x18d2,0x19bc,0x75,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d, +0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x75,0x906,0x906,0x909,0x909,0x909,0x909,0x909,0x909, +0x909,0x909,0x909,0x909,0x909,0x909,0x909,0x909,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846, +0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846,0x846, +0x846,0x846,0x846,0x846,0x846,0xd5f,0xd5f,0x78,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25, +0xb25,0xb25,0xb25,0xb25,0xb25,0x7b,0x7b,0x7b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b, +0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xc6c,0xb2b,0xb2b,0xb2b,0xc6c,0xb2b,0x7e, +0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac, +0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x9c0,0x9c0,0x9c0,0x9c0,0x81,0x81,0x81,0x81, +0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x1221,0x1221,0x1221,0x1221,0x1221,0x1221,0x1221,0x1221, +0x1221,0x1221,0x1221,0x1221,0x1221,0x1221,0x1221,0x1221,0x609,0x609,0x609,0x609,0x609,0x609,0x609,0x84, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x5f7,0x5f7,0x5f7,0x5f7,0x5f7, +0x84,0x84,0x84,0x84,0x84,0xafe,0x5fa,0x600,0x606,0x606,0x606,0x606,0x606,0x606,0x606,0x606, +0x606,0x5fd,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x84, +0x600,0x600,0x600,0x600,0x600,0x84,0x600,0x84,0x600,0x600,0x84,0x600,0x600,0x84,0x600,0x600, +0x600,0x600,0x600,0x600,0x600,0x600,0x600,0x603,0x615,0x60f,0x615,0x60f,0x612,0x618,0x615,0x60f, +0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f,0x1329,0x1329,0x1b21,0x87,0x87,0x87,0x87,0x87, +0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x615,0x60f,0x612,0x618,0x615, +0x60f,0x615,0x60f,0x615,0x60f,0x615,0x615,0x60f,0x60f,0x60f,0x60f,0x612,0x60f,0x60f,0x612,0x60f, +0x612,0x612,0x612,0x60f,0x612,0x612,0x612,0x612,0x87,0x87,0x612,0x612,0x612,0x612,0x60f,0x60f, +0x612,0x60f,0x60f,0x60f,0x60f,0x612,0x60f,0x60f,0x60f,0x60f,0x60f,0x612,0x612,0x612,0x60f,0x60f, +0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x1b21,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49, +0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0x85e,0x870,0x86d,0x870,0x86d,0xc81,0xc81,0xd6b, +0xd68,0x861,0x861,0x861,0x861,0x873,0x873,0x873,0x88b,0x88e,0x89d,0x8a,0x891,0x894,0x8a0,0x8a0, +0x888,0x87f,0x879,0x87f,0x879,0x87f,0x879,0x87c,0x87c,0x897,0x897,0x89a,0x897,0x897,0x897,0x8a, +0x897,0x885,0x882,0x87c,0x8a,0x8a,0x8a,0x8a,0x621,0x62d,0x621,0xbfd,0x621,0x8d,0x621,0x62d, +0x621,0x62d,0x621,0x62d,0x621,0x62d,0x621,0x62d,0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627, +0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x62a,0x624,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x62a, +0x624,0x62a,0x624,0x62a,0x624,0x8d,0x8d,0x61e,0x75f,0x762,0x777,0x77a,0x759,0x762,0x762,0x93, +0x741,0x744,0x744,0x744,0x744,0x741,0x741,0x93,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, +0x90,0xb01,0xb01,0xb01,0x9c3,0x73b,0x630,0x630,0x93,0x789,0x768,0x759,0x762,0x75f,0x759,0x76b, +0x75c,0x756,0x759,0x777,0x76e,0x765,0x786,0x759,0x783,0x783,0x783,0x783,0x783,0x783,0x783,0x783, +0x783,0x783,0x774,0x771,0x777,0x777,0x777,0x789,0x74a,0x747,0x747,0x747,0x747,0x747,0x747,0x747, +0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x747, +0x747,0x747,0x747,0x747,0x747,0x747,0x747,0x93,0x93,0x93,0x747,0x747,0x747,0x747,0x747,0x747, +0x93,0x93,0x747,0x747,0x747,0x747,0x747,0x747,0x93,0x93,0x747,0x747,0x747,0x747,0x747,0x747, +0x93,0x93,0x747,0x747,0x747,0x93,0x93,0x93,0xb4c,0xb4c,0xb4c,0xb4c,0x96,0x96,0x96,0x96, +0x96,0x96,0x96,0x96,0x96,0x186f,0x186f,0x186f,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52, +0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0xb52,0x99,0x99,0x99,0x99,0x99, +0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635, +0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b, +0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, +0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0x9f,0x9f,0xfe4,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67, +0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67, +0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x1b24,0x1b24,0x9f,0x9f,0x9f,0x9f,0x9f, +0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xa2,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7f,0xb7f,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7f,0xa2,0xb7f,0xb7f, +0xa2,0xa2,0xb7f,0xa2,0xa2,0xb7f,0xb7f,0xa2,0xa2,0xb7f,0xb7f,0xb7f,0xb7f,0xa2,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7c,0xb7c,0xb7c,0xb7c,0xa2,0xb7c,0xa2,0xb7c,0xb7c,0xb7c, +0xb7c,0xcf3,0xb7c,0xb7c,0xa2,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7f,0xb7f,0xa2,0xb7f,0xb7f,0xb7f,0xb7f,0xa2,0xa2,0xb7f,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xa2,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xa2,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7f,0xb7f,0xa2,0xb7f,0xb7f,0xb7f,0xb7f,0xa2, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xa2,0xb7f,0xa2,0xa2,0xa2,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7f,0xa2,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xddd,0xddd,0xa2,0xa2,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7c,0xb7c,0xb7c,0xb76, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xef4,0xef1,0xa2,0xa2,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79, +0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xa5,0xb85,0xa5,0xa5, +0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5, +0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xc0c,0xc0c,0xc0c,0xc0c, +0xc0c,0xc0c,0xc0c,0xc0c,0xc0c,0xc0c,0xc0c,0xc0c,0xc0c,0x1b2a,0xc0c,0xc0c,0xc0c,0xc0c,0xc06,0xc06, +0xc09,0x1b27,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0x1b2a,0xc15,0xc15,0xc15,0xc15, +0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc15,0xc0f,0xc0f, +0xc12,0xc75,0xc75,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xc1b,0xc1b,0xc1b,0xc1b, +0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc1b,0xc18,0xc18, +0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xc21,0xc21,0xc21,0xc21, +0xc21,0xc21,0xc21,0xc21,0xc21,0xc21,0xc21,0xc21,0xc21,0xb1,0xc21,0xc21,0xc21,0xb1,0xc1e,0xc1e, +0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd05,0xd05,0xd05,0xd05, +0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05, +0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0xd05,0x14f1,0x14f1,0xb4,0xcf6,0xcf6,0xcf6,0xd02, +0xd02,0xd02,0xd02,0xcf6,0xcf6,0xd02,0xd02,0xd02,0xb4,0xb4,0xb4,0xb4,0xd02,0xd02,0xcf6,0xd02, +0xd02,0xd02,0xd02,0xd02,0xd02,0xcf9,0xcf9,0xcf9,0xb4,0xb4,0xb4,0xb4,0xcfc,0xb4,0xb4,0xb4, +0xd08,0xd08,0xcff,0xcff,0xcff,0xcff,0xcff,0xcff,0xcff,0xcff,0xcff,0xcff,0xd0b,0xd0b,0xd0b,0xd0b, +0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xb7,0xb7, +0xd0b,0xd0b,0xd0b,0xd0b,0xd0b,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7,0xb7, +0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4, +0x14f4,0x14f4,0x14f4,0x14f4,0xba,0xba,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4, +0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0xba,0x1a76, +0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f, +0xd2f,0xd2f,0xd2f,0xd2f,0xbd,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f, +0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xbd,0xd2f,0xd2f,0xd2f,0xd2f, +0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xbd, +0xd2f,0xd2f,0xbd,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f, +0xd2f,0xd2f,0xbd,0xbd,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f,0xd2f, +0xd2f,0xd2f,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd, +0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd,0xbd, +0xbd,0xbd,0xbd,0xbd,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32, +0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xc0, +0xc0,0xc0,0xc0,0xc0,0xd71,0xd71,0xd77,0xc3,0xc3,0xc3,0xc3,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e, +0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e,0xd6e, +0xd6e,0xd6e,0xd6e,0xd6e,0xc3,0xc3,0xc3,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74, +0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38, +0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xd38,0xc6,0xd35, +0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41, +0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xd41,0xc9,0xc9, +0xd3e,0xd3e,0xd3e,0xd3e,0xd3e,0xd3e,0xd3e,0xd3e,0xd3e,0xd3e,0xc9,0xc9,0xc9,0xc9,0xc9,0xc9, +0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833, +0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xcc,0xcc,0xd44,0xcc,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44, +0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44, +0xd44,0xd44,0xcc,0xd44,0xd44,0xcc,0xcc,0xcc,0xd44,0xcc,0xcc,0xd44,0xd47,0xd47,0xd47,0xd47, +0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47, +0xd47,0xd47,0xd47,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xcf,0xdf8,0xdf8,0xdf8,0xdf8, +0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0x14f7,0x14f7,0x17a9,0x17a9,0xd5,0x10e6,0x10e6,0x10e6,0x10e6, +0x10e6,0x10e6,0x10e6,0x10e6,0x10e6,0x10e6,0x10e6,0x10e6,0x1a85,0x126,0x126,0x126,0xe0a,0xe0a,0xe0a,0xe0a, +0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a, +0xe0a,0xe0a,0xe0a,0xe01,0xe01,0xe07,0xe07,0xe01,0xd8,0xd8,0xe04,0xe04,0x1113,0x1113,0x1113,0x1113, +0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0x1c56,0xc72,0xc72,0xc72,0xc72, +0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xc72,0xe1c,0xe19,0xe1c,0xe19, +0xe19,0xe10,0xe10,0xe10,0xe10,0xe10,0xe10,0x1161,0x115e,0x1161,0x115e,0x115b,0x115b,0x115b,0x13ef,0x13ec, +0xde,0xde,0xde,0xde,0xde,0xe16,0xe13,0xe13,0xe13,0xe10,0xe16,0xe13,0xe1f,0xe1f,0xe1f,0xe1f, +0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f, +0xe1f,0xe1f,0xe1f,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1f,0xe1f,0xe1f,0xe1f, +0xe1f,0xe1f,0xe1f,0xe1,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1,0xe1f,0xe1f,0xe1f,0xe1f, +0xe1f,0xe1f,0xe1f,0xe1,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1f,0xe1,0xe25,0xe25,0xe25,0xe25, +0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe22,0xe22,0xe22,0xe22, +0xe22,0xe22,0xe22,0xe22,0xe22,0xe22,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xe28,0xe28,0xe28,0xe28, +0xe28,0xe28,0xe7,0x13f2,0xe7,0xe7,0xe7,0xe7,0xe7,0x13f2,0xe7,0xe7,0xe7f,0xe7f,0xe7f,0xe7f, +0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe40,0xe34,0xe34,0xe34, +0xea,0xe34,0xe34,0xea,0xea,0xea,0xea,0xea,0xe34,0xe34,0xe34,0xe34,0xe40,0xe40,0xe40,0xe40, +0xea,0xe40,0xe40,0xe40,0xea,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40, +0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0xe40,0x1914,0x1914,0xea,0xea, +0xe31,0xe31,0xe31,0xea,0xea,0xea,0xea,0xe37,0xe3a,0xe3a,0xe3a,0xe3a,0xe3a,0xe3a,0xe3a,0xe3a, +0x1911,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xe3d,0xe3d,0xe3d,0xe3d,0xe3d,0xe3d,0xe43,0xe43, +0xe3a,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0x1167,0x1167,0xed,0xed,0xed,0xed,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe52,0xe52,0xe52, +0xe4f,0xe4f,0xe52,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xed,0xed, +0xed,0xed,0xed,0xed,0xe4c,0xe4c,0xe4c,0xe4c,0xe4c,0xe4c,0xe4c,0xe4c,0xe4c,0xe4c,0x1164,0xed, +0xed,0xed,0xe49,0xe49,0xe58,0xe58,0xe58,0xe58,0xf0,0xf0,0xf0,0xf0,0xe58,0xe58,0xe58,0xe58, +0xe58,0xe58,0xe58,0xe58,0xe55,0xe58,0xe58,0xe58,0xe58,0xe58,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, +0xf0,0xf0,0xf0,0xf0,0x1506,0x150c,0x1509,0x1854,0x17af,0x1878,0x1878,0x1878,0x1878,0x1878,0x191a,0x1917, +0x191d,0x1917,0x191d,0x19dd,0x1a79,0x1a79,0x1a79,0x1b3c,0x1b3c,0x1b36,0x1b33,0x1b36,0x1b33,0x1b36,0x1b33,0x1b36, +0x1b33,0x1b39,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3, +0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3, +0xf3,0xf3,0xf3,0xf3,0xe7c,0xe7c,0xe7c,0xe79,0xe79,0xe70,0xe70,0xe79,0xe76,0xe76,0xe76,0xe76, +0x1a7c,0xf6,0xf6,0xf6,0x12cc,0x12cc,0x12cc,0x12cf,0x12cf,0x12cf,0x12d2,0x12d2,0x12d5,0x12d2,0x14a,0x14a, +0x14a,0x14a,0x14a,0x14a,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0x13fe,0x13fe,0xf9,0xf9,0xf9,0xf9, +0xf9,0xf9,0xf9,0xe82,0x133b,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9, +0xf9,0xf9,0xf9,0x1338,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45,0xc45, +0xc45,0xc45,0xc45,0xc45,0xeaf,0xea0,0xe9a,0xeac,0xea9,0xea3,0xea3,0xeb2,0xe9d,0xea6,0xfc,0xfc, +0xfc,0xfc,0xfc,0xfc,0xf36,0xf36,0xf21,0xf36,0xf39,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c, +0x1b3f,0x102,0x102,0x102,0xf30,0xf30,0xf30,0xf30,0xf30,0xf30,0xf30,0xf30,0xf30,0xf30,0xf42,0xf42, +0xf2a,0xf2d,0xf42,0xf42,0xf27,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf24, +0xf24,0xf24,0xf24,0xf24,0xf24,0xf24,0xf24,0xf24,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a,0xf2a, +0xf2a,0x1b42,0x1b42,0x102,0x1b4b,0x1b45,0x19e3,0x19e0,0x19e3,0x19e3,0x19e3,0x1a82,0x1a7f,0x1a82,0x1a7f,0x105, +0x105,0x105,0x105,0x105,0x1b4b,0x1b45,0x105,0x1b45,0x105,0x1b45,0x1b4b,0x1b45,0x1b4b,0x1b45,0x105,0x105, +0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105,0x105, +0x105,0x105,0x1b48,0x1b48,0x1b48,0x1a82,0x1a7f,0x1515,0x1407,0x1407,0x133e,0x103e,0x103e,0x103e,0x103e,0x103e, +0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51, +0xf51,0xf51,0xf51,0xf51,0xf4e,0xf4e,0xf54,0xf54,0x108,0x108,0x108,0x108,0x108,0x108,0x108,0x108, +0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d, +0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf5d,0xf57,0xf57,0xf57,0xf57,0x1170,0x1170,0x10b,0x10b,0x10b,0xf5a, +0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b, +0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x1701,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e, +0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e, +0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0x10e,0xf66,0xf66,0xf66,0x1521, +0x1521,0x1521,0x1521,0x1521,0x1521,0x1521,0x1521,0x1521,0x1521,0x1521,0x1521,0x111,0xf63,0xf63,0xf63,0xf63, +0x151e,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0x111,0xf69,0xf69,0xf69,0xf69, +0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0xf69,0x192c,0x192c, +0x192c,0x192c,0x192c,0x192c,0x192c,0x114,0x114,0x114,0x114,0x114,0x114,0x114,0x1065,0x1065,0x1065,0x1065, +0x1062,0x1062,0x1062,0x1062,0x1062,0x1062,0x1062,0x1062,0x1053,0x1053,0x1053,0x1053,0x1053,0x1053,0x1053,0x1053, +0x1062,0x1062,0x1059,0x1056,0x117,0x117,0x117,0x1068,0x1068,0x105c,0x105c,0x105c,0x105f,0x105f,0x105f,0x105f, +0x105f,0x105f,0x105f,0x105f,0x105f,0x105f,0x117,0x117,0x117,0x1065,0x1065,0x1065,0x106b,0x106b,0x106b,0x106b, +0x106b,0x106b,0x106b,0x106b,0x106b,0x106b,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x1080,0x1080,0x1080,0x1080, +0x1080,0x1080,0x1080,0x1080,0x1080,0x1080,0x1083,0x1083,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a, +0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x11a,0x10aa,0x10aa,0x10aa,0x10aa, +0x10a4,0x17b5,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x10b0,0x10b0,0x10a7,0x10a7,0x10a7,0x10a7, +0x10a7,0x10a7,0x10a7,0x10a7,0x10a7,0x10a7,0x11d,0x11d,0x11d,0x11d,0x11d,0x11d,0x10ce,0x10ce,0x10ce,0x10ce, +0x10ce,0x10ce,0x10ce,0x10c2,0x10c2,0x10c2,0x10c2,0x10c2,0x10c2,0x10c2,0x10c2,0x10c2,0x10c2,0x10c2,0x10c8,0x10cb, +0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x120,0x10c5,0x10e0,0x10e0,0x10e0,0x10e0, +0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10d1,0x10d1,0x10d1,0x10d1,0x10d1,0x10d1,0x10da,0x10da,0x10d1,0x10d1,0x10da, +0x10da,0x10d1,0x10d1,0x123,0x123,0x123,0x123,0x123,0x123,0x123,0x123,0x123,0x10dd,0x10dd,0x10dd,0x10d1, +0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10dd,0x10d1,0x10da,0x123,0x123,0x10d7,0x10d7,0x10d7,0x10d7, +0x10d7,0x10d7,0x10d7,0x10d7,0x10d7,0x10d7,0x123,0x123,0x10d4,0x10e3,0x10e3,0x10e3,0x152d,0x126,0x126,0x126, +0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126, +0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x126,0x10e9,0x10e9,0x10e9,0x10e9, +0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9, +0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10ec,0x129,0x129,0x10ef,0x10ef,0x10ef,0x10ef, +0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef, +0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x12c,0x12c,0x12c,0x10f2,0x10f2,0x10f2,0x10f2, +0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x12f,0x12f,0x12f, +0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x12f,0x10f8,0x10f8,0x10f8,0x10f8, +0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8, +0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x10f8,0x132,0x132,0x132,0x132,0x132,0x10f5,0x10fb,0x10fb,0x10fb,0x10fb, +0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x135,0x135,0x135,0x135,0x10fe,0x10fe,0x10fe,0x10fe, +0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe, +0x138,0x138,0x138,0x138,0x138,0x138,0x138,0x138,0x138,0x138,0x138,0x138,0x1176,0x1176,0x1176,0x1176, +0x117f,0x1176,0x1176,0x1176,0x117f,0x1176,0x1176,0x1176,0x1176,0x1173,0x13b,0x13b,0x117c,0x117c,0x117c,0x117c, +0x117c,0x117c,0x117c,0x1182,0x117c,0x1182,0x117c,0x117c,0x117c,0x1182,0x1182,0x13b,0x1185,0x1185,0x1185,0x1185, +0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185, +0x1185,0x1185,0x13e,0x13e,0x13e,0x13e,0x13e,0x13e,0x13e,0x13e,0x13e,0x13e,0x11a0,0x11a0,0x11a0,0x11a0, +0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0, +0x11a0,0x119d,0x1188,0x119d,0x1188,0x1188,0x1188,0x1188,0x1188,0x1188,0x1188,0x141,0x1191,0x119a,0x1188,0x119a, +0x119a,0x1188,0x1188,0x1188,0x1188,0x1188,0x1188,0x1188,0x1188,0x119d,0x119d,0x119d,0x119d,0x119d,0x119d,0x1188, +0x1188,0x118e,0x118e,0x118e,0x118e,0x118e,0x118e,0x118e,0x118e,0x141,0x141,0x118b,0x1197,0x1197,0x1197,0x1197, +0x1197,0x1197,0x1197,0x1197,0x1197,0x1197,0x141,0x141,0x141,0x141,0x141,0x141,0x1197,0x1197,0x1197,0x1197, +0x1197,0x1197,0x1197,0x1197,0x1197,0x1197,0x141,0x141,0x141,0x141,0x141,0x141,0x1194,0x1194,0x1194,0x1194, +0x1194,0x1194,0x1194,0x11a3,0x11a6,0x11a6,0x11a6,0x11a6,0x1194,0x1194,0x141,0x141,0x156c,0x156c,0x156c,0x156c, +0x156c,0x156c,0x156c,0x156c,0x156c,0x156c,0x156c,0x156c,0x156c,0x156c,0x1569,0x1a97,0x12e7,0x12c0,0x12de,0x12de, +0x12de,0x12de,0x12de,0x12de,0x12de,0x12c6,0x12c3,0x12ba,0x12ba,0x12e4,0x12ba,0x12ba,0x12ba,0x12ba,0x12c9,0x14a6, +0x14ac,0x14a9,0x14a9,0x18f3,0x16c8,0x16c8,0x1a64,0x144,0x144,0x144,0x144,0x144,0x11bb,0x11bb,0x11bb,0x11bb, +0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11b2,0x11b2,0x11b5,0x11be, +0x11b8,0x11b8,0x11b8,0x11be,0x147,0x147,0x147,0x147,0x147,0x147,0x147,0x147,0x12ab,0x12ab,0x12ab,0x12ab, +0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab, +0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x12ab,0x14d,0x14d,0x14d,0x11dc,0x11d0,0x11d0,0x11d0, +0x11d0,0x11d0,0x11d0,0x11d3,0x11e2,0x11e2,0x11d0,0x11d0,0x11d0,0x11d0,0x150,0x12db,0x11d6,0x11d6,0x11d6,0x11d6, +0x11d6,0x11d6,0x11d6,0x11d6,0x11d6,0x11d6,0x150,0x150,0x150,0x150,0x11d0,0x11d0,0x1200,0x11f4,0x1200,0x153, +0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x153, +0x153,0x153,0x153,0x153,0x153,0x153,0x153,0x11fd,0x11fd,0x1203,0x11f7,0x11fa,0x1218,0x1218,0x1218,0x1212, +0x1212,0x1209,0x1212,0x1212,0x1209,0x1212,0x1212,0x121b,0x1215,0x120c,0x156,0x156,0x120f,0x120f,0x120f,0x120f, +0x120f,0x120f,0x120f,0x120f,0x120f,0x120f,0x156,0x156,0x156,0x156,0x156,0x156,0x1221,0x1221,0x1221,0x1221, +0x1221,0x1221,0x1221,0x159,0x159,0x159,0x159,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e, +0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e, +0x121e,0x121e,0x121e,0x121e,0x159,0x159,0x159,0x159,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a, +0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x122a,0x15c,0x1227, +0x1224,0x1224,0x1224,0x1224,0x1224,0x1224,0x1224,0x1224,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239, +0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x15f,0x15f, +0x15f,0x1233,0x1236,0x1236,0x1236,0x1236,0x1236,0x1236,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f, +0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x123f,0x162,0x162, +0x123c,0x123c,0x123c,0x123c,0x123c,0x123c,0x123c,0x123c,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245, +0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x1245,0x165,0x165,0x165,0x165,0x165, +0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x1242,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b, +0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b, +0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x16b,0x1263,0x1263,0x1b4e,0x16e,0x16e,0x16e,0x16e,0x16e, +0x16e,0x16e,0x16e,0x16e,0x16e,0x1935,0x16e,0x16e,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485, +0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1836,0x1836,0x1836,0x1836,0x1836,0x1836,0x1836,0x1836, +0x1836,0x1836,0x1836,0x1836,0x1836,0x1a88,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171, +0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171, +0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x171,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a, +0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a,0x134a, +0x134a,0x134a,0x134a,0x134a,0x12b4,0x13b0,0x13b0,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174, +0x174,0x174,0x174,0x174,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1, +0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x12b1,0x13b0,0x13b0,0x13b0,0x13b0,0x13b0,0x13b0,0x13b0,0x13b0,0x13b0,0x1839, +0x174,0x174,0x174,0x174,0x12ae,0x12ae,0x12ae,0x12ae,0x12ae,0x12ae,0x12ae,0x12ae,0x12ae,0x174,0x174,0x174, +0x174,0x174,0x174,0x174,0x13d4,0x13d4,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174, +0x174,0x174,0x174,0x174,0x18d8,0x18d8,0x18d8,0x18d8,0x18d8,0x18d8,0x174,0x174,0x174,0x174,0x174,0x174, +0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174, +0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x174,0x1353,0x1353,0x1353,0x1353, +0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353,0x1353, +0x1353,0x1353,0x1353,0x1353,0x1353,0x134d,0x134d,0x134d,0x177,0x177,0x1350,0x177,0x1365,0x1365,0x1365,0x1365, +0x1365,0x1365,0x1356,0x135f,0x1359,0x1359,0x135f,0x135f,0x135f,0x1359,0x135f,0x1359,0x1359,0x1359,0x1362,0x1362, +0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x17a,0x135c,0x135c,0x135c,0x135c,0x17d,0x1368,0x1368,0x1368, +0x1368,0x1368,0x1368,0x17d,0x17d,0x1368,0x1368,0x1368,0x1368,0x1368,0x1368,0x17d,0x17d,0x1368,0x1368,0x1368, +0x1368,0x1368,0x1368,0x17d,0x17d,0x17d,0x17d,0x17d,0x17d,0x17d,0x17d,0x17d,0x1368,0x1368,0x1368,0x1368, +0x1368,0x1368,0x1368,0x17d,0x1368,0x1368,0x1368,0x1368,0x1368,0x1368,0x1368,0x17d,0x15cf,0x15cf,0x15cf,0x15cf, +0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x136b,0x136b,0x136b,0x136b, +0x136b,0x136b,0x136e,0x1383,0x1383,0x1374,0x1374,0x1374,0x1374,0x1374,0x180,0x180,0x180,0x180,0x1371,0x1371, +0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1371,0x1377,0x1377, +0x1377,0x1377,0x1377,0x1377,0x1377,0x1377,0x1377,0x1377,0x1b54,0x1b57,0x1b57,0x1b51,0x1b51,0x1b57,0x180,0x180, +0x180,0x180,0x180,0x180,0x180,0x180,0x180,0x153c,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386, +0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386, +0x1386,0x183,0x183,0x183,0x183,0x183,0x183,0x183,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389, +0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x186,0x186,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389, +0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x153f,0x186,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389, +0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x13b9,0x186,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389, +0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x1389,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f, +0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x153f,0x186,0x186, +0x186,0x186,0x186,0x186,0x186,0x186,0x186,0x186,0x13ce,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x154b,0x154b, +0x154b,0x154b,0x154b,0x154b,0x16bf,0x154b,0x154b,0x154b,0x1791,0x1842,0x1842,0x187b,0x187b,0x1a46,0x1af1,0x1af1, +0x189,0x189,0x189,0x189,0x1c3e,0x1bc0,0x1bc0,0x1bc0,0x154b,0x154b,0x154b,0x154b,0x154b,0x154b,0x154b,0x154b, +0x154b,0x154b,0x154b,0x16bc,0x16bc,0x189,0x189,0x189,0x154b,0x154b,0x154b,0x154b,0x1842,0x1842,0x1842,0x18de, +0x18de,0x19c2,0x1a46,0x1af1,0x1af1,0x189,0x189,0x189,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x1be4,0x1be4,0x1be4,0x18c, +0x18c,0x18c,0x18c,0x1be4,0x1be4,0x1be4,0x1be4,0x1be4,0x1428,0x1428,0x1428,0x1428,0x18f,0x1428,0x1428,0x1428, +0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428, +0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x18f,0x1428,0x1428,0x18f,0x1428,0x18f,0x18f,0x1428, +0x18f,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x18f,0x1428,0x1428,0x1428,0x1428, +0x18f,0x1428,0x18f,0x1428,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x1428,0x18f,0x18f,0x18f,0x18f,0x1428, +0x18f,0x1428,0x18f,0x1428,0x18f,0x1428,0x1428,0x1428,0x18f,0x1428,0x1428,0x18f,0x1428,0x18f,0x18f,0x1428, +0x18f,0x1428,0x18f,0x1428,0x18f,0x1428,0x18f,0x1428,0x18f,0x1428,0x1428,0x18f,0x1428,0x18f,0x18f,0x1428, +0x1428,0x1428,0x1428,0x18f,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x18f,0x1428,0x1428,0x1428,0x1428, +0x18f,0x1428,0x1428,0x1428,0x1428,0x18f,0x1428,0x18f,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428, +0x1428,0x1428,0x18f,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428, +0x1428,0x1428,0x1428,0x1428,0x18f,0x18f,0x18f,0x18f,0x18f,0x1428,0x1428,0x1428,0x18f,0x1428,0x1428,0x1428, +0x1428,0x1428,0x18f,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428,0x1428, +0x1428,0x1428,0x1428,0x1428,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f, +0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f, +0x18f,0x18f,0x18f,0x18f,0x1425,0x1425,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f,0x18f, +0x18f,0x18f,0x18f,0x18f,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x142b,0x142b,0x142b,0x142b,0x142b, +0x143a,0x142b,0x142e,0x142e,0x142b,0x142b,0x142b,0x1431,0x1431,0x192,0x1437,0x1437,0x1437,0x1437,0x1437,0x1437, +0x1437,0x1437,0x1437,0x1437,0x1434,0x1440,0x1440,0x1440,0x1941,0x193e,0x193e,0x1a8e,0x192,0x192,0x192,0x192, +0x192,0x192,0x192,0x192,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1, +0x15e1,0x15e1,0x15e1,0x15e1,0x144c,0x144c,0x144c,0x144c,0x144c,0x144c,0x144c,0x144c,0x144c,0x144c,0x144c,0x1449, +0x1443,0x1443,0x1449,0x1449,0x1452,0x1452,0x144c,0x144f,0x144f,0x1449,0x1446,0x195,0x195,0x195,0x195,0x195, +0x195,0x195,0x195,0x195,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455, +0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x198,0x198,0x198,0x198, +0x1716,0x1716,0x1455,0x1455,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716, +0x1716,0x1716,0x1716,0x1716,0x198,0x198,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716, +0x1716,0x1716,0x1716,0x1716,0x1461,0x1461,0x1461,0x1461,0x1461,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19b, +0x19b,0x19b,0x19b,0x19e9,0x1461,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e, +0x145e,0x145e,0x145e,0x145e,0x19ec,0x19ec,0x19ec,0x19ec,0x19ec,0x19ec,0x19ec,0x19ec,0x19b,0x19b,0x19b,0x19b, +0x19b,0x19b,0x19b,0x145b,0x145b,0x145b,0x145b,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464, +0x1464,0x1464,0x1464,0x1464,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x1485,0x19e,0x19e,0x19e, +0x19e,0x19e,0x19e,0x19e,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x19e,0x19e, +0x19e,0x19e,0x19e,0x19e,0x1488,0x1488,0x1488,0x1488,0x1488,0x1488,0x1488,0x1488,0x1a1,0x1a1,0x1a1,0x1a1, +0x1a1,0x1a1,0x1a1,0x1a1,0x12e1,0x12de,0x12e1,0x12bd,0x12de,0x12e4,0x12e4,0x12e7,0x12e4,0x12e7,0x12ea,0x12de, +0x12e7,0x12e7,0x12de,0x12de,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x148b, +0x1494,0x148b,0x1494,0x1494,0x148b,0x148b,0x148b,0x148b,0x148b,0x148b,0x1497,0x148e,0x19f2,0x1b63,0x1a4,0x1a4, +0x1a4,0x1a4,0x1a4,0x1a4,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d, +0x155d,0x155d,0x1a7,0x1a7,0x155a,0x155a,0x155a,0x155a,0x155a,0x1560,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7,0x1a7, +0x1a7,0x1a7,0x1a7,0x1a7,0x1566,0x1566,0x1566,0x1566,0x1aa,0x1aa,0x1aa,0x1aa,0x1aa,0x1aa,0x1aa,0x1aa, +0x1aa,0x1aa,0x1aa,0x1563,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x2af, +0x1bae,0x1bae,0x1bae,0x1bae,0x16cb,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2, +0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2,0x16c2, +0x1ad,0x1ad,0x1ad,0x1ad,0x1a97,0x1b69,0x1b69,0x1b69,0x1b69,0x1b69,0x1b69,0x1b69,0x1b69,0x1b69,0x1b69,0x1b69, +0x1b66,0x1b66,0x1b66,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0, +0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0,0x1b0, +0x1b0,0x1b0,0x1b0,0x1b0,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1b3, +0x1b3,0x1b3,0x1b3,0x1b3,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578, +0x1578,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1b3,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578, +0x1578,0x1578,0x1b3,0x1b3,0x1575,0x156f,0x1572,0x157b,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e, +0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1b6,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566, +0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581, +0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1944,0x1944,0x1944, +0x1944,0x1be7,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49, +0x1a49,0x1a49,0x1a49,0x1a49,0x1b9,0x1b9,0x1b9,0x1b9,0x1bc3,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9, +0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x1b9,0x172b,0x16ce,0x158a,0x16d4,0x1bc,0x1596,0x1596,0x1596, +0x1596,0x1596,0x1596,0x1596,0x1596,0x1bc,0x1bc,0x1596,0x1596,0x1bc,0x1bc,0x1596,0x1596,0x1596,0x1596,0x1596, +0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1bc,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596, +0x1596,0x1bc,0x1596,0x1596,0x1bc,0x1596,0x1596,0x1596,0x1596,0x1596,0x1bc,0x19ce,0x16d1,0x1593,0x1584,0x158a, +0x1584,0x158a,0x158a,0x158a,0x158a,0x1bc,0x1bc,0x158a,0x158a,0x1bc,0x1bc,0x158d,0x158d,0x1590,0x1bc,0x1bc, +0x172e,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1584,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x159c,0x1599,0x1599, +0x1596,0x1596,0x158a,0x158a,0x1bc,0x1bc,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1587,0x1bc,0x1bc,0x1bc, +0x1587,0x1587,0x1587,0x1587,0x1587,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc,0x1bc, +0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1, +0x15b1,0x15b1,0x1bf,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1, +0x15c3,0x15c3,0x15c3,0x15b7,0x15b7,0x15b7,0x15b7,0x15b7,0x15b7,0x15ba,0x15bd,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2, +0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x15c0,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2,0x1c2, +0x1731,0x1731,0x1731,0x1731,0x15cf,0x15cc,0x19f5,0x19f5,0x1a9d,0x1aa0,0x1a9a,0x1a9a,0x1c5,0x1c5,0x1c5,0x1c5, +0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e, +0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, +0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8, +0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, +0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8, +0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8, +0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8,0x1c8, +0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1,0x15e1, +0x15e1,0x15e1,0x15e1,0x15d8,0x15db,0x15de,0x15e1,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb,0x1cb, +0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15e4,0x15e4,0x1ce,0x1ce,0x1ce,0x1ce,0x15e7,0x15e7,0x15e7,0x15e7,0x15e7, +0x15ed,0x15ed,0x16d7,0x15ed,0x15ed,0x15ed,0x15ea,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce,0x1ce, +0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x1d1,0x1d1,0x15f6,0x15f6,0x15f6,0x15f6,0x15f6,0x15f6,0x15f6,0x15f6,0x15f6, +0x15f3,0x15f3,0x15f3,0x15f3,0x15f3,0x15f3,0x15f3,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1,0x1d1, +0x15fc,0x160e,0x160e,0x1602,0x160b,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4, +0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1605,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4,0x1d4, +0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614, +0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1d7, +0x1611,0x1611,0x1611,0x1611,0x1611,0x1611,0x1611,0x1611,0x1611,0x1611,0x1d7,0x1d7,0x1d7,0x1d7,0x1617,0x1617, +0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f, +0x1620,0x1620,0x1620,0x1620,0x1620,0x161a,0x1623,0x1620,0x1620,0x1620,0x1620,0x1620,0x1620,0x1620,0x1620,0x1620, +0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x1620,0x1620,0x1620,0x1620,0x1620,0x1da, +0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629, +0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1629,0x1dd, +0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1635, +0x1635,0x1635,0x1635,0x1635,0x1635,0x1635,0x1632,0x1632,0x1632,0x1632,0x1632,0x1e0,0x1e0,0x1e0,0x1e0,0x1e0, +0x164d,0x164d,0x1650,0x1650,0x1653,0x1644,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3, +0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x1e3,0x1644,0x1644,0x1644,0x1644,0x1644, +0x1644,0x1644,0x1e3,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d, +0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x1e3,0x1e3,0x1e3,0x1e3,0x1e3,0x164d,0x164d,0x164d, +0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c, +0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6,0x1e6, +0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665,0x1665, +0x1665,0x1665,0x1e9,0x1e9,0x1e9,0x1e9,0x1e9,0x1e9,0x1e9,0x1662,0x1662,0x1662,0x1662,0x1e9,0x1e9,0x1e9, +0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1668, +0x167a,0x167a,0x1668,0x1668,0x1668,0x1668,0x1ef,0x1ef,0x167a,0x167a,0x167d,0x167d,0x1668,0x1668,0x167a,0x166e, +0x166b,0x1671,0x1683,0x1683,0x1674,0x1674,0x1677,0x1677,0x1677,0x1683,0x173a,0x173a,0x173a,0x173a,0x173a,0x173a, +0x173a,0x173a,0x173a,0x173a,0x173a,0x173a,0x173a,0x173a,0x1737,0x1737,0x1737,0x1737,0x1734,0x1734,0x1ef,0x1ef, +0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef, +0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef,0x1ef, +0x1f2,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686, +0x1686,0x1686,0x1686,0x1686,0x1686,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2,0x1f2, +0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1f5,0x1f5,0x1f5,0x1f5, +0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689, +0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689, +0x1689,0x1689,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689, +0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689, +0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1f5,0x1f5,0x1aa3,0x1aa3,0x1f5,0x1f5, +0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5, +0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5,0x1f5, +0x168c,0x169b,0x1692,0x168f,0x16a1,0x16a1,0x1695,0x16a1,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8, +0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1698,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8,0x1f8, +0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a4,0x16a4,0x16a4,0x16a4,0x16a4,0x16a4, +0x16a4,0x16a4,0x16a4,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x1fb,0x16ad, +0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f, +0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x174f,0x1947,0x1fe,0x1fe,0x173d,0x173d,0x173d, +0x1749,0x1749,0x173d,0x173d,0x173d,0x173d,0x174c,0x173d,0x173d,0x173d,0x173d,0x1740,0x1fe,0x1fe,0x1fe,0x1fe, +0x1746,0x1746,0x1746,0x1746,0x1746,0x1746,0x1746,0x1746,0x1746,0x1746,0x1743,0x1743,0x1752,0x1752,0x1752,0x1743, +0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201, 0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201, -0x204,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x16d4, -0x16d4,0x16d4,0x16d4,0x16d4,0x16d4,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204,0x204, -0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x207,0x207, -0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, -0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, -0x16d7,0x16d7,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, -0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, -0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x207,0x207,0x1aeb,0x1aeb,0x207,0x207, -0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207, -0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207,0x207, -0x16da,0x16e9,0x16e0,0x16dd,0x16ef,0x16ef,0x16e3,0x16ef,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a, -0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x16e6,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a, -0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f5,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2,0x16f2, -0x16f2,0x16f2,0x16f2,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x16fb, -0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797, -0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x198f,0x210,0x210,0x1788,0x1788,0x1788, -0x1794,0x1794,0x1788,0x1788,0x1788,0x1788,0x1794,0x1788,0x1788,0x1788,0x1788,0x178b,0x210,0x210,0x210,0x210, -0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x1791,0x178e,0x178e,0x179a,0x179a,0x179a,0x178e, -0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213, -0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213, -0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x213,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af, -0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x17af,0x219,0x17af,0x17af,0x219,0x219, -0x219,0x219,0x219,0x17ac,0x17ac,0x17ac,0x17ac,0x17ac,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c, -0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2, -0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x21c,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2,0x17b2, -0x17b2,0x17b5,0x21c,0x21c,0x21c,0x21c,0x21c,0x21c,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614, -0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be, -0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x21f,0x21f,0x21f,0x21f,0x21f, -0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb, -0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x21f,0x21f,0x21f,0x21f,0x21f, -0x21f,0x21f,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x17b8,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929, -0x1929,0x1929,0x1929,0x1929,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a94,0x1b3c,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1b3f, -0x1b3c,0x222,0x1a0a,0x1a94,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x17df,0x1a0a,0x1a0a,0x1a94,0x1a94,0x1a94,0x1a94,0x1a94, -0x1a94,0x1a94,0x1a94,0x1b3c,0x222,0x1a97,0x1a97,0x1a97,0x1929,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x192c, -0x192c,0x192c,0x192c,0x192c,0x192c,0x192c,0x1929,0x1929,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c7, -0x17ca,0x17c7,0x17c7,0x17c4,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225, -0x225,0x225,0x225,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x1821,0x1821,0x1821,0x1821,0x1818,0x1818,0x1818,0x1812, -0x1815,0x1815,0x1815,0x1a40,0x228,0x228,0x228,0x228,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e,0x181e, -0x181e,0x181e,0x228,0x228,0x228,0x228,0x181b,0x181b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c, -0x183c,0x22b,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c, -0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x183c,0x1839,0x1827,0x1827,0x1827,0x1827, -0x1827,0x1827,0x1827,0x22b,0x1827,0x1827,0x1827,0x1827,0x1827,0x1827,0x1839,0x182a,0x183c,0x183f,0x183f,0x1833, -0x1830,0x1830,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x22b,0x1836,0x1836,0x1836,0x1836, -0x1836,0x1836,0x1836,0x1836,0x1836,0x1836,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d,0x182d, -0x182d,0x182d,0x182d,0x182d,0x182d,0x22b,0x22b,0x22b,0x184b,0x184e,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854, -0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842,0x1842, -0x1842,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, -0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x231, -0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845, -0x1845,0x231,0x231,0x1845,0x1845,0x1845,0x1845,0x1845,0x1893,0x192f,0x1a9a,0x1a9d,0x1b45,0x234,0x234,0x234, -0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1b42,0x1b42,0x234,0x234,0x234,0x234,0x234,0x234, -0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854, -0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x1854,0x237,0x237,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848, -0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x237,0x1851,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848, -0x1848,0x1851,0x1848,0x1848,0x1851,0x1848,0x1848,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237,0x237, -0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x1857,0x23a,0x23a,0x23a, -0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a, -0x186f,0x186f,0x1860,0x185a,0x185a,0x186f,0x185d,0x1872,0x1872,0x1872,0x1872,0x1875,0x1875,0x1869,0x1866,0x1863, -0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x186c,0x1aee,0x1869,0x23d,0x1863,0x1992,0x1a43, -0x1af1,0x1af1,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d, -0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d,0x23d, -0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b,0x187b, -0x187b,0x187b,0x187b,0x187b,0x240,0x240,0x240,0x240,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878, -0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878,0x1878, -0x1878,0x1878,0x1878,0x1878,0x240,0x240,0x240,0x240,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896, -0x1896,0x1896,0x1896,0x1896,0x1896,0x1a13,0x1a13,0x1a13,0x1a13,0x1a13,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0,0x1aa0, -0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935, -0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935, -0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x1935,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246, -0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x246,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288, -0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x249, -0x18d5,0x18d5,0x249,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5, -0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x249, -0x249,0x249,0x18c9,0x249,0x18c9,0x18c9,0x249,0x18c9,0x18c9,0x18c9,0x18cc,0x18c9,0x18cf,0x18cf,0x18d8,0x18c9, -0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x249,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2,0x18d2, -0x18d2,0x18d2,0x249,0x249,0x249,0x249,0x249,0x249,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, -0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, -0x1938,0x1938,0x1938,0x1938,0x24c,0x24c,0x24c,0x24c,0x1905,0x1908,0x1917,0x1917,0x1908,0x190b,0x1905,0x1902, -0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x255,0x18f0,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed, -0x18ed,0x18db,0x18db,0x18db,0x18f0,0x18f0,0x18f0,0x18f0,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49, -0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x258,0x258,0x258,0x258, -0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998, -0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x258,0x258,0x1aa9,0x1aa9,0x1aa9,0x1aa9,0x1b4b,0x28b,0x28b,0x28b, -0x1aa9,0x1aa9,0x1aa9,0x28b,0x28b,0x28b,0x28b,0x28b,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa, -0x19aa,0x19aa,0x19aa,0x19aa,0x19a7,0x19a7,0x19a7,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b, -0x19a7,0x19a1,0x199e,0x19a4,0x25b,0x25b,0x25b,0x25b,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, -0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, -0x19ad,0x19ad,0x19ad,0x25e,0x25e,0x19ad,0x19ad,0x19ad,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x261,0x19bc, -0x19bc,0x261,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc, -0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19bc,0x19b9,0x19b9,0x19b9,0x19b9,0x19b9,0x261, -0x19b0,0x19b0,0x261,0x19b9,0x19b9,0x19b0,0x19b9,0x19b3,0x19bc,0x261,0x261,0x261,0x261,0x261,0x261,0x261, -0x19c5,0x19c5,0x19c8,0x19c8,0x19bf,0x19bf,0x19bf,0x19bf,0x264,0x264,0x264,0x264,0x264,0x264,0x264,0x264, -0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x19c2,0x264,0x264,0x264,0x264,0x264,0x264, -0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19ce,0x19cb,0x19cb,0x19cb, -0x19ce,0x19cb,0x19cb,0x19cb,0x19cb,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267, -0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7,0x19d7, -0x19d7,0x19d7,0x19d7,0x19d1,0x19d1,0x19d4,0x19d4,0x19da,0x19da,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a, -0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd,0x19dd, -0x19dd,0x19dd,0x19dd,0x19dd,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d,0x26d, -0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0, -0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e0,0x19e3,0x19ec,0x19e0,0x19e0,0x270,0x270,0x270,0x270,0x270, -0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19ef,0x19f2,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273, -0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb,0x19fb, -0x19fb,0x19fb,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f5,0x19f8,0x19f8,0x19f8, -0x19f8,0x19fe,0x19fe,0x19fe,0x19fe,0x19fe,0x276,0x276,0x276,0x276,0x276,0x276,0x1a55,0x1a55,0x1a55,0x1a55, -0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55,0x1a55, -0x1a55,0x1a55,0x1a55,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x27c,0x1a64,0x1a64,0x1a64,0x1a64, -0x1a64,0x1a64,0x1a64,0x1a64,0x27f,0x27f,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64, -0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a64,0x1a61,0x1a61,0x1a61, -0x1a58,0x1a58,0x1a58,0x1a58,0x27f,0x27f,0x1a58,0x1a58,0x1a61,0x1a61,0x1a61,0x1a61,0x1a5b,0x1a64,0x1a5e,0x1a64, -0x1a61,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f, -0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x1a70,0x1a70,0x1a70,0x1a70, -0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x282,0x282,0x282,0x1a67,0x1a67,0x1a67,0x1a67, -0x1a67,0x1a67,0x1a67,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a73,0x1a73,0x282,0x282,0x285,0x1a76,0x1a76,0x1a76, -0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76, -0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x1a76,0x285,0x285, -0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288, -0x1aa3,0x1aa3,0x1aa3,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288, -0x1aa6,0x1aa6,0x1aa6,0x1aa6,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x288,0x1938,0x1938,0x1938,0x1938, -0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1aa9,0x1aa9,0x1aa9,0x1b4b, -0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1aa9,0x1aa9,0x1aa9,0x1aa9, -0x1aa9,0x1aa9,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b, -0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b,0x28b,0x28b,0x28b,0x28b, -0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x1b4b,0x28b, -0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b, -0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b, -0x1a7f,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79, -0x1a79,0x1a79,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x1a7c, -0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a82,0x1a82,0x1a82,0x1a82, -0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x1a88,0x291,0x291,0x291,0x291,0x291,0x1a85, -0x1af7,0x1af7,0x1af7,0x1af7,0x1af7,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x1af4,0x294,0x294,0x294,0x294, -0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294,0x294, -0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x297,0x1b12,0x297,0x297,0x1b12,0x1b12,0x1b12,0x1b12, -0x1b12,0x1b12,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x297,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12, -0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1b12,0x1afa,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x297,0x1b09, -0x1b0c,0x297,0x297,0x1afa,0x1afa,0x1b0f,0x1b00,0x1b15,0x1b09,0x1b15,0x1b09,0x1afd,0x1b18,0x1b03,0x1b18,0x297, -0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06, -0x1b06,0x1b06,0x297,0x297,0x297,0x297,0x297,0x297,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51, -0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x29a,0x29a, -0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a, -0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a,0x29a, -0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, -0x1b1e,0x1b1e,0x1b1e,0x2a0,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, -0x1b1e,0x1b1e,0x1b1e,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0, -0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21, -0x1b21,0x1b21,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x2a0,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54,0x1b54, -0x1b54,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3, +0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x201,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767, +0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x1767,0x207,0x1767,0x1767,0x207,0x207, +0x207,0x207,0x207,0x1764,0x1764,0x1764,0x1764,0x1764,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x20a, +0x176a,0x20a,0x176a,0x176a,0x176a,0x176a,0x20a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a, +0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x20a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a,0x176a, +0x176a,0x176d,0x20a,0x20a,0x20a,0x20a,0x20a,0x20a,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6, +0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776, +0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x20d,0x20d,0x20d,0x20d,0x20d, +0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773, +0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x20d,0x20d,0x20d,0x20d,0x20d, +0x20d,0x20d,0x1770,0x1770,0x1770,0x1770,0x1770,0x1770,0x177c,0x177c,0x177c,0x177c,0x1779,0x177c,0x177c,0x177f, +0x1782,0x177f,0x177f,0x177c,0x210,0x210,0x210,0x210,0x210,0x210,0x210,0x210,0x210,0x210,0x210,0x210, +0x210,0x210,0x210,0x1779,0x1779,0x1779,0x1779,0x1779,0x17d9,0x17d9,0x17d9,0x17d9,0x17d0,0x17d0,0x17d0,0x17ca, +0x17cd,0x17cd,0x17cd,0x19f8,0x213,0x213,0x213,0x213,0x17d6,0x17d6,0x17d6,0x17d6,0x17d6,0x17d6,0x17d6,0x17d6, +0x17d6,0x17d6,0x213,0x213,0x213,0x213,0x17d3,0x17d3,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4, +0x17f4,0x216,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4, +0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f4,0x17f1,0x17df,0x17df,0x17df,0x17df, +0x17df,0x17df,0x17df,0x216,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17f1,0x17e2,0x17f4,0x17f7,0x17f7,0x17eb, +0x17e8,0x17e8,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x216,0x17ee,0x17ee,0x17ee,0x17ee, +0x17ee,0x17ee,0x17ee,0x17ee,0x17ee,0x17ee,0x17e5,0x17e5,0x17e5,0x17e5,0x17e5,0x17e5,0x17e5,0x17e5,0x17e5,0x17e5, +0x17e5,0x17e5,0x17e5,0x17e5,0x17e5,0x216,0x216,0x216,0x1803,0x1806,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c, +0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x17fa,0x17fa,0x17fa,0x17fa,0x17fa,0x17fa,0x17fa,0x17fa, +0x17fa,0x219,0x219,0x219,0x219,0x219,0x219,0x219,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965, +0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x21c, +0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd, +0x17fd,0x21c,0x21c,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x17fd,0x21c,0x17fd,0x17fd,0x21c,0x17fd,0x17fd, +0x17fd,0x17fd,0x17fd,0x21c,0x21c,0x21c,0x21c,0x21c,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e, +0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x184b,0x18e7,0x1a52,0x1a55,0x1afd,0x21f,0x21f,0x21f, +0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x1afa,0x1afa,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f, +0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x21f,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c, +0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x180c,0x222,0x222,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800, +0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800,0x222,0x1809,0x1800,0x1800,0x1800,0x1800,0x1800,0x1800, +0x1800,0x1809,0x1800,0x1800,0x1809,0x1800,0x1800,0x222,0x222,0x222,0x222,0x222,0x222,0x222,0x222,0x222, +0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x180f,0x225,0x225,0x225, +0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225,0x225, +0x1827,0x1827,0x1818,0x1812,0x1812,0x1827,0x1815,0x182a,0x182a,0x182a,0x182a,0x182d,0x182d,0x1821,0x181e,0x181b, +0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1aa6,0x1821,0x228,0x181b,0x194a,0x19fb, +0x1aa9,0x1aa9,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228, +0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228,0x228, +0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833,0x1833, +0x1833,0x1833,0x1833,0x1833,0x22b,0x22b,0x22b,0x22b,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830, +0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830,0x1830, +0x1830,0x1830,0x1830,0x1830,0x22b,0x22b,0x22b,0x22b,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e, +0x184e,0x184e,0x184e,0x184e,0x184e,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x1a58,0x1a58,0x1a58,0x1a58,0x1a58,0x1a58, +0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x22e,0x1bcc,0x1bcc,0x1bcc,0x231,0x231,0x231,0x231,0x231, +0x231,0x231,0x231,0x231,0x231,0x231,0x231,0x231,0x273,0x273,0x1c41,0x273,0x273,0x273,0x273,0x273, +0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x234, +0x188d,0x188d,0x234,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d, +0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1881,0x1881,0x1881,0x1881,0x1881,0x1881,0x234, +0x234,0x234,0x1881,0x234,0x1881,0x1881,0x234,0x1881,0x1881,0x1881,0x1884,0x1881,0x1887,0x1887,0x1890,0x1881, +0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x234,0x188a,0x188a,0x188a,0x188a,0x188a,0x188a,0x188a,0x188a, +0x188a,0x188a,0x234,0x234,0x234,0x234,0x234,0x234,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, +0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, +0x18f0,0x18f0,0x18f0,0x18f0,0x237,0x237,0x237,0x237,0x189f,0x18a2,0x18a2,0x23a,0x23a,0x23a,0x23a,0x23a, +0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x23a,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8, +0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x1ba8,0x18b1,0x18b1,0x18b1,0x18b1,0x18b1,0x18b1,0x18b1,0x18b1, +0x18b1,0x18b1,0x18b1,0x23d,0x23d,0x23d,0x23d,0x23d,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75, +0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x18bd,0x18c0,0x18cf,0x18cf,0x18c0,0x18c3,0x18bd,0x18ba, +0x240,0x240,0x240,0x240,0x240,0x240,0x240,0x240,0x18a8,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x18a5, +0x18a5,0x1893,0x1893,0x1893,0x18a8,0x18a8,0x18a8,0x18a8,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01, +0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x243,0x243,0x243,0x243, +0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x243,0x1950,0x1950,0x1950,0x1950,0x1950,0x1950,0x1950,0x1950, +0x1950,0x1950,0x1950,0x1950,0x1950,0x1950,0x243,0x243,0x1a61,0x1a61,0x1a61,0x1a61,0x1b03,0x1c47,0x1c47,0x1c47, +0x1a61,0x1a61,0x1a61,0x1bcf,0x1bcf,0x276,0x276,0x276,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962, +0x1962,0x1962,0x1962,0x1962,0x195f,0x195f,0x195f,0x1953,0x1953,0x1953,0x1953,0x1953,0x1953,0x1953,0x1953,0x1953, +0x195f,0x1959,0x1956,0x195c,0x246,0x246,0x246,0x246,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965, +0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965,0x1965, +0x1965,0x1965,0x1965,0x249,0x249,0x1965,0x1965,0x1965,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x24c,0x1974, +0x1974,0x24c,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974, +0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1974,0x1971,0x1971,0x1971,0x1971,0x1971,0x24c, +0x1968,0x1968,0x24c,0x1971,0x1971,0x1968,0x1971,0x196b,0x1974,0x24c,0x24c,0x24c,0x24c,0x24c,0x24c,0x24c, +0x197d,0x197d,0x1980,0x1980,0x1977,0x1977,0x1977,0x1977,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f, +0x197a,0x197a,0x197a,0x197a,0x197a,0x197a,0x197a,0x197a,0x197a,0x197a,0x24f,0x24f,0x24f,0x24f,0x24f,0x24f, +0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1986,0x1983,0x1983,0x1983, +0x1986,0x1983,0x1983,0x1983,0x1983,0x252,0x252,0x252,0x252,0x252,0x252,0x252,0x252,0x252,0x252,0x252, +0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992,0x1992, +0x1992,0x1992,0x198f,0x1989,0x1989,0x198c,0x198c,0x1995,0x1995,0x255,0x255,0x255,0x255,0x255,0x255,0x255, +0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998,0x1998, +0x1998,0x1998,0x1998,0x1998,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258,0x258, +0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b, +0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199b,0x199e,0x19a7,0x199b,0x199b,0x25b,0x25b,0x25b,0x25b,0x25b, +0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19ad,0x25e,0x25e,0x25e,0x25e,0x25e,0x25e,0x25e,0x25e, +0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6,0x19b6, +0x19b6,0x19b6,0x19b0,0x19b0,0x19b0,0x19b0,0x19b0,0x19b0,0x19b0,0x19b0,0x19b0,0x19b0,0x19b0,0x19b3,0x19b3,0x19b3, +0x19b3,0x19b9,0x19b9,0x19b9,0x19b9,0x19b9,0x261,0x261,0x261,0x261,0x261,0x261,0x261,0x261,0x261,0x261, +0x261,0x261,0x261,0x261,0x261,0x261,0x261,0x261,0x1b96,0x1b96,0x1b96,0x1b96,0x1b96,0x1b96,0x1b96,0x1b96, +0x1b96,0x1b96,0x1b96,0x1b96,0x1b96,0x1b96,0x1b96,0x1b96,0x1bf9,0x1bff,0x1bff,0x1bff,0x1bff,0x1bff,0x1bff,0x1bfc, +0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x1bfc,0x264,0x264, +0x264,0x264,0x264,0x264,0x264,0x264,0x264,0x264,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d, +0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x267, +0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x267,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c, +0x26a,0x26a,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c, +0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a1c,0x1a19,0x1a19,0x1a19,0x1a10,0x1a10,0x1a10,0x1a10, +0x26a,0x26a,0x1a10,0x1a10,0x1a19,0x1a19,0x1a19,0x1a19,0x1a13,0x1a1c,0x1a16,0x1a1c,0x1a19,0x26a,0x26a,0x26a, +0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a, +0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x26a,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28, +0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x26d,0x26d,0x26d,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a1f,0x1a28, +0x1a28,0x1a28,0x1a28,0x1a28,0x1a2b,0x1a2b,0x26d,0x26d,0x270,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e, +0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e, +0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x1a2e,0x270,0x270,0x273,0x273,0x273,0x273, +0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x1a5b,0x1a5b,0x1a5b,0x273, +0x273,0x1c44,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x1a5e,0x1a5e,0x1a5e,0x1a5e, +0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x273,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, +0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x1a61,0x1a61,0x1a61,0x1b03,0x1b03,0x1b03,0x1b03,0x1c47, +0x1c47,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x1a61,0x1a61,0x1a61,0x1a61,0x1a61,0x1a61,0x1b03,0x1b03, +0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1bcf,0x1bcf,0x1bcf,0x1bcf,0x1c47,0x1c47,0x1c47, +0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1bcf,0x1bcf,0x1bcf,0x1bcf,0x1c47,0x1c47,0x1c47,0x276,0x1c47, +0x1b03,0x1b03,0x1b03,0x1bd2,0x1bd2,0x1bd2,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x276,0x1c47,0x1c47, +0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1b03,0x1bcf,0x1bcf,0x1bcf,0x1c47,0x1c47,0x276,0x276,0x276,0x276, +0x1bcf,0x1bcf,0x1bcf,0x1bcf,0x1bcf,0x1bcf,0x1bcf,0x1bcf,0x1c47,0x276,0x276,0x276,0x276,0x276,0x276,0x276, +0x1bd2,0x1bd2,0x1bd2,0x1bd2,0x1bd2,0x1bd2,0x1bd2,0x1c4a,0x1c4a,0x276,0x276,0x276,0x276,0x276,0x276,0x276, +0x1a37,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31, +0x1a31,0x1a31,0x279,0x279,0x279,0x279,0x279,0x279,0x279,0x279,0x279,0x279,0x279,0x279,0x279,0x1a34, +0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a3a,0x1a3a,0x1a3a,0x1a3a, +0x1a40,0x1a40,0x1a40,0x1a40,0x1a40,0x1a40,0x1a40,0x1a40,0x1a40,0x1a40,0x27c,0x27c,0x27c,0x27c,0x27c,0x1a3d, +0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aac,0x1aac,0x1aac,0x1aac,0x1aac,0x1aac,0x1aac,0x27f,0x27f,0x27f,0x27f, +0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f,0x27f, +0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x282,0x282,0x1aca,0x282,0x282,0x1aca,0x1aca,0x1aca,0x1aca, +0x1aca,0x1aca,0x1aca,0x1aca,0x282,0x1aca,0x1aca,0x282,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca, +0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1aca,0x1ab2,0x1ac1,0x1ac1,0x1ac1,0x1ac1,0x1ac1,0x282,0x1ac1, +0x1ac4,0x282,0x282,0x1ab2,0x1ab2,0x1ac7,0x1ab8,0x1acd,0x1ac1,0x1acd,0x1ac1,0x1ab5,0x1ad0,0x1abb,0x1ad0,0x282, +0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x1abe,0x1abe,0x1abe,0x1abe,0x1abe,0x1abe,0x1abe,0x1abe, +0x1abe,0x1abe,0x282,0x282,0x282,0x282,0x282,0x282,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09, +0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x285,0x285, +0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285, +0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285,0x285, +0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6, +0x1ad6,0x1ad6,0x1ad6,0x28b,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6, +0x1ad6,0x1ad6,0x1ad6,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b, +0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1ad9,0x1ad9,0x1ad9,0x1ad9,0x1ad9,0x1ad9,0x1ad9,0x1ad9, +0x1ad9,0x1ad9,0x28b,0x28b,0x28b,0x28b,0x28b,0x28b,0x1b0c,0x1b0c,0x1b0c,0x1b0c,0x1b0c,0x1b0c,0x1b0c,0x1b0c, +0x1b0c,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e, +0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e,0x28e, +0x28e,0x28e,0x28e,0x28e,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x291,0x1adc, +0x1adc,0x1adf,0x291,0x291,0x1ae2,0x1ae2,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291, +0x291,0x291,0x291,0x291,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b75,0x1b72,0x1b75,0x1b75,0x1b75, +0x1b75,0x1b75,0x1b75,0x294,0x1b78,0x1b78,0x294,0x294,0x294,0x294,0x294,0x294,0x1b6f,0x1b6f,0x1b6f,0x1b6f, +0x1b6f,0x1b6f,0x1b6f,0x1b6f,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e, +0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7b,0x1b7b,0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x297,0x297, +0x297,0x297,0x297,0x297,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x29a,0x1b81,0x1b81,0x1b81,0x1b81, +0x29a,0x1b81,0x1b81,0x29a,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81,0x1b81, +0x1b81,0x1b81,0x1b81,0x29a,0x1b84,0x1b8a,0x1b8a,0x1b87,0x1b87,0x1b87,0x2a0,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87, +0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87, +0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x2a0,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x1b87,0x2a0, +0x2a0,0x2a0,0x2a0,0x2a0,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b90,0x1b8d, +0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d,0x1b8d, +0x1b8d,0x1b8d,0x1b8d,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x1c02,0x1c02,0x1c02,0x1c02,0x1c02,0x1c02,0x2a3, 0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3, -0x2a3,0x2a3,0x2a3,0x2a3,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x2a6,0x1b24, -0x1b24,0x1b27,0x2a6,0x2a6,0x1b2a,0x1b2a,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6, -0x2a6,0x2a6,0x2a6,0x2a6,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, -0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, -0x2a9,0x2a9,0x2a9,0x2a9,0x1932,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1, -0x2c1,0x2c1,0x2c1,0x2c1,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, -0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, -0x2a9,0x2a9,0x97b,0x97b,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x2c4, -0x2c4,0x2c4,0x2c4,0x2c4,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, -0x2a9,0x2a9,0x2a9,0x2a9,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x1a04, -0x1a04,0x1a04,0x1a04,0x1a04,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33,0x1b33, -0x1b33,0x2ac,0x2ac,0x2ac,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x12e4, -0x12e4,0x12e4,0x2af,0x2af,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0, -0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0x2af,0x2af, -0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af, -0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af,0x2af, -0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9, -0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x1b36,0x2b2,0x2b2, -0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac, -0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0x2b5,0x2b5, -0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9, -0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8, -0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416, -0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x2bb,0x2bb, -0x17dc,0x17dc,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be, -0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932, -0x3cc,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3c0,0x3cc,0x3cc,0x3cc,0x3cc,0x3c6,0x1158,0x133e, -0x3cf,0x945,0x948,0x3bd,0x3bd,0x1155,0x133b,0x133b,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2,0x3d2, -0x1155,0x3c0,0x3c0,0x3cc,0xce1,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf, -0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf, -0x3cf,0x3cf,0x3c0,0x3c0,0x8d0,0x8d3,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963,0x963, -0x3c9,0xfba,0xfb7,0x1341,0x1341,0x1341,0x1341,0x1341,0x1506,0x115b,0x115b,0xf0c,0xf0c,0xdda,0xf0c,0xf0c, -0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf, -0x3cf,0x3d2,0x3cf,0x3cf,0x3d2,0x3cf,0x3cf,0x3cf,0x3cf,0x3cf,0x133b,0x133e,0x3c3,0x3cf,0x3cc,0x3cc, -0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e, -0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x46e,0x1347,0x18ae,0x18ae,0xfd8,0x45f,0x468, -0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa, -0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0x4aa,0xbc7,0xbc7,0xde6,0xde6,0x8d6,0xde9,0x1428,0x1428,0x1428, -0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad, -0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad,0x4ad, -0x4b3,0x4b3,0x4b3,0x1170,0x1170,0x1170,0x1170,0x1170,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0, -0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0, -0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x4b0,0x116d,0x116d,0x116d,0x116d,0x116d,0x116d, -0x4b6,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3, -0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3,0x4b3, -0x4b3,0x4b3,0x4b3,0x4b3,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9, -0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9, -0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4b9,0x4b9,0x4b9,0x4b9,0x4bc,0x9bd,0x1005,0x1005,0x1008,0x1005, -0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9, -0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x4bf,0x4b9,0x1008,0x1005,0x1008,0x1005,0x1008,0x1005, -0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce, -0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce, -0x6ae,0x6ae,0x6b1,0x4e9,0x6bd,0x6ba,0x6ba,0x6b7,0x513,0x513,0x4d1,0x4d1,0x4d1,0x4d1,0x4d1,0xb58, -0x6c0,0x4f5,0x6d8,0x6db,0x50a,0x6c0,0x4f8,0x4f8,0x4e9,0x504,0x504,0x6ae,0x510,0x50d,0x6b4,0x4e3, -0x4da,0x4da,0x4dd,0x4dd,0x4dd,0x4dd,0x4dd,0x4e0,0x4dd,0x4dd,0x4dd,0x4d4,0x51c,0x519,0x516,0x516, -0x6cc,0x4fe,0x4fb,0x6c9,0x6c6,0x6c3,0x6d5,0x4ec,0x6d2,0x6d2,0x501,0x504,0x6cf,0x6cf,0x501,0x504, -0x4e6,0x4e9,0x4e9,0x4e9,0x507,0x4f2,0x4ef,0xbdc,0xaf2,0xaf5,0xaef,0xaef,0xaef,0xaef,0xbd3,0xbd3, -0xbd3,0xbd3,0xbd9,0xd0e,0xd0b,0xdf5,0xdf8,0xbd6,0xdf8,0xdf8,0xdf8,0xdf8,0xdf5,0xdf8,0xdf8,0xbd0, -0x540,0x540,0x540,0x540,0x540,0x540,0x540,0x53d,0x543,0x75c,0x540,0x9c0,0x9e1,0xaf8,0xaf8,0xaf8, -0xbe2,0xbe2,0xdfe,0xdfe,0xdfe,0xdfe,0x1179,0x117c,0x117c,0x135c,0x14f4,0x151e,0x1521,0x1521,0x1734,0x18b1, -0x54f,0x54f,0x567,0x6ea,0x54c,0x6e7,0x54f,0x564,0x54c,0x6ea,0x55e,0x567,0x567,0x567,0x55e,0x55e, -0x567,0x567,0x567,0x6f3,0x54c,0x567,0x6ed,0x54c,0x55b,0x567,0x567,0x567,0x567,0x567,0x54c,0x54c, -0x552,0x6e7,0x6f0,0x54c,0x567,0x54c,0x6f6,0x54c,0x567,0x555,0x56d,0x6f9,0x567,0x567,0x558,0x55e, -0x567,0x567,0x56a,0x567,0x55e,0x561,0x561,0x561,0x561,0xb04,0xb01,0xd11,0xe07,0xbf7,0xbfa,0xbfa, -0xbf4,0xbf1,0xbf1,0xbf1,0xbf1,0xbfa,0xbf7,0xbf7,0xbf7,0xbf7,0xbee,0xbf1,0xe04,0xf18,0xf1b,0x100e, -0x117f,0x117f,0x117f,0x6ff,0x6fc,0x570,0x573,0x573,0x573,0x573,0x573,0x6fc,0x6ff,0x6ff,0x6fc,0x573, -0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x705,0x57c,0x57c,0x57c,0x57c, -0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x702,0x576,0x576,0x576,0x576,0x576,0x576, -0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x588,0x588,0x582,0x582,0x582,0x585,0x57f, -0x582,0x582,0x57f,0x57f,0x57f,0x57f,0x582,0x582,0x708,0x708,0x57f,0x57f,0x582,0x582,0x582,0x582, -0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x585,0x585,0x585,0x582,0x582,0x70b,0x582, -0x70b,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x57f,0x582,0x57f,0x57f,0x57f,0x57f,0x57f,0x57f, -0x582,0x582,0x57f,0x708,0x57f,0x57f,0x57f,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a,0xb0a, -0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0xbfd,0x711,0x58b,0x711,0x711, -0x58e,0x58b,0x58b,0x711,0x711,0x58e,0x58b,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x711,0x59a,0x597, -0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x711,0x711,0x711,0x711,0x58b,0x58b,0x711, -0x58e,0x711,0x58e,0x711,0x711,0x711,0x711,0x711,0x717,0x591,0x711,0x591,0x591,0x58b,0x58b,0x58b, -0x711,0x711,0x711,0x711,0x58b,0x58b,0x58b,0x58b,0x711,0x711,0x58b,0x58b,0x58b,0x58e,0x58b,0x58b, -0x58e,0x58b,0x58b,0x58e,0x711,0x58e,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b, -0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x714,0x711,0x58e,0x58b, -0x711,0x711,0x711,0x711,0x58b,0x58b,0x711,0x711,0x58b,0x58e,0x714,0x714,0x58e,0x58e,0x58b,0x58b, -0x58e,0x58e,0x58b,0x58b,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x711,0x711, -0x58e,0x58e,0x711,0x711,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, -0x58b,0x711,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b, -0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, -0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x711,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, -0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b, -0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x58b,0x58b,0x58b, -0x58b,0x58b,0x58e,0x58e,0x58e,0x58e,0x58b,0x594,0x58b,0x58b,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00, -0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0xc00,0x59d,0xb0d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, -0x5a9,0x5a6,0x5a9,0x5a6,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x71a,0x59d,0x59d,0x59d,0x59d,0x59d, -0x59d,0x59d,0x81f,0x81f,0x59d,0x59d,0x59d,0x59d,0x5a3,0x5a3,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, -0x5a0,0x825,0x822,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, -0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d, -0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0xb0d,0xc06,0xb0d,0xb0d,0xb0d,0x5ac,0x5ac,0x5ac,0x5ac, -0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac, -0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x5ac,0x723,0x723,0x723,0x723, -0x723,0x723,0x723,0x723,0x723,0x723,0x5b2,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f, -0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xd89,0x72c,0x72c,0x72c,0x72c, -0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c, -0x5b5,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c, -0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x5b8,0x5b8,0x5b8,0x5b8,0x72c,0x72c,0x72c,0x72c, -0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72f,0x72f,0x72f,0x72f, -0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x72f,0x5bb,0x5bb,0x72f,0x72f, -0x72f,0x72f,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0xc09,0x735,0x735,0x5be,0x732, -0x732,0x732,0x732,0x732,0x732,0x732,0x5c1,0x5c1,0x5be,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x735,0x735, -0x5c4,0x5c4,0x738,0x735,0x5be,0x5be,0x5be,0x5be,0x735,0x735,0x5c4,0x5c4,0x738,0x735,0x5be,0x5be, -0x5be,0x5be,0x735,0x735,0x732,0x5be,0x5c4,0x735,0x5be,0x5be,0x732,0x735,0x735,0x735,0x5c4,0x5c4, -0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x5be,0x735,0x732, -0x735,0x732,0x5be,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5c4,0x5be,0x5be,0x732,0xb16,0xb16,0xb16,0xb16, -0xb16,0xb16,0xb16,0xb16,0xc0c,0xc0c,0xc0c,0xc0f,0xc0f,0xc8a,0xc8a,0xc0c,0x5d3,0x5d3,0x5d3,0x5d3, -0x5d0,0x74a,0x747,0x5ca,0x5ca,0x73b,0x5ca,0x5ca,0x5ca,0x5ca,0x741,0x73b,0x5ca,0x5d0,0x5ca,0x5c7, -0xd92,0xd92,0xc15,0xc15,0xe13,0xb19,0x5cd,0x5cd,0x73e,0x5d6,0x73e,0x5cd,0x5d0,0x5ca,0x5d0,0x5d0, -0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5ca,0x5ca,0x5ca,0x5d0,0x5d0,0x5ca,0x5ca,0x5ca,0x5ca, -0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x5d3,0x5d3,0x5cd,0x5ca,0x5ca,0x5ca,0x5ca,0x74d,0x5ca,0x74d,0x5ca, -0x5ca,0x5ca,0x5ca,0x5ca,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828, -0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5ca,0x5d0,0x74d,0x74a,0x5d9,0x74d, -0x73b,0x741,0x5d0,0x73b,0x744,0x73b,0x73b,0x5ca,0x73b,0x74a,0x5d9,0x74a,0xb19,0xb19,0xc18,0xc18, -0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc1b,0xc18,0xc18,0xe10,0xec7,0x5dc,0x5dc,0x5dc,0x5dc, -0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc,0x5dc, -0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x152a,0x5eb,0x5f4,0x5eb, -0x5eb,0x13e6,0x5df,0x5df,0x5f4,0x5f4,0x13e9,0x13e9,0x5f7,0x5f7,0x5e8,0x5ee,0x5e8,0x5e8,0x5ee,0x5df, -0x5ee,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df, -0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5ee,0x5df,0x5df,0x5df, -0x5df,0x5df,0x5df,0x5df,0x5df,0x753,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5ee,0x5df,0x5df,0x5ee, -0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x13e6,0x13e6,0x13e6,0x5df,0x12de, -0x5df,0x5df,0x5df,0x5e5,0x5e5,0x5e5,0x5e5,0x1368,0x1368,0x5df,0x5e2,0x5f1,0x5f4,0x5e8,0x5e8,0x5e8, -0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0xc21,0xc1e,0x750,0x750, -0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x5df,0x5ee,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df, -0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df, -0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x5df,0x13e6,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, -0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x621,0x621,0x621, -0x621,0x621,0x621,0x621,0x618,0x61e,0x60f,0x612,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, -0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, -0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x615,0x615,0x615,0x615,0x615,0x615,0x618,0x618,0x618,0x618, -0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, -0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, -0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, -0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618, -0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61b,0x621,0x61e,0x618, -0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61e,0x618, -0x61b,0x621,0x61e,0x618,0x61e,0x618,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b,0x136b, -0x136b,0x136b,0x136b,0x136b,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x621,0x61b,0x621,0x61e,0x618, -0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61e,0x618,0x61b,0x61e,0x618,0x61b, -0x61e,0x618,0x61b,0x621,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, -0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b, -0x61b,0x61b,0x61b,0x61b,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, -0x61e,0x61e,0x61e,0x61e,0x61e,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, -0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x61b,0x618,0x61b,0x618,0x618,0x61b,0x618,0x618,0x61b, -0x618,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x61b,0x618,0x618,0x618,0x61b,0x618,0x618,0x618,0x618, -0x618,0x61b,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, -0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x61b,0x61b,0x618,0x618,0x61b,0x618,0x61b,0x618, -0x618,0x618,0x618,0x618,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b, -0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b, -0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x61b,0x621,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, -0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e, -0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621, -0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x621,0x61e,0x61e,0x61e, -0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x61e,0x624,0x624,0x624,0x624,0x101a,0x101a,0x101a,0x152d, -0x152d,0x152d,0x152d,0x152d,0x152d,0x152d,0x173a,0x173a,0x885,0x88b,0x88b,0x897,0x897,0x888,0x87f,0x888, -0x87f,0x888,0x87f,0x888,0x87f,0x888,0x87f,0x888,0x633,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633, -0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x630, -0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x633,0x62d,0x633,0x62d,0x633, -0x62d,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630, -0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630,0x636,0x633,0x62d,0x630, -0x636,0x633,0x62d,0x630,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720, -0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d, +0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3,0x2a3, +0x1b96,0x1b96,0x1b93,0x1b93,0x1b93,0x1b93,0x1b99,0x1b99,0x1b99,0x1b99,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6, +0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6, +0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf,0x1aaf, +0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f, +0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x2a9, +0x1b9c,0x1b9c,0x1b9c,0x1b9c,0x1b9c,0x1b9c,0x1b9c,0x1b9c,0x1b9c,0x1b9c,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9,0x2a9, +0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d,0x155d, +0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba5,0x1ba2,0x2ac, +0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac,0x2ac, +0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x1bae,0x2af,0x1bae,0x1bae,0x1bae,0x1bae, +0x1bae,0x1bae,0x1bae,0x2af,0x1bae,0x1bae,0x2af,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab, +0x1bab,0x1bab,0x2af,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab, +0x1bab,0x1bab,0x2af,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x1bab,0x2af,0x1bab,0x1bab,0x2af,0x2af,0x2af, +0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x2b2,0x2b2, +0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4, +0x1bb4,0x1bb4,0x1bb4,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x2b2,0x1bb1,0x1bb1,0x1bb1,0x1bb1, +0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x2b5,0x2b5,0x2b5,0x2b5, +0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5, +0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x2b5,0x1c05,0x1c05,0x1c05, +0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0e,0x1c0e,0x1c0e,0x2b8,0x2b8, +0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8,0x2b8, +0x1c11,0x1c11,0x1c11,0x1c11,0x1c11,0x1c11,0x1c11,0x1c11,0x1c11,0x1c11,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb, +0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb, +0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x2bb,0x1c14,0x1c14,0x1c14,0x1c14, +0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14,0x1c14, +0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x2be,0x1c17,0x1c17,0x1c2c,0x1c23, +0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x2c1,0x1c29,0x1c29, +0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29,0x1c29, +0x1c29,0x1c29,0x1c29,0x1c29,0x1c23,0x1c23,0x1c17,0x1c17,0x1c17,0x1c17,0x1c17,0x2c1,0x2c1,0x2c1,0x1c23,0x1c23, +0x1c17,0x1c26,0x1c1a,0x1c2f,0x1c2f,0x1c1d,0x1c1d,0x1c1d,0x1c1d,0x1c1d,0x1c1d,0x1c1d,0x1c1d,0x1c1d,0x1c1d,0x1c1d, +0x1c20,0x1c20,0x1c20,0x1c20,0x1c20,0x1c20,0x1c20,0x1c20,0x1c20,0x1c20,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1,0x2c1, +0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c38,0x1c32,0x1c32,0x1c32,0x1c32, +0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x1c35,0x2c4,0x2c4,0x2c4,0x2c4,0x2c4,0x2c4, +0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7, +0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7, +0x2c7,0x2c7,0x95d,0x95d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d, +0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7,0x2c7, +0x2c7,0x2c7,0x2c7,0x2c7,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0x12a5, +0x12a5,0x12a5,0x2ca,0x2ca,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97, +0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0x2ca,0x2ca, +0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca, +0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca,0x2ca, +0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b, +0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0x2cd,0x2cd, +0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7, +0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x1bbd,0x1bbd,0x1bbd,0x1bbd,0x1c3b,0x2d0,0x2d0,0x2d0,0x2d0,0x2d0,0x2d0, +0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1, +0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x2d3,0x2d3, +0x1794,0x1794,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6,0x2d6, +0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea, +0x18ea,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9,0x2d9, +0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59, +0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x2dc,0x2dc,0x2dc,0x2dc,0x2dc, +0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d, +0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59, +0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x2df,0x2df, +0x3e7,0x3db,0x3db,0x3db,0x3db,0x3db,0x3db,0x3db,0x3db,0x3e7,0x3e7,0x3e7,0x3e7,0x3e1,0x1125,0x12fc, +0x3ea,0x927,0x92a,0x3d8,0x3d8,0x1122,0x12f9,0x12f9,0x3ed,0x3ed,0x3ed,0x3ed,0x3ed,0x3ed,0x3ed,0x3ed, +0x1122,0x3db,0x3db,0x3e7,0xcb1,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea, +0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea, +0x3ea,0x3ea,0x3db,0x3db,0x8af,0x8b2,0x945,0x945,0x945,0x945,0x945,0x945,0x945,0x945,0x945,0x945, +0x3e4,0xf81,0xf7e,0x12ff,0x12ff,0x12ff,0x12ff,0x12ff,0x14c1,0x1128,0x1128,0xed3,0xed3,0xda4,0xed3,0xed3, +0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ed,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea, +0x3ea,0x3ed,0x3ea,0x3ea,0x3ed,0x3ea,0x3ea,0x3ea,0x3ea,0x3ea,0x12f9,0x12fc,0x3de,0x3ea,0x3e7,0x3e7, +0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x1305,0x489,0x489,0x489,0x489,0x489,0x489, +0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x1305,0x1866,0x1866,0xf9f,0x47a,0x483, +0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5, +0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0x4c5,0xba6,0xba6,0xdb3,0xdb3,0x8b5,0xdb0,0x13e3,0x13e3,0x13e3, +0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8, +0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8,0x4c8, +0x4ce,0x4ce,0x4ce,0x113d,0x113d,0x113d,0x113d,0x113d,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb, +0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x4cb,0x113a,0x113a,0x113a,0x113a,0x113a,0x113a, +0x4d1,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce, +0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce,0x4ce, +0x4ce,0x4ce,0x4ce,0x4ce,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4, +0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4, +0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4d4,0x4d4,0x4d4,0x4d4,0x4d7,0x9a2,0xfcc,0xfcc,0xfcf,0xfcc, +0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4, +0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0x4da,0x4d4,0xfcf,0xfcc,0xfcf,0xfcc,0xfcf,0xfcc, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9, +0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e6,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9,0x4e9, +0x6a5,0x6a5,0x6a8,0x504,0x6b4,0x6b1,0x6b1,0x6ae,0x52e,0x52e,0x4ec,0x4ec,0x4ec,0x4ec,0x4ec,0xb37, +0x6b7,0x510,0x6cf,0x6d2,0x525,0x6b7,0x513,0x513,0x504,0x51f,0x51f,0x6a5,0x52b,0x528,0x6ab,0x4fe, +0x4f5,0x4f5,0x4f8,0x4f8,0x4f8,0x4f8,0x4f8,0x4fb,0x4f8,0x4f8,0x4f8,0x4ef,0x537,0x534,0x531,0x531, +0x6c3,0x519,0x516,0x6c0,0x6bd,0x6ba,0x6cc,0x507,0x6c9,0x6c9,0x51c,0x51f,0x6c6,0x6c6,0x51c,0x51f, +0x501,0x504,0x504,0x504,0x522,0x50d,0x50a,0xbbb,0xada,0xada,0xad7,0xad7,0xad7,0xad7,0xbb2,0xbb2, +0xbb2,0xbb2,0xbb8,0xcde,0xcdb,0xdbf,0xdc2,0xbb5,0xdc2,0xdc2,0xdc2,0xdc2,0xdbf,0xdc2,0xdc2,0xbaf, +0x55b,0x55b,0x55b,0x55b,0x55b,0x55b,0x55b,0x558,0x55e,0x73e,0x55b,0x9a5,0x9c6,0xadd,0xadd,0xadd, +0xbc1,0xbc1,0xdc8,0xdc8,0xdc8,0xdc8,0x1146,0x1149,0x1149,0x131a,0x14af,0x14d9,0x14dc,0x14dc,0x16e9,0x1869, +0x56a,0x56a,0x582,0x6e4,0x567,0x6de,0x56a,0x57f,0x567,0x6e4,0x579,0x582,0x582,0x582,0x579,0x579, +0x582,0x582,0x582,0x6ea,0x567,0x582,0x6e7,0x567,0x576,0x582,0x582,0x582,0x582,0x582,0x567,0x567, +0x56d,0x6de,0x6e1,0x567,0x582,0x567,0x6ed,0x567,0x582,0x570,0x588,0x6f0,0x582,0x582,0x573,0x579, +0x582,0x582,0x585,0x582,0x579,0x57c,0x57c,0x57c,0x57c,0xae6,0xae3,0xce1,0xdd1,0xbd6,0xbd9,0xbd9, +0xbd3,0xbd0,0xbd0,0xbd0,0xbd0,0xbd9,0xbd6,0xbd6,0xbd6,0xbd6,0xbcd,0xbd0,0xdce,0xedf,0xee2,0xfd5, +0x114c,0x114c,0x114c,0x6f6,0x6f3,0x58b,0x58e,0x58e,0x58e,0x58e,0x58e,0x6f3,0x6f6,0x6f6,0x6f3,0x58e, +0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x6fc,0x597,0x597,0x597,0x597, +0x6f9,0x6f9,0x6f9,0x6f9,0x6f9,0x6f9,0x6f9,0x6f9,0x6f9,0x6f9,0x591,0x591,0x591,0x591,0x591,0x591, +0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59a,0x59d,0x59d,0x59d,0x59d,0x59d,0x5a0,0x59a, +0x59d,0x59d,0x59a,0x59a,0x59a,0x59a,0x59d,0x59d,0x6ff,0x6ff,0x59a,0x59a,0x59d,0x59d,0x59d,0x59d, +0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x5a0,0x5a0,0x5a0,0x59d,0x59d,0x702,0x59d, +0x702,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59d,0x59a,0x59d,0x59a,0x59a,0x59a,0x59a,0x59a,0x59a, +0x59d,0x59d,0x59a,0x6ff,0x59a,0x59a,0x59a,0xaec,0xaec,0xaec,0xaec,0xaec,0xaec,0xaec,0xaec,0xaec, +0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0xbdc,0x705,0x5a3,0x705,0x705, +0x5a6,0x5a3,0x5a3,0x705,0x705,0x5a6,0x5a3,0x705,0x5a6,0x5a3,0x5a3,0x705,0x5a3,0x705,0x5b2,0x5af, +0x5a3,0x705,0x5a3,0x5a3,0x5a3,0x5a3,0x705,0x5a3,0x5a3,0x705,0x705,0x705,0x705,0x5a3,0x5a3,0x705, +0x5a6,0x705,0x5a6,0x705,0x705,0x705,0x705,0x705,0x70b,0x5a9,0x705,0x5a9,0x5a9,0x5a3,0x5a3,0x5a3, +0x705,0x705,0x705,0x705,0x5a3,0x5a3,0x5a3,0x5a3,0x705,0x705,0x5a3,0x5a3,0x5a3,0x5a6,0x5a3,0x5a3, +0x5a6,0x5a3,0x5a3,0x5a6,0x705,0x5a6,0x5a3,0x5a3,0x705,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x705,0x5a3, +0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x708,0x705,0x5a6,0x5a3, +0x705,0x705,0x705,0x705,0x5a3,0x5a3,0x705,0x705,0x5a3,0x5a6,0x708,0x708,0x5a6,0x5a6,0x5a3,0x5a3, +0x5a6,0x5a6,0x5a3,0x5a3,0x5a6,0x5a6,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a6,0x5a6,0x705,0x705, +0x5a6,0x5a6,0x705,0x705,0x5a6,0x5a6,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3, +0x5a3,0x705,0x5a3,0x5a3,0x5a3,0x705,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x705,0x5a3,0x5a3, +0x5a3,0x5a3,0x5a3,0x5a3,0x5a6,0x5a6,0x5a6,0x5a6,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3, +0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x705,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3, +0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3, +0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a3,0x5a6,0x5a6,0x5a6,0x5a6,0x5a3,0x5a3,0x5a3,0x5a3, +0x5a3,0x5a3,0x5a6,0x5a6,0x5a6,0x5a6,0x5a3,0x5ac,0x5a3,0x5a3,0xbdf,0xbdf,0xbdf,0xbdf,0xbdf,0xbdf, +0xbdf,0xbdf,0xbdf,0xbdf,0xbdf,0xbdf,0xbdf,0xbdf,0x5b5,0xaef,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5, +0x5be,0x5bb,0x5be,0x5bb,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x70e,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5, +0x5b5,0x5b5,0x7fe,0x7fe,0x5b5,0x5b5,0x5b5,0x5b5,0x5b8,0x5b8,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5, +0x5b5,0x804,0x801,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5, +0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5, +0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0x5b5,0xaef,0xbe5,0xaef,0xaef,0xaef,0x5c1,0x5c1,0x5c1,0x5c1, +0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1, +0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x5c1,0x717,0x717,0x717,0x717, +0x717,0x717,0x717,0x717,0x717,0x717,0x5c7,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42, +0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xc42,0xd50,0x71d,0x71d,0x71d,0x71d, 0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d, -0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x726,0x726,0x726,0x726,0x726,0x726, -0x726,0x726,0x726,0x726,0x726,0x726,0x729,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726, -0x726,0x726,0x726,0x726,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723, -0x723,0x723,0x723,0x723,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c, -0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c,0x72c, -0x72c,0x72c,0x72c,0x72c,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756, -0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756, -0x756,0x756,0x756,0x756,0xc78,0x8e8,0x8e2,0x8df,0x8e5,0x8dc,0x76b,0x76e,0x76e,0x76e,0x76e,0x76e, -0x76e,0x76e,0x76e,0x76e,0x8ee,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b, -0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x76b, -0x76b,0x76b,0x76b,0x76b,0x76b,0x76b,0x8eb,0x8eb,0x771,0x8fd,0x900,0x906,0x82b,0x837,0x91b,0x834, -0x8f4,0x8f1,0x8f4,0x8f1,0x8fa,0x8f7,0x8fa,0x8f7,0x8f4,0x8f1,0x831,0x906,0x8f4,0x8f1,0x8f4,0x8f1, -0x8f4,0x8f1,0x8f4,0x8f1,0x909,0x912,0x90f,0x90f,0x777,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7ad, -0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad,0x7ad, -0x7ad,0x7ad,0x7ad,0x77a,0x795,0x774,0x79b,0x79e,0x798,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7b0,0x7aa, -0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa,0x7aa, -0x7aa,0x7aa,0x7aa,0x77a,0x795,0x774,0x795,0xc7b,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819, -0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819, -0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x12d8,0x12d8,0x12d8,0x12d8,0x12d8,0x81c, -0x831,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x834,0x951,0x951,0x951,0x951,0x83a,0x83a, -0x90c,0x918,0x918,0x918,0x918,0x915,0x82e,0x903,0xb3d,0xb3d,0xb3d,0xc8d,0xcab,0xca8,0xb5b,0x8d9, -0x840,0x83d,0x840,0x843,0x83d,0x840,0x83d,0x840,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d, -0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x840,0x840,0x83d,0x83d, -0xcae,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84f,0x84c,0x84f,0x84c, -0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c, -0x84f,0x84c,0x84f,0x852,0x84c,0x84f,0x84c,0x84f,0x84c,0x84f,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c, -0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84f,0x84f,0x84c,0x84c, -0x84c,0x84c,0x84c,0x852,0x84c,0x852,0x84c,0x852,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x852,0x84c, -0x84c,0x84c,0x84c,0x84c,0x84f,0x852,0x852,0x84f,0x84f,0x84f,0x84f,0x921,0x924,0x855,0x858,0xc96, -0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e, -0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e, -0x861,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e, -0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x85e,0x86a,0x86a,0x86a,0x86a, -0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a, -0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0x86a,0xd9b,0xd9b,0xeca,0x864,0x92d,0x92d,0x92d,0x92d, -0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0xd95,0xd95,0xd95,0xd95,0x86d,0x86d,0x86d,0x86d, -0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d, -0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x86d,0x1ab2,0x936,0x936,0x936,0x936, -0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x870,0x870,0x870, -0x870,0x870,0x870,0xd9e,0xd9e,0xd9e,0xd9e,0x939,0x939,0x939,0x939,0x939,0x870,0x870,0x870,0x870, -0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870, -0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0x870,0xd9e,0xd9e, -0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873, -0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873,0x873, -0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876, -0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876, -0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0x876,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd, -0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd,0xecd, -0x113d,0x113d,0x113d,0x113d,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879, -0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x879, -0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x879, -0x879,0x879,0x879,0x879,0x879,0x879,0x879,0x87c,0x879,0x87c,0x879,0x87c,0x87c,0x879,0x879,0x87c, -0x87c,0x87c,0x879,0x879,0x879,0x879,0x14e5,0x14e5,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f, -0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d, -0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d, -0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x92d,0x131d,0x131d,0x131d,0x131d,0x12bd,0x12bd,0x12bd,0x12bd, -0x12bd,0x12bd,0x12bd,0x12bd,0xd95,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99, -0xc99,0xc99,0xc99,0xc99,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930, -0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x933,0x930,0x933,0x930,0x930, -0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930,0x930, -0x930,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99,0xc99, -0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936, -0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0xd9e, -0x9b7,0x999,0x999,0x999,0x999,0x993,0x999,0x999,0x9ab,0x999,0x999,0x996,0x9a2,0x9a8,0x9a8,0x9a8, -0x9a8,0x9a8,0x9ab,0x993,0x99f,0x993,0x993,0x993,0x98a,0x98a,0x993,0x993,0x993,0x993,0x993,0x993, -0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x993,0x993,0x993,0x993,0x993,0x993, -0x993,0x993,0x993,0x993,0x996,0x98a,0x993,0x98a,0x993,0x98a,0x9a5,0x99c,0x9a5,0x99c,0x9b4,0x9b4, -0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3, -0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3,0x9c3, -0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6, -0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6,0x9c6, -0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9, -0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9,0x9c9, -0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2, -0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9cc,0x9cc, -0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5, -0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9cf,0x9cf, -0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2, -0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2,0x9d2, -0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5, -0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5,0x9d5, -0x9d8,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db, -0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9d8,0x9db,0x9db,0x9db, -0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db, -0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0x9db,0xa68,0xa68,0xfff,0xa68,0xa68,0xa68,0xa6b,0xa68, -0xfff,0xa68,0xa68,0xff6,0xa62,0xa56,0xa56,0xa56,0xa56,0xa65,0xa56,0xfe7,0xfe7,0xfe7,0xa56,0xa59, -0xa62,0xa5c,0xfed,0xff9,0xff9,0xfe7,0xfe7,0xfff,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61,0xb61, -0xb61,0xb61,0xa6e,0xa6e,0xa5f,0xa5f,0xa5f,0xa5f,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa65,0xa65, -0xa56,0xa56,0xfff,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68, +0x5ca,0x5cd,0x5cd,0x5cd,0x5cd,0x5cd,0x5cd,0x5cd,0x5cd,0x5cd,0x5cd,0x5cd,0x71d,0x71d,0x71d,0x71d, +0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x5cd,0x5cd,0x5cd,0x5cd,0x71d,0x71d,0x71d,0x71d, +0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x720,0x720,0x720,0x720, +0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x720,0x5d0,0x5d0,0x720,0x720, +0x720,0x720,0xbe8,0xbe8,0xbe8,0xbe8,0xbe8,0xbe8,0xbe8,0xbe8,0xbe8,0xbe8,0x726,0x726,0x5d3,0x723, +0x723,0x723,0x723,0x723,0x723,0x723,0x5d3,0x5d3,0x5d3,0x5d3,0x5d6,0x5d6,0x5d6,0x5d6,0x726,0x726, +0x5d6,0x5d6,0x726,0x726,0x5d3,0x5d3,0x5d3,0x5d3,0x726,0x726,0x5d6,0x5d6,0x726,0x726,0x5d3,0x5d3, +0x5d3,0x5d3,0x726,0x726,0x723,0x5d3,0x5d6,0x726,0x5d3,0x5d3,0x723,0x726,0x726,0x726,0x5d6,0x5d6, +0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x5d3,0x726,0x723, +0x726,0x723,0x5d3,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d3,0x5d3,0x723,0xaf5,0xaf5,0xaf5,0xaf5, +0xaf5,0xaf5,0xaf5,0xaf5,0xbeb,0xbeb,0xbeb,0xbeb,0xbeb,0xc5a,0xc5a,0xbeb,0x5dc,0x5dc,0x5dc,0x5dc, +0x5d9,0x72f,0x72f,0x5d9,0x5d9,0x729,0x5d9,0x5d9,0x5d9,0x5d9,0x729,0x729,0x5d9,0x5d9,0x5d9,0x5d9, +0xd59,0xd59,0xbee,0xbee,0xdda,0xaf8,0x5dc,0x5dc,0x72c,0x5df,0x72c,0x5dc,0x5d9,0x5d9,0x5d9,0x5d9, +0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9, +0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5dc,0x5dc,0x5dc,0x5d9,0x5d9,0x5d9,0x5d9,0x72f,0x5d9,0x72f,0x5d9, +0x5d9,0x5d9,0x5d9,0x5d9,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807, +0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x72f,0x72f,0x5e2,0x72f, +0x729,0x729,0x5d9,0x729,0x72c,0x729,0x729,0x5d9,0x729,0x72f,0x5e2,0x72f,0xaf8,0xaf8,0xbf1,0xbf1, +0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xdd7,0xe8e,0x5e5,0x5e5,0x5e5,0x5e5, +0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5,0x5e5, +0x5e8,0x13a4,0x13a4,0x13a4,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x14e2,0x5ee,0x5ee,0x5ee, +0x5ee,0x13a4,0x5e8,0x5e8,0x5ee,0x5ee,0x13a7,0x13a7,0x5f4,0x5f4,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8, +0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x13a4,0x5e8,0x5e8,0x5e8, +0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8, +0x5e8,0x735,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8, +0x13a4,0x5e8,0x13a4,0x5e8,0x5e8,0x5e8,0x5e8,0x13a4,0x13a4,0x13a4,0x5e8,0x129f,0x5e8,0x5e8,0x5e8,0x5f1, +0x5f1,0x5f1,0x5f1,0x1326,0x1326,0x5e8,0x5eb,0x5eb,0x5ee,0x5e8,0x5e8,0x5e8,0xbf7,0xbf4,0xbf7,0xbf4, +0xbf7,0xbf4,0xbf7,0xbf4,0xbf7,0xbf4,0xbf7,0xbf4,0xbf7,0xbf4,0x732,0x732,0x732,0x732,0x732,0x732, +0x732,0x732,0x732,0x732,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8, +0x5e8,0x5e8,0x5e8,0x5e8,0x13a4,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8,0x5e8, +0x5e8,0x5e8,0x5e8,0x13a4,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615, +0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615, +0x615,0x615,0x60c,0x60c,0x60c,0x60c,0x60c,0x60c,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f, +0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f, +0x60f,0x60f,0x60f,0x60f,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49,0xb49, +0xb49,0xb49,0xb49,0xb49,0x615,0x615,0x95a,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x60c,0x60c, +0xbfa,0xd7d,0x1b21,0x1b21,0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f, +0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f, +0x612,0x618,0x615,0x60f,0x615,0x60f,0x615,0x60f,0x615,0x60f,0x615,0x60f,0x615,0x60f,0x615,0x60f, +0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f, +0x615,0x60f,0x612,0x618,0x615,0x60f,0x615,0x60f,0x612,0x618,0x615,0x60f,0x612,0x618,0x615,0x60f, +0x615,0x60f,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329,0x1329, +0x615,0x60f,0x615,0x60f,0x615,0x60f,0x612,0x618,0x612,0x618,0x615,0x60f,0x615,0x60f,0x615,0x60f, +0x615,0x60f,0x615,0x60f,0x615,0x60f,0x615,0x60f,0x612,0x615,0x60f,0x612,0x615,0x60f,0x612,0x618, +0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f, +0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612, +0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615, +0x615,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f, +0x60f,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, +0x60f,0x615,0x918,0x91b,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21,0x1b21, +0x1b21,0x1b21,0x1b21,0x1b21,0x612,0x60f,0x612,0x612,0x612,0x612,0x612,0x612,0x60f,0x612,0x60f,0x60f, +0x612,0x612,0x60f,0x60f,0x612,0x612,0x60f,0x612,0x60f,0x612,0x60f,0x60f,0x612,0x60f,0x60f,0x612, +0x60f,0x612,0x60f,0x60f,0x612,0x60f,0x612,0x612,0x60f,0x60f,0x60f,0x612,0x60f,0x60f,0x60f,0x60f, +0x60f,0x612,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f, +0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x60f,0x612,0x612,0x60f,0x60f,0x612,0x60f,0x612,0x60f, +0x60f,0x60f,0x60f,0x60f,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612, +0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x612, +0x612,0x612,0x612,0x612,0x612,0x612,0x612,0x618,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615, +0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615, +0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618, +0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x618,0x615,0x615,0x615, +0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x615,0x61b,0x61b,0x61b,0x61b,0xfe1,0xfe1,0xfe1,0x14e5, +0x14e5,0x14e5,0x14e5,0x14e5,0x14e5,0x14e5,0x16ef,0x16ef,0x864,0x86a,0x86a,0x876,0x876,0x867,0x85e,0x867, +0x85e,0x867,0x85e,0x867,0x85e,0x867,0x85e,0x867,0x62a,0x62a,0x624,0x62a,0x624,0x62a,0x624,0x62a, +0x624,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x62a,0x624,0x627, +0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x62a,0x624,0x62a,0x624,0x62a, +0x624,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627, +0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627,0x62d,0x62a,0x624,0x627, +0x62d,0x62a,0x624,0x627,0x714,0x714,0x714,0x714,0x714,0x714,0x714,0x714,0x714,0x714,0x714,0x714, +0x714,0x714,0x714,0x714,0x714,0x714,0x714,0x714,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711, +0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711, +0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x711,0x71a,0x71a,0x71a,0x71a,0x71a,0x71a, +0x71a,0x71a,0x71a,0x71a,0x71a,0x71a,0x71a,0x71a,0x71a,0x71a,0x71a,0x71a,0x717,0x717,0x717,0x717, +0x717,0x717,0x717,0x717,0x717,0x717,0x717,0x717,0x717,0x717,0x717,0x717,0x71d,0x71d,0x71d,0x71d, +0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d, +0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x738,0x738,0x738,0x738, +0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738, +0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0x738,0xc48,0x8c7,0x8be,0x8bb, +0x8c1,0x8c4,0x74d,0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x750,0x8cd,0x74d,0x74d,0x74d, +0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d, +0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x74d,0x8ca,0x8ca, +0x753,0x8dc,0x8df,0x8e5,0x80a,0x816,0x8fa,0x813,0x8d3,0x8d0,0x8d3,0x8d0,0x8d9,0x8d6,0x8d9,0x8d6, +0x8d3,0x8d0,0x810,0x8e5,0x8d3,0x8d0,0x8d3,0x8d0,0x8d3,0x8d0,0x8d3,0x8d0,0x8eb,0x8f1,0x8ee,0x8ee, +0x759,0x795,0x795,0x795,0x795,0x795,0x795,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f, +0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x78f,0x75c,0x777,0x756,0x77d,0x780, +0x77a,0x792,0x792,0x792,0x792,0x792,0x792,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c, +0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x78c,0x75c,0x777,0x756,0x777,0xc4b, +0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8, +0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8, +0x7f8,0x7f8,0x1299,0x1299,0x1299,0x1299,0x1299,0x7fb,0x810,0x813,0x813,0x813,0x813,0x813,0x813,0x813, +0x813,0x813,0x933,0x933,0x933,0x933,0x819,0x819,0x8e8,0x8f7,0x8f7,0x8f7,0x8f7,0x8f4,0x80d,0x8e2, +0xb1c,0xb1c,0xb1c,0xc5d,0xc7b,0xc78,0xb3a,0x8b8,0x81f,0x81c,0x81f,0x822,0x81c,0x81f,0x81c,0x81f, +0x81c,0x81f,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81f,0x81f,0x81c,0x81f,0x81f,0x81c,0x81f,0x81f, +0x81c,0x81f,0x81f,0x81c,0x81f,0x81f,0x81c,0x81c,0xc7e,0x831,0x82b,0x831,0x82b,0x831,0x82b,0x831, +0x82b,0x831,0x82b,0x82b,0x82e,0x82b,0x82e,0x82b,0x82e,0x82b,0x82e,0x82b,0x82e,0x82b,0x82e,0x82b, +0x82e,0x82b,0x82e,0x82b,0x82e,0x82b,0x82e,0x82b,0x82e,0x82b,0x82e,0x831,0x82b,0x82e,0x82b,0x82e, +0x82b,0x82e,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82e,0x82e,0x82b,0x82e,0x82e,0x82b,0x82e,0x82e, +0x82b,0x82e,0x82e,0x82b,0x82e,0x82e,0x82b,0x82b,0x82b,0x82b,0x82b,0x831,0x82b,0x831,0x82b,0x831, +0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x831,0x82b,0x82b,0x82b,0x82b,0x82b,0x82e,0x831,0x831,0x82e, +0x82e,0x82e,0x82e,0x900,0x903,0x834,0x837,0xc66,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d, +0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d, +0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x840,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d, +0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d,0x83d, +0x83d,0x83d,0x83d,0x83d,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849, +0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849,0x849, +0xd62,0xd62,0xe91,0x843,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, +0xd5c,0xd5c,0xd5c,0xd5c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c, +0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c,0x84c, +0x84c,0x84c,0x84c,0x1a6a,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912, +0x912,0x912,0x912,0x912,0x912,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0xd65,0xd65,0xd65,0xd65,0x915, +0x915,0x915,0x915,0x915,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f, +0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0x84f, +0x84f,0x84f,0x84f,0x84f,0x84f,0x84f,0xd65,0xd65,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852, +0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852, +0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x852,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912, +0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855, +0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855,0x855, +0x855,0x855,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94, +0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0xe94,0x110a,0x110a,0x110a,0x110a,0x858,0x858,0x858,0x858, +0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858, +0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x85b,0x85b, +0x858,0x85b,0x858,0x85b,0x85b,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x858,0x85b, +0x858,0x85b,0x858,0x85b,0x85b,0x858,0x858,0x85b,0x85b,0x85b,0x858,0x858,0x858,0x858,0x14a0,0x14a0, +0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f, +0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, +0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c,0x90c, +0x12d8,0x12d8,0x12d8,0x12d8,0x1281,0x1281,0x1281,0x1281,0x1281,0x1281,0x1281,0x1281,0xd5c,0xc69,0xc69,0xc69, +0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0x90f,0x90f,0x90f,0x90f, +0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f, +0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0x90f,0xc69,0xc69,0xc69, +0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0xc69,0x912,0x912,0x912,0x912, +0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912, +0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0x912,0xd65,0x99c,0x97e,0x97e,0x97e, +0x97e,0x978,0x97e,0x97e,0x990,0x97e,0x97e,0x97b,0x987,0x98d,0x98d,0x98d,0x98d,0x98d,0x990,0x978, +0x984,0x978,0x978,0x978,0x96c,0x96c,0x978,0x978,0x978,0x978,0x978,0x978,0x993,0x993,0x993,0x993, +0x993,0x993,0x993,0x993,0x993,0x993,0x978,0x978,0x978,0x978,0x978,0x978,0x978,0x978,0x978,0x978, +0x97b,0x96c,0x978,0x96c,0x978,0x96c,0x98a,0x981,0x98a,0x981,0x999,0x999,0x9a8,0x9a8,0x9a8,0x9a8, +0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8, +0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9a8,0x9ab,0x9ab,0x9ab,0x9ab, +0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab, +0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ab,0x9ae,0x9ae,0x9ae,0x9ae, +0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae, +0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9ae,0x9b7,0x9b7,0x9b7,0x9b7, +0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7, +0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b1,0x9b1,0x9ba,0x9ba,0x9ba,0x9ba, +0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba, +0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9b4,0x9b4,0x9b7,0x9b7,0x9b7,0x9b7, +0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7, +0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9b7,0x9ba,0x9ba,0x9ba,0x9ba, +0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba, +0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9ba,0x9bd,0x9c0,0x9c0,0x9c0, +0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0, +0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9bd,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0, +0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0,0x9c0, +0x9c0,0x9c0,0x9c0,0x9c0,0xa4d,0xa4d,0xfc6,0xa4d,0xa4d,0xa4d,0xa50,0xa4d,0xfc6,0xa4d,0xa4d,0xfbd, +0xa47,0xa3b,0xa3b,0xa3b,0xa3b,0xa4a,0xa3b,0xfae,0xfae,0xfae,0xa3b,0xa3e,0xa47,0xa41,0xfb4,0xfc0, +0xfc0,0xfae,0xfae,0xfc6,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xa53,0xa53, +0xa44,0xa44,0xa44,0xa44,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4a,0xa4a,0xa3b,0xa3b,0xfc6,0xfc6, +0xfc6,0xfc6,0xfae,0xfae,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d, +0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d,0xa4d, +0xa4d,0xa4d,0xa4d,0xa4d,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xdbc,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xdbc, +0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62,0xa62, +0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68, 0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68, -0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa68,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xdf2, -0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, -0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, -0xa7d,0xa7d,0xa7d,0xdf2,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d,0xa7d, -0xa7d,0xa7d,0xa7d,0xa7d,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83, +0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6b,0xa71,0xa6e, +0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0x1143,0x1143,0x1143,0x1143,0x1143,0x1143,0x1143,0x1143,0x1143, +0x1140,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e, +0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e,0xa6e, +0xa6e,0xa6e,0xa6e,0xa6e,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83, 0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83,0xa83, -0xa83,0xa83,0xa83,0xa83,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89, -0xa89,0xa86,0xa8c,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0x1176,0x1176,0x1176,0x1176,0x1176, -0x1176,0x1176,0x1176,0x1176,0x1173,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89, -0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89, -0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa89,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e, -0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e, -0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xa9e,0xac2,0xac2,0xac2,0xac5,0xac5,0xac2,0xac2,0xac2, -0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xaaa,0xaaa,0xabf,0xaa1, -0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xaa1,0xabf,0xabf,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2, -0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2, -0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xac2,0xae3,0xae3,0xae3,0xae3,0xae3,0xace,0xace,0xae3, -0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, -0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, -0xae3,0xae3,0xae3,0xae6,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, -0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3, -0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb10,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d, -0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xc06,0xc06,0xc06,0xc06,0xc06, -0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c, -0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c, -0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, -0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e,0xb2e, -0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34, -0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34,0xb34, -0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40, -0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0xb40,0x13ec,0x13ec,0x13ec,0x1b2d,0x1b2d,0x1b2d,0x1b2d,0x1b2d, -0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43, -0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43,0xb43, -0xb43,0xb43,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0x1b30,0xb46,0xb46,0xb46,0xb46, -0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46, -0xb46,0xb49,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46, -0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46,0xb46, -0xb46,0xb46,0xb46,0xb46,0xb4c,0xb4c,0xc9c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c, -0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xc9c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c,0xb4c, -0xb4c,0xb4c,0xb4c,0xb4c,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70, -0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70,0xb70, -0xb70,0xb70,0xb70,0x1530,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xd26,0xd26,0xb76,0xb76,0xb76,0xb76, -0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xb76, -0xb76,0xb76,0xb76,0xb76,0xb76,0xb76,0xd23,0xd23,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74, -0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79, +0xa83,0xa83,0xa83,0xa83,0xaa7,0xaa7,0xaa7,0xaaa,0xaaa,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7, +0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xa8f,0xa8f,0xaa4,0xa86,0xa86,0xa86,0xa86,0xa86, +0xa86,0xa86,0xaa4,0xaa4,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7, +0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7,0xaa7, +0xaa7,0xaa7,0xaa7,0xaa7,0xacb,0xacb,0xacb,0xacb,0xacb,0xab6,0xab6,0xacb,0xacb,0xacb,0xacb,0xacb, +0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb, +0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xace, +0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb, +0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xacb,0xaef,0xaef,0xaef,0xaef, +0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef, +0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xaef,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xafb,0xafb,0xafb,0xafb, +0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb, +0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xb0d,0xb0d,0xb0d,0xb0d, +0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d, +0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb0d,0xb13,0xb13,0xb13,0xb13, +0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13, +0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb13,0xb1f,0xb1f,0xb1f,0xb1f, +0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f,0xb1f, +0xb1f,0xb1f,0xb1f,0xb1f,0x13aa,0x13aa,0x13aa,0x1ae5,0x1ae5,0x1ae5,0x1ae5,0x1ae5,0xb22,0xb22,0xb22,0xb22, +0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22, +0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0xb22,0x1ae8,0x1ae8, +0x1ae8,0x1ae8,0x1ae8,0x1ae8,0x1ae8,0x1ae8,0x1ae8,0x1ae8,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25, +0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb28,0xb25,0xb25, +0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25, +0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25,0xb25, +0xb2b,0xb2b,0xc6c,0xc6c,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b, +0xb2b,0xb2b,0xb2b,0xb2b,0xc6c,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b,0xb2b, +0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f, +0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0xb4f,0x14e8, +0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xcf0,0xcf0,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55, +0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55,0xb55, +0xb55,0xb55,0xced,0xced,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b, +0xd3b,0xd3b,0xd3b,0xd3b,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58, +0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58,0xb58, +0xb58,0xb58,0xb58,0xb58,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b, +0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b,0xb5b, +0xb5b,0xb5b,0xb5b,0xb5b,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a,0xb61,0xb6d,0xb73,0xb73,0xb73,0xb67,0xb67, +0xb67,0xb70,0xb64,0xb64,0xb64,0xb64,0xb64,0xb5e,0xb5e,0xb5e,0xb5e,0xb5e,0xb5e,0xb5e,0xb5e,0xb73, +0xb73,0xb73,0xb73,0xb73,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67, +0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67, +0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb6a,0xb6a,0xb73,0xb73,0xb73,0xb67,0xb67,0xb73,0xb73,0xb73, +0xb73,0xb73,0xb73,0xb73,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67, +0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb73,0xb73,0xb73,0xb73,0xb67,0xb67, +0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb6a,0xb6a,0xb6a,0xb6a,0xb6a, +0xb6a,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67, +0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0xb67,0x16f2,0x16f2, +0xb7f,0xb76,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb76,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb76,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb76,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb76,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79, 0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79, -0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb79,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb79,0xb79,0xb79,0xb79,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7c,0xb7c, 0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, -0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb82,0xb8e,0xb94, -0xb94,0xb94,0xb88,0xb88,0xb88,0xb91,0xb85,0xb85,0xb85,0xb85,0xb85,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, -0xb7f,0xb7f,0xb7f,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, -0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, -0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b,0xb8b,0xb94,0xb94,0xb94,0xb88, -0xb88,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, -0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb94,0xb94, -0xb94,0xb94,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb8b, -0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f, +0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7f,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c, +0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7c,0xb7f,0xb7f,0xb7f,0xb7f,0xb82,0xb82,0xb82,0xb82, +0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82, +0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb82,0xb88,0xb88,0xb88,0xb88, 0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88, -0xb88,0xb88,0x173d,0x173d,0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xb97, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xb97,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a, -0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a, -0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xb9a,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0,0xba0, -0xba0,0xba0,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d, -0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xb9d,0xba0,0xba0,0xba0,0xba0, -0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3, -0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3,0xba3, -0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9, -0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9,0xba9, -0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac, -0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac,0xbac, -0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc06, -0xc06,0xc06,0xc06,0xc06,0xc06,0xc06,0xc03,0xc06,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03, -0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xc03,0xd14,0xd17,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a,0xe0a, -0xe0a,0xe0a,0xe0a,0xe0a,0xf24,0xf24,0xf24,0xf24,0xc18,0xc18,0xc18,0xc18,0xc18,0xc18,0xc12,0xc12, -0xc12,0xc12,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1a,0xd1d,0xd1d,0xe10,0xec4,0xe10,0xe10,0xe10,0xe10, -0xe0d,0xe10,0xe0d,0xe10,0xe10,0x1014,0x12ae,0x12ae,0xe19,0xe19,0xe19,0xe19,0xe19,0xe1f,0xe1c,0xf36, -0xf36,0xf36,0xf36,0x142e,0x1026,0x142e,0x1374,0x1374,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e, -0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc4e,0xc81,0xc7e,0xc81,0xc7e,0xc81,0xc7e, -0x1137,0x1134,0x102c,0x1029,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51,0xc51, -0xc51,0xc51,0xc51,0xc51,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54, -0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54, -0xc54,0xc54,0xc54,0xc54,0xc57,0xc57,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54,0xc54, -0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc87,0xc84,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60, -0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc60,0xc5d,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a, -0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a, -0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc60,0xc5d, -0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a, -0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc5a,0xc60,0xc5d,0xc5a,0xc5a, -0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc69,0xc63,0xc63,0xc63, -0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, -0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, -0xc69,0xc69,0xc69,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, -0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63,0xc63, -0xc66,0xc63,0xc63,0xc63,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f, -0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f,0xc9f, -0xc9f,0xc9f,0xc9f,0xc9f,0xd20,0xd8f,0xe0d,0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe0d,0xe0d,0xec4,0xec4, -0xe0d,0xe0d,0xe0d,0xe0d,0xe10,0xe10,0xf27,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014,0x1014, -0x1014,0x12db,0x12db,0x12b1,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44, -0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44,0xd44, -0xd44,0xd44,0xd44,0xd44,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd4a,0xd4a,0xd4a,0xd4a,0xd4a,0xd47, -0xd5c,0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd56, -0xd5c,0xd5c,0xd5c,0xd5c,0xd50,0xd50,0xd59,0xd59,0xd59,0xd59,0xd4d,0xd4d,0xd4d,0xd4d,0xd4d,0xd53, -0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe25,0xe22,0xe25,0xe25,0xe25, -0xe25,0xe25,0xe25,0xe25,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c, -0xd5c,0xd5c,0xd56,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c,0xd5c, -0xd5c,0xd50,0xd50,0xd50,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53, +0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0xb88,0x1aee, +0x1aee,0x1aee,0x1aee,0x1aee,0x1aee,0x1aee,0x1bba,0x1bba,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b, +0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b, +0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xb8b,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5, +0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe5,0xbe2,0xbe5, +0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xbe2,0xce4, +0xce7,0xdd4,0xdd4,0xdd4,0xdd4,0xdd4,0xdd4,0xdd4,0xdd4,0xdd4,0xdd4,0xdd4,0xeeb,0xeeb,0xeeb,0xeeb, +0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xbf1,0xcea,0xcea,0xcea,0xcea,0xcea,0xcea, +0xcea,0xcea,0xdd7,0xe8b,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xfdb,0x1278,0x1278, +0xde0,0xde0,0xde0,0xde0,0xde0,0xde6,0xde3,0xefd,0xefd,0xefd,0xefd,0x13e9,0xfed,0x13e9,0x1332,0x1332, +0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24,0xc24, +0xc24,0xc24,0xc51,0xc4e,0xc51,0xc4e,0xc51,0xc4e,0x1104,0x1101,0xff3,0xff0,0xc27,0xc27,0xc27,0xc27, +0xc27,0xc27,0xc27,0xc27,0xc27,0xc27,0xc27,0xc27,0xc27,0xc27,0xc27,0xc27,0xc2a,0xc2a,0xc2a,0xc2a, +0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a, +0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2a,0xc2d,0xc2d,0xc2d,0xc33, +0xc30,0xc57,0xc54,0xc33,0xc30,0xc33,0xc30,0xc33,0xc30,0xc33,0xc30,0xc33,0xc30,0xc33,0xc30,0xc33, +0xc30,0xc33,0xc30,0xc33,0xc30,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc33,0xc30,0xc33,0xc30,0xc2d,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d, +0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc2d,0xc33,0xc30,0xc2d,0xc2d,0xc36,0xc36,0xc36,0xc36, +0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc3c,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36, +0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36, +0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc3c,0xc3c,0xc3c,0xc36, +0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36, +0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc36,0xc39,0xc36,0xc36,0xc36, +0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f, +0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f,0xc6f, +0xcea,0xd56,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xdd7,0xe8b,0xe8b,0xdd7,0xdd7,0xdd7,0xdd7, +0xdd7,0xdd7,0xeee,0xfdb,0xfdb,0xfdb,0xfdb,0xfdb,0xfdb,0xfdb,0xfdb,0xfdb,0xfdb,0x129c,0x129c,0x127b, +0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e, +0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e,0xd0e, +0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd14,0xd14,0xd14,0xd14,0xd14,0xd11,0xd26,0xd26,0xd26,0xd20, +0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd20,0xd26,0xd26,0xd26,0xd26, +0xd1a,0xd1a,0xd23,0xd23,0xd23,0xd23,0xd17,0xd17,0xd17,0xd17,0xd17,0xd1d,0xdec,0xdec,0xdec,0xdec, +0xdec,0xdec,0xdec,0xdec,0xdec,0xdec,0xdec,0xdec,0xde9,0xdec,0xdec,0xdec,0xdec,0xdec,0xdec,0xdec, +0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd20,0xd26, +0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd26,0xd1a,0xd1a,0xd1a, +0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d, +0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d,0xd1d, +0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xd29,0xdef,0xdef, +0xdef,0xdef,0xdef,0xdef,0xf00,0xf00,0xf00,0xf00,0xf00,0xf00,0xf00,0x110d,0x110d,0xff6,0xff6,0xff6, +0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c, +0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c,0xd2c, +0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32, +0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32,0xd32, +0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b, +0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b,0xd3b, +0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47, +0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47,0xd47, +0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53, 0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53,0xd53, -0xd53,0xd53,0xd53,0xd53,0xd5f,0xd5f,0xd5f,0xd5f,0xd5f,0xd62,0xd62,0xd62,0xd5f,0xd5f,0xd5f,0xd5f, -0xd5f,0xd5f,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0xf39,0x1140, -0x1140,0x102f,0x102f,0x102f,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65, -0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65,0xd65, -0xd65,0xd65,0xd65,0xd65,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b, -0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b,0xd6b, -0xd6b,0xd6b,0xd6b,0xd6b,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74, -0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74,0xd74, -0xd74,0xd74,0xd74,0xd74,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80, -0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80,0xd80, -0xd80,0xd80,0xd80,0xd80,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c, -0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c,0xd8c, -0xd8c,0xd8c,0xd8c,0xd8c,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e, +0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5, +0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5,0xdf5, +0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb, +0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8,0xdf8, +0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb, +0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb,0xdfb, +0xebb,0xebb,0xe0d,0xe0d,0xf03,0xf03,0xf03,0xf03,0xf03,0xf03,0xf03,0x1002,0x1002,0x1005,0x1002,0x1002, +0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff, +0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19, +0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19,0xe1c,0xe19, +0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28, +0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28, +0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0x1b30, +0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b, +0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0xe2b,0x1b2d, 0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e, -0xe2e,0xe2e,0xe2e,0xe2e,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34, -0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31,0xe31, -0xe31,0xe31,0xe31,0xe31,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34, -0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34,0xe34, -0xe34,0xe34,0xe34,0xe34,0xef4,0xef4,0xe46,0xe46,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0x103b, -0x103b,0x103b,0x103b,0x103b,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038, -0x1038,0x1038,0x1038,0x1038,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52, -0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52,0xe55,0xe52, -0xe55,0xe52,0xe55,0xe52,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61, +0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e,0xe2e, +0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xe46,0xe46,0xe46,0xe46,0xe46,0xe46,0xe46,0xe46, +0xe46,0xe46,0xe46,0xe46,0xe46,0xe46,0xe46,0xf06,0xf06,0xf06,0xf06,0x1008,0x1008,0x1008,0x1008,0x1008, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f,0xe4f, +0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58, +0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58,0xe58, 0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61, -0xe61,0xe61,0xe61,0xe61,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67, -0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe67, -0xe67,0xe67,0xe67,0xe67,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xeee,0xe7f,0xe7f,0xe7f,0xe7f, -0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xf3f,0xf3f,0xf3f,0xf3f,0x103e, -0x103e,0x103e,0x103e,0x103e,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88, -0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88,0xe88, -0xe88,0xe88,0xe88,0xe88,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91, -0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91,0xe91, -0xe91,0xe91,0xe91,0xe91,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a, -0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a,0xe9a, -0xe9a,0xe9a,0xe9a,0xe94,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97, -0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe9a, -0xe9a,0xe9a,0xe9a,0xe9a,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3,0xea3, -0xea3,0xea3,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xea0,0xe9d,0xea6,0x104a,0x1044,0x1053,0x1041, -0xea3,0xea3,0x1041,0x1041,0xeb5,0xeb5,0xea9,0xeb5,0xeb5,0xeb5,0xeac,0xeb5,0xeb5,0xeb5,0xeb5,0xea9, -0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5,0xeb5, -0xeb5,0xeb5,0xeb5,0xeb5,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8, +0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe61,0xe5b, +0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e, +0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe5e,0xe61,0xe61,0xe61,0xe61,0xe61, +0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe6a,0xe67,0xe67, +0xe67,0xe67,0xe67,0xe67,0xe67,0xe67,0xe64,0xe6d,0x1014,0x100e,0x101d,0x100b,0xe6a,0xe6a,0x100b,0x100b, +0xe7c,0xe7c,0xe70,0xe7c,0xe7c,0xe7c,0xe73,0xe7c,0xe7c,0xe7c,0xe7c,0xe70,0xe7c,0xe7c,0xe7c,0xe7c, +0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c,0xe7c, +0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f, +0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f,0xe7f, +0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97, +0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97,0xe97, 0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8,0xeb8, -0xeb8,0xeb8,0xeb8,0xeb8,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0, -0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0,0xed0, -0xed0,0xed0,0xed0,0xed0,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1,0xef1, -0xef1,0xef1,0xef1,0xef1,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149,0x1149, -0x1149,0x1149,0x1149,0x1149,0xf24,0xf24,0xf24,0xf21,0xf21,0xf21,0xf21,0xf21,0x1182,0x13dd,0x13dd,0x13dd, -0x13dd,0x135f,0x135f,0x135f,0x13e0,0x1362,0x1362,0x13e0,0x1524,0x1524,0x1524,0x1524,0x1527,0x1527,0x1527,0x17ee, -0x17ee,0x17ee,0x17ee,0x18b4,0xf39,0xf39,0xf39,0xf39,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f,0x102f, -0x102f,0x102f,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032, -0x1032,0x1032,0x1032,0x1032,0xf5a,0xf5a,0xf5a,0xf5a,0xf6c,0xf75,0xf78,0xf75,0xf78,0xf75,0xf78,0xf75, -0xf78,0xf75,0xf78,0xf75,0xf75,0xf75,0xf78,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75, -0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf75,0xf5d,0xf5a,0xf5a,0xf5a, -0xf5a,0xf5a,0xf5a,0xf6f,0xf5a,0xf6f,0xf6c,0xf6c,0xf81,0xf7e,0xf81,0xf81,0xf81,0xf7e,0xf7e,0xf81, -0xf7e,0xf81,0xf7e,0xf81,0xf7e,0x1065,0x1065,0x1065,0x11a0,0x105c,0x1065,0x105c,0xf7e,0xf81,0xf7e,0xf7e, -0x105c,0x105c,0x105c,0x105c,0x105f,0x1062,0x11a0,0x11a0,0xf84,0xf84,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e, -0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e, -0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a, -0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a, -0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf8a,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99, -0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99, -0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0xf99,0x1563,0x1563,0x1563,0x1563,0x1563, -0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0x1563,0xf9f,0xf9f,0xf9f,0xf9f, -0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f, -0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xf9f,0xfe7,0xfff,0xff6,0xffc, -0xffc,0xfff,0xfff,0xff6,0xff6,0xffc,0xffc,0xffc,0xffc,0xffc,0xfff,0xfff,0xfff,0xfe7,0xfe7,0xfe7, -0xfe7,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfe7,0xff6, -0xff9,0xfe7,0xfe7,0xffc,0xffc,0xffc,0xffc,0xffc,0xffc,0xfea,0xfff,0xffc,0xff3,0xff3,0xff3,0xff3, -0xff3,0xff3,0xff3,0xff3,0xff3,0xff3,0x116a,0x116a,0x1167,0x1164,0xff0,0xff0,0x1017,0x1017,0x1017,0x1017, -0x12db,0x12db,0x12b1,0x12b1,0x12b7,0x12ae,0x12ae,0x12ae,0x12ae,0x12b1,0x13e3,0x12b7,0x12b1,0x12b7,0x12ae,0x12b7, -0x12db,0x12ae,0x12ae,0x12ae,0x12b1,0x12b1,0x12ae,0x12ae,0x12b1,0x12ae,0x12ae,0x12b1,0x1032,0x1032,0x1032,0x1032, -0x1032,0x102f,0x102f,0x1032,0x1032,0x1032,0x1032,0x1032,0x1032,0x153c,0x153c,0x153c,0x1140,0x102f,0x102f,0x102f, -0x102f,0x12e7,0x12c0,0x12c0,0x12c0,0x12c0,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x1050,0x1050,0x104d,0x1047, -0x104d,0x1047,0x104d,0x1047,0x104d,0x1047,0x1044,0x1044,0x1044,0x1044,0x1059,0x1056,0x1044,0x119d,0x143a,0x143d, -0x143d,0x143a,0x143a,0x143a,0x143a,0x143a,0x1440,0x1440,0x1557,0x154b,0x154b,0x1548,0x1077,0x106e,0x1077,0x106e, -0x1077,0x106e,0x1077,0x106e,0x106b,0x1068,0x1068,0x1077,0x106e,0x1383,0x1380,0x1746,0x1383,0x1380,0x1449,0x1446, -0x155a,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1560,0x155a,0x1077,0x106e,0x1077,0x106e, -0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e, -0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x106e,0x1071,0x106e,0x106e,0x106e, -0x106e,0x106e,0x106e,0x106e,0x106e,0x1077,0x106e,0x1077,0x106e,0x1077,0x1077,0x106e,0x107a,0x107a,0x1080,0x1086, -0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086, -0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1086,0x1080,0x107a,0x107a, -0x107a,0x107a,0x1080,0x1080,0x107a,0x107a,0x1083,0x1452,0x144f,0x144f,0x1086,0x1086,0x107d,0x107d,0x107d,0x107d, -0x107d,0x107d,0x107d,0x107d,0x107d,0x107d,0x1455,0x1455,0x1455,0x1455,0x1455,0x1455,0x109b,0x109b,0x109b,0x109b, -0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b, -0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x109b,0x10a4,0x10a4,0x10a4,0x10a4, -0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4,0x10a4, -0x10a4,0x10a4,0x10a4,0x10a4,0x10a7,0x10a7,0x10a7,0x10aa,0x10a7,0x10a7,0x10ad,0x10ad,0x10b0,0x10b0,0x10b0,0x10b0, -0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0, -0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b0,0x10b9,0x10b9,0x10b9,0x10b9, -0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10bc,0x10b3,0x10c2,0x10bf,0x10b9,0x10b9,0x10b9,0x10b9, -0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9, -0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x1389,0x1386,0x10d4,0x10ce, -0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d1,0x1152,0x10c5,0x10c5,0x10c5,0x10cb, -0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x10c8,0x10c8,0x10cb,0x10d7,0x10d4,0x10ce,0x10d4,0x10ce, -0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce, -0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x10d4,0x10ce,0x156f,0x156c,0x156f,0x156c, -0x1572,0x1572,0x174f,0x1458,0x10e0,0x10e0,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3, -0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3,0x10e3, -0x10e3,0x10e3,0x10e3,0x10e3,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0, -0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10e9,0x10e9,0x10e9,0x10e9,0x10e9,0x10ec,0x10ec,0x10ec,0x1146,0x10f5, -0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104,0x1104, -0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10ef,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2, -0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2, 0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113, -0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113,0x1113, -0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125, -0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125,0x1125, -0x112e,0x112e,0x112e,0x112e,0x1143,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e, -0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e,0x112e, -0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131, -0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131,0x1131, -0x113d,0x113d,0x113d,0x113d,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x12e1,0x14e2,0x17cd,0x17cd,0x17cd, -0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x17cd,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d,0x191d, -0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2, -0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11b2,0x11a9,0x11a9,0x11ac,0x11ac,0x11b2,0x11a9,0x11a9,0x11a9,0x11a9,0x11a9, -0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, -0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8,0x11b8, -0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3, -0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3,0x11d3, +0xeeb,0xeeb,0xeeb,0xee8,0xee8,0xee8,0xee8,0xee8,0x114f,0x139b,0x139b,0x139b,0x139b,0x131d,0x131d,0x131d, +0x139e,0x1320,0x1320,0x139e,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x17a6,0x17a6,0x17a6,0x17a6,0x186c, +0xf00,0xf00,0xf00,0xf00,0xff6,0xff6,0xff6,0xff6,0xff6,0xff6,0xff6,0xff6,0xff6,0xff6,0xff6,0xff6, +0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9,0xff9, +0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0xfff,0x14fa,0x14fa,0x14fa,0x14fa,0x14fa,0x14fa,0x14fa,0x14fa,0x14fa, +0x14fa,0x14fa,0x14fa,0x14fa,0x14fa,0x14fd,0x1875,0x1875,0x18f6,0x1875,0x1bd8,0x17ac,0x1335,0x1158,0xf03,0xf03, +0xf21,0xf21,0xf21,0xf21,0xf33,0xf3c,0xf3f,0xf3c,0xf3f,0xf3c,0xf3f,0xf3c,0xf3f,0xf3c,0xf3f,0xf3c, +0xf3c,0xf3c,0xf3f,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c, +0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf3c,0xf24,0xf21,0xf21,0xf21,0xf21,0xf21,0xf21,0xf36, +0xf21,0xf36,0xf33,0xf33,0xf48,0xf45,0xf48,0xf48,0xf48,0xf45,0xf45,0xf48,0xf45,0xf48,0xf45,0xf48, +0xf45,0x102f,0x102f,0x102f,0x116d,0x1026,0x102f,0x1026,0xf45,0xf48,0xf45,0xf45,0x1026,0x1026,0x1026,0x1026, +0x1029,0x102c,0x116d,0x116d,0xf4b,0xf4b,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038, +0x1041,0x1038,0x1041,0x1038,0x1038,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038, +0x1041,0x1038,0x1041,0x1038,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51, +0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51,0xf51, +0xf51,0xf51,0xf51,0xf51,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60, +0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60, +0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0xf60,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b, +0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0x151b,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66, +0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66, +0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xf66,0xfae,0xfc6,0xfbd,0xfc3,0xfc3,0xfc6,0xfc6,0xfbd, +0xfbd,0xfc3,0xfc3,0xfc3,0xfc3,0xfc3,0xfc6,0xfc6,0xfc6,0xfae,0xfae,0xfae,0xfae,0xfc6,0xfc6,0xfc6, +0xfc6,0xfc6,0xfc6,0xfc6,0xfc6,0xfc6,0xfc6,0xfc6,0xfc6,0xfc6,0xfae,0xfbd,0xfc0,0xfae,0xfae,0xfc3, +0xfc3,0xfc3,0xfc3,0xfc3,0xfc3,0xfb1,0xfc6,0xfc3,0xfba,0xfba,0xfba,0xfba,0xfba,0xfba,0xfba,0xfba, +0xfba,0xfba,0x1137,0x1137,0x1134,0x1131,0xfb7,0xfb7,0xfde,0xfde,0xfde,0xfde,0x129c,0x129c,0x127b,0x127b, +0x127b,0x1278,0x1278,0x1278,0x1278,0x127b,0x13a1,0x127b,0x127b,0x127b,0x1278,0x127b,0x129c,0x1278,0x1278,0x1278, +0x127b,0x127b,0x1278,0x1278,0x127b,0x1278,0x1278,0x127b,0xff9,0xff9,0xff9,0xff9,0xff9,0xff6,0xff6,0xff9, +0xff9,0xff9,0xff9,0xff9,0xff9,0x14f4,0x14f4,0x14f4,0x110d,0xff6,0xff6,0xff6,0xff6,0x12a8,0x1284,0x1284, +0x1284,0x1284,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x101a,0x101a,0x1017,0x1011,0x1017,0x1011,0x1017,0x1011, +0x1017,0x1011,0x100e,0x100e,0x100e,0x100e,0x1023,0x1020,0x100e,0x116a,0x13f5,0x13f8,0x13f8,0x13f5,0x13f5,0x13f5, +0x13f5,0x13f5,0x13fb,0x13fb,0x150f,0x1503,0x1503,0x1500,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038, +0x1035,0x1032,0x1032,0x1041,0x1038,0x1341,0x133e,0x16fb,0x1341,0x133e,0x1404,0x1401,0x1512,0x1512,0x1518,0x1512, +0x1518,0x1512,0x1518,0x1512,0x1518,0x1512,0x1518,0x1512,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038, +0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038, +0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1038,0x103b,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038,0x1038, +0x1038,0x1041,0x1038,0x1041,0x1038,0x1041,0x1041,0x1038,0x1044,0x1044,0x104a,0x1050,0x1050,0x1050,0x1050,0x1050, +0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050, +0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x1050,0x104a,0x1044,0x1044,0x1044,0x1044,0x104a,0x104a, +0x1044,0x1044,0x104d,0x140d,0x140a,0x140a,0x1050,0x1050,0x1047,0x1047,0x1047,0x1047,0x1047,0x1047,0x1047,0x1047, +0x1047,0x1047,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065, +0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065, +0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x1065,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e, +0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e,0x106e, +0x1071,0x1071,0x1071,0x1074,0x1071,0x1071,0x1077,0x1077,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a, +0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a, +0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x107a,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083, +0x1083,0x1083,0x1083,0x1083,0x1086,0x107d,0x108c,0x1089,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083, +0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083, +0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1083,0x1347,0x1344,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098, +0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109b,0x111f,0x108f,0x108f,0x108f,0x1095,0x1413,0x1413,0x1413,0x1413, +0x1413,0x1413,0x1413,0x1413,0x1092,0x1092,0x1095,0x10a1,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098, +0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098, +0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x109e,0x1098,0x1527,0x1524,0x1527,0x1524,0x152a,0x152a,0x1704,0x1413, +0x10aa,0x10aa,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad, +0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad,0x10ad, +0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10aa,0x10bc,0x10bc,0x10bc,0x10bc, +0x10bc,0x10bc,0x10b3,0x10b3,0x10b3,0x10b3,0x10b3,0x10b6,0x10b6,0x10b6,0x1116,0x10bf,0x10ce,0x10ce,0x10ce,0x10ce, +0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10ce,0x10b9,0x10b9,0x10b9,0x10b9, +0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10b9,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc, +0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10bc,0x10e0,0x10e0,0x10e0,0x10e0, +0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0, +0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10e0,0x10f2,0x10f2,0x10f2,0x10f2, +0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2, +0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10f2,0x10fb,0x10fb,0x10fb,0x10fb, +0x1110,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb, +0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fb,0x10fe,0x10fe,0x10fe,0x10fe, +0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe, +0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x10fe,0x110a,0x110a,0x110a,0x110a, +0x12a2,0x12a2,0x12a2,0x12a2,0x12a2,0x12a2,0x12a2,0x12a2,0x149d,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785,0x1785, +0x1785,0x1785,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x117f,0x117f,0x117f,0x117f, +0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f,0x117f, +0x117f,0x117f,0x1176,0x1176,0x1179,0x1179,0x117f,0x1176,0x1176,0x1176,0x1176,0x1176,0x1185,0x1185,0x1185,0x1185, +0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185, +0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x1185,0x11a0,0x11a0,0x11a0,0x11a0, +0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0, +0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11a0,0x11ac,0x11ac,0x11ac,0x11ac, +0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac, +0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11ac,0x11a9,0x11af,0x11bb,0x11bb,0x11bb,0x11bb, +0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb, +0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11bb,0x11c1,0x11c1,0x11c1,0x11c1, +0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x11c1,0x12ed,0x11c7,0x12f0, +0x11c7,0x11c7,0x11c7,0x11c7,0x11c4,0x11c4,0x11c4,0x11c7,0x1707,0x170a,0x1932,0x192f,0x11ca,0x11ca,0x11ca,0x11d9, 0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df, -0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11dc,0x11e2, -0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee, -0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee,0x11ee, -0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4,0x11f4, -0x11f4,0x132f,0x11fa,0x1332,0x11fa,0x11fa,0x11fa,0x11fa,0x11f7,0x11f7,0x11f7,0x11fa,0x1752,0x1755,0x197a,0x1977, -0x11fd,0x11fd,0x11fd,0x120c,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212, -0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212,0x1212, -0x1212,0x1212,0x1212,0x1200,0x120c,0x120c,0x11fd,0x11fd,0x11fd,0x11fd,0x120c,0x120c,0x11fd,0x11fd,0x120c,0x120c, -0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e, -0x1221,0x121e,0x121e,0x121e,0x121e,0x121e,0x121e,0x1218,0x1218,0x1218,0x121e,0x121b,0x1578,0x157b,0x157e,0x157e, -0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230, -0x1224,0x1230,0x1224,0x1224,0x1224,0x1239,0x1239,0x1224,0x1224,0x1239,0x1230,0x1239,0x1239,0x1230,0x1224,0x1227, +0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11df,0x11cd, +0x11d9,0x11d9,0x11ca,0x11ca,0x11ca,0x11ca,0x11d9,0x11d9,0x11ca,0x11ca,0x11d9,0x11d9,0x11eb,0x11eb,0x11eb,0x11eb, +0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11eb,0x11ee,0x11eb,0x11eb,0x11eb, +0x11eb,0x11eb,0x11eb,0x11e5,0x11e5,0x11e5,0x11eb,0x11e8,0x1530,0x1533,0x1536,0x1536,0x11fd,0x11fd,0x11fd,0x11fd, +0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11f1,0x11fd,0x11f1,0x11f1, +0x11f1,0x1206,0x1206,0x11f1,0x11f1,0x1206,0x11fd,0x1206,0x1206,0x11fd,0x11f1,0x11f4,0x11fd,0x11fd,0x11fd,0x11fd, +0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd, +0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x11fd,0x1218,0x1218,0x1218,0x1218, +0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218, +0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1218,0x1230,0x1230,0x1230,0x1230, 0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230, -0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230, -0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b, -0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b,0x124b, -0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263, -0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1263,0x1260,0x1260,0x1260, -0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c, -0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c,0x126c, -0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b, -0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b,0x127b, -0x1281,0x1281,0x1290,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293, -0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1296,0x1293,0x1293,0x1293, -0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1293,0x1296,0x1293,0x1293,0x1293,0x1293, -0x1290,0x1290,0x1290,0x1284,0x1284,0x1284,0x1284,0x1290,0x1290,0x128a,0x1287,0x128d,0x128d,0x129c,0x1299,0x1299, -0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, -0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, -0x12a5,0x12a5,0x12a5,0x12a2,0x12a2,0x12a2,0x129f,0x129f,0x129f,0x129f,0x12a2,0x129f,0x129f,0x129f,0x12a5,0x12a2, -0x12a5,0x12a2,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f, -0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x129f,0x12a5,0x12a2,0x12a2, -0x129f,0x129f,0x129f,0x129f,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c9, -0x12c9,0x12c9,0x12a8,0x1980,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7,0x13d7, -0x13d7,0x12d2,0x13d7,0x12d2,0x12b1,0x12b1,0x1365,0x12ae,0x1365,0x1365,0x1365,0x1365,0x12ae,0x12b4,0x12db,0x12ae, -0x12ae,0x12ae,0x12ae,0x12ae,0x12b4,0x12b7,0x12db,0x12db,0x12b7,0x12db,0x12ae,0x12b7,0x12b7,0x12ba,0x12db,0x12ae, -0x12ae,0x12db,0x12b1,0x12b1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12c3,0x12c3, -0x12c3,0x12c3,0x13ef,0x13ce,0x12cc,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x13ef,0x187e, -0x187e,0x187e,0x187e,0x187e,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x1581, -0x1581,0x1ad0,0x1ad0,0x1ad0,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6,0x12c6, -0x12c6,0x12c6,0x12c6,0x12c6,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12d2,0x13d7,0x13d7,0x13d7,0x12cc,0x12cc, -0x12cc,0x12cc,0x12cc,0x13d1,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4, -0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x145b,0x145b, -0x1a2e,0x1ad0,0x1ad0,0x1ad0,0x13da,0x13da,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x13d4,0x12cf,0x13d4,0x12cf, -0x12cf,0x13d4,0x13da,0x12d5,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9, -0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9,0x12f9, -0x12f9,0x12f9,0x12f9,0x12f9,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1383,0x1380,0x1449,0x1560, -0x1560,0x1560,0x17fa,0x196e,0x1560,0x1560,0x1749,0x1749,0x1749,0x1743,0x1749,0x1743,0x1971,0x196e,0x1a2b,0x1a28, -0x1a2b,0x1a28,0x1a2b,0x1a28,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7, -0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7,0x13a7, -0x13a7,0x13a7,0x13a7,0x13a7,0x13bc,0x13ad,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x1230,0x122d,0x122d,0x122d,0x1239,0x1239,0x1239,0x1239, +0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239, +0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1239,0x1248,0x1248,0x1248,0x1248, +0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248, +0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x1248,0x124e,0x124e,0x125a,0x125d, +0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d, +0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x1260,0x125d,0x1260,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d, +0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x125d,0x1260,0x125d,0x125d,0x125d,0x125d,0x125a,0x125a,0x125a,0x124e, +0x124e,0x124e,0x124e,0x125a,0x125a,0x1254,0x1251,0x1257,0x1257,0x1266,0x1263,0x1263,0x1269,0x1269,0x1269,0x1269, +0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269, +0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x126f,0x126f,0x126f,0x126c, +0x126c,0x126c,0x1269,0x1269,0x1269,0x1269,0x126c,0x1269,0x1269,0x1269,0x126f,0x126c,0x126f,0x126c,0x1269,0x1269, +0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269, +0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x126f,0x126c,0x126c,0x1269,0x1269,0x1269,0x1269, +0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1269,0x1be1,0x1a07,0x1a07,0x1a07,0x1a07, +0x1a07,0x1a07,0x1a07,0x1a0a,0x1a04,0x1bf3,0x1bf3,0x1bf3,0x1bf6,0x1bf0,0x1bf6,0x1bf0,0x128a,0x128a,0x128a,0x128a, +0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128d,0x128d,0x128d,0x1272,0x1938,0x1398,0x1296,0x1398,0x1398, +0x1398,0x1398,0x1398,0x1398,0x1398,0x1398,0x1398,0x1398,0x1398,0x1296,0x1398,0x1296,0x127b,0x127b,0x1323,0x1278, +0x1323,0x1323,0x1323,0x1323,0x1278,0x1278,0x129c,0x1278,0x1278,0x1278,0x1278,0x1278,0x1278,0x127b,0x129c,0x129c, +0x127b,0x129c,0x1278,0x127b,0x127b,0x127e,0x129c,0x1278,0x1278,0x129c,0x127b,0x127b,0x1395,0x1395,0x1395,0x1395, +0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1287,0x1287,0x1287,0x1287,0x13ad,0x138f,0x1290,0x13ad,0x13ad,0x13ad, +0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x1836,0x1836,0x1836,0x1836,0x1836,0x128a,0x128a,0x128a,0x128a, +0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x1539,0x1539,0x1a88,0x1a88,0x1a88,0x128a,0x128a,0x128a,0x128a, +0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x128a,0x1398,0x1398,0x1296,0x1398, +0x1398,0x1398,0x1296,0x1398,0x1398,0x1398,0x1290,0x1290,0x1290,0x1290,0x1290,0x1392,0x1395,0x1395,0x1395,0x1395, +0x1395,0x1395,0x1395,0x1293,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1293,0x1395,0x1395,0x1395,0x1395, +0x1395,0x1395,0x1395,0x1395,0x1395,0x1395,0x1416,0x1416,0x19e6,0x1a88,0x1a88,0x1a88,0x1395,0x1395,0x1395,0x1395, +0x1395,0x1395,0x1395,0x1395,0x1395,0x1293,0x1395,0x1293,0x1293,0x1395,0x1395,0x1293,0x12b7,0x12b7,0x12b7,0x12b7, +0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7, +0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x12b7,0x1341,0x133e,0x1341,0x133e, +0x1341,0x133e,0x1341,0x133e,0x1341,0x133e,0x1404,0x1518,0x1518,0x1518,0x17b2,0x1926,0x1518,0x1518,0x16fe,0x16fe, +0x16fe,0x16f8,0x16fe,0x16f8,0x1929,0x1926,0x19e3,0x19e0,0x19e3,0x19e0,0x19e3,0x19e0,0x1365,0x1365,0x1365,0x1365, +0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365, +0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x1365,0x137a,0x136b,0x137a,0x1380, +0x1380,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d, +0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x137d,0x136b,0x136b,0x136b,0x136b, +0x136b,0x136b,0x136b,0x136b,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386, +0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386,0x1386, +0x1386,0x1386,0x1386,0x1386,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c,0x138c, +0x138c,0x138c,0x138c,0x138c,0x13b6,0x13b3,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db, +0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db, +0x18db,0x18db,0x18db,0x18db,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bc,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bc,0x13bf,0x13bf,0x13bf,0x13bc,0x13bf,0x13bc,0x13bf,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13c2,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bc,0x13bf,0x13bc,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc, +0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x13bc,0x1542,0x1542, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, 0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, -0x13bf,0x13bf,0x13bf,0x13bf,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13ad,0x13c5,0x13c5,0x13c5,0x13c5, -0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5, -0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13cb,0x13cb,0x13cb,0x13cb, +0x13bf,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1788,0x1788,0x1788, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x1545,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x1545,0x1788,0x1788,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13c2,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1542,0x1542,0x1545,0x1545,0x13bf,0x13bf,0x13c2,0x13c2,0x13c2,0x16b3,0x13bf,0x13c2, +0x13bf,0x13bf,0x13c2,0x1548,0x1548,0x1545,0x1545,0x1788,0x1788,0x1788,0x1788,0x1788,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x1545,0x1545,0x1545,0x16b3,0x1545,0x1545,0x1545, +0x1788,0x1788,0x1788,0x178b,0x178b,0x178b,0x178b,0x178b,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x1545,0x13bf,0x1545,0x13c2,0x13c2,0x13bf,0x13bf,0x13c2,0x13c2, +0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2, +0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13c2,0x13bf,0x13bf,0x13bf, +0x13c2,0x13bf,0x13bf,0x13bf,0x13bf,0x13c2,0x13c2,0x13c2,0x13bf,0x13c2,0x13c2,0x13c2,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13c2,0x13bf,0x13c2,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x16b3,0x13bf,0x13bf,0x13bf,0x13bf,0x1545,0x1545,0x1788,0x1419,0x1419,0x1419,0x1419,0x1542,0x1542,0x1542,0x1542, +0x1542,0x1542,0x1545,0x1788,0x1788,0x1788,0x1788,0x170d,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf, +0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1548,0x1548,0x1545,0x1545,0x1545,0x1545,0x183f,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1545,0x13bf,0x13bf,0x13bf,0x13bf,0x13bf,0x14a3,0x13c5,0x13c5,0x13c5, +0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x14a3,0x13c5,0x13c5, +0x13c5,0x14a3,0x13c5,0x14a3,0x13c5,0x14a3,0x13c5,0x14a3,0x13c5,0x13c5,0x13c5,0x14a3,0x13c5,0x13c5,0x13c5,0x13c5, +0x13c5,0x13c5,0x14a3,0x14a3,0x13c5,0x13c5,0x13c5,0x13c5,0x14a3,0x13c5,0x14a3,0x14a3,0x13c5,0x13c5,0x13c5,0x13c5, +0x14a3,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x13c5,0x16b9,0x16b9,0x178e, +0x178e,0x13c8,0x13c8,0x13c8,0x13c5,0x13c5,0x13c5,0x13c8,0x13c8,0x13c8,0x13c8,0x13c8,0x1638,0x1638,0x1638,0x1638, +0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x13cb,0x13cb,0x13cb,0x13cb, 0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb, -0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13fb,0x13f8,0x1923,0x1923, -0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923, -0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1404, -0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1401,0x1404,0x1401,0x1401,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401, -0x1401,0x1401,0x1401,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1401,0x1401,0x1401,0x1401,0x1401,0x1401, -0x1401,0x1401,0x1401,0x1401,0x1401,0x1401,0x158a,0x158a,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x1590,0x1596,0x1596,0x1596,0x1596, -0x1596,0x1596,0x1596,0x1596,0x1596,0x17d0,0x17d0,0x17d0,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596,0x17d0,0x17d0, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1590,0x1590,0x1596,0x1596,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x1596,0x1596, -0x1404,0x1404,0x1407,0x1407,0x1407,0x1701,0x1404,0x1407,0x1404,0x1404,0x1407,0x1599,0x1599,0x1596,0x1596,0x17d0, -0x17d0,0x17d0,0x17d0,0x17d0,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596,0x1596, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1590,0x1590,0x1596,0x1701,0x1596,0x1590,0x1596,0x17d0,0x17d0,0x17d0,0x17d3,0x17d3,0x17d3,0x17d3,0x17d3, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1596, -0x1404,0x1596,0x1407,0x1407,0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407, -0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407,0x1407, -0x1407,0x1407,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1407,0x1404,0x1404,0x1404,0x1404,0x1407,0x1407,0x1407, -0x1404,0x1407,0x1407,0x1407,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1407,0x1404,0x1407,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1701,0x1404,0x1404,0x1404,0x1404,0x1596,0x1590,0x17d0, -0x145e,0x145e,0x145e,0x145e,0x158a,0x158a,0x158d,0x158d,0x158d,0x1593,0x1596,0x17d0,0x17d0,0x17d0,0x17d0,0x1758, -0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404,0x1404, -0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1596,0x1599,0x1599,0x1596,0x1596, -0x1596,0x1596,0x1887,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1596,0x1590,0x1590,0x1590,0x1590, -0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590,0x1596,0x158d,0x158d,0x158d,0x158d, -0x158d,0x158d,0x1596,0x1404,0x1404,0x1404,0x1404,0x1404,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a, -0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8, -0x140a,0x14e8,0x140a,0x14e8,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x14e8,0x14e8, -0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x14e8,0x14e8,0x140a,0x140a,0x140a,0x140a,0x14e8,0x140a,0x140a,0x140a, -0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x140a,0x1707,0x1707,0x17d6,0x17d6,0x140d,0x140d,0x140d, -0x140a,0x140a,0x140a,0x140d,0x140d,0x140d,0x140d,0x140d,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686, -0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410, -0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410, -0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1410,0x1410,0x1410,0x1410, -0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1413,0x1413,0x1413,0x1410, -0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1410,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416, -0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416, -0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1416,0x1803,0x1803,0x1800,0x175b,0x1464,0x1464,0x1464,0x1464, -0x1464,0x1464,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464, -0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x1464,0x15a2,0x1470,0x1470,0x1470,0x1482,0x1482,0x1482,0x1482,0x1482, -0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482, -0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x1482,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d, -0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d, -0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x149d,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3, -0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3, -0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x14a3,0x1a34,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6, -0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6, -0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14a6,0x14ac,0x14ac,0x14b8,0x14be,0x14be,0x14be,0x14be,0x14be, -0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be, -0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14be,0x14b8,0x14b8,0x14b8,0x14ac,0x14ac, -0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14ac,0x14b8,0x14bb,0x14be,0x14c1,0x14c1,0x14be,0x14c4,0x14c4,0x14af, -0x14b2,0x1764,0x1767,0x1767,0x1767,0x15ab,0x1adc,0x1ad9,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5,0x14b5, -0x14b5,0x14b5,0x15a8,0x176d,0x1770,0x176a,0x1773,0x1773,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df, -0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df, -0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x14df,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, -0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, -0x153c,0x153c,0x1956,0x1956,0x1956,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c, -0x153c,0x1a22,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x153c,0x18ba,0x1956,0x1956,0x1956,0x1956,0x1956, -0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1590,0x1590,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590, -0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1596,0x158d,0x158d,0x158d,0x158d, -0x158d,0x158d,0x158d,0x158d,0x1596,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1596, -0x1590,0x1590,0x1596,0x1596,0x1596,0x1596,0x1590,0x1590,0x1599,0x1590,0x1590,0x1590,0x1590,0x1704,0x1704,0x1590, -0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1884,0x1596,0x1590,0x1590,0x1596,0x1590,0x1590,0x1590, -0x1590,0x1590,0x1590,0x1590,0x1590,0x1596,0x1596,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590,0x1590, -0x1596,0x1590,0x1590,0x1590,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba, -0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba,0x15ba, -0x15ba,0x15ba,0x15ba,0x15ba,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc, -0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc,0x15cc, -0x15cc,0x15cc,0x15cc,0x15cc,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2, -0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2,0x15d2, +0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13ce, +0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb, +0x13ce,0x13ce,0x13ce,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13cb,0x13d1,0x13d1,0x13d1,0x13d1, +0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1, +0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x13d1,0x17bb,0x17bb,0x17b8,0x1710, +0x141f,0x141f,0x141f,0x141f,0x141f,0x141f,0x141c,0x141c,0x141c,0x141c,0x141c,0x141c,0x141f,0x141f,0x141f,0x141f, +0x141f,0x141f,0x141f,0x141f,0x141f,0x141f,0x141f,0x141f,0x141f,0x141f,0x141f,0x154e,0x1422,0x1551,0x1422,0x1422, +0x1422,0x1422,0x1422,0x1422,0x1422,0x1422,0x1422,0x1422,0x1422,0x1551,0x1551,0x1551,0x1551,0x1551,0x1551,0x1713, +0x1713,0x1b5d,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x1a8b,0x1a8b,0x142b,0x142b,0x142b,0x143d, +0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d, +0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x143d,0x1458,0x1458,0x1458,0x1458, +0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458, +0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x1458,0x145e,0x145e,0x145e,0x145e, +0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e, +0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x145e,0x19ec,0x1461,0x1461,0x1461,0x1461, +0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461, +0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1461,0x1467,0x1467,0x1473,0x1479, +0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479, +0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1479,0x1473, +0x1473,0x1473,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1467,0x1473,0x1476,0x1479,0x147c,0x147c, +0x1479,0x147f,0x147f,0x146a,0x146d,0x1719,0x171c,0x171c,0x171c,0x1557,0x1a94,0x1a91,0x1470,0x1470,0x1470,0x1470, +0x1470,0x1470,0x1470,0x1470,0x1470,0x1470,0x1554,0x1722,0x1725,0x171f,0x1728,0x1728,0x149a,0x149a,0x149a,0x149a, +0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a, +0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x149a,0x14f4,0x14f4,0x14f4,0x14f4, +0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4, +0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x190e,0x190e,0x190e,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4, +0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x19da,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x14f4,0x1872,0x190e, +0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1542,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1548,0x1545,0x1545,0x1545,0x1545,0x16b6,0x16b6,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x183c,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545,0x1545, +0x1545,0x1545,0x1545,0x1545,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566, +0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566,0x1566, +0x1566,0x1566,0x1566,0x1566,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578, +0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578,0x1578, +0x1578,0x1578,0x1578,0x1578,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e, +0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e,0x157e, +0x157e,0x157e,0x157e,0x157e,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581, +0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581,0x1581, +0x1581,0x1581,0x1581,0x1581,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1,0x15b1, +0x15ab,0x15ab,0x15ab,0x159f,0x159f,0x159f,0x15ab,0x15ab,0x159f,0x15ae,0x15a2,0x159f,0x15b4,0x15b4,0x15a8,0x15b4, +0x15b4,0x15a5,0x17c4,0x1bed,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6, +0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6,0x15c6, +0x15c6,0x15c6,0x15c6,0x15b7,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf, +0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15cf,0x15c9, 0x15d2,0x15d2,0x15d2,0x15d2,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, 0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5,0x15d5, -0x15d5,0x15d5,0x15d5,0x15d5,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614, -0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614,0x1614, -0x1614,0x1614,0x1614,0x1605,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d, -0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x1617, -0x1620,0x1620,0x1620,0x1620,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, -0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623,0x1623, -0x1623,0x1623,0x1623,0x1623,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x1635,0x163e,0x163e,0x163e, -0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e,0x163e, -0x163e,0x163e,0x163e,0x163e,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647, -0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647,0x1647, -0x1647,0x1647,0x1647,0x1647,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659, -0x1659,0x1659,0x1659,0x1659,0x1656,0x1656,0x1656,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x164a,0x1656, -0x1656,0x164a,0x1656,0x164d,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659, -0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659, -0x1659,0x1659,0x1659,0x1659,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d, -0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d,0x167d, -0x167d,0x167a,0x167a,0x167a,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686, -0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x1686,0x168c,0x168c,0x168c,0x1689,0x1689,0x1689, -0x1686,0x1686,0x1686,0x1686,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, -0x169b,0x169b,0x169b,0x169b,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x168f,0x16a1,0x16a1,0x1695,0x1692,0x1692, -0x1692,0x1692,0x1692,0x1692,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, -0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b,0x169b, -0x169b,0x169b,0x169b,0x169b,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7, -0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a7,0x16a4,0x16a4,0x16a4,0x16a4,0x16a4, -0x16a4,0x16a4,0x16a4,0x16a4,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa, +0x15d5,0x15d5,0x15d5,0x15d5,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15e7,0x15f0,0x15f0,0x15f0, +0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0,0x15f0, +0x15f0,0x15f0,0x15f0,0x15f0,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9, +0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9,0x15f9, +0x15f9,0x15f9,0x15f9,0x15f9,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b, +0x160b,0x160b,0x160b,0x160b,0x1608,0x1608,0x1608,0x15fc,0x15fc,0x15fc,0x15fc,0x15fc,0x15fc,0x15fc,0x15fc,0x1608, +0x1608,0x15fc,0x1608,0x15ff,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b, +0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b,0x160b, +0x160b,0x160b,0x160b,0x160b,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f, +0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f,0x162f, +0x162f,0x162c,0x162c,0x162c,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638, +0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x1638,0x163e,0x163e,0x163e,0x163b,0x163b,0x163b, +0x1638,0x1638,0x1638,0x1638,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d, +0x164d,0x164d,0x164d,0x164d,0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1641,0x1653,0x1653,0x1647,0x1644,0x1644, +0x1644,0x1644,0x1644,0x1644,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d, +0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d,0x164d, +0x164d,0x164d,0x164d,0x164d,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659, +0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1659,0x1656,0x1656,0x1656,0x1656,0x1656, +0x1656,0x1656,0x1656,0x1656,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c, +0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c,0x165c, +0x165c,0x165c,0x165c,0x165c,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680, +0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680,0x1680, +0x1680,0x1680,0x1680,0x1680,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689, +0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689,0x1689, +0x1689,0x1689,0x1689,0x1689,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1, +0x16a1,0x16a1,0x16a1,0x16a1,0x168c,0x169b,0x169b,0x168c,0x168c,0x168c,0x168c,0x168c,0x168c,0x169b,0x168c,0x169e, +0x169e,0x168c,0x169e,0x168c,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1, +0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1,0x16a1, +0x16a1,0x16a1,0x16a1,0x16a1,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa, 0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa,0x16aa, -0x16aa,0x16aa,0x16aa,0x16aa,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce, -0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce,0x16ce, -0x16ce,0x16ce,0x16ce,0x16ce,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, -0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7,0x16d7, -0x16d7,0x16d7,0x16d7,0x16d7,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef, -0x16ef,0x16ef,0x16ef,0x16ef,0x16da,0x16e9,0x16e9,0x16da,0x16da,0x16da,0x16da,0x16da,0x16da,0x16e9,0x16da,0x16ec, -0x16ec,0x16da,0x16ec,0x16da,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef, -0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef,0x16ef, -0x16ef,0x16ef,0x16ef,0x16ef,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8, -0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8,0x16f8, -0x16f8,0x16f8,0x16f8,0x16f8,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe, -0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe,0x16fe, -0x16fe,0x16fe,0x16fe,0x16fe,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956, -0x1740,0x1740,0x1740,0x1740,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956,0x1956, -0x1956,0x1956,0x1956,0x1a22,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761, +0x16aa,0x16aa,0x16aa,0x16aa,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0, +0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0,0x16b0, +0x16b0,0x16b0,0x16b0,0x16b0,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e, +0x16f5,0x16f5,0x16f5,0x16f5,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e,0x190e, +0x190e,0x190e,0x190e,0x19da,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716, +0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716,0x1716, +0x1716,0x1716,0x1716,0x1716,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755, +0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755, +0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x175b,0x1758,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755, +0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x1755,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e, +0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e, +0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x175e,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761, 0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761, -0x1761,0x1761,0x1761,0x1761,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d, -0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d, -0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a3,0x17a0,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d, -0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x179d,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6, -0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6, -0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a6,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9, -0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9, -0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17a9,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb, -0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb, -0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17bb,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be, -0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be, -0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1, -0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1, -0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1, -0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c1,0x17c4,0x17c4,0x17c4, -0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c1,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4, -0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4, -0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17c4,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc, +0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1761,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773, +0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773, +0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1773,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776, +0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776, +0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1776,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779, +0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779, +0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x177c,0x177c,0x177c,0x177c,0x1779, +0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x1779,0x177c,0x177c,0x177c, +0x177c,0x177c,0x177c,0x177c,0x177c,0x1779,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c, +0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c, +0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x177c,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794, +0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794, +0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x1794,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e,0x187e, +0x187e,0x187e,0x187e,0x187e,0x1af7,0x1a4c,0x1a4c,0x1a4f,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797,0x1797, +0x179a,0x1848,0x1848,0x1848,0x1848,0x1848,0x1848,0x18e4,0x1797,0x1797,0x1797,0x1797,0x1797,0x1845,0x1845,0x1845, +0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1, +0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x1797,0x19c5,0x19c5,0x1a4c,0x1a4c,0x1a4c,0x1a4c,0x1a4c, +0x1a4c,0x1a4c,0x1a4c,0x1af4,0x1bc6,0x1a4f,0x1a4f,0x1a4f,0x18e1,0x18e4,0x18e4,0x18e4,0x18e4,0x18e4,0x18e4,0x18e4, +0x18e4,0x18e4,0x18e4,0x18e4,0x18e4,0x18e4,0x18e1,0x18e1,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b, +0x1b5d,0x1b60,0x1b5a,0x1b5a,0x1b5a,0x1b5a,0x1b5a,0x1b5a,0x1b5a,0x1b5a,0x1b5a,0x193b,0x17be,0x17be,0x17be,0x17be, +0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x17be,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1848,0x1845, +0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x1848,0x18e4,0x18e4,0x1848,0x1848,0x1848,0x1848,0x1848, +0x1848,0x1848,0x1845,0x17c7,0x1848,0x1848,0x1848,0x1a4c,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x17c7,0x1845, +0x1845,0x1845,0x1845,0x1845,0x18e1,0x19c5,0x19c5,0x19c5,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845, +0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x1845,0x18e1,0x17dc,0x17dc,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9, +0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9, +0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17d9,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc, 0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc, -0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6,0x18c6, -0x18c6,0x18c6,0x18c6,0x18c6,0x1b3f,0x1a94,0x1a94,0x1a97,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df,0x17df, -0x17e2,0x1890,0x1890,0x1890,0x1890,0x1890,0x1890,0x192c,0x17df,0x17df,0x17df,0x17df,0x17df,0x188d,0x188d,0x188d, -0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929, -0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1890,0x188d, -0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1890,0x192c,0x192c,0x1890,0x1890,0x1890,0x1890,0x1890, -0x1890,0x1890,0x188d,0x180f,0x1890,0x1890,0x1890,0x1a94,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x180f,0x188d, -0x188d,0x188d,0x188d,0x188d,0x1929,0x1a0a,0x1a0a,0x1a0a,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d, -0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x188d,0x1929,0x1824,0x1824,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821, -0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821, -0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1821,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824, -0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824, -0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1824,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872, -0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x186f,0x186f,0x186f, -0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x185a,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872, -0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872, -0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1872,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896, -0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896, -0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1896,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899, -0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899, -0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1899,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48, -0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x1b48,0x18f0,0x18f0,0x18f0,0x18f0,0x1a46,0x1a46,0x18f3,0x18f3, -0x18f3,0x18f3,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18ed, -0x18de,0x18e1,0x18e4,0x18f6,0x18f6,0x1995,0x18e7,0x18e7,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, -0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, -0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911, -0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x18fc,0x1902,0x18ff,0x18ff,0x18ff, -0x18ff,0x190e,0x1914,0x18ff,0x18ff,0x18ff,0x18ff,0x190b,0x1911,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff,0x18ff, -0x18ff,0x18ff,0x18ff,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911, -0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1911,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923, -0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923, -0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1923,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1929,0x1a0a, -0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a, -0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1a0a,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932, -0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932, -0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1932,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, -0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938, -0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x1938,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa, -0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa, -0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19aa,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5, +0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x17dc,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a, +0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x1827,0x1827,0x1827, +0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a, +0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a, +0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x182a,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e, +0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e, +0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x184e,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851, +0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851, +0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1851,0x1b00,0x1b00,0x1b00,0x1b00,0x1b00, +0x1b00,0x1b00,0x1b00,0x1b00,0x1b00,0x1b00,0x1b00,0x1b00,0x18a8,0x18a8,0x18a8,0x18a8,0x19fe,0x19fe,0x18ab,0x18ab, +0x18ab,0x18ab,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x1893,0x18a5, +0x1896,0x1899,0x189c,0x18ae,0x18ae,0x194d,0x189f,0x189f,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8, +0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8, +0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18a8,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9, +0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18b4,0x18ba,0x18b7,0x18b7,0x18b7, +0x18b7,0x18c6,0x18cc,0x18b7,0x18b7,0x18b7,0x18b7,0x18c3,0x18c9,0x18b7,0x18b7,0x18b7,0x18b7,0x18b7,0x18b7,0x18b7, +0x18b7,0x18b7,0x18b7,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9, +0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18c9,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5,0x18d5, +0x18d5,0x18d5,0x18d5,0x19bf,0x19bf,0x19bf,0x19bf,0x19bf,0x1aeb,0x1aeb,0x1aeb,0x1aeb,0x1aeb,0x1aeb,0x1aeb,0x1aeb, +0x1aeb,0x1aeb,0x1aeb,0x1aeb,0x1aeb,0x1bb7,0x1bb7,0x1bb7,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db, +0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db, +0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18db,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1, +0x18e1,0x18e1,0x18e1,0x18e1,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x1a4c,0x1af4,0x19c5,0x19c5,0x19c5,0x19c5,0x1af7, +0x1af4,0x1bc6,0x19c5,0x1a4c,0x19c5,0x19c5,0x19c5,0x19c5,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x18e1,0x19c5, 0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5, -0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb, -0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb, -0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19cb,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6, -0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6, -0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e6,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9, -0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9, -0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19e9,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2, -0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19f2, -0x19f2,0x19f2,0x19f2,0x19f2,0x19f2,0x19ef,0x19ef,0x19ef,0x1a0a,0x1a0a,0x1a0a,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a94, -0x1a94,0x1a94,0x1a94,0x1b3c,0x1b3c,0x1b3c,0x1a94,0x1a94,0x1a0d,0x1a0d,0x1a0d,0x1a0d,0x1a0a,0x1a10,0x1a10,0x1a0a, -0x1a10,0x1a10,0x1a94,0x1a97,0x1a94,0x1a94,0x1a94,0x1a94,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49, -0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49, -0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a49,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70, -0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70, -0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a70,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79, -0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1aaf,0x1aaf,0x1a79,0x1aaf,0x1a79,0x1a79,0x1a79,0x1a79, -0x1a79,0x1a79,0x1a79,0x1a79,0x1a79,0x1a7f,0x1a7f,0x1a7f,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b, -0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b, -0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1a8b,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, -0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e, -0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b1e,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a, -0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a, -0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b2a,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e, -0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e, -0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b4e,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51, -0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51, -0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0x1b51,0,0,0,0 +0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea, +0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea, +0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ea,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed, +0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed, +0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x18ed,0x1bc9,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, +0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0, +0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x18f0,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962, +0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962, +0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x1962,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d, +0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d, +0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x197d,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983, +0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983, +0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x1983,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1, +0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1, +0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a1,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4, +0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4, +0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19a4,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, +0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19ad, +0x19ad,0x19ad,0x19ad,0x19ad,0x19ad,0x19aa,0x19aa,0x19aa,0x19c5,0x19c5,0x19c5,0x1af4,0x1af4,0x1a4c,0x1a4c,0x1a4c, +0x1a4c,0x1a4c,0x1a4c,0x1af4,0x1af4,0x1af4,0x1a4c,0x1a4c,0x19c5,0x19c5,0x19c5,0x19c5,0x19c5,0x19c8,0x19c8,0x19c5, +0x19c8,0x19c8,0x1a4c,0x1a4f,0x1a4c,0x1a4c,0x1a4c,0x1a4c,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01, +0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01, +0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a01,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28, +0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28, +0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a28,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31, +0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a67,0x1a67,0x1a31,0x1a67,0x1a31,0x1a31,0x1a31,0x1a31, +0x1a31,0x1a31,0x1a31,0x1a31,0x1a31,0x1a37,0x1a37,0x1a37,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43, +0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43, +0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1a43,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6, +0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6, +0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ad6,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2, +0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2, +0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1ae2,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06, +0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06, +0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b06,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09, +0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09, +0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b09,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e, +0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e, +0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b7e,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f, +0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f, +0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1b9f,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1, +0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1, +0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb1,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4, +0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4, +0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1bb4,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e, +0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0e,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b, +0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c0b,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d, +0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d, +0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c4d,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59, +0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59, +0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0x1c59,0,0,0,0 }; static const UTrie2 propsVectorsTrie={ propsVectorsTrie_index, - propsVectorsTrie_index+5024, - NULL, - 5024, - 26204, + propsVectorsTrie_index+5368, + nullptr, + 5368, + 27396, 0xa40, - 0x1420, + 0x1578, 0x0, 0x0, 0x110000, - 0x79f8, - NULL, 0, FALSE, FALSE, 0, NULL + 0x7ff8, + nullptr, 0, false, false, 0, nullptr }; -static const uint32_t propsVectors[6999]={ -0x67,0,0,0x67,0,0x4e00000,0x67,0x80000,0x20,0x867,0,0,0xa67,0,0,0xb67, -0,0,0xc67,0,0,0xd67,0,0,0xe67,0,0,0x1067,0,0,0x1167,0, -0,0x1267,0,0,0x1367,0,0,0x1467,0,0,0x1567,0,0,0x1667,0,0, -0x1767,0,0,0x1867,0,0,0x1967,0,0,0x1a67,0,0,0x1b67,0,0,0x1d67, -0,0,0x1f67,0,0,0x2067,0,0,0x2267,0,0,0x2367,0,0,0x2467,0, -0,0x2567,0,0,0x2767,0,0,0x2867,0x80000,0x20,0x2967,0,0,0x2a67,0,0x1600000, -0x2b67,0,0,0x2d67,0,0,0x3167,0x20000000,0,0x3267,0x20000000,0,0x3a67,0,0,0x3b67, -0,0,0x3c67,0,0,0x3e67,0,0,0x4067,0,0,0x4167,0,0,0x4467,0, -0,0x4867,0,0,0x4967,0,0,0x4a67,0,0,0x5067,0,0,0x5167,0,0, -0x5467,0,0,0x5567,0,0,0x5667,0x80000,0x20,0x5767,0,0,0x5867,0,0,0x5967, -0,0,0x5b67,0,0,0x5c67,0,0,0x5d67,0,0,0x6067,0x80000,0x20,0x6267,0, -0,0x6367,0,0,0x6467,0,0,0x6567,0,0,0x6f67,0,0,0x7067,0,0, -0x7367,0x20000000,0,0x7567,0,0,0x7667,0,0,0x7767,0,0,0x7867,0,0,0x7a67, -0,0,0x7b67,0,0,0x7c67,0,0,0x7e67,0,0,0x7f67,0,0,0x8167,0, -0,0x8267,0,0,0x8367,0,0,0x8467,0,0,0x8567,0,0,0x8667,0,0, -0x8767,0,0,0x8867,0,0,0x8967,0,0,0x8b67,0,0,0x8c67,0,0,0x8e67, -0x20000000,0,0x8f67,0,0,0x9067,0,0,0x9167,0,0,0x9267,0,0,0x9367,0, -0,0x9567,0,0,0x9667,0,0,0x9767,0,0,0x9867,0,0,0x9967,0,0, -0x9a67,0,0,0x9c67,0,0,0x9f67,0,0,0xa167,0,0,0xa367,0,0,0xa467, -0,0,0xa567,0,0,0xa667,0,0,0xa767,0,0,0xa867,0,0,0xa967,0, -0,0xaa67,0,0x4e00000,0xab67,0,0x4e00000,0xac67,0,0,0xad67,0,0,0xae67,0,0, -0xaf67,0,0,0xb167,0,0,0xb267,0,0,0xb467,0,0,0xb567,0,0,0xb767, -0,0,0xb867,0,0,0xb967,0,0,0xba67,0,0,0xbc67,0,0,0xbd67,0, -0,0xbe67,0,0,0xbf67,0,0,0xc067,0,0,0xc167,0,0,0xc267,0,0, -0xc367,0,0x4e00000,0xc467,0,0x4e00000,0xc667,0,0,0xc767,0,0,0xc867,0,0,0xc967, -0,0,0xca67,0,0,0xcc67,0,0x4e00000,0xcf67,0,0x4e00000,0xd067,0,0x4e00000,0xd267,0, -0,0xd367,0,0,0xd467,0,0,0xd567,0,0,0xd667,0,0,0xd867,0,0, -0xda67,0,0,0xdb67,0,0,0xdc67,0,0,0xdd67,0,0,0xde67,0,0,0xdf67, -0,0,0xe067,0,0,0xe167,0,0,0xe267,0,0,0xe367,0,0x4e00000,0xe467,0, -0,0xe567,0,0,0xe667,0,0,0xe767,0,0,0xe867,0,0,0xe967,0,0, -0xea67,0,0,0xeb67,0,0,0xec67,0,0,0xed67,0,0,0xee67,0,0,0xef67, -0,0,0xf167,0,0,0xf367,0,0,0xf567,0,0,0xf667,0,0,0xf767,0, -0,0xf867,0,0,0xf967,0,0,0xfa67,0,0x4e00000,0xfb67,0,0,0xfc67,0,0, -0xfd67,0,0,0xfe67,0,0,0x10167,0,0,0x10267,0,0,0x10367,0,0,0x10467, -0,0,0x10567,0,0x4e00000,0x10667,0,0,0x10767,0,0,0x10867,0,0,0x10967,0, -0,0x10a67,0,0,0x10b67,0,0,0x10c67,0,0,0x10d67,0,0,0x10e67,0,0, -0x10f67,0,0,0x11067,0,0,0x11367,0,0,0x11467,0,0,0x11567,0,0,0x11667, -0,0,0x11767,0,0,0x11867,0,0,0x11967,0,0x4e00000,0x11a67,0,0,0x11b67,0, -0,0x11c67,0,0,0x11d67,0,0,0x11e67,0,0,0x11f67,0,0,0x12067,0,0, -0x12167,0,0,0x12267,0,0,0x12367,0,0,0x12467,0,0,0x12567,0,0,0x12667, -0,0,0x12767,0,0,0x12867,0,0,0x12967,0,0,0x12a67,0,0x4e00000,0x12b67,0, -0,0x12c67,0,0,0x12d67,0,0,0x12f67,0,0,0x13067,0,0,0x13167,0,0, -0x13267,0,0,0x13367,0,0,0x13467,0,0,0xa0067,0,0xe00000,0xa4767,0,0xe00000,0xa4f67, -0,0xe00000,0xa5e67,0,0xe00000,0xa5f67,0,0xe00000,0xac567,0,0xe00000,0xad167,0,0xe00000,0xb0067,0, -0xe00000,0xb1267,0,0xe00000,0xb2e67,0,0xe00000,0x11000100,0,0x900020,0x11000100,0x40000001,0x440020,0x11000100,0x40000001,0x643020, -0x11000100,0x40000001,0xa5a040,0x11000100,0x40000001,0x116a8a0,0x11000200,0,0x900020,0x11000200,0x4000001,0xc4000b,0x11000200,0x7c00100,0x220402,0x11000200, -0x24000000,0x14200000,0x11000200,0x24000008,0x1710000,0x11000200,0x40000001,0x1d3b020,0x11000219,0x7c00100,0x220401,0x11000219,0x7c00100,0x250401,0x11000319,0x7c00100, -0x220401,0x11000319,0x7c00100,0x220402,0x11000319,0x7c00100,0x250400,0x11000319,0x7c00100,0x250401,0x11000419,0x7c00100,0x220400,0x11000419,0x7c00100,0x220401, -0x11000419,0x7c00100,0x220402,0x11000419,0x7c00100,0x230400,0x11000419,0x7c00100,0x250400,0x11000419,0x7c00100,0x250401,0x11000419,0x7c00100,0x250402,0x11000519, -0x7c00100,0x220400,0x11000519,0x7c00100,0x230400,0x11000600,0x4000400,0x200002,0x11000600,0x4000400,0x200400,0x11000600,0x7c00500,0x220400,0x11000600,0x7c00500, -0x230400,0x11000600,0x7c00500,0x530400,0x11000600,0x7c00d00,0x230400,0x11000619,0x7c00500,0x22040f,0x11000800,0x4000010,0x1001401,0x11000800,0x4000400,0x200001, -0x11000800,0x6800010,0x201001,0x11000800,0x7c00500,0x230401,0x11000807,0x7c00100,0x220400,0x11000807,0x7c00100,0x250400,0x1100080e,0x4000400,0x200000,0x1100080e, -0x4000400,0x200002,0x1100080e,0x7000500,0x220402,0x1100080e,0x7c00100,0x220400,0x1100080e,0x7c00100,0x220401,0x1100080e,0x7c00100,0x220402,0x1100080e,0x7c00100, -0x250400,0x1100080e,0x7c00100,0x250401,0x1100080e,0x7c00120,0x220402,0x1100080e,0x7c00120,0x250402,0x11000908,0x4000000,0x200000,0x11000908,0x7c00100,0x220400, -0x11000908,0x7c00100,0x220401,0x11000908,0x7c00100,0x250400,0x11000908,0x7c00100,0x250401,0x11000a03,0x4000000,0x200400,0x11000a03,0x4000000,0x201000,0x11000a03, -0x4000000,0x270000,0x11000a03,0x7c00100,0x220400,0x11000a03,0x7c00100,0x220402,0x11000a03,0x7c00100,0x250400,0x11000a03,0x7c00500,0x230400,0x11000a03,0xc000010, -0x1049400,0x11000b13,0x2802500,0x962460,0x11000b13,0x4000000,0x200000,0x11000b13,0x4000000,0x201000,0x11000b13,0x4000000,0x230400,0x11000b13,0x4000002,0x400000, -0x11000b13,0x4000010,0x200000,0x11000b13,0x7c00100,0x2633800,0x11000c00,0x80000000,0x218960,0x11000c02,0x2802100,0x962460,0x11000c02,0x2802400,0x962460,0x11000c02, -0x4000000,0x200000,0x11000c02,0x4000000,0x1329400,0x11000c02,0x4000000,0x1329800,0x11000c02,0x4000000,0x1500000,0x11000c02,0x6800000,0x1329800,0x11000c02,0x7c00100, -0x230400,0x11000c02,0x7c00100,0x230401,0x11000c02,0x7c00100,0x230402,0x11000c02,0x7c00500,0x230400,0x11000c02,0x7d00100,0x230400,0x11000f01,0x2802400,0x962460, -0x11000f0a,0x2802100,0x962460,0x11000f0a,0x2802400,0x962460,0x11000f0a,0x2806400,0x962460,0x11000f0a,0x4000000,0x200000,0x11000f0a,0x6800100,0x962540,0x11000f0a, -0x7c00100,0x230400,0x11000f0a,0x7c00100,0x230401,0x11001004,0x2802100,0x962460,0x11001004,0x2802400,0x962460,0x11001004,0x2806400,0x962460,0x11001004,0x4000000, -0x200000,0x11001004,0x4000000,0x1500000,0x11001004,0x6800100,0x962540,0x11001004,0x6800100,0x962541,0x11001004,0x7c00100,0x230400,0x11001004,0x7c00100,0x230401, -0x11001110,0x2802100,0x962460,0x11001110,0x2802400,0x962460,0x11001110,0x2806400,0x962460,0x11001110,0x6800100,0x962540,0x11001110,0x7c00100,0x230400,0x11001110, -0x7c00100,0x230401,0x1100120f,0x2802100,0x962460,0x1100120f,0x2802400,0x962460,0x1100120f,0x2806400,0x962460,0x1100120f,0x6800100,0x962540,0x1100120f,0x7c00100, -0x230400,0x1100131f,0x2802100,0x962460,0x1100131f,0x2802400,0x962460,0x1100131f,0x2806400,0x962460,0x1100131f,0x4000000,0x200000,0x1100131f,0x6800000,0x1329800, -0x1100131f,0x6800100,0x962540,0x1100131f,0x6800100,0x962541,0x1100131f,0x7c00100,0x230400,0x1100131f,0x7c00100,0x230401,0x11001423,0x2802100,0x962460,0x11001423, -0x2806400,0x962460,0x11001423,0x6800100,0x962540,0x11001423,0x6800100,0x962541,0x11001423,0x7c00100,0x230400,0x11001423,0x7c00100,0x230401,0x11001524,0x2802100, -0x962460,0x11001524,0x2802100,0x962461,0x11001524,0x2806400,0x962460,0x11001524,0x6800000,0x1329800,0x11001524,0x6800100,0x962540,0x11001524,0x7c00100,0x230400, -0x11001615,0x2802100,0x962460,0x11001615,0x2806400,0x962460,0x11001615,0x6800100,0x962540,0x11001615,0x6800100,0x962541,0x11001615,0x7c00100,0x230400,0x1100171a, -0x2802100,0x962460,0x1100171a,0x2806400,0x962460,0x1100171a,0x6800000,0x1329800,0x1100171a,0x6800100,0x962540,0x1100171a,0x6800100,0x962541,0x1100171a,0x7c00100, -0x230400,0x11001900,0x4000000,0x1600000,0x11001926,0x2802100,0x1862460,0x11001926,0x2802400,0x1862460,0x11001926,0x2806100,0x1862460,0x11001926,0x4000000,0x200000, -0x11001926,0x4000010,0x400000,0x11001926,0x6800000,0x1329800,0x11001926,0x7800100,0x1830142,0x11001926,0x7c00100,0x1830000,0x11001926,0x7c00900,0x1830000,0x11001926, -0x7e00100,0x1830000,0x11001a18,0x2802100,0x1862460,0x11001a18,0x2802400,0x1862460,0x11001a18,0x6800000,0x1329800,0x11001a18,0x7800100,0x1830142,0x11001a18,0x7c00100, -0x1830000,0x11001a18,0x7c00100,0x1830002,0x11001a18,0x7c00900,0x1830000,0x11001a18,0x7e00100,0x1830000,0x11001d0c,0x7c00100,0x230400,0x11001d0c,0x7c00100,0x250400, -0x11001e12,0x7c00100,0x2230500,0x11001e12,0x7c00100,0x2330520,0x11001e12,0x7c80100,0x2330520,0x11002619,0x7c00100,0x220401,0x11002619,0x7c00100,0x220402,0x11002619, -0x7c00100,0x250401,0x1100270e,0x4000400,0x200001,0x1100270e,0x4000400,0x200002,0x1100270e,0x4000400,0x500001,0x1100270e,0x7c00100,0x220401,0x1100270e,0x7c00100, -0x250401,0x11002800,0x80000,0x918820,0x11002800,0x80000,0x1c18020,0x11002800,0x180000,0x918820,0x11002800,0x4000001,0x445801,0x11002800,0x4000001,0x445802, -0x11002800,0x4000001,0xc4000b,0x11002800,0x6800000,0x201c00,0x11002800,0x6800020,0x201c00,0x11002800,0x24000000,0x200000,0x11002800,0x24000000,0x200002,0x11002800, -0x24000000,0x810000,0x11002800,0x24000000,0x1410000,0x11002800,0x24000000,0x1500000,0x11002800,0x24000000,0x1500002,0x11002800,0x24000002,0x400000,0x11002800,0x24000006, -0xc0000b,0x11002800,0x24000008,0x1410000,0x11002800,0x24000008,0x1710000,0x11002800,0x24000020,0x1001400,0x11002800,0x24000020,0x1500002,0x11002800,0x2c000010,0x1248000, -0x11002800,0x2c000010,0x15248002,0x11002800,0x40000001,0x63b020,0x11002800,0x40080000,0x918820,0x11002801,0x80000,0xaa65620,0x11002801,0x82000,0x962460,0x11002900, -0x4000000,0x20000e,0x11002900,0x4000000,0x20000f,0x11002900,0x4000020,0x20000e,0x11002900,0x4000020,0x20000f,0x11002900,0x4000020,0x81000e,0x11002900,0x4000020, -0x81000f,0x11002900,0x4000020,0x141000e,0x11002900,0x4000020,0x141000f,0x11002900,0x4000022,0x20000e,0x11002900,0x4000022,0x20000f,0x11002a00,0x4000000,0x1500000, -0x11002a00,0x4000000,0x1600000,0x11002a00,0x4000000,0x1600002,0x11002b01,0x2000,0x962460,0x11002b01,0x2802020,0x962460,0x11002c00,0x4000000,0x200000,0x11002c00, -0x4000000,0x200002,0x11002c00,0x4000000,0x20000f,0x11002c00,0x4000020,0x200000,0x11002c00,0x7c00000,0x200000,0x11002c00,0x7c00020,0x200000,0x11002c00,0x7c00120, -0x220405,0x11002c00,0x7c00120,0x230402,0x11002c00,0x7c00120,0x250402,0x11002c00,0x7c00120,0x250405,0x11002c19,0x7c00100,0x250400,0x11002c19,0x7c00100,0x250401, -0x11002d00,0x4000000,0x100006,0x11002d00,0x4000000,0x200006,0x11002d19,0x7c00100,0x220402,0x11002d19,0x7c00100,0x230400,0x11002d19,0x7c00100,0x250402,0x11002e00, -0x24000000,0x200000,0x11002e00,0x24000020,0x200000,0x11002e00,0x24000020,0x200001,0x11002e00,0x24000020,0x14200000,0x11002f00,0x24000020,0x200000,0x11002f00,0x24000020, -0x200001,0x11002f00,0x24000020,0x200002,0x11002f00,0x24000020,0xf00000,0x11002f00,0x24000020,0x1600000,0x11002f00,0x24000022,0x1600000,0x11003000,0x24000000,0x200000, -0x11003000,0x24000000,0x14200000,0x11003000,0x24000020,0x200000,0x11003000,0x24000020,0x810000,0x11003000,0x24000020,0x1410000,0x11003100,0x24000000,0x200000,0x11003200, -0x24000000,0x200000,0x11003300,0x4000000,0x100003,0x11003400,0x24000000,0x100000,0x11003400,0x24000000,0x200000,0x11003500,0x24000000,0x200000,0x11003600,0x24000000, -0x200000,0x11003600,0x24000000,0x14200000,0x11003600,0x24000020,0x200000,0x11003700,0x24000000,0x200000,0x11003700,0x24000000,0x4200000,0x11003700,0x24000000,0x4e00000, -0x11003700,0x24000000,0x14200000,0x11003700,0x24000000,0x14e00000,0x11003700,0x24000000,0x96800000,0x11003700,0x24000020,0x4200000,0x11003800,0x4000000,0x100000,0x11003800, -0x24000000,0x200000,0x11003800,0x24000000,0xb00000,0x11003800,0x24000000,0x1710000,0x11003800,0x24000000,0x4200000,0x11003800,0x24000000,0x4e00000,0x11003800,0x24000000, -0x14200000,0x11003800,0x24000000,0x14b00000,0x11003800,0x24000000,0x14e00000,0x11003800,0x24000000,0x96800000,0x11005003,0x7c00100,0x220402,0x11005013,0x2802500,0x962460, -0x11005013,0x4000020,0x200005,0x11005013,0x7c00100,0x2633801,0x11005013,0x7c00100,0x2633802,0x11005013,0x7c00100,0x2633805,0x11005019,0x7c00100,0x220402,0x11005100, -0x24000000,0x810000,0x11005100,0x24000000,0x1410000,0x11005102,0x7000100,0x230408,0x11005102,0x7c00100,0x230404,0x11005102,0x7c00100,0x230407,0x11005102,0x7c00100, -0x230408,0x11005102,0x7c00100,0x230409,0x11005201,0x2802400,0x962460,0x11005500,0x80000,0x1e18820,0x11005502,0x7000100,0x230408,0x11005502,0x7c00100,0x230404, -0x11005502,0x7c00100,0x230407,0x11005502,0x7c00100,0x230408,0x11005502,0x7c00100,0x230409,0x11005667,0x1000,0,0x11020200,0x80004,0x418820,0x11020200, -0x4000000,0x100006,0x11020200,0x4000000,0x10000f,0x11020200,0x4000400,0x100002,0x11020200,0x4000400,0x500002,0x11020200,0x6800c00,0x101000,0x11020200,0x24000000, -0x100000,0x11020200,0x24000000,0x1400000,0x11020200,0x24000000,0x1500000,0x11020200,0x24000000,0x1600000,0x11020200,0x24000000,0x14200000,0x11020200,0x24000020,0x100000, -0x11020200,0x24000020,0x1600000,0x11020219,0x7c00100,0x12040f,0x11020219,0x7c00100,0x220400,0x11020219,0x7c00100,0x220401,0x11020219,0x7c00100,0x250400,0x11020319, -0x7c00100,0x220400,0x11020319,0x7c00100,0x220401,0x11020319,0x7c00100,0x220402,0x11020319,0x7c00100,0x250400,0x11020319,0x7c00100,0x250402,0x11020319,0x7d00100, -0x220402,0x11020419,0x7c00100,0x220401,0x11020519,0x7c00100,0x220400,0x11020600,0x4000400,0x100002,0x11020600,0x4000400,0x200400,0x11020600,0x7c00500,0x130400, -0x11020600,0x7c00d00,0x130400,0x11020701,0x2802400,0x962460,0x11020701,0x2802400,0x962461,0x11020701,0x2802400,0xc62460,0x1102080e,0x7c00100,0x220400,0x1102080e, -0x7c00100,0x250400,0x11020908,0x7c00100,0x220400,0x11020908,0x7c00100,0x220401,0x11020908,0x7c00100,0x250400,0x11020908,0x7c00100,0x250401,0x11022800,0x24000000, -0x100000,0x11022800,0x24000000,0x200000,0x11022800,0x24000000,0x200002,0x11022800,0x24000000,0x401000,0x11022800,0x24000000,0xf00002,0x11022800,0x24000000,0xf0ac02, -0x11022800,0x24000000,0x1500000,0x11022800,0x24000002,0x100000,0x11022800,0x24000002,0x370000,0x11022800,0x24000002,0x470000,0x11022800,0x24000006,0x400000,0x11022800, -0x24000008,0x1710000,0x11022800,0x24000008,0x1712c00,0x11022800,0x24000020,0x100000,0x11022800,0x24000020,0x1500000,0x11022800,0x24000020,0x1500002,0x11022900,0x4000000, -0x10000e,0x11022900,0x4000000,0x10000f,0x11022919,0x7c00100,0x12040f,0x11022c00,0x4000000,0x100002,0x11022c00,0x4000000,0x1500002,0x11022c00,0x4000000,0x1600002, -0x11022c00,0x4000000,0x1410000f,0x11022c00,0x7c00120,0x120405,0x11022c0e,0x7c00100,0x250401,0x11022c19,0x7c00100,0x150401,0x11022d00,0x4000000,0x100006,0x11022d00, -0x4000000,0x200006,0x11022d19,0x7c00100,0x120402,0x11022d19,0x7c00100,0x150402,0x11022e00,0x24000000,0x200000,0x11022e00,0x24000020,0x100000,0x11022e00,0x24000020, -0x14100000,0x11022f00,0x24000020,0x100000,0x11022f00,0x24000020,0x100001,0x11022f00,0x24000020,0x100002,0x11023000,0x24000000,0x100000,0x11023300,0x4000000,0x100002, -0x11023300,0x4000000,0x100003,0x11023300,0x4000100,0x120403,0x11023300,0x4000100,0x150403,0x11023300,0x4000100,0x14150403,0x11023400,0x24000000,0x100000,0x11023500, -0x24000000,0x100000,0x11023600,0x24000000,0x100000,0x11023600,0x24000020,0x100000,0x11023600,0x24000020,0x14100000,0x11023700,0x24000000,0x4100000,0x11023700,0x24000000, -0x4e00000,0x11023700,0x24000000,0x14100000,0x11023700,0x24000000,0x14e00000,0x11023700,0x24000020,0x100000,0x11023700,0x24000020,0x4100000,0x11023700,0x24000020,0x14100000, -0x11023800,0x4000000,0x100000,0x11023800,0x24000000,0x200000,0x11024e67,0,0,0x11025600,0x4000000,0x100000,0x11042a00,0x4000000,0x1600000,0x11045700, -0x4000000,0x20000a,0x11045700,0x4000020,0x20000a,0x11045712,0x7c00100,0xe3040a,0x11045712,0x7c80100,0xe3040a,0x11045716,0x7c00100,0xe30c0a,0x11045716,0x7c00100, -0x2530c0a,0x11063d00,0x4000001,0x445811,0x11065700,0x4000000,0x810011,0x11065700,0x4000000,0xe00011,0x11065700,0x4000000,0x1410011,0x11065700,0x4000000,0x1500011, -0x11065700,0x4000000,0x1600011,0x11065700,0x4000006,0xe70011,0x11065700,0x4000008,0xe00011,0x11065700,0x4000008,0xe02c11,0x11065700,0x4000010,0x871411,0x11065700, -0x4000010,0x1201411,0x11065700,0x4000010,0x1271011,0x11065700,0x4000020,0xe00011,0x11065700,0x4000400,0xe00011,0x11065700,0x4000420,0xe00011,0x11065700,0x6800000, -0xe01c11,0x11065700,0x6800040,0xe29811,0x11065700,0xc000010,0x80ac11,0x11065700,0xc000010,0xb48011,0x11065719,0x7c00100,0xe20411,0x11065719,0x7c00100,0xe50411, -0x11065719,0x7c00140,0xe20411,0x11065719,0x7c00140,0xe50411,0x11080100,0x6800000,0x201c00,0x11080100,0x68000c0,0x19329800,0x11080100,0x24000000,0x200000,0x11080100, -0x24000000,0x810000,0x11080100,0x24000000,0x1410000,0x11080100,0x24000000,0x1500000,0x11080100,0x24000000,0x1600000,0x11080100,0x24000000,0x1b00000,0x11080100,0x24000000, -0x2410000,0x11080100,0x24000000,0x18200000,0x11080100,0x24000006,0xd70000,0x11080100,0x24000008,0x1713c00,0x11080100,0x24000008,0x1714000,0x11080100,0x24000010,0x1001400, -0x11080100,0x24000010,0x1071000,0x11080100,0x24000010,0x1071400,0x11080100,0x24000020,0x200000,0x11080100,0x24000020,0x400000,0x11080100,0x24000020,0x1600000,0x11080100, -0x24000400,0x200000,0x11080100,0x24000420,0x200000,0x11080100,0x2c000010,0xb48000,0x11080100,0x2c000010,0x100ac00,0x11080100,0x44000001,0x1a45800,0x11080119,0x7c00100, -0x220400,0x11080119,0x7c00100,0x250400,0x11080119,0x7c001c0,0x220400,0x11080119,0x7c001c0,0x250400,0x11080200,0x4000400,0x200002,0x11080200,0x24000000,0x200000, -0x11080200,0x24000000,0x1500000,0x11080200,0x24000000,0x1600000,0x11080200,0x24000020,0x200000,0x110a1e12,0x7c00100,0x2130480,0x110a1e12,0x7c80100,0x2130480,0x110a3000, -0x24000000,0x34e00000,0x110a3000,0x24100000,0x810001,0x110a3000,0x24100000,0x1410001,0x110a3700,0x24000000,0x34200000,0x110a3d00,0x4000000,0xe00000,0x110a3d00,0x4000000, -0xe00002,0x110a3d00,0x24000000,0xe00000,0x110a3d11,0x7c00300,0xe30000,0x110a3d11,0x7c00900,0x1230400,0x110a3d12,0x2802400,0x962460,0x110a3e14,0x7c00100,0xe30000, -0x110a3e14,0x7c00100,0xe30001,0x110a3e14,0x7c00100,0x2530000,0x110a3e14,0x7c00900,0x1230000,0x110a3e14,0x7c00900,0x1230001,0x110a3f16,0x7c00100,0xe30c00,0x110a3f16, -0x7c00100,0xe30c01,0x110a3f16,0x7c00100,0x2530c00,0x110a3f16,0x7c00900,0x1230c00,0x110a3f16,0x7c00900,0x1230c01,0x110a4005,0x7c00100,0xe30400,0x110a4112,0x7c00100, -0xe30402,0x110a4112,0x7c80100,0xe30402,0x110a4400,0x4000000,0xe00000,0x110a4412,0x4000000,0xe00002,0x110a4412,0x4000000,0xe00003,0x110a4416,0x4000000,0xe00c03, -0x110a4500,0x4000000,0xe0000d,0x110a4516,0x4000000,0xe00c0d,0x110a4711,0x7c40300,0xe30000,0x110a4f11,0x7c00300,0xe30001,0x110a4f11,0x7c40300,0xe30000,0x110a5300, -0x4000000,0x810010,0x110a5300,0x4000000,0xe00002,0x110a5300,0x4000000,0xe00010,0x110a5300,0x4000000,0x1410010,0x110a5300,0x4000002,0xe70010,0x110a5300,0x4000008, -0x810010,0x110a5300,0x4000008,0x1410010,0x110a5300,0x6800000,0xe01c02,0x110a5300,0x6800000,0xe01c10,0x110a5400,0x4000000,0x81000c,0x110a5400,0x4000000,0xe0000c, -0x110a5400,0x4000000,0x141000c,0x110a5400,0x4000000,0x150000c,0x110a5400,0x4000000,0x160000c,0x110a5400,0x4000002,0xe7000c,0x110a5400,0x4000010,0x87140c,0x110a5400, -0x4000010,0xe7000c,0x110a5400,0x4000010,0x120140c,0x110a5400,0x4000010,0x127100c,0x110a5400,0x4000020,0xe0000c,0x110a5400,0x4000026,0xe7000c,0x110a5400,0xc000010, -0x80ac0c,0x110a5400,0xc000010,0xb4800c,0x11400c0c,0x4000010,0xb00000,0x11400c0c,0x4000010,0x1071400,0x11400c0c,0xc000010,0xb48000,0x11400c16,0x7c00900,0x230400, -0x11400f40,0xc000010,0x448000,0x11400f54,0xc000010,0x448000,0x11401d89,0x4000000,0x200000,0x11403dbf,0x4000000,0xe00000,0x114457b4,0x4000004,0x120000a,0x114457b4, -0x4000008,0x81000a,0x114457b4,0x4000008,0x141000a,0x114457b4,0x4000010,0x87000a,0x114457b4,0xc000010,0x84800a,0x114457bd,0x3802500,0x126246a,0x114457bd,0x7c00d00, -0x2530c0a,0x114a3db4,0x24000000,0x810000,0x114a3db4,0x24000000,0x1410000,0x114a3db4,0x24000008,0x810000,0x114a3db4,0x24000008,0x1410000,0x114a3db4,0x24000010,0x870000, -0x114a3db4,0x2c000010,0x848000,0x114a3dba,0x4000000,0xe00000,0x114a3dba,0x24000000,0xe00000,0x114a3dba,0x24000002,0x1200000,0x114a3dba,0x24000002,0x14e00000,0x114a3dba, -0x24000008,0x810000,0x114a3dba,0x24000008,0x1410000,0x114a3dbd,0x7c00900,0x930c00,0x114a3dbd,0x7c00900,0xe30c00,0x114a3dbf,0x7c00300,0xe30000,0x114a3ebd,0x7000400, -0x1200c02,0x114a3fb4,0x4000004,0x1200000,0x114a3fbd,0x7c00d00,0x2530c00,0x114a42bf,0x4000000,0xe00000,0x114a42bf,0x4000000,0xe0000f,0x114a44bf,0x4000000,0xe00002, -0x114a44bf,0x4000000,0xe00003,0x114a44bf,0x4000000,0x14e00003,0x114a45bf,0x4000000,0xe00002,0x114a45bf,0x4000000,0xe0000d,0x1180090a,0x2802400,0x962460,0x11800c1e, -0x2802100,0x962460,0x11800c1e,0x2802500,0x962460,0x11800f27,0x2802400,0x962460,0x11800f34,0x2802400,0x962460,0x11820700,0x2802400,0x962460,0x11820700,0x2802500, -0x962460,0x118a3dc0,0x2802400,0x962460,0x118a3ebd,0x2802400,0x962460,0x11c00904,0x2802400,0x962460,0x11c00908,0x2802400,0x962460,0x11c00c20,0xc000010,0xb48000, -0x11c00c23,0x6800000,0x1329800,0x11c00f6d,0x6800000,0x1329800,0x11c01072,0x6800000,0x1329800,0x11c01176,0x6800000,0x1329800,0x11c0127a,0x6800000,0x1329800,0x11c0147e, -0x4000000,0x200000,0x11c0147e,0x6800000,0x1329800,0x11c01682,0x6800000,0x1329800,0x11c051fa,0x7c00100,0x230408,0x20000067,0x1000,0,0x20000b13,0x2802400, -0x962460,0x20000b13,0x2802500,0x962460,0x20001b27,0x2802100,0x962460,0x20001b27,0x2802100,0x962461,0x20001b27,0x2802400,0x962460,0x20001b27,0x2806400,0x962460, -0x20001b27,0x2902100,0x962462,0x20001b27,0x4000000,0x200000,0x20001b27,0x4000000,0x400000,0x20001b27,0x4000000,0x500000,0x20001b27,0x4000000,0x810000,0x20001b27, -0x4000000,0xb00000,0x20001b27,0x4000000,0xc0000b,0x20001b27,0x4000000,0x1410000,0x20001b27,0x4000010,0xb00000,0x20001b27,0x4000010,0xc00000,0x20001b27,0x6800000, -0x1329800,0x20001b27,0x6800100,0x462540,0x20001b27,0x6800400,0x962540,0x20001b27,0x7c00100,0x230400,0x20001b27,0x7c00100,0x230401,0x20002619,0x7c00100,0x220401, -0x20002a00,0x4000000,0x1600000,0x20004b67,0,0x1900000,0x20004c67,0,0x1900000,0x20004d67,0,0x1900000,0x20006d67,0x1000,0,0x20006e67, -0x1000,0,0x20026d67,0,0,0x20026e67,0,0,0x200a4a12,0x7c00100,0x1f304c1,0x200a4a12,0x7c00100,0x20304e1,0x21005600,0x4000000, -0x700000,0x21022a00,0x4000000,0x1600000,0x30000419,0x7c00100,0x220400,0x30000419,0x7c00100,0x220401,0x30000419,0x7c00100,0x250400,0x30000419,0x7c00100,0x250401, -0x30000519,0x7c00100,0x220400,0x30000600,0x4000400,0x200400,0x30000600,0x7c00500,0x230400,0x30000605,0x4000400,0x200400,0x3000080e,0x7c00100,0x220400,0x30000908, -0x2000,0x962460,0x30000908,0x7c00100,0x220400,0x30000908,0x7c00100,0x220401,0x30000908,0x7c00100,0x250400,0x30000908,0x7c00100,0x250401,0x30000a03,0x4000006, -0x400400,0x30000c02,0x4000000,0x200000,0x30000c02,0x7c00100,0x230400,0x30000d22,0x2802100,0x962460,0x30000d22,0x2802400,0x962460,0x30000d22,0x2802500,0x962460, -0x30000d22,0x4000000,0x200000,0x30000d22,0x4000010,0x200000,0x30000d22,0x7c00100,0x230400,0x30000d22,0xc000010,0x248000,0x30000d22,0x80000000,0x218960,0x30000e25, -0x2802500,0x962460,0x30000e25,0x7c00100,0x230400,0x30001821,0x2802100,0x962460,0x30001821,0x2806400,0x962460,0x30001821,0x4000000,0x200000,0x30001821,0x6800100, -0x962540,0x30001821,0x6800100,0x962541,0x30001821,0x7c00100,0x230400,0x30001b27,0x2802100,0x962460,0x30001b27,0x2802400,0x962460,0x30001b27,0x4000000,0x200000, -0x30001b27,0x4000000,0x400000,0x30001b27,0x7c00100,0x230400,0x30001c1c,0x2802100,0x1862460,0x30001c1c,0x2802400,0x1862460,0x30001c1c,0x2806400,0x1862460,0x30001c1c, -0x4000000,0x200000,0x30001c1c,0x6800100,0x1862400,0x30001c1c,0x6800100,0x1862540,0x30001c1c,0x7c00100,0x1830000,0x30001c1c,0x7c00100,0x1830001,0x30001c1c,0xc000010, -0x448000,0x30001f0b,0x4000000,0x200000,0x30001f0b,0x4000010,0x200000,0x30001f0b,0x4000010,0x400000,0x30001f0b,0x6800000,0x200000,0x30001f0b,0x7c00100,0x230400, -0x30001f0b,0xc000010,0x248000,0x30002006,0x7c00100,0x250400,0x30002128,0x4000000,0x200000,0x30002128,0x7c00100,0x230400,0x30002128,0xc000010,0x248000,0x3000221d, -0x4000000,0x810000,0x3000221d,0x4000000,0x1410000,0x3000221d,0x4000001,0x445800,0x3000221d,0x7c00100,0x230400,0x30002300,0x4000010,0x400000,0x30002320,0x7c00100, -0x230400,0x30002417,0x2802100,0x1862460,0x30002417,0x2802400,0x1862460,0x30002417,0x2806400,0x1862460,0x30002417,0x2882000,0x1862460,0x30002417,0x4000000,0x200000, -0x30002417,0x4000000,0x400000,0x30002417,0x4000000,0x1600000,0x30002417,0x4000010,0x400000,0x30002417,0x4000010,0x1200000,0x30002417,0x6800000,0x1329800,0x30002417, -0x6800100,0x1862540,0x30002417,0x7c00100,0x1830000,0x30002417,0x7d00100,0x1830000,0x3000251b,0x80000,0xc18820,0x3000251b,0x2802100,0x962460,0x3000251b,0x3c02100, -0x962460,0x3000251b,0x4000000,0x200000,0x3000251b,0x4000006,0x500000,0x3000251b,0x4000010,0x400000,0x3000251b,0x4000010,0xb70000,0x3000251b,0x4000800,0x200000, -0x3000251b,0x6800000,0x1329800,0x3000251b,0x7c00100,0x230400,0x3000251b,0x7c00900,0x230400,0x3000251b,0xc000010,0xb48000,0x3000251b,0x12882000,0x962460,0x30002800, -0x24000000,0x200000,0x30002800,0x2c000010,0x1248002,0x30002800,0x2c000010,0x15248002,0x30002a00,0x4000000,0x1600000,0x30002b01,0x2000,0x962460,0x30002b01,0x2000, -0x8962460,0x30002c00,0x4000000,0x200000,0x30002c00,0x7c00100,0x14220405,0x30002d19,0x7c00100,0x250400,0x30002e00,0x24000000,0x200000,0x30003000,0x24000000,0x200000, -0x30003000,0x24000000,0x4200000,0x30003100,0x24000000,0x200000,0x30003600,0x24000000,0x200000,0x30003700,0x24000000,0x4200000,0x3000392e,0x24000000,0x200000,0x30005013, -0x7c00100,0x2633801,0x30005600,0,0x918820,0x30020600,0x4000400,0x500400,0x30020701,0x2802400,0x962460,0x30020701,0x2802400,0xc62460,0x300a3a11,0x4020000, -0xe00000,0x300a3a11,0x4020000,0xe00002,0x300a3b11,0x4020000,0xe00002,0x300a3c00,0x4008000,0xe00000,0x300a3c00,0x4010000,0xe00000,0x300a3d11,0x7c00300,0xe30002, -0x300a4305,0x7c00100,0xe30400,0x300a4611,0x7c40300,0xe30000,0x300a4829,0x7c00100,0xe30400,0x300a4829,0x7c00900,0x1230400,0x300a4929,0x4000000,0xe00000,0x3040258f, -0x4000010,0x400000,0x3040258f,0x4000010,0xb70000,0x3040258f,0xc000010,0xb48000,0x304028af,0x4000001,0xc41c0b,0x304a3dbf,0x4000000,0xe00000,0x30800c1e,0x2802100, -0x962460,0x30c01c87,0x6800000,0x1329800,0x3100080e,0x7c00120,0x220402,0x3100080e,0x7c00120,0x250402,0x31005167,0x1000,0,0x3100581e,0x4000000,0x200000, -0x3100581e,0x7c00100,0x230400,0x3100590d,0x7c00100,0x230400,0x31005a09,0x7c00100,0x220400,0x31005a09,0x7c00100,0x250400,0x31005b00,0x4000000,0x200000,0x31005c00, -0x80000,0x918820,0x31005c00,0x2802000,0x962460,0x31005c00,0x2802400,0x962460,0x31005c00,0x4000000,0x200000,0x31005c00,0x4000000,0x200001,0x31005c00,0x6800000, -0x962540,0x31005c00,0x6800400,0x962540,0x31005c01,0x2802400,0x962460,0x31005d00,0x4000020,0x200005,0x31005d00,0x6800020,0x1329805,0x31005d00,0x7c00120,0x220405, -0x31005d00,0x7c00120,0x250405,0x31006000,0x82000,0x8962460,0x31006000,0x180000,0x918820,0x310a5e11,0x7c40300,0xe30000,0x310a5f11,0x7c00300,0xe30001,0x32000419, -0x7c00100,0x250400,0x3200080e,0x4000020,0x200000,0x3200080e,0x7c00100,0x220400,0x3200080e,0x7c00100,0x250400,0x32000908,0x7c00100,0x220400,0x32000908,0x7c00100, -0x250400,0x32000c02,0x7c00100,0x230400,0x32000e25,0x7c00100,0x230400,0x32001d0c,0x7c00100,0x230400,0x32002800,0x80000,0x1e18820,0x32002800,0x80020,0x218820, -0x32002800,0x4000001,0x445802,0x32002800,0x24000000,0x200000,0x32002800,0x24000000,0x200002,0x32002800,0x24000020,0x200000,0x32002800,0x2c000010,0x1248002,0x32002919, -0x7c00100,0x22040f,0x32002a00,0x4000000,0x1600000,0x32002b01,0x2000,0x962460,0x32002b01,0x2802000,0x962460,0x32002b01,0x2802020,0x962460,0x32002c00,0x4000000, -0x200000,0x32002c00,0x4000020,0x200000,0x32002c00,0x4000020,0x200005,0x32002c00,0x7c00120,0x220405,0x32002c00,0x7c00120,0x250405,0x32002e00,0x24000020,0x200000, -0x32002f00,0x24000020,0x200000,0x32003000,0x24000000,0x200000,0x32003000,0x24000020,0x200000,0x32003500,0x24000000,0x200000,0x32003600,0x24000020,0x200000,0x32003600, -0x24000020,0x14200000,0x32003700,0x24000000,0x200000,0x32003700,0x24000000,0x4100000,0x32003700,0x24000000,0x4200000,0x32003700,0x24000000,0x14200000,0x32003800,0x24000000, -0x810000,0x32003800,0x24000000,0x1410000,0x32005102,0x4000000,0x1500008,0x32005502,0x7c00100,0x230400,0x32006108,0x7c00100,0x220400,0x32006108,0x7c00100,0x250400, -0x3200622a,0x2802100,0x962460,0x3200622a,0x2806000,0x962460,0x3200622a,0x7c00100,0x230400,0x3200632b,0x2802100,0x962460,0x3200632b,0x2806000,0x962460,0x3200632b, -0x7c00100,0x230400,0x3200642c,0x2802100,0x962460,0x3200642c,0x7c00100,0x230400,0x3200652d,0x2802100,0x962460,0x3200652d,0x7c00100,0x230400,0x32006600,0x24000020, -0x200000,0x32006700,0x24000020,0x200000,0x32006800,0x24000020,0x200000,0x32006800,0x24000020,0x14200000,0x32006900,0x24000020,0x200000,0x32006900,0x24000020,0x810000, -0x32006900,0x24000020,0x1410000,0x32006a00,0x24000020,0x200000,0x32006a00,0x24000020,0x200001,0x32006a00,0x24000020,0x200002,0x32020701,0x2882000,0xc62460,0x32023300, -0x4000000,0x100000,0x32026c01,0x12882000,0x962460,0x32026c01,0x12882000,0x8962460,0x32065700,0x4000000,0x810011,0x32065700,0x4000000,0x1410011,0x32086600,0x24000020, -0x810000,0x32086600,0x24000020,0x1410000,0x32086900,0x24000020,0x810000,0x32086900,0x24000020,0x1410000,0x320a3600,0x24000020,0x34200000,0x320a3d11,0x7c00100,0x1230400, +static const uint32_t propsVectors[7260]={ +0x67,0,0,0x67,0,0xe00000,0x67,0x80000,0x20,0x867,0,0,0xa67,0,0,0xb67, +0,0,0xd67,0,0,0xe67,0,0,0x1067,0,0,0x1167,0,0,0x1267,0, +0,0x1367,0,0,0x1467,0,0,0x1567,0,0,0x1667,0,0,0x1767,0,0, +0x1867,0,0,0x1967,0,0,0x1a67,0,0,0x1b67,0,0,0x1d67,0,0,0x1f67, +0,0,0x2067,0,0,0x2267,0,0,0x2367,0,0,0x2467,0,0,0x2567,0, +0,0x2767,0,0,0x2867,0x80000,0x20,0x2967,0,0,0x2a67,0,0x1600000,0x2b67,0,0, +0x2d67,0,0,0x3167,0x20000000,0,0x3267,0x20000000,0,0x3a67,0,0,0x3b67,0,0,0x3e67, +0,0,0x4067,0,0,0x4167,0,0,0x4467,0,0,0x4867,0,0,0x4967,0, +0,0x4a67,0,0,0x5067,0,0,0x5167,0,0,0x5467,0,0,0x5567,0,0, +0x5667,0x80000,0x20,0x5767,0,0,0x5867,0,0,0x5967,0,0,0x5b67,0,0,0x5c67, +0,0,0x5d67,0,0,0x6067,0x80000,0x20,0x6267,0,0,0x6367,0,0,0x6467,0, +0,0x6567,0,0,0x6f67,0,0,0x7067,0,0,0x7367,0x20000000,0,0x7567,0,0, +0x7667,0,0,0x7767,0,0,0x7867,0,0,0x7a67,0,0,0x7b67,0,0,0x7c67, +0,0,0x7e67,0,0,0x7f67,0,0,0x8167,0,0,0x8267,0,0,0x8467,0, +0,0x8567,0,0,0x8667,0,0,0x8767,0,0,0x8967,0,0,0x8b67,0,0, +0x8c67,0,0,0x8e67,0x20000000,0,0x8f67,0,0,0x9067,0,0,0x9167,0,0,0x9267, +0,0,0x9367,0,0,0x9567,0,0,0x9667,0,0,0x9767,0,0,0x9867,0, +0,0x9967,0,0,0x9a67,0,0,0x9c67,0,0,0x9f67,0,0,0xa167,0,0, +0xa367,0,0,0xa467,0,0,0xa567,0,0,0xa667,0,0,0xa767,0,0,0xa867, +0,0,0xa967,0,0,0xaa67,0,0xe00000,0xab67,0,0xe00000,0xac67,0,0,0xad67,0, +0,0xae67,0,0,0xaf67,0,0,0xb167,0,0,0xb267,0,0,0xb467,0,0, +0xb567,0,0,0xb767,0,0,0xb867,0,0,0xb967,0,0,0xba67,0,0,0xbc67, +0,0,0xbd67,0,0,0xbe67,0,0,0xbf67,0,0,0xc067,0,0,0xc167,0, +0,0xc367,0,0xe00000,0xc467,0,0xe00000,0xc667,0,0,0xc767,0,0,0xc867,0,0, +0xc967,0,0,0xca67,0,0,0xcc67,0,0xe00000,0xcf67,0,0xe00000,0xd067,0,0xe00000,0xd367, +0,0,0xd467,0,0,0xd567,0,0,0xd667,0,0,0xd867,0,0,0xda67,0, +0,0xdb67,0,0,0xdc67,0,0,0xdd67,0,0,0xde67,0,0,0xdf67,0,0, +0xe067,0,0,0xe167,0,0,0xe267,0,0,0xe367,0,0xe00000,0xe467,0,0,0xe567, +0,0,0xe667,0,0,0xe767,0,0,0xe867,0,0,0xe967,0,0,0xea67,0, +0,0xeb67,0,0,0xec67,0,0,0xed67,0,0,0xee67,0,0,0xef67,0,0, +0xf167,0,0,0xf367,0,0,0xf567,0,0,0xf667,0,0,0xf767,0,0,0xf867, +0,0,0xf967,0,0,0xfa67,0,0xe00000,0xfb67,0,0,0xfc67,0,0,0xfd67,0, +0,0xfe67,0,0,0x10167,0,0,0x10267,0,0,0x10367,0,0,0x10467,0,0, +0x10667,0,0,0x10767,0,0,0x10867,0,0,0x10967,0,0,0x10a67,0,0,0x10b67, +0,0,0x10c67,0,0,0x10d67,0,0,0x10e67,0,0,0x10f67,0,0,0x11067,0, +0,0x11367,0,0,0x11467,0,0,0x11567,0,0,0x11667,0,0,0x11767,0,0, +0x11867,0,0,0x11967,0,0xe00000,0x11a67,0,0,0x11b67,0,0,0x11c67,0,0,0x11d67, +0,0,0x11e67,0,0,0x11f67,0,0,0x12067,0,0,0x12167,0,0,0x12267,0, +0,0x12367,0,0,0x12467,0,0,0x12567,0,0,0x12667,0,0,0x12767,0,0, +0x12867,0,0,0x12967,0,0,0x12a67,0,0xe00000,0x12b67,0,0,0x12c67,0,0,0x12d67, +0,0,0x12f67,0,0,0x13067,0,0,0x13167,0,0,0x13267,0,0,0x13367,0, +0,0x13467,0,0,0x13567,0,0,0x13667,0,0,0x13767,0,0,0x13867,0,0, +0x13967,0,0,0x13a67,0,0,0x13b67,0,0,0x13c67,0,0,0x13d67,0,0,0x13f67, +0,0,0x14067,0,0,0x14167,0,0,0x14367,0,0,0x14467,0,0,0x14567,0, +0,0x14667,0,0,0x14767,0,0,0xa0067,0,0xe00000,0xa4f67,0,0xe00000,0xa5f67,0,0xe00000, +0xac567,0,0xe00000,0xad167,0,0xe00000,0xb0067,0,0xe00000,0xb1267,0,0xe00000,0xb2e67,0,0xe00000,0xb4867, +0,0xe00000,0x11000100,0,0x900020,0x11000100,0x40000001,0x440020,0x11000100,0x40000001,0x643020,0x11000100,0x40000001,0xa5a040,0x11000100,0x40000001, +0x116a8a0,0x11000200,0,0x900020,0x11000200,0x4000001,0xc4000b,0x11000200,0x7c00100,0x220402,0x11000200,0x24000000,0x200000,0x11000200,0x24000008,0x1710000, +0x11000200,0x40000001,0x1d3b020,0x11000219,0x7c00100,0x220401,0x11000219,0x7c00100,0x250401,0x11000319,0x7c00100,0x220401,0x11000319,0x7c00100,0x220402,0x11000319, +0x7c00100,0x250400,0x11000319,0x7c00100,0x250401,0x11000419,0x7c00100,0x220400,0x11000419,0x7c00100,0x220401,0x11000419,0x7c00100,0x220402,0x11000419,0x7c00100, +0x230400,0x11000419,0x7c00100,0x250400,0x11000419,0x7c00100,0x250401,0x11000419,0x7c00100,0x250402,0x11000519,0x7c00100,0x220400,0x11000519,0x7c00100,0x230400, +0x11000600,0x4000400,0x200002,0x11000600,0x4000400,0x200400,0x11000600,0x7c00500,0x220400,0x11000600,0x7c00500,0x230400,0x11000600,0x7c00500,0x530400,0x11000600, +0x7c00d00,0x230400,0x11000619,0x7c00500,0x22040f,0x11000800,0x4000010,0x1001401,0x11000800,0x4000400,0x200001,0x11000800,0x6800010,0x201001,0x11000800,0x7c00500, +0x230401,0x11000807,0x7c00100,0x220400,0x11000807,0x7c00100,0x250400,0x1100080e,0x4000400,0x200000,0x1100080e,0x4000400,0x200002,0x1100080e,0x7000500,0x220402, +0x1100080e,0x7c00100,0x220400,0x1100080e,0x7c00100,0x220401,0x1100080e,0x7c00100,0x220402,0x1100080e,0x7c00100,0x250400,0x1100080e,0x7c00100,0x250401,0x1100080e, +0x7c00120,0x220402,0x1100080e,0x7c00120,0x250402,0x11000908,0x4000000,0x200000,0x11000908,0x7c00100,0x220400,0x11000908,0x7c00100,0x220401,0x11000908,0x7c00100, +0x250400,0x11000908,0x7c00100,0x250401,0x11000a03,0x4000000,0x200400,0x11000a03,0x4000000,0x201000,0x11000a03,0x4000000,0x270000,0x11000a03,0x7c00100,0x220400, +0x11000a03,0x7c00100,0x220402,0x11000a03,0x7c00100,0x250400,0x11000a03,0x7c00500,0x230400,0x11000a03,0xc000010,0x1049400,0x11000b13,0x2802500,0x962460,0x11000b13, +0x4000000,0x200000,0x11000b13,0x4000000,0x201000,0x11000b13,0x4000000,0x230400,0x11000b13,0x4000002,0x400000,0x11000b13,0x4000010,0x200000,0x11000b13,0x7c00100, +0x2633800,0x11000c00,0x80000000,0x1329960,0x11000c02,0x2802100,0x962460,0x11000c02,0x2802400,0x962460,0x11000c02,0x4000000,0x200000,0x11000c02,0x4000000,0x1329400, +0x11000c02,0x4000000,0x1329800,0x11000c02,0x4000000,0x1500000,0x11000c02,0x6800000,0x1329800,0x11000c02,0x7c00100,0x230400,0x11000c02,0x7c00100,0x230401,0x11000c02, +0x7c00100,0x230402,0x11000c02,0x7c00500,0x230400,0x11000c02,0x7d00100,0x230400,0x11000f01,0x2802400,0x962460,0x11000f0a,0x2802100,0x962460,0x11000f0a,0x2802400, +0x962460,0x11000f0a,0x2806400,0x962460,0x11000f0a,0x4000000,0x200000,0x11000f0a,0x6800100,0x962540,0x11000f0a,0x7c00100,0x230400,0x11000f0a,0x7c00100,0x230401, +0x11001004,0x2802100,0x962460,0x11001004,0x2802400,0x962460,0x11001004,0x2806400,0x962460,0x11001004,0x4000000,0x200000,0x11001004,0x4000000,0x1500000,0x11001004, +0x6800100,0x962540,0x11001004,0x6800100,0x962541,0x11001004,0x7c00100,0x230400,0x11001004,0x7c00100,0x230401,0x11001110,0x2802100,0x962460,0x11001110,0x2802400, +0x962460,0x11001110,0x2806400,0x962460,0x11001110,0x6800100,0x962540,0x11001110,0x7c00100,0x230400,0x11001110,0x7c00100,0x230401,0x1100120f,0x2802100,0x962460, +0x1100120f,0x2802400,0x962460,0x1100120f,0x2806400,0x962460,0x1100120f,0x6800100,0x962540,0x1100120f,0x7c00100,0x230400,0x1100131f,0x2802100,0x962460,0x1100131f, +0x2802400,0x962460,0x1100131f,0x2806400,0x962460,0x1100131f,0x4000000,0x200000,0x1100131f,0x6800000,0x1329800,0x1100131f,0x6800100,0x962540,0x1100131f,0x6800100, +0x962541,0x1100131f,0x7c00100,0x230400,0x1100131f,0x7c00100,0x230401,0x11001423,0x2802100,0x962460,0x11001423,0x2806400,0x962460,0x11001423,0x6800100,0x962540, +0x11001423,0x6800100,0x962541,0x11001423,0x7c00100,0x230400,0x11001423,0x7c00100,0x230401,0x11001524,0x2802100,0x962460,0x11001524,0x2802100,0x962461,0x11001524, +0x2806400,0x962460,0x11001524,0x6800000,0x1329800,0x11001524,0x6800100,0x962540,0x11001524,0x7c00100,0x230400,0x11001615,0x2802100,0x962460,0x11001615,0x2806400, +0x962460,0x11001615,0x6800100,0x962540,0x11001615,0x6800100,0x962541,0x11001615,0x7c00100,0x230400,0x1100171a,0x2802100,0x962460,0x1100171a,0x2806400,0x962460, +0x1100171a,0x6800000,0x1329800,0x1100171a,0x6800100,0x962540,0x1100171a,0x6800100,0x962541,0x1100171a,0x7c00100,0x230400,0x11001900,0x4000000,0x1600000,0x11001926, +0x2802100,0x1862460,0x11001926,0x2802400,0x1862460,0x11001926,0x2806100,0x1862460,0x11001926,0x4000000,0x200000,0x11001926,0x4000010,0x400000,0x11001926,0x6800000, +0x1329800,0x11001926,0x7800100,0x1830142,0x11001926,0x7c00100,0x1830000,0x11001926,0x7c00900,0x1830000,0x11001926,0x7e00100,0x1830000,0x11001a18,0x2802100,0x1862460, +0x11001a18,0x2802400,0x1862460,0x11001a18,0x6800000,0x1329800,0x11001a18,0x7800100,0x1830142,0x11001a18,0x7c00100,0x1830000,0x11001a18,0x7c00100,0x1830002,0x11001a18, +0x7c00900,0x1830000,0x11001a18,0x7e00100,0x1830000,0x11001d0c,0x7c00100,0x230400,0x11001d0c,0x7c00100,0x250400,0x11001e12,0x7c00100,0x2230500,0x11001e12,0x7c00100, +0x2330520,0x11001e12,0x7c80100,0x2330520,0x11002619,0x7c00100,0x220401,0x11002619,0x7c00100,0x220402,0x11002619,0x7c00100,0x250401,0x1100270e,0x4000400,0x200001, +0x1100270e,0x4000400,0x200002,0x1100270e,0x4000400,0x500001,0x1100270e,0x7c00100,0x220401,0x1100270e,0x7c00100,0x250401,0x11002800,0x80000,0x918820,0x11002800, +0x80000,0x1c18020,0x11002800,0x180000,0x918820,0x11002800,0x4000001,0x445801,0x11002800,0x4000001,0x445802,0x11002800,0x4000001,0xc4000b,0x11002800,0x6800000, +0x201c00,0x11002800,0x6800020,0x201c00,0x11002800,0x24000000,0x200000,0x11002800,0x24000000,0x200002,0x11002800,0x24000000,0x810000,0x11002800,0x24000000,0x1410000, +0x11002800,0x24000000,0x1500000,0x11002800,0x24000000,0x1500002,0x11002800,0x24000002,0x400000,0x11002800,0x24000006,0xc0000b,0x11002800,0x24000008,0x1410000,0x11002800, +0x24000008,0x1710000,0x11002800,0x24000020,0x1001400,0x11002800,0x24000020,0x1500002,0x11002800,0x2c000010,0x1248000,0x11002800,0x2c000010,0x1248002,0x11002800,0x40000001, +0x63b020,0x11002800,0x40080000,0x918820,0x11002801,0x2880000,0x2a65620,0x11002801,0x2882000,0x962460,0x11002900,0x4000000,0x20000e,0x11002900,0x4000000,0x20000f, +0x11002900,0x4000020,0x20000e,0x11002900,0x4000020,0x20000f,0x11002900,0x4000020,0x81000e,0x11002900,0x4000020,0x81000f,0x11002900,0x4000020,0x141000e,0x11002900, +0x4000020,0x141000f,0x11002900,0x4000022,0x20000e,0x11002900,0x4000022,0x20000f,0x11002a00,0x4000000,0x1500000,0x11002a00,0x4000000,0x1600000,0x11002a00,0x4000000, +0x1600002,0x11002b01,0x2000,0x962460,0x11002b01,0x2802020,0x962460,0x11002c00,0x4000000,0x200000,0x11002c00,0x4000000,0x200002,0x11002c00,0x4000000,0x20000f, +0x11002c00,0x4000020,0x200000,0x11002c00,0x7c00000,0x200000,0x11002c00,0x7c00020,0x200000,0x11002c00,0x7c00120,0x220405,0x11002c00,0x7c00120,0x230402,0x11002c00, +0x7c00120,0x250402,0x11002c00,0x7c00120,0x250405,0x11002c19,0x7c00100,0x250400,0x11002c19,0x7c00100,0x250401,0x11002d00,0x4000000,0x100006,0x11002d00,0x4000000, +0x200006,0x11002d19,0x7c00100,0x220402,0x11002d19,0x7c00100,0x230400,0x11002d19,0x7c00100,0x250402,0x11002e00,0x24000000,0x200000,0x11002e00,0x24000020,0x200000, +0x11002e00,0x24000020,0x200001,0x11002f00,0x24000020,0x200000,0x11002f00,0x24000020,0x200001,0x11002f00,0x24000020,0x200002,0x11002f00,0x24000020,0xf00000,0x11002f00, +0x24000020,0x1600000,0x11002f00,0x24000022,0x1600000,0x11003000,0x24000000,0x200000,0x11003000,0x24000020,0x200000,0x11003000,0x24000020,0x810000,0x11003000,0x24000020, +0x1410000,0x11003100,0x24000000,0x200000,0x11003200,0x24000000,0x200000,0x11003300,0x4000000,0x100003,0x11003400,0x24000000,0x100000,0x11003400,0x24000000,0x200000, +0x11003500,0x24000000,0x200000,0x11003600,0x24000000,0x200000,0x11003600,0x24000020,0x200000,0x11003700,0x24000000,0x200000,0x11003700,0x24000000,0xe00000,0x11003700, +0x24000000,0x2800000,0x11003700,0x24000020,0x200000,0x11003800,0x4000000,0x100000,0x11003800,0x24000000,0x200000,0x11003800,0x24000000,0xb00000,0x11003800,0x24000000, +0xe00000,0x11003800,0x24000000,0x1710000,0x11003800,0x24000000,0x2800000,0x11005003,0x7c00100,0x220402,0x11005013,0x2802500,0x962460,0x11005013,0x4000020,0x200005, +0x11005013,0x7c00100,0x2633801,0x11005013,0x7c00100,0x2633802,0x11005013,0x7c00100,0x2633805,0x11005019,0x7c00100,0x220402,0x11005102,0x7000100,0x230408,0x11005102, +0x7c00100,0x230404,0x11005102,0x7c00100,0x230407,0x11005102,0x7c00100,0x230408,0x11005102,0x7c00100,0x230409,0x11005201,0x2802400,0x962460,0x11005500,0x80000, +0x1e18820,0x11005502,0x7000100,0x230408,0x11005502,0x7c00100,0x230404,0x11005502,0x7c00100,0x230407,0x11005502,0x7c00100,0x230408,0x11005502,0x7c00100,0x230409, +0x11005667,0x1000,0,0x11020200,0x80004,0x418820,0x11020200,0x4000000,0x100006,0x11020200,0x4000000,0x10000f,0x11020200,0x4000400,0x100002,0x11020200, +0x4000400,0x500002,0x11020200,0x6800c00,0x101000,0x11020200,0x24000000,0x100000,0x11020200,0x24000000,0x200000,0x11020200,0x24000000,0x1400000,0x11020200,0x24000000, +0x1500000,0x11020200,0x24000000,0x1600000,0x11020200,0x24000020,0x100000,0x11020200,0x24000020,0x1600000,0x11020219,0x7c00100,0x12040f,0x11020219,0x7c00100,0x220400, +0x11020219,0x7c00100,0x220401,0x11020219,0x7c00100,0x250400,0x11020319,0x7c00100,0x220400,0x11020319,0x7c00100,0x220401,0x11020319,0x7c00100,0x220402,0x11020319, +0x7c00100,0x250400,0x11020319,0x7c00100,0x250402,0x11020319,0x7d00100,0x220402,0x11020419,0x7c00100,0x220401,0x11020519,0x7c00100,0x220400,0x11020600,0x4000400, +0x100002,0x11020600,0x4000400,0x200400,0x11020600,0x7c00500,0x130400,0x11020600,0x7c00d00,0x130400,0x11020701,0x2802400,0x962460,0x11020701,0x2802400,0x962461, +0x11020701,0x2802400,0xc62460,0x1102080e,0x7c00100,0x220400,0x1102080e,0x7c00100,0x250400,0x11020908,0x7c00100,0x220400,0x11020908,0x7c00100,0x220401,0x11020908, +0x7c00100,0x250400,0x11020908,0x7c00100,0x250401,0x11022800,0x24000000,0x100000,0x11022800,0x24000000,0x200000,0x11022800,0x24000000,0x200002,0x11022800,0x24000000, +0x401000,0x11022800,0x24000000,0xf00002,0x11022800,0x24000000,0xf0ac02,0x11022800,0x24000000,0x1500000,0x11022800,0x24000002,0x100000,0x11022800,0x24000002,0x370000, +0x11022800,0x24000002,0x470000,0x11022800,0x24000006,0x400000,0x11022800,0x24000008,0x1710000,0x11022800,0x24000008,0x1712c00,0x11022800,0x24000020,0x100000,0x11022800, +0x24000020,0x1500000,0x11022800,0x24000020,0x1500002,0x11022900,0x4000000,0x10000e,0x11022900,0x4000000,0x10000f,0x11022919,0x7c00100,0x12040f,0x11022c00,0x4000000, +0x100002,0x11022c00,0x4000000,0x10000f,0x11022c00,0x4000000,0x1500002,0x11022c00,0x4000000,0x1600002,0x11022c00,0x7c00120,0x120405,0x11022c0e,0x7c00100,0x250401, +0x11022c19,0x7c00100,0x150401,0x11022d00,0x4000000,0x100006,0x11022d00,0x4000000,0x200006,0x11022d19,0x7c00100,0x120402,0x11022d19,0x7c00100,0x150402,0x11022e00, +0x24000000,0x200000,0x11022e00,0x24000020,0x100000,0x11022f00,0x24000020,0x100000,0x11022f00,0x24000020,0x100001,0x11022f00,0x24000020,0x100002,0x11023000,0x24000000, +0x100000,0x11023300,0x4000000,0x100002,0x11023300,0x4000000,0x100003,0x11023300,0x4000100,0x120403,0x11023300,0x4000100,0x150403,0x11023400,0x24000000,0x100000, +0x11023500,0x24000000,0x100000,0x11023600,0x24000000,0x100000,0x11023600,0x24000020,0x100000,0x11023700,0x24000000,0x100000,0x11023700,0x24000000,0xe00000,0x11023700, +0x24000020,0x100000,0x11023800,0x4000000,0x100000,0x11023800,0x24000000,0x200000,0x11024e67,0,0,0x11025600,0x4000000,0x100000,0x11042a00,0x4000000, +0x1600000,0x11045700,0x4000000,0x20000a,0x11045700,0x4000020,0x20000a,0x11045712,0x7c00100,0xe3040a,0x11045712,0x7c80100,0xe3040a,0x11045716,0x7c00100,0xe30c0a, +0x11045716,0x7c00100,0x2530c0a,0x11063d00,0x4000001,0x445811,0x11065700,0x4000000,0x810011,0x11065700,0x4000000,0xe00011,0x11065700,0x4000000,0x1410011,0x11065700, +0x4000000,0x1500011,0x11065700,0x4000000,0x1600011,0x11065700,0x4000006,0xe70011,0x11065700,0x4000008,0xe00011,0x11065700,0x4000008,0xe02c11,0x11065700,0x4000010, +0x871411,0x11065700,0x4000010,0x1201411,0x11065700,0x4000010,0x1271011,0x11065700,0x4000020,0xe00011,0x11065700,0x4000400,0xe00011,0x11065700,0x4000420,0xe00011, +0x11065700,0x6800000,0xe01c11,0x11065700,0x6800040,0xe29811,0x11065700,0xc000010,0x80ac11,0x11065700,0xc000010,0xb48011,0x11065719,0x7c00100,0xe20411,0x11065719, +0x7c00100,0xe50411,0x11065719,0x7c00140,0xe20411,0x11065719,0x7c00140,0xe50411,0x11080100,0x6800000,0x201c00,0x11080100,0x68000c0,0x1329800,0x11080100,0x24000000, +0x200000,0x11080100,0x24000000,0x810000,0x11080100,0x24000000,0x1410000,0x11080100,0x24000000,0x1500000,0x11080100,0x24000000,0x1600000,0x11080100,0x24000000,0x1b00000, +0x11080100,0x24000000,0x2410000,0x11080100,0x24000006,0xd70000,0x11080100,0x24000008,0x1713c00,0x11080100,0x24000008,0x1714000,0x11080100,0x24000010,0x1001400,0x11080100, +0x24000010,0x1071000,0x11080100,0x24000010,0x1071400,0x11080100,0x24000020,0x200000,0x11080100,0x24000020,0x400000,0x11080100,0x24000020,0x1600000,0x11080100,0x24000400, +0x200000,0x11080100,0x24000420,0x200000,0x11080100,0x2c000010,0xb48000,0x11080100,0x2c000010,0x100ac00,0x11080100,0x44000001,0x1a45800,0x11080119,0x7c00100,0x220400, +0x11080119,0x7c00100,0x250400,0x11080119,0x7c001c0,0x220400,0x11080119,0x7c001c0,0x250400,0x11080200,0x4000400,0x200002,0x11080200,0x24000000,0x200000,0x11080200, +0x24000000,0x1500000,0x11080200,0x24000000,0x1600000,0x11080200,0x24000020,0x200000,0x110a1e12,0x7c00100,0x2130480,0x110a1e12,0x7c80100,0x2130480,0x110a3000,0x24000000, +0xe00000,0x110a3000,0x24100000,0x810001,0x110a3000,0x24100000,0x1410001,0x110a3700,0x24000000,0x200000,0x110a3d00,0x4000000,0xe00000,0x110a3d00,0x4000000,0xe00002, +0x110a3d00,0x24000000,0xe00000,0x110a3d11,0x7c00300,0xe30000,0x110a3d11,0x7c00900,0x1230400,0x110a3d12,0x2802400,0x962460,0x110a3e14,0x7c00100,0xe30000,0x110a3e14, +0x7c00100,0xe30001,0x110a3e14,0x7c00100,0x2530000,0x110a3e14,0x7c00900,0x1230000,0x110a3e14,0x7c00900,0x1230001,0x110a3f16,0x7c00100,0xe30c00,0x110a3f16,0x7c00100, +0xe30c01,0x110a3f16,0x7c00100,0x2530c00,0x110a3f16,0x7c00900,0x1230c00,0x110a3f16,0x7c00900,0x1230c01,0x110a4005,0x7c00100,0xe30400,0x110a4112,0x7c00100,0xe30402, +0x110a4112,0x7c80100,0xe30402,0x110a4400,0x4000000,0xe00000,0x110a4412,0x4000000,0xe00002,0x110a4412,0x4000000,0xe00003,0x110a4416,0x4000000,0xe00c03,0x110a4500, +0x4000000,0xe0000d,0x110a4516,0x4000000,0xe00c0d,0x110a4711,0x7c40300,0xe30000,0x110a4f11,0x7c00300,0xe30001,0x110a4f11,0x7c40300,0xe30000,0x110a5300,0x4000000, +0x810010,0x110a5300,0x4000000,0xe00002,0x110a5300,0x4000000,0xe00010,0x110a5300,0x4000000,0x1410010,0x110a5300,0x4000002,0xe70010,0x110a5300,0x4000008,0x810010, +0x110a5300,0x4000008,0x1410010,0x110a5300,0x6800000,0xe01c02,0x110a5300,0x6800000,0xe01c10,0x110a5400,0x4000000,0x81000c,0x110a5400,0x4000000,0xe0000c,0x110a5400, +0x4000000,0x141000c,0x110a5400,0x4000000,0x150000c,0x110a5400,0x4000000,0x160000c,0x110a5400,0x4000002,0xe7000c,0x110a5400,0x4000010,0x87140c,0x110a5400,0x4000010, +0xe7000c,0x110a5400,0x4000010,0x120140c,0x110a5400,0x4000010,0x127100c,0x110a5400,0x4000020,0xe0000c,0x110a5400,0x4000026,0xe7000c,0x110a5400,0xc000010,0x80ac0c, +0x110a5400,0xc000010,0xb4800c,0x11400c0c,0x4000010,0xb00000,0x11400c0c,0x4000010,0x1071400,0x11400c17,0xc000010,0xb48000,0x11400c1e,0x7c00900,0x230400,0x11400f4b, +0xc000010,0x448000,0x11400f5f,0xc000010,0x448000,0x11401d94,0x4000000,0x200000,0x11403dcc,0x4000000,0xe00000,0x114457c1,0x4000008,0x81000a,0x114457c1,0x4000008, +0x141000a,0x114457c1,0x4000010,0x87000a,0x114457c1,0x6800004,0x120000a,0x114457c1,0xc000010,0x84800a,0x114457ca,0x3802500,0x126246a,0x114457ca,0x7c00d00,0x2530c0a, +0x114a3dc1,0x24000000,0x810000,0x114a3dc1,0x24000000,0x1410000,0x114a3dc1,0x24000008,0x810000,0x114a3dc1,0x24000008,0x1410000,0x114a3dc1,0x24000010,0x870000,0x114a3dc1, +0x2c000010,0x848000,0x114a3dc7,0x4000000,0xe00000,0x114a3dc7,0x24000000,0xe00000,0x114a3dc7,0x24000002,0xe00000,0x114a3dc7,0x24000002,0x1200000,0x114a3dc7,0x24000008, +0x810000,0x114a3dc7,0x24000008,0x1410000,0x114a3dca,0x7c00900,0x930c00,0x114a3dca,0x7c00900,0xe30c00,0x114a3dcc,0x7c00300,0xe30000,0x114a3eca,0x7000400,0x1200c02, +0x114a3fc1,0x6800004,0x1200000,0x114a3fca,0x7c00d00,0x2530c00,0x114a42cc,0x4000000,0xe00000,0x114a42cc,0x4000000,0xe0000f,0x114a44cc,0x4000000,0xe00002,0x114a44cc, +0x4000000,0xe00003,0x114a45cc,0x4000000,0xe00002,0x114a45cc,0x4000000,0xe0000d,0x11505113,0x24000000,0x810000,0x11505113,0x24000000,0x1410000,0x1180090a,0x2802400, +0x962460,0x11800c27,0x2802100,0x962460,0x11800c27,0x2802500,0x962460,0x11800f32,0x2802400,0x962460,0x11800f3f,0x2802400,0x962460,0x11820700,0x2802400,0x962460, +0x11820700,0x2802500,0x962460,0x118a3dcd,0x2802400,0x962460,0x118a3eca,0x2802400,0x962460,0x11c00904,0x2802400,0x962460,0x11c00908,0x2802400,0x962460,0x11c00c2c, +0x6800000,0x1329800,0x11c00c30,0xc000010,0xb48000,0x11c00f78,0x6800000,0x1329800,0x11c0107d,0x6800000,0x1329800,0x11c01181,0x6800000,0x1329800,0x11c01285,0x6800000, +0x1329800,0x11c01489,0x4000000,0x200000,0x11c01489,0x6800000,0x1329800,0x11c0168d,0x6800000,0x1329800,0x11d05117,0x7c00100,0x230408,0x20000067,0x1000,0, +0x20000b13,0x2802400,0x962460,0x20000b13,0x2802500,0x962460,0x20001b27,0x2802100,0x962460,0x20001b27,0x2802100,0x962461,0x20001b27,0x2802400,0x962460,0x20001b27, +0x2802500,0x962460,0x20001b27,0x2806400,0x962460,0x20001b27,0x2902100,0x962462,0x20001b27,0x4000000,0x200000,0x20001b27,0x4000000,0x400000,0x20001b27,0x4000000, +0x500000,0x20001b27,0x4000000,0x810000,0x20001b27,0x4000000,0xb00000,0x20001b27,0x4000000,0xc0000b,0x20001b27,0x4000000,0x1410000,0x20001b27,0x4000010,0xb00000, +0x20001b27,0x4000010,0xc00000,0x20001b27,0x6800000,0x1329800,0x20001b27,0x6800100,0x462540,0x20001b27,0x6800400,0x962540,0x20001b27,0x7c00100,0x230400,0x20001b27, +0x7c00100,0x230401,0x20002619,0x7c00100,0x220401,0x20002a00,0x4000000,0x1600000,0x20004b67,0,0x1900000,0x20004c67,0,0x1900000,0x20004d67,0, +0x1900000,0x20006d67,0x1000,0,0x20006e67,0x1000,0,0x20026d67,0,0,0x20026e67,0,0,0x200a4a12,0x7c00100,0x1f304c1, +0x200a4a12,0x7c00100,0x20304e1,0x21005600,0x4000000,0x700000,0x21022a00,0x4000000,0x1600000,0x30000419,0x7c00100,0x220400,0x30000419,0x7c00100,0x220401,0x30000419, +0x7c00100,0x250400,0x30000419,0x7c00100,0x250401,0x30000519,0x7c00100,0x220400,0x30000600,0x4000400,0x200400,0x30000600,0x7c00500,0x230400,0x30000605,0x4000400, +0x200400,0x3000080e,0x7c00100,0x220400,0x30000908,0x2000,0x962460,0x30000908,0x7c00100,0x220400,0x30000908,0x7c00100,0x220401,0x30000908,0x7c00100,0x250400, +0x30000908,0x7c00100,0x250401,0x30000a03,0x4000006,0x400400,0x30000c02,0x4000000,0x200000,0x30000c02,0x7c00100,0x230400,0x30000d22,0x2802100,0x962460,0x30000d22, +0x2802400,0x962460,0x30000d22,0x2802500,0x962460,0x30000d22,0x4000000,0x200000,0x30000d22,0x4000010,0x200000,0x30000d22,0x7c00100,0x230400,0x30000d22,0xc000010, +0x248000,0x30000d22,0x80000000,0x218560,0x30000e25,0x2802500,0x962460,0x30000e25,0x7c00100,0x230400,0x30001821,0x2802100,0x962460,0x30001821,0x2806400,0x962460, +0x30001821,0x4000000,0x200000,0x30001821,0x6800100,0x962540,0x30001821,0x6800100,0x962541,0x30001821,0x7c00100,0x230400,0x30001b27,0x2802100,0x962460,0x30001b27, +0x2802400,0x962460,0x30001b27,0x4000000,0x200000,0x30001b27,0x4000000,0x400000,0x30001b27,0x7c00100,0x230400,0x30001c1c,0x2802100,0x1862460,0x30001c1c,0x2802400, +0x1862460,0x30001c1c,0x2806400,0x1862460,0x30001c1c,0x4000000,0x200000,0x30001c1c,0x6800100,0x1862400,0x30001c1c,0x6800100,0x1862540,0x30001c1c,0x7c00100,0x1830000, +0x30001c1c,0x7c00100,0x1830001,0x30001c1c,0xc000010,0x448000,0x30001f0b,0x4000000,0x200000,0x30001f0b,0x4000010,0x200000,0x30001f0b,0x4000010,0x400000,0x30001f0b, +0x6800000,0x200000,0x30001f0b,0x7c00100,0x230400,0x30001f0b,0xc000010,0x248000,0x30002006,0x7c00100,0x250400,0x30002128,0x4000000,0x200000,0x30002128,0x7c00100, +0x230400,0x30002128,0xc000010,0x248000,0x3000221d,0x4000000,0x810000,0x3000221d,0x4000000,0x1410000,0x3000221d,0x4000001,0x445800,0x3000221d,0x7c00100,0x230400, +0x30002300,0x4000010,0x400000,0x30002320,0x7c00100,0x230400,0x30002417,0x2802100,0x1862460,0x30002417,0x2802400,0x1862460,0x30002417,0x2806400,0x1862460,0x30002417, +0x2882000,0x1862460,0x30002417,0x4000000,0x200000,0x30002417,0x4000000,0x400000,0x30002417,0x4000000,0x1600000,0x30002417,0x4000010,0x400000,0x30002417,0x4000010, +0x1200000,0x30002417,0x6800000,0x1329800,0x30002417,0x6800100,0x1862540,0x30002417,0x7c00100,0x1830000,0x30002417,0x7d00100,0x1830000,0x30002417,0xc000010,0x448000, +0x3000251b,0x80000,0xc18820,0x3000251b,0x2802100,0x962460,0x3000251b,0x3c02100,0x962460,0x3000251b,0x4000000,0x200000,0x3000251b,0x4000006,0x500000,0x3000251b, +0x4000010,0x400000,0x3000251b,0x4000010,0xb70000,0x3000251b,0x4000800,0x200000,0x3000251b,0x6800000,0x1329800,0x3000251b,0x7c00100,0x230400,0x3000251b,0x7c00900, +0x230400,0x3000251b,0xc000010,0xb48000,0x3000251b,0x12882000,0x962460,0x30002800,0x24000000,0x200000,0x30002800,0x2c000010,0x1248002,0x30002a00,0x4000000,0x1600000, +0x30002b01,0x2000,0x962460,0x30002c00,0x4000000,0x200000,0x30002c00,0x7c00100,0x220405,0x30002d19,0x7c00100,0x250400,0x30002e00,0x24000000,0x200000,0x30003000, +0x24000000,0x200000,0x30003100,0x24000000,0x200000,0x30003600,0x24000000,0x200000,0x30003700,0x24000000,0x200000,0x3000392e,0x24000000,0x200000,0x30005013,0x7c00100, +0x2633801,0x30005600,0,0x918820,0x30020600,0x4000400,0x500400,0x30020701,0x2802400,0x962460,0x30020701,0x2802400,0xc62460,0x300a3a11,0x4020000,0xe00000, +0x300a3a11,0x4020000,0xe00002,0x300a3b11,0x4020000,0xe00002,0x300a3c00,0x4008000,0xe00000,0x300a3c00,0x4010000,0xe00000,0x300a3d11,0x7c00300,0xe30002,0x300a4305, +0x7c00100,0xe30400,0x300a4611,0x7c40300,0xe30000,0x300a4829,0x7c00100,0xe30400,0x300a4829,0x7c00900,0x1230400,0x300a4929,0x4000000,0xe00000,0x3040259a,0x4000010, +0x400000,0x3040259a,0x4000010,0xb70000,0x3040259a,0xc000010,0xb48000,0x304028bc,0x4000001,0xc41c0b,0x304a3dcc,0x4000000,0xe00000,0x30800c27,0x2802100,0x962460, +0x30c01c92,0x6800000,0x1329800,0x3100080e,0x7c00120,0x220402,0x3100080e,0x7c00120,0x250402,0x31005167,0x1000,0,0x3100581e,0x4000000,0x200000,0x3100581e, +0x7c00100,0x230400,0x3100590d,0x7c00100,0x230400,0x31005a09,0x7c00100,0x220400,0x31005a09,0x7c00100,0x250400,0x31005b00,0x4000000,0x200000,0x31005c00,0x80000, +0x918820,0x31005c00,0x2802000,0x962460,0x31005c00,0x2802400,0x962460,0x31005c00,0x4000000,0x200000,0x31005c00,0x4000000,0x200001,0x31005c00,0x6800000,0x962540, +0x31005c00,0x6800400,0x962540,0x31005c01,0x2802400,0x962460,0x31005d00,0x4000020,0x200005,0x31005d00,0x6800020,0x1329805,0x31005d00,0x7c00120,0x220405,0x31005d00, +0x7c00120,0x250405,0x31006000,0x82000,0x962460,0x31006000,0x180000,0x918820,0x310a5e11,0x7c40300,0xe30000,0x310a5f11,0x7c00300,0xe30001,0x32000419,0x7c00100, +0x250400,0x3200080e,0x4000020,0x200000,0x3200080e,0x7c00100,0x220400,0x3200080e,0x7c00100,0x250400,0x32000908,0x7c00100,0x220400,0x32000908,0x7c00100,0x250400, +0x32000c02,0x7c00100,0x230400,0x32000e25,0x7c00100,0x230400,0x32001d0c,0x7c00100,0x230400,0x32002800,0x80000,0x1e18820,0x32002800,0x80020,0x218820,0x32002800, +0x4000001,0x445802,0x32002800,0x24000000,0x200000,0x32002800,0x24000000,0x1500002,0x32002800,0x24000020,0x200000,0x32002800,0x2c000010,0x1248002,0x32002919,0x7c00100, +0x22040f,0x32002a00,0x4000000,0x1600000,0x32002b01,0x2000,0x962460,0x32002b01,0x2802000,0x962460,0x32002b01,0x2802020,0x962460,0x32002c00,0x4000000,0x200000, +0x32002c00,0x4000020,0x200000,0x32002c00,0x4000020,0x200005,0x32002c00,0x7c00120,0x220405,0x32002c00,0x7c00120,0x250405,0x32002e00,0x24000020,0x200000,0x32002f00, +0x24000020,0x200000,0x32003000,0x24000000,0x200000,0x32003000,0x24000020,0x200000,0x32003500,0x24000000,0x200000,0x32003600,0x24000020,0x200000,0x32003700,0x24000000, +0x100000,0x32003700,0x24000000,0x200000,0x32003800,0x24000000,0x810000,0x32003800,0x24000000,0x1410000,0x32005102,0x4000000,0x1500008,0x32005502,0x7c00100,0x230400, +0x32006108,0x7c00100,0x220400,0x32006108,0x7c00100,0x250400,0x3200622a,0x2802100,0x962460,0x3200622a,0x2806400,0x962460,0x3200622a,0x7c00100,0x230400,0x3200632b, +0x2802100,0x962460,0x3200632b,0x6804000,0x962540,0x3200632b,0x7c00100,0x230400,0x3200642c,0x2802100,0x962460,0x3200642c,0x7c00100,0x230400,0x3200652d,0x2802100, +0x962460,0x3200652d,0x7c00100,0x230400,0x32006600,0x24000020,0x200000,0x32006700,0x24000020,0x200000,0x32006800,0x24000020,0x200000,0x32006900,0x24000020,0x200000, +0x32006900,0x24000020,0x810000,0x32006900,0x24000020,0x1410000,0x32006a00,0x24000020,0x200000,0x32006a00,0x24000020,0x200001,0x32006a00,0x24000020,0x200002,0x32020701, +0x2882000,0xc62460,0x32023300,0x4000000,0x100000,0x32026c01,0x12882000,0x962460,0x32065700,0x4000000,0x810011,0x32065700,0x4000000,0x1410011,0x32086600,0x24000020, +0x810000,0x32086600,0x24000020,0x1410000,0x32086900,0x24000020,0x810000,0x32086900,0x24000020,0x1410000,0x320a3600,0x24000020,0x200000,0x320a3d11,0x7c00100,0x1230400, 0x320a3e14,0x7c00100,0xe30010,0x320a3e14,0x7c00100,0x2530000,0x320a3f16,0x7c00100,0xe30c10,0x320a4400,0x4000000,0xe00003,0x320a4929,0x4000000,0xe00000,0x320a4f11, -0x7c00300,0xe30001,0x320a6b16,0x7c00100,0x2530c00,0x3240638b,0xc000010,0x448000,0x324a3dc2,0x4000000,0x14e00000,0x324a3dc2,0x7c00100,0x1230400,0x324a3fbd,0x4000002, -0x1200c00,0x324a53ba,0x24000000,0xe00000,0x32820701,0x2802000,0x962460,0x40000419,0x7c00100,0x220400,0x40000519,0x7c00100,0x220400,0x40000600,0x4000400,0x200400, +0x7c00300,0xe30001,0x320a6b16,0x7c00100,0x2530c00,0x32406396,0xc000010,0x448000,0x324a3dcf,0x4000000,0xe00000,0x324a3dcf,0x7c00100,0x1230400,0x324a3fca,0x4000002, +0x1200c00,0x324a53c7,0x24000000,0xe00000,0x32820701,0x2802000,0x962460,0x40000419,0x7c00100,0x220400,0x40000519,0x7c00100,0x220400,0x40000600,0x4000400,0x200400, 0x4000080e,0x7c00100,0x220400,0x4000080e,0x7c00100,0x250400,0x4000080e,0x7c00100,0x250402,0x40000c02,0x2802100,0x962460,0x40000c02,0x2802400,0x962460,0x40000c02, -0x2802500,0x962460,0x40000c02,0x4000000,0x200000,0x40000c02,0x4000000,0x1071400,0x40000c02,0x7c00100,0x230400,0x40000c02,0x80000000,0x218960,0x40000d22,0x7c00100, +0x2802500,0x962460,0x40000c02,0x4000000,0x200000,0x40000c02,0x4000000,0x1071400,0x40000c02,0x7c00100,0x230400,0x40000c02,0x80000000,0x1329960,0x40000d22,0x7c00100, 0x230400,0x40000f0a,0x7c00100,0x230400,0x40001004,0x7c00100,0x230400,0x40001110,0x2802100,0x962460,0x40001110,0x6800100,0x962540,0x4000120f,0x2802100,0x962460, 0x4000120f,0x4000000,0x1600000,0x4000120f,0x7c00100,0x230400,0x4000131f,0x7c00100,0x230400,0x40001423,0x4000000,0x200000,0x40001423,0x4000000,0x1600000,0x40001615, 0x2802400,0x962460,0x40001615,0x7c00100,0x230400,0x40002417,0x2802400,0x1862460,0x40002417,0x4000000,0x200000,0x40002800,0x6800000,0x201c00,0x40002800,0x24000002, -0x200000,0x40002c00,0x4000000,0x200002,0x40003000,0x24000000,0x14200000,0x40003000,0x24000020,0x200000,0x40003700,0x24000000,0x200000,0x40003700,0x24000000,0x4200000, -0x40003700,0x24000000,0x14200000,0x40005a09,0x7c00100,0x220400,0x40005a09,0x7c00100,0x250400,0x40005d00,0x7c00120,0x220405,0x40006f30,0x2802100,0x962460,0x40006f30, -0x2802400,0x962460,0x40006f30,0x4000000,0x200000,0x40006f30,0x6800000,0x1329800,0x40006f30,0x6800100,0x962540,0x40006f30,0x7c00100,0x230400,0x40006f30,0xc000010, -0xb48000,0x40007034,0x7c00100,0x1830000,0x40007117,0x4000000,0x200000,0x40007208,0x7c00100,0x220400,0x4000720e,0x7c00100,0x220400,0x4000720e,0x7c00500,0x22040e, -0x4000720e,0x7c00500,0x22040f,0x40007219,0x7c00100,0x220400,0x40007219,0x7c00500,0x220400,0x40007219,0x7c00500,0x22040e,0x40007219,0x7c00500,0x22040f,0x40007300, -0x24000000,0x200000,0x40007300,0x24000000,0x14200000,0x40007400,0x4000000,0x200000,0x40007531,0x7c00100,0x230400,0x40007631,0x7c00100,0x230400,0x40007835,0x4000010, -0x400000,0x40007835,0x7c00100,0x230400,0x40007933,0x7c00100,0x230400,0x40007a32,0x6800000,0x1329800,0x40007a32,0x7c00100,0x230400,0x40007b2f,0x7c00100,0x230400, -0x40007c00,0x4000000,0x200000,0x40020701,0x2802400,0x962460,0x40020701,0x2802400,0xc62460,0x40023300,0x4000000,0x200000,0x40027d01,0x12882000,0x962460,0x400a3700, -0x24000000,0x34200000,0x400a3700,0x24000000,0x34e00000,0x400a4400,0x4000000,0xe0000d,0x400a4412,0x4000000,0xe00002,0x400a4412,0x4000000,0xe00003,0x400a4500,0x4000000, -0xe0000d,0x400a5300,0x4000000,0x810010,0x400a5300,0x4000000,0x1410010,0x404077fc,0x4000000,0x200000,0x404077ff,0x4000000,0x200000,0x404077ff,0x4000000,0x400000, -0x40c0147e,0x4000000,0x200000,0x40c051fa,0x4000000,0x200000,0x41000419,0x7c00100,0x220400,0x41000419,0x7c00100,0x250400,0x4100080e,0x7c00100,0x220400,0x4100080e, -0x7c00100,0x250400,0x41000908,0x7c00100,0x220400,0x41000908,0x7c00100,0x250400,0x41000b13,0x2802000,0x962460,0x41000b13,0x2802100,0x962460,0x41000b13,0x4000000, -0xb00000,0x41000c02,0x2802100,0x962460,0x41000c02,0x4000000,0x1500000,0x41000c02,0xc000010,0xb48000,0x41000f0a,0x7c00100,0x230400,0x41001004,0x7c00100,0x230400, -0x41001423,0x7c00100,0x230400,0x41001b27,0x4000000,0x500000,0x41001d0c,0x7c00100,0x230400,0x41001d0c,0x7c00100,0x23040f,0x41001f0b,0x2802400,0x962460,0x41001f0b, -0x4000000,0x200000,0x41001f0b,0x7c00100,0x230400,0x41002800,0x24000000,0x200000,0x41002800,0x24000000,0x400000,0x41002919,0x7c00100,0x22040e,0x41002a00,0x4000000, -0x1600000,0x41002b01,0x2802020,0x962460,0x41002c00,0x4000000,0x200000,0x41002c00,0x7c00120,0x220405,0x41003000,0x24000000,0x200000,0x41003700,0x24000000,0x4200000, -0x41003700,0x24000000,0x14200000,0x41003700,0x24000000,0x14e00000,0x41005d00,0x7c00120,0x220405,0x41006600,0x24000020,0x200000,0x41006600,0x24000020,0x810000,0x41006600, -0x24000020,0x1410000,0x41007208,0x7c00100,0x22040f,0x41007219,0x7c00100,0x220400,0x41007300,0x24000000,0x200000,0x41007e0e,0x2802000,0x962460,0x41007e0e,0x4000000, -0x200000,0x41007f0e,0x4000000,0x200000,0x41007f0e,0x7c00100,0x230400,0x41008002,0x7c00100,0x230400,0x41008137,0x2802100,0x962460,0x41008137,0x4000000,0x200000, -0x41008137,0x6800100,0x962540,0x41008137,0x7c00100,0x230400,0x41008301,0x2802000,0x962460,0x41008407,0x4000000,0x200000,0x41008407,0x4000000,0x400000,0x41008407, -0x4000000,0xb00000,0x41008407,0x7c00100,0x220400,0x41008407,0x7c00100,0x250400,0x4100850b,0x7c00100,0x230400,0x4100860b,0x4000000,0x200000,0x4100860b,0x7c00100, -0x230400,0x4100870c,0x7c00100,0x220400,0x41008838,0x7c00100,0x220400,0x41008838,0x7c00100,0x250400,0x41008939,0x2802000,0x962460,0x41008939,0x2802100,0x962460, -0x41008939,0x2806000,0x962460,0x41008939,0x4000000,0x200000,0x41008939,0x4000000,0x400000,0x41008939,0x7c00100,0x230400,0x41008939,0xc000010,0x448000,0x41008a00, -0x4000400,0x200400,0x41008b3b,0x4000000,0x1800000,0x41008b3b,0x6800000,0x1329800,0x41008b3b,0x7c00100,0x1830000,0x41008b3b,0x7e00100,0x1830000,0x41008c3d,0x4000010, -0x400000,0x41008c3d,0x7c00100,0x230400,0x41008d0e,0x7c00100,0x22040f,0x41008d19,0x7c00100,0x220400,0x41008d19,0x7c00100,0x22040f,0x41008e00,0x24000000,0x200000, -0x41008e00,0x24000000,0x400000,0x41008e00,0x24000000,0x1710000,0x41008e00,0x24000006,0x400000,0x41008f3a,0x2802100,0x962460,0x41008f3a,0x2806000,0x962460,0x41008f3a, -0x4000000,0x200000,0x41008f3a,0x6800100,0x962540,0x41008f3a,0x7c00100,0x230400,0x4100903c,0x7c00100,0x230400,0x4100903c,0x7c00100,0x23040f,0x41020701,0x2802000, -0x962460,0x41020701,0x2802000,0xc62460,0x410a3700,0x24000000,0x34200000,0x410a3700,0x24000000,0x34e00000,0x410a4412,0x4000000,0xe00003,0x410a4711,0x7c40300,0xe30000, -0x410a4f11,0x7c00300,0xe30001,0x410a9100,0x4000000,0x800010,0x410a9100,0x4000000,0x810010,0x410a9100,0x4000000,0x870010,0x410a9100,0x4000000,0xb00010,0x410a9100, -0x4000000,0xf00010,0x410a9100,0x4000000,0x1001410,0x410a9100,0x4000000,0x1071010,0x410a9100,0x4000000,0x1071410,0x410a9100,0x4000000,0x1410010,0x41408ac5,0x4000400, -0x200000,0x414a82bf,0x4000000,0xe00000,0x41808300,0x2802000,0x962460,0x41c0147e,0x6800000,0x1329800,0x50000419,0x7c00100,0x220400,0x50000419,0x7c00100,0x250400, -0x5000080e,0x7c00100,0x220400,0x50000908,0x7c00100,0x220400,0x50000908,0x7c00100,0x250400,0x50000b13,0x2802500,0x962460,0x50000f0a,0x7c00100,0x230400,0x50001615, -0x2802100,0x962460,0x50001615,0x7c00100,0x230400,0x50002b01,0x2802020,0x962460,0x50002c00,0x4000000,0x200000,0x50002c19,0x7c00100,0x220400,0x50002d19,0x7c00100, -0x220400,0x50003000,0x24000000,0x200000,0x50003000,0x24000020,0x200000,0x50003700,0x24000000,0x4200000,0x50005d00,0x7c00120,0x220405,0x50005d00,0x7c00120,0x250405, -0x50006108,0x7c00100,0x220400,0x50006108,0x7c00100,0x250400,0x50006600,0x24000020,0x200000,0x50007300,0x24000000,0x200000,0x50008301,0x2802400,0x962460,0x50008a00, -0x7c00500,0x230400,0x50009257,0x2802400,0x962460,0x50009257,0x4000000,0x200000,0x50009257,0x4000010,0x1071400,0x50009257,0x6800000,0x1329800,0x50009257,0x7c00100, -0x230400,0x50009257,0x7c00500,0x230400,0x50009257,0x7c00900,0x230400,0x50009257,0xc000010,0xb48000,0x5000933e,0x2802100,0x962460,0x5000933e,0x2802400,0x962460, -0x5000933e,0x4000000,0x200000,0x5000933e,0x4000000,0x400000,0x5000933e,0x4000010,0x400000,0x5000933e,0x6800000,0x1329800,0x5000933e,0x6800100,0x962540,0x5000933e, -0x6800100,0x962541,0x5000933e,0x6804400,0x962540,0x5000933e,0x7c00100,0x230400,0x5000933e,0x7c00100,0x230401,0x5000933e,0xc000010,0x448000,0x50009419,0x7c00100, -0x220400,0x50009419,0x7c00100,0x250400,0x50009500,0x4000400,0x200400,0x5000965a,0x4000000,0x500000,0x5000965a,0x7c00100,0x230400,0x5000965a,0xc000010,0xb48000, -0x5000975b,0x4000000,0x200000,0x5000975b,0x4000010,0x400000,0x5000975b,0x7c00100,0x230400,0x50009865,0x7c00100,0x230400,0x50009965,0x4000010,0x400000,0x50009965, -0x7c00100,0x230400,0x50409abf,0x4000000,0x200000,0x5100080e,0x7c00100,0x220400,0x5100080e,0x7c00100,0x250400,0x51000c02,0x2802100,0x962460,0x51000c02,0x4000000, -0x1500000,0x51000c02,0x4000020,0x200000,0x51000c02,0x7c00100,0x230400,0x51000f0a,0x7c00100,0x230400,0x51000f0a,0x7c00500,0x230400,0x51001110,0x2802100,0x962460, -0x5100131f,0x2802100,0x962460,0x51001423,0x7c00100,0x230400,0x51001524,0x2802100,0x962460,0x51001524,0x4000000,0x200000,0x51001524,0x7c00100,0x230400,0x5100171a, -0x2802100,0x962460,0x5100171a,0x4000000,0x200000,0x5100171a,0x4000000,0x1500000,0x5100171a,0x7c00100,0x230400,0x51001b27,0x4000000,0x200000,0x51001b27,0x4000000, -0x400000,0x51001b27,0x4000000,0x500000,0x51001b27,0x7c00100,0x230400,0x51001c1c,0x2802100,0x1862460,0x51001c1c,0x2802500,0x1862460,0x51001c1c,0x2806400,0x1862460, -0x51001c1c,0x4000000,0x1800000,0x51001c1c,0x6800000,0x1329800,0x51001c1c,0x6800100,0x1862400,0x51001c1c,0x6800100,0x1862540,0x51001c1c,0x6800500,0x1862400,0x51001c1c, -0x7c00100,0x1830000,0x5100251b,0x7c00100,0x230400,0x51002619,0x7c00100,0x220400,0x51002619,0x7c00100,0x250400,0x51002800,0x80020,0x218820,0x51002c00,0x4000000, -0x200000,0x51002d19,0x7c00100,0x230400,0x51003700,0x24000000,0x4200000,0x51003700,0x24000000,0x4e00000,0x51005201,0x2802400,0x962460,0x51005c00,0x4000000,0x200000, -0x51006108,0x7c00100,0x220400,0x51006108,0x7c00100,0x250400,0x51006600,0x24000020,0x200000,0x51006600,0x24000020,0x810000,0x51006600,0x24000020,0x1410000,0x51007300, -0x24000000,0x200000,0x51007300,0x24000020,0x200000,0x51008002,0x7c00100,0x230400,0x51008301,0x2802000,0x962460,0x51008301,0x2802400,0x962460,0x51008a00,0x7c00500, -0x230400,0x51008e00,0x24000000,0x200000,0x51008e00,0x24000000,0x400000,0x51008e00,0x24000000,0x810000,0x51008e00,0x24000000,0x1400000,0x51008e00,0x24000000,0x1410000, -0x51008e00,0x24000000,0x1710000,0x51008e00,0x24000002,0x200000,0x51008e00,0x24000500,0x230400,0x51008e00,0x2c000010,0xb48000,0x51009419,0x7c00100,0x220400,0x51009419, -0x7c00100,0x22040e,0x51009419,0x7c00100,0x22040f,0x51009419,0x7c00100,0x250400,0x51009500,0x4000400,0x200400,0x51009500,0x7c00500,0x230400,0x51009519,0x7c00100, -0x220400,0x51009519,0x7c00100,0x22040f,0x51009519,0x7c00100,0x230400,0x51009519,0x7c00100,0x250400,0x51009b71,0x2802100,0x962460,0x51009b71,0x6800000,0x1329800, -0x51009b71,0x6800100,0x962540,0x51009b71,0x6804400,0x962540,0x51009b71,0x7c00100,0x230400,0x51009c52,0x2802100,0x962460,0x51009c52,0x2802400,0x962460,0x51009c52, -0x2802d00,0x962460,0x51009c52,0x4000010,0x400000,0x51009c52,0x6800000,0x1329800,0x51009c52,0x6800100,0x962540,0x51009c52,0x7c00100,0x230400,0x51009c52,0xc000010, -0x448000,0x51009d6d,0x6800000,0x1329800,0x51009d6d,0x7c00100,0x230400,0x51009d6d,0x7c00500,0x230400,0x51009d6d,0x7c00d00,0x230400,0x51009d6d,0xc000010,0x448000, -0x51009e08,0x2802100,0x962460,0x51009f63,0x4000010,0x400000,0x51009f63,0x6800000,0x1329800,0x51009f63,0x7c00100,0x230400,0x51009f63,0x7c00900,0x230400,0x51009f63, -0xc000010,0x448000,0x51009f63,0xc000010,0xb48000,0x5100a008,0x2000,0x962460,0x5100a008,0x2802400,0x962460,0x5100a008,0x4000000,0x200000,0x5100a008,0x7c00100, -0x220400,0x5100a008,0x7c00100,0x230400,0x5100a008,0x7c00100,0x250400,0x5100a008,0x7c00500,0x230400,0x5100a16f,0x2806400,0x962460,0x5100a16f,0x6800000,0x1329800, -0x5100a16f,0x6800100,0x962540,0x5100a16f,0x7c00100,0x230400,0x5100a16f,0xc000010,0x448000,0x5100a24f,0x2802100,0x962460,0x5100a24f,0x2802400,0x962460,0x5100a24f, -0x6800000,0x1329800,0x5100a24f,0x7c00100,0x230400,0x5100a24f,0xc000010,0x448000,0x5100a36e,0x2802100,0x962460,0x5100a36e,0x4000000,0x200000,0x5100a36e,0x6800100, -0x962540,0x5100a36e,0x6804400,0x962540,0x5100a36e,0x7c00100,0x230400,0x5100a442,0x2802100,0x962460,0x5100a442,0x4000000,0x200000,0x5100a442,0x6800000,0x1329800, -0x5100a442,0x6800100,0x962540,0x5100a442,0x7c00100,0x230400,0x5100a442,0xc000010,0x448000,0x5100a500,0x4000000,0x200000,0x5100a600,0x4000000,0x200000,0x5100a601, -0x2802000,0x962460,0x5100a76b,0x7c00100,0x230400,0x5100a868,0x7c00100,0x230400,0x5100a96c,0x4000000,0x200000,0x5100a96c,0x7c00100,0x230400,0x5100aa00,0x4000000, -0x4e00000,0x5100ab00,0x4000000,0x4e00000,0x51086600,0x24000020,0x810000,0x51086600,0x24000020,0x1410000,0x510a4005,0x7c00100,0xe30400,0x510a4711,0x7c40300,0xe30000, -0x510a7300,0x24000000,0x34200000,0x510aaa00,0x4000000,0x34e00000,0x5140a2f3,0x4000400,0x400000,0x514a82bf,0x4000000,0xe00000,0x51802bb1,0x2802000,0x962460,0x51c00908, -0x2802400,0x962460,0x51c0a008,0x2802400,0x962460,0x52000f0a,0x2802100,0x962460,0x52000f0a,0x6800100,0x962540,0x52000f0a,0x7c00100,0x230400,0x52001004,0x4000000, -0x1600000,0x52001b00,0x4000000,0x200000,0x52001c1c,0x2802100,0x1862460,0x52001c1c,0x6800100,0x1862400,0x52001c1c,0x6800500,0x1862400,0x52001e12,0x7c00100,0x2230500, -0x52001e12,0x7c00100,0x2330520,0x52002128,0x4000002,0x400000,0x52002128,0x7c00100,0x230400,0x52002a00,0x4000000,0x1500000,0x52002a00,0x4000000,0x1600000,0x52002d00, -0x4000000,0x200006,0x52003000,0x24000000,0x200000,0x52006108,0x7c00100,0x220400,0x52006108,0x7c00100,0x250400,0x52008301,0x2802400,0x962460,0x52008407,0x2802400, -0x962460,0x52008407,0x7c00100,0x220400,0x52008407,0x7c00100,0x250400,0x52008b3b,0x6800000,0x1800000,0x52008b3b,0x7c00100,0x1830000,0x52008e00,0x24000000,0x400000, -0x52009419,0x7c00100,0x250400,0x5200975b,0x4000000,0x200000,0x5200ac7e,0x2802000,0x962460,0x5200ac7e,0x2802100,0x962460,0x5200ac7e,0x2802400,0x962460,0x5200ac7e, -0x4000010,0x200000,0x5200ac7e,0x7c00100,0x230400,0x5200ac7e,0xc000010,0x248000,0x5200ad28,0x7c00100,0x230400,0x5200ae6a,0x2802100,0x1862460,0x5200ae6a,0x2802400, -0x962460,0x5200ae6a,0x2802400,0x1862460,0x5200ae6a,0x2806000,0x1862460,0x5200ae6a,0x4000000,0x1800000,0x5200ae6a,0x6800000,0x1329800,0x5200ae6a,0x6800100,0x1862400, -0x5200ae6a,0x6800100,0x1862540,0x5200ae6a,0x7c00100,0x1830000,0x5200ae6a,0x7c00900,0x1830000,0x5200ae6a,0xc000010,0x1848000,0x5200b083,0x4000010,0x400000,0x5200b083, -0x7c00100,0x230400,0x5200b083,0xc000010,0x448000,0x5200b182,0x2802400,0x962460,0x5200b182,0x4000000,0x200000,0x5200b182,0x4000010,0x400000,0x5200b182,0x7c00100, -0x230400,0x5200b182,0xc000010,0x448000,0x5200b30a,0x2802400,0x962460,0x5200b30a,0x4000000,0x200000,0x5200b30a,0x7c00100,0x230400,0x5200b54e,0x2802100,0x962460, -0x5200b54e,0x2802400,0x962460,0x5200b54e,0x4000000,0x200000,0x5200b54e,0x4000010,0x400000,0x5200b54e,0x6800000,0x1329800,0x5200b54e,0x6800100,0x962540,0x5200b54e, -0x6804400,0x962540,0x5200b54e,0x7c00100,0x230400,0x5200b54e,0xc000010,0x448000,0x5200b61c,0x4000000,0x1800000,0x5200b61c,0x6800500,0x1862400,0x5200b61c,0x7c00100, -0x1830000,0x5200b61c,0x7c00900,0x1830000,0x5200b77f,0x2802100,0x1862460,0x5200b77f,0x2802400,0x1862460,0x5200b77f,0x4000000,0x1800000,0x5200b77f,0x4000010,0x1800000, -0x5200b77f,0x7c00100,0x1830000,0x5200b77f,0x7c00500,0x1830000,0x5200b77f,0x7c00900,0x1830000,0x5200b77f,0x7e00100,0x1830000,0x5200b873,0x2802100,0x962460,0x5200b873, -0x2806400,0x962460,0x5200b873,0x6800000,0x1329800,0x5200b873,0x6800100,0x962540,0x5200b873,0x6800400,0x962540,0x5200b873,0x7c00100,0x230400,0x5200b873,0xc000010, -0x448000,0x5200b912,0x7c00100,0x2230500,0x5200b912,0x7c00100,0x2330520,0x5200ba74,0x4000000,0x200000,0x5200ba74,0x4000010,0x400000,0x5200ba74,0x7c00100,0x230400, -0x5200bb85,0x4000000,0x200000,0x5200bb85,0x7c00100,0x230400,0x5200bc75,0x4000000,0x400000,0x5200bc75,0x4000010,0x400000,0x5200bc75,0x7c00100,0x230400,0x5200bd7d, -0x4000000,0x200000,0x5200bd7d,0x7c00100,0x230400,0x5200be7a,0x4000000,0x200000,0x5200be7a,0x7c00100,0x230400,0x5200bf58,0x7c00100,0x230400,0x5200c002,0x4000000, -0x200000,0x5200c178,0x2802000,0x962460,0x5200c178,0x2802100,0x962460,0x5200c178,0x2802400,0x962460,0x5200c178,0x2806400,0x962460,0x5200c178,0x4000000,0x200000, -0x5200c178,0x6800100,0x962540,0x5200c178,0x7c00100,0x230400,0x5200c178,0x7c00100,0x230401,0x5200c178,0xc000010,0x448000,0x5200c178,0x80000000,0x218960,0x5200c247, -0x7c00100,0x230400,0x5200c247,0x7c00100,0x830400,0x5200c247,0x7c00100,0x1430400,0x5200c300,0x4000000,0x200003,0x52022d00,0x4000000,0x100006,0x52023700,0x24000000, -0x4100000,0x52023700,0x24000000,0x4e00000,0x52023700,0x24000000,0x14100000,0x52023700,0x24000000,0x14e00000,0x52023700,0x24000000,0x96800000,0x52024400,0x4000000,0x100000, -0x52027300,0x24000000,0x100000,0x5202c300,0x4000000,0x100000,0x5202c300,0x4000000,0x100002,0x5202c300,0x4000000,0x100003,0x5202c300,0x4000000,0x10000d,0x5202c300, -0x4000100,0x150400,0x5202c300,0x4000100,0x15040d,0x5202c300,0x4000100,0x14150400,0x520a1e12,0x7c00100,0x2130480,0x520a3700,0x24000000,0x34e00000,0x520a3800,0x24000000, -0x34100000,0x520a4711,0x7c40300,0xe30000,0x520a4f11,0x7c00300,0xe30001,0x520a7300,0x24000000,0x34100000,0x520ab412,0x7c00100,0x2130480,0x520ac400,0x4000000,0xe00002, -0x520ac400,0x4000000,0xe0000d,0x520ac400,0x4000000,0x34e0000d,0x520ac414,0x4000000,0xe0000d,0x520ac511,0x7c40300,0xe30000,0x5240af91,0x7c00100,0x230400,0x5240af96, -0x4000400,0x200000,0x5240af98,0x6800400,0x962540,0x5240af98,0x7c00100,0x230400,0x5240afa2,0x7c00100,0x230400,0x5240afa4,0x7c00100,0x230400,0x5240b2c7,0x4000000, -0x200000,0x5240b2c7,0x4000000,0x1500000,0x5240b2d2,0x4000000,0x200000,0x5240b2e0,0x4000000,0x200000,0x5240b5f6,0x7c00900,0x230400,0x524a44bf,0x4000000,0xe00003, -0x5280af91,0x2802400,0x962460,0x5280af92,0x2802400,0x962460,0x5280af98,0x2802400,0x962460,0x5280af9a,0x2802400,0x962460,0x5280af9c,0x2802400,0x962460,0x52c0b3ed, -0x2802400,0x962460,0x52c0b3f1,0x7c00100,0x230400,0x60000c02,0x2802100,0x962460,0x60000c02,0x7c00100,0x230400,0x60000f0a,0x2802100,0x962460,0x60000f0a,0x6800100, -0x962540,0x60000f0a,0x7c00100,0x230400,0x6000131f,0x4000000,0x200000,0x6000171a,0x7c00100,0x230400,0x6000171a,0x7c00100,0x230560,0x60001b27,0x2802100,0x962460, -0x60001b27,0x4000000,0xc00000,0x60001b27,0x7c00100,0x230400,0x60001f0b,0x2802400,0x962460,0x60002919,0x7c00100,0x22040e,0x60002a00,0x4000000,0x1600000,0x60003000, -0x24000000,0x14200000,0x60003000,0x24000000,0x14e00000,0x60003700,0x24000000,0x4200000,0x60003800,0x24000000,0x1710000,0x60005102,0x4000000,0x200000,0x60006108,0x7c00100, -0x220400,0x60006108,0x7c00100,0x250400,0x60006600,0x24000020,0x200000,0x60008301,0x2802000,0x962460,0x6000903c,0x2806000,0x962460,0x6000903c,0x4000000,0x400000, -0x60009519,0x7c00100,0x220400,0x60009519,0x7c00100,0x250400,0x6000a008,0x7c00100,0x220400,0x6000a008,0x7c00100,0x250400,0x6000c300,0x4000000,0x3a703580,0x6000c654, -0x2802000,0x962460,0x6000c654,0x4000010,0x200000,0x6000c654,0x7c00100,0x230400,0x6000c73f,0x2802000,0x962460,0x6000c73f,0x2802100,0x962460,0x6000c73f,0x4000000, -0x200000,0x6000c73f,0x6800100,0x962540,0x6000c73f,0x6804000,0x962540,0x6000c73f,0x7c00100,0x230400,0x6000c80b,0x7c00100,0x230400,0x6000c941,0x2802100,0x962460, -0x6000c941,0x2806000,0x962460,0x6000c941,0x4000000,0x200000,0x6000c941,0x4000010,0x200000,0x6000c941,0x6800000,0x1329800,0x6000c941,0x6800100,0x962540,0x6000c941, -0x7c00100,0x230400,0x6000c941,0xc000010,0x448000,0x6000ca82,0x7c00100,0x230400,0x6000cc00,0x4000000,0x4e00000,0x6000d000,0x4000000,0x200000,0x6002c300,0x4000000, -0x100000,0x6002c300,0x4000000,0x10000d,0x6002c300,0x4000100,0x150400,0x6002c300,0x4000100,0x15040d,0x6002c300,0x4000100,0x14150400,0x600a3000,0x24000000,0x34200000, -0x600a3000,0x24000000,0x34e00000,0x600a3700,0x24000000,0x34200000,0x600a3800,0x24000000,0x34200000,0x600a3800,0x24000000,0xb6800000,0x600a4305,0x7c00100,0xe30400,0x600ac300, -0x4000000,0x34100000,0x600ac400,0x4000000,0x14e0000d,0x600ac400,0x4000000,0x34e0000d,0x600acb14,0x7c00100,0xe30000,0x600acb16,0x7c00100,0xe30c00,0x600acc00,0x4000000, -0x34e00000,0x600acd00,0x4000000,0x34200000,0x600acd00,0x4000000,0x34e00000,0x600acd00,0x4000000,0xb6800000,0x600ace00,0x4000000,0x34e00000,0x600ace00,0x4000000,0xb6800000, -0x600acf00,0x4000000,0x34e00000,0x600acf00,0x4000000,0xb6800000,0x600ad111,0x7c40300,0xe30000,0x604ac4bf,0x4000000,0x34e00003,0x61000a03,0x4000000,0x1600000,0x61000c02, -0x80000000,0x218960,0x6100120f,0x4000000,0x200000,0x61001a18,0x7c00100,0x1830000,0x61001d0c,0x7c00100,0x230400,0x61001d0c,0x7c00100,0x250400,0x61006600,0x24000020, -0x200000,0x61008407,0x7c00100,0x220400,0x61008407,0x7c00100,0x250400,0x6100870c,0x7c00100,0x220400,0x61008e00,0x24000000,0x200000,0x61008e00,0x24000000,0x400000, -0x61008e00,0x24000002,0x300000,0x6100903c,0x7c00100,0x230400,0x61009519,0x7c00100,0x220400,0x61009519,0x7c00100,0x250400,0x61009519,0x7c00500,0x22040f,0x61009b71, -0x2802100,0x962460,0x61009b71,0x2806400,0x962460,0x61009b71,0x7c00100,0x230400,0x6100a008,0x2802100,0x962460,0x6100c300,0x4000000,0x20000f,0x6100cd00,0x4000000, -0x200000,0x6100d202,0x2802400,0x962460,0x6100d202,0x2802500,0x962460,0x6100d202,0x7c00100,0x230400,0x6100d302,0x4000020,0x200000,0x6100d302,0x7c00120,0x230405, -0x6100d476,0x2802100,0x962460,0x6100d476,0x2802100,0x962461,0x6100d476,0x2806400,0x962460,0x6100d476,0x4000000,0x400000,0x6100d476,0x6800000,0x1329800,0x6100d476, -0x6800100,0x962540,0x6100d476,0x7c00100,0x230400,0x6100d476,0xc000010,0x448000,0x6100d573,0x2802100,0x962460,0x6100d573,0x2806400,0x962460,0x6100d573,0x6800100, -0x962540,0x6100d573,0x7c00100,0x230400,0x6100d573,0x7c00900,0x230400,0x6100d573,0xc000010,0x448000,0x6100d68d,0x7c00100,0x230400,0x6100d756,0x7c00100,0x230400, -0x6100d85c,0x2802500,0x962460,0x6100d85c,0x6800100,0x962540,0x6100d85c,0x7c00100,0x230400,0x6100d85c,0x7c00500,0x230400,0x6100d997,0x2802100,0x962460,0x6100d997, -0x4000000,0x200000,0x6100d997,0x4000000,0x400000,0x6100d997,0x6800000,0x1329800,0x6100d997,0x6800100,0x962540,0x6100d997,0x6804400,0x962540,0x6100d997,0x7c00100, -0x230400,0x6100d997,0x7c00100,0x230560,0x6100d997,0xc000010,0x448000,0x6100da98,0x6800000,0x1329800,0x6100da98,0x7c00100,0x230400,0x6100db71,0x4000000,0x200000, -0x6100dc99,0x2802100,0x962460,0x6100dc99,0x2802400,0x962460,0x6100dc99,0x6800000,0x1329800,0x6100dc99,0x6800100,0x962540,0x6100dc99,0x6804400,0x962540,0x6100dc99, -0x7c00100,0x230400,0x610a4711,0x7c40300,0xe30000,0x610a4f11,0x7c00300,0xe30001,0x610ace00,0x4000000,0x34e00000,0x6140af96,0x7c00100,0x230400,0x6140af98,0x7c00100, -0x230400,0x6180af93,0x2802400,0x962460,0x62002a00,0x4000000,0x1600000,0x63002800,0x80000,0x918820,0x63c00c14,0x80000,0x918820,0x7000080e,0x7c00100,0x250400, -0x70000a03,0x4000000,0x200000,0x70000c00,0x80000000,0x218960,0x70000f0a,0x7c00100,0x230400,0x70001004,0x7c00100,0x230400,0x70001524,0x2802100,0x962460,0x70001524, -0x7c00100,0x230400,0x70001615,0x2802100,0x962460,0x7000171a,0x2802100,0x962460,0x70001821,0x6800000,0x1329800,0x70002320,0x7c00100,0x230400,0x70002a00,0x4000000, -0x1500000,0x70002a00,0x4000000,0x1600000,0x70003000,0x24000000,0x200000,0x70003000,0x24000000,0x14200000,0x70003800,0x24000000,0x4e00000,0x70005201,0x2802400,0x962460, -0x7000581e,0x7c00100,0x230400,0x70006108,0x7c00100,0x220400,0x70006108,0x7c00100,0x250400,0x70006f30,0x7c00100,0x230400,0x70007300,0x24000000,0x200000,0x70007f0e, -0x4000000,0x200000,0x70008301,0x2802100,0x962460,0x70008301,0x2802400,0x962460,0x70008e00,0x24000000,0x200000,0x70008e00,0x24000000,0x400000,0x70008e00,0x24000002, -0x400000,0x70008e00,0x24000008,0x1410000,0x70008e00,0x24000010,0x400000,0x70008e00,0x2c000010,0x448000,0x70009519,0x7c00100,0x220400,0x70009519,0x7c00100,0x230400, -0x70009519,0x7c00100,0x250400,0x70009865,0x7c00100,0x230400,0x70009965,0x4000010,0x400000,0x70009965,0x7c00100,0x230400,0x7000a008,0x7c00100,0x220400,0x7000a008, -0x7c00100,0x250400,0x7000a008,0x7c00500,0x22040f,0x7000a50e,0x4000000,0x200000,0x7000b61c,0x2802500,0x1862460,0x7000b61c,0x6800500,0x1862400,0x7000b61c,0x7c00100, -0x1830000,0x7000c300,0x4000000,0x100000,0x7000c941,0x2806000,0x962460,0x7000cc00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x200000,0x7000cd00,0x4000000,0x4200000, -0x7000cd00,0x4000000,0x4e00000,0x7000cd00,0x4000000,0x14200000,0x7000cd00,0x4000000,0x14e00000,0x7000cd00,0x4000000,0x96800000,0x7000cf00,0x4000000,0x4e00000,0x7000cf00, -0x4000000,0x14e00000,0x7000d202,0x2802100,0x962460,0x7000d202,0x7c00100,0x230400,0x7000d997,0x7c00100,0x230400,0x7000d997,0xc000010,0x248000,0x7000dd86,0x2802400, -0x962460,0x7000dd86,0x7c00100,0x230400,0x7000dd86,0xc000010,0x448000,0x7000de9f,0x4000000,0x200000,0x7000de9f,0x7c00100,0x230400,0x7000e001,0x2000,0x962460, -0x7000e001,0x2802400,0x962460,0x7000e187,0x2802000,0x962460,0x7000e187,0x2802100,0x962460,0x7000e187,0x4000000,0x200000,0x7000e187,0x7c00100,0x230400,0x7000e187, -0xc000010,0x448000,0x7000e288,0x7c00100,0x230400,0x7000e300,0x4000000,0x200000,0x7000e489,0x2802100,0x962460,0x7000e489,0x2802400,0x962460,0x7000e489,0x6800100, -0x962540,0x7000e489,0x6800100,0x962541,0x7000e489,0x6804400,0x962540,0x7000e489,0x7c00100,0x230400,0x7000e489,0x7c00900,0x230400,0x7000e59d,0x2802100,0x962460, -0x7000e59d,0x2802400,0x962460,0x7000e59d,0x4000000,0x200000,0x7000e59d,0x4000010,0x200000,0x7000e59d,0x6800100,0x962540,0x7000e59d,0x6804400,0x962540,0x7000e59d, -0x7c00100,0x230400,0x7000e59d,0xc000010,0x448000,0x7000e691,0x2802100,0x962460,0x7000e691,0x2802400,0x962460,0x7000e691,0x2806400,0x962460,0x7000e691,0x6800000, -0x1329800,0x7000e691,0x6800100,0x962540,0x7000e691,0x7c00100,0x230400,0x7000e700,0x4000400,0x200400,0x7000e70e,0x7c00100,0x220400,0x7000e719,0x7c00100,0x220400, -0x7000e719,0x7c00500,0x22040f,0x7000e853,0x7c00100,0x230400,0x7000e9a0,0x2802400,0x962460,0x7000e9a0,0x4000000,0x200000,0x7000e9a0,0x4000000,0x500000,0x7000e9a0, -0x7c00100,0x230400,0x7000ea79,0x2802400,0x962460,0x7000ea79,0x4000000,0x200000,0x7000ea79,0x4000000,0xf00000,0x7000ea79,0x4000010,0x400000,0x7000ea79,0x7c00100, -0x230400,0x7000eb8c,0x2802400,0x962460,0x7000eb8c,0x4000000,0x200000,0x7000eb8c,0x7c00100,0x230400,0x7000eca3,0x2802100,0x962460,0x7000eca3,0x2806400,0x962460, -0x7000eca3,0x4000000,0x200000,0x7000eca3,0x6800000,0x1329800,0x7000eca3,0x6800100,0x962540,0x7000eca3,0x7c00100,0x230400,0x7000eca3,0xc000010,0x448000,0x7000ed95, -0x6800000,0x1329800,0x7000ed95,0x7c00100,0x230400,0x7000ed95,0xc000010,0x448000,0x7000ee1c,0x2802500,0x1862460,0x7000ee1c,0x6800000,0x1329800,0x7000ee1c,0x7c00100, -0x1830000,0x7000ee1c,0x7c00900,0x1830000,0x7000ef8f,0x4000000,0x200000,0x7000ef8f,0x7c00100,0x230400,0x7000f08e,0x4000000,0x200000,0x7000f08e,0x7c00100,0x230400, -0x7000f159,0x2802100,0x962460,0x7000f159,0x7c00100,0x230400,0x7000f200,0x4000000,0x200000,0x7000f200,0x4000000,0x1200000,0x7000f200,0x4000000,0x1710000,0x7000f34b, -0x2802400,0x962460,0x7000f34b,0x4000000,0x200000,0x7000f34b,0x4000010,0x400000,0x7000f34b,0x6800000,0x1329800,0x7000f34b,0x7c00100,0x230400,0x7000f34b,0x7c00900, -0x230400,0x7000f34b,0xc000010,0x448000,0x7000f490,0x4000000,0x200000,0x7000f490,0x7c00100,0x230400,0x7000f5a5,0x7c00100,0x230400,0x7000f67b,0x4000000,0x200000, -0x7000f67b,0x4000010,0x200000,0x7000f67b,0x7c00100,0x230400,0x7000f8a6,0x2802100,0x962460,0x7000f8a6,0x2802400,0x962460,0x7000f8a6,0x2806400,0x962460,0x7000f8a6, -0x4000000,0x500000,0x7000f8a6,0x4000010,0xb00000,0x7000f8a6,0x4000800,0x200000,0x7000f8a6,0x6800100,0x962540,0x7000f8a6,0x6800100,0x962541,0x7000f8a6,0x7c00100, -0x230400,0x7000f8a6,0xc000010,0x448000,0x7000f921,0x4000000,0x200000,0x7000fa00,0x4000000,0x200000,0x7000fb9e,0x2802100,0x962460,0x7000fb9e,0x2802400,0x962460, -0x7000fb9e,0x2806400,0x962460,0x7000fb9e,0x4000000,0x200000,0x7000fb9e,0x6800000,0x1329800,0x7000fb9e,0x6800100,0x962540,0x7000fb9e,0x6800100,0x962541,0x7000fb9e, -0x7c00100,0x230400,0x7000fc92,0x4000000,0x200000,0x7000fc92,0x6800000,0x1329800,0x7000fc92,0x7c00100,0x220400,0x7000fc92,0x7c00100,0x230400,0x7000fc92,0x7c00100, -0x250400,0x700acd00,0x4000000,0x34e00000,0x700acd00,0x4000000,0xb6800000,0x700ace00,0x4000000,0x34e00000,0x700acf00,0x4000000,0x34e00000,0x700acf00,0x4000000,0xb6800000, -0x7050df01,0x4000000,0x200000,0x7050f705,0x80000,0x918820,0x7080af96,0x2802400,0x962460,0x7090df01,0x2802400,0x962460,0x70d0e403,0x2802100,0x962460,0x70d0e403, -0x2802400,0x962460,0x70d0e403,0x6800100,0x962540,0x8000120f,0x7c00100,0x230400,0x80001524,0x7c00100,0x230400,0x8000171a,0x7c00100,0x230400,0x80002006,0x7c00100, -0x220400,0x80002006,0x7c00100,0x250400,0x80002a00,0x4000000,0x1500000,0x80002d00,0x4000000,0x200000,0x80005208,0x2802400,0x962460,0x80005c00,0x4000000,0x200000, -0x80007300,0x24000000,0x200000,0x80009519,0x7c00100,0x220400,0x80009519,0x7c00100,0x230400,0x80009519,0x7c00100,0x250400,0x80009865,0x7c00100,0x230400,0x8000a008, -0x2802100,0x962460,0x8000b30a,0x4000000,0x500000,0x8000b30a,0x7c00100,0x230400,0x8000cd00,0x4000000,0x4e00000,0x8000d202,0x2802500,0x962460,0x8000d202,0x7c00100, -0x230400,0x8000d68d,0x4000000,0x200000,0x8000d997,0x2802000,0x962460,0x8000d997,0x2802400,0x962460,0x8000d997,0x4000000,0x400000,0x8000d997,0x4000000,0x500000, -0x8000d997,0x7c00100,0x230400,0x8000d997,0xc000010,0x448000,0x8000e489,0x2802100,0x962460,0x8000e489,0x7c00100,0x230400,0x8000e719,0x7c00100,0x220400,0x8000f8a6, -0x2802100,0x962460,0x8000f8a6,0x7c00100,0x230400,0x8000f8a6,0xc000010,0x448000,0x8000fda1,0x2802100,0x1862460,0x8000fda1,0x2806400,0x1862460,0x8000fda1,0x4000000, -0x1800000,0x8000fda1,0x6800000,0x1329800,0x8000fda1,0x6800100,0x1862540,0x8000fda1,0x7c00100,0x1830000,0x8000fda1,0xc000010,0x448000,0x8000fe9c,0x7c00100,0x230400, -0x8000fe9c,0x7c00100,0x830400,0x8000fe9c,0x7c00100,0x1430400,0x8000ff06,0x7c00100,0x220400,0x80010165,0x7c00100,0x230400,0x800102a2,0x4000000,0x200000,0x800102a2, -0x7c00100,0x230400,0x800103a4,0x7c00100,0x230400,0x800103a4,0xc000010,0x448000,0x8001044c,0x4000000,0x200000,0x8001044c,0x7c00100,0x220400,0x8001044c,0x7c00100, -0x250400,0x80010670,0x2802000,0x962460,0x80010670,0x4000000,0x200000,0x80010670,0x4000010,0x400000,0x80010670,0xc000010,0x448000,0x800a4711,0x7c40300,0xe30000, -0x800acd00,0x4000000,0x34e00000,0x800acd00,0x4000000,0x7a902460,0x800ace00,0x4000000,0x34e00000,0x800acf00,0x4000000,0x34e00000,0x800b0011,0x7c40300,0xe30000,0x800b0500, -0x4000000,0x34e00000,0x800b0500,0x4000000,0xb6800000,0x90001615,0x7c00100,0x230400,0x9000171a,0x4000000,0x200000,0x9000171a,0x7c00100,0x230400,0x90003000,0x24000000, -0x200000,0x90007f0e,0x4000000,0x200000,0x90008301,0x2802000,0x962460,0x90008e00,0x24000000,0x400000,0x90009519,0x7c00100,0x250400,0x9000a16f,0x2802100,0x962460, -0x9000d200,0x80000000,0x218960,0x9000d202,0x2802000,0x962460,0x9000d202,0x2802100,0x962460,0x9000d202,0x7c00100,0x230400,0x9000e59d,0x2802100,0x962460,0x90010500, -0x4000000,0xe00000,0x900107a7,0x2802100,0x962460,0x900107a7,0x2802400,0x962460,0x900107a7,0x2802c00,0x962460,0x900107a7,0x4000000,0x1400000,0x900107a7,0x6800000, -0x1329800,0x900107a7,0x7c00100,0x220400,0x900107a7,0x7c00100,0x250400,0x900108a8,0x2802100,0x962460,0x900108a8,0x2806400,0x962460,0x900108a8,0x4000000,0x200000, -0x900108a8,0x4000000,0x400000,0x900108a8,0x4000010,0x400000,0x900108a8,0x6800000,0x1329800,0x900108a8,0x6800100,0x962540,0x900108a8,0x7c00100,0x230400,0x900108a8, -0xc000010,0x448000,0x90010908,0x7c00100,0x220400,0x90010a38,0x2802100,0x962460,0x90010ca9,0x2802100,0x962460,0x90010ca9,0x4000000,0x500000,0x90010ca9,0x4000010, -0xb00000,0x90010ca9,0x6800100,0x962540,0x90010ca9,0x7c00100,0x230400,0x90010d1b,0x4000000,0x500000,0x90010eaa,0x2802100,0x962460,0x90010eaa,0x2802400,0x962460, -0x90010eaa,0x2806400,0x962460,0x90010eaa,0x4000000,0x200000,0x90010eaa,0x4000000,0x400000,0x90010eaa,0x4000010,0x400000,0x90010eaa,0x6800000,0x1329800,0x90010eaa, -0x6800100,0x962540,0x90010eaa,0x7c00100,0x230400,0x90010eaa,0xc000010,0x448000,0x90010fab,0x7c00100,0x220400,0x90010fab,0x7c00100,0x250400,0x9002c300,0x4000000, -0x100000,0x900ac400,0x4000000,0xe0000d,0x900acd00,0x4000000,0x34e00000,0x900acd00,0x4000000,0xb6800000,0x900acf00,0x4000000,0x34e00000,0x900b0500,0x4000000,0x34e00000, -0x900b0500,0x4000000,0xb6800000,0x900b0b9a,0x7c00900,0x1230400,0x900b109a,0x7c00300,0xe30000,0x900b119a,0x7c00300,0xe30000,0x90408e06,0x24000000,0x400000,0xa0001004, -0x4000000,0x200000,0xa0001004,0x7c00100,0x230400,0xa000120f,0x2802100,0x962460,0xa000120f,0x2802400,0x962460,0xa000171a,0x2802100,0x962460,0xa000171a,0x2806400, -0x962460,0xa0002a00,0x4000000,0x1600000,0xa0003000,0x24000000,0x200000,0xa000581e,0x7c00100,0x230400,0xa0007300,0x24000000,0x200000,0xa0008301,0x2802400,0x962460, -0xa0008e00,0x24000000,0x400000,0xa000cf00,0x4000000,0x4e00000,0xa0010500,0x4000000,0x200000,0xa00114af,0x2802100,0x962460,0xa00114af,0x2802400,0x962460,0xa00114af, -0x2806400,0x962460,0xa00114af,0x6800000,0x1329800,0xa00114af,0x7c00100,0x230400,0xa00114af,0x7c00100,0x230560,0xa00116b0,0x2802100,0x962460,0xa00116b0,0x2802800, -0x962460,0xa00116b0,0x2806400,0x962460,0xa00116b0,0x4000000,0x400000,0xa00116b0,0x4000000,0x500000,0xa00116b0,0x4000010,0x400000,0xa00116b0,0x6800100,0x962540, -0xa00116b0,0x7c00100,0x230400,0xa00116b0,0x7c00100,0x230560,0xa00116b0,0xc000010,0x448000,0xa0011722,0x7c00100,0x230400,0xa00118b1,0x2802000,0x962460,0xa00118b1, -0x2802100,0x962460,0xa00118b1,0x2806400,0x962460,0xa00118b1,0x4000000,0x200000,0xa00118b1,0x4000000,0x400000,0xa00118b1,0x4000000,0x500000,0xa00118b1,0x6800100, -0x962540,0xa00118b1,0x7c00100,0x230400,0xa00118b1,0x7c00100,0x230560,0xa00118b1,0xc000010,0x448000,0xa00a4005,0x7c00100,0xe30400,0xa00a4711,0x7c40300,0xe30000, -0xa00ac400,0x4000000,0x4e00000,0xa00acb14,0x7c00100,0xe30000,0xa00acf00,0x4000000,0x34e00000,0xa00b0500,0x4000000,0x34e00000,0xa00b0500,0x4000000,0xb6800000,0xa00b0b96, -0x7c00900,0x1230400,0xa00b1211,0x7c40300,0xe30000,0xa00b1314,0x7c00100,0xe30000,0xa00b1596,0x7c00300,0xe30000,0xa040afac,0x6800400,0x962540,0xa08083ad,0x2802400, -0x962460,0xb0000a03,0x7c00100,0x220400,0xb0000b13,0x7c00100,0x2633800,0xb0001004,0x2802000,0x962460,0xb0001110,0x4000000,0x200000,0xb0001524,0x2802000,0x962460, -0xb0001615,0x4000000,0x500000,0xb000251b,0x7c00100,0x230400,0xb0007300,0x24000000,0x200000,0xb0008939,0x4000000,0x200000,0xb0008939,0x7c00100,0x230400,0xb0008e00, -0x24000000,0x200000,0xb0008e00,0x24000000,0x400000,0xb0008e00,0x24000010,0x400000,0xb0009257,0x2802000,0x962460,0xb0009257,0x4000000,0x1600000,0xb0009519,0x7c00100, -0x220400,0xb0009519,0x7c00100,0x250400,0xb0009a00,0x4000000,0x200000,0xb000b30a,0x2802100,0x962460,0xb000b30a,0x7c00100,0x230400,0xb000c178,0x80000000,0x218960, -0xb000c300,0x4000000,0x4200000,0xb000d202,0x2802000,0x962460,0xb000d476,0x6800100,0x962540,0xb000d476,0x7c00100,0x230400,0xb000e300,0x4000000,0x4e00000,0xb000fda1, -0x7c00100,0x1830000,0xb0010eaa,0x2802000,0x962460,0xb00116b0,0x7c00100,0x230400,0xb0011900,0x4000000,0x4e00000,0xb0011ab2,0x2802100,0x962460,0xb0011ab2,0x2802400, -0x962460,0xb0011ab2,0x2806400,0x962460,0xb0011ab2,0x4000000,0x200000,0xb0011ab2,0x6800100,0x962540,0xb0011ab2,0x7c00100,0x230400,0xb0011b0c,0x7c00100,0x230400, -0xb0011cb3,0x2802100,0x962460,0xb0011cb3,0x2806400,0x962460,0xb0011cb3,0x6800000,0x1329800,0xb0011cb3,0x6800100,0x962540,0xb0011cb3,0x7c00100,0x230400,0xb0011db6, -0x2802500,0x962460,0xb0011db6,0x6800000,0x1329800,0xb0011db6,0x7c00100,0x230400,0xb0011db6,0x7c00500,0x230400,0xb0011e00,0x4000000,0x200000,0xb0011e00,0x4000000, -0x1500000,0xb0011fb4,0x2802100,0x962460,0xb0011fb4,0x6800100,0x962540,0xb0011fb4,0x7c00100,0x230400,0xb0011fb4,0xc000010,0x248000,0xb0012000,0x4000000,0x200000, -0xb00121b5,0x4000000,0x200000,0xb00121b5,0x4000010,0x400000,0xb00121b5,0x7c00100,0x220400,0xb00121b5,0x7c00100,0x250400,0xb00121b5,0xc000010,0x448000,0xb00122b8, -0x4000000,0x200000,0xb00122b8,0x7c00100,0x230400,0xb00123b7,0x2802400,0x962460,0xb00123b7,0x4000000,0x200000,0xb00123b7,0x7c00100,0x230400,0xb00123b7,0xc000010, -0x248000,0xb00a4005,0x7c00100,0xe30400,0xb00a4711,0x7c40300,0xe30000,0xb00acf00,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x34e00000,0xb00b0500,0x4000000,0x3ce00000, -0xb00b0500,0x4000000,0xb6800000,0xb00b109a,0x7c00300,0xe30000,0xb080e47c,0x2802000,0x962460,0xc0001524,0x4000000,0x500000,0xc0001a18,0x2806400,0x1862460,0xc0001a18, -0x7c00100,0x1830000,0xc0007300,0x24000000,0x200000,0xc0008e00,0x24000010,0x400000,0xc0009519,0x7c00100,0x220400,0xc0009519,0x7c00100,0x250400,0xc000c300,0x4000000, -0x420000f,0xc000d85c,0x2802100,0x962460,0xc000d85c,0x6800100,0x962540,0xc000d85c,0x7c00100,0x230400,0xc000dc99,0x7c00100,0x230400,0xc000e719,0x7c00100,0x220400, -0xc00107a7,0x7c00100,0x230400,0xc0010eaa,0x7c00100,0x230400,0xc00116b0,0x7c00100,0x230560,0xc0011900,0x4000000,0x4200000,0xc0012447,0,0x818820,0xc0012447, -0,0xc18820,0xc0012447,0,0x1418820,0xc00125b9,0x7c00100,0x230400,0xc00126bb,0x2802100,0x962460,0xc00126bb,0x2806400,0x962460,0xc00126bb,0x4000000, -0x500000,0xc00126bb,0x6800100,0x962540,0xc00126bb,0x7c00100,0x230400,0xc00127ba,0x2802400,0x962460,0xc00127ba,0x4000000,0x200000,0xc00127ba,0x6800000,0x1329800, -0xc00127ba,0x7c00100,0x230400,0xc00127ba,0x7c00900,0x230400,0xc0012800,0x4000000,0x200000,0xc0012b23,0x4000000,0x200000,0xc0012b23,0x4000000,0x400000,0xc0012b23, -0x4000000,0x1500000,0xc0012cbc,0x2802400,0x962460,0xc0012cbc,0x4000000,0x1600000,0xc0012cbc,0x6800000,0x1329800,0xc0012cbc,0x7c00100,0x230400,0xc00acf00,0x4000000, -0x34e00000,0xc00ae300,0x4000000,0x34e00000,0xc00b0500,0x4000000,0x34e00000,0xc00b0500,0x4000000,0xb6800000,0xc00b0b00,0x4000000,0x1200000,0xc00b0b00,0x7c00900,0x1230400, -0xc00b109a,0x7c00300,0xe30000,0xc00b2914,0x7c00100,0x2530000,0xc00b2916,0x7c00100,0x2530c00,0xc00b2a00,0x4000000,0x34e00000,0xc040af53,0x7c00100,0x230400,0xc0c12b7e, -0x4000000,0x200000,0xc14a44bf,0x4000000,0xe0000d,0xd000131f,0x2802c00,0x962460,0xd000171a,0x7c00100,0x230400,0xd0001821,0x2802100,0x962460,0xd0007300,0x24000000, -0x200000,0xd0008e00,0x24000000,0x200000,0xd0008f3a,0x2806000,0x962460,0xd0009519,0x7c00100,0x220400,0xd0009519,0x7c00100,0x250400,0xd000a500,0x4000000,0x200000, -0xd000c300,0x4000000,0x4e00000,0xd000d202,0x7c00100,0x230400,0xd000d476,0x7c00100,0x230400,0xd000d997,0x2802100,0x962460,0xd000d997,0x6800100,0x962540,0xd000e001, -0x2802100,0x962460,0xd000e700,0x4000400,0x200000,0xd000e719,0x7c00100,0x220400,0xd000e719,0x7c00500,0x23040f,0xd000fa00,0x4000000,0x4e00000,0xd0010eaa,0x4000010, -0x400000,0xd0010eaa,0x7c00100,0x230400,0xd0012dbd,0x4000000,0x200000,0xd0012dbd,0x7c00100,0x230400,0xd0012fbe,0x2802100,0x962460,0xd0012fbe,0x2802400,0x962460, -0xd0012fbe,0x2806400,0x962460,0xd0012fbe,0x4000000,0x400000,0xd0012fbe,0x6800000,0x1329800,0xd0012fbe,0x6800100,0x962540,0xd0012fbe,0x6800100,0x962541,0xd0012fbe, -0x6804400,0x962540,0xd0012fbe,0x7c00100,0x230400,0xd0012fbe,0x7c00100,0x230560,0xd0012fbe,0xc000010,0x448000,0xd0013183,0x7c00100,0x230400,0xd0013200,0x4000000, -0x200000,0xd0013200,0x6800000,0x1329805,0xd00134c0,0x2802100,0x962460,0xd00134c0,0x4000002,0x400000,0xd00134c0,0x7c00100,0x230400,0xd00a4305,0x7c00100,0xe30400, -0xd00a4611,0x7c40300,0xe30000,0xd00a4711,0x7c40300,0xe30000,0xd00a5e11,0x7c40300,0xe30000,0xd00acf00,0x4000000,0x34e00000,0xd00b0500,0x4000000,0x34e00000,0xd00b0500, -0x4000000,0xb6800000,0xd00b0b11,0x6800500,0x962540,0xd00b0bbf,0x2802200,0xc62460,0xd00b119a,0x7c00300,0xe30000,0xd00b2a00,0x4000000,0x34e00000,0xd00b2e11,0x7c40300, -0xe30000,0xd00b30bf,0x7c00300,0x230000,0xd00b339a,0x7c00300,0xe30000}; +0x200000,0x40002c00,0x4000000,0x200002,0x40003000,0x24000000,0x200000,0x40003000,0x24000020,0x200000,0x40003700,0x24000000,0x200000,0x40005a09,0x7c00100,0x220400, +0x40005a09,0x7c00100,0x250400,0x40005d00,0x7c00120,0x220405,0x40006f30,0x2802100,0x962460,0x40006f30,0x2802400,0x962460,0x40006f30,0x4000000,0x200000,0x40006f30, +0x6800000,0x1329800,0x40006f30,0x6800100,0x962540,0x40006f30,0x7c00100,0x230400,0x40006f30,0xc000010,0xb48000,0x40007034,0x7c00100,0x1830000,0x40007117,0x4000000, +0x200000,0x40007208,0x7c00100,0x220400,0x4000720e,0x7c00100,0x220400,0x4000720e,0x7c00500,0x22040e,0x4000720e,0x7c00500,0x22040f,0x40007219,0x7c00100,0x220400, +0x40007219,0x7c00500,0x220400,0x40007219,0x7c00500,0x22040e,0x40007219,0x7c00500,0x22040f,0x40007300,0x24000000,0x200000,0x40007400,0x4000000,0x200000,0x40007531, +0x7c00100,0x230400,0x40007631,0x7c00100,0x230400,0x40007835,0x4000010,0x400000,0x40007835,0x7c00100,0x230400,0x40007933,0x7c00100,0x230400,0x40007a32,0x6800000, +0x1329800,0x40007a32,0x7c00100,0x230400,0x40007b2f,0x7c00100,0x230400,0x40007c00,0x4000000,0x200000,0x40020701,0x2802400,0x962460,0x40020701,0x2802400,0xc62460, +0x40023300,0x4000000,0x200000,0x40027d01,0x12882000,0x962460,0x400a3700,0x24000000,0x200000,0x400a3700,0x24000000,0xe00000,0x400a4400,0x4000000,0xe0000d,0x400a4412, +0x4000000,0xe00002,0x400a4412,0x4000000,0xe00003,0x400a4500,0x4000000,0xe0000d,0x400a5300,0x4000000,0x810010,0x400a5300,0x4000000,0x1410010,0x40507719,0x4000000, +0x200000,0x4050771c,0x4000000,0x400000,0x4050771f,0x4000000,0x200000,0x4050771f,0x4000000,0x400000,0x40c01489,0x4000000,0x200000,0x40d05117,0x4000000,0x200000, +0x41000419,0x7c00100,0x220400,0x41000419,0x7c00100,0x250400,0x4100080e,0x7c00100,0x220400,0x4100080e,0x7c00100,0x250400,0x41000908,0x7c00100,0x220400,0x41000908, +0x7c00100,0x250400,0x41000b13,0x2802000,0x962460,0x41000b13,0x2802100,0x962460,0x41000b13,0x4000000,0xb00000,0x41000c02,0x2802100,0x962460,0x41000c02,0x4000000, +0x1500000,0x41000c02,0xc000010,0xb48000,0x41000f0a,0x7c00100,0x230400,0x41001004,0x7c00100,0x230400,0x41001423,0x7c00100,0x230400,0x41001b27,0x4000000,0x500000, +0x41001d0c,0x7c00100,0x22040f,0x41001d0c,0x7c00100,0x230400,0x41001f0b,0x2802400,0x962460,0x41001f0b,0x4000000,0x200000,0x41001f0b,0x7c00100,0x230400,0x41002800, +0x24000000,0x200000,0x41002800,0x24000000,0x400000,0x41002919,0x7c00100,0x22040e,0x41002a00,0x4000000,0x1600000,0x41002b01,0x2802020,0x962460,0x41002c00,0x4000000, +0x200000,0x41002c00,0x7c00120,0x220405,0x41003000,0x24000000,0x200000,0x41003700,0x24000000,0x200000,0x41003700,0x24000000,0xe00000,0x41005d00,0x7c00120,0x220405, +0x41006600,0x24000020,0x200000,0x41006600,0x24000020,0x810000,0x41006600,0x24000020,0x1410000,0x41007208,0x7c00100,0x22040f,0x41007219,0x7c00100,0x220400,0x41007300, +0x24000000,0x200000,0x41007e0e,0x2802000,0x962460,0x41007e0e,0x4000000,0x200000,0x41007f0e,0x4000000,0x200000,0x41007f0e,0x7c00100,0x230400,0x41008002,0x7c00100, +0x230400,0x41008137,0x2802100,0x962460,0x41008137,0x4000000,0x200000,0x41008137,0x6800100,0x962540,0x41008137,0x7c00100,0x230400,0x41008301,0x2802000,0x962460, +0x41008407,0x4000000,0x200000,0x41008407,0x4000000,0x400000,0x41008407,0x4000000,0xb00000,0x41008407,0x7c00100,0x220400,0x41008407,0x7c00100,0x250400,0x4100850b, +0x7c00100,0x230400,0x4100860b,0x4000000,0x200000,0x4100860b,0x7c00100,0x230400,0x4100870c,0x7c00100,0x220400,0x41008838,0x7c00100,0x220400,0x41008838,0x7c00100, +0x250400,0x41008939,0x2802000,0x962460,0x41008939,0x2802100,0x962460,0x41008939,0x2806000,0x962460,0x41008939,0x4000000,0x200000,0x41008939,0x4000000,0x400000, +0x41008939,0x7c00100,0x230400,0x41008939,0xc000010,0x448000,0x41008a00,0x4000400,0x200400,0x41008b3b,0x4000000,0x1800000,0x41008b3b,0x6800000,0x1329800,0x41008b3b, +0x7c00100,0x1830000,0x41008b3b,0x7e00100,0x1830000,0x41008c3d,0x4000010,0x400000,0x41008c3d,0x7c00100,0x230400,0x41008d0e,0x7c00100,0x22040f,0x41008d19,0x7c00100, +0x220400,0x41008d19,0x7c00100,0x22040f,0x41008e00,0x24000000,0x200000,0x41008e00,0x24000000,0x400000,0x41008e00,0x24000000,0x1710000,0x41008e00,0x24000006,0x400000, +0x41008f3a,0x2802100,0x962460,0x41008f3a,0x2806000,0x962460,0x41008f3a,0x4000000,0x200000,0x41008f3a,0x6800100,0x962540,0x41008f3a,0x7c00100,0x230400,0x4100903c, +0x7c00100,0x230400,0x4100903c,0x7c00100,0x23040f,0x41020701,0x2802000,0x962460,0x41020701,0x2802000,0xc62460,0x410a3700,0x24000000,0x200000,0x410a3700,0x24000000, +0xe00000,0x410a4412,0x4000000,0xe00003,0x410a4711,0x7c40300,0xe30000,0x410a4f11,0x7c00300,0xe30001,0x410a9100,0x4000000,0x800010,0x410a9100,0x4000000,0x810010, +0x410a9100,0x4000000,0x870010,0x410a9100,0x4000000,0xb00010,0x410a9100,0x4000000,0xf00010,0x410a9100,0x4000000,0x1001410,0x410a9100,0x4000000,0x1071010,0x410a9100, +0x4000000,0x1071410,0x410a9100,0x4000000,0x1410010,0x41408ad2,0x4000400,0x200000,0x414a82cc,0x4000000,0xe00000,0x41808300,0x2802000,0x962460,0x41c01489,0x6800000, +0x1329800,0x50000419,0x7c00100,0x220400,0x50000419,0x7c00100,0x250400,0x5000080e,0x7c00100,0x220400,0x50000908,0x7c00100,0x220400,0x50000908,0x7c00100,0x250400, +0x50000b13,0x2802500,0x962460,0x50000f0a,0x7c00100,0x230400,0x50001615,0x2802100,0x962460,0x50001615,0x7c00100,0x230400,0x50002b01,0x2802020,0x962460,0x50002c00, +0x4000000,0x200000,0x50002c19,0x7c00100,0x220400,0x50002d19,0x7c00100,0x220400,0x50003000,0x24000000,0x200000,0x50003000,0x24000020,0x200000,0x50003700,0x24000000, +0x200000,0x50005d00,0x7c00120,0x220405,0x50005d00,0x7c00120,0x250405,0x50006108,0x7c00100,0x220400,0x50006108,0x7c00100,0x250400,0x50006600,0x24000020,0x200000, +0x50007300,0x24000000,0x200000,0x50008301,0x2802400,0x962460,0x50008a00,0x7c00500,0x230400,0x50009257,0x2802400,0x962460,0x50009257,0x4000000,0x200000,0x50009257, +0x4000010,0x1071400,0x50009257,0x6800000,0x1329800,0x50009257,0x7c00100,0x230400,0x50009257,0x7c00500,0x230400,0x50009257,0x7c00900,0x230400,0x50009257,0xc000010, +0xb48000,0x5000933e,0x2802100,0x962460,0x5000933e,0x2802400,0x962460,0x5000933e,0x4000000,0x400000,0x5000933e,0x4000000,0xe00000,0x5000933e,0x4000010,0x400000, +0x5000933e,0x6800000,0xe29800,0x5000933e,0x6800100,0x962540,0x5000933e,0x6800100,0x962541,0x5000933e,0x6804400,0x2f62540,0x5000933e,0x7c00100,0x2b30400,0x5000933e, +0x7c00100,0x2b30401,0x5000933e,0xc000010,0x448000,0x50009419,0x7c00100,0x220400,0x50009419,0x7c00100,0x250400,0x50009500,0x4000400,0x200400,0x5000965a,0x4000000, +0x500000,0x5000965a,0x7c00100,0x230400,0x5000965a,0xc000010,0xb48000,0x5000975b,0x4000000,0x200000,0x5000975b,0x4000010,0x400000,0x5000975b,0x7c00100,0x230400, +0x50009865,0x7c00100,0x230400,0x50009965,0x4000010,0x400000,0x50009965,0x7c00100,0x230400,0x50409acc,0x4000000,0x200000,0x5100080e,0x7c00100,0x220400,0x5100080e, +0x7c00100,0x250400,0x51000c02,0x2802100,0x962460,0x51000c02,0x4000000,0x1500000,0x51000c02,0x4000020,0x200000,0x51000c02,0x7c00100,0x230400,0x51000f0a,0x7c00100, +0x230400,0x51000f0a,0x7c00500,0x230400,0x51001110,0x2802100,0x962460,0x5100131f,0x2802100,0x962460,0x51001423,0x7c00100,0x230400,0x51001524,0x2802100,0x962460, +0x51001524,0x4000000,0x200000,0x51001524,0x7c00100,0x230400,0x5100171a,0x2802100,0x962460,0x5100171a,0x4000000,0x200000,0x5100171a,0x4000000,0x1500000,0x5100171a, +0x7c00100,0x230400,0x51001b27,0x4000000,0x200000,0x51001b27,0x4000000,0x400000,0x51001b27,0x4000000,0x500000,0x51001b27,0x7c00100,0x230400,0x51001c1c,0x2802100, +0x1862460,0x51001c1c,0x2802500,0x1862460,0x51001c1c,0x2806400,0x1862460,0x51001c1c,0x4000000,0x1800000,0x51001c1c,0x6800000,0x1329800,0x51001c1c,0x6800100,0x1862400, +0x51001c1c,0x6800100,0x1862540,0x51001c1c,0x6800500,0x1862400,0x51001c1c,0x7c00100,0x1830000,0x5100251b,0x7c00100,0x230400,0x51002619,0x7c00100,0x220400,0x51002619, +0x7c00100,0x250400,0x51002800,0x80020,0x218820,0x51002c00,0x4000000,0x200000,0x51002d19,0x7c00100,0x230400,0x51003700,0x24000000,0x200000,0x51003700,0x24000000, +0xe00000,0x51005201,0x2802400,0x962460,0x51005c00,0x4000000,0x200000,0x51006108,0x7c00100,0x220400,0x51006108,0x7c00100,0x250400,0x51006600,0x24000020,0x200000, +0x51006600,0x24000020,0x810000,0x51006600,0x24000020,0x1410000,0x51007300,0x24000000,0x200000,0x51007300,0x24000020,0x200000,0x51008002,0x7c00100,0x230400,0x51008301, +0x2802000,0x962460,0x51008301,0x2802400,0x962460,0x51008301,0x2802400,0xc62460,0x51008a00,0x7c00500,0x230400,0x51008e00,0x24000000,0x200000,0x51008e00,0x24000000, +0x400000,0x51008e00,0x24000000,0x810000,0x51008e00,0x24000000,0x1400000,0x51008e00,0x24000000,0x1410000,0x51008e00,0x24000000,0x1710000,0x51008e00,0x24000002,0x200000, +0x51008e00,0x24000500,0x230400,0x51008e00,0x2c000010,0xb48000,0x51009419,0x7c00100,0x220400,0x51009419,0x7c00100,0x22040e,0x51009419,0x7c00100,0x22040f,0x51009419, +0x7c00100,0x250400,0x51009500,0x4000400,0x200400,0x51009500,0x7c00500,0x230400,0x51009519,0x7c00100,0x220400,0x51009519,0x7c00100,0x22040f,0x51009519,0x7c00100, +0x230400,0x51009519,0x7c00100,0x250400,0x51009b71,0x2802100,0x962460,0x51009b71,0x6800000,0x1329800,0x51009b71,0x6800100,0x962540,0x51009b71,0x6804400,0x962540, +0x51009b71,0x7c00100,0x230400,0x51009c52,0x2802100,0x962460,0x51009c52,0x2802400,0x962460,0x51009c52,0x2802d00,0x962460,0x51009c52,0x4000010,0x400000,0x51009c52, +0x6800000,0x1329800,0x51009c52,0x6800100,0x962540,0x51009c52,0x7c00100,0x230400,0x51009c52,0xc000010,0x448000,0x51009d6d,0x6800000,0x1329800,0x51009d6d,0x7c00100, +0x230400,0x51009d6d,0x7c00500,0x230400,0x51009d6d,0x7c00d00,0x230400,0x51009d6d,0xc000010,0x448000,0x51009e08,0x2802100,0x962460,0x51009f63,0x4000010,0x400000, +0x51009f63,0x6800000,0x1329800,0x51009f63,0x7c00100,0x230400,0x51009f63,0x7c00900,0x230400,0x51009f63,0xc000010,0x448000,0x51009f63,0xc000010,0xb48000,0x5100a008, +0x2000,0x962460,0x5100a008,0x2802400,0x962460,0x5100a008,0x4000000,0x200000,0x5100a008,0x7c00100,0x220400,0x5100a008,0x7c00100,0x230400,0x5100a008,0x7c00100, +0x250400,0x5100a008,0x7c00500,0x230400,0x5100a16f,0x2806400,0x962460,0x5100a16f,0x6800000,0x1329800,0x5100a16f,0x6800100,0x962540,0x5100a16f,0x7c00100,0x230400, +0x5100a16f,0xc000010,0x448000,0x5100a24f,0x2802100,0x962460,0x5100a24f,0x2802400,0x962460,0x5100a24f,0x6800000,0x1329800,0x5100a24f,0x7c00100,0x230400,0x5100a24f, +0xc000010,0x448000,0x5100a36e,0x2802100,0x962460,0x5100a36e,0x4000000,0x200000,0x5100a36e,0x6800100,0x962540,0x5100a36e,0x6804400,0x962540,0x5100a36e,0x7c00100, +0x230400,0x5100a442,0x2802100,0x962460,0x5100a442,0x4000000,0xe00000,0x5100a442,0x6800000,0xe29800,0x5100a442,0x6800100,0x962540,0x5100a442,0x7c00100,0x430400, +0x5100a442,0x7c00100,0x2d30400,0x5100a442,0xc000010,0x448000,0x5100a500,0x4000000,0x200000,0x5100a600,0x4000000,0x200000,0x5100a601,0x2802000,0x962460,0x5100a76b, +0x7c00100,0x230400,0x5100a868,0x7c00100,0x230400,0x5100a96c,0x4000000,0x200000,0x5100a96c,0x7c00100,0x230400,0x5100aa00,0x4000000,0xe00000,0x5100ab00,0x4000000, +0xe00000,0x51086600,0x24000020,0x810000,0x51086600,0x24000020,0x1410000,0x510a4005,0x7c00100,0xe30400,0x510a4711,0x7c40300,0xe30000,0x510a7300,0x24000000,0x200000, +0x510aaa00,0x4000000,0xe00000,0x514a82cc,0x4000000,0xe00000,0x5150a20e,0x4000400,0x400000,0x51802bbe,0x2802000,0x962460,0x51c00908,0x2802400,0x962460,0x51c0a008, +0x2802400,0x962460,0x52000f0a,0x2802100,0x962460,0x52000f0a,0x6800100,0x962540,0x52000f0a,0x7c00100,0x230400,0x52001004,0x4000000,0x1600000,0x52001b00,0x4000000, +0x200000,0x52001c1c,0x2802100,0x1862460,0x52001c1c,0x6800100,0x1862400,0x52001c1c,0x6800500,0x1862400,0x52001e12,0x7c00100,0x2230500,0x52001e12,0x7c00100,0x2330520, +0x52002128,0x4000002,0x400000,0x52002128,0x7c00100,0x230400,0x52002a00,0x4000000,0x1500000,0x52002a00,0x4000000,0x1600000,0x52002d00,0x4000000,0x200006,0x52003000, +0x24000000,0x200000,0x52006108,0x7c00100,0x220400,0x52006108,0x7c00100,0x250400,0x52008301,0x2802400,0x962460,0x52008407,0x2802400,0x962460,0x52008407,0x7c00100, +0x220400,0x52008407,0x7c00100,0x250400,0x52008b3b,0x6800000,0x1800000,0x52008b3b,0x7c00100,0x1830000,0x52008e00,0x24000000,0x400000,0x52009419,0x7c00100,0x250400, +0x5200975b,0x4000000,0x200000,0x5200ac7e,0x2802000,0x962460,0x5200ac7e,0x2802100,0x962460,0x5200ac7e,0x2802400,0x962460,0x5200ac7e,0x4000010,0x200000,0x5200ac7e, +0x7c00100,0x230400,0x5200ac7e,0xc000010,0x248000,0x5200ad28,0x7c00100,0x230400,0x5200ae6a,0x2802100,0x1862460,0x5200ae6a,0x2802400,0x962460,0x5200ae6a,0x2802400, +0x1862460,0x5200ae6a,0x2806000,0x1862460,0x5200ae6a,0x4000000,0x1800000,0x5200ae6a,0x6800000,0x1329800,0x5200ae6a,0x6800100,0x1862400,0x5200ae6a,0x6800100,0x1862540, +0x5200ae6a,0x7c00100,0x1830000,0x5200ae6a,0x7c00900,0x1830000,0x5200ae6a,0xc000010,0x1848000,0x5200b083,0x4000010,0x400000,0x5200b083,0x7c00100,0x230400,0x5200b083, +0xc000010,0x448000,0x5200b182,0x2802400,0x962460,0x5200b182,0x4000000,0x200000,0x5200b182,0x4000010,0x400000,0x5200b182,0x7c00100,0x230400,0x5200b182,0xc000010, +0x448000,0x5200b30a,0x2802400,0x962460,0x5200b30a,0x4000000,0x200000,0x5200b30a,0x7c00100,0x230400,0x5200b54e,0x2802100,0x962460,0x5200b54e,0x2802400,0x962460, +0x5200b54e,0x4000000,0xe00000,0x5200b54e,0x4000010,0x400000,0x5200b54e,0x6800000,0xe29800,0x5200b54e,0x6800100,0x962540,0x5200b54e,0x6804400,0x2f62540,0x5200b54e, +0x7c00100,0x2b30400,0x5200b54e,0xc000010,0x448000,0x5200b61c,0x4000000,0x1800000,0x5200b61c,0x6800500,0x1862400,0x5200b61c,0x7c00100,0x1830000,0x5200b61c,0x7c00900, +0x1830000,0x5200b77f,0x2802100,0x1862460,0x5200b77f,0x2802400,0x1862460,0x5200b77f,0x4000000,0x1800000,0x5200b77f,0x4000010,0x1800000,0x5200b77f,0x7c00100,0x1830000, +0x5200b77f,0x7c00500,0x1830000,0x5200b77f,0x7c00900,0x1830000,0x5200b77f,0x7e00100,0x1830000,0x5200b873,0x2802100,0x962460,0x5200b873,0x2806400,0x962460,0x5200b873, +0x6800000,0x1329800,0x5200b873,0x6800100,0x962540,0x5200b873,0x6800400,0x962540,0x5200b873,0x7c00100,0x230400,0x5200b873,0xc000010,0x448000,0x5200b912,0x7c00100, +0x2230500,0x5200b912,0x7c00100,0x2330520,0x5200ba74,0x4000000,0x200000,0x5200ba74,0x4000010,0x400000,0x5200ba74,0x7c00100,0x230400,0x5200bb85,0x4000000,0x200000, +0x5200bb85,0x7c00100,0x230400,0x5200bc75,0x4000000,0x400000,0x5200bc75,0x4000010,0x400000,0x5200bc75,0x7c00100,0x230400,0x5200bd7d,0x4000000,0x200000,0x5200bd7d, +0x7c00100,0x230400,0x5200be7a,0x4000000,0x200000,0x5200be7a,0x7c00100,0x230400,0x5200bf58,0x7c00100,0x230400,0x5200c002,0x4000000,0x200000,0x5200c178,0x2802100, +0x962460,0x5200c178,0x2802400,0x962460,0x5200c178,0x2806400,0x962460,0x5200c178,0x4000000,0x200000,0x5200c178,0x6800100,0x962540,0x5200c178,0x7c00100,0x230400, +0x5200c178,0x7c00100,0x230401,0x5200c178,0xc000010,0x448000,0x5200c178,0x80000000,0x1329960,0x5200c247,0x7c00100,0x230400,0x5200c247,0x7c00100,0x830400,0x5200c247, +0x7c00100,0x1430400,0x5200c300,0x4000000,0x200003,0x52022d00,0x4000000,0x100006,0x52023700,0x24000000,0x100000,0x52023700,0x24000000,0xe00000,0x52023700,0x24000000, +0x2800000,0x52024400,0x4000000,0x100000,0x52027300,0x24000000,0x100000,0x5202c300,0x4000000,0x100000,0x5202c300,0x4000000,0x100002,0x5202c300,0x4000000,0x100003, +0x5202c300,0x4000000,0x10000d,0x5202c300,0x4000100,0x150400,0x5202c300,0x4000100,0x15040d,0x520a1e12,0x7c00100,0x2130480,0x520a3700,0x24000000,0xe00000,0x520a3800, +0x24000000,0x100000,0x520a4711,0x7c40300,0xe30000,0x520a4f11,0x7c00300,0xe30001,0x520a7300,0x24000000,0x100000,0x520ab412,0x7c00100,0x2130480,0x520ac400,0x4000000, +0xe00002,0x520ac400,0x4000000,0xe0000d,0x520ac414,0x4000000,0xe0000d,0x520ac511,0x7c40300,0xe30000,0x5240af9c,0x7c00100,0x230400,0x5240afa1,0x4000400,0x200000, +0x5240afa3,0x6800400,0x962540,0x5240afa3,0x7c00100,0x230400,0x5240afad,0x7c00100,0x230400,0x5240afaf,0x7c00100,0x230400,0x5240b2d4,0x4000000,0x200000,0x5240b2e3, +0x4000000,0x200000,0x5240b2f1,0x4000000,0x200000,0x5240b2fc,0x4000000,0x1500000,0x524a44cc,0x4000000,0xe00003,0x5250b511,0x7c00900,0x430400,0x5280af9c,0x2802400, +0x962460,0x5280af9d,0x2802400,0x962460,0x5280afa3,0x2802400,0x962460,0x5280afa5,0x2802400,0x962460,0x5280afa7,0x2802400,0x962460,0x52d0b308,0x2802400,0x962460, +0x52d0b30c,0x7c00100,0x230400,0x60000c02,0x2802100,0x962460,0x60000c02,0x7c00100,0x230400,0x60000f0a,0x2802100,0x962460,0x60000f0a,0x6800100,0x962540,0x60000f0a, +0x7c00100,0x230400,0x6000131f,0x4000000,0x200000,0x6000171a,0x7c00100,0x230400,0x6000171a,0x7c00100,0x230560,0x60001b27,0x2802100,0x962460,0x60001b27,0x4000000, +0xc00000,0x60001b27,0x7c00100,0x230400,0x60001f0b,0x2802400,0x962460,0x60002919,0x7c00100,0x22040e,0x60002a00,0x4000000,0x1600000,0x60003000,0x24000000,0x200000, +0x60003000,0x24000000,0xe00000,0x60003700,0x24000000,0x200000,0x60003800,0x24000000,0x1710000,0x60005102,0x4000000,0x200000,0x60006108,0x7c00100,0x220400,0x60006108, +0x7c00100,0x250400,0x60006600,0x24000020,0x200000,0x60008301,0x2802400,0xc62460,0x6000903c,0x2806000,0x962460,0x6000903c,0x4000000,0x400000,0x60009519,0x7c00100, +0x220400,0x60009519,0x7c00100,0x250400,0x6000a008,0x7c00100,0x220400,0x6000a008,0x7c00100,0x250400,0x6000c300,0x4000000,0x2703580,0x6000c654,0x2802000,0x962460, +0x6000c654,0x4000010,0x200000,0x6000c654,0x7c00100,0x230400,0x6000c73f,0x2802000,0x962460,0x6000c73f,0x2802100,0x962460,0x6000c73f,0x4000000,0x200000,0x6000c73f, +0x6800100,0x962540,0x6000c73f,0x6804000,0x2e62540,0x6000c73f,0x7c00100,0x2d30400,0x6000c80b,0x7c00100,0x230400,0x6000c941,0x2802100,0x962460,0x6000c941,0x2806400, +0x2f62460,0x6000c941,0x4000000,0xe00000,0x6000c941,0x4000010,0xe00000,0x6000c941,0x6800000,0x2d29800,0x6000c941,0x6800100,0x962540,0x6000c941,0x7c00100,0x2b30400, +0x6000c941,0x7c00100,0x2c30400,0x6000c941,0xc000010,0x448000,0x6000ca82,0x7c00100,0x230400,0x6000cc00,0x4000000,0xe00000,0x6000d000,0x4000000,0x200000,0x6002c300, +0x4000000,0x100000,0x6002c300,0x4000000,0x10000d,0x6002c300,0x4000100,0x150400,0x6002c300,0x4000100,0x15040d,0x600a3000,0x24000000,0x200000,0x600a3000,0x24000000, +0xe00000,0x600a3700,0x24000000,0x200000,0x600a3800,0x24000000,0x200000,0x600a3800,0x24000000,0x2800000,0x600a4305,0x7c00100,0xe30400,0x600ac300,0x4000000,0x100000, +0x600ac400,0x4000000,0xe0000d,0x600acb14,0x7c00100,0xe30000,0x600acb16,0x7c00100,0xe30c00,0x600acc00,0x4000000,0xe00000,0x600acd00,0x4000000,0x200000,0x600acd00, +0x4000000,0xe00000,0x600acd00,0x4000000,0x2800000,0x600ace00,0x4000000,0xe00000,0x600ace00,0x4000000,0x2800000,0x600acf00,0x4000000,0xe00000,0x600acf00,0x4000000, +0x2800000,0x600ad111,0x7c40300,0xe30000,0x604ac4cc,0x4000000,0xe00003,0x61000a03,0x4000000,0x1600000,0x61000c02,0x80000000,0x1329960,0x6100120f,0x4000000,0x200000, +0x61001a18,0x7c00100,0x1830000,0x61001d0c,0x7c00100,0x230400,0x61001d0c,0x7c00100,0x250400,0x61006600,0x24000020,0x200000,0x61008407,0x7c00100,0x220400,0x61008407, +0x7c00100,0x250400,0x6100870c,0x7c00100,0x220400,0x61008e00,0x24000000,0x200000,0x61008e00,0x24000000,0x400000,0x61008e00,0x24000002,0x300000,0x6100903c,0x7c00100, +0x230400,0x61009519,0x7c00100,0x220400,0x61009519,0x7c00100,0x250400,0x61009519,0x7c00500,0x22040f,0x61009b71,0x2802100,0x962460,0x61009b71,0x2806400,0x962460, +0x61009b71,0x7c00100,0x230400,0x6100a008,0x2802100,0x962460,0x6100c300,0x4000000,0x20000f,0x6100cd00,0x4000000,0x200000,0x6100d202,0x2802400,0x962460,0x6100d202, +0x2802500,0x962460,0x6100d202,0x7c00100,0x230400,0x6100d302,0x4000020,0x200000,0x6100d302,0x7c00120,0x230405,0x6100d476,0x2802100,0x962460,0x6100d476,0x2802100, +0x962461,0x6100d476,0x2806400,0x962460,0x6100d476,0x4000000,0x400000,0x6100d476,0x6800000,0x1329800,0x6100d476,0x6800100,0x962540,0x6100d476,0x7c00100,0x230400, +0x6100d476,0xc000010,0x448000,0x6100d573,0x2802100,0x962460,0x6100d573,0x2806400,0x962460,0x6100d573,0x6800100,0x962540,0x6100d573,0x7c00100,0x230400,0x6100d573, +0x7c00900,0x230400,0x6100d573,0xc000010,0x448000,0x6100d68d,0x7c00100,0x230400,0x6100d756,0x7c00100,0x230400,0x6100d85c,0x2802500,0x962460,0x6100d85c,0x6800100, +0x962540,0x6100d85c,0x7c00100,0x230400,0x6100d85c,0x7c00500,0x230400,0x6100d997,0x2802100,0x962460,0x6100d997,0x4000000,0x200000,0x6100d997,0x4000000,0x400000, +0x6100d997,0x6800000,0x1329800,0x6100d997,0x6800100,0x962540,0x6100d997,0x6804400,0x962540,0x6100d997,0x7c00100,0x230400,0x6100d997,0x7c00100,0x230560,0x6100d997, +0xc000010,0x448000,0x6100da98,0x6800000,0x1329800,0x6100da98,0x7c00100,0x230400,0x6100db71,0x4000000,0x200000,0x6100dc99,0x2802100,0x962460,0x6100dc99,0x2802400, +0x962460,0x6100dc99,0x6800000,0x1329800,0x6100dc99,0x6800100,0x962540,0x6100dc99,0x6804400,0x962540,0x6100dc99,0x7c00100,0x230400,0x610a4711,0x7c40300,0xe30000, +0x610a4f11,0x7c00300,0xe30001,0x610ace00,0x4000000,0xe00000,0x6140afa1,0x7c00100,0x230400,0x6140afa3,0x7c00100,0x230400,0x6180af9e,0x2802400,0x962460,0x62002a00, +0x4000000,0x1600000,0x63002800,0x80000,0x918820,0x63c00c15,0x80000,0x918820,0x7000080e,0x7c00100,0x250400,0x70000a03,0x4000000,0x200000,0x70000c00,0x80000000, +0x1329960,0x70000f0a,0x7c00100,0x230400,0x70001004,0x7c00100,0x230400,0x70001524,0x2802100,0x962460,0x70001524,0x7c00100,0x230400,0x70001615,0x2802100,0x962460, +0x7000171a,0x2802100,0x962460,0x70001821,0x6800000,0x1329800,0x70002320,0x7c00100,0x230400,0x70002a00,0x4000000,0x1500000,0x70002a00,0x4000000,0x1600000,0x70003000, +0x24000000,0x200000,0x70003800,0x24000000,0xe00000,0x70005201,0x2802400,0x962460,0x7000581e,0x7c00100,0x230400,0x70006108,0x7c00100,0x220400,0x70006108,0x7c00100, +0x250400,0x70006f30,0x7c00100,0x230400,0x70007300,0x24000000,0x200000,0x70007f0e,0x4000000,0x200000,0x70008301,0x2802100,0x962460,0x70008301,0x2802400,0x962460, +0x70008e00,0x24000000,0x200000,0x70008e00,0x24000000,0x400000,0x70008e00,0x24000002,0x400000,0x70008e00,0x24000008,0x1410000,0x70008e00,0x24000010,0x400000,0x70008e00, +0x2c000010,0x448000,0x70009519,0x7c00100,0x220400,0x70009519,0x7c00100,0x230400,0x70009519,0x7c00100,0x250400,0x70009865,0x7c00100,0x230400,0x70009965,0x4000010, +0x400000,0x70009965,0x7c00100,0x230400,0x7000a008,0x7c00100,0x220400,0x7000a008,0x7c00100,0x250400,0x7000a008,0x7c00500,0x22040f,0x7000a50e,0x4000000,0x200000, +0x7000b61c,0x2802500,0x1862460,0x7000b61c,0x6800500,0x1862400,0x7000b61c,0x7c00100,0x1830000,0x7000c300,0x4000000,0x100000,0x7000c941,0x2806000,0xc62460,0x7000cc00, +0x4000000,0xe00000,0x7000cd00,0x4000000,0x200000,0x7000cd00,0x4000000,0xe00000,0x7000cd00,0x4000000,0x2800000,0x7000cf00,0x4000000,0xe00000,0x7000d202,0x2802100, +0x962460,0x7000d202,0x7c00100,0x230400,0x7000d997,0x7c00100,0x230400,0x7000d997,0xc000010,0x248000,0x7000dd86,0x2802400,0x962460,0x7000dd86,0x7c00100,0x230400, +0x7000dd86,0xc000010,0x448000,0x7000de9f,0x4000000,0x200000,0x7000de9f,0x7c00100,0x230400,0x7000e001,0x2400,0x962460,0x7000e001,0x2802400,0x962460,0x7000e187, +0x2802000,0x962460,0x7000e187,0x2802100,0x962460,0x7000e187,0x4000000,0x200000,0x7000e187,0x7c00100,0x230400,0x7000e187,0xc000010,0x448000,0x7000e288,0x7c00100, +0x230400,0x7000e300,0x4000000,0x200000,0x7000e489,0x2802100,0x962460,0x7000e489,0x2802400,0x962460,0x7000e489,0x6800100,0x962540,0x7000e489,0x6800100,0x962541, +0x7000e489,0x6804400,0x2f62540,0x7000e489,0x7c00100,0x430400,0x7000e489,0x7c00100,0x2b30400,0x7000e489,0x7c00100,0x2d30400,0x7000e489,0x7c00900,0x430400,0x7000e59d, +0x2802100,0x962460,0x7000e59d,0x2802400,0x962460,0x7000e59d,0x4000000,0x200000,0x7000e59d,0x4000010,0x200000,0x7000e59d,0x6800100,0x962540,0x7000e59d,0x6804400, +0x962540,0x7000e59d,0x7c00100,0x230400,0x7000e59d,0xc000010,0x448000,0x7000e691,0x2802100,0x962460,0x7000e691,0x2802400,0x962460,0x7000e691,0x2806400,0x962460, +0x7000e691,0x6800000,0x1329800,0x7000e691,0x6800100,0x962540,0x7000e691,0x7c00100,0x230400,0x7000e700,0x4000400,0x200400,0x7000e70e,0x7c00100,0x220400,0x7000e719, +0x7c00100,0x220400,0x7000e719,0x7c00500,0x22040f,0x7000e853,0x7c00100,0x230400,0x7000e9a0,0x2802400,0x962460,0x7000e9a0,0x4000000,0x200000,0x7000e9a0,0x4000000, +0x500000,0x7000e9a0,0x7c00100,0x230400,0x7000ea79,0x2802400,0x962460,0x7000ea79,0x4000000,0x200000,0x7000ea79,0x4000000,0xf00000,0x7000ea79,0x4000010,0x400000, +0x7000ea79,0x7c00100,0x230400,0x7000eb8c,0x2802400,0x962460,0x7000eb8c,0x4000000,0x200000,0x7000eb8c,0x7c00100,0x230400,0x7000eca3,0x2802100,0x962460,0x7000eca3, +0x2806400,0x962460,0x7000eca3,0x4000000,0x200000,0x7000eca3,0x6800000,0x1329800,0x7000eca3,0x6800100,0x962540,0x7000eca3,0x7c00100,0x230400,0x7000eca3,0xc000010, +0x448000,0x7000ed95,0x6800000,0x1329800,0x7000ed95,0x7c00100,0x230400,0x7000ed95,0xc000010,0x448000,0x7000ee1c,0x2802500,0x1862460,0x7000ee1c,0x6800000,0x1329800, +0x7000ee1c,0x7c00100,0x1830000,0x7000ee1c,0x7c00900,0x1830000,0x7000ef8f,0x4000000,0x200000,0x7000ef8f,0x7c00100,0x230400,0x7000f08e,0x4000000,0x200000,0x7000f08e, +0x7c00100,0x230400,0x7000f159,0x2802100,0x962460,0x7000f159,0x7c00100,0x230400,0x7000f200,0x4000000,0x200000,0x7000f200,0x4000000,0x1200000,0x7000f200,0x4000000, +0x1710000,0x7000f34b,0x2802400,0x962460,0x7000f34b,0x4000000,0x200000,0x7000f34b,0x4000010,0x400000,0x7000f34b,0x6800000,0x1329800,0x7000f34b,0x7c00100,0x230400, +0x7000f34b,0x7c00900,0x230400,0x7000f34b,0xc000010,0x448000,0x7000f490,0x4000000,0x200000,0x7000f490,0x7c00100,0x230400,0x7000f5a5,0x7c00100,0x230400,0x7000f67b, +0x4000000,0x200000,0x7000f67b,0x4000010,0x200000,0x7000f67b,0x7c00100,0x230400,0x7000f8a6,0x2802100,0x962460,0x7000f8a6,0x2802400,0x962460,0x7000f8a6,0x2806400, +0x962460,0x7000f8a6,0x4000000,0x500000,0x7000f8a6,0x4000010,0xb00000,0x7000f8a6,0x4000800,0x200000,0x7000f8a6,0x6800100,0x962540,0x7000f8a6,0x6800100,0x962541, +0x7000f8a6,0x7c00100,0x230400,0x7000f8a6,0xc000010,0x448000,0x7000f921,0x4000000,0x200000,0x7000fa00,0x4000000,0x200000,0x7000fb9e,0x2802100,0x962460,0x7000fb9e, +0x2802400,0x962460,0x7000fb9e,0x2806400,0x962460,0x7000fb9e,0x4000000,0x200000,0x7000fb9e,0x6800000,0x1329800,0x7000fb9e,0x6800100,0x962540,0x7000fb9e,0x6800100, +0x962541,0x7000fb9e,0x7c00100,0x230400,0x7000fc92,0x4000000,0x200000,0x7000fc92,0x6800000,0x1329800,0x7000fc92,0x7c00100,0x220400,0x7000fc92,0x7c00100,0x230400, +0x7000fc92,0x7c00100,0x250400,0x700acd00,0x4000000,0xe00000,0x700acd00,0x4000000,0x2800000,0x700ace00,0x4000000,0xe00000,0x700acf00,0x4000000,0xe00000,0x700acf00, +0x4000000,0x2800000,0x7050df21,0x4000000,0x200000,0x7050f729,0x80000,0x918820,0x7080afa1,0x2802400,0x962460,0x7090df21,0x2802400,0x962460,0x70d0e427,0x2802100, +0x962460,0x70d0e427,0x2802400,0x962460,0x70d0e427,0x6800100,0x962540,0x70d0ea25,0x4000010,0x400000,0x8000120f,0x7c00100,0x230400,0x80001524,0x7c00100,0x230400, +0x8000171a,0x7c00100,0x230400,0x80002006,0x7c00100,0x220400,0x80002006,0x7c00100,0x250400,0x80002a00,0x4000000,0x1500000,0x80002d00,0x4000000,0x200000,0x80005208, +0x2802400,0x962460,0x80005c00,0x4000000,0x200000,0x80007300,0x24000000,0x200000,0x80009519,0x7c00100,0x220400,0x80009519,0x7c00100,0x230400,0x80009519,0x7c00100, +0x250400,0x80009865,0x7c00100,0x230400,0x8000a008,0x2802100,0x962460,0x8000b30a,0x4000000,0x500000,0x8000b30a,0x7c00100,0x230400,0x8000cd00,0x4000000,0xe00000, +0x8000d202,0x2802500,0x962460,0x8000d202,0x7c00100,0x230400,0x8000d68d,0x4000000,0x200000,0x8000d997,0x2802000,0x962460,0x8000d997,0x2802400,0x962460,0x8000d997, +0x4000000,0x400000,0x8000d997,0x4000000,0x500000,0x8000d997,0x7c00100,0x230400,0x8000d997,0xc000010,0x448000,0x8000e489,0x2802100,0x962460,0x8000e489,0x7c00100, +0x2d30400,0x8000e719,0x7c00100,0x220400,0x8000f8a6,0x2802100,0x962460,0x8000f8a6,0x7c00100,0x230400,0x8000f8a6,0xc000010,0x448000,0x8000fda1,0x2802100,0x1862460, +0x8000fda1,0x2806400,0x1862460,0x8000fda1,0x4000000,0x1800000,0x8000fda1,0x6800000,0x1329800,0x8000fda1,0x6800100,0x1862400,0x8000fda1,0x6800100,0x1862540,0x8000fda1, +0x7c00100,0x1830000,0x8000fda1,0xc000010,0x448000,0x8000fe9c,0x7c00100,0x230400,0x8000fe9c,0x7c00100,0x830400,0x8000fe9c,0x7c00100,0x1430400,0x8000ff06,0x7c00100, +0x220400,0x80010165,0x7c00100,0x230400,0x800102a2,0x4000000,0x200000,0x800102a2,0x7c00100,0x230400,0x800103a4,0x7c00100,0x230400,0x800103a4,0xc000010,0x448000, +0x8001044c,0x4000000,0x200000,0x8001044c,0x7c00100,0x220400,0x8001044c,0x7c00100,0x250400,0x80010670,0x2802000,0x962460,0x80010670,0x4000000,0x200000,0x80010670, +0x4000010,0x400000,0x80010670,0xc000010,0x448000,0x800a4711,0x7c40300,0xe30000,0x800acd00,0x4000000,0xe00000,0x800acd00,0x4000000,0x2902460,0x800ace00,0x4000000, +0xe00000,0x800acf00,0x4000000,0xe00000,0x800b0011,0x7c40300,0xe30000,0x800b0500,0x4000000,0xe00000,0x800b0500,0x4000000,0x2800000,0x90001615,0x7c00100,0x230400, +0x9000171a,0x4000000,0x200000,0x9000171a,0x7c00100,0x230400,0x90003000,0x24000000,0x200000,0x90007f0e,0x4000000,0x200000,0x90008301,0x2802400,0x962460,0x90008e00, +0x24000000,0x400000,0x90009519,0x7c00100,0x250400,0x9000a16f,0x2802100,0x962460,0x9000d200,0x80000000,0x1329960,0x9000d202,0x2802000,0x962460,0x9000d202,0x2802100, +0x962460,0x9000d202,0x7c00100,0x230400,0x9000e59d,0x2802100,0x962460,0x90010500,0x4000000,0xe00000,0x900107a7,0x2802100,0x962460,0x900107a7,0x2802400,0x962460, +0x900107a7,0x2802c00,0x962460,0x900107a7,0x4000000,0x1400000,0x900107a7,0x6800000,0x1329800,0x900107a7,0x7c00100,0x220400,0x900107a7,0x7c00100,0x250400,0x900108a8, +0x2802100,0x962460,0x900108a8,0x2806400,0x962460,0x900108a8,0x4000000,0x200000,0x900108a8,0x4000000,0x400000,0x900108a8,0x4000010,0x400000,0x900108a8,0x6800000, +0x1329800,0x900108a8,0x6800100,0x962540,0x900108a8,0x7c00100,0x230400,0x900108a8,0xc000010,0x448000,0x90010908,0x7c00100,0x220400,0x90010a38,0x2802100,0x962460, +0x90010ca9,0x2802100,0x962460,0x90010ca9,0x4000000,0x500000,0x90010ca9,0x4000010,0xb00000,0x90010ca9,0x6800100,0x962540,0x90010ca9,0x7c00100,0x230400,0x90010d1b, +0x4000000,0x500000,0x90010eaa,0x2802100,0x962460,0x90010eaa,0x2802400,0x962460,0x90010eaa,0x2806400,0x962460,0x90010eaa,0x4000000,0x200000,0x90010eaa,0x4000000, +0x400000,0x90010eaa,0x4000010,0x400000,0x90010eaa,0x6800000,0x1329800,0x90010eaa,0x6800100,0x962540,0x90010eaa,0x7c00100,0x230400,0x90010eaa,0xc000010,0x448000, +0x90010fab,0x7c00100,0x220400,0x90010fab,0x7c00100,0x250400,0x9002c300,0x4000000,0x100000,0x900ac400,0x4000000,0xe0000d,0x900acd00,0x4000000,0xe00000,0x900acd00, +0x4000000,0x2800000,0x900acf00,0x4000000,0xe00000,0x900b0500,0x4000000,0xe00000,0x900b0500,0x4000000,0x2800000,0x900b0b9a,0x7c00900,0x1230400,0x900b109a,0x7c00300, +0xe30000,0x900b119a,0x7c00300,0xe30000,0x90408e06,0x24000000,0x400000,0xa0001004,0x4000000,0x200000,0xa0001004,0x7c00100,0x230400,0xa000120f,0x2802100,0x962460, +0xa000120f,0x2802400,0x962460,0xa000171a,0x2802100,0x962460,0xa000171a,0x2806400,0x962460,0xa0002a00,0x4000000,0x1600000,0xa0003000,0x24000000,0x200000,0xa000581e, +0x7c00100,0x230400,0xa0007300,0x24000000,0x200000,0xa0008301,0x2802400,0x962460,0xa0008e00,0x24000000,0x400000,0xa000cf00,0x4000000,0xe00000,0xa0010500,0x4000000, +0x200000,0xa00114af,0x2802100,0x962460,0xa00114af,0x2802400,0x962460,0xa00114af,0x2806400,0x962460,0xa00114af,0x6800000,0x1329800,0xa00114af,0x7c00100,0x230400, +0xa00114af,0x7c00100,0x230560,0xa00116b0,0x2802100,0x962460,0xa00116b0,0x2802800,0x962460,0xa00116b0,0x2806400,0x962460,0xa00116b0,0x4000000,0x400000,0xa00116b0, +0x4000000,0x500000,0xa00116b0,0x4000010,0x400000,0xa00116b0,0x6800100,0x962540,0xa00116b0,0x7c00100,0x230400,0xa00116b0,0x7c00100,0x230560,0xa00116b0,0xc000010, +0x448000,0xa0011722,0x7c00100,0x230400,0xa00118b1,0x2802000,0x962460,0xa00118b1,0x2802100,0x962460,0xa00118b1,0x2806400,0x962460,0xa00118b1,0x4000000,0x200000, +0xa00118b1,0x4000000,0x400000,0xa00118b1,0x4000000,0x500000,0xa00118b1,0x6800100,0x962540,0xa00118b1,0x7c00100,0x230400,0xa00118b1,0x7c00100,0x230560,0xa00118b1, +0xc000010,0x448000,0xa00a4005,0x7c00100,0xe30400,0xa00a4711,0x7c40300,0xe30000,0xa00ac400,0x4000000,0xe00000,0xa00acb14,0x7c00100,0xe30000,0xa00acf00,0x4000000, +0xe00000,0xa00b0500,0x4000000,0xe00000,0xa00b0500,0x4000000,0x2800000,0xa00b0b96,0x7c00900,0x1230400,0xa00b1211,0x7c40300,0xe30000,0xa00b1314,0x7c00100,0xe30000, +0xa00b1596,0x7c00300,0xe30000,0xa040afb9,0x6800400,0x962540,0xa08083ba,0x2802400,0x962460,0xb0000a03,0x7c00100,0x220400,0xb0000b13,0x7c00100,0x2633800,0xb0001004, +0x2802000,0x962460,0xb0001110,0x4000000,0x200000,0xb0001524,0x2802100,0x962460,0xb0001615,0x4000000,0x500000,0xb000251b,0x7c00100,0x230400,0xb0007300,0x24000000, +0x200000,0xb0008939,0x4000000,0x200000,0xb0008939,0x7c00100,0x230400,0xb0008e00,0x24000000,0x200000,0xb0008e00,0x24000000,0x400000,0xb0008e00,0x24000010,0x400000, +0xb0009257,0x2802000,0x962460,0xb0009257,0x4000000,0x1600000,0xb0009519,0x7c00100,0x220400,0xb0009519,0x7c00100,0x250400,0xb0009a00,0x4000000,0x200000,0xb000b30a, +0x2802100,0x962460,0xb000b30a,0x7c00100,0x230400,0xb000c178,0x80000000,0x1329960,0xb000c300,0x4000000,0x200000,0xb000d202,0x2802000,0x962460,0xb000d476,0x6800100, +0x962540,0xb000d476,0x7c00100,0x230400,0xb000e300,0x4000000,0xe00000,0xb000fda1,0x7c00100,0x1830000,0xb0010eaa,0x2802000,0x962460,0xb00116b0,0x7c00100,0x230400, +0xb0011900,0x4000000,0xe00000,0xb0011ab2,0x2802100,0x962460,0xb0011ab2,0x2802400,0x962460,0xb0011ab2,0x2806400,0x962460,0xb0011ab2,0x4000000,0x200000,0xb0011ab2, +0x6800100,0x962540,0xb0011ab2,0x7c00100,0x230400,0xb0011b0c,0x7c00100,0x230400,0xb0011cb3,0x2802100,0x962460,0xb0011cb3,0x2806400,0x962460,0xb0011cb3,0x6800000, +0x1329800,0xb0011cb3,0x6800100,0x962540,0xb0011cb3,0x7c00100,0x230400,0xb0011db6,0x2802500,0x962460,0xb0011db6,0x6800000,0x1329800,0xb0011db6,0x7c00100,0x230400, +0xb0011db6,0x7c00500,0x230400,0xb0011e00,0x4000000,0x200000,0xb0011e00,0x4000000,0x1500000,0xb0011fb4,0x2802100,0x962460,0xb0011fb4,0x6800100,0x962540,0xb0011fb4, +0x7c00100,0x430400,0xb0011fb4,0x7c00100,0x2d30400,0xb0011fb4,0xc000010,0x448000,0xb0012000,0x4000000,0x200000,0xb00121b5,0x4000000,0x200000,0xb00121b5,0x4000010, +0x400000,0xb00121b5,0x7c00100,0x220400,0xb00121b5,0x7c00100,0x250400,0xb00121b5,0xc000010,0x448000,0xb00122b8,0x4000000,0x200000,0xb00122b8,0x7c00100,0x230400, +0xb00123b7,0x2802400,0x962460,0xb00123b7,0x4000000,0x200000,0xb00123b7,0x7c00100,0x230400,0xb00123b7,0xc000010,0x248000,0xb00a4005,0x7c00100,0xe30400,0xb00a4711, +0x7c40300,0xe30000,0xb00acf00,0x4000000,0xe00000,0xb00b0500,0x4000000,0xe00000,0xb00b0500,0x4000000,0x2800000,0xb00b109a,0x7c00300,0xe30000,0xb080e487,0x2802000, +0x962460,0xc0001524,0x4000000,0x500000,0xc0001a18,0x2806400,0x1862460,0xc0001a18,0x7c00100,0x1830000,0xc0007300,0x24000000,0x200000,0xc0008e00,0x24000010,0x400000, +0xc0009519,0x7c00100,0x220400,0xc0009519,0x7c00100,0x250400,0xc000c300,0x4000000,0x20000f,0xc000d85c,0x2802100,0x962460,0xc000d85c,0x6800100,0x962540,0xc000d85c, +0x7c00100,0x230400,0xc000dc99,0x7c00100,0x230400,0xc000e719,0x7c00100,0x220400,0xc00107a7,0x7c00100,0x230400,0xc0010eaa,0x7c00100,0x230400,0xc00116b0,0x7c00100, +0x230560,0xc0011900,0x4000000,0x200000,0xc0012447,0,0x818820,0xc0012447,0,0xc18820,0xc0012447,0,0x1418820,0xc00125b9,0x7c00100,0x230400, +0xc00126bb,0x2802100,0x962460,0xc00126bb,0x2806400,0x962460,0xc00126bb,0x4000000,0x500000,0xc00126bb,0x6800100,0x962540,0xc00126bb,0x7c00100,0x230400,0xc00127ba, +0x2802400,0x962460,0xc00127ba,0x4000000,0x200000,0xc00127ba,0x6800000,0x1329800,0xc00127ba,0x7c00100,0x230400,0xc00127ba,0x7c00900,0x230400,0xc0012800,0x4000000, +0x200000,0xc0012b23,0x4000000,0x200000,0xc0012b23,0x4000000,0x400000,0xc0012b23,0x4000000,0x1500000,0xc0012cbc,0x2802400,0x962460,0xc0012cbc,0x4000000,0x1600000, +0xc0012cbc,0x6800000,0x1329800,0xc0012cbc,0x7c00100,0x230400,0xc00acf00,0x4000000,0xe00000,0xc00ae300,0x4000000,0xe00000,0xc00b0500,0x4000000,0xe00000,0xc00b0500, +0x4000000,0x2800000,0xc00b0b11,0x4000000,0x1200000,0xc00b0b11,0x7c00900,0x1230400,0xc00b109a,0x7c00300,0xe30000,0xc00b2914,0x7c00100,0x2530000,0xc00b2916,0x7c00100, +0x2530c00,0xc00b2a00,0x4000000,0xe00000,0xc040af5e,0x7c00100,0x230400,0xc0c12b89,0x4000000,0x200000,0xc14a44cc,0x4000000,0xe0000d,0xd000131f,0x2802c00,0x962460, +0xd000171a,0x7c00100,0x230400,0xd0001821,0x2802100,0x962460,0xd0007300,0x24000000,0x200000,0xd0008e00,0x24000000,0x200000,0xd0008f3a,0x2806000,0x962460,0xd0009519, +0x7c00100,0x220400,0xd0009519,0x7c00100,0x250400,0xd000a500,0x4000000,0x200000,0xd000c300,0x4000000,0xe00000,0xd000d202,0x7c00100,0x230400,0xd000d476,0x7c00100, +0x230400,0xd000d997,0x2802100,0x962460,0xd000d997,0x6800100,0x962540,0xd000e001,0x2802100,0x962460,0xd000e700,0x4000400,0x200000,0xd000e719,0x7c00100,0x220400, +0xd000e719,0x7c00500,0x22040f,0xd000fa00,0x4000000,0xe00000,0xd0010eaa,0x4000010,0x400000,0xd0010eaa,0x7c00100,0x230400,0xd0012dbd,0x4000000,0x200000,0xd0012dbd, +0x7c00100,0x230400,0xd0012fbe,0x2802100,0x962460,0xd0012fbe,0x2802400,0x962460,0xd0012fbe,0x2806400,0x2f62460,0xd0012fbe,0x4000000,0x400000,0xd0012fbe,0x6800000, +0xe29800,0xd0012fbe,0x6800100,0x962540,0xd0012fbe,0x6800100,0x962541,0xd0012fbe,0x6804400,0x962540,0xd0012fbe,0x7c00100,0x2b30400,0xd0012fbe,0x7c00100,0x2c30560, +0xd0012fbe,0xc000010,0x448000,0xd0013183,0x7c00100,0x230400,0xd0013200,0x4000000,0x200000,0xd0013200,0x6800000,0x1329805,0xd00134c0,0x2802100,0x962460,0xd00134c0, +0x4000002,0x400000,0xd00134c0,0x7c00100,0x230400,0xd00a4305,0x7c00100,0xe30400,0xd00a4611,0x7c40300,0xe30000,0xd00a4711,0x7c40300,0xe30000,0xd00a5e11,0x7c40300, +0xe30000,0xd00acf00,0x4000000,0xe00000,0xd00b0500,0x4000000,0xe00000,0xd00b0500,0x4000000,0x2800000,0xd00b0b11,0x6800500,0x962540,0xd00b0bbf,0x2802200,0xc62460, +0xd00b119a,0x7c00300,0xe30000,0xd00b2a00,0x4000000,0xe00000,0xd00b2e11,0x7c40300,0xe30000,0xd00b30bf,0x7c00300,0x230000,0xd00b339a,0x7c00300,0xe30000,0xe0000c02, +0xc000010,0xb48000,0xe0001524,0x2802400,0x962460,0xe0001524,0x7c00100,0x230400,0xe0001615,0x7c00100,0x230400,0xe000251b,0x12882000,0x962460,0xe0002a00,0x4000000, +0x1500000,0xe0005102,0x4000000,0x200000,0xe0005c00,0x4000000,0x200000,0xe000622a,0x6804400,0x962540,0xe000622a,0x7c00100,0x230400,0xe0008838,0x7c00100,0x220400, +0xe0008838,0x7c00100,0x250400,0xe0008e00,0x24000000,0x810000,0xe0008e00,0x24000000,0x1410000,0xe0008e00,0x24000002,0x400000,0xe0008e00,0x2c000010,0xb48000,0xe000933e, +0x7c00100,0x2b30400,0xe000933e,0xc000010,0x448000,0xe0009519,0x7c00100,0x220400,0xe0009519,0x7c00100,0x22040f,0xe0009519,0x7c00100,0x250400,0xe000c178,0x2802100, +0x962460,0xe000c941,0x2802100,0x962460,0xe000c941,0x2806400,0x962460,0xe000c941,0x7c00100,0x2b30400,0xe000d202,0x2802400,0x962460,0xe000d202,0x7c00100,0x230400, +0xe000d202,0x7c00500,0x230400,0xe000dc99,0x4000000,0x200000,0xe000e001,0x2802100,0x962460,0xe000e001,0x2802400,0x962460,0xe000fda1,0x7c00100,0x1830000,0xe0013502, +0x2802400,0x962460,0xe0013502,0x4000000,0x200000,0xe0013502,0x7c00100,0x230400,0xe0013502,0x80000000,0x1329960,0xe00136c1,0x4000000,0x200000,0xe00136c1,0x7c00100, +0x230400,0xe001370b,0x7c00100,0x230400,0xe0013919,0x7c00500,0x220400,0xe0013919,0x7c00500,0x22040f,0xe0013919,0x7c00d00,0x23040f,0xe0013a19,0x7c00100,0x220400, +0xe0013a19,0x7c00100,0x230400,0xe0013bc2,0x2802400,0x962460,0xe0013bc2,0x7c00100,0x230400,0xe0013bc2,0xc000010,0x248000,0xe0013cc3,0x6800000,0x1329800,0xe0013cc3, +0x7c00100,0x230400,0xe0013dc4,0x2802400,0x962460,0xe0013dc4,0x7c00100,0x230400,0xe0013e28,0x7c00100,0x230400,0xe0013fc5,0x7c00100,0x220400,0xe0013fc5,0x7c00100, +0x250400,0xe0014000,0x4000000,0x200000,0xe0014001,0x2802400,0x962460,0xe00a4711,0x7c40300,0xe30000,0xe00a5e11,0x7c40300,0xe30000,0xe00ac511,0x7c40300,0xe30000, +0xe00acf00,0x4000000,0xe00000,0xe00ae300,0x4000000,0xe00000,0xe00b0500,0x4000000,0xe00000,0xe00b1314,0x7c00100,0xe30000,0xe00b1316,0x7c00100,0xe30c00,0xe00b2a00, +0x4000000,0xe00000,0xe00b2a00,0x4000000,0x2800000,0xe00b3816,0x7c00500,0x230c00,0xe0808328,0x2802400,0x962460,0xf0001615,0x6800100,0x962540,0xf0001a18,0x2802000, +0x1862460,0xf000c247,0x7c00100,0x1430400,0xf000d000,0x4000000,0xe00000,0xf000e300,0x4000000,0xe00000,0xf000e59d,0x2802100,0x962460,0xf000e59d,0x7c00100,0x230400, +0xf0012447,0,0x818820,0xf0012447,0,0xc18820,0xf0012447,0,0x1418820,0xf0012447,0x2802000,0x962460,0xf0012447,0x2802400,0x962460,0xf0012447, +0x7c00100,0x230400,0xf0013a19,0x7c00100,0x220400,0xf0014102,0x2802400,0x962460,0xf0014308,0x2802100,0x962460,0xf0014308,0x7c00500,0x22040e,0xf0014308,0x7c00500, +0x22040f,0xf001440a,0x4000000,0x500000,0xf0014500,0x4000000,0x200000,0xf00146c6,0x2802100,0x962460,0xf00146c6,0x2806000,0x2f62460,0xf00146c6,0x4000000,0xe00000, +0xf00146c6,0x6800000,0x2d29800,0xf00146c6,0x6800100,0x962540,0xf00146c6,0x6804000,0x962540,0xf00146c6,0x7c00100,0x2b30400,0xf00146c6,0x7c00100,0x2c30560,0xf00146c6, +0xc000010,0x448000,0xf00147c7,0x2802000,0x962460,0xf00147c7,0x6800000,0x1329800,0xf00147c7,0x7c00100,0x230400,0xf00ac511,0x7c40300,0xe30000,0xf00acf00,0x4000000, +0xe00000,0xf00b2914,0x7c00100,0x2530000,0xf00b2916,0x7c00100,0x2530c00,0xf00b2a00,0x4000000,0xe00000,0xf00b2a00,0x4000000,0x2800000,0xf00b4211,0x7c40300,0xe30000, +0xf10a3c00,0x4000000,0xe00000,0xf10a3c00,0x4008000,0xe00000,0xf10a8200,0x4008000,0xe00000,0xf10b4811,0x7c40300,0xe30000}; -// static const int32_t countPropsVectors=6999; +static const int32_t countPropsVectors=7260; static const int32_t propsVectorsColumns=3; -static const uint16_t scriptExtensions[262]={ -0x800e,0x8019,8,0x8059,8,2,8,0x8038,8,6,8,0x8019,2,0x22,0x25,0xb6, -0x80c0,2,0x22,0x8025,2,0x11,2,0x22,0x54,0x79,0x7b,0xa7,0xb6,0x80b7,2,0x8022, -2,0x25,0x80c0,2,0x20,2,0x80b6,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23, -0x24,0x89,0x97,0x809e,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,0x24,0x89,0x809e, -4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x3a,0x89,0x91,0x99,0x9e,0xa0, -0xaf,0xb2,0xb3,0x80bb,4,0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x30,0x3a, -0x89,0x91,0x99,0x9e,0xa0,0xaf,0xb2,0xb3,0x80bb,0xa,0x78,0xa0,0x80b2,0xa,0x69,4, -0x3a,0x8076,4,0x6f,0x10,0x80a4,0x10,0x74,0xf,0x809d,0xf,0x78,0x23,0x8089,0x23,0x7c, -0x15,0x80bb,0x15,0x80,0x1c,0x34,0x8076,0x1c,0x84,0xc,0x8019,0x2a,0x2b,0x2c,0x802d,0x1b, -0x805a,0x800a,4,0xa,0x15,0x8089,0xa,0x8089,4,0x800a,0xa,0x8097,0xa,0x15,0x1a,0x1f, -0x23,0x8024,0xa,0x80bb,4,0xa,0x15,0x1f,0x24,0x89,0x9e,0x80bb,0x8004,8,0x8022,0x19, -0x801b,0xa,0x19,0x8089,5,0x11,0x12,0x14,0x16,0x8029,5,0x11,0x12,0x14,0x8016,0x8011, -5,0x8011,0x11,0x14,0x8016,0x11,0x8019,0xa,0xf,0x10,0x78,0x91,0x99,0x9d,0x9e,0xa0, -0xa3,0x80b2,0xa,0xf,0x10,0x15,0x1a,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb, -0xa,0xf,0x10,0x15,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0xb2,0x80bb,0xa,0x98,0xa, -0x8023,0xa,0xef,0x19,0x1c,0x804f,0x37,0x804e,2,0x8025,2,0xf8,0x2f,0x31,0x8053,0x2f, -0x8031,2,0x8007,0x89,0x7c,0x8087}; +static const uint16_t scriptExtensions[298]={ +0x800e,0x8019,8,0x8059,8,2,8,0x8038,8,6,8,0x8019,2,0x22,0x25,0x57, +0xb6,0x80c0,2,0x22,0x8025,2,0x12,2,0x22,0x25,0x57,0xa7,0xb6,0x80c0,2,0x22, +0x54,0x79,0x7b,0xa7,0xb6,0xb7,0x80c2,2,0x8022,2,0x25,0x80c0,2,0x29,2,0x80b6, +2,0x2e,4,0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,0x24,0x89,0x97,0x809e,4, +0xa,0xf,0x10,0x15,0x19,0x1a,0x1f,0x23,0x24,0x89,0x809e,4,0xa,0xf,0x10,0x15, +0x1a,0x1f,0x21,0x23,0x24,0x3a,0x89,0x91,0x99,0x9e,0xa0,0xaf,0xb2,0xb3,0x80bb,4, +0xa,0xf,0x10,0x15,0x1a,0x1f,0x21,0x23,0x24,0x30,0x3a,0x89,0x91,0x99,0x9e,0xa0, +0xaf,0xb2,0xb3,0x80bb,0xa,0x78,0xa0,0x80b2,0xa,0x74,4,0x3a,0x8076,4,0x7a,0x10, +0x80a4,0x10,0x7f,0xf,0x809d,0xf,0x83,0x23,0x8089,0x23,0x87,0x15,0x80bb,0x15,0x8b,0x1c, +0x34,0x8076,0x1c,0x8f,0xc,0x8019,0x2a,0x2b,0x2c,0x802d,0x1b,0x805a,0x800a,4,0xa,0x15, +0x8089,0xa,0x8089,4,0x800a,0xa,0x8097,0xa,0x15,0x1a,0x1f,0x23,0x8024,0xa,0x80bb,4, +0xa,0x15,0x1a,0x1f,0x21,0x24,0x89,0x9e,0x80bb,0x8004,8,0x8022,0x19,0x801b,0xa,0x19, +0x8089,5,0x11,0x12,0x14,0x16,0x8029,5,0x11,0x12,0x14,0x8016,0x8011,5,0x8011,0x11, +0x14,0x8016,0x11,0x8019,0xa,0xf,0x10,0x15,0x1a,0x78,0x91,0x97,0x99,0x9d,0x9e,0xa0, +0xa3,0xb2,0x80bb,0xa,0xf,0x10,0x15,0x78,0x91,0x97,0x99,0x9d,0x9e,0xa0,0xa3,0xb2, +0x80bb,0xa,0xf,0x10,0x78,0x91,0x99,0x9d,0x9e,0xa0,0xa3,0x80b2,0xa,0xf,0x10,0x78, +0x91,0x97,0x99,0x9d,0x9e,0xa0,0xa3,0x80b2,0xa,0xa3,0xa,0x8023,0xa,0x10a,0x19,0x1c, +0x804f,0x37,0x804e,2,0x8057,2,0x8025,2,0x115,0x2f,0x31,0x8053,0x2f,0x31,0x80c1,0x2f, +0x8031,2,0x8007,0x79,0x80c2,0x79,0x123,0x89,0x87,0x8087}; -static const int32_t indexes[UPROPS_INDEX_COUNT]={0x2b96,0x2b96,0x2b96,0x2b96,0x6898,3,0x83ef,0x8472,0x8472,0x8472,0xb34c0,0x2a75a31,0,0,0,0}; +static const int32_t indexes[UPROPS_INDEX_COUNT]={0x2d4e,0x2d4e,0x2d4e,0x2d4e,0x6d50,3,0x89ac,0x8a41,0x8a41,0x8a41,0xb48c7,0x2f75a31,0,0,0,0}; #endif // INCLUDED_FROM_UCHAR_C diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucharstrie.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucharstrie.cpp index e0b33af51..ba9cea7ba 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucharstrie.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucharstrie.cpp @@ -30,8 +30,8 @@ UCharsTrie::~UCharsTrie() { UStringTrieResult UCharsTrie::current() const { - const UChar *pos=pos_; - if(pos==NULL) { + const char16_t *pos=pos_; + if(pos==nullptr) { return USTRINGTRIE_NO_MATCH; } else { int32_t node; @@ -59,7 +59,7 @@ UCharsTrie::nextForCodePoint(UChar32 cp) { } UStringTrieResult -UCharsTrie::branchNext(const UChar *pos, int32_t length, int32_t uchar) { +UCharsTrie::branchNext(const char16_t *pos, int32_t length, int32_t uchar) { // Branch according to the current unit. if(length==0) { length=*pos++; @@ -121,7 +121,7 @@ UCharsTrie::branchNext(const UChar *pos, int32_t length, int32_t uchar) { } UStringTrieResult -UCharsTrie::nextImpl(const UChar *pos, int32_t uchar) { +UCharsTrie::nextImpl(const char16_t *pos, int32_t uchar) { int32_t node=*pos++; for(;;) { if(nodekMaxBranchLinearSubNodeLength) { ++pos; // ignore the comparison unit - if(NULL==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) { - return NULL; + if(nullptr==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) { + return nullptr; } length=length-(length>>1); pos=skipDelta(pos); @@ -304,24 +304,24 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length, if(isFinal) { if(haveUniqueValue) { if(value!=uniqueValue) { - return NULL; + return nullptr; } } else { uniqueValue=value; - haveUniqueValue=TRUE; + haveUniqueValue=true; } } else { if(!findUniqueValue(pos+value, haveUniqueValue, uniqueValue)) { - return NULL; + return nullptr; } - haveUniqueValue=TRUE; + haveUniqueValue=true; } } while(--length>1); return pos+1; // ignore the last comparison unit } UBool -UCharsTrie::findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &uniqueValue) { +UCharsTrie::findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue) { int32_t node=*pos++; for(;;) { if(node=0) { @@ -397,7 +397,7 @@ UCharsTrie::getNextUChars(Appendable &out) const { } void -UCharsTrie::getNextBranchUChars(const UChar *pos, int32_t length, Appendable &out) { +UCharsTrie::getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out) { while(length>kMaxBranchLinearSubNodeLength) { ++pos; // ignore the comparison unit getNextBranchUChars(jumpByDelta(pos), length>>1, out); diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp index be4e386bb..95b32711a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp @@ -47,7 +47,7 @@ class UCharsTrieElement : public UMemory { return strings[stringOffset]; } - UChar charAt(int32_t index, const UnicodeString &strings) const { + char16_t charAt(int32_t index, const UnicodeString &strings) const { return strings[stringOffset+1+index]; } @@ -75,7 +75,7 @@ UCharsTrieElement::setTo(const UnicodeString &s, int32_t val, return; } stringOffset=strings.length(); - strings.append((UChar)length); + strings.append((char16_t)length); value=val; strings.append(s); } @@ -86,8 +86,8 @@ UCharsTrieElement::compareStringTo(const UCharsTrieElement &other, const Unicode } UCharsTrieBuilder::UCharsTrieBuilder(UErrorCode & /*errorCode*/) - : elements(NULL), elementsCapacity(0), elementsLength(0), - uchars(NULL), ucharsCapacity(0), ucharsLength(0) {} + : elements(nullptr), elementsCapacity(0), elementsLength(0), + uchars(nullptr), ucharsCapacity(0), ucharsLength(0) {} UCharsTrieBuilder::~UCharsTrieBuilder() { delete[] elements; @@ -112,7 +112,7 @@ UCharsTrieBuilder::add(const UnicodeString &s, int32_t value, UErrorCode &errorC newCapacity=4*elementsCapacity; } UCharsTrieElement *newElements=new UCharsTrieElement[newCapacity]; - if(newElements==NULL) { + if(newElements==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; return *this; } @@ -133,7 +133,7 @@ UCharsTrieBuilder::add(const UnicodeString &s, int32_t value, UErrorCode &errorC U_CDECL_BEGIN static int32_t U_CALLCONV -ucharstriebuilder_compareElementStrings(const void *context, const void *left, const void *right) { +compareElementStrings(const void *context, const void *left, const void *right) { const UnicodeString *strings=static_cast(context); const UCharsTrieElement *leftElement=static_cast(left); const UCharsTrieElement *rightElement=static_cast(right); @@ -145,13 +145,13 @@ U_CDECL_END UCharsTrie * UCharsTrieBuilder::build(UStringTrieBuildOption buildOption, UErrorCode &errorCode) { buildUChars(buildOption, errorCode); - UCharsTrie *newTrie=NULL; + UCharsTrie *newTrie=nullptr; if(U_SUCCESS(errorCode)) { newTrie=new UCharsTrie(uchars, uchars+(ucharsCapacity-ucharsLength)); - if(newTrie==NULL) { + if(newTrie==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } else { - uchars=NULL; // The new trie now owns the array. + uchars=nullptr; // The new trie now owns the array. ucharsCapacity=0; } } @@ -163,7 +163,7 @@ UCharsTrieBuilder::buildUnicodeString(UStringTrieBuildOption buildOption, Unicod UErrorCode &errorCode) { buildUChars(buildOption, errorCode); if(U_SUCCESS(errorCode)) { - result.setTo(FALSE, uchars+(ucharsCapacity-ucharsLength), ucharsLength); + result.setTo(false, uchars+(ucharsCapacity-ucharsLength), ucharsLength); } return result; } @@ -173,7 +173,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e if(U_FAILURE(errorCode)) { return; } - if(uchars!=NULL && ucharsLength>0) { + if(uchars!=nullptr && ucharsLength>0) { // Already built. return; } @@ -187,8 +187,8 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e return; } uprv_sortArray(elements, elementsLength, (int32_t)sizeof(UCharsTrieElement), - ucharstriebuilder_compareElementStrings, &strings, - FALSE, // need not be a stable sort + compareElementStrings, &strings, + false, // need not be a stable sort &errorCode); if(U_FAILURE(errorCode)) { return; @@ -204,7 +204,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e prev.fastCopyFrom(current); } } - // Create and UChar-serialize the trie for the elements. + // Create and char16_t-serialize the trie for the elements. ucharsLength=0; int32_t capacity=strings.length(); if(capacity<1024) { @@ -212,8 +212,8 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e } if(ucharsCapacity(uprv_malloc(capacity*2)); - if(uchars==NULL) { + uchars=static_cast(uprv_malloc(capacity*2)); + if(uchars==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; ucharsCapacity=0; return; @@ -221,7 +221,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e ucharsCapacity=capacity; } StringTrieBuilder::build(buildOption, elementsLength, errorCode); - if(uchars==NULL) { + if(uchars==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } @@ -231,7 +231,7 @@ UCharsTrieBuilder::getElementStringLength(int32_t i) const { return elements[i].getStringLength(strings); } -UChar +char16_t UCharsTrieBuilder::getElementUnit(int32_t i, int32_t unitIndex) const { return elements[i].charAt(unitIndex, strings); } @@ -257,7 +257,7 @@ UCharsTrieBuilder::countElementUnits(int32_t start, int32_t limit, int32_t unitI int32_t length=0; // Number of different units at unitIndex. int32_t i=start; do { - UChar unit=elements[i++].charAt(unitIndex, strings); + char16_t unit=elements[i++].charAt(unitIndex, strings); while(i(other); return 0==u_memcmp(s, o.s, length); } @@ -321,21 +321,21 @@ UCharsTrieBuilder::createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t l UBool UCharsTrieBuilder::ensureCapacity(int32_t length) { - if(uchars==NULL) { - return FALSE; // previous memory allocation had failed + if(uchars==nullptr) { + return false; // previous memory allocation had failed } if(length>ucharsCapacity) { int32_t newCapacity=ucharsCapacity; do { newCapacity*=2; } while(newCapacity<=length); - UChar *newUChars=static_cast(uprv_malloc(newCapacity*2)); - if(newUChars==NULL) { + char16_t *newUChars=static_cast(uprv_malloc(newCapacity*2)); + if(newUChars==nullptr) { // unable to allocate memory uprv_free(uchars); - uchars=NULL; + uchars=nullptr; ucharsCapacity=0; - return FALSE; + return false; } u_memcpy(newUChars+(newCapacity-ucharsLength), uchars+(ucharsCapacity-ucharsLength), ucharsLength); @@ -343,7 +343,7 @@ UCharsTrieBuilder::ensureCapacity(int32_t length) { uchars=newUChars; ucharsCapacity=newCapacity; } - return TRUE; + return true; } int32_t @@ -351,13 +351,13 @@ UCharsTrieBuilder::write(int32_t unit) { int32_t newLength=ucharsLength+1; if(ensureCapacity(newLength)) { ucharsLength=newLength; - uchars[ucharsCapacity-ucharsLength]=(UChar)unit; + uchars[ucharsCapacity-ucharsLength]=(char16_t)unit; } return ucharsLength; } int32_t -UCharsTrieBuilder::write(const UChar *s, int32_t length) { +UCharsTrieBuilder::write(const char16_t *s, int32_t length) { int32_t newLength=ucharsLength+length; if(ensureCapacity(newLength)) { ucharsLength=newLength; @@ -376,22 +376,22 @@ UCharsTrieBuilder::writeValueAndFinal(int32_t i, UBool isFinal) { if(0<=i && i<=UCharsTrie::kMaxOneUnitValue) { return write(i|(isFinal<<15)); } - UChar intUnits[3]; + char16_t intUnits[3]; int32_t length; if(i<0 || i>UCharsTrie::kMaxTwoUnitValue) { - intUnits[0]=(UChar)(UCharsTrie::kThreeUnitValueLead); - intUnits[1]=(UChar)((uint32_t)i>>16); - intUnits[2]=(UChar)i; + intUnits[0]=(char16_t)(UCharsTrie::kThreeUnitValueLead); + intUnits[1]=(char16_t)((uint32_t)i>>16); + intUnits[2]=(char16_t)i; length=3; // } else if(i<=UCharsTrie::kMaxOneUnitValue) { - // intUnits[0]=(UChar)(i); + // intUnits[0]=(char16_t)(i); // length=1; } else { - intUnits[0]=(UChar)(UCharsTrie::kMinTwoUnitValueLead+(i>>16)); - intUnits[1]=(UChar)i; + intUnits[0]=(char16_t)(UCharsTrie::kMinTwoUnitValueLead+(i>>16)); + intUnits[1]=(char16_t)i; length=2; } - intUnits[0]=(UChar)(intUnits[0]|(isFinal<<15)); + intUnits[0]=(char16_t)(intUnits[0]|(isFinal<<15)); return write(intUnits, length); } @@ -400,22 +400,22 @@ UCharsTrieBuilder::writeValueAndType(UBool hasValue, int32_t value, int32_t node if(!hasValue) { return write(node); } - UChar intUnits[3]; + char16_t intUnits[3]; int32_t length; if(value<0 || value>UCharsTrie::kMaxTwoUnitNodeValue) { - intUnits[0]=(UChar)(UCharsTrie::kThreeUnitNodeValueLead); - intUnits[1]=(UChar)((uint32_t)value>>16); - intUnits[2]=(UChar)value; + intUnits[0]=(char16_t)(UCharsTrie::kThreeUnitNodeValueLead); + intUnits[1]=(char16_t)((uint32_t)value>>16); + intUnits[2]=(char16_t)value; length=3; } else if(value<=UCharsTrie::kMaxOneUnitNodeValue) { - intUnits[0]=(UChar)((value+1)<<6); + intUnits[0]=(char16_t)((value+1)<<6); length=1; } else { - intUnits[0]=(UChar)(UCharsTrie::kMinTwoUnitNodeValueLead+((value>>10)&0x7fc0)); - intUnits[1]=(UChar)value; + intUnits[0]=(char16_t)(UCharsTrie::kMinTwoUnitNodeValueLead+((value>>10)&0x7fc0)); + intUnits[1]=(char16_t)value; length=2; } - intUnits[0]|=(UChar)node; + intUnits[0]|=(char16_t)node; return write(intUnits, length); } @@ -426,17 +426,17 @@ UCharsTrieBuilder::writeDeltaTo(int32_t jumpTarget) { if(i<=UCharsTrie::kMaxOneUnitDelta) { return write(i); } - UChar intUnits[3]; + char16_t intUnits[3]; int32_t length; if(i<=UCharsTrie::kMaxTwoUnitDelta) { - intUnits[0]=(UChar)(UCharsTrie::kMinTwoUnitDeltaLead+(i>>16)); + intUnits[0]=(char16_t)(UCharsTrie::kMinTwoUnitDeltaLead+(i>>16)); length=1; } else { - intUnits[0]=(UChar)(UCharsTrie::kThreeUnitDeltaLead); - intUnits[1]=(UChar)(i>>16); + intUnits[0]=(char16_t)(UCharsTrie::kThreeUnitDeltaLead); + intUnits[1]=(char16_t)(i>>16); length=2; } - intUnits[length++]=(UChar)i; + intUnits[length++]=(char16_t)i; return write(intUnits, length); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucharstrieiterator.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucharstrieiterator.cpp index b3132241f..176aed682 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucharstrieiterator.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucharstrieiterator.cpp @@ -26,8 +26,8 @@ UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLengt : uchars_(trieUChars), pos_(uchars_), initialPos_(uchars_), remainingMatchLength_(-1), initialRemainingMatchLength_(-1), - skipValue_(FALSE), - maxLength_(maxStringLength), value_(0), stack_(NULL) { + skipValue_(false), + maxLength_(maxStringLength), value_(0), stack_(nullptr) { if(U_FAILURE(errorCode)) { return; } @@ -38,7 +38,7 @@ UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLengt // via the UnicodeString and UVector32 implementations, so this additional // cost is minimal. stack_=new UVector32(errorCode); - if(stack_==NULL) { + if(stack_==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } @@ -48,8 +48,8 @@ UCharsTrie::Iterator::Iterator(const UCharsTrie &trie, int32_t maxStringLength, : uchars_(trie.uchars_), pos_(trie.pos_), initialPos_(trie.pos_), remainingMatchLength_(trie.remainingMatchLength_), initialRemainingMatchLength_(trie.remainingMatchLength_), - skipValue_(FALSE), - maxLength_(maxStringLength), value_(0), stack_(NULL) { + skipValue_(false), + maxLength_(maxStringLength), value_(0), stack_(nullptr) { if(U_FAILURE(errorCode)) { return; } @@ -57,7 +57,7 @@ UCharsTrie::Iterator::Iterator(const UCharsTrie &trie, int32_t maxStringLength, if(U_FAILURE(errorCode)) { return; } - if(stack_==NULL) { + if(stack_==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; return; } @@ -82,7 +82,7 @@ UCharsTrie::Iterator & UCharsTrie::Iterator::reset() { pos_=initialPos_; remainingMatchLength_=initialRemainingMatchLength_; - skipValue_=FALSE; + skipValue_=false; int32_t length=remainingMatchLength_+1; // Remaining match length. if(maxLength_>0 && length>maxLength_) { length=maxLength_; @@ -95,17 +95,17 @@ UCharsTrie::Iterator::reset() { } UBool -UCharsTrie::Iterator::hasNext() const { return pos_!=NULL || !stack_->isEmpty(); } +UCharsTrie::Iterator::hasNext() const { return pos_!=nullptr || !stack_->isEmpty(); } UBool UCharsTrie::Iterator::next(UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { - return FALSE; + return false; } - const UChar *pos=pos_; - if(pos==NULL) { + const char16_t *pos=pos_; + if(pos==nullptr) { if(stack_->isEmpty()) { - return FALSE; + return false; } // Pop the state off the stack and continue with the next outbound edge of // the branch node. @@ -117,8 +117,8 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) { length=(int32_t)((uint32_t)length>>16); if(length>1) { pos=branchNext(pos, length, errorCode); - if(pos==NULL) { - return TRUE; // Reached a final value. + if(pos==nullptr) { + return true; // Reached a final value. } } else { str_.append(*pos++); @@ -135,7 +135,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) { if(skipValue_) { pos=skipNodeValue(pos, node); node&=kNodeTypeMask; - skipValue_=FALSE; + skipValue_=false; } else { // Deliver value for the string so far. UBool isFinal=(UBool)(node>>15); @@ -145,16 +145,16 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) { value_=readNodeValue(pos, node); } if(isFinal || (maxLength_>0 && str_.length()==maxLength_)) { - pos_=NULL; + pos_=nullptr; } else { // We cannot skip the value right here because it shares its // lead unit with a match node which we have to evaluate // next time. // Instead, keep pos_ on the node lead unit itself. pos_=pos-1; - skipValue_=TRUE; + skipValue_=true; } - return TRUE; + return true; } } if(maxLength_>0 && str_.length()==maxLength_) { @@ -165,8 +165,8 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) { node=*pos++; } pos=branchNext(pos, node+1, errorCode); - if(pos==NULL) { - return TRUE; // Reached a final value. + if(pos==nullptr) { + return true; // Reached a final value. } } else { // Linear-match node, append length units to str_. @@ -182,8 +182,8 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) { } // Branch node, needs to take the first outbound edge and push state for the rest. -const UChar * -UCharsTrie::Iterator::branchNext(const UChar *pos, int32_t length, UErrorCode &errorCode) { +const char16_t * +UCharsTrie::Iterator::branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode) { while(length>kMaxBranchLinearSubNodeLength) { ++pos; // ignore the comparison unit // Push state for the greater-or-equal edge. @@ -195,7 +195,7 @@ UCharsTrie::Iterator::branchNext(const UChar *pos, int32_t length, UErrorCode &e } // List of key-value pairs where values are either final values or jump deltas. // Read the first (key, value) pair. - UChar trieUnit=*pos++; + char16_t trieUnit=*pos++; int32_t node=*pos++; UBool isFinal=(UBool)(node>>15); int32_t value=readValue(pos, node&=0x7fff); @@ -204,9 +204,9 @@ UCharsTrie::Iterator::branchNext(const UChar *pos, int32_t length, UErrorCode &e stack_->addElement(((length-1)<<16)|str_.length(), errorCode); str_.append(trieUnit); if(isFinal) { - pos_=NULL; + pos_=nullptr; value_=value; - return NULL; + return nullptr; } else { return pos+value; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp b/src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp index ce248fbca..a7d30977e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp @@ -69,13 +69,13 @@ UCharCharacterIterator::~UCharCharacterIterator() { bool UCharCharacterIterator::operator==(const ForwardCharacterIterator& that) const { if (this == &that) { - return TRUE; + return true; } if (typeid(*this) != typeid(that)) { - return FALSE; + return false; } - UCharCharacterIterator& realThat = (UCharCharacterIterator&)that; + const UCharCharacterIterator& realThat = static_cast(that); return text == realThat.text && textLength == realThat.textLength @@ -94,7 +94,7 @@ UCharCharacterIterator::clone() const { return new UCharCharacterIterator(*this); } -UChar +char16_t UCharCharacterIterator::first() { pos = begin; if(pos < end) { @@ -104,7 +104,7 @@ UCharCharacterIterator::first() { } } -UChar +char16_t UCharCharacterIterator::firstPostInc() { pos = begin; if(pos < end) { @@ -114,7 +114,7 @@ UCharCharacterIterator::firstPostInc() { } } -UChar +char16_t UCharCharacterIterator::last() { pos = end; if(pos > begin) { @@ -124,7 +124,7 @@ UCharCharacterIterator::last() { } } -UChar +char16_t UCharCharacterIterator::setIndex(int32_t position) { if(position < begin) { pos = begin; @@ -140,7 +140,7 @@ UCharCharacterIterator::setIndex(int32_t position) { } } -UChar +char16_t UCharCharacterIterator::current() const { if (pos >= begin && pos < end) { return text[pos]; @@ -149,7 +149,7 @@ UCharCharacterIterator::current() const { } } -UChar +char16_t UCharCharacterIterator::next() { if (pos + 1 < end) { return text[++pos]; @@ -160,7 +160,7 @@ UCharCharacterIterator::next() { } } -UChar +char16_t UCharCharacterIterator::nextPostInc() { if (pos < end) { return text[pos++]; @@ -171,10 +171,10 @@ UCharCharacterIterator::nextPostInc() { UBool UCharCharacterIterator::hasNext() { - return (UBool)(pos < end ? TRUE : FALSE); + return (UBool)(pos < end ? true : false); } -UChar +char16_t UCharCharacterIterator::previous() { if (pos > begin) { return text[--pos]; @@ -185,7 +185,7 @@ UCharCharacterIterator::previous() { UBool UCharCharacterIterator::hasPrevious() { - return (UBool)(pos > begin ? TRUE : FALSE); + return (UBool)(pos > begin ? true : false); } UChar32 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.cpp index ab9d3adbd..c63bd2219 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.cpp @@ -37,11 +37,11 @@ static cleanupFunc *gLibCleanupFunctions[UCLN_COMMON]; Please be sure that you have read ucln.h ************************************************/ U_CAPI void U_EXPORT2 -u_cleanup(void) +u_cleanup() { UTRACE_ENTRY_OC(UTRACE_U_CLEANUP); - icu::umtx_lock(NULL); /* Force a memory barrier, so that we are sure to see */ - icu::umtx_unlock(NULL); /* all state left around by any other threads. */ + icu::umtx_lock(nullptr); /* Force a memory barrier, so that we are sure to see */ + icu::umtx_unlock(nullptr); /* all state left around by any other threads. */ ucln_lib_cleanup(); @@ -52,12 +52,12 @@ u_cleanup(void) /*#endif*/ } -U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType libType) +U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType libType) { if (gLibCleanupFunctions[libType]) { gLibCleanupFunctions[libType](); - gLibCleanupFunctions[libType] = NULL; + gLibCleanupFunctions[libType] = nullptr; } } @@ -102,7 +102,7 @@ ucln_registerCleanup(ECleanupLibraryType type, } } -U_CFUNC UBool ucln_lib_cleanup(void) { +U_CFUNC UBool ucln_lib_cleanup() { int32_t libType = UCLN_START; int32_t commonFunc = UCLN_COMMON_START; @@ -114,11 +114,11 @@ U_CFUNC UBool ucln_lib_cleanup(void) { if (gCommonCleanupFunctions[commonFunc]) { gCommonCleanupFunctions[commonFunc](); - gCommonCleanupFunctions[commonFunc] = NULL; + gCommonCleanupFunctions[commonFunc] = nullptr; } } #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL)) ucln_unRegisterAutomaticCleanup(); #endif - return TRUE; + return true; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.h b/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.h index b837fb946..dd366417f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.h @@ -38,6 +38,8 @@ typedef enum ECleanupCommonType { UCLN_COMMON_SERVICE, UCLN_COMMON_LOCALE_KEY_TYPE, UCLN_COMMON_LOCALE, + UCLN_COMMON_LOCALE_ALIAS, + UCLN_COMMON_LOCALE_KNOWN_CANONICALIZED, UCLN_COMMON_LOCALE_AVAILABLE, UCLN_COMMON_LIKELY_SUBTAGS, UCLN_COMMON_LOCALE_DISTANCE, @@ -49,6 +51,7 @@ typedef enum ECleanupCommonType { UCLN_COMMON_USET, UCLN_COMMON_UNAMES, UCLN_COMMON_UPROPS, + UCLN_COMMON_EMOJIPROPS, UCLN_COMMON_UCNV, UCLN_COMMON_UCNV_IO, UCLN_COMMON_UDATA, diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucln_imp.h b/src/duckdb/extension/icu/third_party/icu/common/ucln_imp.h index 06a666cf1..63a54c86f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucln_imp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucln_imp.h @@ -78,7 +78,7 @@ * Use the ANSI C 'atexit' function. Note that this mechanism does not * guarantee the order of cleanup relative to other users of ICU! */ -static UBool gAutoCleanRegistered = FALSE; +static UBool gAutoCleanRegistered = false; static void ucln_atexit_handler() { @@ -88,7 +88,7 @@ static void ucln_atexit_handler() static void ucln_registerAutomaticCleanup() { if(!gAutoCleanRegistered) { - gAutoCleanRegistered = TRUE; + gAutoCleanRegistered = true; atexit(&ucln_atexit_handler); } } @@ -113,13 +113,13 @@ U_CAPI void U_EXPORT2 UCLN_FINI () /* Windows: DllMain */ #elif U_PLATFORM_HAS_WIN32_API -/* +/* * ICU's own DllMain. */ /* these are from putil.c */ /* READ READ READ READ! Are you getting compilation errors from windows.h? - Any source file which includes this (ucln_imp.h) header MUST + Any source file which includes this (ucln_imp.h) header MUST be defined with language extensions ON. */ #ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN @@ -135,7 +135,7 @@ U_CAPI void U_EXPORT2 UCLN_FINI () */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - BOOL status = TRUE; + BOOL status = true; switch(fdwReason) { case DLL_PROCESS_ATTACH: @@ -168,7 +168,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) /* GCC - use __attribute((destructor)) */ static void ucln_destructor() __attribute__((destructor)) ; -static void ucln_destructor() +static void ucln_destructor() { UCLN_CLEAN_ME_UP; } @@ -177,6 +177,6 @@ static void ucln_destructor() #endif /* UCLN_NO_AUTO_CLEANUP */ -// #else -// #error This file can only be included once. +#else +#error This file can only be included once. #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucmndata.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucmndata.cpp index ba2310bb7..69575d4e8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucmndata.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucmndata.cpp @@ -18,7 +18,7 @@ * contents for locating the individual items by name. * * Two formats for the table of contents are supported, which is - * why there is an abstract inteface involved. + * why there is an abstract interface involved. * */ @@ -34,7 +34,7 @@ U_CFUNC uint16_t udata_getHeaderSize(const DataHeader *udh) { - if(udh==NULL) { + if(udh==nullptr) { return 0; } else if(udh->info.isBigEndian==U_IS_BIG_ENDIAN) { /* same endianness */ @@ -48,7 +48,7 @@ udata_getHeaderSize(const DataHeader *udh) { U_CFUNC uint16_t udata_getInfoSize(const UDataInfo *info) { - if(info==NULL) { + if(info==nullptr) { return 0; } else if(info->isBigEndian==U_IS_BIG_ENDIAN) { /* same endianness */ @@ -216,7 +216,7 @@ static uint32_t U_CALLCONV offsetTOCEntryCount(const UDataMemory *pData) { int32_t retVal=0; const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc; - if (toc != NULL) { + if (toc != nullptr) { retVal = toc->count; } return retVal; @@ -229,7 +229,7 @@ offsetTOCLookupFn(const UDataMemory *pData, UErrorCode *pErrorCode) { (void)pErrorCode; const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc; - if(toc!=NULL) { + if(toc!=nullptr) { const char *base=(const char *)toc; int32_t number, count=(int32_t)toc->count; @@ -257,7 +257,7 @@ offsetTOCLookupFn(const UDataMemory *pData, #ifdef UDATA_DEBUG fprintf(stderr, "%s: Not found.\n", tocEntryName); #endif - return NULL; + return nullptr; } } else { #ifdef UDATA_DEBUG @@ -271,7 +271,7 @@ offsetTOCLookupFn(const UDataMemory *pData, static uint32_t U_CALLCONV pointerTOCEntryCount(const UDataMemory *pData) { const PointerTOC *toc = (PointerTOC *)pData->toc; - return (uint32_t)((toc != NULL) ? (toc->count) : 0); + return (uint32_t)((toc != nullptr) ? (toc->count) : 0); } static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData, @@ -279,7 +279,7 @@ static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData int32_t *pLength, UErrorCode *pErrorCode) { (void)pErrorCode; - if(pData->toc!=NULL) { + if(pData->toc!=nullptr) { const PointerTOC *toc = (PointerTOC *)pData->toc; int32_t number, count=(int32_t)toc->count; @@ -301,7 +301,7 @@ static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData #ifdef UDATA_DEBUG fprintf(stderr, "%s: Not found.\n", name); #endif - return NULL; + return nullptr; } } else { return pData->pHeader; @@ -328,7 +328,7 @@ U_CFUNC void udata_checkCommonData(UDataMemory *udm, UErrorCode *err) { return; } - if(udm==NULL || udm->pHeader==NULL) { + if(udm==nullptr || udm->pHeader==nullptr) { *err=U_INVALID_FORMAT_ERROR; } else if(!(udm->pHeader->dataHeader.magic1==0xda && udm->pHeader->dataHeader.magic2==0x27 && diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucmndata.h b/src/duckdb/extension/icu/third_party/icu/common/ucmndata.h index c3eba9f4d..486b4fd7b 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucmndata.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucmndata.h @@ -18,10 +18,10 @@ * contents for locating the individual items by name. * * Two formats for the table of contents are supported, which is - * why there is an abstract inteface involved. + * why there is an abstract interface involved. * * These functions are part of the ICU internal implementation, and - * are not inteded to be used directly by applications. + * are not intended to be used directly by applications. */ #ifndef __UCMNDATA_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv.cpp deleted file mode 100644 index e1d521855..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv.cpp +++ /dev/null @@ -1,2910 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ****************************************************************************** -// * -// * Copyright (C) 1998-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ****************************************************************************** -// * -// * ucnv.c: -// * Implements APIs for the ICU's codeset conversion library; -// * mostly calls through internal functions; -// * created by Bertrand A. Damiba -// * -// * Modification History: -// * -// * Date Name Description -// * 04/04/99 helena Fixed internal header inclusion. -// * 05/09/00 helena Added implementation to handle fallback mappings. -// * 06/20/2000 helena OS/400 port changes; mostly typecast. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include - -// #include "unicode/ustring.h" -// #include "unicode/ucnv.h" -// #include "unicode/ucnv_err.h" -// #include "unicode/uset.h" -// #include "unicode/utf.h" -// #include "unicode/utf16.h" -// #include "putilimp.h" -// #include "cmemory.h" -// #include "cstring.h" -// #include "uassert.h" -// #include "utracimp.h" -// #include "ustr_imp.h" -// #include "ucnv_imp.h" -// #include "ucnv_cnv.h" -// #include "ucnv_bld.h" - -// /* size of intermediate and preflighting buffers in ucnv_convert() */ -// #define CHUNK_SIZE 1024 - -// typedef struct UAmbiguousConverter { -// const char *name; -// const UChar variant5c; -// } UAmbiguousConverter; - -// static const UAmbiguousConverter ambiguousConverters[]={ -// { "ibm-897_P100-1995", 0xa5 }, -// { "ibm-942_P120-1999", 0xa5 }, -// { "ibm-943_P130-1999", 0xa5 }, -// { "ibm-946_P100-1995", 0xa5 }, -// { "ibm-33722_P120-1999", 0xa5 }, -// { "ibm-1041_P100-1995", 0xa5 }, -// /*{ "ibm-54191_P100-2006", 0xa5 },*/ -// /*{ "ibm-62383_P100-2007", 0xa5 },*/ -// /*{ "ibm-891_P100-1995", 0x20a9 },*/ -// { "ibm-944_P100-1995", 0x20a9 }, -// { "ibm-949_P110-1999", 0x20a9 }, -// { "ibm-1363_P110-1997", 0x20a9 }, -// { "ISO_2022,locale=ko,version=0", 0x20a9 }, -// { "ibm-1088_P100-1995", 0x20a9 } -// }; - -// /*Calls through createConverter */ -// U_CAPI UConverter* U_EXPORT2 -// ucnv_open (const char *name, -// UErrorCode * err) -// { -// UConverter *r; - -// if (err == NULL || U_FAILURE (*err)) { -// return NULL; -// } - -// r = ucnv_createConverter(NULL, name, err); -// return r; -// } - -// U_CAPI UConverter* U_EXPORT2 -// ucnv_openPackage (const char *packageName, const char *converterName, UErrorCode * err) -// { -// return ucnv_createConverterFromPackage(packageName, converterName, err); -// } - -// /*Extracts the UChar* to a char* and calls through createConverter */ -// U_CAPI UConverter* U_EXPORT2 -// ucnv_openU (const UChar * name, -// UErrorCode * err) -// { -// char asciiName[UCNV_MAX_CONVERTER_NAME_LENGTH]; - -// if (err == NULL || U_FAILURE(*err)) -// return NULL; -// if (name == NULL) -// return ucnv_open (NULL, err); -// if (u_strlen(name) >= UCNV_MAX_CONVERTER_NAME_LENGTH) -// { -// *err = U_ILLEGAL_ARGUMENT_ERROR; -// return NULL; -// } -// return ucnv_open(u_austrcpy(asciiName, name), err); -// } - -// /* Copy the string that is represented by the UConverterPlatform enum -// * @param platformString An output buffer -// * @param platform An enum representing a platform -// * @return the length of the copied string. -// */ -// static int32_t -// ucnv_copyPlatformString(char *platformString, UConverterPlatform pltfrm) -// { -// switch (pltfrm) -// { -// case UCNV_IBM: -// uprv_strcpy(platformString, "ibm-"); -// return 4; -// case UCNV_UNKNOWN: -// break; -// } - -// /* default to empty string */ -// *platformString = 0; -// return 0; -// } - -// /*Assumes a $platform-#codepage.$CONVERTER_FILE_EXTENSION scheme and calls -// *through createConverter*/ -// U_CAPI UConverter* U_EXPORT2 -// ucnv_openCCSID (int32_t codepage, -// UConverterPlatform platform, -// UErrorCode * err) -// { -// char myName[UCNV_MAX_CONVERTER_NAME_LENGTH]; -// int32_t myNameLen; - -// if (err == NULL || U_FAILURE (*err)) -// return NULL; - -// /* ucnv_copyPlatformString could return "ibm-" or "cp" */ -// myNameLen = ucnv_copyPlatformString(myName, platform); -// T_CString_integerToString(myName + myNameLen, codepage, 10); - -// return ucnv_createConverter(NULL, myName, err); -// } - -// /* Creating a temporary stack-based object that can be used in one thread, -// and created from a converter that is shared across threads. -// */ - -// U_CAPI UConverter* U_EXPORT2 -// ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status) -// { -// UConverter *localConverter, *allocatedConverter; -// int32_t stackBufferSize; -// int32_t bufferSizeNeeded; -// UErrorCode cbErr; -// UConverterToUnicodeArgs toUArgs = { -// sizeof(UConverterToUnicodeArgs), -// TRUE, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL -// }; -// UConverterFromUnicodeArgs fromUArgs = { -// sizeof(UConverterFromUnicodeArgs), -// TRUE, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL -// }; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_CLONE); - -// if (status == NULL || U_FAILURE(*status)){ -// UTRACE_EXIT_STATUS(status? *status: U_ILLEGAL_ARGUMENT_ERROR); -// return NULL; -// } - -// if (cnv == NULL) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// UTRACE_EXIT_STATUS(*status); -// return NULL; -// } - -// UTRACE_DATA3(UTRACE_OPEN_CLOSE, "clone converter %s at %p into stackBuffer %p", -// ucnv_getName(cnv, status), cnv, stackBuffer); - -// if (cnv->sharedData->impl->safeClone != NULL) { -// /* call the custom safeClone function for sizing */ -// bufferSizeNeeded = 0; -// cnv->sharedData->impl->safeClone(cnv, NULL, &bufferSizeNeeded, status); -// if (U_FAILURE(*status)) { -// UTRACE_EXIT_STATUS(*status); -// return NULL; -// } -// } -// else -// { -// /* inherent sizing */ -// bufferSizeNeeded = sizeof(UConverter); -// } - -// if (pBufferSize == NULL) { -// stackBufferSize = 1; -// pBufferSize = &stackBufferSize; -// } else { -// stackBufferSize = *pBufferSize; -// if (stackBufferSize <= 0){ /* 'preflighting' request - set needed size into *pBufferSize */ -// *pBufferSize = bufferSizeNeeded; -// UTRACE_EXIT_VALUE(bufferSizeNeeded); -// return NULL; -// } -// } - -// /* Adjust (if necessary) the stackBuffer pointer to be aligned correctly for a UConverter. -// * TODO(Jira ICU-20736) Redo this using std::align() once g++4.9 compatibility is no longer needed. -// */ -// if (stackBuffer) { -// uintptr_t p = reinterpret_cast(stackBuffer); -// uintptr_t aligned_p = (p + alignof(UConverter) - 1) & ~(alignof(UConverter) - 1); -// ptrdiff_t pointerAdjustment = aligned_p - p; -// if (bufferSizeNeeded + pointerAdjustment <= stackBufferSize) { -// stackBuffer = reinterpret_cast(aligned_p); -// stackBufferSize -= static_cast(pointerAdjustment); -// } else { -// /* prevent using the stack buffer but keep the size > 0 so that we do not just preflight */ -// stackBufferSize = 1; -// } -// } - -// /* Now, see if we must allocate any memory */ -// if (stackBufferSize < bufferSizeNeeded || stackBuffer == NULL) -// { -// /* allocate one here...*/ -// localConverter = allocatedConverter = (UConverter *) uprv_malloc (bufferSizeNeeded); - -// if(localConverter == NULL) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// UTRACE_EXIT_STATUS(*status); -// return NULL; -// } -// *status = U_SAFECLONE_ALLOCATED_WARNING; - -// /* record the fact that memory was allocated */ -// *pBufferSize = bufferSizeNeeded; -// } else { -// /* just use the stack buffer */ -// localConverter = (UConverter*) stackBuffer; -// allocatedConverter = NULL; -// } - -// uprv_memset(localConverter, 0, bufferSizeNeeded); - -// /* Copy initial state */ -// uprv_memcpy(localConverter, cnv, sizeof(UConverter)); -// localConverter->isCopyLocal = localConverter->isExtraLocal = FALSE; - -// /* copy the substitution string */ -// if (cnv->subChars == (uint8_t *)cnv->subUChars) { -// localConverter->subChars = (uint8_t *)localConverter->subUChars; -// } else { -// localConverter->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR); -// if (localConverter->subChars == NULL) { -// uprv_free(allocatedConverter); -// UTRACE_EXIT_STATUS(*status); -// return NULL; -// } -// uprv_memcpy(localConverter->subChars, cnv->subChars, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR); -// } - -// /* now either call the safeclone fcn or not */ -// if (cnv->sharedData->impl->safeClone != NULL) { -// /* call the custom safeClone function */ -// localConverter = cnv->sharedData->impl->safeClone(cnv, localConverter, pBufferSize, status); -// } - -// if(localConverter==NULL || U_FAILURE(*status)) { -// if (allocatedConverter != NULL && allocatedConverter->subChars != (uint8_t *)allocatedConverter->subUChars) { -// uprv_free(allocatedConverter->subChars); -// } -// uprv_free(allocatedConverter); -// UTRACE_EXIT_STATUS(*status); -// return NULL; -// } - -// /* increment refcount of shared data if needed */ -// if (cnv->sharedData->isReferenceCounted) { -// ucnv_incrementRefCount(cnv->sharedData); -// } - -// if(localConverter == (UConverter*)stackBuffer) { -// /* we're using user provided data - set to not destroy */ -// localConverter->isCopyLocal = TRUE; -// } - -// /* allow callback functions to handle any memory allocation */ -// toUArgs.converter = fromUArgs.converter = localConverter; -// cbErr = U_ZERO_ERROR; -// cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, NULL, 0, UCNV_CLONE, &cbErr); -// cbErr = U_ZERO_ERROR; -// cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLONE, &cbErr); - -// UTRACE_EXIT_PTR_STATUS(localConverter, *status); -// return localConverter; -// } - - - -// /*Decreases the reference counter in the shared immutable section of the object -// *and frees the mutable part*/ - -// U_CAPI void U_EXPORT2 -// ucnv_close (UConverter * converter) -// { -// UErrorCode errorCode = U_ZERO_ERROR; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_CLOSE); - -// if (converter == NULL) -// { -// UTRACE_EXIT(); -// return; -// } - -// UTRACE_DATA3(UTRACE_OPEN_CLOSE, "close converter %s at %p, isCopyLocal=%b", -// ucnv_getName(converter, &errorCode), converter, converter->isCopyLocal); - -// /* In order to speed up the close, only call the callbacks when they have been changed. -// This performance check will only work when the callbacks are set within a shared library -// or from user code that statically links this code. */ -// /* first, notify the callback functions that the converter is closed */ -// if (converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) { -// UConverterToUnicodeArgs toUArgs = { -// sizeof(UConverterToUnicodeArgs), -// TRUE, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL -// }; - -// toUArgs.converter = converter; -// errorCode = U_ZERO_ERROR; -// converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_CLOSE, &errorCode); -// } -// if (converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) { -// UConverterFromUnicodeArgs fromUArgs = { -// sizeof(UConverterFromUnicodeArgs), -// TRUE, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL -// }; -// fromUArgs.converter = converter; -// errorCode = U_ZERO_ERROR; -// converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLOSE, &errorCode); -// } - -// if (converter->sharedData->impl->close != NULL) { -// converter->sharedData->impl->close(converter); -// } - -// if (converter->subChars != (uint8_t *)converter->subUChars) { -// uprv_free(converter->subChars); -// } - -// if (converter->sharedData->isReferenceCounted) { -// ucnv_unloadSharedDataIfReady(converter->sharedData); -// } - -// if(!converter->isCopyLocal){ -// uprv_free(converter); -// } - -// UTRACE_EXIT(); -// } - -// /*returns a single Name from the list, will return NULL if out of bounds -// */ -// U_CAPI const char* U_EXPORT2 -// ucnv_getAvailableName (int32_t n) -// { -// if (0 <= n && n <= 0xffff) { -// UErrorCode err = U_ZERO_ERROR; -// const char *name = ucnv_bld_getAvailableConverter((uint16_t)n, &err); -// if (U_SUCCESS(err)) { -// return name; -// } -// } -// return NULL; -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_countAvailable () -// { -// UErrorCode err = U_ZERO_ERROR; -// return ucnv_bld_countAvailableConverters(&err); -// } - -// U_CAPI void U_EXPORT2 -// ucnv_getSubstChars (const UConverter * converter, -// char *mySubChar, -// int8_t * len, -// UErrorCode * err) -// { -// if (U_FAILURE (*err)) -// return; - -// if (converter->subCharLen <= 0) { -// /* Unicode string or empty string from ucnv_setSubstString(). */ -// *len = 0; -// return; -// } - -// if (*len < converter->subCharLen) /*not enough space in subChars */ -// { -// *err = U_INDEX_OUTOFBOUNDS_ERROR; -// return; -// } - -// uprv_memcpy (mySubChar, converter->subChars, converter->subCharLen); /*fills in the subchars */ -// *len = converter->subCharLen; /*store # of bytes copied to buffer */ -// } - -// U_CAPI void U_EXPORT2 -// ucnv_setSubstChars (UConverter * converter, -// const char *mySubChar, -// int8_t len, -// UErrorCode * err) -// { -// if (U_FAILURE (*err)) -// return; - -// /*Makes sure that the subChar is within the codepages char length boundaries */ -// if ((len > converter->sharedData->staticData->maxBytesPerChar) -// || (len < converter->sharedData->staticData->minBytesPerChar)) -// { -// *err = U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// uprv_memcpy (converter->subChars, mySubChar, len); /*copies the subchars */ -// converter->subCharLen = len; /*sets the new len */ - -// /* -// * There is currently (2001Feb) no separate API to set/get subChar1. -// * In order to always have subChar written after it is explicitly set, -// * we set subChar1 to 0. -// */ -// converter->subChar1 = 0; - -// return; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_setSubstString(UConverter *cnv, -// const UChar *s, -// int32_t length, -// UErrorCode *err) { -// alignas(UConverter) char cloneBuffer[U_CNV_SAFECLONE_BUFFERSIZE]; -// char chars[UCNV_ERROR_BUFFER_LENGTH]; - -// UConverter *clone; -// uint8_t *subChars; -// int32_t cloneSize, length8; - -// /* Let the following functions check all arguments. */ -// cloneSize = sizeof(cloneBuffer); -// clone = ucnv_safeClone(cnv, cloneBuffer, &cloneSize, err); -// ucnv_setFromUCallBack(clone, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, err); -// length8 = ucnv_fromUChars(clone, chars, (int32_t)sizeof(chars), s, length, err); -// ucnv_close(clone); -// if (U_FAILURE(*err)) { -// return; -// } - -// if (cnv->sharedData->impl->writeSub == NULL -// #if !UCONFIG_NO_LEGACY_CONVERSION -// || (cnv->sharedData->staticData->conversionType == UCNV_MBCS && -// ucnv_MBCSGetType(cnv) != UCNV_EBCDIC_STATEFUL) -// #endif -// ) { -// /* The converter is not stateful. Store the charset bytes as a fixed string. */ -// subChars = (uint8_t *)chars; -// } else { -// /* -// * The converter has a non-default writeSub() function, indicating -// * that it is stateful. -// * Store the Unicode string for on-the-fly conversion for correct -// * state handling. -// */ -// if (length > UCNV_ERROR_BUFFER_LENGTH) { -// /* -// * Should not occur. The converter should output at least one byte -// * per UChar, which means that ucnv_fromUChars() should catch all -// * overflows. -// */ -// *err = U_BUFFER_OVERFLOW_ERROR; -// return; -// } -// subChars = (uint8_t *)s; -// if (length < 0) { -// length = u_strlen(s); -// } -// length8 = length * U_SIZEOF_UCHAR; -// } - -// /* -// * For storing the substitution string, select either the small buffer inside -// * UConverter or allocate a subChars buffer. -// */ -// if (length8 > UCNV_MAX_SUBCHAR_LEN) { -// /* Use a separate buffer for the string. Outside UConverter to not make it too large. */ -// if (cnv->subChars == (uint8_t *)cnv->subUChars) { -// /* Allocate a new buffer for the string. */ -// cnv->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR); -// if (cnv->subChars == NULL) { -// cnv->subChars = (uint8_t *)cnv->subUChars; -// *err = U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// uprv_memset(cnv->subChars, 0, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR); -// } -// } - -// /* Copy the substitution string into the UConverter or its subChars buffer. */ -// if (length8 == 0) { -// cnv->subCharLen = 0; -// } else { -// uprv_memcpy(cnv->subChars, subChars, length8); -// if (subChars == (uint8_t *)chars) { -// cnv->subCharLen = (int8_t)length8; -// } else /* subChars == s */ { -// cnv->subCharLen = (int8_t)-length; -// } -// } - -// /* See comment in ucnv_setSubstChars(). */ -// cnv->subChar1 = 0; -// } - -// /*resets the internal states of a converter -// *goal : have the same behaviour than a freshly created converter -// */ -// static void _reset(UConverter *converter, UConverterResetChoice choice, -// UBool callCallback) { -// if(converter == NULL) { -// return; -// } - -// if(callCallback) { -// /* first, notify the callback functions that the converter is reset */ -// UErrorCode errorCode; - -// if(choice<=UCNV_RESET_TO_UNICODE && converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) { -// UConverterToUnicodeArgs toUArgs = { -// sizeof(UConverterToUnicodeArgs), -// TRUE, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL -// }; -// toUArgs.converter = converter; -// errorCode = U_ZERO_ERROR; -// converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_RESET, &errorCode); -// } -// if(choice!=UCNV_RESET_TO_UNICODE && converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) { -// UConverterFromUnicodeArgs fromUArgs = { -// sizeof(UConverterFromUnicodeArgs), -// TRUE, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL, -// NULL -// }; -// fromUArgs.converter = converter; -// errorCode = U_ZERO_ERROR; -// converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_RESET, &errorCode); -// } -// } - -// /* now reset the converter itself */ -// if(choice<=UCNV_RESET_TO_UNICODE) { -// converter->toUnicodeStatus = converter->sharedData->toUnicodeStatus; -// converter->mode = 0; -// converter->toULength = 0; -// converter->invalidCharLength = converter->UCharErrorBufferLength = 0; -// converter->preToULength = 0; -// } -// if(choice!=UCNV_RESET_TO_UNICODE) { -// converter->fromUnicodeStatus = 0; -// converter->fromUChar32 = 0; -// converter->invalidUCharLength = converter->charErrorBufferLength = 0; -// converter->preFromUFirstCP = U_SENTINEL; -// converter->preFromULength = 0; -// } - -// if (converter->sharedData->impl->reset != NULL) { -// /* call the custom reset function */ -// converter->sharedData->impl->reset(converter, choice); -// } -// } - -// U_CAPI void U_EXPORT2 -// ucnv_reset(UConverter *converter) -// { -// _reset(converter, UCNV_RESET_BOTH, TRUE); -// } - -// U_CAPI void U_EXPORT2 -// ucnv_resetToUnicode(UConverter *converter) -// { -// _reset(converter, UCNV_RESET_TO_UNICODE, TRUE); -// } - -// U_CAPI void U_EXPORT2 -// ucnv_resetFromUnicode(UConverter *converter) -// { -// _reset(converter, UCNV_RESET_FROM_UNICODE, TRUE); -// } - -// U_CAPI int8_t U_EXPORT2 -// ucnv_getMaxCharSize (const UConverter * converter) -// { -// return converter->maxBytesPerUChar; -// } - - -// U_CAPI int8_t U_EXPORT2 -// ucnv_getMinCharSize (const UConverter * converter) -// { -// return converter->sharedData->staticData->minBytesPerChar; -// } - -// U_CAPI const char* U_EXPORT2 -// ucnv_getName (const UConverter * converter, UErrorCode * err) - -// { -// if (U_FAILURE (*err)) -// return NULL; -// if(converter->sharedData->impl->getName){ -// const char* temp= converter->sharedData->impl->getName(converter); -// if(temp) -// return temp; -// } -// return converter->sharedData->staticData->name; -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_getCCSID(const UConverter * converter, -// UErrorCode * err) -// { -// int32_t ccsid; -// if (U_FAILURE (*err)) -// return -1; - -// ccsid = converter->sharedData->staticData->codepage; -// if (ccsid == 0) { -// /* Rare case. This is for cases like gb18030, -// which doesn't have an IBM canonical name, but does have an IBM alias. */ -// const char *standardName = ucnv_getStandardName(ucnv_getName(converter, err), "IBM", err); -// if (U_SUCCESS(*err) && standardName) { -// const char *ccsidStr = uprv_strchr(standardName, '-'); -// if (ccsidStr) { -// ccsid = (int32_t)atol(ccsidStr+1); /* +1 to skip '-' */ -// } -// } -// } -// return ccsid; -// } - - -// U_CAPI UConverterPlatform U_EXPORT2 -// ucnv_getPlatform (const UConverter * converter, -// UErrorCode * err) -// { -// if (U_FAILURE (*err)) -// return UCNV_UNKNOWN; - -// return (UConverterPlatform)converter->sharedData->staticData->platform; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_getToUCallBack (const UConverter * converter, -// UConverterToUCallback *action, -// const void **context) -// { -// *action = converter->fromCharErrorBehaviour; -// *context = converter->toUContext; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_getFromUCallBack (const UConverter * converter, -// UConverterFromUCallback *action, -// const void **context) -// { -// *action = converter->fromUCharErrorBehaviour; -// *context = converter->fromUContext; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_setToUCallBack (UConverter * converter, -// UConverterToUCallback newAction, -// const void* newContext, -// UConverterToUCallback *oldAction, -// const void** oldContext, -// UErrorCode * err) -// { -// if (U_FAILURE (*err)) -// return; -// if (oldAction) *oldAction = converter->fromCharErrorBehaviour; -// converter->fromCharErrorBehaviour = newAction; -// if (oldContext) *oldContext = converter->toUContext; -// converter->toUContext = newContext; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_setFromUCallBack (UConverter * converter, -// UConverterFromUCallback newAction, -// const void* newContext, -// UConverterFromUCallback *oldAction, -// const void** oldContext, -// UErrorCode * err) -// { -// if (U_FAILURE (*err)) -// return; -// if (oldAction) *oldAction = converter->fromUCharErrorBehaviour; -// converter->fromUCharErrorBehaviour = newAction; -// if (oldContext) *oldContext = converter->fromUContext; -// converter->fromUContext = newContext; -// } - -// static void -// _updateOffsets(int32_t *offsets, int32_t length, -// int32_t sourceIndex, int32_t errorInputLength) { -// int32_t *limit; -// int32_t delta, offset; - -// if(sourceIndex>=0) { -// /* -// * adjust each offset by adding the previous sourceIndex -// * minus the length of the input sequence that caused an -// * error, if any -// */ -// delta=sourceIndex-errorInputLength; -// } else { -// /* -// * set each offset to -1 because this conversion function -// * does not handle offsets -// */ -// delta=-1; -// } - -// limit=offsets+length; -// if(delta==0) { -// /* most common case, nothing to do */ -// } else if(delta>0) { -// /* add the delta to each offset (but not if the offset is <0) */ -// while(offsets=0) { -// *offsets=offset+delta; -// } -// ++offsets; -// } -// } else /* delta<0 */ { -// /* -// * set each offset to -1 because this conversion function -// * does not handle offsets -// * or the error input sequence started in a previous buffer -// */ -// while(offsetsconverter; -// s=pArgs->source; -// t=pArgs->target; -// offsets=pArgs->offsets; - -// /* get the converter implementation function */ -// sourceIndex=0; -// if(offsets==NULL) { -// fromUnicode=cnv->sharedData->impl->fromUnicode; -// } else { -// fromUnicode=cnv->sharedData->impl->fromUnicodeWithOffsets; -// if(fromUnicode==NULL) { -// /* there is no WithOffsets implementation */ -// fromUnicode=cnv->sharedData->impl->fromUnicode; -// /* we will write -1 for each offset */ -// sourceIndex=-1; -// } -// } - -// if(cnv->preFromULength>=0) { -// /* normal mode */ -// realSource=NULL; - -// /* avoid compiler warnings - not otherwise necessary, and the values do not matter */ -// realSourceLimit=NULL; -// realFlush=FALSE; -// realSourceIndex=0; -// } else { -// /* -// * Previous m:n conversion stored source units from a partial match -// * and failed to consume all of them. -// * We need to "replay" them from a temporary buffer and convert them first. -// */ -// realSource=pArgs->source; -// realSourceLimit=pArgs->sourceLimit; -// realFlush=pArgs->flush; -// realSourceIndex=sourceIndex; - -// uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR); -// pArgs->source=replay; -// pArgs->sourceLimit=replay-cnv->preFromULength; -// pArgs->flush=FALSE; -// sourceIndex=-1; - -// cnv->preFromULength=0; -// } - -// /* -// * loop for conversion and error handling -// * -// * loop { -// * convert -// * loop { -// * update offsets -// * handle end of input -// * handle errors/call callback -// * } -// * } -// */ -// for(;;) { -// if(U_SUCCESS(*err)) { -// /* convert */ -// fromUnicode(pArgs, err); - -// /* -// * set a flag for whether the converter -// * successfully processed the end of the input -// * -// * need not check cnv->preFromULength==0 because a replay (<0) will cause -// * sflush && pArgs->source==pArgs->sourceLimit && -// cnv->fromUChar32==0); -// } else { -// /* handle error from ucnv_convertEx() */ -// converterSawEndOfInput=FALSE; -// } - -// /* no callback called yet for this iteration */ -// calledCallback=FALSE; - -// /* no sourceIndex adjustment for conversion, only for callback output */ -// errorInputLength=0; - -// /* -// * loop for offsets and error handling -// * -// * iterates at most 3 times: -// * 1. to clean up after the conversion function -// * 2. after the callback -// * 3. after the callback again if there was truncated input -// */ -// for(;;) { -// /* update offsets if we write any */ -// if(offsets!=NULL) { -// int32_t length=(int32_t)(pArgs->target-t); -// if(length>0) { -// _updateOffsets(offsets, length, sourceIndex, errorInputLength); - -// /* -// * if a converter handles offsets and updates the offsets -// * pointer at the end, then pArgs->offset should not change -// * here; -// * however, some converters do not handle offsets at all -// * (sourceIndex<0) or may not update the offsets pointer -// */ -// pArgs->offsets=offsets+=length; -// } - -// if(sourceIndex>=0) { -// sourceIndex+=(int32_t)(pArgs->source-s); -// } -// } - -// if(cnv->preFromULength<0) { -// /* -// * switch the source to new replay units (cannot occur while replaying) -// * after offset handling and before end-of-input and callback handling -// */ -// if(realSource==NULL) { -// realSource=pArgs->source; -// realSourceLimit=pArgs->sourceLimit; -// realFlush=pArgs->flush; -// realSourceIndex=sourceIndex; - -// uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR); -// pArgs->source=replay; -// pArgs->sourceLimit=replay-cnv->preFromULength; -// pArgs->flush=FALSE; -// if((sourceIndex+=cnv->preFromULength)<0) { -// sourceIndex=-1; -// } - -// cnv->preFromULength=0; -// } else { -// /* see implementation note before _fromUnicodeWithCallback() */ -// U_ASSERT(realSource==NULL); -// *err=U_INTERNAL_PROGRAM_ERROR; -// } -// } - -// /* update pointers */ -// s=pArgs->source; -// t=pArgs->target; - -// if(U_SUCCESS(*err)) { -// if(ssourceLimit) { -// /* -// * continue with the conversion loop while there is still input left -// * (continue converting by breaking out of only the inner loop) -// */ -// break; -// } else if(realSource!=NULL) { -// /* switch back from replaying to the real source and continue */ -// pArgs->source=realSource; -// pArgs->sourceLimit=realSourceLimit; -// pArgs->flush=realFlush; -// sourceIndex=realSourceIndex; - -// realSource=NULL; -// break; -// } else if(pArgs->flush && cnv->fromUChar32!=0) { -// /* -// * the entire input stream is consumed -// * and there is a partial, truncated input sequence left -// */ - -// /* inject an error and continue with callback handling */ -// *err=U_TRUNCATED_CHAR_FOUND; -// calledCallback=FALSE; /* new error condition */ -// } else { -// /* input consumed */ -// if(pArgs->flush) { -// /* -// * return to the conversion loop once more if the flush -// * flag is set and the conversion function has not -// * successfully processed the end of the input yet -// * -// * (continue converting by breaking out of only the inner loop) -// */ -// if(!converterSawEndOfInput) { -// break; -// } - -// /* reset the converter without calling the callback function */ -// _reset(cnv, UCNV_RESET_FROM_UNICODE, FALSE); -// } - -// /* done successfully */ -// return; -// } -// } - -// /* U_FAILURE(*err) */ -// { -// UErrorCode e; - -// if( calledCallback || -// (e=*err)==U_BUFFER_OVERFLOW_ERROR || -// (e!=U_INVALID_CHAR_FOUND && -// e!=U_ILLEGAL_CHAR_FOUND && -// e!=U_TRUNCATED_CHAR_FOUND) -// ) { -// /* -// * the callback did not or cannot resolve the error: -// * set output pointers and return -// * -// * the check for buffer overflow is redundant but it is -// * a high-runner case and hopefully documents the intent -// * well -// * -// * if we were replaying, then the replay buffer must be -// * copied back into the UConverter -// * and the real arguments must be restored -// */ -// if(realSource!=NULL) { -// int32_t length; - -// U_ASSERT(cnv->preFromULength==0); - -// length=(int32_t)(pArgs->sourceLimit-pArgs->source); -// if(length>0) { -// u_memcpy(cnv->preFromU, pArgs->source, length); -// cnv->preFromULength=(int8_t)-length; -// } - -// pArgs->source=realSource; -// pArgs->sourceLimit=realSourceLimit; -// pArgs->flush=realFlush; -// } - -// return; -// } -// } - -// /* callback handling */ -// { -// UChar32 codePoint; - -// /* get and write the code point */ -// codePoint=cnv->fromUChar32; -// errorInputLength=0; -// U16_APPEND_UNSAFE(cnv->invalidUCharBuffer, errorInputLength, codePoint); -// cnv->invalidUCharLength=(int8_t)errorInputLength; - -// /* set the converter state to deal with the next character */ -// cnv->fromUChar32=0; - -// /* call the callback function */ -// cnv->fromUCharErrorBehaviour(cnv->fromUContext, pArgs, -// cnv->invalidUCharBuffer, errorInputLength, codePoint, -// *err==U_INVALID_CHAR_FOUND ? UCNV_UNASSIGNED : UCNV_ILLEGAL, -// err); -// } - -// /* -// * loop back to the offset handling -// * -// * this flag will indicate after offset handling -// * that a callback was called; -// * if the callback did not resolve the error, then we return -// */ -// calledCallback=TRUE; -// } -// } -// } - -// /* -// * Output the fromUnicode overflow buffer. -// * Call this function if(cnv->charErrorBufferLength>0). -// * @return TRUE if overflow -// */ -// static UBool -// ucnv_outputOverflowFromUnicode(UConverter *cnv, -// char **target, const char *targetLimit, -// int32_t **pOffsets, -// UErrorCode *err) { -// int32_t *offsets; -// char *overflow, *t; -// int32_t i, length; - -// t=*target; -// if(pOffsets!=NULL) { -// offsets=*pOffsets; -// } else { -// offsets=NULL; -// } - -// overflow=(char *)cnv->charErrorBuffer; -// length=cnv->charErrorBufferLength; -// i=0; -// while(icharErrorBufferLength=(int8_t)j; -// *target=t; -// if(offsets!=NULL) { -// *pOffsets=offsets; -// } -// *err=U_BUFFER_OVERFLOW_ERROR; -// return TRUE; -// } - -// /* copy the overflow contents to the target */ -// *t++=overflow[i++]; -// if(offsets!=NULL) { -// *offsets++=-1; /* no source index available for old output */ -// } -// } - -// /* the overflow buffer is completely copied to the target */ -// cnv->charErrorBufferLength=0; -// *target=t; -// if(offsets!=NULL) { -// *pOffsets=offsets; -// } -// return FALSE; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_fromUnicode(UConverter *cnv, -// char **target, const char *targetLimit, -// const UChar **source, const UChar *sourceLimit, -// int32_t *offsets, -// UBool flush, -// UErrorCode *err) { -// UConverterFromUnicodeArgs args; -// const UChar *s; -// char *t; - -// /* check parameters */ -// if(err==NULL || U_FAILURE(*err)) { -// return; -// } - -// if(cnv==NULL || target==NULL || source==NULL) { -// *err=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// s=*source; -// t=*target; - -// if ((const void *)U_MAX_PTR(sourceLimit) == (const void *)sourceLimit) { -// /* -// Prevent code from going into an infinite loop in case we do hit this -// limit. The limit pointer is expected to be on a UChar * boundary. -// This also prevents the next argument check from failing. -// */ -// sourceLimit = (const UChar *)(((const char *)sourceLimit) - 1); -// } - -// /* -// * All these conditions should never happen. -// * -// * 1) Make sure that the limits are >= to the address source or target -// * -// * 2) Make sure that the buffer sizes do not exceed the number range for -// * int32_t because some functions use the size (in units or bytes) -// * rather than comparing pointers, and because offsets are int32_t values. -// * -// * size_t is guaranteed to be unsigned and large enough for the job. -// * -// * Return with an error instead of adjusting the limits because we would -// * not be able to maintain the semantics that either the source must be -// * consumed or the target filled (unless an error occurs). -// * An adjustment would be targetLimit=t+0x7fffffff; for example. -// * -// * 3) Make sure that the user didn't incorrectly cast a UChar * pointer -// * to a char * pointer and provide an incomplete UChar code unit. -// */ -// if (sourceLimit(size_t)0x3fffffff && sourceLimit>s) || -// ((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t) || -// (((const char *)sourceLimit-(const char *)s) & 1) != 0) -// { -// *err=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// /* output the target overflow buffer */ -// if( cnv->charErrorBufferLength>0 && -// ucnv_outputOverflowFromUnicode(cnv, target, targetLimit, &offsets, err) -// ) { -// /* U_BUFFER_OVERFLOW_ERROR */ -// return; -// } -// /* *target may have moved, therefore stop using t */ - -// if(!flush && s==sourceLimit && cnv->preFromULength>=0) { -// /* the overflow buffer is emptied and there is no new input: we are done */ -// return; -// } - -// /* -// * Do not simply return with a buffer overflow error if -// * !flush && t==targetLimit -// * because it is possible that the source will not generate any output. -// * For example, the skip callback may be called; -// * it does not output anything. -// */ - -// /* prepare the converter arguments */ -// args.converter=cnv; -// args.flush=flush; -// args.offsets=offsets; -// args.source=s; -// args.sourceLimit=sourceLimit; -// args.target=*target; -// args.targetLimit=targetLimit; -// args.size=sizeof(args); - -// _fromUnicodeWithCallback(&args, err); - -// *source=args.source; -// *target=args.target; -// } - -// /* ucnv_toUnicode() --------------------------------------------------------- */ - -// static void -// _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) { -// UConverterToUnicode toUnicode; -// UConverter *cnv; -// const char *s; -// UChar *t; -// int32_t *offsets; -// int32_t sourceIndex; -// int32_t errorInputLength; -// UBool converterSawEndOfInput, calledCallback; - -// /* variables for m:n conversion */ -// char replay[UCNV_EXT_MAX_BYTES]; -// const char *realSource, *realSourceLimit; -// int32_t realSourceIndex; -// UBool realFlush; - -// cnv=pArgs->converter; -// s=pArgs->source; -// t=pArgs->target; -// offsets=pArgs->offsets; - -// /* get the converter implementation function */ -// sourceIndex=0; -// if(offsets==NULL) { -// toUnicode=cnv->sharedData->impl->toUnicode; -// } else { -// toUnicode=cnv->sharedData->impl->toUnicodeWithOffsets; -// if(toUnicode==NULL) { -// /* there is no WithOffsets implementation */ -// toUnicode=cnv->sharedData->impl->toUnicode; -// /* we will write -1 for each offset */ -// sourceIndex=-1; -// } -// } - -// if(cnv->preToULength>=0) { -// /* normal mode */ -// realSource=NULL; - -// /* avoid compiler warnings - not otherwise necessary, and the values do not matter */ -// realSourceLimit=NULL; -// realFlush=FALSE; -// realSourceIndex=0; -// } else { -// /* -// * Previous m:n conversion stored source units from a partial match -// * and failed to consume all of them. -// * We need to "replay" them from a temporary buffer and convert them first. -// */ -// realSource=pArgs->source; -// realSourceLimit=pArgs->sourceLimit; -// realFlush=pArgs->flush; -// realSourceIndex=sourceIndex; - -// uprv_memcpy(replay, cnv->preToU, -cnv->preToULength); -// pArgs->source=replay; -// pArgs->sourceLimit=replay-cnv->preToULength; -// pArgs->flush=FALSE; -// sourceIndex=-1; - -// cnv->preToULength=0; -// } - -// /* -// * loop for conversion and error handling -// * -// * loop { -// * convert -// * loop { -// * update offsets -// * handle end of input -// * handle errors/call callback -// * } -// * } -// */ -// for(;;) { -// if(U_SUCCESS(*err)) { -// /* convert */ -// toUnicode(pArgs, err); - -// /* -// * set a flag for whether the converter -// * successfully processed the end of the input -// * -// * need not check cnv->preToULength==0 because a replay (<0) will cause -// * sflush && pArgs->source==pArgs->sourceLimit && -// cnv->toULength==0); -// } else { -// /* handle error from getNextUChar() or ucnv_convertEx() */ -// converterSawEndOfInput=FALSE; -// } - -// /* no callback called yet for this iteration */ -// calledCallback=FALSE; - -// /* no sourceIndex adjustment for conversion, only for callback output */ -// errorInputLength=0; - -// /* -// * loop for offsets and error handling -// * -// * iterates at most 3 times: -// * 1. to clean up after the conversion function -// * 2. after the callback -// * 3. after the callback again if there was truncated input -// */ -// for(;;) { -// /* update offsets if we write any */ -// if(offsets!=NULL) { -// int32_t length=(int32_t)(pArgs->target-t); -// if(length>0) { -// _updateOffsets(offsets, length, sourceIndex, errorInputLength); - -// /* -// * if a converter handles offsets and updates the offsets -// * pointer at the end, then pArgs->offset should not change -// * here; -// * however, some converters do not handle offsets at all -// * (sourceIndex<0) or may not update the offsets pointer -// */ -// pArgs->offsets=offsets+=length; -// } - -// if(sourceIndex>=0) { -// sourceIndex+=(int32_t)(pArgs->source-s); -// } -// } - -// if(cnv->preToULength<0) { -// /* -// * switch the source to new replay units (cannot occur while replaying) -// * after offset handling and before end-of-input and callback handling -// */ -// if(realSource==NULL) { -// realSource=pArgs->source; -// realSourceLimit=pArgs->sourceLimit; -// realFlush=pArgs->flush; -// realSourceIndex=sourceIndex; - -// uprv_memcpy(replay, cnv->preToU, -cnv->preToULength); -// pArgs->source=replay; -// pArgs->sourceLimit=replay-cnv->preToULength; -// pArgs->flush=FALSE; -// if((sourceIndex+=cnv->preToULength)<0) { -// sourceIndex=-1; -// } - -// cnv->preToULength=0; -// } else { -// /* see implementation note before _fromUnicodeWithCallback() */ -// U_ASSERT(realSource==NULL); -// *err=U_INTERNAL_PROGRAM_ERROR; -// } -// } - -// /* update pointers */ -// s=pArgs->source; -// t=pArgs->target; - -// if(U_SUCCESS(*err)) { -// if(ssourceLimit) { -// /* -// * continue with the conversion loop while there is still input left -// * (continue converting by breaking out of only the inner loop) -// */ -// break; -// } else if(realSource!=NULL) { -// /* switch back from replaying to the real source and continue */ -// pArgs->source=realSource; -// pArgs->sourceLimit=realSourceLimit; -// pArgs->flush=realFlush; -// sourceIndex=realSourceIndex; - -// realSource=NULL; -// break; -// } else if(pArgs->flush && cnv->toULength>0) { -// /* -// * the entire input stream is consumed -// * and there is a partial, truncated input sequence left -// */ - -// /* inject an error and continue with callback handling */ -// *err=U_TRUNCATED_CHAR_FOUND; -// calledCallback=FALSE; /* new error condition */ -// } else { -// /* input consumed */ -// if(pArgs->flush) { -// /* -// * return to the conversion loop once more if the flush -// * flag is set and the conversion function has not -// * successfully processed the end of the input yet -// * -// * (continue converting by breaking out of only the inner loop) -// */ -// if(!converterSawEndOfInput) { -// break; -// } - -// /* reset the converter without calling the callback function */ -// _reset(cnv, UCNV_RESET_TO_UNICODE, FALSE); -// } - -// /* done successfully */ -// return; -// } -// } - -// /* U_FAILURE(*err) */ -// { -// UErrorCode e; - -// if( calledCallback || -// (e=*err)==U_BUFFER_OVERFLOW_ERROR || -// (e!=U_INVALID_CHAR_FOUND && -// e!=U_ILLEGAL_CHAR_FOUND && -// e!=U_TRUNCATED_CHAR_FOUND && -// e!=U_ILLEGAL_ESCAPE_SEQUENCE && -// e!=U_UNSUPPORTED_ESCAPE_SEQUENCE) -// ) { -// /* -// * the callback did not or cannot resolve the error: -// * set output pointers and return -// * -// * the check for buffer overflow is redundant but it is -// * a high-runner case and hopefully documents the intent -// * well -// * -// * if we were replaying, then the replay buffer must be -// * copied back into the UConverter -// * and the real arguments must be restored -// */ -// if(realSource!=NULL) { -// int32_t length; - -// U_ASSERT(cnv->preToULength==0); - -// length=(int32_t)(pArgs->sourceLimit-pArgs->source); -// if(length>0) { -// uprv_memcpy(cnv->preToU, pArgs->source, length); -// cnv->preToULength=(int8_t)-length; -// } - -// pArgs->source=realSource; -// pArgs->sourceLimit=realSourceLimit; -// pArgs->flush=realFlush; -// } - -// return; -// } -// } - -// /* copy toUBytes[] to invalidCharBuffer[] */ -// errorInputLength=cnv->invalidCharLength=cnv->toULength; -// if(errorInputLength>0) { -// uprv_memcpy(cnv->invalidCharBuffer, cnv->toUBytes, errorInputLength); -// } - -// /* set the converter state to deal with the next character */ -// cnv->toULength=0; - -// /* call the callback function */ -// if(cnv->toUCallbackReason==UCNV_ILLEGAL && *err==U_INVALID_CHAR_FOUND) { -// cnv->toUCallbackReason = UCNV_UNASSIGNED; -// } -// cnv->fromCharErrorBehaviour(cnv->toUContext, pArgs, -// cnv->invalidCharBuffer, errorInputLength, -// cnv->toUCallbackReason, -// err); -// cnv->toUCallbackReason = UCNV_ILLEGAL; /* reset to default value */ - -// /* -// * loop back to the offset handling -// * -// * this flag will indicate after offset handling -// * that a callback was called; -// * if the callback did not resolve the error, then we return -// */ -// calledCallback=TRUE; -// } -// } -// } - -// /* -// * Output the toUnicode overflow buffer. -// * Call this function if(cnv->UCharErrorBufferLength>0). -// * @return TRUE if overflow -// */ -// static UBool -// ucnv_outputOverflowToUnicode(UConverter *cnv, -// UChar **target, const UChar *targetLimit, -// int32_t **pOffsets, -// UErrorCode *err) { -// int32_t *offsets; -// UChar *overflow, *t; -// int32_t i, length; - -// t=*target; -// if(pOffsets!=NULL) { -// offsets=*pOffsets; -// } else { -// offsets=NULL; -// } - -// overflow=cnv->UCharErrorBuffer; -// length=cnv->UCharErrorBufferLength; -// i=0; -// while(iUCharErrorBufferLength=(int8_t)j; -// *target=t; -// if(offsets!=NULL) { -// *pOffsets=offsets; -// } -// *err=U_BUFFER_OVERFLOW_ERROR; -// return TRUE; -// } - -// /* copy the overflow contents to the target */ -// *t++=overflow[i++]; -// if(offsets!=NULL) { -// *offsets++=-1; /* no source index available for old output */ -// } -// } - -// /* the overflow buffer is completely copied to the target */ -// cnv->UCharErrorBufferLength=0; -// *target=t; -// if(offsets!=NULL) { -// *pOffsets=offsets; -// } -// return FALSE; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_toUnicode(UConverter *cnv, -// UChar **target, const UChar *targetLimit, -// const char **source, const char *sourceLimit, -// int32_t *offsets, -// UBool flush, -// UErrorCode *err) { -// UConverterToUnicodeArgs args; -// const char *s; -// UChar *t; - -// /* check parameters */ -// if(err==NULL || U_FAILURE(*err)) { -// return; -// } - -// if(cnv==NULL || target==NULL || source==NULL) { -// *err=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// s=*source; -// t=*target; - -// if ((const void *)U_MAX_PTR(targetLimit) == (const void *)targetLimit) { -// /* -// Prevent code from going into an infinite loop in case we do hit this -// limit. The limit pointer is expected to be on a UChar * boundary. -// This also prevents the next argument check from failing. -// */ -// targetLimit = (const UChar *)(((const char *)targetLimit) - 1); -// } - -// /* -// * All these conditions should never happen. -// * -// * 1) Make sure that the limits are >= to the address source or target -// * -// * 2) Make sure that the buffer sizes do not exceed the number range for -// * int32_t because some functions use the size (in units or bytes) -// * rather than comparing pointers, and because offsets are int32_t values. -// * -// * size_t is guaranteed to be unsigned and large enough for the job. -// * -// * Return with an error instead of adjusting the limits because we would -// * not be able to maintain the semantics that either the source must be -// * consumed or the target filled (unless an error occurs). -// * An adjustment would be sourceLimit=t+0x7fffffff; for example. -// * -// * 3) Make sure that the user didn't incorrectly cast a UChar * pointer -// * to a char * pointer and provide an incomplete UChar code unit. -// */ -// if (sourceLimit(size_t)0x7fffffff && sourceLimit>s) || -// ((size_t)(targetLimit-t)>(size_t)0x3fffffff && targetLimit>t) || -// (((const char *)targetLimit-(const char *)t) & 1) != 0 -// ) { -// *err=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// /* output the target overflow buffer */ -// if( cnv->UCharErrorBufferLength>0 && -// ucnv_outputOverflowToUnicode(cnv, target, targetLimit, &offsets, err) -// ) { -// /* U_BUFFER_OVERFLOW_ERROR */ -// return; -// } -// /* *target may have moved, therefore stop using t */ - -// if(!flush && s==sourceLimit && cnv->preToULength>=0) { -// /* the overflow buffer is emptied and there is no new input: we are done */ -// return; -// } - -// /* -// * Do not simply return with a buffer overflow error if -// * !flush && t==targetLimit -// * because it is possible that the source will not generate any output. -// * For example, the skip callback may be called; -// * it does not output anything. -// */ - -// /* prepare the converter arguments */ -// args.converter=cnv; -// args.flush=flush; -// args.offsets=offsets; -// args.source=s; -// args.sourceLimit=sourceLimit; -// args.target=*target; -// args.targetLimit=targetLimit; -// args.size=sizeof(args); - -// _toUnicodeWithCallback(&args, err); - -// *source=args.source; -// *target=args.target; -// } - -// /* ucnv_to/fromUChars() ----------------------------------------------------- */ - -// U_CAPI int32_t U_EXPORT2 -// ucnv_fromUChars(UConverter *cnv, -// char *dest, int32_t destCapacity, -// const UChar *src, int32_t srcLength, -// UErrorCode *pErrorCode) { -// const UChar *srcLimit; -// char *originalDest, *destLimit; -// int32_t destLength; - -// /* check arguments */ -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// if( cnv==NULL || -// destCapacity<0 || (destCapacity>0 && dest==NULL) || -// srcLength<-1 || (srcLength!=0 && src==NULL) -// ) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// /* initialize */ -// ucnv_resetFromUnicode(cnv); -// originalDest=dest; -// if(srcLength==-1) { -// srcLength=u_strlen(src); -// } -// if(srcLength>0) { -// srcLimit=src+srcLength; -// destCapacity=pinCapacity(dest, destCapacity); -// destLimit=dest+destCapacity; - -// /* perform the conversion */ -// ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode); -// destLength=(int32_t)(dest-originalDest); - -// /* if an overflow occurs, then get the preflighting length */ -// if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) { -// char buffer[1024]; - -// destLimit=buffer+sizeof(buffer); -// do { -// dest=buffer; -// *pErrorCode=U_ZERO_ERROR; -// ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode); -// destLength+=(int32_t)(dest-buffer); -// } while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR); -// } -// } else { -// destLength=0; -// } - -// return u_terminateChars(originalDest, destCapacity, destLength, pErrorCode); -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_toUChars(UConverter *cnv, -// UChar *dest, int32_t destCapacity, -// const char *src, int32_t srcLength, -// UErrorCode *pErrorCode) { -// const char *srcLimit; -// UChar *originalDest, *destLimit; -// int32_t destLength; - -// /* check arguments */ -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// if( cnv==NULL || -// destCapacity<0 || (destCapacity>0 && dest==NULL) || -// srcLength<-1 || (srcLength!=0 && src==NULL)) -// { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// /* initialize */ -// ucnv_resetToUnicode(cnv); -// originalDest=dest; -// if(srcLength==-1) { -// srcLength=(int32_t)uprv_strlen(src); -// } -// if(srcLength>0) { -// srcLimit=src+srcLength; -// destCapacity=pinCapacity(dest, destCapacity); -// destLimit=dest+destCapacity; - -// /* perform the conversion */ -// ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode); -// destLength=(int32_t)(dest-originalDest); - -// /* if an overflow occurs, then get the preflighting length */ -// if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) -// { -// UChar buffer[1024]; - -// destLimit=buffer+UPRV_LENGTHOF(buffer); -// do { -// dest=buffer; -// *pErrorCode=U_ZERO_ERROR; -// ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, pErrorCode); -// destLength+=(int32_t)(dest-buffer); -// } -// while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR); -// } -// } else { -// destLength=0; -// } - -// return u_terminateUChars(originalDest, destCapacity, destLength, pErrorCode); -// } - -// /* ucnv_getNextUChar() ------------------------------------------------------ */ - -// U_CAPI UChar32 U_EXPORT2 -// ucnv_getNextUChar(UConverter *cnv, -// const char **source, const char *sourceLimit, -// UErrorCode *err) { -// UConverterToUnicodeArgs args; -// UChar buffer[U16_MAX_LENGTH]; -// const char *s; -// UChar32 c; -// int32_t i, length; - -// /* check parameters */ -// if(err==NULL || U_FAILURE(*err)) { -// return 0xffff; -// } - -// if(cnv==NULL || source==NULL) { -// *err=U_ILLEGAL_ARGUMENT_ERROR; -// return 0xffff; -// } - -// s=*source; -// if(sourceLimit(size_t)0x7fffffff && sourceLimit>s)) { -// *err=U_ILLEGAL_ARGUMENT_ERROR; -// return 0xffff; -// } - -// c=U_SENTINEL; - -// /* flush the target overflow buffer */ -// if(cnv->UCharErrorBufferLength>0) { -// UChar *overflow; - -// overflow=cnv->UCharErrorBuffer; -// i=0; -// length=cnv->UCharErrorBufferLength; -// U16_NEXT(overflow, i, length, c); - -// /* move the remaining overflow contents up to the beginning */ -// if((cnv->UCharErrorBufferLength=(int8_t)(length-i))>0) { -// uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+i, -// cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR); -// } - -// if(!U16_IS_LEAD(c) || itoULength==0 && cnv->sharedData->impl->getNextUChar!=NULL) { -// c=cnv->sharedData->impl->getNextUChar(&args, err); -// *source=s=args.source; -// if(*err==U_INDEX_OUTOFBOUNDS_ERROR) { -// /* reset the converter without calling the callback function */ -// _reset(cnv, UCNV_RESET_TO_UNICODE, FALSE); -// return 0xffff; /* no output */ -// } else if(U_SUCCESS(*err) && c>=0) { -// return c; -// /* -// * else fall through to use _toUnicode() because -// * UCNV_GET_NEXT_UCHAR_USE_TO_U: the native function did not want to handle it after all -// * U_FAILURE: call _toUnicode() for callback handling (do not output c) -// */ -// } -// } - -// /* convert to one UChar in buffer[0], or handle getNextUChar() errors */ -// _toUnicodeWithCallback(&args, err); - -// if(*err==U_BUFFER_OVERFLOW_ERROR) { -// *err=U_ZERO_ERROR; -// } - -// i=0; -// length=(int32_t)(args.target-buffer); -// } else { -// /* write the lead surrogate from the overflow buffer */ -// buffer[0]=(UChar)c; -// args.target=buffer+1; -// i=0; -// length=1; -// } - -// /* buffer contents starts at i and ends before length */ - -// if(U_FAILURE(*err)) { -// c=0xffff; /* no output */ -// } else if(length==0) { -// /* no input or only state changes */ -// *err=U_INDEX_OUTOFBOUNDS_ERROR; -// /* no need to reset explicitly because _toUnicodeWithCallback() did it */ -// c=0xffff; /* no output */ -// } else { -// c=buffer[0]; -// i=1; -// if(!U16_IS_LEAD(c)) { -// /* consume c=buffer[0], done */ -// } else { -// /* got a lead surrogate, see if a trail surrogate follows */ -// UChar c2; - -// if(cnv->UCharErrorBufferLength>0) { -// /* got overflow output from the conversion */ -// if(U16_IS_TRAIL(c2=cnv->UCharErrorBuffer[0])) { -// /* got a trail surrogate, too */ -// c=U16_GET_SUPPLEMENTARY(c, c2); - -// /* move the remaining overflow contents up to the beginning */ -// if((--cnv->UCharErrorBufferLength)>0) { -// uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+1, -// cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR); -// } -// } else { -// /* c is an unpaired lead surrogate, just return it */ -// } -// } else if(args.sourceUCharErrorBufferLength)>0) { -// uprv_memmove(cnv->UCharErrorBuffer+delta, cnv->UCharErrorBuffer, -// length*U_SIZEOF_UCHAR); -// } -// cnv->UCharErrorBufferLength=(int8_t)(length+delta); - -// cnv->UCharErrorBuffer[0]=buffer[i++]; -// if(delta>1) { -// cnv->UCharErrorBuffer[1]=buffer[i]; -// } -// } - -// *source=args.source; -// return c; -// } - -// /* ucnv_convert() and siblings ---------------------------------------------- */ - -// U_CAPI void U_EXPORT2 -// ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv, -// char **target, const char *targetLimit, -// const char **source, const char *sourceLimit, -// UChar *pivotStart, UChar **pivotSource, -// UChar **pivotTarget, const UChar *pivotLimit, -// UBool reset, UBool flush, -// UErrorCode *pErrorCode) { -// UChar pivotBuffer[CHUNK_SIZE]; -// const UChar *myPivotSource; -// UChar *myPivotTarget; -// const char *s; -// char *t; - -// UConverterToUnicodeArgs toUArgs; -// UConverterFromUnicodeArgs fromUArgs; -// UConverterConvert convert; - -// /* error checking */ -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return; -// } - -// if( targetCnv==NULL || sourceCnv==NULL || -// source==NULL || *source==NULL || -// target==NULL || *target==NULL || targetLimit==NULL -// ) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// s=*source; -// t=*target; -// if((sourceLimit!=NULL && sourceLimit(size_t)0x7fffffff && sourceLimit>s)) || -// ((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t) -// ) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// if(pivotStart==NULL) { -// if(!flush) { -// /* streaming conversion requires an explicit pivot buffer */ -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// /* use the stack pivot buffer */ -// myPivotSource=myPivotTarget=pivotStart=pivotBuffer; -// pivotSource=(UChar **)&myPivotSource; -// pivotTarget=&myPivotTarget; -// pivotLimit=pivotBuffer+CHUNK_SIZE; -// } else if( pivotStart>=pivotLimit || -// pivotSource==NULL || *pivotSource==NULL || -// pivotTarget==NULL || *pivotTarget==NULL || -// pivotLimit==NULL -// ) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } - -// if(sourceLimit==NULL) { -// /* get limit of single-byte-NUL-terminated source string */ -// sourceLimit=uprv_strchr(*source, 0); -// } - -// if(reset) { -// ucnv_resetToUnicode(sourceCnv); -// ucnv_resetFromUnicode(targetCnv); -// *pivotSource=*pivotTarget=pivotStart; -// } else if(targetCnv->charErrorBufferLength>0) { -// /* output the targetCnv overflow buffer */ -// if(ucnv_outputOverflowFromUnicode(targetCnv, target, targetLimit, NULL, pErrorCode)) { -// /* U_BUFFER_OVERFLOW_ERROR */ -// return; -// } -// /* *target has moved, therefore stop using t */ - -// if( !flush && -// targetCnv->preFromULength>=0 && *pivotSource==*pivotTarget && -// sourceCnv->UCharErrorBufferLength==0 && sourceCnv->preToULength>=0 && s==sourceLimit -// ) { -// /* the fromUnicode overflow buffer is emptied and there is no new input: we are done */ -// return; -// } -// } - -// /* Is direct-UTF-8 conversion available? */ -// if( sourceCnv->sharedData->staticData->conversionType==UCNV_UTF8 && -// targetCnv->sharedData->impl->fromUTF8!=NULL -// ) { -// convert=targetCnv->sharedData->impl->fromUTF8; -// } else if( targetCnv->sharedData->staticData->conversionType==UCNV_UTF8 && -// sourceCnv->sharedData->impl->toUTF8!=NULL -// ) { -// convert=sourceCnv->sharedData->impl->toUTF8; -// } else { -// convert=NULL; -// } - -// /* -// * If direct-UTF-8 conversion is available, then we use a smaller -// * pivot buffer for error handling and partial matches -// * so that we quickly return to direct conversion. -// * -// * 32 is large enough for UCNV_EXT_MAX_UCHARS and UCNV_ERROR_BUFFER_LENGTH. -// * -// * We could reduce the pivot buffer size further, at the cost of -// * buffer overflows from callbacks. -// * The pivot buffer should not be smaller than the maximum number of -// * fromUnicode extension table input UChars -// * (for m:n conversion, see -// * targetCnv->sharedData->mbcs.extIndexes[UCNV_EXT_COUNT_UCHARS]) -// * or 2 for surrogate pairs. -// * -// * Too small a buffer can cause thrashing between pivoting and direct -// * conversion, with function call overhead outweighing the benefits -// * of direct conversion. -// */ -// if(convert!=NULL && (pivotLimit-pivotStart)>32) { -// pivotLimit=pivotStart+32; -// } - -// /* prepare the converter arguments */ -// fromUArgs.converter=targetCnv; -// fromUArgs.flush=FALSE; -// fromUArgs.offsets=NULL; -// fromUArgs.target=*target; -// fromUArgs.targetLimit=targetLimit; -// fromUArgs.size=sizeof(fromUArgs); - -// toUArgs.converter=sourceCnv; -// toUArgs.flush=flush; -// toUArgs.offsets=NULL; -// toUArgs.source=s; -// toUArgs.sourceLimit=sourceLimit; -// toUArgs.targetLimit=pivotLimit; -// toUArgs.size=sizeof(toUArgs); - -// /* -// * TODO: Consider separating this function into two functions, -// * extracting exactly the conversion loop, -// * for readability and to reduce the set of visible variables. -// * -// * Otherwise stop using s and t from here on. -// */ -// s=t=NULL; - -// /* -// * conversion loop -// * -// * The sequence of steps in the loop may appear backward, -// * but the principle is simple: -// * In the chain of -// * source - sourceCnv overflow - pivot - targetCnv overflow - target -// * empty out later buffers before refilling them from earlier ones. -// * -// * The targetCnv overflow buffer is flushed out only once before the loop. -// */ -// for(;;) { -// /* -// * if(pivot not empty or error or replay or flush fromUnicode) { -// * fromUnicode(pivot -> target); -// * } -// * -// * For pivoting conversion; and for direct conversion for -// * error callback handling and flushing the replay buffer. -// */ -// if( *pivotSource<*pivotTarget || -// U_FAILURE(*pErrorCode) || -// targetCnv->preFromULength<0 || -// fromUArgs.flush -// ) { -// fromUArgs.source=*pivotSource; -// fromUArgs.sourceLimit=*pivotTarget; -// _fromUnicodeWithCallback(&fromUArgs, pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// /* target overflow, or conversion error */ -// *pivotSource=(UChar *)fromUArgs.source; -// break; -// } - -// /* -// * _fromUnicodeWithCallback() must have consumed the pivot contents -// * (*pivotSource==*pivotTarget) since it returned with U_SUCCESS() -// */ -// } - -// /* The pivot buffer is empty; reset it so we start at pivotStart. */ -// *pivotSource=*pivotTarget=pivotStart; - -// /* -// * if(sourceCnv overflow buffer not empty) { -// * move(sourceCnv overflow buffer -> pivot); -// * continue; -// * } -// */ -// /* output the sourceCnv overflow buffer */ -// if(sourceCnv->UCharErrorBufferLength>0) { -// if(ucnv_outputOverflowToUnicode(sourceCnv, pivotTarget, pivotLimit, NULL, pErrorCode)) { -// /* U_BUFFER_OVERFLOW_ERROR */ -// *pErrorCode=U_ZERO_ERROR; -// } -// continue; -// } - -// /* -// * check for end of input and break if done -// * -// * Checking both flush and fromUArgs.flush ensures that the converters -// * have been called with the flush flag set if the ucnv_convertEx() -// * caller set it. -// */ -// if( toUArgs.source==sourceLimit && -// sourceCnv->preToULength>=0 && sourceCnv->toULength==0 && -// (!flush || fromUArgs.flush) -// ) { -// /* done successfully */ -// break; -// } - -// /* -// * use direct conversion if available -// * but not if continuing a partial match -// * or flushing the toUnicode replay buffer -// */ -// if(convert!=NULL && targetCnv->preFromUFirstCP<0 && sourceCnv->preToULength==0) { -// if(*pErrorCode==U_USING_DEFAULT_WARNING) { -// /* remove a warning that may be set by this function */ -// *pErrorCode=U_ZERO_ERROR; -// } -// convert(&fromUArgs, &toUArgs, pErrorCode); -// if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) { -// break; -// } else if(U_FAILURE(*pErrorCode)) { -// if(sourceCnv->toULength>0) { -// /* -// * Fall through to calling _toUnicodeWithCallback() -// * for callback handling. -// * -// * The pivot buffer will be reset with -// * *pivotSource=*pivotTarget=pivotStart; -// * which indicates a toUnicode error to the caller -// * (*pivotSource==pivotStart shows no pivot UChars consumed). -// */ -// } else { -// /* -// * Indicate a fromUnicode error to the caller -// * (*pivotSource>pivotStart shows some pivot UChars consumed). -// */ -// *pivotSource=*pivotTarget=pivotStart+1; -// /* -// * Loop around to calling _fromUnicodeWithCallbacks() -// * for callback handling. -// */ -// continue; -// } -// } else if(*pErrorCode==U_USING_DEFAULT_WARNING) { -// /* -// * No error, but the implementation requested to temporarily -// * fall back to pivoting. -// */ -// *pErrorCode=U_ZERO_ERROR; -// /* -// * The following else branches are almost identical to the end-of-input -// * handling in _toUnicodeWithCallback(). -// * Avoid calling it just for the end of input. -// */ -// } else if(flush && sourceCnv->toULength>0) { /* flush==toUArgs.flush */ -// /* -// * the entire input stream is consumed -// * and there is a partial, truncated input sequence left -// */ - -// /* inject an error and continue with callback handling */ -// *pErrorCode=U_TRUNCATED_CHAR_FOUND; -// } else { -// /* input consumed */ -// if(flush) { -// /* reset the converters without calling the callback functions */ -// _reset(sourceCnv, UCNV_RESET_TO_UNICODE, FALSE); -// _reset(targetCnv, UCNV_RESET_FROM_UNICODE, FALSE); -// } - -// /* done successfully */ -// break; -// } -// } - -// /* -// * toUnicode(source -> pivot); -// * -// * For pivoting conversion; and for direct conversion for -// * error callback handling, continuing partial matches -// * and flushing the replay buffer. -// * -// * The pivot buffer is empty and reset. -// */ -// toUArgs.target=pivotStart; /* ==*pivotTarget */ -// /* toUArgs.targetLimit=pivotLimit; already set before the loop */ -// _toUnicodeWithCallback(&toUArgs, pErrorCode); -// *pivotTarget=toUArgs.target; -// if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) { -// /* pivot overflow: continue with the conversion loop */ -// *pErrorCode=U_ZERO_ERROR; -// } else if(U_FAILURE(*pErrorCode) || (!flush && *pivotTarget==pivotStart)) { -// /* conversion error, or there was nothing left to convert */ -// break; -// } -// /* -// * else: -// * _toUnicodeWithCallback() wrote into the pivot buffer, -// * continue with fromUnicode conversion. -// * -// * Set the fromUnicode flush flag if we flush and if toUnicode has -// * processed the end of the input. -// */ -// if( flush && toUArgs.source==sourceLimit && -// sourceCnv->preToULength>=0 && -// sourceCnv->UCharErrorBufferLength==0 -// ) { -// fromUArgs.flush=TRUE; -// } -// } - -// /* -// * The conversion loop is exited when one of the following is true: -// * - the entire source text has been converted successfully to the target buffer -// * - a target buffer overflow occurred -// * - a conversion error occurred -// */ - -// *source=toUArgs.source; -// *target=fromUArgs.target; - -// /* terminate the target buffer if possible */ -// if(flush && U_SUCCESS(*pErrorCode)) { -// if(*target!=targetLimit) { -// **target=0; -// if(*pErrorCode==U_STRING_NOT_TERMINATED_WARNING) { -// *pErrorCode=U_ZERO_ERROR; -// } -// } else { -// *pErrorCode=U_STRING_NOT_TERMINATED_WARNING; -// } -// } -// } - -// /* internal implementation of ucnv_convert() etc. with preflighting */ -// static int32_t -// ucnv_internalConvert(UConverter *outConverter, UConverter *inConverter, -// char *target, int32_t targetCapacity, -// const char *source, int32_t sourceLength, -// UErrorCode *pErrorCode) { -// UChar pivotBuffer[CHUNK_SIZE]; -// UChar *pivot, *pivot2; - -// char *myTarget; -// const char *sourceLimit; -// const char *targetLimit; -// int32_t targetLength=0; - -// /* set up */ -// if(sourceLength<0) { -// sourceLimit=uprv_strchr(source, 0); -// } else { -// sourceLimit=source+sourceLength; -// } - -// /* if there is no input data, we're done */ -// if(source==sourceLimit) { -// return u_terminateChars(target, targetCapacity, 0, pErrorCode); -// } - -// pivot=pivot2=pivotBuffer; -// myTarget=target; -// targetLength=0; - -// if(targetCapacity>0) { -// /* perform real conversion */ -// targetLimit=target+targetCapacity; -// ucnv_convertEx(outConverter, inConverter, -// &myTarget, targetLimit, -// &source, sourceLimit, -// pivotBuffer, &pivot, &pivot2, pivotBuffer+CHUNK_SIZE, -// FALSE, -// TRUE, -// pErrorCode); -// targetLength=(int32_t)(myTarget-target); -// } - -// /* -// * If the output buffer is exhausted (or we are only "preflighting"), we need to stop writing -// * to it but continue the conversion in order to store in targetCapacity -// * the number of bytes that was required. -// */ -// if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR || targetCapacity==0) -// { -// char targetBuffer[CHUNK_SIZE]; - -// targetLimit=targetBuffer+CHUNK_SIZE; -// do { -// *pErrorCode=U_ZERO_ERROR; -// myTarget=targetBuffer; -// ucnv_convertEx(outConverter, inConverter, -// &myTarget, targetLimit, -// &source, sourceLimit, -// pivotBuffer, &pivot, &pivot2, pivotBuffer+CHUNK_SIZE, -// FALSE, -// TRUE, -// pErrorCode); -// targetLength+=(int32_t)(myTarget-targetBuffer); -// } while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR); - -// /* done with preflighting, set warnings and errors as appropriate */ -// return u_terminateChars(target, targetCapacity, targetLength, pErrorCode); -// } - -// /* no need to call u_terminateChars() because ucnv_convertEx() took care of that */ -// return targetLength; -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_convert(const char *toConverterName, const char *fromConverterName, -// char *target, int32_t targetCapacity, -// const char *source, int32_t sourceLength, -// UErrorCode *pErrorCode) { -// UConverter in, out; /* stack-allocated */ -// UConverter *inConverter, *outConverter; -// int32_t targetLength; - -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// if( source==NULL || sourceLength<-1 || -// targetCapacity<0 || (targetCapacity>0 && target==NULL) -// ) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// /* if there is no input data, we're done */ -// if(sourceLength==0 || (sourceLength<0 && *source==0)) { -// return u_terminateChars(target, targetCapacity, 0, pErrorCode); -// } - -// /* create the converters */ -// inConverter=ucnv_createConverter(&in, fromConverterName, pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// outConverter=ucnv_createConverter(&out, toConverterName, pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// ucnv_close(inConverter); -// return 0; -// } - -// targetLength=ucnv_internalConvert(outConverter, inConverter, -// target, targetCapacity, -// source, sourceLength, -// pErrorCode); - -// ucnv_close(inConverter); -// ucnv_close(outConverter); - -// return targetLength; -// } - -// /* @internal */ -// static int32_t -// ucnv_convertAlgorithmic(UBool convertToAlgorithmic, -// UConverterType algorithmicType, -// UConverter *cnv, -// char *target, int32_t targetCapacity, -// const char *source, int32_t sourceLength, -// UErrorCode *pErrorCode) { -// UConverter algoConverterStatic; /* stack-allocated */ -// UConverter *algoConverter, *to, *from; -// int32_t targetLength; - -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// if( cnv==NULL || source==NULL || sourceLength<-1 || -// targetCapacity<0 || (targetCapacity>0 && target==NULL) -// ) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// /* if there is no input data, we're done */ -// if(sourceLength==0 || (sourceLength<0 && *source==0)) { -// return u_terminateChars(target, targetCapacity, 0, pErrorCode); -// } - -// /* create the algorithmic converter */ -// algoConverter=ucnv_createAlgorithmicConverter(&algoConverterStatic, algorithmicType, -// "", 0, pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// /* reset the other converter */ -// if(convertToAlgorithmic) { -// /* cnv->Unicode->algo */ -// ucnv_resetToUnicode(cnv); -// to=algoConverter; -// from=cnv; -// } else { -// /* algo->Unicode->cnv */ -// ucnv_resetFromUnicode(cnv); -// from=algoConverter; -// to=cnv; -// } - -// targetLength=ucnv_internalConvert(to, from, -// target, targetCapacity, -// source, sourceLength, -// pErrorCode); - -// ucnv_close(algoConverter); - -// return targetLength; -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_toAlgorithmic(UConverterType algorithmicType, -// UConverter *cnv, -// char *target, int32_t targetCapacity, -// const char *source, int32_t sourceLength, -// UErrorCode *pErrorCode) { -// return ucnv_convertAlgorithmic(TRUE, algorithmicType, cnv, -// target, targetCapacity, -// source, sourceLength, -// pErrorCode); -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_fromAlgorithmic(UConverter *cnv, -// UConverterType algorithmicType, -// char *target, int32_t targetCapacity, -// const char *source, int32_t sourceLength, -// UErrorCode *pErrorCode) { -// return ucnv_convertAlgorithmic(FALSE, algorithmicType, cnv, -// target, targetCapacity, -// source, sourceLength, -// pErrorCode); -// } - -// U_CAPI UConverterType U_EXPORT2 -// ucnv_getType(const UConverter* converter) -// { -// int8_t type = converter->sharedData->staticData->conversionType; -// #if !UCONFIG_NO_LEGACY_CONVERSION -// if(type == UCNV_MBCS) { -// return ucnv_MBCSGetType(converter); -// } -// #endif -// return (UConverterType)type; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_getStarters(const UConverter* converter, -// UBool starters[256], -// UErrorCode* err) -// { -// if (err == NULL || U_FAILURE(*err)) { -// return; -// } - -// if(converter->sharedData->impl->getStarters != NULL) { -// converter->sharedData->impl->getStarters(converter, starters, err); -// } else { -// *err = U_ILLEGAL_ARGUMENT_ERROR; -// } -// } - -// static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv) -// { -// UErrorCode errorCode; -// const char *name; -// int32_t i; - -// if(cnv==NULL) { -// return NULL; -// } - -// errorCode=U_ZERO_ERROR; -// name=ucnv_getName(cnv, &errorCode); -// if(U_FAILURE(errorCode)) { -// return NULL; -// } - -// for(i=0; ivariant5c; -// for(i=0; iuseFallback = usesFallback; -// } - -// U_CAPI UBool U_EXPORT2 -// ucnv_usesFallback(const UConverter *cnv) -// { -// return cnv->useFallback; -// } - -// U_CAPI void U_EXPORT2 -// ucnv_getInvalidChars (const UConverter * converter, -// char *errBytes, -// int8_t * len, -// UErrorCode * err) -// { -// if (err == NULL || U_FAILURE(*err)) -// { -// return; -// } -// if (len == NULL || errBytes == NULL || converter == NULL) -// { -// *err = U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } -// if (*len < converter->invalidCharLength) -// { -// *err = U_INDEX_OUTOFBOUNDS_ERROR; -// return; -// } -// if ((*len = converter->invalidCharLength) > 0) -// { -// uprv_memcpy (errBytes, converter->invalidCharBuffer, *len); -// } -// } - -// U_CAPI void U_EXPORT2 -// ucnv_getInvalidUChars (const UConverter * converter, -// UChar *errChars, -// int8_t * len, -// UErrorCode * err) -// { -// if (err == NULL || U_FAILURE(*err)) -// { -// return; -// } -// if (len == NULL || errChars == NULL || converter == NULL) -// { -// *err = U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } -// if (*len < converter->invalidUCharLength) -// { -// *err = U_INDEX_OUTOFBOUNDS_ERROR; -// return; -// } -// if ((*len = converter->invalidUCharLength) > 0) -// { -// u_memcpy (errChars, converter->invalidUCharBuffer, *len); -// } -// } - -// #define SIG_MAX_LEN 5 - -// U_CAPI const char* U_EXPORT2 -// ucnv_detectUnicodeSignature( const char* source, -// int32_t sourceLength, -// int32_t* signatureLength, -// UErrorCode* pErrorCode) { -// int32_t dummy; - -// /* initial 0xa5 bytes: make sure that if we read preFromUFirstCP >= 0){ -// return U16_LENGTH(cnv->preFromUFirstCP)+cnv->preFromULength ; -// }else if(cnv->preFromULength < 0){ -// return -cnv->preFromULength ; -// }else if(cnv->fromUChar32 > 0){ -// return 1; -// } -// return 0; - -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status){ - -// if(status == NULL || U_FAILURE(*status)){ -// return -1; -// } -// if(cnv == NULL){ -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return -1; -// } - -// if(cnv->preToULength > 0){ -// return cnv->preToULength ; -// }else if(cnv->preToULength < 0){ -// return -cnv->preToULength; -// }else if(cnv->toULength > 0){ -// return cnv->toULength; -// } -// return 0; -// } - -// U_CAPI UBool U_EXPORT2 -// ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status){ -// if (U_FAILURE(*status)) { -// return FALSE; -// } - -// if (cnv == NULL) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return FALSE; -// } - -// switch (ucnv_getType(cnv)) { -// case UCNV_SBCS: -// case UCNV_DBCS: -// case UCNV_UTF32_BigEndian: -// case UCNV_UTF32_LittleEndian: -// case UCNV_UTF32: -// case UCNV_US_ASCII: -// return TRUE; -// default: -// return FALSE; -// } -// } -// #endif - -// /* -// * Hey, Emacs, please set the following: -// * -// * Local Variables: -// * indent-tabs-mode: nil -// * End: -// * -// */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv2022.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv2022.cpp deleted file mode 100644 index 3b0d2f8d7..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv2022.cpp +++ /dev/null @@ -1,3973 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2000-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * file name: ucnv2022.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2000feb03 -// * created by: Markus W. Scherer -// * -// * Change history: -// * -// * 06/29/2000 helena Major rewrite of the callback APIs. -// * 08/08/2000 Ram Included support for ISO-2022-JP-2 -// * Changed implementation of toUnicode -// * function -// * 08/21/2000 Ram Added support for ISO-2022-KR -// * 08/29/2000 Ram Seperated implementation of EBCDIC to -// * ucnvebdc.c -// * 09/20/2000 Ram Added support for ISO-2022-CN -// * Added implementations for getNextUChar() -// * for specific 2022 country variants. -// * 10/31/2000 Ram Implemented offsets logic functions -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/uset.h" -// #include "unicode/ucnv_err.h" -// #include "unicode/ucnv_cb.h" -// #include "unicode/utf16.h" -// #include "ucnv_imp.h" -// #include "ucnv_bld.h" -// #include "ucnv_cnv.h" -// #include "ucnvmbcs.h" -// #include "cstring.h" -// #include "cmemory.h" -// #include "uassert.h" - -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// /* -// * I am disabling the generic ISO-2022 converter after proposing to do so on -// * the icu mailing list two days ago. -// * -// * Reasons: -// * 1. It does not fully support the ISO-2022/ECMA-35 specification with all of -// * its designation sequences, single shifts with return to the previous state, -// * switch-with-no-return to UTF-16BE or similar, etc. -// * This is unlike the language-specific variants like ISO-2022-JP which -// * require a much smaller repertoire of ISO-2022 features. -// * These variants continue to be supported. -// * 2. I believe that no one is really using the generic ISO-2022 converter -// * but rather always one of the language-specific variants. -// * Note that ICU's generic ISO-2022 converter has always output one escape -// * sequence followed by UTF-8 for the whole stream. -// * 3. Switching between subcharsets is extremely slow, because each time -// * the previous converter is closed and a new one opened, -// * without any kind of caching, least-recently-used list, etc. -// * 4. The code is currently buggy, and given the above it does not seem -// * reasonable to spend the time on maintenance. -// * 5. ISO-2022 subcharsets should normally be used with 7-bit byte encodings. -// * This means, for example, that when ISO-8859-7 is designated, the following -// * ISO-2022 bytes 00..7f should be interpreted as ISO-8859-7 bytes 80..ff. -// * The ICU ISO-2022 converter does not handle this - and has no information -// * about which subconverter would have to be shifted vs. which is designed -// * for 7-bit ISO-2022. -// * -// * Markus Scherer 2003-dec-03 -// */ -// #endif - -// #if !UCONFIG_ONLY_HTML_CONVERSION -// static const char SHIFT_IN_STR[] = "\x0F"; -// // static const char SHIFT_OUT_STR[] = "\x0E"; -// #endif - -// #define CR 0x0D -// #define LF 0x0A -// #define H_TAB 0x09 -// #define V_TAB 0x0B -// #define SPACE 0x20 - -// enum { -// HWKANA_START=0xff61, -// HWKANA_END=0xff9f -// }; - -// /* -// * 94-character sets with native byte values A1..FE are encoded in ISO 2022 -// * as bytes 21..7E. (Subtract 0x80.) -// * 96-character sets with native byte values A0..FF are encoded in ISO 2022 -// * as bytes 20..7F. (Subtract 0x80.) -// * Do not encode C1 control codes with native bytes 80..9F -// * as bytes 00..1F (C0 control codes). -// */ -// enum { -// GR94_START=0xa1, -// GR94_END=0xfe, -// GR96_START=0xa0, -// GR96_END=0xff -// }; - -// /* -// * ISO 2022 control codes must not be converted from Unicode -// * because they would mess up the byte stream. -// * The bit mask 0x0800c000 has bits set at bit positions 0xe, 0xf, 0x1b -// * corresponding to SO, SI, and ESC. -// */ -// #define IS_2022_CONTROL(c) (((c)<0x20) && (((uint32_t)1<<(c))&0x0800c000)!=0) - -// /* for ISO-2022-JP and -CN implementations */ -// typedef enum { -// /* shared values */ -// INVALID_STATE=-1, -// ASCII = 0, - -// SS2_STATE=0x10, -// SS3_STATE, - -// /* JP */ -// ISO8859_1 = 1 , -// ISO8859_7 = 2 , -// JISX201 = 3, -// JISX208 = 4, -// JISX212 = 5, -// GB2312 =6, -// KSC5601 =7, -// HWKANA_7BIT=8, /* Halfwidth Katakana 7 bit */ - -// /* CN */ -// /* the first few enum constants must keep their values because they correspond to myConverterArray[] */ -// GB2312_1=1, -// ISO_IR_165=2, -// CNS_11643=3, - -// /* -// * these are used in StateEnum and ISO2022State variables, -// * but CNS_11643 must be used to index into myConverterArray[] -// */ -// CNS_11643_0=0x20, -// CNS_11643_1, -// CNS_11643_2, -// CNS_11643_3, -// CNS_11643_4, -// CNS_11643_5, -// CNS_11643_6, -// CNS_11643_7 -// } StateEnum; - -// /* is the StateEnum charset value for a DBCS charset? */ -// #if UCONFIG_ONLY_HTML_CONVERSION -// #define IS_JP_DBCS(cs) (JISX208==(cs)) -// #else -// #define IS_JP_DBCS(cs) (JISX208<=(cs) && (cs)<=KSC5601) -// #endif - -// #define CSM(cs) ((uint16_t)1<<(cs)) - -// /* -// * Each of these charset masks (with index x) contains a bit for a charset in exact correspondence -// * to whether that charset is used in the corresponding version x of ISO_2022,locale=ja,version=x -// * -// * Note: The converter uses some leniency: -// * - The escape sequence ESC ( I for half-width 7-bit Katakana is recognized in -// * all versions, not just JIS7 and JIS8. -// * - ICU does not distinguish between different versions of JIS X 0208. -// */ -// #if UCONFIG_ONLY_HTML_CONVERSION -// enum { MAX_JA_VERSION=0 }; -// #else -// enum { MAX_JA_VERSION=4 }; -// #endif -// static const uint16_t jpCharsetMasks[MAX_JA_VERSION+1]={ -// CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT), -// #if !UCONFIG_ONLY_HTML_CONVERSION -// CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212), -// CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212)|CSM(GB2312)|CSM(KSC5601)|CSM(ISO8859_1)|CSM(ISO8859_7), -// CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212)|CSM(GB2312)|CSM(KSC5601)|CSM(ISO8859_1)|CSM(ISO8859_7), -// CSM(ASCII)|CSM(JISX201)|CSM(JISX208)|CSM(HWKANA_7BIT)|CSM(JISX212)|CSM(GB2312)|CSM(KSC5601)|CSM(ISO8859_1)|CSM(ISO8859_7) -// #endif -// }; - -// typedef enum { -// ASCII1=0, -// LATIN1, -// SBCS, -// DBCS, -// MBCS, -// HWKANA -// }Cnv2022Type; - -// typedef struct ISO2022State { -// int8_t cs[4]; /* charset number for SI (G0)/SO (G1)/SS2 (G2)/SS3 (G3) */ -// int8_t g; /* 0..3 for G0..G3 (SI/SO/SS2/SS3) */ -// int8_t prevG; /* g before single shift (SS2 or SS3) */ -// } ISO2022State; - -// #define UCNV_OPTIONS_VERSION_MASK 0xf -// #define UCNV_2022_MAX_CONVERTERS 10 - -// typedef struct{ -// UConverterSharedData *myConverterArray[UCNV_2022_MAX_CONVERTERS]; -// UConverter *currentConverter; -// Cnv2022Type currentType; -// ISO2022State toU2022State, fromU2022State; -// uint32_t key; -// uint32_t version; -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// UBool isFirstBuffer; -// #endif -// UBool isEmptySegment; -// char name[30]; -// char locale[3]; -// }UConverterDataISO2022; - -// /* Protos */ -// /* ISO-2022 ----------------------------------------------------------------- */ - -// /*Forward declaration */ -// U_CFUNC void U_CALLCONV -// ucnv_fromUnicode_UTF8(UConverterFromUnicodeArgs * args, -// UErrorCode * err); -// U_CFUNC void U_CALLCONV -// ucnv_fromUnicode_UTF8_OFFSETS_LOGIC(UConverterFromUnicodeArgs * args, -// UErrorCode * err); - -// #define ESC_2022 0x1B /*ESC*/ - -// typedef enum -// { -// INVALID_2022 = -1, /*Doesn't correspond to a valid iso 2022 escape sequence*/ -// VALID_NON_TERMINAL_2022 = 0, /*so far corresponds to a valid iso 2022 escape sequence*/ -// VALID_TERMINAL_2022 = 1, /*corresponds to a valid iso 2022 escape sequence*/ -// VALID_MAYBE_TERMINAL_2022 = 2 /*so far matches one iso 2022 escape sequence, but by adding more characters might match another escape sequence*/ -// } UCNV_TableStates_2022; - -// /* -// * The way these state transition arrays work is: -// * ex : ESC$B is the sequence for JISX208 -// * a) First Iteration: char is ESC -// * i) Get the value of ESC from normalize_esq_chars_2022[] with int value of ESC as index -// * int x = normalize_esq_chars_2022[27] which is equal to 1 -// * ii) Search for this value in escSeqStateTable_Key_2022[] -// * value of x is stored at escSeqStateTable_Key_2022[0] -// * iii) Save this index as offset -// * iv) Get state of this sequence from escSeqStateTable_Value_2022[] -// * escSeqStateTable_Value_2022[offset], which is VALID_NON_TERMINAL_2022 -// * b) Switch on this state and continue to next char -// * i) Get the value of $ from normalize_esq_chars_2022[] with int value of $ as index -// * which is normalize_esq_chars_2022[36] == 4 -// * ii) x is currently 1(from above) -// * x<<=5 -- x is now 32 -// * x+=normalize_esq_chars_2022[36] -// * now x is 36 -// * iii) Search for this value in escSeqStateTable_Key_2022[] -// * value of x is stored at escSeqStateTable_Key_2022[2], so offset is 2 -// * iv) Get state of this sequence from escSeqStateTable_Value_2022[] -// * escSeqStateTable_Value_2022[offset], which is VALID_NON_TERMINAL_2022 -// * c) Switch on this state and continue to next char -// * i) Get the value of B from normalize_esq_chars_2022[] with int value of B as index -// * ii) x is currently 36 (from above) -// * x<<=5 -- x is now 1152 -// * x+=normalize_esq_chars_2022[66] -// * now x is 1161 -// * iii) Search for this value in escSeqStateTable_Key_2022[] -// * value of x is stored at escSeqStateTable_Key_2022[21], so offset is 21 -// * iv) Get state of this sequence from escSeqStateTable_Value_2022[21] -// * escSeqStateTable_Value_2022[offset], which is VALID_TERMINAL_2022 -// * v) Get the converter name form escSeqStateTable_Result_2022[21] which is JISX208 -// */ - - -// /*Below are the 3 arrays depicting a state transition table*/ -// static const int8_t normalize_esq_chars_2022[256] = { -// /* 0 1 2 3 4 5 6 7 8 9 */ - -// 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,4 ,7 ,29 ,0 -// ,2 ,24 ,26 ,27 ,0 ,3 ,23 ,6 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,5 ,8 ,9 ,10 ,11 ,12 -// ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,25 ,28 -// ,0 ,0 ,21 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,22 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 -// ,0 ,0 ,0 ,0 ,0 ,0 -// }; - -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// /* -// * When the generic ISO-2022 converter is completely removed, not just disabled -// * per #ifdef, then the following state table and the associated tables that are -// * dimensioned with MAX_STATES_2022 should be trimmed. -// * -// * Especially, VALID_MAYBE_TERMINAL_2022 will not be used any more, and all of -// * the associated escape sequences starting with ESC ( B should be removed. -// * This includes the ones with key values 1097 and all of the ones above 1000000. -// * -// * For the latter, the tables can simply be truncated. -// * For the former, since the tables must be kept parallel, it is probably best -// * to simply duplicate an adjacent table cell, parallel in all tables. -// * -// * It may make sense to restructure the tables, especially by using small search -// * tables for the variants instead of indexing them parallel to the table here. -// */ -// #endif - -// #define MAX_STATES_2022 74 -// static const int32_t escSeqStateTable_Key_2022[MAX_STATES_2022] = { -// /* 0 1 2 3 4 5 6 7 8 9 */ - -// 1 ,34 ,36 ,39 ,55 ,57 ,60 ,61 ,1093 ,1096 -// ,1097 ,1098 ,1099 ,1100 ,1101 ,1102 ,1103 ,1104 ,1105 ,1106 -// ,1109 ,1154 ,1157 ,1160 ,1161 ,1176 ,1178 ,1179 ,1254 ,1257 -// ,1768 ,1773 ,1957 ,35105 ,36933 ,36936 ,36937 ,36938 ,36939 ,36940 -// ,36942 ,36943 ,36944 ,36945 ,36946 ,36947 ,36948 ,37640 ,37642 ,37644 -// ,37646 ,37711 ,37744 ,37745 ,37746 ,37747 ,37748 ,40133 ,40136 ,40138 -// ,40139 ,40140 ,40141 ,1123363 ,35947624 ,35947625 ,35947626 ,35947627 ,35947629 ,35947630 -// ,35947631 ,35947635 ,35947636 ,35947638 -// }; - -// #ifdef U_ENABLE_GENERIC_ISO_2022 - -// static const char* const escSeqStateTable_Result_2022[MAX_STATES_2022] = { -// /* 0 1 2 3 4 5 6 7 8 9 */ - -// NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"latin1" ,"latin1" -// ,"latin1" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"JISX0201" ,"JISX0201" ,"latin1" -// ,"latin1" ,NULL ,"JISX-208" ,"ibm-5478" ,"JISX-208" ,NULL ,NULL ,NULL ,NULL ,"UTF8" -// ,"ISO-8859-1" ,"ISO-8859-7" ,"JIS-X-208" ,NULL ,"ibm-955" ,"ibm-367" ,"ibm-952" ,"ibm-949" ,"JISX-212" ,"ibm-1383" -// ,"ibm-952" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-5478" ,"ibm-949" ,"ISO-IR-165" -// ,"CNS-11643-1992,1" ,"CNS-11643-1992,2" ,"CNS-11643-1992,3" ,"CNS-11643-1992,4" ,"CNS-11643-1992,5" ,"CNS-11643-1992,6" ,"CNS-11643-1992,7" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" -// ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,NULL ,"latin1" ,"ibm-912" ,"ibm-913" ,"ibm-914" ,"ibm-813" ,"ibm-1089" -// ,"ibm-920" ,"ibm-915" ,"ibm-915" ,"latin1" -// }; - -// #endif - -// static const int8_t escSeqStateTable_Value_2022[MAX_STATES_2022] = { -// /* 0 1 2 3 4 5 6 7 8 9 */ -// VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 -// ,VALID_MAYBE_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 -// ,VALID_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 -// ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 -// ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 -// ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 -// ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 -// ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 -// }; - -// /* Type def for refactoring changeState_2022 code*/ -// typedef enum{ -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// ISO_2022=0, -// #endif -// ISO_2022_JP=1, -// #if !UCONFIG_ONLY_HTML_CONVERSION -// ISO_2022_KR=2, -// ISO_2022_CN=3 -// #endif -// } Variant2022; - -// /*********** ISO 2022 Converter Protos ***********/ -// static void U_CALLCONV -// _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode); - -// static void U_CALLCONV -// _ISO2022Close(UConverter *converter); - -// static void U_CALLCONV -// _ISO2022Reset(UConverter *converter, UConverterResetChoice choice); - -// U_CDECL_BEGIN -// static const char * U_CALLCONV -// _ISO2022getName(const UConverter* cnv); -// U_CDECL_END - -// static void U_CALLCONV -// _ISO_2022_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode *err); - -// U_CDECL_BEGIN -// static UConverter * U_CALLCONV -// _ISO_2022_SafeClone(const UConverter *cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status); - -// U_CDECL_END - -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// static void U_CALLCONV -// T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args, UErrorCode* err); -// #endif - -// namespace { - -// /*const UConverterSharedData _ISO2022Data;*/ -// extern const UConverterSharedData _ISO2022JPData; - -// #if !UCONFIG_ONLY_HTML_CONVERSION -// extern const UConverterSharedData _ISO2022KRData; -// extern const UConverterSharedData _ISO2022CNData; -// #endif - -// } // namespace - -// /*************** Converter implementations ******************/ - -// /* The purpose of this function is to get around gcc compiler warnings. */ -// static inline void -// fromUWriteUInt8(UConverter *cnv, -// const char *bytes, int32_t length, -// uint8_t **target, const char *targetLimit, -// int32_t **offsets, -// int32_t sourceIndex, -// UErrorCode *pErrorCode) -// { -// char *targetChars = (char *)*target; -// ucnv_fromUWriteBytes(cnv, bytes, length, &targetChars, targetLimit, -// offsets, sourceIndex, pErrorCode); -// *target = (uint8_t*)targetChars; - -// } - -// static inline void -// setInitialStateToUnicodeKR(UConverter* /*converter*/, UConverterDataISO2022 *myConverterData){ -// if(myConverterData->version == 1) { -// UConverter *cnv = myConverterData->currentConverter; - -// cnv->toUnicodeStatus=0; /* offset */ -// cnv->mode=0; /* state */ -// cnv->toULength=0; /* byteIndex */ -// } -// } - -// static inline void -// setInitialStateFromUnicodeKR(UConverter* converter,UConverterDataISO2022 *myConverterData){ -// /* in ISO-2022-KR the designator sequence appears only once -// * in a file so we append it only once -// */ -// if( converter->charErrorBufferLength==0){ - -// converter->charErrorBufferLength = 4; -// converter->charErrorBuffer[0] = 0x1b; -// converter->charErrorBuffer[1] = 0x24; -// converter->charErrorBuffer[2] = 0x29; -// converter->charErrorBuffer[3] = 0x43; -// } -// if(myConverterData->version == 1) { -// UConverter *cnv = myConverterData->currentConverter; - -// cnv->fromUChar32=0; -// cnv->fromUnicodeStatus=1; /* prevLength */ -// } -// } - -// static void U_CALLCONV -// _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){ - -// char myLocale[6]={' ',' ',' ',' ',' ',' '}; - -// cnv->extraInfo = uprv_malloc (sizeof (UConverterDataISO2022)); -// if(cnv->extraInfo != NULL) { -// UConverterNamePieces stackPieces; -// UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER; -// UConverterDataISO2022 *myConverterData=(UConverterDataISO2022 *) cnv->extraInfo; -// uint32_t version; - -// stackArgs.onlyTestIsLoadable = pArgs->onlyTestIsLoadable; - -// uprv_memset(myConverterData, 0, sizeof(UConverterDataISO2022)); -// myConverterData->currentType = ASCII1; -// cnv->fromUnicodeStatus =FALSE; -// if(pArgs->locale){ -// uprv_strncpy(myLocale, pArgs->locale, sizeof(myLocale)); -// } -// version = pArgs->options & UCNV_OPTIONS_VERSION_MASK; -// myConverterData->version = version; -// if(myLocale[0]=='j' && (myLocale[1]=='a'|| myLocale[1]=='p') && -// (myLocale[2]=='_' || myLocale[2]=='\0')) -// { -// /* open the required converters and cache them */ -// if(version>MAX_JA_VERSION) { -// // ICU 55 fails to open a converter for an unsupported version. -// // Previously, it fell back to version 0, but that would yield -// // unexpected behavior. -// *errorCode = U_MISSING_RESOURCE_ERROR; -// return; -// } -// if(jpCharsetMasks[version]&CSM(ISO8859_7)) { -// myConverterData->myConverterArray[ISO8859_7] = -// ucnv_loadSharedData("ISO8859_7", &stackPieces, &stackArgs, errorCode); -// } -// myConverterData->myConverterArray[JISX208] = -// ucnv_loadSharedData("Shift-JIS", &stackPieces, &stackArgs, errorCode); -// if(jpCharsetMasks[version]&CSM(JISX212)) { -// myConverterData->myConverterArray[JISX212] = -// ucnv_loadSharedData("jisx-212", &stackPieces, &stackArgs, errorCode); -// } -// if(jpCharsetMasks[version]&CSM(GB2312)) { -// myConverterData->myConverterArray[GB2312] = -// ucnv_loadSharedData("ibm-5478", &stackPieces, &stackArgs, errorCode); /* gb_2312_80-1 */ -// } -// if(jpCharsetMasks[version]&CSM(KSC5601)) { -// myConverterData->myConverterArray[KSC5601] = -// ucnv_loadSharedData("ksc_5601", &stackPieces, &stackArgs, errorCode); -// } - -// /* set the function pointers to appropriate funtions */ -// cnv->sharedData=(UConverterSharedData*)(&_ISO2022JPData); -// uprv_strcpy(myConverterData->locale,"ja"); - -// (void)uprv_strcpy(myConverterData->name,"ISO_2022,locale=ja,version="); -// size_t len = uprv_strlen(myConverterData->name); -// myConverterData->name[len]=(char)(myConverterData->version+(int)'0'); -// myConverterData->name[len+1]='\0'; -// } -// #if !UCONFIG_ONLY_HTML_CONVERSION -// else if(myLocale[0]=='k' && (myLocale[1]=='o'|| myLocale[1]=='r') && -// (myLocale[2]=='_' || myLocale[2]=='\0')) -// { -// if(version>1) { -// // ICU 55 fails to open a converter for an unsupported version. -// // Previously, it fell back to version 0, but that would yield -// // unexpected behavior. -// *errorCode = U_MISSING_RESOURCE_ERROR; -// return; -// } -// const char *cnvName; -// if(version==1) { -// cnvName="icu-internal-25546"; -// } else { -// cnvName="ibm-949"; -// myConverterData->version=version=0; -// } -// if(pArgs->onlyTestIsLoadable) { -// ucnv_canCreateConverter(cnvName, errorCode); /* errorCode carries result */ -// uprv_free(cnv->extraInfo); -// cnv->extraInfo=NULL; -// return; -// } else { -// myConverterData->currentConverter=ucnv_open(cnvName, errorCode); -// if (U_FAILURE(*errorCode)) { -// _ISO2022Close(cnv); -// return; -// } - -// if(version==1) { -// (void)uprv_strcpy(myConverterData->name,"ISO_2022,locale=ko,version=1"); -// uprv_memcpy(cnv->subChars, myConverterData->currentConverter->subChars, 4); -// cnv->subCharLen = myConverterData->currentConverter->subCharLen; -// }else{ -// (void)uprv_strcpy(myConverterData->name,"ISO_2022,locale=ko,version=0"); -// } - -// /* initialize the state variables */ -// setInitialStateToUnicodeKR(cnv, myConverterData); -// setInitialStateFromUnicodeKR(cnv, myConverterData); - -// /* set the function pointers to appropriate funtions */ -// cnv->sharedData=(UConverterSharedData*)&_ISO2022KRData; -// uprv_strcpy(myConverterData->locale,"ko"); -// } -// } -// else if(((myLocale[0]=='z' && myLocale[1]=='h') || (myLocale[0]=='c'&& myLocale[1]=='n'))&& -// (myLocale[2]=='_' || myLocale[2]=='\0')) -// { -// if(version>2) { -// // ICU 55 fails to open a converter for an unsupported version. -// // Previously, it fell back to version 0, but that would yield -// // unexpected behavior. -// *errorCode = U_MISSING_RESOURCE_ERROR; -// return; -// } - -// /* open the required converters and cache them */ -// myConverterData->myConverterArray[GB2312_1] = -// ucnv_loadSharedData("ibm-5478", &stackPieces, &stackArgs, errorCode); -// if(version==1) { -// myConverterData->myConverterArray[ISO_IR_165] = -// ucnv_loadSharedData("iso-ir-165", &stackPieces, &stackArgs, errorCode); -// } -// myConverterData->myConverterArray[CNS_11643] = -// ucnv_loadSharedData("cns-11643-1992", &stackPieces, &stackArgs, errorCode); - - -// /* set the function pointers to appropriate funtions */ -// cnv->sharedData=(UConverterSharedData*)&_ISO2022CNData; -// uprv_strcpy(myConverterData->locale,"cn"); - -// if (version==0){ -// myConverterData->version = 0; -// (void)uprv_strcpy(myConverterData->name,"ISO_2022,locale=zh,version=0"); -// }else if (version==1){ -// myConverterData->version = 1; -// (void)uprv_strcpy(myConverterData->name,"ISO_2022,locale=zh,version=1"); -// }else { -// myConverterData->version = 2; -// (void)uprv_strcpy(myConverterData->name,"ISO_2022,locale=zh,version=2"); -// } -// } -// #endif // !UCONFIG_ONLY_HTML_CONVERSION -// else{ -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// myConverterData->isFirstBuffer = TRUE; - -// /* append the UTF-8 escape sequence */ -// cnv->charErrorBufferLength = 3; -// cnv->charErrorBuffer[0] = 0x1b; -// cnv->charErrorBuffer[1] = 0x25; -// cnv->charErrorBuffer[2] = 0x42; - -// cnv->sharedData=(UConverterSharedData*)&_ISO2022Data; -// /* initialize the state variables */ -// uprv_strcpy(myConverterData->name,"ISO_2022"); -// #else -// *errorCode = U_MISSING_RESOURCE_ERROR; -// // Was U_UNSUPPORTED_ERROR but changed in ICU 55 to a more standard -// // data loading error code. -// return; -// #endif -// } - -// cnv->maxBytesPerUChar=cnv->sharedData->staticData->maxBytesPerChar; - -// if(U_FAILURE(*errorCode) || pArgs->onlyTestIsLoadable) { -// _ISO2022Close(cnv); -// } -// } else { -// *errorCode = U_MEMORY_ALLOCATION_ERROR; -// } -// } - - -// static void U_CALLCONV -// _ISO2022Close(UConverter *converter) { -// UConverterDataISO2022* myData =(UConverterDataISO2022 *) (converter->extraInfo); -// UConverterSharedData **array = myData->myConverterArray; -// int32_t i; - -// if (converter->extraInfo != NULL) { -// /*close the array of converter pointers and free the memory*/ -// for (i=0; icurrentConverter); - -// if(!converter->isExtraLocal){ -// uprv_free (converter->extraInfo); -// converter->extraInfo = NULL; -// } -// } -// } - -// static void U_CALLCONV -// _ISO2022Reset(UConverter *converter, UConverterResetChoice choice) { -// UConverterDataISO2022 *myConverterData=(UConverterDataISO2022 *) (converter->extraInfo); -// if(choice<=UCNV_RESET_TO_UNICODE) { -// uprv_memset(&myConverterData->toU2022State, 0, sizeof(ISO2022State)); -// myConverterData->key = 0; -// myConverterData->isEmptySegment = FALSE; -// } -// if(choice!=UCNV_RESET_TO_UNICODE) { -// uprv_memset(&myConverterData->fromU2022State, 0, sizeof(ISO2022State)); -// } -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// if(myConverterData->locale[0] == 0){ -// if(choice<=UCNV_RESET_TO_UNICODE) { -// myConverterData->isFirstBuffer = TRUE; -// myConverterData->key = 0; -// if (converter->mode == UCNV_SO){ -// ucnv_close (myConverterData->currentConverter); -// myConverterData->currentConverter=NULL; -// } -// converter->mode = UCNV_SI; -// } -// if(choice!=UCNV_RESET_TO_UNICODE) { -// /* re-append UTF-8 escape sequence */ -// converter->charErrorBufferLength = 3; -// converter->charErrorBuffer[0] = 0x1b; -// converter->charErrorBuffer[1] = 0x28; -// converter->charErrorBuffer[2] = 0x42; -// } -// } -// else -// #endif -// { -// /* reset the state variables */ -// if(myConverterData->locale[0] == 'k'){ -// if(choice<=UCNV_RESET_TO_UNICODE) { -// setInitialStateToUnicodeKR(converter, myConverterData); -// } -// if(choice!=UCNV_RESET_TO_UNICODE) { -// setInitialStateFromUnicodeKR(converter, myConverterData); -// } -// } -// } -// } - -// U_CDECL_BEGIN - -// static const char * U_CALLCONV -// _ISO2022getName(const UConverter* cnv){ -// if(cnv->extraInfo){ -// UConverterDataISO2022* myData= (UConverterDataISO2022*)cnv->extraInfo; -// return myData->name; -// } -// return NULL; -// } - -// U_CDECL_END - - -// /*************** to unicode *******************/ -// /**************************************************************************** -// * Recognized escape sequences are -// * (B ASCII -// * .A ISO-8859-1 -// * .F ISO-8859-7 -// * (J JISX-201 -// * (I JISX-201 -// * $B JISX-208 -// * $@ JISX-208 -// * $(D JISX-212 -// * $A GB2312 -// * $(C KSC5601 -// */ -// static const int8_t nextStateToUnicodeJP[MAX_STATES_2022]= { -// /* 0 1 2 3 4 5 6 7 8 9 */ -// INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,SS2_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,ASCII ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,JISX201 ,HWKANA_7BIT ,JISX201 ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,JISX208 ,GB2312 ,JISX208 ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,ISO8859_1 ,ISO8859_7 ,JISX208 ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,KSC5601 ,JISX212 ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// }; - -// #if !UCONFIG_ONLY_HTML_CONVERSION -// /*************** to unicode *******************/ -// static const int8_t nextStateToUnicodeCN[MAX_STATES_2022]= { -// /* 0 1 2 3 4 5 6 7 8 9 */ -// INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,SS2_STATE ,SS3_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,GB2312_1 ,INVALID_STATE ,ISO_IR_165 -// ,CNS_11643_1 ,CNS_11643_2 ,CNS_11643_3 ,CNS_11643_4 ,CNS_11643_5 ,CNS_11643_6 ,CNS_11643_7 ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE -// }; -// #endif - - -// static UCNV_TableStates_2022 -// getKey_2022(char c,int32_t* key,int32_t* offset){ -// int32_t togo; -// int32_t low = 0; -// int32_t hi = MAX_STATES_2022; -// int32_t oldmid=0; - -// togo = normalize_esq_chars_2022[(uint8_t)c]; -// if(togo == 0) { -// /* not a valid character anywhere in an escape sequence */ -// *key = 0; -// *offset = 0; -// return INVALID_2022; -// } -// togo = (*key << 5) + togo; - -// while (hi != low) /*binary search*/{ - -// int32_t mid = (hi+low) >> 1; /*Finds median*/ - -// if (mid == oldmid) -// break; - -// if (escSeqStateTable_Key_2022[mid] > togo){ -// hi = mid; -// } -// else if (escSeqStateTable_Key_2022[mid] < togo){ -// low = mid; -// } -// else /*we found it*/{ -// *key = togo; -// *offset = mid; -// return (UCNV_TableStates_2022)escSeqStateTable_Value_2022[mid]; -// } -// oldmid = mid; - -// } - -// *key = 0; -// *offset = 0; -// return INVALID_2022; -// } - -// /*runs through a state machine to determine the escape sequence - codepage correspondance -// */ -// static void -// changeState_2022(UConverter* _this, -// const char** source, -// const char* sourceLimit, -// Variant2022 var, -// UErrorCode* err){ -// UCNV_TableStates_2022 value; -// UConverterDataISO2022* myData2022 = ((UConverterDataISO2022*)_this->extraInfo); -// uint32_t key = myData2022->key; -// int32_t offset = 0; -// int8_t initialToULength = _this->toULength; -// char c; - -// value = VALID_NON_TERMINAL_2022; -// while (*source < sourceLimit) { -// c = *(*source)++; -// _this->toUBytes[_this->toULength++]=(uint8_t)c; -// value = getKey_2022(c,(int32_t *) &key, &offset); - -// switch (value){ - -// case VALID_NON_TERMINAL_2022 : -// /* continue with the loop */ -// break; - -// case VALID_TERMINAL_2022: -// key = 0; -// goto DONE; - -// case INVALID_2022: -// goto DONE; - -// case VALID_MAYBE_TERMINAL_2022: -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// /* ESC ( B is ambiguous only for ISO_2022 itself */ -// if(var == ISO_2022) { -// /* discard toUBytes[] for ESC ( B because this sequence is correct and complete */ -// _this->toULength = 0; - -// /* TODO need to indicate that ESC ( B was seen; if failure, then need to replay from source or from MBCS-style replay */ - -// /* continue with the loop */ -// value = VALID_NON_TERMINAL_2022; -// break; -// } else -// #endif -// { -// /* not ISO_2022 itself, finish here */ -// value = VALID_TERMINAL_2022; -// key = 0; -// goto DONE; -// } -// } -// } - -// DONE: -// myData2022->key = key; - -// if (value == VALID_NON_TERMINAL_2022) { -// /* indicate that the escape sequence is incomplete: key!=0 */ -// return; -// } else if (value == INVALID_2022 ) { -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// } else /* value == VALID_TERMINAL_2022 */ { -// switch(var){ -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// case ISO_2022: -// { -// const char *chosenConverterName = escSeqStateTable_Result_2022[offset]; -// if(chosenConverterName == NULL) { -// /* SS2 or SS3 */ -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// _this->toUCallbackReason = UCNV_UNASSIGNED; -// return; -// } - -// _this->mode = UCNV_SI; -// ucnv_close(myData2022->currentConverter); -// myData2022->currentConverter = myUConverter = ucnv_open(chosenConverterName, err); -// if(U_SUCCESS(*err)) { -// myUConverter->fromCharErrorBehaviour = UCNV_TO_U_CALLBACK_STOP; -// _this->mode = UCNV_SO; -// } -// break; -// } -// #endif -// case ISO_2022_JP: -// { -// StateEnum tempState=(StateEnum)nextStateToUnicodeJP[offset]; -// switch(tempState) { -// case INVALID_STATE: -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// break; -// case SS2_STATE: -// if(myData2022->toU2022State.cs[2]!=0) { -// if(myData2022->toU2022State.g<2) { -// myData2022->toU2022State.prevG=myData2022->toU2022State.g; -// } -// myData2022->toU2022State.g=2; -// } else { -// /* illegal to have SS2 before a matching designator */ -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// } -// break; -// /* case SS3_STATE: not used in ISO-2022-JP-x */ -// case ISO8859_1: -// case ISO8859_7: -// if((jpCharsetMasks[myData2022->version] & CSM(tempState)) == 0) { -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// } else { -// /* G2 charset for SS2 */ -// myData2022->toU2022State.cs[2]=(int8_t)tempState; -// } -// break; -// default: -// if((jpCharsetMasks[myData2022->version] & CSM(tempState)) == 0) { -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// } else { -// /* G0 charset */ -// myData2022->toU2022State.cs[0]=(int8_t)tempState; -// } -// break; -// } -// } -// break; -// #if !UCONFIG_ONLY_HTML_CONVERSION -// case ISO_2022_CN: -// { -// StateEnum tempState=(StateEnum)nextStateToUnicodeCN[offset]; -// switch(tempState) { -// case INVALID_STATE: -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// break; -// case SS2_STATE: -// if(myData2022->toU2022State.cs[2]!=0) { -// if(myData2022->toU2022State.g<2) { -// myData2022->toU2022State.prevG=myData2022->toU2022State.g; -// } -// myData2022->toU2022State.g=2; -// } else { -// /* illegal to have SS2 before a matching designator */ -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// } -// break; -// case SS3_STATE: -// if(myData2022->toU2022State.cs[3]!=0) { -// if(myData2022->toU2022State.g<2) { -// myData2022->toU2022State.prevG=myData2022->toU2022State.g; -// } -// myData2022->toU2022State.g=3; -// } else { -// /* illegal to have SS3 before a matching designator */ -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// } -// break; -// case ISO_IR_165: -// if(myData2022->version==0) { -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// break; -// } -// U_FALLTHROUGH; -// case GB2312_1: -// U_FALLTHROUGH; -// case CNS_11643_1: -// myData2022->toU2022State.cs[1]=(int8_t)tempState; -// break; -// case CNS_11643_2: -// myData2022->toU2022State.cs[2]=(int8_t)tempState; -// break; -// default: -// /* other CNS 11643 planes */ -// if(myData2022->version==0) { -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// } else { -// myData2022->toU2022State.cs[3]=(int8_t)tempState; -// } -// break; -// } -// } -// break; -// case ISO_2022_KR: -// if(offset==0x30){ -// /* nothing to be done, just accept this one escape sequence */ -// } else { -// *err = U_UNSUPPORTED_ESCAPE_SEQUENCE; -// } -// break; -// #endif // !UCONFIG_ONLY_HTML_CONVERSION - -// default: -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// break; -// } -// } -// if(U_SUCCESS(*err)) { -// _this->toULength = 0; -// } else if(*err==U_ILLEGAL_ESCAPE_SEQUENCE) { -// if(_this->toULength>1) { -// /* -// * Ticket 5691: consistent illegal sequences: -// * - We include at least the first byte (ESC) in the illegal sequence. -// * - If any of the non-initial bytes could be the start of a character, -// * we stop the illegal sequence before the first one of those. -// * In escape sequences, all following bytes are "printable", that is, -// * unless they are completely illegal (>7f in SBCS, outside 21..7e in DBCS), -// * they are valid single/lead bytes. -// * For simplicity, we always only report the initial ESC byte as the -// * illegal sequence and back out all other bytes we looked at. -// */ -// /* Back out some bytes. */ -// int8_t backOutDistance=_this->toULength-1; -// int8_t bytesFromThisBuffer=_this->toULength-initialToULength; -// if(backOutDistance<=bytesFromThisBuffer) { -// /* same as initialToULength<=1 */ -// *source-=backOutDistance; -// } else { -// /* Back out bytes from the previous buffer: Need to replay them. */ -// _this->preToULength=(int8_t)(bytesFromThisBuffer-backOutDistance); -// /* same as -(initialToULength-1) */ -// /* preToULength is negative! */ -// uprv_memcpy(_this->preToU, _this->toUBytes+1, -_this->preToULength); -// *source-=bytesFromThisBuffer; -// } -// _this->toULength=1; -// } -// } else if(*err==U_UNSUPPORTED_ESCAPE_SEQUENCE) { -// _this->toUCallbackReason = UCNV_UNASSIGNED; -// } -// } - -// #if !UCONFIG_ONLY_HTML_CONVERSION -// /*Checks the characters of the buffer against valid 2022 escape sequences -// *if the match we return a pointer to the initial start of the sequence otherwise -// *we return sourceLimit -// */ -// /*for 2022 looks ahead in the stream -// *to determine the longest possible convertible -// *data stream -// */ -// static inline const char* -// getEndOfBuffer_2022(const char** source, -// const char* sourceLimit, -// UBool /*flush*/){ - -// const char* mySource = *source; - -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// if (*source >= sourceLimit) -// return sourceLimit; - -// do{ - -// if (*mySource == ESC_2022){ -// int8_t i; -// int32_t key = 0; -// int32_t offset; -// UCNV_TableStates_2022 value = VALID_NON_TERMINAL_2022; - -// /* Kludge: I could not -// * figure out the reason for validating an escape sequence -// * twice - once here and once in changeState_2022(). -// * is it possible to have an ESC character in a ISO2022 -// * byte stream which is valid in a code page? Is it legal? -// */ -// for (i=0; -// (mySource+i < sourceLimit)&&(value == VALID_NON_TERMINAL_2022); -// i++) { -// value = getKey_2022(*(mySource+i), &key, &offset); -// } -// if (value > 0 || *mySource==ESC_2022) -// return mySource; - -// if ((value == VALID_NON_TERMINAL_2022)&&(!flush) ) -// return sourceLimit; -// } -// }while (++mySource < sourceLimit); - -// return sourceLimit; -// #else -// while(mySource < sourceLimit && *mySource != ESC_2022) { -// ++mySource; -// } -// return mySource; -// #endif -// } -// #endif - -// /* This inline function replicates code in _MBCSFromUChar32() function in ucnvmbcs.c -// * any future change in _MBCSFromUChar32() function should be reflected here. -// * @return number of bytes in *value; negative number if fallback; 0 if no mapping -// */ -// static inline int32_t -// MBCS_FROM_UCHAR32_ISO2022(UConverterSharedData* sharedData, -// UChar32 c, -// uint32_t* value, -// UBool useFallback, -// int outputType) -// { -// const int32_t *cx; -// const uint16_t *table; -// uint32_t stage2Entry; -// uint32_t myValue; -// int32_t length; -// const uint8_t *p; -// /* -// * TODO(markus): Use and require new, faster MBCS conversion table structures. -// * Use internal version of ucnv_open() that verifies that the new structures are available, -// * else U_INTERNAL_PROGRAM_ERROR. -// */ -// /* BMP-only codepages are stored without stage 1 entries for supplementary code points */ -// if(c<0x10000 || (sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY)) { -// table=sharedData->mbcs.fromUnicodeTable; -// stage2Entry=MBCS_STAGE_2_FROM_U(table, c); -// /* get the bytes and the length for the output */ -// if(outputType==MBCS_OUTPUT_2){ -// myValue=MBCS_VALUE_2_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// if(myValue<=0xff) { -// length=1; -// } else { -// length=2; -// } -// } else /* outputType==MBCS_OUTPUT_3 */ { -// p=MBCS_POINTER_3_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// myValue=((uint32_t)*p<<16)|((uint32_t)p[1]<<8)|p[2]; -// if(myValue<=0xff) { -// length=1; -// } else if(myValue<=0xffff) { -// length=2; -// } else { -// length=3; -// } -// } -// /* is this code point assigned, or do we use fallbacks? */ -// if((stage2Entry&(1<<(16+(c&0xf))))!=0) { -// /* assigned */ -// *value=myValue; -// return length; -// } else if(FROM_U_USE_FALLBACK(useFallback, c) && myValue!=0) { -// /* -// * We allow a 0 byte output if the "assigned" bit is set for this entry. -// * There is no way with this data structure for fallback output -// * to be a zero byte. -// */ -// *value=myValue; -// return -length; -// } -// } - -// cx=sharedData->mbcs.extIndexes; -// if(cx!=NULL) { -// return ucnv_extSimpleMatchFromU(cx, c, value, useFallback); -// } - -// /* unassigned */ -// return 0; -// } - -// /* This inline function replicates code in _MBCSSingleFromUChar32() function in ucnvmbcs.c -// * any future change in _MBCSSingleFromUChar32() function should be reflected here. -// * @param retval pointer to output byte -// * @return 1 roundtrip byte 0 no mapping -1 fallback byte -// */ -// static inline int32_t -// MBCS_SINGLE_FROM_UCHAR32(UConverterSharedData* sharedData, -// UChar32 c, -// uint32_t* retval, -// UBool useFallback) -// { -// const uint16_t *table; -// int32_t value; -// /* BMP-only codepages are stored without stage 1 entries for supplementary code points */ -// if(c>=0x10000 && !(sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY)) { -// return 0; -// } -// /* convert the Unicode code point in c into codepage bytes (same as in _MBCSFromUnicodeWithOffsets) */ -// table=sharedData->mbcs.fromUnicodeTable; -// /* get the byte for the output */ -// value=MBCS_SINGLE_RESULT_FROM_U(table, (uint16_t *)sharedData->mbcs.fromUnicodeBytes, c); -// /* is this code point assigned, or do we use fallbacks? */ -// *retval=(uint32_t)(value&0xff); -// if(value>=0xf00) { -// return 1; /* roundtrip */ -// } else if(useFallback ? value>=0x800 : value>=0xc00) { -// return -1; /* fallback taken */ -// } else { -// return 0; /* no mapping */ -// } -// } - -// /* -// * Check that the result is a 2-byte value with each byte in the range A1..FE -// * (strict EUC DBCS) before accepting it and subtracting 0x80 from each byte -// * to move it to the ISO 2022 range 21..7E. -// * Return 0 if out of range. -// */ -// static inline uint32_t -// _2022FromGR94DBCS(uint32_t value) { -// if( (uint16_t)(value - 0xa1a1) <= (0xfefe - 0xa1a1) && -// (uint8_t)(value - 0xa1) <= (0xfe - 0xa1) -// ) { -// return value - 0x8080; /* shift down to 21..7e byte range */ -// } else { -// return 0; /* not valid for ISO 2022 */ -// } -// } - -// #if 0 /* 5691: Call sites now check for validity. They can just += 0x8080 after that. */ -// /* -// * This method does the reverse of _2022FromGR94DBCS(). Given the 2022 code point, it returns the -// * 2 byte value that is in the range A1..FE for each byte. Otherwise it returns the 2022 code point -// * unchanged. -// */ -// static inline uint32_t -// _2022ToGR94DBCS(uint32_t value) { -// uint32_t returnValue = value + 0x8080; -// if( (uint16_t)(returnValue - 0xa1a1) <= (0xfefe - 0xa1a1) && -// (uint8_t)(returnValue - 0xa1) <= (0xfe - 0xa1)) { -// return returnValue; -// } else { -// return value; -// } -// } -// #endif - -// #ifdef U_ENABLE_GENERIC_ISO_2022 - -// /********************************************************************************** -// * ISO-2022 Converter -// * -// * -// */ - -// static void U_CALLCONV -// T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args, -// UErrorCode* err){ -// const char* mySourceLimit, *realSourceLimit; -// const char* sourceStart; -// const UChar* myTargetStart; -// UConverter* saveThis; -// UConverterDataISO2022* myData; -// int8_t length; - -// saveThis = args->converter; -// myData=((UConverterDataISO2022*)(saveThis->extraInfo)); - -// realSourceLimit = args->sourceLimit; -// while (args->source < realSourceLimit) { -// if(myData->key == 0) { /* are we in the middle of an escape sequence? */ -// /*Find the end of the buffer e.g : Next Escape Seq | end of Buffer*/ -// mySourceLimit = getEndOfBuffer_2022(&(args->source), realSourceLimit, args->flush); - -// if(args->source < mySourceLimit) { -// if(myData->currentConverter==NULL) { -// myData->currentConverter = ucnv_open("ASCII",err); -// if(U_FAILURE(*err)){ -// return; -// } - -// myData->currentConverter->fromCharErrorBehaviour = UCNV_TO_U_CALLBACK_STOP; -// saveThis->mode = UCNV_SO; -// } - -// /* convert to before the ESC or until the end of the buffer */ -// myData->isFirstBuffer=FALSE; -// sourceStart = args->source; -// myTargetStart = args->target; -// args->converter = myData->currentConverter; -// ucnv_toUnicode(args->converter, -// &args->target, -// args->targetLimit, -// &args->source, -// mySourceLimit, -// args->offsets, -// (UBool)(args->flush && mySourceLimit == realSourceLimit), -// err); -// args->converter = saveThis; - -// if (*err == U_BUFFER_OVERFLOW_ERROR) { -// /* move the overflow buffer */ -// length = saveThis->UCharErrorBufferLength = myData->currentConverter->UCharErrorBufferLength; -// myData->currentConverter->UCharErrorBufferLength = 0; -// if(length > 0) { -// uprv_memcpy(saveThis->UCharErrorBuffer, -// myData->currentConverter->UCharErrorBuffer, -// length*U_SIZEOF_UCHAR); -// } -// return; -// } - -// /* -// * At least one of: -// * -Error while converting -// * -Done with entire buffer -// * -Need to write offsets or update the current offset -// * (leave that up to the code in ucnv.c) -// * -// * or else we just stopped at an ESC byte and continue with changeState_2022() -// */ -// if (U_FAILURE(*err) || -// (args->source == realSourceLimit) || -// (args->offsets != NULL && (args->target != myTargetStart || args->source != sourceStart) || -// (mySourceLimit < realSourceLimit && myData->currentConverter->toULength > 0)) -// ) { -// /* copy partial or error input for truncated detection and error handling */ -// if(U_FAILURE(*err)) { -// length = saveThis->invalidCharLength = myData->currentConverter->invalidCharLength; -// if(length > 0) { -// uprv_memcpy(saveThis->invalidCharBuffer, myData->currentConverter->invalidCharBuffer, length); -// } -// } else { -// length = saveThis->toULength = myData->currentConverter->toULength; -// if(length > 0) { -// uprv_memcpy(saveThis->toUBytes, myData->currentConverter->toUBytes, length); -// if(args->source < mySourceLimit) { -// *err = U_TRUNCATED_CHAR_FOUND; /* truncated input before ESC */ -// } -// } -// } -// return; -// } -// } -// } - -// sourceStart = args->source; -// changeState_2022(args->converter, -// &(args->source), -// realSourceLimit, -// ISO_2022, -// err); -// if (U_FAILURE(*err) || (args->source != sourceStart && args->offsets != NULL)) { -// /* let the ucnv.c code update its current offset */ -// return; -// } -// } -// } - -// #endif - -// /* -// * To Unicode Callback helper function -// */ -// static void -// toUnicodeCallback(UConverter *cnv, -// const uint32_t sourceChar, const uint32_t targetUniChar, -// UErrorCode* err){ -// if(sourceChar>0xff){ -// cnv->toUBytes[0] = (uint8_t)(sourceChar>>8); -// cnv->toUBytes[1] = (uint8_t)sourceChar; -// cnv->toULength = 2; -// } -// else{ -// cnv->toUBytes[0] =(char) sourceChar; -// cnv->toULength = 1; -// } - -// if(targetUniChar == (missingCharMarker-1/*0xfffe*/)){ -// *err = U_INVALID_CHAR_FOUND; -// } -// else{ -// *err = U_ILLEGAL_CHAR_FOUND; -// } -// } - -// /**************************************ISO-2022-JP*************************************************/ - -// /************************************** IMPORTANT ************************************************** -// * The UConverter_fromUnicode_ISO2022_JP converter does not use ucnv_fromUnicode() functions for SBCS,DBCS and -// * MBCS; instead, the values are obtained directly by calling _MBCSFromUChar32(). -// * The converter iterates over each Unicode codepoint -// * to obtain the equivalent codepoints from the codepages supported. Since the source buffer is -// * processed one char at a time it would make sense to reduce the extra processing a canned converter -// * would do as far as possible. -// * -// * If the implementation of these macros or structure of sharedData struct change in the future, make -// * sure that ISO-2022 is also changed. -// *************************************************************************************************** -// */ - -// /*************************************************************************************************** -// * Rules for ISO-2022-jp encoding -// * (i) Escape sequences must be fully contained within a line they should not -// * span new lines or CRs -// * (ii) If the last character on a line is represented by two bytes then an ASCII or -// * JIS-Roman character escape sequence should follow before the line terminates -// * (iii) If the first character on the line is represented by two bytes then a two -// * byte character escape sequence should precede it -// * (iv) If no escape sequence is encountered then the characters are ASCII -// * (v) Latin(ISO-8859-1) and Greek(ISO-8859-7) characters must be designated to G2, -// * and invoked with SS2 (ESC N). -// * (vi) If there is any G0 designation in text, there must be a switch to -// * ASCII or to JIS X 0201-Roman before a space character (but not -// * necessarily before "ESC 4/14 2/0" or "ESC N ' '") or control -// * characters such as tab or CRLF. -// * (vi) Supported encodings: -// * ASCII, JISX201, JISX208, JISX212, GB2312, KSC5601, ISO-8859-1,ISO-8859-7 -// * -// * source : RFC-1554 -// * -// * JISX201, JISX208,JISX212 : new .cnv data files created -// * KSC5601 : alias to ibm-949 mapping table -// * GB2312 : alias to ibm-1386 mapping table -// * ISO-8859-1 : Algorithmic implemented as LATIN1 case -// * ISO-8859-7 : alisas to ibm-9409 mapping table -// */ - -// /* preference order of JP charsets */ -// static const StateEnum jpCharsetPref[]={ -// ASCII, -// JISX201, -// ISO8859_1, -// JISX208, -// ISO8859_7, -// JISX212, -// GB2312, -// KSC5601, -// HWKANA_7BIT -// }; - -// /* -// * The escape sequences must be in order of the enum constants like JISX201 = 3, -// * not in order of jpCharsetPref[]! -// */ -// static const char escSeqChars[][6] ={ -// "\x1B\x28\x42", /* (B ASCII */ -// "\x1B\x2E\x41", /* .A ISO-8859-1 */ -// "\x1B\x2E\x46", /* .F ISO-8859-7 */ -// "\x1B\x28\x4A", /* (J JISX-201 */ -// "\x1B\x24\x42", /* $B JISX-208 */ -// "\x1B\x24\x28\x44", /* $(D JISX-212 */ -// "\x1B\x24\x41", /* $A GB2312 */ -// "\x1B\x24\x28\x43", /* $(C KSC5601 */ -// "\x1B\x28\x49" /* (I HWKANA_7BIT */ - -// }; -// static const int8_t escSeqCharsLen[] ={ -// 3, /* length of (B ASCII */ -// 3, /* length of .A ISO-8859-1 */ -// 3, /* length of .F ISO-8859-7 */ -// 3, /* length of (J JISX-201 */ -// 3, /* length of $B JISX-208 */ -// 4, /* length of $(D JISX-212 */ -// 3, /* length of $A GB2312 */ -// 4, /* length of $(C KSC5601 */ -// 3 /* length of (I HWKANA_7BIT */ -// }; - -// /* -// * The iteration over various code pages works this way: -// * i) Get the currentState from myConverterData->currentState -// * ii) Check if the character is mapped to a valid character in the currentState -// * Yes -> a) set the initIterState to currentState -// * b) remain in this state until an invalid character is found -// * No -> a) go to the next code page and find the character -// * iii) Before changing the state increment the current state check if the current state -// * is equal to the intitIteration state -// * Yes -> A character that cannot be represented in any of the supported encodings -// * break and return a U_INVALID_CHARACTER error -// * No -> Continue and find the character in next code page -// * -// * -// * TODO: Implement a priority technique where the users are allowed to set the priority of code pages -// */ - -// /* Map 00..7F to Unicode according to JIS X 0201. */ -// static inline uint32_t -// jisx201ToU(uint32_t value) { -// if(value < 0x5c) { -// return value; -// } else if(value == 0x5c) { -// return 0xa5; -// } else if(value == 0x7e) { -// return 0x203e; -// } else /* value <= 0x7f */ { -// return value; -// } -// } - -// /* Map Unicode to 00..7F according to JIS X 0201. Return U+FFFE if unmappable. */ -// static inline uint32_t -// jisx201FromU(uint32_t value) { -// if(value<=0x7f) { -// if(value!=0x5c && value!=0x7e) { -// return value; -// } -// } else if(value==0xa5) { -// return 0x5c; -// } else if(value==0x203e) { -// return 0x7e; -// } -// return 0xfffe; -// } - -// /* -// * Take a valid Shift-JIS byte pair, check that it is in the range corresponding -// * to JIS X 0208, and convert it to a pair of 21..7E bytes. -// * Return 0 if the byte pair is out of range. -// */ -// static inline uint32_t -// _2022FromSJIS(uint32_t value) { -// uint8_t trail; - -// if(value > 0xEFFC) { -// return 0; /* beyond JIS X 0208 */ -// } - -// trail = (uint8_t)value; - -// value &= 0xff00; /* lead byte */ -// if(value <= 0x9f00) { -// value -= 0x7000; -// } else /* 0xe000 <= value <= 0xef00 */ { -// value -= 0xb000; -// } -// value <<= 1; - -// if(trail <= 0x9e) { -// value -= 0x100; -// if(trail <= 0x7e) { -// value |= trail - 0x1f; -// } else { -// value |= trail - 0x20; -// } -// } else /* trail <= 0xfc */ { -// value |= trail - 0x7e; -// } -// return value; -// } - -// /* -// * Convert a pair of JIS X 0208 21..7E bytes to Shift-JIS. -// * If either byte is outside 21..7E make sure that the result is not valid -// * for Shift-JIS so that the converter catches it. -// * Some invalid byte values already turn into equally invalid Shift-JIS -// * byte values and need not be tested explicitly. -// */ -// static inline void -// _2022ToSJIS(uint8_t c1, uint8_t c2, char bytes[2]) { -// if(c1&1) { -// ++c1; -// if(c2 <= 0x5f) { -// c2 += 0x1f; -// } else if(c2 <= 0x7e) { -// c2 += 0x20; -// } else { -// c2 = 0; /* invalid */ -// } -// } else { -// if((uint8_t)(c2-0x21) <= ((0x7e)-0x21)) { -// c2 += 0x7e; -// } else { -// c2 = 0; /* invalid */ -// } -// } -// c1 >>= 1; -// if(c1 <= 0x2f) { -// c1 += 0x70; -// } else if(c1 <= 0x3f) { -// c1 += 0xb0; -// } else { -// c1 = 0; /* invalid */ -// } -// bytes[0] = (char)c1; -// bytes[1] = (char)c2; -// } - -// /* -// * JIS X 0208 has fallbacks from Unicode half-width Katakana to full-width (DBCS) -// * Katakana. -// * Now that we use a Shift-JIS table for JIS X 0208 we need to hardcode these fallbacks -// * because Shift-JIS roundtrips half-width Katakana to single bytes. -// * These were the only fallbacks in ICU's jisx-208.ucm file. -// */ -// static const uint16_t hwkana_fb[HWKANA_END - HWKANA_START + 1] = { -// 0x2123, /* U+FF61 */ -// 0x2156, -// 0x2157, -// 0x2122, -// 0x2126, -// 0x2572, -// 0x2521, -// 0x2523, -// 0x2525, -// 0x2527, -// 0x2529, -// 0x2563, -// 0x2565, -// 0x2567, -// 0x2543, -// 0x213C, /* U+FF70 */ -// 0x2522, -// 0x2524, -// 0x2526, -// 0x2528, -// 0x252A, -// 0x252B, -// 0x252D, -// 0x252F, -// 0x2531, -// 0x2533, -// 0x2535, -// 0x2537, -// 0x2539, -// 0x253B, -// 0x253D, -// 0x253F, /* U+FF80 */ -// 0x2541, -// 0x2544, -// 0x2546, -// 0x2548, -// 0x254A, -// 0x254B, -// 0x254C, -// 0x254D, -// 0x254E, -// 0x254F, -// 0x2552, -// 0x2555, -// 0x2558, -// 0x255B, -// 0x255E, -// 0x255F, /* U+FF90 */ -// 0x2560, -// 0x2561, -// 0x2562, -// 0x2564, -// 0x2566, -// 0x2568, -// 0x2569, -// 0x256A, -// 0x256B, -// 0x256C, -// 0x256D, -// 0x256F, -// 0x2573, -// 0x212B, -// 0x212C /* U+FF9F */ -// }; - -// static void U_CALLCONV -// UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args, UErrorCode* err) { -// UConverter *cnv = args->converter; -// UConverterDataISO2022 *converterData; -// ISO2022State *pFromU2022State; -// uint8_t *target = (uint8_t *) args->target; -// const uint8_t *targetLimit = (const uint8_t *) args->targetLimit; -// const UChar* source = args->source; -// const UChar* sourceLimit = args->sourceLimit; -// int32_t* offsets = args->offsets; -// UChar32 sourceChar; -// char buffer[8]; -// int32_t len, outLen; -// int8_t choices[10]; -// int32_t choiceCount; -// uint32_t targetValue = 0; -// UBool useFallback; - -// int32_t i; -// int8_t cs, g; - -// /* set up the state */ -// converterData = (UConverterDataISO2022*)cnv->extraInfo; -// pFromU2022State = &converterData->fromU2022State; - -// choiceCount = 0; - -// /* check if the last codepoint of previous buffer was a lead surrogate*/ -// if((sourceChar = cnv->fromUChar32)!=0 && target< targetLimit) { -// goto getTrail; -// } - -// while(source < sourceLimit) { -// if(target < targetLimit) { - -// sourceChar = *(source++); -// /*check if the char is a First surrogate*/ -// if(U16_IS_SURROGATE(sourceChar)) { -// if(U16_IS_SURROGATE_LEAD(sourceChar)) { -// getTrail: -// /*look ahead to find the trail surrogate*/ -// if(source < sourceLimit) { -// /* test the following code unit */ -// UChar trail=(UChar) *source; -// if(U16_IS_TRAIL(trail)) { -// source++; -// sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail); -// cnv->fromUChar32=0x00; -// /* convert this supplementary code point */ -// /* exit this condition tree */ -// } else { -// /* this is an unmatched lead code unit (1st surrogate) */ -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } -// } else { -// /* no more input */ -// cnv->fromUChar32=sourceChar; -// break; -// } -// } else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } -// } - -// /* do not convert SO/SI/ESC */ -// if(IS_2022_CONTROL(sourceChar)) { -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } - -// /* do the conversion */ - -// if(choiceCount == 0) { -// uint16_t csm; - -// /* -// * The csm variable keeps track of which charsets are allowed -// * and not used yet while building the choices[]. -// */ -// csm = jpCharsetMasks[converterData->version]; -// choiceCount = 0; - -// /* JIS7/8: try single-byte half-width Katakana before JISX208 */ -// if(converterData->version == 3 || converterData->version == 4) { -// choices[choiceCount++] = (int8_t)HWKANA_7BIT; -// } -// /* Do not try single-byte half-width Katakana for other versions. */ -// csm &= ~CSM(HWKANA_7BIT); - -// /* try the current G0 charset */ -// choices[choiceCount++] = cs = pFromU2022State->cs[0]; -// csm &= ~CSM(cs); - -// /* try the current G2 charset */ -// if((cs = pFromU2022State->cs[2]) != 0) { -// choices[choiceCount++] = cs; -// csm &= ~CSM(cs); -// } - -// /* try all the other possible charsets */ -// for(i = 0; i < UPRV_LENGTHOF(jpCharsetPref); ++i) { -// cs = (int8_t)jpCharsetPref[i]; -// if(CSM(cs) & csm) { -// choices[choiceCount++] = cs; -// csm &= ~CSM(cs); -// } -// } -// } - -// cs = g = 0; -// /* -// * len==0: no mapping found yet -// * len<0: found a fallback result: continue looking for a roundtrip but no further fallbacks -// * len>0: found a roundtrip result, done -// */ -// len = 0; -// /* -// * We will turn off useFallback after finding a fallback, -// * but we still get fallbacks from PUA code points as usual. -// * Therefore, we will also need to check that we don't overwrite -// * an early fallback with a later one. -// */ -// useFallback = cnv->useFallback; - -// for(i = 0; i < choiceCount && len <= 0; ++i) { -// uint32_t value; -// int32_t len2; -// int8_t cs0 = choices[i]; -// switch(cs0) { -// case ASCII: -// if(sourceChar <= 0x7f) { -// targetValue = (uint32_t)sourceChar; -// len = 1; -// cs = cs0; -// g = 0; -// } -// break; -// case ISO8859_1: -// if(GR96_START <= sourceChar && sourceChar <= GR96_END) { -// targetValue = (uint32_t)sourceChar - 0x80; -// len = 1; -// cs = cs0; -// g = 2; -// } -// break; -// case HWKANA_7BIT: -// if((uint32_t)(sourceChar - HWKANA_START) <= (HWKANA_END - HWKANA_START)) { -// if(converterData->version==3) { -// /* JIS7: use G1 (SO) */ -// /* Shift U+FF61..U+FF9F to bytes 21..5F. */ -// targetValue = (uint32_t)(sourceChar - (HWKANA_START - 0x21)); -// len = 1; -// pFromU2022State->cs[1] = cs = cs0; /* do not output an escape sequence */ -// g = 1; -// } else if(converterData->version==4) { -// /* JIS8: use 8-bit bytes with any single-byte charset, see escape sequence output below */ -// /* Shift U+FF61..U+FF9F to bytes A1..DF. */ -// targetValue = (uint32_t)(sourceChar - (HWKANA_START - 0xa1)); -// len = 1; - -// cs = pFromU2022State->cs[0]; -// if(IS_JP_DBCS(cs)) { -// /* switch from a DBCS charset to JISX201 */ -// cs = (int8_t)JISX201; -// } -// /* else stay in the current G0 charset */ -// g = 0; -// } -// /* else do not use HWKANA_7BIT with other versions */ -// } -// break; -// case JISX201: -// /* G0 SBCS */ -// value = jisx201FromU(sourceChar); -// if(value <= 0x7f) { -// targetValue = value; -// len = 1; -// cs = cs0; -// g = 0; -// useFallback = FALSE; -// } -// break; -// case JISX208: -// /* G0 DBCS from Shift-JIS table */ -// len2 = MBCS_FROM_UCHAR32_ISO2022( -// converterData->myConverterArray[cs0], -// sourceChar, &value, -// useFallback, MBCS_OUTPUT_2); -// if(len2 == 2 || (len2 == -2 && len == 0)) { /* only accept DBCS: abs(len)==2 */ -// value = _2022FromSJIS(value); -// if(value != 0) { -// targetValue = value; -// len = len2; -// cs = cs0; -// g = 0; -// useFallback = FALSE; -// } -// } else if(len == 0 && useFallback && -// (uint32_t)(sourceChar - HWKANA_START) <= (HWKANA_END - HWKANA_START)) { -// targetValue = hwkana_fb[sourceChar - HWKANA_START]; -// len = -2; -// cs = cs0; -// g = 0; -// useFallback = FALSE; -// } -// break; -// case ISO8859_7: -// /* G0 SBCS forced to 7-bit output */ -// len2 = MBCS_SINGLE_FROM_UCHAR32( -// converterData->myConverterArray[cs0], -// sourceChar, &value, -// useFallback); -// if(len2 != 0 && !(len2 < 0 && len != 0) && GR96_START <= value && value <= GR96_END) { -// targetValue = value - 0x80; -// len = len2; -// cs = cs0; -// g = 2; -// useFallback = FALSE; -// } -// break; -// default: -// /* G0 DBCS */ -// len2 = MBCS_FROM_UCHAR32_ISO2022( -// converterData->myConverterArray[cs0], -// sourceChar, &value, -// useFallback, MBCS_OUTPUT_2); -// if(len2 == 2 || (len2 == -2 && len == 0)) { /* only accept DBCS: abs(len)==2 */ -// if(cs0 == KSC5601) { -// /* -// * Check for valid bytes for the encoding scheme. -// * This is necessary because the sub-converter (windows-949) -// * has a broader encoding scheme than is valid for 2022. -// */ -// value = _2022FromGR94DBCS(value); -// if(value == 0) { -// break; -// } -// } -// targetValue = value; -// len = len2; -// cs = cs0; -// g = 0; -// useFallback = FALSE; -// } -// break; -// } -// } - -// if(len != 0) { -// if(len < 0) { -// len = -len; /* fallback */ -// } -// outLen = 0; /* count output bytes */ - -// /* write SI if necessary (only for JIS7) */ -// if(pFromU2022State->g == 1 && g == 0) { -// buffer[outLen++] = UCNV_SI; -// pFromU2022State->g = 0; -// } - -// /* write the designation sequence if necessary */ -// if(cs != pFromU2022State->cs[g]) { -// int32_t escLen = escSeqCharsLen[cs]; -// uprv_memcpy(buffer + outLen, escSeqChars[cs], escLen); -// outLen += escLen; -// pFromU2022State->cs[g] = cs; - -// /* invalidate the choices[] */ -// choiceCount = 0; -// } - -// /* write the shift sequence if necessary */ -// if(g != pFromU2022State->g) { -// switch(g) { -// /* case 0 handled before writing escapes */ -// case 1: -// buffer[outLen++] = UCNV_SO; -// pFromU2022State->g = 1; -// break; -// default: /* case 2 */ -// buffer[outLen++] = 0x1b; -// buffer[outLen++] = 0x4e; -// break; -// /* no case 3: no SS3 in ISO-2022-JP-x */ -// } -// } - -// /* write the output bytes */ -// if(len == 1) { -// buffer[outLen++] = (char)targetValue; -// } else /* len == 2 */ { -// buffer[outLen++] = (char)(targetValue >> 8); -// buffer[outLen++] = (char)targetValue; -// } -// } else { -// /* -// * if we cannot find the character after checking all codepages -// * then this is an error -// */ -// *err = U_INVALID_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } - -// if(sourceChar == CR || sourceChar == LF) { -// /* reset the G2 state at the end of a line (conversion got us into ASCII or JISX201 already) */ -// pFromU2022State->cs[2] = 0; -// choiceCount = 0; -// } - -// /* output outLen>0 bytes in buffer[] */ -// if(outLen == 1) { -// *target++ = buffer[0]; -// if(offsets) { -// *offsets++ = (int32_t)(source - args->source - 1); /* -1: known to be ASCII */ -// } -// } else if(outLen == 2 && (target + 2) <= targetLimit) { -// *target++ = buffer[0]; -// *target++ = buffer[1]; -// if(offsets) { -// int32_t sourceIndex = (int32_t)(source - args->source - U16_LENGTH(sourceChar)); -// *offsets++ = sourceIndex; -// *offsets++ = sourceIndex; -// } -// } else { -// fromUWriteUInt8( -// cnv, -// buffer, outLen, -// &target, (const char *)targetLimit, -// &offsets, (int32_t)(source - args->source - U16_LENGTH(sourceChar)), -// err); -// if(U_FAILURE(*err)) { -// break; -// } -// } -// } /* end if(myTargetIndexg!=0 || pFromU2022State->cs[0]!=ASCII) && -// args->flush && source>=sourceLimit && cnv->fromUChar32==0 -// ) { -// int32_t sourceIndex; - -// outLen = 0; - -// if(pFromU2022State->g != 0) { -// buffer[outLen++] = UCNV_SI; -// pFromU2022State->g = 0; -// } - -// if(pFromU2022State->cs[0] != ASCII) { -// int32_t escLen = escSeqCharsLen[ASCII]; -// uprv_memcpy(buffer + outLen, escSeqChars[ASCII], escLen); -// outLen += escLen; -// pFromU2022State->cs[0] = (int8_t)ASCII; -// } - -// /* get the source index of the last input character */ -// /* -// * TODO this would be simpler and more reliable if we used a pair -// * of sourceIndex/prevSourceIndex like in ucnvmbcs.c -// * so that we could simply use the prevSourceIndex here; -// * this code gives an incorrect result for the rare case of an unmatched -// * trail surrogate that is alone in the last buffer of the text stream -// */ -// sourceIndex=(int32_t)(source-args->source); -// if(sourceIndex>0) { -// --sourceIndex; -// if( U16_IS_TRAIL(args->source[sourceIndex]) && -// (sourceIndex==0 || U16_IS_LEAD(args->source[sourceIndex-1])) -// ) { -// --sourceIndex; -// } -// } else { -// sourceIndex=-1; -// } - -// fromUWriteUInt8( -// cnv, -// buffer, outLen, -// &target, (const char *)targetLimit, -// &offsets, sourceIndex, -// err); -// } - -// /*save the state and return */ -// args->source = source; -// args->target = (char*)target; -// } - -// /*************** to unicode *******************/ - -// static void U_CALLCONV -// UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, -// UErrorCode* err){ -// char tempBuf[2]; -// const char *mySource = (char *) args->source; -// UChar *myTarget = args->target; -// const char *mySourceLimit = args->sourceLimit; -// uint32_t targetUniChar = 0x0000; -// uint32_t mySourceChar = 0x0000; -// uint32_t tmpSourceChar = 0x0000; -// UConverterDataISO2022* myData; -// ISO2022State *pToU2022State; -// StateEnum cs; - -// myData=(UConverterDataISO2022*)(args->converter->extraInfo); -// pToU2022State = &myData->toU2022State; - -// if(myData->key != 0) { -// /* continue with a partial escape sequence */ -// goto escape; -// } else if(args->converter->toULength == 1 && mySource < mySourceLimit && myTarget < args->targetLimit) { -// /* continue with a partial double-byte character */ -// mySourceChar = args->converter->toUBytes[0]; -// args->converter->toULength = 0; -// cs = (StateEnum)pToU2022State->cs[pToU2022State->g]; -// targetUniChar = missingCharMarker; -// goto getTrailByte; -// } - -// while(mySource < mySourceLimit){ - -// targetUniChar =missingCharMarker; - -// if(myTarget < args->targetLimit){ - -// mySourceChar= (unsigned char) *mySource++; - -// switch(mySourceChar) { -// case UCNV_SI: -// if(myData->version==3) { -// pToU2022State->g=0; -// continue; -// } else { -// /* only JIS7 uses SI/SO, not ISO-2022-JP-x */ -// myData->isEmptySegment = FALSE; /* reset this, we have a different error */ -// break; -// } - -// case UCNV_SO: -// if(myData->version==3) { -// /* JIS7: switch to G1 half-width Katakana */ -// pToU2022State->cs[1] = (int8_t)HWKANA_7BIT; -// pToU2022State->g=1; -// continue; -// } else { -// /* only JIS7 uses SI/SO, not ISO-2022-JP-x */ -// myData->isEmptySegment = FALSE; /* reset this, we have a different error */ -// break; -// } - -// case ESC_2022: -// mySource--; -// escape: -// { -// const char * mySourceBefore = mySource; -// int8_t toULengthBefore = args->converter->toULength; - -// changeState_2022(args->converter,&(mySource), -// mySourceLimit, ISO_2022_JP,err); - -// /* If in ISO-2022-JP only and we successully completed an escape sequence, but previous segment was empty, create an error */ -// if(myData->version==0 && myData->key==0 && U_SUCCESS(*err) && myData->isEmptySegment) { -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// args->converter->toUCallbackReason = UCNV_IRREGULAR; -// args->converter->toULength = (int8_t)(toULengthBefore + (mySource - mySourceBefore)); -// } -// } - -// /* invalid or illegal escape sequence */ -// if(U_FAILURE(*err)){ -// args->target = myTarget; -// args->source = mySource; -// myData->isEmptySegment = FALSE; /* Reset to avoid future spurious errors */ -// return; -// } -// /* If we successfully completed an escape sequence, we begin a new segment, empty so far */ -// if(myData->key==0) { -// myData->isEmptySegment = TRUE; -// } -// continue; - -// /* ISO-2022-JP does not use single-byte (C1) SS2 and SS3 */ - -// case CR: -// case LF: -// /* automatically reset to single-byte mode */ -// if((StateEnum)pToU2022State->cs[0] != ASCII && (StateEnum)pToU2022State->cs[0] != JISX201) { -// pToU2022State->cs[0] = (int8_t)ASCII; -// } -// pToU2022State->cs[2] = 0; -// pToU2022State->g = 0; -// U_FALLTHROUGH; -// default: -// /* convert one or two bytes */ -// myData->isEmptySegment = FALSE; -// cs = (StateEnum)pToU2022State->cs[pToU2022State->g]; -// if( (uint8_t)(mySourceChar - 0xa1) <= (0xdf - 0xa1) && myData->version==4 && -// !IS_JP_DBCS(cs) -// ) { -// /* 8-bit halfwidth katakana in any single-byte mode for JIS8 */ -// targetUniChar = mySourceChar + (HWKANA_START - 0xa1); - -// /* return from a single-shift state to the previous one */ -// if(pToU2022State->g >= 2) { -// pToU2022State->g=pToU2022State->prevG; -// } -// } else switch(cs) { -// case ASCII: -// if(mySourceChar <= 0x7f) { -// targetUniChar = mySourceChar; -// } -// break; -// case ISO8859_1: -// if(mySourceChar <= 0x7f) { -// targetUniChar = mySourceChar + 0x80; -// } -// /* return from a single-shift state to the previous one */ -// pToU2022State->g=pToU2022State->prevG; -// break; -// case ISO8859_7: -// if(mySourceChar <= 0x7f) { -// /* convert mySourceChar+0x80 to use a normal 8-bit table */ -// targetUniChar = -// _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP( -// myData->myConverterArray[cs], -// mySourceChar + 0x80); -// } -// /* return from a single-shift state to the previous one */ -// pToU2022State->g=pToU2022State->prevG; -// break; -// case JISX201: -// if(mySourceChar <= 0x7f) { -// targetUniChar = jisx201ToU(mySourceChar); -// } -// break; -// case HWKANA_7BIT: -// if((uint8_t)(mySourceChar - 0x21) <= (0x5f - 0x21)) { -// /* 7-bit halfwidth Katakana */ -// targetUniChar = mySourceChar + (HWKANA_START - 0x21); -// } -// break; -// default: -// /* G0 DBCS */ -// if(mySource < mySourceLimit) { -// int leadIsOk, trailIsOk; -// uint8_t trailByte; -// getTrailByte: -// trailByte = (uint8_t)*mySource; -// /* -// * Ticket 5691: consistent illegal sequences: -// * - We include at least the first byte in the illegal sequence. -// * - If any of the non-initial bytes could be the start of a character, -// * we stop the illegal sequence before the first one of those. -// * -// * In ISO-2022 DBCS, if the second byte is in the 21..7e range or is -// * an ESC/SO/SI, we report only the first byte as the illegal sequence. -// * Otherwise we convert or report the pair of bytes. -// */ -// leadIsOk = (uint8_t)(mySourceChar - 0x21) <= (0x7e - 0x21); -// trailIsOk = (uint8_t)(trailByte - 0x21) <= (0x7e - 0x21); -// if (leadIsOk && trailIsOk) { -// ++mySource; -// tmpSourceChar = (mySourceChar << 8) | trailByte; -// if(cs == JISX208) { -// _2022ToSJIS((uint8_t)mySourceChar, trailByte, tempBuf); -// mySourceChar = tmpSourceChar; -// } else { -// /* Copy before we modify tmpSourceChar so toUnicodeCallback() sees the correct bytes. */ -// mySourceChar = tmpSourceChar; -// if (cs == KSC5601) { -// tmpSourceChar += 0x8080; /* = _2022ToGR94DBCS(tmpSourceChar) */ -// } -// tempBuf[0] = (char)(tmpSourceChar >> 8); -// tempBuf[1] = (char)(tmpSourceChar); -// } -// targetUniChar = ucnv_MBCSSimpleGetNextUChar(myData->myConverterArray[cs], tempBuf, 2, FALSE); -// } else if (!(trailIsOk || IS_2022_CONTROL(trailByte))) { -// /* report a pair of illegal bytes if the second byte is not a DBCS starter */ -// ++mySource; -// /* add another bit so that the code below writes 2 bytes in case of error */ -// mySourceChar = 0x10000 | (mySourceChar << 8) | trailByte; -// } -// } else { -// args->converter->toUBytes[0] = (uint8_t)mySourceChar; -// args->converter->toULength = 1; -// goto endloop; -// } -// } /* End of inner switch */ -// break; -// } /* End of outer switch */ -// if(targetUniChar < (missingCharMarker-1/*0xfffe*/)){ -// if(args->offsets){ -// args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2)); -// } -// *(myTarget++)=(UChar)targetUniChar; -// } -// else if(targetUniChar > missingCharMarker){ -// /* disassemble the surrogate pair and write to output*/ -// targetUniChar-=0x0010000; -// *myTarget = (UChar)(0xd800+(UChar)(targetUniChar>>10)); -// if(args->offsets){ -// args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2)); -// } -// ++myTarget; -// if(myTarget< args->targetLimit){ -// *myTarget = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff)); -// if(args->offsets){ -// args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2)); -// } -// ++myTarget; -// }else{ -// args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= -// (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff)); -// } - -// } -// else{ -// /* Call the callback function*/ -// toUnicodeCallback(args->converter,mySourceChar,targetUniChar,err); -// break; -// } -// } -// else{ /* goes with "if(myTarget < args->targetLimit)" way up near top of function */ -// *err =U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// endloop: -// args->target = myTarget; -// args->source = mySource; -// } - - -// #if !UCONFIG_ONLY_HTML_CONVERSION -// /*************************************************************** -// * Rules for ISO-2022-KR encoding -// * i) The KSC5601 designator sequence should appear only once in a file, -// * at the begining of a line before any KSC5601 characters. This usually -// * means that it appears by itself on the first line of the file -// * ii) There are only 2 shifting sequences SO to shift into double byte mode -// * and SI to shift into single byte mode -// */ -// static void U_CALLCONV -// UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(UConverterFromUnicodeArgs* args, UErrorCode* err){ - -// UConverter* saveConv = args->converter; -// UConverterDataISO2022 *myConverterData=(UConverterDataISO2022*)saveConv->extraInfo; -// args->converter=myConverterData->currentConverter; - -// myConverterData->currentConverter->fromUChar32 = saveConv->fromUChar32; -// ucnv_MBCSFromUnicodeWithOffsets(args,err); -// saveConv->fromUChar32 = myConverterData->currentConverter->fromUChar32; - -// if(*err == U_BUFFER_OVERFLOW_ERROR) { -// if(myConverterData->currentConverter->charErrorBufferLength > 0) { -// uprv_memcpy( -// saveConv->charErrorBuffer, -// myConverterData->currentConverter->charErrorBuffer, -// myConverterData->currentConverter->charErrorBufferLength); -// } -// saveConv->charErrorBufferLength = myConverterData->currentConverter->charErrorBufferLength; -// myConverterData->currentConverter->charErrorBufferLength = 0; -// } -// args->converter=saveConv; -// } - -// static void U_CALLCONV -// UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args, UErrorCode* err){ - -// const UChar *source = args->source; -// const UChar *sourceLimit = args->sourceLimit; -// unsigned char *target = (unsigned char *) args->target; -// unsigned char *targetLimit = (unsigned char *) args->targetLimit; -// int32_t* offsets = args->offsets; -// uint32_t targetByteUnit = 0x0000; -// UChar32 sourceChar = 0x0000; -// UBool isTargetByteDBCS; -// UBool oldIsTargetByteDBCS; -// UConverterDataISO2022 *converterData; -// UConverterSharedData* sharedData; -// UBool useFallback; -// int32_t length =0; - -// converterData=(UConverterDataISO2022*)args->converter->extraInfo; -// /* if the version is 1 then the user is requesting -// * conversion with ibm-25546 pass the arguments to -// * MBCS converter and return -// */ -// if(converterData->version==1){ -// UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(args,err); -// return; -// } - -// /* initialize data */ -// sharedData = converterData->currentConverter->sharedData; -// useFallback = args->converter->useFallback; -// isTargetByteDBCS=(UBool)args->converter->fromUnicodeStatus; -// oldIsTargetByteDBCS = isTargetByteDBCS; - -// isTargetByteDBCS = (UBool) args->converter->fromUnicodeStatus; -// if((sourceChar = args->converter->fromUChar32)!=0 && target targetLimit){ -// sourceChar = *source++; - -// /* do not convert SO/SI/ESC */ -// if(IS_2022_CONTROL(sourceChar)) { -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// args->converter->fromUChar32=sourceChar; -// break; -// } - -// length = MBCS_FROM_UCHAR32_ISO2022(sharedData,sourceChar,&targetByteUnit,useFallback,MBCS_OUTPUT_2); -// if(length < 0) { -// length = -length; /* fallback */ -// } -// /* only DBCS or SBCS characters are expected*/ -// /* DB characters with high bit set to 1 are expected */ -// if( length > 2 || length==0 || -// (length == 1 && targetByteUnit > 0x7f) || -// (length == 2 && -// ((uint16_t)(targetByteUnit - 0xa1a1) > (0xfefe - 0xa1a1) || -// (uint8_t)(targetByteUnit - 0xa1) > (0xfe - 0xa1))) -// ) { -// targetByteUnit=missingCharMarker; -// } -// if (targetByteUnit != missingCharMarker){ - -// oldIsTargetByteDBCS = isTargetByteDBCS; -// isTargetByteDBCS = (UBool)(targetByteUnit>0x00FF); -// /* append the shift sequence */ -// if (oldIsTargetByteDBCS != isTargetByteDBCS ){ - -// if (isTargetByteDBCS) -// *target++ = UCNV_SO; -// else -// *target++ = UCNV_SI; -// if(offsets) -// *(offsets++) = (int32_t)(source - args->source-1); -// } -// /* write the targetUniChar to target */ -// if(targetByteUnit <= 0x00FF){ -// if( target < targetLimit){ -// *(target++) = (unsigned char) targetByteUnit; -// if(offsets){ -// *(offsets++) = (int32_t)(source - args->source-1); -// } - -// }else{ -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (unsigned char) (targetByteUnit); -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// }else{ -// if(target < targetLimit){ -// *(target++) =(unsigned char) ((targetByteUnit>>8) -0x80); -// if(offsets){ -// *(offsets++) = (int32_t)(source - args->source-1); -// } -// if(target < targetLimit){ -// *(target++) =(unsigned char) (targetByteUnit -0x80); -// if(offsets){ -// *(offsets++) = (int32_t)(source - args->source-1); -// } -// }else{ -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (unsigned char) (targetByteUnit -0x80); -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// }else{ -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (unsigned char) ((targetByteUnit>>8) -0x80); -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (unsigned char) (targetByteUnit-0x80); -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } - -// } -// else{ -// /* oops.. the code point is unassingned -// * set the error and reason -// */ - -// /*check if the char is a First surrogate*/ -// if(U16_IS_SURROGATE(sourceChar)) { -// if(U16_IS_SURROGATE_LEAD(sourceChar)) { -// getTrail: -// /*look ahead to find the trail surrogate*/ -// if(source < sourceLimit) { -// /* test the following code unit */ -// UChar trail=(UChar) *source; -// if(U16_IS_TRAIL(trail)) { -// source++; -// sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail); -// *err = U_INVALID_CHAR_FOUND; -// /* convert this surrogate code point */ -// /* exit this condition tree */ -// } else { -// /* this is an unmatched lead code unit (1st surrogate) */ -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// } -// } else { -// /* no more input */ -// *err = U_ZERO_ERROR; -// } -// } else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// } -// } else { -// /* callback(unassigned) for a BMP code point */ -// *err = U_INVALID_CHAR_FOUND; -// } - -// args->converter->fromUChar32=sourceChar; -// break; -// } -// } /* end if(myTargetIndexflush && source>=sourceLimit && args->converter->fromUChar32==0 -// ) { -// int32_t sourceIndex; - -// /* we are switching to ASCII */ -// isTargetByteDBCS=FALSE; - -// /* get the source index of the last input character */ -// /* -// * TODO this would be simpler and more reliable if we used a pair -// * of sourceIndex/prevSourceIndex like in ucnvmbcs.c -// * so that we could simply use the prevSourceIndex here; -// * this code gives an incorrect result for the rare case of an unmatched -// * trail surrogate that is alone in the last buffer of the text stream -// */ -// sourceIndex=(int32_t)(source-args->source); -// if(sourceIndex>0) { -// --sourceIndex; -// if( U16_IS_TRAIL(args->source[sourceIndex]) && -// (sourceIndex==0 || U16_IS_LEAD(args->source[sourceIndex-1])) -// ) { -// --sourceIndex; -// } -// } else { -// sourceIndex=-1; -// } - -// fromUWriteUInt8( -// args->converter, -// SHIFT_IN_STR, 1, -// &target, (const char *)targetLimit, -// &offsets, sourceIndex, -// err); -// } - -// /*save the state and return */ -// args->source = source; -// args->target = (char*)target; -// args->converter->fromUnicodeStatus = (uint32_t)isTargetByteDBCS; -// } - -// /************************ To Unicode ***************************************/ - -// static void U_CALLCONV -// UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(UConverterToUnicodeArgs *args, -// UErrorCode* err){ -// char const* sourceStart; -// UConverterDataISO2022* myData=(UConverterDataISO2022*)(args->converter->extraInfo); - -// UConverterToUnicodeArgs subArgs; -// int32_t minArgsSize; - -// /* set up the subconverter arguments */ -// if(args->sizesize; -// } else { -// minArgsSize = (int32_t)sizeof(UConverterToUnicodeArgs); -// } - -// uprv_memcpy(&subArgs, args, minArgsSize); -// subArgs.size = (uint16_t)minArgsSize; -// subArgs.converter = myData->currentConverter; - -// /* remember the original start of the input for offsets */ -// sourceStart = args->source; - -// if(myData->key != 0) { -// /* continue with a partial escape sequence */ -// goto escape; -// } - -// while(U_SUCCESS(*err) && args->source < args->sourceLimit) { -// /*Find the end of the buffer e.g : Next Escape Seq | end of Buffer*/ -// subArgs.source = args->source; -// subArgs.sourceLimit = getEndOfBuffer_2022(&(args->source), args->sourceLimit, args->flush); -// if(subArgs.source != subArgs.sourceLimit) { -// /* -// * get the current partial byte sequence -// * -// * it needs to be moved between the public and the subconverter -// * so that the conversion framework, which only sees the public -// * converter, can handle truncated and illegal input etc. -// */ -// if(args->converter->toULength > 0) { -// uprv_memcpy(subArgs.converter->toUBytes, args->converter->toUBytes, args->converter->toULength); -// } -// subArgs.converter->toULength = args->converter->toULength; - -// /* -// * Convert up to the end of the input, or to before the next escape character. -// * Does not handle conversion extensions because the preToU[] state etc. -// * is not copied. -// */ -// ucnv_MBCSToUnicodeWithOffsets(&subArgs, err); - -// if(args->offsets != NULL && sourceStart != args->source) { -// /* update offsets to base them on the actual start of the input */ -// int32_t *offsets = args->offsets; -// UChar *target = args->target; -// int32_t delta = (int32_t)(args->source - sourceStart); -// while(target < subArgs.target) { -// if(*offsets >= 0) { -// *offsets += delta; -// } -// ++offsets; -// ++target; -// } -// } -// args->source = subArgs.source; -// args->target = subArgs.target; -// args->offsets = subArgs.offsets; - -// /* copy input/error/overflow buffers */ -// if(subArgs.converter->toULength > 0) { -// uprv_memcpy(args->converter->toUBytes, subArgs.converter->toUBytes, subArgs.converter->toULength); -// } -// args->converter->toULength = subArgs.converter->toULength; - -// if(*err == U_BUFFER_OVERFLOW_ERROR) { -// if(subArgs.converter->UCharErrorBufferLength > 0) { -// uprv_memcpy(args->converter->UCharErrorBuffer, subArgs.converter->UCharErrorBuffer, -// subArgs.converter->UCharErrorBufferLength); -// } -// args->converter->UCharErrorBufferLength=subArgs.converter->UCharErrorBufferLength; -// subArgs.converter->UCharErrorBufferLength = 0; -// } -// } - -// if (U_FAILURE(*err) || (args->source == args->sourceLimit)) { -// return; -// } - -// escape: -// changeState_2022(args->converter, -// &(args->source), -// args->sourceLimit, -// ISO_2022_KR, -// err); -// } -// } - -// static void U_CALLCONV -// UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, -// UErrorCode* err){ -// char tempBuf[2]; -// const char *mySource = ( char *) args->source; -// UChar *myTarget = args->target; -// const char *mySourceLimit = args->sourceLimit; -// UChar32 targetUniChar = 0x0000; -// UChar mySourceChar = 0x0000; -// UConverterDataISO2022* myData; -// UConverterSharedData* sharedData ; -// UBool useFallback; - -// myData=(UConverterDataISO2022*)(args->converter->extraInfo); -// if(myData->version==1){ -// UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(args,err); -// return; -// } - -// /* initialize state */ -// sharedData = myData->currentConverter->sharedData; -// useFallback = args->converter->useFallback; - -// if(myData->key != 0) { -// /* continue with a partial escape sequence */ -// goto escape; -// } else if(args->converter->toULength == 1 && mySource < mySourceLimit && myTarget < args->targetLimit) { -// /* continue with a partial double-byte character */ -// mySourceChar = args->converter->toUBytes[0]; -// args->converter->toULength = 0; -// goto getTrailByte; -// } - -// while(mySource< mySourceLimit){ - -// if(myTarget < args->targetLimit){ - -// mySourceChar= (unsigned char) *mySource++; - -// if(mySourceChar==UCNV_SI){ -// myData->toU2022State.g = 0; -// if (myData->isEmptySegment) { -// myData->isEmptySegment = FALSE; /* we are handling it, reset to avoid future spurious errors */ -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// args->converter->toUCallbackReason = UCNV_IRREGULAR; -// args->converter->toUBytes[0] = (uint8_t)mySourceChar; -// args->converter->toULength = 1; -// args->target = myTarget; -// args->source = mySource; -// return; -// } -// /*consume the source */ -// continue; -// }else if(mySourceChar==UCNV_SO){ -// myData->toU2022State.g = 1; -// myData->isEmptySegment = TRUE; /* Begin a new segment, empty so far */ -// /*consume the source */ -// continue; -// }else if(mySourceChar==ESC_2022){ -// mySource--; -// escape: -// myData->isEmptySegment = FALSE; /* Any invalid ESC sequences will be detected separately, so just reset this */ -// changeState_2022(args->converter,&(mySource), -// mySourceLimit, ISO_2022_KR, err); -// if(U_FAILURE(*err)){ -// args->target = myTarget; -// args->source = mySource; -// return; -// } -// continue; -// } - -// myData->isEmptySegment = FALSE; /* Any invalid char errors will be detected separately, so just reset this */ -// if(myData->toU2022State.g == 1) { -// if(mySource < mySourceLimit) { -// int leadIsOk, trailIsOk; -// uint8_t trailByte; -// getTrailByte: -// targetUniChar = missingCharMarker; -// trailByte = (uint8_t)*mySource; -// /* -// * Ticket 5691: consistent illegal sequences: -// * - We include at least the first byte in the illegal sequence. -// * - If any of the non-initial bytes could be the start of a character, -// * we stop the illegal sequence before the first one of those. -// * -// * In ISO-2022 DBCS, if the second byte is in the 21..7e range or is -// * an ESC/SO/SI, we report only the first byte as the illegal sequence. -// * Otherwise we convert or report the pair of bytes. -// */ -// leadIsOk = (uint8_t)(mySourceChar - 0x21) <= (0x7e - 0x21); -// trailIsOk = (uint8_t)(trailByte - 0x21) <= (0x7e - 0x21); -// if (leadIsOk && trailIsOk) { -// ++mySource; -// tempBuf[0] = (char)(mySourceChar + 0x80); -// tempBuf[1] = (char)(trailByte + 0x80); -// targetUniChar = ucnv_MBCSSimpleGetNextUChar(sharedData, tempBuf, 2, useFallback); -// mySourceChar = (mySourceChar << 8) | trailByte; -// } else if (!(trailIsOk || IS_2022_CONTROL(trailByte))) { -// /* report a pair of illegal bytes if the second byte is not a DBCS starter */ -// ++mySource; -// /* add another bit so that the code below writes 2 bytes in case of error */ -// mySourceChar = static_cast(0x10000 | (mySourceChar << 8) | trailByte); -// } -// } else { -// args->converter->toUBytes[0] = (uint8_t)mySourceChar; -// args->converter->toULength = 1; -// break; -// } -// } -// else if(mySourceChar <= 0x7f) { -// targetUniChar = ucnv_MBCSSimpleGetNextUChar(sharedData, mySource - 1, 1, useFallback); -// } else { -// targetUniChar = 0xffff; -// } -// if(targetUniChar < 0xfffe){ -// if(args->offsets) { -// args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2)); -// } -// *(myTarget++)=(UChar)targetUniChar; -// } -// else { -// /* Call the callback function*/ -// toUnicodeCallback(args->converter,mySourceChar,targetUniChar,err); -// break; -// } -// } -// else{ -// *err =U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// args->target = myTarget; -// args->source = mySource; -// } - -// /*************************** END ISO2022-KR *********************************/ - -// /*************************** ISO-2022-CN ********************************* -// * -// * Rules for ISO-2022-CN Encoding: -// * i) The designator sequence must appear once on a line before any instance -// * of character set it designates. -// * ii) If two lines contain characters from the same character set, both lines -// * must include the designator sequence. -// * iii) Once the designator sequence is known, a shifting sequence has to be found -// * to invoke the shifting -// * iv) All lines start in ASCII and end in ASCII. -// * v) Four shifting sequences are employed for this purpose: -// * -// * Sequcence ASCII Eq Charsets -// * ---------- ------- --------- -// * SI US-ASCII -// * SO CNS-11643-1992 Plane 1, GB2312, ISO-IR-165 -// * SS2 N CNS-11643-1992 Plane 2 -// * SS3 O CNS-11643-1992 Planes 3-7 -// * -// * vi) -// * SOdesignator : ESC "$" ")" finalchar_for_SO -// * SS2designator : ESC "$" "*" finalchar_for_SS2 -// * SS3designator : ESC "$" "+" finalchar_for_SS3 -// * -// * ESC $ ) A Indicates the bytes following SO are Chinese -// * characters as defined in GB 2312-80, until -// * another SOdesignation appears -// * -// * -// * ESC $ ) E Indicates the bytes following SO are as defined -// * in ISO-IR-165 (for details, see section 2.1), -// * until another SOdesignation appears -// * -// * ESC $ ) G Indicates the bytes following SO are as defined -// * in CNS 11643-plane-1, until another -// * SOdesignation appears -// * -// * ESC $ * H Indicates the two bytes immediately following -// * SS2 is a Chinese character as defined in CNS -// * 11643-plane-2, until another SS2designation -// * appears -// * (Meaning N must preceed every 2 byte -// * sequence.) -// * -// * ESC $ + I Indicates the immediate two bytes following SS3 -// * is a Chinese character as defined in CNS -// * 11643-plane-3, until another SS3designation -// * appears -// * (Meaning O must preceed every 2 byte -// * sequence.) -// * -// * ESC $ + J Indicates the immediate two bytes following SS3 -// * is a Chinese character as defined in CNS -// * 11643-plane-4, until another SS3designation -// * appears -// * (In English: O must preceed every 2 byte -// * sequence.) -// * -// * ESC $ + K Indicates the immediate two bytes following SS3 -// * is a Chinese character as defined in CNS -// * 11643-plane-5, until another SS3designation -// * appears -// * -// * ESC $ + L Indicates the immediate two bytes following SS3 -// * is a Chinese character as defined in CNS -// * 11643-plane-6, until another SS3designation -// * appears -// * -// * ESC $ + M Indicates the immediate two bytes following SS3 -// * is a Chinese character as defined in CNS -// * 11643-plane-7, until another SS3designation -// * appears -// * -// * As in ISO-2022-CN, each line starts in ASCII, and ends in ASCII, and -// * has its own designation information before any Chinese characters -// * appear -// * -// */ - -// /* The following are defined this way to make the strings truly readonly */ -// static const char GB_2312_80_STR[] = "\x1B\x24\x29\x41"; -// static const char ISO_IR_165_STR[] = "\x1B\x24\x29\x45"; -// static const char CNS_11643_1992_Plane_1_STR[] = "\x1B\x24\x29\x47"; -// static const char CNS_11643_1992_Plane_2_STR[] = "\x1B\x24\x2A\x48"; -// static const char CNS_11643_1992_Plane_3_STR[] = "\x1B\x24\x2B\x49"; -// static const char CNS_11643_1992_Plane_4_STR[] = "\x1B\x24\x2B\x4A"; -// static const char CNS_11643_1992_Plane_5_STR[] = "\x1B\x24\x2B\x4B"; -// static const char CNS_11643_1992_Plane_6_STR[] = "\x1B\x24\x2B\x4C"; -// static const char CNS_11643_1992_Plane_7_STR[] = "\x1B\x24\x2B\x4D"; - -// /********************** ISO2022-CN Data **************************/ -// static const char* const escSeqCharsCN[10] ={ -// SHIFT_IN_STR, /* 0 ASCII */ -// GB_2312_80_STR, /* 1 GB2312_1 */ -// ISO_IR_165_STR, /* 2 ISO_IR_165 */ -// CNS_11643_1992_Plane_1_STR, -// CNS_11643_1992_Plane_2_STR, -// CNS_11643_1992_Plane_3_STR, -// CNS_11643_1992_Plane_4_STR, -// CNS_11643_1992_Plane_5_STR, -// CNS_11643_1992_Plane_6_STR, -// CNS_11643_1992_Plane_7_STR -// }; - -// static void U_CALLCONV -// UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args, UErrorCode* err){ -// UConverter *cnv = args->converter; -// UConverterDataISO2022 *converterData; -// ISO2022State *pFromU2022State; -// uint8_t *target = (uint8_t *) args->target; -// const uint8_t *targetLimit = (const uint8_t *) args->targetLimit; -// const UChar* source = args->source; -// const UChar* sourceLimit = args->sourceLimit; -// int32_t* offsets = args->offsets; -// UChar32 sourceChar; -// char buffer[8]; -// int32_t len; -// int8_t choices[3]; -// int32_t choiceCount; -// uint32_t targetValue = 0; -// UBool useFallback; - -// /* set up the state */ -// converterData = (UConverterDataISO2022*)cnv->extraInfo; -// pFromU2022State = &converterData->fromU2022State; - -// choiceCount = 0; - -// /* check if the last codepoint of previous buffer was a lead surrogate*/ -// if((sourceChar = cnv->fromUChar32)!=0 && target< targetLimit) { -// goto getTrail; -// } - -// while( source < sourceLimit){ -// if(target < targetLimit){ - -// sourceChar = *(source++); -// /*check if the char is a First surrogate*/ -// if(U16_IS_SURROGATE(sourceChar)) { -// if(U16_IS_SURROGATE_LEAD(sourceChar)) { -// getTrail: -// /*look ahead to find the trail surrogate*/ -// if(source < sourceLimit) { -// /* test the following code unit */ -// UChar trail=(UChar) *source; -// if(U16_IS_TRAIL(trail)) { -// source++; -// sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail); -// cnv->fromUChar32=0x00; -// /* convert this supplementary code point */ -// /* exit this condition tree */ -// } else { -// /* this is an unmatched lead code unit (1st surrogate) */ -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } -// } else { -// /* no more input */ -// cnv->fromUChar32=sourceChar; -// break; -// } -// } else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } -// } - -// /* do the conversion */ -// if(sourceChar <= 0x007f ){ -// /* do not convert SO/SI/ESC */ -// if(IS_2022_CONTROL(sourceChar)) { -// /* callback(illegal) */ -// *err=U_ILLEGAL_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } - -// /* US-ASCII */ -// if(pFromU2022State->g == 0) { -// buffer[0] = (char)sourceChar; -// len = 1; -// } else { -// buffer[0] = UCNV_SI; -// buffer[1] = (char)sourceChar; -// len = 2; -// pFromU2022State->g = 0; -// choiceCount = 0; -// } -// if(sourceChar == CR || sourceChar == LF) { -// /* reset the state at the end of a line */ -// uprv_memset(pFromU2022State, 0, sizeof(ISO2022State)); -// choiceCount = 0; -// } -// } -// else{ -// /* convert U+0080..U+10ffff */ -// int32_t i; -// int8_t cs, g; - -// if(choiceCount == 0) { -// /* try the current SO/G1 converter first */ -// choices[0] = pFromU2022State->cs[1]; - -// /* default to GB2312_1 if none is designated yet */ -// if(choices[0] == 0) { -// choices[0] = GB2312_1; -// } - -// if(converterData->version == 0) { -// /* ISO-2022-CN */ - -// /* try the other SO/G1 converter; a CNS_11643_1 lookup may result in any plane */ -// if(choices[0] == GB2312_1) { -// choices[1] = (int8_t)CNS_11643_1; -// } else { -// choices[1] = (int8_t)GB2312_1; -// } - -// choiceCount = 2; -// } else if (converterData->version == 1) { -// /* ISO-2022-CN-EXT */ - -// /* try one of the other converters */ -// switch(choices[0]) { -// case GB2312_1: -// choices[1] = (int8_t)CNS_11643_1; -// choices[2] = (int8_t)ISO_IR_165; -// break; -// case ISO_IR_165: -// choices[1] = (int8_t)GB2312_1; -// choices[2] = (int8_t)CNS_11643_1; -// break; -// default: /* CNS_11643_x */ -// choices[1] = (int8_t)GB2312_1; -// choices[2] = (int8_t)ISO_IR_165; -// break; -// } - -// choiceCount = 3; -// } else { -// choices[0] = (int8_t)CNS_11643_1; -// choices[1] = (int8_t)GB2312_1; -// } -// } - -// cs = g = 0; -// /* -// * len==0: no mapping found yet -// * len<0: found a fallback result: continue looking for a roundtrip but no further fallbacks -// * len>0: found a roundtrip result, done -// */ -// len = 0; -// /* -// * We will turn off useFallback after finding a fallback, -// * but we still get fallbacks from PUA code points as usual. -// * Therefore, we will also need to check that we don't overwrite -// * an early fallback with a later one. -// */ -// useFallback = cnv->useFallback; - -// for(i = 0; i < choiceCount && len <= 0; ++i) { -// int8_t cs0 = choices[i]; -// if(cs0 > 0) { -// uint32_t value; -// int32_t len2; -// if(cs0 >= CNS_11643_0) { -// len2 = MBCS_FROM_UCHAR32_ISO2022( -// converterData->myConverterArray[CNS_11643], -// sourceChar, -// &value, -// useFallback, -// MBCS_OUTPUT_3); -// if(len2 == 3 || (len2 == -3 && len == 0)) { -// targetValue = value; -// cs = (int8_t)(CNS_11643_0 + (value >> 16) - 0x80); -// if(len2 >= 0) { -// len = 2; -// } else { -// len = -2; -// useFallback = FALSE; -// } -// if(cs == CNS_11643_1) { -// g = 1; -// } else if(cs == CNS_11643_2) { -// g = 2; -// } else /* plane 3..7 */ if(converterData->version == 1) { -// g = 3; -// } else { -// /* ISO-2022-CN (without -EXT) does not support plane 3..7 */ -// len = 0; -// } -// } -// } else { -// /* GB2312_1 or ISO-IR-165 */ -// U_ASSERT(cs0myConverterArray[cs0], -// sourceChar, -// &value, -// useFallback, -// MBCS_OUTPUT_2); -// if(len2 == 2 || (len2 == -2 && len == 0)) { -// targetValue = value; -// len = len2; -// cs = cs0; -// g = 1; -// useFallback = FALSE; -// } -// } -// } -// } - -// if(len != 0) { -// len = 0; /* count output bytes; it must have been abs(len) == 2 */ - -// /* write the designation sequence if necessary */ -// if(cs != pFromU2022State->cs[g]) { -// if(cs < CNS_11643) { -// uprv_memcpy(buffer, escSeqCharsCN[cs], 4); -// } else { -// U_ASSERT(cs >= CNS_11643_1); -// uprv_memcpy(buffer, escSeqCharsCN[CNS_11643 + (cs - CNS_11643_1)], 4); -// } -// len = 4; -// pFromU2022State->cs[g] = cs; -// if(g == 1) { -// /* changing the SO/G1 charset invalidates the choices[] */ -// choiceCount = 0; -// } -// } - -// /* write the shift sequence if necessary */ -// if(g != pFromU2022State->g) { -// switch(g) { -// case 1: -// buffer[len++] = UCNV_SO; - -// /* set the new state only if it is the locking shift SO/G1, not for SS2 or SS3 */ -// pFromU2022State->g = 1; -// break; -// case 2: -// buffer[len++] = 0x1b; -// buffer[len++] = 0x4e; -// break; -// default: /* case 3 */ -// buffer[len++] = 0x1b; -// buffer[len++] = 0x4f; -// break; -// } -// } - -// /* write the two output bytes */ -// buffer[len++] = (char)(targetValue >> 8); -// buffer[len++] = (char)targetValue; -// } else { -// /* if we cannot find the character after checking all codepages -// * then this is an error -// */ -// *err = U_INVALID_CHAR_FOUND; -// cnv->fromUChar32=sourceChar; -// break; -// } -// } - -// /* output len>0 bytes in buffer[] */ -// if(len == 1) { -// *target++ = buffer[0]; -// if(offsets) { -// *offsets++ = (int32_t)(source - args->source - 1); /* -1: known to be ASCII */ -// } -// } else if(len == 2 && (target + 2) <= targetLimit) { -// *target++ = buffer[0]; -// *target++ = buffer[1]; -// if(offsets) { -// int32_t sourceIndex = (int32_t)(source - args->source - U16_LENGTH(sourceChar)); -// *offsets++ = sourceIndex; -// *offsets++ = sourceIndex; -// } -// } else { -// fromUWriteUInt8( -// cnv, -// buffer, len, -// &target, (const char *)targetLimit, -// &offsets, (int32_t)(source - args->source - U16_LENGTH(sourceChar)), -// err); -// if(U_FAILURE(*err)) { -// break; -// } -// } -// } /* end if(myTargetIndexg!=0 && -// args->flush && source>=sourceLimit && cnv->fromUChar32==0 -// ) { -// int32_t sourceIndex; - -// /* we are switching to ASCII */ -// pFromU2022State->g=0; - -// /* get the source index of the last input character */ -// /* -// * TODO this would be simpler and more reliable if we used a pair -// * of sourceIndex/prevSourceIndex like in ucnvmbcs.c -// * so that we could simply use the prevSourceIndex here; -// * this code gives an incorrect result for the rare case of an unmatched -// * trail surrogate that is alone in the last buffer of the text stream -// */ -// sourceIndex=(int32_t)(source-args->source); -// if(sourceIndex>0) { -// --sourceIndex; -// if( U16_IS_TRAIL(args->source[sourceIndex]) && -// (sourceIndex==0 || U16_IS_LEAD(args->source[sourceIndex-1])) -// ) { -// --sourceIndex; -// } -// } else { -// sourceIndex=-1; -// } - -// fromUWriteUInt8( -// cnv, -// SHIFT_IN_STR, 1, -// &target, (const char *)targetLimit, -// &offsets, sourceIndex, -// err); -// } - -// /*save the state and return */ -// args->source = source; -// args->target = (char*)target; -// } - - -// static void U_CALLCONV -// UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, -// UErrorCode* err){ -// char tempBuf[3]; -// const char *mySource = (char *) args->source; -// UChar *myTarget = args->target; -// const char *mySourceLimit = args->sourceLimit; -// uint32_t targetUniChar = 0x0000; -// uint32_t mySourceChar = 0x0000; -// UConverterDataISO2022* myData; -// ISO2022State *pToU2022State; - -// myData=(UConverterDataISO2022*)(args->converter->extraInfo); -// pToU2022State = &myData->toU2022State; - -// if(myData->key != 0) { -// /* continue with a partial escape sequence */ -// goto escape; -// } else if(args->converter->toULength == 1 && mySource < mySourceLimit && myTarget < args->targetLimit) { -// /* continue with a partial double-byte character */ -// mySourceChar = args->converter->toUBytes[0]; -// args->converter->toULength = 0; -// targetUniChar = missingCharMarker; -// goto getTrailByte; -// } - -// while(mySource < mySourceLimit){ - -// targetUniChar =missingCharMarker; - -// if(myTarget < args->targetLimit){ - -// mySourceChar= (unsigned char) *mySource++; - -// switch(mySourceChar){ -// case UCNV_SI: -// pToU2022State->g=0; -// if (myData->isEmptySegment) { -// myData->isEmptySegment = FALSE; /* we are handling it, reset to avoid future spurious errors */ -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// args->converter->toUCallbackReason = UCNV_IRREGULAR; -// args->converter->toUBytes[0] = static_cast(mySourceChar); -// args->converter->toULength = 1; -// args->target = myTarget; -// args->source = mySource; -// return; -// } -// continue; - -// case UCNV_SO: -// if(pToU2022State->cs[1] != 0) { -// pToU2022State->g=1; -// myData->isEmptySegment = TRUE; /* Begin a new segment, empty so far */ -// continue; -// } else { -// /* illegal to have SO before a matching designator */ -// myData->isEmptySegment = FALSE; /* Handling a different error, reset this to avoid future spurious errs */ -// break; -// } - -// case ESC_2022: -// mySource--; -// escape: -// { -// const char * mySourceBefore = mySource; -// int8_t toULengthBefore = args->converter->toULength; - -// changeState_2022(args->converter,&(mySource), -// mySourceLimit, ISO_2022_CN,err); - -// /* After SO there must be at least one character before a designator (designator error handled separately) */ -// if(myData->key==0 && U_SUCCESS(*err) && myData->isEmptySegment) { -// *err = U_ILLEGAL_ESCAPE_SEQUENCE; -// args->converter->toUCallbackReason = UCNV_IRREGULAR; -// args->converter->toULength = (int8_t)(toULengthBefore + (mySource - mySourceBefore)); -// } -// } - -// /* invalid or illegal escape sequence */ -// if(U_FAILURE(*err)){ -// args->target = myTarget; -// args->source = mySource; -// myData->isEmptySegment = FALSE; /* Reset to avoid future spurious errors */ -// return; -// } -// continue; - -// /* ISO-2022-CN does not use single-byte (C1) SS2 and SS3 */ - -// case CR: -// case LF: -// uprv_memset(pToU2022State, 0, sizeof(ISO2022State)); -// U_FALLTHROUGH; -// default: -// /* convert one or two bytes */ -// myData->isEmptySegment = FALSE; -// if(pToU2022State->g != 0) { -// if(mySource < mySourceLimit) { -// UConverterSharedData *cnv; -// StateEnum tempState; -// int32_t tempBufLen; -// int leadIsOk, trailIsOk; -// uint8_t trailByte; -// getTrailByte: -// trailByte = (uint8_t)*mySource; -// /* -// * Ticket 5691: consistent illegal sequences: -// * - We include at least the first byte in the illegal sequence. -// * - If any of the non-initial bytes could be the start of a character, -// * we stop the illegal sequence before the first one of those. -// * -// * In ISO-2022 DBCS, if the second byte is in the 21..7e range or is -// * an ESC/SO/SI, we report only the first byte as the illegal sequence. -// * Otherwise we convert or report the pair of bytes. -// */ -// leadIsOk = (uint8_t)(mySourceChar - 0x21) <= (0x7e - 0x21); -// trailIsOk = (uint8_t)(trailByte - 0x21) <= (0x7e - 0x21); -// if (leadIsOk && trailIsOk) { -// ++mySource; -// tempState = (StateEnum)pToU2022State->cs[pToU2022State->g]; -// if(tempState >= CNS_11643_0) { -// cnv = myData->myConverterArray[CNS_11643]; -// tempBuf[0] = (char) (0x80+(tempState-CNS_11643_0)); -// tempBuf[1] = (char) (mySourceChar); -// tempBuf[2] = (char) trailByte; -// tempBufLen = 3; - -// }else{ -// U_ASSERT(tempStatemyConverterArray[tempState]; -// tempBuf[0] = (char) (mySourceChar); -// tempBuf[1] = (char) trailByte; -// tempBufLen = 2; -// } -// targetUniChar = ucnv_MBCSSimpleGetNextUChar(cnv, tempBuf, tempBufLen, FALSE); -// mySourceChar = (mySourceChar << 8) | trailByte; -// } else if (!(trailIsOk || IS_2022_CONTROL(trailByte))) { -// /* report a pair of illegal bytes if the second byte is not a DBCS starter */ -// ++mySource; -// /* add another bit so that the code below writes 2 bytes in case of error */ -// mySourceChar = 0x10000 | (mySourceChar << 8) | trailByte; -// } -// if(pToU2022State->g>=2) { -// /* return from a single-shift state to the previous one */ -// pToU2022State->g=pToU2022State->prevG; -// } -// } else { -// args->converter->toUBytes[0] = (uint8_t)mySourceChar; -// args->converter->toULength = 1; -// goto endloop; -// } -// } -// else{ -// if(mySourceChar <= 0x7f) { -// targetUniChar = (UChar) mySourceChar; -// } -// } -// break; -// } -// if(targetUniChar < (missingCharMarker-1/*0xfffe*/)){ -// if(args->offsets){ -// args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2)); -// } -// *(myTarget++)=(UChar)targetUniChar; -// } -// else if(targetUniChar > missingCharMarker){ -// /* disassemble the surrogate pair and write to output*/ -// targetUniChar-=0x0010000; -// *myTarget = (UChar)(0xd800+(UChar)(targetUniChar>>10)); -// if(args->offsets){ -// args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2)); -// } -// ++myTarget; -// if(myTarget< args->targetLimit){ -// *myTarget = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff)); -// if(args->offsets){ -// args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2)); -// } -// ++myTarget; -// }else{ -// args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]= -// (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff)); -// } - -// } -// else{ -// /* Call the callback function*/ -// toUnicodeCallback(args->converter,mySourceChar,targetUniChar,err); -// break; -// } -// } -// else{ -// *err =U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// endloop: -// args->target = myTarget; -// args->source = mySource; -// } -// #endif /* #if !UCONFIG_ONLY_HTML_CONVERSION */ - -// static void U_CALLCONV -// _ISO_2022_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode *err) { -// UConverter *cnv = args->converter; -// UConverterDataISO2022 *myConverterData=(UConverterDataISO2022 *) cnv->extraInfo; -// ISO2022State *pFromU2022State=&myConverterData->fromU2022State; -// char *p, *subchar; -// char buffer[8]; -// int32_t length; - -// subchar=(char *)cnv->subChars; -// length=cnv->subCharLen; /* assume length==1 for most variants */ - -// p = buffer; -// switch(myConverterData->locale[0]){ -// case 'j': -// { -// int8_t cs; - -// if(pFromU2022State->g == 1) { -// /* JIS7: switch from G1 to G0 */ -// pFromU2022State->g = 0; -// *p++ = UCNV_SI; -// } - -// cs = pFromU2022State->cs[0]; -// if(cs != ASCII && cs != JISX201) { -// /* not in ASCII or JIS X 0201: switch to ASCII */ -// pFromU2022State->cs[0] = (int8_t)ASCII; -// *p++ = '\x1b'; -// *p++ = '\x28'; -// *p++ = '\x42'; -// } - -// *p++ = subchar[0]; -// break; -// } -// case 'c': -// if(pFromU2022State->g != 0) { -// /* not in ASCII mode: switch to ASCII */ -// pFromU2022State->g = 0; -// *p++ = UCNV_SI; -// } -// *p++ = subchar[0]; -// break; -// case 'k': -// if(myConverterData->version == 0) { -// if(length == 1) { -// if(args->converter->fromUnicodeStatus) { -// /* in DBCS mode: switch to SBCS */ -// args->converter->fromUnicodeStatus = 0; -// *p++ = UCNV_SI; -// } -// *p++ = subchar[0]; -// } else /* length == 2*/ { -// if(!args->converter->fromUnicodeStatus) { -// /* in SBCS mode: switch to DBCS */ -// args->converter->fromUnicodeStatus = 1; -// *p++ = UCNV_SO; -// } -// *p++ = subchar[0]; -// *p++ = subchar[1]; -// } -// break; -// } else { -// /* save the subconverter's substitution string */ -// uint8_t *currentSubChars = myConverterData->currentConverter->subChars; -// int8_t currentSubCharLen = myConverterData->currentConverter->subCharLen; - -// /* set our substitution string into the subconverter */ -// myConverterData->currentConverter->subChars = (uint8_t *)subchar; -// myConverterData->currentConverter->subCharLen = (int8_t)length; - -// /* let the subconverter write the subchar, set/retrieve fromUChar32 state */ -// args->converter = myConverterData->currentConverter; -// myConverterData->currentConverter->fromUChar32 = cnv->fromUChar32; -// ucnv_cbFromUWriteSub(args, 0, err); -// cnv->fromUChar32 = myConverterData->currentConverter->fromUChar32; -// args->converter = cnv; - -// /* restore the subconverter's substitution string */ -// myConverterData->currentConverter->subChars = currentSubChars; -// myConverterData->currentConverter->subCharLen = currentSubCharLen; - -// if(*err == U_BUFFER_OVERFLOW_ERROR) { -// if(myConverterData->currentConverter->charErrorBufferLength > 0) { -// uprv_memcpy( -// cnv->charErrorBuffer, -// myConverterData->currentConverter->charErrorBuffer, -// myConverterData->currentConverter->charErrorBufferLength); -// } -// cnv->charErrorBufferLength = myConverterData->currentConverter->charErrorBufferLength; -// myConverterData->currentConverter->charErrorBufferLength = 0; -// } -// return; -// } -// default: -// /* not expected */ -// break; -// } -// ucnv_cbFromUWriteBytes(args, -// buffer, (int32_t)(p - buffer), -// offsetIndex, err); -// } - -// /* -// * Structure for cloning an ISO 2022 converter into a single memory block. -// */ -// struct cloneStruct -// { -// UConverter cnv; -// UConverter currentConverter; -// UConverterDataISO2022 mydata; -// }; - - -// U_CDECL_BEGIN - -// static UConverter * U_CALLCONV -// _ISO_2022_SafeClone( -// const UConverter *cnv, -// void *stackBuffer, -// int32_t *pBufferSize, -// UErrorCode *status) -// { -// struct cloneStruct * localClone; -// UConverterDataISO2022 *cnvData; -// int32_t i, size; - -// if (U_FAILURE(*status)){ -// return nullptr; -// } - -// if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */ -// *pBufferSize = (int32_t)sizeof(struct cloneStruct); -// return NULL; -// } - -// cnvData = (UConverterDataISO2022 *)cnv->extraInfo; -// localClone = (struct cloneStruct *)stackBuffer; - -// /* ucnv.c/ucnv_safeClone() copied the main UConverter already */ - -// uprv_memcpy(&localClone->mydata, cnvData, sizeof(UConverterDataISO2022)); -// localClone->cnv.extraInfo = &localClone->mydata; /* set pointer to extra data */ -// localClone->cnv.isExtraLocal = TRUE; - -// /* share the subconverters */ - -// if(cnvData->currentConverter != NULL) { -// size = (int32_t)sizeof(UConverter); -// localClone->mydata.currentConverter = -// ucnv_safeClone(cnvData->currentConverter, -// &localClone->currentConverter, -// &size, status); -// if(U_FAILURE(*status)) { -// return NULL; -// } -// } - -// for(i=0; imyConverterArray[i] != NULL) { -// ucnv_incrementRefCount(cnvData->myConverterArray[i]); -// } -// } - -// return &localClone->cnv; -// } - -// U_CDECL_END - -// static void U_CALLCONV -// _ISO_2022_GetUnicodeSet(const UConverter *cnv, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode) -// { -// int32_t i; -// UConverterDataISO2022* cnvData; - -// if (U_FAILURE(*pErrorCode)) { -// return; -// } -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// if (cnv->sharedData == &_ISO2022Data) { -// /* We use UTF-8 in this case */ -// sa->addRange(sa->set, 0, 0xd7FF); -// sa->addRange(sa->set, 0xE000, 0x10FFFF); -// return; -// } -// #endif - -// cnvData = (UConverterDataISO2022*)cnv->extraInfo; - -// /* open a set and initialize it with code points that are algorithmically round-tripped */ -// switch(cnvData->locale[0]){ -// case 'j': -// /* include JIS X 0201 which is hardcoded */ -// sa->add(sa->set, 0xa5); -// sa->add(sa->set, 0x203e); -// if(jpCharsetMasks[cnvData->version]&CSM(ISO8859_1)) { -// /* include Latin-1 for some variants of JP */ -// sa->addRange(sa->set, 0, 0xff); -// } else { -// /* include ASCII for JP */ -// sa->addRange(sa->set, 0, 0x7f); -// } -// if(cnvData->version==3 || cnvData->version==4 || which==UCNV_ROUNDTRIP_AND_FALLBACK_SET) { -// /* -// * Do not test (jpCharsetMasks[cnvData->version]&CSM(HWKANA_7BIT))!=0 -// * because the bit is on for all JP versions although only versions 3 & 4 (JIS7 & JIS8) -// * use half-width Katakana. -// * This is because all ISO-2022-JP variants are lenient in that they accept (in toUnicode) -// * half-width Katakana via the ESC ( I sequence. -// * However, we only emit (fromUnicode) half-width Katakana according to the -// * definition of each variant. -// * -// * When including fallbacks, -// * we need to include half-width Katakana Unicode code points for all JP variants because -// * JIS X 0208 has hardcoded fallbacks for them (which map to full-width Katakana). -// */ -// /* include half-width Katakana for JP */ -// sa->addRange(sa->set, HWKANA_START, HWKANA_END); -// } -// break; -// #if !UCONFIG_ONLY_HTML_CONVERSION -// case 'c': -// case 'z': -// /* include ASCII for CN */ -// sa->addRange(sa->set, 0, 0x7f); -// break; -// case 'k': -// /* there is only one converter for KR, and it is not in the myConverterArray[] */ -// cnvData->currentConverter->sharedData->impl->getUnicodeSet( -// cnvData->currentConverter, sa, which, pErrorCode); -// /* the loop over myConverterArray[] will simply not find another converter */ -// break; -// #endif -// default: -// break; -// } - -// #if 0 /* Replaced by ucnv_MBCSGetFilteredUnicodeSetForUnicode() until we implement ucnv_getUnicodeSet() with reverse fallbacks. */ -// if( (cnvData->locale[0]=='c' || cnvData->locale[0]=='z') && -// cnvData->version==0 && i==CNS_11643 -// ) { -// /* special handling for non-EXT ISO-2022-CN: add only code points for CNS planes 1 and 2 */ -// ucnv_MBCSGetUnicodeSetForBytes( -// cnvData->myConverterArray[i], -// sa, UCNV_ROUNDTRIP_SET, -// 0, 0x81, 0x82, -// pErrorCode); -// } -// #endif - -// for (i=0; imyConverterArray[i]!=NULL) { -// if(cnvData->locale[0]=='j' && i==JISX208) { -// /* -// * Only add code points that map to Shift-JIS codes -// * corresponding to JIS X 0208. -// */ -// filter=UCNV_SET_FILTER_SJIS; -// #if !UCONFIG_ONLY_HTML_CONVERSION -// } else if( (cnvData->locale[0]=='c' || cnvData->locale[0]=='z') && -// cnvData->version==0 && i==CNS_11643) { -// /* -// * Version-specific for CN: -// * CN version 0 does not map CNS planes 3..7 although -// * they are all available in the CNS conversion table; -// * CN version 1 (-EXT) does map them all. -// * The two versions create different Unicode sets. -// */ -// filter=UCNV_SET_FILTER_2022_CN; -// } else if(i==KSC5601) { -// /* -// * Some of the KSC 5601 tables (convrtrs.txt has this aliases on multiple tables) -// * are broader than GR94. -// */ -// filter=UCNV_SET_FILTER_GR94DBCS; -// #endif -// } else { -// filter=UCNV_SET_FILTER_NONE; -// } -// ucnv_MBCSGetFilteredUnicodeSetForUnicode(cnvData->myConverterArray[i], sa, which, filter, pErrorCode); -// } -// } - -// /* -// * ISO 2022 converters must not convert SO/SI/ESC despite what -// * sub-converters do by themselves. -// * Remove these characters from the set. -// */ -// sa->remove(sa->set, 0x0e); -// sa->remove(sa->set, 0x0f); -// sa->remove(sa->set, 0x1b); - -// /* ISO 2022 converters do not convert C1 controls either */ -// sa->removeRange(sa->set, 0x80, 0x9f); -// } - -// static const UConverterImpl _ISO2022Impl={ -// UCNV_ISO_2022, - -// NULL, -// NULL, - -// _ISO2022Open, -// _ISO2022Close, -// _ISO2022Reset, - -// #ifdef U_ENABLE_GENERIC_ISO_2022 -// T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC, -// T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC, -// ucnv_fromUnicode_UTF8, -// ucnv_fromUnicode_UTF8_OFFSETS_LOGIC, -// #else -// NULL, -// NULL, -// NULL, -// NULL, -// #endif -// NULL, - -// NULL, -// _ISO2022getName, -// _ISO_2022_WriteSub, -// _ISO_2022_SafeClone, -// _ISO_2022_GetUnicodeSet, - -// NULL, -// NULL -// }; -// static const UConverterStaticData _ISO2022StaticData={ -// sizeof(UConverterStaticData), -// "ISO_2022", -// 2022, -// UCNV_IBM, -// UCNV_ISO_2022, -// 1, -// 3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */ -// { 0x1a, 0, 0, 0 }, -// 1, -// FALSE, -// FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; -// const UConverterSharedData _ISO2022Data= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022StaticData, &_ISO2022Impl); - -// /*************JP****************/ -// static const UConverterImpl _ISO2022JPImpl={ -// UCNV_ISO_2022, - -// NULL, -// NULL, - -// _ISO2022Open, -// _ISO2022Close, -// _ISO2022Reset, - -// UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC, -// UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC, -// UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC, -// UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC, -// NULL, - -// NULL, -// _ISO2022getName, -// _ISO_2022_WriteSub, -// _ISO_2022_SafeClone, -// _ISO_2022_GetUnicodeSet, - -// NULL, -// NULL -// }; -// static const UConverterStaticData _ISO2022JPStaticData={ -// sizeof(UConverterStaticData), -// "ISO_2022_JP", -// 0, -// UCNV_IBM, -// UCNV_ISO_2022, -// 1, -// 6, /* max 6 bytes per UChar: 4-byte escape sequence + DBCS */ -// { 0x1a, 0, 0, 0 }, -// 1, -// FALSE, -// FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// namespace { - -// const UConverterSharedData _ISO2022JPData= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022JPStaticData, &_ISO2022JPImpl); - -// } // namespace - -// #if !UCONFIG_ONLY_HTML_CONVERSION -// /************* KR ***************/ -// static const UConverterImpl _ISO2022KRImpl={ -// UCNV_ISO_2022, - -// NULL, -// NULL, - -// _ISO2022Open, -// _ISO2022Close, -// _ISO2022Reset, - -// UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC, -// UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC, -// UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC, -// UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC, -// NULL, - -// NULL, -// _ISO2022getName, -// _ISO_2022_WriteSub, -// _ISO_2022_SafeClone, -// _ISO_2022_GetUnicodeSet, - -// NULL, -// NULL -// }; -// static const UConverterStaticData _ISO2022KRStaticData={ -// sizeof(UConverterStaticData), -// "ISO_2022_KR", -// 0, -// UCNV_IBM, -// UCNV_ISO_2022, -// 1, -// 8, /* max 8 bytes per UChar */ -// { 0x1a, 0, 0, 0 }, -// 1, -// FALSE, -// FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// namespace { - -// const UConverterSharedData _ISO2022KRData= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022KRStaticData, &_ISO2022KRImpl); - -// } // namespace - -// /*************** CN ***************/ -// static const UConverterImpl _ISO2022CNImpl={ - -// UCNV_ISO_2022, - -// NULL, -// NULL, - -// _ISO2022Open, -// _ISO2022Close, -// _ISO2022Reset, - -// UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC, -// UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC, -// UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC, -// UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC, -// NULL, - -// NULL, -// _ISO2022getName, -// _ISO_2022_WriteSub, -// _ISO_2022_SafeClone, -// _ISO_2022_GetUnicodeSet, - -// NULL, -// NULL -// }; -// static const UConverterStaticData _ISO2022CNStaticData={ -// sizeof(UConverterStaticData), -// "ISO_2022_CN", -// 0, -// UCNV_IBM, -// UCNV_ISO_2022, -// 1, -// 8, /* max 8 bytes per UChar: 4-byte CNS designator + 2 bytes for SS2/SS3 + DBCS */ -// { 0x1a, 0, 0, 0 }, -// 1, -// FALSE, -// FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// namespace { - -// const UConverterSharedData _ISO2022CNData= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ISO2022CNStaticData, &_ISO2022CNImpl); - -// } // namespace -// #endif /* #if !UCONFIG_ONLY_HTML_CONVERSION */ - -// #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.cpp deleted file mode 100644 index 9acf03c32..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.cpp +++ /dev/null @@ -1,1689 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************** -// * COPYRIGHT: -// * Copyright (c) 1996-2016, International Business Machines Corporation and -// * others. All Rights Reserved. -// ******************************************************************** -// * -// * ucnv_bld.cpp: -// * -// * Defines functions that are used in the creation/initialization/deletion -// * of converters and related structures. -// * uses uconv_io.h routines to access disk information -// * is used by ucnv.h to implement public API create/delete/flushCache routines -// * Modification History: -// * -// * Date Name Description -// * -// * 06/20/2000 helena OS/400 port changes; mostly typecast. -// * 06/29/2000 helena Major rewrite of the callback interface. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/putil.h" -// #include "unicode/udata.h" -// #include "unicode/ucnv.h" -// #include "unicode/uloc.h" -// #include "mutex.h" -// #include "putilimp.h" -// #include "uassert.h" -// #include "utracimp.h" -// #include "ucnv_io.h" -// #include "ucnv_bld.h" -// #include "ucnvmbcs.h" -// #include "ucnv_ext.h" -// #include "ucnv_cnv.h" -// #include "ucnv_imp.h" -// #include "uhash.h" -// #include "umutex.h" -// #include "cstring.h" -// #include "cmemory.h" -// #include "ucln_cmn.h" -// #include "ustr_cnv.h" - - -// #if 0 -// #include -// extern void UCNV_DEBUG_LOG(char *what, char *who, void *p, int l); -// #define UCNV_DEBUG_LOG(x,y,z) UCNV_DEBUG_LOG(x,y,z,__LINE__) -// #else -// # define UCNV_DEBUG_LOG(x,y,z) -// #endif - -// static const UConverterSharedData * const -// converterData[UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES]={ -// NULL, NULL, - -// #if UCONFIG_NO_LEGACY_CONVERSION -// NULL, -// #else -// &_MBCSData, -// #endif - -// &_Latin1Data, -// &_UTF8Data, &_UTF16BEData, &_UTF16LEData, -// #if UCONFIG_ONLY_HTML_CONVERSION -// NULL, NULL, -// #else -// &_UTF32BEData, &_UTF32LEData, -// #endif -// NULL, - -// #if UCONFIG_NO_LEGACY_CONVERSION -// NULL, -// #else -// &_ISO2022Data, -// #endif - -// #if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION -// NULL, NULL, NULL, NULL, NULL, NULL, -// NULL, NULL, NULL, NULL, NULL, NULL, -// NULL, -// #else -// &_LMBCSData1,&_LMBCSData2, &_LMBCSData3, &_LMBCSData4, &_LMBCSData5, &_LMBCSData6, -// &_LMBCSData8,&_LMBCSData11,&_LMBCSData16,&_LMBCSData17,&_LMBCSData18,&_LMBCSData19, -// &_HZData, -// #endif - -// #if UCONFIG_ONLY_HTML_CONVERSION -// NULL, -// #else -// &_SCSUData, -// #endif - - -// #if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION -// NULL, -// #else -// &_ISCIIData, -// #endif - -// &_ASCIIData, -// #if UCONFIG_ONLY_HTML_CONVERSION -// NULL, NULL, &_UTF16Data, NULL, NULL, NULL, -// #else -// &_UTF7Data, &_Bocu1Data, &_UTF16Data, &_UTF32Data, &_CESU8Data, &_IMAPData, -// #endif - -// #if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION -// NULL, -// #else -// &_CompoundTextData -// #endif -// }; - -// /* Please keep this in binary sorted order for getAlgorithmicTypeFromName. -// Also the name should be in lower case and all spaces, dashes and underscores -// removed -// */ -// static struct { -// const char *name; -// const UConverterType type; -// } const cnvNameType[] = { -// #if !UCONFIG_ONLY_HTML_CONVERSION -// { "bocu1", UCNV_BOCU1 }, -// { "cesu8", UCNV_CESU8 }, -// #endif -// #if !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION -// { "hz",UCNV_HZ }, -// #endif -// #if !UCONFIG_ONLY_HTML_CONVERSION -// { "imapmailboxname", UCNV_IMAP_MAILBOX }, -// #endif -// #if !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION -// { "iscii", UCNV_ISCII }, -// #endif -// #if !UCONFIG_NO_LEGACY_CONVERSION -// { "iso2022", UCNV_ISO_2022 }, -// #endif -// { "iso88591", UCNV_LATIN_1 }, -// #if !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION -// { "lmbcs1", UCNV_LMBCS_1 }, -// { "lmbcs11",UCNV_LMBCS_11 }, -// { "lmbcs16",UCNV_LMBCS_16 }, -// { "lmbcs17",UCNV_LMBCS_17 }, -// { "lmbcs18",UCNV_LMBCS_18 }, -// { "lmbcs19",UCNV_LMBCS_19 }, -// { "lmbcs2", UCNV_LMBCS_2 }, -// { "lmbcs3", UCNV_LMBCS_3 }, -// { "lmbcs4", UCNV_LMBCS_4 }, -// { "lmbcs5", UCNV_LMBCS_5 }, -// { "lmbcs6", UCNV_LMBCS_6 }, -// { "lmbcs8", UCNV_LMBCS_8 }, -// #endif -// #if !UCONFIG_ONLY_HTML_CONVERSION -// { "scsu", UCNV_SCSU }, -// #endif -// { "usascii", UCNV_US_ASCII }, -// { "utf16", UCNV_UTF16 }, -// { "utf16be", UCNV_UTF16_BigEndian }, -// { "utf16le", UCNV_UTF16_LittleEndian }, -// #if U_IS_BIG_ENDIAN -// { "utf16oppositeendian", UCNV_UTF16_LittleEndian }, -// { "utf16platformendian", UCNV_UTF16_BigEndian }, -// #else -// { "utf16oppositeendian", UCNV_UTF16_BigEndian}, -// { "utf16platformendian", UCNV_UTF16_LittleEndian }, -// #endif -// #if !UCONFIG_ONLY_HTML_CONVERSION -// { "utf32", UCNV_UTF32 }, -// { "utf32be", UCNV_UTF32_BigEndian }, -// { "utf32le", UCNV_UTF32_LittleEndian }, -// #if U_IS_BIG_ENDIAN -// { "utf32oppositeendian", UCNV_UTF32_LittleEndian }, -// { "utf32platformendian", UCNV_UTF32_BigEndian }, -// #else -// { "utf32oppositeendian", UCNV_UTF32_BigEndian }, -// { "utf32platformendian", UCNV_UTF32_LittleEndian }, -// #endif -// #endif -// #if !UCONFIG_ONLY_HTML_CONVERSION -// { "utf7", UCNV_UTF7 }, -// #endif -// { "utf8", UCNV_UTF8 }, -// #if !UCONFIG_ONLY_HTML_CONVERSION -// { "x11compoundtext", UCNV_COMPOUND_TEXT} -// #endif -// }; - - -// /*initializes some global variables */ -// static UHashtable *SHARED_DATA_HASHTABLE = NULL; -// static icu::UMutex cnvCacheMutex; -// /* Note: the global mutex is used for */ -// /* reference count updates. */ - -// static const char **gAvailableConverters = NULL; -// static uint16_t gAvailableConverterCount = 0; -// static icu::UInitOnce gAvailableConvertersInitOnce = U_INITONCE_INITIALIZER; - -// #if !U_CHARSET_IS_UTF8 - -// /* This contains the resolved converter name. So no further alias lookup is needed again. */ -// static char gDefaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for NULL */ -// static const char *gDefaultConverterName = NULL; - -// /* -// If the default converter is an algorithmic converter, this is the cached value. -// We don't cache a full UConverter and clone it because ucnv_clone doesn't have -// less overhead than an algorithmic open. We don't cache non-algorithmic converters -// because ucnv_flushCache must be able to unload the default converter and its table. -// */ -// static const UConverterSharedData *gDefaultAlgorithmicSharedData = NULL; - -// /* Does gDefaultConverterName have a converter option and require extra parsing? */ -// static UBool gDefaultConverterContainsOption; - -// #endif /* !U_CHARSET_IS_UTF8 */ - -// static const char DATA_TYPE[] = "cnv"; - -// /* ucnv_flushAvailableConverterCache. This is only called from ucnv_cleanup(). -// * If it is ever to be called from elsewhere, synchronization -// * will need to be considered. -// */ -// static void -// ucnv_flushAvailableConverterCache() { -// gAvailableConverterCount = 0; -// if (gAvailableConverters) { -// uprv_free((char **)gAvailableConverters); -// gAvailableConverters = NULL; -// } -// gAvailableConvertersInitOnce.reset(); -// } - -// /* ucnv_cleanup - delete all storage held by the converter cache, except any */ -// /* in use by open converters. */ -// /* Not thread safe. */ -// /* Not supported API. */ -// static UBool U_CALLCONV ucnv_cleanup(void) { -// ucnv_flushCache(); -// if (SHARED_DATA_HASHTABLE != NULL && uhash_count(SHARED_DATA_HASHTABLE) == 0) { -// uhash_close(SHARED_DATA_HASHTABLE); -// SHARED_DATA_HASHTABLE = NULL; -// } - -// /* Isn't called from flushCache because other threads may have preexisting references to the table. */ -// ucnv_flushAvailableConverterCache(); - -// #if !U_CHARSET_IS_UTF8 -// gDefaultConverterName = NULL; -// gDefaultConverterNameBuffer[0] = 0; -// gDefaultConverterContainsOption = FALSE; -// gDefaultAlgorithmicSharedData = NULL; -// #endif - -// return (SHARED_DATA_HASHTABLE == NULL); -// } - -// U_CAPI void U_EXPORT2 -// ucnv_enableCleanup() { -// ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup); -// } - -// static UBool U_CALLCONV -// isCnvAcceptable(void * /*context*/, -// const char * /*type*/, const char * /*name*/, -// const UDataInfo *pInfo) { -// return (UBool)( -// pInfo->size>=20 && -// pInfo->isBigEndian==U_IS_BIG_ENDIAN && -// pInfo->charsetFamily==U_CHARSET_FAMILY && -// pInfo->sizeofUChar==U_SIZEOF_UCHAR && -// pInfo->dataFormat[0]==0x63 && /* dataFormat="cnvt" */ -// pInfo->dataFormat[1]==0x6e && -// pInfo->dataFormat[2]==0x76 && -// pInfo->dataFormat[3]==0x74 && -// pInfo->formatVersion[0]==6); /* Everything will be version 6 */ -// } - -// /** -// * Un flatten shared data from a UDATA.. -// */ -// static UConverterSharedData* -// ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMemory *pData, UErrorCode *status) -// { -// /* UDataInfo info; -- necessary only if some converters have different formatVersion */ -// const uint8_t *raw = (const uint8_t *)udata_getMemory(pData); -// const UConverterStaticData *source = (const UConverterStaticData *) raw; -// UConverterSharedData *data; -// UConverterType type = (UConverterType)source->conversionType; - -// if(U_FAILURE(*status)) -// return NULL; - -// if( (uint16_t)type >= UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES || -// converterData[type] == NULL || -// !converterData[type]->isReferenceCounted || -// converterData[type]->referenceCounter != 1 || -// source->structSize != sizeof(UConverterStaticData)) -// { -// *status = U_INVALID_TABLE_FORMAT; -// return NULL; -// } - -// data = (UConverterSharedData *)uprv_malloc(sizeof(UConverterSharedData)); -// if(data == NULL) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } - -// /* copy initial values from the static structure for this type */ -// uprv_memcpy(data, converterData[type], sizeof(UConverterSharedData)); - -// data->staticData = source; - -// data->sharedDataCached = FALSE; - -// /* fill in fields from the loaded data */ -// data->dataMemory = (void*)pData; /* for future use */ - -// if(data->impl->load != NULL) { -// data->impl->load(data, pArgs, raw + source->structSize, status); -// if(U_FAILURE(*status)) { -// uprv_free(data); -// return NULL; -// } -// } -// return data; -// } - -// /*Takes an alias name gets an actual converter file name -// *goes to disk and opens it. -// *allocates the memory and returns a new UConverter object -// */ -// static UConverterSharedData *createConverterFromFile(UConverterLoadArgs *pArgs, UErrorCode * err) -// { -// UDataMemory *data; -// UConverterSharedData *sharedData; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_LOAD); - -// if (U_FAILURE (*err)) { -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } - -// UTRACE_DATA2(UTRACE_OPEN_CLOSE, "load converter %s from package %s", pArgs->name, pArgs->pkg); - -// data = udata_openChoice(pArgs->pkg, DATA_TYPE, pArgs->name, isCnvAcceptable, NULL, err); -// if(U_FAILURE(*err)) -// { -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } - -// sharedData = ucnv_data_unFlattenClone(pArgs, data, err); -// if(U_FAILURE(*err)) -// { -// udata_close(data); -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } - -// /* -// * TODO Store pkg in a field in the shared data so that delta-only converters -// * can load base converters from the same package. -// * If the pkg name is longer than the field, then either do not load the converter -// * in the first place, or just set the pkg field to "". -// */ - -// UTRACE_EXIT_PTR_STATUS(sharedData, *err); -// return sharedData; -// } - -// /*returns a converter type from a string -// */ -// static const UConverterSharedData * -// getAlgorithmicTypeFromName(const char *realName) -// { -// uint32_t mid, start, limit; -// uint32_t lastMid; -// int result; -// char strippedName[UCNV_MAX_CONVERTER_NAME_LENGTH]; - -// /* Lower case and remove ignoreable characters. */ -// ucnv_io_stripForCompare(strippedName, realName); - -// /* do a binary search for the alias */ -// start = 0; -// limit = UPRV_LENGTHOF(cnvNameType); -// mid = limit; -// lastMid = UINT32_MAX; - -// for (;;) { -// mid = (uint32_t)((start + limit) / 2); -// if (lastMid == mid) { /* Have we moved? */ -// break; /* We haven't moved, and it wasn't found. */ -// } -// lastMid = mid; -// result = uprv_strcmp(strippedName, cnvNameType[mid].name); - -// if (result < 0) { -// limit = mid; -// } else if (result > 0) { -// start = mid; -// } else { -// return converterData[cnvNameType[mid].type]; -// } -// } - -// return NULL; -// } - -// /* -// * Based on the number of known converters, this determines how many times larger -// * the shared data hash table should be. When on small platforms, or just a couple -// * of converters are used, this number should be 2. When memory is plentiful, or -// * when ucnv_countAvailable is ever used with a lot of available converters, -// * this should be 4. -// * Larger numbers reduce the number of hash collisions, but use more memory. -// */ -// #define UCNV_CACHE_LOAD_FACTOR 2 - -// /* Puts the shared data in the static hashtable SHARED_DATA_HASHTABLE */ -// /* Will always be called with the cnvCacheMutex alrady being held */ -// /* by the calling function. */ -// /* Stores the shared data in the SHARED_DATA_HASHTABLE -// * @param data The shared data -// */ -// static void -// ucnv_shareConverterData(UConverterSharedData * data) -// { -// UErrorCode err = U_ZERO_ERROR; -// /*Lazy evaluates the Hashtable itself */ -// /*void *sanity = NULL;*/ - -// if (SHARED_DATA_HASHTABLE == NULL) -// { -// SHARED_DATA_HASHTABLE = uhash_openSize(uhash_hashChars, uhash_compareChars, NULL, -// ucnv_io_countKnownConverters(&err)*UCNV_CACHE_LOAD_FACTOR, -// &err); -// ucnv_enableCleanup(); - -// if (U_FAILURE(err)) -// return; -// } - -// /* ### check to see if the element is not already there! */ - -// /* -// sanity = ucnv_getSharedConverterData (data->staticData->name); -// if(sanity != NULL) -// { -// UCNV_DEBUG_LOG("put:overwrite!",data->staticData->name,sanity); -// } -// UCNV_DEBUG_LOG("put:chk",data->staticData->name,sanity); -// */ - -// /* Mark it shared */ -// data->sharedDataCached = TRUE; - -// uhash_put(SHARED_DATA_HASHTABLE, -// (void*) data->staticData->name, /* Okay to cast away const as long as -// keyDeleter == NULL */ -// data, -// &err); -// UCNV_DEBUG_LOG("put", data->staticData->name,data); - -// } - -// /* Look up a converter name in the shared data cache. */ -// /* cnvCacheMutex must be held by the caller to protect the hash table. */ -// /* gets the shared data from the SHARED_DATA_HASHTABLE (might return NULL if it isn't there) -// * @param name The name of the shared data -// * @return the shared data from the SHARED_DATA_HASHTABLE -// */ -// static UConverterSharedData * -// ucnv_getSharedConverterData(const char *name) -// { -// /*special case when no Table has yet been created we return NULL */ -// if (SHARED_DATA_HASHTABLE == NULL) -// { -// return NULL; -// } -// else -// { -// UConverterSharedData *rc; - -// rc = (UConverterSharedData*)uhash_get(SHARED_DATA_HASHTABLE, name); -// UCNV_DEBUG_LOG("get",name,rc); -// return rc; -// } -// } - -// /*frees the string of memory blocks associates with a sharedConverter -// *if and only if the referenceCounter == 0 -// */ -// /* Deletes (frees) the Shared data it's passed. first it checks the referenceCounter to -// * see if anyone is using it, if not it frees all the memory stemming from sharedConverterData and -// * returns TRUE, -// * otherwise returns FALSE -// * @param sharedConverterData The shared data -// * @return if not it frees all the memory stemming from sharedConverterData and -// * returns TRUE, otherwise returns FALSE -// */ -// static UBool -// ucnv_deleteSharedConverterData(UConverterSharedData * deadSharedData) -// { -// UTRACE_ENTRY_OC(UTRACE_UCNV_UNLOAD); -// UTRACE_DATA2(UTRACE_OPEN_CLOSE, "unload converter %s shared data %p", deadSharedData->staticData->name, deadSharedData); - -// if (deadSharedData->referenceCounter > 0) { -// UTRACE_EXIT_VALUE((int32_t)FALSE); -// return FALSE; -// } - -// if (deadSharedData->impl->unload != NULL) { -// deadSharedData->impl->unload(deadSharedData); -// } - -// if(deadSharedData->dataMemory != NULL) -// { -// UDataMemory *data = (UDataMemory*)deadSharedData->dataMemory; -// udata_close(data); -// } - -// uprv_free(deadSharedData); - -// UTRACE_EXIT_VALUE((int32_t)TRUE); -// return TRUE; -// } - -// /** -// * Load a non-algorithmic converter. -// * If pkg==NULL, then this function must be called inside umtx_lock(&cnvCacheMutex). -// */ -// UConverterSharedData * -// ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err) { -// UConverterSharedData *mySharedConverterData; - -// if(err == NULL || U_FAILURE(*err)) { -// return NULL; -// } - -// if(pArgs->pkg != NULL && *pArgs->pkg != 0) { -// /* application-provided converters are not currently cached */ -// return createConverterFromFile(pArgs, err); -// } - -// mySharedConverterData = ucnv_getSharedConverterData(pArgs->name); -// if (mySharedConverterData == NULL) -// { -// /*Not cached, we need to stream it in from file */ -// mySharedConverterData = createConverterFromFile(pArgs, err); -// if (U_FAILURE (*err) || (mySharedConverterData == NULL)) -// { -// return NULL; -// } -// else if (!pArgs->onlyTestIsLoadable) -// { -// /* share it with other library clients */ -// ucnv_shareConverterData(mySharedConverterData); -// } -// } -// else -// { -// /* The data for this converter was already in the cache. */ -// /* Update the reference counter on the shared data: one more client */ -// mySharedConverterData->referenceCounter++; -// } - -// return mySharedConverterData; -// } - -// /** -// * Unload a non-algorithmic converter. -// * It must be sharedData->isReferenceCounted -// * and this function must be called inside umtx_lock(&cnvCacheMutex). -// */ -// U_CAPI void -// ucnv_unload(UConverterSharedData *sharedData) { -// if(sharedData != NULL) { -// if (sharedData->referenceCounter > 0) { -// sharedData->referenceCounter--; -// } - -// if((sharedData->referenceCounter <= 0)&&(sharedData->sharedDataCached == FALSE)) { -// ucnv_deleteSharedConverterData(sharedData); -// } -// } -// } - -// U_CFUNC void -// ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData) -// { -// if(sharedData != NULL && sharedData->isReferenceCounted) { -// umtx_lock(&cnvCacheMutex); -// ucnv_unload(sharedData); -// umtx_unlock(&cnvCacheMutex); -// } -// } - -// U_CFUNC void -// ucnv_incrementRefCount(UConverterSharedData *sharedData) -// { -// if(sharedData != NULL && sharedData->isReferenceCounted) { -// umtx_lock(&cnvCacheMutex); -// sharedData->referenceCounter++; -// umtx_unlock(&cnvCacheMutex); -// } -// } - -// /* -// * *pPieces must be initialized. -// * The name without options will be copied to pPieces->cnvName. -// * The locale and options will be copied to pPieces only if present in inName, -// * otherwise the existing values in pPieces remain. -// * *pArgs will be set to the pPieces values. -// */ -// static void -// parseConverterOptions(const char *inName, -// UConverterNamePieces *pPieces, -// UConverterLoadArgs *pArgs, -// UErrorCode *err) -// { -// char *cnvName = pPieces->cnvName; -// char c; -// int32_t len = 0; - -// pArgs->name=inName; -// pArgs->locale=pPieces->locale; -// pArgs->options=pPieces->options; - -// /* copy the converter name itself to cnvName */ -// while((c=*inName)!=0 && c!=UCNV_OPTION_SEP_CHAR) { -// if (++len>=UCNV_MAX_CONVERTER_NAME_LENGTH) { -// *err = U_ILLEGAL_ARGUMENT_ERROR; /* bad name */ -// pPieces->cnvName[0]=0; -// return; -// } -// *cnvName++=c; -// inName++; -// } -// *cnvName=0; -// pArgs->name=pPieces->cnvName; - -// /* parse options. No more name copying should occur. */ -// while((c=*inName)!=0) { -// if(c==UCNV_OPTION_SEP_CHAR) { -// ++inName; -// } - -// /* inName is behind an option separator */ -// if(uprv_strncmp(inName, "locale=", 7)==0) { -// /* do not modify locale itself in case we have multiple locale options */ -// char *dest=pPieces->locale; - -// /* copy the locale option value */ -// inName+=7; -// len=0; -// while((c=*inName)!=0 && c!=UCNV_OPTION_SEP_CHAR) { -// ++inName; - -// if(++len>=ULOC_FULLNAME_CAPACITY) { -// *err=U_ILLEGAL_ARGUMENT_ERROR; /* bad name */ -// pPieces->locale[0]=0; -// return; -// } - -// *dest++=c; -// } -// *dest=0; -// } else if(uprv_strncmp(inName, "version=", 8)==0) { -// /* copy the version option value into bits 3..0 of pPieces->options */ -// inName+=8; -// c=*inName; -// if(c==0) { -// pArgs->options=(pPieces->options&=~UCNV_OPTION_VERSION); -// return; -// } else if((uint8_t)(c-'0')<10) { -// pArgs->options=pPieces->options=(pPieces->options&~UCNV_OPTION_VERSION)|(uint32_t)(c-'0'); -// ++inName; -// } -// } else if(uprv_strncmp(inName, "swaplfnl", 8)==0) { -// inName+=8; -// pArgs->options=(pPieces->options|=UCNV_OPTION_SWAP_LFNL); -// /* add processing for new options here with another } else if(uprv_strncmp(inName, "option-name=", XX)==0) { */ -// } else { -// /* ignore any other options until we define some */ -// while(((c = *inName++) != 0) && (c != UCNV_OPTION_SEP_CHAR)) { -// } -// if(c==0) { -// return; -// } -// } -// } -// } - -// /*Logic determines if the converter is Algorithmic AND/OR cached -// *depending on that: -// * -we either go to get data from disk and cache it (Data=TRUE, Cached=False) -// * -Get it from a Hashtable (Data=X, Cached=TRUE) -// * -Call dataConverter initializer (Data=TRUE, Cached=TRUE) -// * -Call AlgorithmicConverter initializer (Data=FALSE, Cached=TRUE) -// */ -// U_CFUNC UConverterSharedData * -// ucnv_loadSharedData(const char *converterName, -// UConverterNamePieces *pPieces, -// UConverterLoadArgs *pArgs, -// UErrorCode * err) { -// UConverterNamePieces stackPieces; -// UConverterLoadArgs stackArgs; -// UConverterSharedData *mySharedConverterData = NULL; -// UErrorCode internalErrorCode = U_ZERO_ERROR; -// UBool mayContainOption = TRUE; -// UBool checkForAlgorithmic = TRUE; - -// if (U_FAILURE (*err)) { -// return NULL; -// } - -// if(pPieces == NULL) { -// if(pArgs != NULL) { -// /* -// * Bad: We may set pArgs pointers to stackPieces fields -// * which will be invalid after this function returns. -// */ -// *err = U_INTERNAL_PROGRAM_ERROR; -// return NULL; -// } -// pPieces = &stackPieces; -// } -// if(pArgs == NULL) { -// uprv_memset(&stackArgs, 0, sizeof(stackArgs)); -// stackArgs.size = (int32_t)sizeof(stackArgs); -// pArgs = &stackArgs; -// } - -// pPieces->cnvName[0] = 0; -// pPieces->locale[0] = 0; -// pPieces->options = 0; - -// pArgs->name = converterName; -// pArgs->locale = pPieces->locale; -// pArgs->options = pPieces->options; - -// /* In case "name" is NULL we want to open the default converter. */ -// if (converterName == NULL) { -// #if U_CHARSET_IS_UTF8 -// pArgs->name = "UTF-8"; -// return (UConverterSharedData *)converterData[UCNV_UTF8]; -// #else -// /* Call ucnv_getDefaultName first to query the name from the OS. */ -// pArgs->name = ucnv_getDefaultName(); -// if (pArgs->name == NULL) { -// *err = U_MISSING_RESOURCE_ERROR; -// return NULL; -// } -// mySharedConverterData = (UConverterSharedData *)gDefaultAlgorithmicSharedData; -// checkForAlgorithmic = FALSE; -// mayContainOption = gDefaultConverterContainsOption; -// /* the default converter name is already canonical */ -// #endif -// } -// else if(UCNV_FAST_IS_UTF8(converterName)) { -// /* fastpath for UTF-8 */ -// pArgs->name = "UTF-8"; -// return (UConverterSharedData *)converterData[UCNV_UTF8]; -// } -// else { -// /* separate the converter name from the options */ -// parseConverterOptions(converterName, pPieces, pArgs, err); -// if (U_FAILURE(*err)) { -// /* Very bad name used. */ -// return NULL; -// } - -// /* get the canonical converter name */ -// pArgs->name = ucnv_io_getConverterName(pArgs->name, &mayContainOption, &internalErrorCode); -// if (U_FAILURE(internalErrorCode) || pArgs->name == NULL) { -// /* -// * set the input name in case the converter was added -// * without updating the alias table, or when there is no alias table -// */ -// pArgs->name = pPieces->cnvName; -// } else if (internalErrorCode == U_AMBIGUOUS_ALIAS_WARNING) { -// *err = U_AMBIGUOUS_ALIAS_WARNING; -// } -// } - -// /* separate the converter name from the options */ -// if(mayContainOption && pArgs->name != pPieces->cnvName) { -// parseConverterOptions(pArgs->name, pPieces, pArgs, err); -// } - -// /* get the shared data for an algorithmic converter, if it is one */ -// if (checkForAlgorithmic) { -// mySharedConverterData = (UConverterSharedData *)getAlgorithmicTypeFromName(pArgs->name); -// } -// if (mySharedConverterData == NULL) -// { -// /* it is a data-based converter, get its shared data. */ -// /* Hold the cnvCacheMutex through the whole process of checking the */ -// /* converter data cache, and adding new entries to the cache */ -// /* to prevent other threads from modifying the cache during the */ -// /* process. */ -// pArgs->nestedLoads=1; -// pArgs->pkg=NULL; - -// umtx_lock(&cnvCacheMutex); -// mySharedConverterData = ucnv_load(pArgs, err); -// umtx_unlock(&cnvCacheMutex); -// if (U_FAILURE (*err) || (mySharedConverterData == NULL)) -// { -// return NULL; -// } -// } - -// return mySharedConverterData; -// } - -// U_CAPI UConverter * -// ucnv_createConverter(UConverter *myUConverter, const char *converterName, UErrorCode * err) -// { -// UConverterNamePieces stackPieces; -// UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER; -// UConverterSharedData *mySharedConverterData; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN); - -// if(U_SUCCESS(*err)) { -// UTRACE_DATA1(UTRACE_OPEN_CLOSE, "open converter %s", converterName); - -// mySharedConverterData = ucnv_loadSharedData(converterName, &stackPieces, &stackArgs, err); - -// myUConverter = ucnv_createConverterFromSharedData( -// myUConverter, mySharedConverterData, -// &stackArgs, -// err); - -// if(U_SUCCESS(*err)) { -// UTRACE_EXIT_PTR_STATUS(myUConverter, *err); -// return myUConverter; -// } -// } - -// /* exit with error */ -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } - -// U_CFUNC UBool -// ucnv_canCreateConverter(const char *converterName, UErrorCode *err) { -// UConverter myUConverter; -// UConverterNamePieces stackPieces; -// UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER; -// UConverterSharedData *mySharedConverterData; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN); - -// if(U_SUCCESS(*err)) { -// UTRACE_DATA1(UTRACE_OPEN_CLOSE, "test if can open converter %s", converterName); - -// stackArgs.onlyTestIsLoadable=TRUE; -// mySharedConverterData = ucnv_loadSharedData(converterName, &stackPieces, &stackArgs, err); -// ucnv_createConverterFromSharedData( -// &myUConverter, mySharedConverterData, -// &stackArgs, -// err); -// ucnv_unloadSharedDataIfReady(mySharedConverterData); -// } - -// UTRACE_EXIT_STATUS(*err); -// return U_SUCCESS(*err); -// } - -// UConverter * -// ucnv_createAlgorithmicConverter(UConverter *myUConverter, -// UConverterType type, -// const char *locale, uint32_t options, -// UErrorCode *err) { -// UConverter *cnv; -// const UConverterSharedData *sharedData; -// UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN_ALGORITHMIC); -// UTRACE_DATA1(UTRACE_OPEN_CLOSE, "open algorithmic converter type %d", (int32_t)type); - -// if(type<0 || UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES<=type) { -// *err = U_ILLEGAL_ARGUMENT_ERROR; -// UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR); -// return NULL; -// } - -// sharedData = converterData[type]; -// if(sharedData == NULL || sharedData->isReferenceCounted) { -// /* not a valid type, or not an algorithmic converter */ -// *err = U_ILLEGAL_ARGUMENT_ERROR; -// UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR); -// return NULL; -// } - -// stackArgs.name = ""; -// stackArgs.options = options; -// stackArgs.locale=locale; -// cnv = ucnv_createConverterFromSharedData( -// myUConverter, (UConverterSharedData *)sharedData, -// &stackArgs, err); - -// UTRACE_EXIT_PTR_STATUS(cnv, *err); -// return cnv; -// } - -// U_CFUNC UConverter* -// ucnv_createConverterFromPackage(const char *packageName, const char *converterName, UErrorCode * err) -// { -// UConverter *myUConverter; -// UConverterSharedData *mySharedConverterData; -// UConverterNamePieces stackPieces; -// UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_OPEN_PACKAGE); - -// if(U_FAILURE(*err)) { -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } - -// UTRACE_DATA2(UTRACE_OPEN_CLOSE, "open converter %s from package %s", converterName, packageName); - -// /* first, get the options out of the converterName string */ -// stackPieces.cnvName[0] = 0; -// stackPieces.locale[0] = 0; -// stackPieces.options = 0; -// parseConverterOptions(converterName, &stackPieces, &stackArgs, err); -// if (U_FAILURE(*err)) { -// /* Very bad name used. */ -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } -// stackArgs.nestedLoads=1; -// stackArgs.pkg=packageName; - -// /* open the data, unflatten the shared structure */ -// mySharedConverterData = createConverterFromFile(&stackArgs, err); - -// if (U_FAILURE(*err)) { -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } - -// /* create the actual converter */ -// myUConverter = ucnv_createConverterFromSharedData(NULL, mySharedConverterData, &stackArgs, err); - -// if (U_FAILURE(*err)) { -// ucnv_close(myUConverter); -// UTRACE_EXIT_STATUS(*err); -// return NULL; -// } - -// UTRACE_EXIT_PTR_STATUS(myUConverter, *err); -// return myUConverter; -// } - - -// U_CFUNC UConverter* -// ucnv_createConverterFromSharedData(UConverter *myUConverter, -// UConverterSharedData *mySharedConverterData, -// UConverterLoadArgs *pArgs, -// UErrorCode *err) -// { -// UBool isCopyLocal; - -// if(U_FAILURE(*err)) { -// ucnv_unloadSharedDataIfReady(mySharedConverterData); -// return myUConverter; -// } -// if(myUConverter == NULL) -// { -// myUConverter = (UConverter *) uprv_malloc (sizeof (UConverter)); -// if(myUConverter == NULL) -// { -// *err = U_MEMORY_ALLOCATION_ERROR; -// ucnv_unloadSharedDataIfReady(mySharedConverterData); -// return NULL; -// } -// isCopyLocal = FALSE; -// } else { -// isCopyLocal = TRUE; -// } - -// /* initialize the converter */ -// uprv_memset(myUConverter, 0, sizeof(UConverter)); -// myUConverter->isCopyLocal = isCopyLocal; -// /*myUConverter->isExtraLocal = FALSE;*/ /* Set by the memset call */ -// myUConverter->sharedData = mySharedConverterData; -// myUConverter->options = pArgs->options; -// if(!pArgs->onlyTestIsLoadable) { -// myUConverter->preFromUFirstCP = U_SENTINEL; -// myUConverter->fromCharErrorBehaviour = UCNV_TO_U_DEFAULT_CALLBACK; -// myUConverter->fromUCharErrorBehaviour = UCNV_FROM_U_DEFAULT_CALLBACK; -// myUConverter->toUnicodeStatus = mySharedConverterData->toUnicodeStatus; -// myUConverter->maxBytesPerUChar = mySharedConverterData->staticData->maxBytesPerChar; -// myUConverter->subChar1 = mySharedConverterData->staticData->subChar1; -// myUConverter->subCharLen = mySharedConverterData->staticData->subCharLen; -// myUConverter->subChars = (uint8_t *)myUConverter->subUChars; -// uprv_memcpy(myUConverter->subChars, mySharedConverterData->staticData->subChar, myUConverter->subCharLen); -// myUConverter->toUCallbackReason = UCNV_ILLEGAL; /* default reason to invoke (*fromCharErrorBehaviour) */ -// } - -// if(mySharedConverterData->impl->open != NULL) { -// mySharedConverterData->impl->open(myUConverter, pArgs, err); -// if(U_FAILURE(*err) && !pArgs->onlyTestIsLoadable) { -// /* don't ucnv_close() if onlyTestIsLoadable because not fully initialized */ -// ucnv_close(myUConverter); -// return NULL; -// } -// } - -// return myUConverter; -// } - -// /*Frees all shared immutable objects that aren't referred to (reference count = 0) -// */ -// U_CAPI int32_t U_EXPORT2 -// ucnv_flushCache () -// { -// UConverterSharedData *mySharedData = NULL; -// int32_t pos; -// int32_t tableDeletedNum = 0; -// const UHashElement *e; -// /*UErrorCode status = U_ILLEGAL_ARGUMENT_ERROR;*/ -// int32_t i, remaining; - -// UTRACE_ENTRY_OC(UTRACE_UCNV_FLUSH_CACHE); - -// /* Close the default converter without creating a new one so that everything will be flushed. */ -// u_flushDefaultConverter(); - -// /*if shared data hasn't even been lazy evaluated yet -// * return 0 -// */ -// if (SHARED_DATA_HASHTABLE == NULL) { -// UTRACE_EXIT_VALUE((int32_t)0); -// return 0; -// } - -// /*creates an enumeration to iterate through every element in the -// * table -// * -// * Synchronization: holding cnvCacheMutex will prevent any other thread from -// * accessing or modifying the hash table during the iteration. -// * The reference count of an entry may be decremented by -// * ucnv_close while the iteration is in process, but this is -// * benign. It can't be incremented (in ucnv_createConverter()) -// * because the sequence of looking up in the cache + incrementing -// * is protected by cnvCacheMutex. -// */ -// umtx_lock(&cnvCacheMutex); -// /* -// * double loop: A delta/extension-only converter has a pointer to its base table's -// * shared data; the first iteration of the outer loop may see the delta converter -// * before the base converter, and unloading the delta converter may get the base -// * converter's reference counter down to 0. -// */ -// i = 0; -// do { -// remaining = 0; -// pos = UHASH_FIRST; -// while ((e = uhash_nextElement (SHARED_DATA_HASHTABLE, &pos)) != NULL) -// { -// mySharedData = (UConverterSharedData *) e->value.pointer; -// /*deletes only if reference counter == 0 */ -// if (mySharedData->referenceCounter == 0) -// { -// tableDeletedNum++; - -// UCNV_DEBUG_LOG("del",mySharedData->staticData->name,mySharedData); - -// uhash_removeElement(SHARED_DATA_HASHTABLE, e); -// mySharedData->sharedDataCached = FALSE; -// ucnv_deleteSharedConverterData (mySharedData); -// } else { -// ++remaining; -// } -// } -// } while(++i == 1 && remaining > 0); -// umtx_unlock(&cnvCacheMutex); - -// UTRACE_DATA1(UTRACE_INFO, "ucnv_flushCache() exits with %d converters remaining", remaining); - -// UTRACE_EXIT_VALUE(tableDeletedNum); -// return tableDeletedNum; -// } - -// /* available converters list --------------------------------------------------- */ - -// static void U_CALLCONV initAvailableConvertersList(UErrorCode &errCode) { -// U_ASSERT(gAvailableConverterCount == 0); -// U_ASSERT(gAvailableConverters == NULL); - -// ucnv_enableCleanup(); -// UEnumeration *allConvEnum = ucnv_openAllNames(&errCode); -// int32_t allConverterCount = uenum_count(allConvEnum, &errCode); -// if (U_FAILURE(errCode)) { -// return; -// } - -// /* We can't have more than "*converterTable" converters to open */ -// gAvailableConverters = (const char **) uprv_malloc(allConverterCount * sizeof(char*)); -// if (!gAvailableConverters) { -// errCode = U_MEMORY_ALLOCATION_ERROR; -// return; -// } - -// /* Open the default converter to make sure that it has first dibs in the hash table. */ -// UErrorCode localStatus = U_ZERO_ERROR; -// UConverter tempConverter; -// ucnv_close(ucnv_createConverter(&tempConverter, NULL, &localStatus)); - -// gAvailableConverterCount = 0; - -// for (int32_t idx = 0; idx < allConverterCount; idx++) { -// localStatus = U_ZERO_ERROR; -// const char *converterName = uenum_next(allConvEnum, NULL, &localStatus); -// if (ucnv_canCreateConverter(converterName, &localStatus)) { -// gAvailableConverters[gAvailableConverterCount++] = converterName; -// } -// } - -// uenum_close(allConvEnum); -// } - - -// static UBool haveAvailableConverterList(UErrorCode *pErrorCode) { -// umtx_initOnce(gAvailableConvertersInitOnce, &initAvailableConvertersList, *pErrorCode); -// return U_SUCCESS(*pErrorCode); -// } - -// U_CFUNC uint16_t -// ucnv_bld_countAvailableConverters(UErrorCode *pErrorCode) { -// if (haveAvailableConverterList(pErrorCode)) { -// return gAvailableConverterCount; -// } -// return 0; -// } - -// U_CFUNC const char * -// ucnv_bld_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode) { -// if (haveAvailableConverterList(pErrorCode)) { -// if (n < gAvailableConverterCount) { -// return gAvailableConverters[n]; -// } -// *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR; -// } -// return NULL; -// } - -// /* default converter name --------------------------------------------------- */ - -// #if !U_CHARSET_IS_UTF8 -// /* -// Copy the canonical converter name. -// ucnv_getDefaultName must be thread safe, which can call this function. - -// ucnv_setDefaultName calls this function and it doesn't have to be -// thread safe because there is no reliable/safe way to reset the -// converter in use in all threads. If you did reset the converter, you -// would not be sure that retrieving a default converter for one string -// would be the same type of default converter for a successive string. -// Since the name is a returned via ucnv_getDefaultName without copying, -// you shouldn't be modifying or deleting the string from a separate thread. -// */ -// static inline void -// internalSetName(const char *name, UErrorCode *status) { -// UConverterNamePieces stackPieces; -// UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER; -// int32_t length=(int32_t)(uprv_strlen(name)); -// UBool containsOption = (UBool)(uprv_strchr(name, UCNV_OPTION_SEP_CHAR) != NULL); -// const UConverterSharedData *algorithmicSharedData; - -// stackArgs.name = name; -// if(containsOption) { -// stackPieces.cnvName[0] = 0; -// stackPieces.locale[0] = 0; -// stackPieces.options = 0; -// parseConverterOptions(name, &stackPieces, &stackArgs, status); -// if(U_FAILURE(*status)) { -// return; -// } -// } -// algorithmicSharedData = getAlgorithmicTypeFromName(stackArgs.name); - -// umtx_lock(&cnvCacheMutex); - -// gDefaultAlgorithmicSharedData = algorithmicSharedData; -// gDefaultConverterContainsOption = containsOption; -// uprv_memcpy(gDefaultConverterNameBuffer, name, length); -// gDefaultConverterNameBuffer[length]=0; - -// /* gDefaultConverterName MUST be the last global var set by this function. */ -// /* It is the variable checked in ucnv_getDefaultName() to see if initialization is required. */ -// // But there is nothing here preventing that from being reordered, either by the compiler -// // or hardware. I'm adding the mutex to ucnv_getDefaultName for now. UMTX_CHECK is not enough. -// // -- Andy -// gDefaultConverterName = gDefaultConverterNameBuffer; - -// ucnv_enableCleanup(); - -// umtx_unlock(&cnvCacheMutex); -// } -// #endif - -// /* -// * In order to be really thread-safe, the get function would have to take -// * a buffer parameter and copy the current string inside a mutex block. -// * This implementation only tries to be really thread-safe while -// * setting the name. -// * It assumes that setting a pointer is atomic. -// */ - -// U_CAPI const char* U_EXPORT2 -// ucnv_getDefaultName() { -// #if U_CHARSET_IS_UTF8 -// return "UTF-8"; -// #else -// /* local variable to be thread-safe */ -// const char *name; - -// /* -// Concurrent calls to ucnv_getDefaultName must be thread safe, -// but ucnv_setDefaultName is not thread safe. -// */ -// { -// icu::Mutex lock(&cnvCacheMutex); -// name = gDefaultConverterName; -// } -// if(name==NULL) { -// UErrorCode errorCode = U_ZERO_ERROR; -// UConverter *cnv = NULL; - -// name = uprv_getDefaultCodepage(); - -// /* if the name is there, test it out and get the canonical name with options */ -// if(name != NULL) { -// cnv = ucnv_open(name, &errorCode); -// if(U_SUCCESS(errorCode) && cnv != NULL) { -// name = ucnv_getName(cnv, &errorCode); -// } -// } - -// if(name == NULL || name[0] == 0 -// || U_FAILURE(errorCode) || cnv == NULL -// || uprv_strlen(name)>=sizeof(gDefaultConverterNameBuffer)) -// { -// /* Panic time, let's use a fallback. */ -// #if (U_CHARSET_FAMILY == U_ASCII_FAMILY) -// name = "US-ASCII"; -// /* there is no 'algorithmic' converter for EBCDIC */ -// #elif U_PLATFORM == U_PF_OS390 -// name = "ibm-1047_P100-1995" UCNV_SWAP_LFNL_OPTION_STRING; -// #else -// name = "ibm-37_P100-1995"; -// #endif -// } - -// internalSetName(name, &errorCode); - -// /* The close may make the current name go away. */ -// ucnv_close(cnv); -// } - -// return name; -// #endif -// } - -// #if U_CHARSET_IS_UTF8 -// U_CAPI void U_EXPORT2 ucnv_setDefaultName(const char *) {} -// #else -// /* -// This function is not thread safe, and it can't be thread safe. -// See internalSetName or the API reference for details. -// */ -// U_CAPI void U_EXPORT2 -// ucnv_setDefaultName(const char *converterName) { -// if(converterName==NULL) { -// /* reset to the default codepage */ -// gDefaultConverterName=NULL; -// } else { -// UErrorCode errorCode = U_ZERO_ERROR; -// UConverter *cnv = NULL; -// const char *name = NULL; - -// /* if the name is there, test it out and get the canonical name with options */ -// cnv = ucnv_open(converterName, &errorCode); -// if(U_SUCCESS(errorCode) && cnv != NULL) { -// name = ucnv_getName(cnv, &errorCode); -// } - -// if(U_SUCCESS(errorCode) && name!=NULL) { -// internalSetName(name, &errorCode); -// } -// /* else this converter is bad to use. Don't change it to a bad value. */ - -// /* The close may make the current name go away. */ -// ucnv_close(cnv); - -// /* reset the converter cache */ -// u_flushDefaultConverter(); -// } -// } -// #endif - -// /* data swapping ------------------------------------------------------------ */ - -// /* most of this might belong more properly into ucnvmbcs.c, but that is so large */ - -// #if !UCONFIG_NO_LEGACY_CONVERSION - -// U_CAPI int32_t U_EXPORT2 -// ucnv_swap(const UDataSwapper *ds, -// const void *inData, int32_t length, void *outData, -// UErrorCode *pErrorCode) { -// const UDataInfo *pInfo; -// int32_t headerSize; - -// const uint8_t *inBytes; -// uint8_t *outBytes; - -// uint32_t offset, count, staticDataSize; -// int32_t size; - -// const UConverterStaticData *inStaticData; -// UConverterStaticData *outStaticData; - -// const _MBCSHeader *inMBCSHeader; -// _MBCSHeader *outMBCSHeader; -// _MBCSHeader mbcsHeader; -// uint32_t mbcsHeaderLength; -// UBool noFromU=FALSE; - -// uint8_t outputType; - -// int32_t maxFastUChar, mbcsIndexLength; - -// const int32_t *inExtIndexes; -// int32_t extOffset; - -// /* udata_swapDataHeader checks the arguments */ -// headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode); -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// /* check data format and format version */ -// pInfo=(const UDataInfo *)((const char *)inData+4); -// if(!( -// pInfo->dataFormat[0]==0x63 && /* dataFormat="cnvt" */ -// pInfo->dataFormat[1]==0x6e && -// pInfo->dataFormat[2]==0x76 && -// pInfo->dataFormat[3]==0x74 && -// pInfo->formatVersion[0]==6 && -// pInfo->formatVersion[1]>=2 -// )) { -// udata_printError(ds, "ucnv_swap(): data format %02x.%02x.%02x.%02x (format version %02x.%02x) is not recognized as an ICU .cnv conversion table\n", -// pInfo->dataFormat[0], pInfo->dataFormat[1], -// pInfo->dataFormat[2], pInfo->dataFormat[3], -// pInfo->formatVersion[0], pInfo->formatVersion[1]); -// *pErrorCode=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// inBytes=(const uint8_t *)inData+headerSize; -// outBytes=(uint8_t *)outData+headerSize; - -// /* read the initial UConverterStaticData structure after the UDataInfo header */ -// inStaticData=(const UConverterStaticData *)inBytes; -// outStaticData=(UConverterStaticData *)outBytes; - -// if(length<0) { -// staticDataSize=ds->readUInt32(inStaticData->structSize); -// } else { -// length-=headerSize; -// if( length<(int32_t)sizeof(UConverterStaticData) || -// (uint32_t)length<(staticDataSize=ds->readUInt32(inStaticData->structSize)) -// ) { -// udata_printError(ds, "ucnv_swap(): too few bytes (%d after header) for an ICU .cnv conversion table\n", -// length); -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } -// } - -// if(length>=0) { -// /* swap the static data */ -// if(inStaticData!=outStaticData) { -// uprv_memcpy(outStaticData, inStaticData, staticDataSize); -// } - -// ds->swapArray32(ds, &inStaticData->structSize, 4, -// &outStaticData->structSize, pErrorCode); -// ds->swapArray32(ds, &inStaticData->codepage, 4, -// &outStaticData->codepage, pErrorCode); - -// ds->swapInvChars(ds, inStaticData->name, (int32_t)uprv_strlen(inStaticData->name), -// outStaticData->name, pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// udata_printError(ds, "ucnv_swap(): error swapping converter name\n"); -// return 0; -// } -// } - -// inBytes+=staticDataSize; -// outBytes+=staticDataSize; -// if(length>=0) { -// length-=(int32_t)staticDataSize; -// } - -// /* check for supported conversionType values */ -// if(inStaticData->conversionType==UCNV_MBCS) { -// /* swap MBCS data */ -// inMBCSHeader=(const _MBCSHeader *)inBytes; -// outMBCSHeader=(_MBCSHeader *)outBytes; - -// if(0<=length && length<(int32_t)sizeof(_MBCSHeader)) { -// udata_printError(ds, "ucnv_swap(): too few bytes (%d after headers) for an ICU MBCS .cnv conversion table\n", -// length); -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } -// if(inMBCSHeader->version[0]==4 && inMBCSHeader->version[1]>=1) { -// mbcsHeaderLength=MBCS_HEADER_V4_LENGTH; -// } else if(inMBCSHeader->version[0]==5 && inMBCSHeader->version[1]>=3 && -// ((mbcsHeader.options=ds->readUInt32(inMBCSHeader->options))& -// MBCS_OPT_UNKNOWN_INCOMPATIBLE_MASK)==0 -// ) { -// mbcsHeaderLength=mbcsHeader.options&MBCS_OPT_LENGTH_MASK; -// noFromU=(UBool)((mbcsHeader.options&MBCS_OPT_NO_FROM_U)!=0); -// } else { -// udata_printError(ds, "ucnv_swap(): unsupported _MBCSHeader.version %d.%d\n", -// inMBCSHeader->version[0], inMBCSHeader->version[1]); -// *pErrorCode=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// uprv_memcpy(mbcsHeader.version, inMBCSHeader->version, 4); -// mbcsHeader.countStates= ds->readUInt32(inMBCSHeader->countStates); -// mbcsHeader.countToUFallbacks= ds->readUInt32(inMBCSHeader->countToUFallbacks); -// mbcsHeader.offsetToUCodeUnits= ds->readUInt32(inMBCSHeader->offsetToUCodeUnits); -// mbcsHeader.offsetFromUTable= ds->readUInt32(inMBCSHeader->offsetFromUTable); -// mbcsHeader.offsetFromUBytes= ds->readUInt32(inMBCSHeader->offsetFromUBytes); -// mbcsHeader.flags= ds->readUInt32(inMBCSHeader->flags); -// mbcsHeader.fromUBytesLength= ds->readUInt32(inMBCSHeader->fromUBytesLength); -// /* mbcsHeader.options have been read above */ - -// extOffset=(int32_t)(mbcsHeader.flags>>8); -// outputType=(uint8_t)mbcsHeader.flags; -// if(noFromU && outputType==MBCS_OUTPUT_1) { -// udata_printError(ds, "ucnv_swap(): unsupported combination of makeconv --small with SBCS\n"); -// *pErrorCode=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// /* make sure that the output type is known */ -// switch(outputType) { -// case MBCS_OUTPUT_1: -// case MBCS_OUTPUT_2: -// case MBCS_OUTPUT_3: -// case MBCS_OUTPUT_4: -// case MBCS_OUTPUT_3_EUC: -// case MBCS_OUTPUT_4_EUC: -// case MBCS_OUTPUT_2_SISO: -// case MBCS_OUTPUT_EXT_ONLY: -// /* OK */ -// break; -// default: -// udata_printError(ds, "ucnv_swap(): unsupported MBCS output type 0x%x\n", -// outputType); -// *pErrorCode=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// /* calculate the length of the MBCS data */ - -// /* -// * utf8Friendly MBCS files (mbcsHeader.version 4.3) -// * contain an additional mbcsIndex table: -// * uint16_t[(maxFastUChar+1)>>6]; -// * where maxFastUChar=((mbcsHeader.version[2]<<8)|0xff). -// */ -// maxFastUChar=0; -// mbcsIndexLength=0; -// if( outputType!=MBCS_OUTPUT_EXT_ONLY && outputType!=MBCS_OUTPUT_1 && -// mbcsHeader.version[1]>=3 && (maxFastUChar=mbcsHeader.version[2])!=0 -// ) { -// maxFastUChar=(maxFastUChar<<8)|0xff; -// mbcsIndexLength=((maxFastUChar+1)>>6)*2; /* number of bytes */ -// } - -// if(extOffset==0) { -// size=(int32_t)(mbcsHeader.offsetFromUBytes+mbcsIndexLength); -// if(!noFromU) { -// size+=(int32_t)mbcsHeader.fromUBytesLength; -// } - -// /* avoid compiler warnings - not otherwise necessary, and the value does not matter */ -// inExtIndexes=NULL; -// } else { -// /* there is extension data after the base data, see ucnv_ext.h */ -// if(length>=0 && length<(extOffset+UCNV_EXT_INDEXES_MIN_LENGTH*4)) { -// udata_printError(ds, "ucnv_swap(): too few bytes (%d after headers) for an ICU MBCS .cnv conversion table with extension data\n", -// length); -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } - -// inExtIndexes=(const int32_t *)(inBytes+extOffset); -// size=extOffset+udata_readInt32(ds, inExtIndexes[UCNV_EXT_SIZE]); -// } - -// if(length>=0) { -// if(lengthswapArray32(ds, &inMBCSHeader->countStates, count-4, -// &outMBCSHeader->countStates, pErrorCode); - -// if(outputType==MBCS_OUTPUT_EXT_ONLY) { -// /* -// * extension-only file, -// * contains a base name instead of normal base table data -// */ - -// /* swap the base name, between the header and the extension data */ -// const char *inBaseName=(const char *)inBytes+count; -// char *outBaseName=(char *)outBytes+count; -// ds->swapInvChars(ds, inBaseName, (int32_t)uprv_strlen(inBaseName), -// outBaseName, pErrorCode); -// } else { -// /* normal file with base table data */ - -// /* swap the state table, 1kB per state */ -// offset=count; -// count=mbcsHeader.countStates*1024; -// ds->swapArray32(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); - -// /* swap the toUFallbacks[] */ -// offset+=count; -// count=mbcsHeader.countToUFallbacks*8; -// ds->swapArray32(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); - -// /* swap the unicodeCodeUnits[] */ -// offset=mbcsHeader.offsetToUCodeUnits; -// count=mbcsHeader.offsetFromUTable-offset; -// ds->swapArray16(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); - -// /* offset to the stage 1 table, independent of the outputType */ -// offset=mbcsHeader.offsetFromUTable; - -// if(outputType==MBCS_OUTPUT_1) { -// /* SBCS: swap the fromU tables, all 16 bits wide */ -// count=(mbcsHeader.offsetFromUBytes-offset)+mbcsHeader.fromUBytesLength; -// ds->swapArray16(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); -// } else { -// /* otherwise: swap the stage tables separately */ - -// /* stage 1 table: uint16_t[0x440 or 0x40] */ -// if(inStaticData->unicodeMask&UCNV_HAS_SUPPLEMENTARY) { -// count=0x440*2; /* for all of Unicode */ -// } else { -// count=0x40*2; /* only BMP */ -// } -// ds->swapArray16(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); - -// /* stage 2 table: uint32_t[] */ -// offset+=count; -// count=mbcsHeader.offsetFromUBytes-offset; -// ds->swapArray32(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); - -// /* stage 3/result bytes: sometimes uint16_t[] or uint32_t[] */ -// offset=mbcsHeader.offsetFromUBytes; -// count= noFromU ? 0 : mbcsHeader.fromUBytesLength; -// switch(outputType) { -// case MBCS_OUTPUT_2: -// case MBCS_OUTPUT_3_EUC: -// case MBCS_OUTPUT_2_SISO: -// ds->swapArray16(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); -// break; -// case MBCS_OUTPUT_4: -// ds->swapArray32(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); -// break; -// default: -// /* just uint8_t[], nothing to swap */ -// break; -// } - -// if(mbcsIndexLength!=0) { -// offset+=count; -// count=mbcsIndexLength; -// ds->swapArray16(ds, inBytes+offset, (int32_t)count, -// outBytes+offset, pErrorCode); -// } -// } -// } - -// if(extOffset!=0) { -// /* swap the extension data */ -// inBytes+=extOffset; -// outBytes+=extOffset; - -// /* swap toUTable[] */ -// offset=udata_readInt32(ds, inExtIndexes[UCNV_EXT_TO_U_INDEX]); -// length=udata_readInt32(ds, inExtIndexes[UCNV_EXT_TO_U_LENGTH]); -// ds->swapArray32(ds, inBytes+offset, length*4, outBytes+offset, pErrorCode); - -// /* swap toUUChars[] */ -// offset=udata_readInt32(ds, inExtIndexes[UCNV_EXT_TO_U_UCHARS_INDEX]); -// length=udata_readInt32(ds, inExtIndexes[UCNV_EXT_TO_U_UCHARS_LENGTH]); -// ds->swapArray16(ds, inBytes+offset, length*2, outBytes+offset, pErrorCode); - -// /* swap fromUTableUChars[] */ -// offset=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_UCHARS_INDEX]); -// length=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_LENGTH]); -// ds->swapArray16(ds, inBytes+offset, length*2, outBytes+offset, pErrorCode); - -// /* swap fromUTableValues[] */ -// offset=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_VALUES_INDEX]); -// /* same length as for fromUTableUChars[] */ -// ds->swapArray32(ds, inBytes+offset, length*4, outBytes+offset, pErrorCode); - -// /* no need to swap fromUBytes[] */ - -// /* swap fromUStage12[] */ -// offset=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_STAGE_12_INDEX]); -// length=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_STAGE_12_LENGTH]); -// ds->swapArray16(ds, inBytes+offset, length*2, outBytes+offset, pErrorCode); - -// /* swap fromUStage3[] */ -// offset=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_STAGE_3_INDEX]); -// length=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_STAGE_3_LENGTH]); -// ds->swapArray16(ds, inBytes+offset, length*2, outBytes+offset, pErrorCode); - -// /* swap fromUStage3b[] */ -// offset=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_STAGE_3B_INDEX]); -// length=udata_readInt32(ds, inExtIndexes[UCNV_EXT_FROM_U_STAGE_3B_LENGTH]); -// ds->swapArray32(ds, inBytes+offset, length*4, outBytes+offset, pErrorCode); - -// /* swap indexes[] */ -// length=udata_readInt32(ds, inExtIndexes[UCNV_EXT_INDEXES_LENGTH]); -// ds->swapArray32(ds, inBytes, length*4, outBytes, pErrorCode); -// } -// } -// } else { -// udata_printError(ds, "ucnv_swap(): unknown conversionType=%d!=UCNV_MBCS\n", -// inStaticData->conversionType); -// *pErrorCode=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// return headerSize+(int32_t)staticDataSize+size; -// } - -// #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */ - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.h b/src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.h index e69de29bb..43e6c09ac 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.h @@ -0,0 +1,296 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2015 International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* +* ucnv_bld.h: +* Contains internal data structure definitions +* Created by Bertrand A. Damiba +* +* Change history: +* +* 06/29/2000 helena Major rewrite of the callback APIs. +*/ + +#ifndef UCNV_BLD_H +#define UCNV_BLD_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "unicode/ucnv_err.h" +#include "unicode/utf16.h" +#include "ucnv_cnv.h" +#include "ucnvmbcs.h" +#include "ucnv_ext.h" +#include "udataswp.h" + +/* size of the overflow buffers in UConverter, enough for escaping callbacks */ +#define UCNV_ERROR_BUFFER_LENGTH 32 + +/* at most 4 bytes per substitution character (part of .cnv file format! see UConverterStaticData) */ +#define UCNV_MAX_SUBCHAR_LEN 4 + +/* at most 8 bytes per character in toUBytes[] (UTF-8 uses up to 6) */ +#define UCNV_MAX_CHAR_LEN 8 + +/* converter options bits */ +#define UCNV_OPTION_VERSION 0xf +#define UCNV_OPTION_SWAP_LFNL 0x10 + +#define UCNV_GET_VERSION(cnv) ((cnv)->options&UCNV_OPTION_VERSION) + +U_CDECL_BEGIN /* We must declare the following as 'extern "C"' so that if ucnv + itself is compiled under C++, the linkage of the funcptrs will + work. + */ + +union UConverterTable { + UConverterMBCSTable mbcs; +}; + +typedef union UConverterTable UConverterTable; + +struct UConverterImpl; +typedef struct UConverterImpl UConverterImpl; + +/** values for the unicodeMask */ +#define UCNV_HAS_SUPPLEMENTARY 1 +#define UCNV_HAS_SURROGATES 2 + +typedef struct UConverterStaticData { /* +offset: size */ + uint32_t structSize; /* +0: 4 Size of this structure */ + + char name + [UCNV_MAX_CONVERTER_NAME_LENGTH]; /* +4: 60 internal name of the converter- invariant chars */ + + int32_t codepage; /* +64: 4 codepage # (now IBM-$codepage) */ + + int8_t platform; /* +68: 1 platform of the converter (only IBM now) */ + int8_t conversionType; /* +69: 1 conversion type */ + + int8_t minBytesPerChar; /* +70: 1 Minimum # bytes per char in this codepage */ + int8_t maxBytesPerChar; /* +71: 1 Maximum # bytes output per UChar in this codepage */ + + uint8_t subChar[UCNV_MAX_SUBCHAR_LEN]; /* +72: 4 [note: 4 and 8 byte boundary] */ + int8_t subCharLen; /* +76: 1 */ + + uint8_t hasToUnicodeFallback; /* +77: 1 UBool needs to be changed to UBool to be consistent across platform */ + uint8_t hasFromUnicodeFallback; /* +78: 1 */ + uint8_t unicodeMask; /* +79: 1 bit 0: has supplementary bit 1: has single surrogates */ + uint8_t subChar1; /* +80: 1 single-byte substitution character for IBM MBCS (0 if none) */ + uint8_t reserved[19]; /* +81: 19 to round out the structure */ + /* total size: 100 */ +} UConverterStaticData; + +/* + * Defines the UConverterSharedData struct, + * the immutable, shared part of UConverter. + */ +struct UConverterSharedData { + uint32_t structSize; /* Size of this structure */ + uint32_t referenceCounter; /* used to count number of clients, unused for static/immutable SharedData */ + + const void *dataMemory; /* from udata_openChoice() - for cleanup */ + + const UConverterStaticData *staticData; /* pointer to the static (non changing) data. */ + + UBool sharedDataCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ + /** If false, then referenceCounter is not used. Must not change after initialization. */ + UBool isReferenceCounted; + + const UConverterImpl *impl; /* vtable-style struct of mostly function pointers */ + + /*initial values of some members of the mutable part of object */ + uint32_t toUnicodeStatus; + + /* + * Shared data structures currently come in two flavors: + * - readonly for built-in algorithmic converters + * - allocated for MBCS, with a pointer to an allocated UConverterTable + * which always has a UConverterMBCSTable + * + * To eliminate one allocation, I am making the UConverterMBCSTable + * a member of the shared data. + * + * markus 2003-nov-07 + */ + UConverterMBCSTable mbcs; +}; + +/** UConverterSharedData initializer for static, non-reference-counted converters. */ +#define UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(pStaticData, pImpl) \ + { \ + sizeof(UConverterSharedData), ~((uint32_t)0), \ + NULL, pStaticData, false, false, pImpl, \ + 0, UCNV_MBCS_TABLE_INITIALIZER \ + } + +/* Defines a UConverter, the lightweight mutable part the user sees */ + +struct UConverter { + /* + * Error function pointer called when conversion issues + * occur during a ucnv_fromUnicode call + */ + void (U_EXPORT2 *fromUCharErrorBehaviour) (const void *context, + UConverterFromUnicodeArgs *args, + const UChar *codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode *); + /* + * Error function pointer called when conversion issues + * occur during a ucnv_toUnicode call + */ + void (U_EXPORT2 *fromCharErrorBehaviour) (const void *context, + UConverterToUnicodeArgs *args, + const char *codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode *); + + /* + * Pointer to additional data that depends on the converter type. + * Used by ISO 2022, SCSU, GB 18030 converters, possibly more. + */ + void *extraInfo; + + const void *fromUContext; + const void *toUContext; + + /* + * Pointer to charset bytes for substitution string if subCharLen>0, + * or pointer to Unicode string (UChar *) if subCharLen<0. + * subCharLen==0 is equivalent to using a skip callback. + * If the pointer is !=subUChars then it is allocated with + * UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR bytes. + * The subUChars field is declared as UChar[] not uint8_t[] to + * guarantee alignment for UChars. + */ + uint8_t *subChars; + + UConverterSharedData *sharedData; /* Pointer to the shared immutable part of the converter object */ + + uint32_t options; /* options flags from UConverterOpen, may contain additional bits */ + + UBool sharedDataIsCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */ + UBool isCopyLocal; /* true if UConverter is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ + UBool isExtraLocal; /* true if extraInfo is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */ + + UBool useFallback; + int8_t toULength; /* number of bytes in toUBytes */ + uint8_t toUBytes[UCNV_MAX_CHAR_LEN-1];/* more "toU status"; keeps the bytes of the current character */ + uint32_t toUnicodeStatus; /* Used to internalize stream status information */ + int32_t mode; + uint32_t fromUnicodeStatus; + + /* + * More fromUnicode() status. Serves 3 purposes: + * - keeps a lead surrogate between buffers (similar to toUBytes[]) + * - keeps a lead surrogate at the end of the stream, + * which the framework handles as truncated input + * - if the fromUnicode() implementation returns to the framework + * (ucnv.c ucnv_fromUnicode()), then the framework calls the callback + * for this code point + */ + UChar32 fromUChar32; + + /* + * value for ucnv_getMaxCharSize() + * + * usually simply copied from the static data, but ucnvmbcs.c modifies + * the value depending on the converter type and options + */ + int8_t maxBytesPerUChar; + + int8_t subCharLen; /* length of the codepage specific character sequence */ + int8_t invalidCharLength; + int8_t charErrorBufferLength; /* number of valid bytes in charErrorBuffer */ + + int8_t invalidUCharLength; + int8_t UCharErrorBufferLength; /* number of valid UChars in charErrorBuffer */ + + uint8_t subChar1; /* single-byte substitution character if different from subChar */ + UBool useSubChar1; + char invalidCharBuffer[UCNV_MAX_CHAR_LEN]; /* bytes from last error/callback situation */ + uint8_t charErrorBuffer[UCNV_ERROR_BUFFER_LENGTH]; /* codepage output from Error functions */ + UChar subUChars[UCNV_MAX_SUBCHAR_LEN/U_SIZEOF_UCHAR]; /* see subChars documentation */ + + UChar invalidUCharBuffer[U16_MAX_LENGTH]; /* UChars from last error/callback situation */ + UChar UCharErrorBuffer[UCNV_ERROR_BUFFER_LENGTH]; /* unicode output from Error functions */ + + /* fields for conversion extension */ + + /* store previous UChars/chars to continue partial matches */ + UChar32 preFromUFirstCP; /* >=0: partial match */ + UChar preFromU[UCNV_EXT_MAX_UCHARS]; + char preToU[UCNV_EXT_MAX_BYTES]; + int8_t preFromULength, preToULength; /* negative: replay */ + int8_t preToUFirstLength; /* length of first character */ + + /* new fields for ICU 4.0 */ + UConverterCallbackReason toUCallbackReason; /* (*fromCharErrorBehaviour) reason, set when error is detected */ +}; + +U_CDECL_END /* end of UConverter */ + +#define CONVERTER_FILE_EXTENSION ".cnv" + + +/** + * Return the number of all converter names. + * @param pErrorCode The error code + * @return the number of all converter names + */ +U_CFUNC uint16_t +ucnv_bld_countAvailableConverters(UErrorCode *pErrorCode); + +/** + * Return the (n)th converter name in mixed case, or NULL + * if there is none (typically, if the data cannot be loaded). + * 0<=indexisReferenceCounted + * and this function must be called inside umtx_lock(&cnvCacheMutex). + */ +U_CAPI void +ucnv_unload(UConverterSharedData *sharedData); + +/** + * Swap ICU .cnv conversion tables. See udataswp.h. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucnv_swap(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +U_CAPI void U_EXPORT2 +ucnv_enableCleanup(void); + +#endif + +#endif /* _UCNV_BLD */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_cb.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_cb.cpp deleted file mode 100644 index 1a5463d7b..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_cb.cpp +++ /dev/null @@ -1,261 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2000-2006, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * ucnv_cb.c: -// * External APIs for the ICU's codeset conversion library -// * Helena Shih -// * -// * Modification History: -// * -// * Date Name Description -// * 7/28/2000 srl Implementation -// */ - -// /** -// * @name Character Conversion C API -// * -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ucnv_cb.h" -// #include "ucnv_bld.h" -// #include "ucnv_cnv.h" -// #include "cmemory.h" - -// /* need to update the offsets when the target moves. */ -// /* Note: Recursion may occur in the cb functions, be sure to update the offsets correctly -// if you don't use ucnv_cbXXX functions. Make sure you don't use the same callback within -// the same call stack if the complexity arises. */ -// U_CAPI void U_EXPORT2 -// ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, -// const char* source, -// int32_t length, -// int32_t offsetIndex, -// UErrorCode * err) -// { -// if(U_FAILURE(*err)) { -// return; -// } - -// ucnv_fromUWriteBytes( -// args->converter, -// source, length, -// &args->target, args->targetLimit, -// &args->offsets, offsetIndex, -// err); -// } - -// U_CAPI void U_EXPORT2 -// ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, -// const UChar** source, -// const UChar* sourceLimit, -// int32_t offsetIndex, -// UErrorCode * err) -// { -// /* -// This is a fun one. Recursion can occur - we're basically going to -// just retry shoving data through the same converter. Note, if you got -// here through some kind of invalid sequence, you maybe should emit a -// reset sequence of some kind and/or call ucnv_reset(). Since this -// IS an actual conversion, take care that you've changed the callback -// or the data, or you'll get an infinite loop. - -// Please set the err value to something reasonable before calling -// into this. -// */ - -// char *oldTarget; - -// if(U_FAILURE(*err)) -// { -// return; -// } - -// oldTarget = args->target; - -// ucnv_fromUnicode(args->converter, -// &args->target, -// args->targetLimit, -// source, -// sourceLimit, -// NULL, /* no offsets */ -// FALSE, /* no flush */ -// err); - -// if(args->offsets) -// { -// while (args->target != oldTarget) /* if it moved at all.. */ -// { -// *(args->offsets)++ = offsetIndex; -// oldTarget++; -// } -// } - -// /* -// Note, if you did something like used a Stop subcallback, things would get interesting. -// In fact, here's where we want to return the partially consumed in-source! -// */ -// if(*err == U_BUFFER_OVERFLOW_ERROR) -// /* && (*source < sourceLimit && args->target >= args->targetLimit) -// -- S. Hrcek */ -// { -// /* Overflowed the target. Now, we'll write into the charErrorBuffer. -// It's a fixed size. If we overflow it... Hmm */ -// char *newTarget; -// const char *newTargetLimit; -// UErrorCode err2 = U_ZERO_ERROR; - -// int8_t errBuffLen; - -// errBuffLen = args->converter->charErrorBufferLength; - -// /* start the new target at the first free slot in the errbuff.. */ -// newTarget = (char *)(args->converter->charErrorBuffer + errBuffLen); - -// newTargetLimit = (char *)(args->converter->charErrorBuffer + -// sizeof(args->converter->charErrorBuffer)); - -// if(newTarget >= newTargetLimit) -// { -// *err = U_INTERNAL_PROGRAM_ERROR; -// return; -// } - -// /* We're going to tell the converter that the errbuff len is empty. -// This prevents the existing errbuff from being 'flushed' out onto -// itself. If the errbuff is needed by the converter this time, -// we're hosed - we're out of space! */ - -// args->converter->charErrorBufferLength = 0; - -// ucnv_fromUnicode(args->converter, -// &newTarget, -// newTargetLimit, -// source, -// sourceLimit, -// NULL, -// FALSE, -// &err2); - -// /* We can go ahead and overwrite the length here. We know just how -// to recalculate it. */ - -// args->converter->charErrorBufferLength = (int8_t)( -// newTarget - (char*)args->converter->charErrorBuffer); - -// if((newTarget >= newTargetLimit) || (err2 == U_BUFFER_OVERFLOW_ERROR)) -// { -// /* now we're REALLY in trouble. -// Internal program error - callback shouldn't have written this much -// data! -// */ -// *err = U_INTERNAL_PROGRAM_ERROR; -// return; -// } -// /*else {*/ -// /* sub errs could be invalid/truncated/illegal chars or w/e. -// These might want to be passed on up.. But the problem is, we already -// need to pass U_BUFFER_OVERFLOW_ERROR. That has to override these -// other errs.. */ - -// /* -// if(U_FAILURE(err2)) -// ?? -// */ -// /*}*/ -// } -// } - -// U_CAPI void U_EXPORT2 -// ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, -// int32_t offsetIndex, -// UErrorCode * err) -// { -// UConverter *converter; -// int32_t length; - -// if(U_FAILURE(*err)) { -// return; -// } -// converter = args->converter; -// length = converter->subCharLen; - -// if(length == 0) { -// return; -// } - -// if(length < 0) { -// /* -// * Write/convert the substitution string. Its real length is -length. -// * Unlike the escape callback, we need not change the converter's -// * callback function because ucnv_setSubstString() verified that -// * the string can be converted, so we will not get a conversion error -// * and will not recurse. -// * At worst we should get a U_BUFFER_OVERFLOW_ERROR. -// */ -// const UChar *source = (const UChar *)converter->subChars; -// ucnv_cbFromUWriteUChars(args, &source, source - length, offsetIndex, err); -// return; -// } - -// if(converter->sharedData->impl->writeSub!=NULL) { -// converter->sharedData->impl->writeSub(args, offsetIndex, err); -// } -// else if(converter->subChar1!=0 && (uint16_t)converter->invalidUCharBuffer[0]<=(uint16_t)0xffu) { -// /* -// TODO: Is this untestable because the MBCS converter has a writeSub function to call -// and the other converters don't use subChar1? -// */ -// ucnv_cbFromUWriteBytes(args, -// (const char *)&converter->subChar1, 1, -// offsetIndex, err); -// } -// else { -// ucnv_cbFromUWriteBytes(args, -// (const char *)converter->subChars, length, -// offsetIndex, err); -// } -// } - -// U_CAPI void U_EXPORT2 -// ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, -// const UChar* source, -// int32_t length, -// int32_t offsetIndex, -// UErrorCode * err) -// { -// if(U_FAILURE(*err)) { -// return; -// } - -// ucnv_toUWriteUChars( -// args->converter, -// source, length, -// &args->target, args->targetLimit, -// &args->offsets, offsetIndex, -// err); -// } - -// U_CAPI void U_EXPORT2 -// ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, -// int32_t offsetIndex, -// UErrorCode * err) -// { -// static const UChar kSubstituteChar1 = 0x1A, kSubstituteChar = 0xFFFD; - -// /* could optimize this case, just one uchar */ -// if(args->converter->invalidCharLength == 1 && args->converter->subChar1 != 0) { -// ucnv_cbToUWriteUChars(args, &kSubstituteChar1, 1, offsetIndex, err); -// } else { -// ucnv_cbToUWriteUChars(args, &kSubstituteChar, 1, offsetIndex, err); -// } -// } - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.cpp deleted file mode 100644 index 8fc859a24..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.cpp +++ /dev/null @@ -1,182 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ****************************************************************************** -// * -// * Copyright (C) 1999-2004, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ****************************************************************************** -// * -// * uconv_cnv.c: -// * Implements all the low level conversion functions -// * T_UnicodeConverter_{to,from}Unicode_$ConversionType -// * -// * Change history: -// * -// * 06/29/2000 helena Major rewrite of the callback APIs. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ucnv_err.h" -// #include "unicode/ucnv.h" -// #include "unicode/uset.h" -// #include "ucnv_cnv.h" -// #include "ucnv_bld.h" -// #include "cmemory.h" - -// U_CFUNC void -// ucnv_getCompleteUnicodeSet(const UConverter *cnv, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode) { -// (void)cnv; -// (void)which; -// (void)pErrorCode; -// sa->addRange(sa->set, 0, 0x10ffff); -// } - -// U_CFUNC void -// ucnv_getNonSurrogateUnicodeSet(const UConverter *cnv, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode) { -// (void)cnv; -// (void)which; -// (void)pErrorCode; -// sa->addRange(sa->set, 0, 0xd7ff); -// sa->addRange(sa->set, 0xe000, 0x10ffff); -// } - -// U_CFUNC void -// ucnv_fromUWriteBytes(UConverter *cnv, -// const char *bytes, int32_t length, -// char **target, const char *targetLimit, -// int32_t **offsets, -// int32_t sourceIndex, -// UErrorCode *pErrorCode) { -// char *t=*target; -// int32_t *o; - -// /* write bytes */ -// if(offsets==NULL || (o=*offsets)==NULL) { -// while(length>0 && t0 && t0) { -// if(cnv!=NULL) { -// t=(char *)cnv->charErrorBuffer; -// cnv->charErrorBufferLength=(int8_t)length; -// do { -// *t++=(uint8_t)*bytes++; -// } while(--length>0); -// } -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } -// } - -// U_CFUNC void -// ucnv_toUWriteUChars(UConverter *cnv, -// const UChar *uchars, int32_t length, -// UChar **target, const UChar *targetLimit, -// int32_t **offsets, -// int32_t sourceIndex, -// UErrorCode *pErrorCode) { -// UChar *t=*target; -// int32_t *o; - -// /* write UChars */ -// if(offsets==NULL || (o=*offsets)==NULL) { -// while(length>0 && t0 && t0) { -// if(cnv!=NULL) { -// t=cnv->UCharErrorBuffer; -// cnv->UCharErrorBufferLength=(int8_t)length; -// do { -// *t++=*uchars++; -// } while(--length>0); -// } -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } -// } - -// U_CFUNC void -// ucnv_toUWriteCodePoint(UConverter *cnv, -// UChar32 c, -// UChar **target, const UChar *targetLimit, -// int32_t **offsets, -// int32_t sourceIndex, -// UErrorCode *pErrorCode) { -// UChar *t; -// int32_t *o; - -// t=*target; - -// if(t=0) { -// if(cnv!=NULL) { -// int8_t i=0; -// U16_APPEND_UNSAFE(cnv->UCharErrorBuffer, i, c); -// cnv->UCharErrorBufferLength=i; -// } -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } -// } - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.h b/src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.h index e69de29bb..e89eebe54 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.h @@ -0,0 +1,323 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* ucnv_cnv.h: +* Definitions for converter implementations. +* +* Modification History: +* +* Date Name Description +* 05/09/00 helena Added implementation to handle fallback mappings. +* 06/29/2000 helena Major rewrite of the callback APIs. +*/ + +#ifndef UCNV_CNV_H +#define UCNV_CNV_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "unicode/ucnv_err.h" +#include "unicode/uset.h" +#include "uset_imp.h" + +U_CDECL_BEGIN + +/* this is used in fromUnicode DBCS tables as an "unassigned" marker */ +#define missingCharMarker 0xFFFF + +/* + * #define missingUCharMarker 0xfffe + * + * commented out because there are actually two values used in toUnicode tables: + * U+fffe "unassigned" + * U+ffff "illegal" + */ + +/** Forward declaration, see ucnv_bld.h */ +struct UConverterSharedData; +typedef struct UConverterSharedData UConverterSharedData; + +/* function types for UConverterImpl ---------------------------------------- */ + +/* struct with arguments for UConverterLoad and ucnv_load() */ +typedef struct { + int32_t size; /* sizeof(UConverterLoadArgs) */ + int32_t nestedLoads; /* count nested ucnv_load() calls */ + UBool onlyTestIsLoadable; /* input: don't actually load */ + UBool reserved0; /* reserved - for good alignment of the pointers */ + int16_t reserved; /* reserved - for good alignment of the pointers */ + uint32_t options; + const char *pkg, *name, *locale; +} UConverterLoadArgs; + +#define UCNV_LOAD_ARGS_INITIALIZER \ + { (int32_t)sizeof(UConverterLoadArgs), 0, false, false, 0, 0, NULL, NULL, NULL } + +typedef void (*UConverterLoad) (UConverterSharedData *sharedData, + UConverterLoadArgs *pArgs, + const uint8_t *raw, UErrorCode *pErrorCode); +typedef void (*UConverterUnload) (UConverterSharedData *sharedData); + +typedef void (*UConverterOpen) (UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *pErrorCode); +typedef void (*UConverterClose) (UConverter *cnv); + +typedef enum UConverterResetChoice { + UCNV_RESET_BOTH, + UCNV_RESET_TO_UNICODE, + UCNV_RESET_FROM_UNICODE +} UConverterResetChoice; + +typedef void (*UConverterReset) (UConverter *cnv, UConverterResetChoice choice); + +/* + * Converter implementation function(s) for ucnv_toUnicode(). + * If the toUnicodeWithOffsets function pointer is NULL, + * then the toUnicode function will be used and the offsets will be set to -1. + * + * Must maintain state across buffers. Use toUBytes[toULength] for partial input + * sequences; it will be checked in ucnv.c at the end of the input stream + * to detect truncated input. + * Some converters may need additional detection and may then set U_TRUNCATED_CHAR_FOUND. + * + * The toUnicodeWithOffsets must write exactly as many offset values as target + * units. Write offset values of -1 for when the source index corresponding to + * the output unit is not known (e.g., the character started in an earlier buffer). + * The pArgs->offsets pointer need not be moved forward. + * + * At function return, either one of the following conditions must be true: + * - U_BUFFER_OVERFLOW_ERROR and the target is full: target==targetLimit + * - another error code with toUBytes[toULength] set to the offending input + * - no error, and the source is consumed: source==sourceLimit + * + * The ucnv.c code will handle the end of the input (reset) + * (reset, and truncation detection) and callbacks. + */ +typedef void (*UConverterToUnicode) (UConverterToUnicodeArgs *, UErrorCode *); + +/* + * Same rules as for UConverterToUnicode. + * A lead surrogate is kept in fromUChar32 across buffers, and if an error + * occurs, then the offending input code point must be put into fromUChar32 + * as well. + */ +typedef void (*UConverterFromUnicode) (UConverterFromUnicodeArgs *, UErrorCode *); + +/* + * Converter implementation function for ucnv_convertEx(), for direct conversion + * between two charsets without pivoting through UTF-16. + * The rules are the same as for UConverterToUnicode and UConverterFromUnicode. + * In addition, + * - The toUnicode side must behave and keep state exactly like the + * UConverterToUnicode implementation for the same source charset. + * - A U_USING_DEFAULT_WARNING can be set to request to temporarily fall back + * to pivoting. When this function is called, the conversion framework makes + * sure that this warning is not set on input. + * - Continuing a partial match and flushing the toUnicode replay buffer + * are handled by pivoting, using the toUnicode and fromUnicode functions. + */ +typedef void (*UConverterConvert) (UConverterFromUnicodeArgs *pFromUArgs, + UConverterToUnicodeArgs *pToUArgs, + UErrorCode *pErrorCode); + +/* + * Converter implementation function for ucnv_getNextUChar(). + * If the function pointer is NULL, then the toUnicode function will be used. + * + * Will be called at a character boundary (toULength==0). + * May return with + * - U_INDEX_OUTOFBOUNDS_ERROR if there was no output for the input + * (the return value will be ignored) + * - U_TRUNCATED_CHAR_FOUND or another error code (never U_BUFFER_OVERFLOW_ERROR!) + * with toUBytes[toULength] set to the offending input + * (the return value will be ignored) + * - return UCNV_GET_NEXT_UCHAR_USE_TO_U, without moving the source pointer, + * to indicate that the ucnv.c code shall call the toUnicode function instead + * - return a real code point result + * + * Unless UCNV_GET_NEXT_UCHAR_USE_TO_U is returned, the source bytes must be consumed. + * + * The ucnv.c code will handle the end of the input (reset) + * (except for truncation detection!) and callbacks. + */ +typedef UChar32 (*UConverterGetNextUChar) (UConverterToUnicodeArgs *, UErrorCode *); + +typedef void (*UConverterGetStarters)(const UConverter* converter, + UBool starters[256], + UErrorCode *pErrorCode); + +/* If this function pointer is null or if the function returns null + * the name field in static data struct should be returned by + * ucnv_getName() API function + */ +typedef const char * (*UConverterGetName) (const UConverter *cnv); + +/** + * Write the codepage substitution character. + * If this function is not set, then ucnv_cbFromUWriteSub() writes + * the substitution character from UConverter. + * For stateful converters, it is typically necessary to handle this + * specifically for the converter in order to properly maintain the state. + */ +typedef void (*UConverterWriteSub) (UConverterFromUnicodeArgs *pArgs, int32_t offsetIndex, UErrorCode *pErrorCode); + +/** + * For converter-specific safeClone processing + * If this function is not set, then ucnv_safeClone assumes that the converter has no private data that changes + * after the converter is done opening. + * If this function is set, then it is called just after a memcpy() of + * converter data to the new, empty converter, and is expected to set up + * the initial state of the converter. It is not expected to increment the + * reference counts of the standard data types such as the shared data. + */ +typedef UConverter * (*UConverterSafeClone) (const UConverter *cnv, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +/** + * Filters for some ucnv_getUnicodeSet() implementation code. + */ +typedef enum UConverterSetFilter { + UCNV_SET_FILTER_NONE, + UCNV_SET_FILTER_DBCS_ONLY, + UCNV_SET_FILTER_2022_CN, + UCNV_SET_FILTER_SJIS, + UCNV_SET_FILTER_GR94DBCS, + UCNV_SET_FILTER_HZ, + UCNV_SET_FILTER_COUNT +} UConverterSetFilter; + +/** + * Fills the set of Unicode code points that can be converted by an ICU converter. + * The API function ucnv_getUnicodeSet() clears the USet before calling + * the converter's getUnicodeSet() implementation; the converter should only + * add the appropriate code points to allow recursive use. + * For example, the ISO-2022-JP converter will call each subconverter's + * getUnicodeSet() implementation to consecutively add code points to + * the same USet, which will result in a union of the sets of all subconverters. + * + * For more documentation, see ucnv_getUnicodeSet() in ucnv.h. + */ +typedef void (*UConverterGetUnicodeSet) (const UConverter *cnv, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +UBool CONVERSION_U_SUCCESS (UErrorCode err); + +/** + * UConverterImpl contains all the data and functions for a converter type. + * Its function pointers work much like a C++ vtable. + * Many converter types need to define only a subset of the functions; + * when a function pointer is NULL, then a default action will be performed. + * + * Every converter type must implement toUnicode, fromUnicode, and getNextUChar, + * otherwise the converter may crash. + * Every converter type that has variable-length codepage sequences should + * also implement toUnicodeWithOffsets and fromUnicodeWithOffsets for + * correct offset handling. + * All other functions may or may not be implemented - it depends only on + * whether the converter type needs them. + * + * When open() fails, then close() will be called, if present. + */ +struct UConverterImpl { + UConverterType type; + + UConverterLoad load; + UConverterUnload unload; + + UConverterOpen open; + UConverterClose close; + UConverterReset reset; + + UConverterToUnicode toUnicode; + UConverterToUnicode toUnicodeWithOffsets; + UConverterFromUnicode fromUnicode; + UConverterFromUnicode fromUnicodeWithOffsets; + UConverterGetNextUChar getNextUChar; + + UConverterGetStarters getStarters; + UConverterGetName getName; + UConverterWriteSub writeSub; + UConverterSafeClone safeClone; + UConverterGetUnicodeSet getUnicodeSet; + + UConverterConvert toUTF8; + UConverterConvert fromUTF8; +}; + +extern const UConverterSharedData + _MBCSData, _Latin1Data, + _UTF8Data, _UTF16BEData, _UTF16LEData, _UTF32BEData, _UTF32LEData, + _ISO2022Data, + _LMBCSData1,_LMBCSData2, _LMBCSData3, _LMBCSData4, _LMBCSData5, _LMBCSData6, + _LMBCSData8,_LMBCSData11,_LMBCSData16,_LMBCSData17,_LMBCSData18,_LMBCSData19, + _HZData,_ISCIIData, _SCSUData, _ASCIIData, + _UTF7Data, _Bocu1Data, _UTF16Data, _UTF32Data, _CESU8Data, _IMAPData, _CompoundTextData; + +U_CDECL_END + +/** Always use fallbacks from codepage to Unicode */ +#define TO_U_USE_FALLBACK(useFallback) true +#define UCNV_TO_U_USE_FALLBACK(cnv) true + +/** Use fallbacks from Unicode to codepage when cnv->useFallback or for private-use code points */ +#define IS_PRIVATE_USE(c) ((uint32_t)((c)-0xe000)<0x1900 || (uint32_t)((c)-0xf0000)<0x20000) +#define FROM_U_USE_FALLBACK(useFallback, c) ((useFallback) || IS_PRIVATE_USE(c)) +#define UCNV_FROM_U_USE_FALLBACK(cnv, c) FROM_U_USE_FALLBACK((cnv)->useFallback, c) + +/** + * Magic number for ucnv_getNextUChar(), returned by a + * getNextUChar() implementation to indicate to use the converter's toUnicode() + * instead of the native function. + * @internal + */ +#define UCNV_GET_NEXT_UCHAR_USE_TO_U -9 + +U_CFUNC void +ucnv_getCompleteUnicodeSet(const UConverter *cnv, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +U_CFUNC void +ucnv_getNonSurrogateUnicodeSet(const UConverter *cnv, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +U_CFUNC void +ucnv_fromUWriteBytes(UConverter *cnv, + const char *bytes, int32_t length, + char **target, const char *targetLimit, + int32_t **offsets, + int32_t sourceIndex, + UErrorCode *pErrorCode); +U_CFUNC void +ucnv_toUWriteUChars(UConverter *cnv, + const UChar *uchars, int32_t length, + UChar **target, const UChar *targetLimit, + int32_t **offsets, + int32_t sourceIndex, + UErrorCode *pErrorCode); + +U_CFUNC void +ucnv_toUWriteCodePoint(UConverter *cnv, + UChar32 c, + UChar **target, const UChar *targetLimit, + int32_t **offsets, + int32_t sourceIndex, + UErrorCode *pErrorCode); + +#endif + +#endif /* UCNV_CNV */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_ct.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_ct.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_err.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_err.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_ext.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_ext.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_ext.h b/src/duckdb/extension/icu/third_party/icu/common/ucnv_ext.h index e69de29bb..dceea7ef1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_ext.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucnv_ext.h @@ -0,0 +1,481 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2003-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ucnv_ext.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003jun13 +* created by: Markus W. Scherer +* +* Conversion extensions +*/ + +#ifndef __UCNV_EXT_H__ +#define __UCNV_EXT_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "ucnv_cnv.h" + +/* + * See icuhtml/design/conversion/conversion_extensions.html + * + * Conversion extensions serve three purposes: + * 1. They support m:n mappings. + * 2. They support extension-only conversion files that are used together + * with the regular conversion data in base files. + * 3. They support mappings with more complicated meta data, + * for example "good one-way" mappings (|4). + * + * A base file may contain an extension table (explicitly requested or + * implicitly generated for m:n mappings), but its extension table is not + * used when an extension-only file is used. + * + * It is an error if a base file contains any regular (not extension) mapping + * from the same sequence as a mapping in the extension file + * because the base mapping would hide the extension mapping. + * + * + * Data for conversion extensions: + * + * One set of data structures per conversion direction (to/from Unicode). + * The data structures are sorted by input units to allow for binary search. + * Input sequences of more than one unit are handled like contraction tables + * in collation: + * The lookup value of a unit points to another table that is to be searched + * for the next unit, recursively. + * + * For conversion from Unicode, the initial code point is looked up in + * a 3-stage trie for speed, + * with an additional table of unique results to save space. + * + * Long output strings are stored in separate arrays, with length and index + * in the lookup tables. + * Output results also include a flag distinguishing roundtrip from + * (reverse) fallback mappings. + * + * Input Unicode strings must not begin or end with unpaired surrogates + * to avoid problems with matches on parts of surrogate pairs. + * + * Mappings from multiple characters (code points or codepage state + * table sequences) must be searched preferring the longest match. + * For this to work and be efficient, the variable-width table must contain + * all mappings that contain prefixes of the multiple characters. + * If an extension table is built on top of a base table in another file + * and a base table entry is a prefix of a multi-character mapping, then + * this is an error. + * + * + * Implementation note: + * + * Currently, the parser and several checks in the code limit the number + * of UChars or bytes in a mapping to + * UCNV_EXT_MAX_UCHARS and UCNV_EXT_MAX_BYTES, respectively, + * which are output value limits in the data structure. + * + * For input, this is not strictly necessary - it is a hard limit only for the + * buffers in UConverter that are used to store partial matches. + * + * Input sequences could otherwise be arbitrarily long if partial matches + * need not be stored (i.e., if a sequence does not span several buffers with too + * many units before the last buffer), although then results would differ + * depending on whether partial matches exceed the limits or not, + * which depends on the pattern of buffer sizes. + * + * + * Data structure: + * + * int32_t indexes[>=32]; + * + * Array of indexes and lengths etc. The length of the array is at least 32. + * The actual length is stored in indexes[0] to be forward compatible. + * + * Each index to another array is the number of bytes from indexes[]. + * Each length of an array is the number of array base units in that array. + * + * Some of the structures may not be present, in which case their indexes + * and lengths are 0. + * + * Usage of indexes[i]: + * [0] length of indexes[] + * + * // to Unicode table + * [1] index of toUTable[] (array of uint32_t) + * [2] length of toUTable[] + * [3] index of toUUChars[] (array of UChar) + * [4] length of toUUChars[] + * + * // from Unicode table, not for the initial code point + * [5] index of fromUTableUChars[] (array of UChar) + * [6] index of fromUTableValues[] (array of uint32_t) + * [7] length of fromUTableUChars[] and fromUTableValues[] + * [8] index of fromUBytes[] (array of char) + * [9] length of fromUBytes[] + * + * // from Unicode trie for initial-code point lookup + * [10] index of fromUStage12[] (combined array of uint16_t for stages 1 & 2) + * [11] length of stage 1 portion of fromUStage12[] + * [12] length of fromUStage12[] + * [13] index of fromUStage3[] (array of uint16_t indexes into fromUStage3b[]) + * [14] length of fromUStage3[] + * [15] index of fromUStage3b[] (array of uint32_t like fromUTableValues[]) + * [16] length of fromUStage3b[] + * + * [17] Bit field containing numbers of bytes: + * 31..24 reserved, 0 + * 23..16 maximum input bytes + * 15.. 8 maximum output bytes + * 7.. 0 maximum bytes per UChar + * + * [18] Bit field containing numbers of UChars: + * 31..24 reserved, 0 + * 23..16 maximum input UChars + * 15.. 8 maximum output UChars + * 7.. 0 maximum UChars per byte + * + * [19] Bit field containing flags: + * (extension table unicodeMask) + * 1 UCNV_HAS_SURROGATES flag for the extension table + * 0 UCNV_HAS_SUPPLEMENTARY flag for the extension table + * + * [20]..[30] reserved, 0 + * [31] number of bytes for the entire extension structure + * [>31] reserved; there are indexes[0] indexes + * + * + * uint32_t toUTable[]; + * + * Array of byte/value pairs for lookups for toUnicode conversion. + * The array is partitioned into sections like collation contraction tables. + * Each section contains one word with the number of following words and + * a default value for when the lookup in this section yields no match. + * + * A section is sorted in ascending order of input bytes, + * allowing for fast linear or binary searches. + * The builder may store entries for a contiguous range of byte values + * (compare difference between the first and last one with count), + * which then allows for direct array access. + * The builder should always do this for the initial table section. + * + * Entries may have 0 values, see below. + * No two entries in a section have the same byte values. + * + * Each uint32_t contains an input byte value in bits 31..24 and the + * corresponding lookup value in bits 23..0. + * Interpret the value as follows: + * if(value==0) { + * no match, see below + * } else if(value<0x1f0000) { + * partial match - use value as index to the next toUTable section + * and match the next unit; (value indexes toUTable[value]) + * } else { + * if(bit 23 set) { + * roundtrip; + * } else { + * fallback; + * } + * unset value bit 23; + * if(value<=0x2fffff) { + * (value-0x1f0000) is a code point; (BMP: value<=0x1fffff) + * } else { + * bits 17..0 (value&0x3ffff) is an index to + * the result UChars in toUUChars[]; (0 indexes toUUChars[0]) + * length of the result=((value>>18)-12); (length=0..19) + * } + * } + * + * The first word in a section contains the number of following words in the + * input byte position (bits 31..24, number=1..0xff). + * The value of the initial word is used when the current byte is not found + * in this section. + * If the value is not 0, then it represents a result as above. + * If the value is 0, then the search has to return a shorter match with an + * earlier default value as the result, or result in "unmappable" even for the + * initial bytes. + * If the value is 0 for the initial toUTable entry, then the initial byte + * does not start any mapping input. + * + * + * UChar toUUChars[]; + * + * Contains toUnicode mapping results, stored as sequences of UChars. + * Indexes and lengths stored in the toUTable[]. + * + * + * UChar fromUTableUChars[]; + * uint32_t fromUTableValues[]; + * + * The fromUTable is split into two arrays, but works otherwise much like + * the toUTable. The array is partitioned into sections like collation + * contraction tables and toUTable. + * A row in the table consists of same-index entries in fromUTableUChars[] + * and fromUTableValues[]. + * + * Interpret a value as follows: + * if(value==0) { + * no match, see below + * } else if(value<=0xffffff) { (bits 31..24 are 0) + * partial match - use value as index to the next fromUTable section + * and match the next unit; (value indexes fromUTable[value]) + * } else { + * if(value==0x80000001) { + * return no mapping, but request for ; + * } + * if(bit 31 set) { + * roundtrip (|0); + * } else if(bit 30 set) { + * "good one-way" mapping (|4); -- new in ICU4C 51, _MBCSHeader.version 5.4/4.4 + * } else { + * normal fallback (|1); + * } + * // bit 29 reserved, 0 + * length=(value>>24)&0x1f; (bits 28..24) + * if(length==1..3) { + * bits 23..0 contain 1..3 bytes, padded with 00s on the left; + * } else { + * bits 23..0 (value&0xffffff) is an index to + * the result bytes in fromUBytes[]; (0 indexes fromUBytes[0]) + * } + * } + * + * The first pair in a section contains the number of following pairs in the + * UChar position (16 bits, number=1..0xffff). + * The value of the initial pair is used when the current UChar is not found + * in this section. + * If the value is not 0, then it represents a result as above. + * If the value is 0, then the search has to return a shorter match with an + * earlier default value as the result, or result in "unmappable" even for the + * initial UChars. + * + * If the from Unicode trie is present, then the from Unicode search tables + * are not used for initial code points. + * In this case, the first entries (index 0) in the tables are not used + * (reserved, set to 0) because a value of 0 is used in trie results + * to indicate no mapping. + * + * + * uint16_t fromUStage12[]; + * + * Stages 1 & 2 of a trie that maps an initial code point. + * Indexes in stage 1 are all offset by the length of stage 1 so that the + * same array pointer can be used for both stages. + * If (c>>10)>=(length of stage 1) then c does not start any mapping. + * Same bit distribution as for regular conversion tries. + * + * + * uint16_t fromUStage3[]; + * uint32_t fromUStage3b[]; + * + * Stage 3 of the trie. The first array simply contains indexes to the second, + * which contains words in the same format as fromUTableValues[]. + * Use a stage 3 granularity of 4, which allows for 256k stage 3 entries, + * and 16-bit entries in stage 3 allow for 64k stage 3b entries. + * The stage 3 granularity means that the stage 2 entry needs to be left-shifted. + * + * Two arrays are used because it is expected that more than half of the stage 3 + * entries will be zero. The 16-bit index stage 3 array saves space even + * considering storing a total of 6 bytes per non-zero entry in both arrays + * together. + * Using a stage 3 granularity of >1 diminishes the compactability in that stage + * but provides a larger effective addressing space in stage 2. + * All but the final result stage use 16-bit entries to save space. + * + * fromUStage3b[] contains a zero for "no mapping" at its index 0, + * and may contain UCNV_EXT_FROM_U_SUBCHAR1 at index 1 for " SUB mapping" + * (i.e., "no mapping" with preference for rather than ), + * and all other items are unique non-zero results. + * + * The default value of a fromUTableValues[] section that is referenced + * _directly_ from a fromUStage3b[] item may also be UCNV_EXT_FROM_U_SUBCHAR1, + * but this value must not occur anywhere else in fromUTableValues[] + * because "no mapping" is always a property of a single code point, + * never of multiple. + * + * + * char fromUBytes[]; + * + * Contains fromUnicode mapping results, stored as sequences of chars. + * Indexes and lengths stored in the fromUTableValues[]. + */ +enum { + UCNV_EXT_INDEXES_LENGTH, /* 0 */ + + UCNV_EXT_TO_U_INDEX, /* 1 */ + UCNV_EXT_TO_U_LENGTH, + UCNV_EXT_TO_U_UCHARS_INDEX, + UCNV_EXT_TO_U_UCHARS_LENGTH, + + UCNV_EXT_FROM_U_UCHARS_INDEX, /* 5 */ + UCNV_EXT_FROM_U_VALUES_INDEX, + UCNV_EXT_FROM_U_LENGTH, + UCNV_EXT_FROM_U_BYTES_INDEX, + UCNV_EXT_FROM_U_BYTES_LENGTH, + + UCNV_EXT_FROM_U_STAGE_12_INDEX, /* 10 */ + UCNV_EXT_FROM_U_STAGE_1_LENGTH, + UCNV_EXT_FROM_U_STAGE_12_LENGTH, + UCNV_EXT_FROM_U_STAGE_3_INDEX, + UCNV_EXT_FROM_U_STAGE_3_LENGTH, + UCNV_EXT_FROM_U_STAGE_3B_INDEX, + UCNV_EXT_FROM_U_STAGE_3B_LENGTH, + + UCNV_EXT_COUNT_BYTES, /* 17 */ + UCNV_EXT_COUNT_UCHARS, + UCNV_EXT_FLAGS, + + UCNV_EXT_RESERVED_INDEX, /* 20, moves with additional indexes */ + + UCNV_EXT_SIZE=31, + UCNV_EXT_INDEXES_MIN_LENGTH=32 +}; + +/* get the pointer to an extension array from indexes[index] */ +#define UCNV_EXT_ARRAY(indexes, index, itemType) \ + ((const itemType *)((const char *)(indexes)+(indexes)[index])) + +#define UCNV_GET_MAX_BYTES_PER_UCHAR(indexes) \ + ((indexes)[UCNV_EXT_COUNT_BYTES]&0xff) + +/* internal API ------------------------------------------------------------- */ + +U_CFUNC UBool +ucnv_extInitialMatchToU(UConverter *cnv, const int32_t *cx, + int32_t firstLength, + const char **src, const char *srcLimit, + UChar **target, const UChar *targetLimit, + int32_t **offsets, int32_t srcIndex, + UBool flush, + UErrorCode *pErrorCode); + +U_CFUNC UChar32 +ucnv_extSimpleMatchToU(const int32_t *cx, + const char *source, int32_t length, + UBool useFallback); + +U_CFUNC void +ucnv_extContinueMatchToU(UConverter *cnv, + UConverterToUnicodeArgs *pArgs, int32_t srcIndex, + UErrorCode *pErrorCode); + + +U_CFUNC UBool +ucnv_extInitialMatchFromU(UConverter *cnv, const int32_t *cx, + UChar32 cp, + const UChar **src, const UChar *srcLimit, + char **target, const char *targetLimit, + int32_t **offsets, int32_t srcIndex, + UBool flush, + UErrorCode *pErrorCode); + +U_CFUNC int32_t +ucnv_extSimpleMatchFromU(const int32_t *cx, + UChar32 cp, uint32_t *pValue, + UBool useFallback); + +U_CFUNC void +ucnv_extContinueMatchFromU(UConverter *cnv, + UConverterFromUnicodeArgs *pArgs, int32_t srcIndex, + UErrorCode *pErrorCode); + +/* + * Add code points and strings to the set according to the extension mappings. + * Limitation on the UConverterSetFilter: + * The filters currently assume that they are used with 1:1 mappings. + * They only apply to single input code points, and then they pass through + * only mappings with single-charset-code results. + * For example, the Shift-JIS filter only works for 2-byte results and tests + * that those 2 bytes are in the JIS X 0208 range of Shift-JIS. + */ +U_CFUNC void +ucnv_extGetUnicodeSet(const UConverterSharedData *sharedData, + const USetAdder *sa, + UConverterUnicodeSet which, + UConverterSetFilter filter, + UErrorCode *pErrorCode); + +/* toUnicode helpers -------------------------------------------------------- */ + +#define UCNV_EXT_TO_U_BYTE_SHIFT 24 +#define UCNV_EXT_TO_U_VALUE_MASK 0xffffff +#define UCNV_EXT_TO_U_MIN_CODE_POINT 0x1f0000 +#define UCNV_EXT_TO_U_MAX_CODE_POINT 0x2fffff +#define UCNV_EXT_TO_U_ROUNDTRIP_FLAG ((uint32_t)1<<23) +#define UCNV_EXT_TO_U_INDEX_MASK 0x3ffff +#define UCNV_EXT_TO_U_LENGTH_SHIFT 18 +#define UCNV_EXT_TO_U_LENGTH_OFFSET 12 + +/* maximum number of indexed UChars */ +#define UCNV_EXT_MAX_UCHARS 19 + +#define UCNV_EXT_TO_U_MAKE_WORD(byte, value) (((uint32_t)(byte)<>UCNV_EXT_TO_U_BYTE_SHIFT) +#define UCNV_EXT_TO_U_GET_VALUE(word) ((word)&UCNV_EXT_TO_U_VALUE_MASK) + +#define UCNV_EXT_TO_U_IS_PARTIAL(value) ((value)>UCNV_EXT_TO_U_LENGTH_SHIFT)-UCNV_EXT_TO_U_LENGTH_OFFSET) + +/* fromUnicode helpers ------------------------------------------------------ */ + +/* most trie constants are shared with ucnvmbcs.h */ + +/* see similar utrie.h UTRIE_INDEX_SHIFT and UTRIE_DATA_GRANULARITY */ +#define UCNV_EXT_STAGE_2_LEFT_SHIFT 2 +#define UCNV_EXT_STAGE_3_GRANULARITY 4 + +/* trie access, returns the stage 3 value=index to stage 3b; s1Index=c>>10 */ +#define UCNV_EXT_FROM_U(stage12, stage3, s1Index, c) \ + (stage3)[ ((int32_t)(stage12)[ (stage12)[s1Index] +(((c)>>4)&0x3f) ]< (impossible roundtrip to 0 bytes, value 01) */ +#define UCNV_EXT_FROM_U_SUBCHAR1 0x80000001 + +/* at most 3 bytes in the lower part of the value */ +#define UCNV_EXT_FROM_U_MAX_DIRECT_LENGTH 3 + +/* maximum number of indexed bytes */ +#define UCNV_EXT_MAX_BYTES 0x1f + +#define UCNV_EXT_FROM_U_IS_PARTIAL(value) (((value)>>UCNV_EXT_FROM_U_LENGTH_SHIFT)==0) +#define UCNV_EXT_FROM_U_GET_PARTIAL_INDEX(value) (value) + +#define UCNV_EXT_FROM_U_IS_ROUNDTRIP(value) (((value)&UCNV_EXT_FROM_U_ROUNDTRIP_FLAG)!=0) +#define UCNV_EXT_FROM_U_MASK_ROUNDTRIP(value) ((value)&~UCNV_EXT_FROM_U_ROUNDTRIP_FLAG) + +/* get length; masks away all other bits */ +#define UCNV_EXT_FROM_U_GET_LENGTH(value) (int32_t)(((value)>>UCNV_EXT_FROM_U_LENGTH_SHIFT)&UCNV_EXT_MAX_BYTES) + +/* get bytes or bytes index */ +#define UCNV_EXT_FROM_U_GET_DATA(value) ((value)&UCNV_EXT_FROM_U_DATA_MASK) + +#endif + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_imp.h b/src/duckdb/extension/icu/third_party/icu/common/ucnv_imp.h index e69de29bb..cb939911e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_imp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucnv_imp.h @@ -0,0 +1,139 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* +* ucnv_imp.h: +* Contains all internal and external data structure definitions +* Created & Maintained by Bertrand A. Damiba +* +* +* +* ATTENTION: +* --------- +* Although the data structures in this file are open and stack allocatable +* we reserve the right to hide them in further releases. +*/ + +#ifndef UCNV_IMP_H +#define UCNV_IMP_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/uloc.h" +#include "ucnv_bld.h" + +/* + * Fast check for whether a charset name is "UTF-8". + * This does not recognize all of the variations that ucnv_open() + * and other functions recognize, but it covers most cases. + * @param name const char * charset name + * @return + */ +#define UCNV_FAST_IS_UTF8(name) \ + (((name[0]=='U' ? \ + ( name[1]=='T' && name[2]=='F') : \ + (name[0]=='u' && name[1]=='t' && name[2]=='f'))) \ + && (name[3]=='-' ? \ + (name[4]=='8' && name[5]==0) : \ + (name[3]=='8' && name[4]==0))) + +typedef struct { + char cnvName[UCNV_MAX_CONVERTER_NAME_LENGTH]; + char locale[ULOC_FULLNAME_CAPACITY]; + uint32_t options; +} UConverterNamePieces; + +U_CFUNC UBool +ucnv_canCreateConverter(const char *converterName, UErrorCode *err); + +/* figures out if we need to go to file to read in the data tables. + * @param converterName The name of the converter + * @param err The error code + * @return the newly created converter + */ +U_CAPI UConverter * +ucnv_createConverter(UConverter *myUConverter, const char *converterName, UErrorCode * err); + +/* + * Open a purely algorithmic converter, specified by a type constant. + * @param myUConverter NULL, or pre-allocated UConverter structure to avoid + * a memory allocation + * @param type requested converter type + * @param locale locale parameter, or "" + * @param options converter options bit set (default 0) + * @param err ICU error code, not tested for U_FAILURE on input + * because this is an internal function + * @internal + */ +U_CFUNC UConverter * +ucnv_createAlgorithmicConverter(UConverter *myUConverter, + UConverterType type, + const char *locale, uint32_t options, + UErrorCode *err); + +/* + * Creates a converter from shared data. + * Adopts mySharedConverterData: No matter what happens, the caller must not + * unload mySharedConverterData, except via ucnv_close(return value) + * if this function is successful. + */ +U_CFUNC UConverter * +ucnv_createConverterFromSharedData(UConverter *myUConverter, + UConverterSharedData *mySharedConverterData, + UConverterLoadArgs *pArgs, + UErrorCode *err); + +U_CFUNC UConverter * +ucnv_createConverterFromPackage(const char *packageName, const char *converterName, UErrorCode *err); + +/** + * Load a converter but do not create a UConverter object. + * Simply return the UConverterSharedData. + * Performs alias lookup etc. + * The UConverterNamePieces need not be initialized + * before calling this function. + * The UConverterLoadArgs must be initialized + * before calling this function. + * If the args are passed in, then the pieces must be passed in too. + * In other words, the following combinations are allowed: + * - pieces==NULL && args==NULL + * - pieces!=NULL && args==NULL + * - pieces!=NULL && args!=NULL + * @internal + */ +U_CFUNC UConverterSharedData * +ucnv_loadSharedData(const char *converterName, + UConverterNamePieces *pieces, + UConverterLoadArgs *pArgs, + UErrorCode * err); + +/** + * This may unload the shared data in a thread safe manner. + * This will only unload the data if no other converters are sharing it. + */ +U_CFUNC void +ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData); + +/** + * This is a thread safe way to increment the reference count. + */ +U_CFUNC void +ucnv_incrementRefCount(UConverterSharedData *sharedData); + +/** + * These are the default error handling callbacks for the charset conversion framework. + * For performance reasons, they are only called to handle an error (not normally called for a reset or close). + */ +#define UCNV_TO_U_DEFAULT_CALLBACK ((UConverterToUCallback) UCNV_TO_U_CALLBACK_SUBSTITUTE) +#define UCNV_FROM_U_DEFAULT_CALLBACK ((UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE) + +#endif + +#endif /* _UCNV_IMP */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_io.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_io.cpp deleted file mode 100644 index bfec130d3..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_io.cpp +++ /dev/null @@ -1,1360 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ****************************************************************************** -// * -// * Copyright (C) 1999-2015, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ****************************************************************************** -// * -// * -// * ucnv_io.cpp: -// * initializes global variables and defines functions pertaining to converter -// * name resolution aspect of the conversion code. -// * -// * new implementation: -// * -// * created on: 1999nov22 -// * created by: Markus W. Scherer -// * -// * Use the binary cnvalias.icu (created from convrtrs.txt) to work -// * with aliases for converter names. -// * -// * Date Name Description -// * 11/22/1999 markus Created -// * 06/28/2002 grhoten Major overhaul of the converter alias design. -// * Now an alias can map to different converters -// * depending on the specified standard. -// ******************************************************************************* -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/udata.h" - -// #include "umutex.h" -// #include "uarrsort.h" -// #include "uassert.h" -// #include "udataswp.h" -// #include "cstring.h" -// #include "cmemory.h" -// #include "ucnv_io.h" -// #include "uenumimp.h" -// #include "ucln_cmn.h" - -// /* Format of cnvalias.icu ----------------------------------------------------- -// * -// * cnvalias.icu is a binary, memory-mappable form of convrtrs.txt. -// * This binary form contains several tables. All indexes are to uint16_t -// * units, and not to the bytes (uint8_t units). Addressing everything on -// * 16-bit boundaries allows us to store more information with small index -// * numbers, which are also 16-bit in size. The majority of the table (except -// * the string table) are 16-bit numbers. -// * -// * First there is the size of the Table of Contents (TOC). The TOC -// * entries contain the size of each section. In order to find the offset -// * you just need to sum up the previous offsets. -// * The TOC length and entries are an array of uint32_t values. -// * The first section after the TOC starts immediately after the TOC. -// * -// * 1) This section contains a list of converters. This list contains indexes -// * into the string table for the converter name. The index of this list is -// * also used by other sections, which are mentioned later on. -// * This list is not sorted. -// * -// * 2) This section contains a list of tags. This list contains indexes -// * into the string table for the tag name. The index of this list is -// * also used by other sections, which are mentioned later on. -// * This list is in priority order of standards. -// * -// * 3) This section contains a list of sorted unique aliases. This -// * list contains indexes into the string table for the alias name. The -// * index of this list is also used by other sections, like the 4th section. -// * The index for the 3rd and 4th section is used to get the -// * alias -> converter name mapping. Section 3 and 4 form a two column table. -// * Some of the most significant bits of each index may contain other -// * information (see findConverter for details). -// * -// * 4) This section contains a list of mapped converter names. Consider this -// * as a table that maps the 3rd section to the 1st section. This list contains -// * indexes into the 1st section. The index of this list is the same index in -// * the 3rd section. There is also some extra information in the high bits of -// * each converter index in this table. Currently it's only used to say that -// * an alias mapped to this converter is ambiguous. See UCNV_CONVERTER_INDEX_MASK -// * and UCNV_AMBIGUOUS_ALIAS_MAP_BIT for more information. This section is -// * the predigested form of the 5th section so that an alias lookup can be fast. -// * -// * 5) This section contains a 2D array with indexes to the 6th section. This -// * section is the full form of all alias mappings. The column index is the -// * index into the converter list (column header). The row index is the index -// * to tag list (row header). This 2D array is the top part a 3D array. The -// * third dimension is in the 6th section. -// * -// * 6) This is blob of variable length arrays. Each array starts with a size, -// * and is followed by indexes to alias names in the string table. This is -// * the third dimension to the section 5. No other section should be referencing -// * this section. -// * -// * 7) Starting in ICU 3.6, this can be a UConverterAliasOptions struct. Its -// * presence indicates that a section 9 exists. UConverterAliasOptions specifies -// * what type of string normalization is used among other potential things in the -// * future. -// * -// * 8) This is the string table. All strings are indexed on an even address. -// * There are two reasons for this. First many chip architectures locate strings -// * faster on even address boundaries. Second, since all indexes are 16-bit -// * numbers, this string table can be 128KB in size instead of 64KB when we -// * only have strings starting on an even address. -// * -// * 9) When present this is a set of prenormalized strings from section 8. This -// * table contains normalized strings with the dashes and spaces stripped out, -// * and all strings lowercased. In the future, the options in section 7 may state -// * other types of normalization. -// * -// * Here is the concept of section 5 and 6. It's a 3D cube. Each tag -// * has a unique alias among all converters. That same alias can -// * be mentioned in other standards on different converters, -// * but only one alias per tag can be unique. -// * -// * -// * Converter Names (Usually in TR22 form) -// * -------------------------------------------. -// * T / /| -// * a / / | -// * g / / | -// * s / / | -// * / / | -// * ------------------------------------------/ | -// * A | | | -// * l | | | -// * i | | / -// * a | | / -// * s | | / -// * e | | / -// * s | |/ -// * ------------------------------------------- -// * -// * -// * -// * Here is what it really looks like. It's like swiss cheese. -// * There are holes. Some converters aren't recognized by -// * a standard, or they are really old converters that the -// * standard doesn't recognize anymore. -// * -// * Converter Names (Usually in TR22 form) -// * -------------------------------------------. -// * T /##########################################/| -// * a / # # /# -// * g / # ## ## ### # ### ### ### #/ -// * s / # ##### #### ## ## #/# -// * / ### # # ## # # # ### # # #/## -// * ------------------------------------------/# # -// * A |### # # ## # # # ### # # #|# # -// * l |# # # # # ## # #|# # -// * i |# # # # # # #|# -// * a |# #|# -// * s | #|# -// * e -// * s -// * -// */ - -// /** -// * Used by the UEnumeration API -// */ -// typedef struct UAliasContext { -// uint32_t listOffset; -// uint32_t listIdx; -// } UAliasContext; - -// static const char DATA_NAME[] = "cnvalias"; -// static const char DATA_TYPE[] = "icu"; - -// static UDataMemory *gAliasData=NULL; -// static icu::UInitOnce gAliasDataInitOnce = U_INITONCE_INITIALIZER; - -// enum { -// tocLengthIndex=0, -// converterListIndex=1, -// tagListIndex=2, -// aliasListIndex=3, -// untaggedConvArrayIndex=4, -// taggedAliasArrayIndex=5, -// taggedAliasListsIndex=6, -// tableOptionsIndex=7, -// stringTableIndex=8, -// normalizedStringTableIndex=9, -// offsetsCount, /* length of the swapper's temporary offsets[] */ -// minTocLength=8 /* min. tocLength in the file, does not count the tocLengthIndex! */ -// }; - -// static const UConverterAliasOptions defaultTableOptions = { -// UCNV_IO_UNNORMALIZED, -// 0 /* containsCnvOptionInfo */ -// }; -// static UConverterAlias gMainTable; - -// #define GET_STRING(idx) (const char *)(gMainTable.stringTable + (idx)) -// #define GET_NORMALIZED_STRING(idx) (const char *)(gMainTable.normalizedStringTable + (idx)) - -// static UBool U_CALLCONV -// isAcceptable(void * /*context*/, -// const char * /*type*/, const char * /*name*/, -// const UDataInfo *pInfo) { -// return (UBool)( -// pInfo->size>=20 && -// pInfo->isBigEndian==U_IS_BIG_ENDIAN && -// pInfo->charsetFamily==U_CHARSET_FAMILY && -// pInfo->dataFormat[0]==0x43 && /* dataFormat="CvAl" */ -// pInfo->dataFormat[1]==0x76 && -// pInfo->dataFormat[2]==0x41 && -// pInfo->dataFormat[3]==0x6c && -// pInfo->formatVersion[0]==3); -// } - -// static UBool U_CALLCONV ucnv_io_cleanup(void) -// { -// if (gAliasData) { -// udata_close(gAliasData); -// gAliasData = NULL; -// } -// gAliasDataInitOnce.reset(); - -// uprv_memset(&gMainTable, 0, sizeof(gMainTable)); - -// return TRUE; /* Everything was cleaned up */ -// } - -// static void U_CALLCONV initAliasData(UErrorCode &errCode) { -// UDataMemory *data; -// const uint16_t *table; -// const uint32_t *sectionSizes; -// uint32_t tableStart; -// uint32_t currOffset; - -// ucln_common_registerCleanup(UCLN_COMMON_UCNV_IO, ucnv_io_cleanup); - -// U_ASSERT(gAliasData == NULL); -// data = udata_openChoice(NULL, DATA_TYPE, DATA_NAME, isAcceptable, NULL, &errCode); -// if(U_FAILURE(errCode)) { -// return; -// } - -// sectionSizes = (const uint32_t *)udata_getMemory(data); -// table = (const uint16_t *)sectionSizes; - -// tableStart = sectionSizes[0]; -// if (tableStart < minTocLength) { -// errCode = U_INVALID_FORMAT_ERROR; -// udata_close(data); -// return; -// } -// gAliasData = data; - -// gMainTable.converterListSize = sectionSizes[1]; -// gMainTable.tagListSize = sectionSizes[2]; -// gMainTable.aliasListSize = sectionSizes[3]; -// gMainTable.untaggedConvArraySize = sectionSizes[4]; -// gMainTable.taggedAliasArraySize = sectionSizes[5]; -// gMainTable.taggedAliasListsSize = sectionSizes[6]; -// gMainTable.optionTableSize = sectionSizes[7]; -// gMainTable.stringTableSize = sectionSizes[8]; - -// if (tableStart > 8) { -// gMainTable.normalizedStringTableSize = sectionSizes[9]; -// } - -// currOffset = tableStart * (sizeof(uint32_t)/sizeof(uint16_t)) + (sizeof(uint32_t)/sizeof(uint16_t)); -// gMainTable.converterList = table + currOffset; - -// currOffset += gMainTable.converterListSize; -// gMainTable.tagList = table + currOffset; - -// currOffset += gMainTable.tagListSize; -// gMainTable.aliasList = table + currOffset; - -// currOffset += gMainTable.aliasListSize; -// gMainTable.untaggedConvArray = table + currOffset; - -// currOffset += gMainTable.untaggedConvArraySize; -// gMainTable.taggedAliasArray = table + currOffset; - -// /* aliasLists is a 1's based array, but it has a padding character */ -// currOffset += gMainTable.taggedAliasArraySize; -// gMainTable.taggedAliasLists = table + currOffset; - -// currOffset += gMainTable.taggedAliasListsSize; -// if (gMainTable.optionTableSize > 0 -// && ((const UConverterAliasOptions *)(table + currOffset))->stringNormalizationType < UCNV_IO_NORM_TYPE_COUNT) -// { -// /* Faster table */ -// gMainTable.optionTable = (const UConverterAliasOptions *)(table + currOffset); -// } -// else { -// /* Smaller table, or I can't handle this normalization mode! -// Use the original slower table lookup. */ -// gMainTable.optionTable = &defaultTableOptions; -// } - -// currOffset += gMainTable.optionTableSize; -// gMainTable.stringTable = table + currOffset; - -// currOffset += gMainTable.stringTableSize; -// gMainTable.normalizedStringTable = ((gMainTable.optionTable->stringNormalizationType == UCNV_IO_UNNORMALIZED) -// ? gMainTable.stringTable : (table + currOffset)); -// } - - -// static UBool -// haveAliasData(UErrorCode *pErrorCode) { -// umtx_initOnce(gAliasDataInitOnce, &initAliasData, *pErrorCode); -// return U_SUCCESS(*pErrorCode); -// } - -// static inline UBool -// isAlias(const char *alias, UErrorCode *pErrorCode) { -// if(alias==NULL) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return FALSE; -// } -// return (UBool)(*alias!=0); -// } - -// static uint32_t getTagNumber(const char *tagname) { -// if (gMainTable.tagList) { -// uint32_t tagNum; -// for (tagNum = 0; tagNum < gMainTable.tagListSize; tagNum++) { -// if (!uprv_stricmp(GET_STRING(gMainTable.tagList[tagNum]), tagname)) { -// return tagNum; -// } -// } -// } - -// return UINT32_MAX; -// } - -// /* character types relevant for ucnv_compareNames() */ -// enum { -// UIGNORE, -// ZERO, -// NONZERO, -// MINLETTER /* any values from here on are lowercase letter mappings */ -// }; - -// /* character types for ASCII 00..7F */ -// static const uint8_t asciiTypes[128] = { -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// ZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, 0, 0, 0, 0, 0, 0, -// 0, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, -// 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0, 0, 0, 0, 0, -// 0, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, -// 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0, 0, 0, 0, 0 -// }; - -// #define GET_ASCII_TYPE(c) ((int8_t)(c) >= 0 ? asciiTypes[(uint8_t)c] : (uint8_t)UIGNORE) - -// /* character types for EBCDIC 80..FF */ -// static const uint8_t ebcdicTypes[128] = { -// 0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0, 0, 0, 0, 0, 0, -// 0, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0, 0, 0, 0, 0, 0, -// 0, 0, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0, 0, 0, 0, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0, 0, 0, 0, 0, 0, -// 0, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0, 0, 0, 0, 0, 0, -// 0, 0, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0, 0, 0, 0, 0, 0, -// ZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, NONZERO, 0, 0, 0, 0, 0, 0 -// }; - -// #define GET_EBCDIC_TYPE(c) ((int8_t)(c) < 0 ? ebcdicTypes[(c)&0x7f] : (uint8_t)UIGNORE) - -// #if U_CHARSET_FAMILY==U_ASCII_FAMILY -// # define GET_CHAR_TYPE(c) GET_ASCII_TYPE(c) -// #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY -// # define GET_CHAR_TYPE(c) GET_EBCDIC_TYPE(c) -// #else -// # error U_CHARSET_FAMILY is not valid -// #endif - - -// /* @see ucnv_compareNames */ -// U_CAPI char * U_CALLCONV -// ucnv_io_stripASCIIForCompare(char *dst, const char *name) { -// char *dstItr = dst; -// uint8_t type, nextType; -// char c1; -// UBool afterDigit = FALSE; - -// while ((c1 = *name++) != 0) { -// type = GET_ASCII_TYPE(c1); -// switch (type) { -// case UIGNORE: -// afterDigit = FALSE; -// continue; /* ignore all but letters and digits */ -// case ZERO: -// if (!afterDigit) { -// nextType = GET_ASCII_TYPE(*name); -// if (nextType == ZERO || nextType == NONZERO) { -// continue; /* ignore leading zero before another digit */ -// } -// } -// break; -// case NONZERO: -// afterDigit = TRUE; -// break; -// default: -// c1 = (char)type; /* lowercased letter */ -// afterDigit = FALSE; -// break; -// } -// *dstItr++ = c1; -// } -// *dstItr = 0; -// return dst; -// } - -// U_CAPI char * U_CALLCONV -// ucnv_io_stripEBCDICForCompare(char *dst, const char *name) { -// char *dstItr = dst; -// uint8_t type, nextType; -// char c1; -// UBool afterDigit = FALSE; - -// while ((c1 = *name++) != 0) { -// type = GET_EBCDIC_TYPE(c1); -// switch (type) { -// case UIGNORE: -// afterDigit = FALSE; -// continue; /* ignore all but letters and digits */ -// case ZERO: -// if (!afterDigit) { -// nextType = GET_EBCDIC_TYPE(*name); -// if (nextType == ZERO || nextType == NONZERO) { -// continue; /* ignore leading zero before another digit */ -// } -// } -// break; -// case NONZERO: -// afterDigit = TRUE; -// break; -// default: -// c1 = (char)type; /* lowercased letter */ -// afterDigit = FALSE; -// break; -// } -// *dstItr++ = c1; -// } -// *dstItr = 0; -// return dst; -// } - -// /** -// * Do a fuzzy compare of two converter/alias names. -// * The comparison is case-insensitive, ignores leading zeroes if they are not -// * followed by further digits, and ignores all but letters and digits. -// * Thus the strings "UTF-8", "utf_8", "u*T@f08" and "Utf 8" are exactly equivalent. -// * See section 1.4, Charset Alias Matching in Unicode Technical Standard #22 -// * at http://www.unicode.org/reports/tr22/ -// * -// * This is a symmetrical (commutative) operation; order of arguments -// * is insignificant. This is an important property for sorting the -// * list (when the list is preprocessed into binary form) and for -// * performing binary searches on it at run time. -// * -// * @param name1 a converter name or alias, zero-terminated -// * @param name2 a converter name or alias, zero-terminated -// * @return 0 if the names match, or a negative value if the name1 -// * lexically precedes name2, or a positive value if the name1 -// * lexically follows name2. -// * -// * @see ucnv_io_stripForCompare -// */ -// U_CAPI int U_EXPORT2 -// ucnv_compareNames(const char *name1, const char *name2) { -// int rc; -// uint8_t type, nextType; -// char c1, c2; -// UBool afterDigit1 = FALSE, afterDigit2 = FALSE; - -// for (;;) { -// while ((c1 = *name1++) != 0) { -// type = GET_CHAR_TYPE(c1); -// switch (type) { -// case UIGNORE: -// afterDigit1 = FALSE; -// continue; /* ignore all but letters and digits */ -// case ZERO: -// if (!afterDigit1) { -// nextType = GET_CHAR_TYPE(*name1); -// if (nextType == ZERO || nextType == NONZERO) { -// continue; /* ignore leading zero before another digit */ -// } -// } -// break; -// case NONZERO: -// afterDigit1 = TRUE; -// break; -// default: -// c1 = (char)type; /* lowercased letter */ -// afterDigit1 = FALSE; -// break; -// } -// break; /* deliver c1 */ -// } -// while ((c2 = *name2++) != 0) { -// type = GET_CHAR_TYPE(c2); -// switch (type) { -// case UIGNORE: -// afterDigit2 = FALSE; -// continue; /* ignore all but letters and digits */ -// case ZERO: -// if (!afterDigit2) { -// nextType = GET_CHAR_TYPE(*name2); -// if (nextType == ZERO || nextType == NONZERO) { -// continue; /* ignore leading zero before another digit */ -// } -// } -// break; -// case NONZERO: -// afterDigit2 = TRUE; -// break; -// default: -// c2 = (char)type; /* lowercased letter */ -// afterDigit2 = FALSE; -// break; -// } -// break; /* deliver c2 */ -// } - -// /* If we reach the ends of both strings then they match */ -// if ((c1|c2)==0) { -// return 0; -// } - -// /* Case-insensitive comparison */ -// rc = (int)(unsigned char)c1 - (int)(unsigned char)c2; -// if (rc != 0) { -// return rc; -// } -// } -// } - -// /* -// * search for an alias -// * return the converter number index for gConverterList -// */ -// static inline uint32_t -// findConverter(const char *alias, UBool *containsOption, UErrorCode *pErrorCode) { -// uint32_t mid, start, limit; -// uint32_t lastMid; -// int result; -// int isUnnormalized = (gMainTable.optionTable->stringNormalizationType == UCNV_IO_UNNORMALIZED); -// char strippedName[UCNV_MAX_CONVERTER_NAME_LENGTH]; - -// if (!isUnnormalized) { -// if (uprv_strlen(alias) >= UCNV_MAX_CONVERTER_NAME_LENGTH) { -// *pErrorCode = U_BUFFER_OVERFLOW_ERROR; -// return UINT32_MAX; -// } - -// /* Lower case and remove ignoreable characters. */ -// ucnv_io_stripForCompare(strippedName, alias); -// alias = strippedName; -// } - -// /* do a binary search for the alias */ -// start = 0; -// limit = gMainTable.untaggedConvArraySize; -// mid = limit; -// lastMid = UINT32_MAX; - -// for (;;) { -// mid = (uint32_t)((start + limit) / 2); -// if (lastMid == mid) { /* Have we moved? */ -// break; /* We haven't moved, and it wasn't found. */ -// } -// lastMid = mid; -// if (isUnnormalized) { -// result = ucnv_compareNames(alias, GET_STRING(gMainTable.aliasList[mid])); -// } -// else { -// result = uprv_strcmp(alias, GET_NORMALIZED_STRING(gMainTable.aliasList[mid])); -// } - -// if (result < 0) { -// limit = mid; -// } else if (result > 0) { -// start = mid; -// } else { -// /* Since the gencnval tool folds duplicates into one entry, -// * this alias in gAliasList is unique, but different standards -// * may map an alias to different converters. -// */ -// if (gMainTable.untaggedConvArray[mid] & UCNV_AMBIGUOUS_ALIAS_MAP_BIT) { -// *pErrorCode = U_AMBIGUOUS_ALIAS_WARNING; -// } -// /* State whether the canonical converter name contains an option. -// This information is contained in this list in order to maintain backward & forward compatibility. */ -// if (containsOption) { -// UBool containsCnvOptionInfo = (UBool)gMainTable.optionTable->containsCnvOptionInfo; -// *containsOption = (UBool)((containsCnvOptionInfo -// && ((gMainTable.untaggedConvArray[mid] & UCNV_CONTAINS_OPTION_BIT) != 0)) -// || !containsCnvOptionInfo); -// } -// return gMainTable.untaggedConvArray[mid] & UCNV_CONVERTER_INDEX_MASK; -// } -// } - -// return UINT32_MAX; -// } - -// /* -// * Is this alias in this list? -// * alias and listOffset should be non-NULL. -// */ -// static inline UBool -// isAliasInList(const char *alias, uint32_t listOffset) { -// if (listOffset) { -// uint32_t currAlias; -// uint32_t listCount = gMainTable.taggedAliasLists[listOffset]; -// /* +1 to skip listCount */ -// const uint16_t *currList = gMainTable.taggedAliasLists + listOffset + 1; -// for (currAlias = 0; currAlias < listCount; currAlias++) { -// if (currList[currAlias] -// && ucnv_compareNames(alias, GET_STRING(currList[currAlias]))==0) -// { -// return TRUE; -// } -// } -// } -// return FALSE; -// } - -// /* -// * Search for an standard name of an alias (what is the default name -// * that this standard uses?) -// * return the listOffset for gTaggedAliasLists. If it's 0, -// * the it couldn't be found, but the parameters are valid. -// */ -// static uint32_t -// findTaggedAliasListsOffset(const char *alias, const char *standard, UErrorCode *pErrorCode) { -// uint32_t idx; -// uint32_t listOffset; -// uint32_t convNum; -// UErrorCode myErr = U_ZERO_ERROR; -// uint32_t tagNum = getTagNumber(standard); - -// /* Make a quick guess. Hopefully they used a TR22 canonical alias. */ -// convNum = findConverter(alias, NULL, &myErr); -// if (myErr != U_ZERO_ERROR) { -// *pErrorCode = myErr; -// } - -// if (tagNum < (gMainTable.tagListSize - UCNV_NUM_HIDDEN_TAGS) && convNum < gMainTable.converterListSize) { -// listOffset = gMainTable.taggedAliasArray[tagNum*gMainTable.converterListSize + convNum]; -// if (listOffset && gMainTable.taggedAliasLists[listOffset + 1]) { -// return listOffset; -// } -// if (myErr == U_AMBIGUOUS_ALIAS_WARNING) { -// /* Uh Oh! They used an ambiguous alias. -// We have to search the whole swiss cheese starting -// at the highest standard affinity. -// This may take a while. -// */ -// for (idx = 0; idx < gMainTable.taggedAliasArraySize; idx++) { -// listOffset = gMainTable.taggedAliasArray[idx]; -// if (listOffset && isAliasInList(alias, listOffset)) { -// uint32_t currTagNum = idx/gMainTable.converterListSize; -// uint32_t currConvNum = (idx - currTagNum*gMainTable.converterListSize); -// uint32_t tempListOffset = gMainTable.taggedAliasArray[tagNum*gMainTable.converterListSize + currConvNum]; -// if (tempListOffset && gMainTable.taggedAliasLists[tempListOffset + 1]) { -// return tempListOffset; -// } -// /* else keep on looking */ -// /* We could speed this up by starting on the next row -// because an alias is unique per row, right now. -// This would change if alias versioning appears. */ -// } -// } -// /* The standard doesn't know about the alias */ -// } -// /* else no default name */ -// return 0; -// } -// /* else converter or tag not found */ - -// return UINT32_MAX; -// } - -// /* Return the canonical name */ -// static uint32_t -// findTaggedConverterNum(const char *alias, const char *standard, UErrorCode *pErrorCode) { -// uint32_t idx; -// uint32_t listOffset; -// uint32_t convNum; -// UErrorCode myErr = U_ZERO_ERROR; -// uint32_t tagNum = getTagNumber(standard); - -// /* Make a quick guess. Hopefully they used a TR22 canonical alias. */ -// convNum = findConverter(alias, NULL, &myErr); -// if (myErr != U_ZERO_ERROR) { -// *pErrorCode = myErr; -// } - -// if (tagNum < (gMainTable.tagListSize - UCNV_NUM_HIDDEN_TAGS) && convNum < gMainTable.converterListSize) { -// listOffset = gMainTable.taggedAliasArray[tagNum*gMainTable.converterListSize + convNum]; -// if (listOffset && isAliasInList(alias, listOffset)) { -// return convNum; -// } -// if (myErr == U_AMBIGUOUS_ALIAS_WARNING) { -// /* Uh Oh! They used an ambiguous alias. -// We have to search one slice of the swiss cheese. -// We search only in the requested tag, not the whole thing. -// This may take a while. -// */ -// uint32_t convStart = (tagNum)*gMainTable.converterListSize; -// uint32_t convLimit = (tagNum+1)*gMainTable.converterListSize; -// for (idx = convStart; idx < convLimit; idx++) { -// listOffset = gMainTable.taggedAliasArray[idx]; -// if (listOffset && isAliasInList(alias, listOffset)) { -// return idx-convStart; -// } -// } -// /* The standard doesn't know about the alias */ -// } -// /* else no canonical name */ -// } -// /* else converter or tag not found */ - -// return UINT32_MAX; -// } - -// U_CAPI const char * -// ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode) { -// const char *aliasTmp = alias; -// int32_t i = 0; -// for (i = 0; i < 2; i++) { -// if (i == 1) { -// /* -// * After the first unsuccess converter lookup, check to see if -// * the name begins with 'x-'. If it does, strip it off and try -// * again. This behaviour is similar to how ICU4J does it. -// */ -// if (aliasTmp[0] == 'x' && aliasTmp[1] == '-') { -// aliasTmp = aliasTmp+2; -// } else { -// break; -// } -// } -// if(haveAliasData(pErrorCode) && isAlias(aliasTmp, pErrorCode)) { -// uint32_t convNum = findConverter(aliasTmp, containsOption, pErrorCode); -// if (convNum < gMainTable.converterListSize) { -// return GET_STRING(gMainTable.converterList[convNum]); -// } -// /* else converter not found */ -// } else { -// break; -// } -// } - -// return NULL; -// } - -// U_CDECL_BEGIN - - -// static int32_t U_CALLCONV -// ucnv_io_countStandardAliases(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) { -// int32_t value = 0; -// UAliasContext *myContext = (UAliasContext *)(enumerator->context); -// uint32_t listOffset = myContext->listOffset; - -// if (listOffset) { -// value = gMainTable.taggedAliasLists[listOffset]; -// } -// return value; -// } - -// static const char * U_CALLCONV -// ucnv_io_nextStandardAliases(UEnumeration *enumerator, -// int32_t* resultLength, -// UErrorCode * /*pErrorCode*/) -// { -// UAliasContext *myContext = (UAliasContext *)(enumerator->context); -// uint32_t listOffset = myContext->listOffset; - -// if (listOffset) { -// uint32_t listCount = gMainTable.taggedAliasLists[listOffset]; -// const uint16_t *currList = gMainTable.taggedAliasLists + listOffset + 1; - -// if (myContext->listIdx < listCount) { -// const char *myStr = GET_STRING(currList[myContext->listIdx++]); -// if (resultLength) { -// *resultLength = (int32_t)uprv_strlen(myStr); -// } -// return myStr; -// } -// } -// /* Either we accessed a zero length list, or we enumerated too far. */ -// if (resultLength) { -// *resultLength = 0; -// } -// return NULL; -// } - -// static void U_CALLCONV -// ucnv_io_resetStandardAliases(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) { -// ((UAliasContext *)(enumerator->context))->listIdx = 0; -// } - -// static void U_CALLCONV -// ucnv_io_closeUEnumeration(UEnumeration *enumerator) { -// uprv_free(enumerator->context); -// uprv_free(enumerator); -// } - -// U_CDECL_END - -// /* Enumerate the aliases for the specified converter and standard tag */ -// static const UEnumeration gEnumAliases = { -// NULL, -// NULL, -// ucnv_io_closeUEnumeration, -// ucnv_io_countStandardAliases, -// uenum_unextDefault, -// ucnv_io_nextStandardAliases, -// ucnv_io_resetStandardAliases -// }; - -// U_CAPI UEnumeration * U_EXPORT2 -// ucnv_openStandardNames(const char *convName, -// const char *standard, -// UErrorCode *pErrorCode) -// { -// UEnumeration *myEnum = NULL; -// if (haveAliasData(pErrorCode) && isAlias(convName, pErrorCode)) { -// uint32_t listOffset = findTaggedAliasListsOffset(convName, standard, pErrorCode); - -// /* When listOffset == 0, we want to acknowledge that the -// converter name and standard are okay, but there -// is nothing to enumerate. */ -// if (listOffset < gMainTable.taggedAliasListsSize) { -// UAliasContext *myContext; - -// myEnum = static_cast(uprv_malloc(sizeof(UEnumeration))); -// if (myEnum == NULL) { -// *pErrorCode = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// uprv_memcpy(myEnum, &gEnumAliases, sizeof(UEnumeration)); -// myContext = static_cast(uprv_malloc(sizeof(UAliasContext))); -// if (myContext == NULL) { -// *pErrorCode = U_MEMORY_ALLOCATION_ERROR; -// uprv_free(myEnum); -// return NULL; -// } -// myContext->listOffset = listOffset; -// myContext->listIdx = 0; -// myEnum->context = myContext; -// } -// /* else converter or tag not found */ -// } -// return myEnum; -// } - -// static uint16_t -// ucnv_io_countAliases(const char *alias, UErrorCode *pErrorCode) { -// if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { -// uint32_t convNum = findConverter(alias, NULL, pErrorCode); -// if (convNum < gMainTable.converterListSize) { -// /* tagListNum - 1 is the ALL tag */ -// int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum]; - -// if (listOffset) { -// return gMainTable.taggedAliasLists[listOffset]; -// } -// /* else this shouldn't happen. internal program error */ -// } -// /* else converter not found */ -// } -// return 0; -// } - -// static uint16_t -// ucnv_io_getAliases(const char *alias, uint16_t start, const char **aliases, UErrorCode *pErrorCode) { -// if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { -// uint32_t currAlias; -// uint32_t convNum = findConverter(alias, NULL, pErrorCode); -// if (convNum < gMainTable.converterListSize) { -// /* tagListNum - 1 is the ALL tag */ -// int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum]; - -// if (listOffset) { -// uint32_t listCount = gMainTable.taggedAliasLists[listOffset]; -// /* +1 to skip listCount */ -// const uint16_t *currList = gMainTable.taggedAliasLists + listOffset + 1; - -// for (currAlias = start; currAlias < listCount; currAlias++) { -// aliases[currAlias] = GET_STRING(currList[currAlias]); -// } -// } -// /* else this shouldn't happen. internal program error */ -// } -// /* else converter not found */ -// } -// return 0; -// } - -// static const char * -// ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) { -// if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { -// uint32_t convNum = findConverter(alias, NULL, pErrorCode); -// if (convNum < gMainTable.converterListSize) { -// /* tagListNum - 1 is the ALL tag */ -// int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum]; - -// if (listOffset) { -// uint32_t listCount = gMainTable.taggedAliasLists[listOffset]; -// /* +1 to skip listCount */ -// const uint16_t *currList = gMainTable.taggedAliasLists + listOffset + 1; - -// if (n < listCount) { -// return GET_STRING(currList[n]); -// } -// *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR; -// } -// /* else this shouldn't happen. internal program error */ -// } -// /* else converter not found */ -// } -// return NULL; -// } - -// static uint16_t -// ucnv_io_countStandards(UErrorCode *pErrorCode) { -// if (haveAliasData(pErrorCode)) { -// /* Don't include the empty list */ -// return (uint16_t)(gMainTable.tagListSize - UCNV_NUM_HIDDEN_TAGS); -// } - -// return 0; -// } - -// U_CAPI const char * U_EXPORT2 -// ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode) { -// if (haveAliasData(pErrorCode)) { -// if (n < gMainTable.tagListSize - UCNV_NUM_HIDDEN_TAGS) { -// return GET_STRING(gMainTable.tagList[n]); -// } -// *pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR; -// } - -// return NULL; -// } - -// U_CAPI const char * U_EXPORT2 -// ucnv_getStandardName(const char *alias, const char *standard, UErrorCode *pErrorCode) { -// if (haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { -// uint32_t listOffset = findTaggedAliasListsOffset(alias, standard, pErrorCode); - -// if (0 < listOffset && listOffset < gMainTable.taggedAliasListsSize) { -// const uint16_t *currList = gMainTable.taggedAliasLists + listOffset + 1; - -// /* Get the preferred name from this list */ -// if (currList[0]) { -// return GET_STRING(currList[0]); -// } -// /* else someone screwed up the alias table. */ -// /* *pErrorCode = U_INVALID_FORMAT_ERROR */ -// } -// } - -// return NULL; -// } - -// U_CAPI uint16_t U_EXPORT2 -// ucnv_countAliases(const char *alias, UErrorCode *pErrorCode) -// { -// return ucnv_io_countAliases(alias, pErrorCode); -// } - - -// U_CAPI const char* U_EXPORT2 -// ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) -// { -// return ucnv_io_getAlias(alias, n, pErrorCode); -// } - -// U_CAPI void U_EXPORT2 -// ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode) -// { -// ucnv_io_getAliases(alias, 0, aliases, pErrorCode); -// } - -// U_CAPI uint16_t U_EXPORT2 -// ucnv_countStandards(void) -// { -// UErrorCode err = U_ZERO_ERROR; -// return ucnv_io_countStandards(&err); -// } - -// U_CAPI const char * U_EXPORT2 -// ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode) { -// if (haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) { -// uint32_t convNum = findTaggedConverterNum(alias, standard, pErrorCode); - -// if (convNum < gMainTable.converterListSize) { -// return GET_STRING(gMainTable.converterList[convNum]); -// } -// } - -// return NULL; -// } - -// U_CDECL_BEGIN - - -// static int32_t U_CALLCONV -// ucnv_io_countAllConverters(UEnumeration * /*enumerator*/, UErrorCode * /*pErrorCode*/) { -// return gMainTable.converterListSize; -// } - -// static const char * U_CALLCONV -// ucnv_io_nextAllConverters(UEnumeration *enumerator, -// int32_t* resultLength, -// UErrorCode * /*pErrorCode*/) -// { -// uint16_t *myContext = (uint16_t *)(enumerator->context); - -// if (*myContext < gMainTable.converterListSize) { -// const char *myStr = GET_STRING(gMainTable.converterList[(*myContext)++]); -// if (resultLength) { -// *resultLength = (int32_t)uprv_strlen(myStr); -// } -// return myStr; -// } -// /* Either we accessed a zero length list, or we enumerated too far. */ -// if (resultLength) { -// *resultLength = 0; -// } -// return NULL; -// } - -// static void U_CALLCONV -// ucnv_io_resetAllConverters(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) { -// *((uint16_t *)(enumerator->context)) = 0; -// } -// U_CDECL_END -// static const UEnumeration gEnumAllConverters = { -// NULL, -// NULL, -// ucnv_io_closeUEnumeration, -// ucnv_io_countAllConverters, -// uenum_unextDefault, -// ucnv_io_nextAllConverters, -// ucnv_io_resetAllConverters -// }; - -// U_CAPI UEnumeration * U_EXPORT2 -// ucnv_openAllNames(UErrorCode *pErrorCode) { -// UEnumeration *myEnum = NULL; -// if (haveAliasData(pErrorCode)) { -// uint16_t *myContext; - -// myEnum = static_cast(uprv_malloc(sizeof(UEnumeration))); -// if (myEnum == NULL) { -// *pErrorCode = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// uprv_memcpy(myEnum, &gEnumAllConverters, sizeof(UEnumeration)); -// myContext = static_cast(uprv_malloc(sizeof(uint16_t))); -// if (myContext == NULL) { -// *pErrorCode = U_MEMORY_ALLOCATION_ERROR; -// uprv_free(myEnum); -// return NULL; -// } -// *myContext = 0; -// myEnum->context = myContext; -// } -// return myEnum; -// } - -// U_CAPI uint16_t -// ucnv_io_countKnownConverters(UErrorCode *pErrorCode) { -// if (haveAliasData(pErrorCode)) { -// return (uint16_t)gMainTable.converterListSize; -// } -// return 0; -// } - -// /* alias table swapping ----------------------------------------------------- */ - -// U_CDECL_BEGIN - -// typedef char * U_CALLCONV StripForCompareFn(char *dst, const char *name); -// U_CDECL_END - - -// /* -// * row of a temporary array -// * -// * gets platform-endian charset string indexes and sorting indexes; -// * after sorting this array by strings, the actual arrays are permutated -// * according to the sorting indexes -// */ -// typedef struct TempRow { -// uint16_t strIndex, sortIndex; -// } TempRow; - -// typedef struct TempAliasTable { -// const char *chars; -// TempRow *rows; -// uint16_t *resort; -// StripForCompareFn *stripForCompare; -// } TempAliasTable; - -// enum { -// STACK_ROW_CAPACITY=500 -// }; - -// static int32_t U_CALLCONV -// io_compareRows(const void *context, const void *left, const void *right) { -// char strippedLeft[UCNV_MAX_CONVERTER_NAME_LENGTH], -// strippedRight[UCNV_MAX_CONVERTER_NAME_LENGTH]; - -// TempAliasTable *tempTable=(TempAliasTable *)context; -// const char *chars=tempTable->chars; - -// return (int32_t)uprv_strcmp(tempTable->stripForCompare(strippedLeft, chars+2*((const TempRow *)left)->strIndex), -// tempTable->stripForCompare(strippedRight, chars+2*((const TempRow *)right)->strIndex)); -// } - -// U_CAPI int32_t U_EXPORT2 -// ucnv_swapAliases(const UDataSwapper *ds, -// const void *inData, int32_t length, void *outData, -// UErrorCode *pErrorCode) { -// const UDataInfo *pInfo; -// int32_t headerSize; - -// const uint16_t *inTable; -// const uint32_t *inSectionSizes; -// uint32_t toc[offsetsCount]; -// uint32_t offsets[offsetsCount]; /* 16-bit-addressed offsets from inTable/outTable */ -// uint32_t i, count, tocLength, topOffset; - -// TempRow rows[STACK_ROW_CAPACITY]; -// uint16_t resort[STACK_ROW_CAPACITY]; -// TempAliasTable tempTable; - -// /* udata_swapDataHeader checks the arguments */ -// headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode); -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// /* check data format and format version */ -// pInfo=(const UDataInfo *)((const char *)inData+4); -// if(!( -// pInfo->dataFormat[0]==0x43 && /* dataFormat="CvAl" */ -// pInfo->dataFormat[1]==0x76 && -// pInfo->dataFormat[2]==0x41 && -// pInfo->dataFormat[3]==0x6c && -// pInfo->formatVersion[0]==3 -// )) { -// udata_printError(ds, "ucnv_swapAliases(): data format %02x.%02x.%02x.%02x (format version %02x) is not an alias table\n", -// pInfo->dataFormat[0], pInfo->dataFormat[1], -// pInfo->dataFormat[2], pInfo->dataFormat[3], -// pInfo->formatVersion[0]); -// *pErrorCode=U_UNSUPPORTED_ERROR; -// return 0; -// } - -// /* an alias table must contain at least the table of contents array */ -// if(length>=0 && (length-headerSize)<4*(1+minTocLength)) { -// udata_printError(ds, "ucnv_swapAliases(): too few bytes (%d after header) for an alias table\n", -// length-headerSize); -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } - -// inSectionSizes=(const uint32_t *)((const char *)inData+headerSize); -// inTable=(const uint16_t *)inSectionSizes; -// uprv_memset(toc, 0, sizeof(toc)); -// toc[tocLengthIndex]=tocLength=ds->readUInt32(inSectionSizes[tocLengthIndex]); -// if(tocLengthreadUInt32(inSectionSizes[i]); -// } - -// /* compute offsets */ -// uprv_memset(offsets, 0, sizeof(offsets)); -// offsets[converterListIndex]=2*(1+tocLength); /* count two 16-bit units per toc entry */ -// for(i=tagListIndex; i<=tocLength; ++i) { -// offsets[i]=offsets[i-1]+toc[i-1]; -// } - -// /* compute the overall size of the after-header data, in numbers of 16-bit units */ -// topOffset=offsets[i-1]+toc[i-1]; - -// if(length>=0) { -// uint16_t *outTable; -// const uint16_t *p, *p2; -// uint16_t *q, *q2; -// uint16_t oldIndex; - -// if((length-headerSize)<(2*(int32_t)topOffset)) { -// udata_printError(ds, "ucnv_swapAliases(): too few bytes (%d after header) for an alias table\n", -// length-headerSize); -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } - -// outTable=(uint16_t *)((char *)outData+headerSize); - -// /* swap the entire table of contents */ -// ds->swapArray32(ds, inTable, 4*(1+tocLength), outTable, pErrorCode); - -// /* swap unormalized strings & normalized strings */ -// ds->swapInvChars(ds, inTable+offsets[stringTableIndex], 2*(int32_t)(toc[stringTableIndex]+toc[normalizedStringTableIndex]), -// outTable+offsets[stringTableIndex], pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// udata_printError(ds, "ucnv_swapAliases().swapInvChars(charset names) failed\n"); -// return 0; -// } - -// if(ds->inCharset==ds->outCharset) { -// /* no need to sort, just swap all 16-bit values together */ -// ds->swapArray16(ds, -// inTable+offsets[converterListIndex], -// 2*(int32_t)(offsets[stringTableIndex]-offsets[converterListIndex]), -// outTable+offsets[converterListIndex], -// pErrorCode); -// } else { -// /* allocate the temporary table for sorting */ -// count=toc[aliasListIndex]; - -// tempTable.chars=(const char *)(outTable+offsets[stringTableIndex]); /* sort by outCharset */ - -// if(count<=STACK_ROW_CAPACITY) { -// tempTable.rows=rows; -// tempTable.resort=resort; -// } else { -// tempTable.rows=(TempRow *)uprv_malloc(count*sizeof(TempRow)+count*2); -// if(tempTable.rows==NULL) { -// udata_printError(ds, "ucnv_swapAliases(): unable to allocate memory for sorting tables (max length: %u)\n", -// count); -// *pErrorCode=U_MEMORY_ALLOCATION_ERROR; -// return 0; -// } -// tempTable.resort=(uint16_t *)(tempTable.rows+count); -// } - -// if(ds->outCharset==U_ASCII_FAMILY) { -// tempTable.stripForCompare=ucnv_io_stripASCIIForCompare; -// } else /* U_EBCDIC_FAMILY */ { -// tempTable.stripForCompare=ucnv_io_stripEBCDICForCompare; -// } - -// /* -// * Sort unique aliases+mapped names. -// * -// * We need to sort the list again by outCharset strings because they -// * sort differently for different charset families. -// * First we set up a temporary table with the string indexes and -// * sorting indexes and sort that. -// * Then we permutate and copy/swap the actual values. -// */ -// p=inTable+offsets[aliasListIndex]; -// q=outTable+offsets[aliasListIndex]; - -// p2=inTable+offsets[untaggedConvArrayIndex]; -// q2=outTable+offsets[untaggedConvArrayIndex]; - -// for(i=0; ireadUInt16(p[i]); -// tempTable.rows[i].sortIndex=(uint16_t)i; -// } - -// uprv_sortArray(tempTable.rows, (int32_t)count, sizeof(TempRow), -// io_compareRows, &tempTable, -// FALSE, pErrorCode); - -// if(U_SUCCESS(*pErrorCode)) { -// /* copy/swap/permutate items */ -// if(p!=q) { -// for(i=0; iswapArray16(ds, p+oldIndex, 2, q+i, pErrorCode); -// ds->swapArray16(ds, p2+oldIndex, 2, q2+i, pErrorCode); -// } -// } else { -// /* -// * If we swap in-place, then the permutation must use another -// * temporary array (tempTable.resort) -// * before the results are copied to the outBundle. -// */ -// uint16_t *r=tempTable.resort; - -// for(i=0; iswapArray16(ds, p+oldIndex, 2, r+i, pErrorCode); -// } -// uprv_memcpy(q, r, 2*(size_t)count); - -// for(i=0; iswapArray16(ds, p2+oldIndex, 2, r+i, pErrorCode); -// } -// uprv_memcpy(q2, r, 2*(size_t)count); -// } -// } - -// if(tempTable.rows!=rows) { -// uprv_free(tempTable.rows); -// } - -// if(U_FAILURE(*pErrorCode)) { -// udata_printError(ds, "ucnv_swapAliases().uprv_sortArray(%u items) failed\n", -// count); -// return 0; -// } - -// /* swap remaining 16-bit values */ -// ds->swapArray16(ds, -// inTable+offsets[converterListIndex], -// 2*(int32_t)(offsets[aliasListIndex]-offsets[converterListIndex]), -// outTable+offsets[converterListIndex], -// pErrorCode); -// ds->swapArray16(ds, -// inTable+offsets[taggedAliasArrayIndex], -// 2*(int32_t)(offsets[stringTableIndex]-offsets[taggedAliasArrayIndex]), -// outTable+offsets[taggedAliasArrayIndex], -// pErrorCode); -// } -// } - -// return headerSize+2*(int32_t)topOffset; -// } - -// #endif - - -// /* -// * Hey, Emacs, please set the following: -// * -// * Local Variables: -// * indent-tabs-mode: nil -// * End: -// * -// */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_io.h b/src/duckdb/extension/icu/third_party/icu/common/ucnv_io.h index cb52ae65f..8f2d7b5a0 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_io.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucnv_io.h @@ -1,127 +1,127 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 1999-2006, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * -// * -// * ucnv_io.h: -// * defines variables and functions pertaining to converter name resolution -// * aspect of the conversion code -// */ - -// #ifndef UCNV_IO_H -// #define UCNV_IO_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "udataswp.h" - -// #define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000 -// #define UCNV_CONTAINS_OPTION_BIT 0x4000 -// #define UCNV_CONVERTER_INDEX_MASK 0xFFF -// #define UCNV_NUM_RESERVED_TAGS 2 -// #define UCNV_NUM_HIDDEN_TAGS 1 - -// enum { -// UCNV_IO_UNNORMALIZED, -// UCNV_IO_STD_NORMALIZED, -// UCNV_IO_NORM_TYPE_COUNT -// }; - -// typedef struct { -// uint16_t stringNormalizationType; -// uint16_t containsCnvOptionInfo; -// } UConverterAliasOptions; - -// typedef struct UConverterAlias { -// const uint16_t *converterList; -// const uint16_t *tagList; -// const uint16_t *aliasList; -// const uint16_t *untaggedConvArray; -// const uint16_t *taggedAliasArray; -// const uint16_t *taggedAliasLists; -// const UConverterAliasOptions *optionTable; -// const uint16_t *stringTable; -// const uint16_t *normalizedStringTable; - -// uint32_t converterListSize; -// uint32_t tagListSize; -// uint32_t aliasListSize; -// uint32_t untaggedConvArraySize; -// uint32_t taggedAliasArraySize; -// uint32_t taggedAliasListsSize; -// uint32_t optionTableSize; -// uint32_t stringTableSize; -// uint32_t normalizedStringTableSize; -// } UConverterAlias; - -// /** -// * \var ucnv_io_stripForCompare -// * Remove the underscores, dashes and spaces from the name, and convert -// * the name to lower case. -// * @param dst The destination buffer, which is <= the buffer of name. -// * @param dst The destination buffer, which is <= the buffer of name. -// * @see ucnv_compareNames -// * @return the destination buffer. -// */ -// #if U_CHARSET_FAMILY==U_ASCII_FAMILY -// # define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare -// #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY -// # define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare -// #else -// # error U_CHARSET_FAMILY is not valid -// #endif - -// U_CAPI char * U_CALLCONV -// ucnv_io_stripASCIIForCompare(char *dst, const char *name); - -// U_CAPI char * U_CALLCONV -// ucnv_io_stripEBCDICForCompare(char *dst, const char *name); - -// /** -// * Map a converter alias name to a canonical converter name. -// * The alias is searched for case-insensitively, the converter name -// * is returned in mixed-case. -// * Returns NULL if the alias is not found. -// * @param alias The alias name to be searched. -// * @param containsOption A return value stating whether the returned converter name contains an option (a comma) -// * @param pErrorCode The error code -// * @return the converter name in mixed-case, return NULL if the alias is not found. -// */ -// U_CAPI const char * -// ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode); - -// /** -// * Return the number of all known converter names (no aliases). -// * @param pErrorCode The error code -// * @return the number of all aliases -// */ -// U_CAPI uint16_t -// ucnv_io_countKnownConverters(UErrorCode *pErrorCode); - -// /** -// * Swap an ICU converter alias table. See implementation for details. -// * @internal -// */ -// U_CAPI int32_t U_EXPORT2 -// ucnv_swapAliases(const UDataSwapper *ds, -// const void *inData, int32_t length, void *outData, -// UErrorCode *pErrorCode); - -// #endif - -// #endif /* _UCNV_IO */ - -// /* -// * Hey, Emacs, please set the following: -// * -// * Local Variables: -// * indent-tabs-mode: nil -// * End: -// * -// */ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ********************************************************************** + * Copyright (C) 1999-2006, International Business Machines + * Corporation and others. All Rights Reserved. + ********************************************************************** + * + * + * ucnv_io.h: + * defines variables and functions pertaining to converter name resolution + * aspect of the conversion code + */ + +#ifndef UCNV_IO_H +#define UCNV_IO_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "udataswp.h" + +#define UCNV_AMBIGUOUS_ALIAS_MAP_BIT 0x8000 +#define UCNV_CONTAINS_OPTION_BIT 0x4000 +#define UCNV_CONVERTER_INDEX_MASK 0xFFF +#define UCNV_NUM_RESERVED_TAGS 2 +#define UCNV_NUM_HIDDEN_TAGS 1 + +enum { + UCNV_IO_UNNORMALIZED, + UCNV_IO_STD_NORMALIZED, + UCNV_IO_NORM_TYPE_COUNT +}; + +typedef struct { + uint16_t stringNormalizationType; + uint16_t containsCnvOptionInfo; +} UConverterAliasOptions; + +typedef struct UConverterAlias { + const uint16_t *converterList; + const uint16_t *tagList; + const uint16_t *aliasList; + const uint16_t *untaggedConvArray; + const uint16_t *taggedAliasArray; + const uint16_t *taggedAliasLists; + const UConverterAliasOptions *optionTable; + const uint16_t *stringTable; + const uint16_t *normalizedStringTable; + + uint32_t converterListSize; + uint32_t tagListSize; + uint32_t aliasListSize; + uint32_t untaggedConvArraySize; + uint32_t taggedAliasArraySize; + uint32_t taggedAliasListsSize; + uint32_t optionTableSize; + uint32_t stringTableSize; + uint32_t normalizedStringTableSize; +} UConverterAlias; + +/** + * \var ucnv_io_stripForCompare + * Remove the underscores, dashes and spaces from the name, and convert + * the name to lower case. + * @param dst The destination buffer, which is <= the buffer of name. + * @param dst The destination buffer, which is <= the buffer of name. + * @see ucnv_compareNames + * @return the destination buffer. + */ +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare +#else +# error U_CHARSET_FAMILY is not valid +#endif + +U_CAPI char * U_CALLCONV +ucnv_io_stripASCIIForCompare(char *dst, const char *name); + +U_CAPI char * U_CALLCONV +ucnv_io_stripEBCDICForCompare(char *dst, const char *name); + +/** + * Map a converter alias name to a canonical converter name. + * The alias is searched for case-insensitively, the converter name + * is returned in mixed-case. + * Returns NULL if the alias is not found. + * @param alias The alias name to be searched. + * @param containsOption A return value stating whether the returned converter name contains an option (a comma) + * @param pErrorCode The error code + * @return the converter name in mixed-case, return NULL if the alias is not found. + */ +U_CAPI const char * +ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *pErrorCode); + +/** + * Return the number of all known converter names (no aliases). + * @param pErrorCode The error code + * @return the number of all aliases + */ +U_CAPI uint16_t +ucnv_io_countKnownConverters(UErrorCode *pErrorCode); + +/** + * Swap an ICU converter alias table. See implementation for details. + * @internal + */ +U_CAPI int32_t U_EXPORT2 +ucnv_swapAliases(const UDataSwapper *ds, + const void *inData, int32_t length, void *outData, + UErrorCode *pErrorCode); + +#endif + +#endif /* _UCNV_IO */ + +/* + * Hey, Emacs, please set the following: + * + * Local Variables: + * indent-tabs-mode: nil + * End: + * + */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_lmb.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_lmb.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_set.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_set.cpp deleted file mode 100644 index 9448c5168..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_set.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * -// * Copyright (C) 2003-2007, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ******************************************************************************* -// * file name: ucnv_set.c -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2004sep07 -// * created by: Markus W. Scherer -// * -// * Conversion API functions using USet (ucnv_getUnicodeSet()) -// * moved here from ucnv.c for removing the dependency of other ucnv_ -// * implementation functions on the USet implementation. -// */ - -// #include "unicode/utypes.h" -// #include "unicode/uset.h" -// #include "unicode/ucnv.h" -// #include "ucnv_bld.h" -// #include "uset_imp.h" - -// #if !UCONFIG_NO_CONVERSION - -// U_CAPI void U_EXPORT2 -// ucnv_getUnicodeSet(const UConverter *cnv, -// USet *setFillIn, -// UConverterUnicodeSet whichSet, -// UErrorCode *pErrorCode) { -// /* argument checking */ -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return; -// } -// if(cnv==NULL || setFillIn==NULL || whichSetsharedData->impl->getUnicodeSet==NULL) { -// *pErrorCode=U_UNSUPPORTED_ERROR; -// return; -// } - -// { -// USetAdder sa={ -// NULL, -// uset_add, -// uset_addRange, -// uset_addString, -// uset_remove, -// uset_removeRange -// }; -// sa.set=setFillIn; - -// /* empty the set */ -// uset_clear(setFillIn); - -// /* call the converter to add the code points it supports */ -// cnv->sharedData->impl->getUnicodeSet(cnv, &sa, whichSet, pErrorCode); -// } -// } - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_u16.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_u16.cpp deleted file mode 100644 index bd3212f73..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_u16.cpp +++ /dev/null @@ -1,1579 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2002-2015, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * file name: ucnv_u16.c -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2002jul01 -// * created by: Markus W. Scherer -// * -// * UTF-16 converter implementation. Used to be in ucnv_utf.c. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/uversion.h" -// #include "ucnv_bld.h" -// #include "ucnv_cnv.h" -// #include "cmemory.h" - -// enum { -// UCNV_NEED_TO_WRITE_BOM=1 -// }; - -// U_CDECL_BEGIN -// /* -// * The UTF-16 toUnicode implementation is also used for the Java-specific -// * "with BOM" variants of UTF-16BE and UTF-16LE. -// */ -// static void U_CALLCONV -// _UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode); - -// /* UTF-16BE ----------------------------------------------------------------- */ - -// #if U_IS_BIG_ENDIAN -// # define _UTF16PEFromUnicodeWithOffsets _UTF16BEFromUnicodeWithOffsets -// #else -// # define _UTF16PEFromUnicodeWithOffsets _UTF16LEFromUnicodeWithOffsets -// #endif - - -// static void U_CALLCONV -// _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const UChar *source; -// char *target; -// int32_t *offsets; - -// uint32_t targetCapacity, length, sourceIndex; -// UChar c, trail; -// char overflow[4]; - -// source=pArgs->source; -// length=(int32_t)(pArgs->sourceLimit-source); -// if(length<=0) { -// /* no input, nothing to do */ -// return; -// } - -// cnv=pArgs->converter; - -// /* write the BOM if necessary */ -// if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) { -// static const char bom[]={ (char)0xfeu, (char)0xffu }; -// ucnv_fromUWriteBytes(cnv, -// bom, 2, -// &pArgs->target, pArgs->targetLimit, -// &pArgs->offsets, -1, -// pErrorCode); -// cnv->fromUnicodeStatus=0; -// } - -// target=pArgs->target; -// if(target >= pArgs->targetLimit) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// return; -// } - -// targetCapacity=(uint32_t)(pArgs->targetLimit-target); -// offsets=pArgs->offsets; -// sourceIndex=0; - -// /* c!=0 indicates in several places outside the main loops that a surrogate was found */ - -// if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) { -// /* the last buffer ended with a lead surrogate, output the surrogate pair */ -// ++source; -// --length; -// target[0]=(uint8_t)(c>>8); -// target[1]=(uint8_t)c; -// target[2]=(uint8_t)(trail>>8); -// target[3]=(uint8_t)trail; -// target+=4; -// targetCapacity-=4; -// if(offsets!=NULL) { -// *offsets++=-1; -// *offsets++=-1; -// *offsets++=-1; -// *offsets++=-1; -// } -// sourceIndex=1; -// cnv->fromUChar32=c=0; -// } - -// if(c==0) { -// /* copy an even number of bytes for complete UChars */ -// uint32_t count=2*length; -// if(count>targetCapacity) { -// count=targetCapacity&~1; -// } -// /* count is even */ -// targetCapacity-=count; -// count>>=1; -// length-=count; - -// if(offsets==NULL) { -// while(count>0) { -// c=*source++; -// if(U16_IS_SINGLE(c)) { -// target[0]=(uint8_t)(c>>8); -// target[1]=(uint8_t)c; -// target+=2; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) { -// ++source; -// --count; -// target[0]=(uint8_t)(c>>8); -// target[1]=(uint8_t)c; -// target[2]=(uint8_t)(trail>>8); -// target[3]=(uint8_t)trail; -// target+=4; -// } else { -// break; -// } -// --count; -// } -// } else { -// while(count>0) { -// c=*source++; -// if(U16_IS_SINGLE(c)) { -// target[0]=(uint8_t)(c>>8); -// target[1]=(uint8_t)c; -// target+=2; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex++; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) { -// ++source; -// --count; -// target[0]=(uint8_t)(c>>8); -// target[1]=(uint8_t)c; -// target[2]=(uint8_t)(trail>>8); -// target[3]=(uint8_t)trail; -// target+=4; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// sourceIndex+=2; -// } else { -// break; -// } -// --count; -// } -// } - -// if(count==0) { -// /* done with the loop for complete UChars */ -// if(length>0 && targetCapacity>0) { -// /* -// * there is more input and some target capacity - -// * it must be targetCapacity==1 because otherwise -// * the above would have copied more; -// * prepare for overflow output -// */ -// if(U16_IS_SINGLE(c=*source++)) { -// overflow[0]=(char)(c>>8); -// overflow[1]=(char)c; -// length=2; /* 2 bytes to output */ -// c=0; -// /* } else { keep c for surrogate handling, length will be set there */ -// } -// } else { -// length=0; -// c=0; -// } -// } else { -// /* keep c for surrogate handling, length will be set there */ -// targetCapacity+=2*count; -// } -// } else { -// length=0; /* from here on, length counts the bytes in overflow[] */ -// } - -// if(c!=0) { -// /* -// * c is a surrogate, and -// * - source or target too short -// * - or the surrogate is unmatched -// */ -// length=0; -// if(U16_IS_SURROGATE_LEAD(c)) { -// if(sourcesourceLimit) { -// if(U16_IS_TRAIL(trail=*source)) { -// /* output the surrogate pair, will overflow (see conditions comment above) */ -// ++source; -// overflow[0]=(char)(c>>8); -// overflow[1]=(char)c; -// overflow[2]=(char)(trail>>8); -// overflow[3]=(char)trail; -// length=4; /* 4 bytes to output */ -// c=0; -// } else { -// /* unmatched lead surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else { -// /* see if the trail surrogate is in the next buffer */ -// } -// } else { -// /* unmatched trail surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// cnv->fromUChar32=c; -// } - -// if(length>0) { -// /* output length bytes with overflow (length>targetCapacity>0) */ -// ucnv_fromUWriteBytes(cnv, -// overflow, length, -// (char **)&target, pArgs->targetLimit, -// &offsets, sourceIndex, -// pErrorCode); -// targetCapacity=(uint32_t)(pArgs->targetLimit-(char *)target); -// } - -// if(U_SUCCESS(*pErrorCode) && sourcesourceLimit && targetCapacity==0) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// pArgs->offsets=offsets; -// } - -// static void U_CALLCONV -// _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const uint8_t *source; -// UChar *target; -// int32_t *offsets; - -// uint32_t targetCapacity, length, count, sourceIndex; -// UChar c, trail; - -// if(pArgs->converter->mode<8) { -// _UTF16ToUnicodeWithOffsets(pArgs, pErrorCode); -// return; -// } - -// cnv=pArgs->converter; -// source=(const uint8_t *)pArgs->source; -// length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source); -// if(length<=0 && cnv->toUnicodeStatus==0) { -// /* no input, nothing to do */ -// return; -// } - -// target=pArgs->target; -// if(target >= pArgs->targetLimit) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// return; -// } - -// targetCapacity=(uint32_t)(pArgs->targetLimit-target); -// offsets=pArgs->offsets; -// sourceIndex=0; -// c=0; - -// /* complete a partial UChar or pair from the last call */ -// if(cnv->toUnicodeStatus!=0) { -// /* -// * special case: single byte from a previous buffer, -// * where the byte turned out not to belong to a trail surrogate -// * and the preceding, unmatched lead surrogate was put into toUBytes[] -// * for error handling -// */ -// cnv->toUBytes[0]=(uint8_t)cnv->toUnicodeStatus; -// cnv->toULength=1; -// cnv->toUnicodeStatus=0; -// } -// if((count=cnv->toULength)!=0) { -// uint8_t *p=cnv->toUBytes; -// do { -// p[count++]=*source++; -// ++sourceIndex; -// --length; -// if(count==2) { -// c=((UChar)p[0]<<8)|p[1]; -// if(U16_IS_SINGLE(c)) { -// /* output the BMP code point */ -// *target++=c; -// if(offsets!=NULL) { -// *offsets++=-1; -// } -// --targetCapacity; -// count=0; -// c=0; -// break; -// } else if(U16_IS_SURROGATE_LEAD(c)) { -// /* continue collecting bytes for the trail surrogate */ -// c=0; /* avoid unnecessary surrogate handling below */ -// } else { -// /* fall through to error handling for an unmatched trail surrogate */ -// break; -// } -// } else if(count==4) { -// c=((UChar)p[0]<<8)|p[1]; -// trail=((UChar)p[2]<<8)|p[3]; -// if(U16_IS_TRAIL(trail)) { -// /* output the surrogate pair */ -// *target++=c; -// if(targetCapacity>=2) { -// *target++=trail; -// if(offsets!=NULL) { -// *offsets++=-1; -// *offsets++=-1; -// } -// targetCapacity-=2; -// } else /* targetCapacity==1 */ { -// targetCapacity=0; -// cnv->UCharErrorBuffer[0]=trail; -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } -// count=0; -// c=0; -// break; -// } else { -// /* unmatched lead surrogate, handle here for consistent toUBytes[] */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; - -// /* back out reading the code unit after it */ -// if(((const uint8_t *)pArgs->source-source)>=2) { -// source-=2; -// } else { -// /* -// * if the trail unit's first byte was in a previous buffer, then -// * we need to put it into a special place because toUBytes[] will be -// * used for the lead unit's bytes -// */ -// cnv->toUnicodeStatus=0x100|p[2]; -// --source; -// } -// cnv->toULength=2; - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// return; -// } -// } -// } while(length>0); -// cnv->toULength=(int8_t)count; -// } - -// /* copy an even number of bytes for complete UChars */ -// count=2*targetCapacity; -// if(count>length) { -// count=length&~1; -// } -// if(c==0 && count>0) { -// length-=count; -// count>>=1; -// targetCapacity-=count; -// if(offsets==NULL) { -// do { -// c=((UChar)source[0]<<8)|source[1]; -// source+=2; -// if(U16_IS_SINGLE(c)) { -// *target++=c; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && -// U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1]) -// ) { -// source+=2; -// --count; -// *target++=c; -// *target++=trail; -// } else { -// break; -// } -// } while(--count>0); -// } else { -// do { -// c=((UChar)source[0]<<8)|source[1]; -// source+=2; -// if(U16_IS_SINGLE(c)) { -// *target++=c; -// *offsets++=sourceIndex; -// sourceIndex+=2; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && -// U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1]) -// ) { -// source+=2; -// --count; -// *target++=c; -// *target++=trail; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// sourceIndex+=4; -// } else { -// break; -// } -// } while(--count>0); -// } - -// if(count==0) { -// /* done with the loop for complete UChars */ -// c=0; -// } else { -// /* keep c for surrogate handling, trail will be set there */ -// length+=2*(count-1); /* one more byte pair was consumed than count decremented */ -// targetCapacity+=count; -// } -// } - -// if(c!=0) { -// /* -// * c is a surrogate, and -// * - source or target too short -// * - or the surrogate is unmatched -// */ -// cnv->toUBytes[0]=(uint8_t)(c>>8); -// cnv->toUBytes[1]=(uint8_t)c; -// cnv->toULength=2; - -// if(U16_IS_SURROGATE_LEAD(c)) { -// if(length>=2) { -// if(U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])) { -// /* output the surrogate pair, will overflow (see conditions comment above) */ -// source+=2; -// length-=2; -// *target++=c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// cnv->UCharErrorBuffer[0]=trail; -// cnv->UCharErrorBufferLength=1; -// cnv->toULength=0; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } else { -// /* unmatched lead surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else { -// /* see if the trail surrogate is in the next buffer */ -// } -// } else { -// /* unmatched trail surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } - -// if(U_SUCCESS(*pErrorCode)) { -// /* check for a remaining source byte */ -// if(length>0) { -// if(targetCapacity==0) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } else { -// /* it must be length==1 because otherwise the above would have copied more */ -// cnv->toUBytes[cnv->toULength++]=*source++; -// } -// } -// } - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// } - -// static UChar32 U_CALLCONV -// _UTF16BEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) { -// const uint8_t *s, *sourceLimit; -// UChar32 c; - -// if(pArgs->converter->mode<8) { -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } - -// s=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; - -// if(s>=sourceLimit) { -// /* no input */ -// *err=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// if(s+2>sourceLimit) { -// /* only one byte: truncated UChar */ -// pArgs->converter->toUBytes[0]=*s++; -// pArgs->converter->toULength=1; -// pArgs->source=(const char *)s; -// *err = U_TRUNCATED_CHAR_FOUND; -// return 0xffff; -// } - -// /* get one UChar */ -// c=((UChar32)*s<<8)|s[1]; -// s+=2; - -// /* check for a surrogate pair */ -// if(U_IS_SURROGATE(c)) { -// if(U16_IS_SURROGATE_LEAD(c)) { -// if(s+2<=sourceLimit) { -// UChar trail; - -// /* get a second UChar and see if it is a trail surrogate */ -// trail=((UChar)*s<<8)|s[1]; -// if(U16_IS_TRAIL(trail)) { -// c=U16_GET_SUPPLEMENTARY(c, trail); -// s+=2; -// } else { -// /* unmatched lead surrogate */ -// c=-2; -// } -// } else { -// /* too few (2 or 3) bytes for a surrogate pair: truncated code point */ -// uint8_t *bytes=pArgs->converter->toUBytes; -// s-=2; -// pArgs->converter->toULength=(int8_t)(sourceLimit-s); -// do { -// *bytes++=*s++; -// } while(sconverter->toUBytes; -// pArgs->converter->toULength=2; -// *bytes=*(s-2); -// bytes[1]=*(s-1); - -// c=0xffff; -// *err=U_ILLEGAL_CHAR_FOUND; -// } -// } - -// pArgs->source=(const char *)s; -// return c; -// } - -// static void U_CALLCONV -// _UTF16BEReset(UConverter *cnv, UConverterResetChoice choice) { -// if(choice<=UCNV_RESET_TO_UNICODE) { -// /* reset toUnicode state */ -// if(UCNV_GET_VERSION(cnv)==0) { -// cnv->mode=8; /* no BOM handling */ -// } else { -// cnv->mode=0; /* Java-specific "UnicodeBig" requires BE BOM or no BOM */ -// } -// } -// if(choice!=UCNV_RESET_TO_UNICODE && UCNV_GET_VERSION(cnv)==1) { -// /* reset fromUnicode for "UnicodeBig": prepare to output the UTF-16BE BOM */ -// cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM; -// } -// } - -// static void U_CALLCONV -// _UTF16BEOpen(UConverter *cnv, -// UConverterLoadArgs *pArgs, -// UErrorCode *pErrorCode) { -// (void)pArgs; -// if(UCNV_GET_VERSION(cnv)<=1) { -// _UTF16BEReset(cnv, UCNV_RESET_BOTH); -// } else { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// } -// } - -// static const char * U_CALLCONV -// _UTF16BEGetName(const UConverter *cnv) { -// if(UCNV_GET_VERSION(cnv)==0) { -// return "UTF-16BE"; -// } else { -// return "UTF-16BE,version=1"; -// } -// } -// U_CDECL_END - -// static const UConverterImpl _UTF16BEImpl={ -// UCNV_UTF16_BigEndian, - -// NULL, -// NULL, - -// _UTF16BEOpen, -// NULL, -// _UTF16BEReset, - -// _UTF16BEToUnicodeWithOffsets, -// _UTF16BEToUnicodeWithOffsets, -// _UTF16BEFromUnicodeWithOffsets, -// _UTF16BEFromUnicodeWithOffsets, -// _UTF16BEGetNextUChar, - -// NULL, -// _UTF16BEGetName, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// NULL, -// NULL -// }; - -// static const UConverterStaticData _UTF16BEStaticData={ -// sizeof(UConverterStaticData), -// "UTF-16BE", -// 1200, UCNV_IBM, UCNV_UTF16_BigEndian, 2, 2, -// { 0xff, 0xfd, 0, 0 },2,FALSE,FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - - -// const UConverterSharedData _UTF16BEData= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16BEStaticData, &_UTF16BEImpl); - -// /* UTF-16LE ----------------------------------------------------------------- */ -// U_CDECL_BEGIN -// static void U_CALLCONV -// _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const UChar *source; -// char *target; -// int32_t *offsets; - -// uint32_t targetCapacity, length, sourceIndex; -// UChar c, trail; -// char overflow[4]; - -// source=pArgs->source; -// length=(int32_t)(pArgs->sourceLimit-source); -// if(length<=0) { -// /* no input, nothing to do */ -// return; -// } - -// cnv=pArgs->converter; - -// /* write the BOM if necessary */ -// if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) { -// static const char bom[]={ (char)0xffu, (char)0xfeu }; -// ucnv_fromUWriteBytes(cnv, -// bom, 2, -// &pArgs->target, pArgs->targetLimit, -// &pArgs->offsets, -1, -// pErrorCode); -// cnv->fromUnicodeStatus=0; -// } - -// target=pArgs->target; -// if(target >= pArgs->targetLimit) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// return; -// } - -// targetCapacity=(uint32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; -// sourceIndex=0; - -// /* c!=0 indicates in several places outside the main loops that a surrogate was found */ - -// if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) { -// /* the last buffer ended with a lead surrogate, output the surrogate pair */ -// ++source; -// --length; -// target[0]=(uint8_t)c; -// target[1]=(uint8_t)(c>>8); -// target[2]=(uint8_t)trail; -// target[3]=(uint8_t)(trail>>8); -// target+=4; -// targetCapacity-=4; -// if(offsets!=NULL) { -// *offsets++=-1; -// *offsets++=-1; -// *offsets++=-1; -// *offsets++=-1; -// } -// sourceIndex=1; -// cnv->fromUChar32=c=0; -// } - -// if(c==0) { -// /* copy an even number of bytes for complete UChars */ -// uint32_t count=2*length; -// if(count>targetCapacity) { -// count=targetCapacity&~1; -// } -// /* count is even */ -// targetCapacity-=count; -// count>>=1; -// length-=count; - -// if(offsets==NULL) { -// while(count>0) { -// c=*source++; -// if(U16_IS_SINGLE(c)) { -// target[0]=(uint8_t)c; -// target[1]=(uint8_t)(c>>8); -// target+=2; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) { -// ++source; -// --count; -// target[0]=(uint8_t)c; -// target[1]=(uint8_t)(c>>8); -// target[2]=(uint8_t)trail; -// target[3]=(uint8_t)(trail>>8); -// target+=4; -// } else { -// break; -// } -// --count; -// } -// } else { -// while(count>0) { -// c=*source++; -// if(U16_IS_SINGLE(c)) { -// target[0]=(uint8_t)c; -// target[1]=(uint8_t)(c>>8); -// target+=2; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex++; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && U16_IS_TRAIL(trail=*source)) { -// ++source; -// --count; -// target[0]=(uint8_t)c; -// target[1]=(uint8_t)(c>>8); -// target[2]=(uint8_t)trail; -// target[3]=(uint8_t)(trail>>8); -// target+=4; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// sourceIndex+=2; -// } else { -// break; -// } -// --count; -// } -// } - -// if(count==0) { -// /* done with the loop for complete UChars */ -// if(length>0 && targetCapacity>0) { -// /* -// * there is more input and some target capacity - -// * it must be targetCapacity==1 because otherwise -// * the above would have copied more; -// * prepare for overflow output -// */ -// if(U16_IS_SINGLE(c=*source++)) { -// overflow[0]=(char)c; -// overflow[1]=(char)(c>>8); -// length=2; /* 2 bytes to output */ -// c=0; -// /* } else { keep c for surrogate handling, length will be set there */ -// } -// } else { -// length=0; -// c=0; -// } -// } else { -// /* keep c for surrogate handling, length will be set there */ -// targetCapacity+=2*count; -// } -// } else { -// length=0; /* from here on, length counts the bytes in overflow[] */ -// } - -// if(c!=0) { -// /* -// * c is a surrogate, and -// * - source or target too short -// * - or the surrogate is unmatched -// */ -// length=0; -// if(U16_IS_SURROGATE_LEAD(c)) { -// if(sourcesourceLimit) { -// if(U16_IS_TRAIL(trail=*source)) { -// /* output the surrogate pair, will overflow (see conditions comment above) */ -// ++source; -// overflow[0]=(char)c; -// overflow[1]=(char)(c>>8); -// overflow[2]=(char)trail; -// overflow[3]=(char)(trail>>8); -// length=4; /* 4 bytes to output */ -// c=0; -// } else { -// /* unmatched lead surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else { -// /* see if the trail surrogate is in the next buffer */ -// } -// } else { -// /* unmatched trail surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// cnv->fromUChar32=c; -// } - -// if(length>0) { -// /* output length bytes with overflow (length>targetCapacity>0) */ -// ucnv_fromUWriteBytes(cnv, -// overflow, length, -// &target, pArgs->targetLimit, -// &offsets, sourceIndex, -// pErrorCode); -// targetCapacity=(uint32_t)(pArgs->targetLimit-(char *)target); -// } - -// if(U_SUCCESS(*pErrorCode) && sourcesourceLimit && targetCapacity==0) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// } - -// static void U_CALLCONV -// _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const uint8_t *source; -// UChar *target; -// int32_t *offsets; - -// uint32_t targetCapacity, length, count, sourceIndex; -// UChar c, trail; - -// if(pArgs->converter->mode<8) { -// _UTF16ToUnicodeWithOffsets(pArgs, pErrorCode); -// return; -// } - -// cnv=pArgs->converter; -// source=(const uint8_t *)pArgs->source; -// length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source); -// if(length<=0 && cnv->toUnicodeStatus==0) { -// /* no input, nothing to do */ -// return; -// } - -// target=pArgs->target; -// if(target >= pArgs->targetLimit) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// return; -// } - -// targetCapacity=(uint32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; -// sourceIndex=0; -// c=0; - -// /* complete a partial UChar or pair from the last call */ -// if(cnv->toUnicodeStatus!=0) { -// /* -// * special case: single byte from a previous buffer, -// * where the byte turned out not to belong to a trail surrogate -// * and the preceding, unmatched lead surrogate was put into toUBytes[] -// * for error handling -// */ -// cnv->toUBytes[0]=(uint8_t)cnv->toUnicodeStatus; -// cnv->toULength=1; -// cnv->toUnicodeStatus=0; -// } -// if((count=cnv->toULength)!=0) { -// uint8_t *p=cnv->toUBytes; -// do { -// p[count++]=*source++; -// ++sourceIndex; -// --length; -// if(count==2) { -// c=((UChar)p[1]<<8)|p[0]; -// if(U16_IS_SINGLE(c)) { -// /* output the BMP code point */ -// *target++=c; -// if(offsets!=NULL) { -// *offsets++=-1; -// } -// --targetCapacity; -// count=0; -// c=0; -// break; -// } else if(U16_IS_SURROGATE_LEAD(c)) { -// /* continue collecting bytes for the trail surrogate */ -// c=0; /* avoid unnecessary surrogate handling below */ -// } else { -// /* fall through to error handling for an unmatched trail surrogate */ -// break; -// } -// } else if(count==4) { -// c=((UChar)p[1]<<8)|p[0]; -// trail=((UChar)p[3]<<8)|p[2]; -// if(U16_IS_TRAIL(trail)) { -// /* output the surrogate pair */ -// *target++=c; -// if(targetCapacity>=2) { -// *target++=trail; -// if(offsets!=NULL) { -// *offsets++=-1; -// *offsets++=-1; -// } -// targetCapacity-=2; -// } else /* targetCapacity==1 */ { -// targetCapacity=0; -// cnv->UCharErrorBuffer[0]=trail; -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } -// count=0; -// c=0; -// break; -// } else { -// /* unmatched lead surrogate, handle here for consistent toUBytes[] */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; - -// /* back out reading the code unit after it */ -// if(((const uint8_t *)pArgs->source-source)>=2) { -// source-=2; -// } else { -// /* -// * if the trail unit's first byte was in a previous buffer, then -// * we need to put it into a special place because toUBytes[] will be -// * used for the lead unit's bytes -// */ -// cnv->toUnicodeStatus=0x100|p[2]; -// --source; -// } -// cnv->toULength=2; - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// return; -// } -// } -// } while(length>0); -// cnv->toULength=(int8_t)count; -// } - -// /* copy an even number of bytes for complete UChars */ -// count=2*targetCapacity; -// if(count>length) { -// count=length&~1; -// } -// if(c==0 && count>0) { -// length-=count; -// count>>=1; -// targetCapacity-=count; -// if(offsets==NULL) { -// do { -// c=((UChar)source[1]<<8)|source[0]; -// source+=2; -// if(U16_IS_SINGLE(c)) { -// *target++=c; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && -// U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0]) -// ) { -// source+=2; -// --count; -// *target++=c; -// *target++=trail; -// } else { -// break; -// } -// } while(--count>0); -// } else { -// do { -// c=((UChar)source[1]<<8)|source[0]; -// source+=2; -// if(U16_IS_SINGLE(c)) { -// *target++=c; -// *offsets++=sourceIndex; -// sourceIndex+=2; -// } else if(U16_IS_SURROGATE_LEAD(c) && count>=2 && -// U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0]) -// ) { -// source+=2; -// --count; -// *target++=c; -// *target++=trail; -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// sourceIndex+=4; -// } else { -// break; -// } -// } while(--count>0); -// } - -// if(count==0) { -// /* done with the loop for complete UChars */ -// c=0; -// } else { -// /* keep c for surrogate handling, trail will be set there */ -// length+=2*(count-1); /* one more byte pair was consumed than count decremented */ -// targetCapacity+=count; -// } -// } - -// if(c!=0) { -// /* -// * c is a surrogate, and -// * - source or target too short -// * - or the surrogate is unmatched -// */ -// cnv->toUBytes[0]=(uint8_t)c; -// cnv->toUBytes[1]=(uint8_t)(c>>8); -// cnv->toULength=2; - -// if(U16_IS_SURROGATE_LEAD(c)) { -// if(length>=2) { -// if(U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])) { -// /* output the surrogate pair, will overflow (see conditions comment above) */ -// source+=2; -// length-=2; -// *target++=c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// cnv->UCharErrorBuffer[0]=trail; -// cnv->UCharErrorBufferLength=1; -// cnv->toULength=0; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } else { -// /* unmatched lead surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else { -// /* see if the trail surrogate is in the next buffer */ -// } -// } else { -// /* unmatched trail surrogate */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } - -// if(U_SUCCESS(*pErrorCode)) { -// /* check for a remaining source byte */ -// if(length>0) { -// if(targetCapacity==0) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } else { -// /* it must be length==1 because otherwise the above would have copied more */ -// cnv->toUBytes[cnv->toULength++]=*source++; -// } -// } -// } - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// } - -// static UChar32 U_CALLCONV -// _UTF16LEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) { -// const uint8_t *s, *sourceLimit; -// UChar32 c; - -// if(pArgs->converter->mode<8) { -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } - -// s=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; - -// if(s>=sourceLimit) { -// /* no input */ -// *err=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// if(s+2>sourceLimit) { -// /* only one byte: truncated UChar */ -// pArgs->converter->toUBytes[0]=*s++; -// pArgs->converter->toULength=1; -// pArgs->source=(const char *)s; -// *err = U_TRUNCATED_CHAR_FOUND; -// return 0xffff; -// } - -// /* get one UChar */ -// c=((UChar32)s[1]<<8)|*s; -// s+=2; - -// /* check for a surrogate pair */ -// if(U_IS_SURROGATE(c)) { -// if(U16_IS_SURROGATE_LEAD(c)) { -// if(s+2<=sourceLimit) { -// UChar trail; - -// /* get a second UChar and see if it is a trail surrogate */ -// trail=((UChar)s[1]<<8)|*s; -// if(U16_IS_TRAIL(trail)) { -// c=U16_GET_SUPPLEMENTARY(c, trail); -// s+=2; -// } else { -// /* unmatched lead surrogate */ -// c=-2; -// } -// } else { -// /* too few (2 or 3) bytes for a surrogate pair: truncated code point */ -// uint8_t *bytes=pArgs->converter->toUBytes; -// s-=2; -// pArgs->converter->toULength=(int8_t)(sourceLimit-s); -// do { -// *bytes++=*s++; -// } while(sconverter->toUBytes; -// pArgs->converter->toULength=2; -// *bytes=*(s-2); -// bytes[1]=*(s-1); - -// c=0xffff; -// *err=U_ILLEGAL_CHAR_FOUND; -// } -// } - -// pArgs->source=(const char *)s; -// return c; -// } - -// static void U_CALLCONV -// _UTF16LEReset(UConverter *cnv, UConverterResetChoice choice) { -// if(choice<=UCNV_RESET_TO_UNICODE) { -// /* reset toUnicode state */ -// if(UCNV_GET_VERSION(cnv)==0) { -// cnv->mode=8; /* no BOM handling */ -// } else { -// cnv->mode=0; /* Java-specific "UnicodeLittle" requires LE BOM or no BOM */ -// } -// } -// if(choice!=UCNV_RESET_TO_UNICODE && UCNV_GET_VERSION(cnv)==1) { -// /* reset fromUnicode for "UnicodeLittle": prepare to output the UTF-16LE BOM */ -// cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM; -// } -// } - -// static void U_CALLCONV -// _UTF16LEOpen(UConverter *cnv, -// UConverterLoadArgs *pArgs, -// UErrorCode *pErrorCode) { -// (void)pArgs; -// if(UCNV_GET_VERSION(cnv)<=1) { -// _UTF16LEReset(cnv, UCNV_RESET_BOTH); -// } else { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// } -// } - -// static const char * U_CALLCONV -// _UTF16LEGetName(const UConverter *cnv) { -// if(UCNV_GET_VERSION(cnv)==0) { -// return "UTF-16LE"; -// } else { -// return "UTF-16LE,version=1"; -// } -// } -// U_CDECL_END - -// static const UConverterImpl _UTF16LEImpl={ -// UCNV_UTF16_LittleEndian, - -// NULL, -// NULL, - -// _UTF16LEOpen, -// NULL, -// _UTF16LEReset, - -// _UTF16LEToUnicodeWithOffsets, -// _UTF16LEToUnicodeWithOffsets, -// _UTF16LEFromUnicodeWithOffsets, -// _UTF16LEFromUnicodeWithOffsets, -// _UTF16LEGetNextUChar, - -// NULL, -// _UTF16LEGetName, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// NULL, -// NULL -// }; - - -// static const UConverterStaticData _UTF16LEStaticData={ -// sizeof(UConverterStaticData), -// "UTF-16LE", -// 1202, UCNV_IBM, UCNV_UTF16_LittleEndian, 2, 2, -// { 0xfd, 0xff, 0, 0 },2,FALSE,FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - - -// const UConverterSharedData _UTF16LEData= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16LEStaticData, &_UTF16LEImpl); - -// /* UTF-16 (Detect BOM) ------------------------------------------------------ */ - -// /* -// * Detect a BOM at the beginning of the stream and select UTF-16BE or UTF-16LE -// * accordingly. -// * This is a simpler version of the UTF-32 converter, with -// * fewer states for shorter BOMs. -// * -// * State values: -// * 0 initial state -// * 1 saw first byte -// * 2..5 - -// * 6..7 see _UTF16ToUnicodeWithOffsets() comments in state 1 -// * 8 UTF-16BE mode -// * 9 UTF-16LE mode -// * -// * During detection: state==number of initial bytes seen so far. -// * -// * On output, emit U+FEFF as the first code point. -// * -// * Variants: -// * - UTF-16,version=1 (Java "Unicode" encoding) treats a missing BOM as an error. -// * - UTF-16BE,version=1 (Java "UnicodeBig" encoding) and -// * UTF-16LE,version=1 (Java "UnicodeLittle" encoding) treat a reverse BOM as an error. -// */ -// U_CDECL_BEGIN -// static void U_CALLCONV -// _UTF16Reset(UConverter *cnv, UConverterResetChoice choice) { -// if(choice<=UCNV_RESET_TO_UNICODE) { -// /* reset toUnicode: state=0 */ -// cnv->mode=0; -// } -// if(choice!=UCNV_RESET_TO_UNICODE) { -// /* reset fromUnicode: prepare to output the UTF-16PE BOM */ -// cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM; -// } -// } -// U_CDECL_END -// extern const UConverterSharedData _UTF16v2Data; -// U_CDECL_BEGIN -// static void U_CALLCONV -// _UTF16Open(UConverter *cnv, -// UConverterLoadArgs *pArgs, -// UErrorCode *pErrorCode) { -// if(UCNV_GET_VERSION(cnv)<=2) { -// if(UCNV_GET_VERSION(cnv)==2 && !pArgs->onlyTestIsLoadable) { -// /* -// * Switch implementation, and switch the staticData that's different -// * and was copied into the UConverter. -// * (See ucnv_createConverterFromSharedData() in ucnv_bld.c.) -// * UTF-16,version=2 fromUnicode() always writes a big-endian byte stream. -// */ -// cnv->sharedData=(UConverterSharedData*)&_UTF16v2Data; -// uprv_memcpy(cnv->subChars, _UTF16v2Data.staticData->subChar, UCNV_MAX_SUBCHAR_LEN); -// } -// _UTF16Reset(cnv, UCNV_RESET_BOTH); -// } else { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// } -// } - -// static const char * U_CALLCONV -// _UTF16GetName(const UConverter *cnv) { -// if(UCNV_GET_VERSION(cnv)==0) { -// return "UTF-16"; -// } else if(UCNV_GET_VERSION(cnv)==1) { -// return "UTF-16,version=1"; -// } else { -// return "UTF-16,version=2"; -// } -// } -// U_CDECL_END -// extern const UConverterSharedData _UTF16Data; - -// static inline bool IS_UTF16BE(const UConverter *cnv) { -// return ((cnv)->sharedData == &_UTF16BEData); -// } - -// static inline bool IS_UTF16LE(const UConverter *cnv) { -// return ((cnv)->sharedData == &_UTF16LEData); -// } - -// static inline bool IS_UTF16(const UConverter *cnv) { -// return ((cnv)->sharedData==&_UTF16Data) || ((cnv)->sharedData == &_UTF16v2Data); -// } - -// U_CDECL_BEGIN -// static void U_CALLCONV -// _UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv=pArgs->converter; -// const char *source=pArgs->source; -// const char *sourceLimit=pArgs->sourceLimit; -// int32_t *offsets=pArgs->offsets; - -// int32_t state, offsetDelta; -// uint8_t b; - -// state=cnv->mode; - -// /* -// * If we detect a BOM in this buffer, then we must add the BOM size to the -// * offsets because the actual converter function will not see and count the BOM. -// * offsetDelta will have the number of the BOM bytes that are in the current buffer. -// */ -// offsetDelta=0; - -// while(sourcetoUBytes[0]=(uint8_t)*source++; -// cnv->toULength=1; -// state=1; -// break; -// case 1: -// /* -// * Only inside this switch case can the state variable -// * temporarily take two additional values: -// * 6: BOM error, continue with BE -// * 7: BOM error, continue with LE -// */ -// b=*source; -// if(cnv->toUBytes[0]==0xfe && b==0xff) { -// if(IS_UTF16LE(cnv)) { -// state=7; /* illegal reverse BOM for Java "UnicodeLittle" */ -// } else { -// state=8; /* detect UTF-16BE */ -// } -// } else if(cnv->toUBytes[0]==0xff && b==0xfe) { -// if(IS_UTF16BE(cnv)) { -// state=6; /* illegal reverse BOM for Java "UnicodeBig" */ -// } else { -// state=9; /* detect UTF-16LE */ -// } -// } else if((IS_UTF16(cnv) && UCNV_GET_VERSION(cnv)==1)) { -// state=6; /* illegal missing BOM for Java "Unicode" */ -// } -// if(state>=8) { -// /* BOM detected, consume it */ -// ++source; -// cnv->toULength=0; -// offsetDelta=(int32_t)(source-pArgs->source); -// } else if(state<6) { -// /* ok: no BOM, and not a reverse BOM */ -// if(source!=pArgs->source) { -// /* reset the source for a correct first offset */ -// source=pArgs->source; -// cnv->toULength=0; -// } -// if(IS_UTF16LE(cnv)) { -// /* Make Java "UnicodeLittle" default to LE. */ -// state=9; -// } else { -// /* Make standard UTF-16 and Java "UnicodeBig" default to BE. */ -// state=8; -// } -// } else { -// /* -// * error: missing BOM, or reverse BOM -// * UTF-16,version=1: Java-specific "Unicode" requires a BOM. -// * UTF-16BE,version=1: Java-specific "UnicodeBig" requires a BE BOM or no BOM. -// * UTF-16LE,version=1: Java-specific "UnicodeLittle" requires an LE BOM or no BOM. -// */ -// /* report the non-BOM or reverse BOM as an illegal sequence */ -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// pArgs->source=source+1; -// /* continue with conversion if the callback resets the error */ -// /* -// * Make Java "Unicode" default to BE like standard UTF-16. -// * Make Java "UnicodeBig" and "UnicodeLittle" default -// * to their normal endiannesses. -// */ -// cnv->mode=state+2; -// *pErrorCode=U_ILLEGAL_ESCAPE_SEQUENCE; -// return; -// } -// /* convert the rest of the stream */ -// cnv->mode=state; -// continue; -// case 8: -// /* call UTF-16BE */ -// pArgs->source=source; -// _UTF16BEToUnicodeWithOffsets(pArgs, pErrorCode); -// source=pArgs->source; -// break; -// case 9: -// /* call UTF-16LE */ -// pArgs->source=source; -// _UTF16LEToUnicodeWithOffsets(pArgs, pErrorCode); -// source=pArgs->source; -// break; -// default: -// break; /* does not occur */ -// } -// } - -// /* add BOM size to offsets - see comment at offsetDelta declaration */ -// if(offsets!=NULL && offsetDelta!=0) { -// int32_t *offsetsLimit=pArgs->offsets; -// while(offsetssource=source; - -// if(source==sourceLimit && pArgs->flush) { -// /* handle truncated input */ -// switch(state) { -// case 0: -// break; /* no input at all, nothing to do */ -// case 8: -// _UTF16BEToUnicodeWithOffsets(pArgs, pErrorCode); -// break; -// case 9: -// _UTF16LEToUnicodeWithOffsets(pArgs, pErrorCode); -// break; -// default: -// /* 0mode=state; -// } - -// static UChar32 U_CALLCONV -// _UTF16GetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// switch(pArgs->converter->mode) { -// case 8: -// return _UTF16BEGetNextUChar(pArgs, pErrorCode); -// case 9: -// return _UTF16LEGetNextUChar(pArgs, pErrorCode); -// default: -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } -// } -// U_CDECL_END - -// static const UConverterImpl _UTF16Impl = { -// UCNV_UTF16, - -// NULL, -// NULL, - -// _UTF16Open, -// NULL, -// _UTF16Reset, - -// _UTF16ToUnicodeWithOffsets, -// _UTF16ToUnicodeWithOffsets, -// _UTF16PEFromUnicodeWithOffsets, -// _UTF16PEFromUnicodeWithOffsets, -// _UTF16GetNextUChar, - -// NULL, /* ### TODO implement getStarters for all Unicode encodings?! */ -// _UTF16GetName, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// NULL, -// NULL -// }; - -// static const UConverterStaticData _UTF16StaticData = { -// sizeof(UConverterStaticData), -// "UTF-16", -// 1204, /* CCSID for BOM sensitive UTF-16 */ -// UCNV_IBM, UCNV_UTF16, 2, 2, -// #if U_IS_BIG_ENDIAN -// { 0xff, 0xfd, 0, 0 }, 2, -// #else -// { 0xfd, 0xff, 0, 0 }, 2, -// #endif -// FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// const UConverterSharedData _UTF16Data = -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16StaticData, &_UTF16Impl); - -// static const UConverterImpl _UTF16v2Impl = { -// UCNV_UTF16, - -// NULL, -// NULL, - -// _UTF16Open, -// NULL, -// _UTF16Reset, - -// _UTF16ToUnicodeWithOffsets, -// _UTF16ToUnicodeWithOffsets, -// _UTF16BEFromUnicodeWithOffsets, -// _UTF16BEFromUnicodeWithOffsets, -// _UTF16GetNextUChar, - -// NULL, /* ### TODO implement getStarters for all Unicode encodings?! */ -// _UTF16GetName, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// NULL, -// NULL -// }; - -// static const UConverterStaticData _UTF16v2StaticData = { -// sizeof(UConverterStaticData), -// "UTF-16,version=2", -// 1204, /* CCSID for BOM sensitive UTF-16 */ -// UCNV_IBM, UCNV_UTF16, 2, 2, -// { 0xff, 0xfd, 0, 0 }, 2, -// FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// const UConverterSharedData _UTF16v2Data = -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16v2StaticData, &_UTF16v2Impl); - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_u32.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_u32.cpp deleted file mode 100644 index 4d66f0ac8..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_u32.cpp +++ /dev/null @@ -1,1253 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2002-2015, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * file name: ucnv_u32.c -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2002jul01 -// * created by: Markus W. Scherer -// * -// * UTF-32 converter implementation. Used to be in ucnv_utf.c. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/utf.h" -// #include "ucnv_bld.h" -// #include "ucnv_cnv.h" -// #include "cmemory.h" - -// #define MAXIMUM_UCS2 0x0000FFFF -// #define MAXIMUM_UTF 0x0010FFFF -// #define HALF_SHIFT 10 -// #define HALF_BASE 0x0010000 -// #define HALF_MASK 0x3FF -// #define SURROGATE_HIGH_START 0xD800 -// #define SURROGATE_LOW_START 0xDC00 - -// /* -SURROGATE_LOW_START + HALF_BASE */ -// #define SURROGATE_LOW_BASE 9216 - -// enum { -// UCNV_NEED_TO_WRITE_BOM=1 -// }; - -// /* UTF-32BE ----------------------------------------------------------------- */ -// U_CDECL_BEGIN -// static void U_CALLCONV -// T_UConverter_toUnicode_UTF32_BE(UConverterToUnicodeArgs * args, -// UErrorCode * err) -// { -// const unsigned char *mySource = (unsigned char *) args->source; -// UChar *myTarget = args->target; -// const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit; -// const UChar *targetLimit = args->targetLimit; -// unsigned char *toUBytes = args->converter->toUBytes; -// uint32_t ch, i; - -// /* Restore state of current sequence */ -// if (args->converter->toULength > 0 && myTarget < targetLimit) { -// i = args->converter->toULength; /* restore # of bytes consumed */ -// args->converter->toULength = 0; - -// ch = args->converter->toUnicodeStatus - 1;/*Stores the previously calculated ch from a previous call*/ -// args->converter->toUnicodeStatus = 0; -// goto morebytes; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) { -// i = 0; -// ch = 0; -// morebytes: -// while (i < sizeof(uint32_t)) { -// if (mySource < sourceLimit) { -// ch = (ch << 8) | (uint8_t)(*mySource); -// toUBytes[i++] = (char) *(mySource++); -// } -// else { -// /* stores a partially calculated target*/ -// /* + 1 to make 0 a valid character */ -// args->converter->toUnicodeStatus = ch + 1; -// args->converter->toULength = (int8_t) i; -// goto donefornow; -// } -// } - -// if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) { -// /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */ -// if (ch <= MAXIMUM_UCS2) -// { -// /* fits in 16 bits */ -// *(myTarget++) = (UChar) ch; -// } -// else { -// /* write out the surrogates */ -// *(myTarget++) = U16_LEAD(ch); -// ch = U16_TRAIL(ch); -// if (myTarget < targetLimit) { -// *(myTarget++) = (UChar)ch; -// } -// else { -// /* Put in overflow buffer (not handled here) */ -// args->converter->UCharErrorBuffer[0] = (UChar) ch; -// args->converter->UCharErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// } -// else { -// args->converter->toULength = (int8_t)i; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } - -// donefornow: -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) { -// /* End of target buffer */ -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = myTarget; -// args->source = (const char *) mySource; -// } - -// static void U_CALLCONV -// T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(UConverterToUnicodeArgs * args, -// UErrorCode * err) -// { -// const unsigned char *mySource = (unsigned char *) args->source; -// UChar *myTarget = args->target; -// int32_t *myOffsets = args->offsets; -// const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit; -// const UChar *targetLimit = args->targetLimit; -// unsigned char *toUBytes = args->converter->toUBytes; -// uint32_t ch, i; -// int32_t offsetNum = 0; - -// /* Restore state of current sequence */ -// if (args->converter->toULength > 0 && myTarget < targetLimit) { -// i = args->converter->toULength; /* restore # of bytes consumed */ -// args->converter->toULength = 0; - -// ch = args->converter->toUnicodeStatus - 1;/*Stores the previously calculated ch from a previous call*/ -// args->converter->toUnicodeStatus = 0; -// goto morebytes; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) { -// i = 0; -// ch = 0; -// morebytes: -// while (i < sizeof(uint32_t)) { -// if (mySource < sourceLimit) { -// ch = (ch << 8) | (uint8_t)(*mySource); -// toUBytes[i++] = (char) *(mySource++); -// } -// else { -// /* stores a partially calculated target*/ -// /* + 1 to make 0 a valid character */ -// args->converter->toUnicodeStatus = ch + 1; -// args->converter->toULength = (int8_t) i; -// goto donefornow; -// } -// } - -// if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) { -// /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */ -// if (ch <= MAXIMUM_UCS2) { -// /* fits in 16 bits */ -// *(myTarget++) = (UChar) ch; -// *(myOffsets++) = offsetNum; -// } -// else { -// /* write out the surrogates */ -// *(myTarget++) = U16_LEAD(ch); -// *myOffsets++ = offsetNum; -// ch = U16_TRAIL(ch); -// if (myTarget < targetLimit) -// { -// *(myTarget++) = (UChar)ch; -// *(myOffsets++) = offsetNum; -// } -// else { -// /* Put in overflow buffer (not handled here) */ -// args->converter->UCharErrorBuffer[0] = (UChar) ch; -// args->converter->UCharErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// } -// else { -// args->converter->toULength = (int8_t)i; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// offsetNum += i; -// } - -// donefornow: -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// /* End of target buffer */ -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = myTarget; -// args->source = (const char *) mySource; -// args->offsets = myOffsets; -// } - -// static void U_CALLCONV -// T_UConverter_fromUnicode_UTF32_BE(UConverterFromUnicodeArgs * args, -// UErrorCode * err) -// { -// const UChar *mySource = args->source; -// unsigned char *myTarget; -// const UChar *sourceLimit = args->sourceLimit; -// const unsigned char *targetLimit = (unsigned char *) args->targetLimit; -// UChar32 ch, ch2; -// unsigned int indexToWrite; -// unsigned char temp[sizeof(uint32_t)]; - -// if(mySource >= sourceLimit) { -// /* no input, nothing to do */ -// return; -// } - -// /* write the BOM if necessary */ -// if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) { -// static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu }; -// ucnv_fromUWriteBytes(args->converter, -// bom, 4, -// &args->target, args->targetLimit, -// &args->offsets, -1, -// err); -// args->converter->fromUnicodeStatus=0; -// } - -// myTarget = (unsigned char *) args->target; -// temp[0] = 0; - -// if (args->converter->fromUChar32) { -// ch = args->converter->fromUChar32; -// args->converter->fromUChar32 = 0; -// goto lowsurogate; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) { -// ch = *(mySource++); - -// if (U_IS_SURROGATE(ch)) { -// if (U_IS_LEAD(ch)) { -// lowsurogate: -// if (mySource < sourceLimit) { -// ch2 = *mySource; -// if (U_IS_TRAIL(ch2)) { -// ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE; -// mySource++; -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// else { -// /* ran out of source */ -// args->converter->fromUChar32 = ch; -// if (args->flush) { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *err = U_ILLEGAL_CHAR_FOUND; -// } -// break; -// } -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } - -// /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */ -// temp[1] = (uint8_t) (ch >> 16 & 0x1F); -// temp[2] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */ -// temp[3] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */ - -// for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) { -// if (myTarget < targetLimit) { -// *(myTarget++) = temp[indexToWrite]; -// } -// else { -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite]; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// } - -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) { -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = (char *) myTarget; -// args->source = mySource; -// } - -// static void U_CALLCONV -// T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args, -// UErrorCode * err) -// { -// const UChar *mySource = args->source; -// unsigned char *myTarget; -// int32_t *myOffsets; -// const UChar *sourceLimit = args->sourceLimit; -// const unsigned char *targetLimit = (unsigned char *) args->targetLimit; -// UChar32 ch, ch2; -// int32_t offsetNum = 0; -// unsigned int indexToWrite; -// unsigned char temp[sizeof(uint32_t)]; - -// if(mySource >= sourceLimit) { -// /* no input, nothing to do */ -// return; -// } - -// /* write the BOM if necessary */ -// if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) { -// static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu }; -// ucnv_fromUWriteBytes(args->converter, -// bom, 4, -// &args->target, args->targetLimit, -// &args->offsets, -1, -// err); -// args->converter->fromUnicodeStatus=0; -// } - -// myTarget = (unsigned char *) args->target; -// myOffsets = args->offsets; -// temp[0] = 0; - -// if (args->converter->fromUChar32) { -// ch = args->converter->fromUChar32; -// args->converter->fromUChar32 = 0; -// goto lowsurogate; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) { -// ch = *(mySource++); - -// if (U_IS_SURROGATE(ch)) { -// if (U_IS_LEAD(ch)) { -// lowsurogate: -// if (mySource < sourceLimit) { -// ch2 = *mySource; -// if (U_IS_TRAIL(ch2)) { -// ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE; -// mySource++; -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// else { -// /* ran out of source */ -// args->converter->fromUChar32 = ch; -// if (args->flush) { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *err = U_ILLEGAL_CHAR_FOUND; -// } -// break; -// } -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } - -// /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */ -// temp[1] = (uint8_t) (ch >> 16 & 0x1F); -// temp[2] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */ -// temp[3] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */ - -// for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) { -// if (myTarget < targetLimit) { -// *(myTarget++) = temp[indexToWrite]; -// *(myOffsets++) = offsetNum; -// } -// else { -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite]; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// offsetNum = offsetNum + 1 + (temp[1] != 0); -// } - -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) { -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = (char *) myTarget; -// args->source = mySource; -// args->offsets = myOffsets; -// } - -// static UChar32 U_CALLCONV -// T_UConverter_getNextUChar_UTF32_BE(UConverterToUnicodeArgs* args, -// UErrorCode* err) -// { -// const uint8_t *mySource; -// UChar32 myUChar; -// int32_t length; - -// mySource = (const uint8_t *)args->source; -// if (mySource >= (const uint8_t *)args->sourceLimit) -// { -// /* no input */ -// *err = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// length = (int32_t)((const uint8_t *)args->sourceLimit - mySource); -// if (length < 4) -// { -// /* got a partial character */ -// uprv_memcpy(args->converter->toUBytes, mySource, length); -// args->converter->toULength = (int8_t)length; -// args->source = (const char *)(mySource + length); -// *err = U_TRUNCATED_CHAR_FOUND; -// return 0xffff; -// } - -// /* Don't even try to do a direct cast because the value may be on an odd address. */ -// myUChar = ((UChar32)mySource[0] << 24) -// | ((UChar32)mySource[1] << 16) -// | ((UChar32)mySource[2] << 8) -// | ((UChar32)mySource[3]); - -// args->source = (const char *)(mySource + 4); -// if ((uint32_t)myUChar <= MAXIMUM_UTF && !U_IS_SURROGATE(myUChar)) { -// return myUChar; -// } - -// uprv_memcpy(args->converter->toUBytes, mySource, 4); -// args->converter->toULength = 4; - -// *err = U_ILLEGAL_CHAR_FOUND; -// return 0xffff; -// } -// U_CDECL_END -// static const UConverterImpl _UTF32BEImpl = { -// UCNV_UTF32_BigEndian, - -// NULL, -// NULL, - -// NULL, -// NULL, -// NULL, - -// T_UConverter_toUnicode_UTF32_BE, -// T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC, -// T_UConverter_fromUnicode_UTF32_BE, -// T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC, -// T_UConverter_getNextUChar_UTF32_BE, - -// NULL, -// NULL, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// NULL, -// NULL -// }; - -// /* The 1232 CCSID refers to any version of Unicode with any endianess of UTF-32 */ -// static const UConverterStaticData _UTF32BEStaticData = { -// sizeof(UConverterStaticData), -// "UTF-32BE", -// 1232, -// UCNV_IBM, UCNV_UTF32_BigEndian, 4, 4, -// { 0, 0, 0xff, 0xfd }, 4, FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// const UConverterSharedData _UTF32BEData = -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32BEStaticData, &_UTF32BEImpl); - -// /* UTF-32LE ---------------------------------------------------------- */ -// U_CDECL_BEGIN -// static void U_CALLCONV -// T_UConverter_toUnicode_UTF32_LE(UConverterToUnicodeArgs * args, -// UErrorCode * err) -// { -// const unsigned char *mySource = (unsigned char *) args->source; -// UChar *myTarget = args->target; -// const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit; -// const UChar *targetLimit = args->targetLimit; -// unsigned char *toUBytes = args->converter->toUBytes; -// uint32_t ch, i; - -// /* Restore state of current sequence */ -// if (args->converter->toULength > 0 && myTarget < targetLimit) -// { -// i = args->converter->toULength; /* restore # of bytes consumed */ -// args->converter->toULength = 0; - -// /* Stores the previously calculated ch from a previous call*/ -// ch = args->converter->toUnicodeStatus - 1; -// args->converter->toUnicodeStatus = 0; -// goto morebytes; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// i = 0; -// ch = 0; -// morebytes: -// while (i < sizeof(uint32_t)) -// { -// if (mySource < sourceLimit) -// { -// ch |= ((uint8_t)(*mySource)) << (i * 8); -// toUBytes[i++] = (char) *(mySource++); -// } -// else -// { -// /* stores a partially calculated target*/ -// /* + 1 to make 0 a valid character */ -// args->converter->toUnicodeStatus = ch + 1; -// args->converter->toULength = (int8_t) i; -// goto donefornow; -// } -// } - -// if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) { -// /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */ -// if (ch <= MAXIMUM_UCS2) { -// /* fits in 16 bits */ -// *(myTarget++) = (UChar) ch; -// } -// else { -// /* write out the surrogates */ -// *(myTarget++) = U16_LEAD(ch); -// ch = U16_TRAIL(ch); -// if (myTarget < targetLimit) { -// *(myTarget++) = (UChar)ch; -// } -// else { -// /* Put in overflow buffer (not handled here) */ -// args->converter->UCharErrorBuffer[0] = (UChar) ch; -// args->converter->UCharErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// } -// else { -// args->converter->toULength = (int8_t)i; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } - -// donefornow: -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// /* End of target buffer */ -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = myTarget; -// args->source = (const char *) mySource; -// } - -// static void U_CALLCONV -// T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(UConverterToUnicodeArgs * args, -// UErrorCode * err) -// { -// const unsigned char *mySource = (unsigned char *) args->source; -// UChar *myTarget = args->target; -// int32_t *myOffsets = args->offsets; -// const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit; -// const UChar *targetLimit = args->targetLimit; -// unsigned char *toUBytes = args->converter->toUBytes; -// uint32_t ch, i; -// int32_t offsetNum = 0; - -// /* Restore state of current sequence */ -// if (args->converter->toULength > 0 && myTarget < targetLimit) -// { -// i = args->converter->toULength; /* restore # of bytes consumed */ -// args->converter->toULength = 0; - -// /* Stores the previously calculated ch from a previous call*/ -// ch = args->converter->toUnicodeStatus - 1; -// args->converter->toUnicodeStatus = 0; -// goto morebytes; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// i = 0; -// ch = 0; -// morebytes: -// while (i < sizeof(uint32_t)) -// { -// if (mySource < sourceLimit) -// { -// ch |= ((uint8_t)(*mySource)) << (i * 8); -// toUBytes[i++] = (char) *(mySource++); -// } -// else -// { -// /* stores a partially calculated target*/ -// /* + 1 to make 0 a valid character */ -// args->converter->toUnicodeStatus = ch + 1; -// args->converter->toULength = (int8_t) i; -// goto donefornow; -// } -// } - -// if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) -// { -// /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */ -// if (ch <= MAXIMUM_UCS2) -// { -// /* fits in 16 bits */ -// *(myTarget++) = (UChar) ch; -// *(myOffsets++) = offsetNum; -// } -// else { -// /* write out the surrogates */ -// *(myTarget++) = U16_LEAD(ch); -// *(myOffsets++) = offsetNum; -// ch = U16_TRAIL(ch); -// if (myTarget < targetLimit) -// { -// *(myTarget++) = (UChar)ch; -// *(myOffsets++) = offsetNum; -// } -// else -// { -// /* Put in overflow buffer (not handled here) */ -// args->converter->UCharErrorBuffer[0] = (UChar) ch; -// args->converter->UCharErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// } -// else -// { -// args->converter->toULength = (int8_t)i; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// offsetNum += i; -// } - -// donefornow: -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// /* End of target buffer */ -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = myTarget; -// args->source = (const char *) mySource; -// args->offsets = myOffsets; -// } - -// static void U_CALLCONV -// T_UConverter_fromUnicode_UTF32_LE(UConverterFromUnicodeArgs * args, -// UErrorCode * err) -// { -// const UChar *mySource = args->source; -// unsigned char *myTarget; -// const UChar *sourceLimit = args->sourceLimit; -// const unsigned char *targetLimit = (unsigned char *) args->targetLimit; -// UChar32 ch, ch2; -// unsigned int indexToWrite; -// unsigned char temp[sizeof(uint32_t)]; - -// if(mySource >= sourceLimit) { -// /* no input, nothing to do */ -// return; -// } - -// /* write the BOM if necessary */ -// if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) { -// static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 }; -// ucnv_fromUWriteBytes(args->converter, -// bom, 4, -// &args->target, args->targetLimit, -// &args->offsets, -1, -// err); -// args->converter->fromUnicodeStatus=0; -// } - -// myTarget = (unsigned char *) args->target; -// temp[3] = 0; - -// if (args->converter->fromUChar32) -// { -// ch = args->converter->fromUChar32; -// args->converter->fromUChar32 = 0; -// goto lowsurogate; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// ch = *(mySource++); - -// if (U16_IS_SURROGATE(ch)) { -// if (U16_IS_LEAD(ch)) -// { -// lowsurogate: -// if (mySource < sourceLimit) -// { -// ch2 = *mySource; -// if (U16_IS_TRAIL(ch2)) { -// ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE; -// mySource++; -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// else { -// /* ran out of source */ -// args->converter->fromUChar32 = ch; -// if (args->flush) { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *err = U_ILLEGAL_CHAR_FOUND; -// } -// break; -// } -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } - -// /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */ -// temp[2] = (uint8_t) (ch >> 16 & 0x1F); -// temp[1] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */ -// temp[0] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */ - -// for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) -// { -// if (myTarget < targetLimit) -// { -// *(myTarget++) = temp[indexToWrite]; -// } -// else -// { -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite]; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// } - -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = (char *) myTarget; -// args->source = mySource; -// } - -// static void U_CALLCONV -// T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args, -// UErrorCode * err) -// { -// const UChar *mySource = args->source; -// unsigned char *myTarget; -// int32_t *myOffsets; -// const UChar *sourceLimit = args->sourceLimit; -// const unsigned char *targetLimit = (unsigned char *) args->targetLimit; -// UChar32 ch, ch2; -// unsigned int indexToWrite; -// unsigned char temp[sizeof(uint32_t)]; -// int32_t offsetNum = 0; - -// if(mySource >= sourceLimit) { -// /* no input, nothing to do */ -// return; -// } - -// /* write the BOM if necessary */ -// if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) { -// static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 }; -// ucnv_fromUWriteBytes(args->converter, -// bom, 4, -// &args->target, args->targetLimit, -// &args->offsets, -1, -// err); -// args->converter->fromUnicodeStatus=0; -// } - -// myTarget = (unsigned char *) args->target; -// myOffsets = args->offsets; -// temp[3] = 0; - -// if (args->converter->fromUChar32) -// { -// ch = args->converter->fromUChar32; -// args->converter->fromUChar32 = 0; -// goto lowsurogate; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// ch = *(mySource++); - -// if (U16_IS_SURROGATE(ch)) { -// if (U16_IS_LEAD(ch)) -// { -// lowsurogate: -// if (mySource < sourceLimit) -// { -// ch2 = *mySource; -// if (U16_IS_TRAIL(ch2)) -// { -// ch = ((ch - SURROGATE_HIGH_START) << HALF_SHIFT) + ch2 + SURROGATE_LOW_BASE; -// mySource++; -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// else { -// /* ran out of source */ -// args->converter->fromUChar32 = ch; -// if (args->flush) { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *err = U_ILLEGAL_CHAR_FOUND; -// } -// break; -// } -// } -// else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// args->converter->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } - -// /* We cannot get any larger than 10FFFF because we are coming from UTF-16 */ -// temp[2] = (uint8_t) (ch >> 16 & 0x1F); -// temp[1] = (uint8_t) (ch >> 8); /* unsigned cast implicitly does (ch & FF) */ -// temp[0] = (uint8_t) (ch); /* unsigned cast implicitly does (ch & FF) */ - -// for (indexToWrite = 0; indexToWrite <= sizeof(uint32_t) - 1; indexToWrite++) -// { -// if (myTarget < targetLimit) -// { -// *(myTarget++) = temp[indexToWrite]; -// *(myOffsets++) = offsetNum; -// } -// else -// { -// args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = temp[indexToWrite]; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// offsetNum = offsetNum + 1 + (temp[2] != 0); -// } - -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = (char *) myTarget; -// args->source = mySource; -// args->offsets = myOffsets; -// } - -// static UChar32 U_CALLCONV -// T_UConverter_getNextUChar_UTF32_LE(UConverterToUnicodeArgs* args, -// UErrorCode* err) -// { -// const uint8_t *mySource; -// UChar32 myUChar; -// int32_t length; - -// mySource = (const uint8_t *)args->source; -// if (mySource >= (const uint8_t *)args->sourceLimit) -// { -// /* no input */ -// *err = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// length = (int32_t)((const uint8_t *)args->sourceLimit - mySource); -// if (length < 4) -// { -// /* got a partial character */ -// uprv_memcpy(args->converter->toUBytes, mySource, length); -// args->converter->toULength = (int8_t)length; -// args->source = (const char *)(mySource + length); -// *err = U_TRUNCATED_CHAR_FOUND; -// return 0xffff; -// } - -// /* Don't even try to do a direct cast because the value may be on an odd address. */ -// myUChar = ((UChar32)mySource[3] << 24) -// | ((UChar32)mySource[2] << 16) -// | ((UChar32)mySource[1] << 8) -// | ((UChar32)mySource[0]); - -// args->source = (const char *)(mySource + 4); -// if ((uint32_t)myUChar <= MAXIMUM_UTF && !U_IS_SURROGATE(myUChar)) { -// return myUChar; -// } - -// uprv_memcpy(args->converter->toUBytes, mySource, 4); -// args->converter->toULength = 4; - -// *err = U_ILLEGAL_CHAR_FOUND; -// return 0xffff; -// } -// U_CDECL_END -// static const UConverterImpl _UTF32LEImpl = { -// UCNV_UTF32_LittleEndian, - -// NULL, -// NULL, - -// NULL, -// NULL, -// NULL, - -// T_UConverter_toUnicode_UTF32_LE, -// T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC, -// T_UConverter_fromUnicode_UTF32_LE, -// T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC, -// T_UConverter_getNextUChar_UTF32_LE, - -// NULL, -// NULL, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// NULL, -// NULL -// }; - -// /* The 1232 CCSID refers to any version of Unicode with any endianess of UTF-32 */ -// static const UConverterStaticData _UTF32LEStaticData = { -// sizeof(UConverterStaticData), -// "UTF-32LE", -// 1234, -// UCNV_IBM, UCNV_UTF32_LittleEndian, 4, 4, -// { 0xfd, 0xff, 0, 0 }, 4, FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - - -// const UConverterSharedData _UTF32LEData = -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32LEStaticData, &_UTF32LEImpl); - -// /* UTF-32 (Detect BOM) ------------------------------------------------------ */ - -// /* -// * Detect a BOM at the beginning of the stream and select UTF-32BE or UTF-32LE -// * accordingly. -// * -// * State values: -// * 0 initial state -// * 1 saw 00 -// * 2 saw 00 00 -// * 3 saw 00 00 FE -// * 4 - -// * 5 saw FF -// * 6 saw FF FE -// * 7 saw FF FE 00 -// * 8 UTF-32BE mode -// * 9 UTF-32LE mode -// * -// * During detection: state&3==number of matching bytes so far. -// * -// * On output, emit U+FEFF as the first code point. -// */ -// U_CDECL_BEGIN -// static void U_CALLCONV -// _UTF32Reset(UConverter *cnv, UConverterResetChoice choice) { -// if(choice<=UCNV_RESET_TO_UNICODE) { -// /* reset toUnicode: state=0 */ -// cnv->mode=0; -// } -// if(choice!=UCNV_RESET_TO_UNICODE) { -// /* reset fromUnicode: prepare to output the UTF-32PE BOM */ -// cnv->fromUnicodeStatus=UCNV_NEED_TO_WRITE_BOM; -// } -// } - -// static void U_CALLCONV -// _UTF32Open(UConverter *cnv, -// UConverterLoadArgs *pArgs, -// UErrorCode *pErrorCode) { -// (void)pArgs; -// (void)pErrorCode; -// _UTF32Reset(cnv, UCNV_RESET_BOTH); -// } - -// static const char utf32BOM[8]={ 0, 0, (char)0xfeu, (char)0xffu, (char)0xffu, (char)0xfeu, 0, 0 }; - -// static void U_CALLCONV -// _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv=pArgs->converter; -// const char *source=pArgs->source; -// const char *sourceLimit=pArgs->sourceLimit; -// int32_t *offsets=pArgs->offsets; - -// int32_t state, offsetDelta; -// char b; - -// state=cnv->mode; - -// /* -// * If we detect a BOM in this buffer, then we must add the BOM size to the -// * offsets because the actual converter function will not see and count the BOM. -// * offsetDelta will have the number of the BOM bytes that are in the current buffer. -// */ -// offsetDelta=0; - -// while(sourcesource); -// } else if(state==8) { -// state=9; /* detect UTF-32LE */ -// offsetDelta=(int32_t)(source-pArgs->source); -// } -// } else { -// /* switch to UTF-32BE and pass the previous bytes */ -// int32_t count=(int32_t)(source-pArgs->source); /* number of bytes from this buffer */ - -// /* reset the source */ -// source=pArgs->source; - -// if(count==(state&3)) { -// /* simple: all in the same buffer, just reset source */ -// } else { -// UBool oldFlush=pArgs->flush; - -// /* some of the bytes are from a previous buffer, replay those first */ -// pArgs->source=utf32BOM+(state&4); /* select the correct BOM */ -// pArgs->sourceLimit=pArgs->source+((state&3)-count); /* replay previous bytes */ -// pArgs->flush=FALSE; /* this sourceLimit is not the real source stream limit */ - -// /* no offsets: bytes from previous buffer, and not enough for output */ -// T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode); - -// /* restore real pointers; pArgs->source will be set in case 8/9 */ -// pArgs->sourceLimit=sourceLimit; -// pArgs->flush=oldFlush; -// } -// state=8; -// continue; -// } -// break; -// case 8: -// /* call UTF-32BE */ -// pArgs->source=source; -// if(offsets==NULL) { -// T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode); -// } else { -// T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(pArgs, pErrorCode); -// } -// source=pArgs->source; -// break; -// case 9: -// /* call UTF-32LE */ -// pArgs->source=source; -// if(offsets==NULL) { -// T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode); -// } else { -// T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(pArgs, pErrorCode); -// } -// source=pArgs->source; -// break; -// default: -// break; /* does not occur */ -// } -// } - -// /* add BOM size to offsets - see comment at offsetDelta declaration */ -// if(offsets!=NULL && offsetDelta!=0) { -// int32_t *offsetsLimit=pArgs->offsets; -// while(offsetssource=source; - -// if(source==sourceLimit && pArgs->flush) { -// /* handle truncated input */ -// switch(state) { -// case 0: -// break; /* no input at all, nothing to do */ -// case 8: -// T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode); -// break; -// case 9: -// T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode); -// break; -// default: -// /* handle 0source=utf32BOM+(state&4); /* select the correct BOM */ -// pArgs->sourceLimit=pArgs->source+(state&3); /* replay bytes */ - -// /* no offsets: not enough for output */ -// T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode); -// pArgs->source=source; -// pArgs->sourceLimit=sourceLimit; -// state=8; -// break; -// } -// } - -// cnv->mode=state; -// } - -// static UChar32 U_CALLCONV -// _UTF32GetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// switch(pArgs->converter->mode) { -// case 8: -// return T_UConverter_getNextUChar_UTF32_BE(pArgs, pErrorCode); -// case 9: -// return T_UConverter_getNextUChar_UTF32_LE(pArgs, pErrorCode); -// default: -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } -// } -// U_CDECL_END -// static const UConverterImpl _UTF32Impl = { -// UCNV_UTF32, - -// NULL, -// NULL, - -// _UTF32Open, -// NULL, -// _UTF32Reset, - -// _UTF32ToUnicodeWithOffsets, -// _UTF32ToUnicodeWithOffsets, -// #if U_IS_BIG_ENDIAN -// T_UConverter_fromUnicode_UTF32_BE, -// T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC, -// #else -// T_UConverter_fromUnicode_UTF32_LE, -// T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC, -// #endif -// _UTF32GetNextUChar, - -// NULL, /* ### TODO implement getStarters for all Unicode encodings?! */ -// NULL, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// NULL, -// NULL -// }; - -// /* The 1236 CCSID refers to any version of Unicode with a BOM sensitive endianess of UTF-32 */ -// static const UConverterStaticData _UTF32StaticData = { -// sizeof(UConverterStaticData), -// "UTF-32", -// 1236, -// UCNV_IBM, UCNV_UTF32, 4, 4, -// #if U_IS_BIG_ENDIAN -// { 0, 0, 0xff, 0xfd }, 4, -// #else -// { 0xfd, 0xff, 0, 0 }, 4, -// #endif -// FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// const UConverterSharedData _UTF32Data = -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32StaticData, &_UTF32Impl); - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_u7.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_u7.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnv_u8.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnv_u8.cpp deleted file mode 100644 index 32e366c0a..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnv_u8.cpp +++ /dev/null @@ -1,944 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2002-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * file name: ucnv_u8.c -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2002jul01 -// * created by: Markus W. Scherer -// * -// * UTF-8 converter implementation. Used to be in ucnv_utf.c. -// * -// * Also, CESU-8 implementation, see UTR 26. -// * The CESU-8 converter uses all the same functions as the -// * UTF-8 converter, with a branch for converting supplementary code points. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/utf.h" -// #include "unicode/utf8.h" -// #include "unicode/utf16.h" -// #include "uassert.h" -// #include "ucnv_bld.h" -// #include "ucnv_cnv.h" -// #include "cmemory.h" -// #include "ustr_imp.h" - -// /* Prototypes --------------------------------------------------------------- */ - -// /* Keep these here to make finicky compilers happy */ - -// U_CFUNC void ucnv_fromUnicode_UTF8(UConverterFromUnicodeArgs *args, -// UErrorCode *err); -// U_CFUNC void ucnv_fromUnicode_UTF8_OFFSETS_LOGIC(UConverterFromUnicodeArgs *args, -// UErrorCode *err); - - -// /* UTF-8 -------------------------------------------------------------------- */ - -// #define MAXIMUM_UCS2 0x0000FFFF - -// static const uint32_t offsetsFromUTF8[5] = {0, -// (uint32_t) 0x00000000, (uint32_t) 0x00003080, (uint32_t) 0x000E2080, -// (uint32_t) 0x03C82080 -// }; - -// static UBool hasCESU8Data(const UConverter *cnv) -// { -// #if UCONFIG_ONLY_HTML_CONVERSION -// return FALSE; -// #else -// return (UBool)(cnv->sharedData == &_CESU8Data); -// #endif -// } -// U_CDECL_BEGIN -// static void U_CALLCONV ucnv_toUnicode_UTF8 (UConverterToUnicodeArgs * args, -// UErrorCode * err) -// { -// UConverter *cnv = args->converter; -// const unsigned char *mySource = (unsigned char *) args->source; -// UChar *myTarget = args->target; -// const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit; -// const UChar *targetLimit = args->targetLimit; -// unsigned char *toUBytes = cnv->toUBytes; -// UBool isCESU8 = hasCESU8Data(cnv); -// uint32_t ch, ch2 = 0; -// int32_t i, inBytes; - -// /* Restore size of current sequence */ -// if (cnv->toULength > 0 && myTarget < targetLimit) -// { -// inBytes = cnv->mode; /* restore # of bytes to consume */ -// i = cnv->toULength; /* restore # of bytes consumed */ -// cnv->toULength = 0; - -// ch = cnv->toUnicodeStatus;/*Stores the previously calculated ch from a previous call*/ -// cnv->toUnicodeStatus = 0; -// goto morebytes; -// } - - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// ch = *(mySource++); -// if (U8_IS_SINGLE(ch)) /* Simple case */ -// { -// *(myTarget++) = (UChar) ch; -// } -// else -// { -// /* store the first char */ -// toUBytes[0] = (char)ch; -// inBytes = U8_COUNT_BYTES_NON_ASCII(ch); /* lookup current sequence length */ -// i = 1; - -// morebytes: -// while (i < inBytes) -// { -// if (mySource < sourceLimit) -// { -// toUBytes[i] = (char) (ch2 = *mySource); -// if (!icu::UTF8::isValidTrail(ch, static_cast(ch2), i, inBytes) && -// !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2))) -// { -// break; /* i < inBytes */ -// } -// ch = (ch << 6) + ch2; -// ++mySource; -// i++; -// } -// else -// { -// /* stores a partially calculated target*/ -// cnv->toUnicodeStatus = ch; -// cnv->mode = inBytes; -// cnv->toULength = (int8_t) i; -// goto donefornow; -// } -// } - -// // In CESU-8, only surrogates, not supplementary code points, are encoded directly. -// if (i == inBytes && (!isCESU8 || i <= 3)) -// { -// /* Remove the accumulated high bits */ -// ch -= offsetsFromUTF8[inBytes]; - -// /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */ -// if (ch <= MAXIMUM_UCS2) -// { -// /* fits in 16 bits */ -// *(myTarget++) = (UChar) ch; -// } -// else -// { -// /* write out the surrogates */ -// *(myTarget++) = U16_LEAD(ch); -// ch = U16_TRAIL(ch); -// if (myTarget < targetLimit) -// { -// *(myTarget++) = (UChar)ch; -// } -// else -// { -// /* Put in overflow buffer (not handled here) */ -// cnv->UCharErrorBuffer[0] = (UChar) ch; -// cnv->UCharErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// } -// else -// { -// cnv->toULength = (int8_t)i; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// } - -// donefornow: -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// /* End of target buffer */ -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = myTarget; -// args->source = (const char *) mySource; -// } - -// static void U_CALLCONV ucnv_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeArgs * args, -// UErrorCode * err) -// { -// UConverter *cnv = args->converter; -// const unsigned char *mySource = (unsigned char *) args->source; -// UChar *myTarget = args->target; -// int32_t *myOffsets = args->offsets; -// int32_t offsetNum = 0; -// const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit; -// const UChar *targetLimit = args->targetLimit; -// unsigned char *toUBytes = cnv->toUBytes; -// UBool isCESU8 = hasCESU8Data(cnv); -// uint32_t ch, ch2 = 0; -// int32_t i, inBytes; - -// /* Restore size of current sequence */ -// if (cnv->toULength > 0 && myTarget < targetLimit) -// { -// inBytes = cnv->mode; /* restore # of bytes to consume */ -// i = cnv->toULength; /* restore # of bytes consumed */ -// cnv->toULength = 0; - -// ch = cnv->toUnicodeStatus;/*Stores the previously calculated ch from a previous call*/ -// cnv->toUnicodeStatus = 0; -// goto morebytes; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// ch = *(mySource++); -// if (U8_IS_SINGLE(ch)) /* Simple case */ -// { -// *(myTarget++) = (UChar) ch; -// *(myOffsets++) = offsetNum++; -// } -// else -// { -// toUBytes[0] = (char)ch; -// inBytes = U8_COUNT_BYTES_NON_ASCII(ch); -// i = 1; - -// morebytes: -// while (i < inBytes) -// { -// if (mySource < sourceLimit) -// { -// toUBytes[i] = (char) (ch2 = *mySource); -// if (!icu::UTF8::isValidTrail(ch, static_cast(ch2), i, inBytes) && -// !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2))) -// { -// break; /* i < inBytes */ -// } -// ch = (ch << 6) + ch2; -// ++mySource; -// i++; -// } -// else -// { -// cnv->toUnicodeStatus = ch; -// cnv->mode = inBytes; -// cnv->toULength = (int8_t)i; -// goto donefornow; -// } -// } - -// // In CESU-8, only surrogates, not supplementary code points, are encoded directly. -// if (i == inBytes && (!isCESU8 || i <= 3)) -// { -// /* Remove the accumulated high bits */ -// ch -= offsetsFromUTF8[inBytes]; - -// /* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */ -// if (ch <= MAXIMUM_UCS2) -// { -// /* fits in 16 bits */ -// *(myTarget++) = (UChar) ch; -// *(myOffsets++) = offsetNum; -// } -// else -// { -// /* write out the surrogates */ -// *(myTarget++) = U16_LEAD(ch); -// *(myOffsets++) = offsetNum; -// ch = U16_TRAIL(ch); -// if (myTarget < targetLimit) -// { -// *(myTarget++) = (UChar)ch; -// *(myOffsets++) = offsetNum; -// } -// else -// { -// cnv->UCharErrorBuffer[0] = (UChar) ch; -// cnv->UCharErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// offsetNum += i; -// } -// else -// { -// cnv->toULength = (int8_t)i; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// } - -// donefornow: -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { /* End of target buffer */ -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = myTarget; -// args->source = (const char *) mySource; -// args->offsets = myOffsets; -// } -// U_CDECL_END - -// U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8 (UConverterFromUnicodeArgs * args, -// UErrorCode * err) -// { -// UConverter *cnv = args->converter; -// const UChar *mySource = args->source; -// const UChar *sourceLimit = args->sourceLimit; -// uint8_t *myTarget = (uint8_t *) args->target; -// const uint8_t *targetLimit = (uint8_t *) args->targetLimit; -// uint8_t *tempPtr; -// UChar32 ch; -// uint8_t tempBuf[4]; -// int32_t indexToWrite; -// UBool isNotCESU8 = !hasCESU8Data(cnv); - -// if (cnv->fromUChar32 && myTarget < targetLimit) -// { -// ch = cnv->fromUChar32; -// cnv->fromUChar32 = 0; -// goto lowsurrogate; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// ch = *(mySource++); - -// if (ch < 0x80) /* Single byte */ -// { -// *(myTarget++) = (uint8_t) ch; -// } -// else if (ch < 0x800) /* Double byte */ -// { -// *(myTarget++) = (uint8_t) ((ch >> 6) | 0xc0); -// if (myTarget < targetLimit) -// { -// *(myTarget++) = (uint8_t) ((ch & 0x3f) | 0x80); -// } -// else -// { -// cnv->charErrorBuffer[0] = (uint8_t) ((ch & 0x3f) | 0x80); -// cnv->charErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// else { -// /* Check for surrogates */ -// if(U16_IS_SURROGATE(ch) && isNotCESU8) { -// lowsurrogate: -// if (mySource < sourceLimit) { -// /* test both code units */ -// if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(*mySource)) { -// /* convert and consume this supplementary code point */ -// ch=U16_GET_SUPPLEMENTARY(ch, *mySource); -// ++mySource; -// /* exit this condition tree */ -// } -// else { -// /* this is an unpaired trail or lead code unit */ -// /* callback(illegal) */ -// cnv->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// else { -// /* no more input */ -// cnv->fromUChar32 = ch; -// break; -// } -// } - -// /* Do we write the buffer directly for speed, -// or do we have to be careful about target buffer space? */ -// tempPtr = (((targetLimit - myTarget) >= 4) ? myTarget : tempBuf); - -// if (ch <= MAXIMUM_UCS2) { -// indexToWrite = 2; -// tempPtr[0] = (uint8_t) ((ch >> 12) | 0xe0); -// } -// else { -// indexToWrite = 3; -// tempPtr[0] = (uint8_t) ((ch >> 18) | 0xf0); -// tempPtr[1] = (uint8_t) (((ch >> 12) & 0x3f) | 0x80); -// } -// tempPtr[indexToWrite-1] = (uint8_t) (((ch >> 6) & 0x3f) | 0x80); -// tempPtr[indexToWrite] = (uint8_t) ((ch & 0x3f) | 0x80); - -// if (tempPtr == myTarget) { -// /* There was enough space to write the codepoint directly. */ -// myTarget += (indexToWrite + 1); -// } -// else { -// /* We might run out of room soon. Write it slowly. */ -// for (; tempPtr <= (tempBuf + indexToWrite); tempPtr++) { -// if (myTarget < targetLimit) { -// *(myTarget++) = *tempPtr; -// } -// else { -// cnv->charErrorBuffer[cnv->charErrorBufferLength++] = *tempPtr; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// } -// } -// } - -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = (char *) myTarget; -// args->source = mySource; -// } - -// U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args, -// UErrorCode * err) -// { -// UConverter *cnv = args->converter; -// const UChar *mySource = args->source; -// int32_t *myOffsets = args->offsets; -// const UChar *sourceLimit = args->sourceLimit; -// uint8_t *myTarget = (uint8_t *) args->target; -// const uint8_t *targetLimit = (uint8_t *) args->targetLimit; -// uint8_t *tempPtr; -// UChar32 ch; -// int32_t offsetNum, nextSourceIndex; -// int32_t indexToWrite; -// uint8_t tempBuf[4]; -// UBool isNotCESU8 = !hasCESU8Data(cnv); - -// if (cnv->fromUChar32 && myTarget < targetLimit) -// { -// ch = cnv->fromUChar32; -// cnv->fromUChar32 = 0; -// offsetNum = -1; -// nextSourceIndex = 0; -// goto lowsurrogate; -// } else { -// offsetNum = 0; -// } - -// while (mySource < sourceLimit && myTarget < targetLimit) -// { -// ch = *(mySource++); - -// if (ch < 0x80) /* Single byte */ -// { -// *(myOffsets++) = offsetNum++; -// *(myTarget++) = (char) ch; -// } -// else if (ch < 0x800) /* Double byte */ -// { -// *(myOffsets++) = offsetNum; -// *(myTarget++) = (uint8_t) ((ch >> 6) | 0xc0); -// if (myTarget < targetLimit) -// { -// *(myOffsets++) = offsetNum++; -// *(myTarget++) = (uint8_t) ((ch & 0x3f) | 0x80); -// } -// else -// { -// cnv->charErrorBuffer[0] = (uint8_t) ((ch & 0x3f) | 0x80); -// cnv->charErrorBufferLength = 1; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// else -// /* Check for surrogates */ -// { -// nextSourceIndex = offsetNum + 1; - -// if(U16_IS_SURROGATE(ch) && isNotCESU8) { -// lowsurrogate: -// if (mySource < sourceLimit) { -// /* test both code units */ -// if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(*mySource)) { -// /* convert and consume this supplementary code point */ -// ch=U16_GET_SUPPLEMENTARY(ch, *mySource); -// ++mySource; -// ++nextSourceIndex; -// /* exit this condition tree */ -// } -// else { -// /* this is an unpaired trail or lead code unit */ -// /* callback(illegal) */ -// cnv->fromUChar32 = ch; -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// else { -// /* no more input */ -// cnv->fromUChar32 = ch; -// break; -// } -// } - -// /* Do we write the buffer directly for speed, -// or do we have to be careful about target buffer space? */ -// tempPtr = (((targetLimit - myTarget) >= 4) ? myTarget : tempBuf); - -// if (ch <= MAXIMUM_UCS2) { -// indexToWrite = 2; -// tempPtr[0] = (uint8_t) ((ch >> 12) | 0xe0); -// } -// else { -// indexToWrite = 3; -// tempPtr[0] = (uint8_t) ((ch >> 18) | 0xf0); -// tempPtr[1] = (uint8_t) (((ch >> 12) & 0x3f) | 0x80); -// } -// tempPtr[indexToWrite-1] = (uint8_t) (((ch >> 6) & 0x3f) | 0x80); -// tempPtr[indexToWrite] = (uint8_t) ((ch & 0x3f) | 0x80); - -// if (tempPtr == myTarget) { -// /* There was enough space to write the codepoint directly. */ -// myTarget += (indexToWrite + 1); -// myOffsets[0] = offsetNum; -// myOffsets[1] = offsetNum; -// myOffsets[2] = offsetNum; -// if (indexToWrite >= 3) { -// myOffsets[3] = offsetNum; -// } -// myOffsets += (indexToWrite + 1); -// } -// else { -// /* We might run out of room soon. Write it slowly. */ -// for (; tempPtr <= (tempBuf + indexToWrite); tempPtr++) { -// if (myTarget < targetLimit) -// { -// *(myOffsets++) = offsetNum; -// *(myTarget++) = *tempPtr; -// } -// else -// { -// cnv->charErrorBuffer[cnv->charErrorBufferLength++] = *tempPtr; -// *err = U_BUFFER_OVERFLOW_ERROR; -// } -// } -// } -// offsetNum = nextSourceIndex; -// } -// } - -// if (mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS(*err)) -// { -// *err = U_BUFFER_OVERFLOW_ERROR; -// } - -// args->target = (char *) myTarget; -// args->source = mySource; -// args->offsets = myOffsets; -// } - -// U_CDECL_BEGIN -// static UChar32 U_CALLCONV ucnv_getNextUChar_UTF8(UConverterToUnicodeArgs *args, -// UErrorCode *err) { -// UConverter *cnv; -// const uint8_t *sourceInitial; -// const uint8_t *source; -// uint8_t myByte; -// UChar32 ch; -// int8_t i; - -// /* UTF-8 only here, the framework handles CESU-8 to combine surrogate pairs */ - -// cnv = args->converter; -// sourceInitial = source = (const uint8_t *)args->source; -// if (source >= (const uint8_t *)args->sourceLimit) -// { -// /* no input */ -// *err = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// myByte = (uint8_t)*(source++); -// if (U8_IS_SINGLE(myByte)) -// { -// args->source = (const char *)source; -// return (UChar32)myByte; -// } - -// uint16_t countTrailBytes = U8_COUNT_TRAIL_BYTES(myByte); -// if (countTrailBytes == 0) { -// cnv->toUBytes[0] = myByte; -// cnv->toULength = 1; -// *err = U_ILLEGAL_CHAR_FOUND; -// args->source = (const char *)source; -// return 0xffff; -// } - -// /*The byte sequence is longer than the buffer area passed*/ -// if (((const char *)source + countTrailBytes) > args->sourceLimit) -// { -// /* check if all of the remaining bytes are trail bytes */ -// uint16_t extraBytesToWrite = countTrailBytes + 1; -// cnv->toUBytes[0] = myByte; -// i = 1; -// *err = U_TRUNCATED_CHAR_FOUND; -// while(source < (const uint8_t *)args->sourceLimit) { -// uint8_t b = *source; -// if(icu::UTF8::isValidTrail(myByte, b, i, extraBytesToWrite)) { -// cnv->toUBytes[i++] = b; -// ++source; -// } else { -// /* error even before we run out of input */ -// *err = U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } -// cnv->toULength = i; -// args->source = (const char *)source; -// return 0xffff; -// } - -// ch = myByte << 6; -// if(countTrailBytes == 2) { -// uint8_t t1 = *source, t2; -// if(U8_IS_VALID_LEAD3_AND_T1(myByte, t1) && U8_IS_TRAIL(t2 = *++source)) { -// args->source = (const char *)(source + 1); -// return (((ch + t1) << 6) + t2) - offsetsFromUTF8[3]; -// } -// } else if(countTrailBytes == 1) { -// uint8_t t1 = *source; -// if(U8_IS_TRAIL(t1)) { -// args->source = (const char *)(source + 1); -// return (ch + t1) - offsetsFromUTF8[2]; -// } -// } else { // countTrailBytes == 3 -// uint8_t t1 = *source, t2, t3; -// if(U8_IS_VALID_LEAD4_AND_T1(myByte, t1) && U8_IS_TRAIL(t2 = *++source) && -// U8_IS_TRAIL(t3 = *++source)) { -// args->source = (const char *)(source + 1); -// return (((((ch + t1) << 6) + t2) << 6) + t3) - offsetsFromUTF8[4]; -// } -// } -// args->source = (const char *)source; - -// for(i = 0; sourceInitial < source; ++i) { -// cnv->toUBytes[i] = *sourceInitial++; -// } -// cnv->toULength = i; -// *err = U_ILLEGAL_CHAR_FOUND; -// return 0xffff; -// } -// U_CDECL_END - -// /* UTF-8-from-UTF-8 conversion functions ------------------------------------ */ - -// U_CDECL_BEGIN -// /* "Convert" UTF-8 to UTF-8: Validate and copy. Modified from ucnv_DBCSFromUTF8(). */ -// static void U_CALLCONV -// ucnv_UTF8FromUTF8(UConverterFromUnicodeArgs *pFromUArgs, -// UConverterToUnicodeArgs *pToUArgs, -// UErrorCode *pErrorCode) { -// UConverter *utf8; -// const uint8_t *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; -// int32_t count; - -// int8_t oldToULength, toULength, toULimit; - -// UChar32 c; -// uint8_t b, t1, t2; - -// /* set up the local pointers */ -// utf8=pToUArgs->converter; -// source=(uint8_t *)pToUArgs->source; -// sourceLimit=(uint8_t *)pToUArgs->sourceLimit; -// target=(uint8_t *)pFromUArgs->target; -// targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target); - -// /* get the converter state from the UTF-8 UConverter */ -// if(utf8->toULength > 0) { -// toULength=oldToULength=utf8->toULength; -// toULimit=(int8_t)utf8->mode; -// c=(UChar32)utf8->toUnicodeStatus; -// } else { -// toULength=oldToULength=toULimit=0; -// c = 0; -// } - -// count=(int32_t)(sourceLimit-source)+oldToULength; -// if(counttargetCapacity) { -// count=targetCapacity; -// } - -// // The conversion loop checks count>0 only once per character. -// // If the buffer ends with a truncated sequence, -// // then we reduce the count to stop before that, -// // and collect the remaining bytes after the conversion loop. - -// // Do not go back into the bytes that will be read for finishing a partial -// // sequence from the previous buffer. -// int32_t length=count-toULimit; -// U8_TRUNCATE_IF_INCOMPLETE(source, 0, length); -// count=toULimit+length; -// } - -// if(c!=0) { -// utf8->toUnicodeStatus=0; -// utf8->toULength=0; -// goto moreBytes; -// /* See note in ucnv_SBCSFromUTF8() about this goto. */ -// } - -// /* conversion loop */ -// while(count>0) { -// b=*source++; -// if(U8_IS_SINGLE(b)) { -// /* convert ASCII */ -// *target++=b; -// --count; -// continue; -// } else { -// if(b>=0xe0) { -// if( /* handle U+0800..U+FFFF inline */ -// b<0xf0 && -// U8_IS_VALID_LEAD3_AND_T1(b, t1=source[0]) && -// U8_IS_TRAIL(t2=source[1]) -// ) { -// source+=2; -// *target++=b; -// *target++=t1; -// *target++=t2; -// count-=3; -// continue; -// } -// } else { -// if( /* handle U+0080..U+07FF inline */ -// b>=0xc2 && -// U8_IS_TRAIL(t1=*source) -// ) { -// ++source; -// *target++=b; -// *target++=t1; -// count-=2; -// continue; -// } -// } - -// /* handle "complicated" and error cases, and continuing partial characters */ -// oldToULength=0; -// toULength=1; -// toULimit=U8_COUNT_BYTES_NON_ASCII(b); -// c=b; -// moreBytes: -// while(toULengthtoUBytes[oldToULength++]=*source++; -// } -// utf8->toUnicodeStatus=c; -// utf8->toULength=toULength; -// utf8->mode=toULimit; -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// return; -// } -// } - -// if(toULength!=toULimit) { -// /* error handling: illegal UTF-8 byte sequence */ -// source-=(toULength-oldToULength); -// while(oldToULengthtoUBytes[oldToULength++]=*source++; -// } -// utf8->toULength=toULength; -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return; -// } - -// /* copy the legal byte sequence to the target */ -// { -// int8_t i; - -// for(i=0; itoUBytes[i]; -// } -// source-=(toULength-oldToULength); -// for(; i=0); - -// if(U_SUCCESS(*pErrorCode) && sourcetargetLimit) { -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } else { -// b=*source; -// toULimit=U8_COUNT_BYTES(b); -// if(toULimit>(sourceLimit-source)) { -// /* collect a truncated byte sequence */ -// toULength=0; -// c=b; -// for(;;) { -// utf8->toUBytes[toULength++]=b; -// if(++source==sourceLimit) { -// /* partial byte sequence at end of source */ -// utf8->toUnicodeStatus=c; -// utf8->toULength=toULength; -// utf8->mode=toULimit; -// break; -// } else if(!icu::UTF8::isValidTrail(c, b=*source, toULength, toULimit)) { -// utf8->toULength=toULength; -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// break; -// } -// c=(c<<6)+b; -// } -// } else { -// /* partial-sequence target overflow: fall back to the pivoting implementation */ -// *pErrorCode=U_USING_DEFAULT_WARNING; -// } -// } -// } - -// /* write back the updated pointers */ -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// } - -// U_CDECL_END - -// /* UTF-8 converter data ----------------------------------------------------- */ - -// static const UConverterImpl _UTF8Impl={ -// UCNV_UTF8, - -// NULL, -// NULL, - -// NULL, -// NULL, -// NULL, - -// ucnv_toUnicode_UTF8, -// ucnv_toUnicode_UTF8_OFFSETS_LOGIC, -// ucnv_fromUnicode_UTF8, -// ucnv_fromUnicode_UTF8_OFFSETS_LOGIC, -// ucnv_getNextUChar_UTF8, - -// NULL, -// NULL, -// NULL, -// NULL, -// ucnv_getNonSurrogateUnicodeSet, - -// ucnv_UTF8FromUTF8, -// ucnv_UTF8FromUTF8 -// }; - -// /* The 1208 CCSID refers to any version of Unicode of UTF-8 */ -// static const UConverterStaticData _UTF8StaticData={ -// sizeof(UConverterStaticData), -// "UTF-8", -// 1208, UCNV_IBM, UCNV_UTF8, -// 1, 3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */ -// { 0xef, 0xbf, 0xbd, 0 },3,FALSE,FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - - -// const UConverterSharedData _UTF8Data= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF8StaticData, &_UTF8Impl); - -// /* CESU-8 converter data ---------------------------------------------------- */ - -// static const UConverterImpl _CESU8Impl={ -// UCNV_CESU8, - -// NULL, -// NULL, - -// NULL, -// NULL, -// NULL, - -// ucnv_toUnicode_UTF8, -// ucnv_toUnicode_UTF8_OFFSETS_LOGIC, -// ucnv_fromUnicode_UTF8, -// ucnv_fromUnicode_UTF8_OFFSETS_LOGIC, -// NULL, - -// NULL, -// NULL, -// NULL, -// NULL, -// ucnv_getCompleteUnicodeSet, - -// NULL, -// NULL -// }; - -// static const UConverterStaticData _CESU8StaticData={ -// sizeof(UConverterStaticData), -// "CESU-8", -// 9400, /* CCSID for CESU-8 */ -// UCNV_UNKNOWN, UCNV_CESU8, 1, 3, -// { 0xef, 0xbf, 0xbd, 0 },3,FALSE,FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - - -// const UConverterSharedData _CESU8Data= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_CESU8StaticData, &_CESU8Impl); - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvbocu.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvbocu.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvdisp.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvdisp.cpp deleted file mode 100644 index 01e4e527a..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnvdisp.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ****************************************************************************** -// * -// * Copyright (C) 1998-2004, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ****************************************************************************** -// * -// * ucnvdisp.c: -// * Implements APIs for the ICU's codeset conversion library display names. -// * -// * Modification History: -// * -// * Date Name Description -// * 04/04/99 helena Fixed internal header inclusion. -// * 05/09/00 helena Added implementation to handle fallback mappings. -// * 06/20/2000 helena OS/400 port changes; mostly typecast. -// * 09/08/2004 grhoten split from ucnv.c -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ustring.h" -// #include "unicode/ures.h" -// #include "unicode/ucnv.h" -// #include "cstring.h" -// #include "ustr_imp.h" -// #include "ucnv_imp.h" -// #include "putilimp.h" - -// U_CAPI int32_t U_EXPORT2 -// ucnv_getDisplayName(const UConverter *cnv, -// const char *displayLocale, -// UChar *displayName, int32_t displayNameCapacity, -// UErrorCode *pErrorCode) { -// UResourceBundle *rb; -// const UChar *name; -// int32_t length; -// UErrorCode localStatus = U_ZERO_ERROR; - -// /* check arguments */ -// if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// if(cnv==NULL || displayNameCapacity<0 || (displayNameCapacity>0 && displayName==NULL)) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// /* open the resource bundle and get the display name string */ -// rb=ures_open(NULL, displayLocale, pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// return 0; -// } - -// /* use the internal name as the key */ -// name=ures_getStringByKey(rb, cnv->sharedData->staticData->name, &length, &localStatus); -// ures_close(rb); - -// if(U_SUCCESS(localStatus)) { -// /* copy the string */ -// if (*pErrorCode == U_ZERO_ERROR) { -// *pErrorCode = localStatus; -// } -// u_memcpy(displayName, name, uprv_min(length, displayNameCapacity)*U_SIZEOF_UCHAR); -// } else { -// /* convert the internal name into a Unicode string */ -// length=(int32_t)uprv_strlen(cnv->sharedData->staticData->name); -// u_charsToUChars(cnv->sharedData->staticData->name, displayName, uprv_min(length, displayNameCapacity)); -// } -// return u_terminateUChars(displayName, displayNameCapacity, length, pErrorCode); -// } - -// #endif - -// /* -// * Hey, Emacs, please set the following: -// * -// * Local Variables: -// * indent-tabs-mode: nil -// * End: -// * -// */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvhz.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvhz.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvisci.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvisci.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvlat1.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvlat1.cpp deleted file mode 100644 index d77d06b05..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnvlat1.cpp +++ /dev/null @@ -1,756 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2000-2015, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * file name: ucnvlat1.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2000feb07 -// * created by: Markus W. Scherer -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/uset.h" -// #include "unicode/utf8.h" -// #include "ucnv_bld.h" -// #include "ucnv_cnv.h" -// #include "ustr_imp.h" - -// /* control optimizations according to the platform */ -// #define LATIN1_UNROLL_FROM_UNICODE 1 - -// /* ISO 8859-1 --------------------------------------------------------------- */ - -// /* This is a table-less and callback-less version of ucnv_MBCSSingleToBMPWithOffsets(). */ -// U_CDECL_BEGIN -// static void U_CALLCONV -// _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// const uint8_t *source; -// UChar *target; -// int32_t targetCapacity, length; -// int32_t *offsets; - -// int32_t sourceIndex; - -// /* set up the local pointers */ -// source=(const uint8_t *)pArgs->source; -// target=pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// sourceIndex=0; - -// /* -// * since the conversion here is 1:1 UChar:uint8_t, we need only one counter -// * for the minimum of the sourceLength and targetCapacity -// */ -// length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source); -// if(length<=targetCapacity) { -// targetCapacity=length; -// } else { -// /* target will be full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// length=targetCapacity; -// } - -// if(targetCapacity>=8) { -// /* This loop is unrolled for speed and improved pipelining. */ -// int32_t count, loops; - -// loops=count=targetCapacity>>3; -// length=targetCapacity&=0x7; -// do { -// target[0]=source[0]; -// target[1]=source[1]; -// target[2]=source[2]; -// target[3]=source[3]; -// target[4]=source[4]; -// target[5]=source[5]; -// target[6]=source[6]; -// target[7]=source[7]; -// target+=8; -// source+=8; -// } while(--count>0); - -// if(offsets!=NULL) { -// do { -// offsets[0]=sourceIndex++; -// offsets[1]=sourceIndex++; -// offsets[2]=sourceIndex++; -// offsets[3]=sourceIndex++; -// offsets[4]=sourceIndex++; -// offsets[5]=sourceIndex++; -// offsets[6]=sourceIndex++; -// offsets[7]=sourceIndex++; -// offsets+=8; -// } while(--loops>0); -// } -// } - -// /* conversion loop */ -// while(targetCapacity>0) { -// *target++=*source++; -// --targetCapacity; -// } - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; - -// /* set offsets */ -// if(offsets!=NULL) { -// while(length>0) { -// *offsets++=sourceIndex++; -// --length; -// } -// pArgs->offsets=offsets; -// } -// } - -// /* This is a table-less and callback-less version of ucnv_MBCSSingleGetNextUChar(). */ -// static UChar32 U_CALLCONV -// _Latin1GetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// const uint8_t *source=(const uint8_t *)pArgs->source; -// if(source<(const uint8_t *)pArgs->sourceLimit) { -// pArgs->source=(const char *)(source+1); -// return *source; -// } - -// /* no output because of empty input */ -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// /* This is a table-less version of ucnv_MBCSSingleFromBMPWithOffsets(). */ -// static void U_CALLCONV -// _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const UChar *source, *sourceLimit; -// uint8_t *target, *oldTarget; -// int32_t targetCapacity, length; -// int32_t *offsets; - -// UChar32 cp; -// UChar c, max; - -// int32_t sourceIndex; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// source=pArgs->source; -// sourceLimit=pArgs->sourceLimit; -// target=oldTarget=(uint8_t *)pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// if(cnv->sharedData==&_Latin1Data) { -// max=0xff; /* Latin-1 */ -// } else { -// max=0x7f; /* US-ASCII */ -// } - -// /* get the converter state from UConverter */ -// cp=cnv->fromUChar32; - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex= cp==0 ? 0 : -1; - -// /* -// * since the conversion here is 1:1 UChar:uint8_t, we need only one counter -// * for the minimum of the sourceLength and targetCapacity -// */ -// length=(int32_t)(sourceLimit-source); -// if(length0) { -// goto getTrail; -// } - -// #if LATIN1_UNROLL_FROM_UNICODE -// /* unroll the loop with the most common case */ -// if(targetCapacity>=16) { -// int32_t count, loops; -// UChar u, oredChars; - -// loops=count=targetCapacity>>4; -// do { -// oredChars=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; -// oredChars|=u=*source++; -// *target++=(uint8_t)u; - -// /* were all 16 entries really valid? */ -// if(oredChars>max) { -// /* no, return to the first of these 16 */ -// source-=16; -// target-=16; -// break; -// } -// } while(--count>0); -// count=loops-count; -// targetCapacity-=16*count; - -// if(offsets!=NULL) { -// oldTarget+=16*count; -// while(count>0) { -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// --count; -// } -// } -// } -// #endif - -// /* conversion loop */ -// c=0; -// while(targetCapacity>0 && (c=*source++)<=max) { -// /* convert the Unicode code point */ -// *target++=(uint8_t)c; -// --targetCapacity; -// } - -// if(c>max) { -// cp=c; -// if(!U_IS_SURROGATE(cp)) { -// /* callback(unassigned) */ -// } else if(U_IS_SURROGATE_LEAD(cp)) { -// getTrail: -// if(sourcefromUChar32=cp; -// goto noMoreInput; -// } -// } else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// } - -// *pErrorCode= U_IS_SURROGATE(cp) ? U_ILLEGAL_CHAR_FOUND : U_INVALID_CHAR_FOUND; -// cnv->fromUChar32=cp; -// } -// noMoreInput: - -// /* set offsets since the start */ -// if(offsets!=NULL) { -// size_t count=target-oldTarget; -// while(count>0) { -// *offsets++=sourceIndex++; -// --count; -// } -// } - -// if(U_SUCCESS(*pErrorCode) && source=(uint8_t *)pArgs->targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// pArgs->offsets=offsets; -// } - -// /* Convert UTF-8 to Latin-1. Adapted from ucnv_SBCSFromUTF8(). */ -// static void U_CALLCONV -// ucnv_Latin1FromUTF8(UConverterFromUnicodeArgs *pFromUArgs, -// UConverterToUnicodeArgs *pToUArgs, -// UErrorCode *pErrorCode) { -// UConverter *utf8; -// const uint8_t *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; - -// UChar32 c; -// uint8_t b, t1; - -// /* set up the local pointers */ -// utf8=pToUArgs->converter; -// source=(uint8_t *)pToUArgs->source; -// sourceLimit=(uint8_t *)pToUArgs->sourceLimit; -// target=(uint8_t *)pFromUArgs->target; -// targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target); - -// /* get the converter state from the UTF-8 UConverter */ -// if (utf8->toULength > 0) { -// c=(UChar32)utf8->toUnicodeStatus; -// } else { -// c = 0; -// } -// if(c!=0 && source=0xc2 && c<=0xc3 && (t1=(uint8_t)(*source-0x80)) <= 0x3f) { -// ++source; -// *target++=(uint8_t)(((c&3)<<6)|t1); -// --targetCapacity; - -// utf8->toUnicodeStatus=0; -// utf8->toULength=0; -// } else { -// /* complicated, illegal or unmappable input: fall back to the pivoting implementation */ -// *pErrorCode=U_USING_DEFAULT_WARNING; -// return; -// } -// } - -// /* -// * Make sure that the last byte sequence before sourceLimit is complete -// * or runs into a lead byte. -// * In the conversion loop compare source with sourceLimit only once -// * per multi-byte character. -// * For Latin-1, adjust sourceLimit only for 1 trail byte because -// * the conversion loop handles at most 2-byte sequences. -// */ -// if(source0) { -// b=*source++; -// if(U8_IS_SINGLE(b)) { -// /* convert ASCII */ -// *target++=(uint8_t)b; -// --targetCapacity; -// } else if( /* handle U+0080..U+00FF inline */ -// b>=0xc2 && b<=0xc3 && -// (t1=(uint8_t)(*source-0x80)) <= 0x3f -// ) { -// ++source; -// *target++=(uint8_t)(((b&3)<<6)|t1); -// --targetCapacity; -// } else { -// /* complicated, illegal or unmappable input: fall back to the pivoting implementation */ -// pToUArgs->source=(char *)(source-1); -// pFromUArgs->target=(char *)target; -// *pErrorCode=U_USING_DEFAULT_WARNING; -// return; -// } -// } else { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } - -// /* -// * The sourceLimit may have been adjusted before the conversion loop -// * to stop before a truncated sequence. -// * If so, then collect the truncated sequence now. -// * For Latin-1, there is at most exactly one lead byte because of the -// * smaller sourceLimit adjustment logic. -// */ -// if(U_SUCCESS(*pErrorCode) && source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) { -// utf8->toUnicodeStatus=utf8->toUBytes[0]=b=*source++; -// utf8->toULength=1; -// utf8->mode=U8_COUNT_BYTES(b); -// } - -// /* write back the updated pointers */ -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// } - -// static void U_CALLCONV -// _Latin1GetUnicodeSet(const UConverter *cnv, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode) { -// (void)cnv; -// (void)which; -// (void)pErrorCode; -// sa->addRange(sa->set, 0, 0xff); -// } -// U_CDECL_END - - -// static const UConverterImpl _Latin1Impl={ -// UCNV_LATIN_1, - -// NULL, -// NULL, - -// NULL, -// NULL, -// NULL, - -// _Latin1ToUnicodeWithOffsets, -// _Latin1ToUnicodeWithOffsets, -// _Latin1FromUnicodeWithOffsets, -// _Latin1FromUnicodeWithOffsets, -// _Latin1GetNextUChar, - -// NULL, -// NULL, -// NULL, -// NULL, -// _Latin1GetUnicodeSet, - -// NULL, -// ucnv_Latin1FromUTF8 -// }; - -// static const UConverterStaticData _Latin1StaticData={ -// sizeof(UConverterStaticData), -// "ISO-8859-1", -// 819, UCNV_IBM, UCNV_LATIN_1, 1, 1, -// { 0x1a, 0, 0, 0 }, 1, FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// const UConverterSharedData _Latin1Data= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_Latin1StaticData, &_Latin1Impl); - -// /* US-ASCII ----------------------------------------------------------------- */ - -// U_CDECL_BEGIN -// /* This is a table-less version of ucnv_MBCSSingleToBMPWithOffsets(). */ -// static void U_CALLCONV -// _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// const uint8_t *source, *sourceLimit; -// UChar *target, *oldTarget; -// int32_t targetCapacity, length; -// int32_t *offsets; - -// int32_t sourceIndex; - -// uint8_t c; - -// /* set up the local pointers */ -// source=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; -// target=oldTarget=pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex=0; - -// /* -// * since the conversion here is 1:1 UChar:uint8_t, we need only one counter -// * for the minimum of the sourceLength and targetCapacity -// */ -// length=(int32_t)(sourceLimit-source); -// if(length=8) { -// /* This loop is unrolled for speed and improved pipelining. */ -// int32_t count, loops; -// UChar oredChars; - -// loops=count=targetCapacity>>3; -// do { -// oredChars=target[0]=source[0]; -// oredChars|=target[1]=source[1]; -// oredChars|=target[2]=source[2]; -// oredChars|=target[3]=source[3]; -// oredChars|=target[4]=source[4]; -// oredChars|=target[5]=source[5]; -// oredChars|=target[6]=source[6]; -// oredChars|=target[7]=source[7]; - -// /* were all 16 entries really valid? */ -// if(oredChars>0x7f) { -// /* no, return to the first of these 16 */ -// break; -// } -// source+=8; -// target+=8; -// } while(--count>0); -// count=loops-count; -// targetCapacity-=count*8; - -// if(offsets!=NULL) { -// oldTarget+=count*8; -// while(count>0) { -// offsets[0]=sourceIndex++; -// offsets[1]=sourceIndex++; -// offsets[2]=sourceIndex++; -// offsets[3]=sourceIndex++; -// offsets[4]=sourceIndex++; -// offsets[5]=sourceIndex++; -// offsets[6]=sourceIndex++; -// offsets[7]=sourceIndex++; -// offsets+=8; -// --count; -// } -// } -// } - -// /* conversion loop */ -// c=0; -// while(targetCapacity>0 && (c=*source++)<=0x7f) { -// *target++=c; -// --targetCapacity; -// } - -// if(c>0x7f) { -// /* callback(illegal); copy the current bytes to toUBytes[] */ -// UConverter *cnv=pArgs->converter; -// cnv->toUBytes[0]=c; -// cnv->toULength=1; -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } else if(source=pArgs->targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } - -// /* set offsets since the start */ -// if(offsets!=NULL) { -// size_t count=target-oldTarget; -// while(count>0) { -// *offsets++=sourceIndex++; -// --count; -// } -// } - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// } - -// /* This is a table-less version of ucnv_MBCSSingleGetNextUChar(). */ -// static UChar32 U_CALLCONV -// _ASCIIGetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// const uint8_t *source; -// uint8_t b; - -// source=(const uint8_t *)pArgs->source; -// if(source<(const uint8_t *)pArgs->sourceLimit) { -// b=*source++; -// pArgs->source=(const char *)source; -// if(b<=0x7f) { -// return b; -// } else { -// UConverter *cnv=pArgs->converter; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return 0xffff; -// } -// } - -// /* no output because of empty input */ -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// /* "Convert" UTF-8 to US-ASCII: Validate and copy. */ -// static void U_CALLCONV -// ucnv_ASCIIFromUTF8(UConverterFromUnicodeArgs *pFromUArgs, -// UConverterToUnicodeArgs *pToUArgs, -// UErrorCode *pErrorCode) { -// const uint8_t *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity, length; - -// uint8_t c; - -// if(pToUArgs->converter->toULength > 0) { -// /* no handling of partial UTF-8 characters here, fall back to pivoting */ -// *pErrorCode=U_USING_DEFAULT_WARNING; -// return; -// } - -// /* set up the local pointers */ -// source=(const uint8_t *)pToUArgs->source; -// sourceLimit=(const uint8_t *)pToUArgs->sourceLimit; -// target=(uint8_t *)pFromUArgs->target; -// targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target); - -// /* -// * since the conversion here is 1:1 uint8_t:uint8_t, we need only one counter -// * for the minimum of the sourceLength and targetCapacity -// */ -// length=(int32_t)(sourceLimit-source); -// if(length=16) { -// int32_t count, loops; -// uint8_t oredChars; - -// loops=count=targetCapacity>>4; -// do { -// oredChars=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; -// oredChars|=*target++=*source++; - -// /* were all 16 entries really valid? */ -// if(oredChars>0x7f) { -// /* no, return to the first of these 16 */ -// source-=16; -// target-=16; -// break; -// } -// } while(--count>0); -// count=loops-count; -// targetCapacity-=16*count; -// } - -// /* conversion loop */ -// c=0; -// while(targetCapacity>0 && (c=*source)<=0x7f) { -// ++source; -// *target++=c; -// --targetCapacity; -// } - -// if(c>0x7f) { -// /* non-ASCII character, handle in standard converter */ -// *pErrorCode=U_USING_DEFAULT_WARNING; -// } else if(source=(const uint8_t *)pFromUArgs->targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } - -// /* write back the updated pointers */ -// pToUArgs->source=(const char *)source; -// pFromUArgs->target=(char *)target; -// } - -// static void U_CALLCONV -// _ASCIIGetUnicodeSet(const UConverter *cnv, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode) { -// (void)cnv; -// (void)which; -// (void)pErrorCode; -// sa->addRange(sa->set, 0, 0x7f); -// } -// U_CDECL_END - -// static const UConverterImpl _ASCIIImpl={ -// UCNV_US_ASCII, - -// NULL, -// NULL, - -// NULL, -// NULL, -// NULL, - -// _ASCIIToUnicodeWithOffsets, -// _ASCIIToUnicodeWithOffsets, -// _Latin1FromUnicodeWithOffsets, -// _Latin1FromUnicodeWithOffsets, -// _ASCIIGetNextUChar, - -// NULL, -// NULL, -// NULL, -// NULL, -// _ASCIIGetUnicodeSet, - -// NULL, -// ucnv_ASCIIFromUTF8 -// }; - -// static const UConverterStaticData _ASCIIStaticData={ -// sizeof(UConverterStaticData), -// "US-ASCII", -// 367, UCNV_IBM, UCNV_US_ASCII, 1, 1, -// { 0x1a, 0, 0, 0 }, 1, FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// const UConverterSharedData _ASCIIData= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_ASCIIStaticData, &_ASCIIImpl); - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.cpp deleted file mode 100644 index 6009b3dfb..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.cpp +++ /dev/null @@ -1,5723 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ****************************************************************************** -// * -// * Copyright (C) 2000-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ****************************************************************************** -// * file name: ucnvmbcs.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2000jul03 -// * created by: Markus W. Scherer -// * -// * The current code in this file replaces the previous implementation -// * of conversion code from multi-byte codepages to Unicode and back. -// * This implementation supports the following: -// * - legacy variable-length codepages with up to 4 bytes per character -// * - all Unicode code points (up to 0x10ffff) -// * - efficient distinction of unassigned vs. illegal byte sequences -// * - it is possible in fromUnicode() to directly deal with simple -// * stateful encodings (used for EBCDIC_STATEFUL) -// * - it is possible to convert Unicode code points -// * to a single zero byte (but not as a fallback except for SBCS) -// * -// * Remaining limitations in fromUnicode: -// * - byte sequences must not have leading zero bytes -// * - except for SBCS codepages: no fallback mapping from Unicode to a zero byte -// * - limitation to up to 4 bytes per character -// * -// * ICU 2.8 (late 2003) adds a secondary data structure which lifts some of these -// * limitations and adds m:n character mappings and other features. -// * See ucnv_ext.h for details. -// * -// * Change history: -// * -// * 5/6/2001 Ram Moved MBCS_SINGLE_RESULT_FROM_U,MBCS_STAGE_2_FROM_U, -// * MBCS_VALUE_2_FROM_STAGE_2, MBCS_VALUE_4_FROM_STAGE_2 -// * macros to ucnvmbcs.h file -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/ucnv_cb.h" -// #include "unicode/udata.h" -// #include "unicode/uset.h" -// #include "unicode/utf8.h" -// #include "unicode/utf16.h" -// #include "ucnv_bld.h" -// #include "ucnvmbcs.h" -// #include "ucnv_ext.h" -// #include "ucnv_cnv.h" -// #include "cmemory.h" -// #include "cstring.h" -// #include "umutex.h" -// #include "ustr_imp.h" - -// /* control optimizations according to the platform */ -// #define MBCS_UNROLL_SINGLE_TO_BMP 1 -// #define MBCS_UNROLL_SINGLE_FROM_BMP 0 - -// /* -// * _MBCSHeader versions 5.3 & 4.3 -// * (Note that the _MBCSHeader version is in addition to the converter formatVersion.) -// * -// * This version is optional. Version 5 is used for incompatible data format changes. -// * makeconv will continue to generate version 4 files if possible. -// * -// * Changes from version 4: -// * -// * The main difference is an additional _MBCSHeader field with -// * - the length (number of uint32_t) of the _MBCSHeader -// * - flags for further incompatible data format changes -// * - flags for further, backward compatible data format changes -// * -// * The MBCS_OPT_FROM_U flag indicates that most of the fromUnicode data is omitted from -// * the file and needs to be reconstituted at load time. -// * This requires a utf8Friendly format with an additional mbcsIndex table for fast -// * (and UTF-8-friendly) fromUnicode conversion for Unicode code points up to maxFastUChar. -// * (For details about these structures see below, and see ucnvmbcs.h.) -// * -// * utf8Friendly also implies that the fromUnicode mappings are stored in ascending order -// * of the Unicode code points. (This requires that the .ucm file has the |0 etc. -// * precision markers for all mappings.) -// * -// * All fallbacks have been moved to the extension table, leaving only roundtrips in the -// * omitted data that can be reconstituted from the toUnicode data. -// * -// * Of the stage 2 table, the part corresponding to maxFastUChar and below is omitted. -// * With only roundtrip mappings in the base fromUnicode data, this part is fully -// * redundant with the mbcsIndex and will be reconstituted from that (also using the -// * stage 1 table which contains the information about how stage 2 was compacted). -// * -// * The rest of the stage 2 table, the part for code points above maxFastUChar, -// * is stored in the file and will be appended to the reconstituted part. -// * -// * The entire fromUBytes array is omitted from the file and will be reconstitued. -// * This is done by enumerating all toUnicode roundtrip mappings, performing -// * each mapping (using the stage 1 and reconstituted stage 2 tables) and -// * writing instead of reading the byte values. -// * -// * _MBCSHeader version 4.3 -// * -// * Change from version 4.2: -// * - Optional utf8Friendly data structures, with 64-entry stage 3 block -// * allocation for parts of the BMP, and an additional mbcsIndex in non-SBCS -// * files which can be used instead of stages 1 & 2. -// * Faster lookups for roundtrips from most commonly used characters, -// * and lookups from UTF-8 byte sequences with a natural bit distribution. -// * See ucnvmbcs.h for more details. -// * -// * Change from version 4.1: -// * - Added an optional extension table structure at the end of the .cnv file. -// * It is present if the upper bits of the header flags field contains a non-zero -// * byte offset to it. -// * Files that contain only a conversion table and no base table -// * use the special outputType MBCS_OUTPUT_EXT_ONLY. -// * These contain the base table name between the MBCS header and the extension -// * data. -// * -// * Change from version 4.0: -// * - Replace header.reserved with header.fromUBytesLength so that all -// * fields in the data have length. -// * -// * Changes from version 3 (for performance improvements): -// * - new bit distribution for state table entries -// * - reordered action codes -// * - new data structure for single-byte fromUnicode -// * + stage 2 only contains indexes -// * + stage 3 stores 16 bits per character with classification bits 15..8 -// * - no multiplier for stage 1 entries -// * - stage 2 for non-single-byte codepages contains the index and the flags in -// * one 32-bit value -// * - 2-byte and 4-byte fromUnicode results are stored directly as 16/32-bit integers -// * -// * For more details about old versions of the MBCS data structure, see -// * the corresponding versions of this file. -// * -// * Converting stateless codepage data ---------------------------------------*** -// * (or codepage data with simple states) to Unicode. -// * -// * Data structure and algorithm for converting from complex legacy codepages -// * to Unicode. (Designed before 2000-may-22.) -// * -// * The basic idea is that the structure of legacy codepages can be described -// * with state tables. -// * When reading a byte stream, each input byte causes a state transition. -// * Some transitions result in the output of a code point, some result in -// * "unassigned" or "illegal" output. -// * This is used here for character conversion. -// * -// * The data structure begins with a state table consisting of a row -// * per state, with 256 entries (columns) per row for each possible input -// * byte value. -// * Each entry is 32 bits wide, with two formats distinguished by -// * the sign bit (bit 31): -// * -// * One format for transitional entries (bit 31 not set) for non-final bytes, and -// * one format for final entries (bit 31 set). -// * Both formats contain the number of the next state in the same bit -// * positions. -// * State 0 is the initial state. -// * -// * Most of the time, the offset values of subsequent states are added -// * up to a scalar value. This value will eventually be the index of -// * the Unicode code point in a table that follows the state table. -// * The effect is that the code points for final state table rows -// * are contiguous. The code points of final state rows follow each other -// * in the order of the references to those final states by previous -// * states, etc. -// * -// * For some terminal states, the offset is itself the output Unicode -// * code point (16 bits for a BMP code point or 20 bits for a supplementary -// * code point (stored as code point minus 0x10000 so that 20 bits are enough). -// * For others, the code point in the Unicode table is stored with either -// * one or two code units: one for BMP code points, two for a pair of -// * surrogates. -// * All code points for a final state entry take up the same number of code -// * units, regardless of whether they all actually _use_ the same number -// * of code units. This is necessary for simple array access. -// * -// * An additional feature comes in with what in ICU is called "fallback" -// * mappings: -// * -// * In addition to round-trippable, precise, 1:1 mappings, there are often -// * mappings defined between similar, though not the same, characters. -// * Typically, such mappings occur only in fromUnicode mapping tables because -// * Unicode has a superset repertoire of most other codepages. However, it -// * is possible to provide such mappings in the toUnicode tables, too. -// * In this case, the fallback mappings are partly integrated into the -// * general state tables because the structure of the encoding includes their -// * byte sequences. -// * For final entries in an initial state, fallback mappings are stored in -// * the entry itself like with roundtrip mappings. -// * For other final entries, they are stored in the code units table if -// * the entry is for a pair of code units. -// * For single-unit results in the code units table, there is no space to -// * alternatively hold a fallback mapping; in this case, the code unit -// * is stored as U+fffe (unassigned), and the fallback mapping needs to -// * be looked up by the scalar offset value in a separate table. -// * -// * "Unassigned" state entries really mean "structurally unassigned", -// * i.e., such a byte sequence will never have a mapping result. -// * -// * The interpretation of the bits in each entry is as follows: -// * -// * Bit 31 not set, not a terminal entry ("transitional"): -// * 30..24 next state -// * 23..0 offset delta, to be added up -// * -// * Bit 31 set, terminal ("final") entry: -// * 30..24 next state (regardless of action code) -// * 23..20 action code: -// * action codes 0 and 1 result in precise-mapping Unicode code points -// * 0 valid byte sequence -// * 19..16 not used, 0 -// * 15..0 16-bit Unicode BMP code point -// * never U+fffe or U+ffff -// * 1 valid byte sequence -// * 19..0 20-bit Unicode supplementary code point -// * never U+fffe or U+ffff -// * -// * action codes 2 and 3 result in fallback (unidirectional-mapping) Unicode code points -// * 2 valid byte sequence (fallback) -// * 19..16 not used, 0 -// * 15..0 16-bit Unicode BMP code point as fallback result -// * 3 valid byte sequence (fallback) -// * 19..0 20-bit Unicode supplementary code point as fallback result -// * -// * action codes 4 and 5 may result in roundtrip/fallback/unassigned/illegal results -// * depending on the code units they result in -// * 4 valid byte sequence -// * 19..9 not used, 0 -// * 8..0 final offset delta -// * pointing to one 16-bit code unit which may be -// * fffe unassigned -- look for a fallback for this offset -// * ffff illegal -// * 5 valid byte sequence -// * 19..9 not used, 0 -// * 8..0 final offset delta -// * pointing to two 16-bit code units -// * (typically UTF-16 surrogates) -// * the result depends on the first code unit as follows: -// * 0000..d7ff roundtrip BMP code point (1st alone) -// * d800..dbff roundtrip surrogate pair (1st, 2nd) -// * dc00..dfff fallback surrogate pair (1st-400, 2nd) -// * e000 roundtrip BMP code point (2nd alone) -// * e001 fallback BMP code point (2nd alone) -// * fffe unassigned -// * ffff illegal -// * (the final offset deltas are at most 255 * 2, -// * times 2 because of storing code unit pairs) -// * -// * 6 unassigned byte sequence -// * 19..16 not used, 0 -// * 15..0 16-bit Unicode BMP code point U+fffe (new with version 2) -// * this does not contain a final offset delta because the main -// * purpose of this action code is to save scalar offset values; -// * therefore, fallback values cannot be assigned to byte -// * sequences that result in this action code -// * 7 illegal byte sequence -// * 19..16 not used, 0 -// * 15..0 16-bit Unicode BMP code point U+ffff (new with version 2) -// * 8 state change only -// * 19..0 not used, 0 -// * useful for state changes in simple stateful encodings, -// * at Shift-In/Shift-Out codes -// * -// * -// * 9..15 reserved for future use -// * current implementations will only perform a state change -// * and ignore bits 19..0 -// * -// * An encoding with contiguous ranges of unassigned byte sequences, like -// * Shift-JIS and especially EUC-TW, can be stored efficiently by having -// * at least two states for the trail bytes: -// * One trail byte state that results in code points, and one that only -// * has "unassigned" and "illegal" terminal states. -// * -// * Note: partly by accident, this data structure supports simple stateful -// * encodings without any additional logic. -// * Currently, only simple Shift-In/Shift-Out schemes are handled with -// * appropriate state tables (especially EBCDIC_STATEFUL!). -// * -// * MBCS version 2 added: -// * unassigned and illegal action codes have U+fffe and U+ffff -// * instead of unused bits; this is useful for _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP() -// * -// * Converting from Unicode to codepage bytes --------------------------------*** -// * -// * The conversion data structure for fromUnicode is designed for the known -// * structure of Unicode. It maps from 21-bit code points (0..0x10ffff) to -// * a sequence of 1..4 bytes, in addition to a flag that indicates if there is -// * a roundtrip mapping. -// * -// * The lookup is done with a 3-stage trie, using 11/6/4 bits for stage 1/2/3 -// * like in the character properties table. -// * The beginning of the trie is at offsetFromUTable, the beginning of stage 3 -// * with the resulting bytes is at offsetFromUBytes. -// * -// * Beginning with version 4, single-byte codepages have a significantly different -// * trie compared to other codepages. -// * In all cases, the entry in stage 1 is directly the index of the block of -// * 64 entries in stage 2. -// * -// * Single-byte lookup: -// * -// * Stage 2 only contains 16-bit indexes directly to the 16-blocks in stage 3. -// * Stage 3 contains one 16-bit word per result: -// * Bits 15..8 indicate the kind of result: -// * f roundtrip result -// * c fallback result from private-use code point -// * 8 fallback result from other code points -// * 0 unassigned -// * Bits 7..0 contain the codepage byte. A zero byte is always possible. -// * -// * In version 4.3, the runtime code can build an sbcsIndex for a utf8Friendly -// * file. For 2-byte UTF-8 byte sequences and some 3-byte sequences the lookup -// * becomes a 2-stage (single-index) trie lookup with 6 bits for stage 3. -// * ASCII code points can be looked up with a linear array access into stage 3. -// * See maxFastUChar and other details in ucnvmbcs.h. -// * -// * Multi-byte lookup: -// * -// * Stage 2 contains a 32-bit word for each 16-block in stage 3: -// * Bits 31..16 contain flags for which stage 3 entries contain roundtrip results -// * test: MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c) -// * If this test is false, then a non-zero result will be interpreted as -// * a fallback mapping. -// * Bits 15..0 contain the index to stage 3, which must be multiplied by 16*(bytes per char) -// * -// * Stage 3 contains 2, 3, or 4 bytes per result. -// * 2 or 4 bytes are stored as uint16_t/uint32_t in platform endianness, -// * while 3 bytes are stored as bytes in big-endian order. -// * Leading zero bytes are ignored, and the number of bytes is counted. -// * A zero byte mapping result is possible as a roundtrip result. -// * For some output types, the actual result is processed from this; -// * see ucnv_MBCSFromUnicodeWithOffsets(). -// * -// * Note that stage 1 always contains 0x440=1088 entries (0x440==0x110000>>10), -// * or (version 3 and up) for BMP-only codepages, it contains 64 entries. -// * -// * In version 4.3, a utf8Friendly file contains an mbcsIndex table. -// * For 2-byte UTF-8 byte sequences and most 3-byte sequences the lookup -// * becomes a 2-stage (single-index) trie lookup with 6 bits for stage 3. -// * ASCII code points can be looked up with a linear array access into stage 3. -// * See maxFastUChar, mbcsIndex and other details in ucnvmbcs.h. -// * -// * In version 3, stage 2 blocks may overlap by multiples of the multiplier -// * for compaction. -// * In version 4, stage 2 blocks (and for single-byte codepages, stage 3 blocks) -// * may overlap by any number of entries. -// * -// * MBCS version 2 added: -// * the converter checks for known output types, which allows -// * adding new ones without crashing an unaware converter -// */ - -// /** -// * Callback from ucnv_MBCSEnumToUnicode(), takes 32 mappings from -// * consecutive sequences of bytes, starting from the one encoded in value, -// * to Unicode code points. (Multiple mappings to reduce per-function call overhead.) -// * Does not currently support m:n mappings or reverse fallbacks. -// * This function will not be called for sequences of bytes with leading zeros. -// * -// * @param context an opaque pointer, as passed into ucnv_MBCSEnumToUnicode() -// * @param value contains 1..4 bytes of the first byte sequence, right-aligned -// * @param codePoints resulting Unicode code points, or negative if a byte sequence does -// * not map to anything -// * @return TRUE to continue enumeration, FALSE to stop -// */ -// typedef UBool U_CALLCONV -// UConverterEnumToUCallback(const void *context, uint32_t value, UChar32 codePoints[32]); - -// static void U_CALLCONV -// ucnv_MBCSLoad(UConverterSharedData *sharedData, -// UConverterLoadArgs *pArgs, -// const uint8_t *raw, -// UErrorCode *pErrorCode); - -// static void U_CALLCONV -// ucnv_MBCSUnload(UConverterSharedData *sharedData); - -// static void U_CALLCONV -// ucnv_MBCSOpen(UConverter *cnv, -// UConverterLoadArgs *pArgs, -// UErrorCode *pErrorCode); - -// static UChar32 U_CALLCONV -// ucnv_MBCSGetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode); - -// static void U_CALLCONV -// ucnv_MBCSGetStarters(const UConverter* cnv, -// UBool starters[256], -// UErrorCode *pErrorCode); - -// U_CDECL_BEGIN -// static const char* U_CALLCONV -// ucnv_MBCSGetName(const UConverter *cnv); -// U_CDECL_END - -// static void U_CALLCONV -// ucnv_MBCSWriteSub(UConverterFromUnicodeArgs *pArgs, -// int32_t offsetIndex, -// UErrorCode *pErrorCode); - -// static UChar32 U_CALLCONV -// ucnv_MBCSGetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode); - -// static void U_CALLCONV -// ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs, -// UConverterToUnicodeArgs *pToUArgs, -// UErrorCode *pErrorCode); - -// static void U_CALLCONV -// ucnv_MBCSGetUnicodeSet(const UConverter *cnv, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode); - -// static void U_CALLCONV -// ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs, -// UConverterToUnicodeArgs *pToUArgs, -// UErrorCode *pErrorCode); - -// static const UConverterImpl _SBCSUTF8Impl={ -// UCNV_MBCS, - -// ucnv_MBCSLoad, -// ucnv_MBCSUnload, - -// ucnv_MBCSOpen, -// NULL, -// NULL, - -// ucnv_MBCSToUnicodeWithOffsets, -// ucnv_MBCSToUnicodeWithOffsets, -// ucnv_MBCSFromUnicodeWithOffsets, -// ucnv_MBCSFromUnicodeWithOffsets, -// ucnv_MBCSGetNextUChar, - -// ucnv_MBCSGetStarters, -// ucnv_MBCSGetName, -// ucnv_MBCSWriteSub, -// NULL, -// ucnv_MBCSGetUnicodeSet, - -// NULL, -// ucnv_SBCSFromUTF8 -// }; - -// static const UConverterImpl _DBCSUTF8Impl={ -// UCNV_MBCS, - -// ucnv_MBCSLoad, -// ucnv_MBCSUnload, - -// ucnv_MBCSOpen, -// NULL, -// NULL, - -// ucnv_MBCSToUnicodeWithOffsets, -// ucnv_MBCSToUnicodeWithOffsets, -// ucnv_MBCSFromUnicodeWithOffsets, -// ucnv_MBCSFromUnicodeWithOffsets, -// ucnv_MBCSGetNextUChar, - -// ucnv_MBCSGetStarters, -// ucnv_MBCSGetName, -// ucnv_MBCSWriteSub, -// NULL, -// ucnv_MBCSGetUnicodeSet, - -// NULL, -// ucnv_DBCSFromUTF8 -// }; - -// static const UConverterImpl _MBCSImpl={ -// UCNV_MBCS, - -// ucnv_MBCSLoad, -// ucnv_MBCSUnload, - -// ucnv_MBCSOpen, -// NULL, -// NULL, - -// ucnv_MBCSToUnicodeWithOffsets, -// ucnv_MBCSToUnicodeWithOffsets, -// ucnv_MBCSFromUnicodeWithOffsets, -// ucnv_MBCSFromUnicodeWithOffsets, -// ucnv_MBCSGetNextUChar, - -// ucnv_MBCSGetStarters, -// ucnv_MBCSGetName, -// ucnv_MBCSWriteSub, -// NULL, -// ucnv_MBCSGetUnicodeSet, -// NULL, -// NULL -// }; - -// /* Static data is in tools/makeconv/ucnvstat.c for data-based -// * converters. Be sure to update it as well. -// */ - -// const UConverterSharedData _MBCSData={ -// sizeof(UConverterSharedData), 1, -// NULL, NULL, FALSE, TRUE, &_MBCSImpl, -// 0, UCNV_MBCS_TABLE_INITIALIZER -// }; - - -// /* GB 18030 data ------------------------------------------------------------ */ - -// /* helper macros for linear values for GB 18030 four-byte sequences */ -// #define LINEAR_18030(a, b, c, d) ((((a)*10+(b))*126L+(c))*10L+(d)) - -// #define LINEAR_18030_BASE LINEAR_18030(0x81, 0x30, 0x81, 0x30) - -// #define LINEAR(x) LINEAR_18030(x>>24, (x>>16)&0xff, (x>>8)&0xff, x&0xff) - -// /* -// * Some ranges of GB 18030 where both the Unicode code points and the -// * GB four-byte sequences are contiguous and are handled algorithmically by -// * the special callback functions below. -// * The values are start & end of Unicode & GB codes. -// * -// * Note that single surrogates are not mapped by GB 18030 -// * as of the re-released mapping tables from 2000-nov-30. -// */ -// static const uint32_t -// gb18030Ranges[14][4]={ -// {0x10000, 0x10FFFF, LINEAR(0x90308130), LINEAR(0xE3329A35)}, -// {0x9FA6, 0xD7FF, LINEAR(0x82358F33), LINEAR(0x8336C738)}, -// {0x0452, 0x1E3E, LINEAR(0x8130D330), LINEAR(0x8135F436)}, -// {0x1E40, 0x200F, LINEAR(0x8135F438), LINEAR(0x8136A531)}, -// {0xE865, 0xF92B, LINEAR(0x8336D030), LINEAR(0x84308534)}, -// {0x2643, 0x2E80, LINEAR(0x8137A839), LINEAR(0x8138FD38)}, -// {0xFA2A, 0xFE2F, LINEAR(0x84309C38), LINEAR(0x84318537)}, -// {0x3CE1, 0x4055, LINEAR(0x8231D438), LINEAR(0x8232AF32)}, -// {0x361B, 0x3917, LINEAR(0x8230A633), LINEAR(0x8230F237)}, -// {0x49B8, 0x4C76, LINEAR(0x8234A131), LINEAR(0x8234E733)}, -// {0x4160, 0x4336, LINEAR(0x8232C937), LINEAR(0x8232F837)}, -// {0x478E, 0x4946, LINEAR(0x8233E838), LINEAR(0x82349638)}, -// {0x44D7, 0x464B, LINEAR(0x8233A339), LINEAR(0x8233C931)}, -// {0xFFE6, 0xFFFF, LINEAR(0x8431A234), LINEAR(0x8431A439)} -// }; - -// /* bit flag for UConverter.options indicating GB 18030 special handling */ -// #define _MBCS_OPTION_GB18030 0x8000 - -// /* bit flag for UConverter.options indicating KEIS,JEF,JIF special handling */ -// #define _MBCS_OPTION_KEIS 0x01000 -// #define _MBCS_OPTION_JEF 0x02000 -// #define _MBCS_OPTION_JIPS 0x04000 - -// #define KEIS_SO_CHAR_1 0x0A -// #define KEIS_SO_CHAR_2 0x42 -// #define KEIS_SI_CHAR_1 0x0A -// #define KEIS_SI_CHAR_2 0x41 - -// #define JEF_SO_CHAR 0x28 -// #define JEF_SI_CHAR 0x29 - -// #define JIPS_SO_CHAR_1 0x1A -// #define JIPS_SO_CHAR_2 0x70 -// #define JIPS_SI_CHAR_1 0x1A -// #define JIPS_SI_CHAR_2 0x71 - -// enum SISO_Option { -// SI, -// SO -// }; -// typedef enum SISO_Option SISO_Option; - -// static int32_t getSISOBytes(SISO_Option option, uint32_t cnvOption, uint8_t *value) { -// int32_t SISOLength = 0; - -// switch (option) { -// case SI: -// if ((cnvOption&_MBCS_OPTION_KEIS)!=0) { -// value[0] = KEIS_SI_CHAR_1; -// value[1] = KEIS_SI_CHAR_2; -// SISOLength = 2; -// } else if ((cnvOption&_MBCS_OPTION_JEF)!=0) { -// value[0] = JEF_SI_CHAR; -// SISOLength = 1; -// } else if ((cnvOption&_MBCS_OPTION_JIPS)!=0) { -// value[0] = JIPS_SI_CHAR_1; -// value[1] = JIPS_SI_CHAR_2; -// SISOLength = 2; -// } else { -// value[0] = UCNV_SI; -// SISOLength = 1; -// } -// break; -// case SO: -// if ((cnvOption&_MBCS_OPTION_KEIS)!=0) { -// value[0] = KEIS_SO_CHAR_1; -// value[1] = KEIS_SO_CHAR_2; -// SISOLength = 2; -// } else if ((cnvOption&_MBCS_OPTION_JEF)!=0) { -// value[0] = JEF_SO_CHAR; -// SISOLength = 1; -// } else if ((cnvOption&_MBCS_OPTION_JIPS)!=0) { -// value[0] = JIPS_SO_CHAR_1; -// value[1] = JIPS_SO_CHAR_2; -// SISOLength = 2; -// } else { -// value[0] = UCNV_SO; -// SISOLength = 1; -// } -// break; -// default: -// /* Should never happen. */ -// break; -// } - -// return SISOLength; -// } - -// /* Miscellaneous ------------------------------------------------------------ */ - -// /* similar to ucnv_MBCSGetNextUChar() but recursive */ -// static UBool -// enumToU(UConverterMBCSTable *mbcsTable, int8_t stateProps[], -// int32_t state, uint32_t offset, -// uint32_t value, -// UConverterEnumToUCallback *callback, const void *context, -// UErrorCode *pErrorCode) { -// UChar32 codePoints[32]; -// const int32_t *row; -// const uint16_t *unicodeCodeUnits; -// UChar32 anyCodePoints; -// int32_t b, limit; - -// row=mbcsTable->stateTable[state]; -// unicodeCodeUnits=mbcsTable->unicodeCodeUnits; - -// value<<=8; -// anyCodePoints=-1; /* becomes non-negative if there is a mapping */ - -// b=(stateProps[state]&0x38)<<2; -// if(b==0 && stateProps[state]>=0x40) { -// /* skip byte sequences with leading zeros because they are not stored in the fromUnicode table */ -// codePoints[0]=U_SENTINEL; -// b=1; -// } -// limit=((stateProps[state]&7)+1)<<5; -// while(b=0) { -// /* recurse to a state with non-ignorable actions */ -// if(!enumToU( -// mbcsTable, stateProps, nextState, -// offset+MBCS_ENTRY_TRANSITION_OFFSET(entry), -// value|(uint32_t)b, -// callback, context, -// pErrorCode)) { -// return FALSE; -// } -// } -// codePoints[b&0x1f]=U_SENTINEL; -// } else { -// UChar32 c; -// int32_t action; - -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=MBCS_ENTRY_FINAL_ACTION(entry); -// if(action==MBCS_STATE_VALID_DIRECT_16) { -// /* output BMP code point */ -// c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// } else if(action==MBCS_STATE_VALID_16) { -// int32_t finalOffset=offset+MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[finalOffset]; -// if(c<0xfffe) { -// /* output BMP code point */ -// } else { -// c=U_SENTINEL; -// } -// } else if(action==MBCS_STATE_VALID_16_PAIR) { -// int32_t finalOffset=offset+MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[finalOffset++]; -// if(c<0xd800) { -// /* output BMP code point below 0xd800 */ -// } else if(c<=0xdbff) { -// /* output roundtrip or fallback supplementary code point */ -// c=((c&0x3ff)<<10)+unicodeCodeUnits[finalOffset]+(0x10000-0xdc00); -// } else if(c==0xe000) { -// /* output roundtrip BMP code point above 0xd800 or fallback BMP code point */ -// c=unicodeCodeUnits[finalOffset]; -// } else { -// c=U_SENTINEL; -// } -// } else if(action==MBCS_STATE_VALID_DIRECT_20) { -// /* output supplementary code point */ -// c=(UChar32)(MBCS_ENTRY_FINAL_VALUE(entry)+0x10000); -// } else { -// c=U_SENTINEL; -// } - -// codePoints[b&0x1f]=c; -// anyCodePoints&=c; -// } -// if(((++b)&0x1f)==0) { -// if(anyCodePoints>=0) { -// if(!callback(context, value|(uint32_t)(b-0x20), codePoints)) { -// return FALSE; -// } -// anyCodePoints=-1; -// } -// } -// } -// return TRUE; -// } - -// /* -// * Only called if stateProps[state]==-1. -// * A recursive call may do stateProps[state]|=0x40 if this state is the target of an -// * MBCS_STATE_CHANGE_ONLY. -// */ -// static int8_t -// getStateProp(const int32_t (*stateTable)[256], int8_t stateProps[], int state) { -// const int32_t *row; -// int32_t min, max, entry, nextState; - -// row=stateTable[state]; -// stateProps[state]=0; - -// /* find first non-ignorable state */ -// for(min=0;; ++min) { -// entry=row[min]; -// nextState=MBCS_ENTRY_STATE(entry); -// if(stateProps[nextState]==-1) { -// getStateProp(stateTable, stateProps, nextState); -// } -// if(MBCS_ENTRY_IS_TRANSITION(entry)) { -// if(stateProps[nextState]>=0) { -// break; -// } -// } else if(MBCS_ENTRY_FINAL_ACTION(entry)>5)<<3); - -// /* find last non-ignorable state */ -// for(max=0xff; min=0) { -// break; -// } -// } else if(MBCS_ENTRY_FINAL_ACTION(entry)>5); - -// /* recurse further and collect direct-state information */ -// while(min<=max) { -// entry=row[min]; -// nextState=MBCS_ENTRY_STATE(entry); -// if(stateProps[nextState]==-1) { -// getStateProp(stateTable, stateProps, nextState); -// } -// if(MBCS_ENTRY_IS_FINAL(entry)) { -// stateProps[nextState]|=0x40; -// if(MBCS_ENTRY_FINAL_ACTION(entry)<=MBCS_STATE_FALLBACK_DIRECT_20) { -// stateProps[state]|=0x40; -// } -// } -// ++min; -// } -// return stateProps[state]; -// } - -// /* -// * Internal function enumerating the toUnicode data of an MBCS converter. -// * Currently only used for reconstituting data for a MBCS_OPT_NO_FROM_U -// * table, but could also be used for a future ucnv_getUnicodeSet() option -// * that includes reverse fallbacks (after updating this function's implementation). -// * Currently only handles roundtrip mappings. -// * Does not currently handle extensions. -// */ -// static void -// ucnv_MBCSEnumToUnicode(UConverterMBCSTable *mbcsTable, -// UConverterEnumToUCallback *callback, const void *context, -// UErrorCode *pErrorCode) { -// /* -// * Properties for each state, to speed up the enumeration. -// * Ignorable actions are unassigned/illegal/state-change-only: -// * They do not lead to mappings. -// * -// * Bits 7..6: -// * 1 direct/initial state (stateful converters have multiple) -// * 0 non-initial state with transitions or with non-ignorable result actions -// * -1 final state with only ignorable actions -// * -// * Bits 5..3: -// * The lowest byte value with non-ignorable actions is -// * value<<5 (rounded down). -// * -// * Bits 2..0: -// * The highest byte value with non-ignorable actions is -// * (value<<5)&0x1f (rounded up). -// */ -// int8_t stateProps[MBCS_MAX_STATE_COUNT]; -// int32_t state; - -// uprv_memset(stateProps, -1, sizeof(stateProps)); - -// /* recurse from state 0 and set all stateProps */ -// getStateProp(mbcsTable->stateTable, stateProps, 0); - -// for(state=0; statecountStates; ++state) { -// /*if(stateProps[state]==-1) { -// printf("unused/unreachable %d\n", state); -// }*/ -// if(stateProps[state]>=0x40) { -// /* start from each direct state */ -// enumToU( -// mbcsTable, stateProps, state, 0, 0, -// callback, context, -// pErrorCode); -// } -// } -// } - -// U_CFUNC void -// ucnv_MBCSGetFilteredUnicodeSetForUnicode(const UConverterSharedData *sharedData, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UConverterSetFilter filter, -// UErrorCode *pErrorCode) { -// const UConverterMBCSTable *mbcsTable; -// const uint16_t *table; - -// uint32_t st3; -// uint16_t st1, maxStage1, st2; - -// UChar32 c; - -// /* enumerate the from-Unicode trie table */ -// mbcsTable=&sharedData->mbcs; -// table=mbcsTable->fromUnicodeTable; -// if(mbcsTable->unicodeMask&UCNV_HAS_SUPPLEMENTARY) { -// maxStage1=0x440; -// } else { -// maxStage1=0x40; -// } - -// c=0; /* keep track of the current code point while enumerating */ - -// if(mbcsTable->outputType==MBCS_OUTPUT_1) { -// const uint16_t *stage2, *stage3, *results; -// uint16_t minValue; - -// results=(const uint16_t *)mbcsTable->fromUnicodeBytes; - -// /* -// * Set a threshold variable for selecting which mappings to use. -// * See ucnv_MBCSSingleFromBMPWithOffsets() and -// * MBCS_SINGLE_RESULT_FROM_U() for details. -// */ -// if(which==UCNV_ROUNDTRIP_SET) { -// /* use only roundtrips */ -// minValue=0xf00; -// } else /* UCNV_ROUNDTRIP_AND_FALLBACK_SET */ { -// /* use all roundtrip and fallback results */ -// minValue=0x800; -// } - -// for(st1=0; st1maxStage1) { -// stage2=table+st2; -// for(st2=0; st2<64; ++st2) { -// if((st3=stage2[st2])!=0) { -// /* read the stage 3 block */ -// stage3=results+st3; - -// do { -// if(*stage3++>=minValue) { -// sa->add(sa->set, c); -// } -// } while((++c&0xf)!=0); -// } else { -// c+=16; /* empty stage 3 block */ -// } -// } -// } else { -// c+=1024; /* empty stage 2 block */ -// } -// } -// } else { -// const uint32_t *stage2; -// const uint8_t *stage3, *bytes; -// uint32_t st3Multiplier; -// uint32_t value; -// UBool useFallback; - -// bytes=mbcsTable->fromUnicodeBytes; - -// useFallback=(UBool)(which==UCNV_ROUNDTRIP_AND_FALLBACK_SET); - -// switch(mbcsTable->outputType) { -// case MBCS_OUTPUT_3: -// case MBCS_OUTPUT_4_EUC: -// st3Multiplier=3; -// break; -// case MBCS_OUTPUT_4: -// st3Multiplier=4; -// break; -// default: -// st3Multiplier=2; -// break; -// } - -// for(st1=0; st1(maxStage1>>1)) { -// stage2=(const uint32_t *)table+st2; -// for(st2=0; st2<64; ++st2) { -// if((st3=stage2[st2])!=0) { -// /* read the stage 3 block */ -// stage3=bytes+st3Multiplier*16*(uint32_t)(uint16_t)st3; - -// /* get the roundtrip flags for the stage 3 block */ -// st3>>=16; - -// /* -// * Add code points for which the roundtrip flag is set, -// * or which map to non-zero bytes if we use fallbacks. -// * See ucnv_MBCSFromUnicodeWithOffsets() for details. -// */ -// switch(filter) { -// case UCNV_SET_FILTER_NONE: -// do { -// if(st3&1) { -// sa->add(sa->set, c); -// stage3+=st3Multiplier; -// } else if(useFallback) { -// uint8_t b=0; -// switch(st3Multiplier) { -// case 4: -// b|=*stage3++; -// U_FALLTHROUGH; -// case 3: -// b|=*stage3++; -// U_FALLTHROUGH; -// case 2: -// b|=stage3[0]|stage3[1]; -// stage3+=2; -// U_FALLTHROUGH; -// default: -// break; -// } -// if(b!=0) { -// sa->add(sa->set, c); -// } -// } -// st3>>=1; -// } while((++c&0xf)!=0); -// break; -// case UCNV_SET_FILTER_DBCS_ONLY: -// /* Ignore single-byte results (<0x100). */ -// do { -// if(((st3&1)!=0 || useFallback) && *((const uint16_t *)stage3)>=0x100) { -// sa->add(sa->set, c); -// } -// st3>>=1; -// stage3+=2; /* +=st3Multiplier */ -// } while((++c&0xf)!=0); -// break; -// case UCNV_SET_FILTER_2022_CN: -// /* Only add code points that map to CNS 11643 planes 1 & 2 for non-EXT ISO-2022-CN. */ -// do { -// if(((st3&1)!=0 || useFallback) && ((value=*stage3)==0x81 || value==0x82)) { -// sa->add(sa->set, c); -// } -// st3>>=1; -// stage3+=3; /* +=st3Multiplier */ -// } while((++c&0xf)!=0); -// break; -// case UCNV_SET_FILTER_SJIS: -// /* Only add code points that map to Shift-JIS codes corresponding to JIS X 0208. */ -// do { -// if(((st3&1)!=0 || useFallback) && (value=*((const uint16_t *)stage3))>=0x8140 && value<=0xeffc) { -// sa->add(sa->set, c); -// } -// st3>>=1; -// stage3+=2; /* +=st3Multiplier */ -// } while((++c&0xf)!=0); -// break; -// case UCNV_SET_FILTER_GR94DBCS: -// /* Only add code points that map to ISO 2022 GR 94 DBCS codes (each byte A1..FE). */ -// do { -// if( ((st3&1)!=0 || useFallback) && -// (uint16_t)((value=*((const uint16_t *)stage3)) - 0xa1a1)<=(0xfefe - 0xa1a1) && -// (uint8_t)(value-0xa1)<=(0xfe - 0xa1) -// ) { -// sa->add(sa->set, c); -// } -// st3>>=1; -// stage3+=2; /* +=st3Multiplier */ -// } while((++c&0xf)!=0); -// break; -// case UCNV_SET_FILTER_HZ: -// /* Only add code points that are suitable for HZ DBCS (lead byte A1..FD). */ -// do { -// if( ((st3&1)!=0 || useFallback) && -// (uint16_t)((value=*((const uint16_t *)stage3))-0xa1a1)<=(0xfdfe - 0xa1a1) && -// (uint8_t)(value-0xa1)<=(0xfe - 0xa1) -// ) { -// sa->add(sa->set, c); -// } -// st3>>=1; -// stage3+=2; /* +=st3Multiplier */ -// } while((++c&0xf)!=0); -// break; -// default: -// *pErrorCode=U_INTERNAL_PROGRAM_ERROR; -// return; -// } -// } else { -// c+=16; /* empty stage 3 block */ -// } -// } -// } else { -// c+=1024; /* empty stage 2 block */ -// } -// } -// } - -// ucnv_extGetUnicodeSet(sharedData, sa, which, filter, pErrorCode); -// } - -// U_CFUNC void -// ucnv_MBCSGetUnicodeSetForUnicode(const UConverterSharedData *sharedData, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode) { -// ucnv_MBCSGetFilteredUnicodeSetForUnicode( -// sharedData, sa, which, -// sharedData->mbcs.outputType==MBCS_OUTPUT_DBCS_ONLY ? -// UCNV_SET_FILTER_DBCS_ONLY : -// UCNV_SET_FILTER_NONE, -// pErrorCode); -// } - -// static void U_CALLCONV -// ucnv_MBCSGetUnicodeSet(const UConverter *cnv, -// const USetAdder *sa, -// UConverterUnicodeSet which, -// UErrorCode *pErrorCode) { -// if(cnv->options&_MBCS_OPTION_GB18030) { -// sa->addRange(sa->set, 0, 0xd7ff); -// sa->addRange(sa->set, 0xe000, 0x10ffff); -// } else { -// ucnv_MBCSGetUnicodeSetForUnicode(cnv->sharedData, sa, which, pErrorCode); -// } -// } - -// /* conversion extensions for input not in the main table -------------------- */ - -// /* -// * Hardcoded extension handling for GB 18030. -// * Definition of LINEAR macros and gb18030Ranges see near the beginning of the file. -// * -// * In the future, conversion extensions may handle m:n mappings and delta tables, -// * see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/conversion/conversion_extensions.html -// * -// * If an input character cannot be mapped, then these functions set an error -// * code. The framework will then call the callback function. -// */ - -// /* -// * @return if(U_FAILURE) return the code point for cnv->fromUChar32 -// * else return 0 after output has been written to the target -// */ -// static UChar32 -// _extFromU(UConverter *cnv, const UConverterSharedData *sharedData, -// UChar32 cp, -// const UChar **source, const UChar *sourceLimit, -// uint8_t **target, const uint8_t *targetLimit, -// int32_t **offsets, int32_t sourceIndex, -// UBool flush, -// UErrorCode *pErrorCode) { -// const int32_t *cx; - -// cnv->useSubChar1=FALSE; - -// if( (cx=sharedData->mbcs.extIndexes)!=NULL && -// ucnv_extInitialMatchFromU( -// cnv, cx, -// cp, source, sourceLimit, -// (char **)target, (char *)targetLimit, -// offsets, sourceIndex, -// flush, -// pErrorCode) -// ) { -// return 0; /* an extension mapping handled the input */ -// } - -// /* GB 18030 */ -// if((cnv->options&_MBCS_OPTION_GB18030)!=0) { -// const uint32_t *range; -// int32_t i; - -// range=gb18030Ranges[0]; -// for(i=0; itoUBytes[0..length[ -// * @return if(U_FAILURE) return the length (toULength, byteIndex) for the input -// * else return 0 after output has been written to the target -// */ -// static int8_t -// _extToU(UConverter *cnv, const UConverterSharedData *sharedData, -// int8_t length, -// const uint8_t **source, const uint8_t *sourceLimit, -// UChar **target, const UChar *targetLimit, -// int32_t **offsets, int32_t sourceIndex, -// UBool flush, -// UErrorCode *pErrorCode) { -// const int32_t *cx; - -// if( (cx=sharedData->mbcs.extIndexes)!=NULL && -// ucnv_extInitialMatchToU( -// cnv, cx, -// length, (const char **)source, (const char *)sourceLimit, -// target, targetLimit, -// offsets, sourceIndex, -// flush, -// pErrorCode) -// ) { -// return 0; /* an extension mapping handled the input */ -// } - -// /* GB 18030 */ -// if(length==4 && (cnv->options&_MBCS_OPTION_GB18030)!=0) { -// const uint32_t *range; -// uint32_t linear; -// int32_t i; - -// linear=LINEAR_18030(cnv->toUBytes[0], cnv->toUBytes[1], cnv->toUBytes[2], cnv->toUBytes[3]); -// range=gb18030Ranges[0]; -// for(i=0; iNL ------------------------------------------------------ */ - -// /* -// * This code modifies a standard EBCDIC<->Unicode mapping table for -// * OS/390 (z/OS) Unix System Services (Open Edition). -// * The difference is in the mapping of Line Feed and New Line control codes: -// * Standard EBCDIC maps -// * -// * \x25 |0 -// * \x15 |0 -// * -// * but OS/390 USS EBCDIC swaps the control codes for LF and NL, -// * mapping -// * -// * \x15 |0 -// * \x25 |0 -// * -// * This code modifies a loaded standard EBCDIC<->Unicode mapping table -// * by copying it into allocated memory and swapping the LF and NL values. -// * It allows to support the same EBCDIC charset in both versions without -// * duplicating the entire installed table. -// */ - -// /* standard EBCDIC codes */ -// #define EBCDIC_LF 0x25 -// #define EBCDIC_NL 0x15 - -// /* standard EBCDIC codes with roundtrip flag as stored in Unicode-to-single-byte tables */ -// #define EBCDIC_RT_LF 0xf25 -// #define EBCDIC_RT_NL 0xf15 - -// /* Unicode code points */ -// #define U_LF 0x0a -// #define U_NL 0x85 - -// static UBool -// _EBCDICSwapLFNL(UConverterSharedData *sharedData, UErrorCode *pErrorCode) { -// UConverterMBCSTable *mbcsTable; - -// const uint16_t *table, *results; -// const uint8_t *bytes; - -// int32_t (*newStateTable)[256]; -// uint16_t *newResults; -// uint8_t *p; -// char *name; - -// uint32_t stage2Entry; -// uint32_t size, sizeofFromUBytes; - -// mbcsTable=&sharedData->mbcs; - -// table=mbcsTable->fromUnicodeTable; -// bytes=mbcsTable->fromUnicodeBytes; -// results=(const uint16_t *)bytes; - -// /* -// * Check that this is an EBCDIC table with SBCS portion - -// * SBCS or EBCDIC_STATEFUL with standard EBCDIC LF and NL mappings. -// * -// * If not, ignore the option. Options are always ignored if they do not apply. -// */ -// if(!( -// (mbcsTable->outputType==MBCS_OUTPUT_1 || mbcsTable->outputType==MBCS_OUTPUT_2_SISO) && -// mbcsTable->stateTable[0][EBCDIC_LF]==MBCS_ENTRY_FINAL(0, MBCS_STATE_VALID_DIRECT_16, U_LF) && -// mbcsTable->stateTable[0][EBCDIC_NL]==MBCS_ENTRY_FINAL(0, MBCS_STATE_VALID_DIRECT_16, U_NL) -// )) { -// return FALSE; -// } - -// if(mbcsTable->outputType==MBCS_OUTPUT_1) { -// if(!( -// EBCDIC_RT_LF==MBCS_SINGLE_RESULT_FROM_U(table, results, U_LF) && -// EBCDIC_RT_NL==MBCS_SINGLE_RESULT_FROM_U(table, results, U_NL) -// )) { -// return FALSE; -// } -// } else /* MBCS_OUTPUT_2_SISO */ { -// stage2Entry=MBCS_STAGE_2_FROM_U(table, U_LF); -// if(!( -// MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, U_LF)!=0 && -// EBCDIC_LF==MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, U_LF) -// )) { -// return FALSE; -// } - -// stage2Entry=MBCS_STAGE_2_FROM_U(table, U_NL); -// if(!( -// MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, U_NL)!=0 && -// EBCDIC_NL==MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, U_NL) -// )) { -// return FALSE; -// } -// } - -// if(mbcsTable->fromUBytesLength>0) { -// /* -// * We _know_ the number of bytes in the fromUnicodeBytes array -// * starting with header.version 4.1. -// */ -// sizeofFromUBytes=mbcsTable->fromUBytesLength; -// } else { -// /* -// * Otherwise: -// * There used to be code to enumerate the fromUnicode -// * trie and find the highest entry, but it was removed in ICU 3.2 -// * because it was not tested and caused a low code coverage number. -// * See Jitterbug 3674. -// * This affects only some .cnv file formats with a header.version -// * below 4.1, and only when swaplfnl is requested. -// * -// * ucnvmbcs.c revision 1.99 is the last one with the -// * ucnv_MBCSSizeofFromUBytes() function. -// */ -// *pErrorCode=U_INVALID_FORMAT_ERROR; -// return FALSE; -// } - -// /* -// * The table has an appropriate format. -// * Allocate and build -// * - a modified to-Unicode state table -// * - a modified from-Unicode output array -// * - a converter name string with the swap option appended -// */ -// size= -// mbcsTable->countStates*1024+ -// sizeofFromUBytes+ -// UCNV_MAX_CONVERTER_NAME_LENGTH+20; -// p=(uint8_t *)uprv_malloc(size); -// if(p==NULL) { -// *pErrorCode=U_MEMORY_ALLOCATION_ERROR; -// return FALSE; -// } - -// /* copy and modify the to-Unicode state table */ -// newStateTable=(int32_t (*)[256])p; -// uprv_memcpy(newStateTable, mbcsTable->stateTable, mbcsTable->countStates*1024); - -// newStateTable[0][EBCDIC_LF]=MBCS_ENTRY_FINAL(0, MBCS_STATE_VALID_DIRECT_16, U_NL); -// newStateTable[0][EBCDIC_NL]=MBCS_ENTRY_FINAL(0, MBCS_STATE_VALID_DIRECT_16, U_LF); - -// /* copy and modify the from-Unicode result table */ -// newResults=(uint16_t *)newStateTable[mbcsTable->countStates]; -// uprv_memcpy(newResults, bytes, sizeofFromUBytes); - -// /* conveniently, the table access macros work on the left side of expressions */ -// if(mbcsTable->outputType==MBCS_OUTPUT_1) { -// MBCS_SINGLE_RESULT_FROM_U(table, newResults, U_LF)=EBCDIC_RT_NL; -// MBCS_SINGLE_RESULT_FROM_U(table, newResults, U_NL)=EBCDIC_RT_LF; -// } else /* MBCS_OUTPUT_2_SISO */ { -// stage2Entry=MBCS_STAGE_2_FROM_U(table, U_LF); -// MBCS_VALUE_2_FROM_STAGE_2(newResults, stage2Entry, U_LF)=EBCDIC_NL; - -// stage2Entry=MBCS_STAGE_2_FROM_U(table, U_NL); -// MBCS_VALUE_2_FROM_STAGE_2(newResults, stage2Entry, U_NL)=EBCDIC_LF; -// } - -// /* set the canonical converter name */ -// name=(char *)newResults+sizeofFromUBytes; -// uprv_strcpy(name, sharedData->staticData->name); -// uprv_strcat(name, UCNV_SWAP_LFNL_OPTION_STRING); - -// /* set the pointers */ -// icu::umtx_lock(NULL); -// if(mbcsTable->swapLFNLStateTable==NULL) { -// mbcsTable->swapLFNLStateTable=newStateTable; -// mbcsTable->swapLFNLFromUnicodeBytes=(uint8_t *)newResults; -// mbcsTable->swapLFNLName=name; - -// newStateTable=NULL; -// } -// icu::umtx_unlock(NULL); - -// /* release the allocated memory if another thread beat us to it */ -// if(newStateTable!=NULL) { -// uprv_free(newStateTable); -// } -// return TRUE; -// } - -// /* reconstitute omitted fromUnicode data ------------------------------------ */ - -// /* for details, compare with genmbcs.c MBCSAddFromUnicode() and transformEUC() */ -// static UBool U_CALLCONV -// writeStage3Roundtrip(const void *context, uint32_t value, UChar32 codePoints[32]) { -// UConverterMBCSTable *mbcsTable=(UConverterMBCSTable *)context; -// const uint16_t *table; -// uint32_t *stage2; -// uint8_t *bytes, *p; -// UChar32 c; -// int32_t i, st3; - -// table=mbcsTable->fromUnicodeTable; -// bytes=(uint8_t *)mbcsTable->fromUnicodeBytes; - -// /* for EUC outputTypes, modify the value like genmbcs.c's transformEUC() */ -// switch(mbcsTable->outputType) { -// case MBCS_OUTPUT_3_EUC: -// if(value<=0xffff) { -// /* short sequences are stored directly */ -// /* code set 0 or 1 */ -// } else if(value<=0x8effff) { -// /* code set 2 */ -// value&=0x7fff; -// } else /* first byte is 0x8f */ { -// /* code set 3 */ -// value&=0xff7f; -// } -// break; -// case MBCS_OUTPUT_4_EUC: -// if(value<=0xffffff) { -// /* short sequences are stored directly */ -// /* code set 0 or 1 */ -// } else if(value<=0x8effffff) { -// /* code set 2 */ -// value&=0x7fffff; -// } else /* first byte is 0x8f */ { -// /* code set 3 */ -// value&=0xff7fff; -// } -// break; -// default: -// break; -// } - -// for(i=0; i<=0x1f; ++value, ++i) { -// c=codePoints[i]; -// if(c<0) { -// continue; -// } - -// /* locate the stage 2 & 3 data */ -// stage2=((uint32_t *)table)+table[c>>10]+((c>>4)&0x3f); -// p=bytes; -// st3=(int32_t)(uint16_t)*stage2*16+(c&0xf); - -// /* write the codepage bytes into stage 3 */ -// switch(mbcsTable->outputType) { -// case MBCS_OUTPUT_3: -// case MBCS_OUTPUT_4_EUC: -// p+=st3*3; -// p[0]=(uint8_t)(value>>16); -// p[1]=(uint8_t)(value>>8); -// p[2]=(uint8_t)value; -// break; -// case MBCS_OUTPUT_4: -// ((uint32_t *)p)[st3]=value; -// break; -// default: -// /* 2 bytes per character */ -// ((uint16_t *)p)[st3]=(uint16_t)value; -// break; -// } - -// /* set the roundtrip flag */ -// *stage2|=(1UL<<(16+(c&0xf))); -// } -// return TRUE; -// } - -// static void -// reconstituteData(UConverterMBCSTable *mbcsTable, -// uint32_t stage1Length, uint32_t stage2Length, -// uint32_t fullStage2Length, /* lengths are numbers of units, not bytes */ -// UErrorCode *pErrorCode) { -// uint16_t *stage1; -// uint32_t *stage2; -// uint32_t dataLength=stage1Length*2+fullStage2Length*4+mbcsTable->fromUBytesLength; -// mbcsTable->reconstitutedData=(uint8_t *)uprv_malloc(dataLength); -// if(mbcsTable->reconstitutedData==NULL) { -// *pErrorCode=U_MEMORY_ALLOCATION_ERROR; -// return; -// } -// uprv_memset(mbcsTable->reconstitutedData, 0, dataLength); - -// /* copy existing data and reroute the pointers */ -// stage1=(uint16_t *)mbcsTable->reconstitutedData; -// uprv_memcpy(stage1, mbcsTable->fromUnicodeTable, stage1Length*2); - -// stage2=(uint32_t *)(stage1+stage1Length); -// uprv_memcpy(stage2+(fullStage2Length-stage2Length), -// mbcsTable->fromUnicodeTable+stage1Length, -// stage2Length*4); - -// mbcsTable->fromUnicodeTable=stage1; -// mbcsTable->fromUnicodeBytes=(uint8_t *)(stage2+fullStage2Length); - -// /* indexes into stage 2 count from the bottom of the fromUnicodeTable */ -// stage2=(uint32_t *)stage1; - -// /* reconstitute the initial part of stage 2 from the mbcsIndex */ -// { -// int32_t stageUTF8Length=((int32_t)mbcsTable->maxFastUChar+1)>>6; -// int32_t stageUTF8Index=0; -// int32_t st1, st2, st3, i; - -// for(st1=0; stageUTF8IndexmbcsIndex[stageUTF8Index++]; -// if(st3!=0) { -// /* an stage 2 entry's index is per stage 3 16-block, not per stage 3 entry */ -// st3>>=4; -// /* -// * 4 stage 2 entries point to 4 consecutive stage 3 16-blocks which are -// * allocated together as a single 64-block for access from the mbcsIndex -// */ -// stage2[st2++]=st3++; -// stage2[st2++]=st3++; -// stage2[st2++]=st3++; -// stage2[st2++]=st3; -// } else { -// /* no stage 3 block, skip */ -// st2+=4; -// } -// } -// } else { -// /* no stage 2 block, skip */ -// stageUTF8Index+=16; -// } -// } -// } - -// /* reconstitute fromUnicodeBytes with roundtrips from toUnicode data */ -// ucnv_MBCSEnumToUnicode(mbcsTable, writeStage3Roundtrip, mbcsTable, pErrorCode); -// } - -// /* MBCS setup functions ----------------------------------------------------- */ - -// static void U_CALLCONV -// ucnv_MBCSLoad(UConverterSharedData *sharedData, -// UConverterLoadArgs *pArgs, -// const uint8_t *raw, -// UErrorCode *pErrorCode) { -// UDataInfo info; -// UConverterMBCSTable *mbcsTable=&sharedData->mbcs; -// _MBCSHeader *header=(_MBCSHeader *)raw; -// uint32_t offset; -// uint32_t headerLength; -// UBool noFromU=FALSE; - -// if(header->version[0]==4) { -// headerLength=MBCS_HEADER_V4_LENGTH; -// } else if(header->version[0]==5 && header->version[1]>=3 && -// (header->options&MBCS_OPT_UNKNOWN_INCOMPATIBLE_MASK)==0) { -// headerLength=header->options&MBCS_OPT_LENGTH_MASK; -// noFromU=(UBool)((header->options&MBCS_OPT_NO_FROM_U)!=0); -// } else { -// *pErrorCode=U_INVALID_TABLE_FORMAT; -// return; -// } - -// mbcsTable->outputType=(uint8_t)header->flags; -// if(noFromU && mbcsTable->outputType==MBCS_OUTPUT_1) { -// *pErrorCode=U_INVALID_TABLE_FORMAT; -// return; -// } - -// /* extension data, header version 4.2 and higher */ -// offset=header->flags>>8; -// if(offset!=0) { -// mbcsTable->extIndexes=(const int32_t *)(raw+offset); -// } - -// if(mbcsTable->outputType==MBCS_OUTPUT_EXT_ONLY) { -// UConverterLoadArgs args=UCNV_LOAD_ARGS_INITIALIZER; -// UConverterSharedData *baseSharedData; -// const int32_t *extIndexes; -// const char *baseName; - -// /* extension-only file, load the base table and set values appropriately */ -// if((extIndexes=mbcsTable->extIndexes)==NULL) { -// /* extension-only file without extension */ -// *pErrorCode=U_INVALID_TABLE_FORMAT; -// return; -// } - -// if(pArgs->nestedLoads!=1) { -// /* an extension table must not be loaded as a base table */ -// *pErrorCode=U_INVALID_TABLE_FILE; -// return; -// } - -// /* load the base table */ -// baseName=(const char *)header+headerLength*4; -// if(0==uprv_strcmp(baseName, sharedData->staticData->name)) { -// /* forbid loading this same extension-only file */ -// *pErrorCode=U_INVALID_TABLE_FORMAT; -// return; -// } - -// /* TODO parse package name out of the prefix of the base name in the extension .cnv file? */ -// args.size=sizeof(UConverterLoadArgs); -// args.nestedLoads=2; -// args.onlyTestIsLoadable=pArgs->onlyTestIsLoadable; -// args.reserved=pArgs->reserved; -// args.options=pArgs->options; -// args.pkg=pArgs->pkg; -// args.name=baseName; -// baseSharedData=ucnv_load(&args, pErrorCode); -// if(U_FAILURE(*pErrorCode)) { -// return; -// } -// if( baseSharedData->staticData->conversionType!=UCNV_MBCS || -// baseSharedData->mbcs.baseSharedData!=NULL -// ) { -// ucnv_unload(baseSharedData); -// *pErrorCode=U_INVALID_TABLE_FORMAT; -// return; -// } -// if(pArgs->onlyTestIsLoadable) { -// /* -// * Exit as soon as we know that we can load the converter -// * and the format is valid and supported. -// * The worst that can happen in the following code is a memory -// * allocation error. -// */ -// ucnv_unload(baseSharedData); -// return; -// } - -// /* copy the base table data */ -// uprv_memcpy(mbcsTable, &baseSharedData->mbcs, sizeof(UConverterMBCSTable)); - -// /* overwrite values with relevant ones for the extension converter */ -// mbcsTable->baseSharedData=baseSharedData; -// mbcsTable->extIndexes=extIndexes; - -// /* -// * It would be possible to share the swapLFNL data with a base converter, -// * but the generated name would have to be different, and the memory -// * would have to be free'd only once. -// * It is easier to just create the data for the extension converter -// * separately when it is requested. -// */ -// mbcsTable->swapLFNLStateTable=NULL; -// mbcsTable->swapLFNLFromUnicodeBytes=NULL; -// mbcsTable->swapLFNLName=NULL; - -// /* -// * The reconstitutedData must be deleted only when the base converter -// * is unloaded. -// */ -// mbcsTable->reconstitutedData=NULL; - -// /* -// * Set a special, runtime-only outputType if the extension converter -// * is a DBCS version of a base converter that also maps single bytes. -// */ -// if( sharedData->staticData->conversionType==UCNV_DBCS || -// (sharedData->staticData->conversionType==UCNV_MBCS && -// sharedData->staticData->minBytesPerChar>=2) -// ) { -// if(baseSharedData->mbcs.outputType==MBCS_OUTPUT_2_SISO) { -// /* the base converter is SI/SO-stateful */ -// int32_t entry; - -// /* get the dbcs state from the state table entry for SO=0x0e */ -// entry=mbcsTable->stateTable[0][0xe]; -// if( MBCS_ENTRY_IS_FINAL(entry) && -// MBCS_ENTRY_FINAL_ACTION(entry)==MBCS_STATE_CHANGE_ONLY && -// MBCS_ENTRY_FINAL_STATE(entry)!=0 -// ) { -// mbcsTable->dbcsOnlyState=(uint8_t)MBCS_ENTRY_FINAL_STATE(entry); - -// mbcsTable->outputType=MBCS_OUTPUT_DBCS_ONLY; -// } -// } else if( -// baseSharedData->staticData->conversionType==UCNV_MBCS && -// baseSharedData->staticData->minBytesPerChar==1 && -// baseSharedData->staticData->maxBytesPerChar==2 && -// mbcsTable->countStates<=127 -// ) { -// /* non-stateful base converter, need to modify the state table */ -// int32_t (*newStateTable)[256]; -// int32_t *state; -// int32_t i, count; - -// /* allocate a new state table and copy the base state table contents */ -// count=mbcsTable->countStates; -// newStateTable=(int32_t (*)[256])uprv_malloc((count+1)*1024); -// if(newStateTable==NULL) { -// ucnv_unload(baseSharedData); -// *pErrorCode=U_MEMORY_ALLOCATION_ERROR; -// return; -// } - -// uprv_memcpy(newStateTable, mbcsTable->stateTable, count*1024); - -// /* change all final single-byte entries to go to a new all-illegal state */ -// state=newStateTable[0]; -// for(i=0; i<256; ++i) { -// if(MBCS_ENTRY_IS_FINAL(state[i])) { -// state[i]=MBCS_ENTRY_TRANSITION(count, 0); -// } -// } - -// /* build the new all-illegal state */ -// state=newStateTable[count]; -// for(i=0; i<256; ++i) { -// state[i]=MBCS_ENTRY_FINAL(0, MBCS_STATE_ILLEGAL, 0); -// } -// mbcsTable->stateTable=(const int32_t (*)[256])newStateTable; -// mbcsTable->countStates=(uint8_t)(count+1); -// mbcsTable->stateTableOwned=TRUE; - -// mbcsTable->outputType=MBCS_OUTPUT_DBCS_ONLY; -// } -// } - -// /* -// * unlike below for files with base tables, do not get the unicodeMask -// * from the sharedData; instead, use the base table's unicodeMask, -// * which we copied in the memcpy above; -// * this is necessary because the static data unicodeMask, especially -// * the UCNV_HAS_SUPPLEMENTARY flag, is part of the base table data -// */ -// } else { -// /* conversion file with a base table; an additional extension table is optional */ -// /* make sure that the output type is known */ -// switch(mbcsTable->outputType) { -// case MBCS_OUTPUT_1: -// case MBCS_OUTPUT_2: -// case MBCS_OUTPUT_3: -// case MBCS_OUTPUT_4: -// case MBCS_OUTPUT_3_EUC: -// case MBCS_OUTPUT_4_EUC: -// case MBCS_OUTPUT_2_SISO: -// /* OK */ -// break; -// default: -// *pErrorCode=U_INVALID_TABLE_FORMAT; -// return; -// } -// if(pArgs->onlyTestIsLoadable) { -// /* -// * Exit as soon as we know that we can load the converter -// * and the format is valid and supported. -// * The worst that can happen in the following code is a memory -// * allocation error. -// */ -// return; -// } - -// mbcsTable->countStates=(uint8_t)header->countStates; -// mbcsTable->countToUFallbacks=header->countToUFallbacks; -// mbcsTable->stateTable=(const int32_t (*)[256])(raw+headerLength*4); -// mbcsTable->toUFallbacks=(const _MBCSToUFallback *)(mbcsTable->stateTable+header->countStates); -// mbcsTable->unicodeCodeUnits=(const uint16_t *)(raw+header->offsetToUCodeUnits); - -// mbcsTable->fromUnicodeTable=(const uint16_t *)(raw+header->offsetFromUTable); -// mbcsTable->fromUnicodeBytes=(const uint8_t *)(raw+header->offsetFromUBytes); -// mbcsTable->fromUBytesLength=header->fromUBytesLength; - -// /* -// * converter versions 6.1 and up contain a unicodeMask that is -// * used here to select the most efficient function implementations -// */ -// info.size=sizeof(UDataInfo); -// udata_getInfo((UDataMemory *)sharedData->dataMemory, &info); -// if(info.formatVersion[0]>6 || (info.formatVersion[0]==6 && info.formatVersion[1]>=1)) { -// /* mask off possible future extensions to be safe */ -// mbcsTable->unicodeMask=(uint8_t)(sharedData->staticData->unicodeMask&3); -// } else { -// /* for older versions, assume worst case: contains anything possible (prevent over-optimizations) */ -// mbcsTable->unicodeMask=UCNV_HAS_SUPPLEMENTARY|UCNV_HAS_SURROGATES; -// } - -// /* -// * _MBCSHeader.version 4.3 adds utf8Friendly data structures. -// * Check for the header version, SBCS vs. MBCS, and for whether the -// * data structures are optimized for code points as high as what the -// * runtime code is designed for. -// * The implementation does not handle mapping tables with entries for -// * unpaired surrogates. -// */ -// if( header->version[1]>=3 && -// (mbcsTable->unicodeMask&UCNV_HAS_SURROGATES)==0 && -// (mbcsTable->countStates==1 ? -// (header->version[2]>=(SBCS_FAST_MAX>>8)) : -// (header->version[2]>=(MBCS_FAST_MAX>>8)) -// ) -// ) { -// mbcsTable->utf8Friendly=TRUE; - -// if(mbcsTable->countStates==1) { -// /* -// * SBCS: Stage 3 is allocated in 64-entry blocks for U+0000..SBCS_FAST_MAX or higher. -// * Build a table with indexes to each block, to be used instead of -// * the regular stage 1/2 table. -// */ -// int32_t i; -// for(i=0; i<(SBCS_FAST_LIMIT>>6); ++i) { -// mbcsTable->sbcsIndex[i]=mbcsTable->fromUnicodeTable[mbcsTable->fromUnicodeTable[i>>4]+((i<<2)&0x3c)]; -// } -// /* set SBCS_FAST_MAX to reflect the reach of sbcsIndex[] even if header->version[2]>(SBCS_FAST_MAX>>8) */ -// mbcsTable->maxFastUChar=SBCS_FAST_MAX; -// } else { -// /* -// * MBCS: Stage 3 is allocated in 64-entry blocks for U+0000..MBCS_FAST_MAX or higher. -// * The .cnv file is prebuilt with an additional stage table with indexes -// * to each block. -// */ -// mbcsTable->mbcsIndex=(const uint16_t *) -// (mbcsTable->fromUnicodeBytes+ -// (noFromU ? 0 : mbcsTable->fromUBytesLength)); -// mbcsTable->maxFastUChar=(((UChar)header->version[2])<<8)|0xff; -// } -// } - -// /* calculate a bit set of 4 ASCII characters per bit that round-trip to ASCII bytes */ -// { -// uint32_t asciiRoundtrips=0xffffffff; -// int32_t i; - -// for(i=0; i<0x80; ++i) { -// if(mbcsTable->stateTable[0][i]!=MBCS_ENTRY_FINAL(0, MBCS_STATE_VALID_DIRECT_16, i)) { -// asciiRoundtrips&=~((uint32_t)1<<(i>>2)); -// } -// } -// mbcsTable->asciiRoundtrips=asciiRoundtrips; -// } - -// if(noFromU) { -// uint32_t stage1Length= -// mbcsTable->unicodeMask&UCNV_HAS_SUPPLEMENTARY ? -// 0x440 : 0x40; -// uint32_t stage2Length= -// (header->offsetFromUBytes-header->offsetFromUTable)/4- -// stage1Length/2; -// reconstituteData(mbcsTable, stage1Length, stage2Length, header->fullStage2Length, pErrorCode); -// } -// } - -// /* Set the impl pointer here so that it is set for both extension-only and base tables. */ -// if(mbcsTable->utf8Friendly) { -// if(mbcsTable->countStates==1) { -// sharedData->impl=&_SBCSUTF8Impl; -// } else { -// if(mbcsTable->outputType==MBCS_OUTPUT_2) { -// sharedData->impl=&_DBCSUTF8Impl; -// } -// } -// } - -// if(mbcsTable->outputType==MBCS_OUTPUT_DBCS_ONLY || mbcsTable->outputType==MBCS_OUTPUT_2_SISO) { -// /* -// * MBCS_OUTPUT_DBCS_ONLY: No SBCS mappings, therefore ASCII does not roundtrip. -// * MBCS_OUTPUT_2_SISO: Bypass the ASCII fastpath to handle prevLength correctly. -// */ -// mbcsTable->asciiRoundtrips=0; -// } -// } - -// static void U_CALLCONV -// ucnv_MBCSUnload(UConverterSharedData *sharedData) { -// UConverterMBCSTable *mbcsTable=&sharedData->mbcs; - -// if(mbcsTable->swapLFNLStateTable!=NULL) { -// uprv_free(mbcsTable->swapLFNLStateTable); -// } -// if(mbcsTable->stateTableOwned) { -// uprv_free((void *)mbcsTable->stateTable); -// } -// if(mbcsTable->baseSharedData!=NULL) { -// ucnv_unload(mbcsTable->baseSharedData); -// } -// if(mbcsTable->reconstitutedData!=NULL) { -// uprv_free(mbcsTable->reconstitutedData); -// } -// } - -// static void U_CALLCONV -// ucnv_MBCSOpen(UConverter *cnv, -// UConverterLoadArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverterMBCSTable *mbcsTable; -// const int32_t *extIndexes; -// uint8_t outputType; -// int8_t maxBytesPerUChar; - -// if(pArgs->onlyTestIsLoadable) { -// return; -// } - -// mbcsTable=&cnv->sharedData->mbcs; -// outputType=mbcsTable->outputType; - -// if(outputType==MBCS_OUTPUT_DBCS_ONLY) { -// /* the swaplfnl option does not apply, remove it */ -// cnv->options=pArgs->options&=~UCNV_OPTION_SWAP_LFNL; -// } - -// if((pArgs->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// /* do this because double-checked locking is broken */ -// UBool isCached; - -// icu::umtx_lock(NULL); -// isCached=mbcsTable->swapLFNLStateTable!=NULL; -// icu::umtx_unlock(NULL); - -// if(!isCached) { -// if(!_EBCDICSwapLFNL(cnv->sharedData, pErrorCode)) { -// if(U_FAILURE(*pErrorCode)) { -// return; /* something went wrong */ -// } - -// /* the option does not apply, remove it */ -// cnv->options=pArgs->options&=~UCNV_OPTION_SWAP_LFNL; -// } -// } -// } - -// if(uprv_strstr(pArgs->name, "18030")!=NULL) { -// if(uprv_strstr(pArgs->name, "gb18030")!=NULL || uprv_strstr(pArgs->name, "GB18030")!=NULL) { -// /* set a flag for GB 18030 mode, which changes the callback behavior */ -// cnv->options|=_MBCS_OPTION_GB18030; -// } -// } else if((uprv_strstr(pArgs->name, "KEIS")!=NULL) || (uprv_strstr(pArgs->name, "keis")!=NULL)) { -// /* set a flag for KEIS converter, which changes the SI/SO character sequence */ -// cnv->options|=_MBCS_OPTION_KEIS; -// } else if((uprv_strstr(pArgs->name, "JEF")!=NULL) || (uprv_strstr(pArgs->name, "jef")!=NULL)) { -// /* set a flag for JEF converter, which changes the SI/SO character sequence */ -// cnv->options|=_MBCS_OPTION_JEF; -// } else if((uprv_strstr(pArgs->name, "JIPS")!=NULL) || (uprv_strstr(pArgs->name, "jips")!=NULL)) { -// /* set a flag for JIPS converter, which changes the SI/SO character sequence */ -// cnv->options|=_MBCS_OPTION_JIPS; -// } - -// /* fix maxBytesPerUChar depending on outputType and options etc. */ -// if(outputType==MBCS_OUTPUT_2_SISO) { -// cnv->maxBytesPerUChar=3; /* SO+DBCS */ -// } - -// extIndexes=mbcsTable->extIndexes; -// if(extIndexes!=NULL) { -// maxBytesPerUChar=(int8_t)UCNV_GET_MAX_BYTES_PER_UCHAR(extIndexes); -// if(outputType==MBCS_OUTPUT_2_SISO) { -// ++maxBytesPerUChar; /* SO + multiple DBCS */ -// } - -// if(maxBytesPerUChar>cnv->maxBytesPerUChar) { -// cnv->maxBytesPerUChar=maxBytesPerUChar; -// } -// } - -// #if 0 -// /* -// * documentation of UConverter fields used for status -// * all of these fields are (re)set to 0 by ucnv_bld.c and ucnv_reset() -// */ - -// /* toUnicode */ -// cnv->toUnicodeStatus=0; /* offset */ -// cnv->mode=0; /* state */ -// cnv->toULength=0; /* byteIndex */ - -// /* fromUnicode */ -// cnv->fromUChar32=0; -// cnv->fromUnicodeStatus=1; /* prevLength */ -// #endif -// } - -// U_CDECL_BEGIN - -// static const char* U_CALLCONV -// ucnv_MBCSGetName(const UConverter *cnv) { -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0 && cnv->sharedData->mbcs.swapLFNLName!=NULL) { -// return cnv->sharedData->mbcs.swapLFNLName; -// } else { -// return cnv->sharedData->staticData->name; -// } -// } -// U_CDECL_END - - -// /* MBCS-to-Unicode conversion functions ------------------------------------- */ - -// static UChar32 U_CALLCONV -// ucnv_MBCSGetFallback(UConverterMBCSTable *mbcsTable, uint32_t offset) { -// const _MBCSToUFallback *toUFallbacks; -// uint32_t i, start, limit; - -// limit=mbcsTable->countToUFallbacks; -// if(limit>0) { -// /* do a binary search for the fallback mapping */ -// toUFallbacks=mbcsTable->toUFallbacks; -// start=0; -// while(startconverter; -// source=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; -// target=pArgs->target; -// targetLimit=pArgs->targetLimit; -// offsets=pArgs->offsets; - -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable; -// } else { -// stateTable=cnv->sharedData->mbcs.stateTable; -// } - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex=0; - -// /* conversion loop */ -// while(source=targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } - -// entry=stateTable[0][*source++]; -// /* MBCS_ENTRY_IS_FINAL(entry) */ - -// /* test the most common case first */ -// if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) { -// /* output BMP code point */ -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } - -// /* normal end of action codes: prepare for a new character */ -// ++sourceIndex; -// continue; -// } - -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if(action==MBCS_STATE_VALID_DIRECT_20 || -// (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv)) -// ) { -// entry=MBCS_ENTRY_FINAL_VALUE(entry); -// /* output surrogate pair */ -// *target++=(UChar)(0xd800|(UChar)(entry>>10)); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// c=(UChar)(0xdc00|(UChar)(entry&0x3ff)); -// if(targetUCharErrorBuffer[0]=c; -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } - -// ++sourceIndex; -// continue; -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_16) { -// if(UCNV_TO_U_USE_FALLBACK(cnv)) { -// /* output BMP code point */ -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } - -// ++sourceIndex; -// continue; -// } -// } else if(action==MBCS_STATE_UNASSIGNED) { -// /* just fall through */ -// } else if(action==MBCS_STATE_ILLEGAL) { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } else { -// /* reserved, must never occur */ -// ++sourceIndex; -// continue; -// } - -// if(U_FAILURE(*pErrorCode)) { -// /* callback(illegal) */ -// break; -// } else /* unassigned sequences indicated with byteIndex>0 */ { -// /* try an extension mapping */ -// pArgs->source=(const char *)source; -// cnv->toUBytes[0]=*(source-1); -// cnv->toULength=_extToU(cnv, cnv->sharedData, -// 1, &source, sourceLimit, -// &target, targetLimit, -// &offsets, sourceIndex, -// pArgs->flush, -// pErrorCode); -// sourceIndex+=1+(int32_t)(source-(const uint8_t *)pArgs->source); - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// break; -// } -// } -// } - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// } - -// /* -// * This version of ucnv_MBCSSingleToUnicodeWithOffsets() is optimized for single-byte, single-state codepages -// * that only map to and from the BMP. -// * In addition to single-byte optimizations, the offset calculations -// * become much easier. -// */ -// static void -// ucnv_MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const uint8_t *source, *sourceLimit, *lastSource; -// UChar *target; -// int32_t targetCapacity, length; -// int32_t *offsets; - -// const int32_t (*stateTable)[256]; - -// int32_t sourceIndex; - -// int32_t entry; -// uint8_t action; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// source=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; -// target=pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable; -// } else { -// stateTable=cnv->sharedData->mbcs.stateTable; -// } - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex=0; -// lastSource=source; - -// /* -// * since the conversion here is 1:1 UChar:uint8_t, we need only one counter -// * for the minimum of the sourceLength and targetCapacity -// */ -// length=(int32_t)(sourceLimit-source); -// if(length=16) { -// int32_t count, loops, oredEntries; - -// loops=count=targetCapacity>>4; -// do { -// oredEntries=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// oredEntries|=entry=stateTable[0][*source++]; -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); - -// /* were all 16 entries really valid? */ -// if(!MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(oredEntries)) { -// /* no, return to the first of these 16 */ -// source-=16; -// target-=16; -// break; -// } -// } while(--count>0); -// count=loops-count; -// targetCapacity-=16*count; - -// if(offsets!=NULL) { -// lastSource+=16*count; -// while(count>0) { -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// --count; -// } -// } -// } -// #endif - -// /* conversion loop */ -// while(targetCapacity > 0 && source < sourceLimit) { -// entry=stateTable[0][*source++]; -// /* MBCS_ENTRY_IS_FINAL(entry) */ - -// /* test the most common case first */ -// if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) { -// /* output BMP code point */ -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// --targetCapacity; -// continue; -// } - -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if(action==MBCS_STATE_FALLBACK_DIRECT_16) { -// if(UCNV_TO_U_USE_FALLBACK(cnv)) { -// /* output BMP code point */ -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// --targetCapacity; -// continue; -// } -// } else if(action==MBCS_STATE_UNASSIGNED) { -// /* just fall through */ -// } else if(action==MBCS_STATE_ILLEGAL) { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } else { -// /* reserved, must never occur */ -// continue; -// } - -// /* set offsets since the start or the last extension */ -// if(offsets!=NULL) { -// int32_t count=(int32_t)(source-lastSource); - -// /* predecrement: do not set the offset for the callback-causing character */ -// while(--count>0) { -// *offsets++=sourceIndex++; -// } -// /* offset and sourceIndex are now set for the current character */ -// } - -// if(U_FAILURE(*pErrorCode)) { -// /* callback(illegal) */ -// break; -// } else /* unassigned sequences indicated with byteIndex>0 */ { -// /* try an extension mapping */ -// lastSource=source; -// cnv->toUBytes[0]=*(source-1); -// cnv->toULength=_extToU(cnv, cnv->sharedData, -// 1, &source, sourceLimit, -// &target, pArgs->targetLimit, -// &offsets, sourceIndex, -// pArgs->flush, -// pErrorCode); -// sourceIndex+=1+(int32_t)(source-lastSource); - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// break; -// } - -// /* recalculate the targetCapacity after an extension mapping */ -// targetCapacity=(int32_t)(pArgs->targetLimit-target); -// length=(int32_t)(sourceLimit-source); -// if(length=pArgs->targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } - -// /* set offsets since the start or the last callback */ -// if(offsets!=NULL) { -// size_t count=source-lastSource; -// while(count>0) { -// *offsets++=sourceIndex++; -// --count; -// } -// } - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// } - -// static UBool -// hasValidTrailBytes(const int32_t (*stateTable)[256], uint8_t state) { -// const int32_t *row=stateTable[state]; -// int32_t b, entry; -// /* First test for final entries in this state for some commonly valid byte values. */ -// entry=row[0xa1]; -// if( !MBCS_ENTRY_IS_TRANSITION(entry) && -// MBCS_ENTRY_FINAL_ACTION(entry)!=MBCS_STATE_ILLEGAL -// ) { -// return TRUE; -// } -// entry=row[0x41]; -// if( !MBCS_ENTRY_IS_TRANSITION(entry) && -// MBCS_ENTRY_FINAL_ACTION(entry)!=MBCS_STATE_ILLEGAL -// ) { -// return TRUE; -// } -// /* Then test for final entries in this state. */ -// for(b=0; b<=0xff; ++b) { -// entry=row[b]; -// if( !MBCS_ENTRY_IS_TRANSITION(entry) && -// MBCS_ENTRY_FINAL_ACTION(entry)!=MBCS_STATE_ILLEGAL -// ) { -// return TRUE; -// } -// } -// /* Then recurse for transition entries. */ -// for(b=0; b<=0xff; ++b) { -// entry=row[b]; -// if( MBCS_ENTRY_IS_TRANSITION(entry) && -// hasValidTrailBytes(stateTable, (uint8_t)MBCS_ENTRY_TRANSITION_STATE(entry)) -// ) { -// return TRUE; -// } -// } -// return FALSE; -// } - -// /* -// * Is byte b a single/lead byte in this state? -// * Recurse for transition states, because here we don't want to say that -// * b is a lead byte if all byte sequences that start with b are illegal. -// */ -// static UBool -// isSingleOrLead(const int32_t (*stateTable)[256], uint8_t state, UBool isDBCSOnly, uint8_t b) { -// const int32_t *row=stateTable[state]; -// int32_t entry=row[b]; -// if(MBCS_ENTRY_IS_TRANSITION(entry)) { /* lead byte */ -// return hasValidTrailBytes(stateTable, (uint8_t)MBCS_ENTRY_TRANSITION_STATE(entry)); -// } else { -// uint8_t action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if(action==MBCS_STATE_CHANGE_ONLY && isDBCSOnly) { -// return FALSE; /* SI/SO are illegal for DBCS-only conversion */ -// } else { -// return action!=MBCS_STATE_ILLEGAL; -// } -// } -// } - -// U_CFUNC void -// ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const uint8_t *source, *sourceLimit; -// UChar *target; -// const UChar *targetLimit; -// int32_t *offsets; - -// const int32_t (*stateTable)[256]; -// const uint16_t *unicodeCodeUnits; - -// uint32_t offset; -// uint8_t state; -// int8_t byteIndex; -// uint8_t *bytes; - -// int32_t sourceIndex, nextSourceIndex; - -// int32_t entry; -// UChar c; -// uint8_t action; - -// /* use optimized function if possible */ -// cnv=pArgs->converter; - -// if(cnv->preToULength>0) { -// /* -// * pass sourceIndex=-1 because we continue from an earlier buffer -// * in the future, this may change with continuous offsets -// */ -// ucnv_extContinueMatchToU(cnv, pArgs, -1, pErrorCode); - -// if(U_FAILURE(*pErrorCode) || cnv->preToULength<0) { -// return; -// } -// } - -// if(cnv->sharedData->mbcs.countStates==1) { -// if(!(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY)) { -// ucnv_MBCSSingleToBMPWithOffsets(pArgs, pErrorCode); -// } else { -// ucnv_MBCSSingleToUnicodeWithOffsets(pArgs, pErrorCode); -// } -// return; -// } - -// /* set up the local pointers */ -// source=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; -// target=pArgs->target; -// targetLimit=pArgs->targetLimit; -// offsets=pArgs->offsets; - -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable; -// } else { -// stateTable=cnv->sharedData->mbcs.stateTable; -// } -// unicodeCodeUnits=cnv->sharedData->mbcs.unicodeCodeUnits; - -// /* get the converter state from UConverter */ -// offset=cnv->toUnicodeStatus; -// byteIndex=cnv->toULength; -// bytes=cnv->toUBytes; - -// /* -// * if we are in the SBCS state for a DBCS-only converter, -// * then load the DBCS state from the MBCS data -// * (dbcsOnlyState==0 if it is not a DBCS-only converter) -// */ -// if((state=(uint8_t)(cnv->mode))==0) { -// state=cnv->sharedData->mbcs.dbcsOnlyState; -// } - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex=byteIndex==0 ? 0 : -1; -// nextSourceIndex=0; - -// /* conversion loop */ -// while(source=targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } - -// if(byteIndex==0) { -// /* optimized loop for 1/2-byte input and BMP output */ -// if(offsets==NULL) { -// do { -// entry=stateTable[state][*source]; -// if(MBCS_ENTRY_IS_TRANSITION(entry)) { -// state=(uint8_t)MBCS_ENTRY_TRANSITION_STATE(entry); -// offset=MBCS_ENTRY_TRANSITION_OFFSET(entry); - -// ++source; -// if( source=sourceLimit) { -// break; -// } -// if(target>=targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } - -// ++nextSourceIndex; -// bytes[byteIndex++]=*source++; -// } else /* byteIndex>0 */ { -// ++nextSourceIndex; -// entry=stateTable[state][bytes[byteIndex++]=*source++]; -// } - -// if(MBCS_ENTRY_IS_TRANSITION(entry)) { -// state=(uint8_t)MBCS_ENTRY_TRANSITION_STATE(entry); -// offset+=MBCS_ENTRY_TRANSITION_OFFSET(entry); -// continue; -// } - -// /* save the previous state for proper extension mapping with SI/SO-stateful converters */ -// cnv->mode=state; - -// /* set the next state early so that we can reuse the entry variable */ -// state=(uint8_t)MBCS_ENTRY_FINAL_STATE(entry); /* typically 0 */ - -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if(action==MBCS_STATE_VALID_16) { -// offset+=MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[offset]; -// if(c<0xfffe) { -// /* output BMP code point */ -// *target++=c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// } else if(c==0xfffe) { -// if(UCNV_TO_U_USE_FALLBACK(cnv) && (entry=(int32_t)ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) { -// /* output fallback BMP code point */ -// *target++=(UChar)entry; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// } -// } else { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else if(action==MBCS_STATE_VALID_DIRECT_16) { -// /* output BMP code point */ -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// } else if(action==MBCS_STATE_VALID_16_PAIR) { -// offset+=MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[offset++]; -// if(c<0xd800) { -// /* output BMP code point below 0xd800 */ -// *target++=c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) { -// /* output roundtrip or fallback surrogate pair */ -// *target++=(UChar)(c&0xdbff); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// if(targetUCharErrorBuffer[0]=unicodeCodeUnits[offset]; -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; - -// offset=0; -// break; -// } -// } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) { -// /* output roundtrip BMP code point above 0xd800 or fallback BMP code point */ -// *target++=unicodeCodeUnits[offset]; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// } else if(c==0xffff) { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else if(action==MBCS_STATE_VALID_DIRECT_20 || -// (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv)) -// ) { -// entry=MBCS_ENTRY_FINAL_VALUE(entry); -// /* output surrogate pair */ -// *target++=(UChar)(0xd800|(UChar)(entry>>10)); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// c=(UChar)(0xdc00|(UChar)(entry&0x3ff)); -// if(targetUCharErrorBuffer[0]=c; -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; - -// offset=0; -// break; -// } -// } else if(action==MBCS_STATE_CHANGE_ONLY) { -// /* -// * This serves as a state change without any output. -// * It is useful for reading simple stateful encodings, -// * for example using just Shift-In/Shift-Out codes. -// * The 21 unused bits may later be used for more sophisticated -// * state transitions. -// */ -// if(cnv->sharedData->mbcs.dbcsOnlyState==0) { -// byteIndex=0; -// } else { -// /* SI/SO are illegal for DBCS-only conversion */ -// state=(uint8_t)(cnv->mode); /* restore the previous state */ - -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_16) { -// if(UCNV_TO_U_USE_FALLBACK(cnv)) { -// /* output BMP code point */ -// *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// byteIndex=0; -// } -// } else if(action==MBCS_STATE_UNASSIGNED) { -// /* just fall through */ -// } else if(action==MBCS_STATE_ILLEGAL) { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } else { -// /* reserved, must never occur */ -// byteIndex=0; -// } - -// /* end of action codes: prepare for a new character */ -// offset=0; - -// if(byteIndex==0) { -// sourceIndex=nextSourceIndex; -// } else if(U_FAILURE(*pErrorCode)) { -// /* callback(illegal) */ -// if(byteIndex>1) { -// /* -// * Ticket 5691: consistent illegal sequences: -// * - We include at least the first byte in the illegal sequence. -// * - If any of the non-initial bytes could be the start of a character, -// * we stop the illegal sequence before the first one of those. -// */ -// UBool isDBCSOnly=(UBool)(cnv->sharedData->mbcs.dbcsOnlyState!=0); -// int8_t i; -// for(i=1; -// isource); -// byteIndex=i; /* length of reported illegal byte sequence */ -// if(backOutDistance<=bytesFromThisBuffer) { -// source-=backOutDistance; -// } else { -// /* Back out bytes from the previous buffer: Need to replay them. */ -// cnv->preToULength=(int8_t)(bytesFromThisBuffer-backOutDistance); -// /* preToULength is negative! */ -// uprv_memcpy(cnv->preToU, bytes+i, -cnv->preToULength); -// source=(const uint8_t *)pArgs->source; -// } -// } -// } -// break; -// } else /* unassigned sequences indicated with byteIndex>0 */ { -// /* try an extension mapping */ -// pArgs->source=(const char *)source; -// byteIndex=_extToU(cnv, cnv->sharedData, -// byteIndex, &source, sourceLimit, -// &target, targetLimit, -// &offsets, sourceIndex, -// pArgs->flush, -// pErrorCode); -// sourceIndex=nextSourceIndex+=(int32_t)(source-(const uint8_t *)pArgs->source); - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// break; -// } -// } -// } - -// /* set the converter state back into UConverter */ -// cnv->toUnicodeStatus=offset; -// cnv->mode=state; -// cnv->toULength=byteIndex; - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// } - -// /* -// * This version of ucnv_MBCSGetNextUChar() is optimized for single-byte, single-state codepages. -// * We still need a conversion loop in case we find reserved action codes, which are to be ignored. -// */ -// static UChar32 -// ucnv_MBCSSingleGetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const int32_t (*stateTable)[256]; -// const uint8_t *source, *sourceLimit; - -// int32_t entry; -// uint8_t action; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// source=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable; -// } else { -// stateTable=cnv->sharedData->mbcs.stateTable; -// } - -// /* conversion loop */ -// while(sourcesource=(const char *)source; - -// if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) { -// /* output BMP code point */ -// return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// } - -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if( action==MBCS_STATE_VALID_DIRECT_20 || -// (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv)) -// ) { -// /* output supplementary code point */ -// return (UChar32)(MBCS_ENTRY_FINAL_VALUE(entry)+0x10000); -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_16) { -// if(UCNV_TO_U_USE_FALLBACK(cnv)) { -// /* output BMP code point */ -// return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// } -// } else if(action==MBCS_STATE_UNASSIGNED) { -// /* just fall through */ -// } else if(action==MBCS_STATE_ILLEGAL) { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } else { -// /* reserved, must never occur */ -// continue; -// } - -// if(U_FAILURE(*pErrorCode)) { -// /* callback(illegal) */ -// break; -// } else /* unassigned sequence */ { -// /* defer to the generic implementation */ -// pArgs->source=(const char *)source-1; -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } -// } - -// /* no output because of empty input or only state changes */ -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// return 0xffff; -// } - -// /* -// * Version of _MBCSToUnicodeWithOffsets() optimized for single-character -// * conversion without offset handling. -// * -// * When a character does not have a mapping to Unicode, then we return to the -// * generic ucnv_getNextUChar() code for extension/GB 18030 and error/callback -// * handling. -// * We also defer to the generic code in other complicated cases and have them -// * ultimately handled by _MBCSToUnicodeWithOffsets() itself. -// * -// * All normal mappings and errors are handled here. -// */ -// static UChar32 U_CALLCONV -// ucnv_MBCSGetNextUChar(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const uint8_t *source, *sourceLimit, *lastSource; - -// const int32_t (*stateTable)[256]; -// const uint16_t *unicodeCodeUnits; - -// uint32_t offset; -// uint8_t state; - -// int32_t entry; -// UChar32 c; -// uint8_t action; - -// /* use optimized function if possible */ -// cnv=pArgs->converter; - -// if(cnv->preToULength>0) { -// /* use the generic code in ucnv_getNextUChar() to continue with a partial match */ -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } - -// if(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SURROGATES) { -// /* -// * Using the generic ucnv_getNextUChar() code lets us deal correctly -// * with the rare case of a codepage that maps single surrogates -// * without adding the complexity to this already complicated function here. -// */ -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } else if(cnv->sharedData->mbcs.countStates==1) { -// return ucnv_MBCSSingleGetNextUChar(pArgs, pErrorCode); -// } - -// /* set up the local pointers */ -// source=lastSource=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; - -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// stateTable=(const int32_t (*)[256])cnv->sharedData->mbcs.swapLFNLStateTable; -// } else { -// stateTable=cnv->sharedData->mbcs.stateTable; -// } -// unicodeCodeUnits=cnv->sharedData->mbcs.unicodeCodeUnits; - -// /* get the converter state from UConverter */ -// offset=cnv->toUnicodeStatus; - -// /* -// * if we are in the SBCS state for a DBCS-only converter, -// * then load the DBCS state from the MBCS data -// * (dbcsOnlyState==0 if it is not a DBCS-only converter) -// */ -// if((state=(uint8_t)(cnv->mode))==0) { -// state=cnv->sharedData->mbcs.dbcsOnlyState; -// } - -// /* conversion loop */ -// c=U_SENTINEL; -// while(sourcemode=state; - -// /* set the next state early so that we can reuse the entry variable */ -// state=(uint8_t)MBCS_ENTRY_FINAL_STATE(entry); /* typically 0 */ - -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if(action==MBCS_STATE_VALID_DIRECT_16) { -// /* output BMP code point */ -// c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// break; -// } else if(action==MBCS_STATE_VALID_16) { -// offset+=MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[offset]; -// if(c<0xfffe) { -// /* output BMP code point */ -// break; -// } else if(c==0xfffe) { -// if(UCNV_TO_U_USE_FALLBACK(cnv) && (c=ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) { -// break; -// } -// } else { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else if(action==MBCS_STATE_VALID_16_PAIR) { -// offset+=MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[offset++]; -// if(c<0xd800) { -// /* output BMP code point below 0xd800 */ -// break; -// } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) { -// /* output roundtrip or fallback supplementary code point */ -// c=((c&0x3ff)<<10)+unicodeCodeUnits[offset]+(0x10000-0xdc00); -// break; -// } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) { -// /* output roundtrip BMP code point above 0xd800 or fallback BMP code point */ -// c=unicodeCodeUnits[offset]; -// break; -// } else if(c==0xffff) { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else if(action==MBCS_STATE_VALID_DIRECT_20 || -// (action==MBCS_STATE_FALLBACK_DIRECT_20 && UCNV_TO_U_USE_FALLBACK(cnv)) -// ) { -// /* output supplementary code point */ -// c=(UChar32)(MBCS_ENTRY_FINAL_VALUE(entry)+0x10000); -// break; -// } else if(action==MBCS_STATE_CHANGE_ONLY) { -// /* -// * This serves as a state change without any output. -// * It is useful for reading simple stateful encodings, -// * for example using just Shift-In/Shift-Out codes. -// * The 21 unused bits may later be used for more sophisticated -// * state transitions. -// */ -// if(cnv->sharedData->mbcs.dbcsOnlyState!=0) { -// /* SI/SO are illegal for DBCS-only conversion */ -// state=(uint8_t)(cnv->mode); /* restore the previous state */ - -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_16) { -// if(UCNV_TO_U_USE_FALLBACK(cnv)) { -// /* output BMP code point */ -// c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// break; -// } -// } else if(action==MBCS_STATE_UNASSIGNED) { -// /* just fall through */ -// } else if(action==MBCS_STATE_ILLEGAL) { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// } else { -// /* reserved (must never occur), or only state change */ -// offset=0; -// lastSource=source; -// continue; -// } - -// /* end of action codes: prepare for a new character */ -// offset=0; - -// if(U_FAILURE(*pErrorCode)) { -// /* callback(illegal) */ -// break; -// } else /* unassigned sequence */ { -// /* defer to the generic implementation */ -// cnv->toUnicodeStatus=0; -// cnv->mode=state; -// pArgs->source=(const char *)lastSource; -// return UCNV_GET_NEXT_UCHAR_USE_TO_U; -// } -// } -// } - -// if(c<0) { -// if(U_SUCCESS(*pErrorCode) && source==sourceLimit && lastSourcetoUBytes; -// cnv->toULength=(int8_t)(source-lastSource); -// do { -// *bytes++=*lastSource++; -// } while(lastSourcesharedData->mbcs.dbcsOnlyState!=0); -// uint8_t *bytes=cnv->toUBytes; -// *bytes++=*lastSource++; /* first byte */ -// if(lastSource==source) { -// cnv->toULength=1; -// } else /* lastSourcetoULength=i; -// source=lastSource; -// } -// } else { -// /* no output because of empty input or only state changes */ -// *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; -// } -// c=0xffff; -// } - -// /* set the converter state back into UConverter, ready for a new character */ -// cnv->toUnicodeStatus=0; -// cnv->mode=state; - -// /* write back the updated pointer */ -// pArgs->source=(const char *)source; -// return c; -// } - -// #if 0 -// /* -// * Code disabled 2002dec09 (ICU 2.4) because it is not currently used in ICU. markus -// * Removal improves code coverage. -// */ -// /** -// * This version of ucnv_MBCSSimpleGetNextUChar() is optimized for single-byte, single-state codepages. -// * It does not handle the EBCDIC swaplfnl option (set in UConverter). -// * It does not handle conversion extensions (_extToU()). -// */ -// U_CFUNC UChar32 -// ucnv_MBCSSingleSimpleGetNextUChar(UConverterSharedData *sharedData, -// uint8_t b, UBool useFallback) { -// int32_t entry; -// uint8_t action; - -// entry=sharedData->mbcs.stateTable[0][b]; -// /* MBCS_ENTRY_IS_FINAL(entry) */ - -// if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) { -// /* output BMP code point */ -// return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// } - -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if(action==MBCS_STATE_VALID_DIRECT_20) { -// /* output supplementary code point */ -// return 0x10000+MBCS_ENTRY_FINAL_VALUE(entry); -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_16) { -// if(!TO_U_USE_FALLBACK(useFallback)) { -// return 0xfffe; -// } -// /* output BMP code point */ -// return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_20) { -// if(!TO_U_USE_FALLBACK(useFallback)) { -// return 0xfffe; -// } -// /* output supplementary code point */ -// return 0x10000+MBCS_ENTRY_FINAL_VALUE(entry); -// } else if(action==MBCS_STATE_UNASSIGNED) { -// return 0xfffe; -// } else if(action==MBCS_STATE_ILLEGAL) { -// return 0xffff; -// } else { -// /* reserved, must never occur */ -// return 0xffff; -// } -// } -// #endif - -// /* -// * This is a simple version of _MBCSGetNextUChar() that is used -// * by other converter implementations. -// * It only returns an "assigned" result if it consumes the entire input. -// * It does not use state from the converter, nor error codes. -// * It does not handle the EBCDIC swaplfnl option (set in UConverter). -// * It handles conversion extensions but not GB 18030. -// * -// * Return value: -// * U+fffe unassigned -// * U+ffff illegal -// * otherwise the Unicode code point -// */ -// U_CFUNC UChar32 -// ucnv_MBCSSimpleGetNextUChar(UConverterSharedData *sharedData, -// const char *source, int32_t length, -// UBool useFallback) { -// const int32_t (*stateTable)[256]; -// const uint16_t *unicodeCodeUnits; - -// uint32_t offset; -// uint8_t state, action; - -// UChar32 c; -// int32_t i, entry; - -// if(length<=0) { -// /* no input at all: "illegal" */ -// return 0xffff; -// } - -// #if 0 -// /* -// * Code disabled 2002dec09 (ICU 2.4) because it is not currently used in ICU. markus -// * TODO In future releases, verify that this function is never called for SBCS -// * conversions, i.e., that sharedData->mbcs.countStates==1 is still true. -// * Removal improves code coverage. -// */ -// /* use optimized function if possible */ -// if(sharedData->mbcs.countStates==1) { -// if(length==1) { -// return ucnv_MBCSSingleSimpleGetNextUChar(sharedData, (uint8_t)*source, useFallback); -// } else { -// return 0xffff; /* illegal: more than a single byte for an SBCS converter */ -// } -// } -// #endif - -// /* set up the local pointers */ -// stateTable=sharedData->mbcs.stateTable; -// unicodeCodeUnits=sharedData->mbcs.unicodeCodeUnits; - -// /* converter state */ -// offset=0; -// state=sharedData->mbcs.dbcsOnlyState; - -// /* conversion loop */ -// for(i=0;;) { -// entry=stateTable[state][(uint8_t)source[i++]]; -// if(MBCS_ENTRY_IS_TRANSITION(entry)) { -// state=(uint8_t)MBCS_ENTRY_TRANSITION_STATE(entry); -// offset+=MBCS_ENTRY_TRANSITION_OFFSET(entry); - -// if(i==length) { -// return 0xffff; /* truncated character */ -// } -// } else { -// /* -// * An if-else-if chain provides more reliable performance for -// * the most common cases compared to a switch. -// */ -// action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry)); -// if(action==MBCS_STATE_VALID_16) { -// offset+=MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[offset]; -// if(c!=0xfffe) { -// /* done */ -// } else if(UCNV_TO_U_USE_FALLBACK(cnv)) { -// c=ucnv_MBCSGetFallback(&sharedData->mbcs, offset); -// /* else done with 0xfffe */ -// } -// break; -// } else if(action==MBCS_STATE_VALID_DIRECT_16) { -// /* output BMP code point */ -// c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// break; -// } else if(action==MBCS_STATE_VALID_16_PAIR) { -// offset+=MBCS_ENTRY_FINAL_VALUE_16(entry); -// c=unicodeCodeUnits[offset++]; -// if(c<0xd800) { -// /* output BMP code point below 0xd800 */ -// } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) { -// /* output roundtrip or fallback supplementary code point */ -// c=(UChar32)(((c&0x3ff)<<10)+unicodeCodeUnits[offset]+(0x10000-0xdc00)); -// } else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) { -// /* output roundtrip BMP code point above 0xd800 or fallback BMP code point */ -// c=unicodeCodeUnits[offset]; -// } else if(c==0xffff) { -// return 0xffff; -// } else { -// c=0xfffe; -// } -// break; -// } else if(action==MBCS_STATE_VALID_DIRECT_20) { -// /* output supplementary code point */ -// c=0x10000+MBCS_ENTRY_FINAL_VALUE(entry); -// break; -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_16) { -// if(!TO_U_USE_FALLBACK(useFallback)) { -// c=0xfffe; -// break; -// } -// /* output BMP code point */ -// c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry); -// break; -// } else if(action==MBCS_STATE_FALLBACK_DIRECT_20) { -// if(!TO_U_USE_FALLBACK(useFallback)) { -// c=0xfffe; -// break; -// } -// /* output supplementary code point */ -// c=0x10000+MBCS_ENTRY_FINAL_VALUE(entry); -// break; -// } else if(action==MBCS_STATE_UNASSIGNED) { -// c=0xfffe; -// break; -// } - -// /* -// * forbid MBCS_STATE_CHANGE_ONLY for this function, -// * and MBCS_STATE_ILLEGAL and reserved action codes -// */ -// return 0xffff; -// } -// } - -// if(i!=length) { -// /* illegal for this function: not all input consumed */ -// return 0xffff; -// } - -// if(c==0xfffe) { -// /* try an extension mapping */ -// const int32_t *cx=sharedData->mbcs.extIndexes; -// if(cx!=NULL) { -// return ucnv_extSimpleMatchToU(cx, source, length, useFallback); -// } -// } - -// return c; -// } - -// /* MBCS-from-Unicode conversion functions ----------------------------------- */ - -// /* This version of ucnv_MBCSFromUnicodeWithOffsets() is optimized for double-byte codepages. */ -// static void -// ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const UChar *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; -// int32_t *offsets; - -// const uint16_t *table; -// const uint16_t *mbcsIndex; -// const uint8_t *bytes; - -// UChar32 c; - -// int32_t sourceIndex, nextSourceIndex; - -// uint32_t stage2Entry; -// uint32_t asciiRoundtrips; -// uint32_t value; -// uint8_t unicodeMask; - -// /* use optimized function if possible */ -// cnv=pArgs->converter; -// unicodeMask=cnv->sharedData->mbcs.unicodeMask; - -// /* set up the local pointers */ -// source=pArgs->source; -// sourceLimit=pArgs->sourceLimit; -// target=(uint8_t *)pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// table=cnv->sharedData->mbcs.fromUnicodeTable; -// mbcsIndex=cnv->sharedData->mbcs.mbcsIndex; -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes; -// } else { -// bytes=cnv->sharedData->mbcs.fromUnicodeBytes; -// } -// asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips; - -// /* get the converter state from UConverter */ -// c=cnv->fromUChar32; - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex= c==0 ? 0 : -1; -// nextSourceIndex=0; - -// /* conversion loop */ -// if(c!=0 && targetCapacity>0) { -// goto getTrail; -// } - -// while(source0) { -// /* -// * Get a correct Unicode code point: -// * a single UChar for a BMP code point or -// * a matched surrogate pair for a "supplementary code point". -// */ -// c=*source++; -// ++nextSourceIndex; -// if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) { -// *target++=(uint8_t)c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// sourceIndex=nextSourceIndex; -// } -// --targetCapacity; -// c=0; -// continue; -// } -// /* -// * utf8Friendly table: Test for <=0xd7ff rather than <=MBCS_FAST_MAX -// * to avoid dealing with surrogates. -// * MBCS_FAST_MAX must be >=0xd7ff. -// */ -// if(c<=0xd7ff) { -// value=DBCS_RESULT_FROM_MOST_BMP(mbcsIndex, (const uint16_t *)bytes, c); -// /* There are only roundtrips (!=0) and no-mapping (==0) entries. */ -// if(value==0) { -// goto unassigned; -// } -// /* output the value */ -// } else { -// /* -// * This also tests if the codepage maps single surrogates. -// * If it does, then surrogates are not paired but mapped separately. -// * Note that in this case unmatched surrogates are not detected. -// */ -// if(U16_IS_SURROGATE(c) && !(unicodeMask&UCNV_HAS_SURROGATES)) { -// if(U16_IS_SURROGATE_LEAD(c)) { -// getTrail: -// if(sourcesource=source; -// c=_extFromU(cnv, cnv->sharedData, -// c, &source, sourceLimit, -// &target, target+targetCapacity, -// &offsets, sourceIndex, -// pArgs->flush, -// pErrorCode); -// nextSourceIndex+=(int32_t)(source-pArgs->source); - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// break; -// } else { -// /* a mapping was written to the target, continue */ - -// /* recalculate the targetCapacity after an extension mapping */ -// targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target); - -// /* normal end of conversion: prepare for a new character */ -// sourceIndex=nextSourceIndex; -// continue; -// } -// } -// } - -// /* write the output character bytes from value and length */ -// /* from the first if in the loop we know that targetCapacity>0 */ -// if(value<=0xff) { -// /* this is easy because we know that there is enough space */ -// *target++=(uint8_t)value; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// --targetCapacity; -// } else /* length==2 */ { -// *target++=(uint8_t)(value>>8); -// if(2<=targetCapacity) { -// *target++=(uint8_t)value; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// } -// targetCapacity-=2; -// } else { -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// cnv->charErrorBuffer[0]=(char)value; -// cnv->charErrorBufferLength=1; - -// /* target overflow */ -// targetCapacity=0; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// c=0; -// break; -// } -// } - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// sourceIndex=nextSourceIndex; -// continue; -// } else { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } - -// /* set the converter state back into UConverter */ -// cnv->fromUChar32=c; - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// pArgs->offsets=offsets; -// } - -// /* This version of ucnv_MBCSFromUnicodeWithOffsets() is optimized for single-byte codepages. */ -// static void -// ucnv_MBCSSingleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const UChar *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; -// int32_t *offsets; - -// const uint16_t *table; -// const uint16_t *results; - -// UChar32 c; - -// int32_t sourceIndex, nextSourceIndex; - -// uint16_t value, minValue; -// UBool hasSupplementary; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// source=pArgs->source; -// sourceLimit=pArgs->sourceLimit; -// target=(uint8_t *)pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// table=cnv->sharedData->mbcs.fromUnicodeTable; -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes; -// } else { -// results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes; -// } - -// if(cnv->useFallback) { -// /* use all roundtrip and fallback results */ -// minValue=0x800; -// } else { -// /* use only roundtrips and fallbacks from private-use characters */ -// minValue=0xc00; -// } -// hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY); - -// /* get the converter state from UConverter */ -// c=cnv->fromUChar32; - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex= c==0 ? 0 : -1; -// nextSourceIndex=0; - -// /* conversion loop */ -// if(c!=0 && targetCapacity>0) { -// goto getTrail; -// } - -// while(source0) { -// /* -// * Get a correct Unicode code point: -// * a single UChar for a BMP code point or -// * a matched surrogate pair for a "supplementary code point". -// */ -// c=*source++; -// ++nextSourceIndex; -// if(U16_IS_SURROGATE(c)) { -// if(U16_IS_SURROGATE_LEAD(c)) { -// getTrail: -// if(source=minValue) { -// /* assigned, write the output character bytes from value and length */ -// /* length==1 */ -// /* this is easy because we know that there is enough space */ -// *target++=(uint8_t)value; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// --targetCapacity; - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// sourceIndex=nextSourceIndex; -// } else { /* unassigned */ -// unassigned: -// /* try an extension mapping */ -// pArgs->source=source; -// c=_extFromU(cnv, cnv->sharedData, -// c, &source, sourceLimit, -// &target, target+targetCapacity, -// &offsets, sourceIndex, -// pArgs->flush, -// pErrorCode); -// nextSourceIndex+=(int32_t)(source-pArgs->source); - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// break; -// } else { -// /* a mapping was written to the target, continue */ - -// /* recalculate the targetCapacity after an extension mapping */ -// targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target); - -// /* normal end of conversion: prepare for a new character */ -// sourceIndex=nextSourceIndex; -// } -// } -// } else { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } - -// /* set the converter state back into UConverter */ -// cnv->fromUChar32=c; - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// pArgs->offsets=offsets; -// } - -// /* -// * This version of ucnv_MBCSFromUnicode() is optimized for single-byte codepages -// * that map only to and from the BMP. -// * In addition to single-byte/state optimizations, the offset calculations -// * become much easier. -// * It would be possible to use the sbcsIndex for UTF-8-friendly tables, -// * but measurements have shown that this diminishes performance -// * in more cases than it improves it. -// * See SVN revision 21013 (2007-feb-06) for the last version with #if switches -// * for various MBCS and SBCS optimizations. -// */ -// static void -// ucnv_MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const UChar *source, *sourceLimit, *lastSource; -// uint8_t *target; -// int32_t targetCapacity, length; -// int32_t *offsets; - -// const uint16_t *table; -// const uint16_t *results; - -// UChar32 c; - -// int32_t sourceIndex; - -// uint32_t asciiRoundtrips; -// uint16_t value, minValue; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// source=pArgs->source; -// sourceLimit=pArgs->sourceLimit; -// target=(uint8_t *)pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// table=cnv->sharedData->mbcs.fromUnicodeTable; -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes; -// } else { -// results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes; -// } -// asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips; - -// if(cnv->useFallback) { -// /* use all roundtrip and fallback results */ -// minValue=0x800; -// } else { -// /* use only roundtrips and fallbacks from private-use characters */ -// minValue=0xc00; -// } - -// /* get the converter state from UConverter */ -// c=cnv->fromUChar32; - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex= c==0 ? 0 : -1; -// lastSource=source; - -// /* -// * since the conversion here is 1:1 UChar:uint8_t, we need only one counter -// * for the minimum of the sourceLength and targetCapacity -// */ -// length=(int32_t)(sourceLimit-source); -// if(length0) { -// goto getTrail; -// } - -// #if MBCS_UNROLL_SINGLE_FROM_BMP -// /* unrolling makes it slower on Pentium III/Windows 2000?! */ -// /* unroll the loop with the most common case */ -// unrolled: -// if(targetCapacity>=4) { -// int32_t count, loops; -// uint16_t andedValues; - -// loops=count=targetCapacity>>2; -// do { -// c=*source++; -// andedValues=value=MBCS_SINGLE_RESULT_FROM_U(table, results, c); -// *target++=(uint8_t)value; -// c=*source++; -// andedValues&=value=MBCS_SINGLE_RESULT_FROM_U(table, results, c); -// *target++=(uint8_t)value; -// c=*source++; -// andedValues&=value=MBCS_SINGLE_RESULT_FROM_U(table, results, c); -// *target++=(uint8_t)value; -// c=*source++; -// andedValues&=value=MBCS_SINGLE_RESULT_FROM_U(table, results, c); -// *target++=(uint8_t)value; - -// /* were all 4 entries really valid? */ -// if(andedValues0); -// count=loops-count; -// targetCapacity-=4*count; - -// if(offsets!=NULL) { -// lastSource+=4*count; -// while(count>0) { -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// *offsets++=sourceIndex++; -// --count; -// } -// } - -// c=0; -// } -// #endif - -// while(targetCapacity>0) { -// /* -// * Get a correct Unicode code point: -// * a single UChar for a BMP code point or -// * a matched surrogate pair for a "supplementary code point". -// */ -// c=*source++; -// /* -// * Do not immediately check for single surrogates: -// * Assume that they are unassigned and check for them in that case. -// * This speeds up the conversion of assigned characters. -// */ -// /* convert the Unicode code point in c into codepage bytes */ -// if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) { -// *target++=(uint8_t)c; -// --targetCapacity; -// c=0; -// continue; -// } -// value=MBCS_SINGLE_RESULT_FROM_U(table, results, c); -// /* is this code point assigned, or do we use fallbacks? */ -// if(value>=minValue) { -// /* assigned, write the output character bytes from value and length */ -// /* length==1 */ -// /* this is easy because we know that there is enough space */ -// *target++=(uint8_t)value; -// --targetCapacity; - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// continue; -// } else if(!U16_IS_SURROGATE(c)) { -// /* normal, unassigned BMP character */ -// } else if(U16_IS_SURROGATE_LEAD(c)) { -// getTrail: -// if(sourceflush) { -// *pErrorCode=U_TRUNCATED_CHAR_FOUND; -// } -// break; -// } -// } else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// break; -// } - -// /* c does not have a mapping */ - -// /* get the number of code units for c to correctly advance sourceIndex */ -// length=U16_LENGTH(c); - -// /* set offsets since the start or the last extension */ -// if(offsets!=NULL) { -// int32_t count=(int32_t)(source-lastSource); - -// /* do not set the offset for this character */ -// count-=length; - -// while(count>0) { -// *offsets++=sourceIndex++; -// --count; -// } -// /* offsets and sourceIndex are now set for the current character */ -// } - -// /* try an extension mapping */ -// lastSource=source; -// c=_extFromU(cnv, cnv->sharedData, -// c, &source, sourceLimit, -// &target, (const uint8_t *)(pArgs->targetLimit), -// &offsets, sourceIndex, -// pArgs->flush, -// pErrorCode); -// sourceIndex+=length+(int32_t)(source-lastSource); -// lastSource=source; - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// break; -// } else { -// /* a mapping was written to the target, continue */ - -// /* recalculate the targetCapacity after an extension mapping */ -// targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target); -// length=(int32_t)(sourceLimit-source); -// if(length=(uint8_t *)pArgs->targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } - -// /* set offsets since the start or the last callback */ -// if(offsets!=NULL) { -// size_t count=source-lastSource; -// if (count > 0 && *pErrorCode == U_TRUNCATED_CHAR_FOUND) { -// /* -// Caller gave us a partial supplementary character, -// which this function couldn't convert in any case. -// The callback will handle the offset. -// */ -// count--; -// } -// while(count>0) { -// *offsets++=sourceIndex++; -// --count; -// } -// } - -// /* set the converter state back into UConverter */ -// cnv->fromUChar32=c; - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// pArgs->offsets=offsets; -// } - -// U_CFUNC void -// ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// const UChar *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; -// int32_t *offsets; - -// const uint16_t *table; -// const uint16_t *mbcsIndex; -// const uint8_t *p, *bytes; -// uint8_t outputType; - -// UChar32 c; - -// int32_t prevSourceIndex, sourceIndex, nextSourceIndex; - -// uint32_t stage2Entry; -// uint32_t asciiRoundtrips; -// uint32_t value; -// /* Shift-In and Shift-Out byte sequences differ by encoding scheme. */ -// uint8_t siBytes[2] = {0, 0}; -// uint8_t soBytes[2] = {0, 0}; -// uint8_t siLength, soLength; -// int32_t length = 0, prevLength; -// uint8_t unicodeMask; - -// cnv=pArgs->converter; - -// if(cnv->preFromUFirstCP>=0) { -// /* -// * pass sourceIndex=-1 because we continue from an earlier buffer -// * in the future, this may change with continuous offsets -// */ -// ucnv_extContinueMatchFromU(cnv, pArgs, -1, pErrorCode); - -// if(U_FAILURE(*pErrorCode) || cnv->preFromULength<0) { -// return; -// } -// } - -// /* use optimized function if possible */ -// outputType=cnv->sharedData->mbcs.outputType; -// unicodeMask=cnv->sharedData->mbcs.unicodeMask; -// if(outputType==MBCS_OUTPUT_1 && !(unicodeMask&UCNV_HAS_SURROGATES)) { -// if(!(unicodeMask&UCNV_HAS_SUPPLEMENTARY)) { -// ucnv_MBCSSingleFromBMPWithOffsets(pArgs, pErrorCode); -// } else { -// ucnv_MBCSSingleFromUnicodeWithOffsets(pArgs, pErrorCode); -// } -// return; -// } else if(outputType==MBCS_OUTPUT_2 && cnv->sharedData->mbcs.utf8Friendly) { -// ucnv_MBCSDoubleFromUnicodeWithOffsets(pArgs, pErrorCode); -// return; -// } - -// /* set up the local pointers */ -// source=pArgs->source; -// sourceLimit=pArgs->sourceLimit; -// target=(uint8_t *)pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// table=cnv->sharedData->mbcs.fromUnicodeTable; -// if(cnv->sharedData->mbcs.utf8Friendly) { -// mbcsIndex=cnv->sharedData->mbcs.mbcsIndex; -// } else { -// mbcsIndex=NULL; -// } -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes; -// } else { -// bytes=cnv->sharedData->mbcs.fromUnicodeBytes; -// } -// asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips; - -// /* get the converter state from UConverter */ -// c=cnv->fromUChar32; - -// if(outputType==MBCS_OUTPUT_2_SISO) { -// prevLength=cnv->fromUnicodeStatus; -// if(prevLength==0) { -// /* set the real value */ -// prevLength=1; -// } -// } else { -// /* prevent fromUnicodeStatus from being set to something non-0 */ -// prevLength=0; -// } - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// prevSourceIndex=-1; -// sourceIndex= c==0 ? 0 : -1; -// nextSourceIndex=0; - -// /* Get the SI/SO character for the converter */ -// siLength = static_cast(getSISOBytes(SI, cnv->options, siBytes)); -// soLength = static_cast(getSISOBytes(SO, cnv->options, soBytes)); - -// /* conversion loop */ -// /* -// * This is another piece of ugly code: -// * A goto into the loop if the converter state contains a first surrogate -// * from the previous function call. -// * It saves me to check in each loop iteration a check of if(c==0) -// * and duplicating the trail-surrogate-handling code in the else -// * branch of that check. -// * I could not find any other way to get around this other than -// * using a function call for the conversion and callback, which would -// * be even more inefficient. -// * -// * Markus Scherer 2000-jul-19 -// */ -// if(c!=0 && targetCapacity>0) { -// goto getTrail; -// } - -// while(source0) { -// /* -// * Get a correct Unicode code point: -// * a single UChar for a BMP code point or -// * a matched surrogate pair for a "supplementary code point". -// */ -// c=*source++; -// ++nextSourceIndex; -// if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) { -// *target++=(uint8_t)c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// prevSourceIndex=sourceIndex; -// sourceIndex=nextSourceIndex; -// } -// --targetCapacity; -// c=0; -// continue; -// } -// /* -// * utf8Friendly table: Test for <=0xd7ff rather than <=MBCS_FAST_MAX -// * to avoid dealing with surrogates. -// * MBCS_FAST_MAX must be >=0xd7ff. -// */ -// if(c<=0xd7ff && mbcsIndex!=NULL) { -// value=mbcsIndex[c>>6]; - -// /* get the bytes and the length for the output (copied from below and adapted for utf8Friendly data) */ -// /* There are only roundtrips (!=0) and no-mapping (==0) entries. */ -// switch(outputType) { -// case MBCS_OUTPUT_2: -// value=((const uint16_t *)bytes)[value +(c&0x3f)]; -// if(value<=0xff) { -// if(value==0) { -// goto unassigned; -// } else { -// length=1; -// } -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_2_SISO: -// /* 1/2-byte stateful with Shift-In/Shift-Out */ -// /* -// * Save the old state in the converter object -// * right here, then change the local prevLength state variable if necessary. -// * Then, if this character turns out to be unassigned or a fallback that -// * is not taken, the callback code must not save the new state in the converter -// * because the new state is for a character that is not output. -// * However, the callback must still restore the state from the converter -// * in case the callback function changed it for its output. -// */ -// cnv->fromUnicodeStatus=prevLength; /* save the old state */ -// value=((const uint16_t *)bytes)[value +(c&0x3f)]; -// if(value<=0xff) { -// if(value==0) { -// goto unassigned; -// } else if(prevLength<=1) { -// length=1; -// } else { -// /* change from double-byte mode to single-byte */ -// if (siLength == 1) { -// value|=(uint32_t)siBytes[0]<<8; -// length = 2; -// } else if (siLength == 2) { -// value|=(uint32_t)siBytes[1]<<8; -// value|=(uint32_t)siBytes[0]<<16; -// length = 3; -// } -// prevLength=1; -// } -// } else { -// if(prevLength==2) { -// length=2; -// } else { -// /* change from single-byte mode to double-byte */ -// if (soLength == 1) { -// value|=(uint32_t)soBytes[0]<<16; -// length = 3; -// } else if (soLength == 2) { -// value|=(uint32_t)soBytes[1]<<16; -// value|=(uint32_t)soBytes[0]<<24; -// length = 4; -// } -// prevLength=2; -// } -// } -// break; -// case MBCS_OUTPUT_DBCS_ONLY: -// /* table with single-byte results, but only DBCS mappings used */ -// value=((const uint16_t *)bytes)[value +(c&0x3f)]; -// if(value<=0xff) { -// /* no mapping or SBCS result, not taken for DBCS-only */ -// goto unassigned; -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_3: -// p=bytes+(value+(c&0x3f))*3; -// value=((uint32_t)*p<<16)|((uint32_t)p[1]<<8)|p[2]; -// if(value<=0xff) { -// if(value==0) { -// goto unassigned; -// } else { -// length=1; -// } -// } else if(value<=0xffff) { -// length=2; -// } else { -// length=3; -// } -// break; -// case MBCS_OUTPUT_4: -// value=((const uint32_t *)bytes)[value +(c&0x3f)]; -// if(value<=0xff) { -// if(value==0) { -// goto unassigned; -// } else { -// length=1; -// } -// } else if(value<=0xffff) { -// length=2; -// } else if(value<=0xffffff) { -// length=3; -// } else { -// length=4; -// } -// break; -// case MBCS_OUTPUT_3_EUC: -// value=((const uint16_t *)bytes)[value +(c&0x3f)]; -// /* EUC 16-bit fixed-length representation */ -// if(value<=0xff) { -// if(value==0) { -// goto unassigned; -// } else { -// length=1; -// } -// } else if((value&0x8000)==0) { -// value|=0x8e8000; -// length=3; -// } else if((value&0x80)==0) { -// value|=0x8f0080; -// length=3; -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_4_EUC: -// p=bytes+(value+(c&0x3f))*3; -// value=((uint32_t)*p<<16)|((uint32_t)p[1]<<8)|p[2]; -// /* EUC 16-bit fixed-length representation applied to the first two bytes */ -// if(value<=0xff) { -// if(value==0) { -// goto unassigned; -// } else { -// length=1; -// } -// } else if(value<=0xffff) { -// length=2; -// } else if((value&0x800000)==0) { -// value|=0x8e800000; -// length=4; -// } else if((value&0x8000)==0) { -// value|=0x8f008000; -// length=4; -// } else { -// length=3; -// } -// break; -// default: -// /* must not occur */ -// /* -// * To avoid compiler warnings that value & length may be -// * used without having been initialized, we set them here. -// * In reality, this is unreachable code. -// * Not having a default branch also causes warnings with -// * some compilers. -// */ -// value=0; -// length=0; -// break; -// } -// /* output the value */ -// } else { -// /* -// * This also tests if the codepage maps single surrogates. -// * If it does, then surrogates are not paired but mapped separately. -// * Note that in this case unmatched surrogates are not detected. -// */ -// if(U16_IS_SURROGATE(c) && !(unicodeMask&UCNV_HAS_SURROGATES)) { -// if(U16_IS_SURROGATE_LEAD(c)) { -// getTrail: -// if(sourcefromUnicodeStatus=prevLength; /* save the old state */ -// /* callback(unassigned) */ -// goto unassigned; -// } -// /* convert this supplementary code point */ -// /* exit this condition tree */ -// } else { -// /* this is an unmatched lead code unit (1st surrogate) */ -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } else { -// /* no more input */ -// break; -// } -// } else { -// /* this is an unmatched trail code unit (2nd surrogate) */ -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// break; -// } -// } - -// /* convert the Unicode code point in c into codepage bytes */ - -// /* -// * The basic lookup is a triple-stage compact array (trie) lookup. -// * For details see the beginning of this file. -// * -// * Single-byte codepages are handled with a different data structure -// * by _MBCSSingle... functions. -// * -// * The result consists of a 32-bit value from stage 2 and -// * a pointer to as many bytes as are stored per character. -// * The pointer points to the character's bytes in stage 3. -// * Bits 15..0 of the stage 2 entry contain the stage 3 index -// * for that pointer, while bits 31..16 are flags for which of -// * the 16 characters in the block are roundtrip-assigned. -// * -// * For 2-byte and 4-byte codepages, the bytes are stored as uint16_t -// * respectively as uint32_t, in the platform encoding. -// * For 3-byte codepages, the bytes are always stored in big-endian order. -// * -// * For EUC encodings that use only either 0x8e or 0x8f as the first -// * byte of their longest byte sequences, the first two bytes in -// * this third stage indicate with their 7th bits whether these bytes -// * are to be written directly or actually need to be preceeded by -// * one of the two Single-Shift codes. With this, the third stage -// * stores one byte fewer per character than the actual maximum length of -// * EUC byte sequences. -// * -// * Other than that, leading zero bytes are removed and the other -// * bytes output. A single zero byte may be output if the "assigned" -// * bit in stage 2 was on. -// * The data structure does not support zero byte output as a fallback, -// * and also does not allow output of leading zeros. -// */ -// stage2Entry=MBCS_STAGE_2_FROM_U(table, c); - -// /* get the bytes and the length for the output */ -// switch(outputType) { -// case MBCS_OUTPUT_2: -// value=MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, c); -// if(value<=0xff) { -// length=1; -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_2_SISO: -// /* 1/2-byte stateful with Shift-In/Shift-Out */ -// /* -// * Save the old state in the converter object -// * right here, then change the local prevLength state variable if necessary. -// * Then, if this character turns out to be unassigned or a fallback that -// * is not taken, the callback code must not save the new state in the converter -// * because the new state is for a character that is not output. -// * However, the callback must still restore the state from the converter -// * in case the callback function changed it for its output. -// */ -// cnv->fromUnicodeStatus=prevLength; /* save the old state */ -// value=MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, c); -// if(value<=0xff) { -// if(value==0 && MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c)==0) { -// /* no mapping, leave value==0 */ -// length=0; -// } else if(prevLength<=1) { -// length=1; -// } else { -// /* change from double-byte mode to single-byte */ -// if (siLength == 1) { -// value|=(uint32_t)siBytes[0]<<8; -// length = 2; -// } else if (siLength == 2) { -// value|=(uint32_t)siBytes[1]<<8; -// value|=(uint32_t)siBytes[0]<<16; -// length = 3; -// } -// prevLength=1; -// } -// } else { -// if(prevLength==2) { -// length=2; -// } else { -// /* change from single-byte mode to double-byte */ -// if (soLength == 1) { -// value|=(uint32_t)soBytes[0]<<16; -// length = 3; -// } else if (soLength == 2) { -// value|=(uint32_t)soBytes[1]<<16; -// value|=(uint32_t)soBytes[0]<<24; -// length = 4; -// } -// prevLength=2; -// } -// } -// break; -// case MBCS_OUTPUT_DBCS_ONLY: -// /* table with single-byte results, but only DBCS mappings used */ -// value=MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, c); -// if(value<=0xff) { -// /* no mapping or SBCS result, not taken for DBCS-only */ -// value=stage2Entry=0; /* stage2Entry=0 to reset roundtrip flags */ -// length=0; -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_3: -// p=MBCS_POINTER_3_FROM_STAGE_2(bytes, stage2Entry, c); -// value=((uint32_t)*p<<16)|((uint32_t)p[1]<<8)|p[2]; -// if(value<=0xff) { -// length=1; -// } else if(value<=0xffff) { -// length=2; -// } else { -// length=3; -// } -// break; -// case MBCS_OUTPUT_4: -// value=MBCS_VALUE_4_FROM_STAGE_2(bytes, stage2Entry, c); -// if(value<=0xff) { -// length=1; -// } else if(value<=0xffff) { -// length=2; -// } else if(value<=0xffffff) { -// length=3; -// } else { -// length=4; -// } -// break; -// case MBCS_OUTPUT_3_EUC: -// value=MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, c); -// /* EUC 16-bit fixed-length representation */ -// if(value<=0xff) { -// length=1; -// } else if((value&0x8000)==0) { -// value|=0x8e8000; -// length=3; -// } else if((value&0x80)==0) { -// value|=0x8f0080; -// length=3; -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_4_EUC: -// p=MBCS_POINTER_3_FROM_STAGE_2(bytes, stage2Entry, c); -// value=((uint32_t)*p<<16)|((uint32_t)p[1]<<8)|p[2]; -// /* EUC 16-bit fixed-length representation applied to the first two bytes */ -// if(value<=0xff) { -// length=1; -// } else if(value<=0xffff) { -// length=2; -// } else if((value&0x800000)==0) { -// value|=0x8e800000; -// length=4; -// } else if((value&0x8000)==0) { -// value|=0x8f008000; -// length=4; -// } else { -// length=3; -// } -// break; -// default: -// /* must not occur */ -// /* -// * To avoid compiler warnings that value & length may be -// * used without having been initialized, we set them here. -// * In reality, this is unreachable code. -// * Not having a default branch also causes warnings with -// * some compilers. -// */ -// value=stage2Entry=0; /* stage2Entry=0 to reset roundtrip flags */ -// length=0; -// break; -// } - -// /* is this code point assigned, or do we use fallbacks? */ -// if(!(MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c)!=0 || -// (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0)) -// ) { -// /* -// * We allow a 0 byte output if the "assigned" bit is set for this entry. -// * There is no way with this data structure for fallback output -// * to be a zero byte. -// */ - -// unassigned: -// /* try an extension mapping */ -// pArgs->source=source; -// c=_extFromU(cnv, cnv->sharedData, -// c, &source, sourceLimit, -// &target, target+targetCapacity, -// &offsets, sourceIndex, -// pArgs->flush, -// pErrorCode); -// nextSourceIndex+=(int32_t)(source-pArgs->source); -// prevLength=cnv->fromUnicodeStatus; /* restore SISO state */ - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// break; -// } else { -// /* a mapping was written to the target, continue */ - -// /* recalculate the targetCapacity after an extension mapping */ -// targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target); - -// /* normal end of conversion: prepare for a new character */ -// if(offsets!=NULL) { -// prevSourceIndex=sourceIndex; -// sourceIndex=nextSourceIndex; -// } -// continue; -// } -// } -// } - -// /* write the output character bytes from value and length */ -// /* from the first if in the loop we know that targetCapacity>0 */ -// if(length<=targetCapacity) { -// if(offsets==NULL) { -// switch(length) { -// /* each branch falls through to the next one */ -// case 4: -// *target++=(uint8_t)(value>>24); -// U_FALLTHROUGH; -// case 3: -// *target++=(uint8_t)(value>>16); -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(value>>8); -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)value; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// } else { -// switch(length) { -// /* each branch falls through to the next one */ -// case 4: -// *target++=(uint8_t)(value>>24); -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// case 3: -// *target++=(uint8_t)(value>>16); -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(value>>8); -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)value; -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// } -// targetCapacity-=length; -// } else { -// uint8_t *charErrorBuffer; - -// /* -// * We actually do this backwards here: -// * In order to save an intermediate variable, we output -// * first to the overflow buffer what does not fit into the -// * regular target. -// */ -// /* we know that 1<=targetCapacitycharErrorBuffer; -// switch(length) { -// /* each branch falls through to the next one */ -// case 3: -// *charErrorBuffer++=(uint8_t)(value>>16); -// U_FALLTHROUGH; -// case 2: -// *charErrorBuffer++=(uint8_t)(value>>8); -// U_FALLTHROUGH; -// case 1: -// *charErrorBuffer=(uint8_t)value; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// cnv->charErrorBufferLength=(int8_t)length; - -// /* now output what fits into the regular target */ -// value>>=8*length; /* length was reduced by targetCapacity */ -// switch(targetCapacity) { -// /* each branch falls through to the next one */ -// case 3: -// *target++=(uint8_t)(value>>16); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(value>>8); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)value; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } - -// /* target overflow */ -// targetCapacity=0; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// c=0; -// break; -// } - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// if(offsets!=NULL) { -// prevSourceIndex=sourceIndex; -// sourceIndex=nextSourceIndex; -// } -// continue; -// } else { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } - -// /* -// * the end of the input stream and detection of truncated input -// * are handled by the framework, but for EBCDIC_STATEFUL conversion -// * we need to emit an SI at the very end -// * -// * conditions: -// * successful -// * EBCDIC_STATEFUL in DBCS mode -// * end of input and no truncated input -// */ -// if( U_SUCCESS(*pErrorCode) && -// outputType==MBCS_OUTPUT_2_SISO && prevLength==2 && -// pArgs->flush && source>=sourceLimit && c==0 -// ) { -// /* EBCDIC_STATEFUL ending with DBCS: emit an SI to return the output stream to SBCS */ -// if(targetCapacity>0) { -// *target++=(uint8_t)siBytes[0]; -// if (siLength == 2) { -// if (targetCapacity<2) { -// cnv->charErrorBuffer[0]=(uint8_t)siBytes[1]; -// cnv->charErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } else { -// *target++=(uint8_t)siBytes[1]; -// } -// } -// if(offsets!=NULL) { -// /* set the last source character's index (sourceIndex points at sourceLimit now) */ -// *offsets++=prevSourceIndex; -// } -// } else { -// /* target is full */ -// cnv->charErrorBuffer[0]=(uint8_t)siBytes[0]; -// if (siLength == 2) { -// cnv->charErrorBuffer[1]=(uint8_t)siBytes[1]; -// } -// cnv->charErrorBufferLength=siLength; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// } -// prevLength=1; /* we switched into SBCS */ -// } - -// /* set the converter state back into UConverter */ -// cnv->fromUChar32=c; -// cnv->fromUnicodeStatus=prevLength; - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// pArgs->offsets=offsets; -// } - -// /* -// * This is another simple conversion function for internal use by other -// * conversion implementations. -// * It does not use the converter state nor call callbacks. -// * It does not handle the EBCDIC swaplfnl option (set in UConverter). -// * It handles conversion extensions but not GB 18030. -// * -// * It converts one single Unicode code point into codepage bytes, encoded -// * as one 32-bit value. The function returns the number of bytes in *pValue: -// * 1..4 the number of bytes in *pValue -// * 0 unassigned (*pValue undefined) -// * -1 illegal (currently not used, *pValue undefined) -// * -// * *pValue will contain the resulting bytes with the last byte in bits 7..0, -// * the second to last byte in bits 15..8, etc. -// * Currently, the function assumes but does not check that 0<=c<=0x10ffff. -// */ -// U_CFUNC int32_t -// ucnv_MBCSFromUChar32(UConverterSharedData *sharedData, -// UChar32 c, uint32_t *pValue, -// UBool useFallback) { -// const int32_t *cx; -// const uint16_t *table; -// #if 0 -// /* #if 0 because this is not currently used in ICU - reduce code, increase code coverage */ -// const uint8_t *p; -// #endif -// uint32_t stage2Entry; -// uint32_t value; -// int32_t length; - -// /* BMP-only codepages are stored without stage 1 entries for supplementary code points */ -// if(c<=0xffff || (sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY)) { -// table=sharedData->mbcs.fromUnicodeTable; - -// /* convert the Unicode code point in c into codepage bytes (same as in _MBCSFromUnicodeWithOffsets) */ -// if(sharedData->mbcs.outputType==MBCS_OUTPUT_1) { -// value=MBCS_SINGLE_RESULT_FROM_U(table, (uint16_t *)sharedData->mbcs.fromUnicodeBytes, c); -// /* is this code point assigned, or do we use fallbacks? */ -// if(useFallback ? value>=0x800 : value>=0xc00) { -// *pValue=value&0xff; -// return 1; -// } -// } else /* outputType!=MBCS_OUTPUT_1 */ { -// stage2Entry=MBCS_STAGE_2_FROM_U(table, c); - -// /* get the bytes and the length for the output */ -// switch(sharedData->mbcs.outputType) { -// case MBCS_OUTPUT_2: -// value=MBCS_VALUE_2_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// if(value<=0xff) { -// length=1; -// } else { -// length=2; -// } -// break; -// #if 0 -// /* #if 0 because this is not currently used in ICU - reduce code, increase code coverage */ -// case MBCS_OUTPUT_DBCS_ONLY: -// /* table with single-byte results, but only DBCS mappings used */ -// value=MBCS_VALUE_2_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// if(value<=0xff) { -// /* no mapping or SBCS result, not taken for DBCS-only */ -// value=stage2Entry=0; /* stage2Entry=0 to reset roundtrip flags */ -// length=0; -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_3: -// p=MBCS_POINTER_3_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// value=((uint32_t)*p<<16)|((uint32_t)p[1]<<8)|p[2]; -// if(value<=0xff) { -// length=1; -// } else if(value<=0xffff) { -// length=2; -// } else { -// length=3; -// } -// break; -// case MBCS_OUTPUT_4: -// value=MBCS_VALUE_4_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// if(value<=0xff) { -// length=1; -// } else if(value<=0xffff) { -// length=2; -// } else if(value<=0xffffff) { -// length=3; -// } else { -// length=4; -// } -// break; -// case MBCS_OUTPUT_3_EUC: -// value=MBCS_VALUE_2_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// /* EUC 16-bit fixed-length representation */ -// if(value<=0xff) { -// length=1; -// } else if((value&0x8000)==0) { -// value|=0x8e8000; -// length=3; -// } else if((value&0x80)==0) { -// value|=0x8f0080; -// length=3; -// } else { -// length=2; -// } -// break; -// case MBCS_OUTPUT_4_EUC: -// p=MBCS_POINTER_3_FROM_STAGE_2(sharedData->mbcs.fromUnicodeBytes, stage2Entry, c); -// value=((uint32_t)*p<<16)|((uint32_t)p[1]<<8)|p[2]; -// /* EUC 16-bit fixed-length representation applied to the first two bytes */ -// if(value<=0xff) { -// length=1; -// } else if(value<=0xffff) { -// length=2; -// } else if((value&0x800000)==0) { -// value|=0x8e800000; -// length=4; -// } else if((value&0x8000)==0) { -// value|=0x8f008000; -// length=4; -// } else { -// length=3; -// } -// break; -// #endif -// default: -// /* must not occur */ -// return -1; -// } - -// /* is this code point assigned, or do we use fallbacks? */ -// if( MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c) || -// (FROM_U_USE_FALLBACK(useFallback, c) && value!=0) -// ) { -// /* -// * We allow a 0 byte output if the "assigned" bit is set for this entry. -// * There is no way with this data structure for fallback output -// * to be a zero byte. -// */ -// /* assigned */ -// *pValue=value; -// return length; -// } -// } -// } - -// cx=sharedData->mbcs.extIndexes; -// if(cx!=NULL) { -// length=ucnv_extSimpleMatchFromU(cx, c, pValue, useFallback); -// return length>=0 ? length : -length; /* return abs(length); */ -// } - -// /* unassigned */ -// return 0; -// } - - -// #if 0 -// /* -// * This function has been moved to ucnv2022.c for inlining. -// * This implementation is here only for documentation purposes -// */ - -// /** -// * This version of ucnv_MBCSFromUChar32() is optimized for single-byte codepages. -// * It does not handle the EBCDIC swaplfnl option (set in UConverter). -// * It does not handle conversion extensions (_extFromU()). -// * -// * It returns the codepage byte for the code point, or -1 if it is unassigned. -// */ -// U_CFUNC int32_t -// ucnv_MBCSSingleFromUChar32(UConverterSharedData *sharedData, -// UChar32 c, -// UBool useFallback) { -// const uint16_t *table; -// int32_t value; - -// /* BMP-only codepages are stored without stage 1 entries for supplementary code points */ -// if(c>=0x10000 && !(sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY)) { -// return -1; -// } - -// /* convert the Unicode code point in c into codepage bytes (same as in _MBCSFromUnicodeWithOffsets) */ -// table=sharedData->mbcs.fromUnicodeTable; - -// /* get the byte for the output */ -// value=MBCS_SINGLE_RESULT_FROM_U(table, (uint16_t *)sharedData->mbcs.fromUnicodeBytes, c); -// /* is this code point assigned, or do we use fallbacks? */ -// if(useFallback ? value>=0x800 : value>=0xc00) { -// return value&0xff; -// } else { -// return -1; -// } -// } -// #endif - -// /* MBCS-from-UTF-8 conversion functions ------------------------------------- */ - -// /* offsets for n-byte UTF-8 sequences that were calculated with ((lead<<6)+trail)<<6+trail... */ -// static const UChar32 -// utf8_offsets[5]={ 0, 0, 0x3080, 0xE2080, 0x3C82080 }; - -// static void U_CALLCONV -// ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs, -// UConverterToUnicodeArgs *pToUArgs, -// UErrorCode *pErrorCode) { -// UConverter *utf8, *cnv; -// const uint8_t *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; - -// const uint16_t *table, *sbcsIndex; -// const uint16_t *results; - -// int8_t oldToULength, toULength, toULimit; - -// UChar32 c; -// uint8_t b, t1, t2; - -// uint32_t asciiRoundtrips; -// uint16_t value, minValue = 0; -// UBool hasSupplementary; - -// /* set up the local pointers */ -// utf8=pToUArgs->converter; -// cnv=pFromUArgs->converter; -// source=(uint8_t *)pToUArgs->source; -// sourceLimit=(uint8_t *)pToUArgs->sourceLimit; -// target=(uint8_t *)pFromUArgs->target; -// targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target); - -// table=cnv->sharedData->mbcs.fromUnicodeTable; -// sbcsIndex=cnv->sharedData->mbcs.sbcsIndex; -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes; -// } else { -// results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes; -// } -// asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips; - -// if(cnv->useFallback) { -// /* use all roundtrip and fallback results */ -// minValue=0x800; -// } else { -// /* use only roundtrips and fallbacks from private-use characters */ -// minValue=0xc00; -// } -// hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY); - -// /* get the converter state from the UTF-8 UConverter */ -// if(utf8->toULength > 0) { -// toULength=oldToULength=utf8->toULength; -// toULimit=(int8_t)utf8->mode; -// c=(UChar32)utf8->toUnicodeStatus; -// } else { -// toULength=oldToULength=toULimit=0; -// c = 0; -// } - -// // The conversion loop checks source0) { -// uint8_t b1=*(sourceLimit-1); -// if(U8_IS_SINGLE(b1)) { -// // common ASCII character -// } else if(U8_IS_TRAIL(b1) && length>=2) { -// uint8_t b2=*(sourceLimit-2); -// if(0xe0<=b2 && b2<0xf0 && U8_IS_VALID_LEAD3_AND_T1(b2, b1)) { -// // truncated 3-byte sequence -// sourceLimit-=2; -// } -// } else if(0xc2<=b1 && b1<0xf0) { -// // truncated 2- or 3-byte sequence -// --sourceLimit; -// } -// } -// } - -// if(c!=0 && targetCapacity>0) { -// utf8->toUnicodeStatus=0; -// utf8->toULength=0; -// goto moreBytes; -// /* -// * Note: We could avoid the goto by duplicating some of the moreBytes -// * code, but only up to the point of collecting a complete UTF-8 -// * sequence; then recurse for the toUBytes[toULength] -// * and then continue with normal conversion. -// * -// * If so, move this code to just after initializing the minimum -// * set of local variables for reading the UTF-8 input -// * (utf8, source, target, limits but not cnv, table, minValue, etc.). -// * -// * Potential advantages: -// * - avoid the goto -// * - oldToULength could become a local variable in just those code blocks -// * that deal with buffer boundaries -// * - possibly faster if the goto prevents some compiler optimizations -// * (this would need measuring to confirm) -// * Disadvantage: -// * - code duplication -// */ -// } - -// /* conversion loop */ -// while(source0) { -// b=*source++; -// if(U8_IS_SINGLE(b)) { -// /* convert ASCII */ -// if(IS_ASCII_ROUNDTRIP(b, asciiRoundtrips)) { -// *target++=(uint8_t)b; -// --targetCapacity; -// continue; -// } else { -// c=b; -// value=SBCS_RESULT_FROM_UTF8(sbcsIndex, results, 0, c); -// } -// } else { -// if(b<0xe0) { -// if( /* handle U+0080..U+07FF inline */ -// b>=0xc2 && -// (t1=(uint8_t)(*source-0x80)) <= 0x3f -// ) { -// c=b&0x1f; -// ++source; -// value=SBCS_RESULT_FROM_UTF8(sbcsIndex, results, c, t1); -// if(value>=minValue) { -// *target++=(uint8_t)value; -// --targetCapacity; -// continue; -// } else { -// c=(c<<6)|t1; -// } -// } else { -// c=-1; -// } -// } else if(b==0xe0) { -// if( /* handle U+0800..U+0FFF inline */ -// (t1=(uint8_t)(source[0]-0x80)) <= 0x3f && t1 >= 0x20 && -// (t2=(uint8_t)(source[1]-0x80)) <= 0x3f -// ) { -// c=t1; -// source+=2; -// value=SBCS_RESULT_FROM_UTF8(sbcsIndex, results, c, t2); -// if(value>=minValue) { -// *target++=(uint8_t)value; -// --targetCapacity; -// continue; -// } else { -// c=(c<<6)|t2; -// } -// } else { -// c=-1; -// } -// } else { -// c=-1; -// } - -// if(c<0) { -// /* handle "complicated" and error cases, and continuing partial characters */ -// oldToULength=0; -// toULength=1; -// toULimit=U8_COUNT_BYTES_NON_ASCII(b); -// c=b; -// moreBytes: -// while(toULengthsourceLimit) { -// b=*source; -// if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) { -// ++source; -// ++toULength; -// c=(c<<6)+b; -// } else { -// break; /* sequence too short, stop with toULengthtoUBytes[oldToULength++]=*source++; -// } -// utf8->toUnicodeStatus=c; -// utf8->toULength=toULength; -// utf8->mode=toULimit; -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// return; -// } -// } - -// if(toULength==toULimit) { -// c-=utf8_offsets[toULength]; -// if(toULength<=3) { /* BMP */ -// value=MBCS_SINGLE_RESULT_FROM_U(table, results, c); -// } else { -// /* supplementary code point */ -// if(!hasSupplementary) { -// /* BMP-only codepages are stored without stage 1 entries for supplementary code points */ -// value=0; -// } else { -// value=MBCS_SINGLE_RESULT_FROM_U(table, results, c); -// } -// } -// } else { -// /* error handling: illegal UTF-8 byte sequence */ -// source-=(toULength-oldToULength); -// while(oldToULengthtoUBytes[oldToULength++]=*source++; -// } -// utf8->toULength=toULength; -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return; -// } -// } -// } - -// if(value>=minValue) { -// /* output the mapping for c */ -// *target++=(uint8_t)value; -// --targetCapacity; -// } else { -// /* valueUTF-16->charset conversion. -// */ -// static const UChar nul=0; -// const UChar *noSource=&nul; -// c=_extFromU(cnv, cnv->sharedData, -// c, &noSource, noSource, -// &target, target+targetCapacity, -// NULL, -1, -// pFromUArgs->flush, -// pErrorCode); - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// cnv->fromUChar32=c; -// break; -// } else if(cnv->preFromUFirstCP>=0) { -// /* -// * Partial match, return and revert to pivoting. -// * In normal from-UTF-16 conversion, we would just continue -// * but then exit the loop because the extension match would -// * have consumed the source. -// */ -// *pErrorCode=U_USING_DEFAULT_WARNING; -// break; -// } else { -// /* a mapping was written to the target, continue */ - -// /* recalculate the targetCapacity after an extension mapping */ -// targetCapacity=(int32_t)(pFromUArgs->targetLimit-(char *)target); -// } -// } -// } else { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } - -// /* -// * The sourceLimit may have been adjusted before the conversion loop -// * to stop before a truncated sequence. -// * If so, then collect the truncated sequence now. -// */ -// if(U_SUCCESS(*pErrorCode) && -// cnv->preFromUFirstCP<0 && -// source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) { -// c=utf8->toUBytes[0]=b=*source++; -// toULength=1; -// toULimit=U8_COUNT_BYTES(b); -// while(sourcetoUBytes[toULength++]=b=*source++; -// c=(c<<6)+b; -// } -// utf8->toUnicodeStatus=c; -// utf8->toULength=toULength; -// utf8->mode=toULimit; -// } - -// /* write back the updated pointers */ -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// } - -// static void U_CALLCONV -// ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs, -// UConverterToUnicodeArgs *pToUArgs, -// UErrorCode *pErrorCode) { -// UConverter *utf8, *cnv; -// const uint8_t *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; - -// const uint16_t *table, *mbcsIndex; -// const uint16_t *results; - -// int8_t oldToULength, toULength, toULimit; - -// UChar32 c; -// uint8_t b, t1, t2; - -// uint32_t stage2Entry; -// uint32_t asciiRoundtrips; -// uint16_t value = 0; -// UBool hasSupplementary; - -// /* set up the local pointers */ -// utf8=pToUArgs->converter; -// cnv=pFromUArgs->converter; -// source=(uint8_t *)pToUArgs->source; -// sourceLimit=(uint8_t *)pToUArgs->sourceLimit; -// target=(uint8_t *)pFromUArgs->target; -// targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target); - -// table=cnv->sharedData->mbcs.fromUnicodeTable; -// mbcsIndex=cnv->sharedData->mbcs.mbcsIndex; -// if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) { -// results=(uint16_t *)cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes; -// } else { -// results=(uint16_t *)cnv->sharedData->mbcs.fromUnicodeBytes; -// } -// asciiRoundtrips=cnv->sharedData->mbcs.asciiRoundtrips; - -// hasSupplementary=(UBool)(cnv->sharedData->mbcs.unicodeMask&UCNV_HAS_SUPPLEMENTARY); - -// /* get the converter state from the UTF-8 UConverter */ -// if(utf8->toULength > 0) { -// toULength=oldToULength=utf8->toULength; -// toULimit=(int8_t)utf8->mode; -// c=(UChar32)utf8->toUnicodeStatus; -// } else { -// toULength=oldToULength=toULimit=0; -// c = 0; -// } - -// // The conversion loop checks source0) { -// uint8_t b1=*(sourceLimit-1); -// if(U8_IS_SINGLE(b1)) { -// // common ASCII character -// } else if(U8_IS_TRAIL(b1) && length>=2) { -// uint8_t b2=*(sourceLimit-2); -// if(0xe0<=b2 && b2<0xf0 && U8_IS_VALID_LEAD3_AND_T1(b2, b1)) { -// // truncated 3-byte sequence -// sourceLimit-=2; -// } -// } else if(0xc2<=b1 && b1<0xf0) { -// // truncated 2- or 3-byte sequence -// --sourceLimit; -// } -// } -// } - -// if(c!=0 && targetCapacity>0) { -// utf8->toUnicodeStatus=0; -// utf8->toULength=0; -// goto moreBytes; -// /* See note in ucnv_SBCSFromUTF8() about this goto. */ -// } - -// /* conversion loop */ -// while(source0) { -// b=*source++; -// if(U8_IS_SINGLE(b)) { -// /* convert ASCII */ -// if(IS_ASCII_ROUNDTRIP(b, asciiRoundtrips)) { -// *target++=b; -// --targetCapacity; -// continue; -// } else { -// value=DBCS_RESULT_FROM_UTF8(mbcsIndex, results, 0, b); -// if(value==0) { -// c=b; -// goto unassigned; -// } -// } -// } else { -// if(b>=0xe0) { -// if( /* handle U+0800..U+D7FF inline */ -// b<=0xed && // do not assume maxFastUChar>0xd7ff -// U8_IS_VALID_LEAD3_AND_T1(b, t1=source[0]) && -// (t2=(uint8_t)(source[1]-0x80)) <= 0x3f -// ) { -// c=((b&0xf)<<6)|(t1&0x3f); -// source+=2; -// value=DBCS_RESULT_FROM_UTF8(mbcsIndex, results, c, t2); -// if(value==0) { -// c=(c<<6)|t2; -// goto unassigned; -// } -// } else { -// c=-1; -// } -// } else { -// if( /* handle U+0080..U+07FF inline */ -// b>=0xc2 && -// (t1=(uint8_t)(*source-0x80)) <= 0x3f -// ) { -// c=b&0x1f; -// ++source; -// value=DBCS_RESULT_FROM_UTF8(mbcsIndex, results, c, t1); -// if(value==0) { -// c=(c<<6)|t1; -// goto unassigned; -// } -// } else { -// c=-1; -// } -// } - -// if(c<0) { -// /* handle "complicated" and error cases, and continuing partial characters */ -// oldToULength=0; -// toULength=1; -// toULimit=U8_COUNT_BYTES_NON_ASCII(b); -// c=b; -// moreBytes: -// while(toULengthsourceLimit) { -// b=*source; -// if(icu::UTF8::isValidTrail(c, b, toULength, toULimit)) { -// ++source; -// ++toULength; -// c=(c<<6)+b; -// } else { -// break; /* sequence too short, stop with toULengthtoUBytes[oldToULength++]=*source++; -// } -// utf8->toUnicodeStatus=c; -// utf8->toULength=toULength; -// utf8->mode=toULimit; -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// return; -// } -// } - -// if(toULength==toULimit) { -// c-=utf8_offsets[toULength]; -// if(toULength<=3) { /* BMP */ -// stage2Entry=MBCS_STAGE_2_FROM_U(table, c); -// } else { -// /* supplementary code point */ -// if(!hasSupplementary) { -// /* BMP-only codepages are stored without stage 1 entries for supplementary code points */ -// stage2Entry=0; -// } else { -// stage2Entry=MBCS_STAGE_2_FROM_U(table, c); -// } -// } -// } else { -// /* error handling: illegal UTF-8 byte sequence */ -// source-=(toULength-oldToULength); -// while(oldToULengthtoUBytes[oldToULength++]=*source++; -// } -// utf8->toULength=toULength; -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// return; -// } - -// /* get the bytes and the length for the output */ -// /* MBCS_OUTPUT_2 */ -// value=MBCS_VALUE_2_FROM_STAGE_2(results, stage2Entry, c); - -// /* is this code point assigned, or do we use fallbacks? */ -// if(!(MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c) || -// (UCNV_FROM_U_USE_FALLBACK(cnv, c) && value!=0)) -// ) { -// goto unassigned; -// } -// } -// } - -// /* write the output character bytes from value and length */ -// /* from the first if in the loop we know that targetCapacity>0 */ -// if(value<=0xff) { -// /* this is easy because we know that there is enough space */ -// *target++=(uint8_t)value; -// --targetCapacity; -// } else /* length==2 */ { -// *target++=(uint8_t)(value>>8); -// if(2<=targetCapacity) { -// *target++=(uint8_t)value; -// targetCapacity-=2; -// } else { -// cnv->charErrorBuffer[0]=(char)value; -// cnv->charErrorBufferLength=1; - -// /* target overflow */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } -// continue; - -// unassigned: -// { -// /* -// * Try an extension mapping. -// * Pass in no source because we don't have UTF-16 input. -// * If we have a partial match on c, we will return and revert -// * to UTF-8->UTF-16->charset conversion. -// */ -// static const UChar nul=0; -// const UChar *noSource=&nul; -// c=_extFromU(cnv, cnv->sharedData, -// c, &noSource, noSource, -// &target, target+targetCapacity, -// NULL, -1, -// pFromUArgs->flush, -// pErrorCode); - -// if(U_FAILURE(*pErrorCode)) { -// /* not mappable or buffer overflow */ -// cnv->fromUChar32=c; -// break; -// } else if(cnv->preFromUFirstCP>=0) { -// /* -// * Partial match, return and revert to pivoting. -// * In normal from-UTF-16 conversion, we would just continue -// * but then exit the loop because the extension match would -// * have consumed the source. -// */ -// *pErrorCode=U_USING_DEFAULT_WARNING; -// break; -// } else { -// /* a mapping was written to the target, continue */ - -// /* recalculate the targetCapacity after an extension mapping */ -// targetCapacity=(int32_t)(pFromUArgs->targetLimit-(char *)target); -// continue; -// } -// } -// } else { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// } - -// /* -// * The sourceLimit may have been adjusted before the conversion loop -// * to stop before a truncated sequence. -// * If so, then collect the truncated sequence now. -// */ -// if(U_SUCCESS(*pErrorCode) && -// cnv->preFromUFirstCP<0 && -// source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) { -// c=utf8->toUBytes[0]=b=*source++; -// toULength=1; -// toULimit=U8_COUNT_BYTES(b); -// while(sourcetoUBytes[toULength++]=b=*source++; -// c=(c<<6)+b; -// } -// utf8->toUnicodeStatus=c; -// utf8->toULength=toULength; -// utf8->mode=toULimit; -// } - -// /* write back the updated pointers */ -// pToUArgs->source=(char *)source; -// pFromUArgs->target=(char *)target; -// } - -// /* miscellaneous ------------------------------------------------------------ */ - -// static void U_CALLCONV -// ucnv_MBCSGetStarters(const UConverter* cnv, -// UBool starters[256], -// UErrorCode *) { -// const int32_t *state0; -// int i; - -// state0=cnv->sharedData->mbcs.stateTable[cnv->sharedData->mbcs.dbcsOnlyState]; -// for(i=0; i<256; ++i) { -// /* all bytes that cause a state transition from state 0 are lead bytes */ -// starters[i]= (UBool)MBCS_ENTRY_IS_TRANSITION(state0[i]); -// } -// } - -// /* -// * This is an internal function that allows other converter implementations -// * to check whether a byte is a lead byte. -// */ -// U_CFUNC UBool -// ucnv_MBCSIsLeadByte(UConverterSharedData *sharedData, char byte) { -// return (UBool)MBCS_ENTRY_IS_TRANSITION(sharedData->mbcs.stateTable[0][(uint8_t)byte]); -// } - -// static void U_CALLCONV -// ucnv_MBCSWriteSub(UConverterFromUnicodeArgs *pArgs, -// int32_t offsetIndex, -// UErrorCode *pErrorCode) { -// UConverter *cnv=pArgs->converter; -// char *p, *subchar; -// char buffer[4]; -// int32_t length; - -// /* first, select between subChar and subChar1 */ -// if( cnv->subChar1!=0 && -// (cnv->sharedData->mbcs.extIndexes!=NULL ? -// cnv->useSubChar1 : -// (cnv->invalidUCharBuffer[0]<=0xff)) -// ) { -// /* select subChar1 if it is set (not 0) and the unmappable Unicode code point is up to U+00ff (IBM MBCS behavior) */ -// subchar=(char *)&cnv->subChar1; -// length=1; -// } else { -// /* select subChar in all other cases */ -// subchar=(char *)cnv->subChars; -// length=cnv->subCharLen; -// } - -// /* reset the selector for the next code point */ -// cnv->useSubChar1=FALSE; - -// if (cnv->sharedData->mbcs.outputType == MBCS_OUTPUT_2_SISO) { -// p=buffer; - -// /* fromUnicodeStatus contains prevLength */ -// switch(length) { -// case 1: -// if(cnv->fromUnicodeStatus==2) { -// /* DBCS mode and SBCS sub char: change to SBCS */ -// cnv->fromUnicodeStatus=1; -// *p++=UCNV_SI; -// } -// *p++=subchar[0]; -// break; -// case 2: -// if(cnv->fromUnicodeStatus<=1) { -// /* SBCS mode and DBCS sub char: change to DBCS */ -// cnv->fromUnicodeStatus=2; -// *p++=UCNV_SO; -// } -// *p++=subchar[0]; -// *p++=subchar[1]; -// break; -// default: -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return; -// } -// subchar=buffer; -// length=(int32_t)(p-buffer); -// } - -// ucnv_cbFromUWriteBytes(pArgs, subchar, length, offsetIndex, pErrorCode); -// } - -// U_CFUNC UConverterType -// ucnv_MBCSGetType(const UConverter* converter) { -// /* SBCS, DBCS, and EBCDIC_STATEFUL are replaced by MBCS, but here we cheat a little */ -// if(converter->sharedData->mbcs.countStates==1) { -// return (UConverterType)UCNV_SBCS; -// } else if((converter->sharedData->mbcs.outputType&0xff)==MBCS_OUTPUT_2_SISO) { -// return (UConverterType)UCNV_EBCDIC_STATEFUL; -// } else if(converter->sharedData->staticData->minBytesPerChar==2 && converter->sharedData->staticData->maxBytesPerChar==2) { -// return (UConverterType)UCNV_DBCS; -// } -// return (UConverterType)UCNV_MBCS; -// } - -// #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.h b/src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.h index e69de29bb..c8f3b89a5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.h @@ -0,0 +1,605 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2000-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ucnvmbcs.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2000jul07 +* created by: Markus W. Scherer +*/ + +#ifndef __UCNVMBCS_H__ +#define __UCNVMBCS_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "ucnv_cnv.h" +#include "ucnv_ext.h" + +/** + * ICU conversion (.cnv) data file structure, following the usual UDataInfo + * header. + * + * Format version: 6.2 + * + * struct UConverterStaticData -- struct containing the converter name, IBM CCSID, + * min/max bytes per character, etc. + * see ucnv_bld.h + * + * -------------------- + * + * The static data is followed by conversionType-specific data structures. + * At the moment, there are only variations of MBCS converters. They all have + * the same toUnicode structures, while the fromUnicode structures for SBCS + * differ from those for other MBCS-style converters. + * + * _MBCSHeader.version 5 is optional and not backward-compatible + * (as usual for changes in the major version field). + * + * Versions 5.m work like versions 4.m except: + * - The _MBCSHeader has variable length (and is always longer than in version 4). + * See the struct _MBCSHeader further description below. + * - There is a set of flags which indicate further incompatible changes. + * (Reader code must reject the file if it does not recognize them all.) + * - In particular, one of these flags indicates that most of the fromUnicode + * data is missing and must be reconstituted from the toUnicode data + * and from the utf8Friendly mbcsIndex at load time. + * (This only works with a utf8Friendly table.) + * In this case, makeconv may increase maxFastUChar automatically to U+FFFF. + * + * The first of these versions is 5.3, which is like 4.3 except for the differences above. + * + * When possible, makeconv continues to generate version 4.m files. + * + * _MBCSHeader.version 5.4/4.4 supports "good one-way" mappings (|4) + * in the extension tables (fromUTableValues bit 30). See ucnv_ext.h for details. + * + * _MBCSHeader.version 4.3 optionally modifies the fromUnicode data structures + * slightly and optionally adds a table for conversion to MBCS (non-SBCS) + * charsets. + * + * The modifications are to make the data utf8Friendly. Not every 4.3 file + * file contains utf8Friendly data. + * It is utf8Friendly if _MBCSHeader.version[2]!=0. + * In this case, the data structures are utf8Friendly up to the code point + * maxFastUChar=((_MBCSHeader.version[2]<<8)|0xff) + * + * A utf8Friendly file has fromUnicode stage 3 entries for code points up to + * maxFastUChar allocated in blocks of 64 for indexing with the 6 bits from + * a UTF-8 trail byte. ASCII is allocated linearly with 128 contiguous entries. + * + * In addition, a utf8Friendly MBCS file contains an additional + * uint16_t mbcsIndex[(maxFastUChar+1)>>6]; + * which replaces the stage 1 and 2 tables for indexing with bits from the + * UTF-8 lead byte and middle trail byte. Unlike the older MBCS stage 2 table, + * the mbcsIndex does not contain roundtrip flags. Therefore, all fallbacks + * from code points up to maxFastUChar (and roundtrips to 0x00) are moved to + * the extension data structure. This also allows for faster roundtrip + * conversion from UTF-16. + * + * SBCS files do not contain an additional sbcsIndex[] array because the + * proportional size increase would be noticeable, but the runtime + * code builds one for the code point range for which the runtime conversion + * code is optimized. + * + * For SBCS, maxFastUChar should be at least U+0FFF. The initial makeconv + * implementation sets it to U+1FFF. Because the sbcsIndex is not stored in + * the file, a larger maxFastUChar only affects stage 3 block allocation size + * and is free in empty blocks. (Larger blocks with sparse contents cause larger + * files.) U+1FFF includes almost all of the small scripts. + * U+0FFF covers UTF-8 two-byte sequences and three-byte sequences starting with + * 0xe0. This includes most scripts with legacy SBCS charsets. + * The initial runtime implementation using 4.3 files only builds an sbcsIndex + * for code points up to U+0FFF. + * + * For MBCS, maxFastUChar should be at least U+D7FF (=initial value). + * This boundary is convenient because practically all of the commonly used + * characters are below it, and because it is the boundary to surrogate + * code points, above which special handling is necessary anyway. + * (Surrogate pair assembly for UTF-16, validity checking for UTF-8.) + * + * maxFastUChar could be up to U+FFFF to cover the whole BMP, which could be + * useful especially for conversion from UTF-8 when the input can be assumed + * to be valid, because the surrogate range would then not have to be + * checked. + * (With maxFastUChar=0xffff, makeconv would have to check for mbcsIndex value + * overflow because with the all-unassigned block 0 and nearly full mappings + * from the BMP it is theoretically possible that an index into stage 3 + * exceeds 16 bits.) + * + * _MBCSHeader.version 4.2 adds an optional conversion extension data structure. + * If it is present, then an ICU version reading header versions 4.0 or 4.1 + * will be able to use the base table and ignore the extension. + * + * The unicodeMask in the static data is part of the base table data structure. + * Especially, the UCNV_HAS_SUPPLEMENTARY flag determines the length of the + * fromUnicode stage 1 array. + * The static data unicodeMask refers only to the base table's properties if + * a base table is included. + * In an extension-only file, the static data unicodeMask is 0. + * The extension data indexes have a separate field with the unicodeMask flags. + * + * MBCS-style data structure following the static data. + * Offsets are counted in bytes from the beginning of the MBCS header structure. + * Details about usage in comments in ucnvmbcs.c. + * + * struct _MBCSHeader (see the definition in this header file below) + * contains 32-bit fields as follows: + * 8 values: + * 0 uint8_t[4] MBCS version in UVersionInfo format (currently 4.3.x.0) + * 1 uint32_t countStates + * 2 uint32_t countToUFallbacks + * 3 uint32_t offsetToUCodeUnits + * 4 uint32_t offsetFromUTable + * 5 uint32_t offsetFromUBytes + * 6 uint32_t flags, bits: + * 31.. 8 offsetExtension -- _MBCSHeader.version 4.2 (ICU 2.8) and higher + * 0 for older versions and if + * there is not extension structure + * 7.. 0 outputType + * 7 uint32_t fromUBytesLength -- _MBCSHeader.version 4.1 (ICU 2.4) and higher + * counts bytes in fromUBytes[] + * + * New and required in version 5: + * 8 uint32_t options, bits: + * 31..16 reserved for flags that can be added without breaking + * backward compatibility + * 15.. 6 reserved for flags whose addition will break + * backward compatibility + * 6 MBCS_OPT_FROM_U -- if set, + * then most of the fromUnicode data is omitted; + * fullStage2Length is present and the missing + * bottom part of stage 2 must be reconstituted from + * the toUnicode data; + * stage 3 is missing completely as well; + * not used for SBCS tables + * 5.. 0 length of the _MBCSHeader (number of uint32_t) + * + * New and optional in version 5: + * 9 uint32_t fullStage2Length: used if MBCS_OPT_FROM_U is set + * specifies the full length of stage 2 + * including the omitted part + * + * if(outputType==MBCS_OUTPUT_EXT_ONLY) { + * -- base table name for extension-only table + * char baseTableName[variable]; -- with NUL plus padding for 4-alignment + * + * -- all _MBCSHeader fields except for version and flags are 0 + * } else { + * -- normal base table with optional extension + * + * int32_t stateTable[countStates][256]; + * + * struct _MBCSToUFallback { (fallbacks are sorted by offset) + * uint32_t offset; + * UChar32 codePoint; + * } toUFallbacks[countToUFallbacks]; + * + * uint16_t unicodeCodeUnits[(offsetFromUTable-offsetToUCodeUnits)/2]; + * (padded to an even number of units) + * + * -- stage 1 tables + * if(staticData.unicodeMask&UCNV_HAS_SUPPLEMENTARY) { + * -- stage 1 table for all of Unicode + * uint16_t fromUTable[0x440]; (32-bit-aligned) + * } else { + * -- BMP-only tables have a smaller stage 1 table + * uint16_t fromUTable[0x40]; (32-bit-aligned) + * } + * + * -- stage 2 tables + * length determined by top of stage 1 and bottom of stage 3 tables + * if(outputType==MBCS_OUTPUT_1) { + * -- SBCS: pure indexes + * uint16_t stage 2 indexes[?]; + * } else { + * -- DBCS, MBCS, EBCDIC_STATEFUL, ...: roundtrip flags and indexes + * uint32_t stage 2 flags and indexes[?]; + * if(options&MBCS_OPT_NO_FROM_U) { + * stage 2 really has length fullStage2Length + * and the omitted lower part must be reconstituted from + * the toUnicode data + * } + * } + * + * -- stage 3 tables with byte results + * if(outputType==MBCS_OUTPUT_1) { + * -- SBCS: each 16-bit result contains flags and the result byte, see ucnvmbcs.c + * uint16_t fromUBytes[fromUBytesLength/2]; + * } else if(!(options&MBCS_OPT_NO_FROM_U)) { + * -- DBCS, MBCS, EBCDIC_STATEFUL, ... 2/3/4 bytes result, see ucnvmbcs.c + * uint8_t fromUBytes[fromUBytesLength]; or + * uint16_t fromUBytes[fromUBytesLength/2]; or + * uint32_t fromUBytes[fromUBytesLength/4]; + * } else { + * fromUBytes[] must be reconstituted from the toUnicode data + * } + * + * -- optional utf8Friendly mbcsIndex -- _MBCSHeader.version 4.3 (ICU 3.8) and higher + * if(outputType!=MBCS_OUTPUT_1 && + * _MBCSHeader.version[1]>=3 && + * (maxFastUChar=_MBCSHeader.version[2])!=0 + * ) { + * maxFastUChar=(maxFastUChar<<8)|0xff; + * uint16_t mbcsIndex[(maxFastUChar+1)>>6]; + * } + * } + * + * -- extension table, details see ucnv_ext.h + * int32_t indexes[>=32]; ... + */ + +/* MBCS converter data and state -------------------------------------------- */ + +enum { + MBCS_MAX_STATE_COUNT=128 +}; + +/** + * MBCS action codes for conversions to Unicode. + * These values are in bits 23..20 of the state table entries. + */ +enum { + MBCS_STATE_VALID_DIRECT_16, + MBCS_STATE_VALID_DIRECT_20, + + MBCS_STATE_FALLBACK_DIRECT_16, + MBCS_STATE_FALLBACK_DIRECT_20, + + MBCS_STATE_VALID_16, + MBCS_STATE_VALID_16_PAIR, + + MBCS_STATE_UNASSIGNED, + MBCS_STATE_ILLEGAL, + + MBCS_STATE_CHANGE_ONLY +}; + +/* Macros for state table entries */ +#define MBCS_ENTRY_TRANSITION(state, offset) (int32_t)(((int32_t)(state)<<24L)|(offset)) +#define MBCS_ENTRY_TRANSITION_SET_OFFSET(entry, offset) (int32_t)(((entry)&0xff000000)|(offset)) +#define MBCS_ENTRY_TRANSITION_ADD_OFFSET(entry, offset) (int32_t)((entry)+(offset)) + +#define MBCS_ENTRY_FINAL(state, action, value) (int32_t)(0x80000000|((int32_t)(state)<<24L)|((action)<<20L)|(value)) +#define MBCS_ENTRY_SET_FINAL(entry) (int32_t)((entry)|0x80000000) +#define MBCS_ENTRY_FINAL_SET_ACTION(entry, action) (int32_t)(((entry)&0xff0fffff)|((int32_t)(action)<<20L)) +#define MBCS_ENTRY_FINAL_SET_VALUE(entry, value) (int32_t)(((entry)&0xfff00000)|(value)) +#define MBCS_ENTRY_FINAL_SET_ACTION_VALUE(entry, action, value) (int32_t)(((entry)&0xff000000)|((int32_t)(action)<<20L)|(value)) + +#define MBCS_ENTRY_SET_STATE(entry, state) (int32_t)(((entry)&0x80ffffff)|((int32_t)(state)<<24L)) + +#define MBCS_ENTRY_STATE(entry) ((((uint32_t)entry)>>24)&0x7f) + +#define MBCS_ENTRY_IS_TRANSITION(entry) ((entry)>=0) +#define MBCS_ENTRY_IS_FINAL(entry) ((entry)<0) + +#define MBCS_ENTRY_TRANSITION_STATE(entry) (((uint32_t)entry)>>24) +#define MBCS_ENTRY_TRANSITION_OFFSET(entry) ((entry)&0xffffff) + +#define MBCS_ENTRY_FINAL_STATE(entry) ((((uint32_t)entry)>>24)&0x7f) +#define MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry) ((entry)<(int32_t)0x80100000) +#define MBCS_ENTRY_FINAL_ACTION(entry) ((((uint32_t)entry)>>20)&0xf) +#define MBCS_ENTRY_FINAL_VALUE(entry) ((entry)&0xfffff) +#define MBCS_ENTRY_FINAL_VALUE_16(entry) (uint16_t)(entry) + +#define IS_ASCII_ROUNDTRIP(b, asciiRoundtrips) (((asciiRoundtrips) & (1<<((b)>>2)))!=0) + +/* single-byte fromUnicode: get the 16-bit result word */ +#define MBCS_SINGLE_RESULT_FROM_U(table, results, c) (results)[ (table)[ (table)[(c)>>10] +(((c)>>4)&0x3f) ] +((c)&0xf) ] + +/* single-byte fromUnicode using the sbcsIndex */ +#define SBCS_RESULT_FROM_LOW_BMP(table, results, c) (results)[ (table)[(c)>>6] +((c)&0x3f) ] + +/* single-byte fromUTF8 using the sbcsIndex; l and t must be masked externally; can be l=0 and t<=0x7f */ +#define SBCS_RESULT_FROM_UTF8(table, results, l, t) (results)[ (table)[l] +(t) ] + +/* multi-byte fromUnicode: get the 32-bit stage 2 entry */ +#define MBCS_STAGE_2_FROM_U(table, c) ((const uint32_t *)(table))[ (table)[(c)>>10] +(((c)>>4)&0x3f) ] +#define MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c) ( ((stage2Entry) & ((uint32_t)1<< (16+((c)&0xf)) )) !=0) + +#define MBCS_VALUE_2_FROM_STAGE_2(bytes, stage2Entry, c) ((uint16_t *)(bytes))[16*(uint32_t)(uint16_t)(stage2Entry)+((c)&0xf)] +#define MBCS_VALUE_4_FROM_STAGE_2(bytes, stage2Entry, c) ((uint32_t *)(bytes))[16*(uint32_t)(uint16_t)(stage2Entry)+((c)&0xf)] + +#define MBCS_POINTER_3_FROM_STAGE_2(bytes, stage2Entry, c) ((bytes)+(16*(uint32_t)(uint16_t)(stage2Entry)+((c)&0xf))*3) + +/* double-byte fromUnicode using the mbcsIndex */ +#define DBCS_RESULT_FROM_MOST_BMP(table, results, c) (results)[ (table)[(c)>>6] +((c)&0x3f) ] + +/* double-byte fromUTF8 using the mbcsIndex; l and t1 combined into lt1; lt1 and t2 must be masked externally */ +#define DBCS_RESULT_FROM_UTF8(table, results, lt1, t2) (results)[ (table)[lt1] +(t2) ] + + +/** + * MBCS output types for conversions from Unicode. + * These per-converter types determine the storage method in stage 3 of the lookup table, + * mostly how many bytes are stored per entry. + */ +enum { + MBCS_OUTPUT_1, /* 0 */ + MBCS_OUTPUT_2, /* 1 */ + MBCS_OUTPUT_3, /* 2 */ + MBCS_OUTPUT_4, /* 3 */ + + MBCS_OUTPUT_3_EUC=8, /* 8 */ + MBCS_OUTPUT_4_EUC, /* 9 */ + + MBCS_OUTPUT_2_SISO=12, /* c */ + MBCS_OUTPUT_2_HZ, /* d */ + + MBCS_OUTPUT_EXT_ONLY, /* e */ + + MBCS_OUTPUT_COUNT, + + MBCS_OUTPUT_DBCS_ONLY=0xdb /* runtime-only type for DBCS-only handling of SISO tables */ +}; + +/** + * Fallbacks to Unicode are stored outside the normal state table and code point structures + * in a vector of items of this type. They are sorted by offset. + */ +typedef struct { + uint32_t offset; + UChar32 codePoint; +} _MBCSToUFallback; + +/** Constants for fast and UTF-8-friendly conversion. */ +enum { + SBCS_FAST_MAX=0x0fff, /* maximum code point with UTF-8-friendly SBCS runtime code, see makeconv SBCS_UTF8_MAX */ + SBCS_FAST_LIMIT=SBCS_FAST_MAX+1, /* =0x1000 */ + MBCS_FAST_MAX=0xd7ff, /* maximum code point with UTF-8-friendly MBCS runtime code, see makeconv MBCS_UTF8_MAX */ + MBCS_FAST_LIMIT=MBCS_FAST_MAX+1 /* =0xd800 */ +}; + +/** + * This is the MBCS part of the UConverterTable union (a runtime data structure). + * It keeps all the per-converter data and points into the loaded mapping tables. + * + * utf8Friendly data structures added with _MBCSHeader.version 4.3 + */ +typedef struct UConverterMBCSTable { + /* toUnicode */ + uint8_t countStates, dbcsOnlyState, stateTableOwned; + uint32_t countToUFallbacks; + + const int32_t (*stateTable)/*[countStates]*/[256]; + int32_t (*swapLFNLStateTable)/*[countStates]*/[256]; /* for swaplfnl */ + const uint16_t *unicodeCodeUnits/*[countUnicodeResults]*/; + const _MBCSToUFallback *toUFallbacks; + + /* fromUnicode */ + const uint16_t *fromUnicodeTable; + const uint16_t *mbcsIndex; /* for fast conversion from most of BMP to MBCS (utf8Friendly data) */ + uint16_t sbcsIndex[SBCS_FAST_LIMIT>>6]; /* for fast conversion from low BMP to SBCS (utf8Friendly data) */ + const uint8_t *fromUnicodeBytes; + uint8_t *swapLFNLFromUnicodeBytes; /* for swaplfnl */ + uint32_t fromUBytesLength; + uint8_t outputType, unicodeMask; + UBool utf8Friendly; /* for utf8Friendly data */ + UChar maxFastUChar; /* for utf8Friendly data */ + + /* roundtrips */ + uint32_t asciiRoundtrips; + + /* reconstituted data that was omitted from the .cnv file */ + uint8_t *reconstitutedData; + + /* converter name for swaplfnl */ + char *swapLFNLName; + + /* extension data */ + struct UConverterSharedData *baseSharedData; + const int32_t *extIndexes; +} UConverterMBCSTable; + +#define UCNV_MBCS_TABLE_INITIALIZER { \ + /* toUnicode */ \ + 0, 0, 0, \ + 0, \ + \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + \ + /* fromUnicode */ \ + NULL, \ + NULL, \ + { 0 }, \ + NULL, \ + NULL, \ + 0, \ + 0, 0, \ + false, \ + 0, \ + \ + /* roundtrips */ \ + 0, \ + \ + /* reconstituted data that was omitted from the .cnv file */ \ + NULL, \ + \ + /* converter name for swaplfnl */ \ + NULL, \ + \ + /* extension data */ \ + NULL, \ + NULL \ +} + +enum { + MBCS_OPT_LENGTH_MASK=0x3f, + MBCS_OPT_NO_FROM_U=0x40, + /* + * If any of the following options bits are set, + * then the file must be rejected. + */ + MBCS_OPT_INCOMPATIBLE_MASK=0xffc0, + /* + * Remove bits from this mask as more options are recognized + * by all implementations that use this constant. + */ + MBCS_OPT_UNKNOWN_INCOMPATIBLE_MASK=0xff80 +}; + +enum { + MBCS_HEADER_V4_LENGTH=8, + MBCS_HEADER_V5_MIN_LENGTH=9 +}; + +/** + * MBCS data header. See data format description above. + */ +typedef struct { + UVersionInfo version; + uint32_t countStates, + countToUFallbacks, + offsetToUCodeUnits, + offsetFromUTable, + offsetFromUBytes, + flags, + fromUBytesLength; + + /* new and required in version 5 */ + uint32_t options; + + /* new and optional in version 5; used if options&MBCS_OPT_NO_FROM_U */ + uint32_t fullStage2Length; /* number of 32-bit units */ +} _MBCSHeader; + +#define UCNV_MBCS_HEADER_INITIALIZER { { 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + +/* + * This is a simple version of _MBCSGetNextUChar() that is used + * by other converter implementations. + * It only returns an "assigned" result if it consumes the entire input. + * It does not use state from the converter, nor error codes. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * It handles conversion extensions but not GB 18030. + * + * Return value: + * U+fffe unassigned + * U+ffff illegal + * otherwise the Unicode code point + */ +U_CFUNC UChar32 +ucnv_MBCSSimpleGetNextUChar(UConverterSharedData *sharedData, + const char *source, int32_t length, + UBool useFallback); + +/** + * This version of _MBCSSimpleGetNextUChar() is optimized for single-byte, single-state codepages. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * It does not handle conversion extensions (_extToU()). + */ +U_CFUNC UChar32 +ucnv_MBCSSingleSimpleGetNextUChar(UConverterSharedData *sharedData, + uint8_t b, UBool useFallback); + +/** + * This macro version of _MBCSSingleSimpleGetNextUChar() gets a code point from a byte. + * It works for single-byte, single-state codepages that only map + * to and from BMP code points, and it always + * returns fallback values. + */ +#define _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(sharedData, b) \ + (UChar)MBCS_ENTRY_FINAL_VALUE_16((sharedData)->mbcs.stateTable[0][(uint8_t)(b)]) + +/** + * This is an internal function that allows other converter implementations + * to check whether a byte is a lead byte. + */ +U_CFUNC UBool +ucnv_MBCSIsLeadByte(UConverterSharedData *sharedData, char byte); + +/** This is a macro version of _MBCSIsLeadByte(). */ +#define _MBCS_IS_LEAD_BYTE(sharedData, byte) \ + (UBool)MBCS_ENTRY_IS_TRANSITION((sharedData)->mbcs.stateTable[0][(uint8_t)(byte)]) + +/* + * This is another simple conversion function for internal use by other + * conversion implementations. + * It does not use the converter state nor call callbacks. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * It handles conversion extensions but not GB 18030. + * + * It converts one single Unicode code point into codepage bytes, encoded + * as one 32-bit value. The function returns the number of bytes in *pValue: + * 1..4 the number of bytes in *pValue + * 0 unassigned (*pValue undefined) + * -1 illegal (currently not used, *pValue undefined) + * + * *pValue will contain the resulting bytes with the last byte in bits 7..0, + * the second to last byte in bits 15..8, etc. + * Currently, the function assumes but does not check that 0<=c<=0x10ffff. + */ +U_CFUNC int32_t +ucnv_MBCSFromUChar32(UConverterSharedData *sharedData, + UChar32 c, uint32_t *pValue, + UBool useFallback); + +/** + * This version of _MBCSFromUChar32() is optimized for single-byte codepages. + * It does not handle the EBCDIC swaplfnl option (set in UConverter). + * + * It returns the codepage byte for the code point, or -1 if it is unassigned. + */ +U_CFUNC int32_t +ucnv_MBCSSingleFromUChar32(UConverterSharedData *sharedData, + UChar32 c, + UBool useFallback); + +/** + * SBCS, DBCS, and EBCDIC_STATEFUL are replaced by MBCS, but + * we cheat a little about the type, returning the old types if appropriate. + */ +U_CFUNC UConverterType +ucnv_MBCSGetType(const UConverter* converter); + +U_CFUNC void +ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, + UErrorCode *pErrorCode); +U_CFUNC void +ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, + UErrorCode *pErrorCode); + +/* + * Internal function returning a UnicodeSet for toUnicode() conversion. + * Currently only used for ISO-2022-CN, and only handles roundtrip mappings. + * In the future, if we add support for fallback sets, this function + * needs to be updated. + * Handles extensions. + * Does not empty the set first. + */ +U_CFUNC void +ucnv_MBCSGetUnicodeSetForUnicode(const UConverterSharedData *sharedData, + const USetAdder *sa, + UConverterUnicodeSet which, + UErrorCode *pErrorCode); + +/* + * Same as ucnv_MBCSGetUnicodeSetForUnicode() but + * the set can be filtered by encoding scheme. + * Used by stateful converters which share regular conversion tables + * but only use a subset of their mappings. + */ +U_CFUNC void +ucnv_MBCSGetFilteredUnicodeSetForUnicode(const UConverterSharedData *sharedData, + const USetAdder *sa, + UConverterUnicodeSet which, + UConverterSetFilter filter, + UErrorCode *pErrorCode); + +#endif + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvscsu.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvscsu.cpp deleted file mode 100644 index 6ea392a3c..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnvscsu.cpp +++ /dev/null @@ -1,2045 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ****************************************************************************** -// * -// * Copyright (C) 2000-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ****************************************************************************** -// * file name: ucnvscsu.c -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2000nov18 -// * created by: Markus W. Scherer -// * -// * This is an implementation of the Standard Compression Scheme for Unicode -// * as defined in http://www.unicode.org/unicode/reports/tr6/ . -// * Reserved commands and window settings are treated as illegal sequences and -// * will result in callback calls. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION && !UCONFIG_ONLY_HTML_CONVERSION - -// #include "unicode/ucnv.h" -// #include "unicode/ucnv_cb.h" -// #include "unicode/utf16.h" -// #include "ucnv_bld.h" -// #include "ucnv_cnv.h" -// #include "cmemory.h" - -// /* SCSU definitions --------------------------------------------------------- */ - -// /* SCSU command byte values */ -// enum { -// SQ0=0x01, /* Quote from window pair 0 */ -// SQ7=0x08, /* Quote from window pair 7 */ -// SDX=0x0B, /* Define a window as extended */ -// Srs=0x0C, /* reserved */ -// SQU=0x0E, /* Quote a single Unicode character */ -// SCU=0x0F, /* Change to Unicode mode */ -// SC0=0x10, /* Select window 0 */ -// SC7=0x17, /* Select window 7 */ -// SD0=0x18, /* Define and select window 0 */ -// SD7=0x1F, /* Define and select window 7 */ - -// UC0=0xE0, /* Select window 0 */ -// UC7=0xE7, /* Select window 7 */ -// UD0=0xE8, /* Define and select window 0 */ -// UD7=0xEF, /* Define and select window 7 */ -// UQU=0xF0, /* Quote a single Unicode character */ -// UDX=0xF1, /* Define a Window as extended */ -// Urs=0xF2 /* reserved */ -// }; - -// enum { -// /* -// * Unicode code points from 3400 to E000 are not adressible by -// * dynamic window, since in these areas no short run alphabets are -// * found. Therefore add gapOffset to all values from gapThreshold. -// */ -// gapThreshold=0x68, -// gapOffset=0xAC00, - -// /* values between reservedStart and fixedThreshold are reserved */ -// reservedStart=0xA8, - -// /* use table of predefined fixed offsets for values from fixedThreshold */ -// fixedThreshold=0xF9 -// }; - -// /* constant offsets for the 8 static windows */ -// static const uint32_t staticOffsets[8]={ -// 0x0000, /* ASCII for quoted tags */ -// 0x0080, /* Latin - 1 Supplement (for access to punctuation) */ -// 0x0100, /* Latin Extended-A */ -// 0x0300, /* Combining Diacritical Marks */ -// 0x2000, /* General Punctuation */ -// 0x2080, /* Currency Symbols */ -// 0x2100, /* Letterlike Symbols and Number Forms */ -// 0x3000 /* CJK Symbols and punctuation */ -// }; - -// /* initial offsets for the 8 dynamic (sliding) windows */ -// static const uint32_t initialDynamicOffsets[8]={ -// 0x0080, /* Latin-1 */ -// 0x00C0, /* Latin Extended A */ -// 0x0400, /* Cyrillic */ -// 0x0600, /* Arabic */ -// 0x0900, /* Devanagari */ -// 0x3040, /* Hiragana */ -// 0x30A0, /* Katakana */ -// 0xFF00 /* Fullwidth ASCII */ -// }; - -// /* Table of fixed predefined Offsets */ -// static const uint32_t fixedOffsets[]={ -// /* 0xF9 */ 0x00C0, /* Latin-1 Letters + half of Latin Extended A */ -// /* 0xFA */ 0x0250, /* IPA extensions */ -// /* 0xFB */ 0x0370, /* Greek */ -// /* 0xFC */ 0x0530, /* Armenian */ -// /* 0xFD */ 0x3040, /* Hiragana */ -// /* 0xFE */ 0x30A0, /* Katakana */ -// /* 0xFF */ 0xFF60 /* Halfwidth Katakana */ -// }; - -// /* state values */ -// enum { -// readCommand, -// quotePairOne, -// quotePairTwo, -// quoteOne, -// definePairOne, -// definePairTwo, -// defineOne -// }; - -// typedef struct SCSUData { -// /* dynamic window offsets, intitialize to default values from initialDynamicOffsets */ -// uint32_t toUDynamicOffsets[8]; -// uint32_t fromUDynamicOffsets[8]; - -// /* state machine state - toUnicode */ -// UBool toUIsSingleByteMode; -// uint8_t toUState; -// int8_t toUQuoteWindow, toUDynamicWindow; -// uint8_t toUByteOne; -// uint8_t toUPadding[3]; - -// /* state machine state - fromUnicode */ -// UBool fromUIsSingleByteMode; -// int8_t fromUDynamicWindow; - -// /* -// * windowUse[] keeps track of the use of the dynamic windows: -// * At nextWindowUseIndex there is the least recently used window, -// * and the following windows (in a wrapping manner) are more and more -// * recently used. -// * At nextWindowUseIndex-1 there is the most recently used window. -// */ -// uint8_t locale; -// int8_t nextWindowUseIndex; -// int8_t windowUse[8]; -// } SCSUData; - -// static const int8_t initialWindowUse[8]={ 7, 0, 3, 2, 4, 5, 6, 1 }; -// static const int8_t initialWindowUse_ja[8]={ 3, 2, 4, 1, 0, 7, 5, 6 }; - -// enum { -// lGeneric, l_ja -// }; - -// /* SCSU setup functions ----------------------------------------------------- */ -// U_CDECL_BEGIN -// static void U_CALLCONV -// _SCSUReset(UConverter *cnv, UConverterResetChoice choice) { -// SCSUData *scsu=(SCSUData *)cnv->extraInfo; - -// if(choice<=UCNV_RESET_TO_UNICODE) { -// /* reset toUnicode */ -// uprv_memcpy(scsu->toUDynamicOffsets, initialDynamicOffsets, 32); - -// scsu->toUIsSingleByteMode=TRUE; -// scsu->toUState=readCommand; -// scsu->toUQuoteWindow=scsu->toUDynamicWindow=0; -// scsu->toUByteOne=0; - -// cnv->toULength=0; -// } -// if(choice!=UCNV_RESET_TO_UNICODE) { -// /* reset fromUnicode */ -// uprv_memcpy(scsu->fromUDynamicOffsets, initialDynamicOffsets, 32); - -// scsu->fromUIsSingleByteMode=TRUE; -// scsu->fromUDynamicWindow=0; - -// scsu->nextWindowUseIndex=0; -// switch(scsu->locale) { -// case l_ja: -// uprv_memcpy(scsu->windowUse, initialWindowUse_ja, 8); -// break; -// default: -// uprv_memcpy(scsu->windowUse, initialWindowUse, 8); -// break; -// } - -// cnv->fromUChar32=0; -// } -// } - -// static void U_CALLCONV -// _SCSUOpen(UConverter *cnv, -// UConverterLoadArgs *pArgs, -// UErrorCode *pErrorCode) { -// const char *locale=pArgs->locale; -// if(pArgs->onlyTestIsLoadable) { -// return; -// } -// cnv->extraInfo=uprv_malloc(sizeof(SCSUData)); -// if(cnv->extraInfo!=NULL) { -// if(locale!=NULL && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) { -// ((SCSUData *)cnv->extraInfo)->locale=l_ja; -// } else { -// ((SCSUData *)cnv->extraInfo)->locale=lGeneric; -// } -// _SCSUReset(cnv, UCNV_RESET_BOTH); -// } else { -// *pErrorCode=U_MEMORY_ALLOCATION_ERROR; -// } - -// /* Set the substitution character U+fffd as a Unicode string. */ -// cnv->subUChars[0]=0xfffd; -// cnv->subCharLen=-1; -// } - -// static void U_CALLCONV -// _SCSUClose(UConverter *cnv) { -// if(cnv->extraInfo!=NULL) { -// if(!cnv->isExtraLocal) { -// uprv_free(cnv->extraInfo); -// } -// cnv->extraInfo=NULL; -// } -// } - -// /* SCSU-to-Unicode conversion functions ------------------------------------- */ - -// static void U_CALLCONV -// _SCSUToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// SCSUData *scsu; -// const uint8_t *source, *sourceLimit; -// UChar *target; -// const UChar *targetLimit; -// int32_t *offsets; -// UBool isSingleByteMode; -// uint8_t state, byteOne; -// int8_t quoteWindow, dynamicWindow; - -// int32_t sourceIndex, nextSourceIndex; - -// uint8_t b; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// scsu=(SCSUData *)cnv->extraInfo; - -// source=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; -// target=pArgs->target; -// targetLimit=pArgs->targetLimit; -// offsets=pArgs->offsets; - -// /* get the state machine state */ -// isSingleByteMode=scsu->toUIsSingleByteMode; -// state=scsu->toUState; -// quoteWindow=scsu->toUQuoteWindow; -// dynamicWindow=scsu->toUDynamicWindow; -// byteOne=scsu->toUByteOne; - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex=state==readCommand ? 0 : -1; -// nextSourceIndex=0; - -// /* -// * conversion "loop" -// * -// * For performance, this is not a normal C loop. -// * Instead, there are two code blocks for the two SCSU modes. -// * The function branches to either one, and a change of the mode is done with a goto to -// * the other branch. -// * -// * Each branch has two conventional loops: -// * - a fast-path loop for the most common codes in the mode -// * - a loop for all other codes in the mode -// * When the fast-path runs into a code that it cannot handle, its loop ends and it -// * runs into the following loop to handle the other codes. -// * The end of the input or output buffer is also handled by the slower loop. -// * The slow loop jumps (goto) to the fast-path loop again as soon as possible. -// * -// * The callback handling is done by returning with an error code. -// * The conversion framework actually calls the callback function. -// */ -// if(isSingleByteMode) { -// /* fast path for single-byte mode */ -// if(state==readCommand) { -// fastSingle: -// while(source=0x20) { -// ++source; -// ++nextSourceIndex; -// if(b<=0x7f) { -// /* write US-ASCII graphic character or DEL */ -// *target++=(UChar)b; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// } else { -// /* write from dynamic window */ -// uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f); -// if(c<=0xffff) { -// *target++=(UChar)c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// } else { -// /* output surrogate pair */ -// *target++=(UChar)(0xd7c0+(c>>10)); -// if(targetUCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff)); -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// goto endloop; -// } -// } -// } -// sourceIndex=nextSourceIndex; -// } -// } - -// /* normal state machine for single-byte mode, minus handling for what fastSingle covers */ -// singleByteMode: -// while(source=targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// b=*source++; -// ++nextSourceIndex; -// switch(state) { -// case readCommand: -// /* redundant conditions are commented out */ -// /* here: b<0x20 because otherwise we would be in fastSingle */ -// if((1UL<toUBytes[0]=b; -// cnv->toULength=1; -// goto endloop; -// } - -// /* store the first byte of a multibyte sequence in toUBytes[] */ -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// break; -// case quotePairOne: -// byteOne=b; -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// state=quotePairTwo; -// break; -// case quotePairTwo: -// *target++=(UChar)((byteOne<<8)|b); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// sourceIndex=nextSourceIndex; -// state=readCommand; -// goto fastSingle; -// case quoteOne: -// if(b<0x80) { -// /* all static offsets are in the BMP */ -// *target++=(UChar)(staticOffsets[quoteWindow]+b); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// } else { -// /* write from dynamic window */ -// uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f); -// if(c<=0xffff) { -// *target++=(UChar)c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// } else { -// /* output surrogate pair */ -// *target++=(UChar)(0xd7c0+(c>>10)); -// if(targetUCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff)); -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// goto endloop; -// } -// } -// } -// sourceIndex=nextSourceIndex; -// state=readCommand; -// goto fastSingle; -// case definePairOne: -// dynamicWindow=(int8_t)((b>>5)&7); -// byteOne=(uint8_t)(b&0x1f); -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// state=definePairTwo; -// break; -// case definePairTwo: -// scsu->toUDynamicOffsets[dynamicWindow]=0x10000+(byteOne<<15UL | b<<7UL); -// sourceIndex=nextSourceIndex; -// state=readCommand; -// goto fastSingle; -// case defineOne: -// if(b==0) { -// /* callback(illegal): Reserved window offset value 0 */ -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// goto endloop; -// } else if(btoUDynamicOffsets[dynamicWindow]=b<<7UL; -// } else if((uint8_t)(b-gapThreshold)<(reservedStart-gapThreshold)) { -// scsu->toUDynamicOffsets[dynamicWindow]=(b<<7UL)+gapOffset; -// } else if(b>=fixedThreshold) { -// scsu->toUDynamicOffsets[dynamicWindow]=fixedOffsets[b-fixedThreshold]; -// } else { -// /* callback(illegal): Reserved window offset value 0xa8..0xf8 */ -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// goto endloop; -// } -// sourceIndex=nextSourceIndex; -// state=readCommand; -// goto fastSingle; -// } -// } -// } else { -// /* fast path for Unicode mode */ -// if(state==readCommand) { -// fastUnicode: -// while(source+1(Urs-UC0)) { -// *target++=(UChar)((b<<8)|source[1]); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// sourceIndex=nextSourceIndex; -// nextSourceIndex+=2; -// source+=2; -// } -// } - -// /* normal state machine for Unicode mode */ -// /* unicodeByteMode: */ -// while(source=targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// b=*source++; -// ++nextSourceIndex; -// switch(state) { -// case readCommand: -// if((uint8_t)(b-UC0)>(Urs-UC0)) { -// byteOne=b; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=quotePairTwo; -// } else if(/* UC0<=b && */ b<=UC7) { -// dynamicWindow=(int8_t)(b-UC0); -// sourceIndex=nextSourceIndex; -// isSingleByteMode=TRUE; -// goto fastSingle; -// } else if(/* UD0<=b && */ b<=UD7) { -// dynamicWindow=(int8_t)(b-UD0); -// isSingleByteMode=TRUE; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=defineOne; -// goto singleByteMode; -// } else if(b==UDX) { -// isSingleByteMode=TRUE; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=definePairOne; -// goto singleByteMode; -// } else if(b==UQU) { -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=quotePairOne; -// } else /* Urs */ { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// goto endloop; -// } -// break; -// case quotePairOne: -// byteOne=b; -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// state=quotePairTwo; -// break; -// case quotePairTwo: -// *target++=(UChar)((byteOne<<8)|b); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// sourceIndex=nextSourceIndex; -// state=readCommand; -// goto fastUnicode; -// } -// } -// } -// endloop: - -// /* set the converter state back into UConverter */ -// if(U_FAILURE(*pErrorCode) && *pErrorCode!=U_BUFFER_OVERFLOW_ERROR) { -// /* reset to deal with the next character */ -// state=readCommand; -// } else if(state==readCommand) { -// /* not in a multi-byte sequence, reset toULength */ -// cnv->toULength=0; -// } -// scsu->toUIsSingleByteMode=isSingleByteMode; -// scsu->toUState=state; -// scsu->toUQuoteWindow=quoteWindow; -// scsu->toUDynamicWindow=dynamicWindow; -// scsu->toUByteOne=byteOne; - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// pArgs->offsets=offsets; -// return; -// } - -// /* -// * Identical to _SCSUToUnicodeWithOffsets but without offset handling. -// * If a change is made in the original function, then either -// * change this function the same way or -// * re-copy the original function and remove the variables -// * offsets, sourceIndex, and nextSourceIndex. -// */ -// static void U_CALLCONV -// _SCSUToUnicode(UConverterToUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// SCSUData *scsu; -// const uint8_t *source, *sourceLimit; -// UChar *target; -// const UChar *targetLimit; -// UBool isSingleByteMode; -// uint8_t state, byteOne; -// int8_t quoteWindow, dynamicWindow; - -// uint8_t b; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// scsu=(SCSUData *)cnv->extraInfo; - -// source=(const uint8_t *)pArgs->source; -// sourceLimit=(const uint8_t *)pArgs->sourceLimit; -// target=pArgs->target; -// targetLimit=pArgs->targetLimit; - -// /* get the state machine state */ -// isSingleByteMode=scsu->toUIsSingleByteMode; -// state=scsu->toUState; -// quoteWindow=scsu->toUQuoteWindow; -// dynamicWindow=scsu->toUDynamicWindow; -// byteOne=scsu->toUByteOne; - -// /* -// * conversion "loop" -// * -// * For performance, this is not a normal C loop. -// * Instead, there are two code blocks for the two SCSU modes. -// * The function branches to either one, and a change of the mode is done with a goto to -// * the other branch. -// * -// * Each branch has two conventional loops: -// * - a fast-path loop for the most common codes in the mode -// * - a loop for all other codes in the mode -// * When the fast-path runs into a code that it cannot handle, its loop ends and it -// * runs into the following loop to handle the other codes. -// * The end of the input or output buffer is also handled by the slower loop. -// * The slow loop jumps (goto) to the fast-path loop again as soon as possible. -// * -// * The callback handling is done by returning with an error code. -// * The conversion framework actually calls the callback function. -// */ -// if(isSingleByteMode) { -// /* fast path for single-byte mode */ -// if(state==readCommand) { -// fastSingle: -// while(source=0x20) { -// ++source; -// if(b<=0x7f) { -// /* write US-ASCII graphic character or DEL */ -// *target++=(UChar)b; -// } else { -// /* write from dynamic window */ -// uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f); -// if(c<=0xffff) { -// *target++=(UChar)c; -// } else { -// /* output surrogate pair */ -// *target++=(UChar)(0xd7c0+(c>>10)); -// if(targetUCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff)); -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// goto endloop; -// } -// } -// } -// } -// } - -// /* normal state machine for single-byte mode, minus handling for what fastSingle covers */ -// singleByteMode: -// while(source=targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// b=*source++; -// switch(state) { -// case readCommand: -// /* redundant conditions are commented out */ -// /* here: b<0x20 because otherwise we would be in fastSingle */ -// if((1UL<toUBytes[0]=b; -// cnv->toULength=1; -// goto endloop; -// } - -// /* store the first byte of a multibyte sequence in toUBytes[] */ -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// break; -// case quotePairOne: -// byteOne=b; -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// state=quotePairTwo; -// break; -// case quotePairTwo: -// *target++=(UChar)((byteOne<<8)|b); -// state=readCommand; -// goto fastSingle; -// case quoteOne: -// if(b<0x80) { -// /* all static offsets are in the BMP */ -// *target++=(UChar)(staticOffsets[quoteWindow]+b); -// } else { -// /* write from dynamic window */ -// uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f); -// if(c<=0xffff) { -// *target++=(UChar)c; -// } else { -// /* output surrogate pair */ -// *target++=(UChar)(0xd7c0+(c>>10)); -// if(targetUCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff)); -// cnv->UCharErrorBufferLength=1; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// goto endloop; -// } -// } -// } -// state=readCommand; -// goto fastSingle; -// case definePairOne: -// dynamicWindow=(int8_t)((b>>5)&7); -// byteOne=(uint8_t)(b&0x1f); -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// state=definePairTwo; -// break; -// case definePairTwo: -// scsu->toUDynamicOffsets[dynamicWindow]=0x10000+(byteOne<<15UL | b<<7UL); -// state=readCommand; -// goto fastSingle; -// case defineOne: -// if(b==0) { -// /* callback(illegal): Reserved window offset value 0 */ -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// goto endloop; -// } else if(btoUDynamicOffsets[dynamicWindow]=b<<7UL; -// } else if((uint8_t)(b-gapThreshold)<(reservedStart-gapThreshold)) { -// scsu->toUDynamicOffsets[dynamicWindow]=(b<<7UL)+gapOffset; -// } else if(b>=fixedThreshold) { -// scsu->toUDynamicOffsets[dynamicWindow]=fixedOffsets[b-fixedThreshold]; -// } else { -// /* callback(illegal): Reserved window offset value 0xa8..0xf8 */ -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// goto endloop; -// } -// state=readCommand; -// goto fastSingle; -// } -// } -// } else { -// /* fast path for Unicode mode */ -// if(state==readCommand) { -// fastUnicode: -// while(source+1(Urs-UC0)) { -// *target++=(UChar)((b<<8)|source[1]); -// source+=2; -// } -// } - -// /* normal state machine for Unicode mode */ -// /* unicodeByteMode: */ -// while(source=targetLimit) { -// /* target is full */ -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// break; -// } -// b=*source++; -// switch(state) { -// case readCommand: -// if((uint8_t)(b-UC0)>(Urs-UC0)) { -// byteOne=b; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=quotePairTwo; -// } else if(/* UC0<=b && */ b<=UC7) { -// dynamicWindow=(int8_t)(b-UC0); -// isSingleByteMode=TRUE; -// goto fastSingle; -// } else if(/* UD0<=b && */ b<=UD7) { -// dynamicWindow=(int8_t)(b-UD0); -// isSingleByteMode=TRUE; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=defineOne; -// goto singleByteMode; -// } else if(b==UDX) { -// isSingleByteMode=TRUE; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=definePairOne; -// goto singleByteMode; -// } else if(b==UQU) { -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// state=quotePairOne; -// } else /* Urs */ { -// /* callback(illegal) */ -// *pErrorCode=U_ILLEGAL_CHAR_FOUND; -// cnv->toUBytes[0]=b; -// cnv->toULength=1; -// goto endloop; -// } -// break; -// case quotePairOne: -// byteOne=b; -// cnv->toUBytes[1]=b; -// cnv->toULength=2; -// state=quotePairTwo; -// break; -// case quotePairTwo: -// *target++=(UChar)((byteOne<<8)|b); -// state=readCommand; -// goto fastUnicode; -// } -// } -// } -// endloop: - -// /* set the converter state back into UConverter */ -// if(U_FAILURE(*pErrorCode) && *pErrorCode!=U_BUFFER_OVERFLOW_ERROR) { -// /* reset to deal with the next character */ -// state=readCommand; -// } else if(state==readCommand) { -// /* not in a multi-byte sequence, reset toULength */ -// cnv->toULength=0; -// } -// scsu->toUIsSingleByteMode=isSingleByteMode; -// scsu->toUState=state; -// scsu->toUQuoteWindow=quoteWindow; -// scsu->toUDynamicWindow=dynamicWindow; -// scsu->toUByteOne=byteOne; - -// /* write back the updated pointers */ -// pArgs->source=(const char *)source; -// pArgs->target=target; -// return; -// } -// U_CDECL_END -// /* SCSU-from-Unicode conversion functions ----------------------------------- */ - -// /* -// * This SCSU Encoder is fairly simple but uses all SCSU commands to achieve -// * reasonable results. The lookahead is minimal. -// * Many cases are simple: -// * A character fits directly into the current mode, a dynamic or static window, -// * or is not compressible. These cases are tested first. -// * Real compression heuristics are applied to the rest, in code branches for -// * single/Unicode mode and BMP/supplementary code points. -// * The heuristics used here are extremely simple. -// */ - -// /* get the number of the window that this character is in, or -1 */ -// static int8_t -// getWindow(const uint32_t offsets[8], uint32_t c) { -// int i; -// for(i=0; i<8; ++i) { -// if((uint32_t)(c-offsets[i])<=0x7f) { -// return (int8_t)(i); -// } -// } -// return -1; -// } - -// /* is the character in the dynamic window starting at the offset, or in the direct-encoded range? */ -// static UBool -// isInOffsetWindowOrDirect(uint32_t offset, uint32_t c) { -// return (UBool)(c<=offset+0x7f && -// (c>=offset || (c<=0x7f && -// (c>=0x20 || (1UL<windowUse[scsu->nextWindowUseIndex]; -// if(++scsu->nextWindowUseIndex==8) { -// scsu->nextWindowUseIndex=0; -// } -// return window; -// } - -// /* -// * useDynamicWindow() adjusts -// * windowUse[] and nextWindowUseIndex for the algorithm to choose -// * the next dynamic window to be defined; -// * a subclass may override it and provide its own algorithm. -// */ -// static void -// useDynamicWindow(SCSUData *scsu, int8_t window) { -// /* -// * move the existing window, which just became the most recently used one, -// * up in windowUse[] to nextWindowUseIndex-1 -// */ - -// /* first, find the index of the window - backwards to favor the more recently used windows */ -// int i, j; - -// i=scsu->nextWindowUseIndex; -// do { -// if(--i<0) { -// i=7; -// } -// } while(scsu->windowUse[i]!=window); - -// /* now copy each windowUse[i+1] to [i] */ -// j=i+1; -// if(j==8) { -// j=0; -// } -// while(j!=scsu->nextWindowUseIndex) { -// scsu->windowUse[i]=scsu->windowUse[j]; -// i=j; -// if(++j==8) { j=0; } -// } - -// /* finally, set the window into the most recently used index */ -// scsu->windowUse[i]=window; -// } - -// /* -// * calculate the offset and the code for a dynamic window that contains the character -// * takes fixed offsets into account -// * the offset of the window is stored in the offset variable, -// * the code is returned -// * -// * return offset code: -1 none <=0xff code for SDn/UDn else code for SDX/UDX, subtract 0x200 to get the true code -// */ -// static int -// getDynamicOffset(uint32_t c, uint32_t *pOffset) { -// int i; - -// for(i=0; i<7; ++i) { -// if((uint32_t)(c-fixedOffsets[i])<=0x7f) { -// *pOffset=fixedOffsets[i]; -// return 0xf9+i; -// } -// } - -// if(c<0x80) { -// /* No dynamic window for US-ASCII. */ -// return -1; -// } else if(c<0x3400 || -// (uint32_t)(c-0x10000)<(0x14000-0x10000) || -// (uint32_t)(c-0x1d000)<=(0x1ffff-0x1d000) -// ) { -// /* This character is in a code range for a "small", i.e., reasonably windowable, script. */ -// *pOffset=c&0x7fffff80; -// return (int)(c>>7); -// } else if(0xe000<=c && c!=0xfeff && c<0xfff0) { -// /* For these characters we need to take the gapOffset into account. */ -// *pOffset=c&0x7fffff80; -// return (int)((c-gapOffset)>>7); -// } else { -// return -1; -// } -// } -// U_CDECL_BEGIN -// /* -// * Idea for compression: -// * - save SCSUData and other state before really starting work -// * - at endloop, see if compression could be better with just unicode mode -// * - don't do this if a callback has been called -// * - if unicode mode would be smaller, then override the results with it - may need SCU at the beginning -// * - different buffer handling! -// * -// * Drawback or need for corrective handling: -// * it is desirable to encode U+feff as SQU fe ff for the SCSU signature, and -// * it is desirable to start a document in US-ASCII/Latin-1 for as long as possible -// * not only for compression but also for HTML/XML documents with following charset/encoding announcers. -// * -// * How to achieve both? -// * - Only replace the result after an SDX or SCU? -// */ - -// static void U_CALLCONV -// _SCSUFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// SCSUData *scsu; -// const UChar *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; -// int32_t *offsets; - -// UBool isSingleByteMode; -// uint8_t dynamicWindow; -// uint32_t currentOffset; - -// uint32_t c, delta; - -// int32_t sourceIndex, nextSourceIndex; - -// int32_t length; - -// /* variables for compression heuristics */ -// uint32_t offset; -// UChar lead, trail; -// int code; -// int8_t window; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// scsu=(SCSUData *)cnv->extraInfo; - -// /* set up the local pointers */ -// source=pArgs->source; -// sourceLimit=pArgs->sourceLimit; -// target=(uint8_t *)pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); -// offsets=pArgs->offsets; - -// /* get the state machine state */ -// isSingleByteMode=scsu->fromUIsSingleByteMode; -// dynamicWindow=scsu->fromUDynamicWindow; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; - -// c=cnv->fromUChar32; - -// /* sourceIndex=-1 if the current character began in the previous buffer */ -// sourceIndex= c==0 ? 0 : -1; -// nextSourceIndex=0; - -// /* similar conversion "loop" as in toUnicode */ -// loop: -// if(isSingleByteMode) { -// if(c!=0 && targetCapacity>0) { -// goto getTrailSingle; -// } - -// /* state machine for single-byte mode */ -// /* singleByteMode: */ -// while(sourcefromUDynamicOffsets, c))>=0) { -// /* there is a dynamic window that contains this character, change to it */ -// dynamicWindow=window; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else if((code=getDynamicOffset(c, &offset))>=0) { -// /* might check if there are more characters in this window to come */ -// /* define an extended window with this character */ -// code-=0x200; -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)SDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=4; -// goto outputBytes; -// } else { -// /* change to Unicode mode and output this (lead, trail) pair */ -// isSingleByteMode=FALSE; -// *target++=(uint8_t)SCU; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// --targetCapacity; -// c=((uint32_t)lead<<16)|trail; -// length=4; -// goto outputBytes; -// } -// } else if(c<0xa0) { -// /* quote C1 control character */ -// c=(c&0x7f)|(SQ0+1)<<8; /* SQ0+1==SQ1 */ -// length=2; -// goto outputBytes; -// } else if(c==0xfeff || c>=0xfff0) { -// /* quote signature character=byte order mark and specials */ -// c|=SQU<<16; -// length=3; -// goto outputBytes; -// } else { -// /* compress all other BMP characters */ -// if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) { -// /* there is a window defined that contains this character - switch to it or quote from it? */ -// if(source>=sourceLimit || isInOffsetWindowOrDirect(scsu->fromUDynamicOffsets[window], *source)) { -// /* change to dynamic window */ -// dynamicWindow=window; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else { -// /* quote from dynamic window */ -// c=((uint32_t)(SQ0+window)<<8)|(c-scsu->fromUDynamicOffsets[window])|0x80; -// length=2; -// goto outputBytes; -// } -// } else if((window=getWindow(staticOffsets, c))>=0) { -// /* quote from static window */ -// c=((uint32_t)(SQ0+window)<<8)|(c-staticOffsets[window]); -// length=2; -// goto outputBytes; -// } else if((code=getDynamicOffset(c, &offset))>=0) { -// /* define a dynamic window with this character */ -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(SD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=3; -// goto outputBytes; -// } else if((uint32_t)(c-0x3400)<(0xd800-0x3400) && -// (source>=sourceLimit || (uint32_t)(*source-0x3400)<(0xd800-0x3400)) -// ) { -// /* -// * this character is not compressible (a BMP ideograph or similar); -// * switch to Unicode mode if this is the last character in the block -// * or there is at least one more ideograph following immediately -// */ -// isSingleByteMode=FALSE; -// c|=SCU<<16; -// length=3; -// goto outputBytes; -// } else { -// /* quote Unicode */ -// c|=SQU<<16; -// length=3; -// goto outputBytes; -// } -// } - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// sourceIndex=nextSourceIndex; -// } -// } else { -// if(c!=0 && targetCapacity>0) { -// goto getTrailUnicode; -// } - -// /* state machine for Unicode mode */ -// /* unicodeByteMode: */ -// while(source=2) { -// *target++=(uint8_t)(c>>8); -// *target++=(uint8_t)c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// *offsets++=sourceIndex; -// } -// targetCapacity-=2; -// } else { -// length=2; -// goto outputBytes; -// } -// } else if((uint32_t)(c-0x3400)>=(0xf300-0x3400) /* c<0x3400 || c>=0xf300 */) { -// /* compress BMP character if the following one is not an uncompressible ideograph */ -// if(!(sourcefromUDynamicOffsets, c))>=0) { -// /* there is a dynamic window that contains this character, change to it */ -// isSingleByteMode=TRUE; -// dynamicWindow=window; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else if((code=getDynamicOffset(c, &offset))>=0) { -// /* define a dynamic window with this character */ -// isSingleByteMode=TRUE; -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(UD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=3; -// goto outputBytes; -// } -// } - -// /* don't know how to compress this character, just write it directly */ -// length=2; -// goto outputBytes; -// } else if(c<0xe000) { -// /* c is a surrogate */ -// if(U16_IS_SURROGATE_LEAD(c)) { -// getTrailUnicode: -// lead=(UChar)c; -// if(sourcefromUDynamicOffsets, c))>=0 && -// !(sourcefromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else if(source=0 -// ) { -// /* two supplementary characters in (probably) the same window - define an extended one */ -// isSingleByteMode=TRUE; -// code-=0x200; -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)UDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=4; -// goto outputBytes; -// } else { -// /* don't know how to compress this character, just write it directly */ -// c=((uint32_t)lead<<16)|trail; -// length=4; -// goto outputBytes; -// } -// } else /* 0xe000<=c<0xf300 */ { -// /* quote to avoid SCSU tags */ -// c|=UQU<<16; -// length=3; -// goto outputBytes; -// } - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// sourceIndex=nextSourceIndex; -// } -// } -// endloop: - -// /* set the converter state back into UConverter */ -// scsu->fromUIsSingleByteMode=isSingleByteMode; -// scsu->fromUDynamicWindow=dynamicWindow; - -// cnv->fromUChar32=c; - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// pArgs->offsets=offsets; -// return; - -// outputBytes: -// /* write the output character bytes from c and length [code copied from ucnvmbcs.c] */ -// /* from the first if in the loop we know that targetCapacity>0 */ -// if(length<=targetCapacity) { -// if(offsets==NULL) { -// switch(length) { -// /* each branch falls through to the next one */ -// case 4: -// *target++=(uint8_t)(c>>24); -// U_FALLTHROUGH; -// case 3: -// *target++=(uint8_t)(c>>16); -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(c>>8); -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)c; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// } else { -// switch(length) { -// /* each branch falls through to the next one */ -// case 4: -// *target++=(uint8_t)(c>>24); -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// case 3: -// *target++=(uint8_t)(c>>16); -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(c>>8); -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)c; -// *offsets++=sourceIndex; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// } -// targetCapacity-=length; - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// sourceIndex=nextSourceIndex; -// goto loop; -// } else { -// uint8_t *p; - -// /* -// * We actually do this backwards here: -// * In order to save an intermediate variable, we output -// * first to the overflow buffer what does not fit into the -// * regular target. -// */ -// /* we know that 0<=targetCapacitycharErrorBuffer; -// switch(length) { -// /* each branch falls through to the next one */ -// case 4: -// *p++=(uint8_t)(c>>24); -// U_FALLTHROUGH; -// case 3: -// *p++=(uint8_t)(c>>16); -// U_FALLTHROUGH; -// case 2: -// *p++=(uint8_t)(c>>8); -// U_FALLTHROUGH; -// case 1: -// *p=(uint8_t)c; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// cnv->charErrorBufferLength=(int8_t)length; - -// /* now output what fits into the regular target */ -// c>>=8*length; /* length was reduced by targetCapacity */ -// switch(targetCapacity) { -// /* each branch falls through to the next one */ -// case 3: -// *target++=(uint8_t)(c>>16); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(c>>8); -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)c; -// if(offsets!=NULL) { -// *offsets++=sourceIndex; -// } -// U_FALLTHROUGH; -// default: -// break; -// } - -// /* target overflow */ -// targetCapacity=0; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// c=0; -// goto endloop; -// } -// } - -// /* -// * Identical to _SCSUFromUnicodeWithOffsets but without offset handling. -// * If a change is made in the original function, then either -// * change this function the same way or -// * re-copy the original function and remove the variables -// * offsets, sourceIndex, and nextSourceIndex. -// */ -// static void U_CALLCONV -// _SCSUFromUnicode(UConverterFromUnicodeArgs *pArgs, -// UErrorCode *pErrorCode) { -// UConverter *cnv; -// SCSUData *scsu; -// const UChar *source, *sourceLimit; -// uint8_t *target; -// int32_t targetCapacity; - -// UBool isSingleByteMode; -// uint8_t dynamicWindow; -// uint32_t currentOffset; - -// uint32_t c, delta; - -// int32_t length; - -// /* variables for compression heuristics */ -// uint32_t offset; -// UChar lead, trail; -// int code; -// int8_t window; - -// /* set up the local pointers */ -// cnv=pArgs->converter; -// scsu=(SCSUData *)cnv->extraInfo; - -// /* set up the local pointers */ -// source=pArgs->source; -// sourceLimit=pArgs->sourceLimit; -// target=(uint8_t *)pArgs->target; -// targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); - -// /* get the state machine state */ -// isSingleByteMode=scsu->fromUIsSingleByteMode; -// dynamicWindow=scsu->fromUDynamicWindow; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; - -// c=cnv->fromUChar32; - -// /* similar conversion "loop" as in toUnicode */ -// loop: -// if(isSingleByteMode) { -// if(c!=0 && targetCapacity>0) { -// goto getTrailSingle; -// } - -// /* state machine for single-byte mode */ -// /* singleByteMode: */ -// while(sourcefromUDynamicOffsets, c))>=0) { -// /* there is a dynamic window that contains this character, change to it */ -// dynamicWindow=window; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else if((code=getDynamicOffset(c, &offset))>=0) { -// /* might check if there are more characters in this window to come */ -// /* define an extended window with this character */ -// code-=0x200; -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)SDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=4; -// goto outputBytes; -// } else { -// /* change to Unicode mode and output this (lead, trail) pair */ -// isSingleByteMode=FALSE; -// *target++=(uint8_t)SCU; -// --targetCapacity; -// c=((uint32_t)lead<<16)|trail; -// length=4; -// goto outputBytes; -// } -// } else if(c<0xa0) { -// /* quote C1 control character */ -// c=(c&0x7f)|(SQ0+1)<<8; /* SQ0+1==SQ1 */ -// length=2; -// goto outputBytes; -// } else if(c==0xfeff || c>=0xfff0) { -// /* quote signature character=byte order mark and specials */ -// c|=SQU<<16; -// length=3; -// goto outputBytes; -// } else { -// /* compress all other BMP characters */ -// if((window=getWindow(scsu->fromUDynamicOffsets, c))>=0) { -// /* there is a window defined that contains this character - switch to it or quote from it? */ -// if(source>=sourceLimit || isInOffsetWindowOrDirect(scsu->fromUDynamicOffsets[window], *source)) { -// /* change to dynamic window */ -// dynamicWindow=window; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(SC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else { -// /* quote from dynamic window */ -// c=((uint32_t)(SQ0+window)<<8)|(c-scsu->fromUDynamicOffsets[window])|0x80; -// length=2; -// goto outputBytes; -// } -// } else if((window=getWindow(staticOffsets, c))>=0) { -// /* quote from static window */ -// c=((uint32_t)(SQ0+window)<<8)|(c-staticOffsets[window]); -// length=2; -// goto outputBytes; -// } else if((code=getDynamicOffset(c, &offset))>=0) { -// /* define a dynamic window with this character */ -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(SD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=3; -// goto outputBytes; -// } else if((uint32_t)(c-0x3400)<(0xd800-0x3400) && -// (source>=sourceLimit || (uint32_t)(*source-0x3400)<(0xd800-0x3400)) -// ) { -// /* -// * this character is not compressible (a BMP ideograph or similar); -// * switch to Unicode mode if this is the last character in the block -// * or there is at least one more ideograph following immediately -// */ -// isSingleByteMode=FALSE; -// c|=SCU<<16; -// length=3; -// goto outputBytes; -// } else { -// /* quote Unicode */ -// c|=SQU<<16; -// length=3; -// goto outputBytes; -// } -// } - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// } -// } else { -// if(c!=0 && targetCapacity>0) { -// goto getTrailUnicode; -// } - -// /* state machine for Unicode mode */ -// /* unicodeByteMode: */ -// while(source=2) { -// *target++=(uint8_t)(c>>8); -// *target++=(uint8_t)c; -// targetCapacity-=2; -// } else { -// length=2; -// goto outputBytes; -// } -// } else if((uint32_t)(c-0x3400)>=(0xf300-0x3400) /* c<0x3400 || c>=0xf300 */) { -// /* compress BMP character if the following one is not an uncompressible ideograph */ -// if(!(sourcefromUDynamicOffsets, c))>=0) { -// /* there is a dynamic window that contains this character, change to it */ -// isSingleByteMode=TRUE; -// dynamicWindow=window; -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else if((code=getDynamicOffset(c, &offset))>=0) { -// /* define a dynamic window with this character */ -// isSingleByteMode=TRUE; -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(UD0+dynamicWindow)<<16)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=3; -// goto outputBytes; -// } -// } - -// /* don't know how to compress this character, just write it directly */ -// length=2; -// goto outputBytes; -// } else if(c<0xe000) { -// /* c is a surrogate */ -// if(U16_IS_SURROGATE_LEAD(c)) { -// getTrailUnicode: -// lead=(UChar)c; -// if(sourcefromUDynamicOffsets, c))>=0 && -// !(sourcefromUDynamicOffsets[dynamicWindow]; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)(UC0+dynamicWindow)<<8)|(c-currentOffset)|0x80; -// length=2; -// goto outputBytes; -// } else if(source=0 -// ) { -// /* two supplementary characters in (probably) the same window - define an extended one */ -// isSingleByteMode=TRUE; -// code-=0x200; -// dynamicWindow=getNextDynamicWindow(scsu); -// currentOffset=scsu->fromUDynamicOffsets[dynamicWindow]=offset; -// useDynamicWindow(scsu, dynamicWindow); -// c=((uint32_t)UDX<<24)|((uint32_t)dynamicWindow<<21)|((uint32_t)code<<8)|(c-currentOffset)|0x80; -// length=4; -// goto outputBytes; -// } else { -// /* don't know how to compress this character, just write it directly */ -// c=((uint32_t)lead<<16)|trail; -// length=4; -// goto outputBytes; -// } -// } else /* 0xe000<=c<0xf300 */ { -// /* quote to avoid SCSU tags */ -// c|=UQU<<16; -// length=3; -// goto outputBytes; -// } - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// } -// } -// endloop: - -// /* set the converter state back into UConverter */ -// scsu->fromUIsSingleByteMode=isSingleByteMode; -// scsu->fromUDynamicWindow=dynamicWindow; - -// cnv->fromUChar32=c; - -// /* write back the updated pointers */ -// pArgs->source=source; -// pArgs->target=(char *)target; -// return; - -// outputBytes: -// /* write the output character bytes from c and length [code copied from ucnvmbcs.c] */ -// /* from the first if in the loop we know that targetCapacity>0 */ -// if(length<=targetCapacity) { -// switch(length) { -// /* each branch falls through to the next one */ -// case 4: -// *target++=(uint8_t)(c>>24); -// U_FALLTHROUGH; -// case 3: -// *target++=(uint8_t)(c>>16); -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(c>>8); -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)c; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// targetCapacity-=length; - -// /* normal end of conversion: prepare for a new character */ -// c=0; -// goto loop; -// } else { -// uint8_t *p; - -// /* -// * We actually do this backwards here: -// * In order to save an intermediate variable, we output -// * first to the overflow buffer what does not fit into the -// * regular target. -// */ -// /* we know that 0<=targetCapacitycharErrorBuffer; -// switch(length) { -// /* each branch falls through to the next one */ -// case 4: -// *p++=(uint8_t)(c>>24); -// U_FALLTHROUGH; -// case 3: -// *p++=(uint8_t)(c>>16); -// U_FALLTHROUGH; -// case 2: -// *p++=(uint8_t)(c>>8); -// U_FALLTHROUGH; -// case 1: -// *p=(uint8_t)c; -// U_FALLTHROUGH; -// default: -// /* will never occur */ -// break; -// } -// cnv->charErrorBufferLength=(int8_t)length; - -// /* now output what fits into the regular target */ -// c>>=8*length; /* length was reduced by targetCapacity */ -// switch(targetCapacity) { -// /* each branch falls through to the next one */ -// case 3: -// *target++=(uint8_t)(c>>16); -// U_FALLTHROUGH; -// case 2: -// *target++=(uint8_t)(c>>8); -// U_FALLTHROUGH; -// case 1: -// *target++=(uint8_t)c; -// U_FALLTHROUGH; -// default: -// break; -// } - -// /* target overflow */ -// targetCapacity=0; -// *pErrorCode=U_BUFFER_OVERFLOW_ERROR; -// c=0; -// goto endloop; -// } -// } - -// /* miscellaneous ------------------------------------------------------------ */ - -// static const char * U_CALLCONV -// _SCSUGetName(const UConverter *cnv) { -// SCSUData *scsu=(SCSUData *)cnv->extraInfo; - -// switch(scsu->locale) { -// case l_ja: -// return "SCSU,locale=ja"; -// default: -// return "SCSU"; -// } -// } - -// /* structure for SafeClone calculations */ -// struct cloneSCSUStruct -// { -// UConverter cnv; -// SCSUData mydata; -// }; - -// static UConverter * U_CALLCONV -// _SCSUSafeClone(const UConverter *cnv, -// void *stackBuffer, -// int32_t *pBufferSize, -// UErrorCode *status) -// { -// struct cloneSCSUStruct * localClone; -// int32_t bufferSizeNeeded = sizeof(struct cloneSCSUStruct); - -// if (U_FAILURE(*status)){ -// return 0; -// } - -// if (*pBufferSize == 0){ /* 'preflighting' request - set needed size into *pBufferSize */ -// *pBufferSize = bufferSizeNeeded; -// return 0; -// } - -// localClone = (struct cloneSCSUStruct *)stackBuffer; -// /* ucnv.c/ucnv_safeClone() copied the main UConverter already */ - -// uprv_memcpy(&localClone->mydata, cnv->extraInfo, sizeof(SCSUData)); -// localClone->cnv.extraInfo = &localClone->mydata; -// localClone->cnv.isExtraLocal = TRUE; - -// return &localClone->cnv; -// } -// U_CDECL_END - -// static const UConverterImpl _SCSUImpl={ -// UCNV_SCSU, - -// NULL, -// NULL, - -// _SCSUOpen, -// _SCSUClose, -// _SCSUReset, - -// _SCSUToUnicode, -// _SCSUToUnicodeWithOffsets, -// _SCSUFromUnicode, -// _SCSUFromUnicodeWithOffsets, -// NULL, - -// NULL, -// _SCSUGetName, -// NULL, -// _SCSUSafeClone, -// ucnv_getCompleteUnicodeSet, -// NULL, -// NULL -// }; - -// static const UConverterStaticData _SCSUStaticData={ -// sizeof(UConverterStaticData), -// "SCSU", -// 1212, /* CCSID for SCSU */ -// UCNV_IBM, UCNV_SCSU, -// 1, 3, /* one UChar generates at least 1 byte and at most 3 bytes */ -// /* -// * The subchar here is ignored because _SCSUOpen() sets U+fffd as a Unicode -// * substitution string. -// */ -// { 0x0e, 0xff, 0xfd, 0 }, 3, -// FALSE, FALSE, -// 0, -// 0, -// { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ -// }; - -// const UConverterSharedData _SCSUData= -// UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_SCSUStaticData, &_SCSUImpl); - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucnvsel.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucnvsel.cpp deleted file mode 100644 index f93188cab..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ucnvsel.cpp +++ /dev/null @@ -1,823 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * -// * Copyright (C) 2008-2011, International Business Machines -// * Corporation, Google and others. All Rights Reserved. -// * -// ******************************************************************************* -// */ -// // Author : eldawy@google.com (Mohamed Eldawy) -// // ucnvsel.cpp -// // -// // Purpose: To generate a list of encodings capable of handling -// // a given Unicode text -// // -// // Started 09-April-2008 - -// /** -// * \file -// * -// * This is an implementation of an encoding selector. -// * The goal is, given a unicode string, find the encodings -// * this string can be mapped to. To make processing faster -// * a trie is built when you call ucnvsel_open() that -// * stores all encodings a codepoint can map to -// */ - -// #include "unicode/ucnvsel.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include - -// #include "unicode/uchar.h" -// #include "unicode/uniset.h" -// #include "unicode/ucnv.h" -// #include "unicode/ustring.h" -// #include "unicode/uchriter.h" -// #include "utrie2.h" -// #include "propsvec.h" -// #include "uassert.h" -// #include "ucmndata.h" -// #include "udataswp.h" -// #include "uenumimp.h" -// #include "cmemory.h" -// #include "cstring.h" - -// U_NAMESPACE_USE - -// struct UConverterSelector { -// UTrie2 *trie; // 16 bit trie containing offsets into pv -// uint32_t* pv; // table of bits! -// int32_t pvCount; -// char** encodings; // which encodings did user ask to use? -// int32_t encodingsCount; -// int32_t encodingStrLength; -// uint8_t* swapped; -// UBool ownPv, ownEncodingStrings; -// }; - -// static void generateSelectorData(UConverterSelector* result, -// UPropsVectors *upvec, -// const USet* excludedCodePoints, -// const UConverterUnicodeSet whichSet, -// UErrorCode* status) { -// if (U_FAILURE(*status)) { -// return; -// } - -// int32_t columns = (result->encodingsCount+31)/32; - -// // set errorValue to all-ones -// for (int32_t col = 0; col < columns; col++) { -// upvec_setValue(upvec, UPVEC_ERROR_VALUE_CP, UPVEC_ERROR_VALUE_CP, -// col, static_cast(~0), static_cast(~0), status); -// } - -// for (int32_t i = 0; i < result->encodingsCount; ++i) { -// uint32_t mask; -// uint32_t column; -// int32_t item_count; -// int32_t j; -// UConverter* test_converter = ucnv_open(result->encodings[i], status); -// if (U_FAILURE(*status)) { -// return; -// } -// USet* unicode_point_set; -// unicode_point_set = uset_open(1, 0); // empty set - -// ucnv_getUnicodeSet(test_converter, unicode_point_set, -// whichSet, status); -// if (U_FAILURE(*status)) { -// ucnv_close(test_converter); -// return; -// } - -// column = i / 32; -// mask = 1 << (i%32); -// // now iterate over intervals on set i! -// item_count = uset_getItemCount(unicode_point_set); - -// for (j = 0; j < item_count; ++j) { -// UChar32 start_char; -// UChar32 end_char; -// UErrorCode smallStatus = U_ZERO_ERROR; -// uset_getItem(unicode_point_set, j, &start_char, &end_char, NULL, 0, -// &smallStatus); -// if (U_FAILURE(smallStatus)) { -// // this will be reached for the converters that fill the set with -// // strings. Those should be ignored by our system -// } else { -// upvec_setValue(upvec, start_char, end_char, column, static_cast(~0), mask, -// status); -// } -// } -// ucnv_close(test_converter); -// uset_close(unicode_point_set); -// if (U_FAILURE(*status)) { -// return; -// } -// } - -// // handle excluded encodings! Simply set their values to all 1's in the upvec -// if (excludedCodePoints) { -// int32_t item_count = uset_getItemCount(excludedCodePoints); -// for (int32_t j = 0; j < item_count; ++j) { -// UChar32 start_char; -// UChar32 end_char; - -// uset_getItem(excludedCodePoints, j, &start_char, &end_char, NULL, 0, -// status); -// for (int32_t col = 0; col < columns; col++) { -// upvec_setValue(upvec, start_char, end_char, col, static_cast(~0), static_cast(~0), -// status); -// } -// } -// } - -// // alright. Now, let's put things in the same exact form you'd get when you -// // unserialize things. -// result->trie = upvec_compactToUTrie2WithRowIndexes(upvec, status); -// result->pv = upvec_cloneArray(upvec, &result->pvCount, NULL, status); -// result->pvCount *= columns; // number of uint32_t = rows * columns -// result->ownPv = TRUE; -// } - -// /* open a selector. If converterListSize is 0, build for all converters. -// If excludedCodePoints is NULL, don't exclude any codepoints */ -// U_CAPI UConverterSelector* U_EXPORT2 -// ucnvsel_open(const char* const* converterList, int32_t converterListSize, -// const USet* excludedCodePoints, -// const UConverterUnicodeSet whichSet, UErrorCode* status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return NULL; -// } -// // ensure args make sense! -// if (converterListSize < 0 || (converterList == NULL && converterListSize != 0)) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return NULL; -// } - -// // allocate a new converter -// LocalUConverterSelectorPointer newSelector( -// (UConverterSelector*)uprv_malloc(sizeof(UConverterSelector))); -// if (newSelector.isNull()) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// uprv_memset(newSelector.getAlias(), 0, sizeof(UConverterSelector)); - -// if (converterListSize == 0) { -// converterList = NULL; -// converterListSize = ucnv_countAvailable(); -// } -// newSelector->encodings = -// (char**)uprv_malloc(converterListSize * sizeof(char*)); -// if (!newSelector->encodings) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// newSelector->encodings[0] = NULL; // now we can call ucnvsel_close() - -// // make a backup copy of the list of converters -// int32_t totalSize = 0; -// int32_t i; -// for (i = 0; i < converterListSize; i++) { -// totalSize += -// (int32_t)uprv_strlen(converterList != NULL ? converterList[i] : ucnv_getAvailableName(i)) + 1; -// } -// // 4-align the totalSize to 4-align the size of the serialized form -// int32_t encodingStrPadding = totalSize & 3; -// if (encodingStrPadding != 0) { -// encodingStrPadding = 4 - encodingStrPadding; -// } -// newSelector->encodingStrLength = totalSize += encodingStrPadding; -// char* allStrings = (char*) uprv_malloc(totalSize); -// if (!allStrings) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } - -// for (i = 0; i < converterListSize; i++) { -// newSelector->encodings[i] = allStrings; -// uprv_strcpy(newSelector->encodings[i], -// converterList != NULL ? converterList[i] : ucnv_getAvailableName(i)); -// allStrings += uprv_strlen(newSelector->encodings[i]) + 1; -// } -// while (encodingStrPadding > 0) { -// *allStrings++ = 0; -// --encodingStrPadding; -// } - -// newSelector->ownEncodingStrings = TRUE; -// newSelector->encodingsCount = converterListSize; -// UPropsVectors *upvec = upvec_open((converterListSize+31)/32, status); -// generateSelectorData(newSelector.getAlias(), upvec, excludedCodePoints, whichSet, status); -// upvec_close(upvec); - -// if (U_FAILURE(*status)) { -// return NULL; -// } - -// return newSelector.orphan(); -// } - -// /* close opened selector */ -// U_CAPI void U_EXPORT2 -// ucnvsel_close(UConverterSelector *sel) { -// if (!sel) { -// return; -// } -// if (sel->ownEncodingStrings) { -// uprv_free(sel->encodings[0]); -// } -// uprv_free(sel->encodings); -// if (sel->ownPv) { -// uprv_free(sel->pv); -// } -// utrie2_close(sel->trie); -// uprv_free(sel->swapped); -// uprv_free(sel); -// } - -// static const UDataInfo dataInfo = { -// sizeof(UDataInfo), -// 0, - -// U_IS_BIG_ENDIAN, -// U_CHARSET_FAMILY, -// U_SIZEOF_UCHAR, -// 0, - -// { 0x43, 0x53, 0x65, 0x6c }, /* dataFormat="CSel" */ -// { 1, 0, 0, 0 }, /* formatVersion */ -// { 0, 0, 0, 0 } /* dataVersion */ -// }; - -// enum { -// UCNVSEL_INDEX_TRIE_SIZE, // trie size in bytes -// UCNVSEL_INDEX_PV_COUNT, // number of uint32_t in the bit vectors -// UCNVSEL_INDEX_NAMES_COUNT, // number of encoding names -// UCNVSEL_INDEX_NAMES_LENGTH, // number of encoding name bytes including padding -// UCNVSEL_INDEX_SIZE = 15, // bytes following the DataHeader -// UCNVSEL_INDEX_COUNT = 16 -// }; - -// /* -// * Serialized form of a UConverterSelector, formatVersion 1: -// * -// * The serialized form begins with a standard ICU DataHeader with a UDataInfo -// * as the template above. -// * This is followed by: -// * int32_t indexes[UCNVSEL_INDEX_COUNT]; // see index entry constants above -// * serialized UTrie2; // indexes[UCNVSEL_INDEX_TRIE_SIZE] bytes -// * uint32_t pv[indexes[UCNVSEL_INDEX_PV_COUNT]]; // bit vectors -// * char* encodingNames[indexes[UCNVSEL_INDEX_NAMES_LENGTH]]; // NUL-terminated strings + padding -// */ - -// /* serialize a selector */ -// U_CAPI int32_t U_EXPORT2 -// ucnvsel_serialize(const UConverterSelector* sel, -// void* buffer, int32_t bufferCapacity, UErrorCode* status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return 0; -// } -// // ensure args make sense! -// uint8_t *p = (uint8_t *)buffer; -// if (bufferCapacity < 0 || -// (bufferCapacity > 0 && (p == NULL || (U_POINTER_MASK_LSB(p, 3) != 0))) -// ) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } -// // add up the size of the serialized form -// int32_t serializedTrieSize = utrie2_serialize(sel->trie, NULL, 0, status); -// if (*status != U_BUFFER_OVERFLOW_ERROR && U_FAILURE(*status)) { -// return 0; -// } -// *status = U_ZERO_ERROR; - -// DataHeader header; -// uprv_memset(&header, 0, sizeof(header)); -// header.dataHeader.headerSize = (uint16_t)((sizeof(header) + 15) & ~15); -// header.dataHeader.magic1 = 0xda; -// header.dataHeader.magic2 = 0x27; -// uprv_memcpy(&header.info, &dataInfo, sizeof(dataInfo)); - -// int32_t indexes[UCNVSEL_INDEX_COUNT] = { -// serializedTrieSize, -// sel->pvCount, -// sel->encodingsCount, -// sel->encodingStrLength -// }; - -// int32_t totalSize = -// header.dataHeader.headerSize + -// (int32_t)sizeof(indexes) + -// serializedTrieSize + -// sel->pvCount * 4 + -// sel->encodingStrLength; -// indexes[UCNVSEL_INDEX_SIZE] = totalSize - header.dataHeader.headerSize; -// if (totalSize > bufferCapacity) { -// *status = U_BUFFER_OVERFLOW_ERROR; -// return totalSize; -// } -// // ok, save! -// int32_t length = header.dataHeader.headerSize; -// uprv_memcpy(p, &header, sizeof(header)); -// uprv_memset(p + sizeof(header), 0, length - sizeof(header)); -// p += length; - -// length = (int32_t)sizeof(indexes); -// uprv_memcpy(p, indexes, length); -// p += length; - -// utrie2_serialize(sel->trie, p, serializedTrieSize, status); -// p += serializedTrieSize; - -// length = sel->pvCount * 4; -// uprv_memcpy(p, sel->pv, length); -// p += length; - -// uprv_memcpy(p, sel->encodings[0], sel->encodingStrLength); -// p += sel->encodingStrLength; - -// return totalSize; -// } - -// /** -// * swap a selector into the desired Endianness and Asciiness of -// * the system. Just as FYI, selectors are always saved in the format -// * of the system that created them. They are only converted if used -// * on another system. In other words, selectors created on different -// * system can be different even if the params are identical (endianness -// * and Asciiness differences only) -// * -// * @param ds pointer to data swapper containing swapping info -// * @param inData pointer to incoming data -// * @param length length of inData in bytes -// * @param outData pointer to output data. Capacity should -// * be at least equal to capacity of inData -// * @param status an in/out ICU UErrorCode -// * @return 0 on failure, number of bytes swapped on success -// * number of bytes swapped can be smaller than length -// */ -// static int32_t -// ucnvsel_swap(const UDataSwapper *ds, -// const void *inData, int32_t length, -// void *outData, UErrorCode *status) { -// /* udata_swapDataHeader checks the arguments */ -// int32_t headerSize = udata_swapDataHeader(ds, inData, length, outData, status); -// if(U_FAILURE(*status)) { -// return 0; -// } - -// /* check data format and format version */ -// const UDataInfo *pInfo = (const UDataInfo *)((const char *)inData + 4); -// if(!( -// pInfo->dataFormat[0] == 0x43 && /* dataFormat="CSel" */ -// pInfo->dataFormat[1] == 0x53 && -// pInfo->dataFormat[2] == 0x65 && -// pInfo->dataFormat[3] == 0x6c -// )) { -// udata_printError(ds, "ucnvsel_swap(): data format %02x.%02x.%02x.%02x is not recognized as UConverterSelector data\n", -// pInfo->dataFormat[0], pInfo->dataFormat[1], -// pInfo->dataFormat[2], pInfo->dataFormat[3]); -// *status = U_INVALID_FORMAT_ERROR; -// return 0; -// } -// if(pInfo->formatVersion[0] != 1) { -// udata_printError(ds, "ucnvsel_swap(): format version %02x is not supported\n", -// pInfo->formatVersion[0]); -// *status = U_UNSUPPORTED_ERROR; -// return 0; -// } - -// if(length >= 0) { -// length -= headerSize; -// if(length < 16*4) { -// udata_printError(ds, "ucnvsel_swap(): too few bytes (%d after header) for UConverterSelector data\n", -// length); -// *status = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } -// } - -// const uint8_t *inBytes = (const uint8_t *)inData + headerSize; -// uint8_t *outBytes = (uint8_t *)outData + headerSize; - -// /* read the indexes */ -// const int32_t *inIndexes = (const int32_t *)inBytes; -// int32_t indexes[16]; -// int32_t i; -// for(i = 0; i < 16; ++i) { -// indexes[i] = udata_readInt32(ds, inIndexes[i]); -// } - -// /* get the total length of the data */ -// int32_t size = indexes[UCNVSEL_INDEX_SIZE]; -// if(length >= 0) { -// if(length < size) { -// udata_printError(ds, "ucnvsel_swap(): too few bytes (%d after header) for all of UConverterSelector data\n", -// length); -// *status = U_INDEX_OUTOFBOUNDS_ERROR; -// return 0; -// } - -// /* copy the data for inaccessible bytes */ -// if(inBytes != outBytes) { -// uprv_memcpy(outBytes, inBytes, size); -// } - -// int32_t offset = 0, count; - -// /* swap the int32_t indexes[] */ -// count = UCNVSEL_INDEX_COUNT*4; -// ds->swapArray32(ds, inBytes, count, outBytes, status); -// offset += count; - -// /* swap the UTrie2 */ -// count = indexes[UCNVSEL_INDEX_TRIE_SIZE]; -// utrie2_swap(ds, inBytes + offset, count, outBytes + offset, status); -// offset += count; - -// /* swap the uint32_t pv[] */ -// count = indexes[UCNVSEL_INDEX_PV_COUNT]*4; -// ds->swapArray32(ds, inBytes + offset, count, outBytes + offset, status); -// offset += count; - -// /* swap the encoding names */ -// count = indexes[UCNVSEL_INDEX_NAMES_LENGTH]; -// ds->swapInvChars(ds, inBytes + offset, count, outBytes + offset, status); -// offset += count; - -// U_ASSERT(offset == size); -// } - -// return headerSize + size; -// } - -// /* unserialize a selector */ -// U_CAPI UConverterSelector* U_EXPORT2 -// ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return NULL; -// } -// // ensure args make sense! -// const uint8_t *p = (const uint8_t *)buffer; -// if (length <= 0 || -// (length > 0 && (p == NULL || (U_POINTER_MASK_LSB(p, 3) != 0))) -// ) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return NULL; -// } -// // header -// if (length < 32) { -// // not even enough space for a minimal header -// *status = U_INDEX_OUTOFBOUNDS_ERROR; -// return NULL; -// } -// const DataHeader *pHeader = (const DataHeader *)p; -// if (!( -// pHeader->dataHeader.magic1==0xda && -// pHeader->dataHeader.magic2==0x27 && -// pHeader->info.dataFormat[0] == 0x43 && -// pHeader->info.dataFormat[1] == 0x53 && -// pHeader->info.dataFormat[2] == 0x65 && -// pHeader->info.dataFormat[3] == 0x6c -// )) { -// /* header not valid or dataFormat not recognized */ -// *status = U_INVALID_FORMAT_ERROR; -// return NULL; -// } -// if (pHeader->info.formatVersion[0] != 1) { -// *status = U_UNSUPPORTED_ERROR; -// return NULL; -// } -// uint8_t* swapped = NULL; -// if (pHeader->info.isBigEndian != U_IS_BIG_ENDIAN || -// pHeader->info.charsetFamily != U_CHARSET_FAMILY -// ) { -// // swap the data -// UDataSwapper *ds = -// udata_openSwapperForInputData(p, length, U_IS_BIG_ENDIAN, U_CHARSET_FAMILY, status); -// int32_t totalSize = ucnvsel_swap(ds, p, -1, NULL, status); -// if (U_FAILURE(*status)) { -// udata_closeSwapper(ds); -// return NULL; -// } -// if (length < totalSize) { -// udata_closeSwapper(ds); -// *status = U_INDEX_OUTOFBOUNDS_ERROR; -// return NULL; -// } -// swapped = (uint8_t*)uprv_malloc(totalSize); -// if (swapped == NULL) { -// udata_closeSwapper(ds); -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// ucnvsel_swap(ds, p, length, swapped, status); -// udata_closeSwapper(ds); -// if (U_FAILURE(*status)) { -// uprv_free(swapped); -// return NULL; -// } -// p = swapped; -// pHeader = (const DataHeader *)p; -// } -// if (length < (pHeader->dataHeader.headerSize + 16 * 4)) { -// // not even enough space for the header and the indexes -// uprv_free(swapped); -// *status = U_INDEX_OUTOFBOUNDS_ERROR; -// return NULL; -// } -// p += pHeader->dataHeader.headerSize; -// length -= pHeader->dataHeader.headerSize; -// // indexes -// const int32_t *indexes = (const int32_t *)p; -// if (length < indexes[UCNVSEL_INDEX_SIZE]) { -// uprv_free(swapped); -// *status = U_INDEX_OUTOFBOUNDS_ERROR; -// return NULL; -// } -// p += UCNVSEL_INDEX_COUNT * 4; -// // create and populate the selector object -// UConverterSelector* sel = (UConverterSelector*)uprv_malloc(sizeof(UConverterSelector)); -// char **encodings = -// (char **)uprv_malloc( -// indexes[UCNVSEL_INDEX_NAMES_COUNT] * sizeof(char *)); -// if (sel == NULL || encodings == NULL) { -// uprv_free(swapped); -// uprv_free(sel); -// uprv_free(encodings); -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// uprv_memset(sel, 0, sizeof(UConverterSelector)); -// sel->pvCount = indexes[UCNVSEL_INDEX_PV_COUNT]; -// sel->encodings = encodings; -// sel->encodingsCount = indexes[UCNVSEL_INDEX_NAMES_COUNT]; -// sel->encodingStrLength = indexes[UCNVSEL_INDEX_NAMES_LENGTH]; -// sel->swapped = swapped; -// // trie -// sel->trie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS, -// p, indexes[UCNVSEL_INDEX_TRIE_SIZE], NULL, -// status); -// p += indexes[UCNVSEL_INDEX_TRIE_SIZE]; -// if (U_FAILURE(*status)) { -// ucnvsel_close(sel); -// return NULL; -// } -// // bit vectors -// sel->pv = (uint32_t *)p; -// p += sel->pvCount * 4; -// // encoding names -// char* s = (char*)p; -// for (int32_t i = 0; i < sel->encodingsCount; ++i) { -// sel->encodings[i] = s; -// s += uprv_strlen(s) + 1; -// } -// p += sel->encodingStrLength; - -// return sel; -// } - -// // a bunch of functions for the enumeration thingie! Nothing fancy here. Just -// // iterate over the selected encodings -// struct Enumerator { -// int16_t* index; -// int16_t length; -// int16_t cur; -// const UConverterSelector* sel; -// }; - -// U_CDECL_BEGIN - -// static void U_CALLCONV -// ucnvsel_close_selector_iterator(UEnumeration *enumerator) { -// uprv_free(((Enumerator*)(enumerator->context))->index); -// uprv_free(enumerator->context); -// uprv_free(enumerator); -// } - - -// static int32_t U_CALLCONV -// ucnvsel_count_encodings(UEnumeration *enumerator, UErrorCode *status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return 0; -// } -// return ((Enumerator*)(enumerator->context))->length; -// } - - -// static const char* U_CALLCONV ucnvsel_next_encoding(UEnumeration* enumerator, -// int32_t* resultLength, -// UErrorCode* status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return NULL; -// } - -// int16_t cur = ((Enumerator*)(enumerator->context))->cur; -// const UConverterSelector* sel; -// const char* result; -// if (cur >= ((Enumerator*)(enumerator->context))->length) { -// return NULL; -// } -// sel = ((Enumerator*)(enumerator->context))->sel; -// result = sel->encodings[((Enumerator*)(enumerator->context))->index[cur] ]; -// ((Enumerator*)(enumerator->context))->cur++; -// if (resultLength) { -// *resultLength = (int32_t)uprv_strlen(result); -// } -// return result; -// } - -// static void U_CALLCONV ucnvsel_reset_iterator(UEnumeration* enumerator, -// UErrorCode* status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return ; -// } -// ((Enumerator*)(enumerator->context))->cur = 0; -// } - -// U_CDECL_END - - -// static const UEnumeration defaultEncodings = { -// NULL, -// NULL, -// ucnvsel_close_selector_iterator, -// ucnvsel_count_encodings, -// uenum_unextDefault, -// ucnvsel_next_encoding, -// ucnvsel_reset_iterator -// }; - - -// // internal fn to intersect two sets of masks -// // returns whether the mask has reduced to all zeros -// static UBool intersectMasks(uint32_t* dest, const uint32_t* source1, int32_t len) { -// int32_t i; -// uint32_t oredDest = 0; -// for (i = 0 ; i < len ; ++i) { -// oredDest |= (dest[i] &= source1[i]); -// } -// return oredDest == 0; -// } - -// // internal fn to count how many 1's are there in a mask -// // algorithm taken from http://graphics.stanford.edu/~seander/bithacks.html -// static int16_t countOnes(uint32_t* mask, int32_t len) { -// int32_t i, totalOnes = 0; -// for (i = 0 ; i < len ; ++i) { -// uint32_t ent = mask[i]; -// for (; ent; totalOnes++) -// { -// ent &= ent - 1; // clear the least significant bit set -// } -// } -// return static_cast(totalOnes); -// } - - -// /* internal function! */ -// static UEnumeration *selectForMask(const UConverterSelector* sel, -// uint32_t *theMask, UErrorCode *status) { -// LocalMemory mask(theMask); -// // this is the context we will use. Store a table of indices to which -// // encodings are legit. -// LocalMemory result(static_cast(uprv_malloc(sizeof(Enumerator)))); -// if (result.isNull()) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return nullptr; -// } -// result->index = nullptr; // this will be allocated later! -// result->length = result->cur = 0; -// result->sel = sel; - -// LocalMemory en(static_cast(uprv_malloc(sizeof(UEnumeration)))); -// if (en.isNull()) { -// // TODO(markus): Combine Enumerator and UEnumeration into one struct. -// *status = U_MEMORY_ALLOCATION_ERROR; -// return nullptr; -// } -// memcpy(en.getAlias(), &defaultEncodings, sizeof(UEnumeration)); - -// int32_t columns = (sel->encodingsCount+31)/32; -// int16_t numOnes = countOnes(mask.getAlias(), columns); -// // now, we know the exact space we need for index -// if (numOnes > 0) { -// result->index = static_cast(uprv_malloc(numOnes * sizeof(int16_t))); -// if (result->index == nullptr) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return nullptr; -// } -// int32_t i, j; -// int16_t k = 0; -// for (j = 0 ; j < columns; j++) { -// uint32_t v = mask[j]; -// for (i = 0 ; i < 32 && k < sel->encodingsCount; i++, k++) { -// if ((v & 1) != 0) { -// result->index[result->length++] = k; -// } -// v >>= 1; -// } -// } -// } //otherwise, index will remain NULL (and will never be touched by -// //the enumerator code anyway) -// en->context = result.orphan(); -// return en.orphan(); -// } - -// /* check a string against the selector - UTF16 version */ -// U_CAPI UEnumeration * U_EXPORT2 -// ucnvsel_selectForString(const UConverterSelector* sel, -// const UChar *s, int32_t length, UErrorCode *status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return NULL; -// } -// // ensure args make sense! -// if (sel == NULL || (s == NULL && length != 0)) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return NULL; -// } - -// int32_t columns = (sel->encodingsCount+31)/32; -// uint32_t* mask = (uint32_t*) uprv_malloc(columns * 4); -// if (mask == NULL) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// uprv_memset(mask, ~0, columns *4); - -// if(s!=NULL) { -// const UChar *limit; -// if (length >= 0) { -// limit = s + length; -// } else { -// limit = NULL; -// } - -// while (limit == NULL ? *s != 0 : s != limit) { -// UChar32 c; -// uint16_t pvIndex; -// UTRIE2_U16_NEXT16(sel->trie, s, limit, c, pvIndex); -// if (intersectMasks(mask, sel->pv+pvIndex, columns)) { -// break; -// } -// } -// } -// return selectForMask(sel, mask, status); -// } - -// /* check a string against the selector - UTF8 version */ -// U_CAPI UEnumeration * U_EXPORT2 -// ucnvsel_selectForUTF8(const UConverterSelector* sel, -// const char *s, int32_t length, UErrorCode *status) { -// // check if already failed -// if (U_FAILURE(*status)) { -// return NULL; -// } -// // ensure args make sense! -// if (sel == NULL || (s == NULL && length != 0)) { -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return NULL; -// } - -// int32_t columns = (sel->encodingsCount+31)/32; -// uint32_t* mask = (uint32_t*) uprv_malloc(columns * 4); -// if (mask == NULL) { -// *status = U_MEMORY_ALLOCATION_ERROR; -// return NULL; -// } -// uprv_memset(mask, ~0, columns *4); - -// if (length < 0) { -// length = (int32_t)uprv_strlen(s); -// } - -// if(s!=NULL) { -// const char *limit = s + length; - -// while (s != limit) { -// uint16_t pvIndex; -// UTRIE2_U8_NEXT16(sel->trie, s, limit, pvIndex); -// if (intersectMasks(mask, sel->pv+pvIndex, columns)) { -// break; -// } -// } -// } -// return selectForMask(sel, mask, status); -// } - -// #endif // !UCONFIG_NO_CONVERSION diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucol_data.h b/src/duckdb/extension/icu/third_party/icu/common/ucol_data.h index 83f54abba..28cf94ffc 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucol_data.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucol_data.h @@ -43,7 +43,7 @@ typedef struct { uint32_t magic; /* magic number - lets us know whether reserved data is reset or junked */ uint32_t mappingPosition; /* const uint8_t *mappingPosition; */ uint32_t expansion; /* uint32_t *expansion; */ - uint32_t contractionIndex; /* UChar *contractionIndex; */ + uint32_t contractionIndex; /* char16_t *contractionIndex; */ uint32_t contractionCEs; /* uint32_t *contractionCEs; */ uint32_t contractionSize; /* needed for various closures */ /*int32_t latinOneMapping;*/ /* this is now handled in the trie itself *//* fast track to latin1 chars */ @@ -60,7 +60,7 @@ typedef struct { /* in contractions. */ int32_t contractionUCACombosSize; /* number of UCA contraction items. */ - /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(UChar) */ + /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(char16_t) */ UBool jamoSpecial; /* is jamoSpecial */ UBool isBigEndian; /* is this data big endian? from the UDataInfo header*/ uint8_t charSetFamily; /* what is the charset family of this data from the UDataInfo header*/ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.cpp index 1af19863f..b5894a1fe 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.cpp @@ -33,20 +33,20 @@ U_CAPI UBool U_EXPORT2 ucol_looksLikeCollationBinary(const UDataSwapper *ds, const void *inData, int32_t length) { - if(ds==NULL || inData==NULL || length<-1) { - return FALSE; + if(ds==nullptr || inData==nullptr || length<-1) { + return false; } // First check for format version 4+ which has a standard data header. UErrorCode errorCode=U_ZERO_ERROR; - (void)udata_swapDataHeader(ds, inData, -1, NULL, &errorCode); + (void)udata_swapDataHeader(ds, inData, -1, nullptr, &errorCode); if(U_SUCCESS(errorCode)) { const UDataInfo &info=*(const UDataInfo *)((const char *)inData+4); if(info.dataFormat[0]==0x55 && // dataFormat="UCol" info.dataFormat[1]==0x43 && info.dataFormat[2]==0x6f && info.dataFormat[3]==0x6c) { - return TRUE; + return true; } } @@ -64,7 +64,7 @@ ucol_looksLikeCollationBinary(const UDataSwapper *ds, if(length<0) { header.size=udata_readInt32(ds, inHeader->size); } else if((length<(42*4) || length<(header.size=udata_readInt32(ds, inHeader->size)))) { - return FALSE; + return false; } header.magic=ds->readUInt32(inHeader->magic); @@ -73,14 +73,14 @@ ucol_looksLikeCollationBinary(const UDataSwapper *ds, inHeader->formatVersion[0]==3 /*&& inHeader->formatVersion[1]>=0*/ )) { - return FALSE; + return false; } if(inHeader->isBigEndian!=ds->inIsBigEndian || inHeader->charSetFamily!=ds->inCharset) { - return FALSE; + return false; } - return TRUE; + return true; } namespace { @@ -103,7 +103,7 @@ swapFormatVersion3(const UDataSwapper *ds, if(U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || length<-1 || (length>0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -204,7 +204,7 @@ swapFormatVersion3(const UDataSwapper *ds, /* swap the contractions */ if(header.contractionSize!=0) { - /* contractionIndex: UChar[] */ + /* contractionIndex: char16_t[] */ ds->swapArray16(ds, inBytes+header.contractionIndex, header.contractionSize*2, outBytes+header.contractionIndex, pErrorCode); @@ -336,7 +336,7 @@ swapFormatVersion4(const UDataSwapper *ds, for(int32_t i=indexesLength; i<=IX_TOTAL_SIZE; ++i) { indexes[i]=-1; } - inIndexes=NULL; // Make sure we do not accidentally use these instead of indexes[]. + inIndexes=nullptr; // Make sure we do not accidentally use these instead of indexes[]. // Get the total length of the data. int32_t size; @@ -506,7 +506,7 @@ ucol_swap(const UDataSwapper *ds, inData=(const char *)inData+headerSize; if(length>=0) { length-=headerSize; } - outData=(char *)outData+headerSize; + outData=(outData == nullptr) ? nullptr : (char *)outData+headerSize; int32_t collationSize; if(info.formatVersion[0]>=4) { collationSize=swapFormatVersion4(ds, inData, length, outData, *pErrorCode); @@ -537,7 +537,7 @@ ucol_swapInverseUCA(const UDataSwapper *ds, /* udata_swapDataHeader checks the arguments */ headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode); - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.h b/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.h index fd8be9aa5..0c2990a85 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucol_swp.h @@ -31,7 +31,7 @@ * Does the data look like a collation binary? * @internal */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucol_looksLikeCollationBinary(const UDataSwapper *ds, const void *inData, int32_t length); diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucptrie.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucptrie.cpp index 4cde43800..0004160a2 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucptrie.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucptrie.cpp @@ -256,7 +256,7 @@ inline uint32_t maybeFilterValue(uint32_t value, uint32_t trieNullValue, uint32_ return value; } -UChar32 ucptrie_internal_getRange(const void *t, UChar32 start, +UChar32 getRange(const void *t, UChar32 start, UCPMapValueFilter *filter, const void *context, uint32_t *pValue) { if ((uint32_t)start > MAX_UNICODE) { return U_SENTINEL; @@ -461,7 +461,7 @@ U_CAPI UChar32 U_EXPORT2 ucptrie_getRange(const UCPTrie *trie, UChar32 start, UCPMapRangeOption option, uint32_t surrogateValue, UCPMapValueFilter *filter, const void *context, uint32_t *pValue) { - return ucptrie_internalGetRange(ucptrie_internal_getRange, trie, start, + return ucptrie_internalGetRange(getRange, trie, start, option, surrogateValue, filter, context, pValue); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucptrie_impl.h b/src/duckdb/extension/icu/third_party/icu/common/ucptrie_impl.h index 1fe6a18ac..a7a80a8f0 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucptrie_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ucptrie_impl.h @@ -54,80 +54,76 @@ struct UCPTrieHeader { uint16_t shiftedHighStart; }; +// Constants for use with UCPTrieHeader.options. +constexpr uint16_t UCPTRIE_OPTIONS_DATA_LENGTH_MASK = 0xf000; +constexpr uint16_t UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK = 0xf00; +constexpr uint16_t UCPTRIE_OPTIONS_RESERVED_MASK = 0x38; +constexpr uint16_t UCPTRIE_OPTIONS_VALUE_BITS_MASK = 7; + /** - * Constants for use with UCPTrieHeader.options. - * @internal + * Value for index3NullOffset which indicates that there is no index-3 null block. + * Bit 15 is unused for this value because this bit is used if the index-3 contains + * 18-bit indexes. */ -enum { - UCPTRIE_OPTIONS_DATA_LENGTH_MASK = 0xf000, - UCPTRIE_OPTIONS_DATA_NULL_OFFSET_MASK = 0xf00, - UCPTRIE_OPTIONS_RESERVED_MASK = 0x38, - UCPTRIE_OPTIONS_VALUE_BITS_MASK = 7, - /** - * Value for index3NullOffset which indicates that there is no index-3 null block. - * Bit 15 is unused for this value because this bit is used if the index-3 contains - * 18-bit indexes. - */ - UCPTRIE_NO_INDEX3_NULL_OFFSET = 0x7fff, - UCPTRIE_NO_DATA_NULL_OFFSET = 0xfffff -}; +constexpr int32_t UCPTRIE_NO_INDEX3_NULL_OFFSET = 0x7fff; +constexpr int32_t UCPTRIE_NO_DATA_NULL_OFFSET = 0xfffff; // Internal constants. -enum { - /** The length of the BMP index table. 1024=0x400 */ - UCPTRIE_BMP_INDEX_LENGTH = 0x10000 >> UCPTRIE_FAST_SHIFT, - UCPTRIE_SMALL_LIMIT = 0x1000, - UCPTRIE_SMALL_INDEX_LENGTH = UCPTRIE_SMALL_LIMIT >> UCPTRIE_FAST_SHIFT, +/** The length of the BMP index table. 1024=0x400 */ +constexpr int32_t UCPTRIE_BMP_INDEX_LENGTH = 0x10000 >> UCPTRIE_FAST_SHIFT; - /** Shift size for getting the index-3 table offset. */ - UCPTRIE_SHIFT_3 = 4, +constexpr int32_t UCPTRIE_SMALL_LIMIT = 0x1000; +constexpr int32_t UCPTRIE_SMALL_INDEX_LENGTH = UCPTRIE_SMALL_LIMIT >> UCPTRIE_FAST_SHIFT; - /** Shift size for getting the index-2 table offset. */ - UCPTRIE_SHIFT_2 = 5 + UCPTRIE_SHIFT_3, +/** Shift size for getting the index-3 table offset. */ +constexpr int32_t UCPTRIE_SHIFT_3 = 4; - /** Shift size for getting the index-1 table offset. */ - UCPTRIE_SHIFT_1 = 5 + UCPTRIE_SHIFT_2, +/** Shift size for getting the index-2 table offset. */ +constexpr int32_t UCPTRIE_SHIFT_2 = 5 + UCPTRIE_SHIFT_3; - /** - * Difference between two shift sizes, - * for getting an index-2 offset from an index-3 offset. 5=9-4 - */ - UCPTRIE_SHIFT_2_3 = UCPTRIE_SHIFT_2 - UCPTRIE_SHIFT_3, +/** Shift size for getting the index-1 table offset. */ +constexpr int32_t UCPTRIE_SHIFT_1 = 5 + UCPTRIE_SHIFT_2; - /** - * Difference between two shift sizes, - * for getting an index-1 offset from an index-2 offset. 5=14-9 - */ - UCPTRIE_SHIFT_1_2 = UCPTRIE_SHIFT_1 - UCPTRIE_SHIFT_2, +/** + * Difference between two shift sizes, + * for getting an index-2 offset from an index-3 offset. 5=9-4 + */ +constexpr int32_t UCPTRIE_SHIFT_2_3 = UCPTRIE_SHIFT_2 - UCPTRIE_SHIFT_3; - /** - * Number of index-1 entries for the BMP. (4) - * This part of the index-1 table is omitted from the serialized form. - */ - UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UCPTRIE_SHIFT_1, +/** + * Difference between two shift sizes, + * for getting an index-1 offset from an index-2 offset. 5=14-9 + */ +constexpr int32_t UCPTRIE_SHIFT_1_2 = UCPTRIE_SHIFT_1 - UCPTRIE_SHIFT_2; - /** Number of entries in an index-2 block. 32=0x20 */ - UCPTRIE_INDEX_2_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_1_2, +/** + * Number of index-1 entries for the BMP. (4) + * This part of the index-1 table is omitted from the serialized form. + */ +constexpr int32_t UCPTRIE_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UCPTRIE_SHIFT_1; - /** Mask for getting the lower bits for the in-index-2-block offset. */ - UCPTRIE_INDEX_2_MASK = UCPTRIE_INDEX_2_BLOCK_LENGTH - 1, +/** Number of entries in an index-2 block. 32=0x20 */ +constexpr int32_t UCPTRIE_INDEX_2_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_1_2; - /** Number of code points per index-2 table entry. 512=0x200 */ - UCPTRIE_CP_PER_INDEX_2_ENTRY = 1 << UCPTRIE_SHIFT_2, +/** Mask for getting the lower bits for the in-index-2-block offset. */ +constexpr int32_t UCPTRIE_INDEX_2_MASK = UCPTRIE_INDEX_2_BLOCK_LENGTH - 1; - /** Number of entries in an index-3 block. 32=0x20 */ - UCPTRIE_INDEX_3_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_2_3, +/** Number of code points per index-2 table entry. 512=0x200 */ +constexpr int32_t UCPTRIE_CP_PER_INDEX_2_ENTRY = 1 << UCPTRIE_SHIFT_2; - /** Mask for getting the lower bits for the in-index-3-block offset. */ - UCPTRIE_INDEX_3_MASK = UCPTRIE_INDEX_3_BLOCK_LENGTH - 1, +/** Number of entries in an index-3 block. 32=0x20 */ +constexpr int32_t UCPTRIE_INDEX_3_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_2_3; - /** Number of entries in a small data block. 16=0x10 */ - UCPTRIE_SMALL_DATA_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_3, +/** Mask for getting the lower bits for the in-index-3-block offset. */ +constexpr int32_t UCPTRIE_INDEX_3_MASK = UCPTRIE_INDEX_3_BLOCK_LENGTH - 1; + +/** Number of entries in a small data block. 16=0x10 */ +constexpr int32_t UCPTRIE_SMALL_DATA_BLOCK_LENGTH = 1 << UCPTRIE_SHIFT_3; + +/** Mask for getting the lower bits for the in-small-data-block offset. */ +constexpr int32_t UCPTRIE_SMALL_DATA_MASK = UCPTRIE_SMALL_DATA_BLOCK_LENGTH - 1; - /** Mask for getting the lower bits for the in-small-data-block offset. */ - UCPTRIE_SMALL_DATA_MASK = UCPTRIE_SMALL_DATA_BLOCK_LENGTH - 1 -}; typedef UChar32 UCPTrieGetRange(const void *trie, UChar32 start, @@ -148,7 +144,7 @@ U_CFUNC void umutablecptrie_setName(UMutableCPTrie *builder, const char *name); /* * Format of the binary, memory-mappable representation of a UCPTrie/CodePointTrie. - * For overview information see http://site.icu-project.org/design/struct/utrie + * For overview information see https://icu.unicode.org/design/struct/utrie * * The binary trie data should be 32-bit-aligned. * The overall layout is: diff --git a/src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp b/src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp index 0ff3507f6..70b1bbf22 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp @@ -11,6 +11,8 @@ #if !UCONFIG_NO_FORMATTING +#include + #include "unicode/ucurr.h" #include "unicode/locid.h" #include "unicode/ures.h" @@ -20,6 +22,7 @@ #include "unicode/usetiter.h" #include "unicode/utf16.h" #include "ustr_imp.h" +#include "bytesinkutil.h" #include "charstr.h" #include "cmemory.h" #include "cstring.h" @@ -49,7 +52,7 @@ using namespace icu; #endif typedef struct IsoCodeEntry { - const UChar *isoCode; /* const because it's a reference to a resource bundle string. */ + const char16_t *isoCode; /* const because it's a reference to a resource bundle string. */ UDate from; UDate to; } IsoCodeEntry; @@ -91,15 +94,17 @@ static const char VAR_DELIM = '_'; // Tag for localized display names (symbols) of currencies static const char CURRENCIES[] = "Currencies"; static const char CURRENCIES_NARROW[] = "Currencies%narrow"; +static const char CURRENCIES_FORMAL[] = "Currencies%formal"; +static const char CURRENCIES_VARIANT[] = "Currencies%variant"; static const char CURRENCYPLURALS[] = "CurrencyPlurals"; // ISO codes mapping table -static const UHashtable* gIsoCodes = NULL; -static icu::UInitOnce gIsoCodesInitOnce = U_INITONCE_INITIALIZER; +static const UHashtable* gIsoCodes = nullptr; +static icu::UInitOnce gIsoCodesInitOnce {}; // Currency symbol equivalances -static const icu::Hashtable* gCurrSymbolsEquiv = NULL; -static icu::UInitOnce gCurrSymbolsEquivInitOnce = U_INITONCE_INITIALIZER; +static const icu::Hashtable* gCurrSymbolsEquiv = nullptr; +static icu::UInitOnce gCurrSymbolsEquivInitOnce {}; U_NAMESPACE_BEGIN @@ -110,13 +115,13 @@ class EquivIterator : public icu::UMemory { // Constructor. hash stores the equivalence relationships; s is the string // for which we find equivalent strings. inline EquivIterator(const icu::Hashtable& hash, const icu::UnicodeString& s) - : _hash(hash) { + : _hash(hash) { _start = _current = &s; } inline ~EquivIterator() { } - // next returns the next equivalent string or NULL if there are no more. - // If s has no equivalent strings, next returns NULL on the first call. + // next returns the next equivalent string or nullptr if there are no more. + // If s has no equivalent strings, next returns nullptr on the first call. const icu::UnicodeString *next(); private: const icu::Hashtable& _hash; @@ -127,12 +132,12 @@ class EquivIterator : public icu::UMemory { const icu::UnicodeString * EquivIterator::next() { const icu::UnicodeString* _next = (const icu::UnicodeString*) _hash.get(*_current); - if (_next == NULL) { + if (_next == nullptr) { U_ASSERT(_current == _start); - return NULL; + return nullptr; } if (*_next == *_start) { - return NULL; + return nullptr; } _current = _next; return _next; @@ -159,7 +164,7 @@ static void makeEquivalent( const icu::UnicodeString *firstRight = rightIter.next(); const icu::UnicodeString *nextLeft = firstLeft; const icu::UnicodeString *nextRight = firstRight; - while (nextLeft != NULL && nextRight != NULL) { + while (nextLeft != nullptr && nextRight != nullptr) { if (*nextLeft == rhs || *nextRight == lhs) { // Already equivalent return; @@ -170,17 +175,17 @@ static void makeEquivalent( // Not equivalent. Must join. icu::UnicodeString *newFirstLeft; icu::UnicodeString *newFirstRight; - if (firstRight == NULL && firstLeft == NULL) { + if (firstRight == nullptr && firstLeft == nullptr) { // Neither lhs or rhs belong to an equivalence circle, so we form // a new equivalnce circle of just lhs and rhs. newFirstLeft = new icu::UnicodeString(rhs); newFirstRight = new icu::UnicodeString(lhs); - } else if (firstRight == NULL) { + } else if (firstRight == nullptr) { // lhs belongs to an equivalence circle, but rhs does not, so we link // rhs into lhs' circle. newFirstLeft = new icu::UnicodeString(rhs); newFirstRight = new icu::UnicodeString(*firstLeft); - } else if (firstLeft == NULL) { + } else if (firstLeft == nullptr) { // rhs belongs to an equivlance circle, but lhs does not, so we link // lhs into rhs' circle. newFirstLeft = new icu::UnicodeString(*firstRight); @@ -191,7 +196,7 @@ static void makeEquivalent( newFirstLeft = new icu::UnicodeString(*firstRight); newFirstRight = new icu::UnicodeString(*firstLeft); } - if (newFirstLeft == NULL || newFirstRight == NULL) { + if (newFirstLeft == nullptr || newFirstRight == nullptr) { delete newFirstLeft; delete newFirstRight; status = U_MEMORY_ALLOCATION_ERROR; @@ -207,7 +212,7 @@ static void makeEquivalent( static int32_t countEquivalent(const icu::Hashtable &hash, const icu::UnicodeString &s) { int32_t result = 0; icu::EquivIterator iter(hash, s); - while (iter.next() != NULL) { + while (iter.next() != nullptr) { ++result; } #ifdef UCURR_DEBUG_EQUIV @@ -228,31 +233,31 @@ static const icu::Hashtable* getCurrSymbolsEquiv(); /** * Cleanup callback func */ -static UBool U_CALLCONV -isoCodes_cleanup(void) +static UBool U_CALLCONV +isoCodes_cleanup() { - if (gIsoCodes != NULL) { + if (gIsoCodes != nullptr) { uhash_close(const_cast(gIsoCodes)); - gIsoCodes = NULL; + gIsoCodes = nullptr; } gIsoCodesInitOnce.reset(); - return TRUE; + return true; } /** * Cleanup callback func */ -static UBool U_CALLCONV -currSymbolsEquiv_cleanup(void) +static UBool U_CALLCONV +currSymbolsEquiv_cleanup() { delete const_cast(gCurrSymbolsEquiv); - gCurrSymbolsEquiv = NULL; + gCurrSymbolsEquiv = nullptr; gCurrSymbolsEquivInitOnce.reset(); - return TRUE; + return true; } /** - * Deleter for OlsonToMetaMappingEntry + * Deleter for IsoCodeEntry */ static void U_CALLCONV deleteIsoCodeEntry(void *obj) { @@ -270,11 +275,11 @@ deleteUnicode(void *obj) { } /** - * Unfortunately, we have to convert the UChar* currency code to char* + * Unfortunately, we have to convert the char16_t* currency code to char* * to use it as a resource key. */ static inline char* -myUCharsToChars(char* resultOfLen4, const UChar* currency) { +myUCharsToChars(char* resultOfLen4, const char16_t* currency) { u_UCharsToChars(currency, resultOfLen4, ISO_CURRENCY_CODE_LENGTH); resultOfLen4[ISO_CURRENCY_CODE_LENGTH] = 0; return resultOfLen4; @@ -285,11 +290,11 @@ myUCharsToChars(char* resultOfLen4, const UChar* currency) { * four integers. The first is the fraction digits. The second is the * rounding increment, or 0 if none. The rounding increment is in * units of 10^(-fraction_digits). The third and fourth are the same - * except that they are those used in cash transations ( cashDigits + * except that they are those used in cash transactions ( cashDigits * and cashRounding ). */ static const int32_t* -_findMetaData(const UChar* currency, UErrorCode& ec) { +_findMetaData(const char16_t* currency, UErrorCode& ec) { if (currency == 0 || *currency == 0) { if (U_SUCCESS(ec)) { @@ -313,10 +318,10 @@ _findMetaData(const UChar* currency, UErrorCode& ec) { // Look up our currency, or if that's not available, then DEFAULT char buf[ISO_CURRENCY_CODE_LENGTH+1]; UErrorCode ec2 = U_ZERO_ERROR; // local error code: soft failure - UResourceBundle* rb = ures_getByKey(currencyMeta, myUCharsToChars(buf, currency), NULL, &ec2); + UResourceBundle* rb = ures_getByKey(currencyMeta, myUCharsToChars(buf, currency), nullptr, &ec2); if (U_FAILURE(ec2)) { ures_close(rb); - rb = ures_getByKey(currencyMeta,DEFAULT_META, NULL, &ec); + rb = ures_getByKey(currencyMeta,DEFAULT_META, nullptr, &ec); if (U_FAILURE(ec)) { ures_close(currencyMeta); ures_close(rb); @@ -347,7 +352,7 @@ _findMetaData(const UChar* currency, UErrorCode& ec) { static void idForLocale(const char* locale, char* countryAndVariant, int capacity, UErrorCode* ec) { - ulocimp_getRegionForSupplementalData(locale, FALSE, countryAndVariant, capacity, ec); + ulocimp_getRegionForSupplementalData(locale, false, countryAndVariant, capacity, ec); } // ------------------------------------------ @@ -359,7 +364,7 @@ idForLocale(const char* locale, char* countryAndVariant, int capacity, UErrorCod // don't use ICUService since we don't need fallback U_CDECL_BEGIN -static UBool U_CALLCONV currency_cleanup(void); +static UBool U_CALLCONV currency_cleanup(); U_CDECL_END #if !UCONFIG_NO_SERVICE @@ -370,10 +375,10 @@ static CReg* gCRegHead = 0; struct CReg : public icu::UMemory { CReg *next; - UChar iso[ISO_CURRENCY_CODE_LENGTH+1]; + char16_t iso[ISO_CURRENCY_CODE_LENGTH+1]; char id[ULOC_FULLNAME_CAPACITY]; - CReg(const UChar* _iso, const char* _id) + CReg(const char16_t* _iso, const char* _id) : next(0) { int32_t len = (int32_t)uprv_strlen(_id); @@ -386,7 +391,7 @@ struct CReg : public icu::UMemory { iso[ISO_CURRENCY_CODE_LENGTH] = 0; } - static UCurrRegistryKey reg(const UChar* _iso, const char* _id, UErrorCode* status) + static UCurrRegistryKey reg(const char16_t* _iso, const char* _id, UErrorCode* status) { if (status && U_SUCCESS(*status) && _iso && _id) { CReg* n = new CReg(_iso, _id); @@ -407,7 +412,7 @@ struct CReg : public icu::UMemory { } static UBool unreg(UCurrRegistryKey key) { - UBool found = FALSE; + UBool found = false; umtx_lock(&gCRegLock); CReg** p = &gCRegHead; @@ -415,7 +420,7 @@ struct CReg : public icu::UMemory { if (*p == key) { *p = ((CReg*)key)->next; delete (CReg*)key; - found = TRUE; + found = true; break; } p = &((*p)->next); @@ -425,8 +430,8 @@ struct CReg : public icu::UMemory { return found; } - static const UChar* get(const char* id) { - const UChar* result = NULL; + static const char16_t* get(const char* id) { + const char16_t* result = nullptr; umtx_lock(&gCRegLock); CReg* p = gCRegHead; @@ -444,7 +449,7 @@ struct CReg : public icu::UMemory { } /* This doesn't need to be thread safe. It's for u_cleanup only. */ - static void cleanup(void) { + static void cleanup() { while (gCRegHead) { CReg* n = gCRegHead; gCRegHead = gCRegHead->next; @@ -456,14 +461,14 @@ struct CReg : public icu::UMemory { // ------------------------------------- U_CAPI UCurrRegistryKey U_EXPORT2 -ucurr_register(const UChar* isoCode, const char* locale, UErrorCode *status) +ucurr_register(const char16_t* isoCode, const char* locale, UErrorCode *status) { if (status && U_SUCCESS(*status)) { char id[ULOC_FULLNAME_CAPACITY]; idForLocale(locale, id, sizeof(id), status); return CReg::reg(isoCode, id, status); } - return NULL; + return nullptr; } // ------------------------------------- @@ -474,7 +479,7 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status) if (status && U_SUCCESS(*status)) { return CReg::unreg(key); } - return FALSE; + return false; } #endif /* UCONFIG_NO_SERVICE */ @@ -483,14 +488,14 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status) /** * Release all static memory held by currency. */ -/*The declaration here is needed so currency_cleanup(void) +/*The declaration here is needed so currency_cleanup() * can call this function. */ static UBool U_CALLCONV -currency_cache_cleanup(void); +currency_cache_cleanup(); U_CDECL_BEGIN -static UBool U_CALLCONV currency_cleanup(void) { +static UBool U_CALLCONV currency_cleanup() { #if !UCONFIG_NO_SERVICE CReg::cleanup(); #endif @@ -501,7 +506,7 @@ static UBool U_CALLCONV currency_cleanup(void) { isoCodes_cleanup(); currSymbolsEquiv_cleanup(); - return TRUE; + return true; } U_CDECL_END @@ -509,7 +514,7 @@ U_CDECL_END U_CAPI int32_t U_EXPORT2 ucurr_forLocale(const char* locale, - UChar* buff, + char16_t* buff, int32_t buffCapacity, UErrorCode* ec) { if (U_FAILURE(*ec)) { return 0; } @@ -518,14 +523,18 @@ ucurr_forLocale(const char* locale, return 0; } - char currency[4]; // ISO currency codes are alpha3 codes. UErrorCode localStatus = U_ZERO_ERROR; - int32_t resLen = uloc_getKeywordValue(locale, "currency", - currency, UPRV_LENGTHOF(currency), &localStatus); - if (U_SUCCESS(localStatus) && resLen == 3 && uprv_isInvariantString(currency, resLen)) { + CharString currency; + { + CharStringByteSink sink(¤cy); + ulocimp_getKeywordValue(locale, "currency", sink, &localStatus); + } + int32_t resLen = currency.length(); + + if (U_SUCCESS(localStatus) && resLen == 3 && uprv_isInvariantString(currency.data(), resLen)) { if (resLen < buffCapacity) { - T_CString_toUpperCase(currency); - u_charsToUChars(currency, buff, resLen); + T_CString_toUpperCase(currency.data()); + u_charsToUChars(currency.data(), buff, resLen); } return u_terminateUChars(buff, buffCapacity, resLen, ec); } @@ -538,7 +547,7 @@ ucurr_forLocale(const char* locale, } #if !UCONFIG_NO_SERVICE - const UChar* result = CReg::get(id); + const char16_t* result = CReg::get(id); if (result) { if(buffCapacity > u_strlen(result)) { u_strcpy(buff, result); @@ -553,7 +562,7 @@ ucurr_forLocale(const char* locale, idDelim[0] = 0; } - const UChar* s = NULL; // Currency code from data file. + const char16_t* s = nullptr; // Currency code from data file. if (id[0] == 0) { // No point looking in the data for an empty string. // This is what we would get. @@ -564,19 +573,46 @@ ucurr_forLocale(const char* locale, UResourceBundle *rb = ures_openDirect(U_ICUDATA_CURR, CURRENCY_DATA, &localStatus); UResourceBundle *cm = ures_getByKey(rb, CURRENCY_MAP, rb, &localStatus); UResourceBundle *countryArray = ures_getByKey(rb, id, cm, &localStatus); - UResourceBundle *currencyReq = ures_getByIndex(countryArray, 0, NULL, &localStatus); - s = ures_getStringByKey(currencyReq, "id", &resLen, &localStatus); - ures_close(currencyReq); + // https://unicode-org.atlassian.net/browse/ICU-21997 + // Prefer to use currencies that are legal tender. + if (U_SUCCESS(localStatus)) { + int32_t arrayLength = ures_getSize(countryArray); + for (int32_t i = 0; i < arrayLength; ++i) { + LocalUResourceBundlePointer currencyReq( + ures_getByIndex(countryArray, i, nullptr, &localStatus)); + // The currency is legal tender if it is *not* marked with tender{"false"}. + UErrorCode tenderStatus = localStatus; + const char16_t *tender = + ures_getStringByKey(currencyReq.getAlias(), "tender", nullptr, &tenderStatus); + bool isTender = U_FAILURE(tenderStatus) || u_strcmp(tender, u"false") != 0; + if (!isTender && s != nullptr) { + // We already have a non-tender currency. Ignore all following non-tender ones. + continue; + } + // Fetch the currency code. + s = ures_getStringByKey(currencyReq.getAlias(), "id", &resLen, &localStatus); + if (isTender) { + break; + } + } + if (U_SUCCESS(localStatus) && s == nullptr) { + localStatus = U_MISSING_RESOURCE_ERROR; + } + } ures_close(countryArray); } if ((U_FAILURE(localStatus)) && strchr(id, '_') != 0) { // We don't know about it. Check to see if we support the variant. - uloc_getParent(locale, id, UPRV_LENGTHOF(id), ec); + CharString parent; + { + CharStringByteSink sink(&parent); + ulocimp_getParent(locale, sink, ec); + } *ec = U_USING_FALLBACK_WARNING; - // TODO: Loop over the shortened id rather than recursing and + // TODO: Loop over the parent rather than recursing and // looking again for a currency keyword. - return ucurr_forLocale(id, buff, buffCapacity, ec); + return ucurr_forLocale(parent.data(), buff, buffCapacity, ec); } if (*ec == U_ZERO_ERROR || localStatus != U_ZERO_ERROR) { // There is nothing to fallback to. Report the failure/warning if possible. @@ -596,37 +632,39 @@ ucurr_forLocale(const char* locale, * Modify the given locale name by removing the rightmost _-delimited * element. If there is none, empty the string ("" == root). * NOTE: The string "root" is not recognized; do not use it. - * @return TRUE if the fallback happened; FALSE if locale is already + * @return true if the fallback happened; false if locale is already * root (""). */ -static UBool fallback(char *loc) { - if (!*loc) { - return FALSE; +static UBool fallback(CharString& loc) { + if (loc.isEmpty()) { + return false; } UErrorCode status = U_ZERO_ERROR; - if (uprv_strcmp(loc, "en_GB") == 0) { + if (loc == "en_GB") { // HACK: See #13368. We need "en_GB" to fall back to "en_001" instead of "en" // in order to consume the correct data strings. This hack will be removed // when proper data sink loading is implemented here. - // NOTE: "001" adds 1 char over "GB". However, both call sites allocate - // arrays with length ULOC_FULLNAME_CAPACITY (plenty of room for en_001). - uprv_strcpy(loc + 3, "001"); + loc.truncate(3); + loc.append("001", status); } else { - uloc_getParent(loc, loc, (int32_t)uprv_strlen(loc), &status); + CharString tmp; + CharStringByteSink sink(&tmp); + ulocimp_getParent(loc.data(), sink, &status); + loc = std::move(tmp); } /* char *i = uprv_strrchr(loc, '_'); - if (i == NULL) { + if (i == nullptr) { i = loc; } *i = 0; */ - return TRUE; + return true; } -U_CAPI const UChar* U_EXPORT2 -ucurr_getName(const UChar* currency, +U_CAPI const char16_t* U_EXPORT2 +ucurr_getName(const char16_t* currency, const char* locale, UCurrNameStyle nameStyle, UBool* isChoiceFormat, // fillin @@ -649,7 +687,7 @@ ucurr_getName(const UChar* currency, } int32_t choice = (int32_t) nameStyle; - if (choice < 0 || choice > 2) { + if (choice < 0 || choice > 4) { *ec = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -667,26 +705,42 @@ ucurr_getName(const UChar* currency, // this function. UErrorCode ec2 = U_ZERO_ERROR; - char loc[ULOC_FULLNAME_CAPACITY]; - uloc_getName(locale, loc, sizeof(loc), &ec2); - if (U_FAILURE(ec2) || ec2 == U_STRING_NOT_TERMINATED_WARNING) { + CharString loc; + { + CharStringByteSink sink(&loc); + ulocimp_getName(locale, sink, &ec2); + } + if (U_FAILURE(ec2)) { *ec = U_ILLEGAL_ARGUMENT_ERROR; return 0; } char buf[ISO_CURRENCY_CODE_LENGTH+1]; myUCharsToChars(buf, currency); - + /* Normalize the keyword value to uppercase */ T_CString_toUpperCase(buf); - - const UChar* s = NULL; + + const char16_t* s = nullptr; ec2 = U_ZERO_ERROR; - LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2)); + LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc.data(), &ec2)); - if (nameStyle == UCURR_NARROW_SYMBOL_NAME) { + if (nameStyle == UCURR_NARROW_SYMBOL_NAME || nameStyle == UCURR_FORMAL_SYMBOL_NAME || nameStyle == UCURR_VARIANT_SYMBOL_NAME) { CharString key; - key.append(CURRENCIES_NARROW, ec2); + switch (nameStyle) { + case UCURR_NARROW_SYMBOL_NAME: + key.append(CURRENCIES_NARROW, ec2); + break; + case UCURR_FORMAL_SYMBOL_NAME: + key.append(CURRENCIES_FORMAL, ec2); + break; + case UCURR_VARIANT_SYMBOL_NAME: + key.append(CURRENCIES_VARIANT, ec2); + break; + default: + *ec = U_UNSUPPORTED_ERROR; + return 0; + } key.append("/", ec2); key.append(buf, ec2); s = ures_getStringByKeyWithFallback(rb.getAlias(), key.data(), len, &ec2); @@ -696,7 +750,7 @@ ucurr_getName(const UChar* currency, choice = UCURR_SYMBOL_NAME; } } - if (s == NULL) { + if (s == nullptr) { ures_getByKey(rb.getAlias(), CURRENCIES, rb.getAlias(), &ec2); ures_getByKeyWithFallback(rb.getAlias(), buf, rb.getAlias(), &ec2); s = ures_getStringByIndex(rb.getAlias(), choice, len, &ec2); @@ -713,11 +767,11 @@ ucurr_getName(const UChar* currency, // We no longer support choice format data in names. Data should not contain // choice patterns. - if (isChoiceFormat != NULL) { - *isChoiceFormat = FALSE; + if (isChoiceFormat != nullptr) { + *isChoiceFormat = false; } if (U_SUCCESS(ec2)) { - U_ASSERT(s != NULL); + U_ASSERT(s != nullptr); return s; } @@ -727,8 +781,8 @@ ucurr_getName(const UChar* currency, return currency; } -U_CAPI const UChar* U_EXPORT2 -ucurr_getPluralName(const UChar* currency, +U_CAPI const char16_t* U_EXPORT2 +ucurr_getPluralName(const char16_t* currency, const char* locale, UBool* isChoiceFormat, const char* pluralCount, @@ -753,9 +807,12 @@ ucurr_getPluralName(const UChar* currency, // this function. UErrorCode ec2 = U_ZERO_ERROR; - char loc[ULOC_FULLNAME_CAPACITY]; - uloc_getName(locale, loc, sizeof(loc), &ec2); - if (U_FAILURE(ec2) || ec2 == U_STRING_NOT_TERMINATED_WARNING) { + CharString loc; + { + CharStringByteSink sink(&loc); + ulocimp_getName(locale, sink, &ec2); + } + if (U_FAILURE(ec2)) { *ec = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -763,9 +820,9 @@ ucurr_getPluralName(const UChar* currency, char buf[ISO_CURRENCY_CODE_LENGTH+1]; myUCharsToChars(buf, currency); - const UChar* s = NULL; + const char16_t* s = nullptr; ec2 = U_ZERO_ERROR; - UResourceBundle* rb = ures_open(U_ICUDATA_CURR, loc, &ec2); + UResourceBundle* rb = ures_open(U_ICUDATA_CURR, loc.data(), &ec2); rb = ures_getByKey(rb, CURRENCYPLURALS, rb, &ec2); @@ -776,11 +833,11 @@ ucurr_getPluralName(const UChar* currency, if (U_FAILURE(ec2)) { // fall back to "other" ec2 = U_ZERO_ERROR; - s = ures_getStringByKeyWithFallback(rb, "other", len, &ec2); + s = ures_getStringByKeyWithFallback(rb, "other", len, &ec2); if (U_FAILURE(ec2)) { ures_close(rb); // fall back to long name in Currencies - return ucurr_getName(currency, locale, UCURR_LONG_NAME, + return ucurr_getName(currency, locale, UCURR_LONG_NAME, isChoiceFormat, len, ec); } } @@ -793,7 +850,7 @@ ucurr_getPluralName(const UChar* currency, || (ec2 == U_USING_FALLBACK_WARNING && *ec != U_USING_DEFAULT_WARNING)) { *ec = ec2; } - U_ASSERT(s != NULL); + U_ASSERT(s != nullptr); return s; } @@ -814,7 +871,7 @@ ucurr_getPluralName(const UChar* currency, typedef struct { const char* IsoCode; // key - UChar* currencyName; // value + char16_t* currencyName; // value int32_t currencyNameLen; // value length int32_t flag; // flags } CurrencyNameStruct; @@ -829,11 +886,11 @@ typedef struct { #endif -// Comparason function used in quick sort. +// Comparison function used in quick sort. static int U_CALLCONV currencyNameComparator(const void* a, const void* b) { const CurrencyNameStruct* currName_1 = (const CurrencyNameStruct*)a; const CurrencyNameStruct* currName_2 = (const CurrencyNameStruct*)b; - for (int32_t i = 0; + for (int32_t i = 0; i < MIN(currName_1->currencyNameLen, currName_2->currencyNameLen); ++i) { if (currName_1->currencyName[i] < currName_2->currencyName[i]) { @@ -855,7 +912,7 @@ static int U_CALLCONV currencyNameComparator(const void* a, const void* b) { // Give a locale, return the maximum number of currency names associated with // this locale. // It gets currency names from resource bundles using fallback. -// It is the maximum number because in the fallback chain, some of the +// It is the maximum number because in the fallback chain, some of the // currency names are duplicated. // For example, given locale as "en_US", the currency names get from resource // bundle in "en_US" and "en" are duplicated. The fallback mechanism will count @@ -865,23 +922,27 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_ U_NAMESPACE_USE *total_currency_name_count = 0; *total_currency_symbol_count = 0; - const UChar* s = NULL; - char locale[ULOC_FULLNAME_CAPACITY]; - uprv_strcpy(locale, loc); + const char16_t* s = nullptr; + CharString locale; + { + UErrorCode status = U_ZERO_ERROR; + locale.append(loc, status); + if (U_FAILURE(status)) { return; } + } const icu::Hashtable *currencySymbolsEquiv = getCurrSymbolsEquiv(); for (;;) { UErrorCode ec2 = U_ZERO_ERROR; // TODO: ures_openDirect? - UResourceBundle* rb = ures_open(U_ICUDATA_CURR, locale, &ec2); - UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, NULL, &ec2); + UResourceBundle* rb = ures_open(U_ICUDATA_CURR, locale.data(), &ec2); + UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, nullptr, &ec2); int32_t n = ures_getSize(curr); for (int32_t i=0; i(symbol->getBuffer()); + const_cast(symbol->getBuffer()); (*currencySymbols)[*total_currency_symbol_count].flag = 0; (*currencySymbols)[(*total_currency_symbol_count)++].currencyNameLen = symbol->length(); } @@ -1017,7 +1081,7 @@ collectCurrencyNames(const char* locale, // Add currency long name. s = ures_getStringByIndex(names, UCURR_LONG_NAME, &len, &ec2); (*currencyNames)[*total_currency_name_count].IsoCode = iso; - UChar* upperName = toUpperCase(s, len, locale); + char16_t* upperName = toUpperCase(s, len, locale); (*currencyNames)[*total_currency_name_count].currencyName = upperName; (*currencyNames)[*total_currency_name_count].flag = NEED_TO_BE_DELETED; (*currencyNames)[(*total_currency_name_count)++].currencyNameLen = len; @@ -1025,7 +1089,7 @@ collectCurrencyNames(const char* locale, // put (iso, 3, and iso) in to array // Add currency ISO code. (*currencySymbols)[*total_currency_symbol_count].IsoCode = iso; - (*currencySymbols)[*total_currency_symbol_count].currencyName = (UChar*)uprv_malloc(sizeof(UChar)*3); + (*currencySymbols)[*total_currency_symbol_count].currencyName = (char16_t*)uprv_malloc(sizeof(char16_t)*3); // Must convert iso[] into Unicode u_charsToUChars(iso, (*currencySymbols)[*total_currency_symbol_count].currencyName, 3); (*currencySymbols)[*total_currency_symbol_count].flag = NEED_TO_BE_DELETED; @@ -1036,30 +1100,30 @@ collectCurrencyNames(const char* locale, // currency plurals UErrorCode ec5 = U_ZERO_ERROR; - UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec5); + UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, nullptr, &ec5); n = ures_getSize(curr_p); for (int32_t i=0; i *maxMatchLen && len <= textLen && - uprv_memcmp(currencyNames[index].currencyName, text, len * sizeof(UChar)) == 0) { + uprv_memcmp(currencyNames[index].currencyName, text, len * sizeof(char16_t)) == 0) { *partialMatchLen = MAX(*partialMatchLen, len); *maxMatchIndex = index; *maxMatchLen = len; @@ -1277,9 +1341,9 @@ linearSearch(const CurrencyNameStruct* currencyNames, // @param maxMatchIndex: the index in currencyName which has the longest // match with input text. static void -searchCurrencyName(const CurrencyNameStruct* currencyNames, +searchCurrencyName(const CurrencyNameStruct* currencyNames, int32_t total_currency_count, - const UChar* text, int32_t textLen, + const char16_t* text, int32_t textLen, int32_t *partialMatchLen, int32_t* maxMatchLen, int32_t* maxMatchIndex) { *maxMatchIndex = -1; @@ -1297,7 +1361,7 @@ searchCurrencyName(const CurrencyNameStruct* currencyNames, // The 2nd round binary search search the second "B" in the text against // the 2nd char in currency names, and narrow the matching range to // "BB BBEX BBEXYZ" (and the maximum matching "BB"). - // The 3rd round returnes the range as "BBEX BBEXYZ" (without changing + // The 3rd round returns the range as "BBEX BBEXYZ" (without changing // maximum matching). // The 4th round returns the same range (the maximum matching is "BBEX"). // The 5th round returns no matching range. @@ -1311,8 +1375,8 @@ searchCurrencyName(const CurrencyNameStruct* currencyNames, break; } *partialMatchLen = MAX(*partialMatchLen, index + 1); - if (matchIndex != -1) { - // find an exact match for text from text[0] to text[index] + if (matchIndex != -1) { + // find an exact match for text from text[0] to text[index] // in currencyNames array. *maxMatchLen = index + 1; *maxMatchIndex = matchIndex; @@ -1341,7 +1405,7 @@ typedef struct { // reference count. // reference count is set to 1 when an entry is put to cache. // it increases by 1 before accessing, and decreased by 1 after accessing. - // The entry is deleted when ref count is zero, which means + // The entry is deleted when ref count is zero, which means // the entry is replaced out of cache and no process is accessing it. int32_t refCount; } CurrencyNameCacheEntry; @@ -1350,7 +1414,7 @@ typedef struct { #define CURRENCY_NAME_CACHE_NUM 10 // Reserve 10 cache entries. -static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {NULL}; +static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {nullptr}; // Using an index to indicate which entry to be replaced when cache is full. // It is a simple round-robin replacement strategy. static int8_t currentCacheEntryIndex = 0; @@ -1379,14 +1443,14 @@ deleteCacheEntry(CurrencyNameCacheEntry* entry) { // Cache clean up static UBool U_CALLCONV -currency_cache_cleanup(void) { +currency_cache_cleanup() { for (int32_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) { if (currCache[i]) { deleteCacheEntry(currCache[i]); currCache[i] = 0; } } - return TRUE; + return true; } @@ -1399,17 +1463,17 @@ static CurrencyNameCacheEntry* getCacheEntry(const char* locale, UErrorCode& ec) { int32_t total_currency_name_count = 0; - CurrencyNameStruct* currencyNames = NULL; + CurrencyNameStruct* currencyNames = nullptr; int32_t total_currency_symbol_count = 0; - CurrencyNameStruct* currencySymbols = NULL; - CurrencyNameCacheEntry* cacheEntry = NULL; + CurrencyNameStruct* currencySymbols = nullptr; + CurrencyNameCacheEntry* cacheEntry = nullptr; umtx_lock(&gCurrencyCacheMutex); // in order to handle racing correctly, // not putting 'search' in a separate function. int8_t found = -1; for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) { - if (currCache[i]!= NULL && + if (currCache[i]!= nullptr && uprv_strcmp(locale, currCache[i]->locale) == 0) { found = i; break; @@ -1423,21 +1487,21 @@ getCacheEntry(const char* locale, UErrorCode& ec) { if (found == -1) { collectCurrencyNames(locale, ¤cyNames, &total_currency_name_count, ¤cySymbols, &total_currency_symbol_count, ec); if (U_FAILURE(ec)) { - return NULL; + return nullptr; } umtx_lock(&gCurrencyCacheMutex); // check again. for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) { - if (currCache[i]!= NULL && + if (currCache[i]!= nullptr && uprv_strcmp(locale, currCache[i]->locale) == 0) { found = i; break; } } if (found == -1) { - // insert new entry to + // insert new entry to // currentCacheEntryIndex % CURRENCY_NAME_CACHE_NUM - // and remove the existing entry + // and remove the existing entry // currentCacheEntryIndex % CURRENCY_NAME_CACHE_NUM // from cache. cacheEntry = currCache[currentCacheEntryIndex]; @@ -1485,7 +1549,7 @@ uprv_parseCurrency(const char* locale, icu::ParsePosition& pos, int8_t type, int32_t* partialMatchLen, - UChar* result, + char16_t* result, UErrorCode& ec) { U_NAMESPACE_USE if (U_FAILURE(ec)) { @@ -1503,8 +1567,8 @@ uprv_parseCurrency(const char* locale, int32_t start = pos.getIndex(); - UChar inputText[MAX_CURRENCY_NAME_LEN]; - UChar upperText[MAX_CURRENCY_NAME_LEN]; + char16_t inputText[MAX_CURRENCY_NAME_LEN]; + char16_t upperText[MAX_CURRENCY_NAME_LEN]; int32_t textLen = MIN(MAX_CURRENCY_NAME_LEN, text.length() - start); text.extract(start, textLen, inputText); UErrorCode ec1 = U_ZERO_ERROR; @@ -1516,7 +1580,7 @@ uprv_parseCurrency(const char* locale, int32_t max = 0; int32_t matchIndex = -1; // case in-sensitive comparison against currency names - searchCurrencyName(currencyNames, total_currency_name_count, + searchCurrencyName(currencyNames, total_currency_name_count, upperText, textLen, partialMatchLen, &max, &matchIndex); #ifdef UCURR_DEBUG @@ -1527,7 +1591,7 @@ uprv_parseCurrency(const char* locale, int32_t matchIndexInSymbol = -1; if (type != UCURR_LONG_NAME) { // not name only // case sensitive comparison against currency symbols and ISO code. - searchCurrencyName(currencySymbols, total_currency_symbol_count, + searchCurrencyName(currencySymbols, total_currency_symbol_count, inputText, textLen, partialMatchLen, &maxInSymbol, &matchIndexInSymbol); @@ -1592,13 +1656,13 @@ void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode& * DecimalFormat and DecimalFormatSymbols. */ U_CAPI void -uprv_getStaticCurrencyName(const UChar* iso, const char* loc, +uprv_getStaticCurrencyName(const char16_t* iso, const char* loc, icu::UnicodeString& result, UErrorCode& ec) { U_NAMESPACE_USE int32_t len; - const UChar* currname = ucurr_getName(iso, loc, UCURR_SYMBOL_NAME, + const char16_t* currname = ucurr_getName(iso, loc, UCURR_SYMBOL_NAME, nullptr /* isChoiceFormat */, &len, &ec); if (U_SUCCESS(ec)) { result.setTo(currname, len); @@ -1606,12 +1670,12 @@ uprv_getStaticCurrencyName(const UChar* iso, const char* loc, } U_CAPI int32_t U_EXPORT2 -ucurr_getDefaultFractionDigits(const UChar* currency, UErrorCode* ec) { +ucurr_getDefaultFractionDigits(const char16_t* currency, UErrorCode* ec) { return ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec); } -U_DRAFT int32_t U_EXPORT2 -ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) { +U_CAPI int32_t U_EXPORT2 +ucurr_getDefaultFractionDigitsForUsage(const char16_t* currency, const UCurrencyUsage usage, UErrorCode* ec) { int32_t fracDigits = 0; if (U_SUCCESS(*ec)) { switch (usage) { @@ -1629,12 +1693,12 @@ ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsa } U_CAPI double U_EXPORT2 -ucurr_getRoundingIncrement(const UChar* currency, UErrorCode* ec) { +ucurr_getRoundingIncrement(const char16_t* currency, UErrorCode* ec) { return ucurr_getRoundingIncrementForUsage(currency, UCURR_USAGE_STANDARD, ec); } -U_DRAFT double U_EXPORT2 -ucurr_getRoundingIncrementForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) { +U_CAPI double U_EXPORT2 +ucurr_getRoundingIncrementForUsage(const char16_t* currency, const UCurrencyUsage usage, UErrorCode* ec) { double result = 0.0; const int32_t *data = _findMetaData(currency, *ec); @@ -1776,7 +1840,6 @@ static const struct CurrencyList { {"ECV", UCURR_UNCOMMON|UCURR_DEPRECATED}, {"EEK", UCURR_COMMON|UCURR_DEPRECATED}, {"EGP", UCURR_COMMON|UCURR_NON_DEPRECATED}, - {"EQE", UCURR_COMMON|UCURR_DEPRECATED}, // questionable, remove? {"ERN", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"ESA", UCURR_UNCOMMON|UCURR_DEPRECATED}, {"ESB", UCURR_UNCOMMON|UCURR_DEPRECATED}, @@ -1914,6 +1977,7 @@ static const struct CurrencyList { {"SHP", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"SIT", UCURR_COMMON|UCURR_DEPRECATED}, {"SKK", UCURR_COMMON|UCURR_DEPRECATED}, + {"SLE", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"SLL", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"SOS", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"SRD", UCURR_COMMON|UCURR_NON_DEPRECATED}, @@ -1948,9 +2012,12 @@ static const struct CurrencyList { {"UYI", UCURR_UNCOMMON|UCURR_NON_DEPRECATED}, {"UYP", UCURR_COMMON|UCURR_DEPRECATED}, {"UYU", UCURR_COMMON|UCURR_NON_DEPRECATED}, + {"UYW", UCURR_UNCOMMON|UCURR_NON_DEPRECATED}, {"UZS", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"VEB", UCURR_COMMON|UCURR_DEPRECATED}, + {"VED", UCURR_UNCOMMON|UCURR_NON_DEPRECATED}, {"VEF", UCURR_COMMON|UCURR_NON_DEPRECATED}, + {"VES", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"VND", UCURR_COMMON|UCURR_NON_DEPRECATED}, {"VNN", UCURR_COMMON|UCURR_DEPRECATED}, {"VUV", UCURR_COMMON|UCURR_NON_DEPRECATED}, @@ -1991,7 +2058,7 @@ static const struct CurrencyList { {"ZWD", UCURR_COMMON|UCURR_DEPRECATED}, {"ZWL", UCURR_COMMON|UCURR_DEPRECATED}, {"ZWR", UCURR_COMMON|UCURR_DEPRECATED}, - { NULL, 0 } // Leave here to denote the end of the list. + { nullptr, 0 } // Leave here to denote the end of the list. }; #define UCURR_MATCHES_BITMASK(variable, typeToMatch) \ @@ -2004,7 +2071,7 @@ ucurr_countCurrencyList(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) { int32_t count = 0; /* Count the number of items matching the type we are looking for. */ - for (int32_t idx = 0; gCurrencyList[idx].currency != NULL; idx++) { + for (int32_t idx = 0; gCurrencyList[idx].currency != nullptr; idx++) { if (UCURR_MATCHES_BITMASK(gCurrencyList[idx].currType, currType)) { count++; } @@ -2034,7 +2101,7 @@ ucurr_nextCurrencyList(UEnumeration *enumerator, if (resultLength) { *resultLength = 0; } - return NULL; + return nullptr; } static void U_CALLCONV @@ -2057,37 +2124,37 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){ UResourceBundle *currencyMapArray = ures_getByKey(rb, CURRENCY_MAP, rb, &localStatus); if (U_SUCCESS(localStatus)) { - // process each entry in currency map + // process each entry in currency map for (int32_t i=0; ito = toDate; localStatus = U_ZERO_ERROR; - uhash_put(isoCodes, (UChar *)isoCode, entry, &localStatus); + uhash_put(isoCodes, (char16_t *)isoCode, entry, &localStatus); } } else { *status = localStatus; @@ -2130,8 +2197,8 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){ } static const UEnumeration gEnumCurrencyList = { - NULL, - NULL, + nullptr, + nullptr, ucurr_closeCurrencyList, ucurr_countCurrencyList, uenum_unextDefault, @@ -2142,10 +2209,10 @@ U_CDECL_END static void U_CALLCONV initIsoCodes(UErrorCode &status) { - U_ASSERT(gIsoCodes == NULL); + U_ASSERT(gIsoCodes == nullptr); ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup); - UHashtable *isoCodes = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status); + UHashtable *isoCodes = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status); if (U_FAILURE(status)) { return; } @@ -2180,11 +2247,11 @@ static void populateCurrSymbolsEquiv(icu::Hashtable *hash, UErrorCode &status) { } static void U_CALLCONV initCurrSymbolsEquiv() { - U_ASSERT(gCurrSymbolsEquiv == NULL); + U_ASSERT(gCurrSymbolsEquiv == nullptr); UErrorCode status = U_ZERO_ERROR; ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup); icu::Hashtable *temp = new icu::Hashtable(status); - if (temp == NULL) { + if (temp == nullptr) { return; } if (U_FAILURE(status)) { @@ -2201,22 +2268,22 @@ static void U_CALLCONV initCurrSymbolsEquiv() { } U_CAPI UBool U_EXPORT2 -ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, UErrorCode* eErrorCode) { +ucurr_isAvailable(const char16_t* isoCode, UDate from, UDate to, UErrorCode* eErrorCode) { umtx_initOnce(gIsoCodesInitOnce, &initIsoCodes, *eErrorCode); if (U_FAILURE(*eErrorCode)) { - return FALSE; + return false; } IsoCodeEntry* result = (IsoCodeEntry *) uhash_get(gIsoCodes, isoCode); - if (result == NULL) { - return FALSE; + if (result == nullptr) { + return false; } else if (from > to) { *eErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } else if ((from > result->to) || (to < result->from)) { - return FALSE; + return false; } - return TRUE; + return true; } static const icu::Hashtable* getCurrSymbolsEquiv() { @@ -2226,20 +2293,20 @@ static const icu::Hashtable* getCurrSymbolsEquiv() { U_CAPI UEnumeration * U_EXPORT2 ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode) { - UEnumeration *myEnum = NULL; + UEnumeration *myEnum = nullptr; UCurrencyContext *myContext; myEnum = (UEnumeration*)uprv_malloc(sizeof(UEnumeration)); - if (myEnum == NULL) { + if (myEnum == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uprv_memcpy(myEnum, &gEnumCurrencyList, sizeof(UEnumeration)); myContext = (UCurrencyContext*)uprv_malloc(sizeof(UCurrencyContext)); - if (myContext == NULL) { + if (myContext == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; uprv_free(myEnum); - return NULL; + return nullptr; } myContext->currType = currType; myContext->listIdx = 0; @@ -2248,18 +2315,17 @@ ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode) { } U_CAPI int32_t U_EXPORT2 -ucurr_countCurrencies(const char* locale, - UDate date, +ucurr_countCurrencies(const char* locale, + UDate date, UErrorCode* ec) { int32_t currCount = 0; - if (ec != NULL && U_SUCCESS(*ec)) + if (ec != nullptr && U_SUCCESS(*ec)) { // local variables UErrorCode localStatus = U_ZERO_ERROR; char id[ULOC_FULLNAME_CAPACITY]; - uloc_getKeywordValue(locale, "currency", id, ULOC_FULLNAME_CAPACITY, &localStatus); // get country or country_variant in `id' idForLocale(locale, id, sizeof(id), ec); @@ -2289,21 +2355,21 @@ ucurr_countCurrencies(const char* locale, for (int32_t i=0; i 2) { int32_t toLength = 0; - UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus); + UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus); const int32_t *toArray = ures_getIntVector(toRes, &toLength, &localStatus); currDate64 = (int64_t)toArray[0] << 32; @@ -2337,7 +2403,7 @@ ucurr_countCurrencies(const char* locale, // Check for errors if (*ec == U_ZERO_ERROR || localStatus != U_ZERO_ERROR) { - // There is nothing to fallback to. + // There is nothing to fallback to. // Report the failure/warning if possible. *ec = localStatus; } @@ -2355,19 +2421,19 @@ ucurr_countCurrencies(const char* locale, return 0; } -U_CAPI int32_t U_EXPORT2 -ucurr_forLocaleAndDate(const char* locale, - UDate date, +U_CAPI int32_t U_EXPORT2 +ucurr_forLocaleAndDate(const char* locale, + UDate date, int32_t index, - UChar* buff, - int32_t buffCapacity, + char16_t* buff, + int32_t buffCapacity, UErrorCode* ec) { int32_t resLen = 0; int32_t currIndex = 0; - const UChar* s = NULL; + const char16_t* s = nullptr; - if (ec != NULL && U_SUCCESS(*ec)) + if (ec != nullptr && U_SUCCESS(*ec)) { // check the arguments passed if ((buff && buffCapacity) || !buffCapacity ) @@ -2375,7 +2441,6 @@ ucurr_forLocaleAndDate(const char* locale, // local variables UErrorCode localStatus = U_ZERO_ERROR; char id[ULOC_FULLNAME_CAPACITY]; - resLen = uloc_getKeywordValue(locale, "currency", id, ULOC_FULLNAME_CAPACITY, &localStatus); // get country or country_variant in `id' idForLocale(locale, id, sizeof(id), ec); @@ -2412,22 +2477,22 @@ ucurr_forLocaleAndDate(const char* locale, for (int32_t i=0; i 2) { int32_t toLength = 0; - UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus); + UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus); const int32_t *toArray = ures_getIntVector(toRes, &toLength, &localStatus); currDate64 = (int64_t)toArray[0] << 32; @@ -2475,7 +2540,7 @@ ucurr_forLocaleAndDate(const char* locale, // Check for errors if (*ec == U_ZERO_ERROR || localStatus != U_ZERO_ERROR) { - // There is nothing to fallback to. + // There is nothing to fallback to. // Report the failure/warning if possible. *ec = localStatus; } @@ -2510,38 +2575,38 @@ ucurr_forLocaleAndDate(const char* locale, return resLen; } -static const UEnumeration ucurr_defaultKeywordValues = { - NULL, - NULL, +static const UEnumeration defaultKeywordValues = { + nullptr, + nullptr, ulist_close_keyword_values_iterator, ulist_count_keyword_values, uenum_unextDefault, - ulist_next_keyword_value, + ulist_next_keyword_value, ulist_reset_keyword_values_iterator }; U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key, const char *locale, UBool commonlyUsed, UErrorCode* status) { // Resolve region char prefRegion[ULOC_COUNTRY_CAPACITY]; - ulocimp_getRegionForSupplementalData(locale, TRUE, prefRegion, sizeof(prefRegion), status); - + ulocimp_getRegionForSupplementalData(locale, true, prefRegion, sizeof(prefRegion), status); + // Read value from supplementalData UList *values = ulist_createEmptyList(status); UList *otherValues = ulist_createEmptyList(status); UEnumeration *en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration)); - if (U_FAILURE(*status) || en == NULL) { - if (en == NULL) { + if (U_FAILURE(*status) || en == nullptr) { + if (en == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; } else { uprv_free(en); } ulist_deleteList(values); ulist_deleteList(otherValues); - return NULL; + return nullptr; } - memcpy(en, &ucurr_defaultKeywordValues, sizeof(UEnumeration)); + memcpy(en, &defaultKeywordValues, sizeof(UEnumeration)); en->context = values; - + UResourceBundle *bundle = ures_openDirect(U_ICUDATA_CURR, "supplementalData", status); ures_getByKey(bundle, "CurrencyMap", bundle, status); UResourceBundle bundlekey, regbndl, curbndl, to; @@ -2549,14 +2614,14 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key, ures_initStackObject(®bndl); ures_initStackObject(&curbndl); ures_initStackObject(&to); - + while (U_SUCCESS(*status) && ures_hasNext(bundle)) { ures_getNextResource(bundle, &bundlekey, status); if (U_FAILURE(*status)) { break; } const char *region = ures_getKey(&bundlekey); - UBool isPrefRegion = uprv_strcmp(region, prefRegion) == 0 ? TRUE : FALSE; + UBool isPrefRegion = uprv_strcmp(region, prefRegion) == 0 ? true : false; if (!isPrefRegion && commonlyUsed) { // With commonlyUsed=true, we do not put // currencies for other regions in the @@ -2575,17 +2640,17 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key, } char *curID = (char *)uprv_malloc(sizeof(char) * ULOC_KEYWORDS_CAPACITY); int32_t curIDLength = ULOC_KEYWORDS_CAPACITY; - if (curID == NULL) { + if (curID == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } #if U_CHARSET_FAMILY==U_ASCII_FAMILY - ures_getUTF8StringByKey(&curbndl, "id", curID, &curIDLength, TRUE, status); + ures_getUTF8StringByKey(&curbndl, "id", curID, &curIDLength, true, status); /* optimize - use the utf-8 string */ #else { - const UChar* defString = ures_getStringByKey(&curbndl, "id", &curIDLength, status); + const char16_t* defString = ures_getStringByKey(&curbndl, "id", &curIDLength, status); if(U_SUCCESS(*status)) { if(curIDLength+1 > ULOC_KEYWORDS_CAPACITY) { *status = U_BUFFER_OVERFLOW_ERROR; @@ -2594,29 +2659,29 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key, } } } -#endif +#endif if (U_FAILURE(*status)) { break; } - UBool hasTo = FALSE; + UBool hasTo = false; ures_getByKey(&curbndl, "to", &to, status); if (U_FAILURE(*status)) { // Do nothing here... *status = U_ZERO_ERROR; } else { - hasTo = TRUE; + hasTo = true; } if (isPrefRegion && !hasTo && !ulist_containsString(values, curID, (int32_t)uprv_strlen(curID))) { // Currently active currency for the target country - ulist_addItemEndList(values, curID, TRUE, status); + ulist_addItemEndList(values, curID, true, status); } else if (!ulist_containsString(otherValues, curID, (int32_t)uprv_strlen(curID)) && !commonlyUsed) { - ulist_addItemEndList(otherValues, curID, TRUE, status); + ulist_addItemEndList(otherValues, curID, true, status); } else { uprv_free(curID); } } - + } if (U_SUCCESS(*status)) { if (commonlyUsed) { @@ -2624,45 +2689,45 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key, // This could happen if no valid region is supplied in the input // locale. In this case, we use the CLDR's default. uenum_close(en); - en = ucurr_getKeywordValuesForLocale(key, "und", TRUE, status); + en = ucurr_getKeywordValuesForLocale(key, "und", true, status); } } else { // Consolidate the list - char *value = NULL; + char *value = nullptr; ulist_resetList(otherValues); - while ((value = (char *)ulist_getNext(otherValues)) != NULL) { + while ((value = (char *)ulist_getNext(otherValues)) != nullptr) { if (!ulist_containsString(values, value, (int32_t)uprv_strlen(value))) { char *tmpValue = (char *)uprv_malloc(sizeof(char) * ULOC_KEYWORDS_CAPACITY); uprv_memcpy(tmpValue, value, uprv_strlen(value) + 1); - ulist_addItemEndList(values, tmpValue, TRUE, status); + ulist_addItemEndList(values, tmpValue, true, status); if (U_FAILURE(*status)) { break; } } } } - + ulist_resetList((UList *)(en->context)); } else { ulist_deleteList(values); uprv_free(en); - values = NULL; - en = NULL; + values = nullptr; + en = nullptr; } ures_close(&to); ures_close(&curbndl); ures_close(®bndl); ures_close(&bundlekey); ures_close(bundle); - + ulist_deleteList(otherValues); - + return en; } U_CAPI int32_t U_EXPORT2 -ucurr_getNumericCode(const UChar* currency) { +ucurr_getNumericCode(const char16_t* currency) { int32_t code = 0; if (currency && u_strlen(currency) == ISO_CURRENCY_CODE_LENGTH) { UErrorCode status = U_ZERO_ERROR; diff --git a/src/duckdb/extension/icu/third_party/icu/common/udata.cpp b/src/duckdb/extension/icu/third_party/icu/common/udata.cpp index ea8c7046a..88126fc68 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/udata.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/udata.cpp @@ -104,12 +104,12 @@ static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err); * that they really need, reducing the size of binaries that take advantage * of this. */ -static UDataMemory *gCommonICUDataArray[10] = { NULL }; // Access protected by icu global mutex. +static UDataMemory *gCommonICUDataArray[10] = { nullptr }; // Access protected by icu global mutex. -static u_atomic_int32_t gHaveTriedToLoadCommonData = ATOMIC_INT32_T_INITIALIZER(0); // See extendICUData(). +static u_atomic_int32_t gHaveTriedToLoadCommonData {0}; // See extendICUData(). -static UHashtable *gCommonDataCache = NULL; /* Global hash table of opened ICU data files. */ -static icu::UInitOnce gCommonDataCacheInitOnce = U_INITONCE_INITIALIZER; +static UHashtable *gCommonDataCache = nullptr; /* Global hash table of opened ICU data files. */ +static icu::UInitOnce gCommonDataCacheInitOnce {}; #if !defined(ICU_DATA_DIR_WINDOWS) static UDataFileAccess gDataFileAccess = UDATA_DEFAULT_ACCESS; // Access not synchronized. @@ -120,41 +120,41 @@ static UDataFileAccess gDataFileAccess = UDATA_NO_FILES; #endif static UBool U_CALLCONV -udata_cleanup(void) +udata_cleanup() { int32_t i; if (gCommonDataCache) { /* Delete the cache of user data mappings. */ uhash_close(gCommonDataCache); /* Table owns the contents, and will delete them. */ - gCommonDataCache = NULL; /* Cleanup is not thread safe. */ + gCommonDataCache = nullptr; /* Cleanup is not thread safe. */ } gCommonDataCacheInitOnce.reset(); - for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray) && gCommonICUDataArray[i] != NULL; ++i) { + for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray) && gCommonICUDataArray[i] != nullptr; ++i) { udata_close(gCommonICUDataArray[i]); - gCommonICUDataArray[i] = NULL; + gCommonICUDataArray[i] = nullptr; } gHaveTriedToLoadCommonData = 0; - return TRUE; /* Everything was cleaned up */ + return true; /* Everything was cleaned up */ } static UBool U_CALLCONV findCommonICUDataByName(const char *inBasename, UErrorCode &err) { - UBool found = FALSE; + UBool found = false; int32_t i; UDataMemory *pData = udata_findCachedData(inBasename, err); - if (U_FAILURE(err) || pData == NULL) - return FALSE; + if (U_FAILURE(err) || pData == nullptr) + return false; { Mutex lock; for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) { - if ((gCommonICUDataArray[i] != NULL) && (gCommonICUDataArray[i]->pHeader == pData->pHeader)) { + if ((gCommonICUDataArray[i] != nullptr) && (gCommonICUDataArray[i]->pHeader == pData->pHeader)) { /* The data pointer is already in the array. */ - found = TRUE; + found = true; break; } } @@ -174,9 +174,9 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca { UDataMemory *newCommonData = UDataMemory_createNewInstance(pErr); int32_t i; - UBool didUpdate = FALSE; + UBool didUpdate = false; if (U_FAILURE(*pErr)) { - return FALSE; + return false; } /* For the assignment, other threads must cleanly see either the old */ @@ -184,18 +184,18 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca /* deleted - someone may still have a pointer to it lying around in */ /* their locals. */ UDatamemory_assign(newCommonData, pData); - umtx_lock(NULL); + umtx_lock(nullptr); for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) { - if (gCommonICUDataArray[i] == NULL) { + if (gCommonICUDataArray[i] == nullptr) { gCommonICUDataArray[i] = newCommonData; - didUpdate = TRUE; + didUpdate = true; break; } else if (gCommonICUDataArray[i]->pHeader == pData->pHeader) { /* The same data pointer is already in the array. */ break; } } - umtx_unlock(NULL); + umtx_unlock(nullptr); if (i == UPRV_LENGTHOF(gCommonICUDataArray) && warn) { *pErr = U_USING_DEFAULT_WARNING; @@ -216,7 +216,7 @@ setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCod UDataMemory_init(&tData); UDataMemory_setData(&tData, pData); udata_checkCommonData(&tData, pErrorCode); - return setCommonICUData(&tData, FALSE, pErrorCode); + return setCommonICUData(&tData, false, pErrorCode); } #endif @@ -224,7 +224,7 @@ setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCod static const char * findBasename(const char *path) { const char *basename=uprv_strrchr(path, U_FILE_SEP_CHAR); - if(basename==NULL) { + if(basename==nullptr) { return path; } else { return basename+1; @@ -235,13 +235,13 @@ findBasename(const char *path) { static const char * packageNameFromPath(const char *path) { - if((path == NULL) || (*path == 0)) { + if((path == nullptr) || (*path == 0)) { return U_ICUDATA_NAME; } path = findBasename(path); - if((path == NULL) || (*path == 0)) { + if((path == nullptr) || (*path == 0)) { return U_ICUDATA_NAME; } @@ -281,12 +281,12 @@ static void U_CALLCONV DataCacheElement_deleter(void *pDCEl) { } static void U_CALLCONV udata_initHashTable(UErrorCode &err) { - U_ASSERT(gCommonDataCache == NULL); - gCommonDataCache = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &err); + U_ASSERT(gCommonDataCache == nullptr); + gCommonDataCache = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &err); if (U_FAILURE(err)) { return; } - U_ASSERT(gCommonDataCache != NULL); + U_ASSERT(gCommonDataCache != nullptr); uhash_setValueDeleter(gCommonDataCache, DataCacheElement_deleter); ucln_common_registerCleanup(UCLN_COMMON_UDATA, udata_cleanup); } @@ -305,20 +305,20 @@ static UHashtable *udata_getHashTable(UErrorCode &err) { static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err) { UHashtable *htable; - UDataMemory *retVal = NULL; + UDataMemory *retVal = nullptr; DataCacheElement *el; const char *baseName; htable = udata_getHashTable(err); if (U_FAILURE(err)) { - return NULL; + return nullptr; } baseName = findBasename(path); /* Cache remembers only the base name, not the full path. */ - umtx_lock(NULL); + umtx_lock(nullptr); el = (DataCacheElement *)uhash_get(htable, baseName); - umtx_unlock(NULL); - if (el != NULL) { + umtx_unlock(nullptr); + if (el != nullptr) { retVal = el->item; } #ifdef UDATA_DEBUG @@ -333,45 +333,45 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr const char *baseName; int32_t nameLen; UHashtable *htable; - DataCacheElement *oldValue = NULL; + DataCacheElement *oldValue = nullptr; UErrorCode subErr = U_ZERO_ERROR; htable = udata_getHashTable(*pErr); if (U_FAILURE(*pErr)) { - return NULL; + return nullptr; } /* Create a new DataCacheElement - the thingy we store in the hash table - * and copy the supplied path and UDataMemoryItems into it. */ newElement = (DataCacheElement *)uprv_malloc(sizeof(DataCacheElement)); - if (newElement == NULL) { + if (newElement == nullptr) { *pErr = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } newElement->item = UDataMemory_createNewInstance(pErr); if (U_FAILURE(*pErr)) { uprv_free(newElement); - return NULL; + return nullptr; } UDatamemory_assign(newElement->item, item); baseName = findBasename(path); nameLen = (int32_t)uprv_strlen(baseName); newElement->name = (char *)uprv_malloc(nameLen+1); - if (newElement->name == NULL) { + if (newElement->name == nullptr) { *pErr = U_MEMORY_ALLOCATION_ERROR; uprv_free(newElement->item); uprv_free(newElement); - return NULL; + return nullptr; } uprv_strcpy(newElement->name, baseName); /* Stick the new DataCacheElement into the hash table. */ - umtx_lock(NULL); + umtx_lock(nullptr); oldValue = (DataCacheElement *)uhash_get(htable, path); - if (oldValue != NULL) { + if (oldValue != nullptr) { subErr = U_USING_DEFAULT_WARNING; } else { @@ -381,10 +381,10 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr newElement, /* Value */ &subErr); } - umtx_unlock(NULL); + umtx_unlock(nullptr); #ifdef UDATA_DEBUG - fprintf(stderr, "Cache: [%s] <<< %p : %s. vFunc=%p\n", newElement->name, + fprintf(stderr, "Cache: [%s] <<< %p : %s. vFunc=%p\n", newElement->name, (void*) newElement->item, u_errorName(subErr), (void*) newElement->item->vFuncs); #endif @@ -393,7 +393,7 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr uprv_free(newElement->name); uprv_free(newElement->item); uprv_free(newElement); - return oldValue ? oldValue->item : NULL; + return oldValue ? oldValue->item : nullptr; } return newElement->item; @@ -429,20 +429,20 @@ class UDataPathIterator CharString pathBuffer; /* output path for this it'ion */ CharString packageStub; /* example: "/icudt28b". Will ignore that leaf in set paths. */ - UBool checkLastFour; /* if TRUE then allow paths such as '/foo/myapp.dat' + UBool checkLastFour; /* if true then allow paths such as '/foo/myapp.dat' * to match, checks last 4 chars of suffix with * last 4 of path, then previous chars. */ }; /** * @param iter The iterator to be initialized. Its current state does not matter. - * @param inPath The full pathname to be iterated over. If NULL, defaults to U_ICUDATA_NAME - * @param pkg Package which is being searched for, ex "icudt28l". Will ignore leaf directories such as /icudt28l - * @param item Item to be searched for. Can include full path, such as /a/b/foo.dat + * @param inPath The full pathname to be iterated over. If nullptr, defaults to U_ICUDATA_NAME + * @param pkg Package which is being searched for, ex "icudt28l". Will ignore leaf directories such as /icudt28l + * @param item Item to be searched for. Can include full path, such as /a/b/foo.dat * @param inSuffix Optional item suffix, if not-null (ex. ".dat") then 'path' can contain 'item' explicitly. - * Ex: 'stuff.dat' would be found in '/a/foo:/tmp/stuff.dat:/bar/baz' as item #2. + * Ex: 'stuff.dat' would be found in '/a/foo:/tmp/stuff.dat:/bar/baz' as item #2. * '/blarg/stuff.dat' would also be found. - * Note: inSuffix may also be the 'item' being searched for as well, (ex: "ibm-5348_P100-1997.cnv"), in which case + * Note: inSuffix may also be the 'item' being searched for as well, (ex: "ibm-5348_P100-1997.cnv"), in which case * the 'item' parameter is often the same as pkg. (Though sometimes might have a tree part as well, ex: "icudt62l-curr"). */ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg, @@ -453,14 +453,14 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg, fprintf(stderr, "SUFFIX1=%s PATH=%s\n", inSuffix, inPath); #endif /** Path **/ - if(inPath == NULL) { + if(inPath == nullptr) { path = u_getDataDirectory(); } else { path = inPath; } /** Package **/ - if(pkg != NULL) { + if(pkg != nullptr) { packageStub.append(U_FILE_SEP_CHAR, *pErrorCode).append(pkg, *pErrorCode); #ifdef UDATA_DEBUG fprintf(stderr, "STUB=%s [%d]\n", packageStub.data(), packageStub.length()); @@ -483,7 +483,7 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg, #endif /** Suffix **/ - if(inSuffix != NULL) { + if(inSuffix != nullptr) { suffix = inSuffix; } else { suffix = ""; @@ -501,30 +501,30 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg, suffix.data(), itemPath.data(), nextPath, - checkLastFour?"TRUE":"false"); + checkLastFour?"true":"false"); #endif } /** * Get the next path on the list. * - * @param iter The Iter to be used - * @param len If set, pointer to the length of the returned path, for convenience. - * @return Pointer to the next path segment, or NULL if there are no more. + * @param iter The Iter to be used + * @param len If set, pointer to the length of the returned path, for convenience. + * @return Pointer to the next path segment, or nullptr if there are no more. */ const char *UDataPathIterator::next(UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - const char *currentPath = NULL; + const char *currentPath = nullptr; int32_t pathLen = 0; const char *pathBasename; do { - if( nextPath == NULL ) { + if( nextPath == nullptr ) { break; } currentPath = nextPath; @@ -535,9 +535,9 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode) } else { /* fix up next for next time */ nextPath = uprv_strchr(currentPath, U_PATH_SEP_CHAR); - if(nextPath == NULL) { + if(nextPath == nullptr) { /* segment: entire path */ - pathLen = (int32_t)uprv_strlen(currentPath); + pathLen = (int32_t)uprv_strlen(currentPath); } else { /* segment: until next segment */ pathLen = (int32_t)(nextPath - currentPath); @@ -553,7 +553,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode) #ifdef UDATA_DEBUG fprintf(stderr, "rest of path (IDD) = %s\n", currentPath); fprintf(stderr, " "); - { + { int32_t qqq; for(qqq=0;qqq=4) && uprv_strncmp(pathBuffer.data() +(pathLen-4), suffix.data(), 4)==0 && /* suffix matches */ uprv_strncmp(findBasename(pathBuffer.data()), basename, basenameLen)==0 && /* base matches */ @@ -579,7 +579,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode) #endif /* do nothing */ } - else + else { /* regular dir path */ if(pathBuffer[pathLen-1] != U_FILE_SEP_CHAR) { if((pathLen>=4) && @@ -626,7 +626,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode) } while(path); /* fell way off the end */ - return NULL; + return nullptr; } U_NAMESPACE_END @@ -643,7 +643,7 @@ U_NAMESPACE_END *----------------------------------------------------------------------*/ #if !defined(ICU_DATA_DIR_WINDOWS) // When using the Windows system data, we expect only a single data file. -extern "C" const unsigned char U_DATA_API U_ICUDATA_ENTRY_POINT []; +extern "C" const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT; #endif /* @@ -652,8 +652,8 @@ extern "C" const unsigned char U_DATA_API U_ICUDATA_ENTRY_POINT []; * to its data package, if it is linked in. */ /* -extern const void *uprv_getICUData_collation(void) ATTRIBUTE_WEAK; -extern const void *uprv_getICUData_conversion(void) ATTRIBUTE_WEAK; +extern const void *uprv_getICUData_collation() ATTRIBUTE_WEAK; +extern const void *uprv_getICUData_conversion() ATTRIBUTE_WEAK; */ /*----------------------------------------------------------------------* @@ -668,7 +668,7 @@ extern const void *uprv_getICUData_conversion(void) ATTRIBUTE_WEAK; *----------------------------------------------------------------------*/ static UDataMemory * openCommonData(const char *path, /* Path from OpenChoice? */ - int32_t commonDataIndex, /* ICU Data (index >= 0) if path == NULL */ + int32_t commonDataIndex, /* ICU Data (index >= 0) if path == nullptr */ UErrorCode *pErrorCode) { UDataMemory tData; @@ -676,29 +676,29 @@ openCommonData(const char *path, /* Path from OpenChoice? */ const char *inBasename; if (U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } UDataMemory_init(&tData); - /* ??????? TODO revisit this */ + /* ??????? TODO revisit this */ if (commonDataIndex >= 0) { /* "mini-cache" for common ICU data */ if(commonDataIndex >= UPRV_LENGTHOF(gCommonICUDataArray)) { - return NULL; + return nullptr; } { Mutex lock; - if(gCommonICUDataArray[commonDataIndex] != NULL) { + if(gCommonICUDataArray[commonDataIndex] != nullptr) { return gCommonICUDataArray[commonDataIndex]; } #if !defined(ICU_DATA_DIR_WINDOWS) // When using the Windows system data, we expect only a single data file. int32_t i; for(i = 0; i < commonDataIndex; ++i) { - if((void*) gCommonICUDataArray[i]->pHeader == (void*) &U_ICUDATA_ENTRY_POINT) { + if(gCommonICUDataArray[i]->pHeader == &U_ICUDATA_ENTRY_POINT) { /* The linked-in data is already in the list. */ - return NULL; + return nullptr; } } #endif @@ -711,15 +711,15 @@ openCommonData(const char *path, /* Path from OpenChoice? */ */ /* if (uprv_getICUData_collation) { - setCommonICUDataPointer(uprv_getICUData_collation(), FALSE, pErrorCode); + setCommonICUDataPointer(uprv_getICUData_collation(), false, pErrorCode); } if (uprv_getICUData_conversion) { - setCommonICUDataPointer(uprv_getICUData_conversion(), FALSE, pErrorCode); + setCommonICUDataPointer(uprv_getICUData_conversion(), false, pErrorCode); } */ #if !defined(ICU_DATA_DIR_WINDOWS) // When using the Windows system data, we expect only a single data file. - setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, FALSE, pErrorCode); + setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, false, pErrorCode); { Mutex lock; return gCommonICUDataArray[commonDataIndex]; @@ -746,14 +746,14 @@ openCommonData(const char *path, /* Path from OpenChoice? */ if (U_SUCCESS(*pErrorCode)) { *pErrorCode=U_FILE_ACCESS_ERROR; } - return NULL; + return nullptr; } /* Is the requested common data file already open and cached? */ /* Note that the cache is keyed by the base name only. The rest of the path, */ /* if any, is not considered. */ UDataMemory *dataToReturn = udata_findCachedData(inBasename, *pErrorCode); - if (dataToReturn != NULL || U_FAILURE(*pErrorCode)) { + if (dataToReturn != nullptr || U_FAILURE(*pErrorCode)) { return dataToReturn; } @@ -761,9 +761,9 @@ openCommonData(const char *path, /* Path from OpenChoice? */ * Hunt it down, trying all the path locations */ - UDataPathIterator iter(u_getDataDirectory(), inBasename, path, ".dat", TRUE, pErrorCode); + UDataPathIterator iter(u_getDataDirectory(), inBasename, path, ".dat", true, pErrorCode); - while ((UDataMemory_isLoaded(&tData)==FALSE) && (pathBuffer = iter.next(pErrorCode)) != NULL) + while ((UDataMemory_isLoaded(&tData)==false) && (pathBuffer = iter.next(pErrorCode)) != nullptr) { #ifdef UDATA_DEBUG fprintf(stderr, "ocd: trying path %s - ", pathBuffer); @@ -774,7 +774,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */ #endif } if (U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } #if defined(OS390_STUBDATA) && defined(OS390BATCH) @@ -789,12 +789,12 @@ openCommonData(const char *path, /* Path from OpenChoice? */ #endif if (U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } if (!UDataMemory_isLoaded(&tData)) { /* no common data */ *pErrorCode=U_FILE_ACCESS_ERROR; - return NULL; + return nullptr; } /* we have mapped a file, check its header */ @@ -822,7 +822,7 @@ static UBool extendICUData(UErrorCode *pErr) { UDataMemory *pData; UDataMemory copyPData; - UBool didUpdate = FALSE; + UBool didUpdate = false; /* * There is a chance for a race condition here. @@ -848,7 +848,7 @@ static UBool extendICUData(UErrorCode *pErr) /* How about if there is no pData, eh... */ UDataMemory_init(©PData); - if(pData != NULL) { + if(pData != nullptr) { UDatamemory_assign(©PData, pData); copyPData.map = 0; /* The mapping for this data is owned by the hash table */ copyPData.mapAddr = 0; /* which will unmap it when ICU is shut down. */ @@ -859,7 +859,7 @@ static UBool extendICUData(UErrorCode *pErr) didUpdate = /* no longer using this result */ setCommonICUData(©PData,/* The new common data. */ - FALSE, /* No warnings if write didn't happen */ + false, /* No warnings if write didn't happen */ pErr); /* setCommonICUData honors errors; NOP if error set */ } @@ -889,11 +889,11 @@ U_CAPI void U_EXPORT2 udata_setCommonData(const void *data, UErrorCode *pErrorCode) { UDataMemory dataMemory; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return; } - if(data==NULL) { + if(data==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -906,7 +906,7 @@ udata_setCommonData(const void *data, UErrorCode *pErrorCode) { /* we have good data */ /* Set it up as the ICU Common Data. */ - setCommonICUData(&dataMemory, TRUE, pErrorCode); + setCommonICUData(&dataMemory, true, pErrorCode); } /*--------------------------------------------------------------------------- @@ -919,10 +919,10 @@ udata_setAppData(const char *path, const void *data, UErrorCode *err) { UDataMemory udm; - if(err==NULL || U_FAILURE(*err)) { + if(err==nullptr || U_FAILURE(*err)) { return; } - if(data==NULL) { + if(data==nullptr) { *err=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -941,7 +941,7 @@ udata_setAppData(const char *path, const void *data, UErrorCode *err) * acceptable to the app. * * If the data is good, create and return a UDataMemory * * object that can be returned to the application. * - * Return NULL on any sort of failure. * + * Return nullptr on any sort of failure. * * * *----------------------------------------------------------------------------*/ static UDataMemory * @@ -958,19 +958,19 @@ checkDataItem UErrorCode *fatalErr /* Bad error, caller should return immediately */ ) { - UDataMemory *rDataMem = NULL; /* the new UDataMemory, to be returned. */ + UDataMemory *rDataMem = nullptr; /* the new UDataMemory, to be returned. */ if (U_FAILURE(*fatalErr)) { - return NULL; + return nullptr; } if(pHeader->dataHeader.magic1==0xda && pHeader->dataHeader.magic2==0x27 && - (isAcceptable==NULL || isAcceptable(context, type, name, &pHeader->info)) + (isAcceptable==nullptr || isAcceptable(context, type, name, &pHeader->info)) ) { rDataMem=UDataMemory_createNewInstance(fatalErr); if (U_FAILURE(*fatalErr)) { - return NULL; + return nullptr; } rDataMem->pHeader = pHeader; } else { @@ -983,9 +983,9 @@ checkDataItem } /** - * @return 0 if not loaded, 1 if loaded or err + * @return 0 if not loaded, 1 if loaded or err */ -static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, +static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, const char *dataPath, const char *tocEntryPathSuffix, /* following arguments are the same as doOpenChoice itself */ const char *path, const char *type, const char *name, @@ -999,9 +999,9 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, /* look in ind. files: package\nam.typ ========================= */ /* init path iterator for individual files */ - UDataPathIterator iter(dataPath, pkgName, path, tocEntryPathSuffix, FALSE, pErrorCode); + UDataPathIterator iter(dataPath, pkgName, path, tocEntryPathSuffix, false, pErrorCode); - while ((pathBuffer = iter.next(pErrorCode)) != NULL) + while ((pathBuffer = iter.next(pErrorCode)) != nullptr) { #ifdef UDATA_DEBUG fprintf(stderr, "UDATA: trying individual file %s\n", pathBuffer); @@ -1009,7 +1009,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, if (uprv_mapFile(&dataMemory, pathBuffer, pErrorCode)) { pEntryData = checkDataItem(dataMemory.pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode); - if (pEntryData != NULL) { + if (pEntryData != nullptr) { /* Data is good. * Hand off ownership of the backing memory to the user's UDataMemory. * and return it. */ @@ -1027,7 +1027,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, /* If we had a nasty error, bail out completely. */ if (U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } /* Otherwise remember that we found data but didn't like it for some reason */ @@ -1037,13 +1037,13 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, fprintf(stderr, "%s\n", UDataMemory_isLoaded(&dataMemory)?"LOADED":"not loaded"); #endif } - return NULL; + return nullptr; } /** - * @return 0 if not loaded, 1 if loaded or err + * @return 0 if not loaded, 1 if loaded or err */ -static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName*/, +static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName*/, const char * /*dataPath*/, const char * /*tocEntryPathSuffix*/, const char *tocEntryName, /* following arguments are the same as doOpenChoice itself */ const char *path, const char *type, const char *name, @@ -1055,7 +1055,7 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName const DataHeader *pHeader; UDataMemory *pCommonData; int32_t commonDataIndex; - UBool checkedExtendedICUData = FALSE; + UBool checkedExtendedICUData = false; /* try to get common data. The loop is for platforms such as the 390 that do * not initially load the full set of ICU data. If the lookup of an ICU data item * fails, the full (but slower to load) set is loaded, the and the loop repeats, @@ -1068,7 +1068,7 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName for (commonDataIndex = isICUData ? 0 : -1;;) { pCommonData=openCommonData(path, commonDataIndex, subErrorCode); /** search for pkg **/ - if(U_SUCCESS(*subErrorCode) && pCommonData!=NULL) { + if(U_SUCCESS(*subErrorCode) && pCommonData!=nullptr) { int32_t length; /* look up the data piece in the common data */ @@ -1077,15 +1077,15 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, (void*) pHeader, u_errorName(*subErrorCode)); #endif - if(pHeader!=NULL) { + if(pHeader!=nullptr) { pEntryData = checkDataItem(pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode); #ifdef UDATA_DEBUG fprintf(stderr, "pEntryData=%p\n", (void*) pEntryData); #endif if (U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - if (pEntryData != NULL) { + if (pEntryData != nullptr) { pEntryData->length = length; return pEntryData; } @@ -1094,20 +1094,20 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName // If we failed due to being out-of-memory, then stop early and report the error. if (*subErrorCode == U_MEMORY_ALLOCATION_ERROR) { *pErrorCode = *subErrorCode; - return NULL; + return nullptr; } /* Data wasn't found. If we were looking for an ICUData item and there is * more data available, load it and try again, * otherwise break out of this loop. */ if (!isICUData) { - return NULL; - } else if (pCommonData != NULL) { + return nullptr; + } else if (pCommonData != nullptr) { ++commonDataIndex; /* try the next data package */ } else if ((!checkedExtendedICUData) && extendICUData(subErrorCode)) { - checkedExtendedICUData = TRUE; - /* try this data package slot again: it changed from NULL to non-NULL */ + checkedExtendedICUData = true; + /* try this data package slot again: it changed from nullptr to non-nullptr */ } else { - return NULL; + return nullptr; } } } @@ -1160,7 +1160,7 @@ doOpenChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode) { - UDataMemory *retVal = NULL; + UDataMemory *retVal = nullptr; const char *dataPath; @@ -1169,34 +1169,34 @@ doOpenChoice(const char *path, const char *type, const char *name, UErrorCode subErrorCode=U_ZERO_ERROR; const char *treeChar; - UBool isICUData = FALSE; + UBool isICUData = false; FileTracer::traceOpen(path, type, name); /* Is this path ICU data? */ - if(path == NULL || + if(path == nullptr || !strcmp(path, U_ICUDATA_ALIAS) || /* "ICUDATA" */ !uprv_strncmp(path, U_ICUDATA_NAME U_TREE_SEPARATOR_STRING, /* "icudt26e-" */ - uprv_strlen(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING)) || + uprv_strlen(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING)) || !uprv_strncmp(path, U_ICUDATA_ALIAS U_TREE_SEPARATOR_STRING, /* "ICUDATA-" */ uprv_strlen(U_ICUDATA_ALIAS U_TREE_SEPARATOR_STRING))) { - isICUData = TRUE; + isICUData = true; } #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) /* Windows: try "foo\bar" and "foo/bar" */ /* remap from alternate path char to the main one */ CharString altSepPath; if(path) { - if(uprv_strchr(path,U_FILE_ALT_SEP_CHAR) != NULL) { + if(uprv_strchr(path,U_FILE_ALT_SEP_CHAR) != nullptr) { altSepPath.append(path, *pErrorCode); char *p; - while ((p = uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR)) != NULL) { + while ((p = uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR)) != nullptr) { *p = U_FILE_SEP_CHAR; } #if defined (UDATA_DEBUG) - fprintf(stderr, "Changed path from [%s] to [%s]\n", path, altSepPath.s); + fprintf(stderr, "Changed path from [%s] to [%s]\n", path, altSepPath.data()); #endif path = altSepPath.data(); } @@ -1210,7 +1210,7 @@ doOpenChoice(const char *path, const char *type, const char *name, CharString treeName; /* ======= Set up strings */ - if(path==NULL) { + if(path==nullptr) { pkgName.append(U_ICUDATA_NAME, *pErrorCode); } else { const char *pkg; @@ -1226,13 +1226,13 @@ doOpenChoice(const char *path, const char *type, const char *name, } } else { treeChar = uprv_strchr(path, U_TREE_SEPARATOR); - if(treeChar) { + if(treeChar) { treeName.append(treeChar+1, *pErrorCode); /* following '-' */ if(isICUData) { pkgName.append(U_ICUDATA_NAME, *pErrorCode); } else { pkgName.append(path, (int32_t)(treeChar-path), *pErrorCode); - if (first == NULL) { + if (first == nullptr) { /* This user data has no path, but there is a tree name. Look up the correct path from the data cache later. @@ -1254,7 +1254,7 @@ doOpenChoice(const char *path, const char *type, const char *name, fprintf(stderr, " P=%s T=%s\n", pkgName.data(), treeName.data()); #endif - /* setting up the entry name and file name + /* setting up the entry name and file name * Make up a full name by appending the type to the supplied * name, assuming that a type was supplied. */ @@ -1271,7 +1271,7 @@ doOpenChoice(const char *path, const char *type, const char *name, tocEntryName.append(U_TREE_ENTRY_SEP_CHAR, *pErrorCode).append(name, *pErrorCode); tocEntryPath.append(U_FILE_SEP_CHAR, *pErrorCode).append(name, *pErrorCode); - if(type!=NULL && *type!=0) { + if(type!=nullptr && *type!=0) { tocEntryName.append(".", *pErrorCode).append(type, *pErrorCode); tocEntryPath.append(".", *pErrorCode).append(type, *pErrorCode); } @@ -1284,7 +1284,7 @@ doOpenChoice(const char *path, const char *type, const char *name, #endif #if !defined(ICU_DATA_DIR_WINDOWS) - if(path == NULL) { + if(path == nullptr) { path = COMMON_DATA_NAME; /* "icudt26e" */ } #else @@ -1309,7 +1309,7 @@ doOpenChoice(const char *path, const char *type, const char *name, #endif retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", tzFilesDir, tocEntryPathSuffix, /* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode); - if((retVal != NULL) || U_FAILURE(*pErrorCode)) { + if((retVal != nullptr) || U_FAILURE(*pErrorCode)) { return retVal; } } @@ -1321,10 +1321,10 @@ doOpenChoice(const char *path, const char *type, const char *name, fprintf(stderr, "Trying packages (UDATA_PACKAGES_FIRST)\n"); #endif /* #2 */ - retVal = doLoadFromCommonData(isICUData, + retVal = doLoadFromCommonData(isICUData, pkgName.data(), dataPath, tocEntryPathSuffix, tocEntryName.data(), path, type, name, isAcceptable, context, &subErrorCode, pErrorCode); - if((retVal != NULL) || U_FAILURE(*pErrorCode)) { + if((retVal != nullptr) || U_FAILURE(*pErrorCode)) { return retVal; } } @@ -1339,14 +1339,14 @@ doOpenChoice(const char *path, const char *type, const char *name, if ((dataPath && *dataPath) || !isICUData) { retVal = doLoadFromIndividualFiles(pkgName.data(), dataPath, tocEntryPathSuffix, path, type, name, isAcceptable, context, &subErrorCode, pErrorCode); - if((retVal != NULL) || U_FAILURE(*pErrorCode)) { + if((retVal != nullptr) || U_FAILURE(*pErrorCode)) { return retVal; } } } /**** COMMON PACKAGE */ - if((gDataFileAccess==UDATA_ONLY_PACKAGES) || + if((gDataFileAccess==UDATA_ONLY_PACKAGES) || (gDataFileAccess==UDATA_FILES_FIRST)) { #ifdef UDATA_DEBUG fprintf(stderr, "Trying packages (UDATA_ONLY_PACKAGES || UDATA_FILES_FIRST)\n"); @@ -1354,14 +1354,14 @@ doOpenChoice(const char *path, const char *type, const char *name, retVal = doLoadFromCommonData(isICUData, pkgName.data(), dataPath, tocEntryPathSuffix, tocEntryName.data(), path, type, name, isAcceptable, context, &subErrorCode, pErrorCode); - if((retVal != NULL) || U_FAILURE(*pErrorCode)) { + if((retVal != nullptr) || U_FAILURE(*pErrorCode)) { return retVal; } } - + /* Load from DLL. If we haven't attempted package load, we also haven't had any chance to try a DLL (static or setCommonData/etc) load. - If we ever have a "UDATA_ONLY_FILES", add it to the or list here. */ + If we ever have a "UDATA_ONLY_FILES", add it to the or list here. */ if(gDataFileAccess==UDATA_NO_FILES) { #ifdef UDATA_DEBUG fprintf(stderr, "Trying common data (UDATA_NO_FILES)\n"); @@ -1369,7 +1369,7 @@ doOpenChoice(const char *path, const char *type, const char *name, retVal = doLoadFromCommonData(isICUData, pkgName.data(), "", tocEntryPathSuffix, tocEntryName.data(), path, type, name, isAcceptable, context, &subErrorCode, pErrorCode); - if((retVal != NULL) || U_FAILURE(*pErrorCode)) { + if((retVal != nullptr) || U_FAILURE(*pErrorCode)) { return retVal; } } @@ -1395,17 +1395,17 @@ U_CAPI UDataMemory * U_EXPORT2 udata_open(const char *path, const char *type, const char *name, UErrorCode *pErrorCode) { #ifdef UDATA_DEBUG - fprintf(stderr, "udata_open(): Opening: %s : %s . %s\n", (path?path:"NULL"), name, type); + fprintf(stderr, "udata_open(): Opening: %s : %s . %s\n", (path?path:"nullptr"), name, type); fflush(stderr); #endif - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return NULL; - } else if(name==NULL || *name==0) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { + return nullptr; + } else if(name==nullptr || *name==0) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } else { - return doOpenChoice(path, type, name, NULL, NULL, pErrorCode); + return doOpenChoice(path, type, name, nullptr, nullptr, pErrorCode); } } @@ -1416,14 +1416,14 @@ udata_openChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode) { #ifdef UDATA_DEBUG - fprintf(stderr, "udata_openChoice(): Opening: %s : %s . %s\n", (path?path:"NULL"), name, type); + fprintf(stderr, "udata_openChoice(): Opening: %s : %s . %s\n", (path?path:"nullptr"), name, type); #endif - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return NULL; - } else if(name==NULL || *name==0 || isAcceptable==NULL) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { + return nullptr; + } else if(name==nullptr || *name==0 || isAcceptable==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } else { return doOpenChoice(path, type, name, isAcceptable, context, pErrorCode); } @@ -1433,8 +1433,8 @@ udata_openChoice(const char *path, const char *type, const char *name, U_CAPI void U_EXPORT2 udata_getInfo(UDataMemory *pData, UDataInfo *pInfo) { - if(pInfo!=NULL) { - if(pData!=NULL && pData->pHeader!=NULL) { + if(pInfo!=nullptr) { + if(pData!=nullptr && pData->pHeader!=nullptr) { const UDataInfo *info=&pData->pHeader->info; uint16_t dataInfoSize=udata_getInfoSize(info); if(pInfo->size>dataInfoSize) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/udatamem.cpp b/src/duckdb/extension/icu/third_party/icu/common/udatamem.cpp index 6bf7c0123..02be85232 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/udatamem.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/udatamem.cpp @@ -42,14 +42,14 @@ U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr) { UDataMemory *This; if (U_FAILURE(*pErr)) { - return NULL; + return nullptr; } This = (UDataMemory *)uprv_malloc(sizeof(UDataMemory)); - if (This == NULL) { + if (This == nullptr) { *pErr = U_MEMORY_ALLOCATION_ERROR; } else { UDataMemory_init(This); - This->heapAllocated = TRUE; + This->heapAllocated = true; } return This; } @@ -59,7 +59,7 @@ U_CFUNC const DataHeader * UDataMemory_normalizeDataPointer(const void *p) { /* allow the data to be optionally prepended with an alignment-forcing double value */ const DataHeader *pdh = (const DataHeader *)p; - if(pdh==NULL || (pdh->dataHeader.magic1==0xda && pdh->dataHeader.magic2==0x27)) { + if(pdh==nullptr || (pdh->dataHeader.magic1==0xda && pdh->dataHeader.magic2==0x27)) { return pdh; } else { #if U_PLATFORM == U_PF_OS400 @@ -90,7 +90,7 @@ U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr) { U_CAPI void U_EXPORT2 udata_close(UDataMemory *pData) { - if(pData!=NULL) { + if(pData!=nullptr) { uprv_unmapFile(pData); if(pData->heapAllocated ) { uprv_free(pData); @@ -102,10 +102,10 @@ udata_close(UDataMemory *pData) { U_CAPI const void * U_EXPORT2 udata_getMemory(UDataMemory *pData) { - if(pData!=NULL && pData->pHeader!=NULL) { + if(pData!=nullptr && pData->pHeader!=nullptr) { return (char *)(pData->pHeader)+udata_getHeaderSize(pData->pHeader); } else { - return NULL; + return nullptr; } } @@ -131,7 +131,7 @@ udata_getMemory(UDataMemory *pData) { */ U_CAPI int32_t U_EXPORT2 udata_getLength(const UDataMemory *pData) { - if(pData!=NULL && pData->pHeader!=NULL && pData->length>=0) { + if(pData!=nullptr && pData->pHeader!=nullptr && pData->length>=0) { /* * subtract the header size, * return only the size of the actual data starting at udata_getMemory() @@ -149,13 +149,13 @@ udata_getLength(const UDataMemory *pData) { */ U_CAPI const void * U_EXPORT2 udata_getRawMemory(const UDataMemory *pData) { - if(pData!=NULL && pData->pHeader!=NULL) { + if(pData!=nullptr && pData->pHeader!=nullptr) { return pData->pHeader; } else { - return NULL; + return nullptr; } } U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This) { - return This->pHeader != NULL; + return This->pHeader != nullptr; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/udatamem.h b/src/duckdb/extension/icu/third_party/icu/common/udatamem.h index a05dd6975..3db2af43a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/udatamem.h +++ b/src/duckdb/extension/icu/third_party/icu/common/udatamem.h @@ -44,7 +44,7 @@ struct UDataMemory { int32_t length; /* Length of the data in bytes; -1 if unknown. */ }; -U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr); +U_CAPI UDataMemory* U_EXPORT2 UDataMemory_createNewInstance(UErrorCode *pErr); U_CFUNC void UDatamemory_assign (UDataMemory *dest, UDataMemory *source); U_CFUNC void UDataMemory_init (UDataMemory *This); U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This); diff --git a/src/duckdb/extension/icu/third_party/icu/common/udataswp.cpp b/src/duckdb/extension/icu/third_party/icu/common/udataswp.cpp index 86f302bd9..bbce1a8ec 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/udataswp.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/udataswp.cpp @@ -38,10 +38,10 @@ uprv_swapArray16(const UDataSwapper *ds, int32_t count; uint16_t x; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) { + if(ds==nullptr || inData==nullptr || length<0 || (length&1)!=0 || outData==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -63,10 +63,10 @@ static int32_t U_CALLCONV uprv_copyArray16(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) { + if(ds==nullptr || inData==nullptr || length<0 || (length&1)!=0 || outData==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -86,10 +86,10 @@ uprv_swapArray32(const UDataSwapper *ds, int32_t count; uint32_t x; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) { + if(ds==nullptr || inData==nullptr || length<0 || (length&3)!=0 || outData==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -111,10 +111,10 @@ static int32_t U_CALLCONV uprv_copyArray32(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) { + if(ds==nullptr || inData==nullptr || length<0 || (length&3)!=0 || outData==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -133,10 +133,10 @@ uprv_swapArray64(const UDataSwapper *ds, uint64_t *q; int32_t count; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) { + if(ds==nullptr || inData==nullptr || length<0 || (length&7)!=0 || outData==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -160,10 +160,10 @@ static int32_t U_CALLCONV uprv_copyArray64(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) { + if(ds==nullptr || inData==nullptr || length<0 || (length&7)!=0 || outData==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -236,10 +236,10 @@ udata_swapInvStringBlock(const UDataSwapper *ds, const char *inChars; int32_t stringsLength; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -273,7 +273,7 @@ udata_printError(const UDataSwapper *ds, ...) { va_list args; - if(ds->printError!=NULL) { + if(ds->printError!=nullptr) { va_start(args, fmt); ds->printError(ds->printErrorContext, fmt, args); va_end(args); @@ -290,10 +290,10 @@ udata_swapDataHeader(const UDataSwapper *ds, uint16_t headerSize, infoSize; /* argument checking */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || length<-1 || (length>0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -365,19 +365,19 @@ udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset, UErrorCode *pErrorCode) { UDataSwapper *swapper; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return NULL; + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { + return nullptr; } if(inCharset>U_EBCDIC_FAMILY || outCharset>U_EBCDIC_FAMILY) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } /* allocate the swapper */ swapper=(UDataSwapper *)uprv_malloc(sizeof(UDataSwapper)); - if(swapper==NULL) { + if(swapper==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uprv_memset(swapper, 0, sizeof(UDataSwapper)); @@ -423,15 +423,15 @@ udata_openSwapperForInputData(const void *data, int32_t length, UBool inIsBigEndian; int8_t inCharset; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return NULL; + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { + return nullptr; } - if( data==NULL || + if( data==nullptr || (length>=0 && length<(int32_t)sizeof(DataHeader)) || outCharset>U_EBCDIC_FAMILY ) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } pHeader=(const DataHeader *)data; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uelement.h b/src/duckdb/extension/icu/third_party/icu/common/uelement.h index 05f36a098..2c5a2043e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uelement.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uelement.h @@ -46,7 +46,7 @@ typedef union UElement UElement; * An element-equality (boolean) comparison function. * @param e1 An element (object or integer) * @param e2 An element (object or integer) - * @return TRUE if the two elements are equal. + * @return true if the two elements are equal. */ typedef UBool U_CALLCONV UElementsAreEqual(const UElement e1, const UElement e2); @@ -54,9 +54,12 @@ typedef UBool U_CALLCONV UElementsAreEqual(const UElement e1, const UElement e2) * An element sorting (three-way) comparison function. * @param e1 An element (object or integer) * @param e2 An element (object or integer) - * @return 0 if the two elements are equal, -1 if e1 is < e2, or +1 if e1 is > e2. + * @return 32-bit signed integer comparison result: + * ==0 if the two elements are equal, + * <0 if e1 is < e2, or + * >0 if e1 is > e2. */ -typedef int8_t U_CALLCONV UElementComparator(UElement e1, UElement e2); +typedef int32_t U_CALLCONV UElementComparator(UElement e1, UElement e2); /** * An element assignment function. It may copy an integer, copy diff --git a/src/duckdb/extension/icu/third_party/icu/common/uenum.cpp b/src/duckdb/extension/icu/third_party/icu/common/uenum.cpp index 11d895ebc..7aab58c44 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uenum.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uenum.cpp @@ -33,21 +33,21 @@ static const int32_t PAD = 8; or reallocating it if at least 'capacity' bytes are not available. */ static void* _getBuffer(UEnumeration* en, int32_t capacity) { - if (en->baseContext != NULL) { + if (en->baseContext != nullptr) { if (((_UEnumBuffer*) en->baseContext)->len < capacity) { capacity += PAD; en->baseContext = uprv_realloc(en->baseContext, sizeof(int32_t) + capacity); - if (en->baseContext == NULL) { - return NULL; + if (en->baseContext == nullptr) { + return nullptr; } ((_UEnumBuffer*) en->baseContext)->len = capacity; } } else { capacity += PAD; en->baseContext = uprv_malloc(sizeof(int32_t) + capacity); - if (en->baseContext == NULL) { - return NULL; + if (en->baseContext == nullptr) { + return nullptr; } ((_UEnumBuffer*) en->baseContext)->len = capacity; } @@ -59,7 +59,7 @@ U_CAPI void U_EXPORT2 uenum_close(UEnumeration* en) { if (en) { - if (en->close != NULL) { + if (en->close != nullptr) { if (en->baseContext) { uprv_free(en->baseContext); } @@ -76,7 +76,7 @@ uenum_count(UEnumeration* en, UErrorCode* status) if (!en || U_FAILURE(*status)) { return -1; } - if (en->count != NULL) { + if (en->count != nullptr) { return en->count(en, status); } else { *status = U_UNSUPPORTED_ERROR; @@ -85,18 +85,18 @@ uenum_count(UEnumeration* en, UErrorCode* status) } /* Don't call this directly. Only uenum_unext should be calling this. */ -U_CAPI const UChar* U_EXPORT2 +U_CAPI const char16_t* U_EXPORT2 uenum_unextDefault(UEnumeration* en, int32_t* resultLength, UErrorCode* status) { - UChar *ustr = NULL; + char16_t *ustr = nullptr; int32_t len = 0; - if (en->next != NULL) { + if (en->next != nullptr) { const char *cstr = en->next(en, &len, status); - if (cstr != NULL) { - ustr = (UChar*) _getBuffer(en, (len+1) * sizeof(UChar)); - if (ustr == NULL) { + if (cstr != nullptr) { + ustr = (char16_t*) _getBuffer(en, (len+1) * sizeof(char16_t)); + if (ustr == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; } else { u_charsToUChars(cstr, ustr, len+1); @@ -117,39 +117,39 @@ uenum_nextDefault(UEnumeration* en, int32_t* resultLength, UErrorCode* status) { - if (en->uNext != NULL) { + if (en->uNext != nullptr) { char *tempCharVal; - const UChar *tempUCharVal = en->uNext(en, resultLength, status); - if (tempUCharVal == NULL) { - return NULL; + const char16_t *tempUCharVal = en->uNext(en, resultLength, status); + if (tempUCharVal == nullptr) { + return nullptr; } tempCharVal = (char*) _getBuffer(en, (*resultLength+1) * sizeof(char)); if (!tempCharVal) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } u_UCharsToChars(tempUCharVal, tempCharVal, *resultLength + 1); return tempCharVal; } else { *status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } } -U_CAPI const UChar* U_EXPORT2 +U_CAPI const char16_t* U_EXPORT2 uenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* status) { if (!en || U_FAILURE(*status)) { - return NULL; + return nullptr; } - if (en->uNext != NULL) { + if (en->uNext != nullptr) { return en->uNext(en, resultLength, status); } else { *status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } } @@ -159,10 +159,10 @@ uenum_next(UEnumeration* en, UErrorCode* status) { if (!en || U_FAILURE(*status)) { - return NULL; + return nullptr; } - if (en->next != NULL) { - if (resultLength != NULL) { + if (en->next != nullptr) { + if (resultLength != nullptr) { return en->next(en, resultLength, status); } else { @@ -171,7 +171,7 @@ uenum_next(UEnumeration* en, } } else { *status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } } @@ -181,7 +181,7 @@ uenum_reset(UEnumeration* en, UErrorCode* status) if (!en || U_FAILURE(*status)) { return; } - if (en->reset != NULL) { + if (en->reset != nullptr) { en->reset(en, status); } else { *status = U_UNSUPPORTED_ERROR; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uhash.cpp b/src/duckdb/extension/icu/third_party/icu/common/uhash.cpp index 86311ceb0..4d92dfa93 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uhash.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uhash.cpp @@ -44,9 +44,9 @@ * The central function is _uhash_find(). This function looks for a * slot matching the given key and hashcode. If one is found, it * returns a pointer to that slot. If the table is full, and no match - * is found, it returns NULL -- in theory. This would make the code + * is found, it returns nullptr -- in theory. This would make the code * more complicated, since all callers of _uhash_find() would then - * have to check for a NULL result. To keep this from happening, we + * have to check for a nullptr result. To keep this from happening, we * don't allow the table to fill. When there is only one * empty/deleted slot left, uhash_put() will refuse to increase the * count, and fail. This simplifies the code. In practice, one will @@ -120,10 +120,10 @@ static const float RESIZE_POLICY_RATIO_TABLE[6] = { /* This macro expects a UHashTok.pointer as its keypointer and valuepointer parameters */ #define HASH_DELETE_KEY_VALUE(hash, keypointer, valuepointer) UPRV_BLOCK_MACRO_BEGIN { \ - if (hash->keyDeleter != NULL && keypointer != NULL) { \ + if (hash->keyDeleter != nullptr && keypointer != nullptr) { \ (*hash->keyDeleter)(keypointer); \ } \ - if (hash->valueDeleter != NULL && valuepointer != NULL) { \ + if (hash->valueDeleter != nullptr && valuepointer != nullptr) { \ (*hash->valueDeleter)(valuepointer); \ } \ } UPRV_BLOCK_MACRO_END @@ -133,8 +133,10 @@ static const float RESIZE_POLICY_RATIO_TABLE[6] = { * or a pointer. If a hint bit is zero, then the associated * token is assumed to be an integer. */ +#define HINT_BOTH_INTEGERS (0) #define HINT_KEY_POINTER (1) #define HINT_VALUE_POINTER (2) +#define HINT_ALLOW_ZERO (4) /******************************************************************** * PRIVATE Implementation @@ -146,16 +148,16 @@ _uhash_setElement(UHashtable *hash, UHashElement* e, UHashTok key, UHashTok value, int8_t hint) { UHashTok oldValue = e->value; - if (hash->keyDeleter != NULL && e->key.pointer != NULL && + if (hash->keyDeleter != nullptr && e->key.pointer != nullptr && e->key.pointer != key.pointer) { /* Avoid double deletion */ (*hash->keyDeleter)(e->key.pointer); } - if (hash->valueDeleter != NULL) { - if (oldValue.pointer != NULL && + if (hash->valueDeleter != nullptr) { + if (oldValue.pointer != nullptr && oldValue.pointer != value.pointer) { /* Avoid double deletion */ (*hash->valueDeleter)(oldValue.pointer); } - oldValue.pointer = NULL; + oldValue.pointer = nullptr; } /* Compilers should copy the UHashTok union correctly, but even if * they do, memory heap tools (e.g. BoundsChecker) can get @@ -185,13 +187,13 @@ _uhash_internalRemoveElement(UHashtable *hash, UHashElement* e) { UHashTok empty; U_ASSERT(!IS_EMPTY_OR_DELETED(e->hashcode)); --hash->count; - empty.pointer = NULL; empty.integer = 0; + empty.pointer = nullptr; empty.integer = 0; return _uhash_setElement(hash, e, HASH_DELETED, empty, empty, 0); } static void _uhash_internalSetResizePolicy(UHashtable *hash, enum UHashResizePolicy policy) { - U_ASSERT(hash != NULL); + U_ASSERT(hash != nullptr); U_ASSERT(((int32_t)policy) >= 0); U_ASSERT(((int32_t)policy) < 3); hash->lowWaterRatio = RESIZE_POLICY_RATIO_TABLE[policy * 2]; @@ -225,12 +227,12 @@ _uhash_allocate(UHashtable *hash, p = hash->elements = (UHashElement*) uprv_malloc(sizeof(UHashElement) * hash->length); - if (hash->elements == NULL) { + if (hash->elements == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } - emptytok.pointer = NULL; /* Only one of these two is needed */ + emptytok.pointer = nullptr; /* Only one of these two is needed */ emptytok.integer = 0; /* but we don't know which one. */ limit = p + hash->length; @@ -254,22 +256,22 @@ _uhash_init(UHashtable *result, int32_t primeIndex, UErrorCode *status) { - if (U_FAILURE(*status)) return NULL; - U_ASSERT(keyHash != NULL); - U_ASSERT(keyComp != NULL); + if (U_FAILURE(*status)) return nullptr; + U_ASSERT(keyHash != nullptr); + U_ASSERT(keyComp != nullptr); result->keyHasher = keyHash; result->keyComparator = keyComp; result->valueComparator = valueComp; - result->keyDeleter = NULL; - result->valueDeleter = NULL; - result->allocated = FALSE; + result->keyDeleter = nullptr; + result->valueDeleter = nullptr; + result->allocated = false; _uhash_internalSetResizePolicy(result, U_GROW); _uhash_allocate(result, primeIndex, status); if (U_FAILURE(*status)) { - return NULL; + return nullptr; } return result; @@ -283,20 +285,20 @@ _uhash_create(UHashFunction *keyHash, UErrorCode *status) { UHashtable *result; - if (U_FAILURE(*status)) return NULL; + if (U_FAILURE(*status)) return nullptr; result = (UHashtable*) uprv_malloc(sizeof(UHashtable)); - if (result == NULL) { + if (result == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } _uhash_init(result, keyHash, keyComp, valueComp, primeIndex, status); - result->allocated = TRUE; + result->allocated = true; if (U_FAILURE(*status)) { uprv_free(result); - return NULL; + return nullptr; } return result; @@ -318,10 +320,10 @@ _uhash_create(UHashFunction *keyHash, * Stop if it is identical or empty, otherwise continue by adding a * "jump" value (moduloing by the length again to keep it within * range) and retesting. For efficiency, there need enough empty - * values so that the searchs stop within a reasonable amount of time. + * values so that the searches stop within a reasonable amount of time. * This can be changed by changing the high/low water marks. * - * In theory, this function can return NULL, if it is full (no empty + * In theory, this function can return nullptr, if it is full (no empty * or deleted slots) and if no matching key is found. In practice, we * prevent this elsewhere (in uhash_put) by making sure the last slot * in the table is never filled. @@ -377,7 +379,7 @@ _uhash_find(const UHashtable *hash, UHashTok key, * WILL NEVER HAPPEN as long as uhash_put() makes sure that * count is always < length. */ - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } return &(elements[theIndex]); } @@ -422,7 +424,7 @@ _uhash_rehash(UHashtable *hash, UErrorCode *status) { for (i = oldLength - 1; i >= 0; --i) { if (!IS_EMPTY_OR_DELETED(old[i].hashcode)) { UHashElement *e = _uhash_find(hash, old[i].key, old[i].hashcode); - U_ASSERT(e != NULL); + U_ASSERT(e != nullptr); U_ASSERT(e->hashcode == HASH_EMPTY); e->key = old[i].key; e->value = old[i].value; @@ -446,8 +448,8 @@ _uhash_remove(UHashtable *hash, */ UHashTok result; UHashElement* e = _uhash_find(hash, key, hash->keyHasher(key)); - U_ASSERT(e != NULL); - result.pointer = NULL; + U_ASSERT(e != nullptr); + result.pointer = nullptr; result.integer = 0; if (!IS_EMPTY_OR_DELETED(e->hashcode)) { result = _uhash_internalRemoveElement(hash, e); @@ -468,7 +470,7 @@ _uhash_put(UHashtable *hash, /* Put finds the position in the table for the new value. If the * key is already in the table, it is deleted, if there is a - * non-NULL keyDeleter. Then the key, the hash and the value are + * non-nullptr keyDeleter. Then the key, the hash and the value are * all put at the position in their respective arrays. */ int32_t hashcode; @@ -478,11 +480,12 @@ _uhash_put(UHashtable *hash, if (U_FAILURE(*status)) { goto err; } - U_ASSERT(hash != NULL); - /* Cannot always check pointer here or iSeries sees NULL every time. */ - if ((hint & HINT_VALUE_POINTER) && value.pointer == NULL) { - /* Disallow storage of NULL values, since NULL is returned by - * get() to indicate an absent key. Storing NULL == removing. + U_ASSERT(hash != nullptr); + if ((hint & HINT_VALUE_POINTER) ? + value.pointer == nullptr : + value.integer == 0 && (hint & HINT_ALLOW_ZERO) == 0) { + /* Disallow storage of nullptr values, since nullptr is returned by + * get() to indicate an absent key. Storing nullptr == removing. */ return _uhash_remove(hash, key); } @@ -495,12 +498,12 @@ _uhash_put(UHashtable *hash, hashcode = (*hash->keyHasher)(key); e = _uhash_find(hash, key, hashcode); - U_ASSERT(e != NULL); + U_ASSERT(e != nullptr); if (IS_EMPTY_OR_DELETED(e->hashcode)) { /* Important: We must never actually fill the table up. If we - * do so, then _uhash_find() will return NULL, and we'll have - * to check for NULL after every call to _uhash_find(). To + * do so, then _uhash_find() will return nullptr, and we'll have + * to check for nullptr after every call to _uhash_find(). To * avoid this we make sure there is always at least one empty * or deleted slot in the table. This only is a problem if we * are out of memory and rehash isn't working. @@ -515,18 +518,18 @@ _uhash_put(UHashtable *hash, } /* We must in all cases handle storage properly. If there was an - * old key, then it must be deleted (if the deleter != NULL). + * old key, then it must be deleted (if the deleter != nullptr). * Make hashcodes stored in table positive. */ return _uhash_setElement(hash, e, hashcode & 0x7FFFFFFF, key, value, hint); err: - /* If the deleters are non-NULL, this method adopts its key and/or + /* If the deleters are non-nullptr, this method adopts its key and/or * value arguments, and we must be sure to delete the key and/or * value in all cases, even upon failure. */ HASH_DELETE_KEY_VALUE(hash, key.pointer, value.pointer); - emptytok.pointer = NULL; emptytok.integer = 0; + emptytok.pointer = nullptr; emptytok.integer = 0; return emptytok; } @@ -588,19 +591,19 @@ uhash_initSize(UHashtable *fillinResult, U_CAPI void U_EXPORT2 uhash_close(UHashtable *hash) { - if (hash == NULL) { + if (hash == nullptr) { return; } - if (hash->elements != NULL) { - if (hash->keyDeleter != NULL || hash->valueDeleter != NULL) { + if (hash->elements != nullptr) { + if (hash->keyDeleter != nullptr || hash->valueDeleter != nullptr) { int32_t pos=UHASH_FIRST; UHashElement *e; - while ((e = (UHashElement*) uhash_nextElement(hash, &pos)) != NULL) { + while ((e = (UHashElement*) uhash_nextElement(hash, &pos)) != nullptr) { HASH_DELETE_KEY_VALUE(hash, e->key.pointer, e->value.pointer); } } uprv_free(hash->elements); - hash->elements = NULL; + hash->elements = nullptr; } if (hash->allocated) { uprv_free(hash); @@ -687,6 +690,28 @@ uhash_igeti(const UHashtable *hash, return _uhash_find(hash, keyholder, hash->keyHasher(keyholder))->value.integer; } +U_CAPI int32_t U_EXPORT2 +uhash_getiAndFound(const UHashtable *hash, + const void *key, + UBool *found) { + UHashTok keyholder; + keyholder.pointer = (void *)key; + const UHashElement *e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder)); + *found = !IS_EMPTY_OR_DELETED(e->hashcode); + return e->value.integer; +} + +U_CAPI int32_t U_EXPORT2 +uhash_igetiAndFound(const UHashtable *hash, + int32_t key, + UBool *found) { + UHashTok keyholder; + keyholder.integer = key; + const UHashElement *e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder)); + *found = !IS_EMPTY_OR_DELETED(e->hashcode); + return e->value.integer; +} + U_CAPI void* U_EXPORT2 uhash_put(UHashtable *hash, void* key, @@ -736,7 +761,34 @@ uhash_iputi(UHashtable *hash, keyholder.integer = key; valueholder.integer = value; return _uhash_put(hash, keyholder, valueholder, - 0, /* neither is a ptr */ + HINT_BOTH_INTEGERS, + status).integer; +} + +U_CAPI int32_t U_EXPORT2 +uhash_putiAllowZero(UHashtable *hash, + void *key, + int32_t value, + UErrorCode *status) { + UHashTok keyholder, valueholder; + keyholder.pointer = key; + valueholder.integer = value; + return _uhash_put(hash, keyholder, valueholder, + HINT_KEY_POINTER | HINT_ALLOW_ZERO, + status).integer; +} + + +U_CAPI int32_t U_EXPORT2 +uhash_iputiAllowZero(UHashtable *hash, + int32_t key, + int32_t value, + UErrorCode *status) { + UHashTok keyholder, valueholder; + keyholder.integer = key; + valueholder.integer = value; + return _uhash_put(hash, keyholder, valueholder, + HINT_BOTH_INTEGERS | HINT_ALLOW_ZERO, status).integer; } @@ -776,22 +828,45 @@ U_CAPI void U_EXPORT2 uhash_removeAll(UHashtable *hash) { int32_t pos = UHASH_FIRST; const UHashElement *e; - U_ASSERT(hash != NULL); + U_ASSERT(hash != nullptr); if (hash->count != 0) { - while ((e = uhash_nextElement(hash, &pos)) != NULL) { + while ((e = uhash_nextElement(hash, &pos)) != nullptr) { uhash_removeElement(hash, e); } } U_ASSERT(hash->count == 0); } +U_CAPI UBool U_EXPORT2 +uhash_containsKey(const UHashtable *hash, const void *key) { + UHashTok keyholder; + keyholder.pointer = (void *)key; + const UHashElement *e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder)); + return !IS_EMPTY_OR_DELETED(e->hashcode); +} + +/** + * Returns true if the UHashtable contains an item with this integer key. + * + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @return true if the key is found. + */ +U_CAPI UBool U_EXPORT2 +uhash_icontainsKey(const UHashtable *hash, int32_t key) { + UHashTok keyholder; + keyholder.integer = key; + const UHashElement *e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder)); + return !IS_EMPTY_OR_DELETED(e->hashcode); +} + U_CAPI const UHashElement* U_EXPORT2 uhash_find(const UHashtable *hash, const void* key) { UHashTok keyholder; const UHashElement *e; keyholder.pointer = (void*) key; e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder)); - return IS_EMPTY_OR_DELETED(e->hashcode) ? NULL : e; + return IS_EMPTY_OR_DELETED(e->hashcode) ? nullptr : e; } U_CAPI const UHashElement* U_EXPORT2 @@ -800,7 +875,7 @@ uhash_nextElement(const UHashtable *hash, int32_t *pos) { * EMPTY and not DELETED. */ int32_t i; - U_ASSERT(hash != NULL); + U_ASSERT(hash != nullptr); for (i = *pos + 1; i < hash->length; ++i) { if (!IS_EMPTY_OR_DELETED(hash->elements[i].hashcode)) { *pos = i; @@ -809,18 +884,18 @@ uhash_nextElement(const UHashtable *hash, int32_t *pos) { } /* No more elements */ - return NULL; + return nullptr; } U_CAPI void* U_EXPORT2 uhash_removeElement(UHashtable *hash, const UHashElement* e) { - U_ASSERT(hash != NULL); - U_ASSERT(e != NULL); + U_ASSERT(hash != nullptr); + U_ASSERT(e != nullptr); if (!IS_EMPTY_OR_DELETED(e->hashcode)) { UHashElement *nce = (UHashElement *)e; return _uhash_internalRemoveElement(hash, nce).pointer; } - return NULL; + return nullptr; } /******************************************************************** @@ -853,20 +928,20 @@ uhash_tokp(void* p) { U_CAPI int32_t U_EXPORT2 uhash_hashUChars(const UHashTok key) { - const UChar *s = (const UChar *)key.pointer; - return s == NULL ? 0 : ustr_hashUCharsN(s, u_strlen(s)); + const char16_t *s = (const char16_t *)key.pointer; + return s == nullptr ? 0 : ustr_hashUCharsN(s, u_strlen(s)); } U_CAPI int32_t U_EXPORT2 uhash_hashChars(const UHashTok key) { const char *s = (const char *)key.pointer; - return s == NULL ? 0 : static_cast(ustr_hashCharsN(s, static_cast(uprv_strlen(s)))); + return s == nullptr ? 0 : static_cast(ustr_hashCharsN(s, static_cast(uprv_strlen(s)))); } U_CAPI int32_t U_EXPORT2 uhash_hashIChars(const UHashTok key) { const char *s = (const char *)key.pointer; - return s == NULL ? 0 : ustr_hashICharsN(s, static_cast(uprv_strlen(s))); + return s == nullptr ? 0 : ustr_hashICharsN(s, static_cast(uprv_strlen(s))); } U_CAPI UBool U_EXPORT2 @@ -874,7 +949,7 @@ uhash_equals(const UHashtable* hash1, const UHashtable* hash2){ int32_t count1, count2, pos, i; if(hash1==hash2){ - return TRUE; + return true; } /* @@ -885,22 +960,22 @@ uhash_equals(const UHashtable* hash1, const UHashtable* hash2){ * with 64-bit pointers and 32-bit integer hashes. * A valueComparator is normally optional. */ - if (hash1==NULL || hash2==NULL || + if (hash1==nullptr || hash2==nullptr || hash1->keyComparator != hash2->keyComparator || hash1->valueComparator != hash2->valueComparator || - hash1->valueComparator == NULL) + hash1->valueComparator == nullptr) { /* Normally we would return an error here about incompatible hash tables, - but we return FALSE instead. + but we return false instead. */ - return FALSE; + return false; } count1 = uhash_count(hash1); count2 = uhash_count(hash2); if(count1!=count2){ - return FALSE; + return false; } pos=UHASH_FIRST; @@ -914,11 +989,11 @@ uhash_equals(const UHashtable* hash1, const UHashtable* hash2){ */ const UHashElement* elem2 = _uhash_find(hash2, key1, hash2->keyHasher(key1)); const UHashTok val2 = elem2->value; - if(hash1->valueComparator(val1, val2)==FALSE){ - return FALSE; + if(hash1->valueComparator(val1, val2)==false){ + return false; } } - return TRUE; + return true; } /******************************************************************** @@ -927,13 +1002,13 @@ uhash_equals(const UHashtable* hash1, const UHashtable* hash2){ U_CAPI UBool U_EXPORT2 uhash_compareUChars(const UHashTok key1, const UHashTok key2) { - const UChar *p1 = (const UChar*) key1.pointer; - const UChar *p2 = (const UChar*) key2.pointer; + const char16_t *p1 = (const char16_t*) key1.pointer; + const char16_t *p2 = (const char16_t*) key2.pointer; if (p1 == p2) { - return TRUE; + return true; } - if (p1 == NULL || p2 == NULL) { - return FALSE; + if (p1 == nullptr || p2 == nullptr) { + return false; } while (*p1 != 0 && *p1 == *p2) { ++p1; @@ -947,10 +1022,10 @@ uhash_compareChars(const UHashTok key1, const UHashTok key2) { const char *p1 = (const char*) key1.pointer; const char *p2 = (const char*) key2.pointer; if (p1 == p2) { - return TRUE; + return true; } - if (p1 == NULL || p2 == NULL) { - return FALSE; + if (p1 == nullptr || p2 == nullptr) { + return false; } while (*p1 != 0 && *p1 == *p2) { ++p1; @@ -964,10 +1039,10 @@ uhash_compareIChars(const UHashTok key1, const UHashTok key2) { const char *p1 = (const char*) key1.pointer; const char *p2 = (const char*) key2.pointer; if (p1 == p2) { - return TRUE; + return true; } - if (p1 == NULL || p2 == NULL) { - return FALSE; + if (p1 == nullptr || p2 == nullptr) { + return false; } while (*p1 != 0 && uprv_tolower(*p1) == uprv_tolower(*p2)) { ++p1; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uhash.h b/src/duckdb/extension/icu/third_party/icu/common/uhash.h index b59d2711b..2ce296f0e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uhash.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uhash.h @@ -23,7 +23,7 @@ /** * UHashtable stores key-value pairs and does moderately fast lookup * based on keys. It provides a good tradeoff between access time and - * storage space. As elements are added to it, it grows to accomodate + * storage space. As elements are added to it, it grows to accommodate * them. By default, the table never shrinks, even if all elements * are removed from it. * @@ -54,6 +54,13 @@ * uhash_remove() on that key. This keeps uhash_get(), uhash_count(), * and uhash_nextElement() consistent with one another. * + * Keys and values can be integers. + * Functions that work with an integer key have an "i" prefix. + * Functions that work with an integer value have an "i" suffix. + * As with putting a NULL value pointer, putting a zero value integer removes the item. + * Except, there are pairs of functions that allow setting zero values + * and fetching (value, found) pairs. + * * To see everything in a hashtable, use uhash_nextElement() to * iterate through its contents. Each call to this function returns a * UHashElement pointer. A hash element contains a key, value, and @@ -121,7 +128,7 @@ typedef UElementsAreEqual UValueComparator; /* see cmemory.h for UObjectDeleter and uprv_deleteUObject() */ /** - * This specifies whether or not, and how, the hastable resizes itself. + * This specifies whether or not, and how, the hashtable resizes itself. * See uhash_setResizePolicy(). */ enum UHashResizePolicy { @@ -202,7 +209,7 @@ uhash_open(UHashFunction *keyHash, * NULL. * @param keyComp A pointer to the function that compares keys. Must * not be NULL. - * @param size The initial capacity of this hash table. + * @param size The initial capacity of this hashtable. * @param status A pointer to an UErrorCode to receive any errors. * @return A pointer to a UHashtable, or 0 if an error occurred. * @see uhash_open @@ -237,7 +244,7 @@ uhash_init(UHashtable *hash, * NULL. * @param keyComp A pointer to the function that compares keys. Must * not be NULL. - * @param size The initial capacity of this hash table. + * @param size The initial capacity of this hashtable. * @param status A pointer to an UErrorCode to receive any errors. * @return A pointer to a UHashtable, or 0 if an error occurred. * @see uhash_openSize @@ -315,7 +322,7 @@ U_CAPI UObjectDeleter *U_EXPORT2 uhash_setValueDeleter(UHashtable *hash, UObjectDeleter *fn); /** - * Specify whether or not, and how, the hastable resizes itself. + * Specify whether or not, and how, the hashtable resizes itself. * By default, tables grow but do not shrink (policy U_GROW). * See enum UHashResizePolicy. * @param hash The UHashtable to set @@ -405,6 +412,44 @@ uhash_iputi(UHashtable *hash, int32_t value, UErrorCode *status); +/** + * Put a (key=pointer, value=integer) item in a UHashtable. If the + * keyDeleter is non-NULL, then the hashtable owns 'key' after this + * call. valueDeleter must be NULL. + * Storing a 0 value is possible; call uhash_igetiAndFound() to retrieve values including zero. + * + * @param hash The target UHashtable. + * @param key The key to store. + * @param value The integer value to store. + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or 0 if none. + * @see uhash_getiAndFound + */ +U_CAPI int32_t U_EXPORT2 +uhash_putiAllowZero(UHashtable *hash, + void *key, + int32_t value, + UErrorCode *status); + +/** + * Put a (key=integer, value=integer) item in a UHashtable. If the + * keyDeleter is non-NULL, then the hashtable owns 'key' after this + * call. valueDeleter must be NULL. + * Storing a 0 value is possible; call uhash_igetiAndFound() to retrieve values including zero. + * + * @param hash The target UHashtable. + * @param key The key to store. + * @param value The integer value to store. + * @param status A pointer to an UErrorCode to receive any errors. + * @return The previous value, or 0 if none. + * @see uhash_igetiAndFound + */ +U_CAPI int32_t U_EXPORT2 +uhash_iputiAllowZero(UHashtable *hash, + int32_t key, + int32_t value, + UErrorCode *status); + /** * Retrieve a pointer value from a UHashtable using a pointer key, * as previously stored by uhash_put(). @@ -448,6 +493,34 @@ U_CAPI int32_t U_EXPORT2 uhash_igeti(const UHashtable *hash, int32_t key); +/** + * Retrieves an integer value from a UHashtable using a pointer key, + * as previously stored by uhash_putiAllowZero() or uhash_puti(). + * + * @param hash The target UHashtable. + * @param key A pointer key stored in a hashtable + * @param found A pointer to a boolean which will be set for whether the key was found. + * @return The requested item, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_getiAndFound(const UHashtable *hash, + const void *key, + UBool *found); + +/** + * Retrieves an integer value from a UHashtable using an integer key, + * as previously stored by uhash_iputiAllowZero() or uhash_iputi(). + * + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @param found A pointer to a boolean which will be set for whether the key was found. + * @return The requested item, or 0 if not found. + */ +U_CAPI int32_t U_EXPORT2 +uhash_igetiAndFound(const UHashtable *hash, + int32_t key, + UBool *found); + /** * Remove an item from a UHashtable stored by uhash_put(). * @param hash The target UHashtable. @@ -495,6 +568,26 @@ uhash_iremovei(UHashtable *hash, U_CAPI void U_EXPORT2 uhash_removeAll(UHashtable *hash); +/** + * Returns true if the UHashtable contains an item with this pointer key. + * + * @param hash The target UHashtable. + * @param key A pointer key stored in a hashtable + * @return true if the key is found. + */ +U_CAPI UBool U_EXPORT2 +uhash_containsKey(const UHashtable *hash, const void *key); + +/** + * Returns true if the UHashtable contains an item with this integer key. + * + * @param hash The target UHashtable. + * @param key An integer key stored in a hashtable + * @return true if the key is found. + */ +U_CAPI UBool U_EXPORT2 +uhash_icontainsKey(const UHashtable *hash, int32_t key); + /** * Locate an element of a UHashtable. The caller must not modify the * returned object. The primary use of this function is to obtain the @@ -687,7 +780,7 @@ uhash_deleteHashtable(void *obj); /* Use uprv_free() itself as a deleter for any key or value allocated using uprv_malloc. */ /** - * Checks if the given hash tables are equal or not. + * Checks if the given hashtables are equal or not. * @param hash1 * @param hash2 * @return true if the hashtables are equal and false if not. diff --git a/src/duckdb/extension/icu/third_party/icu/common/uidna.cpp b/src/duckdb/extension/icu/third_party/icu/common/uidna.cpp deleted file mode 100644 index 7c986944f..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/uidna.cpp +++ /dev/null @@ -1,921 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * -// * Copyright (C) 2003-2014, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ******************************************************************************* -// * file name: uidna.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2003feb1 -// * created by: Ram Viswanadha -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_IDNA - -// #include "unicode/uidna.h" -// #include "unicode/ustring.h" -// #include "unicode/usprep.h" -// #include "punycode.h" -// #include "ustr_imp.h" -// #include "cmemory.h" -// #include "uassert.h" -// #include "sprpimpl.h" - -// /* it is official IDNA ACE Prefix is "xn--" */ -// static const UChar ACE_PREFIX[] ={ 0x0078,0x006E,0x002d,0x002d } ; -// #define ACE_PREFIX_LENGTH 4 - -// #define MAX_LABEL_LENGTH 63 -// /* The Max length of the labels should not be more than MAX_LABEL_LENGTH */ -// #define MAX_LABEL_BUFFER_SIZE 100 - -// #define MAX_DOMAIN_NAME_LENGTH 255 -// /* The Max length of the domain names should not be more than MAX_DOMAIN_NAME_LENGTH */ -// #define MAX_IDN_BUFFER_SIZE MAX_DOMAIN_NAME_LENGTH+1 - -// #define LOWER_CASE_DELTA 0x0020 -// #define HYPHEN 0x002D -// #define FULL_STOP 0x002E -// #define CAPITAL_A 0x0041 -// #define CAPITAL_Z 0x005A - -// inline static UChar -// toASCIILower(UChar ch){ -// if(CAPITAL_A <= ch && ch <= CAPITAL_Z){ -// return ch + LOWER_CASE_DELTA; -// } -// return ch; -// } - -// inline static UBool -// startsWithPrefix(const UChar* src , int32_t srcLength){ -// if(srcLength < ACE_PREFIX_LENGTH){ -// return FALSE; -// } - -// for(int8_t i=0; i< ACE_PREFIX_LENGTH; i++){ -// if(toASCIILower(src[i]) != ACE_PREFIX[i]){ -// return FALSE; -// } -// } -// return TRUE; -// } - - -// inline static int32_t -// compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len, -// const UChar* s2, int32_t s2Len){ - -// int32_t minLength; -// int32_t lengthResult; - -// // are we comparing different lengths? -// if(s1Len != s2Len) { -// if(s1Len < s2Len) { -// minLength = s1Len; -// lengthResult = -1; -// } else { -// minLength = s2Len; -// lengthResult = 1; -// } -// } else { -// // ok the lengths are equal -// minLength = s1Len; -// lengthResult = 0; -// } - -// UChar c1,c2; -// int32_t rc; - -// for(int32_t i =0;/* no condition */;i++) { - -// /* If we reach the ends of both strings then they match */ -// if(i == minLength) { -// return lengthResult; -// } - -// c1 = s1[i]; -// c2 = s2[i]; - -// /* Case-insensitive comparison */ -// if(c1!=c2) { -// rc=(int32_t)toASCIILower(c1)-(int32_t)toASCIILower(c2); -// if(rc!=0) { -// lengthResult=rc; -// break; -// } -// } -// } -// return lengthResult; -// } - - -// /** -// * Ascertain if the given code point is a label separator as -// * defined by the IDNA RFC -// * -// * @param ch The code point to be ascertained -// * @return true if the char is a label separator -// * @stable ICU 2.8 -// */ -// static inline UBool isLabelSeparator(UChar ch){ -// switch(ch){ -// case 0x002e: -// case 0x3002: -// case 0xFF0E: -// case 0xFF61: -// return TRUE; -// default: -// return FALSE; -// } -// } - -// // returns the length of the label excluding the separator -// // if *limit == separator then the length returned does not include -// // the separtor. -// static inline int32_t -// getNextSeparator(UChar *src, int32_t srcLength, -// UChar **limit, UBool *done){ -// if(srcLength == -1){ -// int32_t i; -// for(i=0 ; ;i++){ -// if(src[i] == 0){ -// *limit = src + i; // point to null -// *done = TRUE; -// return i; -// } -// if(isLabelSeparator(src[i])){ -// *limit = src + (i+1); // go past the delimiter -// return i; - -// } -// } -// }else{ -// int32_t i; -// for(i=0;i0x007A){ -// return FALSE; -// } -// //[\\u002D \\u0030-\\u0039 \\u0041-\\u005A \\u0061-\\u007A] -// if( (ch==0x002D) || -// (0x0030 <= ch && ch <= 0x0039) || -// (0x0041 <= ch && ch <= 0x005A) || -// (0x0061 <= ch && ch <= 0x007A) -// ){ -// return TRUE; -// } -// return FALSE; -// } - -// static int32_t -// _internal_toASCII(const UChar* src, int32_t srcLength, -// UChar* dest, int32_t destCapacity, -// int32_t options, -// UStringPrepProfile* nameprep, -// UParseError* parseError, -// UErrorCode* status) -// { - -// // TODO Revisit buffer handling. The label should not be over 63 ASCII characters. ICU4J may need to be updated too. -// UChar b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE]; -// //initialize pointers to stack buffers -// UChar *b1 = b1Stack, *b2 = b2Stack; -// int32_t b1Len=0, b2Len, -// b1Capacity = MAX_LABEL_BUFFER_SIZE, -// b2Capacity = MAX_LABEL_BUFFER_SIZE , -// reqLength=0; - -// int32_t namePrepOptions = ((options & UIDNA_ALLOW_UNASSIGNED) != 0) ? USPREP_ALLOW_UNASSIGNED: 0; -// UBool* caseFlags = NULL; - -// // the source contains all ascii codepoints -// UBool srcIsASCII = TRUE; -// // assume the source contains all LDH codepoints -// UBool srcIsLDH = TRUE; - -// int32_t j=0; - -// //get the options -// UBool useSTD3ASCIIRules = (UBool)((options & UIDNA_USE_STD3_RULES) != 0); - -// int32_t failPos = -1; - -// if(srcLength == -1){ -// srcLength = u_strlen(src); -// } - -// if(srcLength > b1Capacity){ -// b1 = (UChar*) uprv_malloc(srcLength * U_SIZEOF_UCHAR); -// if(b1==NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } -// b1Capacity = srcLength; -// } - -// // step 1 -// for( j=0;j 0x7F){ -// srcIsASCII = FALSE; -// } -// b1[b1Len++] = src[j]; -// } - -// // step 2 is performed only if the source contains non ASCII -// if(srcIsASCII == FALSE){ - -// // step 2 -// b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Capacity, namePrepOptions, parseError, status); - -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// // redo processing of string -// // we do not have enough room so grow the buffer -// if(b1 != b1Stack){ -// uprv_free(b1); -// } -// b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR); -// if(b1==NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } - -// *status = U_ZERO_ERROR; // reset error - -// b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Len, namePrepOptions, parseError, status); -// } -// } -// // error bail out -// if(U_FAILURE(*status)){ -// goto CLEANUP; -// } -// if(b1Len == 0){ -// *status = U_IDNA_ZERO_LENGTH_LABEL_ERROR; -// goto CLEANUP; -// } - -// // for step 3 & 4 -// srcIsASCII = TRUE; -// for( j=0;j 0x7F){ -// srcIsASCII = FALSE; -// }else if(isLDHChar(b1[j])==FALSE){ // if the char is in ASCII range verify that it is an LDH character -// srcIsLDH = FALSE; -// failPos = j; -// } -// } -// if(useSTD3ASCIIRules == TRUE){ -// // verify 3a and 3b -// // 3(a) Verify the absence of non-LDH ASCII code points; that is, the -// // absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F. -// // 3(b) Verify the absence of leading and trailing hyphen-minus; that -// // is, the absence of U+002D at the beginning and end of the -// // sequence. -// if( srcIsLDH == FALSE /* source at this point should not contain anyLDH characters */ -// || b1[0] == HYPHEN || b1[b1Len-1] == HYPHEN){ -// *status = U_IDNA_STD3_ASCII_RULES_ERROR; - -// /* populate the parseError struct */ -// if(srcIsLDH==FALSE){ -// // failPos is always set the index of failure -// uprv_syntaxError(b1,failPos, b1Len,parseError); -// }else if(b1[0] == HYPHEN){ -// // fail position is 0 -// uprv_syntaxError(b1,0,b1Len,parseError); -// }else{ -// // the last index in the source is always length-1 -// uprv_syntaxError(b1, (b1Len>0) ? b1Len-1 : b1Len, b1Len,parseError); -// } - -// goto CLEANUP; -// } -// } -// // Step 4: if the source is ASCII then proceed to step 8 -// if(srcIsASCII){ -// if(b1Len <= destCapacity){ -// u_memmove(dest, b1, b1Len); -// reqLength = b1Len; -// }else{ -// reqLength = b1Len; -// goto CLEANUP; -// } -// }else{ -// // step 5 : verify the sequence does not begin with ACE prefix -// if(!startsWithPrefix(b1,b1Len)){ - -// //step 6: encode the sequence with punycode - -// // do not preserve the case flags for now! -// // TODO: Preserve the case while implementing the RFE -// // caseFlags = (UBool*) uprv_malloc(b1Len * sizeof(UBool)); -// // uprv_memset(caseFlags,TRUE,b1Len); - -// b2Len = u_strToPunycode(b1,b1Len,b2,b2Capacity,caseFlags, status); - -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// // redo processing of string -// /* we do not have enough room so grow the buffer*/ -// b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR); -// if(b2 == NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } - -// *status = U_ZERO_ERROR; // reset error - -// b2Len = u_strToPunycode(b1,b1Len,b2,b2Len,caseFlags, status); -// } -// //error bail out -// if(U_FAILURE(*status)){ -// goto CLEANUP; -// } -// // TODO : Reconsider while implementing the case preserve RFE -// // convert all codepoints to lower case ASCII -// // toASCIILower(b2,b2Len); -// reqLength = b2Len+ACE_PREFIX_LENGTH; - -// if(reqLength > destCapacity){ -// *status = U_BUFFER_OVERFLOW_ERROR; -// goto CLEANUP; -// } -// //Step 7: prepend the ACE prefix -// u_memcpy(dest, ACE_PREFIX, ACE_PREFIX_LENGTH); -// //Step 6: copy the contents in b2 into dest -// u_memcpy(dest+ACE_PREFIX_LENGTH, b2, b2Len); - -// }else{ -// *status = U_IDNA_ACE_PREFIX_ERROR; -// //position of failure is 0 -// uprv_syntaxError(b1,0,b1Len,parseError); -// goto CLEANUP; -// } -// } -// // step 8: verify the length of label -// if(reqLength > MAX_LABEL_LENGTH){ -// *status = U_IDNA_LABEL_TOO_LONG_ERROR; -// } - -// CLEANUP: -// if(b1 != b1Stack){ -// uprv_free(b1); -// } -// if(b2 != b2Stack){ -// uprv_free(b2); -// } -// uprv_free(caseFlags); - -// return u_terminateUChars(dest, destCapacity, reqLength, status); -// } - -// static int32_t -// _internal_toUnicode(const UChar* src, int32_t srcLength, -// UChar* dest, int32_t destCapacity, -// int32_t options, -// UStringPrepProfile* nameprep, -// UParseError* parseError, -// UErrorCode* status) -// { - -// //get the options -// //UBool useSTD3ASCIIRules = (UBool)((options & UIDNA_USE_STD3_RULES) != 0); -// int32_t namePrepOptions = ((options & UIDNA_ALLOW_UNASSIGNED) != 0) ? USPREP_ALLOW_UNASSIGNED: 0; - -// // TODO Revisit buffer handling. The label should not be over 63 ASCII characters. ICU4J may need to be updated too. -// UChar b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE], b3Stack[MAX_LABEL_BUFFER_SIZE]; - -// //initialize pointers to stack buffers -// UChar *b1 = b1Stack, *b2 = b2Stack, *b1Prime=NULL, *b3=b3Stack; -// int32_t b1Len = 0, b2Len, b1PrimeLen, b3Len, -// b1Capacity = MAX_LABEL_BUFFER_SIZE, -// b2Capacity = MAX_LABEL_BUFFER_SIZE, -// b3Capacity = MAX_LABEL_BUFFER_SIZE, -// reqLength=0; - -// UBool* caseFlags = NULL; - -// UBool srcIsASCII = TRUE; -// /*UBool srcIsLDH = TRUE; -// int32_t failPos =0;*/ - -// // step 1: find out if all the codepoints in src are ASCII -// if(srcLength==-1){ -// srcLength = 0; -// for(;src[srcLength]!=0;){ -// if(src[srcLength]> 0x7f){ -// srcIsASCII = FALSE; -// }/*else if(isLDHChar(src[srcLength])==FALSE){ -// // here we do not assemble surrogates -// // since we know that LDH code points -// // are in the ASCII range only -// srcIsLDH = FALSE; -// failPos = srcLength; -// }*/ -// srcLength++; -// } -// }else if(srcLength > 0){ -// for(int32_t j=0; j 0x7f){ -// srcIsASCII = FALSE; -// break; -// }/*else if(isLDHChar(src[j])==FALSE){ -// // here we do not assemble surrogates -// // since we know that LDH code points -// // are in the ASCII range only -// srcIsLDH = FALSE; -// failPos = j; -// }*/ -// } -// }else{ -// return 0; -// } - -// if(srcIsASCII == FALSE){ -// // step 2: process the string -// b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Capacity, namePrepOptions, parseError, status); -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// // redo processing of string -// /* we do not have enough room so grow the buffer*/ -// b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR); -// if(b1==NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } - -// *status = U_ZERO_ERROR; // reset error - -// b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Len, namePrepOptions, parseError, status); -// } -// //bail out on error -// if(U_FAILURE(*status)){ -// goto CLEANUP; -// } -// }else{ - -// //just point src to b1 -// b1 = (UChar*) src; -// b1Len = srcLength; -// } - -// // The RFC states that -// // -// // ToUnicode never fails. If any step fails, then the original input -// // is returned immediately in that step. -// // - -// //step 3: verify ACE Prefix -// if(startsWithPrefix(b1,b1Len)){ - -// //step 4: Remove the ACE Prefix -// b1Prime = b1 + ACE_PREFIX_LENGTH; -// b1PrimeLen = b1Len - ACE_PREFIX_LENGTH; - -// //step 5: Decode using punycode -// b2Len = u_strFromPunycode(b1Prime, b1PrimeLen, b2, b2Capacity, caseFlags,status); - -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// // redo processing of string -// /* we do not have enough room so grow the buffer*/ -// b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR); -// if(b2==NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } - -// *status = U_ZERO_ERROR; // reset error - -// b2Len = u_strFromPunycode(b1Prime, b1PrimeLen, b2, b2Len, caseFlags, status); -// } - - -// //step 6:Apply toASCII -// b3Len = uidna_toASCII(b2, b2Len, b3, b3Capacity, options, parseError, status); - -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// // redo processing of string -// /* we do not have enough room so grow the buffer*/ -// b3 = (UChar*) uprv_malloc(b3Len * U_SIZEOF_UCHAR); -// if(b3==NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } - -// *status = U_ZERO_ERROR; // reset error - -// b3Len = uidna_toASCII(b2,b2Len,b3,b3Len,options,parseError, status); - -// } -// //bail out on error -// if(U_FAILURE(*status)){ -// goto CLEANUP; -// } - -// //step 7: verify -// if(compareCaseInsensitiveASCII(b1, b1Len, b3, b3Len) !=0){ -// // Cause the original to be returned. -// *status = U_IDNA_VERIFICATION_ERROR; -// goto CLEANUP; -// } - -// //step 8: return output of step 5 -// reqLength = b2Len; -// if(b2Len <= destCapacity) { -// u_memmove(dest, b2, b2Len); -// } -// } -// else{ -// // See the start of this if statement for why this is commented out. -// // verify that STD3 ASCII rules are satisfied -// /*if(useSTD3ASCIIRules == TRUE){ -// if( srcIsLDH == FALSE // source contains some non-LDH characters -// || src[0] == HYPHEN || src[srcLength-1] == HYPHEN){ -// *status = U_IDNA_STD3_ASCII_RULES_ERROR; - -// // populate the parseError struct -// if(srcIsLDH==FALSE){ -// // failPos is always set the index of failure -// uprv_syntaxError(src,failPos, srcLength,parseError); -// }else if(src[0] == HYPHEN){ -// // fail position is 0 -// uprv_syntaxError(src,0,srcLength,parseError); -// }else{ -// // the last index in the source is always length-1 -// uprv_syntaxError(src, (srcLength>0) ? srcLength-1 : srcLength, srcLength,parseError); -// } - -// goto CLEANUP; -// } -// }*/ -// // just return the source -// //copy the source to destination -// if(srcLength <= destCapacity){ -// u_memmove(dest, src, srcLength); -// } -// reqLength = srcLength; -// } - - -// CLEANUP: - -// if(b1 != b1Stack && b1!=src){ -// uprv_free(b1); -// } -// if(b2 != b2Stack){ -// uprv_free(b2); -// } -// uprv_free(caseFlags); - -// // The RFC states that -// // -// // ToUnicode never fails. If any step fails, then the original input -// // is returned immediately in that step. -// // -// // So if any step fails lets copy source to destination -// if(U_FAILURE(*status)){ -// //copy the source to destination -// if(dest && srcLength <= destCapacity){ -// // srcLength should have already been set earlier. -// U_ASSERT(srcLength >= 0); -// u_memmove(dest, src, srcLength); -// } -// reqLength = srcLength; -// *status = U_ZERO_ERROR; -// } - -// return u_terminateUChars(dest, destCapacity, reqLength, status); -// } - -// U_CAPI int32_t U_EXPORT2 -// uidna_toASCII(const UChar* src, int32_t srcLength, -// UChar* dest, int32_t destCapacity, -// int32_t options, -// UParseError* parseError, -// UErrorCode* status){ - -// if(status == NULL || U_FAILURE(*status)){ -// return 0; -// } -// if((src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){ -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status); - -// if(U_FAILURE(*status)){ -// return -1; -// } - -// int32_t retLen = _internal_toASCII(src, srcLength, dest, destCapacity, options, nameprep, parseError, status); - -// /* close the profile*/ -// usprep_close(nameprep); - -// return retLen; -// } - -// U_CAPI int32_t U_EXPORT2 -// uidna_toUnicode(const UChar* src, int32_t srcLength, -// UChar* dest, int32_t destCapacity, -// int32_t options, -// UParseError* parseError, -// UErrorCode* status){ - -// if(status == NULL || U_FAILURE(*status)){ -// return 0; -// } -// if( (src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){ -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status); - -// if(U_FAILURE(*status)){ -// return -1; -// } - -// int32_t retLen = _internal_toUnicode(src, srcLength, dest, destCapacity, options, nameprep, parseError, status); - -// usprep_close(nameprep); - -// return retLen; -// } - - -// U_CAPI int32_t U_EXPORT2 -// uidna_IDNToASCII( const UChar *src, int32_t srcLength, -// UChar* dest, int32_t destCapacity, -// int32_t options, -// UParseError *parseError, -// UErrorCode *status){ - -// if(status == NULL || U_FAILURE(*status)){ -// return 0; -// } -// if((src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){ -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// int32_t reqLength = 0; - -// UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status); - -// if(U_FAILURE(*status)){ -// return 0; -// } - -// //initialize pointers -// UChar *delimiter = (UChar*)src; -// UChar *labelStart = (UChar*)src; -// UChar *currentDest = (UChar*) dest; -// int32_t remainingLen = srcLength; -// int32_t remainingDestCapacity = destCapacity; -// int32_t labelLen = 0, labelReqLength = 0; -// UBool done = FALSE; - - -// for(;;){ - -// labelLen = getNextSeparator(labelStart,remainingLen, &delimiter,&done); -// labelReqLength = 0; -// if(!(labelLen==0 && done)){// make sure this is not a root label separator. - -// labelReqLength = _internal_toASCII( labelStart, labelLen, -// currentDest, remainingDestCapacity, -// options, nameprep, -// parseError, status); - -// if(*status == U_BUFFER_OVERFLOW_ERROR){ - -// *status = U_ZERO_ERROR; // reset error -// remainingDestCapacity = 0; -// } -// } - - -// if(U_FAILURE(*status)){ -// break; -// } - -// reqLength +=labelReqLength; -// // adjust the destination pointer -// if(labelReqLength < remainingDestCapacity){ -// currentDest = currentDest + labelReqLength; -// remainingDestCapacity -= labelReqLength; -// }else{ -// // should never occur -// remainingDestCapacity = 0; -// } - -// if(done == TRUE){ -// break; -// } - -// // add the label separator -// if(remainingDestCapacity > 0){ -// *currentDest++ = FULL_STOP; -// remainingDestCapacity--; -// } -// reqLength++; - -// labelStart = delimiter; -// if(remainingLen >0 ){ -// remainingLen = (int32_t)(srcLength - (delimiter - src)); -// } - -// } - -// if(reqLength > MAX_DOMAIN_NAME_LENGTH){ -// *status = U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR; -// } - -// usprep_close(nameprep); - -// return u_terminateUChars(dest, destCapacity, reqLength, status); -// } - -// U_CAPI int32_t U_EXPORT2 -// uidna_IDNToUnicode( const UChar* src, int32_t srcLength, -// UChar* dest, int32_t destCapacity, -// int32_t options, -// UParseError* parseError, -// UErrorCode* status){ - -// if(status == NULL || U_FAILURE(*status)){ -// return 0; -// } -// if((src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){ -// *status = U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// int32_t reqLength = 0; - -// UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status); - -// if(U_FAILURE(*status)){ -// return 0; -// } - -// //initialize pointers -// UChar *delimiter = (UChar*)src; -// UChar *labelStart = (UChar*)src; -// UChar *currentDest = (UChar*) dest; -// int32_t remainingLen = srcLength; -// int32_t remainingDestCapacity = destCapacity; -// int32_t labelLen = 0, labelReqLength = 0; -// UBool done = FALSE; - -// for(;;){ - -// labelLen = getNextSeparator(labelStart,remainingLen, &delimiter,&done); - -// // The RFC states that -// // -// // ToUnicode never fails. If any step fails, then the original input -// // is returned immediately in that step. -// // -// // _internal_toUnicode will copy the label. -// /*if(labelLen==0 && done==FALSE){ -// *status = U_IDNA_ZERO_LENGTH_LABEL_ERROR; -// break; -// }*/ - -// labelReqLength = _internal_toUnicode(labelStart, labelLen, -// currentDest, remainingDestCapacity, -// options, nameprep, -// parseError, status); - -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// *status = U_ZERO_ERROR; // reset error -// remainingDestCapacity = 0; -// } - -// if(U_FAILURE(*status)){ -// break; -// } - -// reqLength +=labelReqLength; -// // adjust the destination pointer -// if(labelReqLength < remainingDestCapacity){ -// currentDest = currentDest + labelReqLength; -// remainingDestCapacity -= labelReqLength; -// }else{ -// // should never occur -// remainingDestCapacity = 0; -// } - -// if(done == TRUE){ -// break; -// } - -// // add the label separator -// // Unlike the ToASCII operation we don't normalize the label separators -// if(remainingDestCapacity > 0){ -// *currentDest++ = *(labelStart + labelLen); -// remainingDestCapacity--; -// } -// reqLength++; - -// labelStart = delimiter; -// if(remainingLen >0 ){ -// remainingLen = (int32_t)(srcLength - (delimiter - src)); -// } - -// } - -// if(reqLength > MAX_DOMAIN_NAME_LENGTH){ -// *status = U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR; -// } - -// usprep_close(nameprep); - -// return u_terminateUChars(dest, destCapacity, reqLength, status); -// } - -// U_CAPI int32_t U_EXPORT2 -// uidna_compare( const UChar *s1, int32_t length1, -// const UChar *s2, int32_t length2, -// int32_t options, -// UErrorCode* status){ - -// if(status == NULL || U_FAILURE(*status)){ -// return -1; -// } - -// UChar b1Stack[MAX_IDN_BUFFER_SIZE], b2Stack[MAX_IDN_BUFFER_SIZE]; -// UChar *b1 = b1Stack, *b2 = b2Stack; -// int32_t b1Len, b2Len, b1Capacity = MAX_IDN_BUFFER_SIZE, b2Capacity = MAX_IDN_BUFFER_SIZE; -// int32_t result=-1; - -// UParseError parseError; - -// b1Len = uidna_IDNToASCII(s1, length1, b1, b1Capacity, options, &parseError, status); -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// // redo processing of string -// b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR); -// if(b1==NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } - -// *status = U_ZERO_ERROR; // reset error - -// b1Len = uidna_IDNToASCII(s1,length1,b1,b1Len, options, &parseError, status); - -// } - -// b2Len = uidna_IDNToASCII(s2,length2, b2,b2Capacity, options, &parseError, status); -// if(*status == U_BUFFER_OVERFLOW_ERROR){ -// // redo processing of string -// b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR); -// if(b2==NULL){ -// *status = U_MEMORY_ALLOCATION_ERROR; -// goto CLEANUP; -// } - -// *status = U_ZERO_ERROR; // reset error - -// b2Len = uidna_IDNToASCII(s2, length2, b2, b2Len, options, &parseError, status); - -// } -// // when toASCII is applied all label separators are replaced with FULL_STOP -// result = compareCaseInsensitiveASCII(b1,b1Len,b2,b2Len); - -// CLEANUP: -// if(b1 != b1Stack){ -// uprv_free(b1); -// } - -// if(b2 != b2Stack){ -// uprv_free(b2); -// } - -// return result; -// } - -// #endif /* #if !UCONFIG_NO_IDNA */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/uinit.cpp b/src/duckdb/extension/icu/third_party/icu/common/uinit.cpp index 624431be0..dc3867b17 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uinit.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uinit.cpp @@ -26,11 +26,11 @@ U_NAMESPACE_BEGIN -static UInitOnce gICUInitOnce = U_INITONCE_INITIALIZER; +static UInitOnce gICUInitOnce {}; static UBool U_CALLCONV uinit_cleanup() { gICUInitOnce.reset(); - return TRUE; + return true; } static void U_CALLCONV diff --git a/src/duckdb/extension/icu/third_party/icu/common/uinvchar.cpp b/src/duckdb/extension/icu/third_party/icu/common/uinvchar.cpp index 05bcf10df..096a8e28d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uinvchar.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uinvchar.cpp @@ -182,8 +182,8 @@ static const uint32_t invariantChars[4]={ U_CAPI void U_EXPORT2 -u_charsToUChars(const char *cs, UChar *us, int32_t length) { - UChar u; +u_charsToUChars(const char *cs, char16_t *us, int32_t length) { + char16_t u; uint8_t c; /* @@ -193,7 +193,7 @@ u_charsToUChars(const char *cs, UChar *us, int32_t length) { */ while(length>0) { c=(uint8_t)(*cs++); - u=(UChar)CHAR_TO_UCHAR(c); + u=(char16_t)CHAR_TO_UCHAR(c); U_ASSERT((u!=0 || c==0)); /* only invariant chars converted? */ *us++=u; --length; @@ -201,13 +201,13 @@ u_charsToUChars(const char *cs, UChar *us, int32_t length) { } U_CAPI void U_EXPORT2 -u_UCharsToChars(const UChar *us, char *cs, int32_t length) { - UChar u; +u_UCharsToChars(const char16_t *us, char *cs, int32_t length) { + char16_t u; while(length>0) { u=*us++; if(!UCHAR_IS_INVARIANT(u)) { - U_ASSERT(FALSE); /* Variant characters were used. These are not portable in ICU. */ + U_ASSERT(false); /* Variant characters were used. These are not portable in ICU. */ u=0; } *cs++=(char)UCHAR_TO_CHAR(u); @@ -245,23 +245,23 @@ uprv_isInvariantString(const char *s, int32_t length) { */ #if U_CHARSET_FAMILY==U_ASCII_FAMILY if(!UCHAR_IS_INVARIANT(c)) { - return FALSE; /* found a variant char */ + return false; /* found a variant char */ } #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY c=CHAR_TO_UCHAR(c); if(c==0 || !UCHAR_IS_INVARIANT(c)) { - return FALSE; /* found a variant char */ + return false; /* found a variant char */ } #else # error U_CHARSET_FAMILY is not valid #endif } - return TRUE; + return true; } U_CAPI UBool U_EXPORT2 -uprv_isInvariantUString(const UChar *s, int32_t length) { - UChar c; +uprv_isInvariantUString(const char16_t *s, int32_t length) { + char16_t c; for(;;) { if(length<0) { @@ -284,10 +284,10 @@ uprv_isInvariantUString(const UChar *s, int32_t length) { * for strings with variant characters */ if(!UCHAR_IS_INVARIANT(c)) { - return FALSE; /* found a variant char */ + return false; /* found a variant char */ } } - return TRUE; + return true; } /* UDataSwapFn implementations used in udataswp.c ------- */ @@ -303,10 +303,10 @@ uprv_ebcdicFromAscii(const UDataSwapper *ds, int32_t count; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -340,10 +340,10 @@ uprv_copyAscii(const UDataSwapper *ds, int32_t count; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -380,10 +380,10 @@ uprv_asciiFromEbcdic(const UDataSwapper *ds, int32_t count; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -417,10 +417,10 @@ uprv_copyEbcdic(const UDataSwapper *ds, int32_t count; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -457,13 +457,13 @@ uprv_isEbcdicAtSign(char c) { U_CFUNC int32_t uprv_compareInvAscii(const UDataSwapper *ds, const char *outString, int32_t outLength, - const UChar *localString, int32_t localLength) { + const char16_t *localString, int32_t localLength) { (void)ds; int32_t minLength; UChar32 c1, c2; uint8_t c; - if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) { + if(outString==nullptr || outLength<-1 || localString==nullptr || localLength<-1) { return 0; } @@ -503,13 +503,13 @@ uprv_compareInvAscii(const UDataSwapper *ds, U_CFUNC int32_t uprv_compareInvEbcdic(const UDataSwapper *ds, const char *outString, int32_t outLength, - const UChar *localString, int32_t localLength) { + const char16_t *localString, int32_t localLength) { (void)ds; int32_t minLength; UChar32 c1, c2; uint8_t c; - if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) { + if(outString==nullptr || outLength<-1 || localString==nullptr || localLength<-1) { return 0; } @@ -579,7 +579,7 @@ uprv_ebcdicToLowercaseAscii(char c) { return (char)lowercaseAsciiFromEbcdic[(uint8_t)c]; } -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n) { uint8_t *orig_dst = dst; @@ -600,7 +600,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n) return orig_dst; } -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n) { uint8_t *orig_dst = dst; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uinvchar.h b/src/duckdb/extension/icu/third_party/icu/common/uinvchar.h index a43cfcd98..9b7a9bd11 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uinvchar.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uinvchar.h @@ -33,11 +33,11 @@ * * @param s Input string pointer. * @param length Length of the string, can be -1 if NUL-terminated. - * @return TRUE if s contains only invariant characters. + * @return true if s contains only invariant characters. * * @internal (ICU 2.8) */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uprv_isInvariantString(const char *s, int32_t length); /** @@ -46,11 +46,11 @@ uprv_isInvariantString(const char *s, int32_t length); * * @param s Input string pointer. * @param length Length of the string, can be -1 if NUL-terminated. - * @return TRUE if s contains only invariant characters. + * @return true if s contains only invariant characters. * * @internal (ICU 2.8) */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uprv_isInvariantUString(const UChar *s, int32_t length); /** @@ -141,7 +141,7 @@ uprv_isEbcdicAtSign(char c); * Compare two EBCDIC invariant-character strings in ASCII order. * @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2); /** @@ -161,7 +161,7 @@ uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2); * Converts an EBCDIC invariant character to ASCII. * @internal */ -U_INTERNAL char U_EXPORT2 +U_CAPI char U_EXPORT2 uprv_ebcdicToAscii(char c); /** @@ -181,7 +181,7 @@ uprv_ebcdicToAscii(char c); * Converts an EBCDIC invariant character to lowercase ASCII. * @internal */ -U_INTERNAL char U_EXPORT2 +U_CAPI char U_EXPORT2 uprv_ebcdicToLowercaseAscii(char c); /** @@ -202,7 +202,7 @@ uprv_ebcdicToLowercaseAscii(char c); * @internal * @see uprv_strncpy */ -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n); @@ -211,7 +211,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n); * @internal * @see uprv_strncpy */ -U_INTERNAL uint8_t* U_EXPORT2 +U_CAPI uint8_t* U_EXPORT2 uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n); diff --git a/src/duckdb/extension/icu/third_party/icu/common/uiter.cpp b/src/duckdb/extension/icu/third_party/icu/common/uiter.cpp index b9252d81c..be59eab2e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uiter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uiter.cpp @@ -47,7 +47,7 @@ noopMove(UCharIterator * /*iter*/, int32_t /*delta*/, UCharIteratorOrigin /*orig static UBool U_CALLCONV noopHasNext(UCharIterator * /*iter*/) { - return FALSE; + return false; } static UChar32 U_CALLCONV @@ -74,7 +74,7 @@ static const UCharIterator noopIterator={ noopCurrent, noopCurrent, noopCurrent, - NULL, + nullptr, noopGetState, noopSetState }; @@ -82,14 +82,14 @@ static const UCharIterator noopIterator={ /* UCharIterator implementation for simple strings -------------------------- */ /* - * This is an implementation of a code unit (UChar) iterator - * for UChar * strings. + * This is an implementation of a code unit (char16_t) iterator + * for char16_t * strings. * * The UCharIterator.context field holds a pointer to the string. */ static int32_t U_CALLCONV -stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { +stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED { switch(origin) { case UITER_ZERO: return 0; @@ -109,7 +109,7 @@ stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { } static int32_t U_CALLCONV -stringIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { +stringIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED { int32_t pos; switch(origin) { @@ -154,7 +154,7 @@ stringIteratorHasPrevious(UCharIterator *iter) { static UChar32 U_CALLCONV stringIteratorCurrent(UCharIterator *iter) { if(iter->indexlimit) { - return ((const UChar *)(iter->context))[iter->index]; + return ((const char16_t *)(iter->context))[iter->index]; } else { return U_SENTINEL; } @@ -163,7 +163,7 @@ stringIteratorCurrent(UCharIterator *iter) { static UChar32 U_CALLCONV stringIteratorNext(UCharIterator *iter) { if(iter->indexlimit) { - return ((const UChar *)(iter->context))[iter->index++]; + return ((const char16_t *)(iter->context))[iter->index++]; } else { return U_SENTINEL; } @@ -172,7 +172,7 @@ stringIteratorNext(UCharIterator *iter) { static UChar32 U_CALLCONV stringIteratorPrevious(UCharIterator *iter) { if(iter->index>iter->start) { - return ((const UChar *)(iter->context))[--iter->index]; + return ((const char16_t *)(iter->context))[--iter->index]; } else { return U_SENTINEL; } @@ -185,9 +185,9 @@ stringIteratorGetState(const UCharIterator *iter) { static void U_CALLCONV stringIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { /* do nothing */ - } else if(iter==NULL) { + } else if(iter==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } else if((int32_t)statestart || iter->limit<(int32_t)state) { *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; @@ -205,13 +205,13 @@ static const UCharIterator stringIterator={ stringIteratorCurrent, stringIteratorNext, stringIteratorPrevious, - NULL, + nullptr, stringIteratorGetState, stringIteratorSetState }; U_CAPI void U_EXPORT2 -uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) { +uiter_setString(UCharIterator *iter, const char16_t *s, int32_t length) { if(iter!=0) { if(s!=0 && length>=-1) { *iter=stringIterator; @@ -231,12 +231,12 @@ uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) { /* UCharIterator implementation for UTF-16BE strings ------------------------ */ /* - * This is an implementation of a code unit (UChar) iterator + * This is an implementation of a code unit (char16_t) iterator * for UTF-16BE strings, i.e., strings in byte-vectors where - * each UChar is stored as a big-endian pair of bytes. + * each char16_t is stored as a big-endian pair of bytes. * * The UCharIterator.context field holds a pointer to the string. - * Everything works just like with a normal UChar iterator (uiter_setString), + * Everything works just like with a normal char16_t iterator (uiter_setString), * except that UChars are assembled from byte pairs. */ @@ -244,7 +244,7 @@ uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) { static inline UChar32 utf16BEIteratorGet(UCharIterator *iter, int32_t index) { const uint8_t *p=(const uint8_t *)iter->context; - return ((UChar)p[2*index]<<8)|(UChar)p[2*index+1]; + return ((char16_t)p[2*index]<<8)|(char16_t)p[2*index+1]; } static UChar32 U_CALLCONV @@ -291,13 +291,13 @@ static const UCharIterator utf16BEIterator={ utf16BEIteratorCurrent, utf16BEIteratorNext, utf16BEIteratorPrevious, - NULL, + nullptr, stringIteratorGetState, stringIteratorSetState }; /* - * Count the number of UChars in a UTF-16BE string before a terminating UChar NUL, + * Count the number of UChars in a UTF-16BE string before a terminating char16_t NUL, * i.e., before a pair of 0 bytes where the first 0 byte is at an even * offset from s. */ @@ -306,10 +306,10 @@ utf16BE_strlen(const char *s) { if(IS_POINTER_EVEN(s)) { /* * even-aligned, call u_strlen(s) - * we are probably on a little-endian machine, but searching for UChar NUL + * we are probably on a little-endian machine, but searching for char16_t NUL * does not care about endianness */ - return u_strlen((const UChar *)s); + return u_strlen((const char16_t *)s); } else { /* odd-aligned, search for pair of 0 bytes */ const char *p=s; @@ -323,15 +323,15 @@ utf16BE_strlen(const char *s) { U_CAPI void U_EXPORT2 uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length) { - if(iter!=NULL) { + if(iter!=nullptr) { /* allow only even-length strings (the input length counts bytes) */ - if(s!=NULL && (length==-1 || (length>=0 && IS_EVEN(length)))) { + if(s!=nullptr && (length==-1 || (length>=0 && IS_EVEN(length)))) { /* length/=2, except that >>=1 also works for -1 (-1/2==0, -1>>1==-1) */ length>>=1; if(U_IS_BIG_ENDIAN && IS_POINTER_EVEN(s)) { - /* big-endian machine and 2-aligned UTF-16BE string: use normal UChar iterator */ - uiter_setString(iter, (const UChar *)s, length); + /* big-endian machine and 2-aligned UTF-16BE string: use normal char16_t iterator */ + uiter_setString(iter, (const char16_t *)s, length); return; } @@ -359,7 +359,7 @@ uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length) { */ static int32_t U_CALLCONV -characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { +characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED { switch(origin) { case UITER_ZERO: return 0; @@ -379,7 +379,7 @@ characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { } static int32_t U_CALLCONV -characterIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { +characterIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED { switch(origin) { case UITER_ZERO: ((CharacterIterator *)(iter->context))->setIndex(delta); @@ -445,9 +445,9 @@ characterIteratorGetState(const UCharIterator *iter) { static void U_CALLCONV characterIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { /* do nothing */ - } else if(iter==NULL || iter->context==NULL) { + } else if(iter==nullptr || iter->context==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } else if((int32_t)state<((CharacterIterator *)(iter->context))->startIndex() || ((CharacterIterator *)(iter->context))->endIndex()<(int32_t)state) { *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; @@ -465,7 +465,7 @@ static const UCharIterator characterIteratorWrapper={ characterIteratorCurrent, characterIteratorNext, characterIteratorPrevious, - NULL, + nullptr, characterIteratorGetState, characterIteratorSetState }; @@ -485,7 +485,7 @@ uiter_setCharacterIterator(UCharIterator *iter, CharacterIterator *charIter) { /* UCharIterator wrapper around Replaceable --------------------------------- */ /* - * This is an implementation of a code unit (UChar) iterator + * This is an implementation of a code unit (char16_t) iterator * based on a Replaceable object. * * The UCharIterator.context field holds a pointer to the Replaceable. @@ -529,7 +529,7 @@ static const UCharIterator replaceableIterator={ replaceableIteratorCurrent, replaceableIteratorNext, replaceableIteratorPrevious, - NULL, + nullptr, stringIteratorGetState, stringIteratorSetState }; @@ -561,7 +561,7 @@ uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) { /* * Minimal implementation: - * Maintain a single-UChar buffer for an additional surrogate. + * Maintain a single-char16_t buffer for an additional surrogate. * The caller must not modify start and limit because they are used internally. * * Use UCharIterator fields as follows: @@ -586,7 +586,7 @@ uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) { */ static int32_t U_CALLCONV -utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { +utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED { switch(origin) { case UITER_ZERO: case UITER_START: @@ -666,7 +666,7 @@ utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) { } static int32_t U_CALLCONV -utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) { +utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED { const uint8_t *s; UChar32 c; int32_t pos; /* requested UTF-16 index */ @@ -678,24 +678,24 @@ utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) case UITER_ZERO: case UITER_START: pos=delta; - havePos=TRUE; + havePos=true; /* iter->index<0 (unknown) is possible */ break; case UITER_CURRENT: if(iter->index>=0) { pos=iter->index+delta; - havePos=TRUE; + havePos=true; } else { /* the current UTF-16 index is unknown after setState(), use only delta */ pos=0; - havePos=FALSE; + havePos=false; } break; case UITER_LIMIT: case UITER_LENGTH: if(iter->length>=0) { pos=iter->length+delta; - havePos=TRUE; + havePos=true; } else { /* pin to the end, avoid counting the length */ iter->index=-1; @@ -706,7 +706,7 @@ utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) } else { /* the current UTF-16 index is unknown, use only delta */ pos=0; - havePos=FALSE; + havePos=false; } } break; @@ -873,7 +873,7 @@ utf8IteratorNext(UCharIterator *iter) { int32_t index; if(iter->reservedField!=0) { - UChar trail=U16_TRAIL(iter->reservedField); + char16_t trail=U16_TRAIL(iter->reservedField); iter->reservedField=0; if((index=iter->index)>=0) { iter->index=index+1; @@ -908,7 +908,7 @@ utf8IteratorPrevious(UCharIterator *iter) { int32_t index; if(iter->reservedField!=0) { - UChar lead=U16_LEAD(iter->reservedField); + char16_t lead=U16_LEAD(iter->reservedField); iter->reservedField=0; iter->start-=4; /* we stayed behind the supplementary code point; go before it now */ if((index=iter->index)>0) { @@ -951,9 +951,9 @@ utf8IteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { /* do nothing */ - } else if(iter==NULL) { + } else if(iter==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } else if(state==utf8IteratorGetState(iter)) { /* setting to the current state: no-op */ @@ -995,7 +995,7 @@ static const UCharIterator utf8Iterator={ utf8IteratorCurrent, utf8IteratorNext, utf8IteratorPrevious, - NULL, + nullptr, utf8IteratorGetState, utf8IteratorSetState }; @@ -1085,7 +1085,7 @@ uiter_previous32(UCharIterator *iter) { U_CAPI uint32_t U_EXPORT2 uiter_getState(const UCharIterator *iter) { - if(iter==NULL || iter->getState==NULL) { + if(iter==nullptr || iter->getState==nullptr) { return UITER_NO_STATE; } else { return iter->getState(iter); @@ -1094,11 +1094,11 @@ uiter_getState(const UCharIterator *iter) { U_CAPI void U_EXPORT2 uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { /* do nothing */ - } else if(iter==NULL) { + } else if(iter==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - } else if(iter->setState==NULL) { + } else if(iter->setState==nullptr) { *pErrorCode=U_UNSUPPORTED_ERROR; } else { iter->setState(iter, state, pErrorCode); diff --git a/src/duckdb/extension/icu/third_party/icu/common/ulist.cpp b/src/duckdb/extension/icu/third_party/icu/common/ulist.cpp index c5180431c..5bdf534c8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ulist.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ulist.cpp @@ -34,21 +34,21 @@ struct UList { static void ulist_addFirstItem(UList *list, UListNode *newItem); U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCode *status) { - UList *newList = NULL; + UList *newList = nullptr; if (U_FAILURE(*status)) { - return NULL; + return nullptr; } newList = (UList *)uprv_malloc(sizeof(UList)); - if (newList == NULL) { + if (newList == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - newList->curr = NULL; - newList->head = NULL; - newList->tail = NULL; + newList->curr = nullptr; + newList->head = nullptr; + newList->tail = nullptr; newList->size = 0; return newList; @@ -59,20 +59,20 @@ U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCode *status) { * This function properly sets the pointers for the first item added. */ static void ulist_addFirstItem(UList *list, UListNode *newItem) { - newItem->next = NULL; - newItem->previous = NULL; + newItem->next = nullptr; + newItem->previous = nullptr; list->head = newItem; list->tail = newItem; } static void ulist_removeItem(UList *list, UListNode *p) { - if (p->previous == NULL) { + if (p->previous == nullptr) { // p is the list head. list->head = p->next; } else { p->previous->next = p->next; } - if (p->next == NULL) { + if (p->next == nullptr) { // p is the list tail. list->tail = p->previous; } else { @@ -89,9 +89,9 @@ static void ulist_removeItem(UList *list, UListNode *p) { } U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) { - UListNode *newItem = NULL; + UListNode *newItem = nullptr; - if (U_FAILURE(*status) || list == NULL || data == NULL) { + if (U_FAILURE(*status) || list == nullptr || data == nullptr) { if (forceDelete) { uprv_free((void *)data); } @@ -99,7 +99,7 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool } newItem = (UListNode *)uprv_malloc(sizeof(UListNode)); - if (newItem == NULL) { + if (newItem == nullptr) { if (forceDelete) { uprv_free((void *)data); } @@ -112,7 +112,7 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool if (list->size == 0) { ulist_addFirstItem(list, newItem); } else { - newItem->next = NULL; + newItem->next = nullptr; newItem->previous = list->tail; list->tail->next = newItem; list->tail = newItem; @@ -122,9 +122,9 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool } U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) { - UListNode *newItem = NULL; + UListNode *newItem = nullptr; - if (U_FAILURE(*status) || list == NULL || data == NULL) { + if (U_FAILURE(*status) || list == nullptr || data == nullptr) { if (forceDelete) { uprv_free((void *)data); } @@ -132,7 +132,7 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo } newItem = (UListNode *)uprv_malloc(sizeof(UListNode)); - if (newItem == NULL) { + if (newItem == nullptr) { if (forceDelete) { uprv_free((void *)data); } @@ -145,7 +145,7 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo if (list->size == 0) { ulist_addFirstItem(list, newItem); } else { - newItem->previous = NULL; + newItem->previous = nullptr; newItem->next = list->head; list->head->previous = newItem; list->head = newItem; @@ -155,38 +155,38 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo } U_CAPI UBool U_EXPORT2 ulist_containsString(const UList *list, const char *data, int32_t length) { - if (list != NULL) { + if (list != nullptr) { const UListNode *pointer; - for (pointer = list->head; pointer != NULL; pointer = pointer->next) { + for (pointer = list->head; pointer != nullptr; pointer = pointer->next) { if (length == (int32_t)uprv_strlen((const char *)pointer->data)) { if (uprv_memcmp(data, pointer->data, length) == 0) { - return TRUE; + return true; } } } } - return FALSE; + return false; } U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data) { - if (list != NULL) { + if (list != nullptr) { UListNode *pointer; - for (pointer = list->head; pointer != NULL; pointer = pointer->next) { + for (pointer = list->head; pointer != nullptr; pointer = pointer->next) { if (uprv_strcmp(data, (const char *)pointer->data) == 0) { ulist_removeItem(list, pointer); // Remove only the first occurrence, like Java LinkedList.remove(Object). - return TRUE; + return true; } } } - return FALSE; + return false; } U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) { - UListNode *curr = NULL; + UListNode *curr = nullptr; - if (list == NULL || list->curr == NULL) { - return NULL; + if (list == nullptr || list->curr == nullptr) { + return nullptr; } curr = list->curr; @@ -196,7 +196,7 @@ U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) { } U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list) { - if (list != NULL) { + if (list != nullptr) { return list->size; } @@ -204,17 +204,17 @@ U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list) { } U_CAPI void U_EXPORT2 ulist_resetList(UList *list) { - if (list != NULL) { + if (list != nullptr) { list->curr = list->head; } } U_CAPI void U_EXPORT2 ulist_deleteList(UList *list) { - UListNode *listHead = NULL; + UListNode *listHead = nullptr; - if (list != NULL) { + if (list != nullptr) { listHead = list->head; - while (listHead != NULL) { + while (listHead != nullptr) { UListNode *listPointer = listHead->next; if (listHead->forceDelete) { @@ -225,12 +225,12 @@ U_CAPI void U_EXPORT2 ulist_deleteList(UList *list) { listHead = listPointer; } uprv_free(list); - list = NULL; + list = nullptr; } } U_CAPI void U_EXPORT2 ulist_close_keyword_values_iterator(UEnumeration *en) { - if (en != NULL) { + if (en != nullptr) { ulist_deleteList((UList *)(en->context)); uprv_free(en); } @@ -247,11 +247,11 @@ U_CAPI int32_t U_EXPORT2 ulist_count_keyword_values(UEnumeration *en, UErrorCode U_CAPI const char * U_EXPORT2 ulist_next_keyword_value(UEnumeration *en, int32_t *resultLength, UErrorCode *status) { const char *s; if (U_FAILURE(*status)) { - return NULL; + return nullptr; } s = (const char *)ulist_getNext((UList *)(en->context)); - if (s != NULL && resultLength != NULL) { + if (s != nullptr && resultLength != nullptr) { *resultLength = static_cast(uprv_strlen(s)); } return s; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uloc.cpp b/src/duckdb/extension/icu/third_party/icu/common/uloc.cpp index af49de1f8..ce49d6c50 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uloc.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uloc.cpp @@ -30,10 +30,14 @@ l = lang, C = ctry, M = charmap, V = variant */ +#include "unicode/bytestream.h" +#include "unicode/errorcode.h" +#include "unicode/stringpiece.h" #include "unicode/utypes.h" #include "unicode/ustring.h" #include "unicode/uloc.h" +#include "bytesinkutil.h" #include "putilimp.h" #include "ustr_imp.h" #include "ulocimp.h" @@ -45,8 +49,6 @@ #include "uenumimp.h" #include "uassert.h" #include "charstr.h" -#include /* for sprintf */ -#include "duckdb/common/string_util.hpp" U_NAMESPACE_USE @@ -54,14 +56,7 @@ U_NAMESPACE_USE /* Locale stuff from locid.cpp */ U_CFUNC void locale_set_default(const char *id); -U_CFUNC const char *locale_get_default(void); -U_CFUNC int32_t -locale_getKeywords(const char *localeID, - char prev, - char *keywords, int32_t keywordCapacity, - char *values, int32_t valuesCapacity, int32_t *valLen, - UBool valuesToo, - UErrorCode *status); +U_CFUNC const char *locale_get_default(); /* ### Data tables **************************************************/ @@ -76,8 +71,8 @@ locale_getKeywords(const char *localeID, * This list must be kept in sync with LANGUAGES_3, with corresponding * entries matched. * - * This table should be terminated with a NULL entry, followed by a - * second list, and another NULL entry. The first list is visible to + * This table should be terminated with a nullptr entry, followed by a + * second list, and another nullptr entry. The first list is visible to * user code when this array is returned by API. The second list * contains codes we support, but do not expose through user API. * @@ -107,13 +102,13 @@ static const char * const LANGUAGES[] = { "asa", "ase", "ast", "av", "avk", "awa", "ay", "az", "ba", "bal", "ban", "bar", "bas", "bax", "bbc", "bbj", "be", "bej", "bem", "bew", "bez", "bfd", "bfq", "bg", - "bgn", "bho", "bi", "bik", "bin", "bjn", "bkm", "bla", - "bm", "bn", "bo", "bpy", "bqi", "br", "bra", "brh", + "bgc", "bgn", "bho", "bi", "bik", "bin", "bjn", "bkm", "bla", + "blo", "bm", "bn", "bo", "bpy", "bqi", "br", "bra", "brh", "brx", "bs", "bss", "bua", "bug", "bum", "byn", "byv", "ca", "cad", "car", "cay", "cch", "ccp", "ce", "ceb", "cgg", "ch", "chb", "chg", "chk", "chm", "chn", "cho", "chp", "chr", "chy", "ckb", "co", "cop", "cps", "cr", "crh", - "cs", "csb", "cu", "cv", "cy", + "cs", "csb", "csw", "cu", "cv", "cy", "da", "dak", "dar", "dav", "de", "del", "den", "dgr", "din", "dje", "doi", "dsb", "dtp", "dua", "dum", "dv", "dyo", "dyu", "dz", "dzg", @@ -140,7 +135,7 @@ static const char * const LANGUAGES[] = { "kkj", "kl", "kln", "km", "kmb", "kn", "ko", "koi", "kok", "kos", "kpe", "kr", "krc", "kri", "krj", "krl", "kru", "ks", "ksb", "ksf", "ksh", "ku", "kum", "kut", - "kv", "kw", "ky", + "kv", "kw", "kxv", "ky", "la", "lad", "lag", "lah", "lam", "lb", "lez", "lfn", "lg", "li", "lij", "liv", "lkt", "lmo", "ln", "lo", "lol", "loz", "lrc", "lt", "ltg", "lu", "lua", "lui", @@ -148,7 +143,7 @@ static const char * const LANGUAGES[] = { "mad", "maf", "mag", "mai", "mak", "man", "mas", "mde", "mdf", "mdh", "mdr", "men", "mer", "mfe", "mg", "mga", "mgh", "mgo", "mh", "mi", "mic", "min", "mis", "mk", - "ml", "mn", "mnc", "mni", "mo", + "ml", "mn", "mnc", "mni", "moh", "mos", "mr", "mrj", "ms", "mt", "mua", "mul", "mus", "mwl", "mwr", "mwv", "my", "mye", "myv", "mzn", @@ -157,7 +152,7 @@ static const char * const LANGUAGES[] = { "nnh", "no", "nog", "non", "nov", "nqo", "nr", "nso", "nus", "nv", "nwc", "ny", "nym", "nyn", "nyo", "nzi", "oc", "oj", "om", "or", "os", "osa", "ota", - "pa", "pag", "pal", "pam", "pap", "pau", "pcd", "pdc", + "pa", "pag", "pal", "pam", "pap", "pau", "pcd", "pcm", "pdc", "pdt", "peo", "pfl", "phn", "pi", "pl", "pms", "pnt", "pon", "prg", "pro", "ps", "pt", "qu", "quc", "qug", @@ -171,30 +166,30 @@ static const char * const LANGUAGES[] = { "sl", "sli", "sly", "sm", "sma", "smj", "smn", "sms", "sn", "snk", "so", "sog", "sq", "sr", "srn", "srr", "ss", "ssy", "st", "stq", "su", "suk", "sus", "sux", - "sv", "sw", "swb", "swc", "syc", "syr", "szl", + "sv", "sw", "swb", "syc", "syr", "szl", "ta", "tcy", "te", "tem", "teo", "ter", "tet", "tg", - "th", "ti", "tig", "tiv", "tk", "tkl", "tkr", "tl", - "tlh", "tli", "tly", "tmh", "tn", "to", "tog", "tpi", + "th", "ti", "tig", "tiv", "tk", "tkl", "tkr", + "tlh", "tli", "tly", "tmh", "tn", "to", "tog", "tok", "tpi", "tr", "tru", "trv", "ts", "tsd", "tsi", "tt", "ttt", "tum", "tvl", "tw", "twq", "ty", "tyv", "tzm", "udm", "ug", "uga", "uk", "umb", "und", "ur", "uz", - "vai", "ve", "vec", "vep", "vi", "vls", "vmf", "vo", - "vot", "vro", "vun", + "vai", "ve", "vec", "vep", "vi", "vls", "vmf", "vmw", + "vo", "vot", "vro", "vun", "wa", "wae", "wal", "war", "was", "wbp", "wo", "wuu", - "xal", "xh", "xmf", "xog", + "xal", "xh", "xmf", "xnr", "xog", "yao", "yap", "yav", "ybb", "yi", "yo", "yrl", "yue", "za", "zap", "zbl", "zea", "zen", "zgh", "zh", "zu", "zun", "zxx", "zza", -NULL, - "in", "iw", "ji", "jw", "sh", /* obsolete language codes */ -NULL +nullptr, + "in", "iw", "ji", "jw", "mo", "sh", "swc", "tl", /* obsolete language codes */ +nullptr }; static const char* const DEPRECATED_LANGUAGES[]={ - "in", "iw", "ji", "jw", NULL, NULL + "in", "iw", "ji", "jw", "mo", nullptr, nullptr }; static const char* const REPLACEMENT_LANGUAGES[]={ - "id", "he", "yi", "jv", NULL, NULL + "id", "he", "yi", "jv", "ro", nullptr, nullptr }; /** @@ -209,8 +204,8 @@ static const char* const REPLACEMENT_LANGUAGES[]={ * Where a 3-letter language code has no 2-letter equivalent, the * 3-letter code occupies both LANGUAGES[i] and LANGUAGES_3[i]. * - * This table should be terminated with a NULL entry, followed by a - * second list, and another NULL entry. The two lists correspond to + * This table should be terminated with a nullptr entry, followed by a + * second list, and another nullptr entry. The two lists correspond to * the two lists in LANGUAGES. */ /* Generated using org.unicode.cldr.icu.GenerateISO639LanguageTables */ @@ -224,13 +219,13 @@ static const char * const LANGUAGES_3[] = { "asa", "ase", "ast", "ava", "avk", "awa", "aym", "aze", "bak", "bal", "ban", "bar", "bas", "bax", "bbc", "bbj", "bel", "bej", "bem", "bew", "bez", "bfd", "bfq", "bul", - "bgn", "bho", "bis", "bik", "bin", "bjn", "bkm", "bla", - "bam", "ben", "bod", "bpy", "bqi", "bre", "bra", "brh", + "bgc", "bgn", "bho", "bis", "bik", "bin", "bjn", "bkm", "bla", + "blo", "bam", "ben", "bod", "bpy", "bqi", "bre", "bra", "brh", "brx", "bos", "bss", "bua", "bug", "bum", "byn", "byv", "cat", "cad", "car", "cay", "cch", "ccp", "che", "ceb", "cgg", "cha", "chb", "chg", "chk", "chm", "chn", "cho", "chp", "chr", "chy", "ckb", "cos", "cop", "cps", "cre", "crh", - "ces", "csb", "chu", "chv", "cym", + "ces", "csb", "csw", "chu", "chv", "cym", "dan", "dak", "dar", "dav", "deu", "del", "den", "dgr", "din", "dje", "doi", "dsb", "dtp", "dua", "dum", "div", "dyo", "dyu", "dzo", "dzg", @@ -257,7 +252,7 @@ static const char * const LANGUAGES_3[] = { "kkj", "kal", "kln", "khm", "kmb", "kan", "kor", "koi", "kok", "kos", "kpe", "kau", "krc", "kri", "krj", "krl", "kru", "kas", "ksb", "ksf", "ksh", "kur", "kum", "kut", - "kom", "cor", "kir", + "kom", "cor", "kxv", "kir", "lat", "lad", "lag", "lah", "lam", "ltz", "lez", "lfn", "lug", "lim", "lij", "liv", "lkt", "lmo", "lin", "lao", "lol", "loz", "lrc", "lit", "ltg", "lub", "lua", "lui", @@ -265,7 +260,7 @@ static const char * const LANGUAGES_3[] = { "mad", "maf", "mag", "mai", "mak", "man", "mas", "mde", "mdf", "mdh", "mdr", "men", "mer", "mfe", "mlg", "mga", "mgh", "mgo", "mah", "mri", "mic", "min", "mis", "mkd", - "mal", "mon", "mnc", "mni", "mol", + "mal", "mon", "mnc", "mni", "moh", "mos", "mar", "mrj", "msa", "mlt", "mua", "mul", "mus", "mwl", "mwr", "mwv", "mya", "mye", "myv", "mzn", @@ -274,7 +269,7 @@ static const char * const LANGUAGES_3[] = { "nnh", "nor", "nog", "non", "nov", "nqo", "nbl", "nso", "nus", "nav", "nwc", "nya", "nym", "nyn", "nyo", "nzi", "oci", "oji", "orm", "ori", "oss", "osa", "ota", - "pan", "pag", "pal", "pam", "pap", "pau", "pcd", "pdc", + "pan", "pag", "pal", "pam", "pap", "pau", "pcd", "pcm", "pdc", "pdt", "peo", "pfl", "phn", "pli", "pol", "pms", "pnt", "pon", "prg", "pro", "pus", "por", "que", "quc", "qug", @@ -288,24 +283,24 @@ static const char * const LANGUAGES_3[] = { "slv", "sli", "sly", "smo", "sma", "smj", "smn", "sms", "sna", "snk", "som", "sog", "sqi", "srp", "srn", "srr", "ssw", "ssy", "sot", "stq", "sun", "suk", "sus", "sux", - "swe", "swa", "swb", "swc", "syc", "syr", "szl", + "swe", "swa", "swb", "syc", "syr", "szl", "tam", "tcy", "tel", "tem", "teo", "ter", "tet", "tgk", - "tha", "tir", "tig", "tiv", "tuk", "tkl", "tkr", "tgl", - "tlh", "tli", "tly", "tmh", "tsn", "ton", "tog", "tpi", + "tha", "tir", "tig", "tiv", "tuk", "tkl", "tkr", + "tlh", "tli", "tly", "tmh", "tsn", "ton", "tog", "tok", "tpi", "tur", "tru", "trv", "tso", "tsd", "tsi", "tat", "ttt", "tum", "tvl", "twi", "twq", "tah", "tyv", "tzm", "udm", "uig", "uga", "ukr", "umb", "und", "urd", "uzb", - "vai", "ven", "vec", "vep", "vie", "vls", "vmf", "vol", - "vot", "vro", "vun", + "vai", "ven", "vec", "vep", "vie", "vls", "vmf", "vmw", + "vol", "vot", "vro", "vun", "wln", "wae", "wal", "war", "was", "wbp", "wol", "wuu", - "xal", "xho", "xmf", "xog", + "xal", "xho", "xmf", "xnr", "xog", "yao", "yap", "yav", "ybb", "yid", "yor", "yrl", "yue", "zha", "zap", "zbl", "zea", "zen", "zgh", "zho", "zul", "zun", "zxx", "zza", -NULL, -/* "in", "iw", "ji", "jw", "sh", */ - "ind", "heb", "yid", "jaw", "srp", -NULL +nullptr, +/* "in", "iw", "ji", "jw", "mo", "sh", "swc", "tl", */ + "ind", "heb", "yid", "jaw", "mol", "srp", "swc", "tgl", +nullptr }; /** @@ -317,8 +312,8 @@ NULL * This list must be kept in sync with COUNTRIES_3, with corresponding * entries matched. * - * This table should be terminated with a NULL entry, followed by a - * second list, and another NULL entry. The first list is visible to + * This table should be terminated with a nullptr entry, followed by a + * second list, and another nullptr entry. The first list is visible to * user code when this array is returned by API. The second list * contains codes we support, but do not expose through user API. * @@ -338,14 +333,14 @@ static const char * const COUNTRIES[] = { "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", - "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", - "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", - "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", + "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CQ", "CR", + "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DG", "DJ", "DK", + "DM", "DO", "DZ", "EA", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", - "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", + "IC", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", @@ -362,18 +357,18 @@ static const char * const COUNTRIES[] = { "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", - "WS", "YE", "YT", "ZA", "ZM", "ZW", -NULL, + "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW", +nullptr, "AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR", /* obsolete country codes */ -NULL +nullptr }; static const char* const DEPRECATED_COUNTRIES[] = { - "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR", NULL, NULL /* deprecated country list */ + "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR", nullptr, nullptr /* deprecated country list */ }; static const char* const REPLACEMENT_COUNTRIES[] = { /* "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR" */ - "CW", "MM", "RS", "DE", "BJ", "FR", "BF", "VU", "ZW", "RU", "TL", "GB", "VN", "YE", "RS", "CD", NULL, NULL /* replacement country codes */ + "CW", "MM", "RS", "DE", "BJ", "FR", "BF", "VU", "ZW", "RU", "TL", "GB", "VN", "YE", "RS", "CD", nullptr, nullptr /* replacement country codes */ }; /** @@ -385,8 +380,8 @@ static const char* const REPLACEMENT_COUNTRIES[] = { * COUNTRIES_3[i]. The commented-out lines are copied from COUNTRIES * to make eyeballing this baby easier. * - * This table should be terminated with a NULL entry, followed by a - * second list, and another NULL entry. The two lists correspond to + * This table should be terminated with a nullptr entry, followed by a + * second list, and another nullptr entry. The two lists correspond to * the two lists in COUNTRIES. */ static const char * const COUNTRIES_3[] = { @@ -400,12 +395,12 @@ static const char * const COUNTRIES_3[] = { "BEN", "BLM", "BMU", "BRN", "BOL", "BES", "BRA", "BHS", "BTN", "BVT", /* "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", */ "BWA", "BLR", "BLZ", "CAN", "CCK", "COD", "CAF", "COG", -/* "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", */ - "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI", -/* "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", */ - "CUB", "CPV", "CUW", "CXR", "CYP", "CZE", "DEU", "DJI", "DNK", -/* "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", */ - "DMA", "DOM", "DZA", "ECU", "EST", "EGY", "ESH", "ERI", +/* "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CQ", "CR", */ + "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRQ", "CRI", +/* "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DG", "DJ", "DK", */ + "CUB", "CPV", "CUW", "CXR", "CYP", "CZE", "DEU", "DGA", "DJI", "DNK", +/* "DM", "DO", "DZ", "EA", "EC", "EE", "EG", "EH", "ER", */ + "DMA", "DOM", "DZA", "XEA", "ECU", "EST", "EGY", "ESH", "ERI", /* "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", */ "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", "FRA", /* "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", */ @@ -414,8 +409,8 @@ static const char * const COUNTRIES_3[] = { "GMB", "GIN", "GLP", "GNQ", "GRC", "SGS", "GTM", "GUM", /* "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", */ "GNB", "GUY", "HKG", "HMD", "HND", "HRV", "HTI", "HUN", -/* "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS" */ - "IDN", "IRL", "ISR", "IMN", "IND", "IOT", "IRQ", "IRN", "ISL", +/* "IC", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS" */ + "XIC", "IDN", "IRL", "ISR", "IMN", "IND", "IOT", "IRQ", "IRN", "ISL", /* "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", */ "ITA", "JEY", "JAM", "JOR", "JPN", "KEN", "KGZ", "KHM", "KIR", /* "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", */ @@ -448,12 +443,12 @@ static const char * const COUNTRIES_3[] = { "TWN", "TZA", "UKR", "UGA", "UMI", "USA", "URY", "UZB", /* "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", */ "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", -/* "WS", "YE", "YT", "ZA", "ZM", "ZW", */ - "WSM", "YEM", "MYT", "ZAF", "ZMB", "ZWE", -NULL, +/* "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW", */ + "WSM", "XKK", "YEM", "MYT", "ZAF", "ZMB", "ZWE", +nullptr, /* "AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR" */ "ANT", "BUR", "SCG", "FXX", "ROM", "SUN", "TMP", "YMD", "YUG", "ZAR", -NULL +nullptr }; typedef struct CanonicalizationMap { @@ -466,51 +461,42 @@ typedef struct CanonicalizationMap { * different semantic kinds of transformations. */ static const CanonicalizationMap CANONICALIZE_MAP[] = { - { "art_LOJBAN", "jbo" }, /* registered name */ + { "art__LOJBAN", "jbo" }, /* registered name */ { "hy__AREVELA", "hy" }, /* Registered IANA variant */ { "hy__AREVMDA", "hyw" }, /* Registered IANA variant */ + { "zh__GUOYU", "zh" }, /* registered name */ + { "zh__HAKKA", "hak" }, /* registered name */ + { "zh__XIANG", "hsn" }, /* registered name */ + // subtags with 3 chars won't be treated as variants. { "zh_GAN", "gan" }, /* registered name */ - { "zh_GUOYU", "zh" }, /* registered name */ - { "zh_HAKKA", "hak" }, /* registered name */ { "zh_MIN_NAN", "nan" }, /* registered name */ { "zh_WUU", "wuu" }, /* registered name */ - { "zh_XIANG", "hsn" }, /* registered name */ { "zh_YUE", "yue" }, /* registered name */ }; /* ### BCP47 Conversion *******************************************/ /* Test if the locale id has BCP47 u extension and does not have '@' */ -#define _hasBCP47Extension(id) (id && uprv_strstr(id, "@") == NULL && getShortestSubtagLength(localeID) == 1) -/* Converts the BCP47 id to Unicode id. Does nothing to id if conversion fails */ -#define _ConvertBCP47(finalID, id, buffer, length,err) UPRV_BLOCK_MACRO_BEGIN { \ - if (uloc_forLanguageTag(id, buffer, length, NULL, err) <= 0 || \ - U_FAILURE(*err) || *err == U_STRING_NOT_TERMINATED_WARNING) { \ - finalID=id; \ - if (*err == U_STRING_NOT_TERMINATED_WARNING) { *err = U_BUFFER_OVERFLOW_ERROR; } \ - } else { \ - finalID=buffer; \ - } \ -} UPRV_BLOCK_MACRO_END +#define _hasBCP47Extension(id) (id && uprv_strstr(id, "@") == nullptr && getShortestSubtagLength(localeID) == 1) /* Gets the size of the shortest subtag in the given localeID. */ static int32_t getShortestSubtagLength(const char *localeID) { int32_t localeIDLength = static_cast(uprv_strlen(localeID)); int32_t length = localeIDLength; int32_t tmpLength = 0; int32_t i; - UBool reset = TRUE; + UBool reset = true; for (i = 0; i < localeIDLength; i++) { if (localeID[i] != '_' && localeID[i] != '-') { if (reset) { tmpLength = 0; - reset = FALSE; + reset = false; } tmpLength++; } else { if (tmpLength != 0 && tmpLength < length) { length = tmpLength; } - reset = TRUE; + reset = true; } } @@ -528,8 +514,8 @@ static int32_t getShortestSubtagLength(const char *localeID) { U_CAPI const char * U_EXPORT2 locale_getKeywordsStart(const char *localeID) { - const char *result = NULL; - if((result = uprv_strchr(localeID, '@')) != NULL) { + const char *result = nullptr; + if((result = uprv_strchr(localeID, '@')) != nullptr) { return result; } #if (U_CHARSET_FAMILY == U_EBCDIC_FAMILY) @@ -540,14 +526,14 @@ locale_getKeywordsStart(const char *localeID) { static const uint8_t ebcdicSigns[] = { 0x7C, 0x44, 0x66, 0x80, 0xAC, 0xAE, 0xAF, 0xB5, 0xEC, 0xEF, 0x00 }; const uint8_t *charToFind = ebcdicSigns; while(*charToFind) { - if((result = uprv_strchr(localeID, *charToFind)) != NULL) { + if((result = uprv_strchr(localeID, *charToFind)) != nullptr) { return result; } charToFind++; } } #endif - return NULL; + return nullptr; } /** @@ -596,29 +582,26 @@ compareKeywordStructs(const void * /*context*/, const void *left, const void *ri return uprv_strcmp(leftString, rightString); } -static int32_t -_getKeywords(const char *localeID, - char prev, - char *keywords, int32_t keywordCapacity, - char *values, int32_t valuesCapacity, int32_t *valLen, - UBool valuesToo, - UErrorCode *status) +U_CFUNC void +ulocimp_getKeywords(const char *localeID, + char prev, + ByteSink& sink, + UBool valuesToo, + UErrorCode *status) { KeywordStruct keywordList[ULOC_MAX_NO_KEYWORDS]; int32_t maxKeywords = ULOC_MAX_NO_KEYWORDS; int32_t numKeywords = 0; const char* pos = localeID; - const char* equalSign = NULL; - const char* semicolon = NULL; + const char* equalSign = nullptr; + const char* semicolon = nullptr; int32_t i = 0, j, n; - int32_t keywordsLen = 0; - int32_t valuesLen = 0; if(prev == '@') { /* start of keyword definition */ /* we will grab pairs, trim spaces, lowercase keywords, sort and return */ do { - UBool duplicate = FALSE; + UBool duplicate = false; /* skip leading spaces */ while(*pos == ' ') { pos++; @@ -628,7 +611,7 @@ _getKeywords(const char *localeID, } if(numKeywords == maxKeywords) { *status = U_INTERNAL_PROGRAM_ERROR; - return 0; + return; } equalSign = uprv_strchr(pos, '='); semicolon = uprv_strchr(pos, ';'); @@ -636,13 +619,13 @@ _getKeywords(const char *localeID, /* ';' before '=' [foo@currency;collation=pinyin] is illegal */ if(!equalSign || (semicolon && semicolon= ULOC_KEYWORD_BUFFER_LEN) { /* keyword name too long for internal buffer */ *status = U_INTERNAL_PROGRAM_ERROR; - return 0; + return; } for(i = 0, n = 0; i < equalSign - pos; ++i) { if (pos[i] != ' ') { @@ -653,7 +636,7 @@ _getKeywords(const char *localeID, /* zero-length keyword is an error. */ if (n == 0) { *status = U_INVALID_FORMAT_ERROR; - return 0; + return; } keywordList[numKeywords].keyword[n] = 0; @@ -668,7 +651,7 @@ _getKeywords(const char *localeID, /* Premature end or zero-length value */ if (!*equalSign || equalSign == semicolon) { *status = U_INVALID_FORMAT_ERROR; - return 0; + return; } keywordList[numKeywords].valueStart = equalSign; @@ -691,7 +674,7 @@ _getKeywords(const char *localeID, /* If this is a duplicate keyword, then ignore it */ for (j=0; j 0 && !handledInputKeyAndValue) { @@ -1047,7 +1012,7 @@ uloc_setKeywordValue(const char* keywordName, updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status); updatedKeysAndValues.append('=', *status); updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status); - handledInputKeyAndValue = TRUE; + handledInputKeyAndValue = true; } /* copy the current entry */ updatedKeysAndValues.append(keyValuePrefix, *status); @@ -1063,7 +1028,7 @@ uloc_setKeywordValue(const char* keywordName, updatedKeysAndValues.append(keywordNameBuffer, keywordNameLen, *status); updatedKeysAndValues.append('=', *status); updatedKeysAndValues.append(keywordValueBuffer, keywordValueLen, *status); - handledInputKeyAndValue = TRUE; + handledInputKeyAndValue = true; } keywordStart = nextSeparator; } /* end loop searching */ @@ -1079,20 +1044,26 @@ uloc_setKeywordValue(const char* keywordName, if (!handledInputKeyAndValue || U_FAILURE(*status)) { /* if input key/value specified removal of a keyword not present in locale, or * there was an error in CharString.append, leave original locale alone. */ + U_ASSERT(*status != U_STRING_NOT_TERMINATED_WARNING); return bufLen; } - updatedKeysAndValuesLen = updatedKeysAndValues.length(); - /* needLen = length of the part before '@' + length of updated key-value part including '@' */ - needLen = (int32_t)(startSearchHere - buffer) + updatedKeysAndValuesLen; - if(needLen >= bufferCapacity) { + // needLen = length of the part before '@' + needLen = (int32_t)(startSearchHere - buffer); + // Check to see can we fit the startSearchHere, if not, return + // U_BUFFER_OVERFLOW_ERROR without copy updatedKeysAndValues into it. + // We do this because this API function does not behave like most others: + // It promises never to set a U_STRING_NOT_TERMINATED_WARNING. + // When the contents fits but without the terminating NUL, in this case we need to not change + // the buffer contents and return with a buffer overflow error. + int32_t appendLength = updatedKeysAndValues.length(); + if (appendLength >= bufferCapacity - needLen) { *status = U_BUFFER_OVERFLOW_ERROR; - return needLen; /* no change */ - } - if (updatedKeysAndValuesLen > 0) { - uprv_strncpy(startSearchHere, updatedKeysAndValues.data(), updatedKeysAndValuesLen); + return needLen + appendLength; } - buffer[needLen]=0; + needLen += updatedKeysAndValues.extract( + startSearchHere, bufferCapacity - needLen, *status); + U_ASSERT(*status != U_STRING_NOT_TERMINATED_WARNING); return needLen; } @@ -1100,7 +1071,7 @@ uloc_setKeywordValue(const char* keywordName, #define _isPrefixLetter(a) ((a=='x')||(a=='X')||(a=='i')||(a=='I')) -/*returns TRUE if one of the special prefixes is here (s=string) +/*returns true if one of the special prefixes is here (s=string) 'x-' or 'i-' */ #define _isIDPrefix(s) (_isPrefixLetter(s[0])&&_isIDSeparator(s[1])) @@ -1111,7 +1082,7 @@ uloc_setKeywordValue(const char* keywordName, /** * Lookup 'key' in the array 'list'. The array 'list' should contain - * a NULL entry, followed by more entries, and a second NULL entry. + * a nullptr entry, followed by more entries, and a second nullptr entry. * * The 'list' param should be LANGUAGES, LANGUAGES_3, COUNTRIES, or * COUNTRIES_3. @@ -1121,7 +1092,7 @@ static int16_t _findIndex(const char* const* list, const char* key) const char* const* anchor = list; int32_t pass = 0; - /* Make two passes through two NULL-terminated arrays at 'list' */ + /* Make two passes through two nullptr-terminated arrays at 'list' */ while (pass++ < 2) { while (*list) { if (uprv_strcmp(key, *list) == 0) { @@ -1129,31 +1100,11 @@ static int16_t _findIndex(const char* const* list, const char* key) } list++; } - ++list; /* skip final NULL *CWB*/ + ++list; /* skip final nullptr *CWB*/ } return -1; } -/* count the length of src while copying it to dest; return strlen(src) */ -static inline int32_t -_copyCount(char *dest, int32_t destCapacity, const char *src) { - const char *anchor; - char c; - - anchor=src; - for(;;) { - if((c=*src)==0) { - return (int32_t)(src-anchor); - } - if(destCapacity<=0) { - return (int32_t)((src-anchor)+uprv_strlen(src)); - } - ++src; - *dest++=c; - --destCapacity; - } -} - U_CFUNC const char* uloc_getCurrentCountryID(const char* oldID){ int32_t offset = _findIndex(DEPRECATED_COUNTRIES, oldID); @@ -1178,13 +1129,11 @@ uloc_getCurrentLanguageID(const char* oldID){ * * TODO try to use this in Locale */ -U_CFUNC int32_t +CharString U_EXPORT2 ulocimp_getLanguage(const char *localeID, - char *language, int32_t languageCapacity, - const char **pEnd) { - int32_t i=0; - int32_t offset; - char lang[4]={ 0, 0, 0, 0 }; /* temporary buffer to hold language code for searching */ + const char **pEnd, + UErrorCode &status) { + CharString result; if (uprv_stricmp(localeID, "root") == 0) { localeID += 4; @@ -1198,51 +1147,41 @@ ulocimp_getLanguage(const char *localeID, /* if it starts with i- or x- then copy that prefix */ if(_isIDPrefix(localeID)) { - if(i=0); - lang[i]=(char)uprv_tolower(*localeID); - } - i++; + result.append((char)uprv_tolower(*localeID), status); localeID++; } - if(i==3) { + if(result.length()==3) { /* convert 3 character code to 2 character code if possible *CWB*/ - offset=_findIndex(LANGUAGES_3, lang); + int32_t offset = _findIndex(LANGUAGES_3, result.data()); if(offset>=0) { - i=_copyCount(language, languageCapacity, LANGUAGES[offset]); + result.clear(); + result.append(LANGUAGES[offset], status); } } - if(pEnd!=NULL) { + if(pEnd!=nullptr) { *pEnd=localeID; } - return i; + + return result; } -U_CFUNC int32_t +CharString U_EXPORT2 ulocimp_getScript(const char *localeID, - char *script, int32_t scriptCapacity, - const char **pEnd) -{ + const char **pEnd, + UErrorCode &status) { + CharString result; int32_t idLen = 0; - if (pEnd != NULL) { + if (pEnd != nullptr) { *pEnd = localeID; } @@ -1255,142 +1194,102 @@ ulocimp_getScript(const char *localeID, /* If it's exactly 4 characters long, then it's a script and not a country. */ if (idLen == 4) { int32_t i; - if (pEnd != NULL) { + if (pEnd != nullptr) { *pEnd = localeID+idLen; } - if(idLen > scriptCapacity) { - idLen = scriptCapacity; - } if (idLen >= 1) { - script[0]=(char)uprv_toupper(*(localeID++)); + result.append((char)uprv_toupper(*(localeID++)), status); } for (i = 1; i < idLen; i++) { - script[i]=(char)uprv_tolower(*(localeID++)); + result.append((char)uprv_tolower(*(localeID++)), status); } } - else { - idLen = 0; - } - return idLen; + + return result; } -U_CFUNC int32_t +CharString U_EXPORT2 ulocimp_getCountry(const char *localeID, - char *country, int32_t countryCapacity, - const char **pEnd) -{ + const char **pEnd, + UErrorCode &status) { + CharString result; int32_t idLen=0; - char cnty[ULOC_COUNTRY_CAPACITY]={ 0, 0, 0, 0 }; - int32_t offset; /* copy the country as far as possible and count its length */ while(!_isTerminator(localeID[idLen]) && !_isIDSeparator(localeID[idLen])) { - if(idLen<(ULOC_COUNTRY_CAPACITY-1)) { /*CWB*/ - cnty[idLen]=(char)uprv_toupper(localeID[idLen]); - } + result.append((char)uprv_toupper(localeID[idLen]), status); idLen++; } /* the country should be either length 2 or 3 */ if (idLen == 2 || idLen == 3) { - UBool gotCountry = FALSE; /* convert 3 character code to 2 character code if possible *CWB*/ if(idLen==3) { - offset=_findIndex(COUNTRIES_3, cnty); + int32_t offset = _findIndex(COUNTRIES_3, result.data()); if(offset>=0) { - idLen=_copyCount(country, countryCapacity, COUNTRIES[offset]); - gotCountry = TRUE; - } - } - if (!gotCountry) { - int32_t i = 0; - for (i = 0; i < idLen; i++) { - if (i < countryCapacity) { - country[i]=(char)uprv_toupper(localeID[i]); - } + result.clear(); + result.append(COUNTRIES[offset], status); } } localeID+=idLen; } else { - idLen = 0; + result.clear(); } - if(pEnd!=NULL) { + if(pEnd!=nullptr) { *pEnd=localeID; } - return idLen; + return result; } /** * @param needSeparator if true, then add leading '_' if any variants * are added to 'variant' */ -static int32_t -_getVariantEx(const char *localeID, - char prev, - char *variant, int32_t variantCapacity, - UBool needSeparator) { - int32_t i=0; +static void +_getVariant(const char *localeID, + char prev, + ByteSink& sink, + UBool needSeparator) { + UBool hasVariant = false; /* get one or more variant tags and separate them with '_' */ if(_isIDSeparator(prev)) { /* get a variant string after a '-' or '_' */ while(!_isTerminator(*localeID)) { if (needSeparator) { - if (icontext)->current); ((UKeywordsContext *)en->context)->current += len+1; } else { - result = NULL; + result = nullptr; } if (resultLength) { *resultLength = len; @@ -1448,8 +1347,8 @@ U_CDECL_END static const UEnumeration gKeywordsEnum = { - NULL, - NULL, + nullptr, + nullptr, uloc_kw_closeKeywords, uloc_kw_countKeywords, uenum_unextDefault, @@ -1489,54 +1388,61 @@ U_CAPI UEnumeration* U_EXPORT2 uloc_openKeywords(const char* localeID, UErrorCode* status) { - int32_t i=0; - char keywords[256]; - int32_t keywordsCapacity = 256; - char tempBuffer[ULOC_FULLNAME_CAPACITY]; + CharString tempBuffer; const char* tmpLocaleID; - if(status==NULL || U_FAILURE(*status)) { + if(status==nullptr || U_FAILURE(*status)) { return 0; } if (_hasBCP47Extension(localeID)) { - _ConvertBCP47(tmpLocaleID, localeID, tempBuffer, sizeof(tempBuffer), status); + CharStringByteSink sink(&tempBuffer); + ulocimp_forLanguageTag(localeID, -1, sink, nullptr, status); + tmpLocaleID = U_SUCCESS(*status) && !tempBuffer.isEmpty() ? tempBuffer.data() : localeID; } else { - if (localeID==NULL) { - localeID=uloc_getDefault(); + if (localeID==nullptr) { + localeID=uloc_getDefault(); } tmpLocaleID=localeID; } /* Skip the language */ - ulocimp_getLanguage(tmpLocaleID, NULL, 0, &tmpLocaleID); + ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *status); + if (U_FAILURE(*status)) { + return 0; + } + if(_isIDSeparator(*tmpLocaleID)) { const char *scriptID; /* Skip the script if available */ - ulocimp_getScript(tmpLocaleID+1, NULL, 0, &scriptID); + ulocimp_getScript(tmpLocaleID+1, &scriptID, *status); + if (U_FAILURE(*status)) { + return 0; + } if(scriptID != tmpLocaleID+1) { /* Found optional script */ tmpLocaleID = scriptID; } /* Skip the Country */ if (_isIDSeparator(*tmpLocaleID)) { - ulocimp_getCountry(tmpLocaleID+1, NULL, 0, &tmpLocaleID); - if(_isIDSeparator(*tmpLocaleID)) { - _getVariant(tmpLocaleID+1, *tmpLocaleID, NULL, 0); + ulocimp_getCountry(tmpLocaleID+1, &tmpLocaleID, *status); + if (U_FAILURE(*status)) { + return 0; } } } /* keywords are located after '@' */ - if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != NULL) { - i=locale_getKeywords(tmpLocaleID+1, '@', keywords, keywordsCapacity, NULL, 0, NULL, FALSE, status); - } - - if(i) { - return uloc_openKeywordList(keywords, i, status); - } else { - return NULL; + if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != nullptr) { + CharString keywords; + CharStringByteSink sink(&keywords); + ulocimp_getKeywords(tmpLocaleID+1, '@', sink, false, status); + if (U_FAILURE(*status)) { + return nullptr; + } + return uloc_openKeywordList(keywords.data(), keywords.length(), status); } + return nullptr; } @@ -1556,30 +1462,44 @@ static const char i_default[] = {'i', '-', 'd', 'e', 'f', 'a', 'u', 'l', 't'}; * * This is the code underlying uloc_getName and uloc_canonicalize. */ -static int32_t +static void _canonicalize(const char* localeID, - char* result, - int32_t resultCapacity, + ByteSink& sink, uint32_t options, UErrorCode* err) { - int32_t j, len, fieldCount=0, scriptSize=0, variantSize=0, nameCapacity; - char localeBuffer[ULOC_FULLNAME_CAPACITY]; - char tempBuffer[ULOC_FULLNAME_CAPACITY]; - const char* origLocaleID; - const char* tmpLocaleID; - const char* keywordAssign = NULL; - const char* separatorIndicator = NULL; - char* name; - char* variant = NULL; /* pointer into name, or NULL */ - if (U_FAILURE(*err)) { - return 0; + return; } + int32_t j, fieldCount=0, scriptSize=0, variantSize=0; + CharString tempBuffer; // if localeID has a BCP47 extension, tmpLocaleID points to this + CharString localeIDWithHyphens; // if localeID has a BPC47 extension and have _, tmpLocaleID points to this + const char* origLocaleID; + const char* tmpLocaleID; + const char* keywordAssign = nullptr; + const char* separatorIndicator = nullptr; + if (_hasBCP47Extension(localeID)) { - _ConvertBCP47(tmpLocaleID, localeID, tempBuffer, sizeof(tempBuffer), err); + const char* localeIDPtr = localeID; + + // convert all underbars to hyphens, unless the "BCP47 extension" comes at the beginning of the string + if (uprv_strchr(localeID, '_') != nullptr && localeID[1] != '-' && localeID[1] != '_') { + localeIDWithHyphens.append(localeID, -1, *err); + if (U_SUCCESS(*err)) { + for (char* p = localeIDWithHyphens.data(); *p != '\0'; ++p) { + if (*p == '_') { + *p = '-'; + } + } + localeIDPtr = localeIDWithHyphens.data(); + } + } + + CharStringByteSink tempSink(&tempBuffer); + ulocimp_forLanguageTag(localeIDPtr, -1, tempSink, nullptr, err); + tmpLocaleID = U_SUCCESS(*err) && !tempBuffer.isEmpty() ? tempBuffer.data() : localeIDPtr; } else { - if (localeID==NULL) { + if (localeID==nullptr) { localeID=uloc_getDefault(); } tmpLocaleID=localeID; @@ -1587,77 +1507,55 @@ _canonicalize(const char* localeID, origLocaleID=tmpLocaleID; - /* if we are doing a full canonicalization, then put results in - localeBuffer, if necessary; otherwise send them to result. */ - if (/*OPTION_SET(options, _ULOC_CANONICALIZE) &&*/ - (result == NULL || resultCapacity < (int32_t)sizeof(localeBuffer))) { - name = localeBuffer; - nameCapacity = (int32_t)sizeof(localeBuffer); - } else { - name = result; - nameCapacity = resultCapacity; - } - /* get all pieces, one after another, and separate with '_' */ - len=ulocimp_getLanguage(tmpLocaleID, name, nameCapacity, &tmpLocaleID); - - if(len == I_DEFAULT_LENGTH && uprv_strncmp(origLocaleID, i_default, len) == 0) { - const char *d = uloc_getDefault(); - - len = (int32_t)uprv_strlen(d); + CharString tag = ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *err); - if (name != NULL) { - uprv_memcpy(name, d, len); - } + if (tag.length() == I_DEFAULT_LENGTH && + uprv_strncmp(origLocaleID, i_default, I_DEFAULT_LENGTH) == 0) { + tag.clear(); + tag.append(uloc_getDefault(), *err); } else if(_isIDSeparator(*tmpLocaleID)) { const char *scriptID; ++fieldCount; - if(len 0) { /* Found optional script */ tmpLocaleID = scriptID; ++fieldCount; - len+=scriptSize; if (_isIDSeparator(*tmpLocaleID)) { /* If there is something else, then we add the _ */ - if(len 0) { + + CharString country = ulocimp_getCountry(tmpLocaleID+1, &cntryID, *err); + tag.append(country, *err); + if (!country.isEmpty()) { /* Found optional country */ tmpLocaleID = cntryID; - len+=cntrySize; } if(_isIDSeparator(*tmpLocaleID)) { /* If there is something else, then we add the _ if we found country before. */ - if (cntrySize >= 0 && ! _isIDSeparator(*(tmpLocaleID+1)) ) { + if (!_isIDSeparator(*(tmpLocaleID+1))) { ++fieldCount; - if(len 0) { - variant = len 0)) { do { - if(len 0)); + + int32_t posixVariantSize = -tag.length(); + { + CharStringByteSink s(&tag); + _getVariant(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0)); + } + posixVariantSize += tag.length(); if (posixVariantSize > 0) { - if (variant == NULL) { - variant = name+len; - } - len += posixVariantSize; variantSize += posixVariantSize; } } /* Look up the ID in the canonicalization map */ for (j=0; j keywordAssign)) { - if(len resultCapacity) ? resultCapacity : len); - } - - return u_terminateChars(result, resultCapacity, len, err); } /* ### ID parsing API **************************************************/ @@ -1774,18 +1655,45 @@ uloc_getParent(const char* localeID, char* parent, int32_t parentCapacity, UErrorCode* err) +{ + if (U_FAILURE(*err)) { + return 0; + } + + CheckedArrayByteSink sink(parent, parentCapacity); + ulocimp_getParent(localeID, sink, err); + + int32_t reslen = sink.NumberOfBytesAppended(); + + if (U_FAILURE(*err)) { + return reslen; + } + + if (sink.Overflowed()) { + *err = U_BUFFER_OVERFLOW_ERROR; + } else { + u_terminateChars(parent, parentCapacity, reslen, err); + } + + return reslen; +} + +U_CAPI void U_EXPORT2 +ulocimp_getParent(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err) { const char *lastUnderscore; int32_t i; if (U_FAILURE(*err)) - return 0; + return; - if (localeID == NULL) + if (localeID == nullptr) localeID = uloc_getDefault(); lastUnderscore=uprv_strrchr(localeID, '_'); - if(lastUnderscore!=NULL) { + if(lastUnderscore!=nullptr) { i=(int32_t)(lastUnderscore-localeID); } else { i=0; @@ -1795,13 +1703,9 @@ uloc_getParent(const char* localeID, if (uprv_strnicmp(localeID, "und_", 4) == 0) { localeID += 3; i -= 3; - uprv_memmove(parent, localeID, uprv_min(i, parentCapacity)); - } else if (parent != localeID) { - uprv_memcpy(parent, localeID, uprv_min(i, parentCapacity)); } + sink.Append(localeID, i); } - - return u_terminateChars(parent, parentCapacity, i, err); } U_CAPI int32_t U_EXPORT2 @@ -1811,18 +1715,16 @@ uloc_getLanguage(const char* localeID, UErrorCode* err) { /* uloc_getLanguage will return a 2 character iso-639 code if one exists. *CWB*/ - int32_t i=0; - if (err==NULL || U_FAILURE(*err)) { + if (err==nullptr || U_FAILURE(*err)) { return 0; } - if(localeID==NULL) { + if(localeID==nullptr) { localeID=uloc_getDefault(); } - i=ulocimp_getLanguage(localeID, language, languageCapacity, NULL); - return u_terminateChars(language, languageCapacity, i, err); + return ulocimp_getLanguage(localeID, nullptr, *err).extract(language, languageCapacity, *err); } U_CAPI int32_t U_EXPORT2 @@ -1831,22 +1733,24 @@ uloc_getScript(const char* localeID, int32_t scriptCapacity, UErrorCode* err) { - int32_t i=0; - - if(err==NULL || U_FAILURE(*err)) { + if(err==nullptr || U_FAILURE(*err)) { return 0; } - if(localeID==NULL) { + if(localeID==nullptr) { localeID=uloc_getDefault(); } /* skip the language */ - ulocimp_getLanguage(localeID, NULL, 0, &localeID); + ulocimp_getLanguage(localeID, &localeID, *err); + if (U_FAILURE(*err)) { + return 0; + } + if(_isIDSeparator(*localeID)) { - i=ulocimp_getScript(localeID+1, script, scriptCapacity, NULL); + return ulocimp_getScript(localeID+1, nullptr, *err).extract(script, scriptCapacity, *err); } - return u_terminateChars(script, scriptCapacity, i, err); + return u_terminateChars(script, scriptCapacity, 0, err); } U_CAPI int32_t U_EXPORT2 @@ -1855,31 +1759,36 @@ uloc_getCountry(const char* localeID, int32_t countryCapacity, UErrorCode* err) { - int32_t i=0; - - if(err==NULL || U_FAILURE(*err)) { + if(err==nullptr || U_FAILURE(*err)) { return 0; } - if(localeID==NULL) { + if(localeID==nullptr) { localeID=uloc_getDefault(); } /* Skip the language */ - ulocimp_getLanguage(localeID, NULL, 0, &localeID); + ulocimp_getLanguage(localeID, &localeID, *err); + if (U_FAILURE(*err)) { + return 0; + } + if(_isIDSeparator(*localeID)) { const char *scriptID; /* Skip the script if available */ - ulocimp_getScript(localeID+1, NULL, 0, &scriptID); + ulocimp_getScript(localeID+1, &scriptID, *err); + if (U_FAILURE(*err)) { + return 0; + } if(scriptID != localeID+1) { /* Found optional script */ localeID = scriptID; } if(_isIDSeparator(*localeID)) { - i=ulocimp_getCountry(localeID+1, country, countryCapacity, NULL); + return ulocimp_getCountry(localeID+1, nullptr, *err).extract(country, countryCapacity, *err); } } - return u_terminateChars(country, countryCapacity, i, err); + return u_terminateChars(country, countryCapacity, 0, err); } U_CAPI int32_t U_EXPORT2 @@ -1888,29 +1797,38 @@ uloc_getVariant(const char* localeID, int32_t variantCapacity, UErrorCode* err) { - char tempBuffer[ULOC_FULLNAME_CAPACITY]; + CharString tempBuffer; const char* tmpLocaleID; int32_t i=0; - if(err==NULL || U_FAILURE(*err)) { + if(err==nullptr || U_FAILURE(*err)) { return 0; } if (_hasBCP47Extension(localeID)) { - _ConvertBCP47(tmpLocaleID, localeID, tempBuffer, sizeof(tempBuffer), err); + CharStringByteSink sink(&tempBuffer); + ulocimp_forLanguageTag(localeID, -1, sink, nullptr, err); + tmpLocaleID = U_SUCCESS(*err) && !tempBuffer.isEmpty() ? tempBuffer.data() : localeID; } else { - if (localeID==NULL) { + if (localeID==nullptr) { localeID=uloc_getDefault(); } tmpLocaleID=localeID; } /* Skip the language */ - ulocimp_getLanguage(tmpLocaleID, NULL, 0, &tmpLocaleID); + ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *err); + if (U_FAILURE(*err)) { + return 0; + } + if(_isIDSeparator(*tmpLocaleID)) { const char *scriptID; /* Skip the script if available */ - ulocimp_getScript(tmpLocaleID+1, NULL, 0, &scriptID); + ulocimp_getScript(tmpLocaleID+1, &scriptID, *err); + if (U_FAILURE(*err)) { + return 0; + } if(scriptID != tmpLocaleID+1) { /* Found optional script */ tmpLocaleID = scriptID; @@ -1918,7 +1836,10 @@ uloc_getVariant(const char* localeID, /* Skip the Country */ if (_isIDSeparator(*tmpLocaleID)) { const char *cntryID; - ulocimp_getCountry(tmpLocaleID+1, NULL, 0, &cntryID); + ulocimp_getCountry(tmpLocaleID+1, &cntryID, *err); + if (U_FAILURE(*err)) { + return 0; + } if (cntryID != tmpLocaleID+1) { /* Found optional country */ tmpLocaleID = cntryID; @@ -1928,18 +1849,24 @@ uloc_getVariant(const char* localeID, if (tmpLocaleID != cntryID && _isIDSeparator(tmpLocaleID[1])) { tmpLocaleID++; } - i=_getVariant(tmpLocaleID+1, *tmpLocaleID, variant, variantCapacity); + + CheckedArrayByteSink sink(variant, variantCapacity); + _getVariant(tmpLocaleID+1, *tmpLocaleID, sink, false); + + i = sink.NumberOfBytesAppended(); + + if (U_FAILURE(*err)) { + return i; + } + + if (sink.Overflowed()) { + *err = U_BUFFER_OVERFLOW_ERROR; + return i; + } } } } - /* removed by weiv. We don't want to handle POSIX variants anymore. Use canonicalization function */ - /* if we do not have a variant tag yet then try a POSIX variant after '@' */ -/* - if(!haveVariant && (localeID=uprv_strrchr(localeID, '@'))!=NULL) { - i=_getVariant(localeID+1, '@', variant, variantCapacity); - } -*/ return u_terminateChars(variant, variantCapacity, i, err); } @@ -1949,7 +1876,34 @@ uloc_getName(const char* localeID, int32_t nameCapacity, UErrorCode* err) { - return _canonicalize(localeID, name, nameCapacity, 0, err); + if (U_FAILURE(*err)) { + return 0; + } + + CheckedArrayByteSink sink(name, nameCapacity); + ulocimp_getName(localeID, sink, err); + + int32_t reslen = sink.NumberOfBytesAppended(); + + if (U_FAILURE(*err)) { + return reslen; + } + + if (sink.Overflowed()) { + *err = U_BUFFER_OVERFLOW_ERROR; + } else { + u_terminateChars(name, nameCapacity, reslen, err); + } + + return reslen; +} + +U_CAPI void U_EXPORT2 +ulocimp_getName(const char* localeID, + ByteSink& sink, + UErrorCode* err) +{ + _canonicalize(localeID, sink, 0, err); } U_CAPI int32_t U_EXPORT2 @@ -1958,7 +1912,34 @@ uloc_getBaseName(const char* localeID, int32_t nameCapacity, UErrorCode* err) { - return _canonicalize(localeID, name, nameCapacity, _ULOC_STRIP_KEYWORDS, err); + if (U_FAILURE(*err)) { + return 0; + } + + CheckedArrayByteSink sink(name, nameCapacity); + ulocimp_getBaseName(localeID, sink, err); + + int32_t reslen = sink.NumberOfBytesAppended(); + + if (U_FAILURE(*err)) { + return reslen; + } + + if (sink.Overflowed()) { + *err = U_BUFFER_OVERFLOW_ERROR; + } else { + u_terminateChars(name, nameCapacity, reslen, err); + } + + return reslen; +} + +U_CAPI void U_EXPORT2 +ulocimp_getBaseName(const char* localeID, + ByteSink& sink, + UErrorCode* err) +{ + _canonicalize(localeID, sink, _ULOC_STRIP_KEYWORDS, err); } U_CAPI int32_t U_EXPORT2 @@ -1967,7 +1948,34 @@ uloc_canonicalize(const char* localeID, int32_t nameCapacity, UErrorCode* err) { - return _canonicalize(localeID, name, nameCapacity, _ULOC_CANONICALIZE, err); + if (U_FAILURE(*err)) { + return 0; + } + + CheckedArrayByteSink sink(name, nameCapacity); + ulocimp_canonicalize(localeID, sink, err); + + int32_t reslen = sink.NumberOfBytesAppended(); + + if (U_FAILURE(*err)) { + return reslen; + } + + if (sink.Overflowed()) { + *err = U_BUFFER_OVERFLOW_ERROR; + } else { + u_terminateChars(name, nameCapacity, reslen, err); + } + + return reslen; +} + +U_CAPI void U_EXPORT2 +ulocimp_canonicalize(const char* localeID, + ByteSink& sink, + UErrorCode* err) +{ + _canonicalize(localeID, sink, _ULOC_CANONICALIZE, err); } U_CAPI const char* U_EXPORT2 @@ -1977,7 +1985,7 @@ uloc_getISO3Language(const char* localeID) char lang[ULOC_LANG_CAPACITY]; UErrorCode err = U_ZERO_ERROR; - if (localeID == NULL) + if (localeID == nullptr) { localeID = uloc_getDefault(); } @@ -1997,7 +2005,7 @@ uloc_getISO3Country(const char* localeID) char cntry[ULOC_LANG_CAPACITY]; UErrorCode err = U_ZERO_ERROR; - if (localeID == NULL) + if (localeID == nullptr) { localeID = uloc_getDefault(); } @@ -2043,22 +2051,22 @@ uloc_getLCID(const char* localeID) // uprv_convertToLCID does not support keywords other than collation. // Remove all keywords except collation. int32_t len; - char collVal[ULOC_KEYWORDS_CAPACITY]; char tmpLocaleID[ULOC_FULLNAME_CAPACITY]; - len = uloc_getKeywordValue(localeID, "collation", collVal, - UPRV_LENGTHOF(collVal) - 1, &status); - - if (U_SUCCESS(status) && len > 0) { - collVal[len] = 0; + CharString collVal; + { + CharStringByteSink sink(&collVal); + ulocimp_getKeywordValue(localeID, "collation", sink, &status); + } + if (U_SUCCESS(status) && !collVal.isEmpty()) { len = uloc_getBaseName(localeID, tmpLocaleID, UPRV_LENGTHOF(tmpLocaleID) - 1, &status); if (U_SUCCESS(status) && len > 0) { tmpLocaleID[len] = 0; - len = uloc_setKeywordValue("collation", collVal, tmpLocaleID, + len = uloc_setKeywordValue("collation", collVal.data(), tmpLocaleID, UPRV_LENGTHOF(tmpLocaleID) - len - 1, &status); if (U_SUCCESS(status) && len > 0) { @@ -2126,308 +2134,11 @@ uloc_getISOCountries() return COUNTRIES; } - -/* this function to be moved into cstring.c later */ -static char gDecimal = 0; - -static /* U_CAPI */ -double -/* U_EXPORT2 */ -_uloc_strtod(const char *start, char **end) { - char *decimal; - char *myEnd; - char buf[30]; - double rv; - if (!gDecimal) { - char rep[5]; - /* For machines that decide to change the decimal on you, - and try to be too smart with localization. - This normally should be just a '.'. */ - int used_buffer = snprintf(rep, 5, "%+1.1f", 1.0); - (void)used_buffer; - U_ASSERT(used_buffer > 0); - gDecimal = rep[2]; - } - - if(gDecimal == '.') { - return uprv_strtod(start, end); /* fall through to OS */ - } else { - uprv_strncpy(buf, start, 29); - buf[29]=0; - decimal = uprv_strchr(buf, '.'); - if(decimal) { - *decimal = gDecimal; - } else { - return uprv_strtod(start, end); /* no decimal point */ - } - rv = uprv_strtod(buf, &myEnd); - if(end) { - *end = (char*)(start+(myEnd-buf)); /* cast away const (to follow uprv_strtod API.) */ - } - return rv; - } -} - -typedef struct { - float q; - int32_t dummy; /* to avoid uninitialized memory copy from qsort */ - char locale[ULOC_FULLNAME_CAPACITY+1]; -} _acceptLangItem; - -static int32_t U_CALLCONV -uloc_acceptLanguageCompare(const void * /*context*/, const void *a, const void *b) -{ - const _acceptLangItem *aa = (const _acceptLangItem*)a; - const _acceptLangItem *bb = (const _acceptLangItem*)b; - - int32_t rc = 0; - if(bb->q < aa->q) { - rc = -1; /* A > B */ - } else if(bb->q > aa->q) { - rc = 1; /* A < B */ - } else { - rc = 0; /* A = B */ - } - - if(rc==0) { - rc = uprv_stricmp(aa->locale, bb->locale); - } - -#if defined(ULOC_DEBUG) - /* fprintf(stderr, "a:[%s:%g], b:[%s:%g] -> %d\n", - aa->locale, aa->q, - bb->locale, bb->q, - rc);*/ -#endif - - return rc; -} - -/* -mt-mt, ja;q=0.76, en-us;q=0.95, en;q=0.92, en-gb;q=0.89, fr;q=0.87, iu-ca;q=0.84, iu;q=0.82, ja-jp;q=0.79, mt;q=0.97, de-de;q=0.74, de;q=0.71, es;q=0.68, it-it;q=0.66, it;q=0.63, vi-vn;q=0.61, vi;q=0.58, nl-nl;q=0.55, nl;q=0.53 -*/ - -U_CAPI int32_t U_EXPORT2 -uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult *outResult, - const char *httpAcceptLanguage, - UEnumeration* availableLocales, - UErrorCode *status) -{ - MaybeStackArray<_acceptLangItem, 4> items; // Struct for collecting items. - char tmp[ULOC_FULLNAME_CAPACITY +1]; - int32_t n = 0; - const char *itemEnd; - const char *paramEnd; - const char *s; - const char *t; - int32_t res; - int32_t i; - int32_t l = (int32_t)uprv_strlen(httpAcceptLanguage); - - if(U_FAILURE(*status)) { - return -1; - } - - for(s=httpAcceptLanguage;s&&*s;) { - while(duckdb::StringUtil::CharacterIsSpace(*s)) /* eat space at the beginning */ - s++; - itemEnd=uprv_strchr(s,','); - paramEnd=uprv_strchr(s,';'); - if(!itemEnd) { - itemEnd = httpAcceptLanguage+l; /* end of string */ - } - if(paramEnd && paramEnds)&&duckdb::StringUtil::CharacterIsSpace(*t);t--) - ; - int32_t slen = static_cast(((t+1)-s)); - if(slen > ULOC_FULLNAME_CAPACITY) { - *status = U_BUFFER_OVERFLOW_ERROR; - return -1; // too big - } - uprv_strncpy(items[n].locale, s, slen); - items[n].locale[slen]=0; // terminate - int32_t clen = uloc_canonicalize(items[n].locale, tmp, UPRV_LENGTHOF(tmp)-1, status); - if(U_FAILURE(*status)) return -1; - if((clen!=slen) || (uprv_strncmp(items[n].locale, tmp, slen))) { - // canonicalization had an effect- copy back - uprv_strncpy(items[n].locale, tmp, clen); - items[n].locale[clen] = 0; // terminate - } -#if defined(ULOC_DEBUG) - /*fprintf(stderr,"%d: s <%s> q <%g>\n", n, j[n].locale, j[n].q);*/ -#endif - n++; - s = itemEnd; - while(*s==',') { /* eat duplicate commas */ - s++; - } - if(n>=items.getCapacity()) { // If we need more items - if(NULL == items.resize(items.getCapacity()*2, items.getCapacity())) { - *status = U_MEMORY_ALLOCATION_ERROR; - return -1; - } -#if defined(ULOC_DEBUG) - fprintf(stderr,"malloced at size %d\n", items.getCapacity()); -#endif - } - } - uprv_sortArray(items.getAlias(), n, sizeof(items[0]), uloc_acceptLanguageCompare, NULL, TRUE, status); - if (U_FAILURE(*status)) { - return -1; - } - LocalMemory strs(NULL); - if (strs.allocateInsteadAndReset(n) == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return -1; - } - for(i=0;i q <%g>\n", i, j[i].locale, j[i].q);*/ -#endif - strs[i]=items[i].locale; - } - res = uloc_acceptLanguage(result, resultAvailable, outResult, - strs.getAlias(), n, availableLocales, status); - return res; -} - - -U_CAPI int32_t U_EXPORT2 -uloc_acceptLanguage(char *result, int32_t resultAvailable, - UAcceptResult *outResult, const char **acceptList, - int32_t acceptListCount, - UEnumeration* availableLocales, - UErrorCode *status) -{ - int32_t i,j; - int32_t len; - int32_t maxLen=0; - char tmp[ULOC_FULLNAME_CAPACITY+1]; - const char *l; - char **fallbackList; - if(U_FAILURE(*status)) { - return -1; - } - fallbackList = static_cast(uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount))); - if(fallbackList==NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return -1; - } - for(i=0;i0) { - uprv_strncpy(result, l, uprv_min(len, resultAvailable)); - } - for(j=0;jmaxLen) { - maxLen = len; - } - } - uenum_reset(availableLocales, status); - /* save off parent info */ - if(uloc_getParent(acceptList[i], tmp, UPRV_LENGTHOF(tmp), status)!=0) { - fallbackList[i] = uprv_strdup(tmp); - } else { - fallbackList[i]=0; - } - } - - for(maxLen--;maxLen>0;maxLen--) { - for(i=0;i0) { - uprv_strncpy(result, l, uprv_min(len, resultAvailable)); - } - for(j=0;j* gKeyTypeStringPool = NULL; -static icu::MemoryPool* gLocExtKeyDataEntries = NULL; -static icu::MemoryPool* gLocExtTypeEntries = NULL; +static icu::MemoryPool* gKeyTypeStringPool = nullptr; +static icu::MemoryPool* gLocExtKeyDataEntries = nullptr; +static icu::MemoryPool* gLocExtTypeEntries = nullptr; U_CDECL_BEGIN static UBool U_CALLCONV -uloc_key_type_cleanup(void) { - if (gLocExtKeyMap != NULL) { +uloc_key_type_cleanup() { + if (gLocExtKeyMap != nullptr) { uhash_close(gLocExtKeyMap); - gLocExtKeyMap = NULL; + gLocExtKeyMap = nullptr; } delete gLocExtKeyDataEntries; - gLocExtKeyDataEntries = NULL; + gLocExtKeyDataEntries = nullptr; delete gLocExtTypeEntries; - gLocExtTypeEntries = NULL; + gLocExtTypeEntries = nullptr; delete gKeyTypeStringPool; - gKeyTypeStringPool = NULL; + gKeyTypeStringPool = nullptr; gLocExtKeyMapInitOnce.reset(); - return TRUE; + return true; } U_CDECL_END @@ -80,34 +80,34 @@ initFromResourceBundle(UErrorCode& sts) { U_NAMESPACE_USE ucln_common_registerCleanup(UCLN_COMMON_LOCALE_KEY_TYPE, uloc_key_type_cleanup); - gLocExtKeyMap = uhash_open(uhash_hashIChars, uhash_compareIChars, NULL, &sts); + gLocExtKeyMap = uhash_open(uhash_hashIChars, uhash_compareIChars, nullptr, &sts); - LocalUResourceBundlePointer keyTypeDataRes(ures_openDirect(NULL, "keyTypeData", &sts)); - LocalUResourceBundlePointer keyMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "keyMap", NULL, &sts)); - LocalUResourceBundlePointer typeMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeMap", NULL, &sts)); + LocalUResourceBundlePointer keyTypeDataRes(ures_openDirect(nullptr, "keyTypeData", &sts)); + LocalUResourceBundlePointer keyMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "keyMap", nullptr, &sts)); + LocalUResourceBundlePointer typeMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeMap", nullptr, &sts)); if (U_FAILURE(sts)) { return; } UErrorCode tmpSts = U_ZERO_ERROR; - LocalUResourceBundlePointer typeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeAlias", NULL, &tmpSts)); + LocalUResourceBundlePointer typeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeAlias", nullptr, &tmpSts)); tmpSts = U_ZERO_ERROR; - LocalUResourceBundlePointer bcpTypeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "bcpTypeAlias", NULL, &tmpSts)); + LocalUResourceBundlePointer bcpTypeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "bcpTypeAlias", nullptr, &tmpSts)); // initialize pools storing dynamically allocated objects gKeyTypeStringPool = new icu::MemoryPool; - if (gKeyTypeStringPool == NULL) { + if (gKeyTypeStringPool == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; return; } gLocExtKeyDataEntries = new icu::MemoryPool; - if (gLocExtKeyDataEntries == NULL) { + if (gLocExtKeyDataEntries == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; return; } gLocExtTypeEntries = new icu::MemoryPool; - if (gLocExtTypeEntries == NULL) { + if (gLocExtTypeEntries == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; return; } @@ -130,7 +130,7 @@ initFromResourceBundle(UErrorCode& sts) { const char* bcpKeyId = legacyKeyId; if (!uBcpKeyId.isEmpty()) { icu::CharString* bcpKeyIdBuf = gKeyTypeStringPool->create(); - if (bcpKeyIdBuf == NULL) { + if (bcpKeyIdBuf == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; break; } @@ -143,7 +143,7 @@ initFromResourceBundle(UErrorCode& sts) { UBool isTZ = uprv_strcmp(legacyKeyId, "timezone") == 0; - UHashtable* typeDataMap = uhash_open(uhash_hashIChars, uhash_compareIChars, NULL, &sts); + UHashtable* typeDataMap = uhash_open(uhash_hashIChars, uhash_compareIChars, nullptr, &sts); if (U_FAILURE(sts)) { break; } @@ -154,25 +154,27 @@ initFromResourceBundle(UErrorCode& sts) { if (typeAliasRes.isValid()) { tmpSts = U_ZERO_ERROR; - typeAliasResByKey.adoptInstead(ures_getByKey(typeAliasRes.getAlias(), legacyKeyId, NULL, &tmpSts)); + typeAliasResByKey.adoptInstead(ures_getByKey(typeAliasRes.getAlias(), legacyKeyId, nullptr, &tmpSts)); if (U_FAILURE(tmpSts)) { typeAliasResByKey.orphan(); } } if (bcpTypeAliasRes.isValid()) { tmpSts = U_ZERO_ERROR; - bcpTypeAliasResByKey.adoptInstead(ures_getByKey(bcpTypeAliasRes.getAlias(), bcpKeyId, NULL, &tmpSts)); + bcpTypeAliasResByKey.adoptInstead(ures_getByKey(bcpTypeAliasRes.getAlias(), bcpKeyId, nullptr, &tmpSts)); if (U_FAILURE(tmpSts)) { bcpTypeAliasResByKey.orphan(); } } // look up type map for the key, and walk through the mapping data - tmpSts = U_ZERO_ERROR; - LocalUResourceBundlePointer typeMapResByKey(ures_getByKey(typeMapRes.getAlias(), legacyKeyId, NULL, &tmpSts)); - if (U_FAILURE(tmpSts)) { - // type map for each key must exist - UPRV_UNREACHABLE; + LocalUResourceBundlePointer typeMapResByKey(ures_getByKey(typeMapRes.getAlias(), legacyKeyId, nullptr, &sts)); + if (U_FAILURE(sts)) { + // We fail here if typeMap does not have an entry corresponding to every entry in keyMap (should + // not happen for valid keyTypeData), or if ures_getByKeyfails fails for some other reason + // (e.g. data file cannot be loaded, using stubdata, over-aggressive data filtering has removed + // something like timezoneTypes.res, etc.). Error code is already set. See ICU-21669. + UPRV_UNREACHABLE_ASSERT; } else { LocalUResourceBundlePointer typeMapEntry; @@ -200,10 +202,10 @@ initFromResourceBundle(UErrorCode& sts) { if (isTZ) { // a timezone key uses a colon instead of a slash in the resource. // e.g. America:Los_Angeles - if (uprv_strchr(legacyTypeId, ':') != NULL) { + if (uprv_strchr(legacyTypeId, ':') != nullptr) { icu::CharString* legacyTypeIdBuf = gKeyTypeStringPool->create(legacyTypeId, sts); - if (legacyTypeIdBuf == NULL) { + if (legacyTypeIdBuf == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; break; } @@ -227,7 +229,7 @@ initFromResourceBundle(UErrorCode& sts) { const char* bcpTypeId = legacyTypeId; if (!uBcpTypeId.isEmpty()) { icu::CharString* bcpTypeIdBuf = gKeyTypeStringPool->create(); - if (bcpTypeIdBuf == NULL) { + if (bcpTypeIdBuf == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; break; } @@ -243,7 +245,7 @@ initFromResourceBundle(UErrorCode& sts) { // type under the same key. So we use a single // map for lookup. LocExtType* t = gLocExtTypeEntries->create(); - if (t == NULL) { + if (t == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; break; } @@ -267,19 +269,19 @@ initFromResourceBundle(UErrorCode& sts) { while (ures_hasNext(typeAliasResByKey.getAlias()) && U_SUCCESS(sts)) { int32_t toLen; typeAliasDataEntry.adoptInstead(ures_getNextResource(typeAliasResByKey.getAlias(), typeAliasDataEntry.orphan(), &sts)); - const UChar* to = ures_getString(typeAliasDataEntry.getAlias(), &toLen, &sts); + const char16_t* to = ures_getString(typeAliasDataEntry.getAlias(), &toLen, &sts); if (U_FAILURE(sts)) { break; } - // check if this is an alias of canoncal legacy type - if (uprv_compareInvWithUChar(NULL, legacyTypeId, -1, to, toLen) == 0) { + // check if this is an alias of canonical legacy type + if (uprv_compareInvWithUChar(nullptr, legacyTypeId, -1, to, toLen) == 0) { const char* from = ures_getKey(typeAliasDataEntry.getAlias()); if (isTZ) { // replace colon with slash if necessary - if (uprv_strchr(from, ':') != NULL) { + if (uprv_strchr(from, ':') != nullptr) { icu::CharString* fromBuf = gKeyTypeStringPool->create(from, sts); - if (fromBuf == NULL) { + if (fromBuf == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; break; } @@ -308,12 +310,12 @@ initFromResourceBundle(UErrorCode& sts) { while (ures_hasNext(bcpTypeAliasResByKey.getAlias()) && U_SUCCESS(sts)) { int32_t toLen; bcpTypeAliasDataEntry.adoptInstead(ures_getNextResource(bcpTypeAliasResByKey.getAlias(), bcpTypeAliasDataEntry.orphan(), &sts)); - const UChar* to = ures_getString(bcpTypeAliasDataEntry.getAlias(), &toLen, &sts); + const char16_t* to = ures_getString(bcpTypeAliasDataEntry.getAlias(), &toLen, &sts); if (U_FAILURE(sts)) { break; } // check if this is an alias of bcp type - if (uprv_compareInvWithUChar(NULL, bcpTypeId, -1, to, toLen) == 0) { + if (uprv_compareInvWithUChar(nullptr, bcpTypeId, -1, to, toLen) == 0) { const char* from = ures_getKey(bcpTypeAliasDataEntry.getAlias()); uhash_put(typeDataMap, (void*)from, t, &sts); } @@ -329,7 +331,7 @@ initFromResourceBundle(UErrorCode& sts) { } LocExtKeyData* keyData = gLocExtKeyDataEntries->create(); - if (keyData == NULL) { + if (keyData == nullptr) { sts = U_MEMORY_ALLOCATION_ERROR; break; } @@ -354,9 +356,9 @@ init() { UErrorCode sts = U_ZERO_ERROR; umtx_initOnce(gLocExtKeyMapInitOnce, &initFromResourceBundle, sts); if (U_FAILURE(sts)) { - return FALSE; + return false; } - return TRUE; + return true; } static UBool @@ -366,7 +368,7 @@ isSpecialTypeCodepoints(const char* val) { while (*p) { if (*p == '-') { if (subtagLen < 4 || subtagLen > 6) { - return FALSE; + return false; } subtagLen = 0; } else if ((*p >= '0' && *p <= '9') || @@ -374,7 +376,7 @@ isSpecialTypeCodepoints(const char* val) { (*p >= 'a' && *p <= 'f')) { // also in EBCDIC subtagLen++; } else { - return FALSE; + return false; } p++; } @@ -388,13 +390,13 @@ isSpecialTypeReorderCode(const char* val) { while (*p) { if (*p == '-') { if (subtagLen < 3 || subtagLen > 8) { - return FALSE; + return false; } subtagLen = 0; } else if (uprv_isASCIILetter(*p)) { subtagLen++; } else { - return FALSE; + return false; } p++; } @@ -410,7 +412,7 @@ isSpecialTypeRgKeyValue(const char* val) { (subtagLen >= 2 && (*p == 'Z' || *p == 'z')) ) { subtagLen++; } else { - return FALSE; + return false; } p++; } @@ -420,53 +422,53 @@ isSpecialTypeRgKeyValue(const char* val) { U_CFUNC const char* ulocimp_toBcpKey(const char* key) { if (!init()) { - return NULL; + return nullptr; } LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key); - if (keyData != NULL) { + if (keyData != nullptr) { return keyData->bcpId; } - return NULL; + return nullptr; } U_CFUNC const char* ulocimp_toLegacyKey(const char* key) { if (!init()) { - return NULL; + return nullptr; } LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key); - if (keyData != NULL) { + if (keyData != nullptr) { return keyData->legacyId; } - return NULL; + return nullptr; } U_CFUNC const char* ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType) { - if (isKnownKey != NULL) { - *isKnownKey = FALSE; + if (isKnownKey != nullptr) { + *isKnownKey = false; } - if (isSpecialType != NULL) { - *isSpecialType = FALSE; + if (isSpecialType != nullptr) { + *isSpecialType = false; } if (!init()) { - return NULL; + return nullptr; } LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key); - if (keyData != NULL) { - if (isKnownKey != NULL) { - *isKnownKey = TRUE; + if (keyData != nullptr) { + if (isKnownKey != nullptr) { + *isKnownKey = true; } LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type); - if (t != NULL) { + if (t != nullptr) { return t->bcpId; } if (keyData->specialTypes != SPECIALTYPE_NONE) { - UBool matched = FALSE; + UBool matched = false; if (keyData->specialTypes & SPECIALTYPE_CODEPOINTS) { matched = isSpecialTypeCodepoints(type); } @@ -477,41 +479,41 @@ ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* i matched = isSpecialTypeRgKeyValue(type); } if (matched) { - if (isSpecialType != NULL) { - *isSpecialType = TRUE; + if (isSpecialType != nullptr) { + *isSpecialType = true; } return type; } } } - return NULL; + return nullptr; } U_CFUNC const char* ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType) { - if (isKnownKey != NULL) { - *isKnownKey = FALSE; + if (isKnownKey != nullptr) { + *isKnownKey = false; } - if (isSpecialType != NULL) { - *isSpecialType = FALSE; + if (isSpecialType != nullptr) { + *isSpecialType = false; } if (!init()) { - return NULL; + return nullptr; } LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key); - if (keyData != NULL) { - if (isKnownKey != NULL) { - *isKnownKey = TRUE; + if (keyData != nullptr) { + if (isKnownKey != nullptr) { + *isKnownKey = true; } LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type); - if (t != NULL) { + if (t != nullptr) { return t->legacyId; } if (keyData->specialTypes != SPECIALTYPE_NONE) { - UBool matched = FALSE; + UBool matched = false; if (keyData->specialTypes & SPECIALTYPE_CODEPOINTS) { matched = isSpecialTypeCodepoints(type); } @@ -522,13 +524,13 @@ ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool matched = isSpecialTypeRgKeyValue(type); } if (matched) { - if (isSpecialType != NULL) { - *isSpecialType = TRUE; + if (isSpecialType != nullptr) { + *isSpecialType = true; } return type; } } } - return NULL; + return nullptr; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uloc_tag.cpp b/src/duckdb/extension/icu/third_party/icu/common/uloc_tag.cpp index 8f673541a..fe3261c75 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uloc_tag.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uloc_tag.cpp @@ -15,6 +15,7 @@ #include "unicode/uenum.h" #include "unicode/uloc.h" #include "ustr_imp.h" +#include "bytesinkutil.h" #include "charstr.h" #include "cmemory.h" #include "cstring.h" @@ -53,7 +54,7 @@ typedef struct ULanguageTag { VariantListEntry *variants; ExtensionListEntry *extensions; const char *privateuse; - const char *grandfathered; + const char *legacy; } ULanguageTag; #define MINLEN 2 @@ -85,8 +86,9 @@ static const char LOCALE_TYPE_YES[] = "yes"; Updated on 2018-09-12 from https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry . - This table has 2 parts. The parts for Grandfathered tags is generated by the - following scripts from the IANA language tag registry. + This table has 2 parts. The part for + legacy language tags (marked as “Type: grandfathered” in BCP 47) + is generated by the following scripts from the IANA language tag registry. curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\ egrep -A 7 'Type: grandfathered' | \ @@ -100,8 +102,8 @@ static const char LOCALE_TYPE_YES[] = "yes"; values. They may have to be removed for the strict BCP 47 compliance. */ -static const char* const GRANDFATHERED[] = { -/* grandfathered preferred */ +static const char* const LEGACY[] = { +/* legacy preferred */ "art-lojban", "jbo", "en-gb-oed", "en-gb-oxendict", "i-ami", "ami", @@ -124,10 +126,9 @@ static const char* const GRANDFATHERED[] = { "zh-min-nan", "nan", "zh-xiang", "hsn", - // Grandfathered tags with no preferred value in the IANA + // Legacy tags with no preferred value in the IANA // registry. Kept for now for the backward compatibility // because ICU has mapped them this way. - "cel-gaulish", "xtg-x-cel-gaulish", "i-default", "en-x-i-default", "i-enochian", "und-x-i-enochian", "i-mingo", "see-x-i-mingo", @@ -138,7 +139,7 @@ static const char* const GRANDFATHERED[] = { Updated on 2018-09-12 from https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry . - The table lists redundant tags with preferred value in the IANA languate tag registry. + The table lists redundant tags with preferred value in the IANA language tag registry. It's generated with the following command: curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\ @@ -346,7 +347,7 @@ ultag_getPrivateUse(const ULanguageTag* langtag); #if 0 static const char* -ultag_getGrandfathered(const ULanguageTag* langtag); +ultag_getLegacy(const ULanguageTag* langtag); #endif U_NAMESPACE_BEGIN @@ -377,10 +378,10 @@ _isAlphaString(const char* s, int32_t len) { int32_t i; for (i = 0; i < len; i++) { if (!ISALPHA(*(s + i))) { - return FALSE; + return false; } } - return TRUE; + return true; } static UBool @@ -388,10 +389,10 @@ _isNumericString(const char* s, int32_t len) { int32_t i; for (i = 0; i < len; i++) { if (!ISNUMERIC(*(s + i))) { - return FALSE; + return false; } } - return TRUE; + return true; } static UBool @@ -399,10 +400,10 @@ _isAlphaNumericString(const char* s, int32_t len) { int32_t i; for (i = 0; i < len; i++) { if (!ISALPHA(*(s + i)) && !ISNUMERIC(*(s + i))) { - return FALSE; + return false; } } - return TRUE; + return true; } static UBool @@ -411,9 +412,9 @@ _isAlphaNumericStringLimitedLength(const char* s, int32_t len, int32_t min, int3 len = (int32_t)uprv_strlen(s); } if (len >= min && len <= max && _isAlphaNumericString(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; } U_CFUNC UBool @@ -427,9 +428,9 @@ ultag_isLanguageSubtag(const char* s, int32_t len) { len = (int32_t)uprv_strlen(s); } if (len >= 2 && len <= 8 && _isAlphaString(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; } static UBool @@ -442,9 +443,9 @@ _isExtlangSubtag(const char* s, int32_t len) { len = (int32_t)uprv_strlen(s); } if (len == 3 && _isAlphaString(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; } U_CFUNC UBool @@ -456,9 +457,9 @@ ultag_isScriptSubtag(const char* s, int32_t len) { len = (int32_t)uprv_strlen(s); } if (len == 4 && _isAlphaString(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; } U_CFUNC UBool @@ -471,12 +472,12 @@ ultag_isRegionSubtag(const char* s, int32_t len) { len = (int32_t)uprv_strlen(s); } if (len == 2 && _isAlphaString(s, len)) { - return TRUE; + return true; } if (len == 3 && _isNumericString(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; } static UBool @@ -489,18 +490,18 @@ _isVariantSubtag(const char* s, int32_t len) { len = (int32_t)uprv_strlen(s); } if (_isAlphaNumericStringLimitedLength(s, len, 5, 8)) { - return TRUE; + return true; } if (len == 4 && ISNUMERIC(*s) && _isAlphaNumericString(s + 1, 3)) { - return TRUE; + return true; } - return FALSE; + return false; } static UBool _isSepListOf(UBool (*test)(const char*, int32_t), const char* s, int32_t len) { const char *p = s; - const char *pSubtag = NULL; + const char *pSubtag = nullptr; if (len < 0) { len = (int32_t)uprv_strlen(s); @@ -508,20 +509,20 @@ _isSepListOf(UBool (*test)(const char*, int32_t), const char* s, int32_t len) { while ((p - s) < len) { if (*p == SEP) { - if (pSubtag == NULL) { - return FALSE; + if (pSubtag == nullptr) { + return false; } if (!test(pSubtag, (int32_t)(p - pSubtag))) { - return FALSE; + return false; } - pSubtag = NULL; - } else if (pSubtag == NULL) { + pSubtag = nullptr; + } else if (pSubtag == nullptr) { pSubtag = p; } p++; } - if (pSubtag == NULL) { - return FALSE; + if (pSubtag == nullptr) { + return false; } return test(pSubtag, (int32_t)(p - pSubtag)); } @@ -556,9 +557,9 @@ _isExtensionSingleton(const char* s, int32_t len) { len = (int32_t)uprv_strlen(s); } if (len == 1 && (ISALPHA(*s) || ISNUMERIC(*s)) && (uprv_tolower(*s) != PRIVATEUSE)) { - return TRUE; + return true; } - return FALSE; + return false; } static UBool @@ -609,9 +610,9 @@ ultag_isUnicodeLocaleKey(const char* s, int32_t len) { len = (int32_t)uprv_strlen(s); } if (len == 2 && (ISALPHA(*s) || ISNUMERIC(*s)) && ISALPHA(s[1])) { - return TRUE; + return true; } - return FALSE; + return false; } U_CFUNC UBool @@ -640,9 +641,25 @@ _isTKey(const char* s, int32_t len) len = (int32_t)uprv_strlen(s); } if (len == 2 && ISALPHA(*s) && ISNUMERIC(*(s + 1))) { - return TRUE; + return true; } - return FALSE; + return false; +} + +U_CAPI const char * U_EXPORT2 +ultag_getTKeyStart(const char *localeID) { + const char *result = localeID; + const char *sep; + while((sep = uprv_strchr(result, SEP)) != nullptr) { + if (_isTKey(result, static_cast(sep - result))) { + return result; + } + result = ++sep; + } + if (_isTKey(result, -1)) { + return result; + } + return nullptr; } static UBool @@ -669,27 +686,31 @@ _isTransformedExtensionSubtag(int32_t& state, const char* s, int32_t len) const int32_t kGotTKey = -1; // Got tkey, wait for tvalue. ERROR if stop here. const int32_t kGotTValue = 6; // Got tvalue, wait for tkey, tvalue or end + + if (len < 0) { + len = (int32_t)uprv_strlen(s); + } switch (state) { case kStart: - if (ultag_isLanguageSubtag(s, len)) { + if (ultag_isLanguageSubtag(s, len) && len != 4) { state = kGotLanguage; - return TRUE; + return true; } if (_isTKey(s, len)) { state = kGotTKey; - return TRUE; + return true; } - return FALSE; + return false; case kGotLanguage: if (ultag_isScriptSubtag(s, len)) { state = kGotScript; - return TRUE; + return true; } U_FALLTHROUGH; case kGotScript: if (ultag_isRegionSubtag(s, len)) { state = kGotRegion; - return TRUE; + return true; } U_FALLTHROUGH; case kGotRegion: @@ -697,30 +718,30 @@ _isTransformedExtensionSubtag(int32_t& state, const char* s, int32_t len) case kGotVariant: if (_isVariantSubtag(s, len)) { state = kGotVariant; - return TRUE; + return true; } if (_isTKey(s, len)) { state = kGotTKey; - return TRUE; + return true; } - return FALSE; + return false; case kGotTKey: if (_isTValue(s, len)) { state = kGotTValue; - return TRUE; + return true; } - return FALSE; + return false; case kGotTValue: if (_isTKey(s, len)) { state = kGotTKey; - return TRUE; + return true; } if (_isTValue(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; } - return FALSE; + return false; } static UBool @@ -734,32 +755,32 @@ _isUnicodeExtensionSubtag(int32_t& state, const char* s, int32_t len) case kStart: if (ultag_isUnicodeLocaleKey(s, len)) { state = kGotKey; - return TRUE; + return true; } if (ultag_isUnicodeLocaleAttribute(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; case kGotKey: if (ultag_isUnicodeLocaleKey(s, len)) { - return TRUE; + return true; } if (_isUnicodeLocaleTypeSubtag(s, len)) { state = kGotType; - return TRUE; + return true; } - return FALSE; + return false; case kGotType: if (ultag_isUnicodeLocaleKey(s, len)) { state = kGotKey; - return TRUE; + return true; } if (_isUnicodeLocaleTypeSubtag(s, len)) { - return TRUE; + return true; } - return FALSE; + return false; } - return FALSE; + return false; } static UBool @@ -777,7 +798,7 @@ _isStatefulSepListOf(UBool (*test)(int32_t&, const char*, int32_t), const char* for (p = s; len > 0; p++, len--) { if (*p == SEP) { if (!test(state, start, subtagLen)) { - return FALSE; + return false; } subtagLen = 0; start = p + 1; @@ -787,9 +808,9 @@ _isStatefulSepListOf(UBool (*test)(int32_t&, const char*, int32_t), const char* } if (test(state, start, subtagLen) && state >= 0) { - return TRUE; + return true; } - return FALSE; + return false; } U_CFUNC UBool @@ -814,22 +835,22 @@ ultag_isUnicodeExtensionSubtags(const char* s, int32_t len) { static UBool _addVariantToList(VariantListEntry **first, VariantListEntry *var) { - UBool bAdded = TRUE; + UBool bAdded = true; - if (*first == NULL) { - var->next = NULL; + if (*first == nullptr) { + var->next = nullptr; *first = var; } else { VariantListEntry *prev, *cur; int32_t cmp; /* variants order should be preserved */ - prev = NULL; + prev = nullptr; cur = *first; - while (TRUE) { - if (cur == NULL) { + while (true) { + if (cur == nullptr) { prev->next = var; - var->next = NULL; + var->next = nullptr; break; } @@ -837,7 +858,7 @@ _addVariantToList(VariantListEntry **first, VariantListEntry *var) { cmp = uprv_compareInvCharsAsAscii(var->variant, cur->variant); if (cmp == 0) { /* duplicated variant */ - bAdded = FALSE; + bAdded = false; break; } prev = cur; @@ -850,27 +871,27 @@ _addVariantToList(VariantListEntry **first, VariantListEntry *var) { static UBool _addAttributeToList(AttributeListEntry **first, AttributeListEntry *attr) { - UBool bAdded = TRUE; + UBool bAdded = true; - if (*first == NULL) { - attr->next = NULL; + if (*first == nullptr) { + attr->next = nullptr; *first = attr; } else { AttributeListEntry *prev, *cur; int32_t cmp; /* reorder variants in alphabetical order */ - prev = NULL; + prev = nullptr; cur = *first; - while (TRUE) { - if (cur == NULL) { + while (true) { + if (cur == nullptr) { prev->next = attr; - attr->next = NULL; + attr->next = nullptr; break; } cmp = uprv_compareInvCharsAsAscii(attr->attribute, cur->attribute); if (cmp < 0) { - if (prev == NULL) { + if (prev == nullptr) { *first = attr; } else { prev->next = attr; @@ -880,7 +901,7 @@ _addAttributeToList(AttributeListEntry **first, AttributeListEntry *attr) { } if (cmp == 0) { /* duplicated variant */ - bAdded = FALSE; + bAdded = false; break; } prev = cur; @@ -894,22 +915,22 @@ _addAttributeToList(AttributeListEntry **first, AttributeListEntry *attr) { static UBool _addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool localeToBCP) { - UBool bAdded = TRUE; + UBool bAdded = true; - if (*first == NULL) { - ext->next = NULL; + if (*first == nullptr) { + ext->next = nullptr; *first = ext; } else { ExtensionListEntry *prev, *cur; int32_t cmp; /* reorder variants in alphabetical order */ - prev = NULL; + prev = nullptr; cur = *first; - while (TRUE) { - if (cur == NULL) { + while (true) { + if (cur == nullptr) { prev->next = ext; - ext->next = NULL; + ext->next = nullptr; break; } if (localeToBCP) { @@ -930,7 +951,7 @@ _addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool l cmp = *(ext->key) - *(cur->key); } } else if (len == 1) { - cmp = *(ext->key) - LDMLEXT; + cmp = *(ext->key) - LDMLEXT; } else if (curlen == 1) { cmp = LDMLEXT - *(cur->key); } else { @@ -948,7 +969,7 @@ _addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool l cmp = uprv_compareInvCharsAsAscii(ext->key, cur->key); } if (cmp < 0) { - if (prev == NULL) { + if (prev == nullptr) { *first = ext; } else { prev->next = ext; @@ -958,7 +979,7 @@ _addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool l } if (cmp == 0) { /* duplicated extension key */ - bAdded = FALSE; + bAdded = false; break; } prev = cur; @@ -973,20 +994,20 @@ static void _initializeULanguageTag(ULanguageTag* langtag) { int32_t i; - langtag->buf = NULL; + langtag->buf = nullptr; langtag->language = EMPTY; for (i = 0; i < MAXEXTLANG; i++) { - langtag->extlang[i] = NULL; + langtag->extlang[i] = nullptr; } langtag->script = EMPTY; langtag->region = EMPTY; - langtag->variants = NULL; - langtag->extensions = NULL; + langtag->variants = nullptr; + langtag->extensions = nullptr; - langtag->grandfathered = EMPTY; + langtag->legacy = EMPTY; langtag->privateuse = EMPTY; } @@ -1110,6 +1131,19 @@ _appendRegionToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool stri } } +static void _sortVariants(VariantListEntry* first) { + for (VariantListEntry* var1 = first; var1 != nullptr; var1 = var1->next) { + for (VariantListEntry* var2 = var1->next; var2 != nullptr; var2 = var2->next) { + // Swap var1->variant and var2->variant. + if (uprv_compareInvCharsAsAscii(var1->variant, var2->variant) > 0) { + const char* temp = var1->variant; + var1->variant = var2->variant; + var2->variant = temp; + } + } + } +} + static void _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool *hadPosix, UErrorCode* status) { char buf[ULOC_FULLNAME_CAPACITY]; @@ -1130,20 +1164,20 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st if (len > 0) { char *p, *pVar; - UBool bNext = TRUE; + UBool bNext = true; VariantListEntry *var; - VariantListEntry *varFirst = NULL; + VariantListEntry *varFirst = nullptr; - pVar = NULL; + pVar = nullptr; p = buf; while (bNext) { if (*p == SEP || *p == LOCALE_SEP || *p == 0) { if (*p == 0) { - bNext = FALSE; + bNext = false; } else { *p = 0; /* terminate */ } - if (pVar == NULL) { + if (pVar == nullptr) { if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; break; @@ -1161,7 +1195,7 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st if (uprv_strcmp(pVar,POSIX_VALUE) || len != (int32_t)uprv_strlen(POSIX_VALUE)) { /* emit the variant to the list */ var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry)); - if (var == NULL) { + if (var == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } @@ -1177,7 +1211,7 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st } else { /* Special handling for POSIX variant, need to remember that we had it and then */ /* treat it like an extension later. */ - *hadPosix = TRUE; + *hadPosix = true; } } else if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; @@ -1188,20 +1222,23 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st } } /* reset variant starting position */ - pVar = NULL; - } else if (pVar == NULL) { + pVar = nullptr; + } else if (pVar == nullptr) { pVar = p; } p++; } if (U_SUCCESS(*status)) { - if (varFirst != NULL) { + if (varFirst != nullptr) { int32_t varLen; + /* per UTS35, we should sort the variants */ + _sortVariants(varFirst); + /* write out validated/normalized variants to the target */ var = varFirst; - while (var != NULL) { + while (var != nullptr) { sink.Append("-", 1); varLen = (int32_t)uprv_strlen(var->variant); sink.Append(var->variant, varLen); @@ -1212,7 +1249,7 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st /* clean up */ var = varFirst; - while (var != NULL) { + while (var != nullptr) { VariantListEntry *tmpVar = var->next; uprv_free(var); var = tmpVar; @@ -1241,9 +1278,9 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st /* reorder extensions */ int32_t len; const char *key; - ExtensionListEntry *firstExt = NULL; + ExtensionListEntry *firstExt = nullptr; ExtensionListEntry *ext; - AttributeListEntry *firstAttr = NULL; + AttributeListEntry *firstAttr = nullptr; AttributeListEntry *attr; icu::MemoryPool extBufPool; const char *bcpKey=nullptr, *bcpValue=nullptr; @@ -1251,36 +1288,18 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st int32_t keylen; UBool isBcpUExt; - while (TRUE) { - icu::CharString buf; - key = uenum_next(keywordEnum.getAlias(), NULL, status); - if (key == NULL) { + while (true) { + key = uenum_next(keywordEnum.getAlias(), nullptr, status); + if (key == nullptr) { break; } - char* buffer; - int32_t resultCapacity = ULOC_KEYWORD_AND_VALUES_CAPACITY; - - for (;;) { - buffer = buf.getAppendBuffer( - /*minCapacity=*/resultCapacity, - /*desiredCapacityHint=*/resultCapacity, - resultCapacity, - tmpStatus); - - if (U_FAILURE(tmpStatus)) { - break; - } - - len = uloc_getKeywordValue( - localeID, key, buffer, resultCapacity, &tmpStatus); - - if (tmpStatus != U_BUFFER_OVERFLOW_ERROR) { - break; - } - resultCapacity = len; - tmpStatus = U_ZERO_ERROR; + icu::CharString buf; + { + icu::CharStringByteSink sink(&buf); + ulocimp_getKeywordValue(localeID, key, sink, &tmpStatus); } + len = buf.length(); if (U_FAILURE(tmpStatus)) { if (tmpStatus == U_MEMORY_ALLOCATION_ERROR) { @@ -1296,11 +1315,6 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st continue; } - buf.append(buffer, len, tmpStatus); - if (tmpStatus == U_STRING_NOT_TERMINATED_WARNING) { - tmpStatus = U_ZERO_ERROR; // Terminators provided by CharString. - } - keylen = (int32_t)uprv_strlen(key); isBcpUExt = (keylen > 1); @@ -1308,18 +1322,27 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st if (uprv_strcmp(key, LOCALE_ATTRIBUTE_KEY) == 0) { if (len > 0) { int32_t i = 0; - while (TRUE) { + while (true) { attrBufLength = 0; for (; i < len; i++) { if (buf[i] != '-') { - attrBuf[attrBufLength++] = buf[i]; + if (static_cast(attrBufLength) < sizeof(attrBuf)) { + attrBuf[attrBufLength++] = buf[i]; + } else { + *status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } } else { i++; break; } } if (attrBufLength > 0) { - attrBuf[attrBufLength] = 0; + if (static_cast(attrBufLength) < sizeof(attrBuf)) { + attrBuf[attrBufLength] = 0; + } else { + *status = U_STRING_NOT_TERMINATED_WARNING; + } } else if (i >= len){ break; @@ -1327,13 +1350,13 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st /* create AttributeListEntry */ attr = attrPool.create(); - if (attr == NULL) { + if (attr == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } icu::CharString* attrValue = strPool.create(attrBuf, attrBufLength, *status); - if (attrValue == NULL) { + if (attrValue == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } @@ -1351,11 +1374,11 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st } /* for a place holder ExtensionListEntry */ bcpKey = LOCALE_ATTRIBUTE_KEY; - bcpValue = NULL; + bcpValue = nullptr; } } else if (isBcpUExt) { bcpKey = uloc_toUnicodeLocaleKey(key); - if (bcpKey == NULL) { + if (bcpKey == nullptr) { if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; break; @@ -1365,7 +1388,7 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st /* we've checked buf is null-terminated above */ bcpValue = uloc_toUnicodeLocaleType(key, buf.data()); - if (bcpValue == NULL) { + if (bcpValue == nullptr) { if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; break; @@ -1379,32 +1402,18 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st no known mapping. This implementation normalizes the value to lower case */ - icu::CharString* extBuf = extBufPool.create(); + icu::CharString* extBuf = extBufPool.create(buf, tmpStatus); + if (extBuf == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } - int32_t bcpValueLen = static_cast(uprv_strlen(bcpValue)); - int32_t resultCapacity; - char* pExtBuf = extBuf->getAppendBuffer( - /*minCapacity=*/bcpValueLen, - /*desiredCapacityHint=*/bcpValueLen, - resultCapacity, - tmpStatus); - if (U_FAILURE(tmpStatus)) { - *status = tmpStatus; - break; - } - - uprv_strcpy(pExtBuf, bcpValue); - T_CString_toLowerCase(pExtBuf); - - extBuf->append(pExtBuf, bcpValueLen, tmpStatus); if (U_FAILURE(tmpStatus)) { *status = tmpStatus; break; } + T_CString_toLowerCase(extBuf->data()); bcpValue = extBuf->data(); } } else { @@ -1441,14 +1450,14 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st /* create ExtensionListEntry */ ext = extPool.create(); - if (ext == NULL) { + if (ext == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } ext->key = bcpKey; ext->value = bcpValue; - if (!_addExtensionToList(&firstExt, ext, TRUE)) { + if (!_addExtensionToList(&firstExt, ext, true)) { if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; break; @@ -1460,25 +1469,25 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st if (hadPosix) { /* create ExtensionListEntry for POSIX */ ext = extPool.create(); - if (ext == NULL) { + if (ext == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } ext->key = POSIX_KEY; ext->value = POSIX_VALUE; - if (!_addExtensionToList(&firstExt, ext, TRUE)) { + if (!_addExtensionToList(&firstExt, ext, true)) { // Silently ignore errors. } } - if (U_SUCCESS(*status) && (firstExt != NULL || firstAttr != NULL)) { - UBool startLDMLExtension = FALSE; + if (U_SUCCESS(*status) && (firstExt != nullptr || firstAttr != nullptr)) { + UBool startLDMLExtension = false; for (ext = firstExt; ext; ext = ext->next) { if (!startLDMLExtension && uprv_strlen(ext->key) > 1) { /* first LDML u singlton extension */ sink.Append("-u", 2); - startLDMLExtension = TRUE; + startLDMLExtension = true; } /* write out the sorted BCP47 attributes, extensions and private use */ @@ -1492,8 +1501,11 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st } else { sink.Append("-", 1); sink.Append(ext->key, static_cast(uprv_strlen(ext->key))); - sink.Append("-", 1); - sink.Append(ext->value, static_cast(uprv_strlen(ext->value))); + if (uprv_strcmp(ext->value, "true") != 0 && + uprv_strcmp(ext->value, "yes") != 0) { + sink.Append("-", 1); + sink.Append(ext->value, static_cast(uprv_strlen(ext->value))); + } } } } @@ -1511,19 +1523,19 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT const char *pKwds; /* beginning of key-type pairs */ UBool variantExists = *posixVariant; - ExtensionListEntry *kwdFirst = NULL; /* first LDML keyword */ + ExtensionListEntry *kwdFirst = nullptr; /* first LDML keyword */ ExtensionListEntry *kwd, *nextKwd; int32_t len; /* Reset the posixVariant value */ - *posixVariant = FALSE; + *posixVariant = false; pTag = ldmlext; - pKwds = NULL; + pKwds = nullptr; { - AttributeListEntry *attrFirst = NULL; /* first attribute */ + AttributeListEntry *attrFirst = nullptr; /* first attribute */ AttributeListEntry *attr, *nextAttr; char attrBuf[ULOC_KEYWORD_AND_VALUES_CAPACITY]; @@ -1543,7 +1555,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT /* add this attribute to the list */ attr = attrPool.create(); - if (attr == NULL) { + if (attr == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1573,20 +1585,20 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT /* emit attributes as an LDML keyword, e.g. attribute=attr1-attr2 */ kwd = extPool.create(); - if (kwd == NULL) { + if (kwd == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } icu::CharString* value = kwdBuf.create(); - if (value == NULL) { + if (value == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } /* attribute subtags sorted in alphabetical order as type */ attr = attrFirst; - while (attr != NULL) { + while (attr != nullptr) { nextAttr = attr->next; if (attr != attrFirst) { value->append('-', *status); @@ -1601,7 +1613,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT kwd->key = LOCALE_ATTRIBUTE_KEY; kwd->value = value->data(); - if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) { + if (!_addExtensionToList(&kwdFirst, kwd, false)) { *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -1609,18 +1621,18 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT } if (pKwds) { - const char *pBcpKey = NULL; /* u extenstion key subtag */ - const char *pBcpType = NULL; /* beginning of u extension type subtag(s) */ + const char *pBcpKey = nullptr; /* u extension key subtag */ + const char *pBcpType = nullptr; /* beginning of u extension type subtag(s) */ int32_t bcpKeyLen = 0; int32_t bcpTypeLen = 0; - UBool isDone = FALSE; + UBool isDone = false; pTag = pKwds; /* BCP47 representation of LDML key/type pairs */ while (!isDone) { - const char *pNextBcpKey = NULL; + const char *pNextBcpKey = nullptr; int32_t nextBcpKeyLen = 0; - UBool emitKeyword = FALSE; + UBool emitKeyword = false; if (*pTag) { /* locate next separator char */ @@ -1628,7 +1640,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT if (ultag_isUnicodeLocaleKey(pTag, len)) { if (pBcpKey) { - emitKeyword = TRUE; + emitKeyword = true; pNextBcpKey = pTag; nextBcpKeyLen = len; } else { @@ -1636,7 +1648,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT bcpKeyLen = len; } } else { - U_ASSERT(pBcpKey != NULL); + U_ASSERT(pBcpKey != nullptr); /* within LDML type subtags */ if (pBcpType) { bcpTypeLen += (len + 1); @@ -1654,30 +1666,31 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT } } else { /* processing last one */ - emitKeyword = TRUE; - isDone = TRUE; + emitKeyword = true; + isDone = true; } if (emitKeyword) { - const char *pKey = NULL; /* LDML key */ - const char *pType = NULL; /* LDML type */ + const char *pKey = nullptr; /* LDML key */ + const char *pType = nullptr; /* LDML type */ - char bcpKeyBuf[9]; /* BCP key length is always 2 for now */ + char bcpKeyBuf[3]; /* BCP key length is always 2 for now */ - U_ASSERT(pBcpKey != NULL); + U_ASSERT(pBcpKey != nullptr); if (bcpKeyLen >= (int32_t)sizeof(bcpKeyBuf)) { /* the BCP key is invalid */ *status = U_ILLEGAL_ARGUMENT_ERROR; return; } + U_ASSERT(bcpKeyLen <= 2); uprv_strncpy(bcpKeyBuf, pBcpKey, bcpKeyLen); bcpKeyBuf[bcpKeyLen] = 0; /* u extension key to LDML key */ pKey = uloc_toLegacyKey(bcpKeyBuf); - if (pKey == NULL) { + if (pKey == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -1688,7 +1701,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT */ T_CString_toLowerCase(bcpKeyBuf); icu::CharString* key = kwdBuf.create(bcpKeyBuf, bcpKeyLen, *status); - if (key == NULL) { + if (key == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1711,7 +1724,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT /* BCP type to locale type */ pType = uloc_toLegacyType(pKey, bcpTypeBuf); - if (pType == NULL) { + if (pType == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -1723,7 +1736,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT /* normalize to lower case */ T_CString_toLowerCase(bcpTypeBuf); icu::CharString* type = kwdBuf.create(bcpTypeBuf, bcpTypeLen, *status); - if (type == NULL) { + if (type == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1737,14 +1750,14 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT pType = LOCALE_TYPE_YES; } - /* Special handling for u-va-posix, since we want to treat this as a variant, + /* Special handling for u-va-posix, since we want to treat this as a variant, not as a keyword */ if (!variantExists && !uprv_strcmp(pKey, POSIX_KEY) && !uprv_strcmp(pType, POSIX_VALUE) ) { - *posixVariant = TRUE; + *posixVariant = true; } else { /* create an ExtensionListEntry for this keyword */ kwd = extPool.create(); - if (kwd == NULL) { + if (kwd == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1752,24 +1765,24 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT kwd->key = pKey; kwd->value = pType; - if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) { + if (!_addExtensionToList(&kwdFirst, kwd, false)) { // duplicate keyword is allowed, Only the first // is honored. } } pBcpKey = pNextBcpKey; - bcpKeyLen = pNextBcpKey != NULL ? nextBcpKeyLen : 0; - pBcpType = NULL; + bcpKeyLen = pNextBcpKey != nullptr ? nextBcpKeyLen : 0; + pBcpType = nullptr; bcpTypeLen = 0; } } } kwd = kwdFirst; - while (kwd != NULL) { + while (kwd != nullptr) { nextKwd = kwd->next; - _addExtensionToList(appendTo, kwd, FALSE); + _addExtensionToList(appendTo, kwd, false); kwd = nextKwd; } } @@ -1779,22 +1792,17 @@ static void _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) { int32_t i, n; int32_t len; - ExtensionListEntry *kwdFirst = NULL; + ExtensionListEntry *kwdFirst = nullptr; ExtensionListEntry *kwd; const char *key, *type; icu::MemoryPool extPool; icu::MemoryPool kwdBuf; - UBool posixVariant = FALSE; + UBool posixVariant = false; if (U_FAILURE(*status)) { return; } - /* Determine if variants already exists */ - if (ultag_getVariantsSize(langtag)) { - posixVariant = TRUE; - } - n = ultag_getExtensionsSize(langtag); /* resolve locale keywords and reordering keys */ @@ -1802,19 +1810,24 @@ _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) key = ultag_getExtensionKey(langtag, i); type = ultag_getExtensionValue(langtag, i); if (*key == LDMLEXT) { + /* Determine if variants already exists */ + if (ultag_getVariantsSize(langtag)) { + posixVariant = true; + } + _appendLDMLExtensionAsKeywords(type, &kwdFirst, extPool, kwdBuf, &posixVariant, status); if (U_FAILURE(*status)) { break; } } else { kwd = extPool.create(); - if (kwd == NULL) { + if (kwd == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; break; } kwd->key = key; kwd->value = type; - if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) { + if (!_addExtensionToList(&kwdFirst, kwd, false)) { *status = U_ILLEGAL_ARGUMENT_ERROR; break; } @@ -1826,12 +1839,12 @@ _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) if ((int32_t)uprv_strlen(type) > 0) { /* add private use as a keyword */ kwd = extPool.create(); - if (kwd == NULL) { + if (kwd == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; } else { kwd->key = PRIVATEUSE_KEY; kwd->value = type; - if (!_addExtensionToList(&kwdFirst, kwd, FALSE)) { + if (!_addExtensionToList(&kwdFirst, kwd, false)) { *status = U_ILLEGAL_ARGUMENT_ERROR; } } @@ -1845,14 +1858,14 @@ _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) sink.Append(_POSIX, len); } - if (U_SUCCESS(*status) && kwdFirst != NULL) { + if (U_SUCCESS(*status) && kwdFirst != nullptr) { /* write out the sorted keywords */ - UBool firstValue = TRUE; + UBool firstValue = true; kwd = kwdFirst; do { if (firstValue) { sink.Append("@", 1); - firstValue = FALSE; + firstValue = false; } else { sink.Append(";", 1); } @@ -1875,11 +1888,8 @@ static void _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, UBool hadPosix, UErrorCode* status) { (void)hadPosix; char buf[ULOC_FULLNAME_CAPACITY]; - char tmpAppend[ULOC_FULLNAME_CAPACITY]; UErrorCode tmpStatus = U_ZERO_ERROR; int32_t len, i; - int32_t reslen = 0; - int32_t capacity = sizeof tmpAppend; if (U_FAILURE(*status)) { return; @@ -1895,21 +1905,21 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool if (len > 0) { char *p, *pPriv; - UBool bNext = TRUE; - UBool firstValue = TRUE; + UBool bNext = true; + UBool firstValue = true; UBool writeValue; - pPriv = NULL; + pPriv = nullptr; p = buf; while (bNext) { - writeValue = FALSE; + writeValue = false; if (*p == SEP || *p == LOCALE_SEP || *p == 0) { if (*p == 0) { - bNext = FALSE; + bNext = false; } else { *p = 0; /* terminate */ } - if (pPriv != NULL) { + if (pPriv != nullptr) { /* Private use in the canonical format is lowercase in BCP47 */ for (i = 0; *(pPriv + i) != 0; i++) { *(pPriv + i) = uprv_tolower(*(pPriv + i)); @@ -1919,10 +1929,10 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool if (_isPrivateuseValueSubtag(pPriv, -1)) { if (firstValue) { if (!_isVariantSubtag(pPriv, -1)) { - writeValue = TRUE; + writeValue = true; } } else { - writeValue = TRUE; + writeValue = true; } } else if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; @@ -1932,55 +1942,27 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool } if (writeValue) { - if (reslen < capacity) { - tmpAppend[reslen++] = SEP; - } + sink.Append("-", 1); if (firstValue) { - if (reslen < capacity) { - tmpAppend[reslen++] = *PRIVATEUSE_KEY; - } - - if (reslen < capacity) { - tmpAppend[reslen++] = SEP; - } - - len = (int32_t)uprv_strlen(PRIVUSE_VARIANT_PREFIX); - if (reslen < capacity) { - uprv_memcpy(tmpAppend + reslen, PRIVUSE_VARIANT_PREFIX, uprv_min(len, capacity - reslen)); - } - reslen += len; - - if (reslen < capacity) { - tmpAppend[reslen++] = SEP; - } - - firstValue = FALSE; + sink.Append(PRIVATEUSE_KEY, UPRV_LENGTHOF(PRIVATEUSE_KEY) - 1); + sink.Append("-", 1); + sink.Append(PRIVUSE_VARIANT_PREFIX, UPRV_LENGTHOF(PRIVUSE_VARIANT_PREFIX) - 1); + sink.Append("-", 1); + firstValue = false; } len = (int32_t)uprv_strlen(pPriv); - if (reslen < capacity) { - uprv_memcpy(tmpAppend + reslen, pPriv, uprv_min(len, capacity - reslen)); - } - reslen += len; + sink.Append(pPriv, len); } } /* reset private use starting position */ - pPriv = NULL; - } else if (pPriv == NULL) { + pPriv = nullptr; + } else if (pPriv == nullptr) { pPriv = p; } p++; } - - if (U_FAILURE(*status)) { - return; - } - } - - if (U_SUCCESS(*status)) { - len = reslen; - sink.Append(tmpAppend, len); } } @@ -2003,11 +1985,12 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool #define PRIV 0x0080 /** - * Ticket #12705 - Visual Studio 2015 Update 3 contains a new code optimizer which has problems optimizing - * this function. (See https://blogs.msdn.microsoft.com/vcblog/2016/05/04/new-code-optimizer/ ) - * As a workaround, we will turn off optimization just for this function on VS2015 Update 3 and above. + * Ticket #12705 - The optimizer in Visual Studio 2015 Update 3 has problems optimizing this function. + * As a work-around, optimization is disabled for this function on VS2015 and VS2017. + * This work-around should be removed once the following versions of Visual Studio are no + * longer supported: All versions of VS2015/VS2017, and versions of VS2019 below 16.4. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210)) +#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924) #pragma optimize( "", off ) #endif @@ -2021,15 +2004,15 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta ExtensionListEntry *pExtension; char *pExtValueSubtag, *pExtValueSubtagEnd; int32_t i; - UBool privateuseVar = FALSE; - int32_t grandfatheredLen = 0; + UBool privateuseVar = false; + int32_t legacyLen = 0; - if (parsedLen != NULL) { + if (parsedLen != nullptr) { *parsedLen = 0; } if (U_FAILURE(*status)) { - return NULL; + return nullptr; } if (tagLen < 0) { @@ -2038,11 +2021,14 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta /* copy the entire string */ tagBuf = (char*)uprv_malloc(tagLen + 1); - if (tagBuf == NULL) { + if (tagBuf == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; + } + + if (tagLen > 0) { + uprv_memcpy(tagBuf, tag, tagLen); } - uprv_memcpy(tagBuf, tag, tagLen); *(tagBuf + tagLen) = 0; /* create a ULanguageTag */ @@ -2051,7 +2037,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta if (t.isNull()) { uprv_free(tagBuf); *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } _initializeULanguageTag(t.getAlias()); t->buf = tagBuf; @@ -2062,45 +2048,50 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta } size_t parsedLenDelta = 0; - // Grandfathered tag will be consider together. Grandfathered tag with intervening + // Legacy tag will be consider together. Legacy tag with intervening // script and region such as art-DE-lojban or art-Latn-lojban won't be // matched. - /* check if the tag is grandfathered */ - for (i = 0; i < UPRV_LENGTHOF(GRANDFATHERED); i += 2) { - int32_t checkGrandfatheredLen = static_cast(uprv_strlen(GRANDFATHERED[i])); - if (tagLen < checkGrandfatheredLen) { + /* check if the tag is legacy */ + for (i = 0; i < UPRV_LENGTHOF(LEGACY); i += 2) { + int32_t checkLegacyLen = static_cast(uprv_strlen(LEGACY[i])); + if (tagLen < checkLegacyLen) { continue; } - if (tagLen > checkGrandfatheredLen && tagBuf[checkGrandfatheredLen] != '-') { + if (tagLen > checkLegacyLen && tagBuf[checkLegacyLen] != '-') { // make sure next char is '-'. continue; } - if (uprv_strnicmp(GRANDFATHERED[i], tagBuf, checkGrandfatheredLen) == 0) { + if (uprv_strnicmp(LEGACY[i], tagBuf, checkLegacyLen) == 0) { int32_t newTagLength; - grandfatheredLen = checkGrandfatheredLen; /* back up for output parsedLen */ - int32_t replacementLen = static_cast(uprv_strlen(GRANDFATHERED[i+1])); - newTagLength = replacementLen + tagLen - checkGrandfatheredLen; + legacyLen = checkLegacyLen; /* back up for output parsedLen */ + int32_t replacementLen = static_cast(uprv_strlen(LEGACY[i+1])); + newTagLength = replacementLen + tagLen - checkLegacyLen; + int32_t oldTagLength = tagLen; if (tagLen < newTagLength) { uprv_free(tagBuf); - tagBuf = (char*)uprv_malloc(newTagLength + 1); - if (tagBuf == NULL) { + // Change t->buf after the free and before return to avoid the second double free in + // the destructor of t when t is out of scope. + t->buf = tagBuf = (char*)uprv_malloc(newTagLength + 1); + if (tagBuf == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - t->buf = tagBuf; tagLen = newTagLength; } - parsedLenDelta = checkGrandfatheredLen - replacementLen; - uprv_strcpy(t->buf, GRANDFATHERED[i + 1]); - if (checkGrandfatheredLen != tagLen) { - uprv_strcpy(t->buf + replacementLen, tag + checkGrandfatheredLen); + parsedLenDelta = checkLegacyLen - replacementLen; + uprv_strcpy(t->buf, LEGACY[i + 1]); + if (checkLegacyLen != tagLen) { + uprv_memcpy(t->buf + replacementLen, tag + checkLegacyLen, + oldTagLength - checkLegacyLen); + // NUL-terminate after memcpy(). + t->buf[replacementLen + oldTagLength - checkLegacyLen] = 0; } break; } } - if (grandfatheredLen == 0) { + if (legacyLen == 0) { for (i = 0; i < UPRV_LENGTHOF(REDUNDANT); i += 2) { const char* redundantTag = REDUNDANT[i]; size_t redundantTagLen = uprv_strlen(redundantTag); @@ -2112,7 +2103,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta if (*redundantTagEnd == '\0' || *redundantTagEnd == SEP) { const char* preferredTag = REDUNDANT[i + 1]; size_t preferredTagLen = uprv_strlen(preferredTag); - uprv_strncpy(t->buf, preferredTag, preferredTagLen); + uprv_memcpy(t->buf, preferredTag, preferredTagLen); if (*redundantTagEnd == SEP) { uprv_memmove(tagBuf + preferredTagLen, redundantTagEnd, @@ -2142,9 +2133,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta next = LANG | PRIV; pNext = pLastGoodPosition = tagBuf; extlangIdx = 0; - pExtension = NULL; - pExtValueSubtag = NULL; - pExtValueSubtagEnd = NULL; + pExtension = nullptr; + pExtValueSubtag = nullptr; + pExtValueSubtagEnd = nullptr; while (pNext) { char *pSep; @@ -2161,7 +2152,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta } if (*pSep == 0) { /* last subtag */ - pNext = NULL; + pNext = nullptr; } else { pNext = pSep + 1; } @@ -2232,9 +2223,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta UBool isAdded; var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry)); - if (var == NULL) { + if (var == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } *pSep = 0; var->variant = T_CString_toUpperCase(pSubtag); @@ -2251,11 +2242,11 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta } if (next & EXTS) { if (_isExtensionSingleton(pSubtag, subtagLen)) { - if (pExtension != NULL) { - if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) { + if (pExtension != nullptr) { + if (pExtValueSubtag == nullptr || pExtValueSubtagEnd == nullptr) { /* the previous extension is incomplete */ uprv_free(pExtension); - pExtension = NULL; + pExtension = nullptr; break; } @@ -2264,32 +2255,32 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta pExtension->value = T_CString_toLowerCase(pExtValueSubtag); /* insert the extension to the list */ - if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) { + if (_addExtensionToList(&(t->extensions), pExtension, false)) { pLastGoodPosition = pExtValueSubtagEnd; } else { /* stop parsing here */ uprv_free(pExtension); - pExtension = NULL; + pExtension = nullptr; break; } } /* create a new extension */ pExtension = (ExtensionListEntry*)uprv_malloc(sizeof(ExtensionListEntry)); - if (pExtension == NULL) { + if (pExtension == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } *pSep = 0; pExtension->key = T_CString_toLowerCase(pSubtag); - pExtension->value = NULL; /* will be set later */ + pExtension->value = nullptr; /* will be set later */ /* * reset the start and the end location of extension value * subtags for this extension */ - pExtValueSubtag = NULL; - pExtValueSubtagEnd = NULL; + pExtValueSubtag = nullptr; + pExtValueSubtagEnd = nullptr; next = EXTV; continue; @@ -2297,8 +2288,8 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta } if (next & EXTV) { if (_isExtensionSubtag(pSubtag, subtagLen)) { - if (pExtValueSubtag == NULL) { - /* if the start postion of this extension's value is not yet, + if (pExtValueSubtag == nullptr) { + /* if the start position of this extension's value is not yet, this one is the first value subtag */ pExtValueSubtag = pSubtag; } @@ -2314,12 +2305,12 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta if (uprv_tolower(*pSubtag) == PRIVATEUSE && subtagLen == 1) { char *pPrivuseVal; - if (pExtension != NULL) { + if (pExtension != nullptr) { /* Process the last extension */ - if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) { + if (pExtValueSubtag == nullptr || pExtValueSubtagEnd == nullptr) { /* the previous extension is incomplete */ uprv_free(pExtension); - pExtension = NULL; + pExtension = nullptr; break; } else { /* terminate the previous extension value */ @@ -2327,20 +2318,20 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta pExtension->value = T_CString_toLowerCase(pExtValueSubtag); /* insert the extension to the list */ - if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) { + if (_addExtensionToList(&(t->extensions), pExtension, false)) { pLastGoodPosition = pExtValueSubtagEnd; - pExtension = NULL; + pExtension = nullptr; } else { /* stop parsing here */ uprv_free(pExtension); - pExtension = NULL; + pExtension = nullptr; break; } } } /* The rest of part will be private use value subtags */ - if (pNext == NULL) { + if (pNext == nullptr) { /* empty private use subtag */ break; } @@ -2359,7 +2350,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta } if (*pSep == 0) { /* last subtag */ - pNext = NULL; + pNext = nullptr; } else { pNext = pSep + 1; } @@ -2368,7 +2359,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta if (uprv_strncmp(pSubtag, PRIVUSE_VARIANT_PREFIX, uprv_strlen(PRIVUSE_VARIANT_PREFIX)) == 0) { *pSep = 0; next = VART; - privateuseVar = TRUE; + privateuseVar = true; break; } else if (_isPrivateuseValueSubtag(pSubtag, subtagLen)) { pLastGoodPosition = pSep; @@ -2395,9 +2386,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta break; } - if (pExtension != NULL) { + if (pExtension != nullptr) { /* Process the last extension */ - if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) { + if (pExtValueSubtag == nullptr || pExtValueSubtagEnd == nullptr) { /* the previous extension is incomplete */ uprv_free(pExtension); } else { @@ -2405,7 +2396,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta *pExtValueSubtagEnd = 0; pExtension->value = T_CString_toLowerCase(pExtValueSubtag); /* insert the extension to the list */ - if (_addExtensionToList(&(t->extensions), pExtension, FALSE)) { + if (_addExtensionToList(&(t->extensions), pExtension, false)) { pLastGoodPosition = pExtValueSubtagEnd; } else { uprv_free(pExtension); @@ -2413,24 +2404,22 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta } } - if (parsedLen != NULL) { + if (parsedLen != nullptr) { *parsedLen = (int32_t)(pLastGoodPosition - t->buf + parsedLenDelta); } return t.orphan(); } -/** -* Ticket #12705 - Turn optimization back on. -*/ -#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210)) +// Ticket #12705 - Turn optimization back on. +#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924) #pragma optimize( "", on ) #endif static void ultag_close(ULanguageTag* langtag) { - if (langtag == NULL) { + if (langtag == nullptr) { return; } @@ -2466,7 +2455,7 @@ ultag_getLanguage(const ULanguageTag* langtag) { static const char* ultag_getJDKLanguage(const ULanguageTag* langtag) { int32_t i; - for (i = 0; DEPRECATEDLANGS[i] != NULL; i += 2) { + for (i = 0; DEPRECATEDLANGS[i] != nullptr; i += 2) { if (uprv_compareInvCharsAsAscii(DEPRECATEDLANGS[i], langtag->language) == 0) { return DEPRECATEDLANGS[i + 1]; } @@ -2480,7 +2469,7 @@ ultag_getExtlang(const ULanguageTag* langtag, int32_t idx) { if (idx >= 0 && idx < MAXEXTLANG) { return langtag->extlang[idx]; } - return NULL; + return nullptr; } static int32_t @@ -2507,7 +2496,7 @@ ultag_getRegion(const ULanguageTag* langtag) { static const char* ultag_getVariant(const ULanguageTag* langtag, int32_t idx) { - const char *var = NULL; + const char *var = nullptr; VariantListEntry *cur = langtag->variants; int32_t i = 0; while (cur) { @@ -2525,8 +2514,8 @@ static int32_t ultag_getVariantsSize(const ULanguageTag* langtag) { int32_t size = 0; VariantListEntry *cur = langtag->variants; - while (TRUE) { - if (cur == NULL) { + while (true) { + if (cur == nullptr) { break; } size++; @@ -2537,7 +2526,7 @@ ultag_getVariantsSize(const ULanguageTag* langtag) { static const char* ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx) { - const char *key = NULL; + const char *key = nullptr; ExtensionListEntry *cur = langtag->extensions; int32_t i = 0; while (cur) { @@ -2553,7 +2542,7 @@ ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx) { static const char* ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx) { - const char *val = NULL; + const char *val = nullptr; ExtensionListEntry *cur = langtag->extensions; int32_t i = 0; while (cur) { @@ -2571,8 +2560,8 @@ static int32_t ultag_getExtensionsSize(const ULanguageTag* langtag) { int32_t size = 0; ExtensionListEntry *cur = langtag->extensions; - while (TRUE) { - if (cur == NULL) { + while (true) { + if (cur == nullptr) { break; } size++; @@ -2588,8 +2577,8 @@ ultag_getPrivateUse(const ULanguageTag* langtag) { #if 0 static const char* -ultag_getGrandfathered(const ULanguageTag* langtag) { - return langtag->grandfathered; +ultag_getLegacy(const ULanguageTag* langtag) { + return langtag->legacy; } #endif @@ -2636,60 +2625,25 @@ ulocimp_toLanguageTag(const char* localeID, UBool strict, UErrorCode* status) { icu::CharString canonical; - int32_t reslen; UErrorCode tmpStatus = U_ZERO_ERROR; - UBool hadPosix = FALSE; + UBool hadPosix = false; const char* pKeywordStart; /* Note: uloc_canonicalize returns "en_US_POSIX" for input locale ID "". See #6835 */ - int32_t resultCapacity = static_cast(uprv_strlen(localeID)); - if (resultCapacity > 0) { - char* buffer; - - for (;;) { - buffer = canonical.getAppendBuffer( - /*minCapacity=*/resultCapacity, - /*desiredCapacityHint=*/resultCapacity, - resultCapacity, - tmpStatus); - - if (U_FAILURE(tmpStatus)) { - *status = tmpStatus; - return; - } - - reslen = - uloc_canonicalize(localeID, buffer, resultCapacity, &tmpStatus); - - if (tmpStatus != U_BUFFER_OVERFLOW_ERROR) { - break; - } - - resultCapacity = reslen; - tmpStatus = U_ZERO_ERROR; - } - - if (U_FAILURE(tmpStatus)) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - - canonical.append(buffer, reslen, tmpStatus); - if (tmpStatus == U_STRING_NOT_TERMINATED_WARNING) { - tmpStatus = U_ZERO_ERROR; // Terminators provided by CharString. - } - - if (U_FAILURE(tmpStatus)) { - *status = tmpStatus; - return; - } + { + icu::CharStringByteSink canonicalSink(&canonical); + ulocimp_canonicalize(localeID, canonicalSink, &tmpStatus); + } + if (U_FAILURE(tmpStatus)) { + *status = tmpStatus; + return; } /* For handling special case - private use only tag */ pKeywordStart = locale_getKeywordsStart(canonical.data()); if (pKeywordStart == canonical.data()) { int kwdCnt = 0; - UBool done = FALSE; + UBool done = false; icu::LocalUEnumerationPointer kwdEnum(uloc_openKeywords(canonical.data(), &tmpStatus)); if (U_SUCCESS(tmpStatus)) { @@ -2700,23 +2654,25 @@ ulocimp_toLanguageTag(const char* localeID, key = uenum_next(kwdEnum.getAlias(), &len, &tmpStatus); if (len == 1 && *key == PRIVATEUSE) { - char buf[ULOC_KEYWORD_AND_VALUES_CAPACITY]; - buf[0] = PRIVATEUSE; - buf[1] = SEP; - len = uloc_getKeywordValue(localeID, key, &buf[2], sizeof(buf) - 2, &tmpStatus); + icu::CharString buf; + { + icu::CharStringByteSink sink(&buf); + ulocimp_getKeywordValue(localeID, key, sink, &tmpStatus); + } if (U_SUCCESS(tmpStatus)) { - if (ultag_isPrivateuseValueSubtags(&buf[2], len)) { + if (ultag_isPrivateuseValueSubtags(buf.data(), buf.length())) { /* return private use only tag */ - sink.Append(buf, len + 2); - done = TRUE; + sink.Append("und-x-", 6); + sink.Append(buf.data(), buf.length()); + done = true; } else if (strict) { *status = U_ILLEGAL_ARGUMENT_ERROR; - done = TRUE; + done = true; } /* if not strict mode, then "und" will be returned */ } else { *status = U_ILLEGAL_ARGUMENT_ERROR; - done = TRUE; + done = true; } } } @@ -2770,11 +2726,11 @@ ulocimp_forLanguageTag(const char* langtag, icu::ByteSink& sink, int32_t* parsedLength, UErrorCode* status) { - UBool isEmpty = TRUE; + UBool isEmpty = true; const char *subtag, *p; int32_t len; int32_t i, n; - UBool noRegion = TRUE; + UBool noRegion = true; icu::LocalULanguageTagPointer lt(ultag_parse(langtag, tagLen, parsedLength, status)); if (U_FAILURE(*status)) { @@ -2787,7 +2743,7 @@ ulocimp_forLanguageTag(const char* langtag, len = (int32_t)uprv_strlen(subtag); if (len > 0) { sink.Append(subtag, len); - isEmpty = FALSE; + isEmpty = false; } } @@ -2796,7 +2752,7 @@ ulocimp_forLanguageTag(const char* langtag, len = (int32_t)uprv_strlen(subtag); if (len > 0) { sink.Append("_", 1); - isEmpty = FALSE; + isEmpty = false; /* write out the script in title case */ char c = uprv_toupper(*subtag); @@ -2809,7 +2765,7 @@ ulocimp_forLanguageTag(const char* langtag, len = (int32_t)uprv_strlen(subtag); if (len > 0) { sink.Append("_", 1); - isEmpty = FALSE; + isEmpty = false; /* write out the region in upper case */ p = subtag; @@ -2818,15 +2774,16 @@ ulocimp_forLanguageTag(const char* langtag, sink.Append(&c, 1); p++; } - noRegion = FALSE; + noRegion = false; } /* variants */ + _sortVariants(lt.getAlias()->variants); n = ultag_getVariantsSize(lt.getAlias()); if (n > 0) { if (noRegion) { sink.Append("_", 1); - isEmpty = FALSE; + isEmpty = false; } for (i = 0; i < n; i++) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/ulocimp.h b/src/duckdb/extension/icu/third_party/icu/common/ulocimp.h index 31d3c44d0..efa0fa72e 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ulocimp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ulocimp.h @@ -13,6 +13,8 @@ #include "unicode/bytestream.h" #include "unicode/uloc.h" +#include "charstr.h" + /** * Create an iterator over the specified keywords list * @param keywordList double-null terminated list. Will be copied. @@ -38,7 +40,7 @@ uloc_getTableStringWithFallback( int32_t *pLength, UErrorCode *pErrorCode); -/*returns TRUE if a is an ID separator FALSE otherwise*/ +/*returns true if a is an ID separator false otherwise*/ #define _isIDSeparator(a) (a == '_' || a == '-') U_CFUNC const char* @@ -47,27 +49,60 @@ uloc_getCurrentCountryID(const char* oldID); U_CFUNC const char* uloc_getCurrentLanguageID(const char* oldID); -U_CFUNC int32_t +U_CFUNC void +ulocimp_getKeywords(const char *localeID, + char prev, + icu::ByteSink& sink, + UBool valuesToo, + UErrorCode *status); + +icu::CharString U_EXPORT2 ulocimp_getLanguage(const char *localeID, - char *language, int32_t languageCapacity, - const char **pEnd); + const char **pEnd, + UErrorCode &status); -U_CFUNC int32_t +icu::CharString U_EXPORT2 ulocimp_getScript(const char *localeID, - char *script, int32_t scriptCapacity, - const char **pEnd); + const char **pEnd, + UErrorCode &status); -U_CFUNC int32_t +icu::CharString U_EXPORT2 ulocimp_getCountry(const char *localeID, - char *country, int32_t countryCapacity, - const char **pEnd); + const char **pEnd, + UErrorCode &status); + +U_CAPI void U_EXPORT2 +ulocimp_getName(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +U_CAPI void U_EXPORT2 +ulocimp_getBaseName(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +U_CAPI void U_EXPORT2 +ulocimp_canonicalize(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); + +U_CAPI void U_EXPORT2 +ulocimp_getKeywordValue(const char* localeID, + const char* keywordName, + icu::ByteSink& sink, + UErrorCode* status); + +U_CAPI void U_EXPORT2 +ulocimp_getParent(const char* localeID, + icu::ByteSink& sink, + UErrorCode* err); /** * Writes a well-formed language tag for this locale ID. * - * **Note**: When `strict` is FALSE, any locale fields which do not satisfy the + * **Note**: When `strict` is false, any locale fields which do not satisfy the * BCP47 syntax requirement will be omitted from the result. When `strict` is - * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the `err` if any locale + * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the `err` if any locale * fields do not satisfy the BCP47 syntax requirement. * * @param localeID the input locale ID @@ -81,7 +116,7 @@ ulocimp_getCountry(const char *localeID, * * @internal ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_toLanguageTag(const char* localeID, icu::ByteSink& sink, UBool strict, @@ -92,13 +127,17 @@ ulocimp_toLanguageTag(const char* localeID, * If the specified language tag contains any ill-formed subtags, * the first such subtag and all following subtags are ignored. *

- * This implements the 'Language-Tag' production of BCP47, and so - * supports grandfathered (regular and irregular) as well as private - * use language tags. Private use tags are represented as 'x-whatever', - * and grandfathered tags are converted to their canonical replacements - * where they exist. Note that a few grandfathered tags have no modern - * replacement, these will be converted using the fallback described in + * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in * the first paragraph, so some information might be lost. + * * @param langtag the input BCP47 language tag. * @param tagLen the length of langtag, or -1 to call uprv_strlen(). * @param sink the output sink receiving a locale ID for the @@ -120,7 +159,7 @@ ulocimp_forLanguageTag(const char* langtag, * Get the region to use for supplemental data lookup. Uses * (1) any region specified by locale tag "rg"; if none then * (2) any unicode_region_tag in the locale ID; if none then - * (3) if inferRegion is TRUE, the region suggested by + * (3) if inferRegion is true, the region suggested by * getLikelySubtags on the localeID. * If no region is found, returns length 0. * @@ -128,7 +167,7 @@ ulocimp_forLanguageTag(const char* langtag, * The complete locale ID (with keywords) from which * to get the region to use for supplemental data. * @param inferRegion - * If TRUE, will try to infer region from localeID if + * If true, will try to infer region from localeID if * no other region is found. * @param region * Buffer in which to put the region ID found; should @@ -174,7 +213,7 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @internal ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_addLikelySubtags(const char* localeID, icu::ByteSink& sink, UErrorCode* err); @@ -203,14 +242,16 @@ ulocimp_addLikelySubtags(const char* localeID, * * @param localeID The locale to minimize * @param sink The output sink receiving the maximized locale + * @param favorScript favor to keep script if true, region if false. * @param err Error information if minimizing the locale failed. If the length * of the localeID and the null-terminator is greater than the maximum allowed size, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @internal ICU 64 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ulocimp_minimizeSubtags(const char* localeID, icu::ByteSink& sink, + bool favorScript, UErrorCode* err); U_CAPI const char * U_EXPORT2 @@ -252,6 +293,9 @@ ultag_isUnicodeLocaleType(const char* s, int32_t len); U_CFUNC UBool ultag_isVariantSubtags(const char* s, int32_t len); +U_CAPI const char * U_EXPORT2 +ultag_getTKeyStart(const char *localeID); + U_CFUNC const char* ulocimp_toBcpKey(const char* key); @@ -264,4 +308,10 @@ ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* i U_CFUNC const char* ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType); +/* Function for testing purpose */ +U_CAPI const char* const* ulocimp_getKnownCanonicalizedLocaleForTest(int32_t* length); + +// Return true if the value is already canonicalized. +U_CAPI bool ulocimp_isCanonicalizedLocaleForTest(const char* localeName); + #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/umapfile.cpp b/src/duckdb/extension/icu/third_party/icu/common/umapfile.cpp index 3e714876a..faa6d8078 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/umapfile.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/umapfile.cpp @@ -107,10 +107,10 @@ typedef HANDLE MemoryMap; U_CFUNC UBool uprv_mapFile(UDataMemory *pData, const char *path, UErrorCode *status) { if (U_FAILURE(*status)) { - return FALSE; + return false; } UDataMemory_init(pData); /* Clear the output struct. */ - return FALSE; /* no file access */ + return false; /* no file access */ } U_CFUNC void uprv_unmapFile(UDataMemory *pData) { @@ -126,7 +126,7 @@ typedef HANDLE MemoryMap; ) { if (U_FAILURE(*status)) { - return FALSE; + return false; } HANDLE map = nullptr; @@ -147,15 +147,15 @@ typedef HANDLE MemoryMap; // Convert from UTF-8 string to UTF-16 string. wchar_t utf16Path[MAX_PATH]; int32_t pathUtf16Len = 0; - u_strFromUTF8(reinterpret_cast(utf16Path), static_cast(UPRV_LENGTHOF(utf16Path)), &pathUtf16Len, path, -1, status); + u_strFromUTF8(reinterpret_cast(utf16Path), static_cast(UPRV_LENGTHOF(utf16Path)), &pathUtf16Len, path, -1, status); if (U_FAILURE(*status)) { - return FALSE; + return false; } if (*status == U_STRING_NOT_TERMINATED_WARNING) { // Report back an error instead of a warning. *status = U_BUFFER_OVERFLOW_ERROR; - return FALSE; + return false; } file = CreateFileW(utf16Path, GENERIC_READ, FILE_SHARE_READ, nullptr, @@ -168,10 +168,10 @@ typedef HANDLE MemoryMap; if (HRESULT_FROM_WIN32(GetLastError()) == E_OUTOFMEMORY) { *status = U_MEMORY_ALLOCATION_ERROR; } - return FALSE; + return false; } - // Note: We use NULL/nullptr for lpAttributes parameter below. + // Note: We use nullptr/nullptr for lpAttributes parameter below. // This means our handle cannot be inherited and we will get the default security descriptor. /* create an unnamed Windows file-mapping object for the specified file */ map = CreateFileMappingW(file, nullptr, PAGE_READONLY, 0, 0, nullptr); @@ -183,17 +183,17 @@ typedef HANDLE MemoryMap; if (HRESULT_FROM_WIN32(GetLastError()) == E_OUTOFMEMORY) { *status = U_MEMORY_ALLOCATION_ERROR; } - return FALSE; + return false; } /* map a view of the file into our address space */ pData->pHeader = reinterpret_cast(MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0)); if (pData->pHeader == nullptr) { CloseHandle(map); - return FALSE; + return false; } pData->map = map; - return TRUE; + return true; } U_CFUNC void @@ -217,21 +217,21 @@ typedef HANDLE MemoryMap; void *data; if (U_FAILURE(*status)) { - return FALSE; + return false; } UDataMemory_init(pData); /* Clear the output struct. */ /* determine the length of the file */ if(stat(path, &mystat)!=0 || mystat.st_size<=0) { - return FALSE; + return false; } length=mystat.st_size; /* open the file */ fd=open(path, O_RDONLY); if(fd==-1) { - return FALSE; + return false; } /* get a view of the mapping */ @@ -243,7 +243,7 @@ typedef HANDLE MemoryMap; close(fd); /* no longer needed */ if(data==MAP_FAILED) { // Possibly check the errno value for ENOMEM, and report U_MEMORY_ALLOCATION_ERROR? - return FALSE; + return false; } pData->map = (char *)data + length; @@ -252,7 +252,7 @@ typedef HANDLE MemoryMap; #if U_PLATFORM == U_PF_IPHONE posix_madvise(data, length, POSIX_MADV_RANDOM); #endif - return TRUE; + return true; } U_CFUNC void @@ -291,21 +291,21 @@ typedef HANDLE MemoryMap; void *p; if (U_FAILURE(*status)) { - return FALSE; + return false; } UDataMemory_init(pData); /* Clear the output struct. */ /* open the input file */ file=fopen(path, "rb"); if(file==nullptr) { - return FALSE; + return false; } /* get the file length */ fileLength=umap_fsize(file); if(ferror(file) || fileLength<=20) { fclose(file); - return FALSE; + return false; } /* allocate the memory to hold the file data */ @@ -313,21 +313,21 @@ typedef HANDLE MemoryMap; if(p==nullptr) { fclose(file); *status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } /* read the file */ if(fileLength!=fread(p, 1, fileLength, file)) { uprv_free(p); fclose(file); - return FALSE; + return false; } fclose(file); pData->map=p; pData->pHeader=(const DataHeader *)p; pData->mapAddr=p; - return TRUE; + return true; } U_CFUNC void @@ -427,7 +427,7 @@ typedef HANDLE MemoryMap; void *val=0; if (U_FAILURE(*status)) { - return FALSE; + return false; } inBasename=uprv_strrchr(path, U_FILE_SEP_CHAR); @@ -447,14 +447,14 @@ typedef HANDLE MemoryMap; /* determine the length of the file */ if(stat(path, &mystat)!=0 || mystat.st_size<=0) { - return FALSE; + return false; } length=mystat.st_size; /* open the file */ fd=open(path, O_RDONLY); if(fd==-1) { - return FALSE; + return false; } /* get a view of the mapping */ @@ -462,12 +462,12 @@ typedef HANDLE MemoryMap; close(fd); /* no longer needed */ if(data==MAP_FAILED) { // Possibly check the errorno value for ENOMEM, and report U_MEMORY_ALLOCATION_ERROR? - return FALSE; + return false; } pData->map = (char *)data + length; pData->pHeader=(const DataHeader *)data; pData->mapAddr = data; - return TRUE; + return true; } # ifdef OS390BATCH @@ -503,16 +503,16 @@ typedef HANDLE MemoryMap; val=dllqueryvar((dllhandle*)handle, U_ICUDATA_ENTRY_NAME); if(val == 0) { /* failed... so keep looking */ - return FALSE; + return false; } # ifdef UDATA_DEBUG fprintf(stderr, "dllqueryvar(%08X, %s) -> %08X\n", handle, U_ICUDATA_ENTRY_NAME, val); # endif pData->pHeader=(const DataHeader *)val; - return TRUE; + return true; } else { - return FALSE; /* no handle */ + return false; /* no handle */ } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/umapfile.h b/src/duckdb/extension/icu/third_party/icu/common/umapfile.h index 92bd567a2..042e71374 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/umapfile.h +++ b/src/duckdb/extension/icu/third_party/icu/common/umapfile.h @@ -18,7 +18,7 @@ * whatever means are available. * * These functions are part of the ICU internal implementation, and - * are not inteded to be used directly by applications. + * are not intended to be used directly by applications. * *----------------------------------------------------------------------------------*/ @@ -29,7 +29,7 @@ #include "unicode/udata.h" #include "putilimp.h" -U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path, UErrorCode *status); +U_CAPI UBool U_EXPORT2 uprv_mapFile(UDataMemory *pdm, const char *path, UErrorCode *status); U_CFUNC void uprv_unmapFile(UDataMemory *pData); /* MAP_NONE: no memory mapping, no file access at all */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/umutablecptrie.cpp b/src/duckdb/extension/icu/third_party/icu/common/umutablecptrie.cpp index 088e8133e..cdbe27080 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/umutablecptrie.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/umutablecptrie.cpp @@ -373,7 +373,7 @@ UChar32 MutableCodePointTrie::getRange( } void -umutablecptrie_writeBlock(uint32_t *block, uint32_t value) { +writeBlock(uint32_t *block, uint32_t value) { uint32_t *limit = block + UCPTRIE_SMALL_DATA_BLOCK_LENGTH; while (block < limit) { *block++ = value; @@ -448,7 +448,7 @@ int32_t MutableCodePointTrie::getDataBlock(int32_t i) { int32_t iLimit = iStart + SMALL_DATA_BLOCKS_PER_BMP_BLOCK; do { U_ASSERT(flags[iStart] == ALL_SAME); - umutablecptrie_writeBlock(data + newBlock, index[iStart]); + writeBlock(data + newBlock, index[iStart]); flags[iStart] = MIXED; index[iStart++] = newBlock; newBlock += UCPTRIE_SMALL_DATA_BLOCK_LENGTH; @@ -457,7 +457,7 @@ int32_t MutableCodePointTrie::getDataBlock(int32_t i) { } else { int32_t newBlock = allocDataBlock(UCPTRIE_SMALL_DATA_BLOCK_LENGTH); if (newBlock < 0) { return newBlock; } - umutablecptrie_writeBlock(data + newBlock, index[i]); + writeBlock(data + newBlock, index[i]); flags[i] = MIXED; index[i] = newBlock; return newBlock; @@ -1801,7 +1801,7 @@ umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c) { namespace { -UChar32 umutablecptrie_internal_getRange(const void *trie, UChar32 start, +UChar32 getRange(const void *trie, UChar32 start, UCPMapValueFilter *filter, const void *context, uint32_t *pValue) { return reinterpret_cast(trie)-> getRange(start, filter, context, pValue); @@ -1813,7 +1813,7 @@ U_CAPI UChar32 U_EXPORT2 umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start, UCPMapRangeOption option, uint32_t surrogateValue, UCPMapValueFilter *filter, const void *context, uint32_t *pValue) { - return ucptrie_internalGetRange(umutablecptrie_internal_getRange, trie, start, + return ucptrie_internalGetRange(getRange, trie, start, option, surrogateValue, filter, context, pValue); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/umutex.h b/src/duckdb/extension/icu/third_party/icu/common/umutex.h index 2503aa4a2..1b8332409 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/umutex.h +++ b/src/duckdb/extension/icu/third_party/icu/common/umutex.h @@ -71,7 +71,6 @@ U_NAMESPACE_BEGIN ****************************************************************************/ typedef std::atomic u_atomic_int32_t; -#define ATOMIC_INT32_T_INITIALIZER(val) ATOMIC_VAR_INIT(val) inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) { return var.load(std::memory_order_acquire); @@ -96,18 +95,15 @@ inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) { * *************************************************************************************************/ -struct UInitOnce { - u_atomic_int32_t fState; - UErrorCode fErrCode; +struct U_COMMON_API UInitOnce { + u_atomic_int32_t fState {0}; + UErrorCode fErrCode {U_ZERO_ERROR}; void reset() {fState = 0;} UBool isReset() {return umtx_loadAcquire(fState) == 0;} // Note: isReset() is used by service registration code. // Thread safety of this usage needs review. }; -#define U_INITONCE_INITIALIZER {ATOMIC_INT32_T_INITIALIZER(0), U_ZERO_ERROR} - - U_COMMON_API UBool U_EXPORT2 umtx_initImplPreInit(UInitOnce &); U_COMMON_API void U_EXPORT2 umtx_initImplPostInit(UInitOnce &); @@ -262,13 +258,13 @@ class U_COMMON_API UMutex { * the global ICU mutex. Recursive locks are an error * and may cause a deadlock on some platforms. */ -U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex); +U_CAPI void U_EXPORT2 umtx_lock(UMutex* mutex); /* Unlock a mutex. * @param mutex The given mutex to be unlocked. Pass NULL to specify * the global ICU mutex. */ -U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex); +U_CAPI void U_EXPORT2 umtx_unlock (UMutex* mutex); U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/unames.cpp b/src/duckdb/extension/icu/third_party/icu/common/unames.cpp index 1c9a6a03c..1b3192bf2 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unames.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unames.cpp @@ -35,8 +35,8 @@ U_NAMESPACE_BEGIN /* prototypes ------------------------------------------------------------- */ -static const char ICU_UNAMES_DATA_NAME[] = "unames"; -static const char ICU_UNAMES_DATA_TYPE[] = "icu"; +static const char DATA_NAME[] = "unames"; +static const char DATA_TYPE[] = "icu"; #define GROUP_SHIFT 5 #define LINES_PER_GROUP (1L<0) { if(!fn(context, start, nameChoice, buffer, length)) { - return FALSE; + return false; } } ++start; @@ -626,12 +626,12 @@ enumGroupNames(UCharNames *names, const uint16_t *group, while(start<=end) { if(compareName(names, s+offsets[start&GROUP_MASK], lengths[start&GROUP_MASK], nameChoice, otherName)) { ((FindName *)context)->code=start; - return FALSE; + return false; } ++start; } } - return TRUE; + return true; } /* @@ -639,7 +639,7 @@ enumGroupNames(UCharNames *names, const uint16_t *group, * It only needs to do it if it is called with a real function and not * with the dummy DO_FIND_NAME, because u_charFromName() does a check * for extended names by itself. - */ + */ static UBool enumExtNames(UChar32 start, UChar32 end, UEnumCharNamesFn *fn, void *context) @@ -647,20 +647,20 @@ enumExtNames(UChar32 start, UChar32 end, if(fn!=DO_FIND_NAME) { char buffer[200]; uint16_t length; - + while(start<=end) { buffer[length = getExtName(start, buffer, sizeof(buffer))] = 0; /* here, we assume that the buffer is large enough */ if(length>0) { if(!fn(context, start, U_EXTENDED_CHAR_NAME, buffer, length)) { - return FALSE; + return false; } } ++start; } } - return TRUE; + return true; } static UBool @@ -684,7 +684,7 @@ enumNames(UCharNames *names, extLimit=limit; } if(!enumExtNames(start, extLimit-1, fn, context)) { - return FALSE; + return false; } start=extLimit; } @@ -705,7 +705,7 @@ enumNames(UCharNames *names, if(!enumGroupNames(names, group, start, ((UChar32)startGroupMSB< group[GROUP_MSB] + 1 && nameChoice == U_EXTENDED_CHAR_NAME) { @@ -738,7 +738,7 @@ enumNames(UCharNames *names, end = limit; } if (!enumExtNames((group[GROUP_MSB] + 1) << GROUP_SHIFT, end - 1, fn, context)) { - return FALSE; + return false; } } group=nextGroup; @@ -753,7 +753,7 @@ enumNames(UCharNames *names, start = next; } } else { - return TRUE; + return true; } } @@ -765,8 +765,8 @@ enumNames(UCharNames *names, } return enumExtNames(start, limit - 1, fn, context); } - - return TRUE; + + return true; } static uint16_t @@ -801,7 +801,7 @@ writeFactorSuffix(const uint16_t *factors, uint16_t count, /* write each element */ for(;;) { - if(elementBases!=NULL) { + if(elementBases!=nullptr) { *elementBases++=s; } @@ -811,7 +811,7 @@ writeFactorSuffix(const uint16_t *factors, uint16_t count, while(*s++!=0) {} --factor; } - if(elements!=NULL) { + if(elements!=nullptr) { *elements++=s; } @@ -913,7 +913,7 @@ getAlgName(AlgorithmicRange *range, uint32_t code, UCharNameChoice nameChoice, } bufferPos+=writeFactorSuffix(factors, count, - s, code-range->start, indexes, NULL, NULL, buffer, bufferLength); + s, code-range->start, indexes, nullptr, nullptr, buffer, bufferLength); break; } default: @@ -941,7 +941,7 @@ enumAlgNames(AlgorithmicRange *range, uint16_t length; if(nameChoice!=U_UNICODE_CHAR_NAME && nameChoice!=U_EXTENDED_CHAR_NAME) { - return TRUE; + return true; } switch(range->type) { @@ -952,12 +952,12 @@ enumAlgNames(AlgorithmicRange *range, /* get the full name of the start character */ length=getAlgName(range, (uint32_t)start, nameChoice, buffer, sizeof(buffer)); if(length<=0) { - return TRUE; + return true; } /* call the enumerator function with this first character */ if(!fn(context, start, nameChoice, buffer, length)) { - return FALSE; + return false; } /* go to the end of the name; all these names have the same length */ @@ -984,7 +984,7 @@ enumAlgNames(AlgorithmicRange *range, } if(!fn(context, start, nameChoice, buffer, length)) { - return FALSE; + return false; } } break; @@ -1018,7 +1018,7 @@ enumAlgNames(AlgorithmicRange *range, /* call the enumerator function with this first character */ if(!fn(context, start, nameChoice, buffer, length)) { - return FALSE; + return false; } /* enumerate the rest of the names */ @@ -1056,7 +1056,7 @@ enumAlgNames(AlgorithmicRange *range, *t=0; if(!fn(context, start, nameChoice, buffer, length)) { - return FALSE; + return false; } } break; @@ -1066,7 +1066,7 @@ enumAlgNames(AlgorithmicRange *range, break; } - return TRUE; + return true; } /* @@ -1319,7 +1319,7 @@ calcNameSetLength(const uint16_t *tokens, uint16_t tokenCount, const uint8_t *to ++length; } else { /* count token word */ - if(tokenLengths!=NULL) { + if(tokenLengths!=nullptr) { /* use cached token length */ tokenLength=tokenLengths[c]; if(tokenLength==0) { @@ -1354,7 +1354,7 @@ calcGroupNameSetsLengths(int32_t maxNameLength) { int32_t groupCount, lineNumber, length; tokenLengths=(int8_t *)uprv_malloc(tokenCount); - if(tokenLengths!=NULL) { + if(tokenLengths!=nullptr) { uprv_memset(tokenLengths, 0, tokenCount); } @@ -1402,7 +1402,7 @@ calcGroupNameSetsLengths(int32_t maxNameLength) { --groupCount; } - if(tokenLengths!=NULL) { + if(tokenLengths!=nullptr) { uprv_free(tokenLengths); } @@ -1416,11 +1416,11 @@ calcNameSetsLengths(UErrorCode *pErrorCode) { int32_t i, maxNameLength; if(gMaxNameLength!=0) { - return TRUE; + return true; } if(!isDataLoaded(pErrorCode)) { - return FALSE; + return false; } /* set hex digits, used in various names, and <>-, used in extended names */ @@ -1437,7 +1437,7 @@ calcNameSetsLengths(UErrorCode *pErrorCode) { /* set sets and lengths from group names, set global maximum values */ calcGroupNameSetsLengths(maxNameLength); - return TRUE; + return true; } U_NAMESPACE_END @@ -1456,10 +1456,10 @@ u_charName(UChar32 code, UCharNameChoice nameChoice, int32_t length; /* check the argument values */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } else if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || - bufferLength<0 || (bufferLength>0 && buffer==NULL) + bufferLength<0 || (bufferLength>0 && buffer==nullptr) ) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; @@ -1505,9 +1505,9 @@ u_getISOComment(UChar32 /*c*/, char *dest, int32_t destCapacity, UErrorCode *pErrorCode) { /* check the argument values */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; - } else if(destCapacity<0 || (destCapacity>0 && dest==NULL)) { + } else if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1519,7 +1519,8 @@ U_CAPI UChar32 U_EXPORT2 u_charFromName(UCharNameChoice nameChoice, const char *name, UErrorCode *pErrorCode) { - char upper[120], lower[120]; + char upper[120] = {0}; + char lower[120] = {0}; FindName findName; AlgorithmicRange *algRange; uint32_t *p; @@ -1528,11 +1529,11 @@ u_charFromName(UCharNameChoice nameChoice, char c0; static constexpr UChar32 error = 0xffff; /* Undefined, but use this for backwards compatibility. */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return error; } - if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || name==NULL || *name==0) { + if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || name==nullptr || *name==0) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return error; } @@ -1640,11 +1641,11 @@ u_enumCharNames(UChar32 start, UChar32 limit, uint32_t *p; uint32_t i; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return; } - if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || fn==NULL) { + if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || fn==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -1715,7 +1716,7 @@ uprv_getMaxCharNameLength() { */ static void charSetToUSet(uint32_t cset[8], const USetAdder *sa) { - UChar us[256]; + char16_t us[256]; char cs[256]; int32_t i, length; @@ -1735,12 +1736,12 @@ charSetToUSet(uint32_t cset[8], const USetAdder *sa) { } } - /* convert the char string to a UChar string */ + /* convert the char string to a char16_t string */ u_charsToUChars(cs, us, length); - /* add each UChar to the USet */ + /* add each char16_t to the USet */ for(i=0; iadd(sa->set, us[i]); } } @@ -1808,7 +1809,7 @@ makeTokenMap(const UDataSwapper *ds, /* enter the converted character into the map and mark it used */ map[c1]=c2; - usedOutChar[c2]=TRUE; + usedOutChar[c2]=true; } } @@ -1849,7 +1850,7 @@ uchar_swapNames(const UDataSwapper *ds, /* udata_swapDataHeader checks the arguments */ headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode); - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } @@ -1871,7 +1872,7 @@ uchar_swapNames(const UDataSwapper *ds, } inBytes=(const uint8_t *)inData+headerSize; - outBytes=(uint8_t *)outData+headerSize; + outBytes=(outData == nullptr) ? nullptr : (uint8_t *)outData+headerSize; if(length<0) { algNamesOffset=ds->readUInt32(((const uint32_t *)inBytes)[3]); } else { @@ -1953,7 +1954,7 @@ uchar_swapNames(const UDataSwapper *ds, * go through a temporary array to support in-place swapping */ temp=(uint16_t *)uprv_malloc(tokenCount*2); - if(temp==NULL) { + if(temp==nullptr) { udata_printError(ds, "out of memory swapping %u unames.icu tokens\n", tokenCount); *pErrorCode=U_MEMORY_ALLOCATION_ERROR; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/appendable.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/appendable.h index 4beacaf65..0e37f4562 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/appendable.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/appendable.h @@ -45,7 +45,7 @@ class UnicodeString; * * The methods do not take UErrorCode parameters. * If an error occurs (e.g., out-of-memory), - * in addition to returning FALSE from failing operations, + * in addition to returning false from failing operations, * the implementation must prevent unexpected behavior (e.g., crashes) * from further calls and should make the error condition available separately * (e.g., store a UErrorCode, make/keep a UnicodeString bogus). @@ -62,7 +62,7 @@ class U_COMMON_API Appendable : public UObject { /** * Appends a 16-bit code unit. * @param c code unit - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendCodeUnit(char16_t c) = 0; @@ -71,7 +71,7 @@ class U_COMMON_API Appendable : public UObject { * Appends a code point. * The default implementation calls appendCodeUnit(char16_t) once or twice. * @param c code point 0..0x10ffff - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendCodePoint(UChar32 c); @@ -79,9 +79,9 @@ class U_COMMON_API Appendable : public UObject { /** * Appends a string. * The default implementation calls appendCodeUnit(char16_t) for each code unit. - * @param s string, must not be NULL if length!=0 + * @param s string, must not be nullptr if length!=0 * @param length string length, or -1 if NUL-terminated - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool appendString(const char16_t *s, int32_t length); @@ -90,9 +90,9 @@ class U_COMMON_API Appendable : public UObject { * Tells the object that the caller is going to append roughly * appendCapacity char16_ts. A subclass might use this to pre-allocate * a larger buffer if necessary. - * The default implementation does nothing. (It always returns TRUE.) + * The default implementation does nothing. (It always returns true.) * @param appendCapacity estimated number of char16_ts that will be appended - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ virtual UBool reserveAppendCapacity(int32_t appendCapacity); @@ -171,36 +171,36 @@ class U_COMMON_API UnicodeStringAppendable : public Appendable { /** * Appends a 16-bit code unit to the string. * @param c code unit - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ - virtual UBool appendCodeUnit(char16_t c); + virtual UBool appendCodeUnit(char16_t c) override; /** * Appends a code point to the string. * @param c code point 0..0x10ffff - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ - virtual UBool appendCodePoint(UChar32 c); + virtual UBool appendCodePoint(UChar32 c) override; /** * Appends a string to the UnicodeString. - * @param s string, must not be NULL if length!=0 + * @param s string, must not be nullptr if length!=0 * @param length string length, or -1 if NUL-terminated - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ - virtual UBool appendString(const char16_t *s, int32_t length); + virtual UBool appendString(const char16_t *s, int32_t length) override; /** * Tells the UnicodeString that the caller is going to append roughly * appendCapacity char16_ts. * @param appendCapacity estimated number of char16_ts that will be appended - * @return TRUE if the operation succeeded + * @return true if the operation succeeded * @stable ICU 4.8 */ - virtual UBool reserveAppendCapacity(int32_t appendCapacity); + virtual UBool reserveAppendCapacity(int32_t appendCapacity) override; /** * Returns a writable buffer for appending and writes the buffer's capacity to @@ -226,7 +226,7 @@ class U_COMMON_API UnicodeStringAppendable : public Appendable { virtual char16_t *getAppendBuffer(int32_t minCapacity, int32_t desiredCapacityHint, char16_t *scratch, int32_t scratchCapacity, - int32_t *resultCapacity); + int32_t *resultCapacity) override; private: UnicodeString &str; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/brkiter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/brkiter.h index 321d47b55..1b10e6ef1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/brkiter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/brkiter.h @@ -1,669 +1,671 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************** -// * Copyright (C) 1997-2016, International Business Machines -// * Corporation and others. All Rights Reserved. -// ******************************************************************************** -// * -// * File brkiter.h -// * -// * Modification History: -// * -// * Date Name Description -// * 02/18/97 aliu Added typedef for TextCount. Made DONE const. -// * 05/07/97 aliu Fixed DLL declaration. -// * 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK -// * 08/11/98 helena Sync-up JDK1.2. -// * 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods. -// ******************************************************************************** -// */ - -// #ifndef BRKITER_H -// #define BRKITER_H - -// #include "unicode/utypes.h" - -// /** -// * \file -// * \brief C++ API: Break Iterator. -// */ - -// #include "unicode/utypes.h" -// #include "unicode/uobject.h" -// #include "unicode/unistr.h" -// #include "unicode/chariter.h" -// #include "unicode/locid.h" -// #include "unicode/ubrk.h" -// #include "unicode/strenum.h" -// #include "unicode/utext.h" -// #include "unicode/umisc.h" - -// #if U_SHOW_CPLUSPLUS_API - -// #if UCONFIG_NO_BREAK_ITERATION - -// U_NAMESPACE_BEGIN - -// /* -// * Allow the declaration of APIs with pointers to BreakIterator -// * even when break iteration is removed from the build. -// */ -// class BreakIterator; - -// U_NAMESPACE_END - -// #else - -// U_NAMESPACE_BEGIN - -// /** -// * The BreakIterator class implements methods for finding the location -// * of boundaries in text. BreakIterator is an abstract base class. -// * Instances of BreakIterator maintain a current position and scan over -// * text returning the index of characters where boundaries occur. -// *

-// * Line boundary analysis determines where a text string can be broken -// * when line-wrapping. The mechanism correctly handles punctuation and -// * hyphenated words. -// *

-// * Sentence boundary analysis allows selection with correct -// * interpretation of periods within numbers and abbreviations, and -// * trailing punctuation marks such as quotation marks and parentheses. -// *

-// * Word boundary analysis is used by search and replace functions, as -// * well as within text editing applications that allow the user to -// * select words with a double click. Word selection provides correct -// * interpretation of punctuation marks within and following -// * words. Characters that are not part of a word, such as symbols or -// * punctuation marks, have word-breaks on both sides. -// *

-// * Character boundary analysis allows users to interact with -// * characters as they expect to, for example, when moving the cursor -// * through a text string. Character boundary analysis provides correct -// * navigation of through character strings, regardless of how the -// * character is stored. For example, an accented character might be -// * stored as a base character and a diacritical mark. What users -// * consider to be a character can differ between languages. -// *

-// * The text boundary positions are found according to the rules -// * described in Unicode Standard Annex #29, Text Boundaries, and -// * Unicode Standard Annex #14, Line Breaking Properties. These -// * are available at http://www.unicode.org/reports/tr14/ and -// * http://www.unicode.org/reports/tr29/. -// *

-// * In addition to the C++ API defined in this header file, a -// * plain C API with equivalent functionality is defined in the -// * file ubrk.h -// *

-// * Code snippets illustrating the use of the Break Iterator APIs -// * are available in the ICU User Guide, -// * http://icu-project.org/userguide/boundaryAnalysis.html -// * and in the sample program icu/source/samples/break/break.cpp -// * -// */ -// class U_COMMON_API BreakIterator : public UObject { -// public: -// /** -// * destructor -// * @stable ICU 2.0 -// */ -// virtual ~BreakIterator(); - -// /** -// * Return true if another object is semantically equal to this -// * one. The other object should be an instance of the same subclass of -// * BreakIterator. Objects of different subclasses are considered -// * unequal. -// *

-// * Return true if this BreakIterator is at the same position in the -// * same text, and is the same class and type (word, line, etc.) of -// * BreakIterator, as the argument. Text is considered the same if -// * it contains the same characters, it need not be the same -// * object, and styles are not considered. -// * @stable ICU 2.0 -// */ -// virtual bool operator==(const BreakIterator&) const = 0; - -// /** -// * Returns the complement of the result of operator== -// * @param rhs The BreakIterator to be compared for inequality -// * @return the complement of the result of operator== -// * @stable ICU 2.0 -// */ -// bool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); } - -// /** -// * Return a polymorphic copy of this object. This is an abstract -// * method which subclasses implement. -// * @stable ICU 2.0 -// */ -// virtual BreakIterator* clone() const = 0; - -// /** -// * Return a polymorphic class ID for this object. Different subclasses -// * will return distinct unequal values. -// * @stable ICU 2.0 -// */ -// virtual UClassID getDynamicClassID(void) const = 0; - -// /** -// * Return a CharacterIterator over the text being analyzed. -// * @stable ICU 2.0 -// */ -// virtual CharacterIterator& getText(void) const = 0; - - -// /** -// * Get a UText for the text being analyzed. -// * The returned UText is a shallow clone of the UText used internally -// * by the break iterator implementation. It can safely be used to -// * access the text without impacting any break iterator operations, -// * but the underlying text itself must not be altered. -// * -// * @param fillIn A UText to be filled in. If NULL, a new UText will be -// * allocated to hold the result. -// * @param status receives any error codes. -// * @return The current UText for this break iterator. If an input -// * UText was provided, it will always be returned. -// * @stable ICU 3.4 -// */ -// virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0; - -// /** -// * Change the text over which this operates. The text boundary is -// * reset to the start. -// * -// * The BreakIterator will retain a reference to the supplied string. -// * The caller must not modify or delete the text while the BreakIterator -// * retains the reference. -// * -// * @param text The UnicodeString used to change the text. -// * @stable ICU 2.0 -// */ -// virtual void setText(const UnicodeString &text) = 0; - -// /** -// * Reset the break iterator to operate over the text represented by -// * the UText. The iterator position is reset to the start. -// * -// * This function makes a shallow clone of the supplied UText. This means -// * that the caller is free to immediately close or otherwise reuse the -// * Utext that was passed as a parameter, but that the underlying text itself -// * must not be altered while being referenced by the break iterator. -// * -// * All index positions returned by break iterator functions are -// * native indices from the UText. For example, when breaking UTF-8 -// * encoded text, the break positions returned by next(), previous(), etc. -// * will be UTF-8 string indices, not UTF-16 positions. -// * -// * @param text The UText used to change the text. -// * @param status receives any error codes. -// * @stable ICU 3.4 -// */ -// virtual void setText(UText *text, UErrorCode &status) = 0; - -// /** -// * Change the text over which this operates. The text boundary is -// * reset to the start. -// * Note that setText(UText *) provides similar functionality to this function, -// * and is more efficient. -// * @param it The CharacterIterator used to change the text. -// * @stable ICU 2.0 -// */ -// virtual void adoptText(CharacterIterator* it) = 0; - -// enum { -// /** -// * DONE is returned by previous() and next() after all valid -// * boundaries have been returned. -// * @stable ICU 2.0 -// */ -// DONE = (int32_t)-1 -// }; - -// /** -// * Sets the current iteration position to the beginning of the text, position zero. -// * @return The offset of the beginning of the text, zero. -// * @stable ICU 2.0 -// */ -// virtual int32_t first(void) = 0; - -// /** -// * Set the iterator position to the index immediately BEYOND the last character in the text being scanned. -// * @return The index immediately BEYOND the last character in the text being scanned. -// * @stable ICU 2.0 -// */ -// virtual int32_t last(void) = 0; - -// /** -// * Set the iterator position to the boundary preceding the current boundary. -// * @return The character index of the previous text boundary or DONE if all -// * boundaries have been returned. -// * @stable ICU 2.0 -// */ -// virtual int32_t previous(void) = 0; - -// /** -// * Advance the iterator to the boundary following the current boundary. -// * @return The character index of the next text boundary or DONE if all -// * boundaries have been returned. -// * @stable ICU 2.0 -// */ -// virtual int32_t next(void) = 0; - -// /** -// * Return character index of the current iterator position within the text. -// * @return The boundary most recently returned. -// * @stable ICU 2.0 -// */ -// virtual int32_t current(void) const = 0; - -// /** -// * Advance the iterator to the first boundary following the specified offset. -// * The value returned is always greater than the offset or -// * the value BreakIterator.DONE -// * @param offset the offset to begin scanning. -// * @return The first boundary after the specified offset. -// * @stable ICU 2.0 -// */ -// virtual int32_t following(int32_t offset) = 0; - -// /** -// * Set the iterator position to the first boundary preceding the specified offset. -// * The value returned is always smaller than the offset or -// * the value BreakIterator.DONE -// * @param offset the offset to begin scanning. -// * @return The first boundary before the specified offset. -// * @stable ICU 2.0 -// */ -// virtual int32_t preceding(int32_t offset) = 0; - -// /** -// * Return true if the specified position is a boundary position. -// * As a side effect, the current position of the iterator is set -// * to the first boundary position at or following the specified offset. -// * @param offset the offset to check. -// * @return True if "offset" is a boundary position. -// * @stable ICU 2.0 -// */ -// virtual UBool isBoundary(int32_t offset) = 0; - -// /** -// * Set the iterator position to the nth boundary from the current boundary -// * @param n the number of boundaries to move by. A value of 0 -// * does nothing. Negative values move to previous boundaries -// * and positive values move to later boundaries. -// * @return The new iterator position, or -// * DONE if there are fewer than |n| boundaries in the specified direction. -// * @stable ICU 2.0 -// */ -// virtual int32_t next(int32_t n) = 0; - -// /** -// * For RuleBasedBreakIterators, return the status tag from the break rule -// * that determined the boundary at the current iteration position. -// *

-// * For break iterator types that do not support a rule status, -// * a default value of 0 is returned. -// *

-// * @return the status from the break rule that determined the boundary at -// * the current iteration position. -// * @see RuleBaseBreakIterator::getRuleStatus() -// * @see UWordBreak -// * @stable ICU 52 -// */ -// virtual int32_t getRuleStatus() const; - -// /** -// * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) -// * that determined the boundary at the current iteration position. -// *

-// * For break iterator types that do not support rule status, -// * no values are returned. -// *

-// * The returned status value(s) are stored into an array provided by the caller. -// * The values are stored in sorted (ascending) order. -// * If the capacity of the output array is insufficient to hold the data, -// * the output will be truncated to the available length, and a -// * U_BUFFER_OVERFLOW_ERROR will be signaled. -// *

-// * @see RuleBaseBreakIterator::getRuleStatusVec -// * -// * @param fillInVec an array to be filled in with the status values. -// * @param capacity the length of the supplied vector. A length of zero causes -// * the function to return the number of status values, in the -// * normal way, without attempting to store any values. -// * @param status receives error codes. -// * @return The number of rule status values from rules that determined -// * the boundary at the current iteration position. -// * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value -// * is the total number of status values that were available, -// * not the reduced number that were actually returned. -// * @see getRuleStatus -// * @stable ICU 52 -// */ -// virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); - -// /** -// * Create BreakIterator for word-breaks using the given locale. -// * Returns an instance of a BreakIterator implementing word breaks. -// * WordBreak is useful for word selection (ex. double click) -// * @param where the locale. -// * @param status the error code -// * @return A BreakIterator for word-breaks. The UErrorCode& status -// * parameter is used to return status information to the user. -// * To check whether the construction succeeded or not, you should check -// * the value of U_SUCCESS(err). If you wish more detailed information, you -// * can check for informational error results which still indicate success. -// * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For -// * example, 'de_CH' was requested, but nothing was found there, so 'de' was -// * used. U_USING_DEFAULT_WARNING indicates that the default locale data was -// * used; neither the requested locale nor any of its fall back locales -// * could be found. -// * The caller owns the returned object and is responsible for deleting it. -// * @stable ICU 2.0 -// */ -// static BreakIterator* U_EXPORT2 -// createWordInstance(const Locale& where, UErrorCode& status); - -// /** -// * Create BreakIterator for line-breaks using specified locale. -// * Returns an instance of a BreakIterator implementing line breaks. Line -// * breaks are logically possible line breaks, actual line breaks are -// * usually determined based on display width. -// * LineBreak is useful for word wrapping text. -// * @param where the locale. -// * @param status The error code. -// * @return A BreakIterator for line-breaks. The UErrorCode& status -// * parameter is used to return status information to the user. -// * To check whether the construction succeeded or not, you should check -// * the value of U_SUCCESS(err). If you wish more detailed information, you -// * can check for informational error results which still indicate success. -// * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For -// * example, 'de_CH' was requested, but nothing was found there, so 'de' was -// * used. U_USING_DEFAULT_WARNING indicates that the default locale data was -// * used; neither the requested locale nor any of its fall back locales -// * could be found. -// * The caller owns the returned object and is responsible for deleting it. -// * @stable ICU 2.0 -// */ -// static BreakIterator* U_EXPORT2 -// createLineInstance(const Locale& where, UErrorCode& status); - -// /** -// * Create BreakIterator for character-breaks using specified locale -// * Returns an instance of a BreakIterator implementing character breaks. -// * Character breaks are boundaries of combining character sequences. -// * @param where the locale. -// * @param status The error code. -// * @return A BreakIterator for character-breaks. The UErrorCode& status -// * parameter is used to return status information to the user. -// * To check whether the construction succeeded or not, you should check -// * the value of U_SUCCESS(err). If you wish more detailed information, you -// * can check for informational error results which still indicate success. -// * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For -// * example, 'de_CH' was requested, but nothing was found there, so 'de' was -// * used. U_USING_DEFAULT_WARNING indicates that the default locale data was -// * used; neither the requested locale nor any of its fall back locales -// * could be found. -// * The caller owns the returned object and is responsible for deleting it. -// * @stable ICU 2.0 -// */ -// static BreakIterator* U_EXPORT2 -// createCharacterInstance(const Locale& where, UErrorCode& status); - -// /** -// * Create BreakIterator for sentence-breaks using specified locale -// * Returns an instance of a BreakIterator implementing sentence breaks. -// * @param where the locale. -// * @param status The error code. -// * @return A BreakIterator for sentence-breaks. The UErrorCode& status -// * parameter is used to return status information to the user. -// * To check whether the construction succeeded or not, you should check -// * the value of U_SUCCESS(err). If you wish more detailed information, you -// * can check for informational error results which still indicate success. -// * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For -// * example, 'de_CH' was requested, but nothing was found there, so 'de' was -// * used. U_USING_DEFAULT_WARNING indicates that the default locale data was -// * used; neither the requested locale nor any of its fall back locales -// * could be found. -// * The caller owns the returned object and is responsible for deleting it. -// * @stable ICU 2.0 -// */ -// static BreakIterator* U_EXPORT2 -// createSentenceInstance(const Locale& where, UErrorCode& status); - -// #ifndef U_HIDE_DEPRECATED_API -// /** -// * Create BreakIterator for title-casing breaks using the specified locale -// * Returns an instance of a BreakIterator implementing title breaks. -// * The iterator returned locates title boundaries as described for -// * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, -// * please use a word boundary iterator. See {@link #createWordInstance }. -// * -// * @param where the locale. -// * @param status The error code. -// * @return A BreakIterator for title-breaks. The UErrorCode& status -// * parameter is used to return status information to the user. -// * To check whether the construction succeeded or not, you should check -// * the value of U_SUCCESS(err). If you wish more detailed information, you -// * can check for informational error results which still indicate success. -// * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For -// * example, 'de_CH' was requested, but nothing was found there, so 'de' was -// * used. U_USING_DEFAULT_WARNING indicates that the default locale data was -// * used; neither the requested locale nor any of its fall back locales -// * could be found. -// * The caller owns the returned object and is responsible for deleting it. -// * @deprecated ICU 64 Use createWordInstance instead. -// */ -// static BreakIterator* U_EXPORT2 -// createTitleInstance(const Locale& where, UErrorCode& status); -// #endif /* U_HIDE_DEPRECATED_API */ - -// /** -// * Get the set of Locales for which TextBoundaries are installed. -// *

Note: this will not return locales added through the register -// * call. To see the registered locales too, use the getAvailableLocales -// * function that returns a StringEnumeration object

-// * @param count the output parameter of number of elements in the locale list -// * @return available locales -// * @stable ICU 2.0 -// */ -// static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); - -// /** -// * Get name of the object for the desired Locale, in the desired language. -// * @param objectLocale must be from getAvailableLocales. -// * @param displayLocale specifies the desired locale for output. -// * @param name the fill-in parameter of the return value -// * Uses best match. -// * @return user-displayable name -// * @stable ICU 2.0 -// */ -// static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, -// const Locale& displayLocale, -// UnicodeString& name); - -// /** -// * Get name of the object for the desired Locale, in the language of the -// * default locale. -// * @param objectLocale must be from getMatchingLocales -// * @param name the fill-in parameter of the return value -// * @return user-displayable name -// * @stable ICU 2.0 -// */ -// static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, -// UnicodeString& name); - -// #ifndef U_FORCE_HIDE_DEPRECATED_API -// /** -// * Deprecated functionality. Use clone() instead. -// * -// * Thread safe client-buffer-based cloning operation -// * Do NOT call delete on a safeclone, since 'new' is not used to create it. -// * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. -// * If buffer is not large enough, new memory will be allocated. -// * @param BufferSize reference to size of allocated space. -// * If BufferSize == 0, a sufficient size for use in cloning will -// * be returned ('pre-flighting') -// * If BufferSize is not enough for a stack-based safe clone, -// * new memory will be allocated. -// * @param status to indicate whether the operation went on smoothly or there were errors -// * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were -// * necessary. -// * @return pointer to the new clone -// * -// * @deprecated ICU 52. Use clone() instead. -// */ -// virtual BreakIterator * createBufferClone(void *stackBuffer, -// int32_t &BufferSize, -// UErrorCode &status) = 0; -// #endif // U_FORCE_HIDE_DEPRECATED_API - -// #ifndef U_HIDE_DEPRECATED_API - -// /** -// * Determine whether the BreakIterator was created in user memory by -// * createBufferClone(), and thus should not be deleted. Such objects -// * must be closed by an explicit call to the destructor (not delete). -// * @deprecated ICU 52. Always delete the BreakIterator. -// */ -// inline UBool isBufferClone(void); - -// #endif /* U_HIDE_DEPRECATED_API */ - -// #if !UCONFIG_NO_SERVICE -// /** -// * Register a new break iterator of the indicated kind, to use in the given locale. -// * The break iterator will be adopted. Clones of the iterator will be returned -// * if a request for a break iterator of the given kind matches or falls back to -// * this locale. -// * Because ICU may choose to cache BreakIterators internally, this must -// * be called at application startup, prior to any calls to -// * BreakIterator::createXXXInstance to avoid undefined behavior. -// * @param toAdopt the BreakIterator instance to be adopted -// * @param locale the Locale for which this instance is to be registered -// * @param kind the type of iterator for which this instance is to be registered -// * @param status the in/out status code, no special meanings are assigned -// * @return a registry key that can be used to unregister this instance -// * @stable ICU 2.4 -// */ -// static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, -// const Locale& locale, -// UBreakIteratorType kind, -// UErrorCode& status); - -// /** -// * Unregister a previously-registered BreakIterator using the key returned from the -// * register call. Key becomes invalid after a successful call and should not be used again. -// * The BreakIterator corresponding to the key will be deleted. -// * Because ICU may choose to cache BreakIterators internally, this should -// * be called during application shutdown, after all calls to -// * BreakIterator::createXXXInstance to avoid undefined behavior. -// * @param key the registry key returned by a previous call to registerInstance -// * @param status the in/out status code, no special meanings are assigned -// * @return TRUE if the iterator for the key was successfully unregistered -// * @stable ICU 2.4 -// */ -// static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); - -// /** -// * Return a StringEnumeration over the locales available at the time of the call, -// * including registered locales. -// * @return a StringEnumeration over the locales available at the time of the call -// * @stable ICU 2.4 -// */ -// static StringEnumeration* U_EXPORT2 getAvailableLocales(void); -// #endif - -// /** -// * Returns the locale for this break iterator. Two flavors are available: valid and -// * actual locale. -// * @stable ICU 2.8 -// */ -// Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; - -// #ifndef U_HIDE_INTERNAL_API -// /** Get the locale for this break iterator object. You can choose between valid and actual locale. -// * @param type type of the locale we're looking for (valid or actual) -// * @param status error code for the operation -// * @return the locale -// * @internal -// */ -// const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; -// #endif /* U_HIDE_INTERNAL_API */ - -// /** -// * Set the subject text string upon which the break iterator is operating -// * without changing any other aspect of the matching state. -// * The new and previous text strings must have the same content. -// * -// * This function is intended for use in environments where ICU is operating on -// * strings that may move around in memory. It provides a mechanism for notifying -// * ICU that the string has been relocated, and providing a new UText to access the -// * string in its new position. -// * -// * Note that the break iterator implementation never copies the underlying text -// * of a string being processed, but always operates directly on the original text -// * provided by the user. Refreshing simply drops the references to the old text -// * and replaces them with references to the new. -// * -// * Caution: this function is normally used only by very specialized, -// * system-level code. One example use case is with garbage collection that moves -// * the text in memory. -// * -// * @param input The new (moved) text string. -// * @param status Receives errors detected by this function. -// * @return *this -// * -// * @stable ICU 49 -// */ -// virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0; - -// private: -// static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status); -// static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status); -// static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status); - -// friend class ICUBreakIteratorFactory; -// friend class ICUBreakIteratorService; - -// protected: -// // Do not enclose protected default/copy constructors with #ifndef U_HIDE_INTERNAL_API -// // or else the compiler will create a public ones. -// /** @internal */ -// BreakIterator(); -// /** @internal */ -// BreakIterator (const BreakIterator &other); -// #ifndef U_HIDE_INTERNAL_API -// /** @internal */ -// BreakIterator (const Locale& valid, const Locale &actual); -// /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */ -// BreakIterator &operator = (const BreakIterator &other); -// #endif /* U_HIDE_INTERNAL_API */ - -// private: - -// /** @internal (private) */ -// char actualLocale[ULOC_FULLNAME_CAPACITY]; -// char validLocale[ULOC_FULLNAME_CAPACITY]; -// }; - -// #ifndef U_HIDE_DEPRECATED_API - -// inline UBool BreakIterator::isBufferClone() -// { -// return FALSE; -// } - -// #endif /* U_HIDE_DEPRECATED_API */ - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ - -// #endif /* U_SHOW_CPLUSPLUS_API */ - -// #endif // BRKITER_H -// //eof +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File brkiter.h +* +* Modification History: +* +* Date Name Description +* 02/18/97 aliu Added typedef for TextCount. Made DONE const. +* 05/07/97 aliu Fixed DLL declaration. +* 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK +* 08/11/98 helena Sync-up JDK1.2. +* 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods. +******************************************************************************** +*/ + +#ifndef BRKITER_H +#define BRKITER_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Break Iterator. + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if UCONFIG_NO_BREAK_ITERATION + +U_NAMESPACE_BEGIN + +/* + * Allow the declaration of APIs with pointers to BreakIterator + * even when break iteration is removed from the build. + */ +class BreakIterator; + +U_NAMESPACE_END + +#else + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/chariter.h" +#include "unicode/locid.h" +#include "unicode/ubrk.h" +#include "unicode/strenum.h" +#include "unicode/utext.h" +#include "unicode/umisc.h" + +U_NAMESPACE_BEGIN + +/** + * The BreakIterator class implements methods for finding the location + * of boundaries in text. BreakIterator is an abstract base class. + * Instances of BreakIterator maintain a current position and scan over + * text returning the index of characters where boundaries occur. + *

+ * Line boundary analysis determines where a text string can be broken + * when line-wrapping. The mechanism correctly handles punctuation and + * hyphenated words. + *

+ * Sentence boundary analysis allows selection with correct + * interpretation of periods within numbers and abbreviations, and + * trailing punctuation marks such as quotation marks and parentheses. + *

+ * Word boundary analysis is used by search and replace functions, as + * well as within text editing applications that allow the user to + * select words with a double click. Word selection provides correct + * interpretation of punctuation marks within and following + * words. Characters that are not part of a word, such as symbols or + * punctuation marks, have word-breaks on both sides. + *

+ * Character boundary analysis allows users to interact with + * characters as they expect to, for example, when moving the cursor + * through a text string. Character boundary analysis provides correct + * navigation of through character strings, regardless of how the + * character is stored. For example, an accented character might be + * stored as a base character and a diacritical mark. What users + * consider to be a character can differ between languages. + *

+ * The text boundary positions are found according to the rules + * described in Unicode Standard Annex #29, Text Boundaries, and + * Unicode Standard Annex #14, Line Breaking Properties. These + * are available at http://www.unicode.org/reports/tr14/ and + * http://www.unicode.org/reports/tr29/. + *

+ * In addition to the C++ API defined in this header file, a + * plain C API with equivalent functionality is defined in the + * file ubrk.h + *

+ * Code snippets illustrating the use of the Break Iterator APIs + * are available in the ICU User Guide, + * https://unicode-org.github.io/icu/userguide/boundaryanalysis/ + * and in the sample program icu/source/samples/break/break.cpp + * + */ +class U_COMMON_API BreakIterator : public UObject { +public: + /** + * destructor + * @stable ICU 2.0 + */ + virtual ~BreakIterator(); + + /** + * Return true if another object is semantically equal to this + * one. The other object should be an instance of the same subclass of + * BreakIterator. Objects of different subclasses are considered + * unequal. + *

+ * Return true if this BreakIterator is at the same position in the + * same text, and is the same class and type (word, line, etc.) of + * BreakIterator, as the argument. Text is considered the same if + * it contains the same characters, it need not be the same + * object, and styles are not considered. + * @stable ICU 2.0 + */ + virtual bool operator==(const BreakIterator&) const = 0; + + /** + * Returns the complement of the result of operator== + * @param rhs The BreakIterator to be compared for inequality + * @return the complement of the result of operator== + * @stable ICU 2.0 + */ + bool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); } + + /** + * Return a polymorphic copy of this object. This is an abstract + * method which subclasses implement. + * @stable ICU 2.0 + */ + virtual BreakIterator* clone() const = 0; + + /** + * Return a polymorphic class ID for this object. Different subclasses + * will return distinct unequal values. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const override = 0; + + /** + * Return a CharacterIterator over the text being analyzed. + * @stable ICU 2.0 + */ + virtual CharacterIterator& getText(void) const = 0; + + + /** + * Get a UText for the text being analyzed. + * The returned UText is a shallow clone of the UText used internally + * by the break iterator implementation. It can safely be used to + * access the text without impacting any break iterator operations, + * but the underlying text itself must not be altered. + * + * @param fillIn A UText to be filled in. If nullptr, a new UText will be + * allocated to hold the result. + * @param status receives any error codes. + * @return The current UText for this break iterator. If an input + * UText was provided, it will always be returned. + * @stable ICU 3.4 + */ + virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0; + + /** + * Change the text over which this operates. The text boundary is + * reset to the start. + * + * The BreakIterator will retain a reference to the supplied string. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param text The UnicodeString used to change the text. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString &text) = 0; + + /** + * Reset the break iterator to operate over the text represented by + * the UText. The iterator position is reset to the start. + * + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * Utext that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * + * All index positions returned by break iterator functions are + * native indices from the UText. For example, when breaking UTF-8 + * encoded text, the break positions returned by next(), previous(), etc. + * will be UTF-8 string indices, not UTF-16 positions. + * + * @param text The UText used to change the text. + * @param status receives any error codes. + * @stable ICU 3.4 + */ + virtual void setText(UText *text, UErrorCode &status) = 0; + + /** + * Change the text over which this operates. The text boundary is + * reset to the start. + * Note that setText(UText *) provides similar functionality to this function, + * and is more efficient. + * @param it The CharacterIterator used to change the text. + * @stable ICU 2.0 + */ + virtual void adoptText(CharacterIterator* it) = 0; + + enum { + /** + * DONE is returned by previous() and next() after all valid + * boundaries have been returned. + * @stable ICU 2.0 + */ + DONE = (int32_t)-1 + }; + + /** + * Sets the current iteration position to the beginning of the text, position zero. + * @return The offset of the beginning of the text, zero. + * @stable ICU 2.0 + */ + virtual int32_t first(void) = 0; + + /** + * Set the iterator position to the index immediately BEYOND the last character in the text being scanned. + * @return The index immediately BEYOND the last character in the text being scanned. + * @stable ICU 2.0 + */ + virtual int32_t last(void) = 0; + + /** + * Set the iterator position to the boundary preceding the current boundary. + * @return The character index of the previous text boundary or DONE if all + * boundaries have been returned. + * @stable ICU 2.0 + */ + virtual int32_t previous(void) = 0; + + /** + * Advance the iterator to the boundary following the current boundary. + * @return The character index of the next text boundary or DONE if all + * boundaries have been returned. + * @stable ICU 2.0 + */ + virtual int32_t next(void) = 0; + + /** + * Return character index of the current iterator position within the text. + * @return The boundary most recently returned. + * @stable ICU 2.0 + */ + virtual int32_t current(void) const = 0; + + /** + * Advance the iterator to the first boundary following the specified offset. + * The value returned is always greater than the offset or + * the value BreakIterator.DONE + * @param offset the offset to begin scanning. + * @return The first boundary after the specified offset. + * @stable ICU 2.0 + */ + virtual int32_t following(int32_t offset) = 0; + + /** + * Set the iterator position to the first boundary preceding the specified offset. + * The value returned is always smaller than the offset or + * the value BreakIterator.DONE + * @param offset the offset to begin scanning. + * @return The first boundary before the specified offset. + * @stable ICU 2.0 + */ + virtual int32_t preceding(int32_t offset) = 0; + + /** + * Return true if the specified position is a boundary position. + * As a side effect, the current position of the iterator is set + * to the first boundary position at or following the specified offset. + * @param offset the offset to check. + * @return True if "offset" is a boundary position. + * @stable ICU 2.0 + */ + virtual UBool isBoundary(int32_t offset) = 0; + + /** + * Set the iterator position to the nth boundary from the current boundary + * @param n the number of boundaries to move by. A value of 0 + * does nothing. Negative values move to previous boundaries + * and positive values move to later boundaries. + * @return The new iterator position, or + * DONE if there are fewer than |n| boundaries in the specified direction. + * @stable ICU 2.0 + */ + virtual int32_t next(int32_t n) = 0; + + /** + * For RuleBasedBreakIterators, return the status tag from the break rule + * that determined the boundary at the current iteration position. + *

+ * For break iterator types that do not support a rule status, + * a default value of 0 is returned. + *

+ * @return the status from the break rule that determined the boundary at + * the current iteration position. + * @see RuleBaseBreakIterator::getRuleStatus() + * @see UWordBreak + * @stable ICU 52 + */ + virtual int32_t getRuleStatus() const; + + /** + * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) + * that determined the boundary at the current iteration position. + *

+ * For break iterator types that do not support rule status, + * no values are returned. + *

+ * The returned status value(s) are stored into an array provided by the caller. + * The values are stored in sorted (ascending) order. + * If the capacity of the output array is insufficient to hold the data, + * the output will be truncated to the available length, and a + * U_BUFFER_OVERFLOW_ERROR will be signaled. + *

+ * @see RuleBaseBreakIterator::getRuleStatusVec + * + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attempting to store any values. + * @param status receives error codes. + * @return The number of rule status values from rules that determined + * the boundary at the current iteration position. + * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value + * is the total number of status values that were available, + * not the reduced number that were actually returned. + * @see getRuleStatus + * @stable ICU 52 + */ + virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); + + /** + * Create BreakIterator for word-breaks using the given locale. + * Returns an instance of a BreakIterator implementing word breaks. + * WordBreak is useful for word selection (ex. double click) + * @param where the locale. + * @param status the error code + * @return A BreakIterator for word-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createWordInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for line-breaks using specified locale. + * Returns an instance of a BreakIterator implementing line breaks. Line + * breaks are logically possible line breaks, actual line breaks are + * usually determined based on display width. + * LineBreak is useful for word wrapping text. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for line-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createLineInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for character-breaks using specified locale + * Returns an instance of a BreakIterator implementing character breaks. + * Character breaks are boundaries of combining character sequences. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for character-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createCharacterInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for sentence-breaks using specified locale + * Returns an instance of a BreakIterator implementing sentence breaks. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for sentence-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createSentenceInstance(const Locale& where, UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Create BreakIterator for title-casing breaks using the specified locale + * Returns an instance of a BreakIterator implementing title breaks. + * The iterator returned locates title boundaries as described for + * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, + * please use a word boundary iterator. See {@link #createWordInstance }. + * + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for title-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @deprecated ICU 64 Use createWordInstance instead. + */ + static BreakIterator* U_EXPORT2 + createTitleInstance(const Locale& where, UErrorCode& status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Get the set of Locales for which TextBoundaries are installed. + *

Note: this will not return locales added through the register + * call. To see the registered locales too, use the getAvailableLocales + * function that returns a StringEnumeration object

+ * @param count the output parameter of number of elements in the locale list + * @return available locales + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + /** + * Get name of the object for the desired Locale, in the desired language. + * @param objectLocale must be from getAvailableLocales. + * @param displayLocale specifies the desired locale for output. + * @param name the fill-in parameter of the return value + * Uses best match. + * @return user-displayable name + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + const Locale& displayLocale, + UnicodeString& name); + + /** + * Get name of the object for the desired Locale, in the language of the + * default locale. + * @param objectLocale must be from getMatchingLocales + * @param name the fill-in parameter of the return value + * @return user-displayable name + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + UnicodeString& name); + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * Deprecated functionality. Use clone() instead. + * + * Thread safe client-buffer-based cloning operation + * Do NOT call delete on a safeclone, since 'new' is not used to create it. + * @param stackBuffer user allocated space for the new clone. If nullptr new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * @param BufferSize reference to size of allocated space. + * If BufferSize == 0, a sufficient size for use in cloning will + * be returned ('pre-flighting') + * If BufferSize is not enough for a stack-based safe clone, + * new memory will be allocated. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were + * necessary. + * @return pointer to the new clone + * + * @deprecated ICU 52. Use clone() instead. + */ + virtual BreakIterator * createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status) = 0; +#endif // U_FORCE_HIDE_DEPRECATED_API + +#ifndef U_HIDE_DEPRECATED_API + + /** + * Determine whether the BreakIterator was created in user memory by + * createBufferClone(), and thus should not be deleted. Such objects + * must be closed by an explicit call to the destructor (not delete). + * @deprecated ICU 52. Always delete the BreakIterator. + */ + inline UBool isBufferClone(void); + +#endif /* U_HIDE_DEPRECATED_API */ + +#if !UCONFIG_NO_SERVICE + /** + * Register a new break iterator of the indicated kind, to use in the given locale. + * The break iterator will be adopted. Clones of the iterator will be returned + * if a request for a break iterator of the given kind matches or falls back to + * this locale. + * Because ICU may choose to cache BreakIterators internally, this must + * be called at application startup, prior to any calls to + * BreakIterator::createXXXInstance to avoid undefined behavior. + * @param toAdopt the BreakIterator instance to be adopted + * @param locale the Locale for which this instance is to be registered + * @param kind the type of iterator for which this instance is to be registered + * @param status the in/out status code, no special meanings are assigned + * @return a registry key that can be used to unregister this instance + * @stable ICU 2.4 + */ + static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, + const Locale& locale, + UBreakIteratorType kind, + UErrorCode& status); + + /** + * Unregister a previously-registered BreakIterator using the key returned from the + * register call. Key becomes invalid after a successful call and should not be used again. + * The BreakIterator corresponding to the key will be deleted. + * Because ICU may choose to cache BreakIterators internally, this should + * be called during application shutdown, after all calls to + * BreakIterator::createXXXInstance to avoid undefined behavior. + * @param key the registry key returned by a previous call to registerInstance + * @param status the in/out status code, no special meanings are assigned + * @return true if the iterator for the key was successfully unregistered + * @stable ICU 2.4 + */ + static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); + + /** + * Return a StringEnumeration over the locales available at the time of the call, + * including registered locales. + * @return a StringEnumeration over the locales available at the time of the call + * @stable ICU 2.4 + */ + static StringEnumeration* U_EXPORT2 getAvailableLocales(void); +#endif + + /** + * Returns the locale for this break iterator. Two flavors are available: valid and + * actual locale. + * @stable ICU 2.8 + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + +#ifndef U_HIDE_INTERNAL_API + /** Get the locale for this break iterator object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale + * @internal + */ + const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator implementation never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized, + * system-level code. One example use case is with garbage collection that moves + * the text in memory. + * + * @param input The new (moved) text string. + * @param status Receives errors detected by this function. + * @return *this + * + * @stable ICU 49 + */ + virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0; + + private: + static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status); + static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status); + static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status); + + friend class ICUBreakIteratorFactory; + friend class ICUBreakIteratorService; + +protected: + // Do not enclose protected default/copy constructors with #ifndef U_HIDE_INTERNAL_API + // or else the compiler will create a public ones. + /** @internal */ + BreakIterator(); + /** @internal */ + BreakIterator (const BreakIterator &other); +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + BreakIterator (const Locale& valid, const Locale &actual); + /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */ + BreakIterator &operator = (const BreakIterator &other); +#endif /* U_HIDE_INTERNAL_API */ + +private: + + /** @internal (private) */ + char actualLocale[ULOC_FULLNAME_CAPACITY]; + char validLocale[ULOC_FULLNAME_CAPACITY]; + char requestLocale[ULOC_FULLNAME_CAPACITY]; +}; + +#ifndef U_HIDE_DEPRECATED_API + +inline UBool BreakIterator::isBufferClone() +{ + return false; +} + +#endif /* U_HIDE_DEPRECATED_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // BRKITER_H +//eof diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestream.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestream.h index 0d60492fe..997746e42 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestream.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestream.h @@ -71,6 +71,38 @@ class U_COMMON_API ByteSink : public UMemory { */ virtual void Append(const char* bytes, int32_t n) = 0; + /** + * Appends n bytes to this. Same as Append(). + * Call AppendU8() with u8"string literals" which are const char * in C++11 + * but const char8_t * in C++20. + * If the compiler does support char8_t as a distinct type, + * then an AppendU8() overload for that is defined and will be chosen. + * + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 67 + */ + inline void AppendU8(const char* bytes, int32_t n) { + Append(bytes, n); + } + +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Appends n bytes to this. Same as Append() but for a const char8_t * pointer. + * Call AppendU8() with u8"string literals" which are const char * in C++11 + * but const char8_t * in C++20. + * If the compiler does support char8_t as a distinct type, + * then this AppendU8() overload for that is defined and will be chosen. + * + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 67 + */ + inline void AppendU8(const char8_t* bytes, int32_t n) { + Append(reinterpret_cast(bytes), n); + } +#endif + /** * Returns a writable buffer for appending and writes the buffer's capacity to * *result_capacity. Guarantees *result_capacity>=min_capacity. @@ -163,7 +195,7 @@ class U_COMMON_API CheckedArrayByteSink : public ByteSink { * Returns the sink to its original state, without modifying the buffer. * Useful for reusing both the buffer and the sink for multiple streams. * Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 - * and Overflowed()=FALSE. + * and Overflowed()=false. * @return *this * @stable ICU 4.6 */ @@ -174,7 +206,7 @@ class U_COMMON_API CheckedArrayByteSink : public ByteSink { * @param n the number of bytes; must be non-negative * @stable ICU 4.2 */ - virtual void Append(const char* bytes, int32_t n); + virtual void Append(const char* bytes, int32_t n) override; /** * Returns a writable buffer for appending and writes the buffer's capacity to * *result_capacity. For details see the base class documentation. @@ -192,7 +224,7 @@ class U_COMMON_API CheckedArrayByteSink : public ByteSink { virtual char* GetAppendBuffer(int32_t min_capacity, int32_t desired_capacity_hint, char* scratch, int32_t scratch_capacity, - int32_t* result_capacity); + int32_t* result_capacity) override; /** * Returns the number of bytes actually written to the sink. * @return number of bytes written to the buffer @@ -202,7 +234,7 @@ class U_COMMON_API CheckedArrayByteSink : public ByteSink { /** * Returns true if any bytes were discarded, i.e., if there was an * attempt to write more than 'capacity' bytes. - * @return TRUE if more than 'capacity' bytes were Append()ed + * @return true if more than 'capacity' bytes were Append()ed * @stable ICU 4.2 */ UBool Overflowed() const { return overflowed_; } @@ -259,7 +291,7 @@ class StringByteSink : public ByteSink { * @param n the number of bytes; must be non-negative * @stable ICU 4.2 */ - virtual void Append(const char* data, int32_t n) { dest_->append(data, n); } + virtual void Append(const char* data, int32_t n) override { dest_->append(data, n); } private: StringClass* dest_; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestrie.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestrie.h index 51405f64a..1719a6bb8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestrie.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestrie.h @@ -30,6 +30,8 @@ #include "unicode/uobject.h" #include "unicode/ustringtrie.h" +class BytesTrieTest; + U_NAMESPACE_BEGIN class ByteSink; @@ -67,7 +69,7 @@ class U_COMMON_API BytesTrie : public UMemory { * @stable ICU 4.8 */ BytesTrie(const void *trieBytes) - : ownedArray_(NULL), bytes_(static_cast(trieBytes)), + : ownedArray_(nullptr), bytes_(static_cast(trieBytes)), pos_(bytes_), remainingMatchLength_(-1) {} /** @@ -83,7 +85,7 @@ class U_COMMON_API BytesTrie : public UMemory { * @stable ICU 4.8 */ BytesTrie(const BytesTrie &other) - : ownedArray_(NULL), bytes_(other.bytes_), + : ownedArray_(nullptr), bytes_(other.bytes_), pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {} /** @@ -97,14 +99,13 @@ class U_COMMON_API BytesTrie : public UMemory { return *this; } -#ifndef U_HIDE_DRAFT_API /** * Returns the state of this trie as a 64-bit integer. * The state value is never 0. * * @return opaque state value * @see resetToState64 - * @draft ICU 65 + * @stable ICU 65 */ uint64_t getState64() const { return (static_cast(remainingMatchLength_ + 2) << kState64RemainingShift) | @@ -123,14 +124,13 @@ class U_COMMON_API BytesTrie : public UMemory { * @see getState64 * @see resetToState * @see reset - * @draft ICU 65 + * @stable ICU 65 */ BytesTrie &resetToState64(uint64_t state) { remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2; pos_ = bytes_ + (state & kState64PosMask); return *this; } -#endif /* U_HIDE_DRAFT_API */ /** * BytesTrie state object, for saving a trie's current state @@ -143,7 +143,7 @@ class U_COMMON_API BytesTrie : public UMemory { * Constructs an empty State. * @stable ICU 4.8 */ - State() { bytes=NULL; } + State() { bytes=nullptr; } private: friend class BytesTrie; @@ -177,7 +177,7 @@ class U_COMMON_API BytesTrie : public UMemory { * @stable ICU 4.8 */ BytesTrie &resetToState(const State &state) { - if(bytes_==state.bytes && bytes_!=NULL) { + if(bytes_==state.bytes && bytes_!=nullptr) { pos_=state.pos; remainingMatchLength_=state.remainingMatchLength; } @@ -227,7 +227,7 @@ class U_COMMON_API BytesTrie : public UMemory { * result=next(c); * return result; * \endcode - * @param s A string or byte sequence. Can be NULL if length is 0. + * @param s A string or byte sequence. Can be nullptr if length is 0. * @param length The length of the byte sequence. Can be -1 if NUL-terminated. * @return The match/value Result. * @stable ICU 4.8 @@ -253,16 +253,16 @@ class U_COMMON_API BytesTrie : public UMemory { /** * Determines whether all byte sequences reachable from the current state * map to the same value. - * @param uniqueValue Receives the unique value, if this function returns TRUE. + * @param uniqueValue Receives the unique value, if this function returns true. * (output-only) - * @return TRUE if all byte sequences reachable from the current state + * @return true if all byte sequences reachable from the current state * map to the same value. * @stable ICU 4.8 */ inline UBool hasUniqueValue(int32_t &uniqueValue) const { const uint8_t *pos=pos_; // Skip the rest of a pending linear-match node. - return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); + return pos!=nullptr && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue); } /** @@ -321,7 +321,7 @@ class U_COMMON_API BytesTrie : public UMemory { Iterator &reset(); /** - * @return TRUE if there are more elements. + * @return true if there are more elements. * @stable ICU 4.8 */ UBool hasNext() const; @@ -337,7 +337,7 @@ class U_COMMON_API BytesTrie : public UMemory { * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) - * @return TRUE if there is another element. + * @return true if there is another element. * @stable ICU 4.8 */ UBool next(UErrorCode &errorCode); @@ -380,6 +380,7 @@ class U_COMMON_API BytesTrie : public UMemory { private: friend class BytesTrieBuilder; + friend class ::BytesTrieTest; /** * Constructs a BytesTrie reader instance. @@ -393,10 +394,10 @@ class U_COMMON_API BytesTrie : public UMemory { pos_(bytes_), remainingMatchLength_(-1) {} // No assignment operator. - BytesTrie &operator=(const BytesTrie &other); + BytesTrie &operator=(const BytesTrie &other) = delete; inline void stop() { - pos_=NULL; + pos_=nullptr; } // Reads a compact 32-bit integer. @@ -554,7 +555,7 @@ class U_COMMON_API BytesTrie : public UMemory { // Iterator variables. - // Pointer to next trie byte to read. NULL if no more matches. + // Pointer to next trie byte to read. nullptr if no more matches. const uint8_t *pos_; // Remaining length of a linear-match node, minus 1. Negative if not in such a node. int32_t remainingMatchLength_; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestriebuilder.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestriebuilder.h index 67dbbf74c..ec9c62547 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestriebuilder.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/bytestriebuilder.h @@ -30,6 +30,8 @@ #include "unicode/stringpiece.h" #include "unicode/stringtriebuilder.h" +class BytesTrieTest; + U_NAMESPACE_BEGIN class BytesTrieElement; @@ -101,9 +103,10 @@ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { * Multiple calls to buildStringPiece() return StringPieces referring to the * builder's same byte array, without rebuilding. * If buildStringPiece() is called after build(), the trie will be - * re-serialized into a new array. - * If build() is called after buildStringPiece(), the trie object will become - * the owner of the previously returned array. + * re-serialized into a new array (because build() passes on ownership). + * If build() is called after buildStringPiece(), the trie object returned + * by build() will become the owner of the underlying string for the + * previously returned StringPiece. * After clear() has been called, a new array will be used as well. * @param buildOption Build option, see UStringTrieBuildOption. * @param errorCode Standard ICU error code. Its input value must @@ -124,26 +127,28 @@ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { BytesTrieBuilder &clear(); private: - BytesTrieBuilder(const BytesTrieBuilder &other); // no copy constructor - BytesTrieBuilder &operator=(const BytesTrieBuilder &other); // no assignment operator + friend class ::BytesTrieTest; + + BytesTrieBuilder(const BytesTrieBuilder &other) = delete; // no copy constructor + BytesTrieBuilder &operator=(const BytesTrieBuilder &other) = delete; // no assignment operator void buildBytes(UStringTrieBuildOption buildOption, UErrorCode &errorCode); - virtual int32_t getElementStringLength(int32_t i) const; - virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const; - virtual int32_t getElementValue(int32_t i) const; + virtual int32_t getElementStringLength(int32_t i) const override; + virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const override; + virtual int32_t getElementValue(int32_t i) const override; - virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex) const; + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex) const override; - virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex) const; - virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const; - virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const; + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex) const override; + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const override; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const override; - virtual UBool matchNodesCanHaveValues() const { return FALSE; } + virtual UBool matchNodesCanHaveValues() const override { return false; } - virtual int32_t getMaxBranchLinearSubNodeLength() const { return BytesTrie::kMaxBranchLinearSubNodeLength; } - virtual int32_t getMinLinearMatch() const { return BytesTrie::kMinLinearMatch; } - virtual int32_t getMaxLinearMatchLength() const { return BytesTrie::kMaxLinearMatchLength; } + virtual int32_t getMaxBranchLinearSubNodeLength() const override { return BytesTrie::kMaxBranchLinearSubNodeLength; } + virtual int32_t getMinLinearMatch() const override { return BytesTrie::kMinLinearMatch; } + virtual int32_t getMaxLinearMatchLength() const override { return BytesTrie::kMaxLinearMatchLength; } /** * @internal (private) @@ -151,22 +156,23 @@ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { class BTLinearMatchNode : public LinearMatchNode { public: BTLinearMatchNode(const char *units, int32_t len, Node *nextNode); - virtual bool operator==(const Node &other) const; - virtual void write(StringTrieBuilder &builder); + virtual bool operator==(const Node &other) const override; + virtual void write(StringTrieBuilder &builder) override; private: const char *s; }; virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length, - Node *nextNode) const; + Node *nextNode) const override; UBool ensureCapacity(int32_t length); - virtual int32_t write(int32_t byte); + virtual int32_t write(int32_t byte) override; int32_t write(const char *b, int32_t length); - virtual int32_t writeElementUnits(int32_t i, int32_t byteIndex, int32_t length); - virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); - virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); - virtual int32_t writeDeltaTo(int32_t jumpTarget); + virtual int32_t writeElementUnits(int32_t i, int32_t byteIndex, int32_t length) override; + virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal) override; + virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node) override; + virtual int32_t writeDeltaTo(int32_t jumpTarget) override; + static int32_t internalEncodeDelta(int32_t i, char intBytes[]); CharString *strings; // Pointer not object so we need not #include internal charstr.h. BytesTrieElement *elements; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/caniter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/caniter.h index 13e524ff6..035bd0e64 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/caniter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/caniter.h @@ -25,11 +25,11 @@ */ /** Should permutation skip characters with combining class zero - * Should be either TRUE or FALSE. This is a compile time option + * Should be either true or false. This is a compile time option * @stable ICU 2.4 */ #ifndef CANITER_SKIP_ZEROES -#define CANITER_SKIP_ZEROES TRUE +#define CANITER_SKIP_ZEROES true #endif U_NAMESPACE_BEGIN @@ -73,7 +73,7 @@ Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMB * @author C++ port by V. Weinstein * @stable ICU 2.4 */ -class U_COMMON_API CanonicalIterator U_FINAL : public UObject { +class U_COMMON_API CanonicalIterator final : public UObject { public: /** * Construct a CanonicalIterator object @@ -145,25 +145,25 @@ class U_COMMON_API CanonicalIterator U_FINAL : public UObject { * * @stable ICU 2.2 */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; private: // ===================== PRIVATES ============================== // private default constructor - CanonicalIterator(); + CanonicalIterator() = delete; /** * Copy constructor. Private for now. * @internal (private) */ - CanonicalIterator(const CanonicalIterator& other); + CanonicalIterator(const CanonicalIterator& other) = delete; /** * Assignment operator. Private for now. * @internal (private) */ - CanonicalIterator& operator=(const CanonicalIterator& other); + CanonicalIterator& operator=(const CanonicalIterator& other) = delete; // fields UnicodeString source; @@ -194,7 +194,7 @@ class U_COMMON_API CanonicalIterator U_FINAL : public UObject { /** * See if the decomposition of cp2 is at segment starting at segmentPos - * (with canonical rearrangment!) + * (with canonical rearrangement!) * If so, take the remainder, and return the equivalents */ //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/casemap.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/casemap.h index 53af84fa7..eca7cbf80 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/casemap.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/casemap.h @@ -30,7 +30,7 @@ class Edits; * * @stable ICU 59 */ -class U_COMMON_API CaseMap U_FINAL : public UMemory { +class U_COMMON_API CaseMap final : public UMemory { public: /** * Lowercases a UTF-16 string and optionally records edits. @@ -38,7 +38,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. @@ -46,13 +46,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. @@ -74,7 +74,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. @@ -82,13 +82,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. @@ -116,7 +116,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * that are to be titlecased. It titlecases those characters and lowercases * all others. (This can be modified with options bits.) * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, * U_TITLECASE_NO_LOWERCASE, * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, @@ -124,7 +124,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * @param iter A break iterator to find the first characters of words that are to be titlecased. * It is set to the source string (setText()) * and used one or more times for iteration (first() and next()). - * If NULL, then a word break iterator for the locale is used + * If nullptr, then a word break iterator for the locale is used * (or something equivalent). * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. @@ -132,13 +132,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. @@ -175,13 +175,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. @@ -202,7 +202,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. * @param src The original string. * @param sink A ByteSink to which the result string is written. @@ -211,7 +211,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @@ -228,7 +228,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. * @param src The original string. * @param sink A ByteSink to which the result string is written. @@ -237,7 +237,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @@ -260,7 +260,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * that are to be titlecased. It titlecases those characters and lowercases * all others. (This can be modified with options bits.) * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, * U_TITLECASE_NO_LOWERCASE, * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, @@ -268,7 +268,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * @param iter A break iterator to find the first characters of words that are to be titlecased. * It is set to the source string (setUText()) * and used one or more times for iteration (first() and next()). - * If NULL, then a word break iterator for the locale is used + * If nullptr, then a word break iterator for the locale is used * (or something equivalent). * @param src The original string. * @param sink A ByteSink to which the result string is written. @@ -277,7 +277,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @@ -308,7 +308,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @@ -326,7 +326,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. @@ -334,13 +334,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. @@ -362,7 +362,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. @@ -370,13 +370,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. @@ -404,7 +404,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * that are to be titlecased. It titlecases those characters and lowercases * all others. (This can be modified with options bits.) * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param locale The locale ID. ("" = root locale, nullptr = default locale.) * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, * U_TITLECASE_NO_LOWERCASE, * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, @@ -412,7 +412,7 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * @param iter A break iterator to find the first characters of words that are to be titlecased. * It is set to the source string (setUText()) * and used one or more times for iteration (first() and next()). - * If NULL, then a word break iterator for the locale is used + * If nullptr, then a word break iterator for the locale is used * (or something equivalent). * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. @@ -420,13 +420,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. @@ -462,13 +462,13 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory { * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then - * dest may be NULL and the function will only return the length of the result + * dest may be nullptr and the function will only return the length of the result * without writing any of the result string. * @param edits Records edits for index mapping, working with styled text, * and getting only changes (if any). * The Edits contents is undefined if any error occurs. * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. + * options includes U_EDITS_NO_RESET. edits can be nullptr. * @param errorCode Reference to an in/out error code value * which must not indicate a failure before the function call. * @return The length of the result string, if successful. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/char16ptr.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/char16ptr.h index c8a9ae6c3..de8182c7a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/char16ptr.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/char16ptr.h @@ -39,7 +39,7 @@ U_NAMESPACE_BEGIN * char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. * @stable ICU 59 */ -class U_COMMON_API Char16Ptr U_FINAL { +class U_COMMON_API Char16Ptr final { public: /** * Copies the pointer. @@ -146,7 +146,7 @@ char16_t *Char16Ptr::get() const { return u_.cp; } * const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. * @stable ICU 59 */ -class U_COMMON_API ConstChar16Ptr U_FINAL { +class U_COMMON_API ConstChar16Ptr final { public: /** * Copies the pointer. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/chariter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/chariter.h index 5b00e6622..45f4d984c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/chariter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/chariter.h @@ -65,7 +65,7 @@ U_NAMESPACE_BEGIN * check for the end of the iteration. When there are no more * characters in the text object: *
    - *
  • The hasNext() function returns FALSE.
  • + *
  • The hasNext() function returns false.
  • *
  • nextPostInc() and next32PostInc() return DONE * when one attempts to read beyond the end of the text object.
  • *
@@ -142,7 +142,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject { * @return a UClassID for this ForwardCharacterIterator * @stable ICU 2.0 */ - virtual UClassID getDynamicClassID(void) const = 0; + virtual UClassID getDynamicClassID(void) const override = 0; /** * Gets the current code unit for returning and advances to the next code unit @@ -165,11 +165,11 @@ class U_COMMON_API ForwardCharacterIterator : public UObject { virtual UChar32 next32PostInc(void) = 0; /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * at or after the current position in the iteration range. * This is used with nextPostInc() or next32PostInc() in forward * iteration. - * @returns FALSE if there are no more code units or code points + * @returns false if there are no more code units or code points * at or after the current position in the iteration range. * @stable ICU 2.0 */ @@ -297,7 +297,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject { * \code * void traverseForward(CharacterIterator& iter) * { - * for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { + * for(char16_t c = iter.first(); c != CharacterIterator::DONE; c = iter.next()) { * processChar(c); * } * } @@ -308,7 +308,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject { * \code * void traverseBackward(CharacterIterator& iter) * { - * for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) { + * for(char16_t c = iter.last(); c != CharacterIterator::DONE; c = iter.previous()) { * processChar(c); * } * } @@ -322,11 +322,11 @@ class U_COMMON_API ForwardCharacterIterator : public UObject { * { * char16_t c; * for (c = iter.setIndex(pos); - * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); + * c != CharacterIterator::DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); * c = iter.next()) {} * int32_t end = iter.getIndex(); * for (c = iter.setIndex(pos); - * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); + * c != CharacterIterator::DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); * c = iter.previous()) {} * int32_t start = iter.getIndex() + 1; * @@ -535,12 +535,12 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator { virtual UChar32 previous32(void) = 0; /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * before the current position in the iteration range. * This is used with previous() or previous32() in backward * iteration. - * @return FALSE if there are no more code units or code points - * before the current position in the iteration range, return TRUE otherwise. + * @return false if there are no more code units or code points + * before the current position in the iteration range, return true otherwise. * @stable ICU 2.0 */ virtual UBool hasPrevious() = 0; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/dtintrv.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/dtintrv.h index fb3f531e9..8c172eb7a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/dtintrv.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/dtintrv.h @@ -89,7 +89,7 @@ class U_COMMON_API DateInterval : public UObject { * other classes have different class IDs. * @stable ICU 4.0 */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID(void) const override; /** @@ -106,14 +106,14 @@ class U_COMMON_API DateInterval : public UObject { /** * Equality operator. - * @return TRUE if the two DateIntervals are the same + * @return true if the two DateIntervals are the same * @stable ICU 4.0 */ virtual bool operator==(const DateInterval& other) const; /** * Non-equality operator - * @return TRUE if the two DateIntervals are not the same + * @return true if the two DateIntervals are not the same * @stable ICU 4.0 */ inline bool operator!=(const DateInterval& other) const; @@ -131,7 +131,7 @@ class U_COMMON_API DateInterval : public UObject { /** * Default constructor, not implemented. */ - DateInterval(); + DateInterval() = delete; UDate fromDate; UDate toDate; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/edits.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/edits.h index c3ceaccb3..dda9d3ca7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/edits.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/edits.h @@ -77,7 +77,7 @@ class UnicodeString; * * @stable ICU 59 */ -class U_COMMON_API Edits U_FINAL : public UMemory { +class U_COMMON_API Edits final : public UMemory { public: /** * Constructs an empty object. @@ -103,7 +103,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param src source edits * @stable ICU 60 */ - Edits(Edits &&src) U_NOEXCEPT : + Edits(Edits &&src) noexcept : array(stackArray), capacity(STACK_CAPACITY), length(src.length), delta(src.delta), numChanges(src.numChanges), errorCode_(src.errorCode_) { @@ -132,13 +132,13 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @return *this * @stable ICU 60 */ - Edits &operator=(Edits &&src) U_NOEXCEPT; + Edits &operator=(Edits &&src) noexcept; /** * Resets the data but may not release memory. * @stable ICU 59 */ - void reset() U_NOEXCEPT; + void reset() noexcept; /** * Adds a no-change edit: a record for an unchanged segment of text. @@ -159,7 +159,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param outErrorCode Set to an error code if it does not contain one already * and an error occurred while recording edits. * Otherwise unchanged. - * @return TRUE if U_FAILURE(outErrorCode) + * @return true if U_FAILURE(outErrorCode) * @stable ICU 59 */ UBool copyErrorTo(UErrorCode &outErrorCode) const; @@ -171,7 +171,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { */ int32_t lengthDelta() const { return delta; } /** - * @return TRUE if there are any change edits + * @return true if there are any change edits * @stable ICU 59 */ UBool hasChanges() const { return numChanges != 0; } @@ -200,15 +200,15 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @see getFineIterator * @stable ICU 59 */ - struct U_COMMON_API Iterator U_FINAL : public UMemory { + struct U_COMMON_API Iterator final : public UMemory { /** * Default constructor, empty iterator. * @stable ICU 60 */ Iterator() : array(nullptr), index(0), length(0), - remaining(0), onlyChanges_(FALSE), coarse(FALSE), - dir(0), changed(FALSE), oldLength_(0), newLength_(0), + remaining(0), onlyChanges_(false), coarse(false), + dir(0), changed(false), oldLength_(0), newLength_(0), srcIndex(0), replIndex(0), destIndex(0) {} /** * Copy constructor. @@ -226,7 +226,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if there is another edit + * @return true if there is another edit * @stable ICU 59 */ UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); } @@ -247,11 +247,11 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if the edit for the source index was found + * @return true if the edit for the source index was found * @stable ICU 59 */ UBool findSourceIndex(int32_t i, UErrorCode &errorCode) { - return findIndex(i, TRUE, errorCode) == 0; + return findIndex(i, true, errorCode) == 0; } /** @@ -270,11 +270,11 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if the edit for the destination index was found + * @return true if the edit for the destination index was found * @stable ICU 60 */ UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) { - return findIndex(i, FALSE, errorCode) == 0; + return findIndex(i, false, errorCode) == 0; } /** @@ -328,8 +328,8 @@ class U_COMMON_API Edits U_FINAL : public UMemory { /** * Returns whether the edit currently represented by the iterator is a change edit. * - * @return TRUE if this edit replaces oldLength() units with newLength() different ones. - * FALSE if oldLength units remain unchanged. + * @return true if this edit replaces oldLength() units with newLength() different ones. + * false if oldLength units remain unchanged. * @stable ICU 59 */ UBool hasChange() const { return changed; } @@ -347,8 +347,8 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * {@link #destinationIndex}, or in the replacement string, which starts at * {@link #replacementIndex}. * - * @return the number of units in the modified string, if hasChange() is TRUE. - * Same as oldLength if hasChange() is FALSE. + * @return the number of units in the modified string, if hasChange() is true. + * Same as oldLength if hasChange() is false. * @stable ICU 59 */ int32_t newLength() const { return newLength_; } @@ -436,7 +436,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getCoarseChangesIterator() const { - return Iterator(array, length, TRUE, TRUE); + return Iterator(array, length, true, true); } /** @@ -448,7 +448,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getCoarseIterator() const { - return Iterator(array, length, FALSE, TRUE); + return Iterator(array, length, false, true); } /** @@ -460,7 +460,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getFineChangesIterator() const { - return Iterator(array, length, TRUE, FALSE); + return Iterator(array, length, true, false); } /** @@ -471,7 +471,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory { * @stable ICU 59 */ Iterator getFineIterator() const { - return Iterator(array, length, FALSE, FALSE); + return Iterator(array, length, false, false); } /** @@ -504,9 +504,9 @@ class U_COMMON_API Edits U_FINAL : public UMemory { Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode); private: - void releaseArray() U_NOEXCEPT; + void releaseArray() noexcept; Edits ©Array(const Edits &other); - Edits &moveArray(Edits &src) U_NOEXCEPT; + Edits &moveArray(Edits &src) noexcept; void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; } int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/filteredbrk.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/filteredbrk.h index 7e9bf2679..8b07e39ae 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/filteredbrk.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/filteredbrk.h @@ -1,152 +1,152 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************** -// * Copyright (C) 1997-2015, International Business Machines -// * Corporation and others. All Rights Reserved. -// ******************************************************************************** -// */ - -// #ifndef FILTEREDBRK_H -// #define FILTEREDBRK_H - -// #include "unicode/utypes.h" - -// #if U_SHOW_CPLUSPLUS_API - -// #include "unicode/brkiter.h" - -// #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION - -// U_NAMESPACE_BEGIN - -// /** -// * \file -// * \brief C++ API: FilteredBreakIteratorBuilder -// */ - -// /** -// * The BreakIteratorFilter is used to modify the behavior of a BreakIterator -// * by constructing a new BreakIterator which suppresses certain segment boundaries. -// * See http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions . -// * For example, a typical English Sentence Break Iterator would break on the space -// * in the string "Mr. Smith" (resulting in two segments), -// * but with "Mr." as an exception, a filtered break iterator -// * would consider the string "Mr. Smith" to be a single segment. -// * -// * @stable ICU 56 -// */ -// class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { -// public: -// /** -// * destructor. -// * @stable ICU 56 -// */ -// virtual ~FilteredBreakIteratorBuilder(); - -// /** -// * Construct a FilteredBreakIteratorBuilder based on rules in a locale. -// * The rules are taken from CLDR exception data for the locale, -// * see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions -// * This is the equivalent of calling createInstance(UErrorCode&) -// * and then repeatedly calling addNoBreakAfter(...) with the contents -// * of the CLDR exception data. -// * @param where the locale. -// * @param status The error code. -// * @return the new builder -// * @stable ICU 56 -// */ -// static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status); - -// #ifndef U_HIDE_DEPRECATED_API -// /** -// * This function has been deprecated in favor of createEmptyInstance, which has -// * identical behavior. -// * @param status The error code. -// * @return the new builder -// * @deprecated ICU 60 use createEmptyInstance instead -// * @see createEmptyInstance() -// */ -// static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status); -// #endif /* U_HIDE_DEPRECATED_API */ - -// /** -// * Construct an empty FilteredBreakIteratorBuilder. -// * In this state, it will not suppress any segment boundaries. -// * @param status The error code. -// * @return the new builder -// * @stable ICU 60 -// */ -// static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); - -// /** -// * Suppress a certain string from being the end of a segment. -// * For example, suppressing "Mr.", then segments ending in "Mr." will not be returned -// * by the iterator. -// * @param string the string to suppress, such as "Mr." -// * @param status error code -// * @return returns TRUE if the string was not present and now added, -// * FALSE if the call was a no-op because the string was already being suppressed. -// * @stable ICU 56 -// */ -// virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; - -// /** -// * Stop suppressing a certain string from being the end of the segment. -// * This function does not create any new segment boundaries, but only serves to un-do -// * the effect of earlier calls to suppressBreakAfter, or to un-do the effect of -// * locale data which may be suppressing certain strings. -// * @param string the exception to remove -// * @param status error code -// * @return returns TRUE if the string was present and now removed, -// * FALSE if the call was a no-op because the string was not being suppressed. -// * @stable ICU 56 -// */ -// virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; - -// #ifndef U_FORCE_HIDE_DEPRECATED_API -// /** -// * This function has been deprecated in favor of wrapIteratorWithFilter() -// * The behavior is identical. -// * @param adoptBreakIterator the break iterator to adopt -// * @param status error code -// * @return the new BreakIterator, owned by the caller. -// * @deprecated ICU 60 use wrapIteratorWithFilter() instead -// * @see wrapBreakIteratorWithFilter() -// */ -// virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; -// #endif // U_FORCE_HIDE_DEPRECATED_API - -// /** -// * Wrap (adopt) an existing break iterator in a new filtered instance. -// * The resulting BreakIterator is owned by the caller. -// * The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed. -// * Note that the adoptBreakIterator is adopted by the new BreakIterator -// * and should no longer be used by the caller. -// * The FilteredBreakIteratorBuilder may be reused. -// * This function is an alias for build() -// * @param adoptBreakIterator the break iterator to adopt -// * @param status error code -// * @return the new BreakIterator, owned by the caller. -// * @stable ICU 60 -// */ -// inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { -// return build(adoptBreakIterator, status); -// } - -// protected: -// /** -// * For subclass use -// * @stable ICU 56 -// */ -// FilteredBreakIteratorBuilder(); -// }; - - -// U_NAMESPACE_END - -// #endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION - -// #endif /* U_SHOW_CPLUSPLUS_API */ - -// #endif // #ifndef FILTEREDBRK_H +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2015, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +*/ + +#ifndef FILTEREDBRK_H +#define FILTEREDBRK_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/brkiter.h" + +#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION + +U_NAMESPACE_BEGIN + +/** + * \file + * \brief C++ API: FilteredBreakIteratorBuilder + */ + +/** + * The BreakIteratorFilter is used to modify the behavior of a BreakIterator + * by constructing a new BreakIterator which suppresses certain segment boundaries. + * See http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions . + * For example, a typical English Sentence Break Iterator would break on the space + * in the string "Mr. Smith" (resulting in two segments), + * but with "Mr." as an exception, a filtered break iterator + * would consider the string "Mr. Smith" to be a single segment. + * + * @stable ICU 56 + */ +class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { + public: + /** + * destructor. + * @stable ICU 56 + */ + virtual ~FilteredBreakIteratorBuilder(); + + /** + * Construct a FilteredBreakIteratorBuilder based on rules in a locale. + * The rules are taken from CLDR exception data for the locale, + * see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions + * This is the equivalent of calling createInstance(UErrorCode&) + * and then repeatedly calling addNoBreakAfter(...) with the contents + * of the CLDR exception data. + * @param where the locale. + * @param status The error code. + * @return the new builder + * @stable ICU 56 + */ + static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * This function has been deprecated in favor of createEmptyInstance, which has + * identical behavior. + * @param status The error code. + * @return the new builder + * @deprecated ICU 60 use createEmptyInstance instead + * @see createEmptyInstance() + */ + static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Construct an empty FilteredBreakIteratorBuilder. + * In this state, it will not suppress any segment boundaries. + * @param status The error code. + * @return the new builder + * @stable ICU 60 + */ + static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); + + /** + * Suppress a certain string from being the end of a segment. + * For example, suppressing "Mr.", then segments ending in "Mr." will not be returned + * by the iterator. + * @param string the string to suppress, such as "Mr." + * @param status error code + * @return returns true if the string was not present and now added, + * false if the call was a no-op because the string was already being suppressed. + * @stable ICU 56 + */ + virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; + + /** + * Stop suppressing a certain string from being the end of the segment. + * This function does not create any new segment boundaries, but only serves to un-do + * the effect of earlier calls to suppressBreakAfter, or to un-do the effect of + * locale data which may be suppressing certain strings. + * @param string the exception to remove + * @param status error code + * @return returns true if the string was present and now removed, + * false if the call was a no-op because the string was not being suppressed. + * @stable ICU 56 + */ + virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * This function has been deprecated in favor of wrapIteratorWithFilter() + * The behavior is identical. + * @param adoptBreakIterator the break iterator to adopt + * @param status error code + * @return the new BreakIterator, owned by the caller. + * @deprecated ICU 60 use wrapIteratorWithFilter() instead + * @see wrapBreakIteratorWithFilter() + */ + virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; +#endif // U_FORCE_HIDE_DEPRECATED_API + + /** + * Wrap (adopt) an existing break iterator in a new filtered instance. + * The resulting BreakIterator is owned by the caller. + * The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed. + * Note that the adoptBreakIterator is adopted by the new BreakIterator + * and should no longer be used by the caller. + * The FilteredBreakIteratorBuilder may be reused. + * This function is an alias for build() + * @param adoptBreakIterator the break iterator to adopt + * @param status error code + * @return the new BreakIterator, owned by the caller. + * @stable ICU 60 + */ + inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { + return build(adoptBreakIterator, status); + } + + protected: + /** + * For subclass use + * @stable ICU 56 + */ + FilteredBreakIteratorBuilder(); +}; + + +U_NAMESPACE_END + +#endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // #ifndef FILTEREDBRK_H diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/icudataver.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/icudataver.h index 1cb202e3d..f218ed8eb 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/icudataver.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/icudataver.h @@ -38,6 +38,6 @@ * * @stable ICU 49 */ -U_STABLE void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); +U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/icuplug.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/icuplug.h index 2e57b149e..c787fcd42 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/icuplug.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/icuplug.h @@ -117,14 +117,13 @@ /* === Basic types === */ #ifndef U_HIDE_INTERNAL_API +struct UPlugData; /** * @{ - * Opaque structure passed to/from a plugin. - * use the APIs to access it. + * Typedef for opaque structure passed to/from a plugin. + * Use the APIs to access it. * @internal ICU 4.4 Technology Preview */ - -struct UPlugData; typedef struct UPlugData UPlugData; /** @} */ @@ -188,8 +187,12 @@ typedef enum { /** * Entrypoint for an ICU plugin. - * @param plug the UPlugData handle. - * @param status the plugin's extended status code. + * @param plug the UPlugData handle. + * @param reason the reason code for the entrypoint's call. + * @param status Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) * @return A valid plugin must return UPLUG_TOKEN * @internal ICU 4.4 Technology Preview */ @@ -208,7 +211,7 @@ typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) ( * @param dontUnload set true if this plugin can't be unloaded * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload); /** @@ -217,7 +220,7 @@ uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload); * @param level the level of this plugin * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setPlugLevel(UPlugData *plug, UPlugLevel level); /** @@ -226,7 +229,7 @@ uplug_setPlugLevel(UPlugData *plug, UPlugLevel level); * @return the level of this plugin * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugLevel U_EXPORT2 +U_CAPI UPlugLevel U_EXPORT2 uplug_getPlugLevel(UPlugData *plug); /** @@ -236,7 +239,7 @@ uplug_getPlugLevel(UPlugData *plug); * @return the lowest level of plug which can currently load * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugLevel U_EXPORT2 +U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel(void); @@ -245,7 +248,7 @@ uplug_getCurrentLevel(void); * @return The error code of this plugin's load attempt. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UErrorCode U_EXPORT2 +U_CAPI UErrorCode U_EXPORT2 uplug_getPlugLoadStatus(UPlugData *plug); /** @@ -254,7 +257,7 @@ uplug_getPlugLoadStatus(UPlugData *plug); * @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setPlugName(UPlugData *plug, const char *name); /** @@ -263,7 +266,7 @@ uplug_setPlugName(UPlugData *plug, const char *name); * @return the name of this plugin * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getPlugName(UPlugData *plug); /** @@ -272,7 +275,7 @@ uplug_getPlugName(UPlugData *plug); * @return the symbol name, or NULL * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getSymbolName(UPlugData *plug); /** @@ -282,7 +285,7 @@ uplug_getSymbolName(UPlugData *plug); * @return the library name, or NULL * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getLibraryName(UPlugData *plug, UErrorCode *status); /** @@ -292,7 +295,7 @@ uplug_getLibraryName(UPlugData *plug, UErrorCode *status); * @return the library, or NULL * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uplug_getLibrary(UPlugData *plug); /** @@ -301,7 +304,7 @@ uplug_getLibrary(UPlugData *plug); * @return the context, or NULL if not set * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void * U_EXPORT2 +U_CAPI void * U_EXPORT2 uplug_getContext(UPlugData *plug); /** @@ -310,7 +313,7 @@ uplug_getContext(UPlugData *plug); * @param context new context to set * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_setContext(UPlugData *plug, void *context); @@ -321,7 +324,7 @@ uplug_setContext(UPlugData *plug, void *context); * @return configuration string, or else null. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uplug_getConfiguration(UPlugData *plug); /** @@ -339,7 +342,7 @@ uplug_getConfiguration(UPlugData *plug); * @return the next oldest plugin, or NULL if no more. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_nextPlug(UPlugData *prior); /** @@ -354,7 +357,7 @@ uplug_nextPlug(UPlugData *prior); * @return the new UPlugData associated with this plugin, or NULL if error. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status); @@ -368,7 +371,7 @@ uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UE * @return the new UPlugData associated with this plugin, or NULL if error. * @internal ICU 4.4 Technology Preview */ -U_INTERNAL UPlugData* U_EXPORT2 +U_CAPI UPlugData* U_EXPORT2 uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status); /** @@ -378,7 +381,7 @@ uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *conf * @param status error result * @internal ICU 4.4 Technology Preview */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 uplug_removePlug(UPlugData *plug, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/idna.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/idna.h index 6dfcfe48d..1c57205ba 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/idna.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/idna.h @@ -95,7 +95,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a single domain name label into its ASCII form for DNS lookup. - * If any processing step fails, then info.hasErrors() will be TRUE and + * If any processing step fails, then info.hasErrors() will be true and * the result might not be an ASCII string. * The label might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. @@ -119,7 +119,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a single domain name label into its Unicode form for human-readable display. - * If any processing step fails, then info.hasErrors() will be TRUE. + * If any processing step fails, then info.hasErrors() will be true. * The label might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, @@ -141,7 +141,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a whole domain name into its ASCII form for DNS lookup. - * If any processing step fails, then info.hasErrors() will be TRUE and + * If any processing step fails, then info.hasErrors() will be true and * the result might not be an ASCII string. * The domain name might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. @@ -165,7 +165,7 @@ class U_COMMON_API IDNA : public UObject { /** * Converts a whole domain name into its Unicode form for human-readable display. - * If any processing step fails, then info.hasErrors() will be TRUE. + * If any processing step fails, then info.hasErrors() will be true. * The domain name might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, @@ -273,10 +273,10 @@ class U_COMMON_API IDNAInfo : public UMemory { * Constructor for stack allocation. * @stable ICU 4.6 */ - IDNAInfo() : errors(0), labelErrors(0), isTransDiff(FALSE), isBiDi(FALSE), isOkBiDi(TRUE) {} + IDNAInfo() : errors(0), labelErrors(0), isTransDiff(false), isBiDi(false), isOkBiDi(true) {} /** * Were there IDNA processing errors? - * @return TRUE if there were processing errors + * @return true if there were processing errors * @stable ICU 4.6 */ UBool hasErrors() const { return errors!=0; } @@ -288,7 +288,7 @@ class U_COMMON_API IDNAInfo : public UMemory { */ uint32_t getErrors() const { return errors; } /** - * Returns TRUE if transitional and nontransitional processing produce different results. + * Returns true if transitional and nontransitional processing produce different results. * This is the case when the input label or domain name contains * one or more deviation characters outside a Punycode label (see UTS #46). *
    @@ -297,7 +297,7 @@ class U_COMMON_API IDNAInfo : public UMemory { *
  • With transitional processing, such characters are * mapped (sharp s/sigma) or removed (joiner/nonjoiner). *
- * @return TRUE if transitional and nontransitional processing produce different results + * @return true if transitional and nontransitional processing produce different results * @stable ICU 4.6 */ UBool isTransitionalDifferent() const { return isTransDiff; } @@ -305,14 +305,14 @@ class U_COMMON_API IDNAInfo : public UMemory { private: friend class UTS46; - IDNAInfo(const IDNAInfo &other); // no copying - IDNAInfo &operator=(const IDNAInfo &other); // no copying + IDNAInfo(const IDNAInfo &other) = delete; // no copying + IDNAInfo &operator=(const IDNAInfo &other) = delete; // no copying void reset() { errors=labelErrors=0; - isTransDiff=FALSE; - isBiDi=FALSE; - isOkBiDi=TRUE; + isTransDiff=false; + isBiDi=false; + isOkBiDi=true; } uint32_t errors, labelErrors; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/localebuilder.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/localebuilder.h index 19e10f1c0..f708a7ed7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/localebuilder.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/localebuilder.h @@ -1,5 +1,5 @@ // © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html #ifndef __LOCALEBUILDER_H__ #define __LOCALEBUILDER_H__ @@ -12,7 +12,6 @@ #include "unicode/stringpiece.h" #include "unicode/uobject.h" -#ifndef U_HIDE_DRAFT_API /** * \file * \brief C++ API: Builder API for Locale @@ -57,7 +56,7 @@ class CharString; * UErrorCode, then track the error of the validation of the input parameter * into the internal UErrorCode. * - * @draft ICU 64 + * @stable ICU 64 */ class U_COMMON_API LocaleBuilder : public UObject { public: @@ -66,13 +65,13 @@ class U_COMMON_API LocaleBuilder : public UObject { * fields, extensions, and private use information is the * empty string. * - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder(); /** * Destructor - * @draft ICU 64 + * @stable ICU 64 */ virtual ~LocaleBuilder(); @@ -86,25 +85,24 @@ class U_COMMON_API LocaleBuilder : public UObject { * @param locale the locale * @return This builder. * - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setLocale(const Locale& locale); /** - * Resets the LocaleBuilder to match the provided - * [Unicode Locale Identifier](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id) . - * Discards the existing state. the empty string cause the builder to be - * reset, like {@link #clear}. Grandfathered tags are converted to their - * canonical form before being processed. Otherwise, the language - * tag must be well-formed, or else the build() method will later - * report an U_ILLEGAL_ARGUMENT_ERROR. + * Resets the LocaleBuilder to match the provided IETF BCP 47 language tag. + * Discards the existing state. + * The empty string causes the builder to be reset, like {@link #clear}. + * Legacy language tags (marked as “Type: grandfathered” in BCP 47) + * are converted to their canonical form before being processed. + * Otherwise, the language tag must be well-formed, + * or else the build() method will later report an U_ILLEGAL_ARGUMENT_ERROR. * *

This method clears the internal UErrorCode. * - * @param tag the language tag, defined as - * [unicode_locale_id](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id). + * @param tag the language tag, defined as IETF BCP 47 language tag. * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setLanguageTag(StringPiece tag); @@ -119,7 +117,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * * @param language the language * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setLanguage(StringPiece language); @@ -135,7 +133,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * * @param script the script * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setScript(StringPiece script); @@ -154,7 +152,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * * @param region the region * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setRegion(StringPiece region); @@ -175,7 +173,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * * @param variant the variant * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setVariant(StringPiece variant); @@ -196,7 +194,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * @param key the extension key * @param value the extension value * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setExtension(char key, StringPiece value); @@ -216,7 +214,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * @param key the Unicode locale key * @param type the Unicode locale type * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& setUnicodeLocaleKeyword( StringPiece key, StringPiece type); @@ -229,7 +227,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * * @param attribute the attribute * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& addUnicodeLocaleAttribute(StringPiece attribute); @@ -242,7 +240,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * * @param attribute the attribute * @return This builder. - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& removeUnicodeLocaleAttribute(StringPiece attribute); @@ -251,7 +249,7 @@ class U_COMMON_API LocaleBuilder : public UObject { *

This method clears the internal UErrorCode. * * @return this builder - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& clear(); @@ -260,7 +258,7 @@ class U_COMMON_API LocaleBuilder : public UObject { * Language, script, region and variant are unchanged. * * @return this builder - * @draft ICU 64 + * @stable ICU 64 */ LocaleBuilder& clearExtensions(); @@ -275,22 +273,20 @@ class U_COMMON_API LocaleBuilder : public UObject { * the same builder to build more locales. * * @return a new Locale - * @draft ICU 64 + * @stable ICU 64 */ Locale build(UErrorCode& status); -#ifndef U_HIDE_DRAFT_API /** * Sets the UErrorCode if an error occurred while recording sets. * Preserves older error codes in the outErrorCode. * @param outErrorCode Set to an error code that occurred while setting subtags. * Unchanged if there is no such error or if outErrorCode * already contained an error. - * @return TRUE if U_FAILURE(outErrorCode) - * @draft ICU 65 + * @return true if U_FAILURE(outErrorCode) + * @stable ICU 65 */ UBool copyErrorTo(UErrorCode &outErrorCode) const; -#endif /* U_HIDE_DRAFT_API */ private: friend class LocaleMatcher::Result; @@ -308,8 +304,6 @@ class U_COMMON_API LocaleBuilder : public UObject { U_NAMESPACE_END -#endif // U_HIDE_DRAFT_API - #endif /* U_SHOW_CPLUSPLUS_API */ #endif // __LOCALEBUILDER_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/localematcher.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/localematcher.h index 701123f75..603daf723 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/localematcher.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/localematcher.h @@ -1,5 +1,5 @@ // © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License +// License & terms of use: http://www.unicode.org/copyright.html // localematcher.h // created: 2019may08 Markus W. Scherer @@ -20,26 +20,24 @@ * \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales. */ -#ifndef U_HIDE_DRAFT_API - /** * Builder option for whether the language subtag or the script subtag is most important. * - * @see Builder#setFavorSubtag(FavorSubtag) - * @draft ICU 65 + * @see LocaleMatcher::Builder#setFavorSubtag(ULocMatchFavorSubtag) + * @stable ICU 65 */ enum ULocMatchFavorSubtag { /** * Language differences are most important, then script differences, then region differences. * (This is the default behavior.) * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_FAVOR_LANGUAGE, /** * Makes script differences matter relatively more than language differences. * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_FAVOR_SCRIPT }; @@ -51,14 +49,14 @@ typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag; * Builder option for whether all desired locales are treated equally or * earlier ones are preferred. * - * @see Builder#setDemotionPerDesiredLocale(Demotion) - * @draft ICU 65 + * @see LocaleMatcher::Builder#setDemotionPerDesiredLocale(ULocMatchDemotion) + * @stable ICU 65 */ enum ULocMatchDemotion { /** * All desired locales are treated equally. * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_DEMOTION_NONE, /** @@ -85,7 +83,7 @@ enum ULocMatchDemotion { * this is possible in future versions of the data.) * * - * @draft ICU 65 + * @stable ICU 65 */ ULOCMATCH_DEMOTION_REGION }; @@ -93,6 +91,42 @@ enum ULocMatchDemotion { typedef enum ULocMatchDemotion ULocMatchDemotion; #endif +/** + * Builder option for whether to include or ignore one-way (fallback) match data. + * The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. + * Sometimes it is desirable to ignore those. + * + *

For example, consider a web application with the UI in a given language, + * with a link to another, related web app. + * The link should include the UI language, and the target server may also use + * the client’s Accept-Language header data. + * The target server has its own list of supported languages. + * One may want to favor UI language consistency, that is, + * if there is a decent match for the original UI language, we want to use it, + * but not if it is merely a fallback. + * + * @see LocaleMatcher::Builder#setDirection(ULocMatchDirection) + * @stable ICU 67 + */ +enum ULocMatchDirection { + /** + * Locale matching includes one-way matches such as Breton→French. (default) + * + * @stable ICU 67 + */ + ULOCMATCH_DIRECTION_WITH_ONE_WAY, + /** + * Locale matching limited to two-way matches including e.g. Danish↔Norwegian + * but ignoring one-way matches. + * + * @stable ICU 67 + */ + ULOCMATCH_DIRECTION_ONLY_TWO_WAY +}; +#ifndef U_IN_DOXYGEN +typedef enum ULocMatchDirection ULocMatchDirection; +#endif + struct UHashtable; U_NAMESPACE_BEGIN @@ -145,7 +179,7 @@ class XLikelySubtags; * *

This class is not intended for public subclassing. * - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API LocaleMatcher : public UMemory { public: @@ -153,7 +187,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * Data for the best-matching pair of a desired and a supported locale. * Movable but not copyable. * - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API Result : public UMemory { public: @@ -162,14 +196,14 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This object will have the same contents that the source object had. * * @param src Result to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ - Result(Result &&src) U_NOEXCEPT; + Result(Result &&src) noexcept; /** * Destructor. * - * @draft ICU 65 + * @stable ICU 65 */ ~Result(); @@ -178,27 +212,27 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This object will have the same contents that the source object had. * * @param src Result to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ - Result &operator=(Result &&src) U_NOEXCEPT; + Result &operator=(Result &&src) noexcept; /** * Returns the best-matching desired locale. * nullptr if the list of desired locales is empty or if none matched well enough. * * @return the best-matching desired locale, or nullptr. - * @draft ICU 65 + * @stable ICU 65 */ inline const Locale *getDesiredLocale() const { return desiredLocale; } /** * Returns the best-matching supported locale. * If none matched well enough, this is the default locale. - * The default locale is nullptr if the list of supported locales is empty and - * no explicit default locale is set. + * The default locale is nullptr if Builder::setNoDefaultLocale() was called, + * or if the list of supported locales is empty and no explicit default locale is set. * * @return the best-matching supported locale, or nullptr. - * @draft ICU 65 + * @stable ICU 65 */ inline const Locale *getSupportedLocale() const { return supportedLocale; } @@ -207,7 +241,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * -1 if the list of desired locales is empty or if none matched well enough. * * @return the index of the best-matching desired locale, or -1. - * @draft ICU 65 + * @stable ICU 65 */ inline int32_t getDesiredIndex() const { return desiredIndex; } @@ -219,7 +253,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * -1 if the list of supported locales is empty or if none matched well enough. * * @return the index of the best-matching supported locale, or -1. - * @draft ICU 65 + * @stable ICU 65 */ inline int32_t getSupportedIndex() const { return supportedIndex; } @@ -233,7 +267,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { *

Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn * * @return a locale combining the best-matching desired and supported locales. - * @draft ICU 65 + * @stable ICU 65 */ Locale makeResolvedLocale(UErrorCode &errorCode) const; @@ -260,8 +294,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * LocaleMatcher builder. * Movable but not copyable. * - * @see LocaleMatcher#builder() - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API Builder : public UMemory { public: @@ -269,7 +302,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * Constructs a builder used in chaining parameters for building a LocaleMatcher. * * @return a new Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder() {} @@ -278,14 +311,14 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This builder will have the same contents that the source builder had. * * @param src Builder to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ - Builder(Builder &&src) U_NOEXCEPT; + Builder(Builder &&src) noexcept; /** * Destructor. * - * @draft ICU 65 + * @stable ICU 65 */ ~Builder(); @@ -294,9 +327,9 @@ class U_COMMON_API LocaleMatcher : public UMemory { * This builder will have the same contents that the source builder had. * * @param src Builder to move contents from. - * @draft ICU 65 + * @stable ICU 65 */ - Builder &operator=(Builder &&src) U_NOEXCEPT; + Builder &operator=(Builder &&src) noexcept; /** * Parses an Accept-Language string @@ -307,7 +340,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param locales the Accept-Language string of locales to set * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setSupportedLocalesFromListString(StringPiece locales); @@ -318,7 +351,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param locales the list of locale * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setSupportedLocales(Locale::Iterator &locales); @@ -333,7 +366,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param begin Start of range. * @param end Exclusive end of range. * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ template Builder &setSupportedLocales(Iter begin, Iter end) { @@ -358,7 +391,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param end Exclusive end of range. * @param converter Converter from *begin to const Locale & or compatible. * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ template Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) { @@ -376,17 +409,29 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param locale another locale * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &addSupportedLocale(const Locale &locale); + /** + * Sets no default locale. + * There will be no explicit or implicit default locale. + * If there is no good match, then the matcher will return nullptr for the + * best supported locale. + * + * @stable ICU 68 + */ + Builder &setNoDefaultLocale(); + /** * Sets the default locale; if nullptr, or if it is not set explicitly, * then the first supported locale is used as the default locale. + * There is no default locale at all (nullptr will be returned instead) + * if setNoDefaultLocale() is called. * * @param defaultLocale the default locale (will be copied) * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setDefaultLocale(const Locale *defaultLocale); @@ -398,7 +443,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param subtag the subtag to favor * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setFavorSubtag(ULocMatchFavorSubtag subtag); @@ -408,10 +453,48 @@ class U_COMMON_API LocaleMatcher : public UMemory { * * @param demotion the demotion per desired locale to set. * @return this Builder object - * @draft ICU 65 + * @stable ICU 65 */ Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion); + /** + * Option for whether to include or ignore one-way (fallback) match data. + * By default, they are included. + * + * @param matchDirection the match direction to set. + * @return this Builder object + * @stable ICU 67 + */ + Builder &setDirection(ULocMatchDirection matchDirection) { + if (U_SUCCESS(errorCode_)) { + direction_ = matchDirection; + } + return *this; + } + + /** + * Sets the maximum distance for an acceptable match. + * The matcher will return a match for a pair of locales only if + * they match at least as well as the pair given here. + * + * For example, setMaxDistance(en-US, en-GB) limits matches to ones where the + * (desired, support) locales have a distance no greater than a region subtag difference. + * This is much stricter than the CLDR default. + * + * The details of locale matching are subject to changes in + * CLDR data and in the algorithm. + * Specifying a maximum distance in relative terms via a sample pair of locales + * insulates from changes that affect all distance metrics similarly, + * but some changes will necessarily affect relative distances between + * different pairs of locales. + * + * @param desired the desired locale for distance comparison. + * @param supported the supported locale for distance comparison. + * @return this Builder object + * @stable ICU 68 + */ + Builder &setMaxDistance(const Locale &desired, const Locale &supported); + /** * Sets the UErrorCode if an error occurred while setting parameters. * Preserves older error codes in the outErrorCode. @@ -419,8 +502,8 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param outErrorCode Set to an error code if it does not contain one already * and an error occurred while setting parameters. * Otherwise unchanged. - * @return TRUE if U_FAILURE(outErrorCode) - * @draft ICU 65 + * @return true if U_FAILURE(outErrorCode) + * @stable ICU 65 */ UBool copyErrorTo(UErrorCode &outErrorCode) const; @@ -431,8 +514,8 @@ class U_COMMON_API LocaleMatcher : public UMemory { * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) - * @return new LocaleMatcher. - * @draft ICU 65 + * @return LocaleMatcher + * @stable ICU 65 */ LocaleMatcher build(UErrorCode &errorCode) const; @@ -450,7 +533,11 @@ class U_COMMON_API LocaleMatcher : public UMemory { int32_t thresholdDistance_ = -1; ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION; Locale *defaultLocale_ = nullptr; + bool withDefault_ = true; ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE; + ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY; + Locale *maxDistanceDesired_ = nullptr; + Locale *maxDistanceSupported_ = nullptr; }; // FYI No public LocaleMatcher constructors in C++; use the Builder. @@ -459,13 +546,13 @@ class U_COMMON_API LocaleMatcher : public UMemory { * Move copy constructor; might modify the source. * This matcher will have the same settings that the source matcher had. * @param src source matcher - * @draft ICU 65 + * @stable ICU 65 */ - LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT; + LocaleMatcher(LocaleMatcher &&src) noexcept; /** * Destructor. - * @draft ICU 65 + * @stable ICU 65 */ ~LocaleMatcher(); @@ -475,9 +562,9 @@ class U_COMMON_API LocaleMatcher : public UMemory { * The behavior is undefined if *this and src are the same object. * @param src source matcher * @return *this - * @draft ICU 65 + * @stable ICU 65 */ - LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT; + LocaleMatcher &operator=(LocaleMatcher &&src) noexcept; /** * Returns the supported locale which best matches the desired locale. @@ -487,7 +574,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching supported locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const; @@ -499,7 +586,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching supported locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; @@ -515,7 +602,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching supported locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const; @@ -529,7 +616,7 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching pair of the desired and a supported locale. - * @draft ICU 65 + * @stable ICU 65 */ Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const; @@ -543,10 +630,25 @@ class U_COMMON_API LocaleMatcher : public UMemory { * or else the function returns immediately. Check for U_FAILURE() * on output or use with function chaining. (See User Guide for details.) * @return the best-matching pair of a desired and a supported locale. - * @draft ICU 65 + * @stable ICU 65 */ Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; + /** + * Returns true if the pair of locales matches acceptably. + * This is influenced by Builder options such as setDirection(), setFavorSubtag(), + * and setMaxDistance(). + * + * @param desired The desired locale. + * @param supported The supported locale. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return true if the pair of locales matches acceptably. + * @stable ICU 68 + */ + UBool isMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const; + #ifndef U_HIDE_INTERNAL_API /** * Returns a fraction between 0 and 1, where 1 means that the languages are a @@ -574,6 +676,8 @@ class U_COMMON_API LocaleMatcher : public UMemory { LocaleMatcher(const LocaleMatcher &other) = delete; LocaleMatcher &operator=(const LocaleMatcher &other) = delete; + int32_t putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength, UErrorCode &errorCode); + int32_t getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const; const XLikelySubtags &likelySubtags; @@ -581,13 +685,14 @@ class U_COMMON_API LocaleMatcher : public UMemory { int32_t thresholdDistance; int32_t demotionPerDesiredLocale; ULocMatchFavorSubtag favorSubtag; + ULocMatchDirection direction; // These are in input order. const Locale ** supportedLocales; LSR *lsrs; int32_t supportedLocalesLength; // These are in preference order: 1. Default locale 2. paradigm locales 3. others. - UHashtable *supportedLsrToIndex; // Map stores index+1 because 0 is "not found" + UHashtable *supportedLsrToIndex; // Map // Array versions of the supportedLsrToIndex keys and values. // The distance lookup loops over the supportedLSRs and returns the index of the best match. const LSR **supportedLSRs; @@ -595,11 +700,9 @@ class U_COMMON_API LocaleMatcher : public UMemory { int32_t supportedLSRsLength; Locale *ownedDefaultLocale; const Locale *defaultLocale; - int32_t defaultLocaleIndex; }; U_NAMESPACE_END -#endif // U_HIDE_DRAFT_API #endif // U_SHOW_CPLUSPLUS_API #endif // __LOCALEMATCHER_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/localpointer.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/localpointer.h index dd3004826..b8be3d794 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/localpointer.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/localpointer.h @@ -35,7 +35,7 @@ * - Need to be able to orphan/release the pointer and its ownership. * - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects. * - * For details see http://site.icu-project.org/design/cpp/scoped_ptr + * For details see https://icu.unicode.org/design/cpp/scoped_ptr */ #include "unicode/utypes.h" @@ -79,7 +79,7 @@ class LocalPointerBase { * @param p simple pointer to an object that is adopted * @stable ICU 4.4 */ - explicit LocalPointerBase(T *p=NULL) : ptr(p) {} + explicit LocalPointerBase(T *p=nullptr) : ptr(p) {} /** * Destructor deletes the object it owns. * Subclass must override: Base class does nothing. @@ -87,20 +87,20 @@ class LocalPointerBase { */ ~LocalPointerBase() { /* delete ptr; */ } /** - * NULL check. - * @return TRUE if ==NULL + * nullptr check. + * @return true if ==nullptr * @stable ICU 4.4 */ - UBool isNull() const { return ptr==NULL; } + UBool isNull() const { return ptr==nullptr; } /** - * NULL check. - * @return TRUE if !=NULL + * nullptr check. + * @return true if !=nullptr * @stable ICU 4.4 */ - UBool isValid() const { return ptr!=NULL; } + UBool isValid() const { return ptr!=nullptr; } /** * Comparison with a simple pointer, so that existing code - * with ==NULL need not be changed. + * with ==nullptr need not be changed. * @param other simple pointer for comparison * @return true if this pointer value equals other * @stable ICU 4.4 @@ -108,7 +108,7 @@ class LocalPointerBase { bool operator==(const T *other) const { return ptr==other; } /** * Comparison with a simple pointer, so that existing code - * with !=NULL need not be changed. + * with !=nullptr need not be changed. * @param other simple pointer for comparison * @return true if this pointer value differs from other * @stable ICU 4.4 @@ -133,14 +133,14 @@ class LocalPointerBase { */ T *operator->() const { return ptr; } /** - * Gives up ownership; the internal pointer becomes NULL. + * Gives up ownership; the internal pointer becomes nullptr. * @return the pointer value; * caller becomes responsible for deleting the object * @stable ICU 4.4 */ T *orphan() { T *p=ptr; - ptr=NULL; + ptr=nullptr; return p; } /** @@ -197,9 +197,9 @@ class LocalPointer : public LocalPointerBase { * @param p simple pointer to an object that is adopted * @stable ICU 4.4 */ - explicit LocalPointer(T *p=NULL) : LocalPointerBase(p) {} + explicit LocalPointer(T *p=nullptr) : LocalPointerBase(p) {} /** - * Constructor takes ownership and reports an error if NULL. + * Constructor takes ownership and reports an error if nullptr. * * This constructor is intended to be used with other-class constructors * that may report a failure UErrorCode, @@ -208,11 +208,11 @@ class LocalPointer : public LocalPointerBase { * * @param p simple pointer to an object that is adopted * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR - * if p==NULL and no other failure code had been set + * if p==nullptr and no other failure code had been set * @stable ICU 55 */ LocalPointer(T *p, UErrorCode &errorCode) : LocalPointerBase(p) { - if(p==NULL && U_SUCCESS(errorCode)) { + if(p==nullptr && U_SUCCESS(errorCode)) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } @@ -221,24 +221,22 @@ class LocalPointer : public LocalPointerBase { * @param src source smart pointer * @stable ICU 56 */ - LocalPointer(LocalPointer &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { - src.ptr=NULL; + LocalPointer(LocalPointer &&src) noexcept : LocalPointerBase(src.ptr) { + src.ptr=nullptr; } -#ifndef U_HIDE_DRAFT_API /** - * Constructs a LocalPointer from a C++11 unique_ptr. - * The LocalPointer steals the object owned by the unique_ptr. + * Constructs a LocalPointer from a C++11 std::unique_ptr. + * The LocalPointer steals the object owned by the std::unique_ptr. * - * This constructor works via move semantics. If your unique_ptr is + * This constructor works via move semantics. If your std::unique_ptr is * in a local variable, you must use std::move. * - * @param p The unique_ptr from which the pointer will be stolen. - * @draft ICU 64 + * @param p The std::unique_ptr from which the pointer will be stolen. + * @stable ICU 64 */ explicit LocalPointer(std::unique_ptr &&p) : LocalPointerBase(p.release()) {} -#endif /* U_HIDE_DRAFT_API */ /** * Destructor deletes the object it owns. @@ -254,34 +252,32 @@ class LocalPointer : public LocalPointerBase { * @return *this * @stable ICU 56 */ - LocalPointer &operator=(LocalPointer &&src) U_NOEXCEPT { + LocalPointer &operator=(LocalPointer &&src) noexcept { delete LocalPointerBase::ptr; LocalPointerBase::ptr=src.ptr; - src.ptr=NULL; + src.ptr=nullptr; return *this; } -#ifndef U_HIDE_DRAFT_API /** - * Move-assign from an unique_ptr to this LocalPointer. - * Steals the pointer from the unique_ptr. + * Move-assign from an std::unique_ptr to this LocalPointer. + * Steals the pointer from the std::unique_ptr. * - * @param p The unique_ptr from which the pointer will be stolen. + * @param p The std::unique_ptr from which the pointer will be stolen. * @return *this - * @draft ICU 64 + * @stable ICU 64 */ - LocalPointer &operator=(std::unique_ptr &&p) U_NOEXCEPT { + LocalPointer &operator=(std::unique_ptr &&p) noexcept { adoptInstead(p.release()); return *this; } -#endif /* U_HIDE_DRAFT_API */ /** * Swap pointers. * @param other other smart pointer * @stable ICU 56 */ - void swap(LocalPointer &other) U_NOEXCEPT { + void swap(LocalPointer &other) noexcept { T *temp=LocalPointerBase::ptr; LocalPointerBase::ptr=other.ptr; other.ptr=temp; @@ -292,7 +288,7 @@ class LocalPointer : public LocalPointerBase { * @param p2 will get p1's pointer * @stable ICU 56 */ - friend inline void swap(LocalPointer &p1, LocalPointer &p2) U_NOEXCEPT { + friend inline void swap(LocalPointer &p1, LocalPointer &p2) noexcept { p1.swap(p2); } /** @@ -311,20 +307,20 @@ class LocalPointer : public LocalPointerBase { * * If U_FAILURE(errorCode), then the current object is retained and the new one deleted. * - * If U_SUCCESS(errorCode) but the input pointer is NULL, + * If U_SUCCESS(errorCode) but the input pointer is nullptr, * then U_MEMORY_ALLOCATION_ERROR is set, - * the current object is deleted, and NULL is set. + * the current object is deleted, and nullptr is set. * * @param p simple pointer to an object that is adopted * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR - * if p==NULL and no other failure code had been set + * if p==nullptr and no other failure code had been set * @stable ICU 55 */ void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { if(U_SUCCESS(errorCode)) { delete LocalPointerBase::ptr; LocalPointerBase::ptr=p; - if(p==NULL) { + if(p==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } else { @@ -332,22 +328,20 @@ class LocalPointer : public LocalPointerBase { } } -#ifndef U_HIDE_DRAFT_API /** - * Conversion operator to a C++11 unique_ptr. - * Disowns the object and gives it to the returned unique_ptr. + * Conversion operator to a C++11 std::unique_ptr. + * Disowns the object and gives it to the returned std::unique_ptr. * * This operator works via move semantics. If your LocalPointer is * in a local variable, you must use std::move. * - * @return An unique_ptr owning the pointer previously owned by this + * @return An std::unique_ptr owning the pointer previously owned by this * icu::LocalPointer. - * @draft ICU 64 + * @stable ICU 64 */ operator std::unique_ptr () && { return std::unique_ptr(LocalPointerBase::orphan()); } -#endif /* U_HIDE_DRAFT_API */ }; /** @@ -378,9 +372,9 @@ class LocalArray : public LocalPointerBase { * @param p simple pointer to an array of T objects that is adopted * @stable ICU 4.4 */ - explicit LocalArray(T *p=NULL) : LocalPointerBase(p) {} + explicit LocalArray(T *p=nullptr) : LocalPointerBase(p) {} /** - * Constructor takes ownership and reports an error if NULL. + * Constructor takes ownership and reports an error if nullptr. * * This constructor is intended to be used with other-class constructors * that may report a failure UErrorCode, @@ -389,11 +383,11 @@ class LocalArray : public LocalPointerBase { * * @param p simple pointer to an array of T objects that is adopted * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR - * if p==NULL and no other failure code had been set + * if p==nullptr and no other failure code had been set * @stable ICU 56 */ LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase(p) { - if(p==NULL && U_SUCCESS(errorCode)) { + if(p==nullptr && U_SUCCESS(errorCode)) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } @@ -402,24 +396,22 @@ class LocalArray : public LocalPointerBase { * @param src source smart pointer * @stable ICU 56 */ - LocalArray(LocalArray &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { - src.ptr=NULL; + LocalArray(LocalArray &&src) noexcept : LocalPointerBase(src.ptr) { + src.ptr=nullptr; } -#ifndef U_HIDE_DRAFT_API /** - * Constructs a LocalArray from a C++11 unique_ptr of an array type. - * The LocalPointer steals the array owned by the unique_ptr. + * Constructs a LocalArray from a C++11 std::unique_ptr of an array type. + * The LocalPointer steals the array owned by the std::unique_ptr. * - * This constructor works via move semantics. If your unique_ptr is + * This constructor works via move semantics. If your std::unique_ptr is * in a local variable, you must use std::move. * - * @param p The unique_ptr from which the array will be stolen. - * @draft ICU 64 + * @param p The std::unique_ptr from which the array will be stolen. + * @stable ICU 64 */ explicit LocalArray(std::unique_ptr &&p) : LocalPointerBase(p.release()) {} -#endif /* U_HIDE_DRAFT_API */ /** * Destructor deletes the array it owns. @@ -435,34 +427,32 @@ class LocalArray : public LocalPointerBase { * @return *this * @stable ICU 56 */ - LocalArray &operator=(LocalArray &&src) U_NOEXCEPT { + LocalArray &operator=(LocalArray &&src) noexcept { delete[] LocalPointerBase::ptr; LocalPointerBase::ptr=src.ptr; - src.ptr=NULL; + src.ptr=nullptr; return *this; } -#ifndef U_HIDE_DRAFT_API /** - * Move-assign from an unique_ptr to this LocalPointer. - * Steals the array from the unique_ptr. + * Move-assign from an std::unique_ptr to this LocalPointer. + * Steals the array from the std::unique_ptr. * - * @param p The unique_ptr from which the array will be stolen. + * @param p The std::unique_ptr from which the array will be stolen. * @return *this - * @draft ICU 64 + * @stable ICU 64 */ - LocalArray &operator=(std::unique_ptr &&p) U_NOEXCEPT { + LocalArray &operator=(std::unique_ptr &&p) noexcept { adoptInstead(p.release()); return *this; } -#endif /* U_HIDE_DRAFT_API */ /** * Swap pointers. * @param other other smart pointer * @stable ICU 56 */ - void swap(LocalArray &other) U_NOEXCEPT { + void swap(LocalArray &other) noexcept { T *temp=LocalPointerBase::ptr; LocalPointerBase::ptr=other.ptr; other.ptr=temp; @@ -473,7 +463,7 @@ class LocalArray : public LocalPointerBase { * @param p2 will get p1's pointer * @stable ICU 56 */ - friend inline void swap(LocalArray &p1, LocalArray &p2) U_NOEXCEPT { + friend inline void swap(LocalArray &p1, LocalArray &p2) noexcept { p1.swap(p2); } /** @@ -492,20 +482,20 @@ class LocalArray : public LocalPointerBase { * * If U_FAILURE(errorCode), then the current array is retained and the new one deleted. * - * If U_SUCCESS(errorCode) but the input pointer is NULL, + * If U_SUCCESS(errorCode) but the input pointer is nullptr, * then U_MEMORY_ALLOCATION_ERROR is set, - * the current array is deleted, and NULL is set. + * the current array is deleted, and nullptr is set. * * @param p simple pointer to an array of T objects that is adopted * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR - * if p==NULL and no other failure code had been set + * if p==nullptr and no other failure code had been set * @stable ICU 56 */ void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { if(U_SUCCESS(errorCode)) { delete[] LocalPointerBase::ptr; LocalPointerBase::ptr=p; - if(p==NULL) { + if(p==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } } else { @@ -521,22 +511,20 @@ class LocalArray : public LocalPointerBase { */ T &operator[](ptrdiff_t i) const { return LocalPointerBase::ptr[i]; } -#ifndef U_HIDE_DRAFT_API /** - * Conversion operator to a C++11 unique_ptr. - * Disowns the object and gives it to the returned unique_ptr. + * Conversion operator to a C++11 std::unique_ptr. + * Disowns the object and gives it to the returned std::unique_ptr. * * This operator works via move semantics. If your LocalPointer is * in a local variable, you must use std::move. * - * @return An unique_ptr owning the pointer previously owned by this + * @return An std::unique_ptr owning the pointer previously owned by this * icu::LocalPointer. - * @draft ICU 64 + * @stable ICU 64 */ operator std::unique_ptr () && { return std::unique_ptr(LocalPointerBase::orphan()); } -#endif /* U_HIDE_DRAFT_API */ }; /** @@ -564,33 +552,36 @@ class LocalArray : public LocalPointerBase { public: \ using LocalPointerBase::operator*; \ using LocalPointerBase::operator->; \ - explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase(p) {} \ - LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \ + explicit LocalPointerClassName(Type *p=nullptr) : LocalPointerBase(p) {} \ + LocalPointerClassName(LocalPointerClassName &&src) noexcept \ : LocalPointerBase(src.ptr) { \ - src.ptr=NULL; \ + src.ptr=nullptr; \ } \ - /* TODO: Be agnostic of the deleter function signature from the user-provided unique_ptr? */ \ + /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ explicit LocalPointerClassName(std::unique_ptr &&p) \ : LocalPointerBase(p.release()) {} \ - ~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \ - LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \ - if (ptr != NULL) { closeFunction(ptr); } \ + ~LocalPointerClassName() { if (ptr != nullptr) { closeFunction(ptr); } } \ + LocalPointerClassName &operator=(LocalPointerClassName &&src) noexcept { \ + if (ptr != nullptr) { closeFunction(ptr); } \ LocalPointerBase::ptr=src.ptr; \ - src.ptr=NULL; \ + src.ptr=nullptr; \ return *this; \ } \ - /* TODO: Be agnostic of the deleter function signature from the user-provided unique_ptr? */ \ + /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ LocalPointerClassName &operator=(std::unique_ptr &&p) { \ adoptInstead(p.release()); \ return *this; \ } \ - void swap(LocalPointerClassName &other) U_NOEXCEPT { \ + void swap(LocalPointerClassName &other) noexcept { \ Type *temp=LocalPointerBase::ptr; \ LocalPointerBase::ptr=other.ptr; \ other.ptr=temp; \ } \ + friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) noexcept { \ + p1.swap(p2); \ + } \ void adoptInstead(Type *p) { \ - if (ptr != NULL) { closeFunction(ptr); } \ + if (ptr != nullptr) { closeFunction(ptr); } \ ptr=p; \ } \ operator std::unique_ptr () && { \ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/locid.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/locid.h index 210e4f425..f0bdc7ca5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/locid.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/locid.h @@ -253,12 +253,12 @@ class U_COMMON_API Locale : public UObject { /** * Construct a locale from language, country, variant. * If an error occurs, then the constructed object will be "bogus" - * (isBogus() will return TRUE). + * (isBogus() will return true). * * @param language Lowercase two-letter or three-letter ISO-639 code. * This parameter can instead be an ICU style C locale (e.g. "en_US"), * but the other parameters must not be used. - * This parameter can be NULL; if so, + * This parameter can be nullptr; if so, * the locale is initialized to match the current default locale. * (This is the same as using the default constructor.) * Please note: The Java Locale class does NOT accept the form @@ -294,7 +294,7 @@ class U_COMMON_API Locale : public UObject { * @param other The Locale object being moved in. * @stable ICU 63 */ - Locale(Locale&& other) U_NOEXCEPT; + Locale(Locale&& other) noexcept; /** * Destructor @@ -320,31 +320,31 @@ class U_COMMON_API Locale : public UObject { * @return *this * @stable ICU 63 */ - Locale& operator=(Locale&& other) U_NOEXCEPT; + Locale& operator=(Locale&& other) noexcept; /** * Checks if two locale keys are the same. * * @param other The locale key object to be compared with this. - * @return True if the two locale keys are the same, false otherwise. + * @return true if the two locale keys are the same, false otherwise. * @stable ICU 2.0 */ - bool operator==(const Locale& other) const; + bool operator==(const Locale& other) const; /** * Checks if two locale keys are not the same. * * @param other The locale key object to be compared with this. - * @return True if the two locale keys are not the same, false + * @return true if the two locale keys are not the same, false * otherwise. * @stable ICU 2.0 */ - inline bool operator!=(const Locale& other) const; + inline bool operator!=(const Locale& other) const; /** * Clone this object. * Clones can be used concurrently in multiple threads. - * If an error occurs, then NULL is returned. + * If an error occurs, then nullptr is returned. * The caller must delete the clone. * * @return a clone of this object @@ -378,7 +378,7 @@ class U_COMMON_API Locale : public UObject { * setDefault() only changes ICU's default locale ID, not * the default locale ID of the runtime environment. * - * @param newLocale Locale to set to. If NULL, set to the value obtained + * @param newLocale Locale to set to. If nullptr, set to the value obtained * from the runtime environment. * @param success The error code. * @system @@ -393,13 +393,17 @@ class U_COMMON_API Locale : public UObject { * If the specified language tag contains any ill-formed subtags, * the first such subtag and all following subtags are ignored. *

- * This implements the 'Language-Tag' production of BCP47, and so - * supports grandfathered (regular and irregular) as well as private - * use language tags. Private use tags are represented as 'x-whatever', - * and grandfathered tags are converted to their canonical replacements - * where they exist. Note that a few grandfathered tags have no modern - * replacement, these will be converted using the fallback described in + * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in * the first paragraph, so some information might be lost. + * * @param tag the input BCP47 language tag. * @param status error information if creating the Locale failed. * @return the Locale for the specified BCP47 language tag. @@ -448,8 +452,8 @@ class U_COMMON_API Locale : public UObject { /** * Creates a locale from the given string after canonicalizing - * the string by calling uloc_canonicalize(). - * @param name the locale ID to create from. Must not be NULL. + * the string according to CLDR by calling uloc_canonicalize(). + * @param name the locale ID to create from. Must not be nullptr. * @return a new locale object corresponding to the given name * @stable ICU 3.0 * @see uloc_canonicalize @@ -567,11 +571,19 @@ class U_COMMON_API Locale : public UObject { */ void minimizeSubtags(UErrorCode& status); + /** + * Canonicalize the locale ID of this object according to CLDR. + * @param status the status code + * @stable ICU 67 + * @see createCanonical + */ + void canonicalize(UErrorCode& status); + /** * Gets the list of keywords for the specified locale. * * @param status the status code - * @return pointer to StringEnumeration class, or NULL if there are no keywords. + * @return pointer to StringEnumeration class, or nullptr if there are no keywords. * Client must dispose of it by calling delete. * @see getKeywords * @stable ICU 2.8 @@ -582,7 +594,7 @@ class U_COMMON_API Locale : public UObject { * Gets the list of Unicode keywords for the specified locale. * * @param status the status code - * @return pointer to StringEnumeration class, or NULL if there are no keywords. + * @return pointer to StringEnumeration class, or nullptr if there are no keywords. * Client must dispose of it by calling delete. * @see getUnicodeKeywords * @stable ICU 63 @@ -710,7 +722,7 @@ class U_COMMON_API Locale : public UObject { * * @param keywordName name of the keyword to be set. Case insensitive. * @param keywordValue value of the keyword to be set. If 0-length or - * NULL, will result in the keyword being removed. No error is given if + * nullptr, will result in the keyword being removed. No error is given if * that keyword does not exist. * @param status Returns any error information while performing this operation. * @@ -731,7 +743,7 @@ class U_COMMON_API Locale : public UObject { * * @param keywordName name of the keyword to be set. * @param keywordValue value of the keyword to be set. If 0-length or - * NULL, will result in the keyword being removed. No error is given if + * nullptr, will result in the keyword being removed. No error is given if * that keyword does not exist. * @param status Returns any error information while performing this operation. * @stable ICU 63 @@ -751,7 +763,7 @@ class U_COMMON_API Locale : public UObject { * * @param keywordName name of the keyword to be set. * @param keywordValue value of the keyword to be set. If 0-length or - * NULL, will result in the keyword being removed. No error is given if + * nullptr, will result in the keyword being removed. No error is given if * that keyword does not exist. * @param status Returns any error information while performing this operation. * @stable ICU 63 @@ -785,14 +797,14 @@ class U_COMMON_API Locale : public UObject { /** * Returns whether this locale's script is written right-to-left. * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). - * If no likely script is known, then FALSE is returned. + * If no likely script is known, then false is returned. * * A script is right-to-left according to the CLDR script metadata * which corresponds to whether the script's letters have Bidi_Class=R or AL. * - * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". + * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl". * - * @return TRUE if the locale's script is written right-to-left + * @return true if the locale's script is written right-to-left * @stable ICU 54 */ UBool isRightToLeft() const; @@ -946,7 +958,7 @@ class U_COMMON_API Locale : public UObject { /** * Gets the bogus state. Locale object can be bogus if it doesn't exist - * @return FALSE if it is a real locale, TRUE if it is a bogus locale + * @return false if it is a real locale, true if it is a bogus locale * @stable ICU 2.1 */ inline UBool isBogus(void) const; @@ -972,7 +984,10 @@ class U_COMMON_API Locale : public UObject { static const char* const* U_EXPORT2 getISOCountries(); /** - * Gets a list of all available language codes defined in ISO 639. This is a pointer + * Returns a list of all unique language codes defined in ISO 639. + * They can be 2 or 3 letter codes, as defined by + * + * BCP 47, section 2.2.1. This is a pointer * to an array of pointers to arrays of char. All of these pointers are owned * by ICU-- do not delete them, and do not write through them. The array is * terminated with a null pointer. @@ -993,34 +1008,33 @@ class U_COMMON_API Locale : public UObject { * * @stable ICU 2.2 */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; -#ifndef U_HIDE_DRAFT_API /** * A Locale iterator interface similar to a Java Iterator. - * @draft ICU 65 + * @stable ICU 65 */ class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ { public: - /** @draft ICU 65 */ + /** @stable ICU 65 */ virtual ~Iterator(); /** - * @return TRUE if next() can be called again. - * @draft ICU 65 + * @return true if next() can be called again. + * @stable ICU 65 */ virtual UBool hasNext() const = 0; /** * @return the next locale. - * @draft ICU 65 + * @stable ICU 65 */ virtual const Locale &next() = 0; }; /** * A generic Locale iterator implementation over Locale input iterators. - * @draft ICU 65 + * @stable ICU 65 */ template class RangeIterator : public Iterator, public UMemory { @@ -1032,19 +1046,19 @@ class U_COMMON_API Locale : public UObject { * * @param begin Start of range. * @param end Exclusive end of range. - * @draft ICU 65 + * @stable ICU 65 */ RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {} /** - * @return TRUE if next() can be called again. - * @draft ICU 65 + * @return true if next() can be called again. + * @stable ICU 65 */ UBool hasNext() const override { return it_ != end_; } /** * @return the next locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale &next() override { return *it_++; } @@ -1056,7 +1070,7 @@ class U_COMMON_API Locale : public UObject { /** * A generic Locale iterator implementation over Locale input iterators. * Calls the converter to convert each *begin to a const Locale &. - * @draft ICU 65 + * @stable ICU 65 */ template class ConvertingIterator : public Iterator, public UMemory { @@ -1069,20 +1083,20 @@ class U_COMMON_API Locale : public UObject { * @param begin Start of range. * @param end Exclusive end of range. * @param converter Converter from *begin to const Locale & or compatible. - * @draft ICU 65 + * @stable ICU 65 */ ConvertingIterator(Iter begin, Iter end, Conv converter) : it_(begin), end_(end), converter_(converter) {} /** - * @return TRUE if next() can be called again. - * @draft ICU 65 + * @return true if next() can be called again. + * @stable ICU 65 */ UBool hasNext() const override { return it_ != end_; } /** * @return the next locale. - * @draft ICU 65 + * @stable ICU 65 */ const Locale &next() override { return converter_(*it_++); } @@ -1091,7 +1105,6 @@ class U_COMMON_API Locale : public UObject { const Iter end_; Conv converter_; }; -#endif // U_HIDE_DRAFT_API protected: /* only protected for testing purposes. DO NOT USE. */ #ifndef U_HIDE_INTERNAL_API @@ -1100,6 +1113,15 @@ class U_COMMON_API Locale : public UObject { * @internal */ void setFromPOSIXID(const char *posixID); + /** + * Minimize the subtags for this Locale, per the algorithm described + * @param favorScript favor to keep script if true, to keep region if false. + * @param status error information if maximizing this Locale failed. + * If this Locale is not well-formed, the error code is + * U_ILLEGAL_ARGUMENT_ERROR. + * @internal + */ + void minimizeSubtags(bool favorScript, UErrorCode& status); #endif /* U_HIDE_INTERNAL_API */ private: diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/messagepattern.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/messagepattern.h index 3084c4267..55b09bfbd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/messagepattern.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/messagepattern.h @@ -265,7 +265,7 @@ typedef enum UMessagePatternArgType UMessagePatternArgType; /** * \def UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE - * Returns TRUE if the argument type has a plural style part sequence and semantics, + * Returns true if the argument type has a plural style part sequence and semantics, * for example UMSGPAT_ARG_TYPE_PLURAL and UMSGPAT_ARG_TYPE_SELECTORDINAL. * @stable ICU 50 */ @@ -388,7 +388,7 @@ class U_COMMON_API MessagePattern : public UObject { * @param pattern a MessageFormat pattern string * @param parseError Struct to receive information on the position * of an error within the pattern. - * Can be NULL. + * Can be nullptr. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with @@ -428,7 +428,7 @@ class U_COMMON_API MessagePattern : public UObject { * @param pattern a MessageFormat pattern string * @param parseError Struct to receive information on the position * of an error within the pattern. - * Can be NULL. + * Can be nullptr. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with @@ -448,7 +448,7 @@ class U_COMMON_API MessagePattern : public UObject { * @param pattern a ChoiceFormat pattern string * @param parseError Struct to receive information on the position * of an error within the pattern. - * Can be NULL. + * Can be nullptr. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with @@ -468,7 +468,7 @@ class U_COMMON_API MessagePattern : public UObject { * @param pattern a PluralFormat pattern string * @param parseError Struct to receive information on the position * of an error within the pattern. - * Can be NULL. + * Can be nullptr. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with @@ -488,7 +488,7 @@ class U_COMMON_API MessagePattern : public UObject { * @param pattern a SelectFormat pattern string * @param parseError Struct to receive information on the position * of an error within the pattern. - * Can be NULL. + * Can be nullptr. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with @@ -523,14 +523,14 @@ class U_COMMON_API MessagePattern : public UObject { /** * @param other another object to compare with. - * @return TRUE if this object is equivalent to the other one. + * @return true if this object is equivalent to the other one. * @stable ICU 4.8 */ bool operator==(const MessagePattern &other) const; /** * @param other another object to compare with. - * @return FALSE if this object is equivalent to the other one. + * @return false if this object is equivalent to the other one. * @stable ICU 4.8 */ inline bool operator!=(const MessagePattern &other) const { @@ -564,7 +564,7 @@ class U_COMMON_API MessagePattern : public UObject { /** * Does the parsed pattern have named arguments like {first_name}? - * @return TRUE if the parsed pattern has at least one named argument. + * @return true if the parsed pattern has at least one named argument. * @stable ICU 4.8 */ UBool hasNamedArguments() const { @@ -573,7 +573,7 @@ class U_COMMON_API MessagePattern : public UObject { /** * Does the parsed pattern have numbered arguments like {2}? - * @return TRUE if the parsed pattern has at least one numbered argument. + * @return true if the parsed pattern has at least one numbered argument. * @stable ICU 4.8 */ UBool hasNumberedArguments() const { @@ -664,7 +664,7 @@ class U_COMMON_API MessagePattern : public UObject { * Compares the part's substring with the input string s. * @param part a part of this MessagePattern. * @param s a string. - * @return TRUE if getSubstring(part).equals(s). + * @return true if getSubstring(part).equals(s). * @stable ICU 4.8 */ UBool partSubstringMatches(const Part &part, const UnicodeString &s) const { @@ -785,7 +785,7 @@ class U_COMMON_API MessagePattern : public UObject { * Indicates whether the Part type has a numeric value. * If so, then that numeric value can be retrieved via MessagePattern.getNumericValue(). * @param type The Part type to be tested. - * @return TRUE if the Part type has a numeric value. + * @return true if the Part type has a numeric value. * @stable ICU 4.8 */ static UBool hasNumericValue(UMessagePatternPartType type) { @@ -794,14 +794,14 @@ class U_COMMON_API MessagePattern : public UObject { /** * @param other another object to compare with. - * @return TRUE if this object is equivalent to the other one. + * @return true if this object is equivalent to the other one. * @stable ICU 4.8 */ bool operator==(const Part &other) const; /** * @param other another object to compare with. - * @return FALSE if this object is equivalent to the other one. + * @return false if this object is equivalent to the other one. * @stable ICU 4.8 */ inline bool operator!=(const Part &other) const { @@ -869,7 +869,7 @@ class U_COMMON_API MessagePattern : public UObject { * Parses a number from the specified message substring. * @param start start index into the message string * @param limit limit index into the message string, must be startFALSE, only canonical + * If this argument is false, only canonical * decomposition will be performed. * @param options the optional features to be enabled (0 for no options) * @param result The composed string (on output). @@ -256,7 +256,7 @@ class U_COMMON_API Normalizer : public UObject { * * @param source the string to be decomposed. * @param compat Perform compatibility decomposition. - * If this argument is FALSE, only canonical + * If this argument is false, only canonical * decomposition will be performed. * @param options the optional features to be enabled (0 for no options) * @param result The decomposed string (on output). @@ -315,7 +315,7 @@ class U_COMMON_API Normalizer : public UObject { * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will - * perform further tests to arrive at a TRUE/FALSE result. + * perform further tests to arrive at a true/false result. * * @param src String that is to be tested if it is in a normalization format. * @param mode Which normalization form to test for. @@ -577,24 +577,24 @@ class U_COMMON_API Normalizer : public UObject { int32_t endIndex(void) const; /** - * Returns TRUE when both iterators refer to the same character in the same + * Returns true when both iterators refer to the same character in the same * input text. * * @param that a Normalizer object to compare this one to * @return comparison result * @deprecated ICU 56 Use Normalizer2 instead. */ - bool operator==(const Normalizer& that) const; + bool operator==(const Normalizer& that) const; /** - * Returns FALSE when both iterators refer to the same character in the same + * Returns false when both iterators refer to the same character in the same * input text. * * @param that a Normalizer object to compare this one to * @return comparison result * @deprecated ICU 56 Use Normalizer2 instead. */ - inline bool operator!=(const Normalizer& that) const; + inline bool operator!=(const Normalizer& that) const; /** * Returns a pointer to a new Normalizer that is a clone of this one. @@ -655,8 +655,8 @@ class U_COMMON_API Normalizer : public UObject { * It is possible to specify multiple options that are all turned on or off. * * @param option the option(s) whose value is/are to be set. - * @param value the new setting for the option. Use TRUE to - * turn the option(s) on and FALSE to turn it/them off. + * @param value the new setting for the option. Use true to + * turn the option(s) on and false to turn it/them off. * * @see #getOption * @deprecated ICU 56 Use Normalizer2 instead. @@ -666,11 +666,11 @@ class U_COMMON_API Normalizer : public UObject { /** * Determine whether an option is turned on or off. - * If multiple options are specified, then the result is TRUE if any + * If multiple options are specified, then the result is true if any * of them are set. *

* @param option the option(s) that are to be checked - * @return TRUE if any of the option(s) are set + * @return true if any of the option(s) are set * @see #setOption * @deprecated ICU 56 Use Normalizer2 instead. */ @@ -732,7 +732,7 @@ class U_COMMON_API Normalizer : public UObject { * @return a UClassID for the actual class. * @deprecated ICU 56 Use Normalizer2 instead. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; #endif // U_FORCE_HIDE_DEPRECATED_API private: @@ -740,8 +740,8 @@ class U_COMMON_API Normalizer : public UObject { // Private functions //------------------------------------------------------------------------- - Normalizer(); // default constructor not implemented - Normalizer &operator=(const Normalizer &that); // assignment operator not implemented + Normalizer() = delete; // default constructor not implemented + Normalizer &operator=(const Normalizer &that) = delete; // assignment operator not implemented // Private utility methods for iteration // For documentation, see the source code @@ -755,7 +755,7 @@ class U_COMMON_API Normalizer : public UObject { // Private data //------------------------------------------------------------------------- - FilteredNormalizer2*fFilteredNorm2; // owned if not NULL + FilteredNormalizer2*fFilteredNorm2; // owned if not nullptr const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2 UNormalizationMode fUMode; // deprecated int32_t fOptions; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/parsepos.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/parsepos.h index 76c3fd282..d33a812ad 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/parsepos.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/parsepos.h @@ -97,22 +97,22 @@ class U_COMMON_API ParsePosition : public UObject { /** * Equality operator. - * @return TRUE if the two parse positions are equal, FALSE otherwise. + * @return true if the two parse positions are equal, false otherwise. * @stable ICU 2.0 */ - inline bool operator==(const ParsePosition& that) const; + inline bool operator==(const ParsePosition& that) const; /** * Equality operator. - * @return TRUE if the two parse positions are not equal, FALSE otherwise. + * @return true if the two parse positions are not equal, false otherwise. * @stable ICU 2.0 */ - inline bool operator!=(const ParsePosition& that) const; + inline bool operator!=(const ParsePosition& that) const; /** * Clone this object. * Clones can be used concurrently in multiple threads. - * If an error occurs, then NULL is returned. + * If an error occurs, then nullptr is returned. * The caller must delete the clone. * * @return a clone of this object @@ -166,7 +166,7 @@ class U_COMMON_API ParsePosition : public UObject { * * @stable ICU 2.2 */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; private: /** @@ -196,9 +196,9 @@ inline bool ParsePosition::operator==(const ParsePosition& copy) const { if(index != copy.index || errorIndex != copy.errorIndex) - return FALSE; + return false; else - return TRUE; + return true; } inline bool diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/platform.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/platform.h index ad75b298a..a99784366 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/platform.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/platform.h @@ -168,7 +168,7 @@ # define U_PLATFORM U_PF_LINUX #elif defined(__APPLE__) && defined(__MACH__) # include -# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */ +# if (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && (defined(TARGET_OS_MACCATALYST) && !TARGET_OS_MACCATALYST) /* variant of TARGET_OS_MAC */ # define U_PLATFORM U_PF_IPHONE # else # define U_PLATFORM U_PF_DARWIN @@ -460,6 +460,13 @@ # define UPRV_HAS_WARNING(x) 0 #endif + +#if defined(__clang__) +#define UPRV_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) +#else +#define UPRV_NO_SANITIZE_UNDEFINED +#endif + /** * \def U_MALLOC_ATTR * Attribute to mark functions as malloc-like @@ -509,26 +516,6 @@ # define U_CPLUSPLUS_VERSION 1 #endif -#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) -// add in std::nullptr_t -namespace std { - typedef decltype(nullptr) nullptr_t; -}; -#endif - -/** - * \def U_NOEXCEPT - * "noexcept" if supported, otherwise empty. - * Some code, especially STL containers, uses move semantics of objects only - * if the move constructor and the move operator are declared as not throwing exceptions. - * @internal - */ -#ifdef U_NOEXCEPT - /* Use the predefined value. */ -#else -# define U_NOEXCEPT noexcept -#endif - /** * \def U_FALLTHROUGH * Annotate intentional fall-through between switch labels. @@ -757,7 +744,7 @@ namespace std { * \def U_HAVE_CHAR16_T * Defines whether the char16_t type is available for UTF-16 * and u"abc" UTF-16 string literals are supported. - * This is a new standard type and standard string literal syntax in C++0x + * This is a new standard type and standard string literal syntax in C++11 * but has been available in some compilers before. * @internal */ @@ -766,12 +753,6 @@ namespace std { #else /* * Notes: - * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef - * and does not support u"abc" string literals. - * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for - * both char16_t and u"abc" string literals. - * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but - * does not support u"abc" string literals. * C++11 and C11 require support for UTF-16 literals * TODO: Fix for plain C. Doesn't work on Mac. */ @@ -814,8 +795,8 @@ namespace std { /* Use the predefined value. */ #elif defined(U_STATIC_IMPLEMENTATION) # define U_EXPORT -#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ - UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) +#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \ + UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__)) # define U_EXPORT __declspec(dllexport) #elif defined(__GNUC__) # define U_EXPORT __attribute__((visibility("default"))) @@ -828,7 +809,7 @@ namespace std { # define U_EXPORT #endif -/* U_CALLCONV is releated to U_EXPORT2 */ +/* U_CALLCONV is related to U_EXPORT2 */ #ifdef U_EXPORT2 /* Use the predefined value. */ #elif defined(_MSC_VER) @@ -839,14 +820,29 @@ namespace std { #ifdef U_IMPORT /* Use the predefined value. */ -#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ - UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) +#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \ + UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__)) /* Windows needs to export/import data. */ # define U_IMPORT __declspec(dllimport) #else # define U_IMPORT #endif +/** + * \def U_HIDDEN + * This is used to mark internal structs declared within external classes, + * to prevent the internal structs from having the same visibility as the + * class within which they are declared. + * @internal + */ +#ifdef U_HIDDEN + /* Use the predefined value. */ +#elif defined(__GNUC__) +# define U_HIDDEN __attribute__((visibility("hidden"))) +#else +# define U_HIDDEN +#endif + /** * \def U_CALLCONV * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary @@ -880,6 +876,6 @@ namespace std { #else # define U_CALLCONV_FPTR #endif -/* @} */ +/** @} */ #endif // _PLATFORM_H diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/putil.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/putil.h index 759b136c1..500c21252 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/putil.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/putil.h @@ -66,7 +66,7 @@ * * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); +U_CAPI const char* U_EXPORT2 u_getDataDirectory(void); /** @@ -88,7 +88,7 @@ U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); * @see u_init * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); +U_CAPI void U_EXPORT2 u_setDataDirectory(const char *directory); #ifndef U_HIDE_INTERNAL_API /** @@ -99,7 +99,7 @@ U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); * @return the time zone data override directory. * @internal */ -U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); +U_CAPI const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); /** * Set the time zone files override directory. @@ -109,7 +109,7 @@ U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status * will access the time zone data. * @internal */ -U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); +U_CAPI void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ @@ -155,7 +155,7 @@ U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCo * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_charsToUChars(const char *cs, UChar *us, int32_t length); /** @@ -177,7 +177,7 @@ u_charsToUChars(const char *cs, UChar *us, int32_t length); * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_UCharsToChars(const UChar *us, char *cs, int32_t length); #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/rbbi.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/rbbi.h index 978539625..045238ac5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/rbbi.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/rbbi.h @@ -1,704 +1,825 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// *************************************************************************** -// * Copyright (C) 1999-2016 International Business Machines Corporation * -// * and others. All rights reserved. * -// *************************************************************************** - -// ********************************************************************** -// * Date Name Description -// * 10/22/99 alan Creation. -// * 11/11/99 rgillam Complete port from Java. -// ********************************************************************** -// */ - -// #ifndef RBBI_H -// #define RBBI_H - -// #include "unicode/utypes.h" - -// #if U_SHOW_CPLUSPLUS_API - -// /** -// * \file -// * \brief C++ API: Rule Based Break Iterator -// */ - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/brkiter.h" -// #include "unicode/udata.h" -// #include "unicode/parseerr.h" -// #include "unicode/schriter.h" - -// U_NAMESPACE_BEGIN - -// /** @internal */ -// class LanguageBreakEngine; -// struct RBBIDataHeader; -// class RBBIDataWrapper; -// class UnhandledEngine; -// class UStack; - -// /** -// * -// * A subclass of BreakIterator whose behavior is specified using a list of rules. -// *

Instances of this class are most commonly created by the factory methods of -// * BreakIterator::createWordInstance(), BreakIterator::createLineInstance(), etc., -// * and then used via the abstract API in class BreakIterator

-// * -// *

See the ICU User Guide for information on Break Iterator Rules.

-// * -// *

This class is not intended to be subclassed.

-// */ -// class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { - -// private: -// /** -// * The UText through which this BreakIterator accesses the text -// * @internal (private) -// */ -// UText fText; - -// #ifndef U_HIDE_INTERNAL_API -// public: -// #endif /* U_HIDE_INTERNAL_API */ -// /** -// * The rule data for this BreakIterator instance. -// * Not for general use; Public only for testing purposes. -// * @internal -// */ -// RBBIDataWrapper *fData; -// private: - -// /** -// * The current position of the iterator. Pinned, 0 < fPosition <= text.length. -// * Never has the value UBRK_DONE (-1). -// */ -// int32_t fPosition; - -// /** -// * TODO: -// */ -// int32_t fRuleStatusIndex; - -// /** -// * Cache of previously determined boundary positions. -// */ -// class BreakCache; -// BreakCache *fBreakCache; - -// /** -// * Cache of boundary positions within a region of text that has been -// * sub-divided by dictionary based breaking. -// */ -// class DictionaryCache; -// DictionaryCache *fDictionaryCache; - -// /** -// * -// * If present, UStack of LanguageBreakEngine objects that might handle -// * dictionary characters. Searched from top to bottom to find an object to -// * handle a given character. -// * @internal (private) -// */ -// UStack *fLanguageBreakEngines; - -// /** -// * -// * If present, the special LanguageBreakEngine used for handling -// * characters that are in the dictionary set, but not handled by any -// * LanguageBreakEngine. -// * @internal (private) -// */ -// UnhandledEngine *fUnhandledBreakEngine; - -// /** -// * Counter for the number of characters encountered with the "dictionary" -// * flag set. -// * @internal (private) -// */ -// uint32_t fDictionaryCharCount; - -// /** -// * A character iterator that refers to the same text as the UText, above. -// * Only included for compatibility with old API, which was based on CharacterIterators. -// * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below. -// */ -// CharacterIterator *fCharIter; - -// /** -// * When the input text is provided by a UnicodeString, this will point to -// * a characterIterator that wraps that data. Needed only for the -// * implementation of getText(), a backwards compatibility issue. -// */ -// StringCharacterIterator fSCharIter; - -// /** -// * True when iteration has run off the end, and iterator functions should return UBRK_DONE. -// */ -// UBool fDone; - -// //======================================================================= -// // constructors -// //======================================================================= - -// /** -// * Constructor from a flattened set of RBBI data in malloced memory. -// * RulesBasedBreakIterators built from a custom set of rules -// * are created via this constructor; the rules are compiled -// * into memory, then the break iterator is constructed here. -// * -// * The break iterator adopts the memory, and will -// * free it when done. -// * @internal (private) -// */ -// RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status); - -// /** @internal */ -// friend class RBBIRuleBuilder; -// /** @internal */ -// friend class BreakIterator; - -// public: - -// /** Default constructor. Creates an empty shell of an iterator, with no -// * rules or text to iterate over. Object can subsequently be assigned to. -// * @stable ICU 2.2 -// */ -// RuleBasedBreakIterator(); - -// /** -// * Copy constructor. Will produce a break iterator with the same behavior, -// * and which iterates over the same text, as the one passed in. -// * @param that The RuleBasedBreakIterator passed to be copied -// * @stable ICU 2.0 -// */ -// RuleBasedBreakIterator(const RuleBasedBreakIterator& that); - -// /** -// * Construct a RuleBasedBreakIterator from a set of rules supplied as a string. -// * @param rules The break rules to be used. -// * @param parseError In the event of a syntax error in the rules, provides the location -// * within the rules of the problem. -// * @param status Information on any errors encountered. -// * @stable ICU 2.2 -// */ -// RuleBasedBreakIterator( const UnicodeString &rules, -// UParseError &parseError, -// UErrorCode &status); - -// /** -// * Construct a RuleBasedBreakIterator from a set of precompiled binary rules. -// * Binary rules are obtained from RulesBasedBreakIterator::getBinaryRules(). -// * Construction of a break iterator in this way is substantially faster than -// * construction from source rules. -// * -// * Ownership of the storage containing the compiled rules remains with the -// * caller of this function. The compiled rules must not be modified or -// * deleted during the life of the break iterator. -// * -// * The compiled rules are not compatible across different major versions of ICU. -// * The compiled rules are compatible only between machines with the same -// * byte ordering (little or big endian) and the same base character set family -// * (ASCII or EBCDIC). -// * -// * @see #getBinaryRules -// * @param compiledRules A pointer to the compiled break rules to be used. -// * @param ruleLength The length of the compiled break rules, in bytes. This -// * corresponds to the length value produced by getBinaryRules(). -// * @param status Information on any errors encountered, including invalid -// * binary rules. -// * @stable ICU 4.8 -// */ -// RuleBasedBreakIterator(const uint8_t *compiledRules, -// uint32_t ruleLength, -// UErrorCode &status); - -// /** -// * This constructor uses the udata interface to create a BreakIterator -// * whose internal tables live in a memory-mapped file. "image" is an -// * ICU UDataMemory handle for the pre-compiled break iterator tables. -// * @param image handle to the memory image for the break iterator data. -// * Ownership of the UDataMemory handle passes to the Break Iterator, -// * which will be responsible for closing it when it is no longer needed. -// * @param status Information on any errors encountered. -// * @see udata_open -// * @see #getBinaryRules -// * @stable ICU 2.8 -// */ -// RuleBasedBreakIterator(UDataMemory* image, UErrorCode &status); - -// /** -// * Destructor -// * @stable ICU 2.0 -// */ -// virtual ~RuleBasedBreakIterator(); - -// /** -// * Assignment operator. Sets this iterator to have the same behavior, -// * and iterate over the same text, as the one passed in. -// * @param that The RuleBasedBreakItertor passed in -// * @return the newly created RuleBasedBreakIterator -// * @stable ICU 2.0 -// */ -// RuleBasedBreakIterator& operator=(const RuleBasedBreakIterator& that); - -// /** -// * Equality operator. Returns TRUE if both BreakIterators are of the -// * same class, have the same behavior, and iterate over the same text. -// * @param that The BreakIterator to be compared for equality -// * @return TRUE if both BreakIterators are of the -// * same class, have the same behavior, and iterate over the same text. -// * @stable ICU 2.0 -// */ -// virtual bool operator==(const BreakIterator& that) const; - -// /** -// * Not-equal operator. If operator== returns TRUE, this returns FALSE, -// * and vice versa. -// * @param that The BreakIterator to be compared for inequality -// * @return TRUE if both BreakIterators are not same. -// * @stable ICU 2.0 -// */ -// inline bool operator!=(const BreakIterator& that) const; - -// /** -// * Returns a newly-constructed RuleBasedBreakIterator with the same -// * behavior, and iterating over the same text, as this one. -// * Differs from the copy constructor in that it is polymorphic, and -// * will correctly clone (copy) a derived class. -// * clone() is thread safe. Multiple threads may simultaneously -// * clone the same source break iterator. -// * @return a newly-constructed RuleBasedBreakIterator -// * @stable ICU 2.0 -// */ -// virtual RuleBasedBreakIterator* clone() const; - -// /** -// * Compute a hash code for this BreakIterator -// * @return A hash code -// * @stable ICU 2.0 -// */ -// virtual int32_t hashCode(void) const; - -// /** -// * Returns the description used to create this iterator -// * @return the description used to create this iterator -// * @stable ICU 2.0 -// */ -// virtual const UnicodeString& getRules(void) const; - -// //======================================================================= -// // BreakIterator overrides -// //======================================================================= - -// /** -// *

-// * Return a CharacterIterator over the text being analyzed. -// * The returned character iterator is owned by the break iterator, and must -// * not be deleted by the caller. Repeated calls to this function may -// * return the same CharacterIterator. -// *

-// *

-// * The returned character iterator must not be used concurrently with -// * the break iterator. If concurrent operation is needed, clone the -// * returned character iterator first and operate on the clone. -// *

-// *

-// * When the break iterator is operating on text supplied via a UText, -// * this function will fail. Lacking any way to signal failures, it -// * returns an CharacterIterator containing no text. -// * The function getUText() provides similar functionality, -// * is reliable, and is more efficient. -// *

-// * -// * TODO: deprecate this function? -// * -// * @return An iterator over the text being analyzed. -// * @stable ICU 2.0 -// */ -// virtual CharacterIterator& getText(void) const; - - -// /** -// * Get a UText for the text being analyzed. -// * The returned UText is a shallow clone of the UText used internally -// * by the break iterator implementation. It can safely be used to -// * access the text without impacting any break iterator operations, -// * but the underlying text itself must not be altered. -// * -// * @param fillIn A UText to be filled in. If NULL, a new UText will be -// * allocated to hold the result. -// * @param status receives any error codes. -// * @return The current UText for this break iterator. If an input -// * UText was provided, it will always be returned. -// * @stable ICU 3.4 -// */ -// virtual UText *getUText(UText *fillIn, UErrorCode &status) const; - -// /** -// * Set the iterator to analyze a new piece of text. This function resets -// * the current iteration position to the beginning of the text. -// * @param newText An iterator over the text to analyze. The BreakIterator -// * takes ownership of the character iterator. The caller MUST NOT delete it! -// * @stable ICU 2.0 -// */ -// virtual void adoptText(CharacterIterator* newText); - -// /** -// * Set the iterator to analyze a new piece of text. This function resets -// * the current iteration position to the beginning of the text. -// * -// * The BreakIterator will retain a reference to the supplied string. -// * The caller must not modify or delete the text while the BreakIterator -// * retains the reference. -// * -// * @param newText The text to analyze. -// * @stable ICU 2.0 -// */ -// virtual void setText(const UnicodeString& newText); - -// /** -// * Reset the break iterator to operate over the text represented by -// * the UText. The iterator position is reset to the start. -// * -// * This function makes a shallow clone of the supplied UText. This means -// * that the caller is free to immediately close or otherwise reuse the -// * Utext that was passed as a parameter, but that the underlying text itself -// * must not be altered while being referenced by the break iterator. -// * -// * @param text The UText used to change the text. -// * @param status Receives any error codes. -// * @stable ICU 3.4 -// */ -// virtual void setText(UText *text, UErrorCode &status); - -// /** -// * Sets the current iteration position to the beginning of the text, position zero. -// * @return The offset of the beginning of the text, zero. -// * @stable ICU 2.0 -// */ -// virtual int32_t first(void); - -// /** -// * Sets the current iteration position to the end of the text. -// * @return The text's past-the-end offset. -// * @stable ICU 2.0 -// */ -// virtual int32_t last(void); - -// /** -// * Advances the iterator either forward or backward the specified number of steps. -// * Negative values move backward, and positive values move forward. This is -// * equivalent to repeatedly calling next() or previous(). -// * @param n The number of steps to move. The sign indicates the direction -// * (negative is backwards, and positive is forwards). -// * @return The character offset of the boundary position n boundaries away from -// * the current one. -// * @stable ICU 2.0 -// */ -// virtual int32_t next(int32_t n); - -// /** -// * Advances the iterator to the next boundary position. -// * @return The position of the first boundary after this one. -// * @stable ICU 2.0 -// */ -// virtual int32_t next(void); - -// /** -// * Moves the iterator backwards, to the last boundary preceding this one. -// * @return The position of the last boundary position preceding this one. -// * @stable ICU 2.0 -// */ -// virtual int32_t previous(void); - -// /** -// * Sets the iterator to refer to the first boundary position following -// * the specified position. -// * @param offset The position from which to begin searching for a break position. -// * @return The position of the first break after the current position. -// * @stable ICU 2.0 -// */ -// virtual int32_t following(int32_t offset); - -// /** -// * Sets the iterator to refer to the last boundary position before the -// * specified position. -// * @param offset The position to begin searching for a break from. -// * @return The position of the last boundary before the starting position. -// * @stable ICU 2.0 -// */ -// virtual int32_t preceding(int32_t offset); - -// /** -// * Returns true if the specified position is a boundary position. As a side -// * effect, leaves the iterator pointing to the first boundary position at -// * or after "offset". -// * @param offset the offset to check. -// * @return True if "offset" is a boundary position. -// * @stable ICU 2.0 -// */ -// virtual UBool isBoundary(int32_t offset); - -// /** -// * Returns the current iteration position. Note that UBRK_DONE is never -// * returned from this function; if iteration has run to the end of a -// * string, current() will return the length of the string while -// * next() will return UBRK_DONE). -// * @return The current iteration position. -// * @stable ICU 2.0 -// */ -// virtual int32_t current(void) const; - - -// /** -// * Return the status tag from the break rule that determined the boundary at -// * the current iteration position. For break rules that do not specify a -// * status, a default value of 0 is returned. If more than one break rule -// * would cause a boundary to be located at some position in the text, -// * the numerically largest of the applicable status values is returned. -// *

-// * Of the standard types of ICU break iterators, only word break and -// * line break provide status values. The values are defined in -// * the header file ubrk.h. For Word breaks, the status allows distinguishing between words -// * that contain alphabetic letters, "words" that appear to be numbers, -// * punctuation and spaces, words containing ideographic characters, and -// * more. For Line Break, the status distinguishes between hard (mandatory) breaks -// * and soft (potential) break positions. -// *

-// * getRuleStatus() can be called after obtaining a boundary -// * position from next(), previous(), or -// * any other break iterator functions that returns a boundary position. -// *

-// * Note that getRuleStatus() returns the value corresponding to -// * current() index even after next() has returned DONE. -// *

-// * When creating custom break rules, one is free to define whatever -// * status values may be convenient for the application. -// *

-// * @return the status from the break rule that determined the boundary -// * at the current iteration position. -// * -// * @see UWordBreak -// * @stable ICU 2.2 -// */ -// virtual int32_t getRuleStatus() const; - -// /** -// * Get the status (tag) values from the break rule(s) that determined the boundary -// * at the current iteration position. -// *

-// * The returned status value(s) are stored into an array provided by the caller. -// * The values are stored in sorted (ascending) order. -// * If the capacity of the output array is insufficient to hold the data, -// * the output will be truncated to the available length, and a -// * U_BUFFER_OVERFLOW_ERROR will be signaled. -// * -// * @param fillInVec an array to be filled in with the status values. -// * @param capacity the length of the supplied vector. A length of zero causes -// * the function to return the number of status values, in the -// * normal way, without attempting to store any values. -// * @param status receives error codes. -// * @return The number of rule status values from the rules that determined -// * the boundary at the current iteration position. -// * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value -// * is the total number of status values that were available, -// * not the reduced number that were actually returned. -// * @see getRuleStatus -// * @stable ICU 3.0 -// */ -// virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); - -// /** -// * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. -// * This method is to implement a simple version of RTTI, since not all -// * C++ compilers support genuine RTTI. Polymorphic operator==() and -// * clone() methods call this method. -// * -// * @return The class ID for this object. All objects of a -// * given class have the same class ID. Objects of -// * other classes have different class IDs. -// * @stable ICU 2.0 -// */ -// virtual UClassID getDynamicClassID(void) const; - -// /** -// * Returns the class ID for this class. This is useful only for -// * comparing to a return value from getDynamicClassID(). For example: -// * -// * Base* polymorphic_pointer = createPolymorphicObject(); -// * if (polymorphic_pointer->getDynamicClassID() == -// * Derived::getStaticClassID()) ... -// * -// * @return The class ID for all objects of this class. -// * @stable ICU 2.0 -// */ -// static UClassID U_EXPORT2 getStaticClassID(void); - -// #ifndef U_FORCE_HIDE_DEPRECATED_API -// /** -// * Deprecated functionality. Use clone() instead. -// * -// * Create a clone (copy) of this break iterator in memory provided -// * by the caller. The idea is to increase performance by avoiding -// * a storage allocation. Use of this function is NOT RECOMMENDED. -// * Performance gains are minimal, and correct buffer management is -// * tricky. Use clone() instead. -// * -// * @param stackBuffer The pointer to the memory into which the cloned object -// * should be placed. If NULL, allocate heap memory -// * for the cloned object. -// * @param BufferSize The size of the buffer. If zero, return the required -// * buffer size, but do not clone the object. If the -// * size was too small (but not zero), allocate heap -// * storage for the cloned object. -// * -// * @param status Error status. U_SAFECLONE_ALLOCATED_WARNING will be -// * returned if the provided buffer was too small, and -// * the clone was therefore put on the heap. -// * -// * @return Pointer to the clone object. This may differ from the stackBuffer -// * address if the byte alignment of the stack buffer was not suitable -// * or if the stackBuffer was too small to hold the clone. -// * @deprecated ICU 52. Use clone() instead. -// */ -// virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer, -// int32_t &BufferSize, -// UErrorCode &status); -// #endif // U_FORCE_HIDE_DEPRECATED_API - -// /** -// * Return the binary form of compiled break rules, -// * which can then be used to create a new break iterator at some -// * time in the future. Creating a break iterator from pre-compiled rules -// * is much faster than building one from the source form of the -// * break rules. -// * -// * The binary data can only be used with the same version of ICU -// * and on the same platform type (processor endian-ness) -// * -// * @param length Returns the length of the binary data. (Out parameter.) -// * -// * @return A pointer to the binary (compiled) rule data. The storage -// * belongs to the RulesBasedBreakIterator object, not the -// * caller, and must not be modified or deleted. -// * @stable ICU 4.8 -// */ -// virtual const uint8_t *getBinaryRules(uint32_t &length); - -// /** -// * Set the subject text string upon which the break iterator is operating -// * without changing any other aspect of the matching state. -// * The new and previous text strings must have the same content. -// * -// * This function is intended for use in environments where ICU is operating on -// * strings that may move around in memory. It provides a mechanism for notifying -// * ICU that the string has been relocated, and providing a new UText to access the -// * string in its new position. -// * -// * Note that the break iterator implementation never copies the underlying text -// * of a string being processed, but always operates directly on the original text -// * provided by the user. Refreshing simply drops the references to the old text -// * and replaces them with references to the new. -// * -// * Caution: this function is normally used only by very specialized, -// * system-level code. One example use case is with garbage collection that moves -// * the text in memory. -// * -// * @param input The new (moved) text string. -// * @param status Receives errors detected by this function. -// * @return *this -// * -// * @stable ICU 49 -// */ -// virtual RuleBasedBreakIterator &refreshInputText(UText *input, UErrorCode &status); - - -// private: -// //======================================================================= -// // implementation -// //======================================================================= -// /** -// * Dumps caches and performs other actions associated with a complete change -// * in text or iteration position. -// * @internal (private) -// */ -// void reset(void); - -// /** -// * Common initialization function, used by constructors and bufferClone. -// * @internal (private) -// */ -// void init(UErrorCode &status); - -// /** -// * Iterate backwards from an arbitrary position in the input text using the -// * synthesized Safe Reverse rules. -// * This locates a "Safe Position" from which the forward break rules -// * will operate correctly. A Safe Position is not necessarily a boundary itself. -// * -// * @param fromPosition the position in the input text to begin the iteration. -// * @internal (private) -// */ -// int32_t handleSafePrevious(int32_t fromPosition); - -// /** -// * Find a rule-based boundary by running the state machine. -// * Input -// * fPosition, the position in the text to begin from. -// * Output -// * fPosition: the boundary following the starting position. -// * fDictionaryCharCount the number of dictionary characters encountered. -// * If > 0, the segment will be further subdivided -// * fRuleStatusIndex Info from the state table indicating which rules caused the boundary. -// * -// * @internal (private) -// */ -// int32_t handleNext(); - - -// /** -// * This function returns the appropriate LanguageBreakEngine for a -// * given character c. -// * @param c A character in the dictionary set -// * @internal (private) -// */ -// const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c); - -// public: -// #ifndef U_HIDE_INTERNAL_API -// /** -// * Debugging function only. -// * @internal -// */ -// void dumpCache(); - -// /** -// * Debugging function only. -// * @internal -// */ -// void dumpTables(); - -// #endif /* U_HIDE_INTERNAL_API */ -// }; - -// //------------------------------------------------------------------------------ -// // -// // Inline Functions Definitions ... -// // -// //------------------------------------------------------------------------------ - -// inline UBool RuleBasedBreakIterator::operator!=(const BreakIterator& that) const { -// return !operator==(that); -// } - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ - -// #endif /* U_SHOW_CPLUSPLUS_API */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +*************************************************************************** +* Copyright (C) 1999-2016 International Business Machines Corporation * +* and others. All rights reserved. * +*************************************************************************** + +********************************************************************** +* Date Name Description +* 10/22/99 alan Creation. +* 11/11/99 rgillam Complete port from Java. +********************************************************************** +*/ + +#ifndef RBBI_H +#define RBBI_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C++ API: Rule Based Break Iterator + */ + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/brkiter.h" +#include "unicode/udata.h" +#include "unicode/parseerr.h" +#include "unicode/schriter.h" + +struct UCPTrie; + +U_NAMESPACE_BEGIN + +/** @internal */ +class LanguageBreakEngine; +struct RBBIDataHeader; +class RBBIDataWrapper; +class UnhandledEngine; +class UStack; + + +#ifndef U_HIDE_DRAFT_API +/** + * The ExternalBreakEngine class define an abstract interface for the host environment + * to provide a low level facility to break text for unicode text in script that the text boundary + * cannot be handled by upper level rule based logic, for example, for Chinese and Japanese + * word breaking, Thai, Khmer, Burmese, Lao and other Southeast Asian scripts. + * The host environment implement one or more subclass of ExternalBreakEngine and + * register them in the initialization time by calling + * RuleBasedBreakIterator::registerExternalBreakEngine(). ICU adopt and own the engine and will + * delete the registered external engine in proper time during the clean up + * event. + * @internal ICU 74 technology preview + */ +class ExternalBreakEngine : public UObject { + public: + /** + * destructor + * @internal ICU 74 technology preview + */ + virtual ~ExternalBreakEngine() {} + + /** + *

Indicate whether this engine handles a particular character when + * the RuleBasedBreakIterator is used for a particular locale. This method is used + * by the RuleBasedBreakIterator to find a break engine.

+ * @param c A character which begins a run that the engine might handle. + * @param locale The locale. + * @return true if this engine handles the particular character for that locale. + * @internal ICU 74 technology preview + */ + virtual bool isFor(UChar32 c, const char* locale) const = 0; + + /** + *

Indicate whether this engine handles a particular character.This method is + * used by the RuleBasedBreakIterator after it already find a break engine to see which + * characters after the first one can be handled by this break engine.

+ * @param c A character that the engine might handle. + * @return true if this engine handles the particular character. + * @internal ICU 74 technology preview + */ + virtual bool handles(UChar32 c) const = 0; + + /** + *

Divide up a range of text handled by this break engine.

+ * + * @param text A UText representing the text + * @param start The start of the range of known characters + * @param end The end of the range of known characters + * @param foundBreaks Output of C array of int32_t break positions, or + * nullptr + * @param foundBreaksCapacity The capacity of foundBreaks + * @param status Information on any errors encountered. + * @return The number of breaks found + * @internal ICU 74 technology preview + */ + virtual int32_t fillBreaks(UText* text, int32_t start, int32_t end, + int32_t* foundBreaks, int32_t foundBreaksCapacity, + UErrorCode& status) const = 0; +}; +#endif /* U_HIDE_DRAFT_API */ + + +/** + * + * A subclass of BreakIterator whose behavior is specified using a list of rules. + *

Instances of this class are most commonly created by the factory methods of + * BreakIterator::createWordInstance(), BreakIterator::createLineInstance(), etc., + * and then used via the abstract API in class BreakIterator

+ * + *

See the ICU User Guide for information on Break Iterator Rules.

+ * + *

This class is not intended to be subclassed.

+ */ +class U_COMMON_API RuleBasedBreakIterator /*final*/ : public BreakIterator { + +private: + /** + * The UText through which this BreakIterator accesses the text + * @internal (private) + */ + UText fText = UTEXT_INITIALIZER; + +#ifndef U_HIDE_INTERNAL_API +public: +#endif /* U_HIDE_INTERNAL_API */ + /** + * The rule data for this BreakIterator instance. + * Not for general use; Public only for testing purposes. + * @internal + */ + RBBIDataWrapper *fData = nullptr; + +private: + /** + * The saved error code associated with this break iterator. + * This is the value to be returned by copyErrorTo(). + */ + UErrorCode fErrorCode = U_ZERO_ERROR; + + /** + * The current position of the iterator. Pinned, 0 < fPosition <= text.length. + * Never has the value UBRK_DONE (-1). + */ + int32_t fPosition = 0; + + /** + * TODO: + */ + int32_t fRuleStatusIndex = 0; + + /** + * Cache of previously determined boundary positions. + */ + class BreakCache; + BreakCache *fBreakCache = nullptr; + + /** + * Cache of boundary positions within a region of text that has been + * sub-divided by dictionary based breaking. + */ + class DictionaryCache; + DictionaryCache *fDictionaryCache = nullptr; + + /** + * + * If present, UStack of LanguageBreakEngine objects that might handle + * dictionary characters. Searched from top to bottom to find an object to + * handle a given character. + * @internal (private) + */ + UStack *fLanguageBreakEngines = nullptr; + + /** + * + * If present, the special LanguageBreakEngine used for handling + * characters that are in the dictionary set, but not handled by any + * LanguageBreakEngine. + * @internal (private) + */ + UnhandledEngine *fUnhandledBreakEngine = nullptr; + + /** + * Counter for the number of characters encountered with the "dictionary" + * flag set. + * @internal (private) + */ + uint32_t fDictionaryCharCount = 0; + + /** + * A character iterator that refers to the same text as the UText, above. + * Only included for compatibility with old API, which was based on CharacterIterators. + * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below. + */ + CharacterIterator *fCharIter = &fSCharIter; + + /** + * When the input text is provided by a UnicodeString, this will point to + * a characterIterator that wraps that data. Needed only for the + * implementation of getText(), a backwards compatibility issue. + */ + UCharCharacterIterator fSCharIter {u"", 0}; + + /** + * True when iteration has run off the end, and iterator functions should return UBRK_DONE. + */ + bool fDone = false; + + /** + * Array of look-ahead tentative results. + */ + int32_t *fLookAheadMatches = nullptr; + + /** + * A flag to indicate if phrase based breaking is enabled. + */ + UBool fIsPhraseBreaking = false; + + //======================================================================= + // constructors + //======================================================================= + + /** + * Constructor from a flattened set of RBBI data in malloced memory. + * RulesBasedBreakIterators built from a custom set of rules + * are created via this constructor; the rules are compiled + * into memory, then the break iterator is constructed here. + * + * The break iterator adopts the memory, and will + * free it when done. + * @internal (private) + */ + RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status); + + /** + * This constructor uses the udata interface to create a BreakIterator + * whose internal tables live in a memory-mapped file. "image" is an + * ICU UDataMemory handle for the pre-compiled break iterator tables. + * @param image handle to the memory image for the break iterator data. + * Ownership of the UDataMemory handle passes to the Break Iterator, + * which will be responsible for closing it when it is no longer needed. + * @param status Information on any errors encountered. + * @param isPhraseBreaking true if phrase based breaking is required, otherwise false. + * @see udata_open + * @see #getBinaryRules + * @internal (private) + */ + RuleBasedBreakIterator(UDataMemory* image, UBool isPhraseBreaking, UErrorCode &status); + + /** @internal */ + friend class RBBIRuleBuilder; + /** @internal */ + friend class BreakIterator; + + /** + * Default constructor with an error code parameter. + * Aside from error handling, otherwise identical to the default constructor. + * Internally, handles common initialization for other constructors. + * @internal (private) + */ + RuleBasedBreakIterator(UErrorCode *status); + +public: + + /** Default constructor. Creates an empty shell of an iterator, with no + * rules or text to iterate over. Object can subsequently be assigned to, + * but is otherwise unusable. + * @stable ICU 2.2 + */ + RuleBasedBreakIterator(); + + /** + * Copy constructor. Will produce a break iterator with the same behavior, + * and which iterates over the same text, as the one passed in. + * @param that The RuleBasedBreakIterator passed to be copied + * @stable ICU 2.0 + */ + RuleBasedBreakIterator(const RuleBasedBreakIterator& that); + + /** + * Construct a RuleBasedBreakIterator from a set of rules supplied as a string. + * @param rules The break rules to be used. + * @param parseError In the event of a syntax error in the rules, provides the location + * within the rules of the problem. + * @param status Information on any errors encountered. + * @stable ICU 2.2 + */ + RuleBasedBreakIterator( const UnicodeString &rules, + UParseError &parseError, + UErrorCode &status); + + /** + * Construct a RuleBasedBreakIterator from a set of precompiled binary rules. + * Binary rules are obtained from RulesBasedBreakIterator::getBinaryRules(). + * Construction of a break iterator in this way is substantially faster than + * construction from source rules. + * + * Ownership of the storage containing the compiled rules remains with the + * caller of this function. The compiled rules must not be modified or + * deleted during the life of the break iterator. + * + * The compiled rules are not compatible across different major versions of ICU. + * The compiled rules are compatible only between machines with the same + * byte ordering (little or big endian) and the same base character set family + * (ASCII or EBCDIC). + * + * @see #getBinaryRules + * @param compiledRules A pointer to the compiled break rules to be used. + * @param ruleLength The length of the compiled break rules, in bytes. This + * corresponds to the length value produced by getBinaryRules(). + * @param status Information on any errors encountered, including invalid + * binary rules. + * @stable ICU 4.8 + */ + RuleBasedBreakIterator(const uint8_t *compiledRules, + uint32_t ruleLength, + UErrorCode &status); + + /** + * This constructor uses the udata interface to create a BreakIterator + * whose internal tables live in a memory-mapped file. "image" is an + * ICU UDataMemory handle for the pre-compiled break iterator tables. + * @param image handle to the memory image for the break iterator data. + * Ownership of the UDataMemory handle passes to the Break Iterator, + * which will be responsible for closing it when it is no longer needed. + * @param status Information on any errors encountered. + * @see udata_open + * @see #getBinaryRules + * @stable ICU 2.8 + */ + RuleBasedBreakIterator(UDataMemory* image, UErrorCode &status); + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~RuleBasedBreakIterator(); + + /** + * Assignment operator. Sets this iterator to have the same behavior, + * and iterate over the same text, as the one passed in. + * @param that The RuleBasedBreakItertor passed in + * @return the newly created RuleBasedBreakIterator + * @stable ICU 2.0 + */ + RuleBasedBreakIterator& operator=(const RuleBasedBreakIterator& that); + + /** + * Equality operator. Returns true if both BreakIterators are of the + * same class, have the same behavior, and iterate over the same text. + * @param that The BreakIterator to be compared for equality + * @return true if both BreakIterators are of the + * same class, have the same behavior, and iterate over the same text. + * @stable ICU 2.0 + */ + virtual bool operator==(const BreakIterator& that) const override; + + /** + * Not-equal operator. If operator== returns true, this returns false, + * and vice versa. + * @param that The BreakIterator to be compared for inequality + * @return true if both BreakIterators are not same. + * @stable ICU 2.0 + */ + inline bool operator!=(const BreakIterator& that) const { + return !operator==(that); + } + + /** + * Returns a newly-constructed RuleBasedBreakIterator with the same + * behavior, and iterating over the same text, as this one. + * Differs from the copy constructor in that it is polymorphic, and + * will correctly clone (copy) a derived class. + * clone() is thread safe. Multiple threads may simultaneously + * clone the same source break iterator. + * @return a newly-constructed RuleBasedBreakIterator + * @stable ICU 2.0 + */ + virtual RuleBasedBreakIterator* clone() const override; + + /** + * Compute a hash code for this BreakIterator + * @return A hash code + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const; + + /** + * Returns the description used to create this iterator + * @return the description used to create this iterator + * @stable ICU 2.0 + */ + virtual const UnicodeString& getRules(void) const; + + //======================================================================= + // BreakIterator overrides + //======================================================================= + + /** + *

+ * Return a CharacterIterator over the text being analyzed. + * The returned character iterator is owned by the break iterator, and must + * not be deleted by the caller. Repeated calls to this function may + * return the same CharacterIterator. + *

+ *

+ * The returned character iterator must not be used concurrently with + * the break iterator. If concurrent operation is needed, clone the + * returned character iterator first and operate on the clone. + *

+ *

+ * When the break iterator is operating on text supplied via a UText, + * this function will fail, returning a CharacterIterator containing no text. + * The function getUText() provides similar functionality, + * is reliable, and is more efficient. + *

+ * + * TODO: deprecate this function? + * + * @return An iterator over the text being analyzed. + * @stable ICU 2.0 + */ + virtual CharacterIterator& getText(void) const override; + + + /** + * Get a UText for the text being analyzed. + * The returned UText is a shallow clone of the UText used internally + * by the break iterator implementation. It can safely be used to + * access the text without impacting any break iterator operations, + * but the underlying text itself must not be altered. + * + * @param fillIn A UText to be filled in. If nullptr, a new UText will be + * allocated to hold the result. + * @param status receives any error codes. + * @return The current UText for this break iterator. If an input + * UText was provided, it will always be returned. + * @stable ICU 3.4 + */ + virtual UText *getUText(UText *fillIn, UErrorCode &status) const override; + + /** + * Set the iterator to analyze a new piece of text. This function resets + * the current iteration position to the beginning of the text. + * @param newText An iterator over the text to analyze. The BreakIterator + * takes ownership of the character iterator. The caller MUST NOT delete it! + * @stable ICU 2.0 + */ + virtual void adoptText(CharacterIterator* newText) override; + + /** + * Set the iterator to analyze a new piece of text. This function resets + * the current iteration position to the beginning of the text. + * + * The BreakIterator will retain a reference to the supplied string. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param newText The text to analyze. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString& newText) override; + + /** + * Reset the break iterator to operate over the text represented by + * the UText. The iterator position is reset to the start. + * + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * Utext that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * + * @param text The UText used to change the text. + * @param status Receives any error codes. + * @stable ICU 3.4 + */ + virtual void setText(UText *text, UErrorCode &status) override; + + /** + * Sets the current iteration position to the beginning of the text, position zero. + * @return The offset of the beginning of the text, zero. + * @stable ICU 2.0 + */ + virtual int32_t first(void) override; + + /** + * Sets the current iteration position to the end of the text. + * @return The text's past-the-end offset. + * @stable ICU 2.0 + */ + virtual int32_t last(void) override; + + /** + * Advances the iterator either forward or backward the specified number of steps. + * Negative values move backward, and positive values move forward. This is + * equivalent to repeatedly calling next() or previous(). + * @param n The number of steps to move. The sign indicates the direction + * (negative is backwards, and positive is forwards). + * @return The character offset of the boundary position n boundaries away from + * the current one. + * @stable ICU 2.0 + */ + virtual int32_t next(int32_t n) override; + + /** + * Advances the iterator to the next boundary position. + * @return The position of the first boundary after this one. + * @stable ICU 2.0 + */ + virtual int32_t next(void) override; + + /** + * Moves the iterator backwards, to the last boundary preceding this one. + * @return The position of the last boundary position preceding this one. + * @stable ICU 2.0 + */ + virtual int32_t previous(void) override; + + /** + * Sets the iterator to refer to the first boundary position following + * the specified position. + * @param offset The position from which to begin searching for a break position. + * @return The position of the first break after the current position. + * @stable ICU 2.0 + */ + virtual int32_t following(int32_t offset) override; + + /** + * Sets the iterator to refer to the last boundary position before the + * specified position. + * @param offset The position to begin searching for a break from. + * @return The position of the last boundary before the starting position. + * @stable ICU 2.0 + */ + virtual int32_t preceding(int32_t offset) override; + + /** + * Returns true if the specified position is a boundary position. As a side + * effect, leaves the iterator pointing to the first boundary position at + * or after "offset". + * @param offset the offset to check. + * @return True if "offset" is a boundary position. + * @stable ICU 2.0 + */ + virtual UBool isBoundary(int32_t offset) override; + + /** + * Returns the current iteration position. Note that UBRK_DONE is never + * returned from this function; if iteration has run to the end of a + * string, current() will return the length of the string while + * next() will return UBRK_DONE). + * @return The current iteration position. + * @stable ICU 2.0 + */ + virtual int32_t current(void) const override; + + + /** + * Return the status tag from the break rule that determined the boundary at + * the current iteration position. For break rules that do not specify a + * status, a default value of 0 is returned. If more than one break rule + * would cause a boundary to be located at some position in the text, + * the numerically largest of the applicable status values is returned. + *

+ * Of the standard types of ICU break iterators, only word break and + * line break provide status values. The values are defined in + * the header file ubrk.h. For Word breaks, the status allows distinguishing between words + * that contain alphabetic letters, "words" that appear to be numbers, + * punctuation and spaces, words containing ideographic characters, and + * more. For Line Break, the status distinguishes between hard (mandatory) breaks + * and soft (potential) break positions. + *

+ * getRuleStatus() can be called after obtaining a boundary + * position from next(), previous(), or + * any other break iterator functions that returns a boundary position. + *

+ * Note that getRuleStatus() returns the value corresponding to + * current() index even after next() has returned DONE. + *

+ * When creating custom break rules, one is free to define whatever + * status values may be convenient for the application. + *

+ * @return the status from the break rule that determined the boundary + * at the current iteration position. + * + * @see UWordBreak + * @stable ICU 2.2 + */ + virtual int32_t getRuleStatus() const override; + + /** + * Get the status (tag) values from the break rule(s) that determined the boundary + * at the current iteration position. + *

+ * The returned status value(s) are stored into an array provided by the caller. + * The values are stored in sorted (ascending) order. + * If the capacity of the output array is insufficient to hold the data, + * the output will be truncated to the available length, and a + * U_BUFFER_OVERFLOW_ERROR will be signaled. + * + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attempting to store any values. + * @param status receives error codes. + * @return The number of rule status values from the rules that determined + * the boundary at the current iteration position. + * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value + * is the total number of status values that were available, + * not the reduced number that were actually returned. + * @see getRuleStatus + * @stable ICU 3.0 + */ + virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status) override; + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. + * This method is to implement a simple version of RTTI, since not all + * C++ compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const override; + + /** + * Returns the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** + * Deprecated functionality. Use clone() instead. + * + * Create a clone (copy) of this break iterator in memory provided + * by the caller. The idea is to increase performance by avoiding + * a storage allocation. Use of this function is NOT RECOMMENDED. + * Performance gains are minimal, and correct buffer management is + * tricky. Use clone() instead. + * + * @param stackBuffer The pointer to the memory into which the cloned object + * should be placed. If nullptr, allocate heap memory + * for the cloned object. + * @param BufferSize The size of the buffer. If zero, return the required + * buffer size, but do not clone the object. If the + * size was too small (but not zero), allocate heap + * storage for the cloned object. + * + * @param status Error status. U_SAFECLONE_ALLOCATED_WARNING will be + * returned if the provided buffer was too small, and + * the clone was therefore put on the heap. + * + * @return Pointer to the clone object. This may differ from the stackBuffer + * address if the byte alignment of the stack buffer was not suitable + * or if the stackBuffer was too small to hold the clone. + * @deprecated ICU 52. Use clone() instead. + */ + virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status) override; +#endif // U_FORCE_HIDE_DEPRECATED_API + + /** + * Return the binary form of compiled break rules, + * which can then be used to create a new break iterator at some + * time in the future. Creating a break iterator from pre-compiled rules + * is much faster than building one from the source form of the + * break rules. + * + * The binary data can only be used with the same version of ICU + * and on the same platform type (processor endian-ness) + * + * @param length Returns the length of the binary data. (Out parameter.) + * + * @return A pointer to the binary (compiled) rule data. The storage + * belongs to the RulesBasedBreakIterator object, not the + * caller, and must not be modified or deleted. + * @stable ICU 4.8 + */ + virtual const uint8_t *getBinaryRules(uint32_t &length); + + /** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator implementation never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized, + * system-level code. One example use case is with garbage collection that moves + * the text in memory. + * + * @param input The new (moved) text string. + * @param status Receives errors detected by this function. + * @return *this + * + * @stable ICU 49 + */ + virtual RuleBasedBreakIterator &refreshInputText(UText *input, UErrorCode &status) override; + + +private: + //======================================================================= + // implementation + //======================================================================= + /** + * Iterate backwards from an arbitrary position in the input text using the + * synthesized Safe Reverse rules. + * This locates a "Safe Position" from which the forward break rules + * will operate correctly. A Safe Position is not necessarily a boundary itself. + * + * @param fromPosition the position in the input text to begin the iteration. + * @internal (private) + */ + int32_t handleSafePrevious(int32_t fromPosition); + + /** + * Find a rule-based boundary by running the state machine. + * Input + * fPosition, the position in the text to begin from. + * Output + * fPosition: the boundary following the starting position. + * fDictionaryCharCount the number of dictionary characters encountered. + * If > 0, the segment will be further subdivided + * fRuleStatusIndex Info from the state table indicating which rules caused the boundary. + * + * @internal (private) + */ + int32_t handleNext(); + + /* + * Templatized version of handleNext() and handleSafePrevious(). + * + * There will be exactly four instantiations, two each for 8 and 16 bit tables, + * two each for 8 and 16 bit trie. + * Having separate instantiations for the table types keeps conditional tests of + * the table type out of the inner loops, at the expense of replicated code. + * + * The template parameter for the Trie access function is a value, not a type. + * Doing it this way, the compiler will inline the Trie function in the + * expanded functions. (Both the 8 and 16 bit access functions have the same type + * signature) + */ + + typedef uint16_t (*PTrieFunc)(const UCPTrie *, UChar32); + + template + int32_t handleSafePrevious(int32_t fromPosition); + + template + int32_t handleNext(); + + + /** + * This function returns the appropriate LanguageBreakEngine for a + * given character c. + * @param c A character in the dictionary set + * @param locale The locale. + * @internal (private) + */ + const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c, const char* locale); + + public: +#ifndef U_HIDE_INTERNAL_API + /** + * Debugging function only. + * @internal + */ + void dumpCache(); + + /** + * Debugging function only. + * @internal + */ + void dumpTables(); +#endif /* U_HIDE_INTERNAL_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Register a new external break engine. The external break engine will be adopted. + * Because ICU may choose to cache break engine internally, this must + * be called at application startup, prior to any calls to + * object methods of RuleBasedBreakIterator to avoid undefined behavior. + * @param toAdopt the ExternalBreakEngine instance to be adopted + * @param status the in/out status code, no special meanings are assigned + * @internal ICU 74 technology preview + */ + static void U_EXPORT2 registerExternalBreakEngine( + ExternalBreakEngine* toAdopt, UErrorCode& status); +#endif /* U_HIDE_DRAFT_API */ + +}; + + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/rep.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/rep.h index 6dd453064..7115c97b8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/rep.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/rep.h @@ -192,7 +192,7 @@ class U_COMMON_API Replaceable : public UObject { * Clone this object, an instance of a subclass of Replaceable. * Clones can be used concurrently in multiple threads. * If a subclass does not implement clone(), or if an error occurs, - * then NULL is returned. + * then nullptr is returned. * The caller must delete the clone. * * @return a clone of this object diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/resbund.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/resbund.h index 289406752..30fc2ac0a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/resbund.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/resbund.h @@ -66,14 +66,14 @@ U_NAMESPACE_BEGIN /** * A class representing a collection of resource information pertaining to a given - * locale. A resource bundle provides a way of accessing locale- specfic information in + * locale. A resource bundle provides a way of accessing locale- specific information in * a data file. You create a resource bundle that manages the resources for a given * locale and then ask it for individual resources. *

* Resource bundles in ICU4C are currently defined using text files which conform to the following - * BNF definition. + * BNF definition. * More on resource bundle concepts and syntax can be found in the - * Users Guide. + * Users Guide. *

* * The ResourceBundle class is not suitable for subclassing. @@ -143,7 +143,7 @@ class U_COMMON_API ResourceBundle : public UObject { * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. - * NULL is used to refer to ICU data. + * nullptr is used to refer to ICU data. * @param locale The locale for which to open a resource bundle. * @param err A UErrorCode value * @stable ICU 2.0 @@ -189,7 +189,7 @@ class U_COMMON_API ResourceBundle : public UObject { /** * Clone this object. * Clones can be used concurrently in multiple threads. - * If an error occurs, then NULL is returned. + * If an error occurs, then nullptr is returned. * The caller must delete the clone. * * @return a clone of this object @@ -286,7 +286,7 @@ class U_COMMON_API ResourceBundle : public UObject { /** * Checks whether the resource has another element to iterate over. * - * @return TRUE if there are more elements, FALSE if there is no more elements + * @return true if there are more elements, false if there is no more elements * @stable ICU 2.0 */ UBool @@ -304,7 +304,7 @@ class U_COMMON_API ResourceBundle : public UObject { * Returns the key associated with this resource. Not all the resources have a key - only * those that are members of a table. * - * @return a key associated to this resource, or NULL if it doesn't have a key + * @return a key associated to this resource, or nullptr if it doesn't have a key * @stable ICU 2.0 */ const char* @@ -331,7 +331,7 @@ class U_COMMON_API ResourceBundle : public UObject { getType(void) const; /** - * Returns the next resource in a given resource or NULL if there are no more resources + * Returns the next resource in a given resource or nullptr if there are no more resources * * @param status fills in the outgoing error code * @return ResourceBundle object. @@ -341,7 +341,7 @@ class U_COMMON_API ResourceBundle : public UObject { getNext(UErrorCode& status); /** - * Returns the next string in a resource or NULL if there are no more resources + * Returns the next string in a resource or nullptr if there are no more resources * to iterate over. * * @param status fills in the outgoing error code @@ -352,7 +352,7 @@ class U_COMMON_API ResourceBundle : public UObject { getNextString(UErrorCode& status); /** - * Returns the next string in a resource or NULL if there are no more resources + * Returns the next string in a resource or nullptr if there are no more resources * to iterate over. * * @param key fill in for key associated with this string @@ -474,7 +474,7 @@ class U_COMMON_API ResourceBundle : public UObject { * * @stable ICU 2.2 */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; /** * ICU "poor man's RTTI", returns a UClassID for this class. @@ -484,7 +484,7 @@ class U_COMMON_API ResourceBundle : public UObject { static UClassID U_EXPORT2 getStaticClassID(); private: - ResourceBundle(); // default constructor not implemented + ResourceBundle() = delete; // default constructor not implemented UResourceBundle *fResource; void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/schriter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/schriter.h index 024c80b89..a2ab17982 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/schriter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/schriter.h @@ -124,7 +124,7 @@ class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { * same string and are pointing at the same character. * @stable ICU 2.0 */ - virtual bool operator==(const ForwardCharacterIterator& that) const; + virtual bool operator==(const ForwardCharacterIterator& that) const override; /** * Returns a new StringCharacterIterator referring to the same @@ -133,7 +133,7 @@ class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { * @return the newly cloned object. * @stable ICU 2.0 */ - virtual StringCharacterIterator* clone() const; + virtual StringCharacterIterator* clone() const override; /** * Sets the iterator to iterate over the provided string. @@ -149,14 +149,14 @@ class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { * @param result Receives a copy of the text under iteration. * @stable ICU 2.0 */ - virtual void getText(UnicodeString& result); + virtual void getText(UnicodeString& result) override; /** * Return a class ID for this object (not really public) * @return a class ID for this object. * @stable ICU 2.0 */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID(void) const override; /** * Return a class ID for this class (not really public) @@ -172,14 +172,6 @@ class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { */ StringCharacterIterator(); - /** - * Sets the iterator to iterate over the provided string. - * @param newText The string to be iterated over - * @param newTextLength The length of the String - * @stable ICU 2.0 - */ - void setText(const char16_t* newText, int32_t newTextLength); - /** * Copy of the iterated string object. * @stable ICU 2.0 diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/simpleformatter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/simpleformatter.h index 9414bca30..7f58106fa 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/simpleformatter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/simpleformatter.h @@ -59,7 +59,7 @@ class SimpleModifier; * @see UMessagePatternApostropheMode * @stable ICU 57 */ -class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { +class U_COMMON_API SimpleFormatter final : public UMemory { public: /** * Default constructor. @@ -125,7 +125,7 @@ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. - * @return TRUE if U_SUCCESS(errorCode). + * @return true if U_SUCCESS(errorCode). * @stable ICU 57 */ UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) { @@ -144,7 +144,7 @@ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { * Must fulfill U_SUCCESS before the function call. * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and * too few or too many arguments. - * @return TRUE if U_SUCCESS(errorCode). + * @return true if U_SUCCESS(errorCode). * @stable ICU 57 */ UBool applyPatternMinMaxArguments(const UnicodeString &pattern, @@ -217,13 +217,13 @@ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { * * @param values The argument values. * An argument value must not be the same object as appendTo. - * Can be NULL if valuesLength==getArgumentLimit()==0. + * Can be nullptr if valuesLength==getArgumentLimit()==0. * @param valuesLength The length of the values array. * Must be at least getArgumentLimit(). * @param appendTo Gets the formatted pattern and values appended. * @param offsets offsets[i] receives the offset of where * values[i] replaced pattern argument {i}. - * Can be shorter or longer than values. Can be NULL if offsetsLength==0. + * Can be shorter or longer than values. Can be nullptr if offsetsLength==0. * If there is no {i} in the pattern, then offsets[i] is set to -1. * @param offsetsLength The length of the offsets array. * @param errorCode ICU error code in/out parameter. @@ -243,13 +243,13 @@ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { * * @param values The argument values. * An argument value may be the same object as result. - * Can be NULL if valuesLength==getArgumentLimit()==0. + * Can be nullptr if valuesLength==getArgumentLimit()==0. * @param valuesLength The length of the values array. * Must be at least getArgumentLimit(). * @param result Gets its contents replaced by the formatted pattern and values. * @param offsets offsets[i] receives the offset of where * values[i] replaced pattern argument {i}. - * Can be shorter or longer than values. Can be NULL if offsetsLength==0. + * Can be shorter or longer than values. Can be nullptr if offsetsLength==0. * If there is no {i} in the pattern, then offsets[i] is set to -1. * @param offsetsLength The length of the offsets array. * @param errorCode ICU error code in/out parameter. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/strenum.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/strenum.h index e6b932224..fba5c9b81 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/strenum.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/strenum.h @@ -70,7 +70,7 @@ class U_COMMON_API StringEnumeration : public UObject { * Clone this object, an instance of a subclass of StringEnumeration. * Clones can be used concurrently in multiple threads. * If a subclass does not implement clone(), or if an error occurs, - * then NULL is returned. + * then nullptr is returned. * The caller must delete the clone. * * @return a clone of this object @@ -101,8 +101,8 @@ class U_COMMON_API StringEnumeration : public UObject { /** *

Returns the next element as a NUL-terminated char*. If there - * are no more elements, returns NULL. If the resultLength pointer - * is not NULL, the length of the string (not counting the + * are no more elements, returns nullptr. If the resultLength pointer + * is not nullptr, the length of the string (not counting the * terminating NUL) is returned at that address. If an error * status is returned, the value at resultLength is undefined.

* @@ -111,21 +111,21 @@ class U_COMMON_API StringEnumeration : public UObject { * to next, unext, snext, reset, or the enumerator's destructor.

* *

If the iterator is out of sync with its service, status is set - * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * to U_ENUM_OUT_OF_SYNC_ERROR and nullptr is returned.

* *

If the native service string is a char16_t* string, it is * converted to char* with the invariant converter. If the * conversion fails (because a character cannot be converted) then * status is set to U_INVARIANT_CONVERSION_ERROR and the return - * value is undefined (though not NULL).

+ * value is undefined (though not nullptr).

* * Starting with ICU 2.8, the default implementation calls snext() * and handles the conversion. * Either next() or snext() must be implemented differently by a subclass. * * @param status the error code. - * @param resultLength a pointer to receive the length, can be NULL. - * @return a pointer to the string, or NULL. + * @param resultLength a pointer to receive the length, can be nullptr. + * @return a pointer to the string, or nullptr. * * @stable ICU 2.4 */ @@ -133,8 +133,8 @@ class U_COMMON_API StringEnumeration : public UObject { /** *

Returns the next element as a NUL-terminated char16_t*. If there - * are no more elements, returns NULL. If the resultLength pointer - * is not NULL, the length of the string (not counting the + * are no more elements, returns nullptr. If the resultLength pointer + * is not nullptr, the length of the string (not counting the * terminating NUL) is returned at that address. If an error * status is returned, the value at resultLength is undefined.

* @@ -143,14 +143,14 @@ class U_COMMON_API StringEnumeration : public UObject { * to next, unext, snext, reset, or the enumerator's destructor.

* *

If the iterator is out of sync with its service, status is set - * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * to U_ENUM_OUT_OF_SYNC_ERROR and nullptr is returned.

* * Starting with ICU 2.8, the default implementation calls snext() * and handles the conversion. * * @param status the error code. - * @param resultLength a ponter to receive the length, can be NULL. - * @return a pointer to the string, or NULL. + * @param resultLength a pointer to receive the length, can be nullptr. + * @return a pointer to the string, or nullptr. * * @stable ICU 2.4 */ @@ -158,21 +158,21 @@ class U_COMMON_API StringEnumeration : public UObject { /** *

Returns the next element a UnicodeString*. If there are no - * more elements, returns NULL.

+ * more elements, returns nullptr.

* *

The returned pointer is owned by this iterator and must not be * deleted by the caller. The pointer is valid until the next call * to next, unext, snext, reset, or the enumerator's destructor.

* *

If the iterator is out of sync with its service, status is set - * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * to U_ENUM_OUT_OF_SYNC_ERROR and nullptr is returned.

* * Starting with ICU 2.8, the default implementation calls next() * and handles the conversion. * Either next() or snext() must be implemented differently by a subclass. * * @param status the error code. - * @return a pointer to the string, or NULL. + * @return a pointer to the string, or nullptr. * * @stable ICU 2.4 */ @@ -196,7 +196,7 @@ class U_COMMON_API StringEnumeration : public UObject { * Compares this enumeration to other to check if both are equal * * @param that The other string enumeration to compare this object to - * @return TRUE if the enumerations are equal. FALSE if not. + * @return true if the enumerations are equal. false if not. * @stable ICU 3.6 */ virtual bool operator==(const StringEnumeration& that)const; @@ -204,7 +204,7 @@ class U_COMMON_API StringEnumeration : public UObject { * Compares this enumeration to other to check if both are not equal * * @param that The other string enumeration to compare this object to - * @return TRUE if the enumerations are equal. FALSE if not. + * @return true if the enumerations are equal. false if not. * @stable ICU 3.6 */ virtual bool operator!=(const StringEnumeration& that)const; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/stringpiece.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/stringpiece.h index 3025f3294..df7f36089 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/stringpiece.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/stringpiece.h @@ -67,20 +67,46 @@ class U_COMMON_API StringPiece : public UMemory { * Default constructor, creates an empty StringPiece. * @stable ICU 4.2 */ - StringPiece() : ptr_(NULL), length_(0) { } + StringPiece() : ptr_(nullptr), length_(0) { } + /** * Constructs from a NUL-terminated const char * pointer. * @param str a NUL-terminated const char * pointer * @stable ICU 4.2 */ StringPiece(const char* str); +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Constructs from a NUL-terminated const char8_t * pointer. + * @param str a NUL-terminated const char8_t * pointer + * @stable ICU 67 + */ + StringPiece(const char8_t* str) : StringPiece(reinterpret_cast(str)) {} +#endif + /** + * Constructs an empty StringPiece. + * Needed for type disambiguation from multiple other overloads. + * @param p nullptr + * @stable ICU 67 + */ + StringPiece(std::nullptr_t p) : ptr_(p), length_(0) {} + /** * Constructs from a std::string. * @stable ICU 4.2 */ StringPiece(const std::string& str) : ptr_(str.data()), length_(static_cast(str.size())) { } -#ifndef U_HIDE_DRAFT_API +#if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN) + /** + * Constructs from a std::u8string. + * @stable ICU 67 + */ + StringPiece(const std::u8string& str) + : ptr_(reinterpret_cast(str.data())), + length_(static_cast(str.size())) { } +#endif + /** * Constructs from some other implementation of a string piece class, from any * C++ record type that has these two methods: @@ -88,7 +114,7 @@ class U_COMMON_API StringPiece : public UMemory { * \code{.cpp} * * struct OtherStringPieceClass { - * const char* data(); + * const char* data(); // or const char8_t* * size_t size(); * }; * @@ -97,16 +123,24 @@ class U_COMMON_API StringPiece : public UMemory { * The other string piece class will typically be std::string_view from C++17 * or absl::string_view from Abseil. * + * Starting with C++20, data() may also return a const char8_t* pointer, + * as from std::u8string_view. + * * @param str the other string piece - * @draft ICU 65 + * @stable ICU 65 */ template ::value && + (std::is_same::value +#if defined(__cpp_char8_t) + || std::is_same::value +#endif + ) && std::is_same::value>::type> StringPiece(T str) - : ptr_(str.data()), length_(static_cast(str.size())) {} -#endif // U_HIDE_DRAFT_API + : ptr_(reinterpret_cast(str.data())), + length_(static_cast(str.size())) {} + /** * Constructs from a const char * pointer and a specified length. * @param offset a const char * pointer (need not be terminated) @@ -114,6 +148,17 @@ class U_COMMON_API StringPiece : public UMemory { * @stable ICU 4.2 */ StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { } +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Constructs from a const char8_t * pointer and a specified length. + * @param str a const char8_t * pointer (need not be terminated) + * @param len the length of the string; must be non-negative + * @stable ICU 67 + */ + StringPiece(const char8_t* str, int32_t len) : + StringPiece(reinterpret_cast(str), len) {} +#endif + /** * Substring of another StringPiece. * @param x the other StringPiece @@ -132,7 +177,7 @@ class U_COMMON_API StringPiece : public UMemory { StringPiece(const StringPiece& x, int32_t pos, int32_t len); /** - * Returns the string pointer. May be NULL if it is empty. + * Returns the string pointer. May be nullptr if it is empty. * * data() may return a pointer to a buffer with embedded NULs, and the * returned buffer may or may not be null terminated. Therefore it is @@ -156,7 +201,7 @@ class U_COMMON_API StringPiece : public UMemory { int32_t length() const { return length_; } /** * Returns whether the string is empty. - * @return TRUE if the string is empty + * @return true if the string is empty * @stable ICU 4.2 */ UBool empty() const { return length_ == 0; } @@ -165,7 +210,7 @@ class U_COMMON_API StringPiece : public UMemory { * Sets to an empty string. * @stable ICU 4.2 */ - void clear() { ptr_ = NULL; length_ = 0; } + void clear() { ptr_ = nullptr; length_ = 0; } /** * Reset the stringpiece to refer to new data. @@ -182,6 +227,27 @@ class U_COMMON_API StringPiece : public UMemory { */ void set(const char* str); +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Resets the stringpiece to refer to new data. + * @param xdata pointer the new string data. Need not be NUL-terminated. + * @param len the length of the new data + * @stable ICU 67 + */ + inline void set(const char8_t* xdata, int32_t len) { + set(reinterpret_cast(xdata), len); + } + + /** + * Resets the stringpiece to refer to new data. + * @param str a pointer to a NUL-terminated string. + * @stable ICU 67 + */ + inline void set(const char8_t* str) { + set(reinterpret_cast(str)); + } +#endif + /** * Removes the first n string units. * @param n prefix length, must be non-negative and <=length() @@ -212,6 +278,24 @@ class U_COMMON_API StringPiece : public UMemory { } } + /** + * Searches the StringPiece for the given search string (needle); + * @param needle The string for which to search. + * @param offset Where to start searching within this string (haystack). + * @return The offset of needle in haystack, or -1 if not found. + * @stable ICU 67 + */ + int32_t find(StringPiece needle, int32_t offset); + + /** + * Compares this StringPiece with the other StringPiece, with semantics + * similar to std::string::compare(). + * @param other The string to compare to. + * @return below zero if this < other; above zero if this > other; 0 if this == other. + * @stable ICU 67 + */ + int32_t compare(StringPiece other); + /** * Maximum integer, used as a default value for substring methods. * @stable ICU 4.2 @@ -235,7 +319,7 @@ class U_COMMON_API StringPiece : public UMemory { * Global operator == for StringPiece * @param x The first StringPiece to compare. * @param y The second StringPiece to compare. - * @return TRUE if the string data is equal + * @return true if the string data is equal * @stable ICU 4.8 */ U_EXPORT UBool U_EXPORT2 @@ -245,7 +329,7 @@ operator==(const StringPiece& x, const StringPiece& y); * Global operator != for StringPiece * @param x The first StringPiece to compare. * @param y The second StringPiece to compare. - * @return TRUE if the string data is not equal + * @return true if the string data is not equal * @stable ICU 4.8 */ inline bool operator!=(const StringPiece& x, const StringPiece& y) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/stringtriebuilder.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/stringtriebuilder.h index dc00a7c39..429d7883f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/stringtriebuilder.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/stringtriebuilder.h @@ -152,7 +152,7 @@ class U_COMMON_API StringTrieBuilder : public UObject { * equivalent to newNode. * @param newNode Input node. The builder takes ownership. * @param errorCode ICU in/out UErrorCode. - Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL. + Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==nullptr. * @return newNode if it is the first of its kind, or * an equivalent node if newNode is a duplicate. * @internal @@ -164,7 +164,7 @@ class U_COMMON_API StringTrieBuilder : public UObject { * Avoids creating a node if the value is a duplicate. * @param value A final value. * @param errorCode ICU in/out UErrorCode. - Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL. + Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==nullptr. * @return A FinalValueNode with the given value. * @internal */ @@ -176,11 +176,11 @@ class U_COMMON_API StringTrieBuilder : public UObject { * registerNode() and registerFinalValue() take ownership of their input nodes, * and only return owned nodes. * If they see a failure UErrorCode, they will delete the input node. - * If they get a NULL pointer, they will record a U_MEMORY_ALLOCATION_ERROR. - * If there is a failure, they return NULL. + * If they get a nullptr pointer, they will record a U_MEMORY_ALLOCATION_ERROR. + * If there is a failure, they return nullptr. * - * NULL Node pointers can be safely passed into other Nodes because - * they call the static Node::hashCode() which checks for a NULL pointer first. + * nullptr Node pointers can be safely passed into other Nodes because + * they call the static Node::hashCode() which checks for a nullptr pointer first. * * Therefore, as long as builder functions register a new node, * they need to check for failures only before explicitly dereferencing @@ -201,8 +201,8 @@ class U_COMMON_API StringTrieBuilder : public UObject { public: Node(int32_t initialHash) : hash(initialHash), offset(0) {} inline int32_t hashCode() const { return hash; } - // Handles node==NULL. - static inline int32_t hashCode(const Node *node) { return node==NULL ? 0 : node->hashCode(); } + // Handles node==nullptr. + static inline int32_t hashCode(const Node *node) { return node==nullptr ? 0 : node->hashCode(); } // Base class operator==() compares the actual class types. virtual bool operator==(const Node &other) const; inline bool operator!=(const Node &other) const { return !operator==(other); } @@ -265,8 +265,8 @@ class U_COMMON_API StringTrieBuilder : public UObject { class FinalValueNode : public Node { public: FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {} - virtual bool operator==(const Node &other) const; - virtual void write(StringTrieBuilder &builder); + virtual bool operator==(const Node &other) const override; + virtual void write(StringTrieBuilder &builder) override; protected: int32_t value; }; @@ -279,10 +279,10 @@ class U_COMMON_API StringTrieBuilder : public UObject { */ class ValueNode : public Node { public: - ValueNode(int32_t initialHash) : Node(initialHash), hasValue(FALSE), value(0) {} - virtual bool operator==(const Node &other) const; + ValueNode(int32_t initialHash) : Node(initialHash), hasValue(false), value(0) {} + virtual bool operator==(const Node &other) const override; void setValue(int32_t v) { - hasValue=TRUE; + hasValue=true; value=v; hash=hash*37u+v; } @@ -299,9 +299,9 @@ class U_COMMON_API StringTrieBuilder : public UObject { public: IntermediateValueNode(int32_t v, Node *nextNode) : ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); } - virtual bool operator==(const Node &other) const; - virtual int32_t markRightEdgesFirst(int32_t edgeNumber); - virtual void write(StringTrieBuilder &builder); + virtual bool operator==(const Node &other) const override; + virtual int32_t markRightEdgesFirst(int32_t edgeNumber) override; + virtual void write(StringTrieBuilder &builder) override; protected: Node *next; }; @@ -317,8 +317,8 @@ class U_COMMON_API StringTrieBuilder : public UObject { LinearMatchNode(int32_t len, Node *nextNode) : ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)), length(len), next(nextNode) {} - virtual bool operator==(const Node &other) const; - virtual int32_t markRightEdgesFirst(int32_t edgeNumber); + virtual bool operator==(const Node &other) const override; + virtual int32_t markRightEdgesFirst(int32_t edgeNumber) override; protected: int32_t length; Node *next; @@ -341,13 +341,13 @@ class U_COMMON_API StringTrieBuilder : public UObject { class ListBranchNode : public BranchNode { public: ListBranchNode() : BranchNode(0x444444), length(0) {} - virtual bool operator==(const Node &other) const; - virtual int32_t markRightEdgesFirst(int32_t edgeNumber); - virtual void write(StringTrieBuilder &builder); + virtual bool operator==(const Node &other) const override; + virtual int32_t markRightEdgesFirst(int32_t edgeNumber) override; + virtual void write(StringTrieBuilder &builder) override; // Adds a unit with a final value. void add(int32_t c, int32_t value) { units[length]=(char16_t)c; - equal[length]=NULL; + equal[length]=nullptr; values[length]=value; ++length; hash=(hash*37u+c)*37u+value; @@ -361,7 +361,7 @@ class U_COMMON_API StringTrieBuilder : public UObject { hash=(hash*37u+c)*37u+hashCode(node); } protected: - Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value". + Node *equal[kMaxBranchLinearSubNodeLength]; // nullptr means "has final value". int32_t length; int32_t values[kMaxBranchLinearSubNodeLength]; char16_t units[kMaxBranchLinearSubNodeLength]; @@ -376,9 +376,9 @@ class U_COMMON_API StringTrieBuilder : public UObject { : BranchNode(((0x555555u*37u+middleUnit)*37u+ hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)), unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {} - virtual bool operator==(const Node &other) const; - virtual int32_t markRightEdgesFirst(int32_t edgeNumber); - virtual void write(StringTrieBuilder &builder); + virtual bool operator==(const Node &other) const override; + virtual int32_t markRightEdgesFirst(int32_t edgeNumber) override; + virtual void write(StringTrieBuilder &builder) override; protected: char16_t unit; Node *lessThan; @@ -392,9 +392,9 @@ class U_COMMON_API StringTrieBuilder : public UObject { BranchHeadNode(int32_t len, Node *subNode) : ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)), length(len), next(subNode) {} - virtual bool operator==(const Node &other) const; - virtual int32_t markRightEdgesFirst(int32_t edgeNumber); - virtual void write(StringTrieBuilder &builder); + virtual bool operator==(const Node &other) const override; + virtual int32_t markRightEdgesFirst(int32_t edgeNumber) override; + virtual void write(StringTrieBuilder &builder) override; protected: int32_t length; Node *next; // A branch sub-node. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/symtable.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/symtable.h index b64d877f9..647a3884a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/symtable.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/symtable.h @@ -73,10 +73,10 @@ class U_COMMON_API SymbolTable /* not : public UObject because this is an interf /** * Lookup the characters associated with this string and return it. - * Return NULL if no such name exists. The resultant + * Return nullptr if no such name exists. The resultant * string may have length zero. * @param s the symbolic name to lookup - * @return a string containing the name's value, or NULL if + * @return a string containing the name's value, or nullptr if * there is no mapping for s. * @stable ICU 2.8 */ @@ -84,10 +84,10 @@ class U_COMMON_API SymbolTable /* not : public UObject because this is an interf /** * Lookup the UnicodeMatcher associated with the given character, and - * return it. Return NULL if not found. + * return it. Return nullptr if not found. * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. * @return the UnicodeMatcher object represented by the given - * character, or NULL if there is no mapping for ch. + * character, or nullptr if there is no mapping for ch. * @stable ICU 2.8 */ virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ubidi.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ubidi.h index f4875c880..536f4172b 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ubidi.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ubidi.h @@ -21,7 +21,10 @@ #include "unicode/utypes.h" #include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** *\file @@ -81,7 +84,7 @@ * *
  * \code
- *#include "unicode/ubidi.h"
+ *#include 
  *
  *typedef enum {
  *     styleNormal=0, styleSelected=1,
@@ -133,11 +136,11 @@
  *         int styleLimit;
  *
  *         for(i=0; ilimit) { styleLimit=limit; }
  *                 renderRun(text, start, styleLimit,
- *                           direction, styleRun[i].style);
+ *                           direction, styleRuns[i].style);
  *                 if(styleLimit==limit) { break; }
  *                 start=styleLimit;
  *             }
@@ -147,14 +150,14 @@
  *
  *         for(i=styleRunCount-1; i>=0; --i) {
  *             if(i>0) {
- *                 styleStart=styleRun[i-1].limit;
+ *                 styleStart=styleRuns[i-1].limit;
  *             } else {
  *                 styleStart=0;
  *             }
  *             if(limit>=styleStart) {
  *                 if(styleStartUBiDi object.
  * @stable ICU 2.0
  */
-U_STABLE UBiDi * U_EXPORT2
+U_CAPI UBiDi * U_EXPORT2
 ubidi_open(void);
 
 /**
@@ -533,7 +537,7 @@ ubidi_open(void);
  * @return An empty UBiDi object with preallocated memory.
  * @stable ICU 2.0
  */
-U_STABLE UBiDi * U_EXPORT2
+U_CAPI UBiDi * U_EXPORT2
 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
 
 /**
@@ -556,7 +560,7 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
  * @see ubidi_setLine
  * @stable ICU 2.0
  */
-U_STABLE void U_EXPORT2
+U_CAPI void U_EXPORT2
 ubidi_close(UBiDi *pBiDi);
 
 #if U_SHOW_CPLUSPLUS_API
@@ -594,7 +598,7 @@ U_NAMESPACE_END
  * this "inverse Bidi" and that the current implementation provides only an
  * approximation of "inverse Bidi".

* - *

With isInverse set to TRUE, + *

With isInverse set to true, * this function changes the behavior of some of the subsequent functions * in a way that they can be used for the inverse Bidi algorithm. * Specifically, runs of text with numeric characters will be treated in a @@ -607,12 +611,12 @@ U_NAMESPACE_END * the runs of the logically ordered output.

* *

Calling this function with argument isInverse set to - * TRUE is equivalent to calling + * true is equivalent to calling * ubidi_setReorderingMode with argument * reorderingMode * set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
* Calling this function with argument isInverse set to - * FALSE is equivalent to calling + * false is equivalent to calling * ubidi_setReorderingMode with argument * reorderingMode * set to #UBIDI_REORDER_DEFAULT. @@ -626,18 +630,18 @@ U_NAMESPACE_END * @see ubidi_setReorderingMode * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); /** * Is this Bidi object set to perform the inverse Bidi algorithm? *

Note: calling this function after setting the reordering mode with - * ubidi_setReorderingMode will return TRUE if the + * ubidi_setReorderingMode will return true if the * reordering mode was set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, - * FALSE for all other values.

+ * false for all other values.

* * @param pBiDi is a UBiDi object. - * @return TRUE if the Bidi object is set to perform the inverse Bidi algorithm + * @return true if the Bidi object is set to perform the inverse Bidi algorithm * by handling numbers as L. * * @see ubidi_setInverse @@ -645,7 +649,7 @@ ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ubidi_isInverse(UBiDi *pBiDi); /** @@ -668,7 +672,7 @@ ubidi_isInverse(UBiDi *pBiDi); * @see ubidi_setPara * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR); /** @@ -676,13 +680,13 @@ ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR); * successive paragraphs progress from left to right? * * @param pBiDi is a UBiDi object. - * @return TRUE if the Bidi object is set to allocate level 0 to block + * @return true if the Bidi object is set to allocate level 0 to block * separators. * * @see ubidi_orderParagraphsLTR * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi); /** @@ -714,7 +718,7 @@ typedef enum UBiDiReorderingMode { * @stable ICU 3.6 */ UBIDI_REORDER_RUNS_ONLY, /** Visual to Logical algorithm which handles numbers like L - * (same algorithm as selected by ubidi_setInverse(TRUE). + * (same algorithm as selected by ubidi_setInverse(true). * @see ubidi_setInverse * @stable ICU 3.6 */ UBIDI_REORDER_INVERSE_NUMBERS_AS_L, @@ -833,7 +837,7 @@ typedef enum UBiDiReorderingMode { * reordered sequence (the option #UBIDI_INSERT_LRM_FOR_NUMERIC can * be used with function ubidi_writeReordered to this end. This * mode is equivalent to calling ubidi_setInverse() with - * argument isInverse set to TRUE. + * argument isInverse set to true. * *
  • When the reordering mode is set to * #UBIDI_REORDER_INVERSE_LIKE_DIRECT, the "direct" Logical to Visual @@ -886,7 +890,7 @@ typedef enum UBiDiReorderingMode { * @see ubidi_writeReordered * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode); /** @@ -897,7 +901,7 @@ ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode); * @see ubidi_setReorderingMode * @stable ICU 3.6 */ -U_STABLE UBiDiReorderingMode U_EXPORT2 +U_CAPI UBiDiReorderingMode U_EXPORT2 ubidi_getReorderingMode(UBiDi *pBiDi); /** @@ -935,7 +939,7 @@ typedef enum UBiDiReorderingOption { * *

    If this option is set in conjunction with reordering mode * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L or with calling - * ubidi_setInverse(TRUE), it implies + * ubidi_setInverse(true), it implies * option #UBIDI_INSERT_LRM_FOR_NUMERIC * in calls to function ubidi_writeReordered().

    * @@ -1016,7 +1020,7 @@ typedef enum UBiDiReorderingOption { * *

    When the UBIDI_OPTION_STREAMING option is used, * it is recommended to call ubidi_orderParagraphsLTR() with - * argument orderParagraphsLTR set to TRUE before + * argument orderParagraphsLTR set to true before * calling ubidi_setPara so that later paragraphs may be * concatenated to previous paragraphs on the right.

    * @@ -1042,7 +1046,7 @@ typedef enum UBiDiReorderingOption { * @see ubidi_getReorderingOptions * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions); /** @@ -1053,7 +1057,7 @@ ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions); * @see ubidi_setReorderingOptions * @stable ICU 3.6 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ubidi_getReorderingOptions(UBiDi *pBiDi); /** @@ -1140,7 +1144,7 @@ ubidi_getReorderingOptions(UBiDi *pBiDi); * @see ubidi_setPara * @stable ICU 4.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setContext(UBiDi *pBiDi, const UChar *prologue, int32_t proLength, const UChar *epilogue, int32_t epiLength, @@ -1228,7 +1232,7 @@ ubidi_setContext(UBiDi *pBiDi, * @param pErrorCode must be a valid pointer to an error code value. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, UErrorCode *pErrorCode); @@ -1279,7 +1283,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setLine(const UBiDi *pParaBiDi, int32_t start, int32_t limit, UBiDi *pLineBiDi, @@ -1300,7 +1304,7 @@ ubidi_setLine(const UBiDi *pParaBiDi, * @see UBiDiDirection * @stable ICU 2.0 */ -U_STABLE UBiDiDirection U_EXPORT2 +U_CAPI UBiDiDirection U_EXPORT2 ubidi_getDirection(const UBiDi *pBiDi); /** @@ -1330,7 +1334,7 @@ ubidi_getDirection(const UBiDi *pBiDi); * @see UBiDiDirection * @stable ICU 4.6 */ -U_STABLE UBiDiDirection U_EXPORT2 +U_CAPI UBiDiDirection U_EXPORT2 ubidi_getBaseDirection(const UChar *text, int32_t length ); /** @@ -1344,7 +1348,7 @@ ubidi_getBaseDirection(const UChar *text, int32_t length ); * @see ubidi_setLine * @stable ICU 2.0 */ -U_STABLE const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 ubidi_getText(const UBiDi *pBiDi); /** @@ -1355,7 +1359,7 @@ ubidi_getText(const UBiDi *pBiDi); * @return The length of the text that the UBiDi object was created for. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getLength(const UBiDi *pBiDi); /** @@ -1373,7 +1377,7 @@ ubidi_getLength(const UBiDi *pBiDi); * @see ubidi_getParagraphByIndex * @stable ICU 2.0 */ -U_STABLE UBiDiLevel U_EXPORT2 +U_CAPI UBiDiLevel U_EXPORT2 ubidi_getParaLevel(const UBiDi *pBiDi); /** @@ -1384,7 +1388,7 @@ ubidi_getParaLevel(const UBiDi *pBiDi); * @return The number of paragraphs. * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_countParagraphs(UBiDi *pBiDi); /** @@ -1421,7 +1425,7 @@ ubidi_countParagraphs(UBiDi *pBiDi); * @see ubidi_getProcessedLength * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); @@ -1453,7 +1457,7 @@ ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, * * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); @@ -1473,7 +1477,7 @@ ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE UBiDiLevel U_EXPORT2 +U_CAPI UBiDiLevel U_EXPORT2 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex); /** @@ -1494,7 +1498,7 @@ ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex); * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE const UBiDiLevel * U_EXPORT2 +U_CAPI const UBiDiLevel * U_EXPORT2 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); /** @@ -1521,7 +1525,7 @@ ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, int32_t *pLogicalLimit, UBiDiLevel *pLevel); @@ -1540,7 +1544,7 @@ ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, * @return The number of runs. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); /** @@ -1599,7 +1603,7 @@ ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); * to avoid these issues. * @stable ICU 2.0 */ -U_STABLE UBiDiDirection U_EXPORT2 +U_CAPI UBiDiDirection U_EXPORT2 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, int32_t *pLogicalStart, int32_t *pLength); @@ -1640,7 +1644,7 @@ ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode); /** @@ -1675,7 +1679,7 @@ ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) * @see ubidi_getResultLength * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode); /** @@ -1718,7 +1722,7 @@ ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode) * @see ubidi_getResultLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); /** @@ -1754,7 +1758,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); * @see ubidi_getResultLength * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); /** @@ -1777,7 +1781,7 @@ ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); * The index map will result in indexMap[logicalIndex]==visualIndex. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); /** @@ -1800,7 +1804,7 @@ ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap * The index map will result in indexMap[visualIndex]==logicalIndex. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); /** @@ -1835,7 +1839,7 @@ ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap) * @see UBIDI_MAP_NOWHERE * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length); /** option flags for ubidi_writeReordered() */ @@ -1940,7 +1944,7 @@ ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length); * @see UBIDI_OPTION_STREAMING * @stable ICU 3.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getProcessedLength(const UBiDi *pBiDi); /** @@ -1970,7 +1974,7 @@ ubidi_getProcessedLength(const UBiDi *pBiDi); * @see UBIDI_OPTION_REMOVE_CONTROLS * @stable ICU 3.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_getResultLength(const UBiDi *pBiDi); U_CDECL_BEGIN @@ -2028,7 +2032,7 @@ U_CDECL_END * @see UBiDiClassCallback * @stable ICU 3.6 */ -U_STABLE UCharDirection U_EXPORT2 +U_CAPI UCharDirection U_EXPORT2 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c); /** @@ -2058,7 +2062,7 @@ ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c); * @see ubidi_getClassCallback * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, const void *newContext, UBiDiClassCallback **oldFn, const void **oldContext, UErrorCode *pErrorCode); @@ -2075,7 +2079,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, * @see ubidi_setClassCallback * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context); /** @@ -2143,7 +2147,7 @@ ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **conte * @see ubidi_getProcessedLength * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_writeReordered(UBiDi *pBiDi, UChar *dest, int32_t destSize, uint16_t options, @@ -2195,7 +2199,7 @@ ubidi_writeReordered(UBiDi *pBiDi, * @return The length of the output string. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ubidi_writeReverse(const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, uint16_t options, diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ubiditransform.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ubiditransform.h index 5c08ed5df..24433aa8a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ubiditransform.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ubiditransform.h @@ -21,11 +21,14 @@ #include "unicode/utypes.h" #include "unicode/ubidi.h" #include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file - * \brief Bidi Transformations + * \brief C API: Bidi Transformations */ /** @@ -147,10 +150,10 @@ typedef struct UBiDiTransform UBiDiTransform; * calling ubidi_setPara with * paraLevel == UBIDI_DEFAULT_RTL,
  • *
  • : this is equivalent to - * calling ubidi_setInverse(UBiDi*, TRUE) and then + * calling ubidi_setInverse(UBiDi*, true) and then * ubidi_setPara with paraLevel == UBIDI_LTR,
  • *
  • : this is equivalent to - * calling ubidi_setInverse(UBiDi*, TRUE) and then + * calling ubidi_setInverse(UBiDi*, true) and then * ubidi_setPara with paraLevel == UBIDI_RTL.
  • * * All combinations that involve the Visual RTL scheme are unsupported by @@ -245,7 +248,7 @@ typedef struct UBiDiTransform UBiDiTransform; * @see u_shapeArabic * @stable ICU 58 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ubiditransform_transform(UBiDiTransform *pBiDiTransform, const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, @@ -291,14 +294,14 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform, * @return An empty UBiDiTransform object. * @stable ICU 58 */ -U_STABLE UBiDiTransform* U_EXPORT2 +U_CAPI UBiDiTransform* U_EXPORT2 ubiditransform_open(UErrorCode *pErrorCode); /** * Deallocates the given UBiDiTransform object. * @stable ICU 58 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ubiditransform_close(UBiDiTransform *pBidiTransform); #if U_SHOW_CPLUSPLUS_API diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ubrk.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ubrk.h index 4bd63f3f1..2b3dc7aa5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ubrk.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ubrk.h @@ -1,628 +1,647 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ****************************************************************************** -// * Copyright (C) 1996-2015, International Business Machines Corporation and others. -// * All Rights Reserved. -// ****************************************************************************** -// */ - -// #ifndef UBRK_H -// #define UBRK_H - -// #include "unicode/utypes.h" -// #include "unicode/uloc.h" -// #include "unicode/utext.h" -// #include "unicode/localpointer.h" - -// /** -// * A text-break iterator. -// * For usage in C programs. -// */ -// #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR -// # define UBRK_TYPEDEF_UBREAK_ITERATOR -// /** -// * Opaque type representing an ICU Break iterator object. -// * @stable ICU 2.0 -// */ -// typedef struct UBreakIterator UBreakIterator; -// #endif - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/parseerr.h" - -// /** -// * \file -// * \brief C API: BreakIterator -// * -// *

    BreakIterator C API

    -// * -// * The BreakIterator C API defines methods for finding the location -// * of boundaries in text. Pointer to a UBreakIterator maintain a -// * current position and scan over text returning the index of characters -// * where boundaries occur. -// *

    -// * Line boundary analysis determines where a text string can be broken -// * when line-wrapping. The mechanism correctly handles punctuation and -// * hyphenated words. -// *

    -// * Note: The locale keyword "lb" can be used to modify line break -// * behavior according to the CSS level 3 line-break options, see -// * . For example: -// * "ja@lb=strict", "zh@lb=loose". -// *

    -// * Sentence boundary analysis allows selection with correct -// * interpretation of periods within numbers and abbreviations, and -// * trailing punctuation marks such as quotation marks and parentheses. -// *

    -// * Note: The locale keyword "ss" can be used to enable use of -// * segmentation suppression data (preventing breaks in English after -// * abbreviations such as "Mr." or "Est.", for example), as follows: -// * "en@ss=standard". -// *

    -// * Word boundary analysis is used by search and replace functions, as -// * well as within text editing applications that allow the user to -// * select words with a double click. Word selection provides correct -// * interpretation of punctuation marks within and following -// * words. Characters that are not part of a word, such as symbols or -// * punctuation marks, have word-breaks on both sides. -// *

    -// * Character boundary analysis identifies the boundaries of -// * "Extended Grapheme Clusters", which are groupings of codepoints -// * that should be treated as character-like units for many text operations. -// * Please see Unicode Standard Annex #29, Unicode Text Segmentation, -// * http://www.unicode.org/reports/tr29/ for additional information -// * on grapheme clusters and guidelines on their use. -// *

    -// * Title boundary analysis locates all positions, -// * typically starts of words, that should be set to Title Case -// * when title casing the text. -// *

    -// * The text boundary positions are found according to the rules -// * described in Unicode Standard Annex #29, Text Boundaries, and -// * Unicode Standard Annex #14, Line Breaking Properties. These -// * are available at http://www.unicode.org/reports/tr14/ and -// * http://www.unicode.org/reports/tr29/. -// *

    -// * In addition to the plain C API defined in this header file, an -// * object oriented C++ API with equivalent functionality is defined in the -// * file brkiter.h. -// *

    -// * Code snippets illustrating the use of the Break Iterator APIs -// * are available in the ICU User Guide, -// * http://icu-project.org/userguide/boundaryAnalysis.html -// * and in the sample program icu/source/samples/break/break.cpp -// */ - -// /** The possible types of text boundaries. @stable ICU 2.0 */ -// typedef enum UBreakIteratorType { -// /** Character breaks @stable ICU 2.0 */ -// UBRK_CHARACTER = 0, -// /** Word breaks @stable ICU 2.0 */ -// UBRK_WORD = 1, -// /** Line breaks @stable ICU 2.0 */ -// UBRK_LINE = 2, -// /** Sentence breaks @stable ICU 2.0 */ -// UBRK_SENTENCE = 3, - -// #ifndef U_HIDE_DEPRECATED_API -// /** -// * Title Case breaks -// * The iterator created using this type locates title boundaries as described for -// * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, -// * please use Word Boundary iterator. -// * -// * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later. -// */ -// UBRK_TITLE = 4, -// /** -// * One more than the highest normal UBreakIteratorType value. -// * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. -// */ -// UBRK_COUNT = 5 -// #endif // U_HIDE_DEPRECATED_API -// } UBreakIteratorType; - -// /** Value indicating all text boundaries have been returned. -// * @stable ICU 2.0 -// */ -// #define UBRK_DONE ((int32_t) -1) - - -// /** -// * Enum constants for the word break tags returned by -// * getRuleStatus(). A range of values is defined for each category of -// * word, to allow for further subdivisions of a category in future releases. -// * Applications should check for tag values falling within the range, rather -// * than for single individual values. -// * -// * The numeric values of all of these constants are stable (will not change). -// * -// * @stable ICU 2.2 -// */ -// typedef enum UWordBreak { -// /** Tag value for "words" that do not fit into any of other categories. -// * Includes spaces and most punctuation. */ -// UBRK_WORD_NONE = 0, -// /** Upper bound for tags for uncategorized words. */ -// UBRK_WORD_NONE_LIMIT = 100, -// /** Tag value for words that appear to be numbers, lower limit. */ -// UBRK_WORD_NUMBER = 100, -// /** Tag value for words that appear to be numbers, upper limit. */ -// UBRK_WORD_NUMBER_LIMIT = 200, -// /** Tag value for words that contain letters, excluding -// * hiragana, katakana or ideographic characters, lower limit. */ -// UBRK_WORD_LETTER = 200, -// /** Tag value for words containing letters, upper limit */ -// UBRK_WORD_LETTER_LIMIT = 300, -// /** Tag value for words containing kana characters, lower limit */ -// UBRK_WORD_KANA = 300, -// /** Tag value for words containing kana characters, upper limit */ -// UBRK_WORD_KANA_LIMIT = 400, -// /** Tag value for words containing ideographic characters, lower limit */ -// UBRK_WORD_IDEO = 400, -// /** Tag value for words containing ideographic characters, upper limit */ -// UBRK_WORD_IDEO_LIMIT = 500 -// } UWordBreak; - -// /** -// * Enum constants for the line break tags returned by getRuleStatus(). -// * A range of values is defined for each category of -// * word, to allow for further subdivisions of a category in future releases. -// * Applications should check for tag values falling within the range, rather -// * than for single individual values. -// * -// * The numeric values of all of these constants are stable (will not change). -// * -// * @stable ICU 2.8 -// */ -// typedef enum ULineBreakTag { -// /** Tag value for soft line breaks, positions at which a line break -// * is acceptable but not required */ -// UBRK_LINE_SOFT = 0, -// /** Upper bound for soft line breaks. */ -// UBRK_LINE_SOFT_LIMIT = 100, -// /** Tag value for a hard, or mandatory line break */ -// UBRK_LINE_HARD = 100, -// /** Upper bound for hard line breaks. */ -// UBRK_LINE_HARD_LIMIT = 200 -// } ULineBreakTag; - - - -// /** -// * Enum constants for the sentence break tags returned by getRuleStatus(). -// * A range of values is defined for each category of -// * sentence, to allow for further subdivisions of a category in future releases. -// * Applications should check for tag values falling within the range, rather -// * than for single individual values. -// * -// * The numeric values of all of these constants are stable (will not change). -// * -// * @stable ICU 2.8 -// */ -// typedef enum USentenceBreakTag { -// /** Tag value for for sentences ending with a sentence terminator -// * ('.', '?', '!', etc.) character, possibly followed by a -// * hard separator (CR, LF, PS, etc.) -// */ -// UBRK_SENTENCE_TERM = 0, -// /** Upper bound for tags for sentences ended by sentence terminators. */ -// UBRK_SENTENCE_TERM_LIMIT = 100, -// /** Tag value for for sentences that do not contain an ending -// * sentence terminator ('.', '?', '!', etc.) character, but -// * are ended only by a hard separator (CR, LF, PS, etc.) or end of input. -// */ -// UBRK_SENTENCE_SEP = 100, -// /** Upper bound for tags for sentences ended by a separator. */ -// UBRK_SENTENCE_SEP_LIMIT = 200 -// /** Tag value for a hard, or mandatory line break */ -// } USentenceBreakTag; - - -// /** -// * Open a new UBreakIterator for locating text boundaries for a specified locale. -// * A UBreakIterator may be used for detecting character, line, word, -// * and sentence breaks in text. -// * @param type The type of UBreakIterator to open: one of UBRK_CHARACTER, UBRK_WORD, -// * UBRK_LINE, UBRK_SENTENCE -// * @param locale The locale specifying the text-breaking conventions. Note that -// * locale keys such as "lb" and "ss" may be used to modify text break behavior, -// * see general discussion of BreakIterator C API. -// * @param text The text to be iterated over. May be null, in which case ubrk_setText() is -// * used to specify the text to be iterated. -// * @param textLength The number of characters in text, or -1 if null-terminated. -// * @param status A UErrorCode to receive any errors. -// * @return A UBreakIterator for the specified locale. -// * @see ubrk_openRules -// * @stable ICU 2.0 -// */ -// U_STABLE UBreakIterator* U_EXPORT2 -// ubrk_open(UBreakIteratorType type, -// const char *locale, -// const UChar *text, -// int32_t textLength, -// UErrorCode *status); - -// /** -// * Open a new UBreakIterator for locating text boundaries using specified breaking rules. -// * The rule syntax is ... (TBD) -// * @param rules A set of rules specifying the text breaking conventions. -// * @param rulesLength The number of characters in rules, or -1 if null-terminated. -// * @param text The text to be iterated over. May be null, in which case ubrk_setText() is -// * used to specify the text to be iterated. -// * @param textLength The number of characters in text, or -1 if null-terminated. -// * @param parseErr Receives position and context information for any syntax errors -// * detected while parsing the rules. -// * @param status A UErrorCode to receive any errors. -// * @return A UBreakIterator for the specified rules. -// * @see ubrk_open -// * @stable ICU 2.2 -// */ -// U_STABLE UBreakIterator* U_EXPORT2 -// ubrk_openRules(const UChar *rules, -// int32_t rulesLength, -// const UChar *text, -// int32_t textLength, -// UParseError *parseErr, -// UErrorCode *status); - -// /** -// * Open a new UBreakIterator for locating text boundaries using precompiled binary rules. -// * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. -// * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not -// * compatible across different major versions of ICU, nor across platforms of different -// * endianness or different base character set family (ASCII vs EBCDIC). -// * @param binaryRules A set of compiled binary rules specifying the text breaking -// * conventions. Ownership of the storage containing the compiled -// * rules remains with the caller of this function. The compiled -// * rules must not be modified or deleted during the life of the -// * break iterator. -// * @param rulesLength The length of binaryRules in bytes; must be >= 0. -// * @param text The text to be iterated over. May be null, in which case -// * ubrk_setText() is used to specify the text to be iterated. -// * @param textLength The number of characters in text, or -1 if null-terminated. -// * @param status Pointer to UErrorCode to receive any errors. -// * @return UBreakIterator for the specified rules. -// * @see ubrk_getBinaryRules -// * @stable ICU 59 -// */ -// U_STABLE UBreakIterator* U_EXPORT2 -// ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, -// const UChar * text, int32_t textLength, -// UErrorCode * status); - -// /** -// * Thread safe cloning operation -// * @param bi iterator to be cloned -// * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
    -// * user allocated space for the new clone. If NULL new memory will be allocated. -// * If buffer is not large enough, new memory will be allocated. -// * Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. -// * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
    -// * pointer to size of allocated space. -// * If *pBufferSize == 0, a sufficient size for use in cloning will -// * be returned ('pre-flighting') -// * If *pBufferSize is not enough for a stack-based safe clone, -// * new memory will be allocated. -// * @param status to indicate whether the operation went on smoothly or there were errors -// * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were necessary. -// * @return pointer to the new clone -// * @stable ICU 2.0 -// */ -// U_STABLE UBreakIterator * U_EXPORT2 -// ubrk_safeClone( -// const UBreakIterator *bi, -// void *stackBuffer, -// int32_t *pBufferSize, -// UErrorCode *status); - -// #ifndef U_HIDE_DEPRECATED_API - -// /** -// * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone(). -// * @deprecated ICU 52. Do not rely on ubrk_safeClone() cloning into any provided buffer. -// */ -// #define U_BRK_SAFECLONE_BUFFERSIZE 1 - -// #endif /* U_HIDE_DEPRECATED_API */ - -// /** -// * Close a UBreakIterator. -// * Once closed, a UBreakIterator may no longer be used. -// * @param bi The break iterator to close. -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 -// ubrk_close(UBreakIterator *bi); - -// #if U_SHOW_CPLUSPLUS_API - -// U_NAMESPACE_BEGIN - -// /** -// * \class LocalUBreakIteratorPointer -// * "Smart pointer" class, closes a UBreakIterator via ubrk_close(). -// * For most methods see the LocalPointerBase base class. -// * -// * @see LocalPointerBase -// * @see LocalPointer -// * @stable ICU 4.4 -// */ -// U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close); - -// U_NAMESPACE_END - -// #endif - -// /** -// * Sets an existing iterator to point to a new piece of text. -// * The break iterator retains a pointer to the supplied text. -// * The caller must not modify or delete the text while the BreakIterator -// * retains the reference. -// * -// * @param bi The iterator to use -// * @param text The text to be set -// * @param textLength The length of the text -// * @param status The error code -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 -// ubrk_setText(UBreakIterator* bi, -// const UChar* text, -// int32_t textLength, -// UErrorCode* status); - - -// /** -// * Sets an existing iterator to point to a new piece of text. -// * -// * All index positions returned by break iterator functions are -// * native indices from the UText. For example, when breaking UTF-8 -// * encoded text, the break positions returned by \ref ubrk_next, \ref ubrk_previous, etc. -// * will be UTF-8 string indices, not UTF-16 positions. -// * -// * @param bi The iterator to use -// * @param text The text to be set. -// * This function makes a shallow clone of the supplied UText. This means -// * that the caller is free to immediately close or otherwise reuse the -// * UText that was passed as a parameter, but that the underlying text itself -// * must not be altered while being referenced by the break iterator. -// * @param status The error code -// * @stable ICU 3.4 -// */ -// U_STABLE void U_EXPORT2 -// ubrk_setUText(UBreakIterator* bi, -// UText* text, -// UErrorCode* status); - - - -// /** -// * Determine the most recently-returned text boundary. -// * -// * @param bi The break iterator to use. -// * @return The character index most recently returned by \ref ubrk_next, \ref ubrk_previous, -// * \ref ubrk_first, or \ref ubrk_last. -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_current(const UBreakIterator *bi); - -// /** -// * Advance the iterator to the boundary following the current boundary. -// * -// * @param bi The break iterator to use. -// * @return The character index of the next text boundary, or UBRK_DONE -// * if all text boundaries have been returned. -// * @see ubrk_previous -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_next(UBreakIterator *bi); - -// /** -// * Set the iterator position to the boundary preceding the current boundary. -// * -// * @param bi The break iterator to use. -// * @return The character index of the preceding text boundary, or UBRK_DONE -// * if all text boundaries have been returned. -// * @see ubrk_next -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_previous(UBreakIterator *bi); - -// /** -// * Set the iterator position to zero, the start of the text being scanned. -// * @param bi The break iterator to use. -// * @return The new iterator position (zero). -// * @see ubrk_last -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_first(UBreakIterator *bi); - -// /** -// * Set the iterator position to the index immediately beyond the last character in the text being scanned. -// * This is not the same as the last character. -// * @param bi The break iterator to use. -// * @return The character offset immediately beyond the last character in the -// * text being scanned. -// * @see ubrk_first -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_last(UBreakIterator *bi); - -// /** -// * Set the iterator position to the first boundary preceding the specified offset. -// * The new position is always smaller than offset, or UBRK_DONE. -// * @param bi The break iterator to use. -// * @param offset The offset to begin scanning. -// * @return The text boundary preceding offset, or UBRK_DONE. -// * @see ubrk_following -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_preceding(UBreakIterator *bi, -// int32_t offset); - -// /** -// * Advance the iterator to the first boundary following the specified offset. -// * The value returned is always greater than offset, or UBRK_DONE. -// * @param bi The break iterator to use. -// * @param offset The offset to begin scanning. -// * @return The text boundary following offset, or UBRK_DONE. -// * @see ubrk_preceding -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_following(UBreakIterator *bi, -// int32_t offset); - -// /** -// * Get a locale for which text breaking information is available. -// * A UBreakIterator in a locale returned by this function will perform the correct -// * text breaking for the locale. -// * @param index The index of the desired locale. -// * @return A locale for which number text breaking information is available, or 0 if none. -// * @see ubrk_countAvailable -// * @stable ICU 2.0 -// */ -// U_STABLE const char* U_EXPORT2 -// ubrk_getAvailable(int32_t index); - -// /** -// * Determine how many locales have text breaking information available. -// * This function is most useful as determining the loop ending condition for -// * calls to \ref ubrk_getAvailable. -// * @return The number of locales for which text breaking information is available. -// * @see ubrk_getAvailable -// * @stable ICU 2.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_countAvailable(void); - - -// /** -// * Returns true if the specified position is a boundary position. As a side -// * effect, leaves the iterator pointing to the first boundary position at -// * or after "offset". -// * @param bi The break iterator to use. -// * @param offset the offset to check. -// * @return True if "offset" is a boundary position. -// * @stable ICU 2.0 -// */ -// U_STABLE UBool U_EXPORT2 -// ubrk_isBoundary(UBreakIterator *bi, int32_t offset); - -// /** -// * Return the status from the break rule that determined the most recently -// * returned break position. The values appear in the rule source -// * within brackets, {123}, for example. For rules that do not specify a -// * status, a default value of 0 is returned. -// *

    -// * For word break iterators, the possible values are defined in enum UWordBreak. -// * @stable ICU 2.2 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_getRuleStatus(UBreakIterator *bi); - -// /** -// * Get the statuses from the break rules that determined the most recently -// * returned break position. The values appear in the rule source -// * within brackets, {123}, for example. The default status value for rules -// * that do not explicitly provide one is zero. -// *

    -// * For word break iterators, the possible values are defined in enum UWordBreak. -// * @param bi The break iterator to use -// * @param fillInVec an array to be filled in with the status values. -// * @param capacity the length of the supplied vector. A length of zero causes -// * the function to return the number of status values, in the -// * normal way, without attempting to store any values. -// * @param status receives error codes. -// * @return The number of rule status values from rules that determined -// * the most recent boundary returned by the break iterator. -// * @stable ICU 3.0 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status); - -// /** -// * Return the locale of the break iterator. You can choose between the valid and -// * the actual locale. -// * @param bi break iterator -// * @param type locale type (valid or actual) -// * @param status error code -// * @return locale string -// * @stable ICU 2.8 -// */ -// U_STABLE const char* U_EXPORT2 -// ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); - -// /** -// * Set the subject text string upon which the break iterator is operating -// * without changing any other aspect of the state. -// * The new and previous text strings must have the same content. -// * -// * This function is intended for use in environments where ICU is operating on -// * strings that may move around in memory. It provides a mechanism for notifying -// * ICU that the string has been relocated, and providing a new UText to access the -// * string in its new position. -// * -// * Note that the break iterator never copies the underlying text -// * of a string being processed, but always operates directly on the original text -// * provided by the user. Refreshing simply drops the references to the old text -// * and replaces them with references to the new. -// * -// * Caution: this function is normally used only by very specialized -// * system-level code. One example use case is with garbage collection -// * that moves the text in memory. -// * -// * @param bi The break iterator. -// * @param text The new (moved) text string. -// * @param status Receives errors detected by this function. -// * -// * @stable ICU 49 -// */ -// U_STABLE void U_EXPORT2 -// ubrk_refreshUText(UBreakIterator *bi, -// UText *text, -// UErrorCode *status); - - -// /** -// * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator. -// * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator -// * more quickly than using ubrk_openRules. The compiled rules are not compatible across -// * different major versions of ICU, nor across platforms of different endianness or -// * different base character set family (ASCII vs EBCDIC). Supports preflighting (with -// * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to -// * the binaryRules buffer. However, whether preflighting or not, if the actual length -// * is greater than INT32_MAX, then the function returns 0 and sets *status to -// * U_INDEX_OUTOFBOUNDS_ERROR. - -// * @param bi The break iterator to use. -// * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for -// * preflighting. -// * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for -// * preflighting. Must be >= 0. -// * @param status Pointer to UErrorCode to receive any errors, such as -// * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or -// * U_ILLEGAL_ARGUMENT_ERROR. -// * @return The actual byte length of the binary rules, if <= INT32_MAX; -// * otherwise 0. If not preflighting and this is larger than -// * rulesCapacity, *status will be set to an error. -// * @see ubrk_openBinaryRules -// * @stable ICU 59 -// */ -// U_STABLE int32_t U_EXPORT2 -// ubrk_getBinaryRules(UBreakIterator *bi, -// uint8_t * binaryRules, int32_t rulesCapacity, -// UErrorCode * status); - -// #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1996-2015, International Business Machines Corporation and others. +* All Rights Reserved. +****************************************************************************** +*/ + +#ifndef UBRK_H +#define UBRK_H + +#include "unicode/utypes.h" +#include "unicode/uloc.h" +#include "unicode/utext.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * A text-break iterator. + * For usage in C programs. + */ +#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR +# define UBRK_TYPEDEF_UBREAK_ITERATOR + /** + * Opaque type representing an ICU Break iterator object. + * @stable ICU 2.0 + */ + typedef struct UBreakIterator UBreakIterator; +#endif + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/parseerr.h" + +/** + * \file + * \brief C API: BreakIterator + * + *

    BreakIterator C API

    + * + * The BreakIterator C API defines methods for finding the location + * of boundaries in text. Pointer to a UBreakIterator maintain a + * current position and scan over text returning the index of characters + * where boundaries occur. + *

    + * Line boundary analysis determines where a text string can be broken + * when line-wrapping. The mechanism correctly handles punctuation and + * hyphenated words. + *

    + * Note: The locale keyword "lb" can be used to modify line break + * behavior according to the CSS level 3 line-break options, see + * . For example: + * "ja@lb=strict", "zh@lb=loose". + *

    + * Sentence boundary analysis allows selection with correct + * interpretation of periods within numbers and abbreviations, and + * trailing punctuation marks such as quotation marks and parentheses. + *

    + * Note: The locale keyword "ss" can be used to enable use of + * segmentation suppression data (preventing breaks in English after + * abbreviations such as "Mr." or "Est.", for example), as follows: + * "en@ss=standard". + *

    + * Word boundary analysis is used by search and replace functions, as + * well as within text editing applications that allow the user to + * select words with a double click. Word selection provides correct + * interpretation of punctuation marks within and following + * words. Characters that are not part of a word, such as symbols or + * punctuation marks, have word-breaks on both sides. + *

    + * Character boundary analysis identifies the boundaries of + * "Extended Grapheme Clusters", which are groupings of codepoints + * that should be treated as character-like units for many text operations. + * Please see Unicode Standard Annex #29, Unicode Text Segmentation, + * http://www.unicode.org/reports/tr29/ for additional information + * on grapheme clusters and guidelines on their use. + *

    + * Title boundary analysis locates all positions, + * typically starts of words, that should be set to Title Case + * when title casing the text. + *

    + * The text boundary positions are found according to the rules + * described in Unicode Standard Annex #29, Text Boundaries, and + * Unicode Standard Annex #14, Line Breaking Properties. These + * are available at http://www.unicode.org/reports/tr14/ and + * http://www.unicode.org/reports/tr29/. + *

    + * In addition to the plain C API defined in this header file, an + * object oriented C++ API with equivalent functionality is defined in the + * file brkiter.h. + *

    + * Code snippets illustrating the use of the Break Iterator APIs + * are available in the ICU User Guide, + * https://unicode-org.github.io/icu/userguide/boundaryanalysis/ + * and in the sample program icu/source/samples/break/break.cpp + */ + +/** The possible types of text boundaries. @stable ICU 2.0 */ +typedef enum UBreakIteratorType { + /** Character breaks @stable ICU 2.0 */ + UBRK_CHARACTER = 0, + /** Word breaks @stable ICU 2.0 */ + UBRK_WORD = 1, + /** Line breaks @stable ICU 2.0 */ + UBRK_LINE = 2, + /** Sentence breaks @stable ICU 2.0 */ + UBRK_SENTENCE = 3, + +#ifndef U_HIDE_DEPRECATED_API + /** + * Title Case breaks + * The iterator created using this type locates title boundaries as described for + * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, + * please use Word Boundary iterator. + * + * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later. + */ + UBRK_TITLE = 4, + /** + * One more than the highest normal UBreakIteratorType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UBRK_COUNT = 5 +#endif // U_HIDE_DEPRECATED_API +} UBreakIteratorType; + +/** Value indicating all text boundaries have been returned. + * @stable ICU 2.0 + */ +#define UBRK_DONE ((int32_t) -1) + + +/** + * Enum constants for the word break tags returned by + * getRuleStatus(). A range of values is defined for each category of + * word, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.2 +*/ +typedef enum UWordBreak { + /** Tag value for "words" that do not fit into any of other categories. + * Includes spaces and most punctuation. */ + UBRK_WORD_NONE = 0, + /** Upper bound for tags for uncategorized words. */ + UBRK_WORD_NONE_LIMIT = 100, + /** Tag value for words that appear to be numbers, lower limit. */ + UBRK_WORD_NUMBER = 100, + /** Tag value for words that appear to be numbers, upper limit. */ + UBRK_WORD_NUMBER_LIMIT = 200, + /** Tag value for words that contain letters, excluding + * hiragana, katakana or ideographic characters, lower limit. */ + UBRK_WORD_LETTER = 200, + /** Tag value for words containing letters, upper limit */ + UBRK_WORD_LETTER_LIMIT = 300, + /** Tag value for words containing kana characters, lower limit */ + UBRK_WORD_KANA = 300, + /** Tag value for words containing kana characters, upper limit */ + UBRK_WORD_KANA_LIMIT = 400, + /** Tag value for words containing ideographic characters, lower limit */ + UBRK_WORD_IDEO = 400, + /** Tag value for words containing ideographic characters, upper limit */ + UBRK_WORD_IDEO_LIMIT = 500 +} UWordBreak; + +/** + * Enum constants for the line break tags returned by getRuleStatus(). + * A range of values is defined for each category of + * word, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.8 +*/ +typedef enum ULineBreakTag { + /** Tag value for soft line breaks, positions at which a line break + * is acceptable but not required */ + UBRK_LINE_SOFT = 0, + /** Upper bound for soft line breaks. */ + UBRK_LINE_SOFT_LIMIT = 100, + /** Tag value for a hard, or mandatory line break */ + UBRK_LINE_HARD = 100, + /** Upper bound for hard line breaks. */ + UBRK_LINE_HARD_LIMIT = 200 +} ULineBreakTag; + + + +/** + * Enum constants for the sentence break tags returned by getRuleStatus(). + * A range of values is defined for each category of + * sentence, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.8 +*/ +typedef enum USentenceBreakTag { + /** Tag value for for sentences ending with a sentence terminator + * ('.', '?', '!', etc.) character, possibly followed by a + * hard separator (CR, LF, PS, etc.) + */ + UBRK_SENTENCE_TERM = 0, + /** Upper bound for tags for sentences ended by sentence terminators. */ + UBRK_SENTENCE_TERM_LIMIT = 100, + /** Tag value for for sentences that do not contain an ending + * sentence terminator ('.', '?', '!', etc.) character, but + * are ended only by a hard separator (CR, LF, PS, etc.) or end of input. + */ + UBRK_SENTENCE_SEP = 100, + /** Upper bound for tags for sentences ended by a separator. */ + UBRK_SENTENCE_SEP_LIMIT = 200 + /** Tag value for a hard, or mandatory line break */ +} USentenceBreakTag; + + +/** + * Open a new UBreakIterator for locating text boundaries for a specified locale. + * A UBreakIterator may be used for detecting character, line, word, + * and sentence breaks in text. + * @param type The type of UBreakIterator to open: one of UBRK_CHARACTER, UBRK_WORD, + * UBRK_LINE, UBRK_SENTENCE + * @param locale The locale specifying the text-breaking conventions. Note that + * locale keys such as "lb" and "ss" may be used to modify text break behavior, + * see general discussion of BreakIterator C API. + * @param text The text to be iterated over. May be null, in which case ubrk_setText() is + * used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param status A UErrorCode to receive any errors. + * @return A UBreakIterator for the specified locale. + * @see ubrk_openRules + * @stable ICU 2.0 + */ +U_CAPI UBreakIterator* U_EXPORT2 +ubrk_open(UBreakIteratorType type, + const char *locale, + const UChar *text, + int32_t textLength, + UErrorCode *status); + +/** + * Open a new UBreakIterator for locating text boundaries using specified breaking rules. + * The rule syntax is ... (TBD) + * @param rules A set of rules specifying the text breaking conventions. + * @param rulesLength The number of characters in rules, or -1 if null-terminated. + * @param text The text to be iterated over. May be null, in which case ubrk_setText() is + * used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param parseErr Receives position and context information for any syntax errors + * detected while parsing the rules. + * @param status A UErrorCode to receive any errors. + * @return A UBreakIterator for the specified rules. + * @see ubrk_open + * @stable ICU 2.2 + */ +U_CAPI UBreakIterator* U_EXPORT2 +ubrk_openRules(const UChar *rules, + int32_t rulesLength, + const UChar *text, + int32_t textLength, + UParseError *parseErr, + UErrorCode *status); + +/** + * Open a new UBreakIterator for locating text boundaries using precompiled binary rules. + * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. + * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not + * compatible across different major versions of ICU, nor across platforms of different + * endianness or different base character set family (ASCII vs EBCDIC). + * @param binaryRules A set of compiled binary rules specifying the text breaking + * conventions. Ownership of the storage containing the compiled + * rules remains with the caller of this function. The compiled + * rules must not be modified or deleted during the life of the + * break iterator. + * @param rulesLength The length of binaryRules in bytes; must be >= 0. + * @param text The text to be iterated over. May be null, in which case + * ubrk_setText() is used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param status Pointer to UErrorCode to receive any errors. + * @return UBreakIterator for the specified rules. + * @see ubrk_getBinaryRules + * @stable ICU 59 + */ +U_CAPI UBreakIterator* U_EXPORT2 +ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, + const UChar * text, int32_t textLength, + UErrorCode * status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * Thread safe cloning operation + * @param bi iterator to be cloned + * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
    + * user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. + * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
    + * pointer to size of allocated space. + * If *pBufferSize == 0, a sufficient size for use in cloning will + * be returned ('pre-flighting') + * If *pBufferSize is not enough for a stack-based safe clone, + * new memory will be allocated. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used + * if pBufferSize != NULL and any allocations were necessary + * @return pointer to the new clone + * @deprecated ICU 69 Use ubrk_clone() instead. + */ +U_DEPRECATED UBreakIterator * U_EXPORT2 +ubrk_safeClone( + const UBreakIterator *bi, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Thread safe cloning operation. + * @param bi iterator to be cloned + * @param status to indicate whether the operation went on smoothly or there were errors + * @return pointer to the new clone + * @stable ICU 69 + */ +U_CAPI UBreakIterator * U_EXPORT2 +ubrk_clone(const UBreakIterator *bi, + UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone(). + * @deprecated ICU 52. Do not rely on ubrk_safeClone() cloning into any provided buffer. + */ +#define U_BRK_SAFECLONE_BUFFERSIZE 1 + +#endif /* U_HIDE_DEPRECATED_API */ + +/** +* Close a UBreakIterator. +* Once closed, a UBreakIterator may no longer be used. +* @param bi The break iterator to close. + * @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +ubrk_close(UBreakIterator *bi); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUBreakIteratorPointer + * "Smart pointer" class, closes a UBreakIterator via ubrk_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close); + +U_NAMESPACE_END + +#endif + +/** + * Sets an existing iterator to point to a new piece of text. + * The break iterator retains a pointer to the supplied text. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param bi The iterator to use + * @param text The text to be set + * @param textLength The length of the text + * @param status The error code + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ubrk_setText(UBreakIterator* bi, + const UChar* text, + int32_t textLength, + UErrorCode* status); + + +/** + * Sets an existing iterator to point to a new piece of text. + * + * All index positions returned by break iterator functions are + * native indices from the UText. For example, when breaking UTF-8 + * encoded text, the break positions returned by \ref ubrk_next, \ref ubrk_previous, etc. + * will be UTF-8 string indices, not UTF-16 positions. + * + * @param bi The iterator to use + * @param text The text to be set. + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * UText that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * @param status The error code + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +ubrk_setUText(UBreakIterator* bi, + UText* text, + UErrorCode* status); + + + +/** + * Determine the most recently-returned text boundary. + * + * @param bi The break iterator to use. + * @return The character index most recently returned by \ref ubrk_next, \ref ubrk_previous, + * \ref ubrk_first, or \ref ubrk_last. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_current(const UBreakIterator *bi); + +/** + * Advance the iterator to the boundary following the current boundary. + * + * @param bi The break iterator to use. + * @return The character index of the next text boundary, or UBRK_DONE + * if all text boundaries have been returned. + * @see ubrk_previous + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_next(UBreakIterator *bi); + +/** + * Set the iterator position to the boundary preceding the current boundary. + * + * @param bi The break iterator to use. + * @return The character index of the preceding text boundary, or UBRK_DONE + * if all text boundaries have been returned. + * @see ubrk_next + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_previous(UBreakIterator *bi); + +/** + * Set the iterator position to zero, the start of the text being scanned. + * @param bi The break iterator to use. + * @return The new iterator position (zero). + * @see ubrk_last + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_first(UBreakIterator *bi); + +/** + * Set the iterator position to the index immediately beyond the last character in the text being scanned. + * This is not the same as the last character. + * @param bi The break iterator to use. + * @return The character offset immediately beyond the last character in the + * text being scanned. + * @see ubrk_first + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_last(UBreakIterator *bi); + +/** + * Set the iterator position to the first boundary preceding the specified offset. + * The new position is always smaller than offset, or UBRK_DONE. + * @param bi The break iterator to use. + * @param offset The offset to begin scanning. + * @return The text boundary preceding offset, or UBRK_DONE. + * @see ubrk_following + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_preceding(UBreakIterator *bi, + int32_t offset); + +/** + * Advance the iterator to the first boundary following the specified offset. + * The value returned is always greater than offset, or UBRK_DONE. + * @param bi The break iterator to use. + * @param offset The offset to begin scanning. + * @return The text boundary following offset, or UBRK_DONE. + * @see ubrk_preceding + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_following(UBreakIterator *bi, + int32_t offset); + +/** +* Get a locale for which text breaking information is available. +* A UBreakIterator in a locale returned by this function will perform the correct +* text breaking for the locale. +* @param index The index of the desired locale. +* @return A locale for which number text breaking information is available, or 0 if none. +* @see ubrk_countAvailable +* @stable ICU 2.0 +*/ +U_CAPI const char* U_EXPORT2 +ubrk_getAvailable(int32_t index); + +/** +* Determine how many locales have text breaking information available. +* This function is most useful as determining the loop ending condition for +* calls to \ref ubrk_getAvailable. +* @return The number of locales for which text breaking information is available. +* @see ubrk_getAvailable +* @stable ICU 2.0 +*/ +U_CAPI int32_t U_EXPORT2 +ubrk_countAvailable(void); + + +/** +* Returns true if the specified position is a boundary position. As a side +* effect, leaves the iterator pointing to the first boundary position at +* or after "offset". +* @param bi The break iterator to use. +* @param offset the offset to check. +* @return True if "offset" is a boundary position. +* @stable ICU 2.0 +*/ +U_CAPI UBool U_EXPORT2 +ubrk_isBoundary(UBreakIterator *bi, int32_t offset); + +/** + * Return the status from the break rule that determined the most recently + * returned break position. The values appear in the rule source + * within brackets, {123}, for example. For rules that do not specify a + * status, a default value of 0 is returned. + *

    + * For word break iterators, the possible values are defined in enum UWordBreak. + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_getRuleStatus(UBreakIterator *bi); + +/** + * Get the statuses from the break rules that determined the most recently + * returned break position. The values appear in the rule source + * within brackets, {123}, for example. The default status value for rules + * that do not explicitly provide one is zero. + *

    + * For word break iterators, the possible values are defined in enum UWordBreak. + * @param bi The break iterator to use + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attempting to store any values. + * @param status receives error codes. + * @return The number of rule status values from rules that determined + * the most recent boundary returned by the break iterator. + * @stable ICU 3.0 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status); + +/** + * Return the locale of the break iterator. You can choose between the valid and + * the actual locale. + * @param bi break iterator + * @param type locale type (valid or actual) + * @param status error code + * @return locale string + * @stable ICU 2.8 + */ +U_CAPI const char* U_EXPORT2 +ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); + +/** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized + * system-level code. One example use case is with garbage collection + * that moves the text in memory. + * + * @param bi The break iterator. + * @param text The new (moved) text string. + * @param status Receives errors detected by this function. + * + * @stable ICU 49 + */ +U_CAPI void U_EXPORT2 +ubrk_refreshUText(UBreakIterator *bi, + UText *text, + UErrorCode *status); + + +/** + * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator. + * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator + * more quickly than using ubrk_openRules. The compiled rules are not compatible across + * different major versions of ICU, nor across platforms of different endianness or + * different base character set family (ASCII vs EBCDIC). Supports preflighting (with + * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to + * the binaryRules buffer. However, whether preflighting or not, if the actual length + * is greater than INT32_MAX, then the function returns 0 and sets *status to + * U_INDEX_OUTOFBOUNDS_ERROR. + + * @param bi The break iterator to use. + * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for + * preflighting. + * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for + * preflighting. Must be >= 0. + * @param status Pointer to UErrorCode to receive any errors, such as + * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or + * U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual byte length of the binary rules, if <= INT32_MAX; + * otherwise 0. If not preflighting and this is larger than + * rulesCapacity, *status will be set to an error. + * @see ubrk_openBinaryRules + * @stable ICU 59 + */ +U_CAPI int32_t U_EXPORT2 +ubrk_getBinaryRules(UBreakIterator *bi, + uint8_t * binaryRules, int32_t rulesCapacity, + UErrorCode * status); + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucasemap.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucasemap.h index 6b253e3d6..d1c1b483a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucasemap.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucasemap.h @@ -22,10 +22,13 @@ #define __UCASEMAP_H__ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/stringoptions.h" #include "unicode/ustring.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Unicode case mapping functions using a UCaseMap service object. @@ -69,7 +72,7 @@ typedef struct UCaseMap UCaseMap; /**< C typedef for struct UCaseMap. @stable IC * @see U_TITLECASE_NO_BREAK_ADJUSTMENT * @stable ICU 3.4 */ -U_STABLE UCaseMap * U_EXPORT2 +U_CAPI UCaseMap * U_EXPORT2 ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode); /** @@ -77,7 +80,7 @@ ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode); * @param csm Object to be closed. * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_close(UCaseMap *csm); #if U_SHOW_CPLUSPLUS_API @@ -105,7 +108,7 @@ U_NAMESPACE_END * @return locale ID * @stable ICU 3.4 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ucasemap_getLocale(const UCaseMap *csm); /** @@ -114,7 +117,7 @@ ucasemap_getLocale(const UCaseMap *csm); * @return options bit set * @stable ICU 3.4 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ucasemap_getOptions(const UCaseMap *csm); /** @@ -128,7 +131,7 @@ ucasemap_getOptions(const UCaseMap *csm); * @see ucasemap_open * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); /** @@ -142,7 +145,7 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); * @see ucasemap_open * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); #if !UCONFIG_NO_BREAK_ITERATION @@ -154,7 +157,7 @@ ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); * @return titlecasing break iterator * @stable ICU 3.8 */ -U_STABLE const UBreakIterator * U_EXPORT2 +U_CAPI const UBreakIterator * U_EXPORT2 ucasemap_getBreakIterator(const UCaseMap *csm); /** @@ -177,7 +180,7 @@ ucasemap_getBreakIterator(const UCaseMap *csm); * @see ucasemap_utf8ToTitle * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode); /** @@ -226,7 +229,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode * @see u_strToTitle * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_toTitle(UCaseMap *csm, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, @@ -257,7 +260,7 @@ ucasemap_toTitle(UCaseMap *csm, * @see u_strToLower * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8ToLower(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, @@ -286,7 +289,7 @@ ucasemap_utf8ToLower(const UCaseMap *csm, * @see u_strToUpper * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8ToUpper(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, @@ -338,7 +341,7 @@ ucasemap_utf8ToUpper(const UCaseMap *csm, * @see U_TITLECASE_NO_BREAK_ADJUSTMENT * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8ToTitle(UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, @@ -376,7 +379,7 @@ ucasemap_utf8ToTitle(UCaseMap *csm, * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucasemap_utf8FoldCase(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucat.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucat.h index 4d1ff3f6b..93850348f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucat.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucat.h @@ -103,7 +103,7 @@ typedef UResourceBundle* u_nl_catd; * * @stable ICU 2.6 */ -U_STABLE u_nl_catd U_EXPORT2 +U_CAPI u_nl_catd U_EXPORT2 u_catopen(const char* name, const char* locale, UErrorCode* ec); /** @@ -114,7 +114,7 @@ u_catopen(const char* name, const char* locale, UErrorCode* ec); * * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_catclose(u_nl_catd catd); /** @@ -149,7 +149,7 @@ u_catclose(u_nl_catd catd); * * @stable ICU 2.6 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num, const UChar* s, int32_t* len, UErrorCode* ec); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uchar.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uchar.h index 3b55b2326..747089133 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uchar.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uchar.h @@ -60,7 +60,7 @@ U_CDECL_BEGIN * @see u_getUnicodeVersion * @stable ICU 2.0 */ -#define U_UNICODE_VERSION "13.0" +#define U_UNICODE_VERSION "15.1" /** * \file @@ -77,10 +77,10 @@ U_CDECL_BEGIN * * For more information see * "About the Unicode Character Database" (http://www.unicode.org/ucd/) - * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html). + * and the ICU User Guide chapter on Properties (https://unicode-org.github.io/icu/userguide/strings/properties). * * Many properties are accessible via generic functions that take a UProperty selector. - * - u_hasBinaryProperty() returns a binary value (TRUE/FALSE) per property and code point. + * - u_hasBinaryProperty() returns a binary value (true/false) per property and code point. * - u_getIntPropertyValue() returns an integer value per property and code point. * For each supported enumerated or catalog property, there is * an enum type for all of the property's values, and @@ -483,12 +483,82 @@ typedef enum UProperty { * @stable ICU 62 */ UCHAR_EXTENDED_PICTOGRAPHIC=64, + /** + * Binary property of strings Basic_Emoji. + * See https://www.unicode.org/reports/tr51/#Emoji_Sets + * + * @stable ICU 70 + */ + UCHAR_BASIC_EMOJI=65, + /** + * Binary property of strings Emoji_Keycap_Sequence. + * See https://www.unicode.org/reports/tr51/#Emoji_Sets + * + * @stable ICU 70 + */ + UCHAR_EMOJI_KEYCAP_SEQUENCE=66, + /** + * Binary property of strings RGI_Emoji_Modifier_Sequence. + * See https://www.unicode.org/reports/tr51/#Emoji_Sets + * + * @stable ICU 70 + */ + UCHAR_RGI_EMOJI_MODIFIER_SEQUENCE=67, + /** + * Binary property of strings RGI_Emoji_Flag_Sequence. + * See https://www.unicode.org/reports/tr51/#Emoji_Sets + * + * @stable ICU 70 + */ + UCHAR_RGI_EMOJI_FLAG_SEQUENCE=68, + /** + * Binary property of strings RGI_Emoji_Tag_Sequence. + * See https://www.unicode.org/reports/tr51/#Emoji_Sets + * + * @stable ICU 70 + */ + UCHAR_RGI_EMOJI_TAG_SEQUENCE=69, + /** + * Binary property of strings RGI_Emoji_ZWJ_Sequence. + * See https://www.unicode.org/reports/tr51/#Emoji_Sets + * + * @stable ICU 70 + */ + UCHAR_RGI_EMOJI_ZWJ_SEQUENCE=70, + /** + * Binary property of strings RGI_Emoji. + * See https://www.unicode.org/reports/tr51/#Emoji_Sets + * + * @stable ICU 70 + */ + UCHAR_RGI_EMOJI=71, +#ifndef U_HIDE_DRAFT_API + /** + * Binary property IDS_Unary_Operator. + * For programmatic determination of Ideographic Description Sequences. + * + * @draft ICU 74 + */ + UCHAR_IDS_UNARY_OPERATOR=72, + /** + * Binary property ID_Compat_Math_Start. + * Used in mathematical identifier profile in UAX #31. + * @draft ICU 74 + */ + UCHAR_ID_COMPAT_MATH_START=73, + /** + * Binary property ID_Compat_Math_Continue. + * Used in mathematical identifier profile in UAX #31. + * @draft ICU 74 + */ + UCHAR_ID_COMPAT_MATH_CONTINUE=74, +#endif // U_HIDE_DRAFT_API #ifndef U_HIDE_DEPRECATED_API /** * One more than the last constant for binary Unicode properties. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UCHAR_BINARY_LIMIT, + UCHAR_BINARY_LIMIT=75, #endif // U_HIDE_DEPRECATED_API /** Enumerated property Bidi_Class. @@ -1807,6 +1877,55 @@ enum UBlockCode { /** @stable ICU 66 */ UBLOCK_YEZIDI = 308, /*[10E80]*/ + // New blocks in Unicode 14.0 + + /** @stable ICU 70 */ + UBLOCK_ARABIC_EXTENDED_B = 309, /*[0870]*/ + /** @stable ICU 70 */ + UBLOCK_CYPRO_MINOAN = 310, /*[12F90]*/ + /** @stable ICU 70 */ + UBLOCK_ETHIOPIC_EXTENDED_B = 311, /*[1E7E0]*/ + /** @stable ICU 70 */ + UBLOCK_KANA_EXTENDED_B = 312, /*[1AFF0]*/ + /** @stable ICU 70 */ + UBLOCK_LATIN_EXTENDED_F = 313, /*[10780]*/ + /** @stable ICU 70 */ + UBLOCK_LATIN_EXTENDED_G = 314, /*[1DF00]*/ + /** @stable ICU 70 */ + UBLOCK_OLD_UYGHUR = 315, /*[10F70]*/ + /** @stable ICU 70 */ + UBLOCK_TANGSA = 316, /*[16A70]*/ + /** @stable ICU 70 */ + UBLOCK_TOTO = 317, /*[1E290]*/ + /** @stable ICU 70 */ + UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED_A = 318, /*[11AB0]*/ + /** @stable ICU 70 */ + UBLOCK_VITHKUQI = 319, /*[10570]*/ + /** @stable ICU 70 */ + UBLOCK_ZNAMENNY_MUSICAL_NOTATION = 320, /*[1CF00]*/ + + // New blocks in Unicode 15.0 + + /** @stable ICU 72 */ + UBLOCK_ARABIC_EXTENDED_C = 321, /*[10EC0]*/ + /** @stable ICU 72 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_H = 322, /*[31350]*/ + /** @stable ICU 72 */ + UBLOCK_CYRILLIC_EXTENDED_D = 323, /*[1E030]*/ + /** @stable ICU 72 */ + UBLOCK_DEVANAGARI_EXTENDED_A = 324, /*[11B00]*/ + /** @stable ICU 72 */ + UBLOCK_KAKTOVIK_NUMERALS = 325, /*[1D2C0]*/ + /** @stable ICU 72 */ + UBLOCK_KAWI = 326, /*[11F00]*/ + /** @stable ICU 72 */ + UBLOCK_NAG_MUNDARI = 327, /*[1E4D0]*/ + + // New block in Unicode 15.1 + + /** @stable ICU 74 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_I = 328, /*[2EBF0]*/ + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UBlockCode value. @@ -1814,7 +1933,7 @@ enum UBlockCode { * * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UBLOCK_COUNT = 309, + UBLOCK_COUNT = 329, #endif // U_HIDE_DEPRECATED_API /** @stable ICU 2.0 */ @@ -2106,6 +2225,9 @@ typedef enum UJoiningGroup { U_JG_HANIFI_ROHINGYA_KINNA_YA, /**< @stable ICU 62 */ U_JG_HANIFI_ROHINGYA_PA, /**< @stable ICU 62 */ + U_JG_THIN_YEH, /**< @stable ICU 70 */ + U_JG_VERTICAL_TAIL, /**< @stable ICU 70 */ + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UJoiningGroup value. @@ -2343,6 +2465,16 @@ typedef enum ULineBreak { U_LB_E_MODIFIER = 41, /*[EM]*/ /** @stable ICU 58 */ U_LB_ZWJ = 42, /*[ZWJ]*/ + /** @stable ICU 74 */ + U_LB_AKSARA = 43, /*[AK]*/ + /** @stable ICU 74 */ + U_LB_AKSARA_PREBASE = 44, /*[AP]*/ + /** @stable ICU 74 */ + U_LB_AKSARA_START = 45, /*[AS]*/ + /** @stable ICU 74 */ + U_LB_VIRAMA_FINAL = 46, /*[VF]*/ + /** @stable ICU 74 */ + U_LB_VIRAMA = 47, /*[VI]*/ #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal ULineBreak value. @@ -2350,7 +2482,7 @@ typedef enum ULineBreak { * * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - U_LB_COUNT = 43 + U_LB_COUNT = 48 #endif // U_HIDE_DEPRECATED_API } ULineBreak; @@ -2585,10 +2717,10 @@ typedef enum UVerticalOrientation { * * @param c Code point to test. * @param which UProperty selector constant, identifies which binary property to check. - * Must be UCHAR_BINARY_START<=whichUTS #51 Unicode Emoji + * defines several properties of strings. + * + * @param s String to test. + * @param length Length of the string, or negative if NUL-terminated. + * @param which UProperty selector constant, identifies which binary property to check. + * Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT. + * @return true or false according to the binary Unicode property value for the string. + * Also false if 'which' is out of bounds or if the Unicode version + * does not have data for the property at all. + * + * @see UProperty + * @see u_hasBinaryProperty + * @see u_getBinaryPropertySet + * @see u_getIntPropertyValue + * @see u_getUnicodeVersion + * @stable ICU 70 + */ +U_CAPI UBool U_EXPORT2 +u_stringHasBinaryProperty(const UChar *s, int32_t length, UProperty which); + /** * Returns a frozen USet for a binary property. * The library retains ownership over the returned object. @@ -2629,7 +2788,7 @@ u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode); * @see u_hasBinaryProperty * @stable ICU 2.1 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isUAlphabetic(UChar32 c); /** @@ -2644,7 +2803,7 @@ u_isUAlphabetic(UChar32 c); * @see u_hasBinaryProperty * @stable ICU 2.1 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isULowercase(UChar32 c); /** @@ -2659,7 +2818,7 @@ u_isULowercase(UChar32 c); * @see u_hasBinaryProperty * @stable ICU 2.1 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isUUppercase(UChar32 c); /** @@ -2680,7 +2839,7 @@ u_isUUppercase(UChar32 c); * @see u_hasBinaryProperty * @stable ICU 2.1 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isUWhiteSpace(UChar32 c); /** @@ -2708,7 +2867,7 @@ u_isUWhiteSpace(UChar32 c); * for enumerated properties, corresponds to the numeric value of the enumerated * constant of the respective property value enumeration type * (cast to enum type if necessary). - * Returns 0 or 1 (for FALSE/TRUE) for binary Unicode properties. + * Returns 0 or 1 (for false/true) for binary Unicode properties. * Returns a bit-mask for mask properties. * Returns 0 if 'which' is out of bounds or if the Unicode version * does not have data for the property at all, or not for this code point. @@ -2721,7 +2880,7 @@ u_isUWhiteSpace(UChar32 c); * @see u_getUnicodeVersion * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_getIntPropertyValue(UChar32 c, UProperty which); /** @@ -2742,7 +2901,7 @@ u_getIntPropertyValue(UChar32 c, UProperty which); * @see u_getIntPropertyValue * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_getIntPropertyMinValue(UProperty which); /** @@ -2754,7 +2913,7 @@ u_getIntPropertyMinValue(UProperty which); * * - UCHAR_BIDI_CLASS: 0/18 (U_LEFT_TO_RIGHT/U_BOUNDARY_NEUTRAL) * - UCHAR_SCRIPT: 0/45 (USCRIPT_COMMON/USCRIPT_TAGBANWA) - * - UCHAR_IDEOGRAPHIC: 0/1 (FALSE/TRUE) + * - UCHAR_IDEOGRAPHIC: 0/1 (false/true) * * For undefined UProperty constant values, min/max values will be 0/-1. * @@ -2771,7 +2930,7 @@ u_getIntPropertyMinValue(UProperty which); * @see u_getIntPropertyValue * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_getIntPropertyMaxValue(UProperty which); /** @@ -2814,7 +2973,7 @@ u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode); * @see U_NO_NUMERIC_VALUE * @stable ICU 2.2 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 u_getNumericValue(UChar32 c); /** @@ -2842,14 +3001,14 @@ u_getNumericValue(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is an Ll lowercase letter + * @return true if the code point is an Ll lowercase letter * * @see UCHAR_LOWERCASE * @see u_isupper * @see u_istitle * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_islower(UChar32 c); /** @@ -2868,7 +3027,7 @@ u_islower(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is an Lu uppercase letter + * @return true if the code point is an Lu uppercase letter * * @see UCHAR_UPPERCASE * @see u_islower @@ -2876,7 +3035,7 @@ u_islower(UChar32 c); * @see u_tolower * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isupper(UChar32 c); /** @@ -2886,14 +3045,14 @@ u_isupper(UChar32 c); * Same as java.lang.Character.isTitleCase(). * * @param c the code point to be tested - * @return TRUE if the code point is an Lt titlecase letter + * @return true if the code point is an Lt titlecase letter * * @see u_isupper * @see u_islower * @see u_totitle * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_istitle(UChar32 c); /** @@ -2910,11 +3069,11 @@ u_istitle(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a digit character according to Character.isDigit() + * @return true if the code point is a digit character according to Character.isDigit() * * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isdigit(UChar32 c); /** @@ -2929,13 +3088,13 @@ u_isdigit(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a letter character + * @return true if the code point is a letter character * * @see u_isdigit * @see u_isalnum * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isalpha(UChar32 c); /** @@ -2952,11 +3111,11 @@ u_isalpha(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is an alphanumeric character according to Character.isLetterOrDigit() + * @return true if the code point is an alphanumeric character according to Character.isLetterOrDigit() * * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isalnum(UChar32 c); /** @@ -2975,11 +3134,11 @@ u_isalnum(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a hexadecimal digit + * @return true if the code point is a hexadecimal digit * * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isxdigit(UChar32 c); /** @@ -2991,17 +3150,17 @@ u_isxdigit(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a punctuation character + * @return true if the code point is a punctuation character * * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_ispunct(UChar32 c); /** * Determines whether the specified code point is a "graphic" character * (printable, excluding spaces). - * TRUE for all characters except those with general categories + * true for all characters except those with general categories * "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates), * "Cn" (unassigned), and "Z" (separators). * @@ -3010,11 +3169,11 @@ u_ispunct(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a "graphic" character + * @return true if the code point is a "graphic" character * * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isgraph(UChar32 c); /** @@ -3022,13 +3181,13 @@ u_isgraph(UChar32 c); * a character that visibly separates words on a line. * The following are equivalent definitions: * - * TRUE for Unicode White_Space characters except for "vertical space controls" + * true for Unicode White_Space characters except for "vertical space controls" * where "vertical space controls" are the following characters: * U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS) * * same as * - * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators). + * true for U+0009 (TAB) and characters with general category "Zs" (space separators). * * Note: There are several ICU whitespace functions; please see the uchar.h * file documentation for a detailed comparison. @@ -3038,11 +3197,11 @@ u_isgraph(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a "blank" + * @return true if the code point is a "blank" * * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isblank(UChar32 c); /** @@ -3057,7 +3216,7 @@ u_isblank(UChar32 c); * Same as java.lang.Character.isDefined(). * * @param c the code point to be tested - * @return TRUE if the code point is assigned a character + * @return true if the code point is assigned a character * * @see u_isdigit * @see u_isalpha @@ -3067,7 +3226,7 @@ u_isblank(UChar32 c); * @see u_istitle * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isdefined(UChar32 c); /** @@ -3088,7 +3247,7 @@ u_isdefined(UChar32 c); * @see u_isUWhiteSpace * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isspace(UChar32 c); /** @@ -3102,14 +3261,14 @@ u_isspace(UChar32 c); * file documentation for a detailed comparison. * * @param c the code point to be tested - * @return TRUE if the code point is a space character according to Character.isSpaceChar() + * @return true if the code point is a space character according to Character.isSpaceChar() * * @see u_isspace * @see u_isWhitespace * @see u_isUWhiteSpace * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isJavaSpaceChar(UChar32 c); /** @@ -3142,14 +3301,14 @@ u_isJavaSpaceChar(UChar32 c); * file documentation for a detailed comparison. * * @param c the code point to be tested - * @return TRUE if the code point is a whitespace character according to Java/ICU + * @return true if the code point is a whitespace character according to Java/ICU * * @see u_isspace * @see u_isJavaSpaceChar * @see u_isUWhiteSpace * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isWhitespace(UChar32 c); /** @@ -3167,13 +3326,13 @@ u_isWhitespace(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a control character + * @return true if the code point is a control character * * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT * @see u_isprint * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_iscntrl(UChar32 c); /** @@ -3183,12 +3342,12 @@ u_iscntrl(UChar32 c); * Same as java.lang.Character.isISOControl(). * * @param c the code point to be tested - * @return TRUE if the code point is an ISO control code + * @return true if the code point is an ISO control code * * @see u_iscntrl * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isISOControl(UChar32 c); /** @@ -3200,13 +3359,13 @@ u_isISOControl(UChar32 c); * documentation at the top of this header file. * * @param c the code point to be tested - * @return TRUE if the code point is a printable character + * @return true if the code point is a printable character * * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT * @see u_iscntrl * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isprint(UChar32 c); /** @@ -3220,13 +3379,13 @@ u_isprint(UChar32 c); * Letter (L), Number (N), Punctuation (P), Symbol (S), or Space Separator (Zs). * * @param c the code point to be tested - * @return TRUE if the code point is a base character according to this function + * @return true if the code point is a base character according to this function * * @see u_isalpha * @see u_isdigit * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isbase(UChar32 c); /** @@ -3245,7 +3404,7 @@ u_isbase(UChar32 c); * @see UCharDirection * @stable ICU 2.0 */ -U_STABLE UCharDirection U_EXPORT2 +U_CAPI UCharDirection U_EXPORT2 u_charDirection(UChar32 c); /** @@ -3258,12 +3417,12 @@ u_charDirection(UChar32 c); * Same as UCHAR_BIDI_MIRRORED * * @param c the code point to be tested - * @return TRUE if the character has the Bidi_Mirrored property + * @return true if the character has the Bidi_Mirrored property * * @see UCHAR_BIDI_MIRRORED * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_isMirrored(UChar32 c); /** @@ -3285,7 +3444,7 @@ u_isMirrored(UChar32 c); * @see u_isMirrored * @stable ICU 2.0 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 u_charMirror(UChar32 c); /** @@ -3304,7 +3463,7 @@ u_charMirror(UChar32 c); * @see u_charMirror * @stable ICU 52 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 u_getBidiPairedBracket(UChar32 c); /** @@ -3318,7 +3477,7 @@ u_getBidiPairedBracket(UChar32 c); * @see UCharCategory * @stable ICU 2.0 */ -U_STABLE int8_t U_EXPORT2 +U_CAPI int8_t U_EXPORT2 u_charType(UChar32 c); /** @@ -3341,13 +3500,13 @@ u_charType(UChar32 c); * of code points c (where start<=c(remainingMatchLength_ + 2) << kState64RemainingShift) | @@ -123,14 +122,13 @@ class U_COMMON_API UCharsTrie : public UMemory { * @see getState64 * @see resetToState * @see reset - * @draft ICU 65 + * @stable ICU 65 */ UCharsTrie &resetToState64(uint64_t state) { remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2; pos_ = uchars_ + (state & kState64PosMask); return *this; } -#endif /* U_HIDE_DRAFT_API */ /** * UCharsTrie state object, for saving a trie's current state @@ -143,7 +141,7 @@ class U_COMMON_API UCharsTrie : public UMemory { * Constructs an empty State. * @stable ICU 4.8 */ - State() { uchars=NULL; } + State() { uchars=nullptr; } private: friend class UCharsTrie; @@ -177,7 +175,7 @@ class U_COMMON_API UCharsTrie : public UMemory { * @stable ICU 4.8 */ UCharsTrie &resetToState(const State &state) { - if(uchars_==state.uchars && uchars_!=NULL) { + if(uchars_==state.uchars && uchars_!=nullptr) { pos_=state.pos; remainingMatchLength_=state.remainingMatchLength; } @@ -241,7 +239,7 @@ class U_COMMON_API UCharsTrie : public UMemory { * result=next(c); * return result; * \endcode - * @param s A string. Can be NULL if length is 0. + * @param s A string. Can be nullptr if length is 0. * @param length The length of the string. Can be -1 if NUL-terminated. * @return The match/value Result. * @stable ICU 4.8 @@ -268,16 +266,16 @@ class U_COMMON_API UCharsTrie : public UMemory { /** * Determines whether all strings reachable from the current state * map to the same value. - * @param uniqueValue Receives the unique value, if this function returns TRUE. + * @param uniqueValue Receives the unique value, if this function returns true. * (output-only) - * @return TRUE if all strings reachable from the current state + * @return true if all strings reachable from the current state * map to the same value. * @stable ICU 4.8 */ inline UBool hasUniqueValue(int32_t &uniqueValue) const { const char16_t *pos=pos_; // Skip the rest of a pending linear-match node. - return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); + return pos!=nullptr && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue); } /** @@ -335,7 +333,7 @@ class U_COMMON_API UCharsTrie : public UMemory { Iterator &reset(); /** - * @return TRUE if there are more elements. + * @return true if there are more elements. * @stable ICU 4.8 */ UBool hasNext() const; @@ -351,7 +349,7 @@ class U_COMMON_API UCharsTrie : public UMemory { * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) - * @return TRUE if there is another element. + * @return true if there is another element. * @stable ICU 4.8 */ UBool next(UErrorCode &errorCode); @@ -369,9 +367,9 @@ class U_COMMON_API UCharsTrie : public UMemory { private: UBool truncateAndStop() { - pos_=NULL; + pos_=nullptr; value_=-1; // no real value for str - return TRUE; + return true; } const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode); @@ -411,10 +409,10 @@ class U_COMMON_API UCharsTrie : public UMemory { pos_(uchars_), remainingMatchLength_(-1) {} // No assignment operator. - UCharsTrie &operator=(const UCharsTrie &other); + UCharsTrie &operator=(const UCharsTrie &other) = delete; inline void stop() { - pos_=NULL; + pos_=nullptr; } // Reads a compact 32-bit integer. @@ -612,7 +610,7 @@ class U_COMMON_API UCharsTrie : public UMemory { // Iterator variables. - // Pointer to next trie unit to read. NULL if no more matches. + // Pointer to next trie unit to read. nullptr if no more matches. const char16_t *pos_; // Remaining length of a linear-match node, minus 1. Negative if not in such a node. int32_t remainingMatchLength_; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucharstriebuilder.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucharstriebuilder.h index f01853954..5c8aa33ff 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucharstriebuilder.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucharstriebuilder.h @@ -101,9 +101,10 @@ class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder { * Multiple calls to buildUnicodeString() set the UnicodeStrings to the * builder's same char16_t array, without rebuilding. * If buildUnicodeString() is called after build(), the trie will be - * re-serialized into a new array. - * If build() is called after buildUnicodeString(), the trie object will become - * the owner of the previously returned array. + * re-serialized into a new array (because build() passes on ownership). + * If build() is called after buildUnicodeString(), the trie object returned + * by build() will become the owner of the underlying data for the + * previously returned UnicodeString. * After clear() has been called, a new array will be used as well. * @param buildOption Build option, see UStringTrieBuildOption. * @param result A UnicodeString which will be set to the char16_t-serialized @@ -132,46 +133,46 @@ class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder { } private: - UCharsTrieBuilder(const UCharsTrieBuilder &other); // no copy constructor - UCharsTrieBuilder &operator=(const UCharsTrieBuilder &other); // no assignment operator + UCharsTrieBuilder(const UCharsTrieBuilder &other) = delete; // no copy constructor + UCharsTrieBuilder &operator=(const UCharsTrieBuilder &other) = delete; // no assignment operator void buildUChars(UStringTrieBuildOption buildOption, UErrorCode &errorCode); - virtual int32_t getElementStringLength(int32_t i) const; - virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const; - virtual int32_t getElementValue(int32_t i) const; + virtual int32_t getElementStringLength(int32_t i) const override; + virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const override; + virtual int32_t getElementValue(int32_t i) const override; - virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const; + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const override; - virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const; - virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const; - virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const; + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const override; + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const override; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const override; - virtual UBool matchNodesCanHaveValues() const { return TRUE; } + virtual UBool matchNodesCanHaveValues() const override { return true; } - virtual int32_t getMaxBranchLinearSubNodeLength() const { return UCharsTrie::kMaxBranchLinearSubNodeLength; } - virtual int32_t getMinLinearMatch() const { return UCharsTrie::kMinLinearMatch; } - virtual int32_t getMaxLinearMatchLength() const { return UCharsTrie::kMaxLinearMatchLength; } + virtual int32_t getMaxBranchLinearSubNodeLength() const override { return UCharsTrie::kMaxBranchLinearSubNodeLength; } + virtual int32_t getMinLinearMatch() const override { return UCharsTrie::kMinLinearMatch; } + virtual int32_t getMaxLinearMatchLength() const override { return UCharsTrie::kMaxLinearMatchLength; } class UCTLinearMatchNode : public LinearMatchNode { public: UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode); - virtual bool operator==(const Node &other) const; - virtual void write(StringTrieBuilder &builder); + virtual bool operator==(const Node &other) const override; + virtual void write(StringTrieBuilder &builder) override; private: const char16_t *s; }; virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length, - Node *nextNode) const; + Node *nextNode) const override; UBool ensureCapacity(int32_t length); - virtual int32_t write(int32_t unit); + virtual int32_t write(int32_t unit) override; int32_t write(const char16_t *s, int32_t length); - virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length); - virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); - virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); - virtual int32_t writeDeltaTo(int32_t jumpTarget); + virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length) override; + virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal) override; + virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node) override; + virtual int32_t writeDeltaTo(int32_t jumpTarget) override; UnicodeString strings; UCharsTrieElement *elements; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uchriter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uchriter.h index f6979e2bc..9fae5e7de 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uchriter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uchriter.h @@ -56,7 +56,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * The starting * position is specified by "position". If "position" is outside the valid * iteration range, the behavior of this object is undefined. - * @param textPtr The char16_t array to be iteratd over + * @param textPtr The char16_t array to be iterated over * @param length The length of the char16_t array * @param position The starting position of the iteration * @stable ICU 2.0 @@ -119,14 +119,14 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * same string and are pointing at the same character. * @stable ICU 2.0 */ - virtual bool operator==(const ForwardCharacterIterator& that) const; + virtual bool operator==(const ForwardCharacterIterator& that) const override; /** * Generates a hash code for this iterator. * @return the hash code. * @stable ICU 2.0 */ - virtual int32_t hashCode(void) const; + virtual int32_t hashCode(void) const override; /** * Returns a new UCharCharacterIterator referring to the same @@ -135,7 +135,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the CharacterIterator newly created * @stable ICU 2.0 */ - virtual UCharCharacterIterator* clone() const; + virtual UCharCharacterIterator* clone() const override; /** * Sets the iterator to refer to the first code unit in its @@ -144,7 +144,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the first code unit in its iteration range. * @stable ICU 2.0 */ - virtual char16_t first(void); + virtual char16_t first(void) override; /** * Sets the iterator to refer to the first code unit in its @@ -154,7 +154,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the first code unit in its iteration range * @stable ICU 2.0 */ - virtual char16_t firstPostInc(void); + virtual char16_t firstPostInc(void) override; /** * Sets the iterator to refer to the first code point in its @@ -165,7 +165,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the first code point in its iteration range * @stable ICU 2.0 */ - virtual UChar32 first32(void); + virtual UChar32 first32(void) override; /** * Sets the iterator to refer to the first code point in its @@ -175,7 +175,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the first code point in its iteration range. * @stable ICU 2.0 */ - virtual UChar32 first32PostInc(void); + virtual UChar32 first32PostInc(void) override; /** * Sets the iterator to refer to the last code unit in its @@ -184,7 +184,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the last code unit in its iteration range. * @stable ICU 2.0 */ - virtual char16_t last(void); + virtual char16_t last(void) override; /** * Sets the iterator to refer to the last code point in its @@ -193,7 +193,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the last code point in its iteration range. * @stable ICU 2.0 */ - virtual UChar32 last32(void); + virtual UChar32 last32(void) override; /** * Sets the iterator to refer to the "position"-th code unit @@ -203,7 +203,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the code unit * @stable ICU 2.0 */ - virtual char16_t setIndex(int32_t position); + virtual char16_t setIndex(int32_t position) override; /** * Sets the iterator to refer to the beginning of the code point @@ -216,21 +216,21 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the code unit * @stable ICU 2.0 */ - virtual UChar32 setIndex32(int32_t position); + virtual UChar32 setIndex32(int32_t position) override; /** * Returns the code unit the iterator currently refers to. * @return the code unit the iterator currently refers to. * @stable ICU 2.0 */ - virtual char16_t current(void) const; + virtual char16_t current(void) const override; /** * Returns the code point the iterator currently refers to. * @return the code point the iterator currently refers to. * @stable ICU 2.0 */ - virtual UChar32 current32(void) const; + virtual UChar32 current32(void) const override; /** * Advances to the next code unit in the iteration range (toward @@ -239,7 +239,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the next code unit in the iteration range. * @stable ICU 2.0 */ - virtual char16_t next(void); + virtual char16_t next(void) override; /** * Gets the current code unit for returning and advances to the next code unit @@ -249,7 +249,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the current code unit. * @stable ICU 2.0 */ - virtual char16_t nextPostInc(void); + virtual char16_t nextPostInc(void) override; /** * Advances to the next code point in the iteration range (toward @@ -261,7 +261,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the next code point in the iteration range. * @stable ICU 2.0 */ - virtual UChar32 next32(void); + virtual UChar32 next32(void) override; /** * Gets the current code point for returning and advances to the next code point @@ -271,18 +271,18 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the current point. * @stable ICU 2.0 */ - virtual UChar32 next32PostInc(void); + virtual UChar32 next32PostInc(void) override; /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * at or after the current position in the iteration range. * This is used with nextPostInc() or next32PostInc() in forward * iteration. - * @return FALSE if there are no more code units or code points + * @return false if there are no more code units or code points * at or after the current position in the iteration range. * @stable ICU 2.0 */ - virtual UBool hasNext(); + virtual UBool hasNext() override; /** * Advances to the previous code unit in the iteration range (toward @@ -291,7 +291,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the previous code unit in the iteration range. * @stable ICU 2.0 */ - virtual char16_t previous(void); + virtual char16_t previous(void) override; /** * Advances to the previous code point in the iteration range (toward @@ -300,18 +300,18 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the previous code point in the iteration range. * @stable ICU 2.0 */ - virtual UChar32 previous32(void); + virtual UChar32 previous32(void) override; /** - * Returns FALSE if there are no more code units or code points + * Returns false if there are no more code units or code points * before the current position in the iteration range. * This is used with previous() or previous32() in backward * iteration. - * @return FALSE if there are no more code units or code points + * @return false if there are no more code units or code points * before the current position in the iteration range. * @stable ICU 2.0 */ - virtual UBool hasPrevious(); + virtual UBool hasPrevious() override; /** * Moves the current position relative to the start or end of the @@ -324,7 +324,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return the new position * @stable ICU 2.0 */ - virtual int32_t move(int32_t delta, EOrigin origin); + virtual int32_t move(int32_t delta, EOrigin origin) override; /** * Moves the current position relative to the start or end of the @@ -341,7 +341,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { // One of the system headers right now is sometimes defining a conflicting macro we don't use #undef move32 #endif - virtual int32_t move32(int32_t delta, EOrigin origin); + virtual int32_t move32(int32_t delta, EOrigin origin) override; /** * Sets the iterator to iterate over a new range of text @@ -356,7 +356,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @param result Receives a copy of the text under iteration. * @stable ICU 2.0 */ - virtual void getText(UnicodeString& result); + virtual void getText(UnicodeString& result) override; /** * Return a class ID for this class (not really public) @@ -370,7 +370,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { * @return a class ID for this object. * @stable ICU 2.0 */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID(void) const override; protected: /** diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uclean.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uclean.h index 7cef6dba6..f5b0aa088 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uclean.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uclean.h @@ -49,7 +49,7 @@ * * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_init(UErrorCode *status); #ifndef U_HIDE_SYSTEM_API @@ -98,7 +98,7 @@ u_init(UErrorCode *status); * @stable ICU 2.0 * @system */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_cleanup(void); U_CDECL_BEGIN @@ -114,7 +114,8 @@ typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size); /** * Pointer type for a user supplied memory re-allocation function. * @param context user supplied value, obtained from u_setMemoryFunctions(). - * @param size The number of bytes to be allocated + * @param mem Pointer to the memory block to be resized. + * @param size The new size for the block. * @return Pointer to the newly allocated memory, or NULL if the allocation failed. * @stable ICU 2.8 * @system @@ -124,8 +125,7 @@ typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t si * Pointer type for a user supplied memory free function. Behavior should be * similar the standard C library free(). * @param context user supplied value, obtained from u_setMemoryFunctions(). - * @param mem Pointer to the memory block to be resized - * @param size The new size for the block + * @param mem Pointer to the memory block to be freed. * @return Pointer to the resized memory block, or NULL if the resizing failed. * @stable ICU 2.8 * @system @@ -148,7 +148,7 @@ typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); * @stable ICU 2.8 * @system */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, UErrorCode *status); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv.h index c1f295577..20c173b66 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv.h @@ -1,3 +1,288 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * ucnv.h: + * External APIs for the ICU's codeset conversion library + * Bertrand A. Damiba + * + * Modification History: + * + * Date Name Description + * 04/04/99 helena Fixed internal header inclusion. + * 05/11/00 helena Added setFallback and usesFallback APIs. + * 06/29/2000 helena Major rewrite of the callback APIs. + * 12/07/2000 srl Update of documentation + */ + +/** + * \file + * \brief C API: Character conversion + * + *

    Character Conversion C API

    + * + *

    This API is used to convert codepage or character encoded data to and + * from UTF-16. You can open a converter with {@link ucnv_open() }. With that + * converter, you can get its properties, set options, convert your data and + * close the converter.

    + * + *

    Since many software programs recognize different converter names for + * different types of converters, there are other functions in this API to + * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() }, + * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the + * more frequently used alias functions to get this information.

    + * + *

    When a converter encounters an illegal, irregular, invalid or unmappable character + * its default behavior is to use a substitution character to replace the + * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromUCallBack() } + * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h defines + * many other callback actions that can be used instead of a character substitution.

    + * + *

    More information about this API can be found in our + * User Guide.

    + */ + +#ifndef UCNV_H +#define UCNV_H + +#include "unicode/ucnv_err.h" +#include "unicode/uenum.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) + +#define USET_DEFINED + +/** + * USet is the C API type corresponding to C++ class UnicodeSet. + * It is forward-declared here to avoid including unicode/uset.h file if related + * conversion APIs are not used. + * + * @see ucnv_getUnicodeSet + * @stable ICU 2.4 + */ +typedef struct USet USet; + +#endif + +#if !UCONFIG_NO_CONVERSION + +U_CDECL_BEGIN + +/** Maximum length of a converter name including the terminating NULL @stable ICU 2.0 */ +#define UCNV_MAX_CONVERTER_NAME_LENGTH 60 +/** Maximum length of a converter name including path and terminating NULL @stable ICU 2.0 */ +#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH) + +/** Shift in for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ +#define UCNV_SI 0x0F +/** Shift out for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ +#define UCNV_SO 0x0E + +/** + * Enum for specifying basic types of converters + * @see ucnv_getType + * @stable ICU 2.0 + */ +typedef enum { + /** @stable ICU 2.0 */ + UCNV_UNSUPPORTED_CONVERTER = -1, + /** @stable ICU 2.0 */ + UCNV_SBCS = 0, + /** @stable ICU 2.0 */ + UCNV_DBCS = 1, + /** @stable ICU 2.0 */ + UCNV_MBCS = 2, + /** @stable ICU 2.0 */ + UCNV_LATIN_1 = 3, + /** @stable ICU 2.0 */ + UCNV_UTF8 = 4, + /** @stable ICU 2.0 */ + UCNV_UTF16_BigEndian = 5, + /** @stable ICU 2.0 */ + UCNV_UTF16_LittleEndian = 6, + /** @stable ICU 2.0 */ + UCNV_UTF32_BigEndian = 7, + /** @stable ICU 2.0 */ + UCNV_UTF32_LittleEndian = 8, + /** @stable ICU 2.0 */ + UCNV_EBCDIC_STATEFUL = 9, + /** @stable ICU 2.0 */ + UCNV_ISO_2022 = 10, + + /** @stable ICU 2.0 */ + UCNV_LMBCS_1 = 11, + /** @stable ICU 2.0 */ + UCNV_LMBCS_2, + /** @stable ICU 2.0 */ + UCNV_LMBCS_3, + /** @stable ICU 2.0 */ + UCNV_LMBCS_4, + /** @stable ICU 2.0 */ + UCNV_LMBCS_5, + /** @stable ICU 2.0 */ + UCNV_LMBCS_6, + /** @stable ICU 2.0 */ + UCNV_LMBCS_8, + /** @stable ICU 2.0 */ + UCNV_LMBCS_11, + /** @stable ICU 2.0 */ + UCNV_LMBCS_16, + /** @stable ICU 2.0 */ + UCNV_LMBCS_17, + /** @stable ICU 2.0 */ + UCNV_LMBCS_18, + /** @stable ICU 2.0 */ + UCNV_LMBCS_19, + /** @stable ICU 2.0 */ + UCNV_LMBCS_LAST = UCNV_LMBCS_19, + /** @stable ICU 2.0 */ + UCNV_HZ, + /** @stable ICU 2.0 */ + UCNV_SCSU, + /** @stable ICU 2.0 */ + UCNV_ISCII, + /** @stable ICU 2.0 */ + UCNV_US_ASCII, + /** @stable ICU 2.0 */ + UCNV_UTF7, + /** @stable ICU 2.2 */ + UCNV_BOCU1, + /** @stable ICU 2.2 */ + UCNV_UTF16, + /** @stable ICU 2.2 */ + UCNV_UTF32, + /** @stable ICU 2.2 */ + UCNV_CESU8, + /** @stable ICU 2.4 */ + UCNV_IMAP_MAILBOX, + /** @stable ICU 4.8 */ + UCNV_COMPOUND_TEXT, + + /* Number of converter types for which we have conversion routines. */ + UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES +} UConverterType; + +/** + * Enum for specifying which platform a converter ID refers to. + * The use of platform/CCSID is not recommended. See ucnv_openCCSID(). + * + * @see ucnv_getPlatform + * @see ucnv_openCCSID + * @see ucnv_getCCSID + * @stable ICU 2.0 + */ +typedef enum { + UCNV_UNKNOWN = -1, + UCNV_IBM = 0 +} UConverterPlatform; + +/** + * Function pointer for error callback in the codepage to unicode direction. + * Called when an error has occurred in conversion to unicode, or on open/close of the callback (see reason). + * @param context Pointer to the callback's private data + * @param args Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param pErrorCode ICU error code in/out parameter. + * For converter callback functions, set to a conversion error + * before the call, and the callback may reset it to U_ZERO_ERROR. + * @see ucnv_setToUCallBack + * @see UConverterToUnicodeArgs + * @stable ICU 2.0 + */ +typedef void (U_EXPORT2 *UConverterToUCallback) ( + const void* context, + UConverterToUnicodeArgs *args, + const char *codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode *pErrorCode); + +/** + * Function pointer for error callback in the unicode to codepage direction. + * Called when an error has occurred in conversion from unicode, or on open/close of the callback (see reason). + * @param context Pointer to the callback's private data + * @param args Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param pErrorCode ICU error code in/out parameter. + * For converter callback functions, set to a conversion error + * before the call, and the callback may reset it to U_ZERO_ERROR. + * @see ucnv_setFromUCallBack + * @stable ICU 2.0 + */ +typedef void (U_EXPORT2 *UConverterFromUCallback) ( + const void* context, + UConverterFromUnicodeArgs *args, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode *pErrorCode); + +U_CDECL_END + +/** + * Character that separates converter names from options and options from each other. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_OPTION_SEP_CHAR ',' + +/** + * String version of UCNV_OPTION_SEP_CHAR. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_OPTION_SEP_STRING "," + +/** + * Character that separates a converter option from its value. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_VALUE_SEP_CHAR '=' + +/** + * String version of UCNV_VALUE_SEP_CHAR. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_VALUE_SEP_STRING "=" + +/** + * Converter option for specifying a locale. + * For example, ucnv_open("SCSU,locale=ja", &errorCode); + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_LOCALE_OPTION_STRING ",locale=" + +/** + * Converter option for specifying a version selector (0..9) for some converters. + * For example, + * \code + * ucnv_open("UTF-7,version=1", &errorCode); + * \endcode + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.4 + */ +#define UCNV_VERSION_OPTION_STRING ",version=" + /** * Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages. * Swaps Unicode mappings for EBCDIC LF and NL codes, as used on @@ -9,3 +294,1763 @@ * @stable ICU 2.4 */ #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl" + +/** + * Do a fuzzy compare of two converter/alias names. + * The comparison is case-insensitive, ignores leading zeroes if they are not + * followed by further digits, and ignores all but letters and digits. + * Thus the strings "UTF-8", "utf_8", "u*T@f08" and "Utf 8" are exactly equivalent. + * See section 1.4, Charset Alias Matching in Unicode Technical Standard #22 + * at http://www.unicode.org/reports/tr22/ + * + * @param name1 a converter name or alias, zero-terminated + * @param name2 a converter name or alias, zero-terminated + * @return 0 if the names match, or a negative value if the name1 + * lexically precedes name2, or a positive value if the name1 + * lexically follows name2. + * @stable ICU 2.0 + */ +U_CAPI int U_EXPORT2 +ucnv_compareNames(const char *name1, const char *name2); + + +/** + * Creates a UConverter object with the name of a coded character set specified as a C string. + * The actual name will be resolved with the alias file + * using a case-insensitive string comparison that ignores + * leading zeroes and all non-alphanumeric characters. + * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. + * (See also ucnv_compareNames().) + * If NULL is passed for the converter name, it will create one with the + * getDefaultName return value. + * + *

    A converter name for ICU 1.5 and above may contain options + * like a locale specification to control the specific behavior of + * the newly instantiated converter. + * The meaning of the options depends on the particular converter. + * If an option is not defined for or recognized by a given converter, then it is ignored.

    + * + *

    Options are appended to the converter name string, with a + * UCNV_OPTION_SEP_CHAR between the name and the first option and + * also between adjacent options.

    + * + *

    If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.

    + * + *

    The conversion behavior and names can vary between platforms. ICU may + * convert some characters differently from other platforms. Details on this topic + * are in the User + * Guide. Aliases starting with a "cp" prefix have no specific meaning + * other than its an alias starting with the letters "cp". Please do not + * associate any meaning to these aliases.

    + * + * \snippet samples/ucnv/convsamp.cpp ucnv_open + * + * @param converterName Name of the coded character set table. + * This may have options appended to the string. + * IANA alias character set names, IBM CCSIDs starting with "ibm-", + * Windows codepage numbers starting with "windows-" are frequently + * used for this parameter. See ucnv_getAvailableName and + * ucnv_getAlias for a complete list that is available. + * If this parameter is NULL, the default converter will be used. + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error occurred + * @see ucnv_openU + * @see ucnv_openCCSID + * @see ucnv_getAvailableName + * @see ucnv_getAlias + * @see ucnv_getDefaultName + * @see ucnv_close + * @see ucnv_compareNames + * @stable ICU 2.0 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_open(const char *converterName, UErrorCode *err); + + +/** + * Creates a Unicode converter with the names specified as unicode string. + * The name should be limited to the ASCII-7 alphanumerics range. + * The actual name will be resolved with the alias file + * using a case-insensitive string comparison that ignores + * leading zeroes and all non-alphanumeric characters. + * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. + * (See also ucnv_compareNames().) + * If NULL is passed for the converter name, it will create + * one with the ucnv_getDefaultName() return value. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * + *

    See ucnv_open for the complete details

    + * @param name Name of the UConverter table in a zero terminated + * Unicode string + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, + * U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an + * error occurred + * @see ucnv_open + * @see ucnv_openCCSID + * @see ucnv_close + * @see ucnv_compareNames + * @stable ICU 2.0 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_openU(const UChar *name, + UErrorCode *err); + +/** + * Creates a UConverter object from a CCSID number and platform pair. + * Note that the usefulness of this function is limited to platforms with numeric + * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifiers for + * encodings. + * + * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related. + * For many IBM CCSIDs there are multiple (up to six) Unicode conversion tables, and + * for some Unicode conversion tables there are multiple CCSIDs. + * Some "alternate" Unicode conversion tables are provided by the + * IBM CDRA conversion table registry. + * The most prominent example of a systematic modification of conversion tables that is + * not provided in the form of conversion table files in the repository is + * that S/390 Unix System Services swaps the codes for Line Feed and New Line in all + * EBCDIC codepages, which requires such a swap in the Unicode conversion tables as well. + * + * Only IBM default conversion tables are accessible with ucnv_openCCSID(). + * ucnv_getCCSID() will return the same CCSID for all conversion tables that are associated + * with that CCSID. + * + * Currently, the only "platform" supported in the ICU converter API is UCNV_IBM. + * + * In summary, the use of CCSIDs and the associated API functions is not recommended. + * + * In order to open a converter with the default IBM CDRA Unicode conversion table, + * you can use this function or use the prefix "ibm-": + * \code + * char name[20]; + * sprintf(name, "ibm-%hu", ccsid); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * In order to open a converter with the IBM S/390 Unix System Services variant + * of a Unicode/EBCDIC conversion table, + * you can use the prefix "ibm-" together with the option string UCNV_SWAP_LFNL_OPTION_STRING: + * \code + * char name[20]; + * sprintf(name, "ibm-%hu" UCNV_SWAP_LFNL_OPTION_STRING, ccsid); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * In order to open a converter from a Microsoft codepage number, use the prefix "cp": + * \code + * char name[20]; + * sprintf(name, "cp%hu", codepageID); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * + * @param codepage codepage number to create + * @param platform the platform in which the codepage number exists + * @param err error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error + * occurred. + * @see ucnv_open + * @see ucnv_openU + * @see ucnv_close + * @see ucnv_getCCSID + * @see ucnv_getPlatform + * @see UConverterPlatform + * @stable ICU 2.0 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_openCCSID(int32_t codepage, + UConverterPlatform platform, + UErrorCode * err); + +/** + *

    Creates a UConverter object specified from a packageName and a converterName.

    + * + *

    The packageName and converterName must point to an ICU udata object, as defined by + * udata_open( packageName, "cnv", converterName, err) or equivalent. + * Typically, packageName will refer to a (.dat) file, or to a package registered with + * udata_setAppData(). Using a full file or directory pathname for packageName is deprecated.

    + * + *

    The name will NOT be looked up in the alias mechanism, nor will the converter be + * stored in the converter cache or the alias table. The only way to open further converters + * is call this function multiple times, or use the ucnv_clone() function to clone a + * 'primary' converter.

    + * + *

    A future version of ICU may add alias table lookups and/or caching + * to this function.

    + * + *

    Example Use: + * cnv = ucnv_openPackage("myapp", "myconverter", &err); + *

    + * + * @param packageName name of the package (equivalent to 'path' in udata_open() call) + * @param converterName name of the data item to be used, without suffix. + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error occurred + * @see udata_open + * @see ucnv_open + * @see ucnv_clone + * @see ucnv_close + * @stable ICU 2.2 + */ +U_CAPI UConverter* U_EXPORT2 +ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err); + +/** + * Thread safe converter cloning operation. + * + * You must ucnv_close() the clone. + * + * @param cnv converter to be cloned + * @param status to indicate whether the operation went on smoothly or there were errors + * @return pointer to the new clone + * @stable ICU 71 + */ +U_CAPI UConverter* U_EXPORT2 ucnv_clone(const UConverter *cnv, UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * Thread safe converter cloning operation. + * For most efficient operation, pass in a stackBuffer (and a *pBufferSize) + * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space. + * If the buffer size is sufficient, then the clone will use the stack buffer; + * otherwise, it will be allocated, and *pBufferSize will indicate + * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.) + * + * You must ucnv_close() the clone in any case. + * + * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not) + * then *pBufferSize will be changed to a sufficient size + * for cloning this converter, + * without actually cloning the converter ("pure pre-flighting"). + * + * If *pBufferSize is greater than zero but not large enough for a stack-based + * clone, then the converter is cloned using newly allocated memory + * and *pBufferSize is changed to the necessary size. + * + * If the converter clone fits into the stack buffer but the stack buffer is not + * sufficiently aligned for the clone, then the clone will use an + * adjusted pointer and use an accordingly smaller buffer size. + * + * @param cnv converter to be cloned + * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
    + * user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations. + * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
    + * pointer to size of allocated space. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_WARNING, + * is used if pBufferSize != NULL and any allocations were necessary + * However, it is better to check if *pBufferSize grew for checking for + * allocations because warning codes can be overridden by subsequent + * function calls. + * @return pointer to the new clone + * @deprecated ICU 71 Use ucnv_clone() instead. + */ +U_DEPRECATED UConverter * U_EXPORT2 +ucnv_safeClone(const UConverter *cnv, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +/** + * \def U_CNV_SAFECLONE_BUFFERSIZE + * Definition of a buffer size that is designed to be large enough for + * converters to be cloned with ucnv_safeClone(). + * @deprecated ICU 52. Do not rely on ucnv_safeClone() cloning into any provided buffer. + */ +#define U_CNV_SAFECLONE_BUFFERSIZE 1024 + +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Deletes the unicode converter and releases resources associated + * with just this instance. + * Does not free up shared converter tables. + * + * @param converter the converter object to be deleted + * @see ucnv_open + * @see ucnv_openU + * @see ucnv_openCCSID + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_close(UConverter * converter); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUConverterPointer + * "Smart pointer" class, closes a UConverter via ucnv_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close); + +U_NAMESPACE_END + +#endif + +/** + * Fills in the output parameter, subChars, with the substitution characters + * as multiple bytes. + * If ucnv_setSubstString() set a Unicode string because the converter is + * stateful, then subChars will be an empty string. + * + * @param converter the Unicode converter + * @param subChars the substitution characters + * @param len on input the capacity of subChars, on output the number + * of bytes copied to it + * @param err the outgoing error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @see ucnv_setSubstString + * @see ucnv_setSubstChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getSubstChars(const UConverter *converter, + char *subChars, + int8_t *len, + UErrorCode *err); + +/** + * Sets the substitution chars when converting from unicode to a codepage. The + * substitution is specified as a string of 1-4 bytes, and may contain + * NULL bytes. + * The subChars must represent a single character. The caller needs to know the + * byte sequence of a valid character in the converter's charset. + * For some converters, for example some ISO 2022 variants, only single-byte + * substitution characters may be supported. + * The newer ucnv_setSubstString() function relaxes these limitations. + * + * @param converter the Unicode converter + * @param subChars the substitution character byte sequence we want set + * @param len the number of bytes in subChars + * @param err the error status code. U_INDEX_OUTOFBOUNDS_ERROR if + * len is bigger than the maximum number of bytes allowed in subchars + * @see ucnv_setSubstString + * @see ucnv_getSubstChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setSubstChars(UConverter *converter, + const char *subChars, + int8_t len, + UErrorCode *err); + +/** + * Set a substitution string for converting from Unicode to a charset. + * The caller need not know the charset byte sequence for each charset. + * + * Unlike ucnv_setSubstChars() which is designed to set a charset byte sequence + * for a single character, this function takes a Unicode string with + * zero, one or more characters, and immediately verifies that the string can be + * converted to the charset. + * If not, or if the result is too long (more than 32 bytes as of ICU 3.6), + * then the function returns with an error accordingly. + * + * Also unlike ucnv_setSubstChars(), this function works for stateful charsets + * by converting on the fly at the point of substitution rather than setting + * a fixed byte sequence. + * + * @param cnv The UConverter object. + * @param s The Unicode string. + * @param length The number of UChars in s, or -1 for a NUL-terminated string. + * @param err Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * + * @see ucnv_setSubstChars + * @see ucnv_getSubstChars + * @stable ICU 3.6 + */ +U_CAPI void U_EXPORT2 +ucnv_setSubstString(UConverter *cnv, + const UChar *s, + int32_t length, + UErrorCode *err); + +/** + * Fills in the output parameter, errBytes, with the error characters from the + * last failing conversion. + * + * @param converter the Unicode converter + * @param errBytes the codepage bytes which were in error + * @param len on input the capacity of errBytes, on output the number of + * bytes which were copied to it + * @param err the error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getInvalidChars(const UConverter *converter, + char *errBytes, + int8_t *len, + UErrorCode *err); + +/** + * Fills in the output parameter, errChars, with the error characters from the + * last failing conversion. + * + * @param converter the Unicode converter + * @param errUChars the UChars which were in error + * @param len on input the capacity of errUChars, on output the number of + * UChars which were copied to it + * @param err the error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getInvalidUChars(const UConverter *converter, + UChar *errUChars, + int8_t *len, + UErrorCode *err); + +/** + * Resets the state of a converter to the default state. This is used + * in the case of an error, to restart a conversion from a known default state. + * It will also empty the internal output buffers. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_reset(UConverter *converter); + +/** + * Resets the to-Unicode part of a converter state to the default state. + * This is used in the case of an error to restart a conversion to + * Unicode to a known default state. It will also empty the internal + * output buffers used for the conversion to Unicode codepoints. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_resetToUnicode(UConverter *converter); + +/** + * Resets the from-Unicode part of a converter state to the default state. + * This is used in the case of an error to restart a conversion from + * Unicode to a known default state. It will also empty the internal output + * buffers used for the conversion from Unicode codepoints. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_resetFromUnicode(UConverter *converter); + +/** + * Returns the maximum number of bytes that are output per UChar in conversion + * from Unicode using this converter. + * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING + * to calculate the size of a target buffer for conversion from Unicode. + * + * Note: Before ICU 2.8, this function did not return reliable numbers for + * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS. + * + * This number may not be the same as the maximum number of bytes per + * "conversion unit". In other words, it may not be the intuitively expected + * number of bytes per character that would be published for a charset, + * and may not fulfill any other purpose than the allocation of an output + * buffer of guaranteed sufficient size for a given input length and converter. + * + * Examples for special cases that are taken into account: + * - Supplementary code points may convert to more bytes than BMP code points. + * This function returns bytes per UChar (UTF-16 code unit), not per + * Unicode code point, for efficient buffer allocation. + * - State-shifting output (SI/SO, escapes, etc.) from stateful converters. + * - When m input UChars are converted to n output bytes, then the maximum m/n + * is taken into account. + * + * The number returned here does not take into account + * (see UCNV_GET_MAX_BYTES_FOR_STRING): + * - callbacks which output more than one charset character sequence per call, + * like escape callbacks + * - initial and final non-character bytes that are output by some converters + * (automatic BOMs, initial escape sequence, final SI, etc.) + * + * Examples for returned values: + * - SBCS charsets: 1 + * - Shift-JIS: 2 + * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted) + * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_) + * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS) + * - ISO-2022: 3 (always outputs UTF-8) + * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS) + * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS) + * + * @param converter The Unicode converter. + * @return The maximum number of bytes per UChar (16 bit code unit) + * that are output by ucnv_fromUnicode(), + * to be used together with UCNV_GET_MAX_BYTES_FOR_STRING + * for buffer allocation. + * + * @see UCNV_GET_MAX_BYTES_FOR_STRING + * @see ucnv_getMinCharSize + * @stable ICU 2.0 + */ +U_CAPI int8_t U_EXPORT2 +ucnv_getMaxCharSize(const UConverter *converter); + +/** + * Calculates the size of a buffer for conversion from Unicode to a charset. + * The calculated size is guaranteed to be sufficient for this conversion. + * + * It takes into account initial and final non-character bytes that are output + * by some converters. + * It does not take into account callbacks which output more than one charset + * character sequence per call, like escape callbacks. + * The default (substitution) callback only outputs one charset character sequence. + * + * @param length Number of UChars to be converted. + * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter + * that will be used. + * @return Size of a buffer that will be large enough to hold the output bytes of + * converting length UChars with the converter that returned the maxCharSize. + * + * @see ucnv_getMaxCharSize + * @stable ICU 2.8 + */ +#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \ + (((int32_t)(length)+10)*(int32_t)(maxCharSize)) + +/** + * Returns the minimum byte length (per codepoint) for characters in this codepage. + * This is usually either 1 or 2. + * @param converter the Unicode converter + * @return the minimum number of bytes per codepoint allowed by this particular converter + * @see ucnv_getMaxCharSize + * @stable ICU 2.0 + */ +U_CAPI int8_t U_EXPORT2 +ucnv_getMinCharSize(const UConverter *converter); + +/** + * Returns the display name of the converter passed in based on the Locale + * passed in. If the locale contains no display name, the internal ASCII + * name will be filled in. + * + * @param converter the Unicode converter. + * @param displayLocale is the specific Locale we want to localized for + * @param displayName user provided buffer to be filled in + * @param displayNameCapacity size of displayName Buffer + * @param err error status code + * @return displayNameLength number of UChar needed in displayName + * @see ucnv_getName + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_getDisplayName(const UConverter *converter, + const char *displayLocale, + UChar *displayName, + int32_t displayNameCapacity, + UErrorCode *err); + +/** + * Gets the internal, canonical name of the converter (zero-terminated). + * The lifetime of the returned string will be that of the converter + * passed to this function. + * @param converter the Unicode converter + * @param err UErrorCode status + * @return the internal name of the converter + * @see ucnv_getDisplayName + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getName(const UConverter *converter, UErrorCode *err); + +/** + * Gets a codepage number associated with the converter. This is not guaranteed + * to be the one used to create the converter. Some converters do not represent + * platform registered codepages and return zero for the codepage number. + * The error code fill-in parameter indicates if the codepage number + * is available. + * Does not check if the converter is NULL or if converter's data + * table is NULL. + * + * Important: The use of CCSIDs is not recommended because it is limited + * to only two platforms in principle and only one (UCNV_IBM) in the current + * ICU converter API. + * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely. + * For more details see ucnv_openCCSID(). + * + * @param converter the Unicode converter + * @param err the error status code. + * @return If any error occurs, -1 will be returned otherwise, the codepage number + * will be returned + * @see ucnv_openCCSID + * @see ucnv_getPlatform + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_getCCSID(const UConverter *converter, + UErrorCode *err); + +/** + * Gets a codepage platform associated with the converter. Currently, + * only UCNV_IBM will be returned. + * Does not test if the converter is NULL or if converter's data + * table is NULL. + * @param converter the Unicode converter + * @param err the error status code. + * @return The codepage platform + * @stable ICU 2.0 + */ +U_CAPI UConverterPlatform U_EXPORT2 +ucnv_getPlatform(const UConverter *converter, + UErrorCode *err); + +/** + * Gets the type of the converter + * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, + * EBCDIC_STATEFUL, LATIN_1 + * @param converter a valid, opened converter + * @return the type of the converter + * @stable ICU 2.0 + */ +U_CAPI UConverterType U_EXPORT2 +ucnv_getType(const UConverter * converter); + +/** + * Gets the "starter" (lead) bytes for converters of type MBCS. + * Will fill in an U_ILLEGAL_ARGUMENT_ERROR if converter passed in + * is not MBCS. Fills in an array of type UBool, with the value of the byte + * as offset to the array. For example, if (starters[0x20] == true) at return, + * it means that the byte 0x20 is a starter byte in this converter. + * Context pointers are always owned by the caller. + * + * @param converter a valid, opened converter of type MBCS + * @param starters an array of size 256 to be filled in + * @param err error status, U_ILLEGAL_ARGUMENT_ERROR if the + * converter is not a type which can return starters. + * @see ucnv_getType + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getStarters(const UConverter* converter, + UBool starters[256], + UErrorCode* err); + + +/** + * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet(). + * @see ucnv_getUnicodeSet + * @stable ICU 2.6 + */ +typedef enum UConverterUnicodeSet { + /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */ + UCNV_ROUNDTRIP_SET, + /** Select the set of Unicode code points with roundtrip or fallback mappings. @stable ICU 4.0 */ + UCNV_ROUNDTRIP_AND_FALLBACK_SET, +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of UConverterUnicodeSet selectors. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCNV_SET_COUNT +#endif // U_HIDE_DEPRECATED_API +} UConverterUnicodeSet; + + +/** + * Returns the set of Unicode code points that can be converted by an ICU converter. + * + * Returns one of several kinds of set: + * + * 1. UCNV_ROUNDTRIP_SET + * + * The set of all Unicode code points that can be roundtrip-converted + * (converted without any data loss) with the converter (ucnv_fromUnicode()). + * This set will not include code points that have fallback mappings + * or are only the result of reverse fallback mappings. + * This set will also not include PUA code points with fallbacks, although + * ucnv_fromUnicode() will always uses those mappings despite ucnv_setFallback(). + * See UTR #22 "Character Mapping Markup Language" + * at http://www.unicode.org/reports/tr22/ + * + * This is useful for example for + * - checking that a string or document can be roundtrip-converted with a converter, + * without/before actually performing the conversion + * - testing if a converter can be used for text for typical text for a certain locale, + * by comparing its roundtrip set with the set of ExemplarCharacters from + * ICU's locale data or other sources + * + * 2. UCNV_ROUNDTRIP_AND_FALLBACK_SET + * + * The set of all Unicode code points that can be converted with the converter (ucnv_fromUnicode()) + * when fallbacks are turned on (see ucnv_setFallback()). + * This set includes all code points with roundtrips and fallbacks (but not reverse fallbacks). + * + * In the future, there may be more UConverterUnicodeSet choices to select + * sets with different properties. + * + * @param cnv The converter for which a set is requested. + * @param setFillIn A valid USet *. It will be cleared by this function before + * the converter's specific set is filled into the USet. + * @param whichSet A UConverterUnicodeSet selector; + * currently UCNV_ROUNDTRIP_SET is the only supported value. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * + * @see UConverterUnicodeSet + * @see uset_open + * @see uset_close + * @stable ICU 2.6 + */ +U_CAPI void U_EXPORT2 +ucnv_getUnicodeSet(const UConverter *cnv, + USet *setFillIn, + UConverterUnicodeSet whichSet, + UErrorCode *pErrorCode); + +/** + * Gets the current callback function used by the converter when an illegal + * or invalid codepage sequence is found. + * Context pointers are always owned by the caller. + * + * @param converter the unicode converter + * @param action fillin: returns the callback function pointer + * @param context fillin: returns the callback's private void* context + * @see ucnv_setToUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getToUCallBack (const UConverter * converter, + UConverterToUCallback *action, + const void **context); + +/** + * Gets the current callback function used by the converter when illegal + * or invalid Unicode sequence is found. + * Context pointers are always owned by the caller. + * + * @param converter the unicode converter + * @param action fillin: returns the callback function pointer + * @param context fillin: returns the callback's private void* context + * @see ucnv_setFromUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getFromUCallBack (const UConverter * converter, + UConverterFromUCallback *action, + const void **context); + +/** + * Changes the callback function used by the converter when + * an illegal or invalid sequence is found. + * Context pointers are always owned by the caller. + * Predefined actions and contexts can be found in the ucnv_err.h header. + * + * @param converter the unicode converter + * @param newAction the new callback function + * @param newContext the new toUnicode callback context pointer. This can be NULL. + * @param oldAction fillin: returns the old callback function pointer. This can be NULL. + * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. + * @param err The error code status + * @see ucnv_getToUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setToUCallBack (UConverter * converter, + UConverterToUCallback newAction, + const void* newContext, + UConverterToUCallback *oldAction, + const void** oldContext, + UErrorCode * err); + +/** + * Changes the current callback function used by the converter when + * an illegal or invalid sequence is found. + * Context pointers are always owned by the caller. + * Predefined actions and contexts can be found in the ucnv_err.h header. + * + * @param converter the unicode converter + * @param newAction the new callback function + * @param newContext the new fromUnicode callback context pointer. This can be NULL. + * @param oldAction fillin: returns the old callback function pointer. This can be NULL. + * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. + * @param err The error code status + * @see ucnv_getFromUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setFromUCallBack (UConverter * converter, + UConverterFromUCallback newAction, + const void *newContext, + UConverterFromUCallback *oldAction, + const void **oldContext, + UErrorCode * err); + +/** + * Converts an array of unicode characters to an array of codepage + * characters. This function is optimized for converting a continuous + * stream of data in buffer-sized chunks, where the entire source and + * target does not fit in available buffers. + * + * The source pointer is an in/out parameter. It starts out pointing where the + * conversion is to begin, and ends up pointing after the last UChar consumed. + * + * Target similarly starts out pointer at the first available byte in the output + * buffer, and ends up pointing after the last byte written to the output. + * + * The converter always attempts to consume the entire source buffer, unless + * (1.) the target buffer is full, or (2.) a failing error is returned from the + * current callback function. When a successful error status has been + * returned, it means that all of the source buffer has been + * consumed. At that point, the caller should reset the source and + * sourceLimit pointers to point to the next chunk. + * + * At the end of the stream (flush==true), the input is completely consumed + * when *source==sourceLimit and no error code is set. + * The converter object is then automatically reset by this function. + * (This means that a converter need not be reset explicitly between data + * streams if it finishes the previous stream without errors.) + * + * This is a stateful conversion. Additionally, even when all source data has + * been consumed, some data may be in the converters' internal state. + * Call this function repeatedly, updating the target pointers with + * the next empty chunk of target in case of a + * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers + * with the next chunk of source when a successful error status is + * returned, until there are no more chunks of source data. + * @param converter the Unicode converter + * @param target I/O parameter. Input : Points to the beginning of the buffer to copy + * codepage characters to. Output : points to after the last codepage character copied + * to target. + * @param targetLimit the pointer just after last of the target buffer + * @param source I/O parameter, pointer to pointer to the source Unicode character buffer. + * @param sourceLimit the pointer just after the last of the source buffer + * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number + * of allocated cells as target. Will fill in offsets from target to source pointer + * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] + * For output data carried across calls, and other data without a specific source character + * (such as from escape sequences or callbacks) -1 will be placed for offsets. + * @param flush set to true if the current source buffer is the last available + * chunk of the source, false otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to true until + * the source buffer is consumed. + * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the + * converter is NULL. + * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is + * still data to be written to the target. + * @see ucnv_fromUChars + * @see ucnv_convert + * @see ucnv_getMinCharSize + * @see ucnv_setToUCallBack + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_fromUnicode (UConverter * converter, + char **target, + const char *targetLimit, + const UChar ** source, + const UChar * sourceLimit, + int32_t* offsets, + UBool flush, + UErrorCode * err); + +/** + * Converts a buffer of codepage bytes into an array of unicode UChars + * characters. This function is optimized for converting a continuous + * stream of data in buffer-sized chunks, where the entire source and + * target does not fit in available buffers. + * + * The source pointer is an in/out parameter. It starts out pointing where the + * conversion is to begin, and ends up pointing after the last byte of source consumed. + * + * Target similarly starts out pointer at the first available UChar in the output + * buffer, and ends up pointing after the last UChar written to the output. + * It does NOT necessarily keep UChar sequences together. + * + * The converter always attempts to consume the entire source buffer, unless + * (1.) the target buffer is full, or (2.) a failing error is returned from the + * current callback function. When a successful error status has been + * returned, it means that all of the source buffer has been + * consumed. At that point, the caller should reset the source and + * sourceLimit pointers to point to the next chunk. + * + * At the end of the stream (flush==true), the input is completely consumed + * when *source==sourceLimit and no error code is set + * The converter object is then automatically reset by this function. + * (This means that a converter need not be reset explicitly between data + * streams if it finishes the previous stream without errors.) + * + * This is a stateful conversion. Additionally, even when all source data has + * been consumed, some data may be in the converters' internal state. + * Call this function repeatedly, updating the target pointers with + * the next empty chunk of target in case of a + * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers + * with the next chunk of source when a successful error status is + * returned, until there are no more chunks of source data. + * @param converter the Unicode converter + * @param target I/O parameter. Input : Points to the beginning of the buffer to copy + * UChars into. Output : points to after the last UChar copied. + * @param targetLimit the pointer just after the end of the target buffer + * @param source I/O parameter, pointer to pointer to the source codepage buffer. + * @param sourceLimit the pointer to the byte after the end of the source buffer + * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number + * of allocated cells as target. Will fill in offsets from target to source pointer + * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] + * For output data carried across calls, and other data without a specific source character + * (such as from escape sequences or callbacks) -1 will be placed for offsets. + * @param flush set to true if the current source buffer is the last available + * chunk of the source, false otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to true until + * the source buffer is consumed. + * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the + * converter is NULL. + * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is + * still data to be written to the target. + * @see ucnv_fromUChars + * @see ucnv_convert + * @see ucnv_getMinCharSize + * @see ucnv_setFromUCallBack + * @see ucnv_getNextUChar + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_toUnicode(UConverter *converter, + UChar **target, + const UChar *targetLimit, + const char **source, + const char *sourceLimit, + int32_t *offsets, + UBool flush, + UErrorCode *err); + +/** + * Convert the Unicode string into a codepage string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function is a more convenient but less powerful version of ucnv_fromUnicode(). + * It is only useful for whole strings, not for streaming conversion. + * + * The maximum output buffer capacity required (barring output from callbacks) will be + * UCNV_GET_MAX_BYTES_FOR_STRING(srcLength, ucnv_getMaxCharSize(cnv)). + * + * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called) + * @param src the input Unicode string + * @param srcLength the input string length, or -1 if NUL-terminated + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of chars available at dest + * @param pErrorCode normal ICU error code; + * common error codes that may be set by this function include + * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, + * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @see ucnv_fromUnicode + * @see ucnv_convert + * @see UCNV_GET_MAX_BYTES_FOR_STRING + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_fromUChars(UConverter *cnv, + char *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert the codepage string into a Unicode string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function is a more convenient but less powerful version of ucnv_toUnicode(). + * It is only useful for whole strings, not for streaming conversion. + * + * The maximum output buffer capacity required (barring output from callbacks) will be + * 2*srcLength (each char may be converted into a surrogate pair). + * + * @param cnv the converter object to be used (ucnv_resetToUnicode() will be called) + * @param src the input codepage string + * @param srcLength the input string length, or -1 if NUL-terminated + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of UChars available at dest + * @param pErrorCode normal ICU error code; + * common error codes that may be set by this function include + * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, + * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @see ucnv_toUnicode + * @see ucnv_convert + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_toUChars(UConverter *cnv, + UChar *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a codepage buffer into Unicode one character at a time. + * The input is completely consumed when the U_INDEX_OUTOFBOUNDS_ERROR is set. + * + * Advantage compared to ucnv_toUnicode() or ucnv_toUChars(): + * - Faster for small amounts of data, for most converters, e.g., + * US-ASCII, ISO-8859-1, UTF-8/16/32, and most "normal" charsets. + * (For complex converters, e.g., SCSU, UTF-7 and ISO 2022 variants, + * it uses ucnv_toUnicode() internally.) + * - Convenient. + * + * Limitations compared to ucnv_toUnicode(): + * - Always assumes flush=true. + * This makes ucnv_getNextUChar() unsuitable for "streaming" conversion, + * that is, for where the input is supplied in multiple buffers, + * because ucnv_getNextUChar() will assume the end of the input at the end + * of the first buffer. + * - Does not provide offset output. + * + * It is possible to "mix" ucnv_getNextUChar() and ucnv_toUnicode() because + * ucnv_getNextUChar() uses the current state of the converter + * (unlike ucnv_toUChars() which always resets first). + * However, if ucnv_getNextUChar() is called after ucnv_toUnicode() + * stopped in the middle of a character sequence (with flush=false), + * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode() + * internally until the next character boundary. + * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to + * start at a character boundary.) + * + * Instead of using ucnv_getNextUChar(), it is recommended + * to convert using ucnv_toUnicode() or ucnv_toUChars() + * and then iterate over the text using U16_NEXT() or a UCharIterator (uiter.h) + * or a C++ CharacterIterator or similar. + * This allows streaming conversion and offset output, for example. + * + *

    Handling of surrogate pairs and supplementary-plane code points:
    + * There are two different kinds of codepages that provide mappings for surrogate characters: + *

      + *
    • Codepages like UTF-8, UTF-32, and GB 18030 provide direct representations for Unicode + * code points U+10000-U+10ffff as well as for single surrogates U+d800-U+dfff. + * Each valid sequence will result in exactly one returned code point. + * If a sequence results in a single surrogate, then that will be returned + * by itself, even if a neighboring sequence encodes the matching surrogate.
    • + *
    • Codepages like SCSU and LMBCS (and UTF-16) provide direct representations only for BMP code points + * including surrogates. Code points in supplementary planes are represented with + * two sequences, each encoding a surrogate. + * For these codepages, matching pairs of surrogates will be combined into single + * code points for returning from this function. + * (Note that SCSU is actually a mix of these codepage types.)
    • + *

    + * + * @param converter an open UConverter + * @param source the address of a pointer to the codepage buffer, will be + * updated to point after the bytes consumed in the conversion call. + * @param sourceLimit points to the end of the input buffer + * @param err fills in error status (see ucnv_toUnicode) + * U_INDEX_OUTOFBOUNDS_ERROR will be set if the input + * is empty or does not convert to any output (e.g.: pure state-change + * codes SI/SO, escape sequences for ISO 2022, + * or if the callback did not output anything, ...). + * This function will not set a U_BUFFER_OVERFLOW_ERROR because + * the "buffer" is the return code. However, there might be subsequent output + * stored in the converter object + * that will be returned in following calls to this function. + * @return a UChar32 resulting from the partial conversion of source + * @see ucnv_toUnicode + * @see ucnv_toUChars + * @see ucnv_convert + * @stable ICU 2.0 + */ +U_CAPI UChar32 U_EXPORT2 +ucnv_getNextUChar(UConverter * converter, + const char **source, + const char * sourceLimit, + UErrorCode * err); + +/** + * Convert from one external charset to another using two existing UConverters. + * Internally, two conversions - ucnv_toUnicode() and ucnv_fromUnicode() - + * are used, "pivoting" through 16-bit Unicode. + * + * Important: For streaming conversion (multiple function calls for successive + * parts of a text stream), the caller must provide a pivot buffer explicitly, + * and must preserve the pivot buffer and associated pointers from one + * call to another. (The buffer may be moved if its contents and the relative + * pointer positions are preserved.) + * + * There is a similar function, ucnv_convert(), + * which has the following limitations: + * - it takes charset names, not converter objects, so that + * - two converters are opened for each call + * - only single-string conversion is possible, not streaming operation + * - it does not provide enough information to find out, + * in case of failure, whether the toUnicode or + * the fromUnicode conversion failed + * + * By contrast, ucnv_convertEx() + * - takes UConverter parameters instead of charset names + * - fully exposes the pivot buffer for streaming conversion and complete error handling + * + * ucnv_convertEx() also provides further convenience: + * - an option to reset the converters at the beginning + * (if reset==true, see parameters; + * also sets *pivotTarget=*pivotSource=pivotStart) + * - allow NUL-terminated input + * (only a single NUL byte, will not work for charsets with multi-byte NULs) + * (if sourceLimit==NULL, see parameters) + * - terminate with a NUL on output + * (only a single NUL byte, not useful for charsets with multi-byte NULs), + * or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills + * the target buffer + * - the pivot buffer can be provided internally; + * possible only for whole-string conversion, not streaming conversion; + * in this case, the caller will not be able to get details about where an + * error occurred + * (if pivotStart==NULL, see below) + * + * The function returns when one of the following is true: + * - the entire source text has been converted successfully to the target buffer + * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR) + * - a conversion error occurred + * (other U_FAILURE(), see description of pErrorCode) + * + * Limitation compared to the direct use of + * ucnv_fromUnicode() and ucnv_toUnicode(): + * ucnv_convertEx() does not provide offset information. + * + * Limitation compared to ucnv_fromUChars() and ucnv_toUChars(): + * ucnv_convertEx() does not support preflighting directly. + * + * Sample code for converting a single string from + * one external charset to UTF-8, ignoring the location of errors: + * + * \code + * int32_t + * myToUTF8(UConverter *cnv, + * const char *s, int32_t length, + * char *u8, int32_t capacity, + * UErrorCode *pErrorCode) { + * UConverter *utf8Cnv; + * char *target; + * + * if(U_FAILURE(*pErrorCode)) { + * return 0; + * } + * + * utf8Cnv=myGetCachedUTF8Converter(pErrorCode); + * if(U_FAILURE(*pErrorCode)) { + * return 0; + * } + * + * if(length<0) { + * length=strlen(s); + * } + * target=u8; + * ucnv_convertEx(utf8Cnv, cnv, + * &target, u8+capacity, + * &s, s+length, + * NULL, NULL, NULL, NULL, + * true, true, + * pErrorCode); + * + * myReleaseCachedUTF8Converter(utf8Cnv); + * + * // return the output string length, but without preflighting + * return (int32_t)(target-u8); + * } + * \endcode + * + * @param targetCnv Output converter, used to convert from the UTF-16 pivot + * to the target using ucnv_fromUnicode(). + * @param sourceCnv Input converter, used to convert from the source to + * the UTF-16 pivot using ucnv_toUnicode(). + * @param target I/O parameter, same as for ucnv_fromUChars(). + * Input: *target points to the beginning of the target buffer. + * Output: *target points to the first unit after the last char written. + * @param targetLimit Pointer to the first unit after the target buffer. + * @param source I/O parameter, same as for ucnv_toUChars(). + * Input: *source points to the beginning of the source buffer. + * Output: *source points to the first unit after the last char read. + * @param sourceLimit Pointer to the first unit after the source buffer. + * @param pivotStart Pointer to the UTF-16 pivot buffer. If pivotStart==NULL, + * then an internal buffer is used and the other pivot + * arguments are ignored and can be NULL as well. + * @param pivotSource I/O parameter, same as source in ucnv_fromUChars() for + * conversion from the pivot buffer to the target buffer. + * @param pivotTarget I/O parameter, same as target in ucnv_toUChars() for + * conversion from the source buffer to the pivot buffer. + * It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit + * and pivotStart[0..ucnv_countAvailable()]) + * @return a pointer a string (library owned), or NULL if the index is out of bounds. + * @see ucnv_countAvailable + * @stable ICU 2.0 + */ +U_CAPI const char* U_EXPORT2 +ucnv_getAvailableName(int32_t n); + +/** + * Returns a UEnumeration to enumerate all of the canonical converter + * names, as per the alias file, regardless of the ability to open each + * converter. + * + * @return A UEnumeration object for getting all the recognized canonical + * converter names. + * @see ucnv_getAvailableName + * @see uenum_close + * @see uenum_next + * @stable ICU 2.4 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnv_openAllNames(UErrorCode *pErrorCode); + +/** + * Gives the number of aliases for a given converter or alias name. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * This method only enumerates the listed entries in the alias file. + * @param alias alias name + * @param pErrorCode error status + * @return number of names on alias list for given alias + * @stable ICU 2.0 + */ +U_CAPI uint16_t U_EXPORT2 +ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); + +/** + * Gives the name of the alias at given index of alias list. + * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * @param alias alias name + * @param n index in alias list + * @param pErrorCode result of operation + * @return returns the name of the alias at given index + * @see ucnv_countAliases + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); + +/** + * Fill-up the list of alias names for the given alias. + * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * @param alias alias name + * @param aliases fill-in list, aliases is a pointer to an array of + * ucnv_countAliases() string-pointers + * (const char *) that will be filled in. + * The strings themselves are owned by the library. + * @param pErrorCode result of operation + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode); + +/** + * Return a new UEnumeration object for enumerating all the + * alias names for a given converter that are recognized by a standard. + * This method only enumerates the listed entries in the alias file. + * The convrtrs.txt file can be modified to change the results of + * this function. + * The first result in this list is the same result given by + * ucnv_getStandardName, which is the default alias for + * the specified standard name. The returned object must be closed with + * uenum_close when you are done with the object. + * + * @param convName original converter name + * @param standard name of the standard governing the names; MIME and IANA + * are such standards + * @param pErrorCode The error code + * @return A UEnumeration object for getting all aliases that are recognized + * by a standard. If any of the parameters are invalid, NULL + * is returned. + * @see ucnv_getStandardName + * @see uenum_close + * @see uenum_next + * @stable ICU 2.2 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnv_openStandardNames(const char *convName, + const char *standard, + UErrorCode *pErrorCode); + +/** + * Gives the number of standards associated to converter names. + * @return number of standards + * @stable ICU 2.0 + */ +U_CAPI uint16_t U_EXPORT2 +ucnv_countStandards(void); + +/** + * Gives the name of the standard at given index of standard list. + * @param n index in standard list + * @param pErrorCode result of operation + * @return returns the name of the standard at given index. Owned by the library. + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode); + +/** + * Returns a standard name for a given converter name. + *

    + * Example alias table:
    + * conv alias1 { STANDARD1 } alias2 { STANDARD1* } + *

    + * Result of ucnv_getStandardName("conv", "STANDARD1") from example + * alias table:
    + * "alias2" + * + * @param name original converter name + * @param standard name of the standard governing the names; MIME and IANA + * are such standards + * @param pErrorCode result of operation + * @return returns the standard converter name; + * if a standard converter name cannot be determined, + * then NULL is returned. Owned by the library. + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode); + +/** + * This function will return the internal canonical converter name of the + * tagged alias. This is the opposite of ucnv_openStandardNames, which + * returns the tagged alias given the canonical name. + *

    + * Example alias table:
    + * conv alias1 { STANDARD1 } alias2 { STANDARD1* } + *

    + * Result of ucnv_getStandardName("alias1", "STANDARD1") from example + * alias table:
    + * "conv" + * + * @return returns the canonical converter name; + * if a standard or alias name cannot be determined, + * then NULL is returned. The returned string is + * owned by the library. + * @see ucnv_getStandardName + * @stable ICU 2.4 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode); + +/** + * Returns the current default converter name. If you want to open + * a default converter, you do not need to use this function. + * It is faster if you pass a NULL argument to ucnv_open the + * default converter. + * + * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function + * always returns "UTF-8". + * + * @return returns the current default converter name. + * Storage owned by the library + * @see ucnv_setDefaultName + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +ucnv_getDefaultName(void); + +#ifndef U_HIDE_SYSTEM_API +/** + * This function is not thread safe. DO NOT call this function when ANY ICU + * function is being used from more than one thread! This function sets the + * current default converter name. If this function needs to be called, it + * should be called during application initialization. Most of the time, the + * results from ucnv_getDefaultName() or ucnv_open with a NULL string argument + * is sufficient for your application. + * + * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function + * does nothing. + * + * @param name the converter name to be the default (must be known by ICU). + * @see ucnv_getDefaultName + * @system + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_setDefaultName(const char *name); +#endif /* U_HIDE_SYSTEM_API */ + +/** + * Fixes the backslash character mismapping. For example, in SJIS, the backslash + * character in the ASCII portion is also used to represent the yen currency sign. + * When mapping from Unicode character 0x005C, it's unclear whether to map the + * character back to yen or backslash in SJIS. This function will take the input + * buffer and replace all the yen sign characters with backslash. This is necessary + * when the user tries to open a file with the input buffer on Windows. + * This function will test the converter to see whether such mapping is + * required. You can sometimes avoid using this function by using the correct version + * of Shift-JIS. + * + * @param cnv The converter representing the target codepage. + * @param source the input buffer to be fixed + * @param sourceLen the length of the input buffer + * @see ucnv_isAmbiguous + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen); + +/** + * Determines if the converter contains ambiguous mappings of the same + * character or not. + * @param cnv the converter to be tested + * @return true if the converter contains ambiguous mapping of the same + * character, false otherwise. + * @stable ICU 2.0 + */ +U_CAPI UBool U_EXPORT2 +ucnv_isAmbiguous(const UConverter *cnv); + +/** + * Sets the converter to use fallback mappings or not. + * Regardless of this flag, the converter will always use + * fallbacks from Unicode Private Use code points, as well as + * reverse fallbacks (to Unicode). + * For details see ".ucm File Format" + * in the Conversion Data chapter of the ICU User Guide: + * https://unicode-org.github.io/icu/userguide/conversion/data.html#ucm-file-format + * + * @param cnv The converter to set the fallback mapping usage on. + * @param usesFallback true if the user wants the converter to take advantage of the fallback + * mapping, false otherwise. + * @stable ICU 2.0 + * @see ucnv_usesFallback + */ +U_CAPI void U_EXPORT2 +ucnv_setFallback(UConverter *cnv, UBool usesFallback); + +/** + * Determines if the converter uses fallback mappings or not. + * This flag has restrictions, see ucnv_setFallback(). + * + * @param cnv The converter to be tested + * @return true if the converter uses fallback, false otherwise. + * @stable ICU 2.0 + * @see ucnv_setFallback + */ +U_CAPI UBool U_EXPORT2 +ucnv_usesFallback(const UConverter *cnv); + +/** + * Detects Unicode signature byte sequences at the start of the byte stream + * and returns the charset name of the indicated Unicode charset. + * NULL is returned when no Unicode signature is recognized. + * The number of bytes in the signature is output as well. + * + * The caller can ucnv_open() a converter using the charset name. + * The first code unit (UChar) from the start of the stream will be U+FEFF + * (the Unicode BOM/signature character) and can usually be ignored. + * + * For most Unicode charsets it is also possible to ignore the indicated + * number of initial stream bytes and start converting after them. + * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which + * this will not work. Therefore, it is best to ignore the first output UChar + * instead of the input signature bytes. + *

    + * Usage: + * \snippet samples/ucnv/convsamp.cpp ucnv_detectUnicodeSignature + * + * @param source The source string in which the signature should be detected. + * @param sourceLength Length of the input string, or -1 if terminated with a NUL byte. + * @param signatureLength A pointer to int32_t to receive the number of bytes that make up the signature + * of the detected UTF. 0 if not detected. + * Can be a NULL pointer. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The name of the encoding detected. NULL if encoding is not detected. + * @stable ICU 2.4 + */ +U_CAPI const char* U_EXPORT2 +ucnv_detectUnicodeSignature(const char* source, + int32_t sourceLength, + int32_t *signatureLength, + UErrorCode *pErrorCode); + +/** + * Returns the number of UChars held in the converter's internal state + * because more input is needed for completing the conversion. This function is + * useful for mapping semantics of ICU's converter interface to those of iconv, + * and this information is not needed for normal conversion. + * @param cnv The converter in which the input is held + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The number of UChars in the state. -1 if an error is encountered. + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); + +/** + * Returns the number of chars held in the converter's internal state + * because more input is needed for completing the conversion. This function is + * useful for mapping semantics of ICU's converter interface to those of iconv, + * and this information is not needed for normal conversion. + * @param cnv The converter in which the input is held as internal state + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The number of chars in the state. -1 if an error is encountered. + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); + +/** + * Returns whether or not the charset of the converter has a fixed number of bytes + * per charset character. + * An example of this are converters that are of the type UCNV_SBCS or UCNV_DBCS. + * Another example is UTF-32 which is always 4 bytes per character. + * A Unicode code point may be represented by more than one UTF-8 or UTF-16 code unit + * but a UTF-32 converter encodes each code point with 4 bytes. + * Note: This method is not intended to be used to determine whether the charset has a + * fixed ratio of bytes to Unicode codes units for any particular Unicode encoding form. + * false is returned with the UErrorCode if error occurs or cnv is NULL. + * @param cnv The converter to be tested + * @param status ICU error code in/out parameter + * @return true if the converter is fixed-width + * @stable ICU 4.8 + */ +U_CAPI UBool U_EXPORT2 +ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status); + +#endif + +#endif +/*_UCNV*/ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_cb.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_cb.h index 551d4a5d6..b4ef99208 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_cb.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_cb.h @@ -1,164 +1,164 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2000-2004, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * ucnv_cb.h: -// * External APIs for the ICU's codeset conversion library -// * Helena Shih -// * -// * Modification History: -// * -// * Date Name Description -// */ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2000-2004, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * ucnv_cb.h: + * External APIs for the ICU's codeset conversion library + * Helena Shih + * + * Modification History: + * + * Date Name Description + */ -// /** -// * \file -// * \brief C UConverter functions to aid the writers of callbacks -// * -// *

    Callback API for UConverter

    -// * -// * These functions are provided here for the convenience of the callback -// * writer. If you are just looking for callback functions to use, please -// * see ucnv_err.h. DO NOT call these functions directly when you are -// * working with converters, unless your code has been called as a callback -// * via ucnv_setFromUCallback or ucnv_setToUCallback !! -// * -// * A note about error codes and overflow. Unlike other ICU functions, -// * these functions do not expect the error status to be U_ZERO_ERROR. -// * Callbacks must be much more careful about their error codes. -// * The error codes used here are in/out parameters, which should be passed -// * back in the callback's error parameter. -// * -// * For example, if you call ucnv_cbfromUWriteBytes to write data out -// * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if -// * the data did not fit in the target. But this isn't a failing error, -// * in fact, ucnv_cbfromUWriteBytes may be called AGAIN with the error -// * status still U_BUFFER_OVERFLOW_ERROR to attempt to write further bytes, -// * which will also go into the internal overflow buffers. -// * -// * Concerning offsets, the 'offset' parameters here are relative to the start -// * of SOURCE. For example, Suppose the string "ABCD" was being converted -// * from Unicode into a codepage which doesn't have a mapping for 'B'. -// * 'A' will be written out correctly, but -// * The FromU Callback will be called on an unassigned character for 'B'. -// * At this point, this is the state of the world: -// * Target: A [..] [points after A] -// * Source: A B [C] D [points to C - B has been consumed] -// * 0 1 2 3 -// * codePoint = "B" [the unassigned codepoint] -// * -// * Now, suppose a callback wants to write the substitution character '?' to -// * the target. It calls ucnv_cbFromUWriteBytes() to write the ?. -// * It should pass ZERO as the offset, because the offset as far as the -// * callback is concerned is relative to the SOURCE pointer [which points -// * before 'C'.] If the callback goes into the args and consumes 'C' also, -// * it would call FromUWriteBytes with an offset of 1 (and advance the source -// * pointer). -// * -// */ +/** + * \file + * \brief C API: UConverter functions to aid the writers of callbacks + * + *

    Callback API for UConverter

    + * + * These functions are provided here for the convenience of the callback + * writer. If you are just looking for callback functions to use, please + * see ucnv_err.h. DO NOT call these functions directly when you are + * working with converters, unless your code has been called as a callback + * via ucnv_setFromUCallback or ucnv_setToUCallback !! + * + * A note about error codes and overflow. Unlike other ICU functions, + * these functions do not expect the error status to be U_ZERO_ERROR. + * Callbacks must be much more careful about their error codes. + * The error codes used here are in/out parameters, which should be passed + * back in the callback's error parameter. + * + * For example, if you call ucnv_cbfromUWriteBytes to write data out + * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if + * the data did not fit in the target. But this isn't a failing error, + * in fact, ucnv_cbfromUWriteBytes may be called AGAIN with the error + * status still U_BUFFER_OVERFLOW_ERROR to attempt to write further bytes, + * which will also go into the internal overflow buffers. + * + * Concerning offsets, the 'offset' parameters here are relative to the start + * of SOURCE. For example, Suppose the string "ABCD" was being converted + * from Unicode into a codepage which doesn't have a mapping for 'B'. + * 'A' will be written out correctly, but + * The FromU Callback will be called on an unassigned character for 'B'. + * At this point, this is the state of the world: + * Target: A [..] [points after A] + * Source: A B [C] D [points to C - B has been consumed] + * 0 1 2 3 + * codePoint = "B" [the unassigned codepoint] + * + * Now, suppose a callback wants to write the substitution character '?' to + * the target. It calls ucnv_cbFromUWriteBytes() to write the ?. + * It should pass ZERO as the offset, because the offset as far as the + * callback is concerned is relative to the SOURCE pointer [which points + * before 'C'.] If the callback goes into the args and consumes 'C' also, + * it would call FromUWriteBytes with an offset of 1 (and advance the source + * pointer). + * + */ -// #ifndef UCNV_CB_H -// #define UCNV_CB_H +#ifndef UCNV_CB_H +#define UCNV_CB_H -// #include "unicode/utypes.h" +#include "unicode/utypes.h" -// #if !UCONFIG_NO_CONVERSION +#if !UCONFIG_NO_CONVERSION -// #include "unicode/ucnv.h" -// #include "unicode/ucnv_err.h" +#include "unicode/ucnv.h" +#include "unicode/ucnv_err.h" -// /** -// * ONLY used by FromU callback functions. -// * Writes out the specified byte output bytes to the target byte buffer or to converter internal buffers. -// * -// * @param args callback fromUnicode arguments -// * @param source source bytes to write -// * @param length length of bytes to write -// * @param offsetIndex the relative offset index from callback. -// * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must -// * be returned to the user, because it means that not all data could be written into the target buffer, and some is -// * in the converter error buffer. -// * @see ucnv_cbFromUWriteSub -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 -// ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, -// const char* source, -// int32_t length, -// int32_t offsetIndex, -// UErrorCode * err); +/** + * ONLY used by FromU callback functions. + * Writes out the specified byte output bytes to the target byte buffer or to converter internal buffers. + * + * @param args callback fromUnicode arguments + * @param source source bytes to write + * @param length length of bytes to write + * @param offsetIndex the relative offset index from callback. + * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must + * be returned to the user, because it means that not all data could be written into the target buffer, and some is + * in the converter error buffer. + * @see ucnv_cbFromUWriteSub + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, + const char* source, + int32_t length, + int32_t offsetIndex, + UErrorCode * err); -// /** -// * ONLY used by FromU callback functions. -// * This function will write out the correct substitution character sequence -// * to the target. -// * -// * @param args callback fromUnicode arguments -// * @param offsetIndex the relative offset index from the current source pointer to be used -// * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must -// * be returned to the user, because it means that not all data could be written into the target buffer, and some is -// * in the converter error buffer. -// * @see ucnv_cbFromUWriteBytes -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 -// ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, -// int32_t offsetIndex, -// UErrorCode * err); +/** + * ONLY used by FromU callback functions. + * This function will write out the correct substitution character sequence + * to the target. + * + * @param args callback fromUnicode arguments + * @param offsetIndex the relative offset index from the current source pointer to be used + * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must + * be returned to the user, because it means that not all data could be written into the target buffer, and some is + * in the converter error buffer. + * @see ucnv_cbFromUWriteBytes + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 +ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, + int32_t offsetIndex, + UErrorCode * err); -// /** -// * ONLY used by fromU callback functions. -// * This function will write out the error character(s) to the target UChar buffer. -// * -// * @param args callback fromUnicode arguments -// * @param source pointer to pointer to first UChar to write [on exit: 1 after last UChar processed] -// * @param sourceLimit pointer after last UChar to write -// * @param offsetIndex the relative offset index from callback which will be set -// * @param err error status U_BUFFER_OVERFLOW -// * @see ucnv_cbToUWriteSub -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, -// const UChar** source, -// const UChar* sourceLimit, -// int32_t offsetIndex, -// UErrorCode * err); +/** + * ONLY used by fromU callback functions. + * This function will write out the error character(s) to the target UChar buffer. + * + * @param args callback fromUnicode arguments + * @param source pointer to pointer to first UChar to write [on exit: 1 after last UChar processed] + * @param sourceLimit pointer after last UChar to write + * @param offsetIndex the relative offset index from callback which will be set + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteSub + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, + const UChar** source, + const UChar* sourceLimit, + int32_t offsetIndex, + UErrorCode * err); -// /** -// * ONLY used by ToU callback functions. -// * This function will write out the specified characters to the target -// * UChar buffer. -// * -// * @param args callback toUnicode arguments -// * @param source source string to write -// * @param length the length of source string -// * @param offsetIndex the relative offset index which will be written. -// * @param err error status U_BUFFER_OVERFLOW -// * @see ucnv_cbToUWriteSub -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, -// const UChar* source, -// int32_t length, -// int32_t offsetIndex, -// UErrorCode * err); +/** + * ONLY used by ToU callback functions. + * This function will write out the specified characters to the target + * UChar buffer. + * + * @param args callback toUnicode arguments + * @param source source string to write + * @param length the length of source string + * @param offsetIndex the relative offset index which will be written. + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteSub + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, + const UChar* source, + int32_t length, + int32_t offsetIndex, + UErrorCode * err); -// /** -// * ONLY used by ToU callback functions. -// * This function will write out the Unicode substitution character (U+FFFD). -// * -// * @param args callback fromUnicode arguments -// * @param offsetIndex the relative offset index from callback. -// * @param err error status U_BUFFER_OVERFLOW -// * @see ucnv_cbToUWriteUChars -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, -// int32_t offsetIndex, -// UErrorCode * err); -// #endif +/** + * ONLY used by ToU callback functions. + * This function will write out the Unicode substitution character (U+FFFD). + * + * @param args callback fromUnicode arguments + * @param offsetIndex the relative offset index from callback. + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteUChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, + int32_t offsetIndex, + UErrorCode * err); +#endif -// #endif +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_err.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_err.h index b07361466..c743e5614 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_err.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnv_err.h @@ -1,465 +1,465 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 1999-2009, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * -// * -// * ucnv_err.h: -// */ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2009, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * + * + * ucnv_err.h: + */ -// /** -// * \file -// * \brief C UConverter predefined error callbacks -// * -// *

    Error Behaviour Functions

    -// * Defines some error behaviour functions called by ucnv_{from,to}Unicode -// * These are provided as part of ICU and many are stable, but they -// * can also be considered only as an example of what can be done with -// * callbacks. You may of course write your own. -// * -// * If you want to write your own, you may also find the functions from -// * ucnv_cb.h useful when writing your own callbacks. -// * -// * These functions, although public, should NEVER be called directly. -// * They should be used as parameters to the ucnv_setFromUCallback -// * and ucnv_setToUCallback functions, to set the behaviour of a converter -// * when it encounters ILLEGAL/UNMAPPED/INVALID sequences. -// * -// * usage example: 'STOP' doesn't need any context, but newContext -// * could be set to something other than 'NULL' if needed. The available -// * contexts in this header can modify the default behavior of the callback. -// * -// * \code -// * UErrorCode err = U_ZERO_ERROR; -// * UConverter *myConverter = ucnv_open("ibm-949", &err); -// * const void *oldContext; -// * UConverterFromUCallback oldAction; -// * -// * -// * if (U_SUCCESS(err)) -// * { -// * ucnv_setFromUCallBack(myConverter, -// * UCNV_FROM_U_CALLBACK_STOP, -// * NULL, -// * &oldAction, -// * &oldContext, -// * &status); -// * } -// * \endcode -// * -// * The code above tells "myConverter" to stop when it encounters an -// * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from -// * Unicode -> Codepage. The behavior from Codepage to Unicode is not changed, -// * and ucnv_setToUCallBack would need to be called in order to change -// * that behavior too. -// * -// * Here is an example with a context: -// * -// * \code -// * UErrorCode err = U_ZERO_ERROR; -// * UConverter *myConverter = ucnv_open("ibm-949", &err); -// * const void *oldContext; -// * UConverterFromUCallback oldAction; -// * -// * -// * if (U_SUCCESS(err)) -// * { -// * ucnv_setToUCallBack(myConverter, -// * UCNV_TO_U_CALLBACK_SUBSTITUTE, -// * UCNV_SUB_STOP_ON_ILLEGAL, -// * &oldAction, -// * &oldContext, -// * &status); -// * } -// * \endcode -// * -// * The code above tells "myConverter" to stop when it encounters an -// * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from -// * Codepage -> Unicode. Any unmapped and legal characters will be -// * substituted to be the default substitution character. -// */ +/** + * \file + * \brief C API: UConverter predefined error callbacks + * + *

    Error Behaviour Functions

    + * Defines some error behaviour functions called by ucnv_{from,to}Unicode + * These are provided as part of ICU and many are stable, but they + * can also be considered only as an example of what can be done with + * callbacks. You may of course write your own. + * + * If you want to write your own, you may also find the functions from + * ucnv_cb.h useful when writing your own callbacks. + * + * These functions, although public, should NEVER be called directly. + * They should be used as parameters to the ucnv_setFromUCallback + * and ucnv_setToUCallback functions, to set the behaviour of a converter + * when it encounters ILLEGAL/UNMAPPED/INVALID sequences. + * + * usage example: 'STOP' doesn't need any context, but newContext + * could be set to something other than 'NULL' if needed. The available + * contexts in this header can modify the default behavior of the callback. + * + * \code + * UErrorCode err = U_ZERO_ERROR; + * UConverter *myConverter = ucnv_open("ibm-949", &err); + * const void *oldContext; + * UConverterFromUCallback oldAction; + * + * + * if (U_SUCCESS(err)) + * { + * ucnv_setFromUCallBack(myConverter, + * UCNV_FROM_U_CALLBACK_STOP, + * NULL, + * &oldAction, + * &oldContext, + * &status); + * } + * \endcode + * + * The code above tells "myConverter" to stop when it encounters an + * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from + * Unicode -> Codepage. The behavior from Codepage to Unicode is not changed, + * and ucnv_setToUCallBack would need to be called in order to change + * that behavior too. + * + * Here is an example with a context: + * + * \code + * UErrorCode err = U_ZERO_ERROR; + * UConverter *myConverter = ucnv_open("ibm-949", &err); + * const void *oldContext; + * UConverterFromUCallback oldAction; + * + * + * if (U_SUCCESS(err)) + * { + * ucnv_setToUCallBack(myConverter, + * UCNV_TO_U_CALLBACK_SUBSTITUTE, + * UCNV_SUB_STOP_ON_ILLEGAL, + * &oldAction, + * &oldContext, + * &status); + * } + * \endcode + * + * The code above tells "myConverter" to stop when it encounters an + * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from + * Codepage -> Unicode. Any unmapped and legal characters will be + * substituted to be the default substitution character. + */ -// #ifndef UCNV_ERR_H -// #define UCNV_ERR_H +#ifndef UCNV_ERR_H +#define UCNV_ERR_H -// #include "unicode/utypes.h" +#include "unicode/utypes.h" -// #if !UCONFIG_NO_CONVERSION +#if !UCONFIG_NO_CONVERSION -// /** Forward declaring the UConverter structure. @stable ICU 2.0 */ -// struct UConverter; +/** Forward declaring the UConverter structure. @stable ICU 2.0 */ +struct UConverter; -// /** @stable ICU 2.0 */ -// typedef struct UConverter UConverter; +/** @stable ICU 2.0 */ +typedef struct UConverter UConverter; -// /** -// * FROM_U, TO_U context options for sub callback -// * @stable ICU 2.0 -// */ -// #define UCNV_SUB_STOP_ON_ILLEGAL "i" +/** + * FROM_U, TO_U context options for sub callback + * @stable ICU 2.0 + */ +#define UCNV_SUB_STOP_ON_ILLEGAL "i" -// /** -// * FROM_U, TO_U context options for skip callback -// * @stable ICU 2.0 -// */ -// #define UCNV_SKIP_STOP_ON_ILLEGAL "i" +/** + * FROM_U, TO_U context options for skip callback + * @stable ICU 2.0 + */ +#define UCNV_SKIP_STOP_ON_ILLEGAL "i" -// /** -// * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) -// * @stable ICU 2.0 -// */ -// #define UCNV_ESCAPE_ICU NULL -// /** -// * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX) -// * @stable ICU 2.0 -// */ -// #define UCNV_ESCAPE_JAVA "J" -// /** -// * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX) -// * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX) -// * @stable ICU 2.0 -// */ -// #define UCNV_ESCAPE_C "C" -// /** -// * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly -// * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly -// * @stable ICU 2.0 -// */ -// #define UCNV_ESCAPE_XML_DEC "D" -// /** -// * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly -// * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly -// * @stable ICU 2.0 -// */ -// #define UCNV_ESCAPE_XML_HEX "X" -// /** -// * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX) -// * @stable ICU 2.0 -// */ -// #define UCNV_ESCAPE_UNICODE "U" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_ICU NULL +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_JAVA "J" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX) + * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_C "C" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_XML_DEC "D" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_XML_HEX "X" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_UNICODE "U" -// /** -// * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H, that is, -// * a backslash, 1..6 hex digits, and a space) -// * @stable ICU 4.0 -// */ -// #define UCNV_ESCAPE_CSS2 "S" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H, that is, + * a backslash, 1..6 hex digits, and a space) + * @stable ICU 4.0 + */ +#define UCNV_ESCAPE_CSS2 "S" -// /** -// * The process condition code to be used with the callbacks. -// * Codes which are greater than UCNV_IRREGULAR should be -// * passed on to any chained callbacks. -// * @stable ICU 2.0 -// */ -// typedef enum { -// UCNV_UNASSIGNED = 0, /**< The code point is unassigned. -// The error code U_INVALID_CHAR_FOUND will be set. */ -// UCNV_ILLEGAL = 1, /**< The code point is illegal. For example, -// \\x81\\x2E is illegal in SJIS because \\x2E -// is not a valid trail byte for the \\x81 -// lead byte. -// Also, starting with Unicode 3.0.1, non-shortest byte sequences -// in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061) -// are also illegal, not just irregular. -// The error code U_ILLEGAL_CHAR_FOUND will be set. */ -// UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in -// the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF -// are irregular UTF-8 byte sequences for single surrogate -// code points. -// The error code U_INVALID_CHAR_FOUND will be set. */ -// UCNV_RESET = 3, /**< The callback is called with this reason when a -// 'reset' has occurred. Callback should reset all -// state. */ -// UCNV_CLOSE = 4, /**< Called when the converter is closed. The -// callback should release any allocated memory.*/ -// UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the -// converter. the pointer available as the -// 'context' is an alias to the original converters' -// context pointer. If the context must be owned -// by the new converter, the callback must clone -// the data and call ucnv_setFromUCallback -// (or setToUCallback) with the correct pointer. -// @stable ICU 2.2 -// */ -// } UConverterCallbackReason; +/** + * The process condition code to be used with the callbacks. + * Codes which are greater than UCNV_IRREGULAR should be + * passed on to any chained callbacks. + * @stable ICU 2.0 + */ +typedef enum { + UCNV_UNASSIGNED = 0, /**< The code point is unassigned. + The error code U_INVALID_CHAR_FOUND will be set. */ + UCNV_ILLEGAL = 1, /**< The code point is illegal. For example, + \\x81\\x2E is illegal in SJIS because \\x2E + is not a valid trail byte for the \\x81 + lead byte. + Also, starting with Unicode 3.0.1, non-shortest byte sequences + in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061) + are also illegal, not just irregular. + The error code U_ILLEGAL_CHAR_FOUND will be set. */ + UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in + the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF + are irregular UTF-8 byte sequences for single surrogate + code points. + The error code U_INVALID_CHAR_FOUND will be set. */ + UCNV_RESET = 3, /**< The callback is called with this reason when a + 'reset' has occurred. Callback should reset all + state. */ + UCNV_CLOSE = 4, /**< Called when the converter is closed. The + callback should release any allocated memory.*/ + UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the + converter. the pointer available as the + 'context' is an alias to the original converters' + context pointer. If the context must be owned + by the new converter, the callback must clone + the data and call ucnv_setFromUCallback + (or setToUCallback) with the correct pointer. + @stable ICU 2.2 + */ +} UConverterCallbackReason; -// /** -// * The structure for the fromUnicode callback function parameter. -// * @stable ICU 2.0 -// */ -// typedef struct { -// uint16_t size; /**< The size of this struct. @stable ICU 2.0 */ -// UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ -// UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ -// const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ -// const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ -// char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ -// const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ -// int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ -// } UConverterFromUnicodeArgs; +/** + * The structure for the fromUnicode callback function parameter. + * @stable ICU 2.0 + */ +typedef struct { + uint16_t size; /**< The size of this struct. @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to true. @stable ICU 2.0 */ + UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ + const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ + const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ + char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ + const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ +} UConverterFromUnicodeArgs; -// /** -// * The structure for the toUnicode callback function parameter. -// * @stable ICU 2.0 -// */ -// typedef struct { -// uint16_t size; /**< The size of this struct @stable ICU 2.0 */ -// UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ -// UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ -// const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ -// const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ -// UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ -// const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ -// int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ -// } UConverterToUnicodeArgs; +/** + * The structure for the toUnicode callback function parameter. + * @stable ICU 2.0 + */ +typedef struct { + uint16_t size; /**< The size of this struct @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to true. @stable ICU 2.0 */ + UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ + const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ + const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ + UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ + const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ +} UConverterToUnicodeArgs; -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE, -// * returning the error code back to the caller immediately. -// * -// * @param context Pointer to the callback's private data -// * @param fromUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. -// * @param reason Defines the reason the callback was invoked -// * @param err This should always be set to a failure status prior to calling. -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( -// const void *context, -// UConverterFromUnicodeArgs *fromUArgs, -// const UChar* codeUnits, -// int32_t length, -// UChar32 codePoint, -// UConverterCallbackReason reason, -// UErrorCode * err); +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * + * @param context Pointer to the callback's private data + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err This should always be set to a failure status prior to calling. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE, -// * returning the error code back to the caller immediately. -// * -// * @param context Pointer to the callback's private data -// * @param toUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' bytes of the concerned codepage sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param reason Defines the reason the callback was invoked -// * @param err This should always be set to a failure status prior to calling. -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( -// const void *context, -// UConverterToUnicodeArgs *toUArgs, -// const char* codeUnits, -// int32_t length, -// UConverterCallbackReason reason, -// UErrorCode * err); +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * + * @param context Pointer to the callback's private data + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err This should always be set to a failure status prior to calling. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This From Unicode callback skips any ILLEGAL_SEQUENCE, or -// * skips only UNASSINGED_SEQUENCE depending on the context parameter -// * simply ignoring those characters. -// * -// * @param context The function currently recognizes the callback options: -// * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, -// * returning the error code back to the caller immediately. -// * NULL: Skips any ILLEGAL_SEQUENCE -// * @param fromUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. -// * @param reason Defines the reason the callback was invoked -// * @param err Return value will be set to success if the callback was handled, -// * otherwise this value will be set to a failure status. -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( -// const void *context, -// UConverterFromUnicodeArgs *fromUArgs, -// const UChar* codeUnits, -// int32_t length, -// UChar32 codePoint, -// UConverterCallbackReason reason, -// UErrorCode * err); +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback skips any ILLEGAL_SEQUENCE, or + * skips only UNASSIGNED_SEQUENCE depending on the context parameter + * simply ignoring those characters. + * + * @param context The function currently recognizes the callback options: + * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Skips any ILLEGAL_SEQUENCE + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or -// * UNASSIGNED_SEQUENCE depending on context parameter, with the -// * current substitution string for the converter. This is the default -// * callback. -// * -// * @param context The function currently recognizes the callback options: -// * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, -// * returning the error code back to the caller immediately. -// * NULL: Substitutes any ILLEGAL_SEQUENCE -// * @param fromUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. -// * @param reason Defines the reason the callback was invoked -// * @param err Return value will be set to success if the callback was handled, -// * otherwise this value will be set to a failure status. -// * @see ucnv_setSubstChars -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( -// const void *context, -// UConverterFromUnicodeArgs *fromUArgs, -// const UChar* codeUnits, -// int32_t length, -// UChar32 codePoint, -// UConverterCallbackReason reason, -// UErrorCode * err); +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or + * UNASSIGNED_SEQUENCE depending on context parameter, with the + * current substitution string for the converter. This is the default + * callback. + * + * @param context The function currently recognizes the callback options: + * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Substitutes any ILLEGAL_SEQUENCE + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @see ucnv_setSubstChars + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the -// * hexadecimal representation of the illegal codepoints -// * -// * @param context The function currently recognizes the callback options: -// *
      -// *
    • UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal -// * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). -// * In the Event the converter doesn't support the characters {%,U}[A-F][0-9], -// * it will substitute the illegal sequence with the substitution characters. -// * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as -// * %UD84D%UDC56
    • -// *
    • UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal -// * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). -// * In the Event the converter doesn't support the characters {\,u}[A-F][0-9], -// * it will substitute the illegal sequence with the substitution characters. -// * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as -// * \\uD84D\\uDC56
    • -// *
    • UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal -// * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). -// * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], -// * it will substitute the illegal sequence with the substitution characters. -// * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as -// * \\U00023456
    • -// *
    • UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal -// * representation in the format \htmlonly&#DDDDDDDD;, e.g. "&#65534;&#172;&#51454;")\endhtmlonly. -// * In the Event the converter doesn't support the characters {&,#}[0-9], -// * it will substitute the illegal sequence with the substitution characters. -// * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as -// * &#144470; and Zero padding is ignored.
    • -// *
    • UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal -// * representation in the format \htmlonly&#xXXXX; e.g. "&#xFFFE;&#x00AC;&#xC8FE;")\endhtmlonly. -// * In the Event the converter doesn't support the characters {&,#,x}[0-9], -// * it will substitute the illegal sequence with the substitution characters. -// * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as -// * \htmlonly&#x23456;\endhtmlonly
    • -// *
    -// * @param fromUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. -// * @param reason Defines the reason the callback was invoked -// * @param err Return value will be set to success if the callback was handled, -// * otherwise this value will be set to a failure status. -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( -// const void *context, -// UConverterFromUnicodeArgs *fromUArgs, -// const UChar* codeUnits, -// int32_t length, -// UChar32 codePoint, -// UConverterCallbackReason reason, -// UErrorCode * err); +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the + * hexadecimal representation of the illegal codepoints + * + * @param context The function currently recognizes the callback options: + *
      + *
    • UCNV_ESCAPE_ICU: Substitutes the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). + * In the Event the converter doesn't support the characters {%,U}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * %UD84D%UDC56
    • + *
    • UCNV_ESCAPE_JAVA: Substitutes the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). + * In the Event the converter doesn't support the characters {\,u}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \\uD84D\\uDC56
    • + *
    • UCNV_ESCAPE_C: Substitutes the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). + * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \\U00023456
    • + *
    • UCNV_ESCAPE_XML_DEC: Substitutes the ILLEGAL SEQUENCE with the decimal + * representation in the format \htmlonly&#DDDDDDDD;, e.g. "&#65534;&#172;&#51454;")\endhtmlonly. + * In the Event the converter doesn't support the characters {&,#}[0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * &#144470; and Zero padding is ignored.
    • + *
    • UCNV_ESCAPE_XML_HEX:Substitutes the ILLEGAL SEQUENCE with the decimal + * representation in the format \htmlonly&#xXXXX; e.g. "&#xFFFE;&#x00AC;&#xC8FE;")\endhtmlonly. + * In the Event the converter doesn't support the characters {&,#,x}[0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \htmlonly&#x23456;\endhtmlonly
    • + *
    + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This To Unicode callback skips any ILLEGAL_SEQUENCE, or -// * skips only UNASSINGED_SEQUENCE depending on the context parameter -// * simply ignoring those characters. -// * -// * @param context The function currently recognizes the callback options: -// * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, -// * returning the error code back to the caller immediately. -// * NULL: Skips any ILLEGAL_SEQUENCE -// * @param toUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' bytes of the concerned codepage sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param reason Defines the reason the callback was invoked -// * @param err Return value will be set to success if the callback was handled, -// * otherwise this value will be set to a failure status. -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( -// const void *context, -// UConverterToUnicodeArgs *toUArgs, -// const char* codeUnits, -// int32_t length, -// UConverterCallbackReason reason, -// UErrorCode * err); +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback skips any ILLEGAL_SEQUENCE, or + * skips only UNASSIGNED_SEQUENCE depending on the context parameter + * simply ignoring those characters. + * + * @param context The function currently recognizes the callback options: + * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Skips any ILLEGAL_SEQUENCE + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or -// * UNASSIGNED_SEQUENCE depending on context parameter, with the -// * Unicode substitution character, U+FFFD. -// * -// * @param context The function currently recognizes the callback options: -// * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, -// * returning the error code back to the caller immediately. -// * NULL: Substitutes any ILLEGAL_SEQUENCE -// * @param toUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' bytes of the concerned codepage sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param reason Defines the reason the callback was invoked -// * @param err Return value will be set to success if the callback was handled, -// * otherwise this value will be set to a failure status. -// * @stable ICU 2.0 -// */ -// U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( -// const void *context, -// UConverterToUnicodeArgs *toUArgs, -// const char* codeUnits, -// int32_t length, -// UConverterCallbackReason reason, -// UErrorCode * err); +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or + * UNASSIGNED_SEQUENCE depending on context parameter, with the + * Unicode substitution character, U+FFFD. + * + * @param context The function currently recognizes the callback options: + * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Substitutes any ILLEGAL_SEQUENCE + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); -// /** -// * DO NOT CALL THIS FUNCTION DIRECTLY! -// * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the -// * hexadecimal representation of the illegal bytes -// * (in the format %XNN, e.g. "%XFF%X0A%XC8%X03"). -// * -// * @param context This function currently recognizes the callback options: -// * UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC, -// * UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE. -// * @param toUArgs Information about the conversion in progress -// * @param codeUnits Points to 'length' bytes of the concerned codepage sequence -// * @param length Size (in bytes) of the concerned codepage sequence -// * @param reason Defines the reason the callback was invoked -// * @param err Return value will be set to success if the callback was handled, -// * otherwise this value will be set to a failure status. -// * @stable ICU 2.0 -// */ +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the + * hexadecimal representation of the illegal bytes + * (in the format %XNN, e.g. "%XFF%X0A%XC8%X03"). + * + * @param context This function currently recognizes the callback options: + * UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC, + * UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE. + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ -// U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( -// const void *context, -// UConverterToUnicodeArgs *toUArgs, -// const char* codeUnits, -// int32_t length, -// UConverterCallbackReason reason, -// UErrorCode * err); +U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); -// #endif +#endif -// #endif +#endif -// /*UCNV_ERR_H*/ +/*UCNV_ERR_H*/ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnvsel.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnvsel.h index ca623ed7e..9373ec951 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnvsel.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucnvsel.h @@ -1,189 +1,193 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * -// * Copyright (C) 2008-2011, International Business Machines -// * Corporation, Google and others. All Rights Reserved. -// * -// ******************************************************************************* -// */ -// /* -// * Author : eldawy@google.com (Mohamed Eldawy) -// * ucnvsel.h -// * -// * Purpose: To generate a list of encodings capable of handling -// * a given Unicode text -// * -// * Started 09-April-2008 -// */ - -// #ifndef __ICU_UCNV_SEL_H__ -// #define __ICU_UCNV_SEL_H__ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/uset.h" -// #include "unicode/utf16.h" -// #include "unicode/uenum.h" -// #include "unicode/ucnv.h" -// #include "unicode/localpointer.h" - -// /** -// * \file -// * -// * A converter selector is built with a set of encoding/charset names -// * and given an input string returns the set of names of the -// * corresponding converters which can convert the string. -// * -// * A converter selector can be serialized into a buffer and reopened -// * from the serialized form. -// */ - -// /** -// * @{ -// * The selector data structure -// */ -// struct UConverterSelector; -// typedef struct UConverterSelector UConverterSelector; -// /** @} */ - -// /** -// * Open a selector. -// * If converterListSize is 0, build for all available converters. -// * If excludedCodePoints is NULL, don't exclude any code points. -// * -// * @param converterList a pointer to encoding names needed to be involved. -// * Can be NULL if converterListSize==0. -// * The list and the names will be cloned, and the caller -// * retains ownership of the original. -// * @param converterListSize number of encodings in above list. -// * If 0, builds a selector for all available converters. -// * @param excludedCodePoints a set of code points to be excluded from consideration. -// * That is, excluded code points in a string do not change -// * the selection result. (They might be handled by a callback.) -// * Use NULL to exclude nothing. -// * @param whichSet what converter set to use? Use this to determine whether -// * to consider only roundtrip mappings or also fallbacks. -// * @param status an in/out ICU UErrorCode -// * @return the new selector -// * -// * @stable ICU 4.2 -// */ -// U_STABLE UConverterSelector* U_EXPORT2 -// ucnvsel_open(const char* const* converterList, int32_t converterListSize, -// const USet* excludedCodePoints, -// const UConverterUnicodeSet whichSet, UErrorCode* status); - -// /** -// * Closes a selector. -// * If any Enumerations were returned by ucnv_select*, they become invalid. -// * They can be closed before or after calling ucnv_closeSelector, -// * but should never be used after the selector is closed. -// * -// * @see ucnv_selectForString -// * @see ucnv_selectForUTF8 -// * -// * @param sel selector to close -// * -// * @stable ICU 4.2 -// */ -// U_STABLE void U_EXPORT2 -// ucnvsel_close(UConverterSelector *sel); - -// #if U_SHOW_CPLUSPLUS_API - -// U_NAMESPACE_BEGIN - -// /** -// * \class LocalUConverterSelectorPointer -// * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). -// * For most methods see the LocalPointerBase base class. -// * -// * @see LocalPointerBase -// * @see LocalPointer -// * @stable ICU 4.4 -// */ -// U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close); - -// U_NAMESPACE_END - -// #endif - -// /** -// * Open a selector from its serialized form. -// * The buffer must remain valid and unchanged for the lifetime of the selector. -// * This is much faster than creating a selector from scratch. -// * Using a serialized form from a different machine (endianness/charset) is supported. -// * -// * @param buffer pointer to the serialized form of a converter selector; -// * must be 32-bit-aligned -// * @param length the capacity of this buffer (can be equal to or larger than -// * the actual data length) -// * @param status an in/out ICU UErrorCode -// * @return the new selector -// * -// * @stable ICU 4.2 -// */ -// U_STABLE UConverterSelector* U_EXPORT2 -// ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status); - -// /** -// * Serialize a selector into a linear buffer. -// * The serialized form is portable to different machines. -// * -// * @param sel selector to consider -// * @param buffer pointer to 32-bit-aligned memory to be filled with the -// * serialized form of this converter selector -// * @param bufferCapacity the capacity of this buffer -// * @param status an in/out ICU UErrorCode -// * @return the required buffer capacity to hold serialize data (even if the call fails -// * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity) -// * -// * @stable ICU 4.2 -// */ -// U_STABLE int32_t U_EXPORT2 -// ucnvsel_serialize(const UConverterSelector* sel, -// void* buffer, int32_t bufferCapacity, UErrorCode* status); - -// /** -// * Select converters that can map all characters in a UTF-16 string, -// * ignoring the excluded code points. -// * -// * @param sel a selector -// * @param s UTF-16 string -// * @param length length of the string, or -1 if NUL-terminated -// * @param status an in/out ICU UErrorCode -// * @return an enumeration containing encoding names. -// * The returned encoding names and their order will be the same as -// * supplied when building the selector. -// * -// * @stable ICU 4.2 -// */ -// U_STABLE UEnumeration * U_EXPORT2 -// ucnvsel_selectForString(const UConverterSelector* sel, -// const UChar *s, int32_t length, UErrorCode *status); - -// /** -// * Select converters that can map all characters in a UTF-8 string, -// * ignoring the excluded code points. -// * -// * @param sel a selector -// * @param s UTF-8 string -// * @param length length of the string, or -1 if NUL-terminated -// * @param status an in/out ICU UErrorCode -// * @return an enumeration containing encoding names. -// * The returned encoding names and their order will be the same as -// * supplied when building the selector. -// * -// * @stable ICU 4.2 -// */ -// U_STABLE UEnumeration * U_EXPORT2 -// ucnvsel_selectForUTF8(const UConverterSelector* sel, -// const char *s, int32_t length, UErrorCode *status); - -// #endif /* !UCONFIG_NO_CONVERSION */ - -// #endif /* __ICU_UCNV_SEL_H__ */ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2008-2011, International Business Machines +* Corporation, Google and others. All Rights Reserved. +* +******************************************************************************* +*/ +/* + * Author : eldawy@google.com (Mohamed Eldawy) + * ucnvsel.h + * + * Purpose: To generate a list of encodings capable of handling + * a given Unicode text + * + * Started 09-April-2008 + */ + +#ifndef __ICU_UCNV_SEL_H__ +#define __ICU_UCNV_SEL_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/uset.h" +#include "unicode/utf16.h" +#include "unicode/uenum.h" +#include "unicode/ucnv.h" + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + +/** + * \file + * \brief C API: Encoding/charset encoding selector + * + * A converter selector is built with a set of encoding/charset names + * and given an input string returns the set of names of the + * corresponding converters which can convert the string. + * + * A converter selector can be serialized into a buffer and reopened + * from the serialized form. + */ + +struct UConverterSelector; +/** + * @{ + * Typedef for selector data structure. + */ +typedef struct UConverterSelector UConverterSelector; +/** @} */ + +/** + * Open a selector. + * If converterListSize is 0, build for all available converters. + * If excludedCodePoints is NULL, don't exclude any code points. + * + * @param converterList a pointer to encoding names needed to be involved. + * Can be NULL if converterListSize==0. + * The list and the names will be cloned, and the caller + * retains ownership of the original. + * @param converterListSize number of encodings in above list. + * If 0, builds a selector for all available converters. + * @param excludedCodePoints a set of code points to be excluded from consideration. + * That is, excluded code points in a string do not change + * the selection result. (They might be handled by a callback.) + * Use NULL to exclude nothing. + * @param whichSet what converter set to use? Use this to determine whether + * to consider only roundtrip mappings or also fallbacks. + * @param status an in/out ICU UErrorCode + * @return the new selector + * + * @stable ICU 4.2 + */ +U_CAPI UConverterSelector* U_EXPORT2 +ucnvsel_open(const char* const* converterList, int32_t converterListSize, + const USet* excludedCodePoints, + const UConverterUnicodeSet whichSet, UErrorCode* status); + +/** + * Closes a selector. + * If any Enumerations were returned by ucnv_select*, they become invalid. + * They can be closed before or after calling ucnv_closeSelector, + * but should never be used after the selector is closed. + * + * @see ucnv_selectForString + * @see ucnv_selectForUTF8 + * + * @param sel selector to close + * + * @stable ICU 4.2 + */ +U_CAPI void U_EXPORT2 +ucnvsel_close(UConverterSelector *sel); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUConverterSelectorPointer + * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a selector from its serialized form. + * The buffer must remain valid and unchanged for the lifetime of the selector. + * This is much faster than creating a selector from scratch. + * Using a serialized form from a different machine (endianness/charset) is supported. + * + * @param buffer pointer to the serialized form of a converter selector; + * must be 32-bit-aligned + * @param length the capacity of this buffer (can be equal to or larger than + * the actual data length) + * @param status an in/out ICU UErrorCode + * @return the new selector + * + * @stable ICU 4.2 + */ +U_CAPI UConverterSelector* U_EXPORT2 +ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status); + +/** + * Serialize a selector into a linear buffer. + * The serialized form is portable to different machines. + * + * @param sel selector to consider + * @param buffer pointer to 32-bit-aligned memory to be filled with the + * serialized form of this converter selector + * @param bufferCapacity the capacity of this buffer + * @param status an in/out ICU UErrorCode + * @return the required buffer capacity to hold serialize data (even if the call fails + * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity) + * + * @stable ICU 4.2 + */ +U_CAPI int32_t U_EXPORT2 +ucnvsel_serialize(const UConverterSelector* sel, + void* buffer, int32_t bufferCapacity, UErrorCode* status); + +/** + * Select converters that can map all characters in a UTF-16 string, + * ignoring the excluded code points. + * + * @param sel a selector + * @param s UTF-16 string + * @param length length of the string, or -1 if NUL-terminated + * @param status an in/out ICU UErrorCode + * @return an enumeration containing encoding names. + * The returned encoding names and their order will be the same as + * supplied when building the selector. + * + * @stable ICU 4.2 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnvsel_selectForString(const UConverterSelector* sel, + const UChar *s, int32_t length, UErrorCode *status); + +/** + * Select converters that can map all characters in a UTF-8 string, + * ignoring the excluded code points. + * + * @param sel a selector + * @param s UTF-8 string + * @param length length of the string, or -1 if NUL-terminated + * @param status an in/out ICU UErrorCode + * @return an enumeration containing encoding names. + * The returned encoding names and their order will be the same as + * supplied when building the selector. + * + * @stable ICU 4.2 + */ +U_CAPI UEnumeration * U_EXPORT2 +ucnvsel_selectForUTF8(const UConverterSelector* sel, + const char *s, int32_t length, UErrorCode *status); + +#endif /* !UCONFIG_NO_CONVERSION */ + +#endif /* __ICU_UCNV_SEL_H__ */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uconfig.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uconfig.h index 2507f79c1..eaaf6d149 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uconfig.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uconfig.h @@ -37,6 +37,10 @@ #define UCONFIG_NO_CONVERSION 1 #endif +#ifndef U_CHARSET_IS_UTF8 +#define U_CHARSET_IS_UTF8 1 +#endif + #ifndef UCONFIG_NO_TRANSLITERATION #define UCONFIG_NO_TRANSLITERATION 1 #endif @@ -53,6 +57,10 @@ #define U_SHOW_CPLUSPLUS_API 1 #endif +#ifndef U_I18N_IMPLEMENTATION +#define U_I18N_IMPLEMENTATION 1 +#endif + /*! * \file * \brief User-configurable settings @@ -86,9 +94,9 @@ * * @internal ICU 4.0 */ -// #if defined(UCONFIG_USE_LOCAL) -// #include "uconfig_local.h" -// #endif +#if defined(UCONFIG_USE_LOCAL) +#include "uconfig_local.h" +#endif /** * \def U_DEBUG @@ -127,6 +135,24 @@ #define U_DISABLE_RENAMING 0 #endif +/** + * \def U_NO_DEFAULT_INCLUDE_UTF_HEADERS + * Determines whether utypes.h includes utf.h, utf8.h, utf16.h and utf_old.h. + * utypes.h includes those headers if this macro is defined to 0. + * Otherwise, each those headers must be included explicitly when using one of their macros. + * Defaults to 0 for backward compatibility, except inside ICU. + * @stable ICU 49 + */ +#ifdef U_NO_DEFAULT_INCLUDE_UTF_HEADERS + /* Use the predefined value. */ +#elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \ + defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \ + defined(U_TOOLUTIL_IMPLEMENTATION) +# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 1 +#else +# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 0 +#endif + /** * \def U_OVERRIDE_CXX_ALLOCATION * Determines whether to override new and delete. @@ -340,6 +366,16 @@ # define UCONFIG_NO_NORMALIZATION 0 #endif +/** + * \def UCONFIG_USE_ML_PHRASE_BREAKING + * This switch turns on BudouX ML phrase-based line breaking, rather than using the dictionary. + * + * @internal + */ +#ifndef UCONFIG_USE_ML_PHRASE_BREAKING +# define UCONFIG_USE_ML_PHRASE_BREAKING 0 +#endif + #if UCONFIG_NO_NORMALIZATION /* common library */ /* ICU 50 CJK dictionary BreakIterator uses normalization */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucpmap.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucpmap.h index 31e1365ca..a740bd160 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucpmap.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucpmap.h @@ -13,8 +13,7 @@ U_CDECL_BEGIN /** * \file - * - * This file defines an abstract map from Unicode code points to integer values. + * \brief C API: This file defines an abstract map from Unicode code points to integer values. * * @see UCPMap * @see UCPTrie diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucptrie.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucptrie.h index be06a2279..dadef79c5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucptrie.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucptrie.h @@ -8,17 +8,18 @@ #define __UCPTRIE_H__ #include "unicode/utypes.h" - -#include "unicode/localpointer.h" #include "unicode/ucpmap.h" #include "unicode/utf8.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + U_CDECL_BEGIN /** * \file - * - * This file defines an immutable Unicode code point trie. + * \brief C API: This file defines an immutable Unicode code point trie. * * @see UCPTrie * @see UMutableCPTrie @@ -41,7 +42,7 @@ typedef union UCPTrieData { /** * Immutable Unicode code point trie structure. * Fast, reasonably compact, map from Unicode code points (U+0000..U+10FFFF) to integer values. - * For details see http://site.icu-project.org/design/struct/utrie + * For details see https://icu.unicode.org/design/struct/utrie * * Do not access UCPTrie fields directly; use public functions and macros. * Functions are easy to use: They support all trie types and value widths. @@ -580,11 +581,11 @@ enum { // Do not conditionalize with #ifndef U_HIDE_INTERNAL_API, needed for public API /** @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c); /** @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3); /** @@ -592,7 +593,7 @@ ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8 * Do not call directly. * @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c, const uint8_t *start, const uint8_t *src); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucurr.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucurr.h index f91cc0df7..5589e7999 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ucurr.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ucurr.h @@ -78,7 +78,7 @@ typedef enum UCurrencyUsage UCurrencyUsage; * invalid. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_forLocale(const char* locale, UChar* buff, int32_t buffCapacity, @@ -113,7 +113,27 @@ typedef enum UCurrNameStyle { * * @stable ICU 61 */ - UCURR_NARROW_SYMBOL_NAME + UCURR_NARROW_SYMBOL_NAME, + + /** + * Selector for getName() indicating the formal currency symbol. + * The formal currency symbol is similar to the regular currency + * symbol, but it always takes the form used in formal settings + * such as banking; for example, "NT$" instead of "$" for TWD in zh-TW. + * + * @stable ICU 68 + */ + UCURR_FORMAL_SYMBOL_NAME, + + /** + * Selector for getName() indicating the variant currency symbol. + * The variant symbol for a currency is an alternative symbol + * that is not necessarily as widely used as the regular symbol. + * + * @stable ICU 68 + */ + UCURR_VARIANT_SYMBOL_NAME + } UCurrNameStyle; #if !UCONFIG_NO_SERVICE @@ -133,7 +153,7 @@ typedef const void* UCurrRegistryKey; * if there was an error. * @stable ICU 2.6 */ -U_STABLE UCurrRegistryKey U_EXPORT2 +U_CAPI UCurrRegistryKey U_EXPORT2 ucurr_register(const UChar* isoCode, const char* locale, UErrorCode* status); @@ -145,10 +165,10 @@ ucurr_register(const UChar* isoCode, * restored. * @param key the registry key returned by a previous call to ucurr_register * @param status the in/out status code, no special meanings are assigned - * @return TRUE if the currency for this key was successfully unregistered + * @return true if the currency for this key was successfully unregistered * @stable ICU 2.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); #endif /* UCONFIG_NO_SERVICE */ @@ -159,7 +179,7 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); * @param currency null-terminated 3-letter ISO 4217 code * @param locale locale in which to display currency * @param nameStyle selector for which kind of name to return - * @param isChoiceFormat always set to FALSE, or can be NULL; + * @param isChoiceFormat always set to false, or can be NULL; * display names are static strings; * since ICU 4.4, ChoiceFormat patterns are no longer supported * @param len fill-in parameter to receive length of result @@ -169,7 +189,7 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); * returned. * @stable ICU 2.6 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ucurr_getName(const UChar* currency, const char* locale, UCurrNameStyle nameStyle, @@ -183,7 +203,7 @@ ucurr_getName(const UChar* currency, * currency object in the en_US locale is "US dollar" or "US dollars". * @param currency null-terminated 3-letter ISO 4217 code * @param locale locale in which to display currency - * @param isChoiceFormat always set to FALSE, or can be NULL; + * @param isChoiceFormat always set to false, or can be NULL; * display names are static strings; * since ICU 4.4, ChoiceFormat patterns are no longer supported * @param pluralCount plural count @@ -194,7 +214,7 @@ ucurr_getName(const UChar* currency, * returned. * @stable ICU 4.2 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ucurr_getPluralName(const UChar* currency, const char* locale, UBool* isChoiceFormat, @@ -219,7 +239,7 @@ ucurr_getPluralName(const UChar* currency, * displayed, or 0 if there is an error * @stable ICU 3.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_getDefaultFractionDigits(const UChar* currency, UErrorCode* ec); @@ -240,7 +260,7 @@ ucurr_getDefaultFractionDigits(const UChar* currency, * displayed, or 0 if there is an error * @stable ICU 54 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec); @@ -255,7 +275,7 @@ ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, * or 0.0 if there is an error * @stable ICU 3.0 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 ucurr_getRoundingIncrement(const UChar* currency, UErrorCode* ec); @@ -269,7 +289,7 @@ ucurr_getRoundingIncrement(const UChar* currency, * or 0.0 if there is an error * @stable ICU 54 */ -U_STABLE double U_EXPORT2 +U_CAPI double U_EXPORT2 ucurr_getRoundingIncrementForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec); @@ -326,7 +346,7 @@ typedef enum UCurrCurrencyType { * @param pErrorCode Error code * @stable ICU 3.2 */ -U_STABLE UEnumeration * U_EXPORT2 +U_CAPI UEnumeration * U_EXPORT2 ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode); /** @@ -351,11 +371,11 @@ ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode); * @param errorCode * ICU error code * - * @return TRUE if the given ISO 4217 3-letter code is supported on the specified date range. + * @return true if the given ISO 4217 3-letter code is supported on the specified date range. * * @stable ICU 4.8 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, @@ -375,7 +395,7 @@ ucurr_isAvailable(const UChar* isoCode, * values are invalid. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_countCurrencies(const char* locale, UDate date, UErrorCode* ec); @@ -399,7 +419,7 @@ ucurr_countCurrencies(const char* locale, * invalid. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_forLocaleAndDate(const char* locale, UDate date, int32_t index, @@ -423,7 +443,7 @@ ucurr_forLocaleAndDate(const char* locale, * @return a string enumeration over keyword values for the given key and the locale. * @stable ICU 4.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ucurr_getKeywordValuesForLocale(const char* key, const char* locale, UBool commonlyUsed, @@ -438,7 +458,7 @@ ucurr_getKeywordValuesForLocale(const char* key, * @return The ISO 4217 numeric code of the currency * @stable ICU 49 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ucurr_getNumericCode(const UChar* currency); #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/udata.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/udata.h index 325ffcf17..4cda25501 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/udata.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/udata.h @@ -20,7 +20,10 @@ #define __UDATA_H__ #include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API U_CDECL_BEGIN @@ -166,8 +169,8 @@ typedef struct UDataMemory UDataMemory; * @param pInfo A pointer to the UDataInfo structure * of data that has been loaded and will be returned * by udata_openChoice() if this function - * returns TRUE. - * @return TRUE if the current data memory is acceptable + * returns true. + * @return true if the current data memory is acceptable * @stable ICU 2.0 */ typedef UBool U_CALLCONV @@ -197,7 +200,7 @@ UDataMemoryIsAcceptable(void *context, * @see udata_openChoice * @stable ICU 2.0 */ -U_STABLE UDataMemory * U_EXPORT2 +U_CAPI UDataMemory * U_EXPORT2 udata_open(const char *path, const char *type, const char *name, UErrorCode *pErrorCode); @@ -228,7 +231,7 @@ udata_open(const char *path, const char *type, const char *name, * logically prepended to the ICU data directory string.

    * *

    For details about ICU data loading see the User Guide - * Data Management chapter. (http://icu-project.org/userguide/icudata.html)

    + * Data Management chapter. (https://unicode-org.github.io/icu/userguide/icu_data/)

    * * @param path Specifies an absolute path and/or a basename for the * finding of the data in the file system. @@ -239,7 +242,7 @@ udata_open(const char *path, const char *type, const char *name, * This may be NULL or empty. * @param name A string that specifies the name of the data. * @param isAcceptable This function is called to verify that loaded data - * is useful for the client code. If it returns FALSE + * is useful for the client code. If it returns false * for all data items, then udata_openChoice() * will return with an error. * @param context Arbitrary parameter to be passed into isAcceptable. @@ -249,7 +252,7 @@ udata_open(const char *path, const char *type, const char *name, * to get a pointer to the actual data. * @stable ICU 2.0 */ -U_STABLE UDataMemory * U_EXPORT2 +U_CAPI UDataMemory * U_EXPORT2 udata_openChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode); @@ -261,7 +264,7 @@ udata_openChoice(const char *path, const char *type, const char *name, * @param pData The pointer to data memory object * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_close(UDataMemory *pData); /** @@ -273,7 +276,7 @@ udata_close(UDataMemory *pData); * @param pData The pointer to data memory object * @stable ICU 2.0 */ -U_STABLE const void * U_EXPORT2 +U_CAPI const void * U_EXPORT2 udata_getMemory(UDataMemory *pData); /** @@ -294,7 +297,7 @@ udata_getMemory(UDataMemory *pData); * adjusted and only part of the structure will be filled. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); /** @@ -303,7 +306,7 @@ udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); * area in memory. * * ICU data must be at least 8-aligned, and should be 16-aligned. - * See http://userguide.icu-project.org/icudata + * See https://unicode-org.github.io/icu/userguide/icu_data * * The format of this data is that of the icu common data file, as is * generated by the pkgdata tool with mode=common or mode=dll. @@ -340,7 +343,7 @@ udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_setCommonData(const void *data, UErrorCode *err); @@ -350,7 +353,7 @@ udata_setCommonData(const void *data, UErrorCode *err); * pointer. * * ICU data must be at least 8-aligned, and should be 16-aligned. - * See http://userguide.icu-project.org/icudata + * See https://unicode-org.github.io/icu/userguide/icu_data * * The format of this data is that of the icu common data file, like 'icudt26l.dat' * or the corresponding shared library (DLL) file. @@ -359,7 +362,7 @@ udata_setCommonData(const void *data, UErrorCode *err); * * * Warning: setAppData will set a U_USING_DEFAULT_WARNING code if - * data with the specifed path that has already been opened, or + * data with the specified path that has already been opened, or * if setAppData with the same path has already been called. * Any such calls to setAppData will have no effect. * @@ -371,7 +374,7 @@ udata_setCommonData(const void *data, UErrorCode *err); * @see udata_setCommonData * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_setAppData(const char *packageName, const void *data, UErrorCode *err); /** @@ -410,7 +413,7 @@ typedef enum UDataFileAccess { * @see UDataFileAccess * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 udata_setFileAccess(UDataFileAccess access, UErrorCode *status); U_CDECL_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/udisplaycontext.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/udisplaycontext.h index 398481c68..6e1421798 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/udisplaycontext.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/udisplaycontext.h @@ -156,7 +156,8 @@ enum UDisplayContext { UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0, /** * A possible setting for SUBSTITUTE_HANDLING: - * Returns a null value when no data is available. + * Returns a null value with error code set to U_ILLEGAL_ARGUMENT_ERROR when no + * data is available. * @stable ICU 58 */ UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1 diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uenum.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uenum.h index c670eeafb..d9c893e06 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uenum.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uenum.h @@ -20,13 +20,14 @@ #define __UENUM_H #include "unicode/utypes.h" -#include "unicode/localpointer.h" #if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" + U_NAMESPACE_BEGIN class StringEnumeration; U_NAMESPACE_END -#endif +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -49,7 +50,7 @@ typedef struct UEnumeration UEnumeration; * @param en UEnumeration structure pointer * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uenum_close(UEnumeration* en); #if U_SHOW_CPLUSPLUS_API @@ -85,7 +86,7 @@ U_NAMESPACE_END * @return number of elements in the iterator * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uenum_count(UEnumeration* en, UErrorCode* status); /** @@ -109,7 +110,7 @@ uenum_count(UEnumeration* en, UErrorCode* status); * traversed, returns NULL. * @stable ICU 2.2 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 uenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* status); @@ -142,7 +143,7 @@ uenum_unext(UEnumeration* en, * traversed, returns NULL. * @stable ICU 2.2 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uenum_next(UEnumeration* en, int32_t* resultLength, UErrorCode* status); @@ -156,7 +157,7 @@ uenum_next(UEnumeration* en, * the iterator is out of sync with its service. * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uenum_reset(UEnumeration* en, UErrorCode* status); #if U_SHOW_CPLUSPLUS_API @@ -170,7 +171,7 @@ uenum_reset(UEnumeration* en, UErrorCode* status); * @return a UEnumeration wrapping the adopted StringEnumeration. * @stable ICU 4.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec); #endif @@ -186,7 +187,7 @@ uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec) * @see uenum_close * @stable ICU 50 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count, UErrorCode* ec); @@ -201,7 +202,7 @@ uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count, * @see uenum_close * @stable ICU 50 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uenum_openCharStringsEnumeration(const char* const strings[], int32_t count, UErrorCode* ec); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uidna.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uidna.h index 0dafb7620..24a81cead 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uidna.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uidna.h @@ -23,9 +23,13 @@ #if !UCONFIG_NO_IDNA -#include "unicode/localpointer.h" +#include #include "unicode/parseerr.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * \file * \brief C API: Internationalizing Domain Names in Applications (IDNA) @@ -138,7 +142,7 @@ typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @stable ICU 4.6 */ * @return the UTS #46 UIDNA instance, if successful * @stable ICU 4.6 */ -U_STABLE UIDNA * U_EXPORT2 +U_CAPI UIDNA * U_EXPORT2 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); /** @@ -146,7 +150,7 @@ uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); * @param idna UIDNA instance to be closed * @stable ICU 4.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uidna_close(UIDNA *idna); #if U_SHOW_CPLUSPLUS_API @@ -182,7 +186,7 @@ typedef struct UIDNAInfo { /** sizeof(UIDNAInfo) @stable ICU 4.6 */ int16_t size; /** - * Set to TRUE if transitional and nontransitional processing produce different results. + * Set to true if transitional and nontransitional processing produce different results. * For details see C++ IDNAInfo::isTransitionalDifferent(). * @stable ICU 4.6 */ @@ -204,7 +208,7 @@ typedef struct UIDNAInfo { */ #define UIDNA_INFO_INITIALIZER { \ (int16_t)sizeof(UIDNAInfo), \ - FALSE, FALSE, \ + false, false, \ 0, 0, 0 } /** @@ -230,7 +234,7 @@ typedef struct UIDNAInfo { * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToASCII(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, @@ -257,7 +261,7 @@ uidna_labelToASCII(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToUnicode(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, @@ -286,7 +290,7 @@ uidna_labelToUnicode(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToASCII(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, @@ -313,7 +317,7 @@ uidna_nameToASCII(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToUnicode(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, @@ -338,7 +342,7 @@ uidna_nameToUnicode(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToASCII_UTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, @@ -361,7 +365,7 @@ uidna_labelToASCII_UTF8(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_labelToUnicodeUTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, @@ -384,7 +388,7 @@ uidna_labelToUnicodeUTF8(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToASCII_UTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, @@ -407,7 +411,7 @@ uidna_nameToASCII_UTF8(const UIDNA *idna, * @return destination string length * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uidna_nameToUnicodeUTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uiter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uiter.h index 11ad75acd..be232c774 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uiter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uiter.h @@ -492,7 +492,7 @@ struct UCharIterator { * @see UnicodeString::char32At() * @stable ICU 2.1 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uiter_current32(UCharIterator *iter); /** @@ -509,7 +509,7 @@ uiter_current32(UCharIterator *iter); * @see U16_NEXT * @stable ICU 2.1 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uiter_next32(UCharIterator *iter); /** @@ -526,7 +526,7 @@ uiter_next32(UCharIterator *iter); * @see U16_PREV * @stable ICU 2.1 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uiter_previous32(UCharIterator *iter); /** @@ -547,7 +547,7 @@ uiter_previous32(UCharIterator *iter); * @see UITER_NO_STATE * @stable ICU 2.6 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 uiter_getState(const UCharIterator *iter); /** @@ -565,7 +565,7 @@ uiter_getState(const UCharIterator *iter); * @see UCharIteratorSetState * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); /** @@ -590,7 +590,7 @@ uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); * @see UCharIterator * @stable ICU 2.1 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setString(UCharIterator *iter, const UChar *s, int32_t length); /** @@ -613,7 +613,7 @@ uiter_setString(UCharIterator *iter, const UChar *s, int32_t length); * @see uiter_setString * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length); /** @@ -649,7 +649,7 @@ uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length); * @see UCharIterator * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length); #if U_SHOW_CPLUSPLUS_API @@ -674,7 +674,7 @@ uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length); * @see UCharIterator * @stable ICU 2.1 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter); /** @@ -699,7 +699,7 @@ uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter * @see UCharIterator * @stable ICU 2.1 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uiter_setReplaceable(UCharIterator *iter, const icu::Replaceable *rep); #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uldnames.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uldnames.h index 3ebffa23d..47b047ece 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uldnames.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uldnames.h @@ -16,10 +16,13 @@ */ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/uscript.h" #include "unicode/udisplaycontext.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * Enum used in LocaleDisplayNames::createInstance. * @stable ICU 4.4 @@ -65,7 +68,7 @@ typedef struct ULocaleDisplayNames ULocaleDisplayNames; * @param pErrorCode the status code * @stable ICU 4.4 */ -U_STABLE ULocaleDisplayNames * U_EXPORT2 +U_CAPI ULocaleDisplayNames * U_EXPORT2 uldn_open(const char * locale, UDialectHandling dialectHandling, UErrorCode *pErrorCode); @@ -75,7 +78,7 @@ uldn_open(const char * locale, * @param ldn the ULocaleDisplayNames instance to be closed * @stable ICU 4.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uldn_close(ULocaleDisplayNames *ldn); #if U_SHOW_CPLUSPLUS_API @@ -106,7 +109,7 @@ U_NAMESPACE_END * @return the display locale * @stable ICU 4.4 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 uldn_getLocale(const ULocaleDisplayNames *ldn); /** @@ -115,7 +118,7 @@ uldn_getLocale(const ULocaleDisplayNames *ldn); * @return the dialect handling enum * @stable ICU 4.4 */ -U_STABLE UDialectHandling U_EXPORT2 +U_CAPI UDialectHandling U_EXPORT2 uldn_getDialectHandling(const ULocaleDisplayNames *ldn); /* names for entire locales */ @@ -131,7 +134,7 @@ uldn_getDialectHandling(const ULocaleDisplayNames *ldn); * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_localeDisplayName(const ULocaleDisplayNames *ldn, const char *locale, UChar *result, @@ -151,7 +154,7 @@ uldn_localeDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_languageDisplayName(const ULocaleDisplayNames *ldn, const char *lang, UChar *result, @@ -169,7 +172,7 @@ uldn_languageDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, const char *script, UChar *result, @@ -187,7 +190,7 @@ uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, UScriptCode scriptCode, UChar *result, @@ -205,7 +208,7 @@ uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_regionDisplayName(const ULocaleDisplayNames *ldn, const char *region, UChar *result, @@ -223,7 +226,7 @@ uldn_regionDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_variantDisplayName(const ULocaleDisplayNames *ldn, const char *variant, UChar *result, @@ -241,7 +244,7 @@ uldn_variantDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_keyDisplayName(const ULocaleDisplayNames *ldn, const char *key, UChar *result, @@ -260,7 +263,7 @@ uldn_keyDisplayName(const ULocaleDisplayNames *ldn, * greater than maxResultSize, the returned name will be truncated. * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, const char *key, const char *value, @@ -282,7 +285,7 @@ uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, * @return a ULocaleDisplayNames instance * @stable ICU 51 */ -U_STABLE ULocaleDisplayNames * U_EXPORT2 +U_CAPI ULocaleDisplayNames * U_EXPORT2 uldn_openForContext(const char * locale, UDisplayContext *contexts, int32_t length, UErrorCode *pErrorCode); @@ -296,7 +299,7 @@ uldn_openForContext(const char * locale, UDisplayContext *contexts, * @return the UDisplayContextValue for the specified type. * @stable ICU 51 */ -U_STABLE UDisplayContext U_EXPORT2 +U_CAPI UDisplayContext U_EXPORT2 uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type, UErrorCode *pErrorCode); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uloc.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uloc.h index c45edad9e..21179c1b6 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uloc.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uloc.h @@ -26,9 +26,9 @@ #include "unicode/utypes.h" #include "unicode/uenum.h" -/** +/** * \file - * \brief C API: Locale + * \brief C API: Locale ID functionality similar to C++ class Locale * *

    ULoc C API for Locale

    * A Locale represents a specific geographical, political, @@ -371,7 +371,7 @@ typedef enum { * @system * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getDefault(void); /** @@ -391,7 +391,7 @@ uloc_getDefault(void); * @system * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uloc_setDefault(const char* localeID, UErrorCode* status); #endif /* U_HIDE_SYSTEM_API */ @@ -408,7 +408,7 @@ uloc_setDefault(const char* localeID, * than languageCapacity, the returned language code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getLanguage(const char* localeID, char* language, int32_t languageCapacity, @@ -426,7 +426,7 @@ uloc_getLanguage(const char* localeID, * than scriptCapacity, the returned language code will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getScript(const char* localeID, char* script, int32_t scriptCapacity, @@ -444,7 +444,7 @@ uloc_getScript(const char* localeID, * than countryCapacity, the returned country code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getCountry(const char* localeID, char* country, int32_t countryCapacity, @@ -462,7 +462,7 @@ uloc_getCountry(const char* localeID, * than variantCapacity, the returned variant code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getVariant(const char* localeID, char* variant, int32_t variantCapacity, @@ -485,7 +485,7 @@ uloc_getVariant(const char* localeID, * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getName(const char* localeID, char* name, int32_t nameCapacity, @@ -508,7 +508,7 @@ uloc_getName(const char* localeID, * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_canonicalize(const char* localeID, char* name, int32_t nameCapacity, @@ -521,7 +521,7 @@ uloc_canonicalize(const char* localeID, * @return language the ISO language code for localeID * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getISO3Language(const char* localeID); @@ -532,7 +532,7 @@ uloc_getISO3Language(const char* localeID); * @return country the ISO country code for localeID * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getISO3Country(const char* localeID); /** @@ -546,26 +546,31 @@ uloc_getISO3Country(const char* localeID); * @return country the Win32 LCID for localeID * @stable ICU 2.0 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 uloc_getLCID(const char* localeID); /** * Gets the language name suitable for display for the specified locale. * * @param locale the locale to get the ISO language code with - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "Anglais", while passing Locale::getGerman() - * for inLocale would result in "Englisch". + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". * @param language the displayable language code for localeID - * @param languageCapacity the size of the language buffer to store the - * displayable language code with - * @param status error information if retrieving the displayable language code failed - * @return the actual buffer size needed for the displayable language code. If it's greater - * than languageCapacity, the returned language code will be truncated. + * @param languageCapacity the size of the language buffer to store the + * displayable language code with. + * @param status error information if retrieving the displayable language code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * language code is placed into language as fallback. + * @return the actual buffer size needed for the displayable language code. If + * it's greater than languageCapacity, the returned language + * code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayLanguage(const char* locale, const char* displayLocale, UChar* language, @@ -575,20 +580,26 @@ uloc_getDisplayLanguage(const char* locale, /** * Gets the script name suitable for display for the specified locale. * - * @param locale the locale to get the displayable script code with. NULL may be used to specify the default. - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "", while passing Locale::getGerman() - * for inLocale would result in "". NULL may be used to specify the default. - * @param script the displayable script for the localeID - * @param scriptCapacity the size of the script buffer to store the - * displayable script code with - * @param status error information if retrieving the displayable script code failed - * @return the actual buffer size needed for the displayable script code. If it's greater - * than scriptCapacity, the returned displayable script code will be truncated. + * @param locale the locale to get the displayable script code with. NULL may be + * used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "", while + * passing Locale::getGerman() for inLocale would result in "". + * NULL may be used to specify the default. + * @param script the displayable script for the localeID. + * @param scriptCapacity the size of the script buffer to store the displayable + * script code with. + * @param status error information if retrieving the displayable script code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * script code is placed into script as fallback. + * @return the actual buffer size needed for the displayable script code. If + * it's greater than scriptCapacity, the returned displayable + * script code will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayScript(const char* locale, const char* displayLocale, UChar* script, @@ -597,23 +608,30 @@ uloc_getDisplayScript(const char* locale, /** * Gets the country name suitable for display for the specified locale. - * Warning: this is for the region part of a valid locale ID; it cannot just be the region code (like "FR"). - * To get the display name for a region alone, or for other options, use ULocaleDisplayNames instead. - * - * @param locale the locale to get the displayable country code with. NULL may be used to specify the default. - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "Anglais", while passing Locale::getGerman() - * for inLocale would result in "Englisch". NULL may be used to specify the default. - * @param country the displayable country code for localeID - * @param countryCapacity the size of the country buffer to store the - * displayable country code with - * @param status error information if retrieving the displayable country code failed - * @return the actual buffer size needed for the displayable country code. If it's greater - * than countryCapacity, the returned displayable country code will be truncated. + * Warning: this is for the region part of a valid locale ID; it cannot just be + * the region code (like "FR"). To get the display name for a region alone, or + * for other options, use ULocaleDisplayNames instead. + * + * @param locale the locale to get the displayable country code with. NULL may + * be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". NULL may be used to specify the default. + * @param country the displayable country code for localeID. + * @param countryCapacity the size of the country buffer to store the + * displayable country code with. + * @param status error information if retrieving the displayable country code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * country code is placed into country as fallback. + * @return the actual buffer size needed for the displayable country code. If + * it's greater than countryCapacity, the returned displayable + * country code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayCountry(const char* locale, const char* displayLocale, UChar* country, @@ -624,20 +642,26 @@ uloc_getDisplayCountry(const char* locale, /** * Gets the variant name suitable for display for the specified locale. * - * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default. - * @param displayLocale Specifies the locale to be used to display the name. In other words, - * if the locale's language code is "en", passing Locale::getFrench() for - * inLocale would result in "Anglais", while passing Locale::getGerman() - * for inLocale would result in "Englisch". NULL may be used to specify the default. - * @param variant the displayable variant code for localeID - * @param variantCapacity the size of the variant buffer to store the - * displayable variant code with - * @param status error information if retrieving the displayable variant code failed - * @return the actual buffer size needed for the displayable variant code. If it's greater - * than variantCapacity, the returned displayable variant code will be truncated. + * @param locale the locale to get the displayable variant code with. NULL may + * be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In + * other words, if the locale's language code is "en", passing + * Locale::getFrench() for inLocale would result in "Anglais", + * while passing Locale::getGerman() for inLocale would result + * in "Englisch". NULL may be used to specify the default. + * @param variant the displayable variant code for localeID. + * @param variantCapacity the size of the variant buffer to store the + * displayable variant code with. + * @param status error information if retrieving the displayable variant code + * failed. U_USING_DEFAULT_WARNING indicates that no data was + * found from the locale resources and a case canonicalized + * variant code is placed into variant as fallback. + * @return the actual buffer size needed for the displayable variant code. If + * it's greater than variantCapacity, the returned displayable + * variant code will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayVariant(const char* locale, const char* displayLocale, UChar* variant, @@ -645,9 +669,9 @@ uloc_getDisplayVariant(const char* locale, UErrorCode* status); /** - * Gets the keyword name suitable for display for the specified locale. - * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display - * string for the keyword collation. + * Gets the keyword name suitable for display for the specified locale. E.g: + * for the locale string de_DE\@collation=PHONEBOOK, this API gets the display + * string for the keyword collation. * Usage: * * UErrorCode status = U_ZERO_ERROR; @@ -676,15 +700,17 @@ uloc_getDisplayVariant(const char* locale, * for inLocale would result in "Englisch". NULL may be used to specify the default. * @param dest the buffer to which the displayable keyword should be written. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then - * dest may be NULL and the function will only return the length of the + * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). - * @param status error information if retrieving the displayable string failed. + * @param status error information if retrieving the displayable string failed. * Should not be NULL and should not indicate failure on entry. - * @return the actual buffer size needed for the displayable variant code. + * U_USING_DEFAULT_WARNING indicates that no data was found from the locale + * resources and the keyword is placed into dest as fallback. + * @return the actual buffer size needed for the displayable variant code. * @see #uloc_openKeywords * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayKeyword(const char* keyword, const char* displayLocale, UChar* dest, @@ -692,7 +718,7 @@ uloc_getDisplayKeyword(const char* keyword, UErrorCode* status); /** * Gets the value of the keyword suitable for display for the specified locale. - * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display + * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword. * * @param locale The locale to get the displayable variant code with. NULL may be used to specify the default. @@ -703,14 +729,16 @@ uloc_getDisplayKeyword(const char* keyword, * for inLocale would result in "Englisch". NULL may be used to specify the default. * @param dest the buffer to which the displayable keyword should be written. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then - * dest may be NULL and the function will only return the length of the + * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). - * @param status error information if retrieving the displayable string failed. + * @param status error information if retrieving the displayable string failed. * Should not be NULL and must not indicate failure on entry. - * @return the actual buffer size needed for the displayable variant code. + * U_USING_DEFAULT_WARNING indicates that no data was found from the locale + * resources and the value of the keyword is placed into dest as fallback. + * @return the actual buffer size needed for the displayable variant code. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayKeywordValue( const char* locale, const char* keyword, const char* displayLocale, @@ -733,7 +761,7 @@ uloc_getDisplayKeywordValue( const char* locale, * than maxResultSize, the returned displayable name will be truncated. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getDisplayName(const char* localeID, const char* inLocaleID, UChar* result, @@ -757,7 +785,7 @@ uloc_getDisplayName(const char* localeID, * @return a specified locale name of all available locales * @stable ICU 2.0 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_getAvailable(int32_t n); /** @@ -766,21 +794,19 @@ uloc_getAvailable(int32_t n); * @return the size of the locale list * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void); - -#ifndef U_HIDE_DRAFT_API +U_CAPI int32_t U_EXPORT2 uloc_countAvailable(void); /** * Types for uloc_getAvailableByType and uloc_countAvailableByType. * - * @draft ICU 65 + * @stable ICU 65 */ typedef enum ULocAvailableType { /** * Locales that return data when passed to ICU APIs, * but not including legacy or alias locales. * - * @draft ICU 65 + * @stable ICU 65 */ ULOC_AVAILABLE_DEFAULT, @@ -798,7 +824,7 @@ typedef enum ULocAvailableType { * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use * ULOC_AVAILABLE_WITH_LEGACY_ALIASES. * - * @draft ICU 65 + * @stable ICU 65 */ ULOC_AVAILABLE_ONLY_LEGACY_ALIASES, @@ -806,7 +832,7 @@ typedef enum ULocAvailableType { * The union of the locales in ULOC_AVAILABLE_DEFAULT and * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS. * - * @draft ICU 65 + * @stable ICU 65 */ ULOC_AVAILABLE_WITH_LEGACY_ALIASES, @@ -815,7 +841,7 @@ typedef enum ULocAvailableType { * @internal */ ULOC_AVAILABLE_COUNT -#endif +#endif /* U_HIDE_INTERNAL_API */ } ULocAvailableType; /** @@ -827,13 +853,11 @@ typedef enum ULocAvailableType { * @param type Type choice from ULocAvailableType. * @param status Set if an error occurred. * @return a UEnumeration owned by the caller, or nullptr on failure. - * @draft ICU 65 + * @stable ICU 65 */ -U_DRAFT UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status); -#endif // U_HIDE_DRAFT_API - /** * * Gets a list of all available 2-letter language codes defined in ISO 639, @@ -845,7 +869,7 @@ uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status); * @return a list of all available language codes * @stable ICU 2.0 */ -U_STABLE const char* const* U_EXPORT2 +U_CAPI const char* const* U_EXPORT2 uloc_getISOLanguages(void); /** @@ -857,7 +881,7 @@ uloc_getISOLanguages(void); * @return a list of all available country codes * @stable ICU 2.0 */ -U_STABLE const char* const* U_EXPORT2 +U_CAPI const char* const* U_EXPORT2 uloc_getISOCountries(void); /** @@ -873,7 +897,7 @@ uloc_getISOCountries(void); * @return The length of the parent locale ID. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getParent(const char* localeID, char* parent, int32_t parentCapacity, @@ -904,7 +928,7 @@ uloc_getParent(const char* localeID, * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getBaseName(const char* localeID, char* name, int32_t nameCapacity, @@ -919,7 +943,7 @@ uloc_getBaseName(const char* localeID, * @return enumeration of keywords or NULL if there are no keywords. * @stable ICU 2.8 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 uloc_openKeywords(const char* localeID, UErrorCode* status); @@ -936,7 +960,7 @@ uloc_openKeywords(const char* localeID, * @return the length of keyword value * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getKeywordValue(const char* localeID, const char* keywordName, char* buffer, int32_t bufferCapacity, @@ -973,7 +997,7 @@ uloc_getKeywordValue(const char* localeID, * @see uloc_getKeywordValue * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_setKeywordValue(const char* keywordName, const char* keywordValue, char* buffer, int32_t bufferCapacity, @@ -982,18 +1006,18 @@ uloc_setKeywordValue(const char* keywordName, /** * Returns whether the locale's script is written right-to-left. * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). - * If no likely script is known, then FALSE is returned. + * If no likely script is known, then false is returned. * * A script is right-to-left according to the CLDR script metadata * which corresponds to whether the script's letters have Bidi_Class=R or AL. * - * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". + * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl". * * @param locale input locale ID - * @return TRUE if the locale's script is written right-to-left + * @return true if the locale's script is written right-to-left * @stable ICU 54 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uloc_isRightToLeft(const char *locale); /** @@ -1017,7 +1041,7 @@ typedef enum { * @return an enum indicating the layout orientation for characters. * @stable ICU 4.0 */ -U_STABLE ULayoutType U_EXPORT2 +U_CAPI ULayoutType U_EXPORT2 uloc_getCharacterOrientation(const char* localeId, UErrorCode *status); @@ -1029,38 +1053,54 @@ uloc_getCharacterOrientation(const char* localeId, * @return an enum indicating the layout orientation for lines. * @stable ICU 4.0 */ -U_STABLE ULayoutType U_EXPORT2 +U_CAPI ULayoutType U_EXPORT2 uloc_getLineOrientation(const char* localeId, UErrorCode *status); /** - * enums for the 'outResult' parameter return value + * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter. + * * @see uloc_acceptLanguageFromHTTP * @see uloc_acceptLanguage * @stable ICU 3.2 */ typedef enum { - ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */ - ULOC_ACCEPT_VALID = 1, /* An exact match was found. */ - ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example, - Accept list contained 'ja_JP' - which matched available locale 'ja'. */ + /** + * No exact match was found. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_FAILED = 0, + /** + * An exact match was found. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_VALID = 1, + /** + * A fallback was found. For example, the Accept-Language list includes 'ja_JP' + * and is matched with available locale 'ja'. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_FALLBACK = 2 /* */ } UAcceptResult; - /** * Based on a HTTP header from a web browser and a list of available locales, * determine an acceptable locale for the user. + * + * This is a thin wrapper over C++ class LocaleMatcher. + * * @param result - buffer to accept the result locale * @param resultAvailable the size of the result buffer. * @param outResult - An out parameter that contains the fallback status * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP. * @param availableLocales - list of available locales to match - * @param status Error status, may be BUFFER_OVERFLOW_ERROR + * @param status ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) * @return length needed for the locale. * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char *httpAcceptLanguage, @@ -1070,17 +1110,22 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, /** * Based on a list of available locales, * determine an acceptable locale for the user. + * + * This is a thin wrapper over C++ class LocaleMatcher. + * * @param result - buffer to accept the result locale * @param resultAvailable the size of the result buffer. * @param outResult - An out parameter that contains the fallback status * @param acceptList - list of acceptable languages * @param acceptListCount - count of acceptList items * @param availableLocales - list of available locales to match - * @param status Error status, may be BUFFER_OVERFLOW_ERROR + * @param status ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) * @return length needed for the locale. * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_acceptLanguage(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char **acceptList, int32_t acceptListCount, @@ -1100,7 +1145,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable, * @return actual the actual size of the locale ID, not including NUL-termination * @stable ICU 3.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, UErrorCode *status); @@ -1138,7 +1183,7 @@ uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, * On error, the return value is -1. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_addLikelySubtags(const char* localeID, char* maximizedLocaleID, int32_t maximizedLocaleIDCapacity, @@ -1178,7 +1223,7 @@ uloc_addLikelySubtags(const char* localeID, * On error, the return value is -1. * @stable ICU 4.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_minimizeSubtags(const char* localeID, char* minimizedLocaleID, int32_t minimizedLocaleIDCapacity, @@ -1188,14 +1233,18 @@ uloc_minimizeSubtags(const char* localeID, * Returns a locale ID for the specified BCP47 language tag string. * If the specified language tag contains any ill-formed subtags, * the first such subtag and all following subtags are ignored. - *

    - * This implements the 'Language-Tag' production of BCP47, and so - * supports grandfathered (regular and irregular) as well as private - * use language tags. Private use tags are represented as 'x-whatever', - * and grandfathered tags are converted to their canonical replacements - * where they exist. Note that a few grandfathered tags have no modern - * replacement, these will be converted using the fallback described in + *

    + * This implements the 'Language-Tag' production of BCP 47, and so + * supports legacy language tags (marked as “Type: grandfathered” in BCP 47) + * (regular and irregular) as well as private use language tags. + * + * Private use tags are represented as 'x-whatever', + * and legacy tags are converted to their canonical replacements where they exist. + * + * Note that a few legacy tags have no modern replacement; + * these will be converted using the fallback described in * the first paragraph, so some information might be lost. + * * @param langtag the input BCP47 language tag. * @param localeID the output buffer receiving a locale ID for the * specified BCP47 language tag. @@ -1207,7 +1256,7 @@ uloc_minimizeSubtags(const char* localeID, * @return the length of the locale ID. * @stable ICU 4.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_forLanguageTag(const char* langtag, char* localeID, int32_t localeIDCapacity, @@ -1217,10 +1266,10 @@ uloc_forLanguageTag(const char* langtag, /** * Returns a well-formed language tag for this locale ID. *

    - * Note: When strict is FALSE, any locale + * Note: When strict is false, any locale * fields which do not satisfy the BCP47 syntax requirement will * be omitted from the result. When strict is - * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the + * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the * err if any locale fields do not satisfy the * BCP47 syntax requirement. * @param localeID the input locale ID @@ -1235,7 +1284,7 @@ uloc_forLanguageTag(const char* langtag, * @return The length of the BCP47 language tag. * @stable ICU 4.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uloc_toLanguageTag(const char* localeID, char* langtag, int32_t langtagCapacity, @@ -1263,7 +1312,7 @@ uloc_toLanguageTag(const char* localeID, * @see uloc_toLegacyKey * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toUnicodeLocaleKey(const char* keyword); /** @@ -1294,7 +1343,7 @@ uloc_toUnicodeLocaleKey(const char* keyword); * @see uloc_toLegacyType * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toUnicodeLocaleType(const char* keyword, const char* value); /** @@ -1309,7 +1358,7 @@ uloc_toUnicodeLocaleType(const char* keyword, const char* value); * @see toUnicodeLocaleKey * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toLegacyKey(const char* keyword); /** @@ -1338,7 +1387,7 @@ uloc_toLegacyKey(const char* keyword); * @see toUnicodeLocaleType * @stable ICU 54 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uloc_toLegacyType(const char* keyword, const char* value); #endif /*_ULOC*/ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/umachine.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/umachine.h index c52984cef..545abef59 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/umachine.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/umachine.h @@ -49,12 +49,13 @@ * ANSI C headers: * stddef.h defines wchar_t */ +#include #include /*==========================================================================*/ -/* For C wrappers, we use the symbol U_STABLE. */ +/* For C wrappers, we use the symbol U_CAPI. */ /* This works properly if the includer is C or C++. */ -/* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ +/* Functions are declared U_CAPI return-type U_EXPORT2 function-name()... */ /*==========================================================================*/ /** @@ -107,39 +108,17 @@ /** This is used to declare a function as a public ICU C API @stable ICU 2.0*/ #define U_CAPI U_CFUNC U_EXPORT -/** This is used to declare a function as a stable public ICU C API*/ +/** Obsolete/same as U_CAPI; was used to declare a function as a stable public ICU C API*/ #define U_STABLE U_CAPI -/** This is used to declare a function as a draft public ICU C API */ +/** Obsolete/same as U_CAPI; was used to declare a function as a draft public ICU C API */ #define U_DRAFT U_CAPI /** This is used to declare a function as a deprecated public ICU C API */ #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED -/** This is used to declare a function as an obsolete public ICU C API */ +/** Obsolete/same as U_CAPI; was used to declare a function as an obsolete public ICU C API */ #define U_OBSOLETE U_CAPI -/** This is used to declare a function as an internal ICU C API */ +/** Obsolete/same as U_CAPI; was used to declare a function as an internal ICU C API */ #define U_INTERNAL U_CAPI -/** - * \def U_OVERRIDE - * Defined to the C++11 "override" keyword if available. - * Denotes a class or member which is an override of the base class. - * May result in an error if it applied to something not an override. - * @internal - */ -#ifndef U_OVERRIDE -#define U_OVERRIDE override -#endif - -/** - * \def U_FINAL - * Defined to the C++11 "final" keyword if available. - * Denotes a class or member which may not be overridden in subclasses. - * May result in an error if subclasses attempt to override. - * @internal - */ -#if !defined(U_FINAL) || defined(U_IN_DOXYGEN) -#define U_FINAL final -#endif - // Before ICU 65, function-like, multi-statement ICU macros were just defined as // series of statements wrapped in { } blocks and the caller could choose to // either treat them as if they were actual functions and end the invocation @@ -170,11 +149,11 @@ /** * \def UPRV_BLOCK_MACRO_END - * Defined as "while (FALSE)" by default. + * Defined as "while (false)" by default. * @internal */ #ifndef UPRV_BLOCK_MACRO_END -#define UPRV_BLOCK_MACRO_END while (FALSE) +#define UPRV_BLOCK_MACRO_END while (false) #endif /*==========================================================================*/ @@ -257,18 +236,53 @@ /* Boolean data type */ /*==========================================================================*/ -/** The ICU boolean type @stable ICU 2.0 */ +/** + * The ICU boolean type, a signed-byte integer. + * ICU-specific for historical reasons: The C and C++ standards used to not define type bool. + * Also provides a fixed type definition, as opposed to + * type bool whose details (e.g., sizeof) may vary by compiler and between C and C++. + * + * @stable ICU 2.0 + */ typedef int8_t UBool; +/** + * \def U_DEFINE_FALSE_AND_TRUE + * Normally turns off defining macros FALSE=0 & TRUE=1 in public ICU headers. + * These obsolete macros sometimes break compilation of other code that + * defines enum constants or similar with these names. + * C++ has long defined bool/false/true. + * C99 also added definitions for these, although as macros; see stdbool.h. + * + * You may transitionally define U_DEFINE_FALSE_AND_TRUE=1 if you need time to migrate code. + * + * @internal ICU 68 + */ +#ifdef U_DEFINE_FALSE_AND_TRUE + // Use the predefined value. +#else + // Default to avoiding collision with non-macro definitions of FALSE & TRUE. +# define U_DEFINE_FALSE_AND_TRUE 0 +#endif + +#if U_DEFINE_FALSE_AND_TRUE || defined(U_IN_DOXYGEN) #ifndef TRUE -/** The TRUE value of a UBool @stable ICU 2.0 */ +/** + * The TRUE value of a UBool. + * + * @deprecated ICU 68 Use standard "true" instead. + */ # define TRUE 1 #endif #ifndef FALSE -/** The FALSE value of a UBool @stable ICU 2.0 */ +/** + * The FALSE value of a UBool. + * + * @deprecated ICU 68 Use standard "false" instead. + */ # define FALSE 0 #endif - +#endif // U_DEFINE_FALSE_AND_TRUE /*==========================================================================*/ /* Unicode data types */ @@ -312,7 +326,7 @@ typedef int8_t UBool; /* UChar and UChar32 definitions -------------------------------------------- */ -/** Number of bytes in a UChar. @stable ICU 2.0 */ +/** Number of bytes in a UChar (always 2). @stable ICU 2.0 */ #define U_SIZEOF_UCHAR 2 /** @@ -320,11 +334,7 @@ typedef int8_t UBool; * If 1, then char16_t is a typedef and not a real type (yet) * @internal */ -#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) -// for AIX, uchar.h needs to be included -# include -# define U_CHAR16_IS_TYPEDEF 1 -#elif defined(_MSC_VER) && (_MSC_VER < 1900) +#if defined(_MSC_VER) && (_MSC_VER < 1900) // Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type, // and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx # define U_CHAR16_IS_TYPEDEF 1 @@ -372,10 +382,10 @@ typedef int8_t UBool; typedef char16_t UChar; #elif defined(UCHAR_TYPE) typedef UCHAR_TYPE UChar; -#elif defined(__cplusplus) - typedef char16_t UChar; +#elif U_CPLUSPLUS_VERSION != 0 + typedef char16_t UChar; // C++ #else - typedef uint16_t UChar; + typedef uint16_t UChar; // C #endif /** diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/umisc.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/umisc.h index 213290b9a..4e9dda745 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/umisc.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/umisc.h @@ -21,9 +21,9 @@ /** * \file - * \brief C API:misc definitions + * \brief C API: Miscellaneous definitions * - * This file contains miscellaneous definitions for the C APIs. + * This file contains miscellaneous definitions for the C APIs. */ U_CDECL_BEGIN diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/umutablecptrie.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/umutablecptrie.h index 13e71ef25..d60fd6181 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/umutablecptrie.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/umutablecptrie.h @@ -9,17 +9,19 @@ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/ucpmap.h" #include "unicode/ucptrie.h" #include "unicode/utf8.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + U_CDECL_BEGIN /** * \file - * - * This file defines a mutable Unicode code point trie. + * \brief C API: This file defines a mutable Unicode code point trie. * * @see UCPTrie * @see UMutableCPTrie @@ -28,7 +30,7 @@ U_CDECL_BEGIN /** * Mutable Unicode code point trie. * Fast map from Unicode code points (U+0000..U+10FFFF) to 32-bit integer values. - * For details see http://site.icu-project.org/design/struct/utrie + * For details see https://icu.unicode.org/design/struct/utrie * * Setting values (especially ranges) and lookup is fast. * The mutable trie is only somewhat space-efficient. @@ -83,25 +85,6 @@ umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode); U_CAPI void U_EXPORT2 umutablecptrie_close(UMutableCPTrie *trie); -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUMutableCPTriePointer - * "Smart pointer" class, closes a UMutableCPTrie via umutablecptrie_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 63 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close); - -U_NAMESPACE_END - -#endif - /** * Creates a mutable trie with the same contents as the UCPMap. * You must umutablecptrie_close() the mutable trie once you are done using it. @@ -235,4 +218,23 @@ umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieVal U_CDECL_END +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUMutableCPTriePointer + * "Smart pointer" class, closes a UMutableCPTrie via umutablecptrie_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 63 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close); + +U_NAMESPACE_END + +#endif + #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/unifilt.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/unifilt.h index 420e1a190..0fcaf4b78 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/unifilt.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/unifilt.h @@ -40,8 +40,8 @@ U_NAMESPACE_BEGIN * * UnicodeFilter defines a protocol for selecting a * subset of the full range (U+0000 to U+10FFFF) of Unicode characters. - * Currently, filters are used in conjunction with classes like {@link - * Transliterator} to only process selected characters through a + * Currently, filters are used in conjunction with classes like + * {@link Transliterator} to only process selected characters through a * transformation. * *

    Note: UnicodeFilter currently stubs out two pure virtual methods @@ -77,7 +77,7 @@ class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher * @return clone, or nullptr if an error occurred * @stable ICU 2.4 */ - virtual UnicodeFilter* clone() const = 0; + virtual UnicodeFilter* clone() const override = 0; /** * Returns true for characters that are in the selected @@ -93,7 +93,7 @@ class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher * and return the pointer. * @stable ICU 2.4 */ - virtual UnicodeMatcher* toMatcher() const; + virtual UnicodeMatcher* toMatcher() const override; /** * Implement UnicodeMatcher API. @@ -102,13 +102,13 @@ class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher virtual UMatchDegree matches(const Replaceable& text, int32_t& offset, int32_t limit, - UBool incremental); + UBool incremental) override; /** * UnicodeFunctor API. Nothing to do. * @stable ICU 2.4 */ - virtual void setData(const TransliterationRuleData*); + virtual void setData(const TransliterationRuleData*) override; /** * ICU "poor man's RTTI", returns a UClassID for this class. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/unifunct.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/unifunct.h index 7d31af7da..875130249 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/unifunct.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/unifunct.h @@ -93,14 +93,14 @@ class U_COMMON_API UnicodeFunctor : public UObject { * *

    Concrete subclasses of UnicodeFunctor should use the macro * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to - * provide definitios getStaticClassID and getDynamicClassID. + * provide definitions getStaticClassID and getDynamicClassID. * * @return The class ID for this object. All objects of a given * class have the same class ID. Objects of other classes have * different class IDs. * @stable ICU 2.4 */ - virtual UClassID getDynamicClassID(void) const = 0; + virtual UClassID getDynamicClassID(void) const override = 0; /** * Set the data object associated with this functor. The data diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/unimatch.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/unimatch.h index 5a192b1b4..302332f45 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/unimatch.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/unimatch.h @@ -115,11 +115,11 @@ class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an int * considered for matching will be text.charAt(limit-1) in the * forward direction or text.charAt(limit+1) in the backward * direction. - * @param incremental if TRUE, then assume further characters may + * @param incremental if true, then assume further characters may * be inserted at limit and check for partial matching. Otherwise * assume the text as given is complete. * @return a match degree value indicating a full match, a partial - * match, or a mismatch. If incremental is FALSE then + * match, or a mismatch. If incremental is false then * U_PARTIAL_MATCH should never be returned. * @stable ICU 2.4 */ @@ -134,17 +134,17 @@ class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an int * will produce another matcher that is equal to this one. * @param result the string to receive the pattern. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. * @stable ICU 2.4 */ virtual UnicodeString& toPattern(UnicodeString& result, - UBool escapeUnprintable = FALSE) const = 0; + UBool escapeUnprintable = false) const = 0; /** - * Returns TRUE if this matcher will match a character c, where c + * Returns true if this matcher will match a character c, where c * & 0xFF == v, at offset, in the forward direction (with limit > * offset). This is used by RuleBasedTransliterator for * indexing. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uniset.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uniset.h index 623f8087e..84774d9f3 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uniset.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uniset.h @@ -124,8 +124,8 @@ class RuleCharacterIterator; * "[:Lu:]" and the Perl-like syntax "\\p{Lu}" are recognized. For a * complete list of supported property patterns, see the User's Guide * for UnicodeSet at - * - * http://icu-project.org/userguide/unicodeSet.html. + * + * https://unicode-org.github.io/icu/userguide/strings/unicodeset. * Actual determination of property data is defined by the underlying * Unicode database as implemented by UCharacter. * @@ -136,6 +136,13 @@ class RuleCharacterIterator; * their delimiters; "[:^foo]" and "\\P{foo}". In any other location, * '^' has no special meaning. * + *

    Since ICU 70, "[^...]", "[:^foo]", "\\P{foo}", and "[:binaryProperty=No:]" + * perform a “code point complement” (all code points minus the original set), + * removing all multicharacter strings, + * equivalent to .complement().removeAllStrings(). + * The complement() API function continues to perform a + * symmetric difference with all code points and thus retains all multicharacter strings. + * *

    Ranges are indicated by placing two a '-' between two * characters, as in "a-z". This specifies the range of all * characters from the left to the right, in Unicode order. If the @@ -178,8 +185,6 @@ class RuleCharacterIterator; * Unicode property * * - *

    Warning: you cannot add an empty string ("") to a UnicodeSet.

    - * *

    Formal syntax

    * * \htmlonly
    \endhtmlonly @@ -219,9 +224,8 @@ class RuleCharacterIterator; * * * hex :=  - * any character for which - * Character.digit(c, 16) - * returns a non-negative result + * '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
    + *     'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
    * * * property :=  @@ -265,7 +269,7 @@ class RuleCharacterIterator; * * * \htmlonly
    \endhtmlonly - * + * *

    Note: * - Most UnicodeSet methods do not take a UErrorCode parameter because * there are usually very few opportunities for failure other than a shortage @@ -278,7 +282,7 @@ class RuleCharacterIterator; * @author Alan Liu * @stable ICU 2.0 */ -class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { +class U_COMMON_API UnicodeSet final : public UnicodeFilter { private: /** * Enough for sets with few ranges. @@ -293,8 +297,8 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { int32_t len = 1; // length of list used; 1 <= len <= capacity uint8_t fFlags = 0; // Bit flag (see constants above) - BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not NULL. - UChar32* buffer = nullptr; // internal buffer, may be NULL + BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not nullptr. + UChar32* buffer = nullptr; // internal buffer, may be nullptr int32_t bufferCapacity = 0; // capacity of buffer /** @@ -325,7 +329,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * A bogus set has no value. It is different from an empty set. * It can be used to indicate that no set value is available. * - * @return TRUE if the set is bogus/invalid, FALSE otherwise + * @return true if the set is bogus/invalid, false otherwise * @see setToBogus() * @stable ICU 4.0 */ @@ -333,7 +337,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Make this UnicodeSet object invalid. - * The string will test TRUE with isBogus(). + * The string will test true with isBogus(). * * A bogus set has no value. It is different from an empty set. * It can be used to indicate that no set value is available. @@ -426,9 +430,11 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * description for the syntax of the pattern language. * @param pattern a string specifying what characters are in the set * @param options bitmask for options to apply to the pattern. - * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * Valid options are USET_IGNORE_SPACE and + * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. * @param symbols a symbol table mapping variable names to values - * and stand-in characters to UnicodeSets; may be NULL + * and stand-in characters to UnicodeSets; may be nullptr * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * @internal @@ -446,9 +452,11 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * @param pos on input, the position in pattern at which to start parsing. * On output, the position after the last character parsed. * @param options bitmask for options to apply to the pattern. - * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * Valid options are USET_IGNORE_SPACE and + * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. * @param symbols a symbol table mapping variable names to values - * and stand-in characters to UnicodeSets; may be NULL + * and stand-in characters to UnicodeSets; may be nullptr * @param status input-output error code * @stable ICU 2.8 */ @@ -505,7 +513,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * @see cloneAsThawed * @stable ICU 2.0 */ - virtual UnicodeSet* clone() const; + virtual UnicodeSet* clone() const override; /** * Returns the hash code value for this set. @@ -535,7 +543,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * @stable ICU 4.2 */ inline static const UnicodeSet *fromUSet(const USet *uset); - + /** * Produce a USet * pointer for this UnicodeSet. * USet is the plain C type for UnicodeSet @@ -563,7 +571,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Determines whether the set has been frozen (made immutable) or not. * See the ICU4J Freezable interface for details. - * @return TRUE/FALSE for whether the set has been frozen + * @return true/false for whether the set has been frozen * @see freeze * @see cloneAsThawed * @stable ICU 3.8 @@ -601,7 +609,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Make this object represent the range `start - end`. - * If `end > start` then this object is set to an empty range. + * If `start > end` then this object is set to an empty range. * A frozen set will not be modified. * * @param start first character in the set, inclusive @@ -641,9 +649,11 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * A frozen set will not be modified. * @param pattern a string specifying what characters are in the set * @param options bitmask for options to apply to the pattern. - * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * Valid options are USET_IGNORE_SPACE and + * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. * @param symbols a symbol table mapping variable names to - * values and stand-ins to UnicodeSets; may be NULL + * values and stand-ins to UnicodeSets; may be nullptr * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * Empties the set passed before applying the pattern. @@ -679,9 +689,11 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * pattern.length() if the closing ']' is the last character of * the pattern string. * @param options bitmask for options to apply to the pattern. - * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * Valid options are USET_IGNORE_SPACE and + * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. * @param symbols a symbol table mapping variable names to - * values and stand-ins to UnicodeSets; may be NULL + * values and stand-ins to UnicodeSets; may be nullptr * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * @return a reference to this @@ -700,14 +712,14 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * A frozen set will not be modified. * @param result the string to receive the rules. Previous * contents will be deleted. - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. * @stable ICU 2.0 */ virtual UnicodeString& toPattern(UnicodeString& result, - UBool escapeUnprintable = FALSE) const; + UBool escapeUnprintable = false) const override; /** * Modifies this set to contain those code points which have the given value @@ -773,8 +785,12 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * Note than the elements of a set may include both individual * codepoints and strings. * + * This is slower than getRangeCount() because + * it counts the code points of all ranges. + * * @return the number of elements in this set (its cardinality). * @stable ICU 2.0 + * @see getRangeCount */ virtual int32_t size(void) const; @@ -786,6 +802,12 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { */ virtual UBool isEmpty(void) const; + /** + * @return true if this set contains multi-character strings or the empty string. + * @stable ICU 70 + */ + UBool hasStrings() const; + /** * Returns true if this set contains the given character. * This function works faster with a frozen set. @@ -793,7 +815,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * @return true if the test condition is met * @stable ICU 2.0 */ - virtual UBool contains(UChar32 c) const; + virtual UBool contains(UChar32 c) const override; /** * Returns true if this set contains every character @@ -1002,7 +1024,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { virtual UMatchDegree matches(const Replaceable& text, int32_t& offset, int32_t limit, - UBool incremental); + UBool incremental) override; private: /** @@ -1051,7 +1073,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * @param toUnionTo the set into which to union the source characters * @stable ICU 2.4 */ - virtual void addMatchSetTo(UnicodeSet& toUnionTo) const; + virtual void addMatchSetTo(UnicodeSet& toUnionTo) const override; /** * Returns the index of the given character within this set, where @@ -1066,8 +1088,14 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Returns the character at the given index within this set, where * the set is ordered by ascending code point. If the index is - * out of range, return (UChar32)-1. The inverse of this method is - * indexOf(). + * out of range for characters, returns (UChar32)-1. + * The inverse of this method is indexOf(). + * + * For iteration, this is slower than UnicodeSetIterator or + * getRangeCount()/getRangeStart()/getRangeEnd(), + * because for each call it skips linearly over index + * characters in the ranges. + * * @param index an index from 0..size()-1 * @return the character at the given index, or (UChar32)-1. * @stable ICU 2.4 @@ -1077,7 +1105,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Adds the specified range to this set if it is not already * present. If this set already contains the specified range, - * the call leaves this set unchanged. If end > start + * the call leaves this set unchanged. If start > end * then an empty range is added, leaving the set unchanged. * This is equivalent to a boolean logic OR, or a set UNION. * A frozen set will not be modified. @@ -1095,6 +1123,9 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * present. If this set already contains the specified character, * the call leaves this set unchanged. * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining * @stable ICU 2.0 */ UnicodeSet& add(UChar32 c); @@ -1104,8 +1135,8 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * present. If this set already contains the multicharacter, * the call leaves this set unchanged. * Thus "ch" => {"ch"} - *
    Warning: you cannot add an empty string ("") to a UnicodeSet. * A frozen set will not be modified. + * * @param s the source string * @return this object, for chaining * @stable ICU 2.4 @@ -1124,8 +1155,8 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { public: /** - * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"} - * If this set already any particular character, it has no effect on that character. + * Adds each of the characters in this string to the set. Note: "ch" => {"c", "h"} + * If this set already contains any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining @@ -1135,7 +1166,6 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Retains EACH of the characters in this string. Note: "ch" == {"c", "h"} - * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining @@ -1145,7 +1175,6 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Complement EACH of the characters in this string. Note: "ch" == {"c", "h"} - * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining @@ -1155,7 +1184,6 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Remove EACH of the characters in this string. Note: "ch" == {"c", "h"} - * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining @@ -1165,7 +1193,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Makes a set from a multicharacter string. Thus "ch" => {"ch"} - *
    Warning: you cannot add an empty string ("") to a UnicodeSet. + * * @param s the source string * @return a newly created set containing the given string. * The caller owns the return object and is responsible for deleting it. @@ -1185,15 +1213,13 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Retain only the elements in this set that are contained in the - * specified range. If end > start then an empty range is + * specified range. If start > end then an empty range is * retained, leaving the set empty. This is equivalent to * a boolean logic AND, or a set INTERSECTION. * A frozen set will not be modified. * - * @param start first character, inclusive, of range to be retained - * to this set. - * @param end last character, inclusive, of range to be retained - * to this set. + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range * @stable ICU 2.0 */ virtual UnicodeSet& retain(UChar32 start, UChar32 end); @@ -1202,14 +1228,29 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Retain the specified character from this set if it is present. * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining * @stable ICU 2.0 */ UnicodeSet& retain(UChar32 c); + /** + * Retains only the specified string from this set if it is present. + * Upon return this set will be empty if it did not contain s, or + * will only contain s if it did contain s. + * A frozen set will not be modified. + * + * @param s the source string + * @return this object, for chaining + * @stable ICU 69 + */ + UnicodeSet& retain(const UnicodeString &s); + /** * Removes the specified range from this set if it is present. * The set will not contain the specified range once the call - * returns. If end > start then an empty range is + * returns. If start > end then an empty range is * removed, leaving the set unchanged. * A frozen set will not be modified. * @@ -1226,6 +1267,9 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * The set will not contain the specified range once the call * returns. * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining * @stable ICU 2.0 */ UnicodeSet& remove(UChar32 c); @@ -1242,26 +1286,29 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { UnicodeSet& remove(const UnicodeString& s); /** - * Inverts this set. This operation modifies this set so that - * its value is its complement. This is equivalent to + * This is equivalent to * complement(MIN_VALUE, MAX_VALUE). + * + * Note: This performs a symmetric difference with all code points + * and thus retains all multicharacter strings. + * In order to achieve a “code point complement” (all code points minus this set), + * the easiest is to .complement().removeAllStrings(). + * * A frozen set will not be modified. * @stable ICU 2.0 */ - virtual UnicodeSet& complement(void); + virtual UnicodeSet& complement(); /** * Complements the specified range in this set. Any character in * the range will be removed if it is in this set, or will be - * added if it is not in this set. If end > start + * added if it is not in this set. If start > end * then an empty range is complemented, leaving the set unchanged. * This is equivalent to a boolean logic XOR. * A frozen set will not be modified. * - * @param start first character, inclusive, of range to be removed - * from this set. - * @param end last character, inclusive, of range to be removed - * from this set. + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range * @stable ICU 2.0 */ virtual UnicodeSet& complement(UChar32 start, UChar32 end); @@ -1271,16 +1318,18 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * will be removed if it is in this set, or will be added if it is * not in this set. * A frozen set will not be modified. + * + * @param c the character (code point) + * @return this object, for chaining * @stable ICU 2.0 */ UnicodeSet& complement(UChar32 c); /** * Complement the specified string in this set. - * The set will not contain the specified string once the call - * returns. - *
    Warning: you cannot add an empty string ("") to a UnicodeSet. + * The string will be removed if it is in this set, or will be added if it is not in this set. * A frozen set will not be modified. + * * @param s the string to complement * @return this object, for chaining * @stable ICU 2.4 @@ -1349,7 +1398,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { /** * Close this set over the given attribute. For the attribute - * USET_CASE, the result is to modify this set so that: + * USET_CASE_INSENSITIVE, the result is to modify this set so that: * * 1. For each character or string 'a' in this set, all strings or * characters 'b' such that foldCase(a) == foldCase(b) are added @@ -1367,8 +1416,10 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * A frozen set will not be modified. * * @param attribute bitmask for attributes to close over. - * Currently only the USET_CASE bit is supported. Any undefined bits - * are ignored. + * Valid options: + * At most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. + * Unrelated options bits are ignored. * @return a reference to this set. * @stable ICU 4.2 */ @@ -1447,7 +1498,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * bits followed by least significant 16 bits. * * @param dest pointer to buffer of destCapacity 16-bit integers. - * May be NULL only if destCapacity is zero. + * May be nullptr only if destCapacity is zero. * @param destCapacity size of dest, or zero. Must not be negative. * @param ec error code. Will be set to U_INDEX_OUTOFBOUNDS_ERROR * if n+2*m > 0x7FFF. Will be set to U_BUFFER_OVERFLOW_ERROR if @@ -1488,7 +1539,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * different class IDs. * @stable ICU 2.4 */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID(void) const override; private: @@ -1509,7 +1560,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * is the given value. This is used by RuleBasedTransliterator for * indexing. */ - virtual UBool matchesIndexValue(uint8_t v) const; + virtual UBool matchesIndexValue(uint8_t v) const override; private: friend class RBBIRuleScanner; @@ -1538,6 +1589,9 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { int32_t depth, UErrorCode& ec); + void closeOverCaseInsensitive(bool simple); + void closeOverAddCaseMappings(); + //---------------------------------------------------------------- // Implementation: Utility methods //---------------------------------------------------------------- @@ -1551,7 +1605,6 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { void swapBuffers(void); UBool allocateStrings(UErrorCode &status); - UBool hasStrings() const; int32_t stringsSize() const; UBool stringsContains(const UnicodeString &s) const; @@ -1565,6 +1618,9 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { static void _appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable); + static void _appendToPat(UnicodeString &result, UChar32 start, UChar32 end, + UBool escapeUnprintable); + //---------------------------------------------------------------- // Implementation: Fundamental operators //---------------------------------------------------------------- @@ -1592,7 +1648,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { * * The original design document is out of date, but still useful. * Ignore the property and value names: - * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/unicodeset_properties.html + * https://htmlpreview.github.io/?https://github.com/unicode-org/icu-docs/blob/main/design/unicodeset_properties.html * * Recognized syntax: * @@ -1633,10 +1689,8 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { UnicodeString& rebuiltPat, UErrorCode& ec); - static const UnicodeSet* getInclusions(int32_t src, UErrorCode &status); - /** - * A filter that returns TRUE if the given code point should be + * A filter that returns true if the given code point should be * included in the UnicodeSet being constructed. */ typedef UBool (*Filter)(UChar32 codePoint, void* context); @@ -1655,11 +1709,6 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { const UnicodeSet* inclusions, UErrorCode &status); - // UCPMap is now stable ICU 63 - void applyIntPropertyValue(const UCPMap *map, - UCPMapValueFilter *filter, const void *context, - UErrorCode &errorCode); - /** * Set the new pattern to cache. */ @@ -1682,7 +1731,7 @@ inline bool UnicodeSet::operator!=(const UnicodeSet& o) const { } inline UBool UnicodeSet::isFrozen() const { - return (UBool)(bmpSet!=NULL || stringSpan!=NULL); + return (UBool)(bmpSet!=nullptr || stringSpan!=nullptr); } inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const { diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/unistr.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/unistr.h index b7c87e6b8..4074e8d07 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/unistr.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/unistr.h @@ -44,9 +44,10 @@ struct UConverter; // unicode/ucnv.h #ifndef USTRING_H /** * \ingroup ustring_ustrlen + * @param s Pointer to sequence of UChars. + * @return Length of sequence. */ -U_STABLE int32_t U_EXPORT2 -u_strlen(const UChar *s); +U_CAPI int32_t U_EXPORT2 u_strlen(const UChar *s); #endif U_NAMESPACE_BEGIN @@ -113,9 +114,9 @@ class UnicodeStringAppendable; // unicode/appendable.h * @stable ICU 2.0 */ #if !U_CHAR16_IS_TYPEDEF -# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) +# define UNICODE_STRING(cs, _length) icu::UnicodeString(true, u ## cs, _length) #else -# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length) +# define UNICODE_STRING(cs, _length) icu::UnicodeString(true, (const char16_t*)u ## cs, _length) #endif /** @@ -163,7 +164,7 @@ class UnicodeStringAppendable; // unicode/appendable.h #ifndef UNISTR_FROM_STRING_EXPLICIT # if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) // Auto-"explicit" in ICU library code. -# define UNISTR_FROM_STRING_EXPLICIT +# define UNISTR_FROM_STRING_EXPLICIT explicit # else // Empty by default for source code compatibility. # define UNISTR_FROM_STRING_EXPLICIT @@ -227,7 +228,7 @@ class UnicodeStringAppendable; // unicode/appendable.h * The UnicodeString class is not suitable for subclassing. * * For an overview of Unicode strings in C and C++ see the - * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Strings-in-C-C-). + * [User Guide Strings chapter](https://unicode-org.github.io/icu/userguide/strings#strings-in-cc). * * In ICU, a Unicode string consists of 16-bit Unicode *code units*. * A Unicode character may be stored with either one code unit @@ -252,7 +253,7 @@ class UnicodeStringAppendable; // unicode/appendable.h * target object, e.g., calling str.append(str), an extra copy may take place * to ensure safety. * - If primitive string pointer values (e.g., const char16_t * or char *) - * for input strings are NULL, then those input string parameters are treated + * for input strings are nullptr, then those input string parameters are treated * as if they pointed to an empty string. * However, this is *not* the case for char * parameters for charset names * or other IDs. @@ -285,7 +286,7 @@ class UnicodeStringAppendable; // unicode/appendable.h * significant performance improvements. * Also, the internal buffer is accessible via special functions. * For details see the - * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Maximizing-Performance-with-the-UnicodeString-Storage-Model). + * [User Guide Strings chapter](https://unicode-org.github.io/icu/userguide/strings#maximizing-performance-with-the-unicodestring-storage-model). * * @see utf.h * @see CharacterIterator @@ -320,8 +321,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Equality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if `text` contains the same characters as this one, - * FALSE otherwise. + * @return true if `text` contains the same characters as this one, + * false otherwise. * @stable ICU 2.0 */ inline bool operator== (const UnicodeString& text) const; @@ -329,8 +330,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Inequality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return FALSE if `text` contains the same characters as this one, - * TRUE otherwise. + * @return false if `text` contains the same characters as this one, + * true otherwise. * @stable ICU 2.0 */ inline bool operator!= (const UnicodeString& text) const; @@ -338,38 +339,38 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Greater than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * greater than the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * greater than the characters in `text`, false otherwise * @stable ICU 2.0 */ - inline bool operator> (const UnicodeString& text) const; + inline UBool operator> (const UnicodeString& text) const; /** * Less than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * less than the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * less than the characters in `text`, false otherwise * @stable ICU 2.0 */ - inline bool operator< (const UnicodeString& text) const; + inline UBool operator< (const UnicodeString& text) const; /** * Greater than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * greater than or equal to the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * greater than or equal to the characters in `text`, false otherwise * @stable ICU 2.0 */ - inline bool operator>= (const UnicodeString& text) const; + inline UBool operator>= (const UnicodeString& text) const; /** * Less than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if the characters in this are bitwise - * less than or equal to the characters in `text`, FALSE otherwise + * @return true if the characters in this are bitwise + * less than or equal to the characters in `text`, false otherwise * @stable ICU 2.0 */ - inline bool operator<= (const UnicodeString& text) const; + inline UBool operator<= (const UnicodeString& text) const; /** * Compare the characters bitwise in this UnicodeString to @@ -855,8 +856,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this starts with the characters in `text` * @param text The text to match. - * @return TRUE if this starts with the characters in `text`, - * FALSE otherwise + * @return true if this starts with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UnicodeString& text) const; @@ -867,8 +868,8 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcText The text to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcText` to match - * @return TRUE if this starts with the characters in `text`, - * FALSE otherwise + * @return true if this starts with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UnicodeString& srcText, @@ -879,8 +880,8 @@ class U_COMMON_API UnicodeString : public Replaceable * Determine if this starts with the characters in `srcChars` * @param srcChars The characters to match. * @param srcLength the number of characters in `srcChars` - * @return TRUE if this starts with the characters in `srcChars`, - * FALSE otherwise + * @return true if this starts with the characters in `srcChars`, + * false otherwise * @stable ICU 2.0 */ inline UBool startsWith(ConstChar16Ptr srcChars, @@ -892,7 +893,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcChars The characters to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcChars` to match - * @return TRUE if this ends with the characters in `srcChars`, FALSE otherwise + * @return true if this ends with the characters in `srcChars`, false otherwise * @stable ICU 2.0 */ inline UBool startsWith(const char16_t *srcChars, @@ -902,8 +903,8 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this ends with the characters in `text` * @param text The text to match. - * @return TRUE if this ends with the characters in `text`, - * FALSE otherwise + * @return true if this ends with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UnicodeString& text) const; @@ -914,8 +915,8 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcText The text to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcText` to match - * @return TRUE if this ends with the characters in `text`, - * FALSE otherwise + * @return true if this ends with the characters in `text`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UnicodeString& srcText, @@ -926,8 +927,8 @@ class U_COMMON_API UnicodeString : public Replaceable * Determine if this ends with the characters in `srcChars` * @param srcChars The characters to match. * @param srcLength the number of characters in `srcChars` - * @return TRUE if this ends with the characters in `srcChars`, - * FALSE otherwise + * @return true if this ends with the characters in `srcChars`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(ConstChar16Ptr srcChars, @@ -939,8 +940,8 @@ class U_COMMON_API UnicodeString : public Replaceable * @param srcChars The characters to match. * @param srcStart the offset into `srcText` to start matching * @param srcLength the number of characters in `srcChars` to match - * @return TRUE if this ends with the characters in `srcChars`, - * FALSE otherwise + * @return true if this ends with the characters in `srcChars`, + * false otherwise * @stable ICU 2.0 */ inline UBool endsWith(const char16_t *srcChars, @@ -1525,7 +1526,7 @@ class U_COMMON_API UnicodeString : public Replaceable */ virtual void extractBetween(int32_t start, int32_t limit, - UnicodeString& target) const; + UnicodeString& target) const override; /** * Copy the characters in the range @@ -1541,10 +1542,10 @@ class U_COMMON_API UnicodeString : public Replaceable * * @param start offset of first character which will be copied * @param startLength the number of characters to extract - * @param target the target buffer for extraction, can be NULL + * @param target the target buffer for extraction, can be nullptr * if targetLength is 0 * @param targetCapacity the length of the target buffer - * @param inv Signature-distinguishing paramater, use US_INV. + * @param inv Signature-distinguishing parameter, use US_INV. * @return the output string length, not including the terminating NUL * @stable ICU 3.2 */ @@ -1570,7 +1571,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param startLength the number of characters to extract * @param target the target buffer for extraction * @param targetLength the length of the target buffer - * If `target` is NULL, then the number of bytes required for + * If `target` is nullptr, then the number of bytes required for * `target` is returned. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 @@ -1603,7 +1604,7 @@ class U_COMMON_API UnicodeString : public Replaceable * If `codepage` is an empty string (`""`), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. - * If `target` is NULL, then the number of bytes required for + * If `target` is nullptr, then the number of bytes required for * `target` is returned. It is assumed that the target is big enough * to fit all of the characters. * @return the output string length, not including the terminating NUL @@ -1638,7 +1639,7 @@ class U_COMMON_API UnicodeString : public Replaceable * If `codepage` is an empty string (`""`), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. - * If `target` is NULL, then the number of bytes required for + * If `target` is nullptr, then the number of bytes required for * `target` is returned. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 @@ -1656,10 +1657,10 @@ class U_COMMON_API UnicodeString : public Replaceable * This function avoids the overhead of opening and closing a converter if * multiple strings are extracted. * - * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param dest destination string buffer, can be nullptr if destCapacity==0 * @param destCapacity the number of chars available at dest * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called), - * or NULL for the default converter + * or nullptr for the default converter * @param errorCode normal ICU error code * @return the length of the output string, not counting the terminating NUL; * if the length is greater than destCapacity, then the string will not fit @@ -1736,7 +1737,7 @@ class U_COMMON_API UnicodeString : public Replaceable * Unpaired surrogates are replaced with U+FFFD. * Calls u_strToUTF32WithSub(). * - * @param utf32 destination string buffer, can be NULL if capacity==0 + * @param utf32 destination string buffer, can be nullptr if capacity==0 * @param capacity the number of UChar32s available at utf32 * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns @@ -1804,7 +1805,7 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this string is empty. - * @return TRUE if this string contains 0 characters, FALSE otherwise. + * @return true if this string contains 0 characters, false otherwise. * @stable ICU 2.0 */ inline UBool isEmpty(void) const; @@ -1832,12 +1833,12 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Determine if this object contains a valid string. * A bogus string has no value. It is different from an empty string, - * although in both cases isEmpty() returns TRUE and length() returns 0. + * although in both cases isEmpty() returns true and length() returns 0. * setToBogus() and isBogus() can be used to indicate that no string value is available. - * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and + * For a bogus string, getBuffer() and getTerminatedBuffer() return nullptr, and * length() returns 0. * - * @return TRUE if the string is bogus/invalid, FALSE otherwise + * @return true if the string is bogus/invalid, false otherwise * @see setToBogus() * @stable ICU 2.0 */ @@ -1905,14 +1906,14 @@ class U_COMMON_API UnicodeString : public Replaceable * @return *this * @stable ICU 56 */ - UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT; + UnicodeString &operator=(UnicodeString &&src) noexcept; /** * Swap strings. * @param other other string * @stable ICU 56 */ - void swap(UnicodeString &other) U_NOEXCEPT; + void swap(UnicodeString &other) noexcept; /** * Non-member UnicodeString swap function. @@ -1921,7 +1922,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @stable ICU 56 */ friend inline void U_EXPORT2 - swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT { + swap(UnicodeString &s1, UnicodeString &s2) noexcept { s1.swap(s2); } @@ -2067,11 +2068,11 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Make this UnicodeString object invalid. - * The string will test TRUE with isBogus(). + * The string will test true with isBogus(). * * A bogus string has no value. It is different from an empty string. * It can be used to indicate that no string value is available. - * getBuffer() and getTerminatedBuffer() return NULL, and + * getBuffer() and getTerminatedBuffer() return nullptr, and * length() returns 0. * * This utility function is used throughout the UnicodeString @@ -2455,14 +2456,14 @@ class U_COMMON_API UnicodeString : public Replaceable */ virtual void handleReplaceBetween(int32_t start, int32_t limit, - const UnicodeString& text); + const UnicodeString& text) override; /** * Replaceable API - * @return TRUE if it has MetaData + * @return true if it has MetaData * @stable ICU 2.4 */ - virtual UBool hasMetaData() const; + virtual UBool hasMetaData() const override; /** * Copy a substring of this object, retaining attribute (out-of-band) @@ -2477,7 +2478,7 @@ class U_COMMON_API UnicodeString : public Replaceable * dest >= limit`. * @stable ICU 2.0 */ - virtual void copy(int32_t start, int32_t limit, int32_t dest); + virtual void copy(int32_t start, int32_t limit, int32_t dest) override; /* Search and replace operations */ @@ -2590,7 +2591,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param targetLength the desired length of the string * @param padChar the character to use for padding. Defaults to * space (U+0020) - * @return TRUE if the text was padded, FALSE otherwise. + * @return true if the text was padded, false otherwise. * @stable ICU 2.0 */ UBool padLeading(int32_t targetLength, @@ -2604,7 +2605,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param targetLength the desired length of the string * @param padChar the character to use for padding. Defaults to * space (U+0020) - * @return TRUE if the text was padded, FALSE otherwise. + * @return true if the text was padded, false otherwise. * @stable ICU 2.0 */ UBool padTrailing(int32_t targetLength, @@ -2613,7 +2614,7 @@ class U_COMMON_API UnicodeString : public Replaceable /** * Truncate this UnicodeString to the `targetLength`. * @param targetLength the desired length of this UnicodeString. - * @return TRUE if the text was truncated, FALSE otherwise + * @return true if the text was truncated, false otherwise * @stable ICU 2.0 */ inline UBool truncate(int32_t targetLength); @@ -2766,7 +2767,6 @@ class U_COMMON_API UnicodeString : public Replaceable * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE, * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. - * @param options Options bit set, see ucasemap_open(). * @return A reference to this. * @stable ICU 3.8 */ @@ -2978,7 +2978,7 @@ class U_COMMON_API UnicodeString : public Replaceable * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` * on the compiler command line or similar. * @param text The characters to place in the UnicodeString. `text` - * must be NULL (U+0000) terminated. + * must be NUL (U+0000) terminated. * @stable ICU 2.0 */ UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text); @@ -3245,7 +3245,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param src input codepage string * @param srcLength length of the input string, can be -1 for NUL-terminated strings * @param cnv converter object (ucnv_resetToUnicode() will be called), - * can be NULL for the default converter + * can be nullptr for the default converter * @param errorCode normal ICU error code * @stable ICU 2.0 */ @@ -3274,7 +3274,7 @@ class U_COMMON_API UnicodeString : public Replaceable * \endcode * @param src String using only invariant characters. * @param textLength Length of src, or -1 if NUL-terminated. - * @param inv Signature-distinguishing paramater, use US_INV. + * @param inv Signature-distinguishing parameter, use US_INV. * * @see US_INV * @stable ICU 3.2 @@ -3306,7 +3306,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @param src source string * @stable ICU 56 */ - UnicodeString(UnicodeString &&src) U_NOEXCEPT; + UnicodeString(UnicodeString &&src) noexcept; /** * 'Substring' constructor from tail of source string. @@ -3329,7 +3329,7 @@ class U_COMMON_API UnicodeString : public Replaceable * Clone this object, an instance of a subclass of Replaceable. * Clones can be used concurrently in multiple threads. * If a subclass does not implement clone(), or if an error occurs, - * then NULL is returned. + * then nullptr is returned. * The caller must delete the clone. * * @return a clone of this object @@ -3338,7 +3338,7 @@ class U_COMMON_API UnicodeString : public Replaceable * @see getDynamicClassID * @stable ICU 2.6 */ - virtual UnicodeString *clone() const; + virtual UnicodeString *clone() const override; /** Destructor. * @stable ICU 2.0 @@ -3365,7 +3365,7 @@ class U_COMMON_API UnicodeString : public Replaceable * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string. * Calls u_strFromUTF32WithSub(). * - * @param utf32 UTF-32 input string. Must not be NULL. + * @param utf32 UTF-32 input string. Must not be nullptr. * @param length Length of the input string, or -1 if NUL-terminated. * @return A UnicodeString with equivalent UTF-16 contents. * @see toUTF32 @@ -3444,7 +3444,7 @@ class U_COMMON_API UnicodeString : public Replaceable * * @stable ICU 2.2 */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; //======================================== // Implementation methods @@ -3455,21 +3455,21 @@ class U_COMMON_API UnicodeString : public Replaceable * Implement Replaceable::getLength() (see jitterbug 1027). * @stable ICU 2.4 */ - virtual int32_t getLength() const; + virtual int32_t getLength() const override; /** * The change in Replaceable to use virtual getCharAt() allows * UnicodeString::charAt() to be inline again (see jitterbug 709). * @stable ICU 2.4 */ - virtual char16_t getCharAt(int32_t offset) const; + virtual char16_t getCharAt(int32_t offset) const override; /** * The change in Replaceable to use virtual getChar32At() allows * UnicodeString::char32At() to be inline again (see jitterbug 709). * @stable ICU 2.4 */ - virtual UChar32 getChar32At(int32_t offset) const; + virtual UChar32 getChar32At(int32_t offset) const override; private: // For char* constructors. Could be made public. @@ -3489,6 +3489,19 @@ class U_COMMON_API UnicodeString : public Replaceable */ UBool doEquals(const UnicodeString &text, int32_t len) const; + inline UBool + doEqualsSubstring(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + UBool doEqualsSubstring(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + inline int8_t doCompare(int32_t start, int32_t length, @@ -3614,11 +3627,11 @@ class U_COMMON_API UnicodeString : public Replaceable // turn a bogus string into an empty one void unBogus(); - // implements assigment operator, copy constructor, and fastCopyFrom() - UnicodeString ©From(const UnicodeString &src, UBool fastCopy=FALSE); + // implements assignment operator, copy constructor, and fastCopyFrom() + UnicodeString ©From(const UnicodeString &src, UBool fastCopy=false); // Copies just the fields without memory management. - void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT; + void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) noexcept; // Pin start and limit to acceptable values. inline void pinIndex(int32_t& start) const; @@ -3668,13 +3681,13 @@ class U_COMMON_API UnicodeString : public Replaceable * the buffer is refCounted (shared), and refCount>1, or * the buffer is too small. * - * Return FALSE if memory could not be allocated. + * Return false if memory could not be allocated. */ UBool cloneArrayIfNeeded(int32_t newCapacity = -1, int32_t growCapacity = -1, - UBool doCopyArray = TRUE, + UBool doCopyArray = true, int32_t **pBufferToDelete = 0, - UBool forceClone = FALSE); + UBool forceClone = false); /** * Common function for UnicodeString case mappings. @@ -3706,7 +3719,7 @@ class U_COMMON_API UnicodeString : public Replaceable kEmptyHashCode=1, // hash code for empty string // bit flag values for fLengthAndFlags - kIsBogus=1, // this string is bogus, i.e., not valid or NULL + kIsBogus=1, // this string is bogus, i.e., not valid or nullptr kUsingStackBuffer=2,// using fUnion.fStackFields instead of fUnion.fFields kRefCounted=4, // there is a refCount field before the characters in fArray kBufferIsReadonly=8,// do not write to this buffer @@ -3946,6 +3959,21 @@ UnicodeString::doCompare(int32_t start, } } +inline UBool +UnicodeString::doEqualsSubstring(int32_t start, + int32_t thisLength, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ + if(srcText.isBogus()) { + return isBogus(); + } else { + srcText.pinIndices(srcStart, srcLength); + return !isBogus() && doEqualsSubstring(start, thisLength, srcText.getArrayStart(), srcStart, srcLength); + } +} + inline bool UnicodeString::operator== (const UnicodeString& text) const { @@ -3961,19 +3989,19 @@ inline bool UnicodeString::operator!= (const UnicodeString& text) const { return (! operator==(text)); } -inline bool +inline UBool UnicodeString::operator> (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) == 1; } -inline bool +inline UBool UnicodeString::operator< (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) == -1; } -inline bool +inline UBool UnicodeString::operator>= (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) != -1; } -inline bool +inline UBool UnicodeString::operator<= (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) != 1; } @@ -4326,20 +4354,20 @@ UnicodeString::lastIndexOf(UChar32 c, inline UBool UnicodeString::startsWith(const UnicodeString& text) const -{ return compare(0, text.length(), text, 0, text.length()) == 0; } +{ return doEqualsSubstring(0, text.length(), text, 0, text.length()); } inline UBool UnicodeString::startsWith(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const -{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; } +{ return doEqualsSubstring(0, srcLength, srcText, srcStart, srcLength); } inline UBool UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const { if(srcLength < 0) { srcLength = u_strlen(toUCharPtr(srcChars)); } - return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; + return doEqualsSubstring(0, srcLength, srcChars, 0, srcLength); } inline UBool @@ -4347,21 +4375,21 @@ UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t sr if(srcLength < 0) { srcLength = u_strlen(toUCharPtr(srcChars)); } - return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0; + return doEqualsSubstring(0, srcLength, srcChars, srcStart, srcLength); } inline UBool UnicodeString::endsWith(const UnicodeString& text) const -{ return doCompare(length() - text.length(), text.length(), - text, 0, text.length()) == 0; } +{ return doEqualsSubstring(length() - text.length(), text.length(), + text, 0, text.length()); } inline UBool UnicodeString::endsWith(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const { srcText.pinIndices(srcStart, srcLength); - return doCompare(length() - srcLength, srcLength, - srcText, srcStart, srcLength) == 0; + return doEqualsSubstring(length() - srcLength, srcLength, + srcText, srcStart, srcLength); } inline UBool @@ -4370,8 +4398,7 @@ UnicodeString::endsWith(ConstChar16Ptr srcChars, if(srcLength < 0) { srcLength = u_strlen(toUCharPtr(srcChars)); } - return doCompare(length() - srcLength, srcLength, - srcChars, 0, srcLength) == 0; + return doEqualsSubstring(length() - srcLength, srcLength, srcChars, 0, srcLength); } inline UBool @@ -4381,8 +4408,8 @@ UnicodeString::endsWith(const char16_t *srcChars, if(srcLength < 0) { srcLength = u_strlen(toUCharPtr(srcChars + srcStart)); } - return doCompare(length() - srcLength, srcLength, - srcChars, srcStart, srcLength) == 0; + return doEqualsSubstring(length() - srcLength, srcLength, + srcChars, srcStart, srcLength); } //======================================== @@ -4712,18 +4739,18 @@ UnicodeString::remove(int32_t start, // remove(guaranteed everything) of a bogus string makes the string empty and non-bogus return remove(); } - return doReplace(start, _length, NULL, 0, 0); + return doReplace(start, _length, nullptr, 0, 0); } inline UnicodeString& UnicodeString::removeBetween(int32_t start, int32_t limit) -{ return doReplace(start, limit - start, NULL, 0, 0); } +{ return doReplace(start, limit - start, nullptr, 0, 0); } inline UnicodeString & UnicodeString::retainBetween(int32_t start, int32_t limit) { truncate(limit); - return doReplace(0, start, NULL, 0, 0); + return doReplace(0, start, nullptr, 0, 0); } inline UBool @@ -4732,12 +4759,12 @@ UnicodeString::truncate(int32_t targetLength) if(isBogus() && targetLength == 0) { // truncate(0) of a bogus string makes the string empty and non-bogus unBogus(); - return FALSE; + return false; } else if((uint32_t)targetLength < (uint32_t)length()) { setLength(targetLength); - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm.h index 09dd366a9..38fb89515 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm.h @@ -115,7 +115,7 @@ * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD. * * For more details on FCD see the collation design document: - * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm + * https://htmlpreview.github.io/?https://github.com/unicode-org/icu-docs/blob/main/design/collation/ICU_collation_design.htm * * ICU collation performs either NFD or FCD normalization automatically if normalization * is turned on for the collator object. @@ -274,7 +274,7 @@ unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will - * perform further tests to arrive at a TRUE/FALSE result. + * perform further tests to arrive at a true/false result. * * @param src String that is to be tested if it is in a normalization format. * @param srcLength Length of source to test, or -1 if NUL-terminated. @@ -358,10 +358,10 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, * It is useful for operations like a normalizing transliterator, where one would * not want to replace a piece of text if it is not modified. * - * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE + * If doNormalize==true and pNeededToNormalize!=NULL then *pNeeded... is set true * if the normalization was necessary. * - * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE. + * If doNormalize==false then *pNeededToNormalize will be set to false. * * If the buffer overflows, then *pNeededToNormalize will be undefined; * essentially, whenever U_FAILURE is true (like in buffer overflows), this result @@ -373,11 +373,11 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, * @param mode The normalization mode. * @param options The normalization options, ORed together (0 for no options). * @param doNormalize Indicates if the source text up to the next boundary - * is to be normalized (TRUE) or just copied (FALSE). + * is to be normalized (true) or just copied (false). * @param pNeededToNormalize Output flag indicating if the normalization resulted in * different text from the input. * Not defined if an error occurs including buffer overflow. - * Always FALSE if !doNormalize. + * Always false if !doNormalize. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Length of output (number of UChars) when successful or buffer overflow. @@ -406,11 +406,11 @@ unorm_next(UCharIterator *src, * @param mode The normalization mode. * @param options The normalization options, ORed together (0 for no options). * @param doNormalize Indicates if the source text up to the next boundary - * is to be normalized (TRUE) or just copied (FALSE). + * is to be normalized (true) or just copied (false). * @param pNeededToNormalize Output flag indicating if the normalization resulted in * different text from the input. * Not defined if an error occurs including buffer overflow. - * Always FALSE if !doNormalize. + * Always false if !doNormalize. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Length of output (number of UChars) when successful or buffer overflow. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm2.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm2.h index a9bd02f25..3844041f1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm2.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/unorm2.h @@ -31,10 +31,13 @@ */ #include "unicode/utypes.h" -#include "unicode/localpointer.h" #include "unicode/stringoptions.h" #include "unicode/uset.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API + /** * Constants for normalization modes. * For details about standard Unicode normalization forms @@ -132,7 +135,7 @@ typedef struct UNormalizer2 UNormalizer2; /**< C typedef for struct UNormalizer * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFCInstance(UErrorCode *pErrorCode); /** @@ -146,7 +149,7 @@ unorm2_getNFCInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFDInstance(UErrorCode *pErrorCode); /** @@ -160,7 +163,7 @@ unorm2_getNFDInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFKCInstance(UErrorCode *pErrorCode); /** @@ -174,11 +177,14 @@ unorm2_getNFKCInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFKDInstance(UErrorCode *pErrorCode); /** - * Returns a UNormalizer2 instance for Unicode NFKC_Casefold normalization. + * Returns a UNormalizer2 instance for Unicode toNFKC_Casefold() normalization + * which is equivalent to applying the NFKC_Casefold mappings and then NFC. + * See https://www.unicode.org/reports/tr44/#NFKC_Casefold + * * Same as unorm2_getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, pErrorCode). * Returns an unmodifiable singleton instance. Do not delete it. * @param pErrorCode Standard ICU error code. Its input value must @@ -188,9 +194,28 @@ unorm2_getNFKDInstance(UErrorCode *pErrorCode); * @return the requested Normalizer2, if successful * @stable ICU 49 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode); +#ifndef U_HIDE_DRAFT_API +/** + * Returns a UNormalizer2 instance for a variant of Unicode toNFKC_Casefold() normalization + * which is equivalent to applying the NFKC_Simple_Casefold mappings and then NFC. + * See https://www.unicode.org/reports/tr44/#NFKC_Simple_Casefold + * + * Same as unorm2_getInstance(NULL, "nfkc_scf", UNORM2_COMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @draft ICU 74 + */ +U_CAPI const UNormalizer2 * U_EXPORT2 +unorm2_getNFKCSimpleCasefoldInstance(UErrorCode *pErrorCode); +#endif // U_HIDE_DRAFT_API + /** * Returns a UNormalizer2 instance which uses the specified data file * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle) @@ -203,7 +228,7 @@ unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode); * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold. * * @param packageName NULL for ICU built-in data, otherwise application data package name - * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file + * @param name "nfc" or "nfkc" or "nfkc_cf" or "nfkc_scf" or name of custom data file * @param mode normalization mode (compose or decompose etc.) * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns @@ -212,7 +237,7 @@ unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode); * @return the requested UNormalizer2, if successful * @stable ICU 4.4 */ -U_STABLE const UNormalizer2 * U_EXPORT2 +U_CAPI const UNormalizer2 * U_EXPORT2 unorm2_getInstance(const char *packageName, const char *name, UNormalization2Mode mode, @@ -233,7 +258,7 @@ unorm2_getInstance(const char *packageName, * @return the requested UNormalizer2, if successful * @stable ICU 4.4 */ -U_STABLE UNormalizer2 * U_EXPORT2 +U_CAPI UNormalizer2 * U_EXPORT2 unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode); /** @@ -242,7 +267,7 @@ unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode * @param norm2 UNormalizer2 instance to be closed * @stable ICU 4.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 unorm2_close(UNormalizer2 *norm2); #if U_SHOW_CPLUSPLUS_API @@ -280,7 +305,7 @@ U_NAMESPACE_END * @return dest * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_normalize(const UNormalizer2 *norm2, const UChar *src, int32_t length, UChar *dest, int32_t capacity, @@ -303,7 +328,7 @@ unorm2_normalize(const UNormalizer2 *norm2, * @return first * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, @@ -326,7 +351,7 @@ unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, * @return first * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_append(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, @@ -351,7 +376,7 @@ unorm2_append(const UNormalizer2 *norm2, * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value * @stable ICU 4.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_getDecomposition(const UNormalizer2 *norm2, UChar32 c, UChar *decomposition, int32_t capacity, UErrorCode *pErrorCode); @@ -385,7 +410,7 @@ unorm2_getDecomposition(const UNormalizer2 *norm2, * @return the non-negative length of c's raw decomposition, if there is one; otherwise a negative value * @stable ICU 49 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_getRawDecomposition(const UNormalizer2 *norm2, UChar32 c, UChar *decomposition, int32_t capacity, UErrorCode *pErrorCode); @@ -405,7 +430,7 @@ unorm2_getRawDecomposition(const UNormalizer2 *norm2, * @return The non-negative composite code point if there is one; otherwise a negative value. * @stable ICU 49 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b); /** @@ -417,7 +442,7 @@ unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b); * @return c's combining class * @stable ICU 49 */ -U_STABLE uint8_t U_EXPORT2 +U_CAPI uint8_t U_EXPORT2 unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c); /** @@ -433,10 +458,10 @@ unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c); * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) - * @return TRUE if s is normalized + * @return true if s is normalized * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_isNormalized(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); @@ -458,7 +483,7 @@ unorm2_isNormalized(const UNormalizer2 *norm2, * @return UNormalizationCheckResult * @stable ICU 4.4 */ -U_STABLE UNormalizationCheckResult U_EXPORT2 +U_CAPI UNormalizationCheckResult U_EXPORT2 unorm2_quickCheck(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); @@ -487,7 +512,7 @@ unorm2_quickCheck(const UNormalizer2 *norm2, * @return "yes" span end index * @stable ICU 4.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); @@ -498,10 +523,10 @@ unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test - * @return TRUE if c has a normalization boundary before it + * @return true if c has a normalization boundary before it * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c); /** @@ -510,10 +535,10 @@ unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c); * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test - * @return TRUE if c has a normalization boundary after it + * @return true if c has a normalization boundary after it * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); /** @@ -521,10 +546,10 @@ unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test - * @return TRUE if c is normalization-inert + * @return true if c is normalization-inert * @stable ICU 4.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); /** @@ -593,7 +618,7 @@ unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); * * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 unorm_compare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uobject.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uobject.h index 25a8330f9..f53ec1d11 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uobject.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uobject.h @@ -32,21 +32,21 @@ /** * \def U_NO_THROW - * Since ICU 64, use U_NOEXCEPT instead. + * Since ICU 64, use noexcept instead. * * Previously, define this to define the throw() specification so * certain functions do not throw any exceptions * * UMemory operator new methods should have the throw() specification - * appended to them, so that the compiler adds the additional NULL check - * before calling constructors. Without, if operator new returns NULL the + * appended to them, so that the compiler adds the additional nullptr check + * before calling constructors. Without, if operator new returns nullptr the * constructor is still called, and if the constructor references member * data, (which it typically does), the result is a segmentation violation. * - * @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422. + * @stable ICU 4.2. Since ICU 64, Use noexcept instead. See ICU-20422. */ #ifndef U_NO_THROW -#define U_NO_THROW U_NOEXCEPT +#define U_NO_THROW noexcept #endif /*===========================================================================*/ @@ -131,14 +131,14 @@ class U_COMMON_API UMemory { * for ICU4C C++ classes * @stable ICU 2.4 */ - static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT; + static void * U_EXPORT2 operator new(size_t size) noexcept; /** * Override for ICU4C C++ memory management. * See new(). * @stable ICU 2.4 */ - static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT; + static void * U_EXPORT2 operator new[](size_t size) noexcept; /** * Override for ICU4C C++ memory management. @@ -148,14 +148,14 @@ class U_COMMON_API UMemory { * for ICU4C C++ classes * @stable ICU 2.4 */ - static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT; + static void U_EXPORT2 operator delete(void *p) noexcept; /** * Override for ICU4C C++ memory management. * See delete(). * @stable ICU 2.4 */ - static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT; + static void U_EXPORT2 operator delete[](void *p) noexcept; #if U_HAVE_PLACEMENT_NEW /** @@ -163,14 +163,14 @@ class U_COMMON_API UMemory { * See new(). * @stable ICU 2.6 */ - static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; } + static inline void * U_EXPORT2 operator new(size_t, void *ptr) noexcept { return ptr; } /** * Override for ICU4C C++ memory management for STL. * See delete(). * @stable ICU 2.6 */ - static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {} + static inline void U_EXPORT2 operator delete(void *, void *) noexcept {} #endif /* U_HAVE_PLACEMENT_NEW */ #if U_HAVE_DEBUG_LOCATION_NEW /** @@ -180,7 +180,7 @@ class U_COMMON_API UMemory { * @param file The file where the allocation was requested * @param line The line where the allocation was requested */ - static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT; + static void * U_EXPORT2 operator new(size_t size, const char* file, int line) noexcept; /** * This method provides a matching delete for the MFC debug new * @@ -188,7 +188,7 @@ class U_COMMON_API UMemory { * @param file The file where the allocation was requested * @param line The line where the allocation was requested */ - static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT; + static void U_EXPORT2 operator delete(void* p, const char* file, int line) noexcept; #endif /* U_HAVE_DEBUG_LOCATION_NEW */ #endif /* U_OVERRIDE_CXX_ALLOCATION */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/urename.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/urename.h index e834a4503..74f2cae51 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/urename.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/urename.h @@ -23,1877 +23,2006 @@ #ifndef URENAME_H #define URENAME_H -// /* U_DISABLE_RENAMING can be defined in the following ways: -// * - when running configure, e.g. -// * runConfigureICU Linux --disable-renaming -// * - by changing the default setting of U_DISABLE_RENAMING in uconfig.h -// */ +/* U_DISABLE_RENAMING can be defined in the following ways: + * - when running configure, e.g. + * runConfigureICU Linux --disable-renaming + * - by changing the default setting of U_DISABLE_RENAMING in uconfig.h + */ -// #include "unicode/uconfig.h" +#include "unicode/uconfig.h" -// #if !U_DISABLE_RENAMING +#if !U_DISABLE_RENAMING -// // Disable Renaming for Visual Studio's IntelliSense feature, so that 'Go-to-Definition' (F12) will work. -// #if !(defined(_MSC_VER) && defined(__INTELLISENSE__)) +// Disable Renaming for Visual Studio's IntelliSense feature, so that 'Go-to-Definition' (F12) will work. +#if !(defined(_MSC_VER) && defined(__INTELLISENSE__)) -// /* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give -// the platform a chance to define it first. -// Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined. -// */ +/* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give + the platform a chance to define it first. + Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined. + */ -// #ifndef U_ICU_ENTRY_POINT_RENAME -// #include "unicode/umachine.h" -// #endif +#ifndef U_ICU_ENTRY_POINT_RENAME +#include "unicode/umachine.h" +#endif -// /* If we still don't have U_ICU_ENTRY_POINT_RENAME use the default. */ -// #ifndef U_ICU_ENTRY_POINT_RENAME -// #include "unicode/uvernum.h" -// #endif +/* If we still don't have U_ICU_ENTRY_POINT_RENAME use the default. */ +#ifndef U_ICU_ENTRY_POINT_RENAME +#include "unicode/uvernum.h" +#endif -// /* Error out before the following defines cause very strange and unexpected code breakage */ -// #ifndef U_ICU_ENTRY_POINT_RENAME -// #error U_ICU_ENTRY_POINT_RENAME is not defined - cannot continue. Consider defining U_DISABLE_RENAMING if renaming should not be used. -// #endif +/* Error out before the following defines cause very strange and unexpected code breakage */ +#ifndef U_ICU_ENTRY_POINT_RENAME +#error U_ICU_ENTRY_POINT_RENAME is not defined - cannot continue. Consider defining U_DISABLE_RENAMING if renaming should not be used. +#endif -// /* C exports renaming data */ +/* C exports renaming data */ -// #define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString) -// #define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString) -// #define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger) -// #define T_CString_toLowerCase U_ICU_ENTRY_POINT_RENAME(T_CString_toLowerCase) -// #define T_CString_toUpperCase U_ICU_ENTRY_POINT_RENAME(T_CString_toUpperCase) -// #define UCNV_FROM_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_ESCAPE) -// #define UCNV_FROM_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SKIP) -// #define UCNV_FROM_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_STOP) -// #define UCNV_FROM_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SUBSTITUTE) -// #define UCNV_TO_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_ESCAPE) -// #define UCNV_TO_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SKIP) -// #define UCNV_TO_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_STOP) -// #define UCNV_TO_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SUBSTITUTE) -// #define UDataMemory_createNewInstance U_ICU_ENTRY_POINT_RENAME(UDataMemory_createNewInstance) -// #define UDataMemory_init U_ICU_ENTRY_POINT_RENAME(UDataMemory_init) -// #define UDataMemory_isLoaded U_ICU_ENTRY_POINT_RENAME(UDataMemory_isLoaded) -// #define UDataMemory_normalizeDataPointer U_ICU_ENTRY_POINT_RENAME(UDataMemory_normalizeDataPointer) -// #define UDataMemory_setData U_ICU_ENTRY_POINT_RENAME(UDataMemory_setData) -// #define UDatamemory_assign U_ICU_ENTRY_POINT_RENAME(UDatamemory_assign) -// #define _ASCIIData U_ICU_ENTRY_POINT_RENAME(_ASCIIData) -// #define _Bocu1Data U_ICU_ENTRY_POINT_RENAME(_Bocu1Data) -// #define _CESU8Data U_ICU_ENTRY_POINT_RENAME(_CESU8Data) -// #define _CompoundTextData U_ICU_ENTRY_POINT_RENAME(_CompoundTextData) -// #define _HZData U_ICU_ENTRY_POINT_RENAME(_HZData) -// #define _IMAPData U_ICU_ENTRY_POINT_RENAME(_IMAPData) -// #define _ISCIIData U_ICU_ENTRY_POINT_RENAME(_ISCIIData) -// #define _ISO2022Data U_ICU_ENTRY_POINT_RENAME(_ISO2022Data) -// #define _LMBCSData1 U_ICU_ENTRY_POINT_RENAME(_LMBCSData1) -// #define _LMBCSData11 U_ICU_ENTRY_POINT_RENAME(_LMBCSData11) -// #define _LMBCSData16 U_ICU_ENTRY_POINT_RENAME(_LMBCSData16) -// #define _LMBCSData17 U_ICU_ENTRY_POINT_RENAME(_LMBCSData17) -// #define _LMBCSData18 U_ICU_ENTRY_POINT_RENAME(_LMBCSData18) -// #define _LMBCSData19 U_ICU_ENTRY_POINT_RENAME(_LMBCSData19) -// #define _LMBCSData2 U_ICU_ENTRY_POINT_RENAME(_LMBCSData2) -// #define _LMBCSData3 U_ICU_ENTRY_POINT_RENAME(_LMBCSData3) -// #define _LMBCSData4 U_ICU_ENTRY_POINT_RENAME(_LMBCSData4) -// #define _LMBCSData5 U_ICU_ENTRY_POINT_RENAME(_LMBCSData5) -// #define _LMBCSData6 U_ICU_ENTRY_POINT_RENAME(_LMBCSData6) -// #define _LMBCSData8 U_ICU_ENTRY_POINT_RENAME(_LMBCSData8) -// #define _Latin1Data U_ICU_ENTRY_POINT_RENAME(_Latin1Data) -// #define _MBCSData U_ICU_ENTRY_POINT_RENAME(_MBCSData) -// #define _SCSUData U_ICU_ENTRY_POINT_RENAME(_SCSUData) -// #define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData) -// #define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data) -// #define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData) -// #define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data) -// #define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData) -// #define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data) -// #define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData) -// #define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data) -// #define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data) -// #define _isUnicodeLocaleTypeSubtag U_ICU_ENTRY_POINT_RENAME(_isUnicodeLocaleTypeSubtag) -// #define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup) -// #define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup) -// #define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup) -// #define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats) -// #define gTimeZoneFilesInitOnce U_ICU_ENTRY_POINT_RENAME(gTimeZoneFilesInitOnce) -// #define initNumsysNames U_ICU_ENTRY_POINT_RENAME(initNumsysNames) -// #define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone) -// #define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close) -// #define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals) -// #define izrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(izrule_getDSTSavings) -// #define izrule_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(izrule_getDynamicClassID) -// #define izrule_getFinalStart U_ICU_ENTRY_POINT_RENAME(izrule_getFinalStart) -// #define izrule_getFirstStart U_ICU_ENTRY_POINT_RENAME(izrule_getFirstStart) -// #define izrule_getName U_ICU_ENTRY_POINT_RENAME(izrule_getName) -// #define izrule_getNextStart U_ICU_ENTRY_POINT_RENAME(izrule_getNextStart) -// #define izrule_getPreviousStart U_ICU_ENTRY_POINT_RENAME(izrule_getPreviousStart) -// #define izrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(izrule_getRawOffset) -// #define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID) -// #define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo) -// #define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open) -// #define locale_getKeywords U_ICU_ENTRY_POINT_RENAME(locale_getKeywords) -// #define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) -// #define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) -// #define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default) -// #define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup) -// #define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun) -// #define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun) -// #define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun) -// #define pl_close U_ICU_ENTRY_POINT_RENAME(pl_close) -// #define pl_closeFontRuns U_ICU_ENTRY_POINT_RENAME(pl_closeFontRuns) -// #define pl_closeLine U_ICU_ENTRY_POINT_RENAME(pl_closeLine) -// #define pl_closeLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_closeLocaleRuns) -// #define pl_closeValueRuns U_ICU_ENTRY_POINT_RENAME(pl_closeValueRuns) -// #define pl_countLineRuns U_ICU_ENTRY_POINT_RENAME(pl_countLineRuns) -// #define pl_create U_ICU_ENTRY_POINT_RENAME(pl_create) -// #define pl_getAscent U_ICU_ENTRY_POINT_RENAME(pl_getAscent) -// #define pl_getDescent U_ICU_ENTRY_POINT_RENAME(pl_getDescent) -// #define pl_getFontRunCount U_ICU_ENTRY_POINT_RENAME(pl_getFontRunCount) -// #define pl_getFontRunFont U_ICU_ENTRY_POINT_RENAME(pl_getFontRunFont) -// #define pl_getFontRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLastLimit) -// #define pl_getFontRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLimit) -// #define pl_getLeading U_ICU_ENTRY_POINT_RENAME(pl_getLeading) -// #define pl_getLineAscent U_ICU_ENTRY_POINT_RENAME(pl_getLineAscent) -// #define pl_getLineDescent U_ICU_ENTRY_POINT_RENAME(pl_getLineDescent) -// #define pl_getLineLeading U_ICU_ENTRY_POINT_RENAME(pl_getLineLeading) -// #define pl_getLineVisualRun U_ICU_ENTRY_POINT_RENAME(pl_getLineVisualRun) -// #define pl_getLineWidth U_ICU_ENTRY_POINT_RENAME(pl_getLineWidth) -// #define pl_getLocaleRunCount U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunCount) -// #define pl_getLocaleRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLastLimit) -// #define pl_getLocaleRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLimit) -// #define pl_getLocaleRunLocale U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLocale) -// #define pl_getParagraphLevel U_ICU_ENTRY_POINT_RENAME(pl_getParagraphLevel) -// #define pl_getTextDirection U_ICU_ENTRY_POINT_RENAME(pl_getTextDirection) -// #define pl_getValueRunCount U_ICU_ENTRY_POINT_RENAME(pl_getValueRunCount) -// #define pl_getValueRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLastLimit) -// #define pl_getValueRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLimit) -// #define pl_getValueRunValue U_ICU_ENTRY_POINT_RENAME(pl_getValueRunValue) -// #define pl_getVisualRunAscent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunAscent) -// #define pl_getVisualRunDescent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDescent) -// #define pl_getVisualRunDirection U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDirection) -// #define pl_getVisualRunFont U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunFont) -// #define pl_getVisualRunGlyphCount U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphCount) -// #define pl_getVisualRunGlyphToCharMap U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphToCharMap) -// #define pl_getVisualRunGlyphs U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphs) -// #define pl_getVisualRunLeading U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunLeading) -// #define pl_getVisualRunPositions U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunPositions) -// #define pl_isComplex U_ICU_ENTRY_POINT_RENAME(pl_isComplex) -// #define pl_nextLine U_ICU_ENTRY_POINT_RENAME(pl_nextLine) -// #define pl_openEmptyFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyFontRuns) -// #define pl_openEmptyLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyLocaleRuns) -// #define pl_openEmptyValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyValueRuns) -// #define pl_openFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openFontRuns) -// #define pl_openLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openLocaleRuns) -// #define pl_openValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openValueRuns) -// #define pl_reflow U_ICU_ENTRY_POINT_RENAME(pl_reflow) -// #define pl_resetFontRuns U_ICU_ENTRY_POINT_RENAME(pl_resetFontRuns) -// #define pl_resetLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_resetLocaleRuns) -// #define pl_resetValueRuns U_ICU_ENTRY_POINT_RENAME(pl_resetValueRuns) -// #define res_countArrayItems U_ICU_ENTRY_POINT_RENAME(res_countArrayItems) -// #define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource) -// #define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias) -// #define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem) -// #define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace) -// #define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace) -// #define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType) -// #define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource) -// #define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace) -// #define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex) -// #define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey) -// #define res_load U_ICU_ENTRY_POINT_RENAME(res_load) -// #define res_read U_ICU_ENTRY_POINT_RENAME(res_read) -// #define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload) -// #define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars) -// #define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy) -// #define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy) -// #define u_caseInsensitivePrefixMatch U_ICU_ENTRY_POINT_RENAME(u_caseInsensitivePrefixMatch) -// #define u_catclose U_ICU_ENTRY_POINT_RENAME(u_catclose) -// #define u_catgets U_ICU_ENTRY_POINT_RENAME(u_catgets) -// #define u_catopen U_ICU_ENTRY_POINT_RENAME(u_catopen) -// #define u_charAge U_ICU_ENTRY_POINT_RENAME(u_charAge) -// #define u_charDigitValue U_ICU_ENTRY_POINT_RENAME(u_charDigitValue) -// #define u_charDirection U_ICU_ENTRY_POINT_RENAME(u_charDirection) -// #define u_charFromName U_ICU_ENTRY_POINT_RENAME(u_charFromName) -// #define u_charMirror U_ICU_ENTRY_POINT_RENAME(u_charMirror) -// #define u_charName U_ICU_ENTRY_POINT_RENAME(u_charName) -// #define u_charType U_ICU_ENTRY_POINT_RENAME(u_charType) -// #define u_charsToUChars U_ICU_ENTRY_POINT_RENAME(u_charsToUChars) -// #define u_cleanup U_ICU_ENTRY_POINT_RENAME(u_cleanup) -// #define u_countChar32 U_ICU_ENTRY_POINT_RENAME(u_countChar32) -// #define u_digit U_ICU_ENTRY_POINT_RENAME(u_digit) -// #define u_enumCharNames U_ICU_ENTRY_POINT_RENAME(u_enumCharNames) -// #define u_enumCharTypes U_ICU_ENTRY_POINT_RENAME(u_enumCharTypes) -// #define u_errorName U_ICU_ENTRY_POINT_RENAME(u_errorName) -// #define u_fadopt U_ICU_ENTRY_POINT_RENAME(u_fadopt) -// #define u_fclose U_ICU_ENTRY_POINT_RENAME(u_fclose) -// #define u_feof U_ICU_ENTRY_POINT_RENAME(u_feof) -// #define u_fflush U_ICU_ENTRY_POINT_RENAME(u_fflush) -// #define u_fgetConverter U_ICU_ENTRY_POINT_RENAME(u_fgetConverter) -// #define u_fgetNumberFormat U_ICU_ENTRY_POINT_RENAME(u_fgetNumberFormat) -// #define u_fgetc U_ICU_ENTRY_POINT_RENAME(u_fgetc) -// #define u_fgetcodepage U_ICU_ENTRY_POINT_RENAME(u_fgetcodepage) -// #define u_fgetcx U_ICU_ENTRY_POINT_RENAME(u_fgetcx) -// #define u_fgetfile U_ICU_ENTRY_POINT_RENAME(u_fgetfile) -// #define u_fgetlocale U_ICU_ENTRY_POINT_RENAME(u_fgetlocale) -// #define u_fgets U_ICU_ENTRY_POINT_RENAME(u_fgets) -// #define u_file_read U_ICU_ENTRY_POINT_RENAME(u_file_read) -// #define u_file_write U_ICU_ENTRY_POINT_RENAME(u_file_write) -// #define u_file_write_flush U_ICU_ENTRY_POINT_RENAME(u_file_write_flush) -// #define u_finit U_ICU_ENTRY_POINT_RENAME(u_finit) -// #define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter) -// #define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase) -// #define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen) -// #define u_fopen_u U_ICU_ENTRY_POINT_RENAME(u_fopen_u) -// #define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit) -// #define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage) -// #define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError) -// #define u_fprintf U_ICU_ENTRY_POINT_RENAME(u_fprintf) -// #define u_fprintf_u U_ICU_ENTRY_POINT_RENAME(u_fprintf_u) -// #define u_fputc U_ICU_ENTRY_POINT_RENAME(u_fputc) -// #define u_fputs U_ICU_ENTRY_POINT_RENAME(u_fputs) -// #define u_frewind U_ICU_ENTRY_POINT_RENAME(u_frewind) -// #define u_fscanf U_ICU_ENTRY_POINT_RENAME(u_fscanf) -// #define u_fscanf_u U_ICU_ENTRY_POINT_RENAME(u_fscanf_u) -// #define u_fsetcodepage U_ICU_ENTRY_POINT_RENAME(u_fsetcodepage) -// #define u_fsetlocale U_ICU_ENTRY_POINT_RENAME(u_fsetlocale) -// #define u_fsettransliterator U_ICU_ENTRY_POINT_RENAME(u_fsettransliterator) -// #define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen) -// #define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc) -// #define u_getBidiPairedBracket U_ICU_ENTRY_POINT_RENAME(u_getBidiPairedBracket) -// #define u_getBinaryPropertySet U_ICU_ENTRY_POINT_RENAME(u_getBinaryPropertySet) -// #define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass) -// #define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory) -// #define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion) -// #define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter) -// #define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure) -// #define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment) -// #define u_getIntPropertyMap U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMap) -// #define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue) -// #define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue) -// #define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue) -// #define u_getMainProperties U_ICU_ENTRY_POINT_RENAME(u_getMainProperties) -// #define u_getNumericValue U_ICU_ENTRY_POINT_RENAME(u_getNumericValue) -// #define u_getPropertyEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyEnum) -// #define u_getPropertyName U_ICU_ENTRY_POINT_RENAME(u_getPropertyName) -// #define u_getPropertyValueEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueEnum) -// #define u_getPropertyValueName U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueName) -// #define u_getTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_getTimeZoneFilesDirectory) -// #define u_getUnicodeProperties U_ICU_ENTRY_POINT_RENAME(u_getUnicodeProperties) -// #define u_getUnicodeVersion U_ICU_ENTRY_POINT_RENAME(u_getUnicodeVersion) -// #define u_getVersion U_ICU_ENTRY_POINT_RENAME(u_getVersion) -// #define u_get_stdout U_ICU_ENTRY_POINT_RENAME(u_get_stdout) -// #define u_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_hasBinaryProperty) -// #define u_init U_ICU_ENTRY_POINT_RENAME(u_init) -// #define u_isIDIgnorable U_ICU_ENTRY_POINT_RENAME(u_isIDIgnorable) -// #define u_isIDPart U_ICU_ENTRY_POINT_RENAME(u_isIDPart) -// #define u_isIDStart U_ICU_ENTRY_POINT_RENAME(u_isIDStart) -// #define u_isISOControl U_ICU_ENTRY_POINT_RENAME(u_isISOControl) -// #define u_isJavaIDPart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDPart) -// #define u_isJavaIDStart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDStart) -// #define u_isJavaSpaceChar U_ICU_ENTRY_POINT_RENAME(u_isJavaSpaceChar) -// #define u_isMirrored U_ICU_ENTRY_POINT_RENAME(u_isMirrored) -// #define u_isUAlphabetic U_ICU_ENTRY_POINT_RENAME(u_isUAlphabetic) -// #define u_isULowercase U_ICU_ENTRY_POINT_RENAME(u_isULowercase) -// #define u_isUUppercase U_ICU_ENTRY_POINT_RENAME(u_isUUppercase) -// #define u_isUWhiteSpace U_ICU_ENTRY_POINT_RENAME(u_isUWhiteSpace) -// #define u_isWhitespace U_ICU_ENTRY_POINT_RENAME(u_isWhitespace) -// #define u_isalnum U_ICU_ENTRY_POINT_RENAME(u_isalnum) -// #define u_isalnumPOSIX U_ICU_ENTRY_POINT_RENAME(u_isalnumPOSIX) -// #define u_isalpha U_ICU_ENTRY_POINT_RENAME(u_isalpha) -// #define u_isbase U_ICU_ENTRY_POINT_RENAME(u_isbase) -// #define u_isblank U_ICU_ENTRY_POINT_RENAME(u_isblank) -// #define u_iscntrl U_ICU_ENTRY_POINT_RENAME(u_iscntrl) -// #define u_isdefined U_ICU_ENTRY_POINT_RENAME(u_isdefined) -// #define u_isdigit U_ICU_ENTRY_POINT_RENAME(u_isdigit) -// #define u_isgraph U_ICU_ENTRY_POINT_RENAME(u_isgraph) -// #define u_isgraphPOSIX U_ICU_ENTRY_POINT_RENAME(u_isgraphPOSIX) -// #define u_islower U_ICU_ENTRY_POINT_RENAME(u_islower) -// #define u_isprint U_ICU_ENTRY_POINT_RENAME(u_isprint) -// #define u_isprintPOSIX U_ICU_ENTRY_POINT_RENAME(u_isprintPOSIX) -// #define u_ispunct U_ICU_ENTRY_POINT_RENAME(u_ispunct) -// #define u_isspace U_ICU_ENTRY_POINT_RENAME(u_isspace) -// #define u_istitle U_ICU_ENTRY_POINT_RENAME(u_istitle) -// #define u_isupper U_ICU_ENTRY_POINT_RENAME(u_isupper) -// #define u_isxdigit U_ICU_ENTRY_POINT_RENAME(u_isxdigit) -// #define u_locbund_close U_ICU_ENTRY_POINT_RENAME(u_locbund_close) -// #define u_locbund_getNumberFormat U_ICU_ENTRY_POINT_RENAME(u_locbund_getNumberFormat) -// #define u_locbund_init U_ICU_ENTRY_POINT_RENAME(u_locbund_init) -// #define u_memcasecmp U_ICU_ENTRY_POINT_RENAME(u_memcasecmp) -// #define u_memchr U_ICU_ENTRY_POINT_RENAME(u_memchr) -// #define u_memchr32 U_ICU_ENTRY_POINT_RENAME(u_memchr32) -// #define u_memcmp U_ICU_ENTRY_POINT_RENAME(u_memcmp) -// #define u_memcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_memcmpCodePointOrder) -// #define u_memcpy U_ICU_ENTRY_POINT_RENAME(u_memcpy) -// #define u_memmove U_ICU_ENTRY_POINT_RENAME(u_memmove) -// #define u_memrchr U_ICU_ENTRY_POINT_RENAME(u_memrchr) -// #define u_memrchr32 U_ICU_ENTRY_POINT_RENAME(u_memrchr32) -// #define u_memset U_ICU_ENTRY_POINT_RENAME(u_memset) -// #define u_parseMessage U_ICU_ENTRY_POINT_RENAME(u_parseMessage) -// #define u_parseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_parseMessageWithError) -// #define u_printf U_ICU_ENTRY_POINT_RENAME(u_printf) -// #define u_printf_parse U_ICU_ENTRY_POINT_RENAME(u_printf_parse) -// #define u_printf_u U_ICU_ENTRY_POINT_RENAME(u_printf_u) -// #define u_releaseDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_releaseDefaultConverter) -// #define u_scanf_parse U_ICU_ENTRY_POINT_RENAME(u_scanf_parse) -// #define u_setAtomicIncDecFunctions U_ICU_ENTRY_POINT_RENAME(u_setAtomicIncDecFunctions) -// #define u_setDataDirectory U_ICU_ENTRY_POINT_RENAME(u_setDataDirectory) -// #define u_setMemoryFunctions U_ICU_ENTRY_POINT_RENAME(u_setMemoryFunctions) -// #define u_setMutexFunctions U_ICU_ENTRY_POINT_RENAME(u_setMutexFunctions) -// #define u_setTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_setTimeZoneFilesDirectory) -// #define u_shapeArabic U_ICU_ENTRY_POINT_RENAME(u_shapeArabic) -// #define u_snprintf U_ICU_ENTRY_POINT_RENAME(u_snprintf) -// #define u_snprintf_u U_ICU_ENTRY_POINT_RENAME(u_snprintf_u) -// #define u_sprintf U_ICU_ENTRY_POINT_RENAME(u_sprintf) -// #define u_sprintf_u U_ICU_ENTRY_POINT_RENAME(u_sprintf_u) -// #define u_sscanf U_ICU_ENTRY_POINT_RENAME(u_sscanf) -// #define u_sscanf_u U_ICU_ENTRY_POINT_RENAME(u_sscanf_u) -// #define u_strCaseCompare U_ICU_ENTRY_POINT_RENAME(u_strCaseCompare) -// #define u_strCompare U_ICU_ENTRY_POINT_RENAME(u_strCompare) -// #define u_strCompareIter U_ICU_ENTRY_POINT_RENAME(u_strCompareIter) -// #define u_strFindFirst U_ICU_ENTRY_POINT_RENAME(u_strFindFirst) -// #define u_strFindLast U_ICU_ENTRY_POINT_RENAME(u_strFindLast) -// #define u_strFoldCase U_ICU_ENTRY_POINT_RENAME(u_strFoldCase) -// #define u_strFromJavaModifiedUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromJavaModifiedUTF8WithSub) -// #define u_strFromPunycode U_ICU_ENTRY_POINT_RENAME(u_strFromPunycode) -// #define u_strFromUTF32 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32) -// #define u_strFromUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32WithSub) -// #define u_strFromUTF8 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8) -// #define u_strFromUTF8Lenient U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8Lenient) -// #define u_strFromUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8WithSub) -// #define u_strFromWCS U_ICU_ENTRY_POINT_RENAME(u_strFromWCS) -// #define u_strHasMoreChar32Than U_ICU_ENTRY_POINT_RENAME(u_strHasMoreChar32Than) -// #define u_strToJavaModifiedUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToJavaModifiedUTF8) -// #define u_strToLower U_ICU_ENTRY_POINT_RENAME(u_strToLower) -// #define u_strToPunycode U_ICU_ENTRY_POINT_RENAME(u_strToPunycode) -// #define u_strToTitle U_ICU_ENTRY_POINT_RENAME(u_strToTitle) -// #define u_strToUTF32 U_ICU_ENTRY_POINT_RENAME(u_strToUTF32) -// #define u_strToUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF32WithSub) -// #define u_strToUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToUTF8) -// #define u_strToUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF8WithSub) -// #define u_strToUpper U_ICU_ENTRY_POINT_RENAME(u_strToUpper) -// #define u_strToWCS U_ICU_ENTRY_POINT_RENAME(u_strToWCS) -// #define u_strcasecmp U_ICU_ENTRY_POINT_RENAME(u_strcasecmp) -// #define u_strcat U_ICU_ENTRY_POINT_RENAME(u_strcat) -// #define u_strchr U_ICU_ENTRY_POINT_RENAME(u_strchr) -// #define u_strchr32 U_ICU_ENTRY_POINT_RENAME(u_strchr32) -// #define u_strcmp U_ICU_ENTRY_POINT_RENAME(u_strcmp) -// #define u_strcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strcmpCodePointOrder) -// #define u_strcmpFold U_ICU_ENTRY_POINT_RENAME(u_strcmpFold) -// #define u_strcpy U_ICU_ENTRY_POINT_RENAME(u_strcpy) -// #define u_strcspn U_ICU_ENTRY_POINT_RENAME(u_strcspn) -// #define u_strlen U_ICU_ENTRY_POINT_RENAME(u_strlen) -// #define u_strncasecmp U_ICU_ENTRY_POINT_RENAME(u_strncasecmp) -// #define u_strncat U_ICU_ENTRY_POINT_RENAME(u_strncat) -// #define u_strncmp U_ICU_ENTRY_POINT_RENAME(u_strncmp) -// #define u_strncmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strncmpCodePointOrder) -// #define u_strncpy U_ICU_ENTRY_POINT_RENAME(u_strncpy) -// #define u_strpbrk U_ICU_ENTRY_POINT_RENAME(u_strpbrk) -// #define u_strrchr U_ICU_ENTRY_POINT_RENAME(u_strrchr) -// #define u_strrchr32 U_ICU_ENTRY_POINT_RENAME(u_strrchr32) -// #define u_strrstr U_ICU_ENTRY_POINT_RENAME(u_strrstr) -// #define u_strspn U_ICU_ENTRY_POINT_RENAME(u_strspn) -// #define u_strstr U_ICU_ENTRY_POINT_RENAME(u_strstr) -// #define u_strtok_r U_ICU_ENTRY_POINT_RENAME(u_strtok_r) -// #define u_terminateChars U_ICU_ENTRY_POINT_RENAME(u_terminateChars) -// #define u_terminateUChar32s U_ICU_ENTRY_POINT_RENAME(u_terminateUChar32s) -// #define u_terminateUChars U_ICU_ENTRY_POINT_RENAME(u_terminateUChars) -// #define u_terminateWChars U_ICU_ENTRY_POINT_RENAME(u_terminateWChars) -// #define u_tolower U_ICU_ENTRY_POINT_RENAME(u_tolower) -// #define u_totitle U_ICU_ENTRY_POINT_RENAME(u_totitle) -// #define u_toupper U_ICU_ENTRY_POINT_RENAME(u_toupper) -// #define u_uastrcpy U_ICU_ENTRY_POINT_RENAME(u_uastrcpy) -// #define u_uastrncpy U_ICU_ENTRY_POINT_RENAME(u_uastrncpy) -// #define u_unescape U_ICU_ENTRY_POINT_RENAME(u_unescape) -// #define u_unescapeAt U_ICU_ENTRY_POINT_RENAME(u_unescapeAt) -// #define u_versionFromString U_ICU_ENTRY_POINT_RENAME(u_versionFromString) -// #define u_versionFromUString U_ICU_ENTRY_POINT_RENAME(u_versionFromUString) -// #define u_versionToString U_ICU_ENTRY_POINT_RENAME(u_versionToString) -// #define u_vformatMessage U_ICU_ENTRY_POINT_RENAME(u_vformatMessage) -// #define u_vformatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vformatMessageWithError) -// #define u_vfprintf U_ICU_ENTRY_POINT_RENAME(u_vfprintf) -// #define u_vfprintf_u U_ICU_ENTRY_POINT_RENAME(u_vfprintf_u) -// #define u_vfscanf U_ICU_ENTRY_POINT_RENAME(u_vfscanf) -// #define u_vfscanf_u U_ICU_ENTRY_POINT_RENAME(u_vfscanf_u) -// #define u_vparseMessage U_ICU_ENTRY_POINT_RENAME(u_vparseMessage) -// #define u_vparseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vparseMessageWithError) -// #define u_vsnprintf U_ICU_ENTRY_POINT_RENAME(u_vsnprintf) -// #define u_vsnprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsnprintf_u) -// #define u_vsprintf U_ICU_ENTRY_POINT_RENAME(u_vsprintf) -// #define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u) -// #define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf) -// #define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u) -// #define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun) -// #define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts) -// #define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close) -// #define ubidi_countParagraphs U_ICU_ENTRY_POINT_RENAME(ubidi_countParagraphs) -// #define ubidi_countRuns U_ICU_ENTRY_POINT_RENAME(ubidi_countRuns) -// #define ubidi_getBaseDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getBaseDirection) -// #define ubidi_getClass U_ICU_ENTRY_POINT_RENAME(ubidi_getClass) -// #define ubidi_getClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_getClassCallback) -// #define ubidi_getCustomizedClass U_ICU_ENTRY_POINT_RENAME(ubidi_getCustomizedClass) -// #define ubidi_getDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getDirection) -// #define ubidi_getJoiningGroup U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningGroup) -// #define ubidi_getJoiningType U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningType) -// #define ubidi_getLength U_ICU_ENTRY_POINT_RENAME(ubidi_getLength) -// #define ubidi_getLevelAt U_ICU_ENTRY_POINT_RENAME(ubidi_getLevelAt) -// #define ubidi_getLevels U_ICU_ENTRY_POINT_RENAME(ubidi_getLevels) -// #define ubidi_getLogicalIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalIndex) -// #define ubidi_getLogicalMap U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalMap) -// #define ubidi_getLogicalRun U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalRun) -// #define ubidi_getMaxValue U_ICU_ENTRY_POINT_RENAME(ubidi_getMaxValue) -// #define ubidi_getMemory U_ICU_ENTRY_POINT_RENAME(ubidi_getMemory) -// #define ubidi_getMirror U_ICU_ENTRY_POINT_RENAME(ubidi_getMirror) -// #define ubidi_getPairedBracket U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracket) -// #define ubidi_getPairedBracketType U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracketType) -// #define ubidi_getParaLevel U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevel) -// #define ubidi_getParaLevelAtIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevelAtIndex) -// #define ubidi_getParagraph U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraph) -// #define ubidi_getParagraphByIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraphByIndex) -// #define ubidi_getProcessedLength U_ICU_ENTRY_POINT_RENAME(ubidi_getProcessedLength) -// #define ubidi_getReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingMode) -// #define ubidi_getReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingOptions) -// #define ubidi_getResultLength U_ICU_ENTRY_POINT_RENAME(ubidi_getResultLength) -// #define ubidi_getRuns U_ICU_ENTRY_POINT_RENAME(ubidi_getRuns) -// #define ubidi_getText U_ICU_ENTRY_POINT_RENAME(ubidi_getText) -// #define ubidi_getVisualIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualIndex) -// #define ubidi_getVisualMap U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualMap) -// #define ubidi_getVisualRun U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualRun) -// #define ubidi_invertMap U_ICU_ENTRY_POINT_RENAME(ubidi_invertMap) -// #define ubidi_isBidiControl U_ICU_ENTRY_POINT_RENAME(ubidi_isBidiControl) -// #define ubidi_isInverse U_ICU_ENTRY_POINT_RENAME(ubidi_isInverse) -// #define ubidi_isJoinControl U_ICU_ENTRY_POINT_RENAME(ubidi_isJoinControl) -// #define ubidi_isMirrored U_ICU_ENTRY_POINT_RENAME(ubidi_isMirrored) -// #define ubidi_isOrderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_isOrderParagraphsLTR) -// #define ubidi_open U_ICU_ENTRY_POINT_RENAME(ubidi_open) -// #define ubidi_openSized U_ICU_ENTRY_POINT_RENAME(ubidi_openSized) -// #define ubidi_orderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_orderParagraphsLTR) -// #define ubidi_reorderLogical U_ICU_ENTRY_POINT_RENAME(ubidi_reorderLogical) -// #define ubidi_reorderVisual U_ICU_ENTRY_POINT_RENAME(ubidi_reorderVisual) -// #define ubidi_setClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_setClassCallback) -// #define ubidi_setContext U_ICU_ENTRY_POINT_RENAME(ubidi_setContext) -// #define ubidi_setInverse U_ICU_ENTRY_POINT_RENAME(ubidi_setInverse) -// #define ubidi_setLine U_ICU_ENTRY_POINT_RENAME(ubidi_setLine) -// #define ubidi_setPara U_ICU_ENTRY_POINT_RENAME(ubidi_setPara) -// #define ubidi_setReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingMode) -// #define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions) -// #define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered) -// #define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse) -// #define ubiditransform_close U_ICU_ENTRY_POINT_RENAME(ubiditransform_close) -// #define ubiditransform_open U_ICU_ENTRY_POINT_RENAME(ubiditransform_open) -// #define ubiditransform_transform U_ICU_ENTRY_POINT_RENAME(ubiditransform_transform) -// #define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode) -// #define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close) -// #define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable) -// #define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current) -// #define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first) -// #define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following) -// #define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable) -// #define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules) -// #define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType) -// #define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus) -// #define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec) -// #define ubrk_isBoundary U_ICU_ENTRY_POINT_RENAME(ubrk_isBoundary) -// #define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last) -// #define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next) -// #define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open) -// #define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules) -// #define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules) -// #define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding) -// #define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous) -// #define ubrk_refreshUText U_ICU_ENTRY_POINT_RENAME(ubrk_refreshUText) -// #define ubrk_safeClone U_ICU_ENTRY_POINT_RENAME(ubrk_safeClone) -// #define ubrk_setText U_ICU_ENTRY_POINT_RENAME(ubrk_setText) -// #define ubrk_setUText U_ICU_ENTRY_POINT_RENAME(ubrk_setUText) -// #define ubrk_swap U_ICU_ENTRY_POINT_RENAME(ubrk_swap) -// #define ucache_compareKeys U_ICU_ENTRY_POINT_RENAME(ucache_compareKeys) -// #define ucache_deleteKey U_ICU_ENTRY_POINT_RENAME(ucache_deleteKey) -// #define ucache_hashKeys U_ICU_ENTRY_POINT_RENAME(ucache_hashKeys) -// #define ucal_add U_ICU_ENTRY_POINT_RENAME(ucal_add) -// #define ucal_clear U_ICU_ENTRY_POINT_RENAME(ucal_clear) -// #define ucal_clearField U_ICU_ENTRY_POINT_RENAME(ucal_clearField) -// #define ucal_clone U_ICU_ENTRY_POINT_RENAME(ucal_clone) -// #define ucal_close U_ICU_ENTRY_POINT_RENAME(ucal_close) -// #define ucal_countAvailable U_ICU_ENTRY_POINT_RENAME(ucal_countAvailable) -// #define ucal_equivalentTo U_ICU_ENTRY_POINT_RENAME(ucal_equivalentTo) -// #define ucal_get U_ICU_ENTRY_POINT_RENAME(ucal_get) -// #define ucal_getAttribute U_ICU_ENTRY_POINT_RENAME(ucal_getAttribute) -// #define ucal_getAvailable U_ICU_ENTRY_POINT_RENAME(ucal_getAvailable) -// #define ucal_getCanonicalTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getCanonicalTimeZoneID) -// #define ucal_getDSTSavings U_ICU_ENTRY_POINT_RENAME(ucal_getDSTSavings) -// #define ucal_getDayOfWeekType U_ICU_ENTRY_POINT_RENAME(ucal_getDayOfWeekType) -// #define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone) -// #define ucal_getFieldDifference U_ICU_ENTRY_POINT_RENAME(ucal_getFieldDifference) -// #define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange) -// #define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone) -// #define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale) -// #define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit) -// #define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType) -// #define ucal_getMillis U_ICU_ENTRY_POINT_RENAME(ucal_getMillis) -// #define ucal_getNow U_ICU_ENTRY_POINT_RENAME(ucal_getNow) -// #define ucal_getTZDataVersion U_ICU_ENTRY_POINT_RENAME(ucal_getTZDataVersion) -// #define ucal_getTimeZoneDisplayName U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneDisplayName) -// #define ucal_getTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneID) -// #define ucal_getTimeZoneIDForWindowsID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneIDForWindowsID) -// #define ucal_getTimeZoneTransitionDate U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneTransitionDate) -// #define ucal_getType U_ICU_ENTRY_POINT_RENAME(ucal_getType) -// #define ucal_getWeekendTransition U_ICU_ENTRY_POINT_RENAME(ucal_getWeekendTransition) -// #define ucal_getWindowsTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getWindowsTimeZoneID) -// #define ucal_inDaylightTime U_ICU_ENTRY_POINT_RENAME(ucal_inDaylightTime) -// #define ucal_isSet U_ICU_ENTRY_POINT_RENAME(ucal_isSet) -// #define ucal_isWeekend U_ICU_ENTRY_POINT_RENAME(ucal_isWeekend) -// #define ucal_open U_ICU_ENTRY_POINT_RENAME(ucal_open) -// #define ucal_openCountryTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openCountryTimeZones) -// #define ucal_openTimeZoneIDEnumeration U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZoneIDEnumeration) -// #define ucal_openTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZones) -// #define ucal_roll U_ICU_ENTRY_POINT_RENAME(ucal_roll) -// #define ucal_set U_ICU_ENTRY_POINT_RENAME(ucal_set) -// #define ucal_setAttribute U_ICU_ENTRY_POINT_RENAME(ucal_setAttribute) -// #define ucal_setDate U_ICU_ENTRY_POINT_RENAME(ucal_setDate) -// #define ucal_setDateTime U_ICU_ENTRY_POINT_RENAME(ucal_setDateTime) -// #define ucal_setDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setDefaultTimeZone) -// #define ucal_setGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_setGregorianChange) -// #define ucal_setMillis U_ICU_ENTRY_POINT_RENAME(ucal_setMillis) -// #define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone) -// #define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure) -// #define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts) -// #define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure) -// #define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold) -// #define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale) -// #define ucase_getTrie U_ICU_ENTRY_POINT_RENAME(ucase_getTrie) -// #define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType) -// #define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable) -// #define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty) -// #define ucase_isCaseSensitive U_ICU_ENTRY_POINT_RENAME(ucase_isCaseSensitive) -// #define ucase_isSoftDotted U_ICU_ENTRY_POINT_RENAME(ucase_isSoftDotted) -// #define ucase_toFullFolding U_ICU_ENTRY_POINT_RENAME(ucase_toFullFolding) -// #define ucase_toFullLower U_ICU_ENTRY_POINT_RENAME(ucase_toFullLower) -// #define ucase_toFullTitle U_ICU_ENTRY_POINT_RENAME(ucase_toFullTitle) -// #define ucase_toFullUpper U_ICU_ENTRY_POINT_RENAME(ucase_toFullUpper) -// #define ucase_tolower U_ICU_ENTRY_POINT_RENAME(ucase_tolower) -// #define ucase_totitle U_ICU_ENTRY_POINT_RENAME(ucase_totitle) -// #define ucase_toupper U_ICU_ENTRY_POINT_RENAME(ucase_toupper) -// #define ucasemap_close U_ICU_ENTRY_POINT_RENAME(ucasemap_close) -// #define ucasemap_getBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_getBreakIterator) -// #define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale) -// #define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions) -// #define ucasemap_internalUTF8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_internalUTF8ToTitle) -// #define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open) -// #define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator) -// #define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale) -// #define ucasemap_setOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_setOptions) -// #define ucasemap_toTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_toTitle) -// #define ucasemap_utf8FoldCase U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8FoldCase) -// #define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower) -// #define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle) -// #define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper) -// #define ucfpos_close U_ICU_ENTRY_POINT_RENAME(ucfpos_close) -// #define ucfpos_constrainCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainCategory) -// #define ucfpos_constrainField U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainField) -// #define ucfpos_getCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_getCategory) -// #define ucfpos_getField U_ICU_ENTRY_POINT_RENAME(ucfpos_getField) -// #define ucfpos_getIndexes U_ICU_ENTRY_POINT_RENAME(ucfpos_getIndexes) -// #define ucfpos_getInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_getInt64IterationContext) -// #define ucfpos_matchesField U_ICU_ENTRY_POINT_RENAME(ucfpos_matchesField) -// #define ucfpos_open U_ICU_ENTRY_POINT_RENAME(ucfpos_open) -// #define ucfpos_reset U_ICU_ENTRY_POINT_RENAME(ucfpos_reset) -// #define ucfpos_setInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_setInt64IterationContext) -// #define ucfpos_setState U_ICU_ENTRY_POINT_RENAME(ucfpos_setState) -// #define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts) -// #define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames) -// #define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne) -// #define ucln_common_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_common_registerCleanup) -// #define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup) -// #define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup) -// #define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup) -// #define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup) -// #define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32) -// #define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets) -// #define ucnv_MBCSGetFilteredUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetFilteredUnicodeSetForUnicode) -// #define ucnv_MBCSGetType U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetType) -// #define ucnv_MBCSGetUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetUnicodeSetForUnicode) -// #define ucnv_MBCSIsLeadByte U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSIsLeadByte) -// #define ucnv_MBCSSimpleGetNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSSimpleGetNextUChar) -// #define ucnv_MBCSToUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSToUnicodeWithOffsets) -// #define ucnv_bld_countAvailableConverters U_ICU_ENTRY_POINT_RENAME(ucnv_bld_countAvailableConverters) -// #define ucnv_bld_getAvailableConverter U_ICU_ENTRY_POINT_RENAME(ucnv_bld_getAvailableConverter) -// #define ucnv_canCreateConverter U_ICU_ENTRY_POINT_RENAME(ucnv_canCreateConverter) -// #define ucnv_cbFromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteBytes) -// #define ucnv_cbFromUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteSub) -// #define ucnv_cbFromUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteUChars) -// #define ucnv_cbToUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteSub) -// #define ucnv_cbToUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteUChars) -// #define ucnv_close U_ICU_ENTRY_POINT_RENAME(ucnv_close) -// #define ucnv_compareNames U_ICU_ENTRY_POINT_RENAME(ucnv_compareNames) -// #define ucnv_convert U_ICU_ENTRY_POINT_RENAME(ucnv_convert) -// #define ucnv_convertEx U_ICU_ENTRY_POINT_RENAME(ucnv_convertEx) -// #define ucnv_countAliases U_ICU_ENTRY_POINT_RENAME(ucnv_countAliases) -// #define ucnv_countAvailable U_ICU_ENTRY_POINT_RENAME(ucnv_countAvailable) -// #define ucnv_countStandards U_ICU_ENTRY_POINT_RENAME(ucnv_countStandards) -// #define ucnv_createAlgorithmicConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createAlgorithmicConverter) -// #define ucnv_createConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createConverter) -// #define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage) -// #define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData) -// #define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature) -// #define ucnv_enableCleanup U_ICU_ENTRY_POINT_RENAME(ucnv_enableCleanup) -// #define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU) -// #define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU) -// #define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet) -// #define ucnv_extInitialMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchFromU) -// #define ucnv_extInitialMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchToU) -// #define ucnv_extSimpleMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchFromU) -// #define ucnv_extSimpleMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchToU) -// #define ucnv_fixFileSeparator U_ICU_ENTRY_POINT_RENAME(ucnv_fixFileSeparator) -// #define ucnv_flushCache U_ICU_ENTRY_POINT_RENAME(ucnv_flushCache) -// #define ucnv_fromAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_fromAlgorithmic) -// #define ucnv_fromUChars U_ICU_ENTRY_POINT_RENAME(ucnv_fromUChars) -// #define ucnv_fromUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_fromUCountPending) -// #define ucnv_fromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_fromUWriteBytes) -// #define ucnv_fromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode) -// #define ucnv_fromUnicode_UTF8 U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8) -// #define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8_OFFSETS_LOGIC) -// #define ucnv_getAlias U_ICU_ENTRY_POINT_RENAME(ucnv_getAlias) -// #define ucnv_getAliases U_ICU_ENTRY_POINT_RENAME(ucnv_getAliases) -// #define ucnv_getAvailableName U_ICU_ENTRY_POINT_RENAME(ucnv_getAvailableName) -// #define ucnv_getCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_getCCSID) -// #define ucnv_getCanonicalName U_ICU_ENTRY_POINT_RENAME(ucnv_getCanonicalName) -// #define ucnv_getCompleteUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getCompleteUnicodeSet) -// #define ucnv_getDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_getDefaultName) -// #define ucnv_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucnv_getDisplayName) -// #define ucnv_getFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getFromUCallBack) -// #define ucnv_getInvalidChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidChars) -// #define ucnv_getInvalidUChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidUChars) -// #define ucnv_getMaxCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMaxCharSize) -// #define ucnv_getMinCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMinCharSize) -// #define ucnv_getName U_ICU_ENTRY_POINT_RENAME(ucnv_getName) -// #define ucnv_getNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_getNextUChar) -// #define ucnv_getNonSurrogateUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getNonSurrogateUnicodeSet) -// #define ucnv_getPlatform U_ICU_ENTRY_POINT_RENAME(ucnv_getPlatform) -// #define ucnv_getStandard U_ICU_ENTRY_POINT_RENAME(ucnv_getStandard) -// #define ucnv_getStandardName U_ICU_ENTRY_POINT_RENAME(ucnv_getStandardName) -// #define ucnv_getStarters U_ICU_ENTRY_POINT_RENAME(ucnv_getStarters) -// #define ucnv_getSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_getSubstChars) -// #define ucnv_getToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getToUCallBack) -// #define ucnv_getType U_ICU_ENTRY_POINT_RENAME(ucnv_getType) -// #define ucnv_getUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getUnicodeSet) -// #define ucnv_incrementRefCount U_ICU_ENTRY_POINT_RENAME(ucnv_incrementRefCount) -// #define ucnv_io_countKnownConverters U_ICU_ENTRY_POINT_RENAME(ucnv_io_countKnownConverters) -// #define ucnv_io_getConverterName U_ICU_ENTRY_POINT_RENAME(ucnv_io_getConverterName) -// #define ucnv_io_stripASCIIForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripASCIIForCompare) -// #define ucnv_io_stripEBCDICForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripEBCDICForCompare) -// #define ucnv_isAmbiguous U_ICU_ENTRY_POINT_RENAME(ucnv_isAmbiguous) -// #define ucnv_isFixedWidth U_ICU_ENTRY_POINT_RENAME(ucnv_isFixedWidth) -// #define ucnv_load U_ICU_ENTRY_POINT_RENAME(ucnv_load) -// #define ucnv_loadSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_loadSharedData) -// #define ucnv_open U_ICU_ENTRY_POINT_RENAME(ucnv_open) -// #define ucnv_openAllNames U_ICU_ENTRY_POINT_RENAME(ucnv_openAllNames) -// #define ucnv_openCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_openCCSID) -// #define ucnv_openPackage U_ICU_ENTRY_POINT_RENAME(ucnv_openPackage) -// #define ucnv_openStandardNames U_ICU_ENTRY_POINT_RENAME(ucnv_openStandardNames) -// #define ucnv_openU U_ICU_ENTRY_POINT_RENAME(ucnv_openU) -// #define ucnv_reset U_ICU_ENTRY_POINT_RENAME(ucnv_reset) -// #define ucnv_resetFromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetFromUnicode) -// #define ucnv_resetToUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetToUnicode) -// #define ucnv_safeClone U_ICU_ENTRY_POINT_RENAME(ucnv_safeClone) -// #define ucnv_setDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_setDefaultName) -// #define ucnv_setFallback U_ICU_ENTRY_POINT_RENAME(ucnv_setFallback) -// #define ucnv_setFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setFromUCallBack) -// #define ucnv_setSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstChars) -// #define ucnv_setSubstString U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstString) -// #define ucnv_setToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setToUCallBack) -// #define ucnv_swap U_ICU_ENTRY_POINT_RENAME(ucnv_swap) -// #define ucnv_swapAliases U_ICU_ENTRY_POINT_RENAME(ucnv_swapAliases) -// #define ucnv_toAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_toAlgorithmic) -// #define ucnv_toUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUChars) -// #define ucnv_toUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_toUCountPending) -// #define ucnv_toUWriteCodePoint U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteCodePoint) -// #define ucnv_toUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteUChars) -// #define ucnv_toUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_toUnicode) -// #define ucnv_unload U_ICU_ENTRY_POINT_RENAME(ucnv_unload) -// #define ucnv_unloadSharedDataIfReady U_ICU_ENTRY_POINT_RENAME(ucnv_unloadSharedDataIfReady) -// #define ucnv_usesFallback U_ICU_ENTRY_POINT_RENAME(ucnv_usesFallback) -// #define ucnvsel_close U_ICU_ENTRY_POINT_RENAME(ucnvsel_close) -// #define ucnvsel_open U_ICU_ENTRY_POINT_RENAME(ucnvsel_open) -// #define ucnvsel_openFromSerialized U_ICU_ENTRY_POINT_RENAME(ucnvsel_openFromSerialized) -// #define ucnvsel_selectForString U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForString) -// #define ucnvsel_selectForUTF8 U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForUTF8) -// #define ucnvsel_serialize U_ICU_ENTRY_POINT_RENAME(ucnvsel_serialize) -// #define ucol_cloneBinary U_ICU_ENTRY_POINT_RENAME(ucol_cloneBinary) -// #define ucol_close U_ICU_ENTRY_POINT_RENAME(ucol_close) -// #define ucol_closeElements U_ICU_ENTRY_POINT_RENAME(ucol_closeElements) -// #define ucol_countAvailable U_ICU_ENTRY_POINT_RENAME(ucol_countAvailable) -// #define ucol_equal U_ICU_ENTRY_POINT_RENAME(ucol_equal) -// #define ucol_equals U_ICU_ENTRY_POINT_RENAME(ucol_equals) -// #define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute) -// #define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable) -// #define ucol_getBound U_ICU_ENTRY_POINT_RENAME(ucol_getBound) -// #define ucol_getContractions U_ICU_ENTRY_POINT_RENAME(ucol_getContractions) -// #define ucol_getContractionsAndExpansions U_ICU_ENTRY_POINT_RENAME(ucol_getContractionsAndExpansions) -// #define ucol_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucol_getDisplayName) -// #define ucol_getEquivalentReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getEquivalentReorderCodes) -// #define ucol_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ucol_getFunctionalEquivalent) -// #define ucol_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValues) -// #define ucol_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValuesForLocale) -// #define ucol_getKeywords U_ICU_ENTRY_POINT_RENAME(ucol_getKeywords) -// #define ucol_getLocale U_ICU_ENTRY_POINT_RENAME(ucol_getLocale) -// #define ucol_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucol_getLocaleByType) -// #define ucol_getMaxExpansion U_ICU_ENTRY_POINT_RENAME(ucol_getMaxExpansion) -// #define ucol_getMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_getMaxVariable) -// #define ucol_getOffset U_ICU_ENTRY_POINT_RENAME(ucol_getOffset) -// #define ucol_getReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodes) -// #define ucol_getRules U_ICU_ENTRY_POINT_RENAME(ucol_getRules) -// #define ucol_getRulesEx U_ICU_ENTRY_POINT_RENAME(ucol_getRulesEx) -// #define ucol_getShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_getShortDefinitionString) -// #define ucol_getSortKey U_ICU_ENTRY_POINT_RENAME(ucol_getSortKey) -// #define ucol_getStrength U_ICU_ENTRY_POINT_RENAME(ucol_getStrength) -// #define ucol_getTailoredSet U_ICU_ENTRY_POINT_RENAME(ucol_getTailoredSet) -// #define ucol_getUCAVersion U_ICU_ENTRY_POINT_RENAME(ucol_getUCAVersion) -// #define ucol_getUnsafeSet U_ICU_ENTRY_POINT_RENAME(ucol_getUnsafeSet) -// #define ucol_getVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_getVariableTop) -// #define ucol_getVersion U_ICU_ENTRY_POINT_RENAME(ucol_getVersion) -// #define ucol_greater U_ICU_ENTRY_POINT_RENAME(ucol_greater) -// #define ucol_greaterOrEqual U_ICU_ENTRY_POINT_RENAME(ucol_greaterOrEqual) -// #define ucol_keyHashCode U_ICU_ENTRY_POINT_RENAME(ucol_keyHashCode) -// #define ucol_looksLikeCollationBinary U_ICU_ENTRY_POINT_RENAME(ucol_looksLikeCollationBinary) -// #define ucol_mergeSortkeys U_ICU_ENTRY_POINT_RENAME(ucol_mergeSortkeys) -// #define ucol_next U_ICU_ENTRY_POINT_RENAME(ucol_next) -// #define ucol_nextSortKeyPart U_ICU_ENTRY_POINT_RENAME(ucol_nextSortKeyPart) -// #define ucol_normalizeShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_normalizeShortDefinitionString) -// #define ucol_open U_ICU_ENTRY_POINT_RENAME(ucol_open) -// #define ucol_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ucol_openAvailableLocales) -// #define ucol_openBinary U_ICU_ENTRY_POINT_RENAME(ucol_openBinary) -// #define ucol_openElements U_ICU_ENTRY_POINT_RENAME(ucol_openElements) -// #define ucol_openFromShortString U_ICU_ENTRY_POINT_RENAME(ucol_openFromShortString) -// #define ucol_openRules U_ICU_ENTRY_POINT_RENAME(ucol_openRules) -// #define ucol_prepareShortStringOpen U_ICU_ENTRY_POINT_RENAME(ucol_prepareShortStringOpen) -// #define ucol_previous U_ICU_ENTRY_POINT_RENAME(ucol_previous) -// #define ucol_primaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_primaryOrder) -// #define ucol_reset U_ICU_ENTRY_POINT_RENAME(ucol_reset) -// #define ucol_restoreVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_restoreVariableTop) -// #define ucol_safeClone U_ICU_ENTRY_POINT_RENAME(ucol_safeClone) -// #define ucol_secondaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_secondaryOrder) -// #define ucol_setAttribute U_ICU_ENTRY_POINT_RENAME(ucol_setAttribute) -// #define ucol_setMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_setMaxVariable) -// #define ucol_setOffset U_ICU_ENTRY_POINT_RENAME(ucol_setOffset) -// #define ucol_setReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_setReorderCodes) -// #define ucol_setStrength U_ICU_ENTRY_POINT_RENAME(ucol_setStrength) -// #define ucol_setText U_ICU_ENTRY_POINT_RENAME(ucol_setText) -// #define ucol_setVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_setVariableTop) -// #define ucol_strcoll U_ICU_ENTRY_POINT_RENAME(ucol_strcoll) -// #define ucol_strcollIter U_ICU_ENTRY_POINT_RENAME(ucol_strcollIter) -// #define ucol_strcollUTF8 U_ICU_ENTRY_POINT_RENAME(ucol_strcollUTF8) -// #define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap) -// #define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA) -// #define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder) -// #define ucpmap_get U_ICU_ENTRY_POINT_RENAME(ucpmap_get) -// #define ucpmap_getRange U_ICU_ENTRY_POINT_RENAME(ucpmap_getRange) -// #define ucptrie_close U_ICU_ENTRY_POINT_RENAME(ucptrie_close) -// #define ucptrie_get U_ICU_ENTRY_POINT_RENAME(ucptrie_get) -// #define ucptrie_getRange U_ICU_ENTRY_POINT_RENAME(ucptrie_getRange) -// #define ucptrie_getType U_ICU_ENTRY_POINT_RENAME(ucptrie_getType) -// #define ucptrie_getValueWidth U_ICU_ENTRY_POINT_RENAME(ucptrie_getValueWidth) -// #define ucptrie_internalGetRange U_ICU_ENTRY_POINT_RENAME(ucptrie_internalGetRange) -// #define ucptrie_internalSmallIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallIndex) -// #define ucptrie_internalSmallU8Index U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallU8Index) -// #define ucptrie_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalU8PrevIndex) -// #define ucptrie_openFromBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_openFromBinary) -// #define ucptrie_swap U_ICU_ENTRY_POINT_RENAME(ucptrie_swap) -// #define ucptrie_toBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_toBinary) -// #define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close) -// #define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect) -// #define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll) -// #define ucsdet_enableInputFilter U_ICU_ENTRY_POINT_RENAME(ucsdet_enableInputFilter) -// #define ucsdet_getAllDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getAllDetectableCharsets) -// #define ucsdet_getConfidence U_ICU_ENTRY_POINT_RENAME(ucsdet_getConfidence) -// #define ucsdet_getDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getDetectableCharsets) -// #define ucsdet_getLanguage U_ICU_ENTRY_POINT_RENAME(ucsdet_getLanguage) -// #define ucsdet_getName U_ICU_ENTRY_POINT_RENAME(ucsdet_getName) -// #define ucsdet_getUChars U_ICU_ENTRY_POINT_RENAME(ucsdet_getUChars) -// #define ucsdet_isInputFilterEnabled U_ICU_ENTRY_POINT_RENAME(ucsdet_isInputFilterEnabled) -// #define ucsdet_open U_ICU_ENTRY_POINT_RENAME(ucsdet_open) -// #define ucsdet_setDeclaredEncoding U_ICU_ENTRY_POINT_RENAME(ucsdet_setDeclaredEncoding) -// #define ucsdet_setDetectableCharset U_ICU_ENTRY_POINT_RENAME(ucsdet_setDetectableCharset) -// #define ucsdet_setText U_ICU_ENTRY_POINT_RENAME(ucsdet_setText) -// #define ucurr_countCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_countCurrencies) -// #define ucurr_forLocale U_ICU_ENTRY_POINT_RENAME(ucurr_forLocale) -// #define ucurr_forLocaleAndDate U_ICU_ENTRY_POINT_RENAME(ucurr_forLocaleAndDate) -// #define ucurr_getDefaultFractionDigits U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigits) -// #define ucurr_getDefaultFractionDigitsForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigitsForUsage) -// #define ucurr_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucurr_getKeywordValuesForLocale) -// #define ucurr_getName U_ICU_ENTRY_POINT_RENAME(ucurr_getName) -// #define ucurr_getNumericCode U_ICU_ENTRY_POINT_RENAME(ucurr_getNumericCode) -// #define ucurr_getPluralName U_ICU_ENTRY_POINT_RENAME(ucurr_getPluralName) -// #define ucurr_getRoundingIncrement U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrement) -// #define ucurr_getRoundingIncrementForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrementForUsage) -// #define ucurr_isAvailable U_ICU_ENTRY_POINT_RENAME(ucurr_isAvailable) -// #define ucurr_openISOCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_openISOCurrencies) -// #define ucurr_register U_ICU_ENTRY_POINT_RENAME(ucurr_register) -// #define ucurr_unregister U_ICU_ENTRY_POINT_RENAME(ucurr_unregister) -// #define udat_adoptNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormat) -// #define udat_adoptNumberFormatForFields U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormatForFields) -// #define udat_applyPattern U_ICU_ENTRY_POINT_RENAME(udat_applyPattern) -// #define udat_applyPatternRelative U_ICU_ENTRY_POINT_RENAME(udat_applyPatternRelative) -// #define udat_clone U_ICU_ENTRY_POINT_RENAME(udat_clone) -// #define udat_close U_ICU_ENTRY_POINT_RENAME(udat_close) -// #define udat_countAvailable U_ICU_ENTRY_POINT_RENAME(udat_countAvailable) -// #define udat_countSymbols U_ICU_ENTRY_POINT_RENAME(udat_countSymbols) -// #define udat_format U_ICU_ENTRY_POINT_RENAME(udat_format) -// #define udat_formatCalendar U_ICU_ENTRY_POINT_RENAME(udat_formatCalendar) -// #define udat_formatCalendarForFields U_ICU_ENTRY_POINT_RENAME(udat_formatCalendarForFields) -// #define udat_formatForFields U_ICU_ENTRY_POINT_RENAME(udat_formatForFields) -// #define udat_get2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_get2DigitYearStart) -// #define udat_getAvailable U_ICU_ENTRY_POINT_RENAME(udat_getAvailable) -// #define udat_getBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_getBooleanAttribute) -// #define udat_getCalendar U_ICU_ENTRY_POINT_RENAME(udat_getCalendar) -// #define udat_getContext U_ICU_ENTRY_POINT_RENAME(udat_getContext) -// #define udat_getLocaleByType U_ICU_ENTRY_POINT_RENAME(udat_getLocaleByType) -// #define udat_getNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormat) -// #define udat_getNumberFormatForField U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormatForField) -// #define udat_getSymbols U_ICU_ENTRY_POINT_RENAME(udat_getSymbols) -// #define udat_isLenient U_ICU_ENTRY_POINT_RENAME(udat_isLenient) -// #define udat_open U_ICU_ENTRY_POINT_RENAME(udat_open) -// #define udat_parse U_ICU_ENTRY_POINT_RENAME(udat_parse) -// #define udat_parseCalendar U_ICU_ENTRY_POINT_RENAME(udat_parseCalendar) -// #define udat_registerOpener U_ICU_ENTRY_POINT_RENAME(udat_registerOpener) -// #define udat_set2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_set2DigitYearStart) -// #define udat_setBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_setBooleanAttribute) -// #define udat_setCalendar U_ICU_ENTRY_POINT_RENAME(udat_setCalendar) -// #define udat_setContext U_ICU_ENTRY_POINT_RENAME(udat_setContext) -// #define udat_setLenient U_ICU_ENTRY_POINT_RENAME(udat_setLenient) -// #define udat_setNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_setNumberFormat) -// #define udat_setSymbols U_ICU_ENTRY_POINT_RENAME(udat_setSymbols) -// #define udat_toCalendarDateField U_ICU_ENTRY_POINT_RENAME(udat_toCalendarDateField) -// #define udat_toPattern U_ICU_ENTRY_POINT_RENAME(udat_toPattern) -// #define udat_toPatternRelativeDate U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeDate) -// #define udat_toPatternRelativeTime U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeTime) -// #define udat_unregisterOpener U_ICU_ENTRY_POINT_RENAME(udat_unregisterOpener) -// #define udata_checkCommonData U_ICU_ENTRY_POINT_RENAME(udata_checkCommonData) -// #define udata_close U_ICU_ENTRY_POINT_RENAME(udata_close) -// #define udata_closeSwapper U_ICU_ENTRY_POINT_RENAME(udata_closeSwapper) -// #define udata_getHeaderSize U_ICU_ENTRY_POINT_RENAME(udata_getHeaderSize) -// #define udata_getInfo U_ICU_ENTRY_POINT_RENAME(udata_getInfo) -// #define udata_getInfoSize U_ICU_ENTRY_POINT_RENAME(udata_getInfoSize) -// #define udata_getLength U_ICU_ENTRY_POINT_RENAME(udata_getLength) -// #define udata_getMemory U_ICU_ENTRY_POINT_RENAME(udata_getMemory) -// #define udata_getRawMemory U_ICU_ENTRY_POINT_RENAME(udata_getRawMemory) -// #define udata_open U_ICU_ENTRY_POINT_RENAME(udata_open) -// #define udata_openChoice U_ICU_ENTRY_POINT_RENAME(udata_openChoice) -// #define udata_openSwapper U_ICU_ENTRY_POINT_RENAME(udata_openSwapper) -// #define udata_openSwapperForInputData U_ICU_ENTRY_POINT_RENAME(udata_openSwapperForInputData) -// #define udata_printError U_ICU_ENTRY_POINT_RENAME(udata_printError) -// #define udata_readInt16 U_ICU_ENTRY_POINT_RENAME(udata_readInt16) -// #define udata_readInt32 U_ICU_ENTRY_POINT_RENAME(udata_readInt32) -// #define udata_setAppData U_ICU_ENTRY_POINT_RENAME(udata_setAppData) -// #define udata_setCommonData U_ICU_ENTRY_POINT_RENAME(udata_setCommonData) -// #define udata_setFileAccess U_ICU_ENTRY_POINT_RENAME(udata_setFileAccess) -// #define udata_swapDataHeader U_ICU_ENTRY_POINT_RENAME(udata_swapDataHeader) -// #define udata_swapInvStringBlock U_ICU_ENTRY_POINT_RENAME(udata_swapInvStringBlock) -// #define udatpg_addPattern U_ICU_ENTRY_POINT_RENAME(udatpg_addPattern) -// #define udatpg_clone U_ICU_ENTRY_POINT_RENAME(udatpg_clone) -// #define udatpg_close U_ICU_ENTRY_POINT_RENAME(udatpg_close) -// #define udatpg_getAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemFormat) -// #define udatpg_getAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemName) -// #define udatpg_getBaseSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getBaseSkeleton) -// #define udatpg_getBestPattern U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPattern) -// #define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions) -// #define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat) -// #define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal) -// #define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName) -// #define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton) -// #define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton) -// #define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open) -// #define udatpg_openBaseSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openBaseSkeletons) -// #define udatpg_openEmpty U_ICU_ENTRY_POINT_RENAME(udatpg_openEmpty) -// #define udatpg_openSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openSkeletons) -// #define udatpg_replaceFieldTypes U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypes) -// #define udatpg_replaceFieldTypesWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypesWithOptions) -// #define udatpg_setAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemFormat) -// #define udatpg_setAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemName) -// #define udatpg_setDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormat) -// #define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal) -// #define udict_swap U_ICU_ENTRY_POINT_RENAME(udict_swap) -// #define udtitvfmt_close U_ICU_ENTRY_POINT_RENAME(udtitvfmt_close) -// #define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult) -// #define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format) -// #define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult) -// #define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open) -// #define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult) -// #define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue) -// #define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close) -// #define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count) -// #define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next) -// #define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault) -// #define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration) -// #define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration) -// #define uenum_openUCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openUCharStringsEnumeration) -// #define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset) -// #define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext) -// #define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault) -// #define ufieldpositer_close U_ICU_ENTRY_POINT_RENAME(ufieldpositer_close) -// #define ufieldpositer_next U_ICU_ENTRY_POINT_RENAME(ufieldpositer_next) -// #define ufieldpositer_open U_ICU_ENTRY_POINT_RENAME(ufieldpositer_open) -// #define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch) -// #define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32) -// #define ufmt_close U_ICU_ENTRY_POINT_RENAME(ufmt_close) -// #define ufmt_getArrayItemByIndex U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayItemByIndex) -// #define ufmt_getArrayLength U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayLength) -// #define ufmt_getDate U_ICU_ENTRY_POINT_RENAME(ufmt_getDate) -// #define ufmt_getDecNumChars U_ICU_ENTRY_POINT_RENAME(ufmt_getDecNumChars) -// #define ufmt_getDouble U_ICU_ENTRY_POINT_RENAME(ufmt_getDouble) -// #define ufmt_getInt64 U_ICU_ENTRY_POINT_RENAME(ufmt_getInt64) -// #define ufmt_getLong U_ICU_ENTRY_POINT_RENAME(ufmt_getLong) -// #define ufmt_getObject U_ICU_ENTRY_POINT_RENAME(ufmt_getObject) -// #define ufmt_getType U_ICU_ENTRY_POINT_RENAME(ufmt_getType) -// #define ufmt_getUChars U_ICU_ENTRY_POINT_RENAME(ufmt_getUChars) -// #define ufmt_isNumeric U_ICU_ENTRY_POINT_RENAME(ufmt_isNumeric) -// #define ufmt_open U_ICU_ENTRY_POINT_RENAME(ufmt_open) -// #define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString) -// #define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition) -// #define ugender_getInstance U_ICU_ENTRY_POINT_RENAME(ugender_getInstance) -// #define ugender_getListGender U_ICU_ENTRY_POINT_RENAME(ugender_getListGender) -// #define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close) -// #define uhash_compareCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareCaselessUnicodeString) -// #define uhash_compareChars U_ICU_ENTRY_POINT_RENAME(uhash_compareChars) -// #define uhash_compareIChars U_ICU_ENTRY_POINT_RENAME(uhash_compareIChars) -// #define uhash_compareLong U_ICU_ENTRY_POINT_RENAME(uhash_compareLong) -// #define uhash_compareScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_compareScriptSet) -// #define uhash_compareUChars U_ICU_ENTRY_POINT_RENAME(uhash_compareUChars) -// #define uhash_compareUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareUnicodeString) -// #define uhash_count U_ICU_ENTRY_POINT_RENAME(uhash_count) -// #define uhash_deleteHashtable U_ICU_ENTRY_POINT_RENAME(uhash_deleteHashtable) -// #define uhash_deleteScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_deleteScriptSet) -// #define uhash_equals U_ICU_ENTRY_POINT_RENAME(uhash_equals) -// #define uhash_equalsScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_equalsScriptSet) -// #define uhash_find U_ICU_ENTRY_POINT_RENAME(uhash_find) -// #define uhash_get U_ICU_ENTRY_POINT_RENAME(uhash_get) -// #define uhash_geti U_ICU_ENTRY_POINT_RENAME(uhash_geti) -// #define uhash_hashCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashCaselessUnicodeString) -// #define uhash_hashChars U_ICU_ENTRY_POINT_RENAME(uhash_hashChars) -// #define uhash_hashIChars U_ICU_ENTRY_POINT_RENAME(uhash_hashIChars) -// #define uhash_hashLong U_ICU_ENTRY_POINT_RENAME(uhash_hashLong) -// #define uhash_hashScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_hashScriptSet) -// #define uhash_hashUChars U_ICU_ENTRY_POINT_RENAME(uhash_hashUChars) -// #define uhash_hashUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashUnicodeString) -// #define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget) -// #define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti) -// #define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init) -// #define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize) -// #define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput) -// #define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi) -// #define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove) -// #define uhash_iremovei U_ICU_ENTRY_POINT_RENAME(uhash_iremovei) -// #define uhash_nextElement U_ICU_ENTRY_POINT_RENAME(uhash_nextElement) -// #define uhash_open U_ICU_ENTRY_POINT_RENAME(uhash_open) -// #define uhash_openSize U_ICU_ENTRY_POINT_RENAME(uhash_openSize) -// #define uhash_put U_ICU_ENTRY_POINT_RENAME(uhash_put) -// #define uhash_puti U_ICU_ENTRY_POINT_RENAME(uhash_puti) -// #define uhash_remove U_ICU_ENTRY_POINT_RENAME(uhash_remove) -// #define uhash_removeAll U_ICU_ENTRY_POINT_RENAME(uhash_removeAll) -// #define uhash_removeElement U_ICU_ENTRY_POINT_RENAME(uhash_removeElement) -// #define uhash_removei U_ICU_ENTRY_POINT_RENAME(uhash_removei) -// #define uhash_setKeyComparator U_ICU_ENTRY_POINT_RENAME(uhash_setKeyComparator) -// #define uhash_setKeyDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setKeyDeleter) -// #define uhash_setKeyHasher U_ICU_ENTRY_POINT_RENAME(uhash_setKeyHasher) -// #define uhash_setResizePolicy U_ICU_ENTRY_POINT_RENAME(uhash_setResizePolicy) -// #define uhash_setValueComparator U_ICU_ENTRY_POINT_RENAME(uhash_setValueComparator) -// #define uhash_setValueDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setValueDeleter) -// #define uidna_IDNToASCII U_ICU_ENTRY_POINT_RENAME(uidna_IDNToASCII) -// #define uidna_IDNToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_IDNToUnicode) -// #define uidna_close U_ICU_ENTRY_POINT_RENAME(uidna_close) -// #define uidna_compare U_ICU_ENTRY_POINT_RENAME(uidna_compare) -// #define uidna_labelToASCII U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII) -// #define uidna_labelToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII_UTF8) -// #define uidna_labelToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicode) -// #define uidna_labelToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicodeUTF8) -// #define uidna_nameToASCII U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII) -// #define uidna_nameToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII_UTF8) -// #define uidna_nameToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicode) -// #define uidna_nameToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicodeUTF8) -// #define uidna_openUTS46 U_ICU_ENTRY_POINT_RENAME(uidna_openUTS46) -// #define uidna_toASCII U_ICU_ENTRY_POINT_RENAME(uidna_toASCII) -// #define uidna_toUnicode U_ICU_ENTRY_POINT_RENAME(uidna_toUnicode) -// #define uiter_current32 U_ICU_ENTRY_POINT_RENAME(uiter_current32) -// #define uiter_getState U_ICU_ENTRY_POINT_RENAME(uiter_getState) -// #define uiter_next32 U_ICU_ENTRY_POINT_RENAME(uiter_next32) -// #define uiter_previous32 U_ICU_ENTRY_POINT_RENAME(uiter_previous32) -// #define uiter_setCharacterIterator U_ICU_ENTRY_POINT_RENAME(uiter_setCharacterIterator) -// #define uiter_setReplaceable U_ICU_ENTRY_POINT_RENAME(uiter_setReplaceable) -// #define uiter_setState U_ICU_ENTRY_POINT_RENAME(uiter_setState) -// #define uiter_setString U_ICU_ENTRY_POINT_RENAME(uiter_setString) -// #define uiter_setUTF16BE U_ICU_ENTRY_POINT_RENAME(uiter_setUTF16BE) -// #define uiter_setUTF8 U_ICU_ENTRY_POINT_RENAME(uiter_setUTF8) -// #define uldn_close U_ICU_ENTRY_POINT_RENAME(uldn_close) -// #define uldn_getContext U_ICU_ENTRY_POINT_RENAME(uldn_getContext) -// #define uldn_getDialectHandling U_ICU_ENTRY_POINT_RENAME(uldn_getDialectHandling) -// #define uldn_getLocale U_ICU_ENTRY_POINT_RENAME(uldn_getLocale) -// #define uldn_keyDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyDisplayName) -// #define uldn_keyValueDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyValueDisplayName) -// #define uldn_languageDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_languageDisplayName) -// #define uldn_localeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_localeDisplayName) -// #define uldn_open U_ICU_ENTRY_POINT_RENAME(uldn_open) -// #define uldn_openForContext U_ICU_ENTRY_POINT_RENAME(uldn_openForContext) -// #define uldn_regionDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_regionDisplayName) -// #define uldn_scriptCodeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptCodeDisplayName) -// #define uldn_scriptDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptDisplayName) -// #define uldn_variantDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_variantDisplayName) -// #define ulist_addItemBeginList U_ICU_ENTRY_POINT_RENAME(ulist_addItemBeginList) -// #define ulist_addItemEndList U_ICU_ENTRY_POINT_RENAME(ulist_addItemEndList) -// #define ulist_close_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_close_keyword_values_iterator) -// #define ulist_containsString U_ICU_ENTRY_POINT_RENAME(ulist_containsString) -// #define ulist_count_keyword_values U_ICU_ENTRY_POINT_RENAME(ulist_count_keyword_values) -// #define ulist_createEmptyList U_ICU_ENTRY_POINT_RENAME(ulist_createEmptyList) -// #define ulist_deleteList U_ICU_ENTRY_POINT_RENAME(ulist_deleteList) -// #define ulist_getListFromEnum U_ICU_ENTRY_POINT_RENAME(ulist_getListFromEnum) -// #define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize) -// #define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext) -// #define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value) -// #define ulist_removeString U_ICU_ENTRY_POINT_RENAME(ulist_removeString) -// #define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList) -// #define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator) -// #define ulistfmt_close U_ICU_ENTRY_POINT_RENAME(ulistfmt_close) -// #define ulistfmt_closeResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_closeResult) -// #define ulistfmt_format U_ICU_ENTRY_POINT_RENAME(ulistfmt_format) -// #define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult) -// #define ulistfmt_open U_ICU_ENTRY_POINT_RENAME(ulistfmt_open) -// #define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult) -// #define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue) -// #define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage) -// #define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP) -// #define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags) -// #define uloc_canonicalize U_ICU_ENTRY_POINT_RENAME(uloc_canonicalize) -// #define uloc_countAvailable U_ICU_ENTRY_POINT_RENAME(uloc_countAvailable) -// #define uloc_forLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_forLanguageTag) -// #define uloc_getAvailable U_ICU_ENTRY_POINT_RENAME(uloc_getAvailable) -// #define uloc_getBaseName U_ICU_ENTRY_POINT_RENAME(uloc_getBaseName) -// #define uloc_getCharacterOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getCharacterOrientation) -// #define uloc_getCountry U_ICU_ENTRY_POINT_RENAME(uloc_getCountry) -// #define uloc_getCurrentCountryID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentCountryID) -// #define uloc_getCurrentLanguageID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentLanguageID) -// #define uloc_getDefault U_ICU_ENTRY_POINT_RENAME(uloc_getDefault) -// #define uloc_getDisplayCountry U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayCountry) -// #define uloc_getDisplayKeyword U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeyword) -// #define uloc_getDisplayKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeywordValue) -// #define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage) -// #define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName) -// #define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript) -// #define uloc_getDisplayScriptInContext U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScriptInContext) -// #define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant) -// #define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country) -// #define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language) -// #define uloc_getISOCountries U_ICU_ENTRY_POINT_RENAME(uloc_getISOCountries) -// #define uloc_getISOLanguages U_ICU_ENTRY_POINT_RENAME(uloc_getISOLanguages) -// #define uloc_getKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getKeywordValue) -// #define uloc_getLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLCID) -// #define uloc_getLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getLanguage) -// #define uloc_getLineOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getLineOrientation) -// #define uloc_getLocaleForLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLocaleForLCID) -// #define uloc_getName U_ICU_ENTRY_POINT_RENAME(uloc_getName) -// #define uloc_getParent U_ICU_ENTRY_POINT_RENAME(uloc_getParent) -// #define uloc_getScript U_ICU_ENTRY_POINT_RENAME(uloc_getScript) -// #define uloc_getTableStringWithFallback U_ICU_ENTRY_POINT_RENAME(uloc_getTableStringWithFallback) -// #define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant) -// #define uloc_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uloc_isRightToLeft) -// #define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags) -// #define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType) -// #define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList) -// #define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords) -// #define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault) -// #define uloc_setKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_setKeywordValue) -// #define uloc_toLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_toLanguageTag) -// #define uloc_toLegacyKey U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyKey) -// #define uloc_toLegacyType U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyType) -// #define uloc_toUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleKey) -// #define uloc_toUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleType) -// #define ulocdata_close U_ICU_ENTRY_POINT_RENAME(ulocdata_close) -// #define ulocdata_getCLDRVersion U_ICU_ENTRY_POINT_RENAME(ulocdata_getCLDRVersion) -// #define ulocdata_getDelimiter U_ICU_ENTRY_POINT_RENAME(ulocdata_getDelimiter) -// #define ulocdata_getExemplarSet U_ICU_ENTRY_POINT_RENAME(ulocdata_getExemplarSet) -// #define ulocdata_getLocaleDisplayPattern U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleDisplayPattern) -// #define ulocdata_getLocaleSeparator U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleSeparator) -// #define ulocdata_getMeasurementSystem U_ICU_ENTRY_POINT_RENAME(ulocdata_getMeasurementSystem) -// #define ulocdata_getNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_getNoSubstitute) -// #define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize) -// #define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open) -// #define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute) -// #define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags) -// #define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag) -// #define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) -// #define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) -// #define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData) -// #define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) -// #define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags) -// #define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey) -// #define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType) -// #define ulocimp_toLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_toLanguageTag) -// #define ulocimp_toLegacyKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyKey) -// #define ulocimp_toLegacyType U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyType) -// #define ultag_isExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isExtensionSubtags) -// #define ultag_isLanguageSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isLanguageSubtag) -// #define ultag_isPrivateuseValueSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isPrivateuseValueSubtags) -// #define ultag_isRegionSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isRegionSubtag) -// #define ultag_isScriptSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isScriptSubtag) -// #define ultag_isTransformedExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isTransformedExtensionSubtags) -// #define ultag_isUnicodeExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeExtensionSubtags) -// #define ultag_isUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttribute) -// #define ultag_isUnicodeLocaleAttributes U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttributes) -// #define ultag_isUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleKey) -// #define ultag_isUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleType) -// #define ultag_isVariantSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isVariantSubtags) -// #define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern) -// #define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe) -// #define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone) -// #define umsg_close U_ICU_ENTRY_POINT_RENAME(umsg_close) -// #define umsg_format U_ICU_ENTRY_POINT_RENAME(umsg_format) -// #define umsg_getLocale U_ICU_ENTRY_POINT_RENAME(umsg_getLocale) -// #define umsg_open U_ICU_ENTRY_POINT_RENAME(umsg_open) -// #define umsg_parse U_ICU_ENTRY_POINT_RENAME(umsg_parse) -// #define umsg_setLocale U_ICU_ENTRY_POINT_RENAME(umsg_setLocale) -// #define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern) -// #define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat) -// #define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse) -// #define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock) -// #define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock) -// #define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable) -// #define umutablecptrie_clone U_ICU_ENTRY_POINT_RENAME(umutablecptrie_clone) -// #define umutablecptrie_close U_ICU_ENTRY_POINT_RENAME(umutablecptrie_close) -// #define umutablecptrie_fromUCPMap U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPMap) -// #define umutablecptrie_fromUCPTrie U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPTrie) -// #define umutablecptrie_get U_ICU_ENTRY_POINT_RENAME(umutablecptrie_get) -// #define umutablecptrie_getRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_getRange) -// #define umutablecptrie_open U_ICU_ENTRY_POINT_RENAME(umutablecptrie_open) -// #define umutablecptrie_set U_ICU_ENTRY_POINT_RENAME(umutablecptrie_set) -// #define umutablecptrie_setRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_setRange) -// #define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance) -// #define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append) -// #define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close) -// #define unorm2_composePair U_ICU_ENTRY_POINT_RENAME(unorm2_composePair) -// #define unorm2_getCombiningClass U_ICU_ENTRY_POINT_RENAME(unorm2_getCombiningClass) -// #define unorm2_getDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getDecomposition) -// #define unorm2_getInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getInstance) -// #define unorm2_getNFCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFCInstance) -// #define unorm2_getNFDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFDInstance) -// #define unorm2_getNFKCCasefoldInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCCasefoldInstance) -// #define unorm2_getNFKCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCInstance) -// #define unorm2_getNFKDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKDInstance) -// #define unorm2_getRawDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getRawDecomposition) -// #define unorm2_hasBoundaryAfter U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryAfter) -// #define unorm2_hasBoundaryBefore U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryBefore) -// #define unorm2_isInert U_ICU_ENTRY_POINT_RENAME(unorm2_isInert) -// #define unorm2_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm2_isNormalized) -// #define unorm2_normalize U_ICU_ENTRY_POINT_RENAME(unorm2_normalize) -// #define unorm2_normalizeSecondAndAppend U_ICU_ENTRY_POINT_RENAME(unorm2_normalizeSecondAndAppend) -// #define unorm2_openFiltered U_ICU_ENTRY_POINT_RENAME(unorm2_openFiltered) -// #define unorm2_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm2_quickCheck) -// #define unorm2_spanQuickCheckYes U_ICU_ENTRY_POINT_RENAME(unorm2_spanQuickCheckYes) -// #define unorm2_swap U_ICU_ENTRY_POINT_RENAME(unorm2_swap) -// #define unorm_compare U_ICU_ENTRY_POINT_RENAME(unorm_compare) -// #define unorm_concatenate U_ICU_ENTRY_POINT_RENAME(unorm_concatenate) -// #define unorm_getFCD16 U_ICU_ENTRY_POINT_RENAME(unorm_getFCD16) -// #define unorm_getQuickCheck U_ICU_ENTRY_POINT_RENAME(unorm_getQuickCheck) -// #define unorm_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm_isNormalized) -// #define unorm_isNormalizedWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_isNormalizedWithOptions) -// #define unorm_next U_ICU_ENTRY_POINT_RENAME(unorm_next) -// #define unorm_normalize U_ICU_ENTRY_POINT_RENAME(unorm_normalize) -// #define unorm_previous U_ICU_ENTRY_POINT_RENAME(unorm_previous) -// #define unorm_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm_quickCheck) -// #define unorm_quickCheckWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_quickCheckWithOptions) -// #define unum_applyPattern U_ICU_ENTRY_POINT_RENAME(unum_applyPattern) -// #define unum_clone U_ICU_ENTRY_POINT_RENAME(unum_clone) -// #define unum_close U_ICU_ENTRY_POINT_RENAME(unum_close) -// #define unum_countAvailable U_ICU_ENTRY_POINT_RENAME(unum_countAvailable) -// #define unum_format U_ICU_ENTRY_POINT_RENAME(unum_format) -// #define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal) -// #define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble) -// #define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency) -// #define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields) -// #define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64) -// #define unum_formatUFormattable U_ICU_ENTRY_POINT_RENAME(unum_formatUFormattable) -// #define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute) -// #define unum_getAvailable U_ICU_ENTRY_POINT_RENAME(unum_getAvailable) -// #define unum_getContext U_ICU_ENTRY_POINT_RENAME(unum_getContext) -// #define unum_getDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_getDoubleAttribute) -// #define unum_getLocaleByType U_ICU_ENTRY_POINT_RENAME(unum_getLocaleByType) -// #define unum_getSymbol U_ICU_ENTRY_POINT_RENAME(unum_getSymbol) -// #define unum_getTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_getTextAttribute) -// #define unum_open U_ICU_ENTRY_POINT_RENAME(unum_open) -// #define unum_parse U_ICU_ENTRY_POINT_RENAME(unum_parse) -// #define unum_parseDecimal U_ICU_ENTRY_POINT_RENAME(unum_parseDecimal) -// #define unum_parseDouble U_ICU_ENTRY_POINT_RENAME(unum_parseDouble) -// #define unum_parseDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_parseDoubleCurrency) -// #define unum_parseInt64 U_ICU_ENTRY_POINT_RENAME(unum_parseInt64) -// #define unum_parseToUFormattable U_ICU_ENTRY_POINT_RENAME(unum_parseToUFormattable) -// #define unum_setAttribute U_ICU_ENTRY_POINT_RENAME(unum_setAttribute) -// #define unum_setContext U_ICU_ENTRY_POINT_RENAME(unum_setContext) -// #define unum_setDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_setDoubleAttribute) -// #define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol) -// #define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute) -// #define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern) -// #define unumf_close U_ICU_ENTRY_POINT_RENAME(unumf_close) -// #define unumf_closeResult U_ICU_ENTRY_POINT_RENAME(unumf_closeResult) -// #define unumf_formatDecimal U_ICU_ENTRY_POINT_RENAME(unumf_formatDecimal) -// #define unumf_formatDouble U_ICU_ENTRY_POINT_RENAME(unumf_formatDouble) -// #define unumf_formatInt U_ICU_ENTRY_POINT_RENAME(unumf_formatInt) -// #define unumf_openForSkeletonAndLocale U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocale) -// #define unumf_openForSkeletonAndLocaleWithError U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocaleWithError) -// #define unumf_openResult U_ICU_ENTRY_POINT_RENAME(unumf_openResult) -// #define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue) -// #define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions) -// #define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition) -// #define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString) -// #define unumsys_close U_ICU_ENTRY_POINT_RENAME(unumsys_close) -// #define unumsys_getDescription U_ICU_ENTRY_POINT_RENAME(unumsys_getDescription) -// #define unumsys_getName U_ICU_ENTRY_POINT_RENAME(unumsys_getName) -// #define unumsys_getRadix U_ICU_ENTRY_POINT_RENAME(unumsys_getRadix) -// #define unumsys_isAlgorithmic U_ICU_ENTRY_POINT_RENAME(unumsys_isAlgorithmic) -// #define unumsys_open U_ICU_ENTRY_POINT_RENAME(unumsys_open) -// #define unumsys_openAvailableNames U_ICU_ENTRY_POINT_RENAME(unumsys_openAvailableNames) -// #define unumsys_openByName U_ICU_ENTRY_POINT_RENAME(unumsys_openByName) -// #define uplrules_close U_ICU_ENTRY_POINT_RENAME(uplrules_close) -// #define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords) -// #define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open) -// #define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType) -// #define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select) -// #define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted) -// #define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) -// #define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) -// #define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary) -// #define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration) -// #define uplug_getContext U_ICU_ENTRY_POINT_RENAME(uplug_getContext) -// #define uplug_getCurrentLevel U_ICU_ENTRY_POINT_RENAME(uplug_getCurrentLevel) -// #define uplug_getLibrary U_ICU_ENTRY_POINT_RENAME(uplug_getLibrary) -// #define uplug_getLibraryName U_ICU_ENTRY_POINT_RENAME(uplug_getLibraryName) -// #define uplug_getPlugInternal U_ICU_ENTRY_POINT_RENAME(uplug_getPlugInternal) -// #define uplug_getPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLevel) -// #define uplug_getPlugLoadStatus U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLoadStatus) -// #define uplug_getPlugName U_ICU_ENTRY_POINT_RENAME(uplug_getPlugName) -// #define uplug_getPluginFile U_ICU_ENTRY_POINT_RENAME(uplug_getPluginFile) -// #define uplug_getSymbolName U_ICU_ENTRY_POINT_RENAME(uplug_getSymbolName) -// #define uplug_init U_ICU_ENTRY_POINT_RENAME(uplug_init) -// #define uplug_loadPlugFromEntrypoint U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromEntrypoint) -// #define uplug_loadPlugFromLibrary U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromLibrary) -// #define uplug_nextPlug U_ICU_ENTRY_POINT_RENAME(uplug_nextPlug) -// #define uplug_openLibrary U_ICU_ENTRY_POINT_RENAME(uplug_openLibrary) -// #define uplug_removePlug U_ICU_ENTRY_POINT_RENAME(uplug_removePlug) -// #define uplug_setContext U_ICU_ENTRY_POINT_RENAME(uplug_setContext) -// #define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel) -// #define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName) -// #define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload) -// #define uprops_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uprops_addPropertyStarts) -// #define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource) -// #define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts) -// #define uprv_add32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_add32_overflow) -// #define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy) -// #define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic) -// #define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower) -// #define uprv_calloc U_ICU_ENTRY_POINT_RENAME(uprv_calloc) -// #define uprv_ceil U_ICU_ENTRY_POINT_RENAME(uprv_ceil) -// #define uprv_compareASCIIPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareASCIIPropertyNames) -// #define uprv_compareEBCDICPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareEBCDICPropertyNames) -// #define uprv_compareInvAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvAscii) -// #define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic) -// #define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii) -// #define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID) -// #define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform) -// #define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix) -// #define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii) -// #define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic) -// #define uprv_currencyLeads U_ICU_ENTRY_POINT_RENAME(uprv_currencyLeads) -// #define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus) -// #define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault) -// #define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding) -// #define uprv_decContextGetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetStatus) -// #define uprv_decContextRestoreStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextRestoreStatus) -// #define uprv_decContextSaveStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSaveStatus) -// #define uprv_decContextSetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetRounding) -// #define uprv_decContextSetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatus) -// #define uprv_decContextSetStatusFromString U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromString) -// #define uprv_decContextSetStatusFromStringQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromStringQuiet) -// #define uprv_decContextSetStatusQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusQuiet) -// #define uprv_decContextStatusToString U_ICU_ENTRY_POINT_RENAME(uprv_decContextStatusToString) -// #define uprv_decContextTestSavedStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestSavedStatus) -// #define uprv_decContextTestStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestStatus) -// #define uprv_decContextZeroStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextZeroStatus) -// #define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs) -// #define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd) -// #define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd) -// #define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString) -// #define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare) -// #define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal) -// #define uprv_decNumberCompareTotal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotal) -// #define uprv_decNumberCompareTotalMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotalMag) -// #define uprv_decNumberCopy U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopy) -// #define uprv_decNumberCopyAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyAbs) -// #define uprv_decNumberCopyNegate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyNegate) -// #define uprv_decNumberCopySign U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopySign) -// #define uprv_decNumberDivide U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivide) -// #define uprv_decNumberDivideInteger U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivideInteger) -// #define uprv_decNumberExp U_ICU_ENTRY_POINT_RENAME(uprv_decNumberExp) -// #define uprv_decNumberFMA U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFMA) -// #define uprv_decNumberFromInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromInt32) -// #define uprv_decNumberFromString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromString) -// #define uprv_decNumberFromUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromUInt32) -// #define uprv_decNumberGetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberGetBCD) -// #define uprv_decNumberInvert U_ICU_ENTRY_POINT_RENAME(uprv_decNumberInvert) -// #define uprv_decNumberIsNormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsNormal) -// #define uprv_decNumberIsSubnormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsSubnormal) -// #define uprv_decNumberLn U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLn) -// #define uprv_decNumberLog10 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLog10) -// #define uprv_decNumberLogB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLogB) -// #define uprv_decNumberMax U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMax) -// #define uprv_decNumberMaxMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMaxMag) -// #define uprv_decNumberMin U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMin) -// #define uprv_decNumberMinMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinMag) -// #define uprv_decNumberMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinus) -// #define uprv_decNumberMultiply U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMultiply) -// #define uprv_decNumberNextMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextMinus) -// #define uprv_decNumberNextPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextPlus) -// #define uprv_decNumberNextToward U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextToward) -// #define uprv_decNumberNormalize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNormalize) -// #define uprv_decNumberOr U_ICU_ENTRY_POINT_RENAME(uprv_decNumberOr) -// #define uprv_decNumberPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPlus) -// #define uprv_decNumberPower U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPower) -// #define uprv_decNumberQuantize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberQuantize) -// #define uprv_decNumberReduce U_ICU_ENTRY_POINT_RENAME(uprv_decNumberReduce) -// #define uprv_decNumberRemainder U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainder) -// #define uprv_decNumberRemainderNear U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainderNear) -// #define uprv_decNumberRescale U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRescale) -// #define uprv_decNumberRotate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRotate) -// #define uprv_decNumberSameQuantum U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSameQuantum) -// #define uprv_decNumberScaleB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberScaleB) -// #define uprv_decNumberSetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSetBCD) -// #define uprv_decNumberShift U_ICU_ENTRY_POINT_RENAME(uprv_decNumberShift) -// #define uprv_decNumberSquareRoot U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSquareRoot) -// #define uprv_decNumberSubtract U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSubtract) -// #define uprv_decNumberToEngString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToEngString) -// #define uprv_decNumberToInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToInt32) -// #define uprv_decNumberToIntegralExact U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralExact) -// #define uprv_decNumberToIntegralValue U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralValue) -// #define uprv_decNumberToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToString) -// #define uprv_decNumberToUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToUInt32) -// #define uprv_decNumberTrim U_ICU_ENTRY_POINT_RENAME(uprv_decNumberTrim) -// #define uprv_decNumberVersion U_ICU_ENTRY_POINT_RENAME(uprv_decNumberVersion) -// #define uprv_decNumberXor U_ICU_ENTRY_POINT_RENAME(uprv_decNumberXor) -// #define uprv_decNumberZero U_ICU_ENTRY_POINT_RENAME(uprv_decNumberZero) -// #define uprv_deleteConditionalCE32 U_ICU_ENTRY_POINT_RENAME(uprv_deleteConditionalCE32) -// #define uprv_deleteUObject U_ICU_ENTRY_POINT_RENAME(uprv_deleteUObject) -// #define uprv_dl_close U_ICU_ENTRY_POINT_RENAME(uprv_dl_close) -// #define uprv_dl_open U_ICU_ENTRY_POINT_RENAME(uprv_dl_open) -// #define uprv_dlsym_func U_ICU_ENTRY_POINT_RENAME(uprv_dlsym_func) -// #define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy) -// #define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii) -// #define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii) -// #define uprv_ebcdicToLowercaseAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToLowercaseAscii) -// #define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower) -// #define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs) -// #define uprv_floor U_ICU_ENTRY_POINT_RENAME(uprv_floor) -// #define uprv_fmax U_ICU_ENTRY_POINT_RENAME(uprv_fmax) -// #define uprv_fmin U_ICU_ENTRY_POINT_RENAME(uprv_fmin) -// #define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod) -// #define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free) -// #define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters) -// #define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID) -// #define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity) -// #define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength) -// #define uprv_getMaxValues U_ICU_ENTRY_POINT_RENAME(uprv_getMaxValues) -// #define uprv_getNaN U_ICU_ENTRY_POINT_RENAME(uprv_getNaN) -// #define uprv_getRawUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getRawUTCtime) -// #define uprv_getStaticCurrencyName U_ICU_ENTRY_POINT_RENAME(uprv_getStaticCurrencyName) -// #define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime) -// #define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator) -// #define uprv_isASCIILetter U_ICU_ENTRY_POINT_RENAME(uprv_isASCIILetter) -// #define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign) -// #define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite) -// #define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString) -// #define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString) -// #define uprv_isNaN U_ICU_ENTRY_POINT_RENAME(uprv_isNaN) -// #define uprv_isNegativeInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isNegativeInfinity) -// #define uprv_isPositiveInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isPositiveInfinity) -// #define uprv_itou U_ICU_ENTRY_POINT_RENAME(uprv_itou) -// #define uprv_log U_ICU_ENTRY_POINT_RENAME(uprv_log) -// #define uprv_malloc U_ICU_ENTRY_POINT_RENAME(uprv_malloc) -// #define uprv_mapFile U_ICU_ENTRY_POINT_RENAME(uprv_mapFile) -// #define uprv_max U_ICU_ENTRY_POINT_RENAME(uprv_max) -// #define uprv_maxMantissa U_ICU_ENTRY_POINT_RENAME(uprv_maxMantissa) -// #define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr) -// #define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min) -// #define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf) -// #define uprv_mul32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_mul32_overflow) -// #define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency) -// #define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute) -// #define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow) -// #define uprv_pow10 U_ICU_ENTRY_POINT_RENAME(uprv_pow10) -// #define uprv_realloc U_ICU_ENTRY_POINT_RENAME(uprv_realloc) -// #define uprv_round U_ICU_ENTRY_POINT_RENAME(uprv_round) -// #define uprv_sortArray U_ICU_ENTRY_POINT_RENAME(uprv_sortArray) -// #define uprv_stableBinarySearch U_ICU_ENTRY_POINT_RENAME(uprv_stableBinarySearch) -// #define uprv_strCompare U_ICU_ENTRY_POINT_RENAME(uprv_strCompare) -// #define uprv_strdup U_ICU_ENTRY_POINT_RENAME(uprv_strdup) -// #define uprv_stricmp U_ICU_ENTRY_POINT_RENAME(uprv_stricmp) -// #define uprv_strndup U_ICU_ENTRY_POINT_RENAME(uprv_strndup) -// #define uprv_strnicmp U_ICU_ENTRY_POINT_RENAME(uprv_strnicmp) -// #define uprv_syntaxError U_ICU_ENTRY_POINT_RENAME(uprv_syntaxError) -// #define uprv_timezone U_ICU_ENTRY_POINT_RENAME(uprv_timezone) -// #define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper) -// #define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc) -// #define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname) -// #define uprv_tzname_clear_cache U_ICU_ENTRY_POINT_RENAME(uprv_tzname_clear_cache) -// #define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset) -// #define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator) -// #define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator) -// #define uprv_unmapFile U_ICU_ENTRY_POINT_RENAME(uprv_unmapFile) -// #define upvec_cloneArray U_ICU_ENTRY_POINT_RENAME(upvec_cloneArray) -// #define upvec_close U_ICU_ENTRY_POINT_RENAME(upvec_close) -// #define upvec_compact U_ICU_ENTRY_POINT_RENAME(upvec_compact) -// #define upvec_compactToUTrie2Handler U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2Handler) -// #define upvec_compactToUTrie2WithRowIndexes U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2WithRowIndexes) -// #define upvec_getArray U_ICU_ENTRY_POINT_RENAME(upvec_getArray) -// #define upvec_getRow U_ICU_ENTRY_POINT_RENAME(upvec_getRow) -// #define upvec_getValue U_ICU_ENTRY_POINT_RENAME(upvec_getValue) -// #define upvec_open U_ICU_ENTRY_POINT_RENAME(upvec_open) -// #define upvec_setValue U_ICU_ENTRY_POINT_RENAME(upvec_setValue) -// #define uregex_appendReplacement U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacement) -// #define uregex_appendReplacementUText U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacementUText) -// #define uregex_appendTail U_ICU_ENTRY_POINT_RENAME(uregex_appendTail) -// #define uregex_appendTailUText U_ICU_ENTRY_POINT_RENAME(uregex_appendTailUText) -// #define uregex_clone U_ICU_ENTRY_POINT_RENAME(uregex_clone) -// #define uregex_close U_ICU_ENTRY_POINT_RENAME(uregex_close) -// #define uregex_end U_ICU_ENTRY_POINT_RENAME(uregex_end) -// #define uregex_end64 U_ICU_ENTRY_POINT_RENAME(uregex_end64) -// #define uregex_find U_ICU_ENTRY_POINT_RENAME(uregex_find) -// #define uregex_find64 U_ICU_ENTRY_POINT_RENAME(uregex_find64) -// #define uregex_findNext U_ICU_ENTRY_POINT_RENAME(uregex_findNext) -// #define uregex_flags U_ICU_ENTRY_POINT_RENAME(uregex_flags) -// #define uregex_getFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_getFindProgressCallback) -// #define uregex_getMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_getMatchCallback) -// #define uregex_getStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_getStackLimit) -// #define uregex_getText U_ICU_ENTRY_POINT_RENAME(uregex_getText) -// #define uregex_getTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_getTimeLimit) -// #define uregex_getUText U_ICU_ENTRY_POINT_RENAME(uregex_getUText) -// #define uregex_group U_ICU_ENTRY_POINT_RENAME(uregex_group) -// #define uregex_groupCount U_ICU_ENTRY_POINT_RENAME(uregex_groupCount) -// #define uregex_groupNumberFromCName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromCName) -// #define uregex_groupNumberFromName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromName) -// #define uregex_groupUText U_ICU_ENTRY_POINT_RENAME(uregex_groupUText) -// #define uregex_hasAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasAnchoringBounds) -// #define uregex_hasTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasTransparentBounds) -// #define uregex_hitEnd U_ICU_ENTRY_POINT_RENAME(uregex_hitEnd) -// #define uregex_lookingAt U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt) -// #define uregex_lookingAt64 U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt64) -// #define uregex_matches U_ICU_ENTRY_POINT_RENAME(uregex_matches) -// #define uregex_matches64 U_ICU_ENTRY_POINT_RENAME(uregex_matches64) -// #define uregex_open U_ICU_ENTRY_POINT_RENAME(uregex_open) -// #define uregex_openC U_ICU_ENTRY_POINT_RENAME(uregex_openC) -// #define uregex_openUText U_ICU_ENTRY_POINT_RENAME(uregex_openUText) -// #define uregex_pattern U_ICU_ENTRY_POINT_RENAME(uregex_pattern) -// #define uregex_patternUText U_ICU_ENTRY_POINT_RENAME(uregex_patternUText) -// #define uregex_refreshUText U_ICU_ENTRY_POINT_RENAME(uregex_refreshUText) -// #define uregex_regionEnd U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd) -// #define uregex_regionEnd64 U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd64) -// #define uregex_regionStart U_ICU_ENTRY_POINT_RENAME(uregex_regionStart) -// #define uregex_regionStart64 U_ICU_ENTRY_POINT_RENAME(uregex_regionStart64) -// #define uregex_replaceAll U_ICU_ENTRY_POINT_RENAME(uregex_replaceAll) -// #define uregex_replaceAllUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceAllUText) -// #define uregex_replaceFirst U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirst) -// #define uregex_replaceFirstUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirstUText) -// #define uregex_requireEnd U_ICU_ENTRY_POINT_RENAME(uregex_requireEnd) -// #define uregex_reset U_ICU_ENTRY_POINT_RENAME(uregex_reset) -// #define uregex_reset64 U_ICU_ENTRY_POINT_RENAME(uregex_reset64) -// #define uregex_setFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_setFindProgressCallback) -// #define uregex_setMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_setMatchCallback) -// #define uregex_setRegion U_ICU_ENTRY_POINT_RENAME(uregex_setRegion) -// #define uregex_setRegion64 U_ICU_ENTRY_POINT_RENAME(uregex_setRegion64) -// #define uregex_setRegionAndStart U_ICU_ENTRY_POINT_RENAME(uregex_setRegionAndStart) -// #define uregex_setStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_setStackLimit) -// #define uregex_setText U_ICU_ENTRY_POINT_RENAME(uregex_setText) -// #define uregex_setTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_setTimeLimit) -// #define uregex_setUText U_ICU_ENTRY_POINT_RENAME(uregex_setUText) -// #define uregex_split U_ICU_ENTRY_POINT_RENAME(uregex_split) -// #define uregex_splitUText U_ICU_ENTRY_POINT_RENAME(uregex_splitUText) -// #define uregex_start U_ICU_ENTRY_POINT_RENAME(uregex_start) -// #define uregex_start64 U_ICU_ENTRY_POINT_RENAME(uregex_start64) -// #define uregex_ucstr_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_ucstr_unescape_charAt) -// #define uregex_useAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_useAnchoringBounds) -// #define uregex_useTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_useTransparentBounds) -// #define uregex_utext_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_utext_unescape_charAt) -// #define uregion_areEqual U_ICU_ENTRY_POINT_RENAME(uregion_areEqual) -// #define uregion_contains U_ICU_ENTRY_POINT_RENAME(uregion_contains) -// #define uregion_getAvailable U_ICU_ENTRY_POINT_RENAME(uregion_getAvailable) -// #define uregion_getContainedRegions U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegions) -// #define uregion_getContainedRegionsOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegionsOfType) -// #define uregion_getContainingRegion U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegion) -// #define uregion_getContainingRegionOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegionOfType) -// #define uregion_getNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getNumericCode) -// #define uregion_getPreferredValues U_ICU_ENTRY_POINT_RENAME(uregion_getPreferredValues) -// #define uregion_getRegionCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionCode) -// #define uregion_getRegionFromCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromCode) -// #define uregion_getRegionFromNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromNumericCode) -// #define uregion_getType U_ICU_ENTRY_POINT_RENAME(uregion_getType) -// #define ureldatefmt_close U_ICU_ENTRY_POINT_RENAME(ureldatefmt_close) -// #define ureldatefmt_closeResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_closeResult) -// #define ureldatefmt_combineDateAndTime U_ICU_ENTRY_POINT_RENAME(ureldatefmt_combineDateAndTime) -// #define ureldatefmt_format U_ICU_ENTRY_POINT_RENAME(ureldatefmt_format) -// #define ureldatefmt_formatNumeric U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumeric) -// #define ureldatefmt_formatNumericToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumericToResult) -// #define ureldatefmt_formatToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatToResult) -// #define ureldatefmt_open U_ICU_ENTRY_POINT_RENAME(ureldatefmt_open) -// #define ureldatefmt_openResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_openResult) -// #define ureldatefmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ureldatefmt_resultAsValue) -// #define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close) -// #define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb) -// #define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems) -// #define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource) -// #define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource) -// #define ures_getAllItemsWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getAllItemsWithFallback) -// #define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary) -// #define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex) -// #define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey) -// #define ures_getByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getByKeyWithFallback) -// #define ures_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ures_getFunctionalEquivalent) -// #define ures_getInt U_ICU_ENTRY_POINT_RENAME(ures_getInt) -// #define ures_getIntVector U_ICU_ENTRY_POINT_RENAME(ures_getIntVector) -// #define ures_getKey U_ICU_ENTRY_POINT_RENAME(ures_getKey) -// #define ures_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ures_getKeywordValues) -// #define ures_getLocale U_ICU_ENTRY_POINT_RENAME(ures_getLocale) -// #define ures_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ures_getLocaleByType) -// #define ures_getLocaleInternal U_ICU_ENTRY_POINT_RENAME(ures_getLocaleInternal) -// #define ures_getName U_ICU_ENTRY_POINT_RENAME(ures_getName) -// #define ures_getNextResource U_ICU_ENTRY_POINT_RENAME(ures_getNextResource) -// #define ures_getNextString U_ICU_ENTRY_POINT_RENAME(ures_getNextString) -// #define ures_getSize U_ICU_ENTRY_POINT_RENAME(ures_getSize) -// #define ures_getString U_ICU_ENTRY_POINT_RENAME(ures_getString) -// #define ures_getStringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getStringByIndex) -// #define ures_getStringByKey U_ICU_ENTRY_POINT_RENAME(ures_getStringByKey) -// #define ures_getStringByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getStringByKeyWithFallback) -// #define ures_getType U_ICU_ENTRY_POINT_RENAME(ures_getType) -// #define ures_getUInt U_ICU_ENTRY_POINT_RENAME(ures_getUInt) -// #define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String) -// #define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex) -// #define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey) -// #define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback) -// #define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion) -// #define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey) -// #define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber) -// #define ures_getVersionNumberInternal U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumberInternal) -// #define ures_hasNext U_ICU_ENTRY_POINT_RENAME(ures_hasNext) -// #define ures_initStackObject U_ICU_ENTRY_POINT_RENAME(ures_initStackObject) -// #define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open) -// #define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales) -// #define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect) -// #define ures_openDirectFillIn U_ICU_ENTRY_POINT_RENAME(ures_openDirectFillIn) -// #define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn) -// #define ures_openNoDefault U_ICU_ENTRY_POINT_RENAME(ures_openNoDefault) -// #define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU) -// #define ures_resetIterator U_ICU_ENTRY_POINT_RENAME(ures_resetIterator) -// #define ures_swap U_ICU_ENTRY_POINT_RENAME(ures_swap) -// #define uscript_breaksBetweenLetters U_ICU_ENTRY_POINT_RENAME(uscript_breaksBetweenLetters) -// #define uscript_closeRun U_ICU_ENTRY_POINT_RENAME(uscript_closeRun) -// #define uscript_getCode U_ICU_ENTRY_POINT_RENAME(uscript_getCode) -// #define uscript_getName U_ICU_ENTRY_POINT_RENAME(uscript_getName) -// #define uscript_getSampleString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleString) -// #define uscript_getSampleUnicodeString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleUnicodeString) -// #define uscript_getScript U_ICU_ENTRY_POINT_RENAME(uscript_getScript) -// #define uscript_getScriptExtensions U_ICU_ENTRY_POINT_RENAME(uscript_getScriptExtensions) -// #define uscript_getShortName U_ICU_ENTRY_POINT_RENAME(uscript_getShortName) -// #define uscript_getUsage U_ICU_ENTRY_POINT_RENAME(uscript_getUsage) -// #define uscript_hasScript U_ICU_ENTRY_POINT_RENAME(uscript_hasScript) -// #define uscript_isCased U_ICU_ENTRY_POINT_RENAME(uscript_isCased) -// #define uscript_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uscript_isRightToLeft) -// #define uscript_nextRun U_ICU_ENTRY_POINT_RENAME(uscript_nextRun) -// #define uscript_openRun U_ICU_ENTRY_POINT_RENAME(uscript_openRun) -// #define uscript_resetRun U_ICU_ENTRY_POINT_RENAME(uscript_resetRun) -// #define uscript_setRunText U_ICU_ENTRY_POINT_RENAME(uscript_setRunText) -// #define usearch_close U_ICU_ENTRY_POINT_RENAME(usearch_close) -// #define usearch_first U_ICU_ENTRY_POINT_RENAME(usearch_first) -// #define usearch_following U_ICU_ENTRY_POINT_RENAME(usearch_following) -// #define usearch_getAttribute U_ICU_ENTRY_POINT_RENAME(usearch_getAttribute) -// #define usearch_getBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_getBreakIterator) -// #define usearch_getCollator U_ICU_ENTRY_POINT_RENAME(usearch_getCollator) -// #define usearch_getMatchedLength U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedLength) -// #define usearch_getMatchedStart U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedStart) -// #define usearch_getMatchedText U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedText) -// #define usearch_getOffset U_ICU_ENTRY_POINT_RENAME(usearch_getOffset) -// #define usearch_getPattern U_ICU_ENTRY_POINT_RENAME(usearch_getPattern) -// #define usearch_getText U_ICU_ENTRY_POINT_RENAME(usearch_getText) -// #define usearch_handleNextCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handleNextCanonical) -// #define usearch_handleNextExact U_ICU_ENTRY_POINT_RENAME(usearch_handleNextExact) -// #define usearch_handlePreviousCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousCanonical) -// #define usearch_handlePreviousExact U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousExact) -// #define usearch_last U_ICU_ENTRY_POINT_RENAME(usearch_last) -// #define usearch_next U_ICU_ENTRY_POINT_RENAME(usearch_next) -// #define usearch_open U_ICU_ENTRY_POINT_RENAME(usearch_open) -// #define usearch_openFromCollator U_ICU_ENTRY_POINT_RENAME(usearch_openFromCollator) -// #define usearch_preceding U_ICU_ENTRY_POINT_RENAME(usearch_preceding) -// #define usearch_previous U_ICU_ENTRY_POINT_RENAME(usearch_previous) -// #define usearch_reset U_ICU_ENTRY_POINT_RENAME(usearch_reset) -// #define usearch_search U_ICU_ENTRY_POINT_RENAME(usearch_search) -// #define usearch_searchBackwards U_ICU_ENTRY_POINT_RENAME(usearch_searchBackwards) -// #define usearch_setAttribute U_ICU_ENTRY_POINT_RENAME(usearch_setAttribute) -// #define usearch_setBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_setBreakIterator) -// #define usearch_setCollator U_ICU_ENTRY_POINT_RENAME(usearch_setCollator) -// #define usearch_setOffset U_ICU_ENTRY_POINT_RENAME(usearch_setOffset) -// #define usearch_setPattern U_ICU_ENTRY_POINT_RENAME(usearch_setPattern) -// #define usearch_setText U_ICU_ENTRY_POINT_RENAME(usearch_setText) -// #define uset_add U_ICU_ENTRY_POINT_RENAME(uset_add) -// #define uset_addAll U_ICU_ENTRY_POINT_RENAME(uset_addAll) -// #define uset_addAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_addAllCodePoints) -// #define uset_addRange U_ICU_ENTRY_POINT_RENAME(uset_addRange) -// #define uset_addString U_ICU_ENTRY_POINT_RENAME(uset_addString) -// #define uset_applyIntPropertyValue U_ICU_ENTRY_POINT_RENAME(uset_applyIntPropertyValue) -// #define uset_applyPattern U_ICU_ENTRY_POINT_RENAME(uset_applyPattern) -// #define uset_applyPropertyAlias U_ICU_ENTRY_POINT_RENAME(uset_applyPropertyAlias) -// #define uset_charAt U_ICU_ENTRY_POINT_RENAME(uset_charAt) -// #define uset_clear U_ICU_ENTRY_POINT_RENAME(uset_clear) -// #define uset_clone U_ICU_ENTRY_POINT_RENAME(uset_clone) -// #define uset_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(uset_cloneAsThawed) -// #define uset_close U_ICU_ENTRY_POINT_RENAME(uset_close) -// #define uset_closeOver U_ICU_ENTRY_POINT_RENAME(uset_closeOver) -// #define uset_compact U_ICU_ENTRY_POINT_RENAME(uset_compact) -// #define uset_complement U_ICU_ENTRY_POINT_RENAME(uset_complement) -// #define uset_complementAll U_ICU_ENTRY_POINT_RENAME(uset_complementAll) -// #define uset_contains U_ICU_ENTRY_POINT_RENAME(uset_contains) -// #define uset_containsAll U_ICU_ENTRY_POINT_RENAME(uset_containsAll) -// #define uset_containsAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_containsAllCodePoints) -// #define uset_containsNone U_ICU_ENTRY_POINT_RENAME(uset_containsNone) -// #define uset_containsRange U_ICU_ENTRY_POINT_RENAME(uset_containsRange) -// #define uset_containsSome U_ICU_ENTRY_POINT_RENAME(uset_containsSome) -// #define uset_containsString U_ICU_ENTRY_POINT_RENAME(uset_containsString) -// #define uset_equals U_ICU_ENTRY_POINT_RENAME(uset_equals) -// #define uset_freeze U_ICU_ENTRY_POINT_RENAME(uset_freeze) -// #define uset_getItem U_ICU_ENTRY_POINT_RENAME(uset_getItem) -// #define uset_getItemCount U_ICU_ENTRY_POINT_RENAME(uset_getItemCount) -// #define uset_getSerializedRange U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRange) -// #define uset_getSerializedRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRangeCount) -// #define uset_getSerializedSet U_ICU_ENTRY_POINT_RENAME(uset_getSerializedSet) -// #define uset_indexOf U_ICU_ENTRY_POINT_RENAME(uset_indexOf) -// #define uset_isEmpty U_ICU_ENTRY_POINT_RENAME(uset_isEmpty) -// #define uset_isFrozen U_ICU_ENTRY_POINT_RENAME(uset_isFrozen) -// #define uset_open U_ICU_ENTRY_POINT_RENAME(uset_open) -// #define uset_openEmpty U_ICU_ENTRY_POINT_RENAME(uset_openEmpty) -// #define uset_openPattern U_ICU_ENTRY_POINT_RENAME(uset_openPattern) -// #define uset_openPatternOptions U_ICU_ENTRY_POINT_RENAME(uset_openPatternOptions) -// #define uset_remove U_ICU_ENTRY_POINT_RENAME(uset_remove) -// #define uset_removeAll U_ICU_ENTRY_POINT_RENAME(uset_removeAll) -// #define uset_removeAllStrings U_ICU_ENTRY_POINT_RENAME(uset_removeAllStrings) -// #define uset_removeRange U_ICU_ENTRY_POINT_RENAME(uset_removeRange) -// #define uset_removeString U_ICU_ENTRY_POINT_RENAME(uset_removeString) -// #define uset_resemblesPattern U_ICU_ENTRY_POINT_RENAME(uset_resemblesPattern) -// #define uset_retain U_ICU_ENTRY_POINT_RENAME(uset_retain) -// #define uset_retainAll U_ICU_ENTRY_POINT_RENAME(uset_retainAll) -// #define uset_serialize U_ICU_ENTRY_POINT_RENAME(uset_serialize) -// #define uset_serializedContains U_ICU_ENTRY_POINT_RENAME(uset_serializedContains) -// #define uset_set U_ICU_ENTRY_POINT_RENAME(uset_set) -// #define uset_setSerializedToOne U_ICU_ENTRY_POINT_RENAME(uset_setSerializedToOne) -// #define uset_size U_ICU_ENTRY_POINT_RENAME(uset_size) -// #define uset_span U_ICU_ENTRY_POINT_RENAME(uset_span) -// #define uset_spanBack U_ICU_ENTRY_POINT_RENAME(uset_spanBack) -// #define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8) -// #define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8) -// #define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern) -// #define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable) -// #define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8) -// #define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString) -// #define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check) -// #define uspoof_check2 U_ICU_ENTRY_POINT_RENAME(uspoof_check2) -// #define uspoof_check2UTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_check2UTF8) -// #define uspoof_check2UnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_check2UnicodeString) -// #define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8) -// #define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString) -// #define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone) -// #define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close) -// #define uspoof_closeCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_closeCheckResult) -// #define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars) -// #define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales) -// #define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet) -// #define uspoof_getCheckResultChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultChecks) -// #define uspoof_getCheckResultNumerics U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultNumerics) -// #define uspoof_getCheckResultRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultRestrictionLevel) -// #define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks) -// #define uspoof_getInclusionSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionSet) -// #define uspoof_getInclusionUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionUnicodeSet) -// #define uspoof_getRecommendedSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedSet) -// #define uspoof_getRecommendedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedUnicodeSet) -// #define uspoof_getRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getRestrictionLevel) -// #define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton) -// #define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8) -// #define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString) -// #define uspoof_internalInitStatics U_ICU_ENTRY_POINT_RENAME(uspoof_internalInitStatics) -// #define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open) -// #define uspoof_openCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_openCheckResult) -// #define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized) -// #define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource) -// #define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize) -// #define uspoof_setAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedChars) -// #define uspoof_setAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedLocales) -// #define uspoof_setAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedUnicodeSet) -// #define uspoof_setChecks U_ICU_ENTRY_POINT_RENAME(uspoof_setChecks) -// #define uspoof_setRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_setRestrictionLevel) -// #define uspoof_swap U_ICU_ENTRY_POINT_RENAME(uspoof_swap) -// #define usprep_close U_ICU_ENTRY_POINT_RENAME(usprep_close) -// #define usprep_open U_ICU_ENTRY_POINT_RENAME(usprep_open) -// #define usprep_openByType U_ICU_ENTRY_POINT_RENAME(usprep_openByType) -// #define usprep_prepare U_ICU_ENTRY_POINT_RENAME(usprep_prepare) -// #define usprep_swap U_ICU_ENTRY_POINT_RENAME(usprep_swap) -// #define ustr_hashCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashCharsN) -// #define ustr_hashICharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashICharsN) -// #define ustr_hashUCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashUCharsN) -// #define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale) -// #define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator) -// #define ustrcase_internalFold U_ICU_ENTRY_POINT_RENAME(ustrcase_internalFold) -// #define ustrcase_internalToLower U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToLower) -// #define ustrcase_internalToTitle U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToTitle) -// #define ustrcase_internalToUpper U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToUpper) -// #define ustrcase_map U_ICU_ENTRY_POINT_RENAME(ustrcase_map) -// #define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap) -// #define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At) -// #define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone) -// #define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close) -// #define utext_copy U_ICU_ENTRY_POINT_RENAME(utext_copy) -// #define utext_current32 U_ICU_ENTRY_POINT_RENAME(utext_current32) -// #define utext_equals U_ICU_ENTRY_POINT_RENAME(utext_equals) -// #define utext_extract U_ICU_ENTRY_POINT_RENAME(utext_extract) -// #define utext_freeze U_ICU_ENTRY_POINT_RENAME(utext_freeze) -// #define utext_getNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getNativeIndex) -// #define utext_getPreviousNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getPreviousNativeIndex) -// #define utext_hasMetaData U_ICU_ENTRY_POINT_RENAME(utext_hasMetaData) -// #define utext_isLengthExpensive U_ICU_ENTRY_POINT_RENAME(utext_isLengthExpensive) -// #define utext_isWritable U_ICU_ENTRY_POINT_RENAME(utext_isWritable) -// #define utext_moveIndex32 U_ICU_ENTRY_POINT_RENAME(utext_moveIndex32) -// #define utext_nativeLength U_ICU_ENTRY_POINT_RENAME(utext_nativeLength) -// #define utext_next32 U_ICU_ENTRY_POINT_RENAME(utext_next32) -// #define utext_next32From U_ICU_ENTRY_POINT_RENAME(utext_next32From) -// #define utext_openCharacterIterator U_ICU_ENTRY_POINT_RENAME(utext_openCharacterIterator) -// #define utext_openConstUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openConstUnicodeString) -// #define utext_openReplaceable U_ICU_ENTRY_POINT_RENAME(utext_openReplaceable) -// #define utext_openUChars U_ICU_ENTRY_POINT_RENAME(utext_openUChars) -// #define utext_openUTF8 U_ICU_ENTRY_POINT_RENAME(utext_openUTF8) -// #define utext_openUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openUnicodeString) -// #define utext_previous32 U_ICU_ENTRY_POINT_RENAME(utext_previous32) -// #define utext_previous32From U_ICU_ENTRY_POINT_RENAME(utext_previous32From) -// #define utext_replace U_ICU_ENTRY_POINT_RENAME(utext_replace) -// #define utext_setNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_setNativeIndex) -// #define utext_setup U_ICU_ENTRY_POINT_RENAME(utext_setup) -// #define utf8_appendCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_appendCharSafeBody) -// #define utf8_back1SafeBody U_ICU_ENTRY_POINT_RENAME(utf8_back1SafeBody) -// #define utf8_countTrailBytes U_ICU_ENTRY_POINT_RENAME(utf8_countTrailBytes) -// #define utf8_nextCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_nextCharSafeBody) -// #define utf8_prevCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_prevCharSafeBody) -// #define utmscale_fromInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_fromInt64) -// #define utmscale_getTimeScaleValue U_ICU_ENTRY_POINT_RENAME(utmscale_getTimeScaleValue) -// #define utmscale_toInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_toInt64) -// #define utrace_cleanup U_ICU_ENTRY_POINT_RENAME(utrace_cleanup) -// #define utrace_data U_ICU_ENTRY_POINT_RENAME(utrace_data) -// #define utrace_entry U_ICU_ENTRY_POINT_RENAME(utrace_entry) -// #define utrace_exit U_ICU_ENTRY_POINT_RENAME(utrace_exit) -// #define utrace_format U_ICU_ENTRY_POINT_RENAME(utrace_format) -// #define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName) -// #define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions) -// #define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel) -// #define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions) -// #define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel) -// #define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat) -// #define utrans_clone U_ICU_ENTRY_POINT_RENAME(utrans_clone) -// #define utrans_close U_ICU_ENTRY_POINT_RENAME(utrans_close) -// #define utrans_countAvailableIDs U_ICU_ENTRY_POINT_RENAME(utrans_countAvailableIDs) -// #define utrans_getAvailableID U_ICU_ENTRY_POINT_RENAME(utrans_getAvailableID) -// #define utrans_getID U_ICU_ENTRY_POINT_RENAME(utrans_getID) -// #define utrans_getSourceSet U_ICU_ENTRY_POINT_RENAME(utrans_getSourceSet) -// #define utrans_getUnicodeID U_ICU_ENTRY_POINT_RENAME(utrans_getUnicodeID) -// #define utrans_open U_ICU_ENTRY_POINT_RENAME(utrans_open) -// #define utrans_openIDs U_ICU_ENTRY_POINT_RENAME(utrans_openIDs) -// #define utrans_openInverse U_ICU_ENTRY_POINT_RENAME(utrans_openInverse) -// #define utrans_openU U_ICU_ENTRY_POINT_RENAME(utrans_openU) -// #define utrans_register U_ICU_ENTRY_POINT_RENAME(utrans_register) -// #define utrans_rep_caseContextIterator U_ICU_ENTRY_POINT_RENAME(utrans_rep_caseContextIterator) -// #define utrans_setFilter U_ICU_ENTRY_POINT_RENAME(utrans_setFilter) -// #define utrans_stripRules U_ICU_ENTRY_POINT_RENAME(utrans_stripRules) -// #define utrans_toRules U_ICU_ENTRY_POINT_RENAME(utrans_toRules) -// #define utrans_trans U_ICU_ENTRY_POINT_RENAME(utrans_trans) -// #define utrans_transIncremental U_ICU_ENTRY_POINT_RENAME(utrans_transIncremental) -// #define utrans_transIncrementalUChars U_ICU_ENTRY_POINT_RENAME(utrans_transIncrementalUChars) -// #define utrans_transUChars U_ICU_ENTRY_POINT_RENAME(utrans_transUChars) -// #define utrans_transliterator_cleanup U_ICU_ENTRY_POINT_RENAME(utrans_transliterator_cleanup) -// #define utrans_unregister U_ICU_ENTRY_POINT_RENAME(utrans_unregister) -// #define utrans_unregisterID U_ICU_ENTRY_POINT_RENAME(utrans_unregisterID) -// #define utrie2_clone U_ICU_ENTRY_POINT_RENAME(utrie2_clone) -// #define utrie2_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(utrie2_cloneAsThawed) -// #define utrie2_close U_ICU_ENTRY_POINT_RENAME(utrie2_close) -// #define utrie2_enum U_ICU_ENTRY_POINT_RENAME(utrie2_enum) -// #define utrie2_enumForLeadSurrogate U_ICU_ENTRY_POINT_RENAME(utrie2_enumForLeadSurrogate) -// #define utrie2_freeze U_ICU_ENTRY_POINT_RENAME(utrie2_freeze) -// #define utrie2_fromUTrie U_ICU_ENTRY_POINT_RENAME(utrie2_fromUTrie) -// #define utrie2_get32 U_ICU_ENTRY_POINT_RENAME(utrie2_get32) -// #define utrie2_get32FromLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_get32FromLeadSurrogateCodeUnit) -// #define utrie2_internalU8NextIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8NextIndex) -// #define utrie2_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8PrevIndex) -// #define utrie2_isFrozen U_ICU_ENTRY_POINT_RENAME(utrie2_isFrozen) -// #define utrie2_open U_ICU_ENTRY_POINT_RENAME(utrie2_open) -// #define utrie2_openDummy U_ICU_ENTRY_POINT_RENAME(utrie2_openDummy) -// #define utrie2_openFromSerialized U_ICU_ENTRY_POINT_RENAME(utrie2_openFromSerialized) -// #define utrie2_serialize U_ICU_ENTRY_POINT_RENAME(utrie2_serialize) -// #define utrie2_set32 U_ICU_ENTRY_POINT_RENAME(utrie2_set32) -// #define utrie2_set32ForLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_set32ForLeadSurrogateCodeUnit) -// #define utrie2_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie2_setRange32) -// #define utrie2_swap U_ICU_ENTRY_POINT_RENAME(utrie2_swap) -// #define utrie_clone U_ICU_ENTRY_POINT_RENAME(utrie_clone) -// #define utrie_close U_ICU_ENTRY_POINT_RENAME(utrie_close) -// #define utrie_defaultGetFoldingOffset U_ICU_ENTRY_POINT_RENAME(utrie_defaultGetFoldingOffset) -// #define utrie_enum U_ICU_ENTRY_POINT_RENAME(utrie_enum) -// #define utrie_get32 U_ICU_ENTRY_POINT_RENAME(utrie_get32) -// #define utrie_getData U_ICU_ENTRY_POINT_RENAME(utrie_getData) -// #define utrie_open U_ICU_ENTRY_POINT_RENAME(utrie_open) -// #define utrie_serialize U_ICU_ENTRY_POINT_RENAME(utrie_serialize) -// #define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32) -// #define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32) -// #define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap) -// #define utrie_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie_swapAnyVersion) -// #define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize) -// #define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy) -// #define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone) -// #define vzone_close U_ICU_ENTRY_POINT_RENAME(vzone_close) -// #define vzone_countTransitionRules U_ICU_ENTRY_POINT_RENAME(vzone_countTransitionRules) -// #define vzone_equals U_ICU_ENTRY_POINT_RENAME(vzone_equals) -// #define vzone_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(vzone_getDynamicClassID) -// #define vzone_getLastModified U_ICU_ENTRY_POINT_RENAME(vzone_getLastModified) -// #define vzone_getNextTransition U_ICU_ENTRY_POINT_RENAME(vzone_getNextTransition) -// #define vzone_getOffset U_ICU_ENTRY_POINT_RENAME(vzone_getOffset) -// #define vzone_getOffset2 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset2) -// #define vzone_getOffset3 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset3) -// #define vzone_getPreviousTransition U_ICU_ENTRY_POINT_RENAME(vzone_getPreviousTransition) -// #define vzone_getRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_getRawOffset) -// #define vzone_getStaticClassID U_ICU_ENTRY_POINT_RENAME(vzone_getStaticClassID) -// #define vzone_getTZURL U_ICU_ENTRY_POINT_RENAME(vzone_getTZURL) -// #define vzone_hasSameRules U_ICU_ENTRY_POINT_RENAME(vzone_hasSameRules) -// #define vzone_inDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_inDaylightTime) -// #define vzone_openData U_ICU_ENTRY_POINT_RENAME(vzone_openData) -// #define vzone_openID U_ICU_ENTRY_POINT_RENAME(vzone_openID) -// #define vzone_setLastModified U_ICU_ENTRY_POINT_RENAME(vzone_setLastModified) -// #define vzone_setRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_setRawOffset) -// #define vzone_setTZURL U_ICU_ENTRY_POINT_RENAME(vzone_setTZURL) -// #define vzone_useDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_useDaylightTime) -// #define vzone_write U_ICU_ENTRY_POINT_RENAME(vzone_write) -// #define vzone_writeFromStart U_ICU_ENTRY_POINT_RENAME(vzone_writeFromStart) -// #define vzone_writeSimple U_ICU_ENTRY_POINT_RENAME(vzone_writeSimple) -// #define zrule_close U_ICU_ENTRY_POINT_RENAME(zrule_close) -// #define zrule_equals U_ICU_ENTRY_POINT_RENAME(zrule_equals) -// #define zrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(zrule_getDSTSavings) -// #define zrule_getName U_ICU_ENTRY_POINT_RENAME(zrule_getName) -// #define zrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(zrule_getRawOffset) -// #define zrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(zrule_isEquivalentTo) -// #define ztrans_adoptFrom U_ICU_ENTRY_POINT_RENAME(ztrans_adoptFrom) -// #define ztrans_adoptTo U_ICU_ENTRY_POINT_RENAME(ztrans_adoptTo) -// #define ztrans_clone U_ICU_ENTRY_POINT_RENAME(ztrans_clone) -// #define ztrans_close U_ICU_ENTRY_POINT_RENAME(ztrans_close) -// #define ztrans_equals U_ICU_ENTRY_POINT_RENAME(ztrans_equals) -// #define ztrans_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getDynamicClassID) -// #define ztrans_getFrom U_ICU_ENTRY_POINT_RENAME(ztrans_getFrom) -// #define ztrans_getStaticClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getStaticClassID) -// #define ztrans_getTime U_ICU_ENTRY_POINT_RENAME(ztrans_getTime) -// #define ztrans_getTo U_ICU_ENTRY_POINT_RENAME(ztrans_getTo) -// #define ztrans_open U_ICU_ENTRY_POINT_RENAME(ztrans_open) -// #define ztrans_openEmpty U_ICU_ENTRY_POINT_RENAME(ztrans_openEmpty) -// #define ztrans_setFrom U_ICU_ENTRY_POINT_RENAME(ztrans_setFrom) -// #define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime) -// #define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo) +#define CreateLSTMBreakEngine U_ICU_ENTRY_POINT_RENAME(CreateLSTMBreakEngine) +#define CreateLSTMData U_ICU_ENTRY_POINT_RENAME(CreateLSTMData) +#define CreateLSTMDataForScript U_ICU_ENTRY_POINT_RENAME(CreateLSTMDataForScript) +#define DeleteLSTMData U_ICU_ENTRY_POINT_RENAME(DeleteLSTMData) +#define LSTMDataName U_ICU_ENTRY_POINT_RENAME(LSTMDataName) +#define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString) +#define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString) +#define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger) +#define T_CString_toLowerCase U_ICU_ENTRY_POINT_RENAME(T_CString_toLowerCase) +#define T_CString_toUpperCase U_ICU_ENTRY_POINT_RENAME(T_CString_toUpperCase) +#define UCNV_FROM_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_ESCAPE) +#define UCNV_FROM_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SKIP) +#define UCNV_FROM_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_STOP) +#define UCNV_FROM_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SUBSTITUTE) +#define UCNV_TO_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_ESCAPE) +#define UCNV_TO_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SKIP) +#define UCNV_TO_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_STOP) +#define UCNV_TO_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SUBSTITUTE) +#define UDataMemory_createNewInstance U_ICU_ENTRY_POINT_RENAME(UDataMemory_createNewInstance) +#define UDataMemory_init U_ICU_ENTRY_POINT_RENAME(UDataMemory_init) +#define UDataMemory_isLoaded U_ICU_ENTRY_POINT_RENAME(UDataMemory_isLoaded) +#define UDataMemory_normalizeDataPointer U_ICU_ENTRY_POINT_RENAME(UDataMemory_normalizeDataPointer) +#define UDataMemory_setData U_ICU_ENTRY_POINT_RENAME(UDataMemory_setData) +#define UDatamemory_assign U_ICU_ENTRY_POINT_RENAME(UDatamemory_assign) +#define _ASCIIData U_ICU_ENTRY_POINT_RENAME(_ASCIIData) +#define _Bocu1Data U_ICU_ENTRY_POINT_RENAME(_Bocu1Data) +#define _CESU8Data U_ICU_ENTRY_POINT_RENAME(_CESU8Data) +#define _CompoundTextData U_ICU_ENTRY_POINT_RENAME(_CompoundTextData) +#define _HZData U_ICU_ENTRY_POINT_RENAME(_HZData) +#define _IMAPData U_ICU_ENTRY_POINT_RENAME(_IMAPData) +#define _ISCIIData U_ICU_ENTRY_POINT_RENAME(_ISCIIData) +#define _ISO2022Data U_ICU_ENTRY_POINT_RENAME(_ISO2022Data) +#define _LMBCSData1 U_ICU_ENTRY_POINT_RENAME(_LMBCSData1) +#define _LMBCSData11 U_ICU_ENTRY_POINT_RENAME(_LMBCSData11) +#define _LMBCSData16 U_ICU_ENTRY_POINT_RENAME(_LMBCSData16) +#define _LMBCSData17 U_ICU_ENTRY_POINT_RENAME(_LMBCSData17) +#define _LMBCSData18 U_ICU_ENTRY_POINT_RENAME(_LMBCSData18) +#define _LMBCSData19 U_ICU_ENTRY_POINT_RENAME(_LMBCSData19) +#define _LMBCSData2 U_ICU_ENTRY_POINT_RENAME(_LMBCSData2) +#define _LMBCSData3 U_ICU_ENTRY_POINT_RENAME(_LMBCSData3) +#define _LMBCSData4 U_ICU_ENTRY_POINT_RENAME(_LMBCSData4) +#define _LMBCSData5 U_ICU_ENTRY_POINT_RENAME(_LMBCSData5) +#define _LMBCSData6 U_ICU_ENTRY_POINT_RENAME(_LMBCSData6) +#define _LMBCSData8 U_ICU_ENTRY_POINT_RENAME(_LMBCSData8) +#define _Latin1Data U_ICU_ENTRY_POINT_RENAME(_Latin1Data) +#define _MBCSData U_ICU_ENTRY_POINT_RENAME(_MBCSData) +#define _SCSUData U_ICU_ENTRY_POINT_RENAME(_SCSUData) +#define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData) +#define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data) +#define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData) +#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data) +#define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData) +#define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data) +#define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData) +#define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data) +#define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data) +#define _isUnicodeLocaleTypeSubtag U_ICU_ENTRY_POINT_RENAME(_isUnicodeLocaleTypeSubtag) +#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup) +#define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup) +#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup) +#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats) +#define gTimeZoneFilesInitOnce U_ICU_ENTRY_POINT_RENAME(gTimeZoneFilesInitOnce) +#define initNumsysNames U_ICU_ENTRY_POINT_RENAME(initNumsysNames) +#define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone) +#define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close) +#define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals) +#define izrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(izrule_getDSTSavings) +#define izrule_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(izrule_getDynamicClassID) +#define izrule_getFinalStart U_ICU_ENTRY_POINT_RENAME(izrule_getFinalStart) +#define izrule_getFirstStart U_ICU_ENTRY_POINT_RENAME(izrule_getFirstStart) +#define izrule_getName U_ICU_ENTRY_POINT_RENAME(izrule_getName) +#define izrule_getNextStart U_ICU_ENTRY_POINT_RENAME(izrule_getNextStart) +#define izrule_getPreviousStart U_ICU_ENTRY_POINT_RENAME(izrule_getPreviousStart) +#define izrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(izrule_getRawOffset) +#define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID) +#define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo) +#define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open) +#define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) +#define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) +#define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default) +#define mixedMeasuresToMicros U_ICU_ENTRY_POINT_RENAME(mixedMeasuresToMicros) +#define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup) +#define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun) +#define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun) +#define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun) +#define pl_close U_ICU_ENTRY_POINT_RENAME(pl_close) +#define pl_closeFontRuns U_ICU_ENTRY_POINT_RENAME(pl_closeFontRuns) +#define pl_closeLine U_ICU_ENTRY_POINT_RENAME(pl_closeLine) +#define pl_closeLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_closeLocaleRuns) +#define pl_closeValueRuns U_ICU_ENTRY_POINT_RENAME(pl_closeValueRuns) +#define pl_countLineRuns U_ICU_ENTRY_POINT_RENAME(pl_countLineRuns) +#define pl_create U_ICU_ENTRY_POINT_RENAME(pl_create) +#define pl_getAscent U_ICU_ENTRY_POINT_RENAME(pl_getAscent) +#define pl_getDescent U_ICU_ENTRY_POINT_RENAME(pl_getDescent) +#define pl_getFontRunCount U_ICU_ENTRY_POINT_RENAME(pl_getFontRunCount) +#define pl_getFontRunFont U_ICU_ENTRY_POINT_RENAME(pl_getFontRunFont) +#define pl_getFontRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLastLimit) +#define pl_getFontRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLimit) +#define pl_getLeading U_ICU_ENTRY_POINT_RENAME(pl_getLeading) +#define pl_getLineAscent U_ICU_ENTRY_POINT_RENAME(pl_getLineAscent) +#define pl_getLineDescent U_ICU_ENTRY_POINT_RENAME(pl_getLineDescent) +#define pl_getLineLeading U_ICU_ENTRY_POINT_RENAME(pl_getLineLeading) +#define pl_getLineVisualRun U_ICU_ENTRY_POINT_RENAME(pl_getLineVisualRun) +#define pl_getLineWidth U_ICU_ENTRY_POINT_RENAME(pl_getLineWidth) +#define pl_getLocaleRunCount U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunCount) +#define pl_getLocaleRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLastLimit) +#define pl_getLocaleRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLimit) +#define pl_getLocaleRunLocale U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLocale) +#define pl_getParagraphLevel U_ICU_ENTRY_POINT_RENAME(pl_getParagraphLevel) +#define pl_getTextDirection U_ICU_ENTRY_POINT_RENAME(pl_getTextDirection) +#define pl_getValueRunCount U_ICU_ENTRY_POINT_RENAME(pl_getValueRunCount) +#define pl_getValueRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLastLimit) +#define pl_getValueRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLimit) +#define pl_getValueRunValue U_ICU_ENTRY_POINT_RENAME(pl_getValueRunValue) +#define pl_getVisualRunAscent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunAscent) +#define pl_getVisualRunDescent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDescent) +#define pl_getVisualRunDirection U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDirection) +#define pl_getVisualRunFont U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunFont) +#define pl_getVisualRunGlyphCount U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphCount) +#define pl_getVisualRunGlyphToCharMap U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphToCharMap) +#define pl_getVisualRunGlyphs U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphs) +#define pl_getVisualRunLeading U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunLeading) +#define pl_getVisualRunPositions U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunPositions) +#define pl_isComplex U_ICU_ENTRY_POINT_RENAME(pl_isComplex) +#define pl_nextLine U_ICU_ENTRY_POINT_RENAME(pl_nextLine) +#define pl_openEmptyFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyFontRuns) +#define pl_openEmptyLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyLocaleRuns) +#define pl_openEmptyValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyValueRuns) +#define pl_openFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openFontRuns) +#define pl_openLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openLocaleRuns) +#define pl_openValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openValueRuns) +#define pl_reflow U_ICU_ENTRY_POINT_RENAME(pl_reflow) +#define pl_resetFontRuns U_ICU_ENTRY_POINT_RENAME(pl_resetFontRuns) +#define pl_resetLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_resetLocaleRuns) +#define pl_resetValueRuns U_ICU_ENTRY_POINT_RENAME(pl_resetValueRuns) +#define rbbi_cleanup U_ICU_ENTRY_POINT_RENAME(rbbi_cleanup) +#define res_countArrayItems U_ICU_ENTRY_POINT_RENAME(res_countArrayItems) +#define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource) +#define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias) +#define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem) +#define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace) +#define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace) +#define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType) +#define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource) +#define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace) +#define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex) +#define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey) +#define res_load U_ICU_ENTRY_POINT_RENAME(res_load) +#define res_read U_ICU_ENTRY_POINT_RENAME(res_read) +#define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload) +#define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars) +#define u_asciiToUpper U_ICU_ENTRY_POINT_RENAME(u_asciiToUpper) +#define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy) +#define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy) +#define u_caseInsensitivePrefixMatch U_ICU_ENTRY_POINT_RENAME(u_caseInsensitivePrefixMatch) +#define u_catclose U_ICU_ENTRY_POINT_RENAME(u_catclose) +#define u_catgets U_ICU_ENTRY_POINT_RENAME(u_catgets) +#define u_catopen U_ICU_ENTRY_POINT_RENAME(u_catopen) +#define u_charAge U_ICU_ENTRY_POINT_RENAME(u_charAge) +#define u_charDigitValue U_ICU_ENTRY_POINT_RENAME(u_charDigitValue) +#define u_charDirection U_ICU_ENTRY_POINT_RENAME(u_charDirection) +#define u_charFromName U_ICU_ENTRY_POINT_RENAME(u_charFromName) +#define u_charMirror U_ICU_ENTRY_POINT_RENAME(u_charMirror) +#define u_charName U_ICU_ENTRY_POINT_RENAME(u_charName) +#define u_charType U_ICU_ENTRY_POINT_RENAME(u_charType) +#define u_charsToUChars U_ICU_ENTRY_POINT_RENAME(u_charsToUChars) +#define u_cleanup U_ICU_ENTRY_POINT_RENAME(u_cleanup) +#define u_countChar32 U_ICU_ENTRY_POINT_RENAME(u_countChar32) +#define u_digit U_ICU_ENTRY_POINT_RENAME(u_digit) +#define u_enumCharNames U_ICU_ENTRY_POINT_RENAME(u_enumCharNames) +#define u_enumCharTypes U_ICU_ENTRY_POINT_RENAME(u_enumCharTypes) +#define u_errorName U_ICU_ENTRY_POINT_RENAME(u_errorName) +#define u_fadopt U_ICU_ENTRY_POINT_RENAME(u_fadopt) +#define u_fclose U_ICU_ENTRY_POINT_RENAME(u_fclose) +#define u_feof U_ICU_ENTRY_POINT_RENAME(u_feof) +#define u_fflush U_ICU_ENTRY_POINT_RENAME(u_fflush) +#define u_fgetConverter U_ICU_ENTRY_POINT_RENAME(u_fgetConverter) +#define u_fgetNumberFormat U_ICU_ENTRY_POINT_RENAME(u_fgetNumberFormat) +#define u_fgetc U_ICU_ENTRY_POINT_RENAME(u_fgetc) +#define u_fgetcodepage U_ICU_ENTRY_POINT_RENAME(u_fgetcodepage) +#define u_fgetcx U_ICU_ENTRY_POINT_RENAME(u_fgetcx) +#define u_fgetfile U_ICU_ENTRY_POINT_RENAME(u_fgetfile) +#define u_fgetlocale U_ICU_ENTRY_POINT_RENAME(u_fgetlocale) +#define u_fgets U_ICU_ENTRY_POINT_RENAME(u_fgets) +#define u_file_read U_ICU_ENTRY_POINT_RENAME(u_file_read) +#define u_file_write U_ICU_ENTRY_POINT_RENAME(u_file_write) +#define u_file_write_flush U_ICU_ENTRY_POINT_RENAME(u_file_write_flush) +#define u_finit U_ICU_ENTRY_POINT_RENAME(u_finit) +#define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter) +#define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase) +#define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen) +#define u_fopen_u U_ICU_ENTRY_POINT_RENAME(u_fopen_u) +#define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit) +#define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage) +#define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError) +#define u_fprintf U_ICU_ENTRY_POINT_RENAME(u_fprintf) +#define u_fprintf_u U_ICU_ENTRY_POINT_RENAME(u_fprintf_u) +#define u_fputc U_ICU_ENTRY_POINT_RENAME(u_fputc) +#define u_fputs U_ICU_ENTRY_POINT_RENAME(u_fputs) +#define u_frewind U_ICU_ENTRY_POINT_RENAME(u_frewind) +#define u_fscanf U_ICU_ENTRY_POINT_RENAME(u_fscanf) +#define u_fscanf_u U_ICU_ENTRY_POINT_RENAME(u_fscanf_u) +#define u_fsetcodepage U_ICU_ENTRY_POINT_RENAME(u_fsetcodepage) +#define u_fsetlocale U_ICU_ENTRY_POINT_RENAME(u_fsetlocale) +#define u_fsettransliterator U_ICU_ENTRY_POINT_RENAME(u_fsettransliterator) +#define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen) +#define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc) +#define u_getBidiPairedBracket U_ICU_ENTRY_POINT_RENAME(u_getBidiPairedBracket) +#define u_getBinaryPropertySet U_ICU_ENTRY_POINT_RENAME(u_getBinaryPropertySet) +#define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass) +#define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory) +#define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion) +#define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter) +#define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure) +#define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment) +#define u_getIntPropertyMap U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMap) +#define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue) +#define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue) +#define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue) +#define u_getMainProperties U_ICU_ENTRY_POINT_RENAME(u_getMainProperties) +#define u_getNumericValue U_ICU_ENTRY_POINT_RENAME(u_getNumericValue) +#define u_getPropertyEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyEnum) +#define u_getPropertyName U_ICU_ENTRY_POINT_RENAME(u_getPropertyName) +#define u_getPropertyValueEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueEnum) +#define u_getPropertyValueName U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueName) +#define u_getTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_getTimeZoneFilesDirectory) +#define u_getUnicodeProperties U_ICU_ENTRY_POINT_RENAME(u_getUnicodeProperties) +#define u_getUnicodeVersion U_ICU_ENTRY_POINT_RENAME(u_getUnicodeVersion) +#define u_getVersion U_ICU_ENTRY_POINT_RENAME(u_getVersion) +#define u_get_stdout U_ICU_ENTRY_POINT_RENAME(u_get_stdout) +#define u_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_hasBinaryProperty) +#define u_init U_ICU_ENTRY_POINT_RENAME(u_init) +#define u_isIDIgnorable U_ICU_ENTRY_POINT_RENAME(u_isIDIgnorable) +#define u_isIDPart U_ICU_ENTRY_POINT_RENAME(u_isIDPart) +#define u_isIDStart U_ICU_ENTRY_POINT_RENAME(u_isIDStart) +#define u_isISOControl U_ICU_ENTRY_POINT_RENAME(u_isISOControl) +#define u_isJavaIDPart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDPart) +#define u_isJavaIDStart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDStart) +#define u_isJavaSpaceChar U_ICU_ENTRY_POINT_RENAME(u_isJavaSpaceChar) +#define u_isMirrored U_ICU_ENTRY_POINT_RENAME(u_isMirrored) +#define u_isUAlphabetic U_ICU_ENTRY_POINT_RENAME(u_isUAlphabetic) +#define u_isULowercase U_ICU_ENTRY_POINT_RENAME(u_isULowercase) +#define u_isUUppercase U_ICU_ENTRY_POINT_RENAME(u_isUUppercase) +#define u_isUWhiteSpace U_ICU_ENTRY_POINT_RENAME(u_isUWhiteSpace) +#define u_isWhitespace U_ICU_ENTRY_POINT_RENAME(u_isWhitespace) +#define u_isalnum U_ICU_ENTRY_POINT_RENAME(u_isalnum) +#define u_isalnumPOSIX U_ICU_ENTRY_POINT_RENAME(u_isalnumPOSIX) +#define u_isalpha U_ICU_ENTRY_POINT_RENAME(u_isalpha) +#define u_isbase U_ICU_ENTRY_POINT_RENAME(u_isbase) +#define u_isblank U_ICU_ENTRY_POINT_RENAME(u_isblank) +#define u_iscntrl U_ICU_ENTRY_POINT_RENAME(u_iscntrl) +#define u_isdefined U_ICU_ENTRY_POINT_RENAME(u_isdefined) +#define u_isdigit U_ICU_ENTRY_POINT_RENAME(u_isdigit) +#define u_isgraph U_ICU_ENTRY_POINT_RENAME(u_isgraph) +#define u_isgraphPOSIX U_ICU_ENTRY_POINT_RENAME(u_isgraphPOSIX) +#define u_islower U_ICU_ENTRY_POINT_RENAME(u_islower) +#define u_isprint U_ICU_ENTRY_POINT_RENAME(u_isprint) +#define u_isprintPOSIX U_ICU_ENTRY_POINT_RENAME(u_isprintPOSIX) +#define u_ispunct U_ICU_ENTRY_POINT_RENAME(u_ispunct) +#define u_isspace U_ICU_ENTRY_POINT_RENAME(u_isspace) +#define u_istitle U_ICU_ENTRY_POINT_RENAME(u_istitle) +#define u_isupper U_ICU_ENTRY_POINT_RENAME(u_isupper) +#define u_isxdigit U_ICU_ENTRY_POINT_RENAME(u_isxdigit) +#define u_locbund_close U_ICU_ENTRY_POINT_RENAME(u_locbund_close) +#define u_locbund_getNumberFormat U_ICU_ENTRY_POINT_RENAME(u_locbund_getNumberFormat) +#define u_locbund_init U_ICU_ENTRY_POINT_RENAME(u_locbund_init) +#define u_memcasecmp U_ICU_ENTRY_POINT_RENAME(u_memcasecmp) +#define u_memchr U_ICU_ENTRY_POINT_RENAME(u_memchr) +#define u_memchr32 U_ICU_ENTRY_POINT_RENAME(u_memchr32) +#define u_memcmp U_ICU_ENTRY_POINT_RENAME(u_memcmp) +#define u_memcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_memcmpCodePointOrder) +#define u_memcpy U_ICU_ENTRY_POINT_RENAME(u_memcpy) +#define u_memmove U_ICU_ENTRY_POINT_RENAME(u_memmove) +#define u_memrchr U_ICU_ENTRY_POINT_RENAME(u_memrchr) +#define u_memrchr32 U_ICU_ENTRY_POINT_RENAME(u_memrchr32) +#define u_memset U_ICU_ENTRY_POINT_RENAME(u_memset) +#define u_parseMessage U_ICU_ENTRY_POINT_RENAME(u_parseMessage) +#define u_parseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_parseMessageWithError) +#define u_printf U_ICU_ENTRY_POINT_RENAME(u_printf) +#define u_printf_parse U_ICU_ENTRY_POINT_RENAME(u_printf_parse) +#define u_printf_u U_ICU_ENTRY_POINT_RENAME(u_printf_u) +#define u_releaseDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_releaseDefaultConverter) +#define u_scanf_parse U_ICU_ENTRY_POINT_RENAME(u_scanf_parse) +#define u_setAtomicIncDecFunctions U_ICU_ENTRY_POINT_RENAME(u_setAtomicIncDecFunctions) +#define u_setDataDirectory U_ICU_ENTRY_POINT_RENAME(u_setDataDirectory) +#define u_setMemoryFunctions U_ICU_ENTRY_POINT_RENAME(u_setMemoryFunctions) +#define u_setMutexFunctions U_ICU_ENTRY_POINT_RENAME(u_setMutexFunctions) +#define u_setTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_setTimeZoneFilesDirectory) +#define u_shapeArabic U_ICU_ENTRY_POINT_RENAME(u_shapeArabic) +#define u_snprintf U_ICU_ENTRY_POINT_RENAME(u_snprintf) +#define u_snprintf_u U_ICU_ENTRY_POINT_RENAME(u_snprintf_u) +#define u_sprintf U_ICU_ENTRY_POINT_RENAME(u_sprintf) +#define u_sprintf_u U_ICU_ENTRY_POINT_RENAME(u_sprintf_u) +#define u_sscanf U_ICU_ENTRY_POINT_RENAME(u_sscanf) +#define u_sscanf_u U_ICU_ENTRY_POINT_RENAME(u_sscanf_u) +#define u_strCaseCompare U_ICU_ENTRY_POINT_RENAME(u_strCaseCompare) +#define u_strCompare U_ICU_ENTRY_POINT_RENAME(u_strCompare) +#define u_strCompareIter U_ICU_ENTRY_POINT_RENAME(u_strCompareIter) +#define u_strFindFirst U_ICU_ENTRY_POINT_RENAME(u_strFindFirst) +#define u_strFindLast U_ICU_ENTRY_POINT_RENAME(u_strFindLast) +#define u_strFoldCase U_ICU_ENTRY_POINT_RENAME(u_strFoldCase) +#define u_strFromJavaModifiedUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromJavaModifiedUTF8WithSub) +#define u_strFromPunycode U_ICU_ENTRY_POINT_RENAME(u_strFromPunycode) +#define u_strFromUTF32 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32) +#define u_strFromUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32WithSub) +#define u_strFromUTF8 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8) +#define u_strFromUTF8Lenient U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8Lenient) +#define u_strFromUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8WithSub) +#define u_strFromWCS U_ICU_ENTRY_POINT_RENAME(u_strFromWCS) +#define u_strHasMoreChar32Than U_ICU_ENTRY_POINT_RENAME(u_strHasMoreChar32Than) +#define u_strToJavaModifiedUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToJavaModifiedUTF8) +#define u_strToLower U_ICU_ENTRY_POINT_RENAME(u_strToLower) +#define u_strToPunycode U_ICU_ENTRY_POINT_RENAME(u_strToPunycode) +#define u_strToTitle U_ICU_ENTRY_POINT_RENAME(u_strToTitle) +#define u_strToUTF32 U_ICU_ENTRY_POINT_RENAME(u_strToUTF32) +#define u_strToUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF32WithSub) +#define u_strToUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToUTF8) +#define u_strToUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF8WithSub) +#define u_strToUpper U_ICU_ENTRY_POINT_RENAME(u_strToUpper) +#define u_strToWCS U_ICU_ENTRY_POINT_RENAME(u_strToWCS) +#define u_strcasecmp U_ICU_ENTRY_POINT_RENAME(u_strcasecmp) +#define u_strcat U_ICU_ENTRY_POINT_RENAME(u_strcat) +#define u_strchr U_ICU_ENTRY_POINT_RENAME(u_strchr) +#define u_strchr32 U_ICU_ENTRY_POINT_RENAME(u_strchr32) +#define u_strcmp U_ICU_ENTRY_POINT_RENAME(u_strcmp) +#define u_strcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strcmpCodePointOrder) +#define u_strcmpFold U_ICU_ENTRY_POINT_RENAME(u_strcmpFold) +#define u_strcpy U_ICU_ENTRY_POINT_RENAME(u_strcpy) +#define u_strcspn U_ICU_ENTRY_POINT_RENAME(u_strcspn) +#define u_stringHasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_stringHasBinaryProperty) +#define u_strlen U_ICU_ENTRY_POINT_RENAME(u_strlen) +#define u_strncasecmp U_ICU_ENTRY_POINT_RENAME(u_strncasecmp) +#define u_strncat U_ICU_ENTRY_POINT_RENAME(u_strncat) +#define u_strncmp U_ICU_ENTRY_POINT_RENAME(u_strncmp) +#define u_strncmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strncmpCodePointOrder) +#define u_strncpy U_ICU_ENTRY_POINT_RENAME(u_strncpy) +#define u_strpbrk U_ICU_ENTRY_POINT_RENAME(u_strpbrk) +#define u_strrchr U_ICU_ENTRY_POINT_RENAME(u_strrchr) +#define u_strrchr32 U_ICU_ENTRY_POINT_RENAME(u_strrchr32) +#define u_strrstr U_ICU_ENTRY_POINT_RENAME(u_strrstr) +#define u_strspn U_ICU_ENTRY_POINT_RENAME(u_strspn) +#define u_strstr U_ICU_ENTRY_POINT_RENAME(u_strstr) +#define u_strtok_r U_ICU_ENTRY_POINT_RENAME(u_strtok_r) +#define u_terminateChars U_ICU_ENTRY_POINT_RENAME(u_terminateChars) +#define u_terminateUChar32s U_ICU_ENTRY_POINT_RENAME(u_terminateUChar32s) +#define u_terminateUChars U_ICU_ENTRY_POINT_RENAME(u_terminateUChars) +#define u_terminateWChars U_ICU_ENTRY_POINT_RENAME(u_terminateWChars) +#define u_tolower U_ICU_ENTRY_POINT_RENAME(u_tolower) +#define u_totitle U_ICU_ENTRY_POINT_RENAME(u_totitle) +#define u_toupper U_ICU_ENTRY_POINT_RENAME(u_toupper) +#define u_uastrcpy U_ICU_ENTRY_POINT_RENAME(u_uastrcpy) +#define u_uastrncpy U_ICU_ENTRY_POINT_RENAME(u_uastrncpy) +#define u_unescape U_ICU_ENTRY_POINT_RENAME(u_unescape) +#define u_unescapeAt U_ICU_ENTRY_POINT_RENAME(u_unescapeAt) +#define u_versionFromString U_ICU_ENTRY_POINT_RENAME(u_versionFromString) +#define u_versionFromUString U_ICU_ENTRY_POINT_RENAME(u_versionFromUString) +#define u_versionToString U_ICU_ENTRY_POINT_RENAME(u_versionToString) +#define u_vformatMessage U_ICU_ENTRY_POINT_RENAME(u_vformatMessage) +#define u_vformatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vformatMessageWithError) +#define u_vfprintf U_ICU_ENTRY_POINT_RENAME(u_vfprintf) +#define u_vfprintf_u U_ICU_ENTRY_POINT_RENAME(u_vfprintf_u) +#define u_vfscanf U_ICU_ENTRY_POINT_RENAME(u_vfscanf) +#define u_vfscanf_u U_ICU_ENTRY_POINT_RENAME(u_vfscanf_u) +#define u_vparseMessage U_ICU_ENTRY_POINT_RENAME(u_vparseMessage) +#define u_vparseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vparseMessageWithError) +#define u_vsnprintf U_ICU_ENTRY_POINT_RENAME(u_vsnprintf) +#define u_vsnprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsnprintf_u) +#define u_vsprintf U_ICU_ENTRY_POINT_RENAME(u_vsprintf) +#define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u) +#define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf) +#define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u) +#define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun) +#define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts) +#define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close) +#define ubidi_countParagraphs U_ICU_ENTRY_POINT_RENAME(ubidi_countParagraphs) +#define ubidi_countRuns U_ICU_ENTRY_POINT_RENAME(ubidi_countRuns) +#define ubidi_getBaseDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getBaseDirection) +#define ubidi_getClass U_ICU_ENTRY_POINT_RENAME(ubidi_getClass) +#define ubidi_getClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_getClassCallback) +#define ubidi_getCustomizedClass U_ICU_ENTRY_POINT_RENAME(ubidi_getCustomizedClass) +#define ubidi_getDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getDirection) +#define ubidi_getJoiningGroup U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningGroup) +#define ubidi_getJoiningType U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningType) +#define ubidi_getLength U_ICU_ENTRY_POINT_RENAME(ubidi_getLength) +#define ubidi_getLevelAt U_ICU_ENTRY_POINT_RENAME(ubidi_getLevelAt) +#define ubidi_getLevels U_ICU_ENTRY_POINT_RENAME(ubidi_getLevels) +#define ubidi_getLogicalIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalIndex) +#define ubidi_getLogicalMap U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalMap) +#define ubidi_getLogicalRun U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalRun) +#define ubidi_getMaxValue U_ICU_ENTRY_POINT_RENAME(ubidi_getMaxValue) +#define ubidi_getMemory U_ICU_ENTRY_POINT_RENAME(ubidi_getMemory) +#define ubidi_getMirror U_ICU_ENTRY_POINT_RENAME(ubidi_getMirror) +#define ubidi_getPairedBracket U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracket) +#define ubidi_getPairedBracketType U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracketType) +#define ubidi_getParaLevel U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevel) +#define ubidi_getParaLevelAtIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevelAtIndex) +#define ubidi_getParagraph U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraph) +#define ubidi_getParagraphByIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraphByIndex) +#define ubidi_getProcessedLength U_ICU_ENTRY_POINT_RENAME(ubidi_getProcessedLength) +#define ubidi_getReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingMode) +#define ubidi_getReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingOptions) +#define ubidi_getResultLength U_ICU_ENTRY_POINT_RENAME(ubidi_getResultLength) +#define ubidi_getRuns U_ICU_ENTRY_POINT_RENAME(ubidi_getRuns) +#define ubidi_getText U_ICU_ENTRY_POINT_RENAME(ubidi_getText) +#define ubidi_getVisualIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualIndex) +#define ubidi_getVisualMap U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualMap) +#define ubidi_getVisualRun U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualRun) +#define ubidi_invertMap U_ICU_ENTRY_POINT_RENAME(ubidi_invertMap) +#define ubidi_isBidiControl U_ICU_ENTRY_POINT_RENAME(ubidi_isBidiControl) +#define ubidi_isInverse U_ICU_ENTRY_POINT_RENAME(ubidi_isInverse) +#define ubidi_isJoinControl U_ICU_ENTRY_POINT_RENAME(ubidi_isJoinControl) +#define ubidi_isMirrored U_ICU_ENTRY_POINT_RENAME(ubidi_isMirrored) +#define ubidi_isOrderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_isOrderParagraphsLTR) +#define ubidi_open U_ICU_ENTRY_POINT_RENAME(ubidi_open) +#define ubidi_openSized U_ICU_ENTRY_POINT_RENAME(ubidi_openSized) +#define ubidi_orderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_orderParagraphsLTR) +#define ubidi_reorderLogical U_ICU_ENTRY_POINT_RENAME(ubidi_reorderLogical) +#define ubidi_reorderVisual U_ICU_ENTRY_POINT_RENAME(ubidi_reorderVisual) +#define ubidi_setClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_setClassCallback) +#define ubidi_setContext U_ICU_ENTRY_POINT_RENAME(ubidi_setContext) +#define ubidi_setInverse U_ICU_ENTRY_POINT_RENAME(ubidi_setInverse) +#define ubidi_setLine U_ICU_ENTRY_POINT_RENAME(ubidi_setLine) +#define ubidi_setPara U_ICU_ENTRY_POINT_RENAME(ubidi_setPara) +#define ubidi_setReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingMode) +#define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions) +#define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered) +#define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse) +#define ubiditransform_close U_ICU_ENTRY_POINT_RENAME(ubiditransform_close) +#define ubiditransform_open U_ICU_ENTRY_POINT_RENAME(ubiditransform_open) +#define ubiditransform_transform U_ICU_ENTRY_POINT_RENAME(ubiditransform_transform) +#define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode) +#define ubrk_clone U_ICU_ENTRY_POINT_RENAME(ubrk_clone) +#define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close) +#define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable) +#define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current) +#define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first) +#define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following) +#define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable) +#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules) +#define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType) +#define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus) +#define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec) +#define ubrk_isBoundary U_ICU_ENTRY_POINT_RENAME(ubrk_isBoundary) +#define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last) +#define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next) +#define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open) +#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules) +#define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules) +#define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding) +#define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous) +#define ubrk_refreshUText U_ICU_ENTRY_POINT_RENAME(ubrk_refreshUText) +#define ubrk_safeClone U_ICU_ENTRY_POINT_RENAME(ubrk_safeClone) +#define ubrk_setText U_ICU_ENTRY_POINT_RENAME(ubrk_setText) +#define ubrk_setUText U_ICU_ENTRY_POINT_RENAME(ubrk_setUText) +#define ubrk_swap U_ICU_ENTRY_POINT_RENAME(ubrk_swap) +#define ucal_add U_ICU_ENTRY_POINT_RENAME(ucal_add) +#define ucal_clear U_ICU_ENTRY_POINT_RENAME(ucal_clear) +#define ucal_clearField U_ICU_ENTRY_POINT_RENAME(ucal_clearField) +#define ucal_clone U_ICU_ENTRY_POINT_RENAME(ucal_clone) +#define ucal_close U_ICU_ENTRY_POINT_RENAME(ucal_close) +#define ucal_countAvailable U_ICU_ENTRY_POINT_RENAME(ucal_countAvailable) +#define ucal_equivalentTo U_ICU_ENTRY_POINT_RENAME(ucal_equivalentTo) +#define ucal_get U_ICU_ENTRY_POINT_RENAME(ucal_get) +#define ucal_getAttribute U_ICU_ENTRY_POINT_RENAME(ucal_getAttribute) +#define ucal_getAvailable U_ICU_ENTRY_POINT_RENAME(ucal_getAvailable) +#define ucal_getCanonicalTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getCanonicalTimeZoneID) +#define ucal_getDSTSavings U_ICU_ENTRY_POINT_RENAME(ucal_getDSTSavings) +#define ucal_getDayOfWeekType U_ICU_ENTRY_POINT_RENAME(ucal_getDayOfWeekType) +#define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone) +#define ucal_getFieldDifference U_ICU_ENTRY_POINT_RENAME(ucal_getFieldDifference) +#define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange) +#define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone) +#define ucal_getIanaTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getIanaTimeZoneID) +#define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale) +#define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit) +#define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType) +#define ucal_getMillis U_ICU_ENTRY_POINT_RENAME(ucal_getMillis) +#define ucal_getNow U_ICU_ENTRY_POINT_RENAME(ucal_getNow) +#define ucal_getTZDataVersion U_ICU_ENTRY_POINT_RENAME(ucal_getTZDataVersion) +#define ucal_getTimeZoneDisplayName U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneDisplayName) +#define ucal_getTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneID) +#define ucal_getTimeZoneIDForWindowsID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneIDForWindowsID) +#define ucal_getTimeZoneOffsetFromLocal U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneOffsetFromLocal) +#define ucal_getTimeZoneTransitionDate U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneTransitionDate) +#define ucal_getType U_ICU_ENTRY_POINT_RENAME(ucal_getType) +#define ucal_getWeekendTransition U_ICU_ENTRY_POINT_RENAME(ucal_getWeekendTransition) +#define ucal_getWindowsTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getWindowsTimeZoneID) +#define ucal_inDaylightTime U_ICU_ENTRY_POINT_RENAME(ucal_inDaylightTime) +#define ucal_isSet U_ICU_ENTRY_POINT_RENAME(ucal_isSet) +#define ucal_isWeekend U_ICU_ENTRY_POINT_RENAME(ucal_isWeekend) +#define ucal_open U_ICU_ENTRY_POINT_RENAME(ucal_open) +#define ucal_openCountryTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openCountryTimeZones) +#define ucal_openTimeZoneIDEnumeration U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZoneIDEnumeration) +#define ucal_openTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZones) +#define ucal_roll U_ICU_ENTRY_POINT_RENAME(ucal_roll) +#define ucal_set U_ICU_ENTRY_POINT_RENAME(ucal_set) +#define ucal_setAttribute U_ICU_ENTRY_POINT_RENAME(ucal_setAttribute) +#define ucal_setDate U_ICU_ENTRY_POINT_RENAME(ucal_setDate) +#define ucal_setDateTime U_ICU_ENTRY_POINT_RENAME(ucal_setDateTime) +#define ucal_setDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setDefaultTimeZone) +#define ucal_setGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_setGregorianChange) +#define ucal_setMillis U_ICU_ENTRY_POINT_RENAME(ucal_setMillis) +#define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone) +#define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure) +#define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts) +#define ucase_addSimpleCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addSimpleCaseClosure) +#define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure) +#define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold) +#define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale) +#define ucase_getSingleton U_ICU_ENTRY_POINT_RENAME(ucase_getSingleton) +#define ucase_getTrie U_ICU_ENTRY_POINT_RENAME(ucase_getTrie) +#define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType) +#define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable) +#define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty) +#define ucase_isCaseSensitive U_ICU_ENTRY_POINT_RENAME(ucase_isCaseSensitive) +#define ucase_isSoftDotted U_ICU_ENTRY_POINT_RENAME(ucase_isSoftDotted) +#define ucase_toFullFolding U_ICU_ENTRY_POINT_RENAME(ucase_toFullFolding) +#define ucase_toFullLower U_ICU_ENTRY_POINT_RENAME(ucase_toFullLower) +#define ucase_toFullTitle U_ICU_ENTRY_POINT_RENAME(ucase_toFullTitle) +#define ucase_toFullUpper U_ICU_ENTRY_POINT_RENAME(ucase_toFullUpper) +#define ucase_tolower U_ICU_ENTRY_POINT_RENAME(ucase_tolower) +#define ucase_totitle U_ICU_ENTRY_POINT_RENAME(ucase_totitle) +#define ucase_toupper U_ICU_ENTRY_POINT_RENAME(ucase_toupper) +#define ucasemap_close U_ICU_ENTRY_POINT_RENAME(ucasemap_close) +#define ucasemap_getBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_getBreakIterator) +#define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale) +#define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions) +#define ucasemap_internalUTF8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_internalUTF8ToTitle) +#define ucasemap_mapUTF8 U_ICU_ENTRY_POINT_RENAME(ucasemap_mapUTF8) +#define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open) +#define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator) +#define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale) +#define ucasemap_setOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_setOptions) +#define ucasemap_toTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_toTitle) +#define ucasemap_utf8FoldCase U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8FoldCase) +#define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower) +#define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle) +#define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper) +#define ucfpos_close U_ICU_ENTRY_POINT_RENAME(ucfpos_close) +#define ucfpos_constrainCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainCategory) +#define ucfpos_constrainField U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainField) +#define ucfpos_getCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_getCategory) +#define ucfpos_getField U_ICU_ENTRY_POINT_RENAME(ucfpos_getField) +#define ucfpos_getIndexes U_ICU_ENTRY_POINT_RENAME(ucfpos_getIndexes) +#define ucfpos_getInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_getInt64IterationContext) +#define ucfpos_matchesField U_ICU_ENTRY_POINT_RENAME(ucfpos_matchesField) +#define ucfpos_open U_ICU_ENTRY_POINT_RENAME(ucfpos_open) +#define ucfpos_reset U_ICU_ENTRY_POINT_RENAME(ucfpos_reset) +#define ucfpos_setInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_setInt64IterationContext) +#define ucfpos_setState U_ICU_ENTRY_POINT_RENAME(ucfpos_setState) +#define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts) +#define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames) +#define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne) +#define ucln_common_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_common_registerCleanup) +#define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup) +#define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup) +#define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup) +#define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup) +#define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32) +#define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets) +#define ucnv_MBCSGetFilteredUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetFilteredUnicodeSetForUnicode) +#define ucnv_MBCSGetType U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetType) +#define ucnv_MBCSGetUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetUnicodeSetForUnicode) +#define ucnv_MBCSIsLeadByte U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSIsLeadByte) +#define ucnv_MBCSSimpleGetNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSSimpleGetNextUChar) +#define ucnv_MBCSToUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSToUnicodeWithOffsets) +#define ucnv_bld_countAvailableConverters U_ICU_ENTRY_POINT_RENAME(ucnv_bld_countAvailableConverters) +#define ucnv_bld_getAvailableConverter U_ICU_ENTRY_POINT_RENAME(ucnv_bld_getAvailableConverter) +#define ucnv_canCreateConverter U_ICU_ENTRY_POINT_RENAME(ucnv_canCreateConverter) +#define ucnv_cbFromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteBytes) +#define ucnv_cbFromUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteSub) +#define ucnv_cbFromUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteUChars) +#define ucnv_cbToUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteSub) +#define ucnv_cbToUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteUChars) +#define ucnv_clone U_ICU_ENTRY_POINT_RENAME(ucnv_clone) +#define ucnv_close U_ICU_ENTRY_POINT_RENAME(ucnv_close) +#define ucnv_compareNames U_ICU_ENTRY_POINT_RENAME(ucnv_compareNames) +#define ucnv_convert U_ICU_ENTRY_POINT_RENAME(ucnv_convert) +#define ucnv_convertEx U_ICU_ENTRY_POINT_RENAME(ucnv_convertEx) +#define ucnv_countAliases U_ICU_ENTRY_POINT_RENAME(ucnv_countAliases) +#define ucnv_countAvailable U_ICU_ENTRY_POINT_RENAME(ucnv_countAvailable) +#define ucnv_countStandards U_ICU_ENTRY_POINT_RENAME(ucnv_countStandards) +#define ucnv_createAlgorithmicConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createAlgorithmicConverter) +#define ucnv_createConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createConverter) +#define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage) +#define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData) +#define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature) +#define ucnv_enableCleanup U_ICU_ENTRY_POINT_RENAME(ucnv_enableCleanup) +#define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU) +#define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU) +#define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet) +#define ucnv_extInitialMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchFromU) +#define ucnv_extInitialMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchToU) +#define ucnv_extSimpleMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchFromU) +#define ucnv_extSimpleMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchToU) +#define ucnv_fixFileSeparator U_ICU_ENTRY_POINT_RENAME(ucnv_fixFileSeparator) +#define ucnv_flushCache U_ICU_ENTRY_POINT_RENAME(ucnv_flushCache) +#define ucnv_fromAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_fromAlgorithmic) +#define ucnv_fromUChars U_ICU_ENTRY_POINT_RENAME(ucnv_fromUChars) +#define ucnv_fromUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_fromUCountPending) +#define ucnv_fromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_fromUWriteBytes) +#define ucnv_fromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode) +#define ucnv_fromUnicode_UTF8 U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8) +#define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8_OFFSETS_LOGIC) +#define ucnv_getAlias U_ICU_ENTRY_POINT_RENAME(ucnv_getAlias) +#define ucnv_getAliases U_ICU_ENTRY_POINT_RENAME(ucnv_getAliases) +#define ucnv_getAvailableName U_ICU_ENTRY_POINT_RENAME(ucnv_getAvailableName) +#define ucnv_getCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_getCCSID) +#define ucnv_getCanonicalName U_ICU_ENTRY_POINT_RENAME(ucnv_getCanonicalName) +#define ucnv_getCompleteUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getCompleteUnicodeSet) +#define ucnv_getDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_getDefaultName) +#define ucnv_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucnv_getDisplayName) +#define ucnv_getFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getFromUCallBack) +#define ucnv_getInvalidChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidChars) +#define ucnv_getInvalidUChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidUChars) +#define ucnv_getMaxCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMaxCharSize) +#define ucnv_getMinCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMinCharSize) +#define ucnv_getName U_ICU_ENTRY_POINT_RENAME(ucnv_getName) +#define ucnv_getNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_getNextUChar) +#define ucnv_getNonSurrogateUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getNonSurrogateUnicodeSet) +#define ucnv_getPlatform U_ICU_ENTRY_POINT_RENAME(ucnv_getPlatform) +#define ucnv_getStandard U_ICU_ENTRY_POINT_RENAME(ucnv_getStandard) +#define ucnv_getStandardName U_ICU_ENTRY_POINT_RENAME(ucnv_getStandardName) +#define ucnv_getStarters U_ICU_ENTRY_POINT_RENAME(ucnv_getStarters) +#define ucnv_getSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_getSubstChars) +#define ucnv_getToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getToUCallBack) +#define ucnv_getType U_ICU_ENTRY_POINT_RENAME(ucnv_getType) +#define ucnv_getUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getUnicodeSet) +#define ucnv_incrementRefCount U_ICU_ENTRY_POINT_RENAME(ucnv_incrementRefCount) +#define ucnv_io_countKnownConverters U_ICU_ENTRY_POINT_RENAME(ucnv_io_countKnownConverters) +#define ucnv_io_getConverterName U_ICU_ENTRY_POINT_RENAME(ucnv_io_getConverterName) +#define ucnv_io_stripASCIIForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripASCIIForCompare) +#define ucnv_io_stripEBCDICForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripEBCDICForCompare) +#define ucnv_isAmbiguous U_ICU_ENTRY_POINT_RENAME(ucnv_isAmbiguous) +#define ucnv_isFixedWidth U_ICU_ENTRY_POINT_RENAME(ucnv_isFixedWidth) +#define ucnv_load U_ICU_ENTRY_POINT_RENAME(ucnv_load) +#define ucnv_loadSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_loadSharedData) +#define ucnv_open U_ICU_ENTRY_POINT_RENAME(ucnv_open) +#define ucnv_openAllNames U_ICU_ENTRY_POINT_RENAME(ucnv_openAllNames) +#define ucnv_openCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_openCCSID) +#define ucnv_openPackage U_ICU_ENTRY_POINT_RENAME(ucnv_openPackage) +#define ucnv_openStandardNames U_ICU_ENTRY_POINT_RENAME(ucnv_openStandardNames) +#define ucnv_openU U_ICU_ENTRY_POINT_RENAME(ucnv_openU) +#define ucnv_reset U_ICU_ENTRY_POINT_RENAME(ucnv_reset) +#define ucnv_resetFromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetFromUnicode) +#define ucnv_resetToUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetToUnicode) +#define ucnv_safeClone U_ICU_ENTRY_POINT_RENAME(ucnv_safeClone) +#define ucnv_setDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_setDefaultName) +#define ucnv_setFallback U_ICU_ENTRY_POINT_RENAME(ucnv_setFallback) +#define ucnv_setFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setFromUCallBack) +#define ucnv_setSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstChars) +#define ucnv_setSubstString U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstString) +#define ucnv_setToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setToUCallBack) +#define ucnv_swap U_ICU_ENTRY_POINT_RENAME(ucnv_swap) +#define ucnv_swapAliases U_ICU_ENTRY_POINT_RENAME(ucnv_swapAliases) +#define ucnv_toAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_toAlgorithmic) +#define ucnv_toUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUChars) +#define ucnv_toUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_toUCountPending) +#define ucnv_toUWriteCodePoint U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteCodePoint) +#define ucnv_toUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteUChars) +#define ucnv_toUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_toUnicode) +#define ucnv_unload U_ICU_ENTRY_POINT_RENAME(ucnv_unload) +#define ucnv_unloadSharedDataIfReady U_ICU_ENTRY_POINT_RENAME(ucnv_unloadSharedDataIfReady) +#define ucnv_usesFallback U_ICU_ENTRY_POINT_RENAME(ucnv_usesFallback) +#define ucnvsel_close U_ICU_ENTRY_POINT_RENAME(ucnvsel_close) +#define ucnvsel_open U_ICU_ENTRY_POINT_RENAME(ucnvsel_open) +#define ucnvsel_openFromSerialized U_ICU_ENTRY_POINT_RENAME(ucnvsel_openFromSerialized) +#define ucnvsel_selectForString U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForString) +#define ucnvsel_selectForUTF8 U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForUTF8) +#define ucnvsel_serialize U_ICU_ENTRY_POINT_RENAME(ucnvsel_serialize) +#define ucol_clone U_ICU_ENTRY_POINT_RENAME(ucol_clone) +#define ucol_cloneBinary U_ICU_ENTRY_POINT_RENAME(ucol_cloneBinary) +#define ucol_close U_ICU_ENTRY_POINT_RENAME(ucol_close) +#define ucol_closeElements U_ICU_ENTRY_POINT_RENAME(ucol_closeElements) +#define ucol_countAvailable U_ICU_ENTRY_POINT_RENAME(ucol_countAvailable) +#define ucol_equal U_ICU_ENTRY_POINT_RENAME(ucol_equal) +#define ucol_equals U_ICU_ENTRY_POINT_RENAME(ucol_equals) +#define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute) +#define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable) +#define ucol_getBound U_ICU_ENTRY_POINT_RENAME(ucol_getBound) +#define ucol_getContractions U_ICU_ENTRY_POINT_RENAME(ucol_getContractions) +#define ucol_getContractionsAndExpansions U_ICU_ENTRY_POINT_RENAME(ucol_getContractionsAndExpansions) +#define ucol_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucol_getDisplayName) +#define ucol_getEquivalentReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getEquivalentReorderCodes) +#define ucol_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ucol_getFunctionalEquivalent) +#define ucol_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValues) +#define ucol_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValuesForLocale) +#define ucol_getKeywords U_ICU_ENTRY_POINT_RENAME(ucol_getKeywords) +#define ucol_getLocale U_ICU_ENTRY_POINT_RENAME(ucol_getLocale) +#define ucol_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucol_getLocaleByType) +#define ucol_getMaxExpansion U_ICU_ENTRY_POINT_RENAME(ucol_getMaxExpansion) +#define ucol_getMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_getMaxVariable) +#define ucol_getOffset U_ICU_ENTRY_POINT_RENAME(ucol_getOffset) +#define ucol_getReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodes) +#define ucol_getRules U_ICU_ENTRY_POINT_RENAME(ucol_getRules) +#define ucol_getRulesEx U_ICU_ENTRY_POINT_RENAME(ucol_getRulesEx) +#define ucol_getShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_getShortDefinitionString) +#define ucol_getSortKey U_ICU_ENTRY_POINT_RENAME(ucol_getSortKey) +#define ucol_getStrength U_ICU_ENTRY_POINT_RENAME(ucol_getStrength) +#define ucol_getTailoredSet U_ICU_ENTRY_POINT_RENAME(ucol_getTailoredSet) +#define ucol_getUCAVersion U_ICU_ENTRY_POINT_RENAME(ucol_getUCAVersion) +#define ucol_getUnsafeSet U_ICU_ENTRY_POINT_RENAME(ucol_getUnsafeSet) +#define ucol_getVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_getVariableTop) +#define ucol_getVersion U_ICU_ENTRY_POINT_RENAME(ucol_getVersion) +#define ucol_greater U_ICU_ENTRY_POINT_RENAME(ucol_greater) +#define ucol_greaterOrEqual U_ICU_ENTRY_POINT_RENAME(ucol_greaterOrEqual) +#define ucol_keyHashCode U_ICU_ENTRY_POINT_RENAME(ucol_keyHashCode) +#define ucol_looksLikeCollationBinary U_ICU_ENTRY_POINT_RENAME(ucol_looksLikeCollationBinary) +#define ucol_mergeSortkeys U_ICU_ENTRY_POINT_RENAME(ucol_mergeSortkeys) +#define ucol_next U_ICU_ENTRY_POINT_RENAME(ucol_next) +#define ucol_nextSortKeyPart U_ICU_ENTRY_POINT_RENAME(ucol_nextSortKeyPart) +#define ucol_normalizeShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_normalizeShortDefinitionString) +#define ucol_open U_ICU_ENTRY_POINT_RENAME(ucol_open) +#define ucol_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ucol_openAvailableLocales) +#define ucol_openBinary U_ICU_ENTRY_POINT_RENAME(ucol_openBinary) +#define ucol_openElements U_ICU_ENTRY_POINT_RENAME(ucol_openElements) +#define ucol_openFromShortString U_ICU_ENTRY_POINT_RENAME(ucol_openFromShortString) +#define ucol_openRules U_ICU_ENTRY_POINT_RENAME(ucol_openRules) +#define ucol_prepareShortStringOpen U_ICU_ENTRY_POINT_RENAME(ucol_prepareShortStringOpen) +#define ucol_previous U_ICU_ENTRY_POINT_RENAME(ucol_previous) +#define ucol_primaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_primaryOrder) +#define ucol_reset U_ICU_ENTRY_POINT_RENAME(ucol_reset) +#define ucol_restoreVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_restoreVariableTop) +#define ucol_safeClone U_ICU_ENTRY_POINT_RENAME(ucol_safeClone) +#define ucol_secondaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_secondaryOrder) +#define ucol_setAttribute U_ICU_ENTRY_POINT_RENAME(ucol_setAttribute) +#define ucol_setMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_setMaxVariable) +#define ucol_setOffset U_ICU_ENTRY_POINT_RENAME(ucol_setOffset) +#define ucol_setReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_setReorderCodes) +#define ucol_setStrength U_ICU_ENTRY_POINT_RENAME(ucol_setStrength) +#define ucol_setText U_ICU_ENTRY_POINT_RENAME(ucol_setText) +#define ucol_setVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_setVariableTop) +#define ucol_strcoll U_ICU_ENTRY_POINT_RENAME(ucol_strcoll) +#define ucol_strcollIter U_ICU_ENTRY_POINT_RENAME(ucol_strcollIter) +#define ucol_strcollUTF8 U_ICU_ENTRY_POINT_RENAME(ucol_strcollUTF8) +#define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap) +#define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA) +#define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder) +#define ucpmap_get U_ICU_ENTRY_POINT_RENAME(ucpmap_get) +#define ucpmap_getRange U_ICU_ENTRY_POINT_RENAME(ucpmap_getRange) +#define ucptrie_close U_ICU_ENTRY_POINT_RENAME(ucptrie_close) +#define ucptrie_get U_ICU_ENTRY_POINT_RENAME(ucptrie_get) +#define ucptrie_getRange U_ICU_ENTRY_POINT_RENAME(ucptrie_getRange) +#define ucptrie_getType U_ICU_ENTRY_POINT_RENAME(ucptrie_getType) +#define ucptrie_getValueWidth U_ICU_ENTRY_POINT_RENAME(ucptrie_getValueWidth) +#define ucptrie_internalGetRange U_ICU_ENTRY_POINT_RENAME(ucptrie_internalGetRange) +#define ucptrie_internalSmallIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallIndex) +#define ucptrie_internalSmallU8Index U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallU8Index) +#define ucptrie_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalU8PrevIndex) +#define ucptrie_openFromBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_openFromBinary) +#define ucptrie_swap U_ICU_ENTRY_POINT_RENAME(ucptrie_swap) +#define ucptrie_toBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_toBinary) +#define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close) +#define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect) +#define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll) +#define ucsdet_enableInputFilter U_ICU_ENTRY_POINT_RENAME(ucsdet_enableInputFilter) +#define ucsdet_getAllDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getAllDetectableCharsets) +#define ucsdet_getConfidence U_ICU_ENTRY_POINT_RENAME(ucsdet_getConfidence) +#define ucsdet_getDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getDetectableCharsets) +#define ucsdet_getLanguage U_ICU_ENTRY_POINT_RENAME(ucsdet_getLanguage) +#define ucsdet_getName U_ICU_ENTRY_POINT_RENAME(ucsdet_getName) +#define ucsdet_getUChars U_ICU_ENTRY_POINT_RENAME(ucsdet_getUChars) +#define ucsdet_isInputFilterEnabled U_ICU_ENTRY_POINT_RENAME(ucsdet_isInputFilterEnabled) +#define ucsdet_open U_ICU_ENTRY_POINT_RENAME(ucsdet_open) +#define ucsdet_setDeclaredEncoding U_ICU_ENTRY_POINT_RENAME(ucsdet_setDeclaredEncoding) +#define ucsdet_setDetectableCharset U_ICU_ENTRY_POINT_RENAME(ucsdet_setDetectableCharset) +#define ucsdet_setText U_ICU_ENTRY_POINT_RENAME(ucsdet_setText) +#define ucurr_countCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_countCurrencies) +#define ucurr_forLocale U_ICU_ENTRY_POINT_RENAME(ucurr_forLocale) +#define ucurr_forLocaleAndDate U_ICU_ENTRY_POINT_RENAME(ucurr_forLocaleAndDate) +#define ucurr_getDefaultFractionDigits U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigits) +#define ucurr_getDefaultFractionDigitsForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigitsForUsage) +#define ucurr_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucurr_getKeywordValuesForLocale) +#define ucurr_getName U_ICU_ENTRY_POINT_RENAME(ucurr_getName) +#define ucurr_getNumericCode U_ICU_ENTRY_POINT_RENAME(ucurr_getNumericCode) +#define ucurr_getPluralName U_ICU_ENTRY_POINT_RENAME(ucurr_getPluralName) +#define ucurr_getRoundingIncrement U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrement) +#define ucurr_getRoundingIncrementForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrementForUsage) +#define ucurr_isAvailable U_ICU_ENTRY_POINT_RENAME(ucurr_isAvailable) +#define ucurr_openISOCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_openISOCurrencies) +#define ucurr_register U_ICU_ENTRY_POINT_RENAME(ucurr_register) +#define ucurr_unregister U_ICU_ENTRY_POINT_RENAME(ucurr_unregister) +#define udat_adoptNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormat) +#define udat_adoptNumberFormatForFields U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormatForFields) +#define udat_applyPattern U_ICU_ENTRY_POINT_RENAME(udat_applyPattern) +#define udat_applyPatternRelative U_ICU_ENTRY_POINT_RENAME(udat_applyPatternRelative) +#define udat_clone U_ICU_ENTRY_POINT_RENAME(udat_clone) +#define udat_close U_ICU_ENTRY_POINT_RENAME(udat_close) +#define udat_countAvailable U_ICU_ENTRY_POINT_RENAME(udat_countAvailable) +#define udat_countSymbols U_ICU_ENTRY_POINT_RENAME(udat_countSymbols) +#define udat_format U_ICU_ENTRY_POINT_RENAME(udat_format) +#define udat_formatCalendar U_ICU_ENTRY_POINT_RENAME(udat_formatCalendar) +#define udat_formatCalendarForFields U_ICU_ENTRY_POINT_RENAME(udat_formatCalendarForFields) +#define udat_formatForFields U_ICU_ENTRY_POINT_RENAME(udat_formatForFields) +#define udat_get2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_get2DigitYearStart) +#define udat_getAvailable U_ICU_ENTRY_POINT_RENAME(udat_getAvailable) +#define udat_getBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_getBooleanAttribute) +#define udat_getCalendar U_ICU_ENTRY_POINT_RENAME(udat_getCalendar) +#define udat_getContext U_ICU_ENTRY_POINT_RENAME(udat_getContext) +#define udat_getLocaleByType U_ICU_ENTRY_POINT_RENAME(udat_getLocaleByType) +#define udat_getNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormat) +#define udat_getNumberFormatForField U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormatForField) +#define udat_getSymbols U_ICU_ENTRY_POINT_RENAME(udat_getSymbols) +#define udat_isLenient U_ICU_ENTRY_POINT_RENAME(udat_isLenient) +#define udat_open U_ICU_ENTRY_POINT_RENAME(udat_open) +#define udat_parse U_ICU_ENTRY_POINT_RENAME(udat_parse) +#define udat_parseCalendar U_ICU_ENTRY_POINT_RENAME(udat_parseCalendar) +#define udat_registerOpener U_ICU_ENTRY_POINT_RENAME(udat_registerOpener) +#define udat_set2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_set2DigitYearStart) +#define udat_setBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_setBooleanAttribute) +#define udat_setCalendar U_ICU_ENTRY_POINT_RENAME(udat_setCalendar) +#define udat_setContext U_ICU_ENTRY_POINT_RENAME(udat_setContext) +#define udat_setLenient U_ICU_ENTRY_POINT_RENAME(udat_setLenient) +#define udat_setNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_setNumberFormat) +#define udat_setSymbols U_ICU_ENTRY_POINT_RENAME(udat_setSymbols) +#define udat_toCalendarDateField U_ICU_ENTRY_POINT_RENAME(udat_toCalendarDateField) +#define udat_toPattern U_ICU_ENTRY_POINT_RENAME(udat_toPattern) +#define udat_toPatternRelativeDate U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeDate) +#define udat_toPatternRelativeTime U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeTime) +#define udat_unregisterOpener U_ICU_ENTRY_POINT_RENAME(udat_unregisterOpener) +#define udata_checkCommonData U_ICU_ENTRY_POINT_RENAME(udata_checkCommonData) +#define udata_close U_ICU_ENTRY_POINT_RENAME(udata_close) +#define udata_closeSwapper U_ICU_ENTRY_POINT_RENAME(udata_closeSwapper) +#define udata_getHeaderSize U_ICU_ENTRY_POINT_RENAME(udata_getHeaderSize) +#define udata_getInfo U_ICU_ENTRY_POINT_RENAME(udata_getInfo) +#define udata_getInfoSize U_ICU_ENTRY_POINT_RENAME(udata_getInfoSize) +#define udata_getLength U_ICU_ENTRY_POINT_RENAME(udata_getLength) +#define udata_getMemory U_ICU_ENTRY_POINT_RENAME(udata_getMemory) +#define udata_getRawMemory U_ICU_ENTRY_POINT_RENAME(udata_getRawMemory) +#define udata_open U_ICU_ENTRY_POINT_RENAME(udata_open) +#define udata_openChoice U_ICU_ENTRY_POINT_RENAME(udata_openChoice) +#define udata_openSwapper U_ICU_ENTRY_POINT_RENAME(udata_openSwapper) +#define udata_openSwapperForInputData U_ICU_ENTRY_POINT_RENAME(udata_openSwapperForInputData) +#define udata_printError U_ICU_ENTRY_POINT_RENAME(udata_printError) +#define udata_readInt16 U_ICU_ENTRY_POINT_RENAME(udata_readInt16) +#define udata_readInt32 U_ICU_ENTRY_POINT_RENAME(udata_readInt32) +#define udata_setAppData U_ICU_ENTRY_POINT_RENAME(udata_setAppData) +#define udata_setCommonData U_ICU_ENTRY_POINT_RENAME(udata_setCommonData) +#define udata_setFileAccess U_ICU_ENTRY_POINT_RENAME(udata_setFileAccess) +#define udata_swapDataHeader U_ICU_ENTRY_POINT_RENAME(udata_swapDataHeader) +#define udata_swapInvStringBlock U_ICU_ENTRY_POINT_RENAME(udata_swapInvStringBlock) +#define udatpg_addPattern U_ICU_ENTRY_POINT_RENAME(udatpg_addPattern) +#define udatpg_clone U_ICU_ENTRY_POINT_RENAME(udatpg_clone) +#define udatpg_close U_ICU_ENTRY_POINT_RENAME(udatpg_close) +#define udatpg_getAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemFormat) +#define udatpg_getAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemName) +#define udatpg_getBaseSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getBaseSkeleton) +#define udatpg_getBestPattern U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPattern) +#define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions) +#define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat) +#define udatpg_getDateTimeFormatForStyle U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormatForStyle) +#define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal) +#define udatpg_getDefaultHourCycle U_ICU_ENTRY_POINT_RENAME(udatpg_getDefaultHourCycle) +#define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName) +#define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton) +#define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton) +#define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open) +#define udatpg_openBaseSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openBaseSkeletons) +#define udatpg_openEmpty U_ICU_ENTRY_POINT_RENAME(udatpg_openEmpty) +#define udatpg_openSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openSkeletons) +#define udatpg_replaceFieldTypes U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypes) +#define udatpg_replaceFieldTypesWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypesWithOptions) +#define udatpg_setAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemFormat) +#define udatpg_setAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemName) +#define udatpg_setDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormat) +#define udatpg_setDateTimeFormatForStyle U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormatForStyle) +#define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal) +#define udict_swap U_ICU_ENTRY_POINT_RENAME(udict_swap) +#define udispopt_fromGrammaticalCaseIdentifier U_ICU_ENTRY_POINT_RENAME(udispopt_fromGrammaticalCaseIdentifier) +#define udispopt_fromNounClassIdentifier U_ICU_ENTRY_POINT_RENAME(udispopt_fromNounClassIdentifier) +#define udispopt_fromPluralCategoryIdentifier U_ICU_ENTRY_POINT_RENAME(udispopt_fromPluralCategoryIdentifier) +#define udispopt_getGrammaticalCaseIdentifier U_ICU_ENTRY_POINT_RENAME(udispopt_getGrammaticalCaseIdentifier) +#define udispopt_getNounClassIdentifier U_ICU_ENTRY_POINT_RENAME(udispopt_getNounClassIdentifier) +#define udispopt_getPluralCategoryIdentifier U_ICU_ENTRY_POINT_RENAME(udispopt_getPluralCategoryIdentifier) +#define udtitvfmt_close U_ICU_ENTRY_POINT_RENAME(udtitvfmt_close) +#define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult) +#define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format) +#define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult) +#define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult) +#define udtitvfmt_getContext U_ICU_ENTRY_POINT_RENAME(udtitvfmt_getContext) +#define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open) +#define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult) +#define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue) +#define udtitvfmt_setContext U_ICU_ENTRY_POINT_RENAME(udtitvfmt_setContext) +#define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close) +#define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count) +#define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next) +#define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault) +#define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration) +#define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration) +#define uenum_openUCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openUCharStringsEnumeration) +#define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset) +#define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext) +#define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault) +#define ufieldpositer_close U_ICU_ENTRY_POINT_RENAME(ufieldpositer_close) +#define ufieldpositer_next U_ICU_ENTRY_POINT_RENAME(ufieldpositer_next) +#define ufieldpositer_open U_ICU_ENTRY_POINT_RENAME(ufieldpositer_open) +#define ufile_close_translit U_ICU_ENTRY_POINT_RENAME(ufile_close_translit) +#define ufile_fill_uchar_buffer U_ICU_ENTRY_POINT_RENAME(ufile_fill_uchar_buffer) +#define ufile_flush_io U_ICU_ENTRY_POINT_RENAME(ufile_flush_io) +#define ufile_flush_translit U_ICU_ENTRY_POINT_RENAME(ufile_flush_translit) +#define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch) +#define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32) +#define ufmt_64tou U_ICU_ENTRY_POINT_RENAME(ufmt_64tou) +#define ufmt_close U_ICU_ENTRY_POINT_RENAME(ufmt_close) +#define ufmt_defaultCPToUnicode U_ICU_ENTRY_POINT_RENAME(ufmt_defaultCPToUnicode) +#define ufmt_digitvalue U_ICU_ENTRY_POINT_RENAME(ufmt_digitvalue) +#define ufmt_getArrayItemByIndex U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayItemByIndex) +#define ufmt_getArrayLength U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayLength) +#define ufmt_getDate U_ICU_ENTRY_POINT_RENAME(ufmt_getDate) +#define ufmt_getDecNumChars U_ICU_ENTRY_POINT_RENAME(ufmt_getDecNumChars) +#define ufmt_getDouble U_ICU_ENTRY_POINT_RENAME(ufmt_getDouble) +#define ufmt_getInt64 U_ICU_ENTRY_POINT_RENAME(ufmt_getInt64) +#define ufmt_getLong U_ICU_ENTRY_POINT_RENAME(ufmt_getLong) +#define ufmt_getObject U_ICU_ENTRY_POINT_RENAME(ufmt_getObject) +#define ufmt_getType U_ICU_ENTRY_POINT_RENAME(ufmt_getType) +#define ufmt_getUChars U_ICU_ENTRY_POINT_RENAME(ufmt_getUChars) +#define ufmt_isNumeric U_ICU_ENTRY_POINT_RENAME(ufmt_isNumeric) +#define ufmt_isdigit U_ICU_ENTRY_POINT_RENAME(ufmt_isdigit) +#define ufmt_open U_ICU_ENTRY_POINT_RENAME(ufmt_open) +#define ufmt_ptou U_ICU_ENTRY_POINT_RENAME(ufmt_ptou) +#define ufmt_uto64 U_ICU_ENTRY_POINT_RENAME(ufmt_uto64) +#define ufmt_utop U_ICU_ENTRY_POINT_RENAME(ufmt_utop) +#define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString) +#define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition) +#define ugender_getInstance U_ICU_ENTRY_POINT_RENAME(ugender_getInstance) +#define ugender_getListGender U_ICU_ENTRY_POINT_RENAME(ugender_getListGender) +#define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close) +#define uhash_compareCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareCaselessUnicodeString) +#define uhash_compareChars U_ICU_ENTRY_POINT_RENAME(uhash_compareChars) +#define uhash_compareIChars U_ICU_ENTRY_POINT_RENAME(uhash_compareIChars) +#define uhash_compareLong U_ICU_ENTRY_POINT_RENAME(uhash_compareLong) +#define uhash_compareScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_compareScriptSet) +#define uhash_compareUChars U_ICU_ENTRY_POINT_RENAME(uhash_compareUChars) +#define uhash_compareUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareUnicodeString) +#define uhash_containsKey U_ICU_ENTRY_POINT_RENAME(uhash_containsKey) +#define uhash_count U_ICU_ENTRY_POINT_RENAME(uhash_count) +#define uhash_deleteHashtable U_ICU_ENTRY_POINT_RENAME(uhash_deleteHashtable) +#define uhash_deleteScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_deleteScriptSet) +#define uhash_equals U_ICU_ENTRY_POINT_RENAME(uhash_equals) +#define uhash_equalsScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_equalsScriptSet) +#define uhash_find U_ICU_ENTRY_POINT_RENAME(uhash_find) +#define uhash_get U_ICU_ENTRY_POINT_RENAME(uhash_get) +#define uhash_geti U_ICU_ENTRY_POINT_RENAME(uhash_geti) +#define uhash_getiAndFound U_ICU_ENTRY_POINT_RENAME(uhash_getiAndFound) +#define uhash_hashCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashCaselessUnicodeString) +#define uhash_hashChars U_ICU_ENTRY_POINT_RENAME(uhash_hashChars) +#define uhash_hashIChars U_ICU_ENTRY_POINT_RENAME(uhash_hashIChars) +#define uhash_hashLong U_ICU_ENTRY_POINT_RENAME(uhash_hashLong) +#define uhash_hashScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_hashScriptSet) +#define uhash_hashUChars U_ICU_ENTRY_POINT_RENAME(uhash_hashUChars) +#define uhash_hashUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashUnicodeString) +#define uhash_icontainsKey U_ICU_ENTRY_POINT_RENAME(uhash_icontainsKey) +#define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget) +#define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti) +#define uhash_igetiAndFound U_ICU_ENTRY_POINT_RENAME(uhash_igetiAndFound) +#define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init) +#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize) +#define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput) +#define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi) +#define uhash_iputiAllowZero U_ICU_ENTRY_POINT_RENAME(uhash_iputiAllowZero) +#define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove) +#define uhash_iremovei U_ICU_ENTRY_POINT_RENAME(uhash_iremovei) +#define uhash_nextElement U_ICU_ENTRY_POINT_RENAME(uhash_nextElement) +#define uhash_open U_ICU_ENTRY_POINT_RENAME(uhash_open) +#define uhash_openSize U_ICU_ENTRY_POINT_RENAME(uhash_openSize) +#define uhash_put U_ICU_ENTRY_POINT_RENAME(uhash_put) +#define uhash_puti U_ICU_ENTRY_POINT_RENAME(uhash_puti) +#define uhash_putiAllowZero U_ICU_ENTRY_POINT_RENAME(uhash_putiAllowZero) +#define uhash_remove U_ICU_ENTRY_POINT_RENAME(uhash_remove) +#define uhash_removeAll U_ICU_ENTRY_POINT_RENAME(uhash_removeAll) +#define uhash_removeElement U_ICU_ENTRY_POINT_RENAME(uhash_removeElement) +#define uhash_removei U_ICU_ENTRY_POINT_RENAME(uhash_removei) +#define uhash_setKeyComparator U_ICU_ENTRY_POINT_RENAME(uhash_setKeyComparator) +#define uhash_setKeyDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setKeyDeleter) +#define uhash_setKeyHasher U_ICU_ENTRY_POINT_RENAME(uhash_setKeyHasher) +#define uhash_setResizePolicy U_ICU_ENTRY_POINT_RENAME(uhash_setResizePolicy) +#define uhash_setValueComparator U_ICU_ENTRY_POINT_RENAME(uhash_setValueComparator) +#define uhash_setValueDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setValueDeleter) +#define uidna_IDNToASCII U_ICU_ENTRY_POINT_RENAME(uidna_IDNToASCII) +#define uidna_IDNToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_IDNToUnicode) +#define uidna_close U_ICU_ENTRY_POINT_RENAME(uidna_close) +#define uidna_compare U_ICU_ENTRY_POINT_RENAME(uidna_compare) +#define uidna_labelToASCII U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII) +#define uidna_labelToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII_UTF8) +#define uidna_labelToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicode) +#define uidna_labelToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicodeUTF8) +#define uidna_nameToASCII U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII) +#define uidna_nameToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII_UTF8) +#define uidna_nameToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicode) +#define uidna_nameToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicodeUTF8) +#define uidna_openUTS46 U_ICU_ENTRY_POINT_RENAME(uidna_openUTS46) +#define uidna_toASCII U_ICU_ENTRY_POINT_RENAME(uidna_toASCII) +#define uidna_toUnicode U_ICU_ENTRY_POINT_RENAME(uidna_toUnicode) +#define uiter_current32 U_ICU_ENTRY_POINT_RENAME(uiter_current32) +#define uiter_getState U_ICU_ENTRY_POINT_RENAME(uiter_getState) +#define uiter_next32 U_ICU_ENTRY_POINT_RENAME(uiter_next32) +#define uiter_previous32 U_ICU_ENTRY_POINT_RENAME(uiter_previous32) +#define uiter_setCharacterIterator U_ICU_ENTRY_POINT_RENAME(uiter_setCharacterIterator) +#define uiter_setReplaceable U_ICU_ENTRY_POINT_RENAME(uiter_setReplaceable) +#define uiter_setState U_ICU_ENTRY_POINT_RENAME(uiter_setState) +#define uiter_setString U_ICU_ENTRY_POINT_RENAME(uiter_setString) +#define uiter_setUTF16BE U_ICU_ENTRY_POINT_RENAME(uiter_setUTF16BE) +#define uiter_setUTF8 U_ICU_ENTRY_POINT_RENAME(uiter_setUTF8) +#define uldn_close U_ICU_ENTRY_POINT_RENAME(uldn_close) +#define uldn_getContext U_ICU_ENTRY_POINT_RENAME(uldn_getContext) +#define uldn_getDialectHandling U_ICU_ENTRY_POINT_RENAME(uldn_getDialectHandling) +#define uldn_getLocale U_ICU_ENTRY_POINT_RENAME(uldn_getLocale) +#define uldn_keyDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyDisplayName) +#define uldn_keyValueDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyValueDisplayName) +#define uldn_languageDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_languageDisplayName) +#define uldn_localeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_localeDisplayName) +#define uldn_open U_ICU_ENTRY_POINT_RENAME(uldn_open) +#define uldn_openForContext U_ICU_ENTRY_POINT_RENAME(uldn_openForContext) +#define uldn_regionDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_regionDisplayName) +#define uldn_scriptCodeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptCodeDisplayName) +#define uldn_scriptDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptDisplayName) +#define uldn_variantDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_variantDisplayName) +#define ulist_addItemBeginList U_ICU_ENTRY_POINT_RENAME(ulist_addItemBeginList) +#define ulist_addItemEndList U_ICU_ENTRY_POINT_RENAME(ulist_addItemEndList) +#define ulist_close_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_close_keyword_values_iterator) +#define ulist_containsString U_ICU_ENTRY_POINT_RENAME(ulist_containsString) +#define ulist_count_keyword_values U_ICU_ENTRY_POINT_RENAME(ulist_count_keyword_values) +#define ulist_createEmptyList U_ICU_ENTRY_POINT_RENAME(ulist_createEmptyList) +#define ulist_deleteList U_ICU_ENTRY_POINT_RENAME(ulist_deleteList) +#define ulist_getListFromEnum U_ICU_ENTRY_POINT_RENAME(ulist_getListFromEnum) +#define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize) +#define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext) +#define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value) +#define ulist_removeString U_ICU_ENTRY_POINT_RENAME(ulist_removeString) +#define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList) +#define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator) +#define ulistfmt_close U_ICU_ENTRY_POINT_RENAME(ulistfmt_close) +#define ulistfmt_closeResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_closeResult) +#define ulistfmt_format U_ICU_ENTRY_POINT_RENAME(ulistfmt_format) +#define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult) +#define ulistfmt_open U_ICU_ENTRY_POINT_RENAME(ulistfmt_open) +#define ulistfmt_openForType U_ICU_ENTRY_POINT_RENAME(ulistfmt_openForType) +#define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult) +#define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue) +#define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage) +#define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP) +#define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags) +#define uloc_canonicalize U_ICU_ENTRY_POINT_RENAME(uloc_canonicalize) +#define uloc_countAvailable U_ICU_ENTRY_POINT_RENAME(uloc_countAvailable) +#define uloc_forLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_forLanguageTag) +#define uloc_getAvailable U_ICU_ENTRY_POINT_RENAME(uloc_getAvailable) +#define uloc_getBaseName U_ICU_ENTRY_POINT_RENAME(uloc_getBaseName) +#define uloc_getCharacterOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getCharacterOrientation) +#define uloc_getCountry U_ICU_ENTRY_POINT_RENAME(uloc_getCountry) +#define uloc_getCurrentCountryID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentCountryID) +#define uloc_getCurrentLanguageID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentLanguageID) +#define uloc_getDefault U_ICU_ENTRY_POINT_RENAME(uloc_getDefault) +#define uloc_getDisplayCountry U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayCountry) +#define uloc_getDisplayKeyword U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeyword) +#define uloc_getDisplayKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeywordValue) +#define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage) +#define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName) +#define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript) +#define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant) +#define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country) +#define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language) +#define uloc_getISOCountries U_ICU_ENTRY_POINT_RENAME(uloc_getISOCountries) +#define uloc_getISOLanguages U_ICU_ENTRY_POINT_RENAME(uloc_getISOLanguages) +#define uloc_getKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getKeywordValue) +#define uloc_getLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLCID) +#define uloc_getLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getLanguage) +#define uloc_getLineOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getLineOrientation) +#define uloc_getLocaleForLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLocaleForLCID) +#define uloc_getName U_ICU_ENTRY_POINT_RENAME(uloc_getName) +#define uloc_getParent U_ICU_ENTRY_POINT_RENAME(uloc_getParent) +#define uloc_getScript U_ICU_ENTRY_POINT_RENAME(uloc_getScript) +#define uloc_getTableStringWithFallback U_ICU_ENTRY_POINT_RENAME(uloc_getTableStringWithFallback) +#define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant) +#define uloc_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uloc_isRightToLeft) +#define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags) +#define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType) +#define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList) +#define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords) +#define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault) +#define uloc_setKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_setKeywordValue) +#define uloc_toLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_toLanguageTag) +#define uloc_toLegacyKey U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyKey) +#define uloc_toLegacyType U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyType) +#define uloc_toUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleKey) +#define uloc_toUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleType) +#define ulocale_close U_ICU_ENTRY_POINT_RENAME(ulocale_close) +#define ulocale_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocale_getBaseName) +#define ulocale_getKeywordValue U_ICU_ENTRY_POINT_RENAME(ulocale_getKeywordValue) +#define ulocale_getKeywords U_ICU_ENTRY_POINT_RENAME(ulocale_getKeywords) +#define ulocale_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocale_getLanguage) +#define ulocale_getLocaleID U_ICU_ENTRY_POINT_RENAME(ulocale_getLocaleID) +#define ulocale_getRegion U_ICU_ENTRY_POINT_RENAME(ulocale_getRegion) +#define ulocale_getScript U_ICU_ENTRY_POINT_RENAME(ulocale_getScript) +#define ulocale_getUnicodeKeywordValue U_ICU_ENTRY_POINT_RENAME(ulocale_getUnicodeKeywordValue) +#define ulocale_getUnicodeKeywords U_ICU_ENTRY_POINT_RENAME(ulocale_getUnicodeKeywords) +#define ulocale_getVariant U_ICU_ENTRY_POINT_RENAME(ulocale_getVariant) +#define ulocale_isBogus U_ICU_ENTRY_POINT_RENAME(ulocale_isBogus) +#define ulocale_openForLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocale_openForLanguageTag) +#define ulocale_openForLocaleID U_ICU_ENTRY_POINT_RENAME(ulocale_openForLocaleID) +#define ulocbld_addUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ulocbld_addUnicodeLocaleAttribute) +#define ulocbld_adoptULocale U_ICU_ENTRY_POINT_RENAME(ulocbld_adoptULocale) +#define ulocbld_buildLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocbld_buildLanguageTag) +#define ulocbld_buildLocaleID U_ICU_ENTRY_POINT_RENAME(ulocbld_buildLocaleID) +#define ulocbld_buildULocale U_ICU_ENTRY_POINT_RENAME(ulocbld_buildULocale) +#define ulocbld_clear U_ICU_ENTRY_POINT_RENAME(ulocbld_clear) +#define ulocbld_clearExtensions U_ICU_ENTRY_POINT_RENAME(ulocbld_clearExtensions) +#define ulocbld_close U_ICU_ENTRY_POINT_RENAME(ulocbld_close) +#define ulocbld_copyErrorTo U_ICU_ENTRY_POINT_RENAME(ulocbld_copyErrorTo) +#define ulocbld_open U_ICU_ENTRY_POINT_RENAME(ulocbld_open) +#define ulocbld_removeUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ulocbld_removeUnicodeLocaleAttribute) +#define ulocbld_setExtension U_ICU_ENTRY_POINT_RENAME(ulocbld_setExtension) +#define ulocbld_setLanguage U_ICU_ENTRY_POINT_RENAME(ulocbld_setLanguage) +#define ulocbld_setLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocbld_setLanguageTag) +#define ulocbld_setLocale U_ICU_ENTRY_POINT_RENAME(ulocbld_setLocale) +#define ulocbld_setRegion U_ICU_ENTRY_POINT_RENAME(ulocbld_setRegion) +#define ulocbld_setScript U_ICU_ENTRY_POINT_RENAME(ulocbld_setScript) +#define ulocbld_setUnicodeLocaleKeyword U_ICU_ENTRY_POINT_RENAME(ulocbld_setUnicodeLocaleKeyword) +#define ulocbld_setVariant U_ICU_ENTRY_POINT_RENAME(ulocbld_setVariant) +#define ulocdata_close U_ICU_ENTRY_POINT_RENAME(ulocdata_close) +#define ulocdata_getCLDRVersion U_ICU_ENTRY_POINT_RENAME(ulocdata_getCLDRVersion) +#define ulocdata_getDelimiter U_ICU_ENTRY_POINT_RENAME(ulocdata_getDelimiter) +#define ulocdata_getExemplarSet U_ICU_ENTRY_POINT_RENAME(ulocdata_getExemplarSet) +#define ulocdata_getLocaleDisplayPattern U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleDisplayPattern) +#define ulocdata_getLocaleSeparator U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleSeparator) +#define ulocdata_getMeasurementSystem U_ICU_ENTRY_POINT_RENAME(ulocdata_getMeasurementSystem) +#define ulocdata_getNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_getNoSubstitute) +#define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize) +#define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open) +#define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute) +#define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags) +#define ulocimp_canonicalize U_ICU_ENTRY_POINT_RENAME(ulocimp_canonicalize) +#define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag) +#define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName) +#define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) +#define ulocimp_getKeywordValue U_ICU_ENTRY_POINT_RENAME(ulocimp_getKeywordValue) +#define ulocimp_getKeywords U_ICU_ENTRY_POINT_RENAME(ulocimp_getKeywords) +#define ulocimp_getKnownCanonicalizedLocaleForTest U_ICU_ENTRY_POINT_RENAME(ulocimp_getKnownCanonicalizedLocaleForTest) +#define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) +#define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName) +#define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData) +#define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) +#define ulocimp_isCanonicalizedLocaleForTest U_ICU_ENTRY_POINT_RENAME(ulocimp_isCanonicalizedLocaleForTest) +#define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags) +#define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey) +#define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType) +#define ulocimp_toLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_toLanguageTag) +#define ulocimp_toLegacyKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyKey) +#define ulocimp_toLegacyType U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyType) +#define ultag_getTKeyStart U_ICU_ENTRY_POINT_RENAME(ultag_getTKeyStart) +#define ultag_isExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isExtensionSubtags) +#define ultag_isLanguageSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isLanguageSubtag) +#define ultag_isPrivateuseValueSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isPrivateuseValueSubtags) +#define ultag_isRegionSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isRegionSubtag) +#define ultag_isScriptSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isScriptSubtag) +#define ultag_isTransformedExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isTransformedExtensionSubtags) +#define ultag_isUnicodeExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeExtensionSubtags) +#define ultag_isUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttribute) +#define ultag_isUnicodeLocaleAttributes U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttributes) +#define ultag_isUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleKey) +#define ultag_isUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleType) +#define ultag_isVariantSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isVariantSubtags) +#define umeas_getPrefixBase U_ICU_ENTRY_POINT_RENAME(umeas_getPrefixBase) +#define umeas_getPrefixPower U_ICU_ENTRY_POINT_RENAME(umeas_getPrefixPower) +#define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern) +#define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe) +#define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone) +#define umsg_close U_ICU_ENTRY_POINT_RENAME(umsg_close) +#define umsg_format U_ICU_ENTRY_POINT_RENAME(umsg_format) +#define umsg_getLocale U_ICU_ENTRY_POINT_RENAME(umsg_getLocale) +#define umsg_open U_ICU_ENTRY_POINT_RENAME(umsg_open) +#define umsg_parse U_ICU_ENTRY_POINT_RENAME(umsg_parse) +#define umsg_setLocale U_ICU_ENTRY_POINT_RENAME(umsg_setLocale) +#define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern) +#define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat) +#define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse) +#define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock) +#define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock) +#define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable) +#define umutablecptrie_clone U_ICU_ENTRY_POINT_RENAME(umutablecptrie_clone) +#define umutablecptrie_close U_ICU_ENTRY_POINT_RENAME(umutablecptrie_close) +#define umutablecptrie_fromUCPMap U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPMap) +#define umutablecptrie_fromUCPTrie U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPTrie) +#define umutablecptrie_get U_ICU_ENTRY_POINT_RENAME(umutablecptrie_get) +#define umutablecptrie_getRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_getRange) +#define umutablecptrie_open U_ICU_ENTRY_POINT_RENAME(umutablecptrie_open) +#define umutablecptrie_set U_ICU_ENTRY_POINT_RENAME(umutablecptrie_set) +#define umutablecptrie_setRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_setRange) +#define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance) +#define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append) +#define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close) +#define unorm2_composePair U_ICU_ENTRY_POINT_RENAME(unorm2_composePair) +#define unorm2_getCombiningClass U_ICU_ENTRY_POINT_RENAME(unorm2_getCombiningClass) +#define unorm2_getDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getDecomposition) +#define unorm2_getInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getInstance) +#define unorm2_getNFCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFCInstance) +#define unorm2_getNFDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFDInstance) +#define unorm2_getNFKCCasefoldInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCCasefoldInstance) +#define unorm2_getNFKCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCInstance) +#define unorm2_getNFKCSimpleCasefoldInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCSimpleCasefoldInstance) +#define unorm2_getNFKDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKDInstance) +#define unorm2_getRawDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getRawDecomposition) +#define unorm2_hasBoundaryAfter U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryAfter) +#define unorm2_hasBoundaryBefore U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryBefore) +#define unorm2_isInert U_ICU_ENTRY_POINT_RENAME(unorm2_isInert) +#define unorm2_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm2_isNormalized) +#define unorm2_normalize U_ICU_ENTRY_POINT_RENAME(unorm2_normalize) +#define unorm2_normalizeSecondAndAppend U_ICU_ENTRY_POINT_RENAME(unorm2_normalizeSecondAndAppend) +#define unorm2_openFiltered U_ICU_ENTRY_POINT_RENAME(unorm2_openFiltered) +#define unorm2_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm2_quickCheck) +#define unorm2_spanQuickCheckYes U_ICU_ENTRY_POINT_RENAME(unorm2_spanQuickCheckYes) +#define unorm2_swap U_ICU_ENTRY_POINT_RENAME(unorm2_swap) +#define unorm_compare U_ICU_ENTRY_POINT_RENAME(unorm_compare) +#define unorm_concatenate U_ICU_ENTRY_POINT_RENAME(unorm_concatenate) +#define unorm_getFCD16 U_ICU_ENTRY_POINT_RENAME(unorm_getFCD16) +#define unorm_getQuickCheck U_ICU_ENTRY_POINT_RENAME(unorm_getQuickCheck) +#define unorm_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm_isNormalized) +#define unorm_isNormalizedWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_isNormalizedWithOptions) +#define unorm_next U_ICU_ENTRY_POINT_RENAME(unorm_next) +#define unorm_normalize U_ICU_ENTRY_POINT_RENAME(unorm_normalize) +#define unorm_previous U_ICU_ENTRY_POINT_RENAME(unorm_previous) +#define unorm_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm_quickCheck) +#define unorm_quickCheckWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_quickCheckWithOptions) +#define unum_applyPattern U_ICU_ENTRY_POINT_RENAME(unum_applyPattern) +#define unum_clone U_ICU_ENTRY_POINT_RENAME(unum_clone) +#define unum_close U_ICU_ENTRY_POINT_RENAME(unum_close) +#define unum_countAvailable U_ICU_ENTRY_POINT_RENAME(unum_countAvailable) +#define unum_format U_ICU_ENTRY_POINT_RENAME(unum_format) +#define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal) +#define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble) +#define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency) +#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields) +#define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64) +#define unum_formatUFormattable U_ICU_ENTRY_POINT_RENAME(unum_formatUFormattable) +#define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute) +#define unum_getAvailable U_ICU_ENTRY_POINT_RENAME(unum_getAvailable) +#define unum_getContext U_ICU_ENTRY_POINT_RENAME(unum_getContext) +#define unum_getDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_getDoubleAttribute) +#define unum_getLocaleByType U_ICU_ENTRY_POINT_RENAME(unum_getLocaleByType) +#define unum_getSymbol U_ICU_ENTRY_POINT_RENAME(unum_getSymbol) +#define unum_getTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_getTextAttribute) +#define unum_hasAttribute U_ICU_ENTRY_POINT_RENAME(unum_hasAttribute) +#define unum_open U_ICU_ENTRY_POINT_RENAME(unum_open) +#define unum_parse U_ICU_ENTRY_POINT_RENAME(unum_parse) +#define unum_parseDecimal U_ICU_ENTRY_POINT_RENAME(unum_parseDecimal) +#define unum_parseDouble U_ICU_ENTRY_POINT_RENAME(unum_parseDouble) +#define unum_parseDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_parseDoubleCurrency) +#define unum_parseInt64 U_ICU_ENTRY_POINT_RENAME(unum_parseInt64) +#define unum_parseToUFormattable U_ICU_ENTRY_POINT_RENAME(unum_parseToUFormattable) +#define unum_setAttribute U_ICU_ENTRY_POINT_RENAME(unum_setAttribute) +#define unum_setContext U_ICU_ENTRY_POINT_RENAME(unum_setContext) +#define unum_setDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_setDoubleAttribute) +#define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol) +#define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute) +#define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern) +#define unumf_close U_ICU_ENTRY_POINT_RENAME(unumf_close) +#define unumf_closeResult U_ICU_ENTRY_POINT_RENAME(unumf_closeResult) +#define unumf_formatDecimal U_ICU_ENTRY_POINT_RENAME(unumf_formatDecimal) +#define unumf_formatDouble U_ICU_ENTRY_POINT_RENAME(unumf_formatDouble) +#define unumf_formatInt U_ICU_ENTRY_POINT_RENAME(unumf_formatInt) +#define unumf_openForSkeletonAndLocale U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocale) +#define unumf_openForSkeletonAndLocaleWithError U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocaleWithError) +#define unumf_openResult U_ICU_ENTRY_POINT_RENAME(unumf_openResult) +#define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue) +#define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions) +#define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition) +#define unumf_resultToDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumf_resultToDecimalNumber) +#define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString) +#define unumrf_close U_ICU_ENTRY_POINT_RENAME(unumrf_close) +#define unumrf_closeResult U_ICU_ENTRY_POINT_RENAME(unumrf_closeResult) +#define unumrf_formatDecimalRange U_ICU_ENTRY_POINT_RENAME(unumrf_formatDecimalRange) +#define unumrf_formatDoubleRange U_ICU_ENTRY_POINT_RENAME(unumrf_formatDoubleRange) +#define unumrf_openForSkeletonWithCollapseAndIdentityFallback U_ICU_ENTRY_POINT_RENAME(unumrf_openForSkeletonWithCollapseAndIdentityFallback) +#define unumrf_openResult U_ICU_ENTRY_POINT_RENAME(unumrf_openResult) +#define unumrf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumrf_resultAsValue) +#define unumrf_resultGetFirstDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetFirstDecimalNumber) +#define unumrf_resultGetIdentityResult U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetIdentityResult) +#define unumrf_resultGetSecondDecimalNumber U_ICU_ENTRY_POINT_RENAME(unumrf_resultGetSecondDecimalNumber) +#define unumsys_close U_ICU_ENTRY_POINT_RENAME(unumsys_close) +#define unumsys_getDescription U_ICU_ENTRY_POINT_RENAME(unumsys_getDescription) +#define unumsys_getName U_ICU_ENTRY_POINT_RENAME(unumsys_getName) +#define unumsys_getRadix U_ICU_ENTRY_POINT_RENAME(unumsys_getRadix) +#define unumsys_isAlgorithmic U_ICU_ENTRY_POINT_RENAME(unumsys_isAlgorithmic) +#define unumsys_open U_ICU_ENTRY_POINT_RENAME(unumsys_open) +#define unumsys_openAvailableNames U_ICU_ENTRY_POINT_RENAME(unumsys_openAvailableNames) +#define unumsys_openByName U_ICU_ENTRY_POINT_RENAME(unumsys_openByName) +#define uplrules_close U_ICU_ENTRY_POINT_RENAME(uplrules_close) +#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords) +#define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open) +#define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType) +#define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select) +#define uplrules_selectForRange U_ICU_ENTRY_POINT_RENAME(uplrules_selectForRange) +#define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted) +#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) +#define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) +#define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary) +#define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration) +#define uplug_getContext U_ICU_ENTRY_POINT_RENAME(uplug_getContext) +#define uplug_getCurrentLevel U_ICU_ENTRY_POINT_RENAME(uplug_getCurrentLevel) +#define uplug_getLibrary U_ICU_ENTRY_POINT_RENAME(uplug_getLibrary) +#define uplug_getLibraryName U_ICU_ENTRY_POINT_RENAME(uplug_getLibraryName) +#define uplug_getPlugInternal U_ICU_ENTRY_POINT_RENAME(uplug_getPlugInternal) +#define uplug_getPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLevel) +#define uplug_getPlugLoadStatus U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLoadStatus) +#define uplug_getPlugName U_ICU_ENTRY_POINT_RENAME(uplug_getPlugName) +#define uplug_getPluginFile U_ICU_ENTRY_POINT_RENAME(uplug_getPluginFile) +#define uplug_getSymbolName U_ICU_ENTRY_POINT_RENAME(uplug_getSymbolName) +#define uplug_init U_ICU_ENTRY_POINT_RENAME(uplug_init) +#define uplug_loadPlugFromEntrypoint U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromEntrypoint) +#define uplug_loadPlugFromLibrary U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromLibrary) +#define uplug_nextPlug U_ICU_ENTRY_POINT_RENAME(uplug_nextPlug) +#define uplug_openLibrary U_ICU_ENTRY_POINT_RENAME(uplug_openLibrary) +#define uplug_removePlug U_ICU_ENTRY_POINT_RENAME(uplug_removePlug) +#define uplug_setContext U_ICU_ENTRY_POINT_RENAME(uplug_setContext) +#define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel) +#define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName) +#define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload) +#define uprops_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uprops_addPropertyStarts) +#define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource) +#define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts) +#define uprv_add32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_add32_overflow) +#define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy) +#define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic) +#define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower) +#define uprv_calloc U_ICU_ENTRY_POINT_RENAME(uprv_calloc) +#define uprv_ceil U_ICU_ENTRY_POINT_RENAME(uprv_ceil) +#define uprv_compareASCIIPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareASCIIPropertyNames) +#define uprv_compareEBCDICPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareEBCDICPropertyNames) +#define uprv_compareInvAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvAscii) +#define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic) +#define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii) +#define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID) +#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform) +#define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix) +#define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii) +#define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic) +#define uprv_currencyLeads U_ICU_ENTRY_POINT_RENAME(uprv_currencyLeads) +#define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus) +#define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault) +#define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding) +#define uprv_decContextGetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetStatus) +#define uprv_decContextRestoreStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextRestoreStatus) +#define uprv_decContextSaveStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSaveStatus) +#define uprv_decContextSetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetRounding) +#define uprv_decContextSetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatus) +#define uprv_decContextSetStatusFromString U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromString) +#define uprv_decContextSetStatusFromStringQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromStringQuiet) +#define uprv_decContextSetStatusQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusQuiet) +#define uprv_decContextStatusToString U_ICU_ENTRY_POINT_RENAME(uprv_decContextStatusToString) +#define uprv_decContextTestSavedStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestSavedStatus) +#define uprv_decContextTestStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestStatus) +#define uprv_decContextZeroStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextZeroStatus) +#define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs) +#define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd) +#define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd) +#define uprv_decNumberClass U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClass) +#define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString) +#define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare) +#define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal) +#define uprv_decNumberCompareTotal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotal) +#define uprv_decNumberCompareTotalMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotalMag) +#define uprv_decNumberCopy U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopy) +#define uprv_decNumberCopyAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyAbs) +#define uprv_decNumberCopyNegate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyNegate) +#define uprv_decNumberCopySign U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopySign) +#define uprv_decNumberDivide U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivide) +#define uprv_decNumberDivideInteger U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivideInteger) +#define uprv_decNumberExp U_ICU_ENTRY_POINT_RENAME(uprv_decNumberExp) +#define uprv_decNumberFMA U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFMA) +#define uprv_decNumberFromInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromInt32) +#define uprv_decNumberFromString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromString) +#define uprv_decNumberFromUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromUInt32) +#define uprv_decNumberGetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberGetBCD) +#define uprv_decNumberInvert U_ICU_ENTRY_POINT_RENAME(uprv_decNumberInvert) +#define uprv_decNumberIsNormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsNormal) +#define uprv_decNumberIsSubnormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsSubnormal) +#define uprv_decNumberLn U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLn) +#define uprv_decNumberLog10 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLog10) +#define uprv_decNumberLogB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLogB) +#define uprv_decNumberMax U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMax) +#define uprv_decNumberMaxMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMaxMag) +#define uprv_decNumberMin U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMin) +#define uprv_decNumberMinMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinMag) +#define uprv_decNumberMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinus) +#define uprv_decNumberMultiply U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMultiply) +#define uprv_decNumberNextMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextMinus) +#define uprv_decNumberNextPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextPlus) +#define uprv_decNumberNextToward U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextToward) +#define uprv_decNumberNormalize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNormalize) +#define uprv_decNumberOr U_ICU_ENTRY_POINT_RENAME(uprv_decNumberOr) +#define uprv_decNumberPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPlus) +#define uprv_decNumberPower U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPower) +#define uprv_decNumberQuantize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberQuantize) +#define uprv_decNumberReduce U_ICU_ENTRY_POINT_RENAME(uprv_decNumberReduce) +#define uprv_decNumberRemainder U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainder) +#define uprv_decNumberRemainderNear U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainderNear) +#define uprv_decNumberRescale U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRescale) +#define uprv_decNumberRotate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRotate) +#define uprv_decNumberSameQuantum U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSameQuantum) +#define uprv_decNumberScaleB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberScaleB) +#define uprv_decNumberSetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSetBCD) +#define uprv_decNumberShift U_ICU_ENTRY_POINT_RENAME(uprv_decNumberShift) +#define uprv_decNumberSquareRoot U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSquareRoot) +#define uprv_decNumberSubtract U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSubtract) +#define uprv_decNumberToEngString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToEngString) +#define uprv_decNumberToInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToInt32) +#define uprv_decNumberToIntegralExact U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralExact) +#define uprv_decNumberToIntegralValue U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralValue) +#define uprv_decNumberToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToString) +#define uprv_decNumberToUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToUInt32) +#define uprv_decNumberTrim U_ICU_ENTRY_POINT_RENAME(uprv_decNumberTrim) +#define uprv_decNumberVersion U_ICU_ENTRY_POINT_RENAME(uprv_decNumberVersion) +#define uprv_decNumberXor U_ICU_ENTRY_POINT_RENAME(uprv_decNumberXor) +#define uprv_decNumberZero U_ICU_ENTRY_POINT_RENAME(uprv_decNumberZero) +#define uprv_deleteConditionalCE32 U_ICU_ENTRY_POINT_RENAME(uprv_deleteConditionalCE32) +#define uprv_deleteUObject U_ICU_ENTRY_POINT_RENAME(uprv_deleteUObject) +#define uprv_dl_close U_ICU_ENTRY_POINT_RENAME(uprv_dl_close) +#define uprv_dl_open U_ICU_ENTRY_POINT_RENAME(uprv_dl_open) +#define uprv_dlsym_func U_ICU_ENTRY_POINT_RENAME(uprv_dlsym_func) +#define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy) +#define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii) +#define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii) +#define uprv_ebcdicToLowercaseAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToLowercaseAscii) +#define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower) +#define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs) +#define uprv_floor U_ICU_ENTRY_POINT_RENAME(uprv_floor) +#define uprv_fmax U_ICU_ENTRY_POINT_RENAME(uprv_fmax) +#define uprv_fmin U_ICU_ENTRY_POINT_RENAME(uprv_fmin) +#define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod) +#define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free) +#define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters) +#define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID) +#define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity) +#define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength) +#define uprv_getMaxValues U_ICU_ENTRY_POINT_RENAME(uprv_getMaxValues) +#define uprv_getNaN U_ICU_ENTRY_POINT_RENAME(uprv_getNaN) +#define uprv_getRawUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getRawUTCtime) +#define uprv_getStaticCurrencyName U_ICU_ENTRY_POINT_RENAME(uprv_getStaticCurrencyName) +#define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime) +#define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator) +#define uprv_isASCIILetter U_ICU_ENTRY_POINT_RENAME(uprv_isASCIILetter) +#define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign) +#define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite) +#define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString) +#define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString) +#define uprv_isNaN U_ICU_ENTRY_POINT_RENAME(uprv_isNaN) +#define uprv_isNegativeInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isNegativeInfinity) +#define uprv_isPositiveInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isPositiveInfinity) +#define uprv_itou U_ICU_ENTRY_POINT_RENAME(uprv_itou) +#define uprv_log U_ICU_ENTRY_POINT_RENAME(uprv_log) +#define uprv_malloc U_ICU_ENTRY_POINT_RENAME(uprv_malloc) +#define uprv_mapFile U_ICU_ENTRY_POINT_RENAME(uprv_mapFile) +#define uprv_max U_ICU_ENTRY_POINT_RENAME(uprv_max) +#define uprv_maxMantissa U_ICU_ENTRY_POINT_RENAME(uprv_maxMantissa) +#define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr) +#define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min) +#define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf) +#define uprv_mul32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_mul32_overflow) +#define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency) +#define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute) +#define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow) +#define uprv_pow10 U_ICU_ENTRY_POINT_RENAME(uprv_pow10) +#define uprv_realloc U_ICU_ENTRY_POINT_RENAME(uprv_realloc) +#define uprv_round U_ICU_ENTRY_POINT_RENAME(uprv_round) +#define uprv_sortArray U_ICU_ENTRY_POINT_RENAME(uprv_sortArray) +#define uprv_stableBinarySearch U_ICU_ENTRY_POINT_RENAME(uprv_stableBinarySearch) +#define uprv_strCompare U_ICU_ENTRY_POINT_RENAME(uprv_strCompare) +#define uprv_strdup U_ICU_ENTRY_POINT_RENAME(uprv_strdup) +#define uprv_stricmp U_ICU_ENTRY_POINT_RENAME(uprv_stricmp) +#define uprv_strndup U_ICU_ENTRY_POINT_RENAME(uprv_strndup) +#define uprv_strnicmp U_ICU_ENTRY_POINT_RENAME(uprv_strnicmp) +#define uprv_syntaxError U_ICU_ENTRY_POINT_RENAME(uprv_syntaxError) +#define uprv_timezone U_ICU_ENTRY_POINT_RENAME(uprv_timezone) +#define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper) +#define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc) +#define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname) +#define uprv_tzname_clear_cache U_ICU_ENTRY_POINT_RENAME(uprv_tzname_clear_cache) +#define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset) +#define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator) +#define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator) +#define uprv_unmapFile U_ICU_ENTRY_POINT_RENAME(uprv_unmapFile) +#define upvec_cloneArray U_ICU_ENTRY_POINT_RENAME(upvec_cloneArray) +#define upvec_close U_ICU_ENTRY_POINT_RENAME(upvec_close) +#define upvec_compact U_ICU_ENTRY_POINT_RENAME(upvec_compact) +#define upvec_compactToUTrie2Handler U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2Handler) +#define upvec_compactToUTrie2WithRowIndexes U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2WithRowIndexes) +#define upvec_getArray U_ICU_ENTRY_POINT_RENAME(upvec_getArray) +#define upvec_getRow U_ICU_ENTRY_POINT_RENAME(upvec_getRow) +#define upvec_getValue U_ICU_ENTRY_POINT_RENAME(upvec_getValue) +#define upvec_open U_ICU_ENTRY_POINT_RENAME(upvec_open) +#define upvec_setValue U_ICU_ENTRY_POINT_RENAME(upvec_setValue) +#define uregex_appendReplacement U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacement) +#define uregex_appendReplacementUText U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacementUText) +#define uregex_appendTail U_ICU_ENTRY_POINT_RENAME(uregex_appendTail) +#define uregex_appendTailUText U_ICU_ENTRY_POINT_RENAME(uregex_appendTailUText) +#define uregex_clone U_ICU_ENTRY_POINT_RENAME(uregex_clone) +#define uregex_close U_ICU_ENTRY_POINT_RENAME(uregex_close) +#define uregex_end U_ICU_ENTRY_POINT_RENAME(uregex_end) +#define uregex_end64 U_ICU_ENTRY_POINT_RENAME(uregex_end64) +#define uregex_find U_ICU_ENTRY_POINT_RENAME(uregex_find) +#define uregex_find64 U_ICU_ENTRY_POINT_RENAME(uregex_find64) +#define uregex_findNext U_ICU_ENTRY_POINT_RENAME(uregex_findNext) +#define uregex_flags U_ICU_ENTRY_POINT_RENAME(uregex_flags) +#define uregex_getFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_getFindProgressCallback) +#define uregex_getMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_getMatchCallback) +#define uregex_getStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_getStackLimit) +#define uregex_getText U_ICU_ENTRY_POINT_RENAME(uregex_getText) +#define uregex_getTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_getTimeLimit) +#define uregex_getUText U_ICU_ENTRY_POINT_RENAME(uregex_getUText) +#define uregex_group U_ICU_ENTRY_POINT_RENAME(uregex_group) +#define uregex_groupCount U_ICU_ENTRY_POINT_RENAME(uregex_groupCount) +#define uregex_groupNumberFromCName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromCName) +#define uregex_groupNumberFromName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromName) +#define uregex_groupUText U_ICU_ENTRY_POINT_RENAME(uregex_groupUText) +#define uregex_hasAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasAnchoringBounds) +#define uregex_hasTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasTransparentBounds) +#define uregex_hitEnd U_ICU_ENTRY_POINT_RENAME(uregex_hitEnd) +#define uregex_lookingAt U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt) +#define uregex_lookingAt64 U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt64) +#define uregex_matches U_ICU_ENTRY_POINT_RENAME(uregex_matches) +#define uregex_matches64 U_ICU_ENTRY_POINT_RENAME(uregex_matches64) +#define uregex_open U_ICU_ENTRY_POINT_RENAME(uregex_open) +#define uregex_openC U_ICU_ENTRY_POINT_RENAME(uregex_openC) +#define uregex_openUText U_ICU_ENTRY_POINT_RENAME(uregex_openUText) +#define uregex_pattern U_ICU_ENTRY_POINT_RENAME(uregex_pattern) +#define uregex_patternUText U_ICU_ENTRY_POINT_RENAME(uregex_patternUText) +#define uregex_refreshUText U_ICU_ENTRY_POINT_RENAME(uregex_refreshUText) +#define uregex_regionEnd U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd) +#define uregex_regionEnd64 U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd64) +#define uregex_regionStart U_ICU_ENTRY_POINT_RENAME(uregex_regionStart) +#define uregex_regionStart64 U_ICU_ENTRY_POINT_RENAME(uregex_regionStart64) +#define uregex_replaceAll U_ICU_ENTRY_POINT_RENAME(uregex_replaceAll) +#define uregex_replaceAllUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceAllUText) +#define uregex_replaceFirst U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirst) +#define uregex_replaceFirstUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirstUText) +#define uregex_requireEnd U_ICU_ENTRY_POINT_RENAME(uregex_requireEnd) +#define uregex_reset U_ICU_ENTRY_POINT_RENAME(uregex_reset) +#define uregex_reset64 U_ICU_ENTRY_POINT_RENAME(uregex_reset64) +#define uregex_setFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_setFindProgressCallback) +#define uregex_setMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_setMatchCallback) +#define uregex_setRegion U_ICU_ENTRY_POINT_RENAME(uregex_setRegion) +#define uregex_setRegion64 U_ICU_ENTRY_POINT_RENAME(uregex_setRegion64) +#define uregex_setRegionAndStart U_ICU_ENTRY_POINT_RENAME(uregex_setRegionAndStart) +#define uregex_setStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_setStackLimit) +#define uregex_setText U_ICU_ENTRY_POINT_RENAME(uregex_setText) +#define uregex_setTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_setTimeLimit) +#define uregex_setUText U_ICU_ENTRY_POINT_RENAME(uregex_setUText) +#define uregex_split U_ICU_ENTRY_POINT_RENAME(uregex_split) +#define uregex_splitUText U_ICU_ENTRY_POINT_RENAME(uregex_splitUText) +#define uregex_start U_ICU_ENTRY_POINT_RENAME(uregex_start) +#define uregex_start64 U_ICU_ENTRY_POINT_RENAME(uregex_start64) +#define uregex_ucstr_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_ucstr_unescape_charAt) +#define uregex_useAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_useAnchoringBounds) +#define uregex_useTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_useTransparentBounds) +#define uregex_utext_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_utext_unescape_charAt) +#define uregion_areEqual U_ICU_ENTRY_POINT_RENAME(uregion_areEqual) +#define uregion_contains U_ICU_ENTRY_POINT_RENAME(uregion_contains) +#define uregion_getAvailable U_ICU_ENTRY_POINT_RENAME(uregion_getAvailable) +#define uregion_getContainedRegions U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegions) +#define uregion_getContainedRegionsOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegionsOfType) +#define uregion_getContainingRegion U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegion) +#define uregion_getContainingRegionOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegionOfType) +#define uregion_getNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getNumericCode) +#define uregion_getPreferredValues U_ICU_ENTRY_POINT_RENAME(uregion_getPreferredValues) +#define uregion_getRegionCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionCode) +#define uregion_getRegionFromCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromCode) +#define uregion_getRegionFromNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromNumericCode) +#define uregion_getType U_ICU_ENTRY_POINT_RENAME(uregion_getType) +#define ureldatefmt_close U_ICU_ENTRY_POINT_RENAME(ureldatefmt_close) +#define ureldatefmt_closeResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_closeResult) +#define ureldatefmt_combineDateAndTime U_ICU_ENTRY_POINT_RENAME(ureldatefmt_combineDateAndTime) +#define ureldatefmt_format U_ICU_ENTRY_POINT_RENAME(ureldatefmt_format) +#define ureldatefmt_formatNumeric U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumeric) +#define ureldatefmt_formatNumericToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumericToResult) +#define ureldatefmt_formatToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatToResult) +#define ureldatefmt_open U_ICU_ENTRY_POINT_RENAME(ureldatefmt_open) +#define ureldatefmt_openResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_openResult) +#define ureldatefmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ureldatefmt_resultAsValue) +#define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close) +#define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb) +#define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems) +#define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource) +#define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource) +#define ures_getAllChildrenWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getAllChildrenWithFallback) +#define ures_getAllItemsWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getAllItemsWithFallback) +#define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary) +#define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex) +#define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey) +#define ures_getByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getByKeyWithFallback) +#define ures_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ures_getFunctionalEquivalent) +#define ures_getInt U_ICU_ENTRY_POINT_RENAME(ures_getInt) +#define ures_getIntVector U_ICU_ENTRY_POINT_RENAME(ures_getIntVector) +#define ures_getKey U_ICU_ENTRY_POINT_RENAME(ures_getKey) +#define ures_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ures_getKeywordValues) +#define ures_getLocale U_ICU_ENTRY_POINT_RENAME(ures_getLocale) +#define ures_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ures_getLocaleByType) +#define ures_getLocaleInternal U_ICU_ENTRY_POINT_RENAME(ures_getLocaleInternal) +#define ures_getName U_ICU_ENTRY_POINT_RENAME(ures_getName) +#define ures_getNextResource U_ICU_ENTRY_POINT_RENAME(ures_getNextResource) +#define ures_getNextString U_ICU_ENTRY_POINT_RENAME(ures_getNextString) +#define ures_getSize U_ICU_ENTRY_POINT_RENAME(ures_getSize) +#define ures_getString U_ICU_ENTRY_POINT_RENAME(ures_getString) +#define ures_getStringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getStringByIndex) +#define ures_getStringByKey U_ICU_ENTRY_POINT_RENAME(ures_getStringByKey) +#define ures_getStringByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getStringByKeyWithFallback) +#define ures_getType U_ICU_ENTRY_POINT_RENAME(ures_getType) +#define ures_getUInt U_ICU_ENTRY_POINT_RENAME(ures_getUInt) +#define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String) +#define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex) +#define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey) +#define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback) +#define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion) +#define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey) +#define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber) +#define ures_getVersionNumberInternal U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumberInternal) +#define ures_hasNext U_ICU_ENTRY_POINT_RENAME(ures_hasNext) +#define ures_initStackObject U_ICU_ENTRY_POINT_RENAME(ures_initStackObject) +#define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open) +#define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales) +#define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect) +#define ures_openDirectFillIn U_ICU_ENTRY_POINT_RENAME(ures_openDirectFillIn) +#define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn) +#define ures_openNoDefault U_ICU_ENTRY_POINT_RENAME(ures_openNoDefault) +#define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU) +#define ures_resetIterator U_ICU_ENTRY_POINT_RENAME(ures_resetIterator) +#define ures_swap U_ICU_ENTRY_POINT_RENAME(ures_swap) +#define uscript_breaksBetweenLetters U_ICU_ENTRY_POINT_RENAME(uscript_breaksBetweenLetters) +#define uscript_closeRun U_ICU_ENTRY_POINT_RENAME(uscript_closeRun) +#define uscript_getCode U_ICU_ENTRY_POINT_RENAME(uscript_getCode) +#define uscript_getName U_ICU_ENTRY_POINT_RENAME(uscript_getName) +#define uscript_getSampleString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleString) +#define uscript_getSampleUnicodeString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleUnicodeString) +#define uscript_getScript U_ICU_ENTRY_POINT_RENAME(uscript_getScript) +#define uscript_getScriptExtensions U_ICU_ENTRY_POINT_RENAME(uscript_getScriptExtensions) +#define uscript_getShortName U_ICU_ENTRY_POINT_RENAME(uscript_getShortName) +#define uscript_getUsage U_ICU_ENTRY_POINT_RENAME(uscript_getUsage) +#define uscript_hasScript U_ICU_ENTRY_POINT_RENAME(uscript_hasScript) +#define uscript_isCased U_ICU_ENTRY_POINT_RENAME(uscript_isCased) +#define uscript_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uscript_isRightToLeft) +#define uscript_nextRun U_ICU_ENTRY_POINT_RENAME(uscript_nextRun) +#define uscript_openRun U_ICU_ENTRY_POINT_RENAME(uscript_openRun) +#define uscript_resetRun U_ICU_ENTRY_POINT_RENAME(uscript_resetRun) +#define uscript_setRunText U_ICU_ENTRY_POINT_RENAME(uscript_setRunText) +#define usearch_close U_ICU_ENTRY_POINT_RENAME(usearch_close) +#define usearch_first U_ICU_ENTRY_POINT_RENAME(usearch_first) +#define usearch_following U_ICU_ENTRY_POINT_RENAME(usearch_following) +#define usearch_getAttribute U_ICU_ENTRY_POINT_RENAME(usearch_getAttribute) +#define usearch_getBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_getBreakIterator) +#define usearch_getCollator U_ICU_ENTRY_POINT_RENAME(usearch_getCollator) +#define usearch_getMatchedLength U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedLength) +#define usearch_getMatchedStart U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedStart) +#define usearch_getMatchedText U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedText) +#define usearch_getOffset U_ICU_ENTRY_POINT_RENAME(usearch_getOffset) +#define usearch_getPattern U_ICU_ENTRY_POINT_RENAME(usearch_getPattern) +#define usearch_getText U_ICU_ENTRY_POINT_RENAME(usearch_getText) +#define usearch_handleNextCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handleNextCanonical) +#define usearch_handleNextExact U_ICU_ENTRY_POINT_RENAME(usearch_handleNextExact) +#define usearch_handlePreviousCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousCanonical) +#define usearch_handlePreviousExact U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousExact) +#define usearch_last U_ICU_ENTRY_POINT_RENAME(usearch_last) +#define usearch_next U_ICU_ENTRY_POINT_RENAME(usearch_next) +#define usearch_open U_ICU_ENTRY_POINT_RENAME(usearch_open) +#define usearch_openFromCollator U_ICU_ENTRY_POINT_RENAME(usearch_openFromCollator) +#define usearch_preceding U_ICU_ENTRY_POINT_RENAME(usearch_preceding) +#define usearch_previous U_ICU_ENTRY_POINT_RENAME(usearch_previous) +#define usearch_reset U_ICU_ENTRY_POINT_RENAME(usearch_reset) +#define usearch_search U_ICU_ENTRY_POINT_RENAME(usearch_search) +#define usearch_searchBackwards U_ICU_ENTRY_POINT_RENAME(usearch_searchBackwards) +#define usearch_setAttribute U_ICU_ENTRY_POINT_RENAME(usearch_setAttribute) +#define usearch_setBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_setBreakIterator) +#define usearch_setCollator U_ICU_ENTRY_POINT_RENAME(usearch_setCollator) +#define usearch_setOffset U_ICU_ENTRY_POINT_RENAME(usearch_setOffset) +#define usearch_setPattern U_ICU_ENTRY_POINT_RENAME(usearch_setPattern) +#define usearch_setText U_ICU_ENTRY_POINT_RENAME(usearch_setText) +#define uset_add U_ICU_ENTRY_POINT_RENAME(uset_add) +#define uset_addAll U_ICU_ENTRY_POINT_RENAME(uset_addAll) +#define uset_addAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_addAllCodePoints) +#define uset_addRange U_ICU_ENTRY_POINT_RENAME(uset_addRange) +#define uset_addString U_ICU_ENTRY_POINT_RENAME(uset_addString) +#define uset_applyIntPropertyValue U_ICU_ENTRY_POINT_RENAME(uset_applyIntPropertyValue) +#define uset_applyPattern U_ICU_ENTRY_POINT_RENAME(uset_applyPattern) +#define uset_applyPropertyAlias U_ICU_ENTRY_POINT_RENAME(uset_applyPropertyAlias) +#define uset_charAt U_ICU_ENTRY_POINT_RENAME(uset_charAt) +#define uset_clear U_ICU_ENTRY_POINT_RENAME(uset_clear) +#define uset_clone U_ICU_ENTRY_POINT_RENAME(uset_clone) +#define uset_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(uset_cloneAsThawed) +#define uset_close U_ICU_ENTRY_POINT_RENAME(uset_close) +#define uset_closeOver U_ICU_ENTRY_POINT_RENAME(uset_closeOver) +#define uset_compact U_ICU_ENTRY_POINT_RENAME(uset_compact) +#define uset_complement U_ICU_ENTRY_POINT_RENAME(uset_complement) +#define uset_complementAll U_ICU_ENTRY_POINT_RENAME(uset_complementAll) +#define uset_complementAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_complementAllCodePoints) +#define uset_complementRange U_ICU_ENTRY_POINT_RENAME(uset_complementRange) +#define uset_complementString U_ICU_ENTRY_POINT_RENAME(uset_complementString) +#define uset_contains U_ICU_ENTRY_POINT_RENAME(uset_contains) +#define uset_containsAll U_ICU_ENTRY_POINT_RENAME(uset_containsAll) +#define uset_containsAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_containsAllCodePoints) +#define uset_containsNone U_ICU_ENTRY_POINT_RENAME(uset_containsNone) +#define uset_containsRange U_ICU_ENTRY_POINT_RENAME(uset_containsRange) +#define uset_containsSome U_ICU_ENTRY_POINT_RENAME(uset_containsSome) +#define uset_containsString U_ICU_ENTRY_POINT_RENAME(uset_containsString) +#define uset_equals U_ICU_ENTRY_POINT_RENAME(uset_equals) +#define uset_freeze U_ICU_ENTRY_POINT_RENAME(uset_freeze) +#define uset_getItem U_ICU_ENTRY_POINT_RENAME(uset_getItem) +#define uset_getItemCount U_ICU_ENTRY_POINT_RENAME(uset_getItemCount) +#define uset_getRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getRangeCount) +#define uset_getSerializedRange U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRange) +#define uset_getSerializedRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRangeCount) +#define uset_getSerializedSet U_ICU_ENTRY_POINT_RENAME(uset_getSerializedSet) +#define uset_hasStrings U_ICU_ENTRY_POINT_RENAME(uset_hasStrings) +#define uset_indexOf U_ICU_ENTRY_POINT_RENAME(uset_indexOf) +#define uset_isEmpty U_ICU_ENTRY_POINT_RENAME(uset_isEmpty) +#define uset_isFrozen U_ICU_ENTRY_POINT_RENAME(uset_isFrozen) +#define uset_open U_ICU_ENTRY_POINT_RENAME(uset_open) +#define uset_openEmpty U_ICU_ENTRY_POINT_RENAME(uset_openEmpty) +#define uset_openPattern U_ICU_ENTRY_POINT_RENAME(uset_openPattern) +#define uset_openPatternOptions U_ICU_ENTRY_POINT_RENAME(uset_openPatternOptions) +#define uset_remove U_ICU_ENTRY_POINT_RENAME(uset_remove) +#define uset_removeAll U_ICU_ENTRY_POINT_RENAME(uset_removeAll) +#define uset_removeAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_removeAllCodePoints) +#define uset_removeAllStrings U_ICU_ENTRY_POINT_RENAME(uset_removeAllStrings) +#define uset_removeRange U_ICU_ENTRY_POINT_RENAME(uset_removeRange) +#define uset_removeString U_ICU_ENTRY_POINT_RENAME(uset_removeString) +#define uset_resemblesPattern U_ICU_ENTRY_POINT_RENAME(uset_resemblesPattern) +#define uset_retain U_ICU_ENTRY_POINT_RENAME(uset_retain) +#define uset_retainAll U_ICU_ENTRY_POINT_RENAME(uset_retainAll) +#define uset_retainAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_retainAllCodePoints) +#define uset_retainString U_ICU_ENTRY_POINT_RENAME(uset_retainString) +#define uset_serialize U_ICU_ENTRY_POINT_RENAME(uset_serialize) +#define uset_serializedContains U_ICU_ENTRY_POINT_RENAME(uset_serializedContains) +#define uset_set U_ICU_ENTRY_POINT_RENAME(uset_set) +#define uset_setSerializedToOne U_ICU_ENTRY_POINT_RENAME(uset_setSerializedToOne) +#define uset_size U_ICU_ENTRY_POINT_RENAME(uset_size) +#define uset_span U_ICU_ENTRY_POINT_RENAME(uset_span) +#define uset_spanBack U_ICU_ENTRY_POINT_RENAME(uset_spanBack) +#define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8) +#define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8) +#define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern) +#define usnum_close U_ICU_ENTRY_POINT_RENAME(usnum_close) +#define usnum_multiplyByPowerOfTen U_ICU_ENTRY_POINT_RENAME(usnum_multiplyByPowerOfTen) +#define usnum_openForInt64 U_ICU_ENTRY_POINT_RENAME(usnum_openForInt64) +#define usnum_roundTo U_ICU_ENTRY_POINT_RENAME(usnum_roundTo) +#define usnum_setMinimumFractionDigits U_ICU_ENTRY_POINT_RENAME(usnum_setMinimumFractionDigits) +#define usnum_setMinimumIntegerDigits U_ICU_ENTRY_POINT_RENAME(usnum_setMinimumIntegerDigits) +#define usnum_setSign U_ICU_ENTRY_POINT_RENAME(usnum_setSign) +#define usnum_setToInt64 U_ICU_ENTRY_POINT_RENAME(usnum_setToInt64) +#define usnum_truncateStart U_ICU_ENTRY_POINT_RENAME(usnum_truncateStart) +#define usnumf_close U_ICU_ENTRY_POINT_RENAME(usnumf_close) +#define usnumf_format U_ICU_ENTRY_POINT_RENAME(usnumf_format) +#define usnumf_formatInt64 U_ICU_ENTRY_POINT_RENAME(usnumf_formatInt64) +#define usnumf_openForLocale U_ICU_ENTRY_POINT_RENAME(usnumf_openForLocale) +#define usnumf_openForLocaleAndGroupingStrategy U_ICU_ENTRY_POINT_RENAME(usnumf_openForLocaleAndGroupingStrategy) +#define uspoof_areBidiConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areBidiConfusable) +#define uspoof_areBidiConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areBidiConfusableUTF8) +#define uspoof_areBidiConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areBidiConfusableUnicodeString) +#define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable) +#define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8) +#define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString) +#define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check) +#define uspoof_check2 U_ICU_ENTRY_POINT_RENAME(uspoof_check2) +#define uspoof_check2UTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_check2UTF8) +#define uspoof_check2UnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_check2UnicodeString) +#define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8) +#define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString) +#define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone) +#define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close) +#define uspoof_closeCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_closeCheckResult) +#define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars) +#define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales) +#define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet) +#define uspoof_getBidiSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getBidiSkeleton) +#define uspoof_getBidiSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getBidiSkeletonUTF8) +#define uspoof_getBidiSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getBidiSkeletonUnicodeString) +#define uspoof_getCheckResultChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultChecks) +#define uspoof_getCheckResultNumerics U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultNumerics) +#define uspoof_getCheckResultRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultRestrictionLevel) +#define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks) +#define uspoof_getInclusionSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionSet) +#define uspoof_getInclusionUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionUnicodeSet) +#define uspoof_getRecommendedSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedSet) +#define uspoof_getRecommendedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedUnicodeSet) +#define uspoof_getRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getRestrictionLevel) +#define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton) +#define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8) +#define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString) +#define uspoof_internalInitStatics U_ICU_ENTRY_POINT_RENAME(uspoof_internalInitStatics) +#define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open) +#define uspoof_openCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_openCheckResult) +#define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized) +#define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource) +#define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize) +#define uspoof_setAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedChars) +#define uspoof_setAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedLocales) +#define uspoof_setAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedUnicodeSet) +#define uspoof_setChecks U_ICU_ENTRY_POINT_RENAME(uspoof_setChecks) +#define uspoof_setRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_setRestrictionLevel) +#define uspoof_swap U_ICU_ENTRY_POINT_RENAME(uspoof_swap) +#define usprep_close U_ICU_ENTRY_POINT_RENAME(usprep_close) +#define usprep_open U_ICU_ENTRY_POINT_RENAME(usprep_open) +#define usprep_openByType U_ICU_ENTRY_POINT_RENAME(usprep_openByType) +#define usprep_prepare U_ICU_ENTRY_POINT_RENAME(usprep_prepare) +#define usprep_swap U_ICU_ENTRY_POINT_RENAME(usprep_swap) +#define ustr_hashCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashCharsN) +#define ustr_hashICharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashICharsN) +#define ustr_hashUCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashUCharsN) +#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale) +#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator) +#define ustrcase_internalFold U_ICU_ENTRY_POINT_RENAME(ustrcase_internalFold) +#define ustrcase_internalToLower U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToLower) +#define ustrcase_internalToTitle U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToTitle) +#define ustrcase_internalToUpper U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToUpper) +#define ustrcase_map U_ICU_ENTRY_POINT_RENAME(ustrcase_map) +#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap) +#define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At) +#define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone) +#define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close) +#define utext_copy U_ICU_ENTRY_POINT_RENAME(utext_copy) +#define utext_current32 U_ICU_ENTRY_POINT_RENAME(utext_current32) +#define utext_equals U_ICU_ENTRY_POINT_RENAME(utext_equals) +#define utext_extract U_ICU_ENTRY_POINT_RENAME(utext_extract) +#define utext_freeze U_ICU_ENTRY_POINT_RENAME(utext_freeze) +#define utext_getNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getNativeIndex) +#define utext_getPreviousNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getPreviousNativeIndex) +#define utext_hasMetaData U_ICU_ENTRY_POINT_RENAME(utext_hasMetaData) +#define utext_isLengthExpensive U_ICU_ENTRY_POINT_RENAME(utext_isLengthExpensive) +#define utext_isWritable U_ICU_ENTRY_POINT_RENAME(utext_isWritable) +#define utext_moveIndex32 U_ICU_ENTRY_POINT_RENAME(utext_moveIndex32) +#define utext_nativeLength U_ICU_ENTRY_POINT_RENAME(utext_nativeLength) +#define utext_next32 U_ICU_ENTRY_POINT_RENAME(utext_next32) +#define utext_next32From U_ICU_ENTRY_POINT_RENAME(utext_next32From) +#define utext_openCharacterIterator U_ICU_ENTRY_POINT_RENAME(utext_openCharacterIterator) +#define utext_openConstUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openConstUnicodeString) +#define utext_openReplaceable U_ICU_ENTRY_POINT_RENAME(utext_openReplaceable) +#define utext_openUChars U_ICU_ENTRY_POINT_RENAME(utext_openUChars) +#define utext_openUTF8 U_ICU_ENTRY_POINT_RENAME(utext_openUTF8) +#define utext_openUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openUnicodeString) +#define utext_previous32 U_ICU_ENTRY_POINT_RENAME(utext_previous32) +#define utext_previous32From U_ICU_ENTRY_POINT_RENAME(utext_previous32From) +#define utext_replace U_ICU_ENTRY_POINT_RENAME(utext_replace) +#define utext_setNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_setNativeIndex) +#define utext_setup U_ICU_ENTRY_POINT_RENAME(utext_setup) +#define utf8_appendCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_appendCharSafeBody) +#define utf8_back1SafeBody U_ICU_ENTRY_POINT_RENAME(utf8_back1SafeBody) +#define utf8_countTrailBytes U_ICU_ENTRY_POINT_RENAME(utf8_countTrailBytes) +#define utf8_nextCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_nextCharSafeBody) +#define utf8_prevCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_prevCharSafeBody) +#define utmscale_fromInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_fromInt64) +#define utmscale_getTimeScaleValue U_ICU_ENTRY_POINT_RENAME(utmscale_getTimeScaleValue) +#define utmscale_toInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_toInt64) +#define utrace_cleanup U_ICU_ENTRY_POINT_RENAME(utrace_cleanup) +#define utrace_data U_ICU_ENTRY_POINT_RENAME(utrace_data) +#define utrace_entry U_ICU_ENTRY_POINT_RENAME(utrace_entry) +#define utrace_exit U_ICU_ENTRY_POINT_RENAME(utrace_exit) +#define utrace_format U_ICU_ENTRY_POINT_RENAME(utrace_format) +#define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName) +#define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions) +#define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel) +#define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions) +#define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel) +#define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat) +#define utrans_clone U_ICU_ENTRY_POINT_RENAME(utrans_clone) +#define utrans_close U_ICU_ENTRY_POINT_RENAME(utrans_close) +#define utrans_countAvailableIDs U_ICU_ENTRY_POINT_RENAME(utrans_countAvailableIDs) +#define utrans_getAvailableID U_ICU_ENTRY_POINT_RENAME(utrans_getAvailableID) +#define utrans_getID U_ICU_ENTRY_POINT_RENAME(utrans_getID) +#define utrans_getSourceSet U_ICU_ENTRY_POINT_RENAME(utrans_getSourceSet) +#define utrans_getUnicodeID U_ICU_ENTRY_POINT_RENAME(utrans_getUnicodeID) +#define utrans_open U_ICU_ENTRY_POINT_RENAME(utrans_open) +#define utrans_openIDs U_ICU_ENTRY_POINT_RENAME(utrans_openIDs) +#define utrans_openInverse U_ICU_ENTRY_POINT_RENAME(utrans_openInverse) +#define utrans_openU U_ICU_ENTRY_POINT_RENAME(utrans_openU) +#define utrans_register U_ICU_ENTRY_POINT_RENAME(utrans_register) +#define utrans_rep_caseContextIterator U_ICU_ENTRY_POINT_RENAME(utrans_rep_caseContextIterator) +#define utrans_setFilter U_ICU_ENTRY_POINT_RENAME(utrans_setFilter) +#define utrans_stripRules U_ICU_ENTRY_POINT_RENAME(utrans_stripRules) +#define utrans_toRules U_ICU_ENTRY_POINT_RENAME(utrans_toRules) +#define utrans_trans U_ICU_ENTRY_POINT_RENAME(utrans_trans) +#define utrans_transIncremental U_ICU_ENTRY_POINT_RENAME(utrans_transIncremental) +#define utrans_transIncrementalUChars U_ICU_ENTRY_POINT_RENAME(utrans_transIncrementalUChars) +#define utrans_transUChars U_ICU_ENTRY_POINT_RENAME(utrans_transUChars) +#define utrans_transliterator_cleanup U_ICU_ENTRY_POINT_RENAME(utrans_transliterator_cleanup) +#define utrans_unregister U_ICU_ENTRY_POINT_RENAME(utrans_unregister) +#define utrans_unregisterID U_ICU_ENTRY_POINT_RENAME(utrans_unregisterID) +#define utrie2_clone U_ICU_ENTRY_POINT_RENAME(utrie2_clone) +#define utrie2_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(utrie2_cloneAsThawed) +#define utrie2_close U_ICU_ENTRY_POINT_RENAME(utrie2_close) +#define utrie2_enum U_ICU_ENTRY_POINT_RENAME(utrie2_enum) +#define utrie2_enumForLeadSurrogate U_ICU_ENTRY_POINT_RENAME(utrie2_enumForLeadSurrogate) +#define utrie2_freeze U_ICU_ENTRY_POINT_RENAME(utrie2_freeze) +#define utrie2_fromUTrie U_ICU_ENTRY_POINT_RENAME(utrie2_fromUTrie) +#define utrie2_get32 U_ICU_ENTRY_POINT_RENAME(utrie2_get32) +#define utrie2_get32FromLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_get32FromLeadSurrogateCodeUnit) +#define utrie2_internalU8NextIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8NextIndex) +#define utrie2_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8PrevIndex) +#define utrie2_isFrozen U_ICU_ENTRY_POINT_RENAME(utrie2_isFrozen) +#define utrie2_open U_ICU_ENTRY_POINT_RENAME(utrie2_open) +#define utrie2_openDummy U_ICU_ENTRY_POINT_RENAME(utrie2_openDummy) +#define utrie2_openFromSerialized U_ICU_ENTRY_POINT_RENAME(utrie2_openFromSerialized) +#define utrie2_serialize U_ICU_ENTRY_POINT_RENAME(utrie2_serialize) +#define utrie2_set32 U_ICU_ENTRY_POINT_RENAME(utrie2_set32) +#define utrie2_set32ForLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_set32ForLeadSurrogateCodeUnit) +#define utrie2_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie2_setRange32) +#define utrie2_swap U_ICU_ENTRY_POINT_RENAME(utrie2_swap) +#define utrie_clone U_ICU_ENTRY_POINT_RENAME(utrie_clone) +#define utrie_close U_ICU_ENTRY_POINT_RENAME(utrie_close) +#define utrie_defaultGetFoldingOffset U_ICU_ENTRY_POINT_RENAME(utrie_defaultGetFoldingOffset) +#define utrie_enum U_ICU_ENTRY_POINT_RENAME(utrie_enum) +#define utrie_get32 U_ICU_ENTRY_POINT_RENAME(utrie_get32) +#define utrie_getData U_ICU_ENTRY_POINT_RENAME(utrie_getData) +#define utrie_open U_ICU_ENTRY_POINT_RENAME(utrie_open) +#define utrie_serialize U_ICU_ENTRY_POINT_RENAME(utrie_serialize) +#define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32) +#define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32) +#define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap) +#define utrie_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie_swapAnyVersion) +#define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize) +#define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy) +#define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone) +#define vzone_close U_ICU_ENTRY_POINT_RENAME(vzone_close) +#define vzone_countTransitionRules U_ICU_ENTRY_POINT_RENAME(vzone_countTransitionRules) +#define vzone_equals U_ICU_ENTRY_POINT_RENAME(vzone_equals) +#define vzone_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(vzone_getDynamicClassID) +#define vzone_getLastModified U_ICU_ENTRY_POINT_RENAME(vzone_getLastModified) +#define vzone_getNextTransition U_ICU_ENTRY_POINT_RENAME(vzone_getNextTransition) +#define vzone_getOffset U_ICU_ENTRY_POINT_RENAME(vzone_getOffset) +#define vzone_getOffset2 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset2) +#define vzone_getOffset3 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset3) +#define vzone_getPreviousTransition U_ICU_ENTRY_POINT_RENAME(vzone_getPreviousTransition) +#define vzone_getRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_getRawOffset) +#define vzone_getStaticClassID U_ICU_ENTRY_POINT_RENAME(vzone_getStaticClassID) +#define vzone_getTZURL U_ICU_ENTRY_POINT_RENAME(vzone_getTZURL) +#define vzone_hasSameRules U_ICU_ENTRY_POINT_RENAME(vzone_hasSameRules) +#define vzone_inDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_inDaylightTime) +#define vzone_openData U_ICU_ENTRY_POINT_RENAME(vzone_openData) +#define vzone_openID U_ICU_ENTRY_POINT_RENAME(vzone_openID) +#define vzone_setLastModified U_ICU_ENTRY_POINT_RENAME(vzone_setLastModified) +#define vzone_setRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_setRawOffset) +#define vzone_setTZURL U_ICU_ENTRY_POINT_RENAME(vzone_setTZURL) +#define vzone_useDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_useDaylightTime) +#define vzone_write U_ICU_ENTRY_POINT_RENAME(vzone_write) +#define vzone_writeFromStart U_ICU_ENTRY_POINT_RENAME(vzone_writeFromStart) +#define vzone_writeSimple U_ICU_ENTRY_POINT_RENAME(vzone_writeSimple) +#define zrule_close U_ICU_ENTRY_POINT_RENAME(zrule_close) +#define zrule_equals U_ICU_ENTRY_POINT_RENAME(zrule_equals) +#define zrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(zrule_getDSTSavings) +#define zrule_getName U_ICU_ENTRY_POINT_RENAME(zrule_getName) +#define zrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(zrule_getRawOffset) +#define zrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(zrule_isEquivalentTo) +#define ztrans_adoptFrom U_ICU_ENTRY_POINT_RENAME(ztrans_adoptFrom) +#define ztrans_adoptTo U_ICU_ENTRY_POINT_RENAME(ztrans_adoptTo) +#define ztrans_clone U_ICU_ENTRY_POINT_RENAME(ztrans_clone) +#define ztrans_close U_ICU_ENTRY_POINT_RENAME(ztrans_close) +#define ztrans_equals U_ICU_ENTRY_POINT_RENAME(ztrans_equals) +#define ztrans_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getDynamicClassID) +#define ztrans_getFrom U_ICU_ENTRY_POINT_RENAME(ztrans_getFrom) +#define ztrans_getStaticClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getStaticClassID) +#define ztrans_getTime U_ICU_ENTRY_POINT_RENAME(ztrans_getTime) +#define ztrans_getTo U_ICU_ENTRY_POINT_RENAME(ztrans_getTo) +#define ztrans_open U_ICU_ENTRY_POINT_RENAME(ztrans_open) +#define ztrans_openEmpty U_ICU_ENTRY_POINT_RENAME(ztrans_openEmpty) +#define ztrans_setFrom U_ICU_ENTRY_POINT_RENAME(ztrans_setFrom) +#define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime) +#define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo) -// #endif /* !(defined(_MSC_VER) && defined(__INTELLISENSE__)) */ -// #endif /* U_DISABLE_RENAMING */ +#endif /* !(defined(_MSC_VER) && defined(__INTELLISENSE__)) */ +#endif /* U_DISABLE_RENAMING */ #endif /* URENAME_H */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ures.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ures.h index 839779fad..babc01d42 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ures.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ures.h @@ -25,9 +25,13 @@ #ifndef URES_H #define URES_H +#include "unicode/char16ptr.h" #include "unicode/utypes.h" #include "unicode/uloc.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * \file @@ -41,9 +45,9 @@ * locale and then ask it for individual resources. *

    * Resource bundles in ICU4C are currently defined using text files which conform to the following - * BNF definition. + * BNF definition. * More on resource bundle concepts and syntax can be found in the - * Users Guide. + * Users Guide. *

    */ @@ -163,7 +167,7 @@ typedef enum { * @see ures_close * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_open(const char* packageName, const char* locale, UErrorCode* status); @@ -186,7 +190,7 @@ ures_open(const char* packageName, * @see ures_close * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_openDirect(const char* packageName, const char* locale, UErrorCode* status); @@ -209,7 +213,7 @@ ures_openDirect(const char* packageName, * @see ures_open * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_openU(const UChar* packageName, const char* locale, UErrorCode* status); @@ -245,7 +249,7 @@ ures_countArrayItems(const UResourceBundle* resourceBundle, * @see ures_open * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_close(UResourceBundle* resourceBundle); #if U_SHOW_CPLUSPLUS_API @@ -291,7 +295,7 @@ ures_getVersionNumber(const UResourceBundle* resourceBundle); * as specified in the resource bundle or its parent. * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo); @@ -325,7 +329,7 @@ ures_getLocale(const UResourceBundle* resourceBundle, * @return A Locale name * @stable ICU 2.8 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ures_getLocaleByType(const UResourceBundle* resourceBundle, ULocDataLocaleType type, UErrorCode* status); @@ -348,7 +352,7 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle, * @param status The error code. * @internal */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_openFillIn(UResourceBundle *r, const char* packageName, const char* localeID, @@ -372,7 +376,7 @@ ures_openFillIn(UResourceBundle *r, * @see ures_getUInt * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); @@ -383,10 +387,10 @@ ures_getString(const UResourceBundle* resourceBundle, * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * - * If forceCopy==TRUE, then the string is always written to the dest buffer + * If forceCopy==true, then the string is always written to the dest buffer * and dest is returned. * - * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * If forceCopy==false, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * @@ -404,10 +408,10 @@ ures_getString(const UResourceBundle* resourceBundle, * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. - * @param forceCopy If TRUE, then the output string will always be written to + * @param forceCopy If true, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. - * If FALSE, then the dest buffer may or may not contain a + * If false, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. @@ -424,7 +428,7 @@ ures_getString(const UResourceBundle* resourceBundle, * @see u_strToUTF8 * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getUTF8String(const UResourceBundle *resB, char *dest, int32_t *length, UBool forceCopy, @@ -447,7 +451,7 @@ ures_getUTF8String(const UResourceBundle *resB, * @see ures_getUInt * @stable ICU 2.0 */ -U_STABLE const uint8_t* U_EXPORT2 +U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); @@ -469,7 +473,7 @@ ures_getBinary(const UResourceBundle* resourceBundle, * @see ures_getUInt * @stable ICU 2.0 */ -U_STABLE const int32_t* U_EXPORT2 +U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); @@ -490,7 +494,7 @@ ures_getIntVector(const UResourceBundle* resourceBundle, * @see ures_getString * @stable ICU 2.0 */ -U_STABLE uint32_t U_EXPORT2 +U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resourceBundle, UErrorCode *status); @@ -510,7 +514,7 @@ ures_getUInt(const UResourceBundle* resourceBundle, * @see ures_getString * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resourceBundle, UErrorCode *status); @@ -524,7 +528,7 @@ ures_getInt(const UResourceBundle* resourceBundle, * @return number of resources in a given resource. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resourceBundle); /** @@ -535,7 +539,7 @@ ures_getSize(const UResourceBundle *resourceBundle); * @see UResType * @stable ICU 2.0 */ -U_STABLE UResType U_EXPORT2 +U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resourceBundle); /** @@ -546,7 +550,7 @@ ures_getType(const UResourceBundle *resourceBundle); * @return a key associated to this resource, or NULL if it doesn't have a key * @stable ICU 2.0 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resourceBundle); /* ITERATION API @@ -559,17 +563,17 @@ ures_getKey(const UResourceBundle *resourceBundle); * @param resourceBundle a resource * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resourceBundle); /** * Checks whether the given resource has another element to iterate over. * * @param resourceBundle a resource - * @return TRUE if there are more elements, FALSE if there is no more elements + * @return true if there are more elements, false if there is no more elements * @stable ICU 2.0 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resourceBundle); /** @@ -584,7 +588,7 @@ ures_hasNext(const UResourceBundle *resourceBundle); * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resourceBundle, UResourceBundle *fillIn, UErrorCode *status); @@ -601,7 +605,7 @@ ures_getNextResource(UResourceBundle *resourceBundle, * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resourceBundle, int32_t* len, const char ** key, @@ -619,7 +623,7 @@ ures_getNextString(UResourceBundle *resourceBundle, * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resourceBundle, int32_t indexR, UResourceBundle *fillIn, @@ -636,7 +640,7 @@ ures_getByIndex(const UResourceBundle *resourceBundle, * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resourceBundle, int32_t indexS, int32_t* len, @@ -648,10 +652,10 @@ ures_getStringByIndex(const UResourceBundle *resourceBundle, * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * - * If forceCopy==TRUE, then the string is always written to the dest buffer + * If forceCopy==true, then the string is always written to the dest buffer * and dest is returned. * - * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * If forceCopy==false, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * @@ -670,10 +674,10 @@ ures_getStringByIndex(const UResourceBundle *resourceBundle, * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. - * @param forceCopy If TRUE, then the output string will always be written to + * @param forceCopy If true, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. - * If FALSE, then the dest buffer may or may not contain a + * If false, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. @@ -690,7 +694,7 @@ ures_getStringByIndex(const UResourceBundle *resourceBundle, * @see u_strToUTF8 * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getUTF8StringByIndex(const UResourceBundle *resB, int32_t stringIndex, char *dest, int32_t *pLength, @@ -709,7 +713,7 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB, * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ -U_STABLE UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resourceBundle, const char* key, UResourceBundle *fillIn, @@ -727,7 +731,7 @@ ures_getByKey(const UResourceBundle *resourceBundle, * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ -U_STABLE const UChar* U_EXPORT2 +U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* key, int32_t* len, @@ -741,10 +745,10 @@ ures_getStringByKey(const UResourceBundle *resB, * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * - * If forceCopy==TRUE, then the string is always written to the dest buffer + * If forceCopy==true, then the string is always written to the dest buffer * and dest is returned. * - * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * If forceCopy==false, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * @@ -763,10 +767,10 @@ ures_getStringByKey(const UResourceBundle *resB, * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. - * @param forceCopy If TRUE, then the output string will always be written to + * @param forceCopy If true, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. - * If FALSE, then the dest buffer may or may not contain a + * If false, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. @@ -783,7 +787,7 @@ ures_getStringByKey(const UResourceBundle *resB, * @see u_strToUTF8 * @stable ICU 3.6 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ures_getUTF8StringByKey(const UResourceBundle *resB, const char *key, char *dest, int32_t *pLength, @@ -809,9 +813,9 @@ inline UnicodeString ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { UnicodeString result; int32_t len = 0; - const UChar *r = ures_getString(resB, &len, status); + const char16_t *r = ConstChar16Ptr(ures_getString(resB, &len, status)); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -834,9 +838,9 @@ inline UnicodeString ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { UnicodeString result; int32_t len = 0; - const UChar* r = ures_getNextString(resB, &len, key, status); + const char16_t* r = ConstChar16Ptr(ures_getNextString(resB, &len, key, status)); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -856,9 +860,9 @@ inline UnicodeString ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { UnicodeString result; int32_t len = 0; - const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); + const char16_t* r = ConstChar16Ptr(ures_getStringByIndex(resB, indexS, &len, status)); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -879,9 +883,9 @@ inline UnicodeString ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { UnicodeString result; int32_t len = 0; - const UChar* r = ures_getStringByKey(resB, key, &len, status); + const char16_t* r = ConstChar16Ptr(ures_getStringByKey(resB, key, &len, status)); if(U_SUCCESS(*status)) { - result.setTo(TRUE, r, len); + result.setTo(true, r, len); } else { result.setToBogus(); } @@ -900,7 +904,7 @@ U_NAMESPACE_END * @param status error code * @stable ICU 3.2 */ -U_STABLE UEnumeration* U_EXPORT2 +U_CAPI UEnumeration* U_EXPORT2 ures_openAvailableLocales(const char *packageName, UErrorCode *status); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uscript.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uscript.h index 53d57abed..dc97ab2ba 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uscript.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uscript.h @@ -484,6 +484,22 @@ typedef enum UScriptCode { /** @stable ICU 66 */ USCRIPT_YEZIDI = 192,/* Yezi */ + /** @stable ICU 70 */ + USCRIPT_CYPRO_MINOAN = 193,/* Cpmn */ + /** @stable ICU 70 */ + USCRIPT_OLD_UYGHUR = 194,/* Ougr */ + /** @stable ICU 70 */ + USCRIPT_TANGSA = 195,/* Tnsa */ + /** @stable ICU 70 */ + USCRIPT_TOTO = 196,/* Toto */ + /** @stable ICU 70 */ + USCRIPT_VITHKUQI = 197,/* Vith */ + + /** @stable ICU 72 */ + USCRIPT_KAWI = 198,/* Kawi */ + /** @stable ICU 72 */ + USCRIPT_NAG_MUNDARI = 199,/* Nagm */ + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UScriptCode value. @@ -491,7 +507,7 @@ typedef enum UScriptCode { * * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - USCRIPT_CODE_LIMIT = 193 + USCRIPT_CODE_LIMIT = 200 #endif // U_HIDE_DEPRECATED_API } UScriptCode; @@ -514,7 +530,7 @@ typedef enum UScriptCode { * @return The number of script codes filled in the buffer passed in * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err); /** @@ -527,7 +543,7 @@ uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capac * or NULL if scriptCode is invalid * @stable ICU 2.4 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uscript_getName(UScriptCode scriptCode); /** @@ -539,7 +555,7 @@ uscript_getName(UScriptCode scriptCode); * @return short script name (4-letter code), or NULL if scriptCode is invalid * @stable ICU 2.4 */ -U_STABLE const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uscript_getShortName(UScriptCode scriptCode); /** @@ -550,7 +566,7 @@ uscript_getShortName(UScriptCode scriptCode); * @return The UScriptCode, or 0 if codepoint is invalid * @stable ICU 2.4 */ -U_STABLE UScriptCode U_EXPORT2 +U_CAPI UScriptCode U_EXPORT2 uscript_getScript(UChar32 codepoint, UErrorCode *err); /** @@ -562,10 +578,10 @@ uscript_getScript(UChar32 codepoint, UErrorCode *err); * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. * @param c code point * @param sc script code - * @return TRUE if sc is in Script_Extensions(c) + * @return true if sc is in Script_Extensions(c) * @stable ICU 49 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_hasScript(UChar32 c, UScriptCode sc); /** @@ -597,7 +613,7 @@ uscript_hasScript(UChar32 c, UScriptCode sc); * written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity * @stable ICU 49 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uscript_getScriptExtensions(UChar32 c, UScriptCode *scripts, int32_t capacity, UErrorCode *errorCode); @@ -636,7 +652,7 @@ typedef enum UScriptUsage { * @return the string length, even if U_BUFFER_OVERFLOW_ERROR * @stable ICU 51 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode); #if U_SHOW_CPLUSPLUS_API @@ -668,41 +684,41 @@ uscript_getSampleUnicodeString(UScriptCode script); * @see UScriptUsage * @stable ICU 51 */ -U_STABLE UScriptUsage U_EXPORT2 +U_CAPI UScriptUsage U_EXPORT2 uscript_getUsage(UScriptCode script); /** - * Returns TRUE if the script is written right-to-left. + * Returns true if the script is written right-to-left. * For example, Arab and Hebr. * * @param script script code - * @return TRUE if the script is right-to-left + * @return true if the script is right-to-left * @stable ICU 51 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_isRightToLeft(UScriptCode script); /** - * Returns TRUE if the script allows line breaks between letters (excluding hyphenation). + * Returns true if the script allows line breaks between letters (excluding hyphenation). * Such a script typically requires dictionary-based line breaking. * For example, Hani and Thai. * * @param script script code - * @return TRUE if the script allows line breaks between letters + * @return true if the script allows line breaks between letters * @stable ICU 51 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_breaksBetweenLetters(UScriptCode script); /** - * Returns TRUE if in modern (or most recent) usage of the script case distinctions are customary. + * Returns true if in modern (or most recent) usage of the script case distinctions are customary. * For example, Latn and Cyrl. * * @param script script code - * @return TRUE if the script is cased + * @return true if the script is cased * @stable ICU 51 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uscript_isCased(UScriptCode script); #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uset.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uset.h index 18482c10e..ee4e0036d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uset.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uset.h @@ -31,7 +31,10 @@ #include "unicode/utypes.h" #include "unicode/uchar.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API #ifndef USET_DEFINED @@ -50,6 +53,12 @@ typedef struct USet USet; /** * Bitmask values to be passed to uset_openPatternOptions() or * uset_applyPattern() taking an option parameter. + * + * Use at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. + * + * Undefined options bits are ignored, and reserved for future use. + * * @stable ICU 2.4 */ enum { @@ -57,13 +66,13 @@ enum { * Ignore white space within patterns unless quoted or escaped. * @stable ICU 2.4 */ - USET_IGNORE_SPACE = 1, + USET_IGNORE_SPACE = 1, /** * Enable case insensitive matching. E.g., "[ab]" with this flag * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will * match all except 'a', 'A', 'b', and 'B'. This performs a full - * closure over case mappings, e.g. U+017F for s. + * closure over case mappings, e.g. 'ſ' (U+017F long s) for 's'. * * The resulting set is a superset of the input for the code points but * not for the strings. @@ -85,17 +94,36 @@ enum { * * @stable ICU 2.4 */ - USET_CASE_INSENSITIVE = 2, + USET_CASE_INSENSITIVE = 2, /** - * Enable case insensitive matching. E.g., "[ab]" with this flag - * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will - * match all except 'a', 'A', 'b', and 'B'. This adds the lower-, - * title-, and uppercase mappings as well as the case folding + * Adds all case mappings for each element in the set. + * This adds the full lower-, title-, and uppercase mappings as well as the full case folding * of each existing element in the set. + * + * Unlike the “case insensitive” options, this does not perform a closure. + * For example, it does not add 'ſ' (U+017F long s) for 's', + * 'K' (U+212A Kelvin sign) for 'k', or replace set strings by their case-folded versions. + * * @stable ICU 3.2 */ - USET_ADD_CASE_MAPPINGS = 4 + USET_ADD_CASE_MAPPINGS = 4, + +#ifndef U_HIDE_DRAFT_API + /** + * Enable case insensitive matching. + * Same as USET_CASE_INSENSITIVE but using only Simple_Case_Folding (scf) mappings, + * which map each code point to one code point, + * not full Case_Folding (cf) mappings, which map some code points to multiple code points. + * + * This is designed for case-insensitive matches, for example in certain + * regular expression implementations where only Simple_Case_Folding mappings are used, + * such as in ECMAScript (JavaScript) regular expressions. + * + * @draft ICU 73 + */ + USET_SIMPLE_CASE_INSENSITIVE = 6 +#endif // U_HIDE_DRAFT_API }; /** @@ -158,7 +186,7 @@ typedef enum USetSpanCondition { * Continues a span() while there is no set element at the current position. * Increments by one code point at a time. * Stops before the first set element (character or string). - * (For code points only, this is like while contains(current)==FALSE). + * (For code points only, this is like while contains(current)==false). * * When span() returns, the substring between where it started and the position * it returned consists only of characters that are not in the set, @@ -169,7 +197,7 @@ typedef enum USetSpanCondition { USET_SPAN_NOT_CONTAINED = 0, /** * Spans the longest substring that is a concatenation of set elements (characters or strings). - * (For characters only, this is like while contains(current)==TRUE). + * (For characters only, this is like while contains(current)==true). * * When span() returns, the substring between where it started and the position * it returned consists only of set elements (characters or strings) that are in the set. @@ -185,7 +213,7 @@ typedef enum USetSpanCondition { /** * Continues a span() while there is a set element at the current position. * Increments by the longest matching element at each position. - * (For characters only, this is like while contains(current)==TRUE). + * (For characters only, this is like while contains(current)==true). * * When span() returns, the substring between where it started and the position * it returned consists only of set elements (characters or strings) that are in the set. @@ -260,7 +288,7 @@ typedef struct USerializedSet { * it when done. * @stable ICU 4.2 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_openEmpty(void); /** @@ -273,7 +301,7 @@ uset_openEmpty(void); * it when done. * @stable ICU 2.4 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_open(UChar32 start, UChar32 end); /** @@ -285,7 +313,7 @@ uset_open(UChar32 start, UChar32 end); * @param ec the error code * @stable ICU 2.4 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_openPattern(const UChar* pattern, int32_t patternLength, UErrorCode* ec); @@ -296,11 +324,13 @@ uset_openPattern(const UChar* pattern, int32_t patternLength, * @param patternLength the length of the pattern, or -1 if null * terminated * @param options bitmask for options to apply to the pattern. - * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * Valid options are USET_IGNORE_SPACE and + * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. * @param ec the error code * @stable ICU 2.4 */ -U_STABLE USet* U_EXPORT2 +U_CAPI USet* U_EXPORT2 uset_openPatternOptions(const UChar* pattern, int32_t patternLength, uint32_t options, UErrorCode* ec); @@ -311,7 +341,7 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength, * @param set the object to dispose of * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_close(USet* set); #if U_SHOW_CPLUSPLUS_API @@ -342,19 +372,19 @@ U_NAMESPACE_END * @see uset_cloneAsThawed * @stable ICU 3.8 */ -U_STABLE USet * U_EXPORT2 +U_CAPI USet * U_EXPORT2 uset_clone(const USet *set); /** * Determines whether the set has been frozen (made immutable) or not. * See the ICU4J Freezable interface for details. * @param set the set - * @return TRUE/FALSE for whether the set has been frozen + * @return true/false for whether the set has been frozen * @see uset_freeze * @see uset_cloneAsThawed * @stable ICU 3.8 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_isFrozen(const USet *set); /** @@ -371,7 +401,7 @@ uset_isFrozen(const USet *set); * @see uset_cloneAsThawed * @stable ICU 3.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_freeze(USet *set); /** @@ -384,7 +414,7 @@ uset_freeze(USet *set); * @see uset_clone * @stable ICU 3.8 */ -U_STABLE USet * U_EXPORT2 +U_CAPI USet * U_EXPORT2 uset_cloneAsThawed(const USet *set); /** @@ -396,7 +426,7 @@ uset_cloneAsThawed(const USet *set); * @param end last character in the set, inclusive * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_set(USet* set, UChar32 start, UChar32 end); @@ -411,7 +441,10 @@ uset_set(USet* set, * The character at pattern[0] must be a '['. * @param patternLength The length of the UChar string. -1 if NUL terminated. * @param options A bitmask for options to apply to the pattern. - * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * Valid options are USET_IGNORE_SPACE and + * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, + * USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. * @param status Returns an error if the pattern cannot be parsed. * @return Upon successful parse, the value is either * the index of the character after the closing ']' @@ -421,7 +454,7 @@ uset_set(USet* set, * * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_applyPattern(USet *set, const UChar *pattern, int32_t patternLength, uint32_t options, @@ -449,7 +482,7 @@ uset_applyPattern(USet *set, * * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_applyIntPropertyValue(USet* set, UProperty prop, int32_t value, UErrorCode* ec); @@ -488,7 +521,7 @@ uset_applyIntPropertyValue(USet* set, * * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_applyPropertyAlias(USet* set, const UChar *prop, int32_t propLength, const UChar *value, int32_t valueLength, @@ -503,7 +536,7 @@ uset_applyPropertyAlias(USet* set, * @param pos the given position * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_resemblesPattern(const UChar *pattern, int32_t patternLength, int32_t pos); @@ -514,7 +547,7 @@ uset_resemblesPattern(const UChar *pattern, int32_t patternLength, * @param set the set * @param result the string to receive the rules, may be NULL * @param resultCapacity the capacity of result, may be 0 if result is NULL - * @param escapeUnprintable if TRUE then convert unprintable + * @param escapeUnprintable if true then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. @@ -522,7 +555,7 @@ uset_resemblesPattern(const UChar *pattern, int32_t patternLength, * @return length of string, possibly larger than resultCapacity * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_toPattern(const USet* set, UChar* result, int32_t resultCapacity, UBool escapeUnprintable, @@ -530,13 +563,13 @@ uset_toPattern(const USet* set, /** * Adds the given character to the given USet. After this call, - * uset_contains(set, c) will return TRUE. + * uset_contains(set, c) will return true. * A frozen set will not be modified. * @param set the object to which to add the character * @param c the character to add * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_add(USet* set, UChar32 c); /** @@ -551,80 +584,92 @@ uset_add(USet* set, UChar32 c); * @param additionalSet the source set whose elements are to be added to this set. * @stable ICU 2.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addAll(USet* set, const USet *additionalSet); /** * Adds the given range of characters to the given USet. After this call, - * uset_contains(set, start, end) will return TRUE. + * uset_contains(set, start, end) will return true. * A frozen set will not be modified. * @param set the object to which to add the character * @param start the first character of the range to add, inclusive * @param end the last character of the range to add, inclusive * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addRange(USet* set, UChar32 start, UChar32 end); /** * Adds the given string to the given USet. After this call, - * uset_containsString(set, str, strLen) will return TRUE. + * uset_containsString(set, str, strLen) will return true. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the string to add * @param strLen the length of the string or -1 if null terminated. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addString(USet* set, const UChar* str, int32_t strLen); /** - * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"} - * If this set already any particular character, it has no effect on that character. + * Adds each of the characters in this string to the set. Note: "ch" => {"c", "h"} + * If this set already contains any particular character, it has no effect on that character. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the source string * @param strLen the length of the string or -1 if null terminated. * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); /** * Removes the given character from the given USet. After this call, - * uset_contains(set, c) will return FALSE. + * uset_contains(set, c) will return false. * A frozen set will not be modified. * @param set the object from which to remove the character * @param c the character to remove * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_remove(USet* set, UChar32 c); /** * Removes the given range of characters from the given USet. After this call, - * uset_contains(set, start, end) will return FALSE. + * uset_contains(set, start, end) will return false. * A frozen set will not be modified. * @param set the object to which to add the character * @param start the first character of the range to remove, inclusive * @param end the last character of the range to remove, inclusive * @stable ICU 2.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeRange(USet* set, UChar32 start, UChar32 end); /** * Removes the given string to the given USet. After this call, - * uset_containsString(set, str, strLen) will return FALSE. + * uset_containsString(set, str, strLen) will return false. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the string to remove * @param strLen the length of the string or -1 if null terminated. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeString(USet* set, const UChar* str, int32_t strLen); +/** + * Removes EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @stable ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_removeAllCodePoints(USet *set, const UChar *str, int32_t length); + /** * Removes from this set all of its elements that are contained in the * specified set. This operation effectively modifies this @@ -636,7 +681,7 @@ uset_removeString(USet* set, const UChar* str, int32_t strLen); * removed from this set * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeAll(USet* set, const USet* removeSet); /** @@ -647,15 +692,39 @@ uset_removeAll(USet* set, const USet* removeSet); * A frozen set will not be modified. * * @param set the object for which to retain only the specified range - * @param start first character, inclusive, of range to be retained - * to this set. - * @param end last character, inclusive, of range to be retained - * to this set. + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_retain(USet* set, UChar32 start, UChar32 end); +/** + * Retains only the specified string from this set if it is present. + * Upon return this set will be empty if it did not contain s, or + * will only contain s if it did contain s. + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @stable ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_retainString(USet *set, const UChar *str, int32_t length); + +/** + * Retains EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @stable ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_retainAllCodePoints(USet *set, const UChar *str, int32_t length); + /** * Retains only the elements in this set that are contained in the * specified set. In other words, removes from this set all of @@ -668,7 +737,7 @@ uset_retain(USet* set, UChar32 start, UChar32 end); * @param retain set that defines which elements this set will retain * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_retainAll(USet* set, const USet* retain); /** @@ -676,23 +745,69 @@ uset_retainAll(USet* set, const USet* retain); * possible space, without changing this object's value. * A frozen set will not be modified. * - * @param set the object on which to perfrom the compact + * @param set the object on which to perform the compact * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_compact(USet* set); /** - * Inverts this set. This operation modifies this set so that - * its value is its complement. This operation does not affect - * the multicharacter strings, if any. + * This is equivalent to + * uset_complementRange(set, 0, 0x10FFFF). + * + * Note: This performs a symmetric difference with all code points + * and thus retains all multicharacter strings. + * In order to achieve a “code point complement” (all code points minus this set), + * the easiest is to uset_complement(set); uset_removeAllStrings(set);. + * * A frozen set will not be modified. * @param set the set * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_complement(USet* set); +/** + * Complements the specified range in this set. Any character in + * the range will be removed if it is in this set, or will be + * added if it is not in this set. If start > end + * then an empty range is complemented, leaving the set unchanged. + * This is equivalent to a boolean logic XOR. + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range + * @stable ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_complementRange(USet *set, UChar32 start, UChar32 end); + +/** + * Complements the specified string in this set. + * The string will be removed if it is in this set, or will be added if it is not in this set. + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @stable ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_complementString(USet *set, const UChar *str, int32_t length); + +/** + * Complements EACH of the characters in this string. Note: "ch" == {"c", "h"} + * A frozen set will not be modified. + * + * @param set the object to be modified + * @param str the string + * @param length the length of the string, or -1 if NUL-terminated + * @stable ICU 69 + */ +U_CAPI void U_EXPORT2 +uset_complementAllCodePoints(USet *set, const UChar *str, int32_t length); + /** * Complements in this set all elements contained in the specified * set. Any character in the other set will be removed if it is @@ -704,7 +819,7 @@ uset_complement(USet* set); * from this set. * @stable ICU 3.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_complementAll(USet* set, const USet* complement); /** @@ -714,12 +829,12 @@ uset_complementAll(USet* set, const USet* complement); * @param set the set * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_clear(USet* set); /** * Close this set over the given attribute. For the attribute - * USET_CASE, the result is to modify this set so that: + * USET_CASE_INSENSITIVE, the result is to modify this set so that: * * 1. For each character or string 'a' in this set, all strings or * characters 'b' such that foldCase(a) == foldCase(b) are added @@ -739,11 +854,13 @@ uset_clear(USet* set); * @param set the set * * @param attributes bitmask for attributes to close over. - * Currently only the USET_CASE bit is supported. Any undefined bits - * are ignored. + * Valid options: + * At most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE. + * These case options are mutually exclusive. + * Unrelated options bits are ignored. * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_closeOver(USet* set, int32_t attributes); /** @@ -752,51 +869,59 @@ uset_closeOver(USet* set, int32_t attributes); * @param set the set * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_removeAllStrings(USet* set); /** - * Returns TRUE if the given USet contains no characters and no + * Returns true if the given USet contains no characters and no * strings. * @param set the set * @return true if set is empty * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_isEmpty(const USet* set); /** - * Returns TRUE if the given USet contains the given character. + * @param set the set + * @return true if this set contains multi-character strings or the empty string. + * @stable ICU 70 + */ +U_CAPI UBool U_EXPORT2 +uset_hasStrings(const USet *set); + +/** + * Returns true if the given USet contains the given character. * This function works faster with a frozen set. * @param set the set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_contains(const USet* set, UChar32 c); /** - * Returns TRUE if the given USet contains all characters c + * Returns true if the given USet contains all characters c * where start <= c && c <= end. * @param set the set * @param start the first character of the range to test, inclusive * @param end the last character of the range to test, inclusive - * @return TRUE if set contains the range + * @return true if set contains the range * @stable ICU 2.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsRange(const USet* set, UChar32 start, UChar32 end); /** - * Returns TRUE if the given USet contains the given string. + * Returns true if the given USet contains the given string. * @param set the set * @param str the string * @param strLen the length of the string or -1 if null terminated. * @return true if set contains str * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsString(const USet* set, const UChar* str, int32_t strLen); /** @@ -809,33 +934,54 @@ uset_containsString(const USet* set, const UChar* str, int32_t strLen); * @return an index from 0..size()-1, or -1 * @stable ICU 3.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_indexOf(const USet* set, UChar32 c); /** * Returns the character at the given index within this set, where * the set is ordered by ascending code point. If the index is - * out of range, return (UChar32)-1. The inverse of this method is - * indexOf(). + * out of range for characters, returns (UChar32)-1. + * The inverse of this method is indexOf(). + * + * For iteration, this is slower than uset_getRangeCount()/uset_getItemCount() + * with uset_getItem(), because for each call it skips linearly over index + * characters in the ranges. + * * @param set the set * @param charIndex an index from 0..size()-1 to obtain the char for * @return the character at the given index, or (UChar32)-1. * @stable ICU 3.2 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 uset_charAt(const USet* set, int32_t charIndex); /** - * Returns the number of characters and strings contained in the given - * USet. + * Returns the number of characters and strings contained in this set. + * The last (uset_getItemCount() - uset_getRangeCount()) items are strings. + * + * This is slower than uset_getRangeCount() and uset_getItemCount() because + * it counts the code points of all ranges. + * * @param set the set * @return a non-negative integer counting the characters and strings * contained in set * @stable ICU 2.4 + * @see uset_getRangeCount */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_size(const USet* set); +/** + * @param set the set + * @return the number of ranges in this set. + * @stable ICU 70 + * @see uset_getItemCount + * @see uset_getItem + * @see uset_size + */ +U_CAPI int32_t U_EXPORT2 +uset_getRangeCount(const USet *set); + /** * Returns the number of items in this set. An item is either a range * of characters or a single multicharacter string. @@ -844,28 +990,38 @@ uset_size(const USet* set); * and/or strings contained in set * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_getItemCount(const USet* set); /** * Returns an item of this set. An item is either a range of - * characters or a single multicharacter string. + * characters or a single multicharacter string (which can be the empty string). + * + * If itemIndex is less than uset_getRangeCount(), then this function returns 0, + * and the range is *start..*end. + * + * If itemIndex is at least uset_getRangeCount() and less than uset_getItemCount(), then + * this function copies the string into str[strCapacity] and + * returns the length of the string (0 for the empty string). + * + * If itemIndex is out of range, then this function returns -1. + * + * Note that 0 is returned for each range as well as for the empty string. + * * @param set the set - * @param itemIndex a non-negative integer in the range 0.. - * uset_getItemCount(set)-1 - * @param start pointer to variable to receive first character - * in range, inclusive - * @param end pointer to variable to receive last character in range, - * inclusive + * @param itemIndex a non-negative integer in the range 0..uset_getItemCount(set)-1 + * @param start pointer to variable to receive first character in range, inclusive; + * can be NULL for a string item + * @param end pointer to variable to receive last character in range, inclusive; + * can be NULL for a string item * @param str buffer to receive the string, may be NULL * @param strCapacity capacity of str, or 0 if str is NULL - * @param ec error code - * @return the length of the string (>= 2), or 0 if the item is a - * range, in which case it is the range *start..*end, or -1 if - * itemIndex is out of range + * @param ec error code; U_INDEX_OUTOFBOUNDS_ERROR if the itemIndex is out of range + * @return the length of the string (0 or >= 2), or 0 if the item is a range, + * or -1 if the itemIndex is out of range * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_getItem(const USet* set, int32_t itemIndex, UChar32* start, UChar32* end, UChar* str, int32_t strCapacity, @@ -879,7 +1035,7 @@ uset_getItem(const USet* set, int32_t itemIndex, * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsAll(const USet* set1, const USet* set2); /** @@ -892,7 +1048,7 @@ uset_containsAll(const USet* set1, const USet* set2); * @return true if the test condition is met * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); /** @@ -903,7 +1059,7 @@ uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsNone(const USet* set1, const USet* set2); /** @@ -914,7 +1070,7 @@ uset_containsNone(const USet* set1, const USet* set2); * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_containsSome(const USet* set1, const USet* set2); /** @@ -936,7 +1092,7 @@ uset_containsSome(const USet* set1, const USet* set2); * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); /** @@ -957,7 +1113,7 @@ uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spa * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); /** @@ -979,7 +1135,7 @@ uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); /** @@ -1000,7 +1156,7 @@ uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition * @stable ICU 3.8 * @see USetSpanCondition */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); /** @@ -1011,7 +1167,7 @@ uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondit * @return true if the test condition is met * @stable ICU 3.2 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_equals(const USet* set1, const USet* set2); /********************************************************************* @@ -1067,7 +1223,7 @@ uset_equals(const USet* set1, const USet* set2); * than U_BUFFER_OVERFLOW_ERROR. * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); /** @@ -1078,7 +1234,7 @@ uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode * @return true if the given array is valid, otherwise false * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); /** @@ -1088,18 +1244,18 @@ uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcL * @param c The codepoint to set * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); /** - * Returns TRUE if the given USerializedSet contains the given + * Returns true if the given USerializedSet contains the given * character. * @param set the serialized set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_serializedContains(const USerializedSet* set, UChar32 c); /** @@ -1111,7 +1267,7 @@ uset_serializedContains(const USerializedSet* set, UChar32 c); * contained in set * @stable ICU 2.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uset_getSerializedRangeCount(const USerializedSet* set); /** @@ -1127,7 +1283,7 @@ uset_getSerializedRangeCount(const USerializedSet* set); * @return true if rangeIndex is valid, otherwise false * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, UChar32* pStart, UChar32* pEnd); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/usetiter.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/usetiter.h index c6396fd76..3168d3b0f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/usetiter.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/usetiter.h @@ -33,9 +33,7 @@ class UnicodeString; * code points or ranges have been returned, it returns the * multicharacter strings of the UnicodeSet, if any. * - * This class is not intended to be subclassed. Consider any fields - * or methods declared as "protected" to be private. The use of - * protected in this class is an artifact of history. + * This class is not intended for public subclassing. * *

    To iterate over code points and strings, use a loop like this: *

    @@ -60,25 +58,23 @@ class UnicodeString;
      *   }
      * }
      * 
    + * + * To iterate over only the strings, start with skipToStrings(). + * * @author M. Davis * @stable ICU 2.4 */ -class U_COMMON_API UnicodeSetIterator : public UObject { - - protected: - +class U_COMMON_API UnicodeSetIterator final : public UObject { /** * Value of codepoint if the iterator points to a string. * If codepoint == IS_STRING, then examine * string for the current iteration result. - * @stable ICU 2.4 */ enum { IS_STRING = -1 }; /** * Current code point, or the special value IS_STRING, if * the iterator points to a string. - * @stable ICU 2.4 */ UChar32 codepoint; @@ -89,7 +85,6 @@ class U_COMMON_API UnicodeSetIterator : public UObject { * iterating over code points using next(), or if * codepoint == IS_STRING, then the value of * codepointEnd is undefined. - * @stable ICU 2.4 */ UChar32 codepointEnd; @@ -97,7 +92,6 @@ class U_COMMON_API UnicodeSetIterator : public UObject { * If codepoint == IS_STRING, then string points * to the current string. If codepoint != IS_STRING, the * value of string is undefined. - * @stable ICU 2.4 */ const UnicodeString* string; @@ -170,13 +164,30 @@ class U_COMMON_API UnicodeSetIterator : public UObject { */ const UnicodeString& getString(); + /** + * Skips over the remaining code points/ranges, if any. + * A following call to next() or nextRange() will yield a string, if there is one. + * No-op if next() would return false, or if it would yield a string anyway. + * + * @return *this + * @stable ICU 70 + * @see UnicodeSet#strings() + */ + inline UnicodeSetIterator &skipToStrings() { + // Finish code point/range iteration. + range = endRange; + endElement = -1; + nextElement = 0; + return *this; + } + /** * Advances the iteration position to the next element in the set, * which can be either a single code point or a string. * If there are no more elements in the set, return false. * *

    - * If isString() == TRUE, the value is a + * If isString() == true, the value is a * string, otherwise the value is a * single code point. Elements of either type can be retrieved * with the function getString(), while elements of @@ -197,7 +208,7 @@ class U_COMMON_API UnicodeSetIterator : public UObject { /** * Returns the next element in the set, either a code point range * or a string. If there are no more elements in the set, return - * false. If isString() == TRUE, the value is a + * false. If isString() == true, the value is a * string and can be accessed with getString(). Otherwise the value is a * range of one or more code points from getCodepoint() to * getCodepointeEnd() inclusive. @@ -205,7 +216,7 @@ class U_COMMON_API UnicodeSetIterator : public UObject { *

    The order of iteration is all code points ranges in sorted * order, followed by all strings sorted order. Ranges are * disjoint and non-contiguous. The value returned from getString() - * is undefined unless isString() == TRUE. Do not mix calls to + * is undefined unless isString() == true. Do not mix calls to * next() and nextRange() without calling * reset() between them. The results of doing so are * undefined. @@ -242,71 +253,58 @@ class U_COMMON_API UnicodeSetIterator : public UObject { * * @stable ICU 2.4 */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; // ======================= PRIVATES =========================== - protected: +private: // endElement and nextElements are really UChar32's, but we keep // them as signed int32_t's so we can do comparisons with // endElement set to -1. Leave them as int32_t's. /** The set - * @stable ICU 2.4 */ const UnicodeSet* set; /** End range - * @stable ICU 2.4 */ int32_t endRange; /** Range - * @stable ICU 2.4 */ int32_t range; /** End element - * @stable ICU 2.4 */ int32_t endElement; /** Next element - * @stable ICU 2.4 */ int32_t nextElement; - //UBool abbreviated; /** Next string - * @stable ICU 2.4 */ int32_t nextString; /** String count - * @stable ICU 2.4 */ int32_t stringCount; /** * Points to the string to use when the caller asks for a * string and the current iteration item is a code point, not a string. - * @internal */ UnicodeString *cpString; /** Copy constructor. Disallowed. - * @stable ICU 2.4 */ - UnicodeSetIterator(const UnicodeSetIterator&); // disallow + UnicodeSetIterator(const UnicodeSetIterator&) = delete; /** Assignment operator. Disallowed. - * @stable ICU 2.4 */ - UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow + UnicodeSetIterator& operator=(const UnicodeSetIterator&) = delete; /** Load range - * @stable ICU 2.4 */ - virtual void loadRange(int32_t range); - + void loadRange(int32_t range); }; inline UBool UnicodeSetIterator::isString() const { - return codepoint == (UChar32)IS_STRING; + return codepoint < 0; } inline UChar32 UnicodeSetIterator::getCodepoint() const { diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ushape.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ushape.h index 78b4d027a..14371edc8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ushape.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ushape.h @@ -98,7 +98,7 @@ * the return value indicates the necessary destination buffer size. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_shapeArabic(const UChar *source, int32_t sourceLength, UChar *dest, int32_t destSize, uint32_t options, @@ -323,7 +323,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, #define U_SHAPE_PRESERVE_PRESENTATION 0x8000 /** Presentation form option: * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with - * their unshaped correspondants in range 0+06xx, before shaping. + * their unshaped correspondents in range 0+06xx, before shaping. * @stable ICU 3.6 */ #define U_SHAPE_PRESERVE_PRESENTATION_NOOP 0 diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/usprep.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/usprep.h index 914eb8487..f8a0f58e0 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/usprep.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/usprep.h @@ -25,7 +25,10 @@ */ #include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" +#endif // U_SHOW_CPLUSPLUS_API /** * @@ -181,7 +184,7 @@ typedef enum UStringPrepProfileType { * @see usprep_close() * @stable ICU 2.8 */ -U_STABLE UStringPrepProfile* U_EXPORT2 +U_CAPI UStringPrepProfile* U_EXPORT2 usprep_open(const char* path, const char* fileName, UErrorCode* status); @@ -197,7 +200,7 @@ usprep_open(const char* path, * @see usprep_close() * @stable ICU 4.2 */ -U_STABLE UStringPrepProfile* U_EXPORT2 +U_CAPI UStringPrepProfile* U_EXPORT2 usprep_openByType(UStringPrepProfileType type, UErrorCode* status); @@ -206,7 +209,7 @@ usprep_openByType(UStringPrepProfileType type, * @param profile The profile to close * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 usprep_close(UStringPrepProfile* profile); #if U_SHOW_CPLUSPLUS_API @@ -257,7 +260,7 @@ U_NAMESPACE_END * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 usprep_prepare( const UStringPrepProfile* prep, const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/ustring.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/ustring.h index 245b76654..03c697c72 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/ustring.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/ustring.h @@ -72,7 +72,7 @@ * their occurrence is rare. Almost all characters in modern use require only * a single UChar code unit (i.e., their code point values are <=0xffff). * - * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html). + * For more details see the User Guide Strings chapter (https://unicode-org.github.io/icu/userguide/strings/). * For a discussion of the handling of unpaired surrogates see also * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. */ @@ -89,7 +89,7 @@ * @return The number of UChars in chars, minus the terminator. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strlen(const UChar *s); /*@}*/ @@ -106,7 +106,7 @@ u_strlen(const UChar *s); * @return The number of code points in the specified code units. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_countChar32(const UChar *s, int32_t length); /** @@ -127,7 +127,7 @@ u_countChar32(const UChar *s, int32_t length); * than 'number'. Same as (u_countChar32(s, length)>number). * @stable ICU 2.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); /** @@ -140,7 +140,7 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strcat(UChar *dst, const UChar *src); @@ -158,7 +158,7 @@ u_strcat(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strncat(UChar *dst, const UChar *src, int32_t n); @@ -183,7 +183,7 @@ u_strncat(UChar *dst, * @see u_strFindFirst * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strstr(const UChar *s, const UChar *substring); /** @@ -207,7 +207,7 @@ u_strstr(const UChar *s, const UChar *substring); * @see u_strstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** @@ -227,7 +227,7 @@ u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t s * @see u_strstr * @see u_strFindFirst */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strchr(const UChar *s, UChar c); /** @@ -247,7 +247,7 @@ u_strchr(const UChar *s, UChar c); * @see u_strstr * @see u_strFindFirst */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strchr32(const UChar *s, UChar32 c); /** @@ -270,7 +270,7 @@ u_strchr32(const UChar *s, UChar32 c); * @see u_strFindFirst * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strrstr(const UChar *s, const UChar *substring); /** @@ -294,7 +294,7 @@ u_strrstr(const UChar *s, const UChar *substring); * @see u_strstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** @@ -314,7 +314,7 @@ u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t su * @see u_strrstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strrchr(const UChar *s, UChar c); /** @@ -334,7 +334,7 @@ u_strrchr(const UChar *s, UChar c); * @see u_strrstr * @see u_strFindLast */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strrchr32(const UChar *s, UChar32 c); /** @@ -349,7 +349,7 @@ u_strrchr32(const UChar *s, UChar32 c); * characters in matchSet, or NULL if no such character is found. * @stable ICU 2.0 */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strpbrk(const UChar *string, const UChar *matchSet); /** @@ -365,7 +365,7 @@ u_strpbrk(const UChar *string, const UChar *matchSet); * @see u_strspn * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcspn(const UChar *string, const UChar *matchSet); /** @@ -381,7 +381,7 @@ u_strcspn(const UChar *string, const UChar *matchSet); * @see u_strcspn * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strspn(const UChar *string, const UChar *matchSet); /** @@ -409,7 +409,7 @@ u_strspn(const UChar *string, const UChar *matchSet); * when there are no more tokens. * @stable ICU 2.0 */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strtok_r(UChar *src, const UChar *delim, UChar **saveState); @@ -424,7 +424,7 @@ u_strtok_r(UChar *src, * value if s1 is bitwise greater than s2. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcmp(const UChar *s1, const UChar *s2); @@ -439,7 +439,7 @@ u_strcmp(const UChar *s1, * in code point order * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); /** @@ -462,14 +462,14 @@ u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * - * @param codePointOrder Choose between code unit order (FALSE) - * and code point order (TRUE). + * @param codePointOrder Choose between code unit order (false) + * and code point order (true). * * @return <0 or 0 or >0 as usual for string comparisons * * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, UBool codePointOrder); @@ -485,8 +485,8 @@ u_strCompare(const UChar *s1, int32_t length1, * * @param iter1 First source string iterator. * @param iter2 Second source string iterator. - * @param codePointOrder Choose between code unit order (FALSE) - * and code point order (TRUE). + * @param codePointOrder Choose between code unit order (false) + * and code point order (true). * * @return <0 or 0 or >0 as usual for string comparisons * @@ -494,7 +494,7 @@ u_strCompare(const UChar *s1, int32_t length1, * * @stable ICU 2.6 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); /** @@ -537,7 +537,7 @@ u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrde * * @stable ICU 2.2 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strCaseCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, @@ -555,7 +555,7 @@ u_strCaseCompare(const UChar *s1, int32_t length1, * value if s1 is bitwise greater than s2. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strncmp(const UChar *ucs1, const UChar *ucs2, int32_t n); @@ -573,7 +573,7 @@ u_strncmp(const UChar *ucs1, * in code point order * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); /** @@ -595,7 +595,7 @@ u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); /** @@ -619,7 +619,7 @@ u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); /** @@ -643,7 +643,7 @@ u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); /** @@ -654,7 +654,7 @@ u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options) * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strcpy(UChar *dst, const UChar *src); @@ -669,7 +669,7 @@ u_strcpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strncpy(UChar *dst, const UChar *src, int32_t n); @@ -686,7 +686,7 @@ u_strncpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, +U_CAPI UChar* U_EXPORT2 u_uastrcpy(UChar *dst, const char *src ); /** @@ -701,7 +701,7 @@ U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, +U_CAPI UChar* U_EXPORT2 u_uastrncpy(UChar *dst, const char *src, int32_t n); @@ -715,7 +715,7 @@ U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, +U_CAPI char* U_EXPORT2 u_austrcpy(char *dst, const UChar *src ); /** @@ -730,7 +730,7 @@ U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, * @return A pointer to dst. * @stable ICU 2.0 */ -U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, +U_CAPI char* U_EXPORT2 u_austrncpy(char *dst, const UChar *src, int32_t n ); @@ -744,7 +744,7 @@ U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, * @return A pointer to dest * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memcpy(UChar *dest, const UChar *src, int32_t count); /** @@ -755,7 +755,7 @@ u_memcpy(UChar *dest, const UChar *src, int32_t count); * @return A pointer to dest * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memmove(UChar *dest, const UChar *src, int32_t count); /** @@ -767,7 +767,7 @@ u_memmove(UChar *dest, const UChar *src, int32_t count); * @return A pointer to dest. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memset(UChar *dest, UChar c, int32_t count); /** @@ -781,7 +781,7 @@ u_memset(UChar *dest, UChar c, int32_t count); * When buf1 > buf2, a positive number is returned. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); /** @@ -797,7 +797,7 @@ u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); * in code point order * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); /** @@ -817,7 +817,7 @@ u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); * @see u_memchr32 * @see u_strFindFirst */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memchr(const UChar *s, UChar c, int32_t count); /** @@ -837,7 +837,7 @@ u_memchr(const UChar *s, UChar c, int32_t count); * @see u_memchr * @see u_strFindFirst */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memchr32(const UChar *s, UChar32 c, int32_t count); /** @@ -857,7 +857,7 @@ u_memchr32(const UChar *s, UChar32 c, int32_t count); * @see u_memrchr32 * @see u_strFindLast */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memrchr(const UChar *s, UChar c, int32_t count); /** @@ -877,7 +877,7 @@ u_memrchr(const UChar *s, UChar c, int32_t count); * @see u_memrchr * @see u_strFindLast */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_memrchr32(const UChar *s, UChar32 c, int32_t count); /** @@ -903,13 +903,13 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count); * * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); * U_STRING_DECL(ustringVar2, "jumps 5%", 8); - * static UBool didInit=FALSE; + * static UBool didInit=false; * * int32_t function() { * if(!didInit) { * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); * U_STRING_INIT(ustringVar2, "jumps 5%", 8); - * didInit=TRUE; + * didInit=true; * } * return u_strcmp(ustringVar1, ustringVar2); * } @@ -931,14 +931,10 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count); # define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs) /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) -#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) +#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || defined(U_WCHAR_IS_UTF16)) # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) -#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY -# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs - /**@stable ICU 2.0 */ -# define U_STRING_INIT(var, cs, length) #else # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] /**@stable ICU 2.0 */ @@ -992,7 +988,7 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count); * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_unescape(const char *src, UChar *dest, int32_t destCapacity); @@ -1040,7 +1036,7 @@ U_CDECL_END * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 u_unescapeAt(UNESCAPE_CHAR_AT charAt, int32_t *offset, int32_t length, @@ -1066,7 +1062,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strToUpper(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, @@ -1092,7 +1088,7 @@ u_strToUpper(UChar *dest, int32_t destCapacity, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strToLower(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, @@ -1138,7 +1134,7 @@ u_strToLower(UChar *dest, int32_t destCapacity, * only some of the result was written to the destination buffer. * @stable ICU 2.1 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strToTitle(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UBreakIterator *titleIter, @@ -1171,7 +1167,7 @@ u_strToTitle(UChar *dest, int32_t destCapacity, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 u_strFoldCase(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, uint32_t options, @@ -1200,7 +1196,7 @@ u_strFoldCase(UChar *dest, int32_t destCapacity, * @return The pointer to destination buffer. * @stable ICU 2.0 */ -U_STABLE wchar_t* U_EXPORT2 +U_CAPI wchar_t* U_EXPORT2 u_strToWCS(wchar_t *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1229,7 +1225,7 @@ u_strToWCS(wchar_t *dest, * @return The pointer to destination buffer. * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromWCS(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1260,7 +1256,7 @@ u_strFromWCS(UChar *dest, * @see u_strToUTF8WithSub * @see u_strFromUTF8 */ -U_STABLE char* U_EXPORT2 +U_CAPI char* U_EXPORT2 u_strToUTF8(char *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1290,7 +1286,7 @@ u_strToUTF8(char *dest, * @see u_strFromUTF8WithSub * @see u_strFromUTF8Lenient */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF8(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1333,7 +1329,7 @@ u_strFromUTF8(UChar *dest, * @see u_strFromUTF8WithSub * @stable ICU 3.6 */ -U_STABLE char* U_EXPORT2 +U_CAPI char* U_EXPORT2 u_strToUTF8WithSub(char *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1378,7 +1374,7 @@ u_strToUTF8WithSub(char *dest, * @see u_strToUTF8WithSub * @stable ICU 3.6 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF8WithSub(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1438,7 +1434,7 @@ u_strFromUTF8WithSub(UChar *dest, * @see u_strToUTF8WithSub * @stable ICU 3.6 */ -U_STABLE UChar * U_EXPORT2 +U_CAPI UChar * U_EXPORT2 u_strFromUTF8Lenient(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1468,7 +1464,7 @@ u_strFromUTF8Lenient(UChar *dest, * @see u_strFromUTF32 * @stable ICU 2.0 */ -U_STABLE UChar32* U_EXPORT2 +U_CAPI UChar32* U_EXPORT2 u_strToUTF32(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1498,7 +1494,7 @@ u_strToUTF32(UChar32 *dest, * @see u_strToUTF32 * @stable ICU 2.0 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF32(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1541,7 +1537,7 @@ u_strFromUTF32(UChar *dest, * @see u_strFromUTF32WithSub * @stable ICU 4.2 */ -U_STABLE UChar32* U_EXPORT2 +U_CAPI UChar32* U_EXPORT2 u_strToUTF32WithSub(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1585,7 +1581,7 @@ u_strToUTF32WithSub(UChar32 *dest, * @see u_strToUTF32WithSub * @stable ICU 4.2 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromUTF32WithSub(UChar *dest, int32_t destCapacity, int32_t *pDestLength, @@ -1626,7 +1622,7 @@ u_strFromUTF32WithSub(UChar *dest, * @see u_strToUTF8WithSub * @see u_strFromJavaModifiedUTF8WithSub */ -U_STABLE char* U_EXPORT2 +U_CAPI char* U_EXPORT2 u_strToJavaModifiedUTF8( char *dest, int32_t destCapacity, @@ -1676,7 +1672,7 @@ u_strToJavaModifiedUTF8( * @see u_strToJavaModifiedUTF8 * @stable ICU 4.4 */ -U_STABLE UChar* U_EXPORT2 +U_CAPI UChar* U_EXPORT2 u_strFromJavaModifiedUTF8WithSub( UChar *dest, int32_t destCapacity, diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/utext.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/utext.h index 8560ddc75..423b28163 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/utext.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/utext.h @@ -97,7 +97,7 @@ * refer to any part of a multi-unit character representation are considered * to be equivalent. In the case of multi-unit characters, an incoming index * will be logically normalized to refer to the start of the character. - * + * * It is possible to test whether a native index is on a code point boundary * by doing a utext_setNativeIndex() followed by a utext_getNativeIndex(). * If the index is returned unchanged, it was on a code point boundary. If @@ -111,13 +111,13 @@ * pointer must refer to a valid, open UText. Attempting to * use a closed UText or passing a NULL pointer is a programming error and * will produce undefined results or NULL pointer exceptions. - * + * * The UText_Open family of functions can either open an existing (closed) * UText, or heap allocate a new UText. Here is sample code for creating * a stack-allocated UText. * * \code - * char *s = whatever(); // A utf-8 string + * char *s = whatever(); // A utf-8 string * U_ErrorCode status = U_ZERO_ERROR; * UText ut = UTEXT_INITIALIZER; * utext_openUTF8(ut, s, -1, &status); @@ -128,7 +128,7 @@ * } * \endcode * - * Any existing UText passed to an open function _must_ have been initialized, + * Any existing UText passed to an open function _must_ have been initialized, * either by the UTEXT_INITIALIZER, or by having been originally heap-allocated * by an open function. Passing NULL will cause the open function to * heap-allocate and fully initialize a new UText. @@ -139,12 +139,12 @@ #include "unicode/utypes.h" #include "unicode/uchar.h" -// #if U_SHOW_CPLUSPLUS_API +#if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" #include "unicode/rep.h" #include "unicode/unistr.h" #include "unicode/chariter.h" -// #endif +#endif U_CDECL_BEGIN @@ -170,7 +170,7 @@ typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ * a local or static instance, the storage will not be deleted. * * An open UText can be reset to refer to new string by using one of the utext_open() - * functions without first closing the UText. + * functions without first closing the UText. * * @param ut The UText to be closed. * @return NULL if the UText struct was deleted by the close. If the UText struct @@ -180,38 +180,19 @@ typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ * * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_close(UText *ut); -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUTextPointer - * "Smart pointer" class, closes a UText via utext_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 4.4 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close); - -U_NAMESPACE_END - -#endif - /** * Open a read-only UText implementation for UTF-8 strings. - * + * * \htmlonly * Any invalid UTF-8 in the input will be handled in this way: * a sequence of bytes that has the form of a truncated, but otherwise valid, - * UTF-8 sequence will be replaced by a single unicode replacement character, \uFFFD. + * UTF-8 sequence will be replaced by a single unicode replacement character, \uFFFD. * Any other illegal bytes will each be replaced by a \uFFFD. * \endhtmlonly - * + * * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an initialized UText struct, which will then * be reset to reference the specified UTF-8 string. @@ -223,13 +204,13 @@ U_NAMESPACE_END * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); /** * Open a read-only UText for UChar * string. - * + * * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an initialized UText struct, which will then * be reset to reference the specified UChar string. @@ -241,16 +222,16 @@ utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); #if U_SHOW_CPLUSPLUS_API /** - * Open a writable UText for a non-const UnicodeString. - * - * @param ut Pointer to a UText struct. If NULL, a new UText will be created. - * If non-NULL, must refer to an initialized UText struct, which will then + * Open a writable UText for a non-const UnicodeString. + * + * @param ut Pointer to a UText struct. If nullptr, a new UText will be created. + * If non-nullptr, must refer to an initialized UText struct, which will then * be reset to reference the specified input string. * @param s A UnicodeString. * @param status Errors are returned here. @@ -258,15 +239,15 @@ utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status); /** * Open a UText for a const UnicodeString. The resulting UText will not be writable. - * - * @param ut Pointer to a UText struct. If NULL, a new UText will be created. - * If non-NULL, must refer to an initialized UText struct, which will then + * + * @param ut Pointer to a UText struct. If nullptr, a new UText will be created. + * If non-nullptr, must refer to an initialized UText struct, which will then * be reset to reference the specified input string. * @param s A const UnicodeString to be wrapped. * @param status Errors are returned here. @@ -274,14 +255,14 @@ utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status); * will always be used and returned. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode *status); /** * Open a writable UText implementation for an ICU Replaceable object. - * @param ut Pointer to a UText struct. If NULL, a new UText will be created. - * If non-NULL, must refer to an already existing UText, which will then + * @param ut Pointer to a UText struct. If nullptr, a new UText will be created. + * If non-nullptr, must refer to an already existing UText, which will then * be reset to reference the specified replaceable text. * @param rep A Replaceable text object. * @param status Errors are returned here. @@ -290,13 +271,13 @@ utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode * @see Replaceable * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status); /** * Open a UText implementation over an ICU CharacterIterator. - * @param ut Pointer to a UText struct. If NULL, a new UText will be created. - * If non-NULL, must refer to an already existing UText, which will then + * @param ut Pointer to a UText struct. If nullptr, a new UText will be created. + * If non-nullptr, must refer to an already existing UText, which will then * be reset to reference the specified replaceable text. * @param ci A Character Iterator. * @param status Errors are returned here. @@ -305,7 +286,7 @@ utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status); * @see Replaceable * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *status); #endif @@ -329,7 +310,7 @@ utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *s * non-writable by means of UText_freeze(). * * A shallow clone replicates only the UText data structures; it does not make - * a copy of the underlying text. Shallow clones can be used as an efficient way to + * a copy of the underlying text. Shallow clones can be used as an efficient way to * have multiple iterators active in a single text string that is not being * modified. * @@ -342,7 +323,7 @@ utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *s * shallow clones provide some protection against errors of this type by * disabling text modification via the cloned UText. * - * A shallow clone made with the readOnly parameter == FALSE will preserve the + * A shallow clone made with the readOnly parameter == false will preserve the * utext_isWritable() state of the source object. Note, however, that * write operations must be avoided while more than one UText exists that refer * to the same underlying text. @@ -358,9 +339,9 @@ utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *s * If non-NULL, must refer to an already existing UText, which will then * be reset to become the clone. * @param src The UText to be cloned. - * @param deep TRUE to request a deep clone, FALSE for a shallow clone. - * @param readOnly TRUE to request that the cloned UText have read only access to the - * underlying text. + * @param deep true to request a deep clone, false for a shallow clone. + * @param readOnly true to request that the cloned UText have read only access to the + * underlying text. * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR * will be returned if the text provider is unable to clone the @@ -368,7 +349,7 @@ utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *s * @return The newly created clone, or NULL if the clone operation failed. * @stable ICU 3.4 */ -U_STABLE UText * U_EXPORT2 +U_CAPI UText * U_EXPORT2 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status); @@ -376,14 +357,14 @@ utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCod * Compare two UText objects for equality. * UTexts are equal if they are iterating over the same text, and * have the same iteration position within the text. - * If either or both of the parameters are NULL, the comparison is FALSE. + * If either or both of the parameters are NULL, the comparison is false. * * @param a The first of the two UTexts to compare. * @param b The other UText to be compared. - * @return TRUE if the two UTexts are equal. + * @return true if the two UTexts are equal. * @stable ICU 3.6 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_equals(const UText *a, const UText *b); @@ -395,7 +376,7 @@ utext_equals(const UText *a, const UText *b); /** * Get the length of the text. Depending on the characteristics - * of the underlying text representation, this may be expensive. + * of the underlying text representation, this may be expensive. * @see utext_isLengthExpensive() * * @@ -404,11 +385,11 @@ utext_equals(const UText *a, const UText *b); * * @stable ICU 3.4 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 utext_nativeLength(UText *ut); /** - * Return TRUE if calculating the length of the text could be expensive. + * Return true if calculating the length of the text could be expensive. * Finding the length of NUL terminated strings is considered to be expensive. * * Note that the value of this function may change @@ -417,10 +398,10 @@ utext_nativeLength(UText *ut); * be expensive to report it. * * @param ut the text to be accessed. - * @return TRUE if determining the length of the text could be time consuming. + * @return true if determining the length of the text could be time consuming. * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_isLengthExpensive(const UText *ut); /** @@ -436,11 +417,11 @@ utext_isLengthExpensive(const UText *ut); * This function is roughly equivalent to the sequence * utext_setNativeIndex(index); * utext_current32(); - * (There is a subtle difference if the index is out of bounds by being less than zero - + * (There is a subtle difference if the index is out of bounds by being less than zero - * utext_setNativeIndex(negative value) sets the index to zero, after which utext_current() * will return the char at zero. utext_char32At(negative index), on the other hand, will * return the U_SENTINEL value of -1.) - * + * * @param ut the text to be accessed * @param nativeIndex the native index of the character to be accessed. If the index points * to other than the first unit of a multi-unit character, it will be adjusted @@ -448,7 +429,7 @@ utext_isLengthExpensive(const UText *ut); * @return the code point at the specified index. * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_char32At(UText *ut, int64_t nativeIndex); @@ -462,7 +443,7 @@ utext_char32At(UText *ut, int64_t nativeIndex); * @return the Unicode code point at the current iterator position. * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_current32(UText *ut); @@ -471,12 +452,12 @@ utext_current32(UText *ut); * advance the position to the first index following the character. * * If the position is at the end of the text (the index following - * the last character, which is also the length of the text), - * return U_SENTINEL (-1) and do not advance the index. + * the last character, which is also the length of the text), + * return U_SENTINEL (-1) and do not advance the index. * * This is a post-increment operation. * - * An inline macro version of this function, UTEXT_NEXT32(), + * An inline macro version of this function, UTEXT_NEXT32(), * is available for performance critical use. * * @param ut the text to be accessed. @@ -484,7 +465,7 @@ utext_current32(UText *ut); * @see UTEXT_NEXT32 * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_next32(UText *ut); @@ -493,24 +474,24 @@ utext_next32(UText *ut); * index precedes the current position, and return that character. * This is a pre-decrement operation. * - * If the initial position is at the start of the text (index of 0) + * If the initial position is at the start of the text (index of 0) * return U_SENTINEL (-1), and leave the position unchanged. * - * An inline macro version of this function, UTEXT_PREVIOUS32(), + * An inline macro version of this function, UTEXT_PREVIOUS32(), * is available for performance critical use. * * @param ut the text to be accessed. - * @return the previous UChar32 code point, or U_SENTINEL (-1) + * @return the previous UChar32 code point, or U_SENTINEL (-1) * if the iteration has reached the start of the text. * @see UTEXT_PREVIOUS32 * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_previous32(UText *ut); /** - * Set the iteration index and return the code point at that index. + * Set the iteration index and return the code point at that index. * Leave the iteration index at the start of the following code point. * * This function is the most efficient and convenient way to @@ -527,7 +508,7 @@ utext_previous32(UText *ut); * or U_SENTINEL (-1) if it is out of bounds. * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_next32From(UText *ut, int64_t nativeIndex); @@ -547,22 +528,22 @@ utext_next32From(UText *ut, int64_t nativeIndex); * * @stable ICU 3.4 */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utext_previous32From(UText *ut, int64_t nativeIndex); /** - * Get the current iterator position, which can range from 0 to + * Get the current iterator position, which can range from 0 to * the length of the text. * The position is a native index into the input text, in whatever format it * may have (possibly UTF-8 for example), and may not always be the same as * the corresponding UChar (UTF-16) index. - * The returned position will always be aligned to a code point boundary. + * The returned position will always be aligned to a code point boundary. * * @param ut the text to be accessed. * @return the current index position, in the native units of the text provider. * @stable ICU 3.4 */ -U_STABLE int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 utext_getNativeIndex(const UText *ut); /** @@ -588,7 +569,7 @@ utext_getNativeIndex(const UText *ut); * @param nativeIndex the native unit index of the new iteration position. * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utext_setNativeIndex(UText *ut, int64_t nativeIndex); /** @@ -603,11 +584,11 @@ utext_setNativeIndex(UText *ut, int64_t nativeIndex); * * @param ut the text to be accessed. * @param delta the signed number of code points to move the iteration position. - * @return TRUE if the position could be moved the requested number of positions while + * @return true if the position could be moved the requested number of positions while * staying within the range [0 - text length]. * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_moveIndex32(UText *ut, int32_t delta); /** @@ -616,7 +597,7 @@ utext_moveIndex32(UText *ut, int32_t delta); * is returned. * The value returned is the same as that obtained from the following sequence, * but without the side effect of changing the iteration position. - * + * * \code * UText *ut = whatever; * ... @@ -632,8 +613,8 @@ utext_moveIndex32(UText *ut, int32_t delta); * or zero if the current position is at the start of the text. * @stable ICU 3.6 */ -U_STABLE int64_t U_EXPORT2 -utext_getPreviousNativeIndex(UText *ut); +U_CAPI int64_t U_EXPORT2 +utext_getPreviousNativeIndex(UText *ut); /** @@ -664,13 +645,13 @@ utext_getPreviousNativeIndex(UText *ut); * @param destCapacity The size, in UChars, of the destination buffer. May be zero * for precomputing the required size. * @param status receives any error status. - * U_BUFFER_OVERFLOW_ERROR: the extracted text was truncated because the + * U_BUFFER_OVERFLOW_ERROR: the extracted text was truncated because the * buffer was too small. Returns number of UChars for preflighting. * @return Number of UChars in the data to be extracted. Does not include a trailing NUL. * * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utext_extract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, @@ -741,19 +722,19 @@ utext_extract(UText *ut, /** * inline version of utext_getNativeIndex(), for performance-critical situations. * - * Get the current iterator position, which can range from 0 to + * Get the current iterator position, which can range from 0 to * the length of the text. * The position is a native index into the input text, in whatever format it * may have (possibly UTF-8 for example), and may not always be the same as * the corresponding UChar (UTF-16) index. - * The returned position will always be aligned to a code point boundary. + * The returned position will always be aligned to a code point boundary. * * @stable ICU 3.6 */ #define UTEXT_GETNATIVEINDEX(ut) \ ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \ (ut)->chunkNativeStart+(ut)->chunkOffset : \ - (ut)->pFuncs->mapOffsetToNative(ut)) + (ut)->pFuncs->mapOffsetToNative(ut)) /** * inline version of utext_setNativeIndex(), for performance-critical situations. @@ -787,16 +768,16 @@ utext_extract(UText *ut, /** - * Return TRUE if the text can be written (modified) with utext_replace() or + * Return true if the text can be written (modified) with utext_replace() or * utext_copy(). For the text to be writable, the text provider must * be of a type that supports writing and the UText must not be frozen. * - * Attempting to modify text when utext_isWriteable() is FALSE will fail - + * Attempting to modify text when utext_isWriteable() is false will fail - * the text will not be modified, and an error will be returned from the function * that attempted the modification. * * @param ut the UText to be tested. - * @return TRUE if the text is modifiable. + * @return true if the text is modifiable. * * @see utext_freeze() * @see utext_replace() @@ -804,7 +785,7 @@ utext_extract(UText *ut, * @stable ICU 3.4 * */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_isWritable(const UText *ut); @@ -813,10 +794,10 @@ utext_isWritable(const UText *ut); * @see Replaceable::hasMetaData() * * @param ut The UText to be tested - * @return TRUE if the underlying text includes meta data. + * @return true if the underlying text includes meta data. * @stable ICU 3.4 */ -U_STABLE UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 utext_hasMetaData(const UText *ut); @@ -827,7 +808,7 @@ utext_hasMetaData(const UText *ut); * newly inserted replacement text. * * This function is only available on UText types that support writing, - * that is, ones where utext_isWritable() returns TRUE. + * that is, ones where utext_isWritable() returns true. * * When using this function, there should be only a single UText opened onto the * underlying native text string. Behavior after a replace operation @@ -847,7 +828,7 @@ utext_hasMetaData(const UText *ut); * * @stable ICU 3.4 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utext_replace(UText *ut, int64_t nativeStart, int64_t nativeLimit, const UChar *replacementText, int32_t replacementLength, @@ -869,7 +850,7 @@ utext_replace(UText *ut, * at the destination position. * * This function is only available on UText types that support writing, - * that is, ones where utext_isWritable() returns TRUE. + * that is, ones where utext_isWritable() returns true. * * When using this function, there should be only a single UText opened onto the * underlying native text string. Behavior after a copy operation @@ -882,12 +863,12 @@ utext_replace(UText *ut, * to be copied. * @param destIndex The native destination index to which the source substring is * copied or moved. - * @param move If TRUE, then the substring is moved, not copied/duplicated. + * @param move If true, then the substring is moved, not copied/duplicated. * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION - * + * * @stable ICU 3.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utext_copy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t destIndex, @@ -916,7 +897,7 @@ utext_copy(UText *ut, * @see utext_isWritable() * @stable ICU 3.6 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utext_freeze(UText *ut); @@ -950,7 +931,7 @@ enum { * There is meta data associated with the text. * @see Replaceable::hasMetaData() * @stable ICU 3.4 - */ + */ UTEXT_PROVIDER_HAS_META_DATA = 4, /** * Text provider owns the text storage. @@ -975,7 +956,7 @@ enum { * and be prepared to handle failures. * * A shallow clone replicates only the UText data structures; it does not make - * a copy of the underlying text. Shallow clones can be used as an efficient way to + * a copy of the underlying text. Shallow clones can be used as an efficient way to * have multiple iterators active in a single text string that is not being * modified. * @@ -991,7 +972,7 @@ enum { * @param dest A UText struct to be filled in with the result of the clone operation, * or NULL if the clone function should heap-allocate a new UText struct. * @param src The UText to be cloned. - * @param deep TRUE to request a deep clone, FALSE for a shallow clone. + * @param deep true to request a deep clone, false for a shallow clone. * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR * should be returned if the text provider is unable to clone the * original text. @@ -1027,9 +1008,9 @@ UTextNativeLength(UText *ut); * * @param ut the UText being accessed. * @param nativeIndex Requested index of the text to be accessed. - * @param forward If TRUE, then the returned chunk must contain text + * @param forward If true, then the returned chunk must contain text * starting from the index, so that start<=indexUsage: * ICU coding guidelines for if() statements should be followed when using these macros. - * Compound statements (curly braces {}) must be used for if-else-while... + * Compound statements (curly braces {}) must be used for if-else-while... * bodies and all macro statements should be terminated with semicolon. * * @stable ICU 2.4 @@ -124,7 +124,7 @@ /** * Is this code point a Unicode noncharacter? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_UNICODE_NONCHAR(c) \ @@ -145,7 +145,7 @@ * and that boundary is tested first for performance. * * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_UNICODE_CHAR(c) \ @@ -155,7 +155,7 @@ /** * Is this code point a BMP code point (U+0000..U+ffff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.8 */ #define U_IS_BMP(c) ((uint32_t)(c)<=0xffff) @@ -163,15 +163,15 @@ /** * Is this code point a supplementary code point (U+10000..U+10ffff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.8 */ #define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff) - + /** * Is this code point a lead surrogate (U+d800..U+dbff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) @@ -179,7 +179,7 @@ /** * Is this code point a trail surrogate (U+dc00..U+dfff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) @@ -187,7 +187,7 @@ /** * Is this code point a surrogate (U+d800..U+dfff)? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) @@ -196,7 +196,7 @@ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)), * is it a lead surrogate? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) @@ -205,14 +205,14 @@ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)), * is it a trail surrogate? * @param c 32-bit code point - * @return TRUE or FALSE + * @return true or false * @stable ICU 4.2 */ #define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0) /* include the utfXX.h ------------------------------------------------------ */ -// #if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS +#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS #include "unicode/utf8.h" #include "unicode/utf16.h" @@ -220,6 +220,6 @@ /* utf_old.h contains deprecated, pre-ICU 2.4 definitions */ #include "unicode/utf_old.h" -// #endif /* !U_NO_DEFAULT_INCLUDE_UTF_HEADERS */ +#endif /* !U_NO_DEFAULT_INCLUDE_UTF_HEADERS */ #endif /* __UTF_H__ */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/utf16.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/utf16.h index 9fd7d5c8a..3902c60e9 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/utf16.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/utf16.h @@ -23,7 +23,7 @@ * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings. * * For more information see utf.h and the ICU User Guide Strings chapter - * (http://userguide.icu-project.org/strings). + * (https://unicode-org.github.io/icu/userguide/strings). * * Usage: * ICU coding guidelines for if() statements should be followed when using these macros. @@ -34,6 +34,7 @@ #ifndef __UTF16_H__ #define __UTF16_H__ +#include #include "unicode/umachine.h" #ifndef __UTF_H__ # include "unicode/utf.h" @@ -44,7 +45,7 @@ /** * Does this code unit alone encode a code point (BMP, not a surrogate)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) @@ -52,7 +53,7 @@ /** * Is this code unit a lead surrogate (U+d800..U+dbff)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) @@ -60,7 +61,7 @@ /** * Is this code unit a trail surrogate (U+dc00..U+dfff)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) @@ -68,7 +69,7 @@ /** * Is this code unit a surrogate (U+d800..U+dfff)? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) @@ -77,7 +78,7 @@ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), * is it a lead surrogate? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) @@ -86,7 +87,7 @@ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), * is it a trail surrogate? * @param c 16-bit code unit - * @return TRUE or FALSE + * @return true or false * @stable ICU 4.2 */ #define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0) @@ -379,13 +380,13 @@ * "Safe" macro, checks for a valid code point. * If a surrogate pair is written, checks for sufficient space in the string. * If the code point is not valid or a trail surrogate does not fit, - * then isError is set to TRUE. + * then isError is set to true. * * @param s const UChar * string buffer * @param i string offset, must be i>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } else /* c>0x10ffff or not enough space */ { \ - (isError)=TRUE; \ + (isError)=true; \ } \ } UPRV_BLOCK_MACRO_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/utf8.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/utf8.h index 4987a00e8..5a07435fc 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/utf8.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/utf8.h @@ -23,7 +23,7 @@ * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings. * * For more information see utf.h and the ICU User Guide Strings chapter - * (http://userguide.icu-project.org/strings). + * (https://unicode-org.github.io/icu/userguide/strings). * * Usage: * ICU coding guidelines for if() statements should be followed when using these macros. @@ -34,6 +34,7 @@ #ifndef __UTF8_H__ #define __UTF8_H__ +#include #include "unicode/umachine.h" #ifndef __UTF_H__ # include "unicode/utf.h" @@ -117,48 +118,48 @@ * Function for handling "next code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict); /** * Function for handling "append code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError); /** * Function for handling "previous code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE UChar32 U_EXPORT2 +U_CAPI UChar32 U_EXPORT2 utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict); /** * Function for handling "skip backward one code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; - * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this + * however it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /* single-code point definitions -------------------------------------------- */ @@ -166,7 +167,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /** * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)? * @param c 8-bit code unit (byte) - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U8_IS_SINGLE(c) (((c)&0x80)==0) @@ -174,7 +175,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /** * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4) * @param c 8-bit code unit (byte) - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32) @@ -183,7 +184,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /** * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF) * @param c 8-bit code unit (byte) - * @return TRUE or FALSE + * @return true or false * @stable ICU 2.4 */ #define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40) @@ -445,13 +446,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * "Safe" macro, checks for a valid code point. * If a non-ASCII code point is written, checks for sufficient space in the string. * If the code point is not valid or trail bytes do not fit, - * then isError is set to TRUE. + * then isError is set to true. * * @param s const uint8_t * string buffer * @param i int32_t string offset, must be i>6)&0x3f)|0x80); \ (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ } else { \ - (isError)=TRUE; \ + (isError)=true; \ } \ } UPRV_BLOCK_MACRO_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/utf_old.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/utf_old.h index b2428e6b3..6b868c728 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/utf_old.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/utf_old.h @@ -109,7 +109,7 @@ * Where such a distinction is useful, there are two versions of the macros, "unsafe" and "safe" * ones with ..._UNSAFE and ..._SAFE suffixes. The unsafe macros are fast but may cause * program failures if the strings are not well-formed. The safe macros have an additional, boolean - * parameter "strict". If strict is FALSE, then only illegal sequences are detected. + * parameter "strict". If strict is false, then only illegal sequences are detected. * Otherwise, irregular sequences and non-characters are detected as well (like single surrogates). * Safe macros return special error code points for illegal/irregular sequences: * Typically, U+ffff, or values that would result in a code unit sequence of the same length @@ -181,7 +181,7 @@ typedef int32_t UTextOffset; /** * The default choice for general Unicode string macros is to use the ..._SAFE macro implementations - * with strict=FALSE. + * with strict=false. * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ @@ -293,10 +293,10 @@ typedef int32_t UTextOffset; #ifdef U_UTF8_IMPL // No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes. #elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) -U_CFUNC const uint8_t utf8_countTrailBytes[]; +U_CAPI const uint8_t utf8_countTrailBytes[]; #else -U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/ -#endif +U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; +#endif /** * Count the trail bytes for a UTF-8 lead byte. diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/utrace.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/utrace.h index 0af050756..677486f47 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/utrace.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/utrace.h @@ -27,15 +27,15 @@ /** * \file - * \brief C API: Definitions for ICU tracing/logging. + * \brief C API: Definitions for ICU tracing/logging. * * This provides API for debugging the internals of ICU without the use of * a traditional debugger. * - * By default, tracing is disabled in ICU. If you need to debug ICU with + * By default, tracing is disabled in ICU. If you need to debug ICU with * tracing, please compile ICU with the --enable-tracing configure option. */ - + U_CDECL_BEGIN /** @@ -112,11 +112,9 @@ typedef enum UTraceFunctionNumber { UTRACE_COLLATION_LIMIT, #endif // U_HIDE_DEPRECATED_API -#ifndef U_HIDE_DRAFT_API - /** * The lowest resource/data location. - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_START=0x3000, @@ -133,7 +131,7 @@ typedef enum UTraceFunctionNumber { * - "get" (a path was loaded, but the value was not accessed) * - "getalias" (a path was loaded, and an alias was resolved) * - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START, @@ -141,7 +139,7 @@ typedef enum UTraceFunctionNumber { * Indicates that a resource bundle was opened. * * Provides one C-style string to UTraceData: file name. - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_BUNDLE, @@ -150,7 +148,7 @@ typedef enum UTraceFunctionNumber { * * Provides one C-style string to UTraceData: file name. * - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_DATA_FILE, @@ -163,12 +161,10 @@ typedef enum UTraceFunctionNumber { * * Provides one C-style string to UTraceData: file name. * - * @draft ICU 65 + * @stable ICU 65 */ UTRACE_UDATA_RES_FILE, -#endif // U_HIDE_DRAFT_API - #ifndef U_HIDE_INTERNAL_API /** * One more than the highest normal resource/data trace location. @@ -177,6 +173,68 @@ typedef enum UTraceFunctionNumber { UTRACE_RES_DATA_LIMIT, #endif // U_HIDE_INTERNAL_API + /** + * The lowest break iterator location. + * @stable ICU 67 + */ + UTRACE_UBRK_START=0x4000, + + /** + * Indicates that a character instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_CHARACTER = UTRACE_UBRK_START, + + /** + * Indicates that a word instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_WORD, + + /** + * Indicates that a line instance of break iterator was created. + * + * Provides one C-style string to UTraceData: the lb value ("", + * "loose", "strict", or "normal"). + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_LINE, + + /** + * Indicates that a sentence instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_SENTENCE, + + /** + * Indicates that a title instance of break iterator was created. + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_TITLE, + + /** + * Indicates that an internal dictionary break engine was created. + * + * Provides one C-style string to UTraceData: the script code of what + * the break engine cover ("Hani", "Khmr", "Laoo", "Mymr", or "Thai"). + * + * @stable ICU 67 + */ + UTRACE_UBRK_CREATE_BREAK_ENGINE, + +#ifndef U_HIDE_INTERNAL_API + /** + * One more than the highest normal break iterator trace location. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_UBRK_LIMIT, +#endif // U_HIDE_INTERNAL_API + } UTraceFunctionNumber; /** @@ -184,7 +242,7 @@ typedef enum UTraceFunctionNumber { * @param traceLevel A UTraceLevel value. * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utrace_setLevel(int32_t traceLevel); /** @@ -192,7 +250,7 @@ utrace_setLevel(int32_t traceLevel); * @return The UTraceLevel value being used by ICU. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrace_getLevel(void); /* Trace function pointers types ----------------------------- */ @@ -220,7 +278,7 @@ UTraceEntry(const void *context, int32_t fnNumber); * @stable ICU 2.8 */ typedef void U_CALLCONV -UTraceExit(const void *context, int32_t fnNumber, +UTraceExit(const void *context, int32_t fnNumber, const char *fmt, va_list args); /** @@ -256,17 +314,17 @@ UTraceData(const void *context, int32_t fnNumber, int32_t level, * here will in turn be passed to each of the tracing * functions UTraceEntry, UTraceExit and UTraceData. * ICU does not use or alter this pointer. - * @param e Callback function to be called on entry to a + * @param e Callback function to be called on entry to a * a traced ICU function. * @param x Callback function to be called on exit from a * traced ICU function. - * @param d Callback function to be called from within a + * @param d Callback function to be called from within a * traced ICU function, for the purpose of providing * data to the trace. * * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utrace_setFunctions(const void *context, UTraceEntry *e, UTraceExit *x, UTraceData *d); @@ -280,7 +338,7 @@ utrace_setFunctions(const void *context, * @param d The currently installed UTraceData function. * @stable ICU 2.8 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 utrace_getFunctions(const void **context, UTraceEntry **e, UTraceExit **x, UTraceData **d); @@ -328,7 +386,7 @@ utrace_getFunctions(const void **context, * - S A UChar * string. Requires two params, (ptr, length). Length=-1 for nul term. * - b A byte (8-bit integer). * - h A 16-bit integer. Also a 16 bit Unicode code unit. - * - d A 32-bit integer. Also a 20 bit Unicode code point value. + * - d A 32-bit integer. Also a 20 bit Unicode code point value. * - l A 64-bit integer. * - p A data pointer. * @@ -360,7 +418,7 @@ utrace_getFunctions(const void **context, * the type casts will not be necessary in actual code * * UTraceDataFunc(context, fnNumber, level, - * "There is a character %c in the string %s.", // Format String + * "There is a character %c in the string %s.", // Format String * (char)c, (const char *)s); // varargs parameters * -> There is a character 0x42 'B' in the string "Bravo". * @@ -399,10 +457,10 @@ utrace_getFunctions(const void **context, * @param fmt Format specification for the data to output * @param args Data to be formatted. * @return Length of formatted output, including the terminating NUL. - * If buffer capacity is insufficient, the required capacity is returned. + * If buffer capacity is insufficient, the required capacity is returned. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, va_list args); @@ -420,10 +478,10 @@ utrace_vformat(char *outBuf, int32_t capacity, * @param fmt Format specification for the data to output * @param ... Data to be formatted. * @return Length of formatted output, including the terminating NUL. - * If buffer capacity is insufficient, the required capacity is returned. + * If buffer capacity is insufficient, the required capacity is returned. * @stable ICU 2.8 */ -U_STABLE int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrace_format(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, ...); @@ -440,7 +498,7 @@ utrace_format(char *outBuf, int32_t capacity, * @see UTraceFunctionNumber * @stable ICU 2.8 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 utrace_functionName(int32_t fnNumber); U_CDECL_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/utypes.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/utypes.h index ea5d3413b..f890d5d1d 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/utypes.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/utypes.h @@ -40,7 +40,9 @@ #include "unicode/uconfig.h" #include -#include "unicode/utf.h" +#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS +# include "unicode/utf.h" +#endif /*! * \file @@ -209,16 +211,16 @@ typedef double UDate; /** The number of milliseconds per day @stable ICU 2.0 */ #define U_MILLIS_PER_DAY (86400000) -/** - * Maximum UDate value - * @stable ICU 4.8 - */ +/** + * Maximum UDate value + * @stable ICU 4.8 + */ #define U_DATE_MAX DBL_MAX /** - * Minimum UDate value - * @stable ICU 4.8 - */ + * Minimum UDate value + * @stable ICU 4.8 + */ #define U_DATE_MIN -U_DATE_MAX /*===========================================================================*/ @@ -398,7 +400,7 @@ typedef double UDate; * suitable subclass. * * For more information, see: - * http://icu-project.org/userguide/conventions + * https://unicode-org.github.io/icu/userguide/dev/codingguidelines#details-about-icu-error-codes * * Note: By convention, ICU functions that take a reference (C++) or a pointer * (C) to a UErrorCode first test: @@ -433,7 +435,7 @@ typedef enum UErrorCode { U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */ U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */ - + U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */ #ifndef U_HIDE_DEPRECATED_API @@ -477,13 +479,21 @@ typedef enum UErrorCode { U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */ U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */ U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */ + /** + * The input is impractically long for an operation. + * It is rejected because it may lead to problems such as excessive + * processing time, stack depth, or heap memory requirements. + * + * @stable ICU 68 + */ + U_INPUT_TOO_LONG_ERROR = 31, #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest standard error code. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - U_STANDARD_ERROR_LIMIT, + U_STANDARD_ERROR_LIMIT = 32, #endif // U_HIDE_DEPRECATED_API /* @@ -654,7 +664,7 @@ typedef enum UErrorCode { U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, - + /* * Error codes in the range 0x10500-0x105ff are reserved for Plugin related error codes. */ @@ -713,7 +723,7 @@ typedef enum UErrorCode { * in the UErrorCode enum above. * @stable ICU 2.0 */ -U_STABLE const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 u_errorName(UErrorCode code); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uvernum.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uvernum.h index f5d649784..1cdf8912f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uvernum.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uvernum.h @@ -31,19 +31,12 @@ * renaming macro, and copyright * * The following files need to be updated as well, which can be done - * by running the UNIX makefile target 'update-windows-makefiles' in icu/source. + * by running the UNIX makefile target 'update-windows-makefiles' in icu4c/source. * - * - * source/common/common_uwp.vcxproj - * source/common/common.vcxproj - update 'Output file name' on the link tab so - * that it contains the new major/minor combination - * source/i18n/i18n.vcxproj - same as for the common.vcxproj - * source/i18n/i18n_uwp.vcxproj - same as for the common_uwp.vcxproj - * source/layoutex/layoutex.vcproj - same - * source/stubdata/stubdata.vcproj - same as for the common.vcxproj - * source/io/io.vcproj - same as for the common.vcxproj + * source/allinone/Build.Windows.IcuVersion.props - Update the IcuMajorVersion * source/data/makedata.mak - change U_ICUDATA_NAME so that it contains - * the new major/minor combination and the Unicode version. + * the new major/minor combination, and UNICODE_VERSION + * for the Unicode version. */ #ifndef UVERNUM_H @@ -60,13 +53,13 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION_MAJOR_NUM 66 +#define U_ICU_VERSION_MAJOR_NUM 74 /** The current ICU minor version as an integer. * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ -#define U_ICU_VERSION_MINOR_NUM 1 +#define U_ICU_VERSION_MINOR_NUM 2 /** The current ICU patchlevel version as an integer. * This value will change in the subsequent releases of ICU @@ -86,7 +79,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ -#define U_ICU_VERSION_SUFFIX _66 +#define U_ICU_VERSION_SUFFIX _74 /** * \def U_DEF2_ICU_ENTRY_POINT_RENAME @@ -139,7 +132,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION "66.1" +#define U_ICU_VERSION "74.2" /** * The current ICU library major version number as a string, for library name suffixes. @@ -148,17 +141,17 @@ * Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers * into one string without dots ("48"). * Since ICU 49, it is the double-digit major ICU version number. - * See http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU + * See https://unicode-org.github.io/icu/userguide/design#version-numbers-in-icu * * @stable ICU 2.6 */ -#define U_ICU_VERSION_SHORT "66" +#define U_ICU_VERSION_SHORT "74" #ifndef U_HIDE_INTERNAL_API /** Data version in ICU4C. * @internal ICU 4.4 Internal Use Only **/ -#define U_ICU_DATA_VERSION "66.1" +#define U_ICU_DATA_VERSION "74.2" #endif /* U_HIDE_INTERNAL_API */ /*=========================================================================== diff --git a/src/duckdb/extension/icu/third_party/icu/common/unicode/uversion.h b/src/duckdb/extension/icu/third_party/icu/common/unicode/uversion.h index 5700f62cb..113568df8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unicode/uversion.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unicode/uversion.h @@ -141,7 +141,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; * values of up to 255 each. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_versionFromString(UVersionInfo versionArray, const char *versionString); /** @@ -155,7 +155,7 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString); * fields with values of up to 255 each. * @stable ICU 4.2 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); @@ -171,7 +171,7 @@ u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. * @stable ICU 2.4 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_versionToString(const UVersionInfo versionArray, char *versionString); /** @@ -182,6 +182,6 @@ u_versionToString(const UVersionInfo versionArray, char *versionString); * @param versionArray the version # information, the result will be filled in * @stable ICU 2.0 */ -U_STABLE void U_EXPORT2 +U_CAPI void U_EXPORT2 u_getVersion(UVersionInfo versionArray); #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.cpp b/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.cpp index 78b45a10b..1284c0381 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.cpp @@ -19,10 +19,10 @@ #include "uhash.h" #include "ucln_cmn.h" -static icu::UnifiedCache *unifiedcache_gCache = NULL; -static std::mutex *unifiedcache_gCacheMutex = nullptr; +static icu::UnifiedCache *gCache = nullptr; +static std::mutex *gCacheMutex = nullptr; static std::condition_variable *gInProgressValueAddedCond; -static icu::UInitOnce unifiedcache_gCacheInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce gCacheInitOnce {}; static const int32_t MAX_EVICT_ITERATIONS = 10; static const int32_t DEFAULT_MAX_UNUSED = 1000; @@ -31,34 +31,34 @@ static const int32_t DEFAULT_PERCENTAGE_OF_IN_USE = 100; U_CDECL_BEGIN static UBool U_CALLCONV unifiedcache_cleanup() { - unifiedcache_gCacheInitOnce.reset(); - delete unifiedcache_gCache; - unifiedcache_gCache = nullptr; - unifiedcache_gCacheMutex->~mutex(); - unifiedcache_gCacheMutex = nullptr; + gCacheInitOnce.reset(); + delete gCache; + gCache = nullptr; + gCacheMutex->~mutex(); + gCacheMutex = nullptr; gInProgressValueAddedCond->~condition_variable(); gInProgressValueAddedCond = nullptr; - return TRUE; + return true; } U_CDECL_END U_NAMESPACE_BEGIN -U_CAPI int32_t U_EXPORT2 +int32_t U_EXPORT2 ucache_hashKeys(const UHashTok key) { const CacheKeyBase *ckey = (const CacheKeyBase *) key.pointer; return ckey->hashCode(); } -U_CAPI UBool U_EXPORT2 +UBool U_EXPORT2 ucache_compareKeys(const UHashTok key1, const UHashTok key2) { const CacheKeyBase *p1 = (const CacheKeyBase *) key1.pointer; const CacheKeyBase *p2 = (const CacheKeyBase *) key2.pointer; return *p1 == *p2; } -U_CAPI void U_EXPORT2 +void U_EXPORT2 ucache_deleteKey(void *obj) { CacheKeyBase *p = (CacheKeyBase *) obj; delete p; @@ -67,35 +67,35 @@ ucache_deleteKey(void *obj) { CacheKeyBase::~CacheKeyBase() { } -static void U_CALLCONV unified_cache_cacheInit(UErrorCode &status) { - U_ASSERT(unifiedcache_gCache == NULL); +static void U_CALLCONV cacheInit(UErrorCode &status) { + U_ASSERT(gCache == nullptr); ucln_common_registerCleanup( UCLN_COMMON_UNIFIED_CACHE, unifiedcache_cleanup); - unifiedcache_gCacheMutex = STATIC_NEW(std::mutex); + gCacheMutex = STATIC_NEW(std::mutex); gInProgressValueAddedCond = STATIC_NEW(std::condition_variable); - unifiedcache_gCache = new UnifiedCache(status); - if (unifiedcache_gCache == NULL) { + gCache = new UnifiedCache(status); + if (gCache == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } if (U_FAILURE(status)) { - delete unifiedcache_gCache; - unifiedcache_gCache = NULL; + delete gCache; + gCache = nullptr; return; } } UnifiedCache *UnifiedCache::getInstance(UErrorCode &status) { - umtx_initOnce(unifiedcache_gCacheInitOnce, &unified_cache_cacheInit, status); + umtx_initOnce(gCacheInitOnce, &cacheInit, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } - U_ASSERT(unifiedcache_gCache != NULL); - return unifiedcache_gCache; + U_ASSERT(gCache != nullptr); + return gCache; } UnifiedCache::UnifiedCache(UErrorCode &status) : - fHashtable(NULL), + fHashtable(nullptr), fEvictPos(UHASH_FIRST), fNumValuesTotal(0), fNumValuesInUse(0), @@ -118,7 +118,7 @@ UnifiedCache::UnifiedCache(UErrorCode &status) : fHashtable = uhash_open( &ucache_hashKeys, &ucache_compareKeys, - NULL, + nullptr, &status); if (U_FAILURE(status)) { return; @@ -135,37 +135,37 @@ void UnifiedCache::setEvictionPolicy( status = U_ILLEGAL_ARGUMENT_ERROR; return; } - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); fMaxUnused = count; fMaxPercentageOfInUse = percentageOfInUseItems; } int32_t UnifiedCache::unusedCount() const { - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); return uhash_count(fHashtable) - fNumValuesInUse; } int64_t UnifiedCache::autoEvictedCount() const { - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); return fAutoEvictedCount; } int32_t UnifiedCache::keyCount() const { - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); return uhash_count(fHashtable); } void UnifiedCache::flush() const { - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); // Use a loop in case cache items that are flushed held hard references to // other cache items making those additional cache items eligible for // flushing. - while (_flush(FALSE)); + while (_flush(false)); } void UnifiedCache::handleUnreferencedObject() const { - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); --fNumValuesInUse; _runEvictionSlice(); } @@ -184,19 +184,19 @@ void UnifiedCache::dump() { } void UnifiedCache::dumpContents() const { - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); _dumpContents(); } // Dumps content of cache. -// On entry, unifiedcache_gCacheMutex must be held. +// On entry, gCacheMutex must be held. // On exit, cache contents dumped to stderr. void UnifiedCache::_dumpContents() const { int32_t pos = UHASH_FIRST; const UHashElement *element = uhash_nextElement(fHashtable, &pos); char buffer[256]; int32_t cnt = 0; - for (; element != NULL; element = uhash_nextElement(fHashtable, &pos)) { + for (; element != nullptr; element = uhash_nextElement(fHashtable, &pos)) { const SharedObject *sharedObject = (const SharedObject *) element->value.pointer; const CacheKeyBase *key = @@ -208,7 +208,7 @@ void UnifiedCache::_dumpContents() const { "Unified Cache: Key '%s', error %d, value %p, total refcount %d, soft refcount %d\n", key->writeDescription(buffer, 256), key->creationStatus, - sharedObject == fNoValue ? NULL :sharedObject, + sharedObject == fNoValue ? nullptr :sharedObject, sharedObject->getRefCount(), sharedObject->getSoftRefCount()); } @@ -224,8 +224,8 @@ UnifiedCache::~UnifiedCache() { // Now all that should be left in the cache are entries that refer to // each other and entries with hard references from outside the cache. // Nothing we can do about these so proceed to wipe out the cache. - std::lock_guard lock(*unifiedcache_gCacheMutex); - _flush(TRUE); + std::lock_guard lock(*gCacheMutex); + _flush(true); } uhash_close(fHashtable); fHashtable = nullptr; @@ -236,7 +236,7 @@ UnifiedCache::~UnifiedCache() { const UHashElement * UnifiedCache::_nextElement() const { const UHashElement *element = uhash_nextElement(fHashtable, &fEvictPos); - if (element == NULL) { + if (element == nullptr) { fEvictPos = UHASH_FIRST; return uhash_nextElement(fHashtable, &fEvictPos); } @@ -244,7 +244,7 @@ UnifiedCache::_nextElement() const { } UBool UnifiedCache::_flush(UBool all) const { - UBool result = FALSE; + UBool result = false; int32_t origSize = uhash_count(fHashtable); for (int32_t i = 0; i < origSize; ++i) { const UHashElement *element = _nextElement(); @@ -257,7 +257,7 @@ UBool UnifiedCache::_flush(UBool all) const { U_ASSERT(sharedObject->cachePtr == this); uhash_removeElement(fHashtable, element); removeSoftRef(sharedObject); // Deletes the sharedObject when softRefCount goes to zero. - result = TRUE; + result = true; } } return result; @@ -268,8 +268,8 @@ int32_t UnifiedCache::_computeCountOfItemsToEvict() const { int32_t evictableItems = totalItems - fNumValuesInUse; int32_t unusedLimitByPercentage = fNumValuesInUse * fMaxPercentageOfInUse / 100; - int32_t unusedLimit = unusedLimitByPercentage > fMaxUnused ? unusedLimitByPercentage : fMaxUnused; - int32_t countOfItemsToEvict = evictableItems > unusedLimit ? evictableItems - unusedLimit : 0; + int32_t unusedLimit = std::max(unusedLimitByPercentage, fMaxUnused); + int32_t countOfItemsToEvict = std::max(0, evictableItems - unusedLimit); return countOfItemsToEvict; } @@ -305,13 +305,13 @@ void UnifiedCache::_putNew( return; } CacheKeyBase *keyToAdopt = key.clone(); - if (keyToAdopt == NULL) { + if (keyToAdopt == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } keyToAdopt->fCreationStatus = creationStatus; if (value->softRefCount == 0) { - _registerMaster(keyToAdopt, value); + _registerPrimary(keyToAdopt, value); } void *oldValue = uhash_put(fHashtable, keyToAdopt, (void *) value, &status); U_ASSERT(oldValue == nullptr); @@ -325,20 +325,20 @@ void UnifiedCache::_putIfAbsentAndGet( const CacheKeyBase &key, const SharedObject *&value, UErrorCode &status) const { - std::lock_guard lock(*unifiedcache_gCacheMutex); + std::lock_guard lock(*gCacheMutex); const UHashElement *element = uhash_find(fHashtable, &key); - if (element != NULL && !_inProgress(element)) { + if (element != nullptr && !_inProgress(element)) { _fetch(element, value, status); return; } - if (element == NULL) { + if (element == nullptr) { UErrorCode putError = U_ZERO_ERROR; // best-effort basis only. _putNew(key, value, status, putError); } else { _put(element, value, status); } - // Run an eviction slice. This will run even if we added a master entry + // Run an eviction slice. This will run even if we added a primary entry // which doesn't increase the unused count, but that is still o.k _runEvictionSlice(); } @@ -348,31 +348,31 @@ UBool UnifiedCache::_poll( const CacheKeyBase &key, const SharedObject *&value, UErrorCode &status) const { - U_ASSERT(value == NULL); + U_ASSERT(value == nullptr); U_ASSERT(status == U_ZERO_ERROR); - std::unique_lock lock(*unifiedcache_gCacheMutex); + std::unique_lock lock(*gCacheMutex); const UHashElement *element = uhash_find(fHashtable, &key); // If the hash table contains an inProgress placeholder entry for this key, // this means that another thread is currently constructing the value object. // Loop, waiting for that construction to complete. - while (element != NULL && _inProgress(element)) { + while (element != nullptr && _inProgress(element)) { gInProgressValueAddedCond->wait(lock); element = uhash_find(fHashtable, &key); } // If the hash table contains an entry for the key, // fetch out the contents and return them. - if (element != NULL) { + if (element != nullptr) { _fetch(element, value, status); - return TRUE; + return true; } // The hash table contained nothing for this key. // Insert an inProgress place holder value. // Our caller will create the final value and update the hash table. _putNew(key, fNoValue, U_ZERO_ERROR, status); - return FALSE; + return false; } void UnifiedCache::_get( @@ -380,7 +380,7 @@ void UnifiedCache::_get( const SharedObject *&value, const void *creationContext, UErrorCode &status) const { - U_ASSERT(value == NULL); + U_ASSERT(value == nullptr); U_ASSERT(status == U_ZERO_ERROR); if (_poll(key, value, status)) { if (value == fNoValue) { @@ -392,9 +392,9 @@ void UnifiedCache::_get( return; } value = key.createObject(creationContext, status); - U_ASSERT(value == NULL || value->hasHardReferences()); - U_ASSERT(value != NULL || status != U_ZERO_ERROR); - if (value == NULL) { + U_ASSERT(value == nullptr || value->hasHardReferences()); + U_ASSERT(value != nullptr || status != U_ZERO_ERROR); + if (value == nullptr) { SharedObject::copyPtr(fNoValue, value); } _putIfAbsentAndGet(key, value, status); @@ -403,9 +403,9 @@ void UnifiedCache::_get( } } -void UnifiedCache::_registerMaster( +void UnifiedCache::_registerPrimary( const CacheKeyBase *theKey, const SharedObject *value) const { - theKey->fIsMaster = true; + theKey->fIsPrimary = true; value->cachePtr = this; ++fNumValuesTotal; ++fNumValuesInUse; @@ -420,7 +420,7 @@ void UnifiedCache::_put( const SharedObject *oldValue = (const SharedObject *) element->value.pointer; theKey->fCreationStatus = status; if (value->softRefCount == 0) { - _registerMaster(theKey, value); + _registerPrimary(theKey, value); } value->softRefCount++; UHashElement *ptr = const_cast(element); @@ -451,7 +451,7 @@ void UnifiedCache::_fetch( UBool UnifiedCache::_inProgress(const UHashElement* element) const { UErrorCode status = U_ZERO_ERROR; - const SharedObject * value = NULL; + const SharedObject * value = nullptr; _fetch(element, value, status); UBool result = _inProgress(value, status); removeHardRef(value); @@ -471,12 +471,12 @@ UBool UnifiedCache::_isEvictable(const UHashElement *element) const // Entries that are under construction are never evictable if (_inProgress(theValue, theKey->fCreationStatus)) { - return FALSE; + return false; } - // We can evict entries that are either not a master or have just + // We can evict entries that are either not a primary or have just // one reference (The one reference being from the cache itself). - return (!theKey->fIsMaster || (theValue->softRefCount == 1 && theValue->noHardReferences())); + return (!theKey->fIsPrimary || (theValue->softRefCount == 1 && theValue->noHardReferences())); } void UnifiedCache::removeSoftRef(const SharedObject *value) const { diff --git a/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.h b/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.h index d7f5689fb..217031a27 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unifiedcache.h @@ -34,13 +34,13 @@ class UnifiedCache; */ class U_COMMON_API CacheKeyBase : public UObject { public: - CacheKeyBase() : fCreationStatus(U_ZERO_ERROR), fIsMaster(FALSE) {} + CacheKeyBase() : fCreationStatus(U_ZERO_ERROR), fIsPrimary(false) {} /** * Copy constructor. Needed to support cloning. */ - CacheKeyBase(const CacheKeyBase &other) - : UObject(other), fCreationStatus(other.fCreationStatus), fIsMaster(FALSE) { } + CacheKeyBase(const CacheKeyBase &other) + : UObject(other), fCreationStatus(other.fCreationStatus), fIsPrimary(false) { } virtual ~CacheKeyBase(); /** @@ -53,49 +53,51 @@ class U_COMMON_API CacheKeyBase : public UObject { */ virtual CacheKeyBase *clone() const = 0; - /** - * Equality operator. - */ - virtual bool operator == (const CacheKeyBase &other) const = 0; - /** * Create a new object for this key. Called by cache on cache miss. * createObject must add a reference to the object it returns. Note * that getting an object from the cache and returning it without calling - * removeRef on it satisfies this requirement. It can also return NULL + * removeRef on it satisfies this requirement. It can also return nullptr * and set status to an error. * * @param creationContext the context in which the object is being - * created. May be NULL. + * created. May be nullptr. * @param status Implementations can return a failure here. * In addition, implementations may return a - * non NULL object and set a warning status. + * non nullptr object and set a warning status. */ virtual const SharedObject *createObject( const void *creationContext, UErrorCode &status) const = 0; /** * Writes a description of this key to buffer and returns buffer. Written - * description is NULL terminated. + * description is nullptr terminated. */ virtual char *writeDescription(char *buffer, int32_t bufSize) const = 0; - /** - * Inequality operator. - */ - bool operator != (const CacheKeyBase &other) const { - return !(*this == other); + friend inline bool operator==(const CacheKeyBase& lhs, + const CacheKeyBase& rhs) { + return lhs.equals(rhs); } + + friend inline bool operator!=(const CacheKeyBase& lhs, + const CacheKeyBase& rhs) { + return !lhs.equals(rhs); + } + + protected: + virtual bool equals(const CacheKeyBase& other) const = 0; + private: mutable UErrorCode fCreationStatus; - mutable UBool fIsMaster; + mutable UBool fIsPrimary; friend class UnifiedCache; }; /** - * Templated version of CacheKeyBase. + * Templated version of CacheKeyBase. * A key of type LocaleCacheKey maps to a value of type T. */ template @@ -105,7 +107,7 @@ class CacheKey : public CacheKeyBase { /** * The template parameter, T, determines the hash code returned. */ - virtual int32_t hashCode() const { + virtual int32_t hashCode() const override { const char *s = typeid(T).name(); return ustr_hashCharsN(s, static_cast(uprv_strlen(s))); } @@ -113,18 +115,19 @@ class CacheKey : public CacheKeyBase { /** * Use the value type, T, as the description. */ - virtual char *writeDescription(char *buffer, int32_t bufLen) const { + virtual char *writeDescription(char *buffer, int32_t bufLen) const override { const char *s = typeid(T).name(); uprv_strncpy(buffer, s, bufLen); buffer[bufLen - 1] = 0; return buffer; } + protected: /** * Two objects are equal if they are of the same type. */ - virtual bool operator == (const CacheKeyBase &other) const { - return typeid(*this) == typeid(other); + virtual bool equals(const CacheKeyBase &other) const override { + return this == &other || typeid(*this) == typeid(other); } }; @@ -136,37 +139,34 @@ template class LocaleCacheKey : public CacheKey { protected: Locale fLoc; + virtual bool equals(const CacheKeyBase &other) const override { + if (!CacheKey::equals(other)) { + return false; + } + // We know this and other are of same class because equals() on + // CacheKey returned true. + return operator==(static_cast &>(other)); + } public: LocaleCacheKey(const Locale &loc) : fLoc(loc) {} LocaleCacheKey(const LocaleCacheKey &other) : CacheKey(other), fLoc(other.fLoc) { } virtual ~LocaleCacheKey() { } - virtual int32_t hashCode() const { + virtual int32_t hashCode() const override { return (int32_t)(37u * (uint32_t)CacheKey::hashCode() + (uint32_t)fLoc.hashCode()); } - virtual bool operator == (const CacheKeyBase &other) const { - // reflexive - if (this == &other) { - return TRUE; - } - if (!CacheKey::operator == (other)) { - return FALSE; - } - // We know this and other are of same class because operator== on - // CacheKey returned true. - const LocaleCacheKey *fOther = - static_cast *>(&other); - return fLoc == fOther->fLoc; + inline bool operator == (const LocaleCacheKey &other) const { + return fLoc == other.fLoc; } - virtual CacheKeyBase *clone() const { + virtual CacheKeyBase *clone() const override { return new LocaleCacheKey(*this); } virtual const T *createObject( - const void *creationContext, UErrorCode &status) const; + const void *creationContext, UErrorCode &status) const override; /** * Use the locale id as the description. */ - virtual char *writeDescription(char *buffer, int32_t bufLen) const { + virtual char *writeDescription(char *buffer, int32_t bufLen) const override { const char *s = fLoc.getName(); uprv_strncpy(buffer, s, bufLen); buffer[bufLen - 1] = 0; @@ -196,14 +196,14 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { /** * Fetches a value from the cache by key. Equivalent to - * get(key, NULL, ptr, status); + * get(key, nullptr, ptr, status); */ template void get( const CacheKey& key, const T *&ptr, UErrorCode &status) const { - get(key, NULL, ptr, status); + get(key, nullptr, ptr, status); } /** @@ -211,12 +211,12 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { * * @param key the cache key. * @param creationContext passed verbatim to createObject method of key - * @param ptr On entry, ptr must be NULL or be included if + * @param ptr On entry, ptr must be nullptr or be included if * the reference count of the object it points * to. On exit, ptr points to the fetched object * from the cache or is left unchanged on * failure. Caller must call removeRef on ptr - * if set to a non NULL value. + * if set to a non nullptr value. * @param status Any error returned here. May be set to a * warning value even if ptr is set. */ @@ -230,7 +230,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { return; } UErrorCode creationStatus = U_ZERO_ERROR; - const SharedObject *value = NULL; + const SharedObject *value = nullptr; _get(key, value, creationContext, creationStatus); const T *tvalue = (const T *) value; if (U_SUCCESS(creationStatus)) { @@ -254,13 +254,13 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { /** * Convenience method to get a value of type T from cache for a - * particular locale with creationContext == NULL. + * particular locale with creationContext == nullptr. * @param loc the locale - * @param ptr On entry, must be NULL or included in the ref count + * @param ptr On entry, must be nullptr or included in the ref count * of the object to which it points. * On exit, fetched value stored here or is left * unchanged on failure. Caller must call removeRef on - * ptr if set to a non NULL value. + * ptr if set to a non nullptr value. * @param status Any error returned here. May be set to a * warning value even if ptr is set. */ @@ -293,8 +293,8 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { void flush() const; /** - * Configures at what point evcition of unused entries will begin. - * Eviction is triggered whenever the number of evictable keys exeeds + * Configures at what point eviction of unused entries will begin. + * Eviction is triggered whenever the number of evictable keys exceeds * BOTH count AND (number of in-use items) * (percentageOfInUseItems / 100). * Once the number of unused entries drops below one of these, * eviction ceases. Because eviction happens incrementally, @@ -315,7 +315,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { * settings. * * If a client already holds references to many different unique values - * in the cache such that the number of those unique values far exeeds + * in the cache such that the number of those unique values far exceeds * "count" then the cache may not be able to maintain this maximum. * However, if this happens, the cache still guarantees that the number of * unused entries will remain only a small percentage of the total cache @@ -341,9 +341,9 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { */ int32_t unusedCount() const; - virtual void handleUnreferencedObject() const; + virtual void handleUnreferencedObject() const override; virtual ~UnifiedCache(); - + private: UHashtable *fHashtable; mutable int32_t fEvictPos; @@ -353,37 +353,37 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { int32_t fMaxPercentageOfInUse; mutable int64_t fAutoEvictedCount; SharedObject *fNoValue; - - UnifiedCache(const UnifiedCache &other); - UnifiedCache &operator=(const UnifiedCache &other); - + + UnifiedCache(const UnifiedCache &other) = delete; + UnifiedCache &operator=(const UnifiedCache &other) = delete; + /** * Flushes the contents of the cache. If cache values hold references to other - * cache values then _flush should be called in a loop until it returns FALSE. - * + * cache values then _flush should be called in a loop until it returns false. + * * On entry, gCacheMutex must be held. * On exit, those values with are evictable are flushed. - * + * * @param all if false flush evictable items only, which are those with no external * references, plus those that can be safely recreated.
    * if true, flush all elements. Any values (sharedObjects) with remaining * hard (external) references are not deleted, but are detached from * the cache, so that a subsequent removeRefs can delete them. * _flush is not thread safe when all is true. - * @return TRUE if any value in cache was flushed or FALSE otherwise. + * @return true if any value in cache was flushed or false otherwise. */ UBool _flush(UBool all) const; - + /** * Gets value out of cache. - * On entry. gCacheMutex must not be held. value must be NULL. status + * On entry. gCacheMutex must not be held. value must be nullptr. status * must be U_ZERO_ERROR. * On exit. value and status set to what is in cache at key or on cache * miss the key's createObject() is called and value and status are set to * the result of that. In this latter case, best effort is made to add the * value and status to the cache. If createObject() fails to create a value, - * fNoValue is stored in cache, and value is set to NULL. Caller must call - * removeRef on value if non NULL. + * fNoValue is stored in cache, and value is set to nullptr. Caller must call + * removeRef on value if non nullptr. */ void _get( const CacheKeyBase &key, @@ -393,23 +393,23 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { /** * Attempts to fetch value and status for key from cache. - * On entry, gCacheMutex must not be held value must be NULL and status must + * On entry, gCacheMutex must not be held value must be nullptr and status must * be U_ZERO_ERROR. - * On exit, either returns FALSE (In this - * case caller should try to create the object) or returns TRUE with value + * On exit, either returns false (In this + * case caller should try to create the object) or returns true with value * pointing to the fetched value and status set to fetched status. When - * FALSE is returned status may be set to failure if an in progress hash - * entry could not be made but value will remain unchanged. When TRUE is + * false is returned status may be set to failure if an in progress hash + * entry could not be made but value will remain unchanged. When true is * returned, caller must call removeRef() on value. */ UBool _poll( const CacheKeyBase &key, const SharedObject *&value, UErrorCode &status) const; - + /** * Places a new value and creationStatus in the cache for the given key. - * On entry, gCacheMutex must be held. key must not exist in the cache. + * On entry, gCacheMutex must be held. key must not exist in the cache. * On exit, value and creation status placed under key. Soft reference added * to value on successful add. On error sets status. */ @@ -418,15 +418,15 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { const SharedObject *value, const UErrorCode creationStatus, UErrorCode &status) const; - + /** * Places value and status at key if there is no value at key or if cache * entry for key is in progress. Otherwise, it leaves the current value and * status there. - * + * * On entry. gCacheMutex must not be held. Value must be * included in the reference count of the object to which it points. - * + * * On exit, value and status are changed to what was already in the cache if * something was there and not in progress. Otherwise, value and status are left * unchanged in which case they are placed in the cache on a best-effort basis. @@ -443,17 +443,17 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { * On entry, gCacheMutex must be held. */ const UHashElement *_nextElement() const; - + /** * Return the number of cache items that would need to be evicted * to bring usage into conformance with eviction policy. - * + * * An item corresponds to an entry in the hash table, a hash table element. - * + * * On entry, gCacheMutex must be held. */ int32_t _computeCountOfItemsToEvict() const; - + /** * Run an eviction slice. * On entry, gCacheMutex must be held. @@ -461,24 +461,24 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { * 10 entries in the cache round robin style evicting them if they are eligible. */ void _runEvictionSlice() const; - + /** - * Register a master cache entry. A master key is the first key to create + * Register a primary cache entry. A primary key is the first key to create * a given SharedObject value. Subsequent keys whose create function - * produce referneces to an already existing SharedObject are not masters - + * produce references to an already existing SharedObject are not primary - * they can be evicted and subsequently recreated. - * + * * On entry, gCacheMutex must be held. - * On exit, items in use count incremented, entry is marked as a master + * On exit, items in use count incremented, entry is marked as a primary * entry, and value registered with cache so that subsequent calls to * addRef() and removeRef() on it correctly interact with the cache. */ - void _registerMaster(const CacheKeyBase *theKey, const SharedObject *value) const; - + void _registerPrimary(const CacheKeyBase *theKey, const SharedObject *value) const; + /** * Store a value and creation error status in given hash entry. * On entry, gCacheMutex must be held. Hash entry element must be in progress. - * value must be non NULL. + * value must be non nullptr. * On Exit, soft reference added to value. value and status stored in hash * entry. Soft reference removed from previous stored value. Waiting * threads notified. @@ -494,35 +494,35 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { * @param value the SharedObject to be acted on. */ void removeSoftRef(const SharedObject *value) const; - + /** * Increment the hard reference count of the given SharedObject. * gCacheMutex must be held by the caller. * Update numValuesEvictable on transitions between zero and one reference. - * + * * @param value The SharedObject to be referenced. * @return the hard reference count after the addition. */ int32_t addHardRef(const SharedObject *value) const; - + /** * Decrement the hard reference count of the given SharedObject. * gCacheMutex must be held by the caller. * Update numValuesEvictable on transitions between one and zero reference. - * + * * @param value The SharedObject to be referenced. * @return the hard reference count after the removal. */ int32_t removeHardRef(const SharedObject *value) const; - + #ifdef UNIFIED_CACHE_DEBUG void _dumpContents() const; #endif - + /** * Fetch value and error code from a particular hash entry. - * On entry, gCacheMutex must be held. value must be either NULL or must be + * On entry, gCacheMutex must be held. value must be either nullptr or must be * included in the ref count of the object to which it points. * On exit, value and status set to what is in the hash entry. Caller must * eventually call removeRef on value. @@ -531,19 +531,19 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { */ void _fetch(const UHashElement *element, const SharedObject *&value, UErrorCode &status) const; - + /** * Determine if given hash entry is in progress. * On entry, gCacheMutex must be held. */ UBool _inProgress(const UHashElement *element) const; - + /** * Determine if given hash entry is in progress. * On entry, gCacheMutex must be held. */ UBool _inProgress(const SharedObject *theValue, UErrorCode creationStatus) const; - + /** * Determine if given hash entry is eligible for eviction. * On entry, gCacheMutex must be held. diff --git a/src/duckdb/extension/icu/third_party/icu/common/uniquecharstr.h b/src/duckdb/extension/icu/third_party/icu/common/uniquecharstr.h new file mode 100644 index 000000000..e5d3b7341 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/common/uniquecharstr.h @@ -0,0 +1,120 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// uniquecharstr.h +// created: 2020sep01 Frank Yung-Fong Tang + +#ifndef __UNIQUECHARSTR_H__ +#define __UNIQUECHARSTR_H__ + +#include "charstr.h" +#include "uassert.h" +#include "uhash.h" +#include "cmemory.h" + +U_NAMESPACE_BEGIN + +/** + * Stores NUL-terminated strings with duplicate elimination. + * Checks for unique UTF-16 string pointers and converts to invariant characters. + * + * Intended to be stack-allocated. Add strings, get a unique number for each, + * freeze the object, get a char * pointer for each string, + * call orphanCharStrings() to capture the string storage, and let this object go out of scope. + */ +class UniqueCharStrings { +public: + UniqueCharStrings(UErrorCode &errorCode) : strings(nullptr) { + // Note: We hash on string contents but store stable char16_t * pointers. + // If the strings are stored in resource bundles which should be built with + // duplicate elimination, then we should be able to hash on just the pointer values. + uhash_init(&map, uhash_hashUChars, uhash_compareUChars, uhash_compareLong, &errorCode); + if (U_FAILURE(errorCode)) { return; } + strings = new CharString(); + if (strings == nullptr) { + errorCode = U_MEMORY_ALLOCATION_ERROR; + } + } + ~UniqueCharStrings() { + uhash_close(&map); + delete strings; + } + + /** Returns/orphans the CharString that contains all strings. */ + CharString *orphanCharStrings() { + CharString *result = strings; + strings = nullptr; + return result; + } + + /** + * Adds a NUL-terminated string and returns a unique number for it. + * The string must not change, nor move around in memory, + * while this UniqueCharStrings is in use. + * + * Best used with string data in a stable storage, such as strings returned + * by resource bundle functions. + */ + int32_t add(const char16_t*p, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return -1; } + if (isFrozen) { + errorCode = U_NO_WRITE_PERMISSION; + return -1; + } + // The string points into the resource bundle. + int32_t oldIndex = uhash_geti(&map, p); + if (oldIndex != 0) { // found duplicate + return oldIndex; + } + // Explicit NUL terminator for the previous string. + // The strings object is also terminated with one implicit NUL. + strings->append(0, errorCode); + int32_t newIndex = strings->length(); + strings->appendInvariantChars(p, u_strlen(p), errorCode); + uhash_puti(&map, const_cast(p), newIndex, &errorCode); + return newIndex; + } + + /** + * Adds a unicode string by value and returns a unique number for it. + */ + int32_t addByValue(UnicodeString s, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return -1; } + if (isFrozen) { + errorCode = U_NO_WRITE_PERMISSION; + return -1; + } + int32_t oldIndex = uhash_geti(&map, s.getTerminatedBuffer()); + if (oldIndex != 0) { // found duplicate + return oldIndex; + } + // We need to store the string content of the UnicodeString. + UnicodeString *key = keyStore.create(s); + if (key == nullptr) { + errorCode = U_MEMORY_ALLOCATION_ERROR; + return -1; + } + return add(key->getTerminatedBuffer(), errorCode); + } + + void freeze() { isFrozen = true; } + + /** + * Returns a string pointer for its unique number, if this object is frozen. + * Otherwise nullptr. + */ + const char *get(int32_t i) const { + U_ASSERT(isFrozen); + return isFrozen && i > 0 ? strings->data() + i : nullptr; + } + +private: + UHashtable map; + CharString *strings; + MemoryPool keyStore; + bool isFrozen = false; +}; + +U_NAMESPACE_END + +#endif // __UNIQUECHARSTR_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/common/uniset.cpp b/src/duckdb/extension/icu/third_party/icu/common/uniset.cpp index 92545c74e..71f57fc12 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uniset.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uniset.cpp @@ -30,24 +30,6 @@ #include "bmpset.h" #include "unisetspan.h" -// Define UChar constants using hex for EBCDIC compatibility -// Used #define to reduce private static exports and memory access time. -#define uniset_SET_OPEN ((UChar)0x005B) /*[*/ -#define uniset_SET_CLOSE ((UChar)0x005D) /*]*/ -#define uniset_HYPHEN ((UChar)0x002D) /*-*/ -#define uniset_COMPLEMENT ((UChar)0x005E) /*^*/ -#define uniset_COLON ((UChar)0x003A) /*:*/ -#define uniset_BACKSLASH ((UChar)0x005C) /*\*/ -#define uniset_INTERSECTION ((UChar)0x0026) /*&*/ -#define uniset_UPPER_U ((UChar)0x0055) /*U*/ -#define uniset_LOWER_U ((UChar)0x0075) /*u*/ -#define uniset_OPEN_BRACE ((UChar)123) /*{*/ -#define uniset_CLOSE_BRACE ((UChar)125) /*}*/ -#define uniset_UPPER_P ((UChar)0x0050) /*P*/ -#define uniset_LOWER_P ((UChar)0x0070) /*p*/ -#define uniset_UPPER_N ((UChar)78) /*N*/ -#define uniset_EQUALS ((UChar)0x003D) /*=*/ - // HIGH_VALUE > all valid values. 110000 for codepoints #define UNICODESET_HIGH 0x0110000 @@ -55,7 +37,7 @@ #define UNICODESET_LOW 0x000000 /** Max list [0, 1, 2, ..., max code point, HIGH] */ -constexpr int32_t uniset_MAX_LENGTH = UNICODESET_HIGH + 1; +constexpr int32_t MAX_LENGTH = UNICODESET_HIGH + 1; U_NAMESPACE_BEGIN @@ -100,7 +82,7 @@ static int32_t _dbgCount = 0; static inline void _dbgct(UnicodeSet* set) { UnicodeString str; - set->toPattern(str, TRUE); + set->toPattern(str, true); char buf[40]; str.extract(0, 39, buf, ""); printf("DEBUG UnicodeSet: ct 0x%08X; %d %s\n", set, ++_dbgCount, buf); @@ -108,7 +90,7 @@ static inline void _dbgct(UnicodeSet* set) { static inline void _dbgdt(UnicodeSet* set) { UnicodeString str; - set->toPattern(str, TRUE); + set->toPattern(str, true); char buf[40]; str.extract(0, 39, buf, ""); printf("DEBUG UnicodeSet: dt 0x%08X; %d %s\n", set, --_dbgCount, buf); @@ -116,12 +98,8 @@ static inline void _dbgdt(UnicodeSet* set) { #else -#ifndef _dbgct -#define _dbgct(me) -#endif -#ifndef _dbgdt -#define _dbgdt(me) -#endif +#define _dbgct(set) +#define _dbgdt(set) #endif @@ -133,7 +111,7 @@ static void U_CALLCONV cloneUnicodeString(UElement *dst, UElement *src) { dst->pointer = new UnicodeString(*(UnicodeString*)src->pointer); } -static int8_t U_CALLCONV compareUnicodeString(UElement t1, UElement t2) { +static int32_t U_CALLCONV compareUnicodeString(UElement t1, UElement t2) { const UnicodeString &a = *(const UnicodeString*)t1.pointer; const UnicodeString &b = *(const UnicodeString*)t2.pointer; return a.compare(b); @@ -226,7 +204,7 @@ UnicodeSet::~UnicodeSet() { * Assigns this object to be a copy of another. */ UnicodeSet& UnicodeSet::operator=(const UnicodeSet& o) { - return copyFrom(o, FALSE); + return copyFrom(o, false); } UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) { @@ -248,7 +226,7 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) { uprv_memcpy(list, o.list, (size_t)len*sizeof(UChar32)); if (o.bmpSet != nullptr && !asThawed) { bmpSet = new BMPSet(*o.bmpSet, list, len); - if (bmpSet == NULL) { // Check for memory allocation error. + if (bmpSet == nullptr) { // Check for memory allocation error. setToBogus(); return *this; } @@ -265,7 +243,7 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) { } if (o.stringSpan != nullptr && !asThawed) { stringSpan = new UnicodeSetStringSpan(*o.stringSpan, *strings); - if (stringSpan == NULL) { // Check for memory allocation error. + if (stringSpan == nullptr) { // Check for memory allocation error. setToBogus(); return *this; } @@ -287,7 +265,7 @@ UnicodeSet* UnicodeSet::clone() const { } UnicodeSet *UnicodeSet::cloneAsThawed() const { - return new UnicodeSet(*this, TRUE); + return new UnicodeSet(*this, true); } /** @@ -301,13 +279,13 @@ UnicodeSet *UnicodeSet::cloneAsThawed() const { * @return true if the specified set is equal to this set. */ bool UnicodeSet::operator==(const UnicodeSet& o) const { - if (len != o.len) return FALSE; + if (len != o.len) return false; for (int32_t i = 0; i < len; ++i) { - if (list[i] != o.list[i]) return FALSE; + if (list[i] != o.list[i]) return false; } - if (hasStrings() != o.hasStrings()) { return FALSE; } - if (hasStrings() && *strings != *o.strings) return FALSE; - return TRUE; + if (hasStrings() != o.hasStrings()) { return false; } + if (hasStrings() && *strings != *o.strings) return false; + return true; } /** @@ -316,7 +294,7 @@ bool UnicodeSet::operator==(const UnicodeSet& o) const { * @return the hash code value for this set. * @see Object#hashCode() */ -int32_t UnicodeSet::hashCode(void) const { +int32_t UnicodeSet::hashCode() const { uint32_t result = static_cast(len); for (int32_t i = 0; i < len; ++i) { result *= 1000003u; @@ -336,7 +314,7 @@ int32_t UnicodeSet::hashCode(void) const { * * @return the number of elements in this set (its cardinality). */ -int32_t UnicodeSet::size(void) const { +int32_t UnicodeSet::size() const { int32_t n = 0; int32_t count = getRangeCount(); for (int32_t i = 0; i < count; ++i) { @@ -350,7 +328,7 @@ int32_t UnicodeSet::size(void) const { * * @return true if this set contains no elements. */ -UBool UnicodeSet::isEmpty(void) const { +UBool UnicodeSet::isEmpty() const { return len == 1 && !hasStrings(); } @@ -367,14 +345,14 @@ UBool UnicodeSet::contains(UChar32 c) const { //for (;;) { // if (c < list[++i]) break; //} - if (bmpSet != NULL) { + if (bmpSet != nullptr) { return bmpSet->contains(c); } - if (stringSpan != NULL) { + if (stringSpan != nullptr) { return stringSpan->contains(c); } if (c >= UNICODESET_HIGH) { // Don't need to check LOW bound - return FALSE; + return false; } int32_t i = findCodePoint(c); return (UBool)(i & 1); // return true if odd @@ -448,7 +426,6 @@ UBool UnicodeSet::contains(UChar32 start, UChar32 end) const { * @return true if this set contains the specified string */ UBool UnicodeSet::contains(const UnicodeString& s) const { - if (s.length() == 0) return FALSE; int32_t cp = getSingleCP(s); if (cp < 0) { return stringsContains(s); @@ -470,7 +447,7 @@ UBool UnicodeSet::containsAll(const UnicodeSet& c) const { int32_t n = c.getRangeCount(); for (int i=0; icontainsAll(*c.strings)); @@ -516,7 +493,7 @@ UBool UnicodeSet::containsNone(const UnicodeSet& c) const { int32_t n = c.getRangeCount(); for (int32_t i=0; icontainsNone(*c.strings); @@ -554,27 +531,25 @@ UBool UnicodeSet::matchesIndexValue(uint8_t v) const { UChar32 high = getRangeEnd(i); if ((low & ~0xFF) == (high & ~0xFF)) { if ((low & 0xFF) <= v && v <= (high & 0xFF)) { - return TRUE; + return true; } } else if ((low & 0xFF) <= v || v <= (high & 0xFF)) { - return TRUE; + return true; } } if (hasStrings()) { for (i=0; isize(); ++i) { const UnicodeString& s = *(const UnicodeString*)strings->elementAt(i); - //if (s.length() == 0) { - // // Empty strings match everything - // return TRUE; - //} - // assert(s.length() != 0); // We enforce this elsewhere + if (s.isEmpty()) { + continue; // skip the empty string + } UChar32 c = s.char32At(0); if ((c & 0xFF) == v) { - return TRUE; + return true; } } } - return FALSE; + return false; } /** @@ -586,9 +561,6 @@ UMatchDegree UnicodeSet::matches(const Replaceable& text, int32_t limit, UBool incremental) { if (offset == limit) { - // Strings, if any, have length != 0, so we don't worry - // about them here. If we ever allow zero-length strings - // we much check for them here. if (contains(U_ETHER)) { return incremental ? U_PARTIAL_MATCH : U_MATCH; } else { @@ -610,7 +582,7 @@ UMatchDegree UnicodeSet::matches(const Replaceable& text, // firstChar is the leftmost char to match in the // forward direction or the rightmost char to match in // the reverse direction. - UChar firstChar = text.charAt(offset); + char16_t firstChar = text.charAt(offset); // If there are multiple strings that can match we // return the longest match. @@ -618,13 +590,11 @@ UMatchDegree UnicodeSet::matches(const Replaceable& text, for (i=0; isize(); ++i) { const UnicodeString& trial = *(const UnicodeString*)strings->elementAt(i); + if (trial.isEmpty()) { + continue; // skip the empty string + } - //if (trial.length() == 0) { - // return U_MATCH; // null-string always matches - //} - // assert(trial.length() != 0); // We ensure this elsewhere - - UChar c = trial.charAt(forward ? 0 : trial.length() - 1); + char16_t c = trial.charAt(forward ? 0 : trial.length() - 1); // Strings are sorted, so we can optimize in the // forward direction. @@ -975,12 +945,12 @@ UnicodeSet& UnicodeSet::add(UChar32 c) { * present. If this set already contains the multicharacter, * the call leaves this set unchanged. * Thus "ch" => {"ch"} - *
    Warning: you cannot add an empty string ("") to a UnicodeSet. + * * @param s the source string * @return the modified set, for chaining */ UnicodeSet& UnicodeSet::add(const UnicodeString& s) { - if (s.length() == 0 || isFrozen() || isBogus()) return *this; + if (isFrozen() || isBogus()) return *this; int32_t cp = getSingleCP(s); if (cp < 0) { if (!stringsContains(s)) { @@ -995,8 +965,7 @@ UnicodeSet& UnicodeSet::add(const UnicodeString& s) { /** * Adds the given string, in order, to 'strings'. The given string - * must have been checked by the caller to not be empty and to not - * already be in 'strings'. + * must have been checked by the caller to not already be in 'strings'. */ void UnicodeSet::_add(const UnicodeString& s) { if (isFrozen() || isBogus()) { @@ -1008,14 +977,13 @@ void UnicodeSet::_add(const UnicodeString& s) { return; } UnicodeString* t = new UnicodeString(s); - if (t == NULL) { // Check for memory allocation error. + if (t == nullptr) { // Check for memory allocation error. setToBogus(); return; } strings->sortedInsert(t, compareUnicodeString, ec); if (U_FAILURE(ec)) { setToBogus(); - delete t; } } @@ -1025,16 +993,13 @@ void UnicodeSet::_add(const UnicodeString& s) { * @param string to test */ int32_t UnicodeSet::getSingleCP(const UnicodeString& s) { - //if (s.length() < 1) { - // throw new IllegalArgumentException("Can't use zero-length strings in UnicodeSet"); - //} - if (s.length() > 2) return -1; - if (s.length() == 1) return s.charAt(0); - - // at this point, len = 2 - UChar32 cp = s.char32At(0); - if (cp > 0xFFFF) { // is surrogate pair - return cp; + int32_t sLength = s.length(); + if (sLength == 1) return s.charAt(0); + if (sLength == 2) { + UChar32 cp = s.char32At(0); + if (cp > 0xFFFF) { // is surrogate pair + return cp; + } } return -1; } @@ -1110,7 +1075,7 @@ UnicodeSet& UnicodeSet::removeAllStrings() { */ UnicodeSet* U_EXPORT2 UnicodeSet::createFrom(const UnicodeString& s) { UnicodeSet *set = new UnicodeSet(); - if (set != NULL) { // Check for memory allocation error. + if (set != nullptr) { // Check for memory allocation error. set->add(s); } return set; @@ -1124,7 +1089,7 @@ UnicodeSet* U_EXPORT2 UnicodeSet::createFrom(const UnicodeString& s) { */ UnicodeSet* U_EXPORT2 UnicodeSet::createFromAll(const UnicodeString& s) { UnicodeSet *set = new UnicodeSet(); - if (set != NULL) { // Check for memory allocation error. + if (set != nullptr) { // Check for memory allocation error. set->addAll(s); } return set; @@ -1154,6 +1119,26 @@ UnicodeSet& UnicodeSet::retain(UChar32 c) { return retain(c, c); } +UnicodeSet& UnicodeSet::retain(const UnicodeString &s) { + if (isFrozen() || isBogus()) { return *this; } + UChar32 cp = getSingleCP(s); + if (cp < 0) { + bool isIn = stringsContains(s); + // Check for getRangeCount() first to avoid somewhat-expensive size() + // when there are single code points. + if (isIn && getRangeCount() == 0 && size() == 1) { + return *this; + } + clear(); + if (isIn) { + _add(s); + } + } else { + retain(cp, cp); + } + return *this; +} + /** * Removes the specified range from this set if it is present. * The set will not contain the specified range once the call @@ -1190,7 +1175,7 @@ UnicodeSet& UnicodeSet::remove(UChar32 c) { * @return the modified set, for chaining */ UnicodeSet& UnicodeSet::remove(const UnicodeString& s) { - if (s.length() == 0 || isFrozen() || isBogus()) return *this; + if (isFrozen() || isBogus()) return *this; int32_t cp = getSingleCP(s); if (cp < 0) { if (strings != nullptr && strings->removeElement((void*) &s)) { @@ -1233,7 +1218,7 @@ UnicodeSet& UnicodeSet::complement(UChar32 c) { * This is equivalent to * complement(MIN_VALUE, MAX_VALUE). */ -UnicodeSet& UnicodeSet::complement(void) { +UnicodeSet& UnicodeSet::complement() { if (isFrozen() || isBogus()) { return *this; } @@ -1256,12 +1241,12 @@ UnicodeSet& UnicodeSet::complement(void) { * Complement the specified string in this set. * The set will not contain the specified string once the call * returns. - *
    Warning: you cannot add an empty string ("") to a UnicodeSet. + * * @param s the string to complement * @return this object, for chaining */ UnicodeSet& UnicodeSet::complement(const UnicodeString& s) { - if (s.length() == 0 || isFrozen() || isBogus()) return *this; + if (isFrozen() || isBogus()) return *this; int32_t cp = getSingleCP(s); if (cp < 0) { if (stringsContains(s)) { @@ -1287,12 +1272,12 @@ UnicodeSet& UnicodeSet::complement(const UnicodeString& s) { * @see #add(char, char) */ UnicodeSet& UnicodeSet::addAll(const UnicodeSet& c) { - if ( c.len>0 && c.list!=NULL ) { + if ( c.len>0 && c.list!=nullptr ) { add(c.list, c.len, 0); } // Add strings in order - if ( c.strings!=NULL ) { + if ( c.strings!=nullptr ) { for (int32_t i=0; isize(); ++i) { const UnicodeString* s = (const UnicodeString*)c.strings->elementAt(i); if (!stringsContains(*s)) { @@ -1376,14 +1361,14 @@ UnicodeSet& UnicodeSet::complementAll(const UnicodeSet& c) { * Removes all of the elements from this set. This set will be * empty after this call returns. */ -UnicodeSet& UnicodeSet::clear(void) { +UnicodeSet& UnicodeSet::clear() { if (isFrozen()) { return *this; } list[0] = UNICODESET_HIGH; len = 1; releasePattern(); - if (strings != NULL) { + if (strings != nullptr) { strings->removeAllElements(); } // Remove bogus @@ -1436,7 +1421,7 @@ UnicodeSet& UnicodeSet::compact() { // Delete buffer first to defragment memory less. if (buffer != stackList) { uprv_free(buffer); - buffer = NULL; + buffer = nullptr; bufferCapacity = 0; } if (list == stackList) { @@ -1479,7 +1464,7 @@ UnicodeSet::UnicodeSet(const uint16_t data[], int32_t dataLen, ESerialization se } if( (serialization != kSerialized) - || (data==NULL) + || (data==nullptr) || (dataLen < 1)) { ec = U_ILLEGAL_ARGUMENT_ERROR; setToBogus(); @@ -1528,7 +1513,7 @@ int32_t UnicodeSet::serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& return 0; } - if (destCapacity<0 || (destCapacity>0 && dest==NULL)) { + if (destCapacity<0 || (destCapacity>0 && dest==nullptr)) { ec=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1618,24 +1603,24 @@ int32_t UnicodeSet::serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& //---------------------------------------------------------------- /** - * Allocate our strings vector and return TRUE if successful. + * Allocate our strings vector and return true if successful. */ UBool UnicodeSet::allocateStrings(UErrorCode &status) { if (U_FAILURE(status)) { - return FALSE; + return false; } strings = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, 1, status); - if (strings == NULL) { // Check for memory allocation error. + if (strings == nullptr) { // Check for memory allocation error. status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } if (U_FAILURE(status)) { delete strings; - strings = NULL; - return FALSE; - } - return TRUE; + strings = nullptr; + return false; + } + return true; } int32_t UnicodeSet::nextCapacity(int32_t minCapacity) { @@ -1646,23 +1631,23 @@ int32_t UnicodeSet::nextCapacity(int32_t minCapacity) { return 5 * minCapacity; } else { int32_t newCapacity = 2 * minCapacity; - if (newCapacity > uniset_MAX_LENGTH) { - newCapacity = uniset_MAX_LENGTH; + if (newCapacity > MAX_LENGTH) { + newCapacity = MAX_LENGTH; } return newCapacity; } } bool UnicodeSet::ensureCapacity(int32_t newLen) { - if (newLen > uniset_MAX_LENGTH) { - newLen = uniset_MAX_LENGTH; + if (newLen > MAX_LENGTH) { + newLen = MAX_LENGTH; } if (newLen <= capacity) { return true; } int32_t newCapacity = nextCapacity(newLen); UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32)); - if (temp == NULL) { + if (temp == nullptr) { setToBogus(); // set the object to bogus state if an OOM failure occurred. return false; } @@ -1677,15 +1662,15 @@ bool UnicodeSet::ensureCapacity(int32_t newLen) { } bool UnicodeSet::ensureBufferCapacity(int32_t newLen) { - if (newLen > uniset_MAX_LENGTH) { - newLen = uniset_MAX_LENGTH; + if (newLen > MAX_LENGTH) { + newLen = MAX_LENGTH; } if (newLen <= bufferCapacity) { return true; } int32_t newCapacity = nextCapacity(newLen); UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32)); - if (temp == NULL) { + if (temp == nullptr) { setToBogus(); return false; } @@ -1702,7 +1687,7 @@ bool UnicodeSet::ensureBufferCapacity(int32_t newLen) { /** * Swap list and buffer. */ -void UnicodeSet::swapBuffers(void) { +void UnicodeSet::swapBuffers() { // swap list and buffer UChar32* temp = list; list = buffer; @@ -1722,7 +1707,7 @@ void UnicodeSet::setToBogus() { // Implementation: Fundamental operators //---------------------------------------------------------------- -static inline UChar32 unichar_max(UChar32 a, UChar32 b) { +static inline UChar32 max(UChar32 a, UChar32 b) { return (a > b) ? a : b; } @@ -1778,7 +1763,7 @@ void UnicodeSet::exclusiveOr(const UChar32* other, int32_t otherLen, int8_t pola // polarity = 3: ~x union ~y void UnicodeSet::add(const UChar32* other, int32_t otherLen, int8_t polarity) { - if (isFrozen() || isBogus() || other==NULL) { + if (isFrozen() || isBogus() || other==nullptr) { return; } if (!ensureBufferCapacity(len + otherLen)) { @@ -1797,7 +1782,7 @@ void UnicodeSet::add(const UChar32* other, int32_t otherLen, int8_t polarity) { // Back up over overlapping ranges in buffer[] if (k > 0 && a <= buffer[k-1]) { // Pick latter end value in buffer[] vs. list[] - a = unichar_max(list[i], buffer[--k]); + a = max(list[i], buffer[--k]); } else { // No overlap buffer[k++] = a; @@ -1807,7 +1792,7 @@ void UnicodeSet::add(const UChar32* other, int32_t otherLen, int8_t polarity) { polarity ^= 1; } else if (b < a) { // take b if (k > 0 && b <= buffer[k-1]) { - b = unichar_max(other[j], buffer[--k]); + b = max(other[j], buffer[--k]); } else { buffer[k++] = b; b = other[j]; @@ -1819,7 +1804,7 @@ void UnicodeSet::add(const UChar32* other, int32_t otherLen, int8_t polarity) { // This is symmetrical; it doesn't matter if // we backtrack with a or b. - liu if (k > 0 && a <= buffer[k-1]) { - a = unichar_max(list[i], buffer[--k]); + a = max(list[i], buffer[--k]); } else { // No overlap buffer[k++] = a; @@ -1982,8 +1967,7 @@ void UnicodeSet::retain(const UChar32* other, int32_t otherLen, int8_t polarity) * Append the toPattern() representation of a * string to the given StringBuffer. */ -void UnicodeSet::_appendToPat(UnicodeString& buf, const UnicodeString& s, UBool -escapeUnprintable) { +void UnicodeSet::_appendToPat(UnicodeString& buf, const UnicodeString& s, UBool escapeUnprintable) { UChar32 cp; for (int32_t i = 0; i < s.length(); i += U16_LENGTH(cp)) { _appendToPat(buf, cp = s.char32At(i), escapeUnprintable); @@ -1994,39 +1978,50 @@ escapeUnprintable) { * Append the toPattern() representation of a * character to the given StringBuffer. */ -void UnicodeSet::_appendToPat(UnicodeString& buf, UChar32 c, UBool -escapeUnprintable) { - if (escapeUnprintable && ICU_Utility::isUnprintable(c)) { +void UnicodeSet::_appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable) { + if (escapeUnprintable ? ICU_Utility::isUnprintable(c) : ICU_Utility::shouldAlwaysBeEscaped(c)) { // Use hex escape notation (\uxxxx or \Uxxxxxxxx) for anything // unprintable - if (ICU_Utility::escapeUnprintable(buf, c)) { - return; - } + ICU_Utility::escape(buf, c); + return; } // Okay to let ':' pass through switch (c) { - case uniset_SET_OPEN: - case uniset_SET_CLOSE: - case uniset_HYPHEN: - case uniset_COMPLEMENT: - case uniset_INTERSECTION: - case uniset_BACKSLASH: - case uniset_OPEN_BRACE: - case uniset_CLOSE_BRACE: - case uniset_COLON: + case u'[': + case u']': + case u'-': + case u'^': + case u'&': + case u'\\': + case u'{': + case u'}': + case u':': case SymbolTable::SYMBOL_REF: - buf.append(uniset_BACKSLASH); + buf.append(u'\\'); break; default: // Escape whitespace if (PatternProps::isWhiteSpace(c)) { - buf.append(uniset_BACKSLASH); + buf.append(u'\\'); } break; } buf.append(c); } +void UnicodeSet::_appendToPat(UnicodeString &result, UChar32 start, UChar32 end, + UBool escapeUnprintable) { + _appendToPat(result, start, escapeUnprintable); + if (start != end) { + if ((start+1) != end || + // Avoid writing what looks like a lead+trail surrogate pair. + start == 0xdbff) { + result.append(u'-'); + } + _appendToPat(result, end, escapeUnprintable); + } +} + /** * Append a string representation of this set to result. This will be * a cleaned version of the string passed to applyPattern(), if there @@ -2035,13 +2030,14 @@ escapeUnprintable) { UnicodeString& UnicodeSet::_toPattern(UnicodeString& result, UBool escapeUnprintable) const { - if (pat != NULL) { + if (pat != nullptr) { int32_t i; int32_t backslashCount = 0; for (i=0; i 1 && - getRangeStart(0) == MIN_VALUE && - getRangeEnd(count-1) == MAX_VALUE) { - + // if (getRangeCount() >= 2 && + // getRangeStart(0) == MIN_VALUE && + // getRangeEnd(last) == MAX_VALUE) + // Invariant: list[len-1] == HIGH == MAX_VALUE + 1 + // If limit == len then len is even and the last range ends with MAX_VALUE. + // + // *But* do not write the inverse (complement) if there are strings. + // Since ICU 70, the '^' performs a code point complement which removes all strings. + if (len >= 4 && list[0] == 0 && limit == len && !hasStrings()) { // Emit the inverse - result.append(uniset_COMPLEMENT); - - for (int32_t i = 1; i < count; ++i) { - UChar32 start = getRangeEnd(i-1)+1; - UChar32 end = getRangeStart(i)-1; - _appendToPat(result, start, escapeUnprintable); - if (start != end) { - if ((start+1) != end) { - result.append(uniset_HYPHEN); - } - _appendToPat(result, end, escapeUnprintable); + result.append(u'^'); + // Offsetting the inversion list index by one lets us + // iterate over the ranges of the set complement. + i = 1; + --limit; + } + + // Emit the ranges as pairs. + while (i < limit) { + UChar32 start = list[i]; // getRangeStart() + UChar32 end = list[i + 1] - 1; // getRangeEnd() = range limit minus one + if (!(0xd800 <= end && end <= 0xdbff)) { + _appendToPat(result, start, end, escapeUnprintable); + i += 2; + } else { + // The range ends with a lead surrogate. + // Avoid writing what looks like a lead+trail surrogate pair. + // 1. Postpone ranges that start with a lead surrogate code point. + int32_t firstLead = i; + while ((i += 2) < limit && list[i] <= 0xdbff) {} + int32_t firstAfterLead = i; + // 2. Write following ranges that start with a trail surrogate code point. + while (i < limit && (start = list[i]) <= 0xdfff) { + _appendToPat(result, start, list[i + 1] - 1, escapeUnprintable); + i += 2; } - } - } - - // Default; emit the ranges as pairs - else { - for (int32_t i = 0; i < count; ++i) { - UChar32 start = getRangeStart(i); - UChar32 end = getRangeEnd(i); - _appendToPat(result, start, escapeUnprintable); - if (start != end) { - if ((start+1) != end) { - result.append(uniset_HYPHEN); - } - _appendToPat(result, end, escapeUnprintable); + // 3. Now write the postponed ranges. + for (int j = firstLead; j < firstAfterLead; j += 2) { + _appendToPat(result, list[j], list[j + 1] - 1, escapeUnprintable); } } } if (strings != nullptr) { for (int32_t i = 0; isize(); ++i) { - result.append(uniset_OPEN_BRACE); + result.append(u'{'); _appendToPat(result, *(const UnicodeString*) strings->elementAt(i), escapeUnprintable); - result.append(uniset_CLOSE_BRACE); + result.append(u'}'); } } - return result.append(uniset_SET_CLOSE); + return result.append(u']'); } /** @@ -2156,7 +2151,7 @@ UnicodeString& UnicodeSet::_generatePattern(UnicodeString& result, void UnicodeSet::releasePattern() { if (pat) { uprv_free(pat); - pat = NULL; + pat = nullptr; patLen = 0; } } @@ -2166,7 +2161,7 @@ void UnicodeSet::releasePattern() { */ void UnicodeSet::setPattern(const char16_t *newPat, int32_t newPatLen) { releasePattern(); - pat = (UChar *)uprv_malloc((newPatLen + 1) * sizeof(UChar)); + pat = (char16_t *)uprv_malloc((newPatLen + 1) * sizeof(char16_t)); if (pat) { patLen = newPatLen; u_memcpy(pat, newPat, patLen); @@ -2193,13 +2188,13 @@ UnicodeSet *UnicodeSet::freeze() { // many relevant strings as UTF-16. // (Thus needsStringSpanUTF8() implies needsStringSpanUTF16().) delete stringSpan; - stringSpan = NULL; + stringSpan = nullptr; } } - if (stringSpan == NULL) { + if (stringSpan == nullptr) { // No span-relevant strings: Optimize for code point spans. bmpSet=new BMPSet(list, len); - if (bmpSet == NULL) { // Check for memory allocation error. + if (bmpSet == nullptr) { // Check for memory allocation error. setToBogus(); } } @@ -2207,8 +2202,8 @@ UnicodeSet *UnicodeSet::freeze() { return this; } -int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const { - if(length>0 && bmpSet!=NULL) { +int32_t UnicodeSet::span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const { + if(length>0 && bmpSet!=nullptr) { return (int32_t)(bmpSet->span(s, s+length, spanCondition)-s); } if(length<0) { @@ -2217,7 +2212,7 @@ int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanC if(length==0) { return 0; } - if(stringSpan!=NULL) { + if(stringSpan!=nullptr) { return stringSpan->span(s, length, spanCondition); } else if(hasStrings()) { uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ? @@ -2244,8 +2239,8 @@ int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanC return prev; } -int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const { - if(length>0 && bmpSet!=NULL) { +int32_t UnicodeSet::spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const { + if(length>0 && bmpSet!=nullptr) { return (int32_t)(bmpSet->spanBack(s, s+length, spanCondition)-s); } if(length<0) { @@ -2254,7 +2249,7 @@ int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition s if(length==0) { return 0; } - if(stringSpan!=NULL) { + if(stringSpan!=nullptr) { return stringSpan->spanBack(s, length, spanCondition); } else if(hasStrings()) { uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ? @@ -2282,7 +2277,7 @@ int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition s } int32_t UnicodeSet::spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const { - if(length>0 && bmpSet!=NULL) { + if(length>0 && bmpSet!=nullptr) { const uint8_t *s0=(const uint8_t *)s; return (int32_t)(bmpSet->spanUTF8(s0, length, spanCondition)-s0); } @@ -2292,7 +2287,7 @@ int32_t UnicodeSet::spanUTF8(const char *s, int32_t length, USetSpanCondition sp if(length==0) { return 0; } - if(stringSpan!=NULL) { + if(stringSpan!=nullptr) { return stringSpan->spanUTF8((const uint8_t *)s, length, spanCondition); } else if(hasStrings()) { uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ? @@ -2320,7 +2315,7 @@ int32_t UnicodeSet::spanUTF8(const char *s, int32_t length, USetSpanCondition sp } int32_t UnicodeSet::spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const { - if(length>0 && bmpSet!=NULL) { + if(length>0 && bmpSet!=nullptr) { const uint8_t *s0=(const uint8_t *)s; return bmpSet->spanBackUTF8(s0, length, spanCondition); } @@ -2330,7 +2325,7 @@ int32_t UnicodeSet::spanBackUTF8(const char *s, int32_t length, USetSpanConditio if(length==0) { return 0; } - if(stringSpan!=NULL) { + if(stringSpan!=nullptr) { return stringSpan->spanBackUTF8((const uint8_t *)s, length, spanCondition); } else if(hasStrings()) { uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ? diff --git a/src/duckdb/extension/icu/third_party/icu/common/uniset_closure.cpp b/src/duckdb/extension/icu/third_party/icu/common/uniset_closure.cpp index bafc4d8f3..173a5cbaa 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uniset_closure.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uniset_closure.cpp @@ -25,9 +25,11 @@ #include "unicode/locid.h" #include "unicode/parsepos.h" #include "unicode/uniset.h" +#include "unicode/utf16.h" #include "cmemory.h" #include "ruleiter.h" #include "ucase.h" +#include "uprops.h" #include "util.h" #include "uvector.h" @@ -36,9 +38,7 @@ U_NAMESPACE_BEGIN // TODO memory debugging provided inside uniset.cpp // could be made available here but probably obsolete with use of modern // memory leak checker tools -#ifndef _dbgct #define _dbgct(me) -#endif //---------------------------------------------------------------- // Constructors &c @@ -76,7 +76,7 @@ UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern, if (options & USET_IGNORE_SPACE) { // Skip over trailing whitespace - ICU_Utility::skipWhitespace(pattern, i, TRUE); + ICU_Utility::skipWhitespace(pattern, i, true); } if (i != pattern.length()) { @@ -125,7 +125,7 @@ _set_addRange(USet *set, UChar32 start, UChar32 end) { } static void U_CALLCONV -_set_addString(USet *set, const UChar *str, int32_t length) { +_set_addString(USet *set, const char16_t *str, int32_t length) { ((UnicodeSet *)set)->add(UnicodeString((UBool)(length<0), str, length)); } @@ -136,14 +136,14 @@ _set_addString(USet *set, const UChar *str, int32_t length) { // add the result of a full case mapping to the set // use str as a temporary string to avoid constructing one static inline void -addCaseMapping(UnicodeSet &set, int32_t result, const UChar *full, UnicodeString &str) { +addCaseMapping(UnicodeSet &set, int32_t result, const char16_t *full, UnicodeString &str) { if(result >= 0) { if(result > UCASE_MAX_STRING_LENGTH) { // add a single-code point case mapping set.add(result); } else { // add a string case mapping from full with length result - str.setTo((UBool)FALSE, full, result); + str.setTo((UBool)false, full, result); set.add(str); } } @@ -151,102 +151,208 @@ addCaseMapping(UnicodeSet &set, int32_t result, const UChar *full, UnicodeString // see ucase.h } +namespace { + +/** For case closure on a large set, look only at code points with relevant properties. */ +const UnicodeSet &maybeOnlyCaseSensitive(const UnicodeSet &src, UnicodeSet &subset) { + // The subset must have been constructed with all code points, + // so that the retainAll() intersection effectively copies all single code points from src. + U_ASSERT(subset.contains(0, 0x10ffff)); + if (src.size() < 30) { + return src; + } + // Return the intersection of the src code points with Case_Sensitive ones. + UErrorCode errorCode = U_ZERO_ERROR; + const UnicodeSet *sensitive = + CharacterProperties::getBinaryPropertySet(UCHAR_CASE_SENSITIVE, errorCode); + if (U_FAILURE(errorCode)) { + return src; + } + // Start by copying the "smaller" set. + // (We "copy" by intersecting all Unicode *code points* with the first set, + // which omits any strings.) + if (src.getRangeCount() > sensitive->getRangeCount()) { + subset.retainAll(*sensitive); + subset.retainAll(src); + } else { + subset.retainAll(src); + subset.retainAll(*sensitive); + } + return subset; +} + +// Per-character scf = Simple_Case_Folding of a string. +// (Normally when we case-fold a string we use full case foldings.) +bool scfString(const UnicodeString &s, UnicodeString &scf) { + // Iterate over the raw buffer for best performance. + const char16_t *p = s.getBuffer(); + int32_t length = s.length(); + // Loop while not needing modification. + for (int32_t i = 0; i < length;) { + UChar32 c; + U16_NEXT(p, i, length, c); // post-increments i + UChar32 scfChar = u_foldCase(c, U_FOLD_CASE_DEFAULT); + if (scfChar != c) { + // Copy the characters before c. + scf.setTo(p, i - U16_LENGTH(c)); + // Loop over the rest of the string and keep case-folding. + for (;;) { + scf.append(scfChar); + if (i == length) { + return true; + } + U16_NEXT(p, i, length, c); // post-increments i + scfChar = u_foldCase(c, U_FOLD_CASE_DEFAULT); + } + } + } + return false; +} + +} // namespace + UnicodeSet& UnicodeSet::closeOver(int32_t attribute) { if (isFrozen() || isBogus()) { return *this; } - if (attribute & (USET_CASE_INSENSITIVE | USET_ADD_CASE_MAPPINGS)) { - { - UnicodeSet foldSet(*this); - UnicodeString str; - USetAdder sa = { - foldSet.toUSet(), - _set_add, - _set_addRange, - _set_addString, - NULL, // don't need remove() - NULL // don't need removeRange() - }; - - // start with input set to guarantee inclusion - // USET_CASE: remove strings because the strings will actually be reduced (folded); - // therefore, start with no strings and add only those needed - if ((attribute & USET_CASE_INSENSITIVE) && foldSet.hasStrings()) { - foldSet.strings->removeAllElements(); - } + switch (attribute & USET_CASE_MASK) { + case 0: + break; + case USET_CASE_INSENSITIVE: + closeOverCaseInsensitive(/* simple= */ false); + break; + case USET_ADD_CASE_MAPPINGS: + closeOverAddCaseMappings(); + break; + case USET_SIMPLE_CASE_INSENSITIVE: + closeOverCaseInsensitive(/* simple= */ true); + break; + default: + // bad option (unreachable) + break; + } + return *this; +} + +void UnicodeSet::closeOverCaseInsensitive(bool simple) { + // Start with input set to guarantee inclusion. + UnicodeSet foldSet(*this); + // Full case mappings closure: + // Remove strings because the strings will actually be reduced (folded); + // therefore, start with no strings and add only those needed. + // Do this before processing code points, because they may add strings. + if (!simple && foldSet.hasStrings()) { + foldSet.strings->removeAllElements(); + } + + USetAdder sa = { + foldSet.toUSet(), + _set_add, + _set_addRange, + _set_addString, + nullptr, // don't need remove() + nullptr // don't need removeRange() + }; + + UnicodeSet subset(0, 0x10ffff); + const UnicodeSet &codePoints = maybeOnlyCaseSensitive(*this, subset); + + // Iterate over the ranges of single code points. Nested loop for each code point. + int32_t n = codePoints.getRangeCount(); + + for (int32_t i=0; isize(); ++j) { + const UnicodeString *pStr = (const UnicodeString *) strings->elementAt(j); + if (simple) { + if (scfString(*pStr, str)) { + foldSet.remove(*pStr).add(str); + } + } else { + str = *pStr; + str.foldCase(); + if(!ucase_addStringCaseClosure(str.getBuffer(), str.length(), &sa)) { + foldSet.add(str); // does not map to code points: add the folded string itself } } - if (hasStrings()) { - if (attribute & USET_CASE_INSENSITIVE) { - for (int32_t j=0; jsize(); ++j) { - str = *(const UnicodeString *) strings->elementAt(j); - str.foldCase(); - if(!ucase_addStringCaseClosure(str.getBuffer(), str.length(), &sa)) { - foldSet.add(str); // does not map to code points: add the folded string itself - } - } - } else { - Locale root(""); -#if !UCONFIG_NO_BREAK_ITERATION - UErrorCode status = U_ZERO_ERROR; - BreakIterator *bi = BreakIterator::createWordInstance(root, status); - if (U_SUCCESS(status)) { -#endif - const UnicodeString *pStr; + } + } + *this = foldSet; +} + +void UnicodeSet::closeOverAddCaseMappings() { + // Start with input set to guarantee inclusion. + UnicodeSet foldSet(*this); - for (int32_t j=0; jsize(); ++j) { - pStr = (const UnicodeString *) strings->elementAt(j); - (str = *pStr).toLower(root); - foldSet.add(str); + UnicodeSet subset(0, 0x10ffff); + const UnicodeSet &codePoints = maybeOnlyCaseSensitive(*this, subset); + + // Iterate over the ranges of single code points. Nested loop for each code point. + int32_t n = codePoints.getRangeCount(); + UChar32 result; + const char16_t *full; + UnicodeString str; + + for (int32_t i=0; isize(); ++j) { + const UnicodeString *pStr = (const UnicodeString *) strings->elementAt(j); + (str = *pStr).toLower(root); + foldSet.add(str); #if !UCONFIG_NO_BREAK_ITERATION - } - delete bi; + (str = *pStr).toTitle(bi, root); + foldSet.add(str); #endif - } + (str = *pStr).toUpper(root); + foldSet.add(str); + (str = *pStr).foldCase(); + foldSet.add(str); } - *this = foldSet; +#if !UCONFIG_NO_BREAK_ITERATION } + delete bi; +#endif } - return *this; + *this = foldSet; } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/uniset_props.cpp b/src/duckdb/extension/icu/third_party/icu/common/uniset_props.cpp index 16c84029b..b3dbdf93c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uniset_props.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uniset_props.cpp @@ -47,45 +47,14 @@ U_NAMESPACE_USE -// Define UChar constants using hex for EBCDIC compatibility -// Used #define to reduce private static exports and memory access time. -#define uniset_props_SET_OPEN ((UChar)0x005B) /*[*/ -#define uniset_props_SET_CLOSE ((UChar)0x005D) /*]*/ -#define uniset_props_HYPHEN ((UChar)0x002D) /*-*/ -#define uniset_props_COMPLEMENT ((UChar)0x005E) /*^*/ -#define uniset_props_COLON ((UChar)0x003A) /*:*/ -#define uniset_props_BACKSLASH ((UChar)0x005C) /*\*/ -#define uniset_props_INTERSECTION ((UChar)0x0026) /*&*/ -#define uniset_props_UPPER_U ((UChar)0x0055) /*U*/ -#define uniset_props_LOWER_U ((UChar)0x0075) /*u*/ -#define uniset_props_OPEN_BRACE ((UChar)123) /*{*/ -#define uniset_props_CLOSE_BRACE ((UChar)125) /*}*/ -#define uniset_props_UPPER_P ((UChar)0x0050) /*P*/ -#define uniset_props_LOWER_P ((UChar)0x0070) /*p*/ -#define uniset_props_UPPER_N ((UChar)78) /*N*/ -#define uniset_props_EQUALS ((UChar)0x003D) /*=*/ - -//static const UChar POSIX_OPEN[] = { uniset_props_SET_OPEN,uniset_props_COLON,0 }; // "[:" -static const UChar uniset_props_POSIX_CLOSE[] = { uniset_props_COLON,uniset_props_SET_CLOSE,0 }; // ":]" -//static const UChar PERL_OPEN[] = { uniset_props_BACKSLASH,uniset_props_LOWER_P,0 }; // "\\p" -//static const UChar PERL_CLOSE[] = { uniset_props_CLOSE_BRACE,0 }; // "}" -//static const UChar NAME_OPEN[] = { uniset_props_BACKSLASH,uniset_props_UPPER_N,0 }; // "\\N" -static const UChar uniset_props_HYPHEN_RIGHT_BRACE[] = {uniset_props_HYPHEN,uniset_props_SET_CLOSE,0}; /*-]*/ - // Special property set IDs -static const char uniset_props_ANY[] = "uniset_props_ANY"; // [\u0000-\U0010FFFF] -static const char uniset_props_ASCII[] = "uniset_props_ASCII"; // [\u0000-\u007F] -static const char uniset_props_ASSIGNED[] = "Assigned"; // [:^Cn:] +static const char ANY[] = "ANY"; // [\u0000-\U0010FFFF] +static const char ASCII[] = "ASCII"; // [\u0000-\u007F] +static const char ASSIGNED[] = "Assigned"; // [:^Cn:] // Unicode name property alias -#define uniset_props_NAME_PROP "na" -#define uniset_props_NAME_PROP_LENGTH 2 - -/** - * Delimiter string used in patterns to close a category reference: - * ":]". Example: "[:Lu:]". - */ -//static const UChar CATEGORY_CLOSE[] = {uniset_props_COLON, uniset_props_SET_CLOSE, 0x0000}; /* ":]" */ +#define NAME_PROP "na" +#define NAME_PROP_LENGTH 2 // Cached sets ------------------------------------------------------------- *** @@ -93,16 +62,16 @@ U_CDECL_BEGIN static UBool U_CALLCONV uset_cleanup(); static UnicodeSet *uni32Singleton; -static icu::UInitOnce uni32InitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce uni32InitOnce {}; /** * Cleanup function for UnicodeSet */ -static UBool U_CALLCONV uset_cleanup(void) { +static UBool U_CALLCONV uset_cleanup() { delete uni32Singleton; - uni32Singleton = NULL; + uni32Singleton = nullptr; uni32InitOnce.reset(); - return TRUE; + return true; } U_CDECL_END @@ -113,9 +82,9 @@ namespace { // Cache some sets for other services -------------------------------------- *** void U_CALLCONV createUni32Set(UErrorCode &errorCode) { - U_ASSERT(uni32Singleton == NULL); + U_ASSERT(uni32Singleton == nullptr); uni32Singleton = new UnicodeSet(UNICODE_STRING_SIMPLE("[:age=3.2:]"), errorCode); - if(uni32Singleton==NULL) { + if(uni32Singleton==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; } else { uni32Singleton->freeze(); @@ -123,6 +92,13 @@ void U_CALLCONV createUni32Set(UErrorCode &errorCode) { ucln_common_registerCleanup(UCLN_COMMON_USET, uset_cleanup); } + +U_CFUNC UnicodeSet * +uniset_getUnicode32Instance(UErrorCode &errorCode) { + umtx_initOnce(uni32InitOnce, &createUni32Set, errorCode); + return uni32Singleton; +} + // helper functions for matching of pattern syntax pieces ------------------ *** // these functions are parallel to the PERL_OPEN etc. strings above @@ -132,45 +108,37 @@ void U_CALLCONV createUni32Set(UErrorCode &errorCode) { static inline UBool isPerlOpen(const UnicodeString &pattern, int32_t pos) { - UChar c; - return pattern.charAt(pos)==uniset_props_BACKSLASH && ((c=pattern.charAt(pos+1))==uniset_props_LOWER_P || c==uniset_props_UPPER_P); + char16_t c; + return pattern.charAt(pos)==u'\\' && ((c=pattern.charAt(pos+1))==u'p' || c==u'P'); } /*static inline UBool isPerlClose(const UnicodeString &pattern, int32_t pos) { - return pattern.charAt(pos)==uniset_props_CLOSE_BRACE; + return pattern.charAt(pos)==u'}'; }*/ static inline UBool isNameOpen(const UnicodeString &pattern, int32_t pos) { - return pattern.charAt(pos)==uniset_props_BACKSLASH && pattern.charAt(pos+1)==uniset_props_UPPER_N; + return pattern.charAt(pos)==u'\\' && pattern.charAt(pos+1)==u'N'; } static inline UBool isPOSIXOpen(const UnicodeString &pattern, int32_t pos) { - return pattern.charAt(pos)==uniset_props_SET_OPEN && pattern.charAt(pos+1)==uniset_props_COLON; + return pattern.charAt(pos)==u'[' && pattern.charAt(pos+1)==u':'; } /*static inline UBool isPOSIXClose(const UnicodeString &pattern, int32_t pos) { - return pattern.charAt(pos)==uniset_props_COLON && pattern.charAt(pos+1)==uniset_props_SET_CLOSE; + return pattern.charAt(pos)==u':' && pattern.charAt(pos+1)==u']'; }*/ // TODO memory debugging provided inside uniset.cpp // could be made available here but probably obsolete with use of modern // memory leak checker tools -#ifndef _dbgct #define _dbgct(me) -#endif } // namespace -U_CFUNC UnicodeSet * -uniset_getUnicode32Instance(UErrorCode &errorCode) { - umtx_initOnce(uni32InitOnce, &createUni32Set, errorCode); - return uni32Singleton; -} - //---------------------------------------------------------------- // Constructors &c //---------------------------------------------------------------- @@ -194,15 +162,15 @@ UnicodeSet::UnicodeSet(const UnicodeString& pattern, UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern, UErrorCode& status) { // Equivalent to - // return applyPattern(pattern, USET_IGNORE_SPACE, NULL, status); + // return applyPattern(pattern, USET_IGNORE_SPACE, nullptr, status); // but without dependency on closeOver(). ParsePosition pos(0); - applyPatternIgnoreSpace(pattern, pos, NULL, status); + applyPatternIgnoreSpace(pattern, pos, nullptr, status); if (U_FAILURE(status)) return *this; int32_t i = pos.getIndex(); // Skip over trailing whitespace - ICU_Utility::skipWhitespace(pattern, i, TRUE); + ICU_Utility::skipWhitespace(pattern, i, true); if (i != pattern.length()) { status = U_ILLEGAL_ARGUMENT_ERROR; } @@ -225,7 +193,7 @@ UnicodeSet::applyPatternIgnoreSpace(const UnicodeString& pattern, // _applyPattern calls add() etc., which set pat to empty. UnicodeString rebuiltPat; RuleCharacterIterator chars(pattern, symbols, pos); - applyPattern(chars, symbols, rebuiltPat, USET_IGNORE_SPACE, NULL, 0, status); + applyPattern(chars, symbols, rebuiltPat, USET_IGNORE_SPACE, nullptr, 0, status); if (U_FAILURE(status)) return; if (chars.inVariable()) { // syntaxError(chars, "Extra chars in variable value"); @@ -241,7 +209,7 @@ UnicodeSet::applyPatternIgnoreSpace(const UnicodeString& pattern, */ UBool UnicodeSet::resemblesPattern(const UnicodeString& pattern, int32_t pos) { return ((pos+1) < pattern.length() && - pattern.charAt(pos) == (UChar)91/*[*/) || + pattern.charAt(pos) == (char16_t)91/*[*/) || resemblesPropertyPattern(pattern, pos); } @@ -311,7 +279,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, } UnicodeString patLocal, buf; - UBool usePat = FALSE; + UBool usePat = false; UnicodeSetPointer scratch; RuleCharacterIterator::Pos backup; @@ -319,20 +287,19 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, // lastItem: 0=none, 1=char, 2=set int8_t lastItem = 0, mode = 0; UChar32 lastChar = 0; - UChar op = 0; + char16_t op = 0; - UBool invert = FALSE; + UBool invert = false; clear(); while (mode != 2 && !chars.atEnd()) { U_ASSERT((lastItem == 0 && op == 0) || - (lastItem == 1 && (op == 0 || op == uniset_props_HYPHEN /*'-'*/)) || - (lastItem == 2 && (op == 0 || op == uniset_props_HYPHEN /*'-'*/ || - op == uniset_props_INTERSECTION /*'&'*/))); + (lastItem == 1 && (op == 0 || op == u'-')) || + (lastItem == 2 && (op == 0 || op == u'-' || op == u'&'))); UChar32 c = 0; - UBool literal = FALSE; + UBool literal = false; UnicodeSet* nested = 0; // alias - do not delete // -------- Check for property pattern @@ -357,28 +324,28 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, c = chars.next(opts, literal, ec); if (U_FAILURE(ec)) return; - if (c == 0x5B /*'['*/ && !literal) { + if (c == u'[' && !literal) { if (mode == 1) { chars.setPos(backup); // backup setMode = 1; } else { // Handle opening '[' delimiter mode = 1; - patLocal.append((UChar) 0x5B /*'['*/); + patLocal.append(u'['); chars.getPos(backup); // prepare to backup - c = chars.next(opts, literal, ec); + c = chars.next(opts, literal, ec); if (U_FAILURE(ec)) return; - if (c == 0x5E /*'^'*/ && !literal) { - invert = TRUE; - patLocal.append((UChar) 0x5E /*'^'*/); + if (c == u'^' && !literal) { + invert = true; + patLocal.append(u'^'); chars.getPos(backup); // prepare to backup c = chars.next(opts, literal, ec); if (U_FAILURE(ec)) return; } // Fall through to handle special leading '-'; // otherwise restart loop for nested [], \p{}, etc. - if (c == uniset_props_HYPHEN /*'-'*/) { - literal = TRUE; + if (c == u'-') { + literal = true; // Fall through to handle literal '-' below } else { chars.setPos(backup); // backup @@ -389,7 +356,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, const UnicodeFunctor *m = symbols->lookupMatcher(c); if (m != 0) { const UnicodeSet *ms = dynamic_cast(m); - if (ms == NULL) { + if (ms == nullptr) { ec = U_MALFORMED_SET; return; } @@ -414,12 +381,12 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, return; } add(lastChar, lastChar); - _appendToPat(patLocal, lastChar, FALSE); + _appendToPat(patLocal, lastChar, false); lastItem = 0; op = 0; } - if (op == uniset_props_HYPHEN /*'-'*/ || op == uniset_props_INTERSECTION /*'&'*/) { + if (op == u'-' || op == u'&') { patLocal.append(op); } @@ -441,11 +408,11 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, if (U_FAILURE(ec)) return; break; case 3: // `nested' already parsed - nested->_toPattern(patLocal, FALSE); + nested->_toPattern(patLocal, false); break; } - usePat = TRUE; + usePat = true; if (mode == 0) { // Entire pattern is a category; leave parse loop @@ -455,10 +422,10 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, } switch (op) { - case uniset_props_HYPHEN: /*'-'*/ + case u'-': removeAll(*nested); break; - case uniset_props_INTERSECTION: /*'&'*/ + case u'&': retainAll(*nested); break; case 0: @@ -484,35 +451,35 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, if (!literal) { switch (c) { - case 0x5D /*']'*/: + case u']': if (lastItem == 1) { add(lastChar, lastChar); - _appendToPat(patLocal, lastChar, FALSE); + _appendToPat(patLocal, lastChar, false); } // Treat final trailing '-' as a literal - if (op == uniset_props_HYPHEN /*'-'*/) { + if (op == u'-') { add(op, op); patLocal.append(op); - } else if (op == uniset_props_INTERSECTION /*'&'*/) { + } else if (op == u'&') { // syntaxError(chars, "Trailing '&'"); ec = U_MALFORMED_SET; return; } - patLocal.append((UChar) 0x5D /*']'*/); + patLocal.append(u']'); mode = 2; continue; - case uniset_props_HYPHEN /*'-'*/: + case u'-': if (op == 0) { if (lastItem != 0) { - op = (UChar) c; + op = (char16_t) c; continue; } else { // Treat final trailing '-' as a literal add(c, c); c = chars.next(opts, literal, ec); if (U_FAILURE(ec)) return; - if (c == 0x5D /*']'*/ && !literal) { - patLocal.append(uniset_props_HYPHEN_RIGHT_BRACE, 2); + if (c == u']' && !literal) { + patLocal.append(u"-]", 2); mode = 2; continue; } @@ -521,19 +488,19 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, // syntaxError(chars, "'-' not after char or set"); ec = U_MALFORMED_SET; return; - case uniset_props_INTERSECTION /*'&'*/: + case u'&': if (lastItem == 2 && op == 0) { - op = (UChar) c; + op = (char16_t) c; continue; } // syntaxError(chars, "'&' not after set"); ec = U_MALFORMED_SET; return; - case 0x5E /*'^'*/: + case u'^': // syntaxError(chars, "'^' not after '['"); ec = U_MALFORMED_SET; return; - case 0x7B /*'{'*/: + case u'{': if (op != 0) { // syntaxError(chars, "Missing operand after operator"); ec = U_MALFORMED_SET; @@ -541,22 +508,22 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, } if (lastItem == 1) { add(lastChar, lastChar); - _appendToPat(patLocal, lastChar, FALSE); + _appendToPat(patLocal, lastChar, false); } lastItem = 0; buf.truncate(0); { - UBool ok = FALSE; + UBool ok = false; while (!chars.atEnd()) { c = chars.next(opts, literal, ec); if (U_FAILURE(ec)) return; - if (c == 0x7D /*'}'*/ && !literal) { - ok = TRUE; + if (c == u'}' && !literal) { + ok = true; break; } buf.append(c); } - if (buf.length() < 1 || !ok) { + if (!ok) { // syntaxError(chars, "Invalid multicharacter string"); ec = U_MALFORMED_SET; return; @@ -566,9 +533,9 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, // we don't need to drop through to the further // processing add(buf); - patLocal.append((UChar) 0x7B /*'{'*/); - _appendToPat(patLocal, buf, FALSE); - patLocal.append((UChar) 0x7D /*'}'*/); + patLocal.append(u'{'); + _appendToPat(patLocal, buf, false); + patLocal.append(u'}'); continue; case SymbolTable::SYMBOL_REF: // symbols nosymbols @@ -581,7 +548,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, chars.getPos(backup); c = chars.next(opts, literal, ec); if (U_FAILURE(ec)) return; - UBool anchor = (c == 0x5D /*']'*/ && !literal); + UBool anchor = (c == u']' && !literal); if (symbols == 0 && !anchor) { c = SymbolTable::SYMBOL_REF; chars.setPos(backup); @@ -590,12 +557,12 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, if (anchor && op == 0) { if (lastItem == 1) { add(lastChar, lastChar); - _appendToPat(patLocal, lastChar, FALSE); + _appendToPat(patLocal, lastChar, false); } add(U_ETHER); - usePat = TRUE; - patLocal.append((UChar) SymbolTable::SYMBOL_REF); - patLocal.append((UChar) 0x5D /*']'*/); + usePat = true; + patLocal.append((char16_t) SymbolTable::SYMBOL_REF); + patLocal.append(u']'); mode = 2; continue; } @@ -618,7 +585,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, lastChar = c; break; case 1: - if (op == uniset_props_HYPHEN /*'-'*/) { + if (op == u'-') { if (lastChar >= c) { // Don't allow redundant (a-a) or empty (b-a) ranges; // these are most likely typos. @@ -627,14 +594,14 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, return; } add(lastChar, c); - _appendToPat(patLocal, lastChar, FALSE); + _appendToPat(patLocal, lastChar, false); patLocal.append(op); - _appendToPat(patLocal, c, FALSE); + _appendToPat(patLocal, c, false); lastItem = 0; op = 0; } else { add(lastChar, lastChar); - _appendToPat(patLocal, lastChar, FALSE); + _appendToPat(patLocal, lastChar, false); lastChar = c; } break; @@ -661,17 +628,14 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, /** * Handle global flags (invert, case insensitivity). If this * pattern should be compiled case-insensitive, then we need - * to close over case BEFORE uniset_props_COMPLEMENTING. This makes + * to close over case BEFORE COMPLEMENTING. This makes * patterns like /[^abc]/i work. */ - if ((options & USET_CASE_INSENSITIVE) != 0) { - (this->*caseClosure)(USET_CASE_INSENSITIVE); - } - else if ((options & USET_ADD_CASE_MAPPINGS) != 0) { - (this->*caseClosure)(USET_ADD_CASE_MAPPINGS); + if ((options & USET_CASE_MASK) != 0) { + (this->*caseClosure)(options); } if (invert) { - complement(); + complement().removeAllStrings(); // code point complement } // Use the rebuilt pattern (patLocal) only if necessary. Prefer the @@ -679,7 +643,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars, if (usePat) { rebuiltPat.append(patLocal); } else { - _generatePattern(rebuiltPat, FALSE); + _generatePattern(rebuiltPat, false); } if (isBogus() && U_SUCCESS(ec)) { // We likely ran out of memory. AHHH! @@ -789,12 +753,12 @@ static UBool mungeCharName(char* dst, const char* src, int32_t dstCapacity) { if (ch == ' ' && (j==0 || (j>0 && dst[j-1]==' '))) { continue; } - if (j >= dstCapacity) return FALSE; + if (j >= dstCapacity) return false; dst[j++] = ch; } if (j > 0 && dst[j-1] == ' ') --j; dst[j] = 0; - return TRUE; + return true; } } // namespace @@ -822,9 +786,9 @@ UnicodeSet::applyIntPropertyValue(UProperty prop, int32_t value, UErrorCode& ec) if (value == 0 || value == 1) { const USet *set = u_getBinaryPropertySet(prop, &ec); if (U_FAILURE(ec)) { return *this; } - copyFrom(*UnicodeSet::fromUSet(set), TRUE); + copyFrom(*UnicodeSet::fromUSet(set), true); if (value == 0) { - complement(); + complement().removeAllStrings(); // code point complement } } else { clear(); @@ -863,7 +827,7 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop, UProperty p; int32_t v; - UBool invert = FALSE; + UBool invert = false; if (value.length() > 0) { p = u_getPropertyEnum(pname.data()); @@ -971,17 +935,17 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop, p = u_getPropertyEnum(pname.data()); if (p >= UCHAR_BINARY_START && p < UCHAR_BINARY_LIMIT) { v = 1; - } else if (0 == uprv_comparePropertyNames(uniset_props_ANY, pname.data())) { + } else if (0 == uprv_comparePropertyNames(ANY, pname.data())) { set(MIN_VALUE, MAX_VALUE); return *this; - } else if (0 == uprv_comparePropertyNames(uniset_props_ASCII, pname.data())) { + } else if (0 == uprv_comparePropertyNames(ASCII, pname.data())) { set(0, 0x7F); return *this; - } else if (0 == uprv_comparePropertyNames(uniset_props_ASSIGNED, pname.data())) { + } else if (0 == uprv_comparePropertyNames(ASSIGNED, pname.data())) { // [:Assigned:]=[:^Cn:] p = UCHAR_GENERAL_CATEGORY_MASK; v = U_GC_CN_MASK; - invert = TRUE; + invert = true; } else { FAIL(ec); } @@ -991,7 +955,7 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop, applyIntPropertyValue(p, v, ec); if(invert) { - complement(); + complement().removeAllStrings(); // code point complement } if (isBogus() && U_SUCCESS(ec)) { @@ -1013,7 +977,7 @@ UBool UnicodeSet::resemblesPropertyPattern(const UnicodeString& pattern, int32_t pos) { // Patterns are at least 5 characters long if ((pos+5) > pattern.length()) { - return FALSE; + return false; } // Look for an opening [:, [:^, \p, or \P @@ -1030,18 +994,18 @@ UBool UnicodeSet::resemblesPropertyPattern(const UnicodeString& pattern, */ UBool UnicodeSet::resemblesPropertyPattern(RuleCharacterIterator& chars, int32_t iterOpts) { - // NOTE: literal will always be FALSE, because we don't parse escapes. - UBool result = FALSE, literal; + // NOTE: literal will always be false, because we don't parse escapes. + UBool result = false, literal; UErrorCode ec = U_ZERO_ERROR; iterOpts &= ~RuleCharacterIterator::PARSE_ESCAPES; RuleCharacterIterator::Pos pos; chars.getPos(pos); UChar32 c = chars.next(iterOpts, literal, ec); - if (c == 0x5B /*'['*/ || c == 0x5C /*'\\'*/) { + if (c == u'[' || c == u'\\') { UChar32 d = chars.next(iterOpts & ~RuleCharacterIterator::SKIP_WHITESPACE, literal, ec); - result = (c == 0x5B /*'['*/) ? (d == 0x3A /*':'*/) : - (d == 0x4E /*'N'*/ || d == 0x70 /*'p'*/ || d == 0x50 /*'P'*/); + result = (c == u'[') ? (d == u':') : + (d == u'N' || d == u'p' || d == u'P'); } chars.setPos(pos); return result && U_SUCCESS(ec); @@ -1055,9 +1019,9 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern, UErrorCode &ec) { int32_t pos = ppos.getIndex(); - UBool posix = FALSE; // true for [:pat:], false for \p{pat} \P{pat} \N{pat} - UBool isName = FALSE; // true for \N{pat}, o/w false - UBool invert = FALSE; + UBool posix = false; // true for [:pat:], false for \p{pat} \P{pat} \N{pat} + UBool isName = false; // true for \N{pat}, o/w false + UBool invert = false; if (U_FAILURE(ec)) return *this; @@ -1069,20 +1033,20 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern, // On entry, ppos should point to one of the following locations: // Look for an opening [:, [:^, \p, or \P if (isPOSIXOpen(pattern, pos)) { - posix = TRUE; + posix = true; pos += 2; pos = ICU_Utility::skipWhitespace(pattern, pos); - if (pos < pattern.length() && pattern.charAt(pos) == uniset_props_COMPLEMENT) { + if (pos < pattern.length() && pattern.charAt(pos) == u'^') { ++pos; - invert = TRUE; + invert = true; } } else if (isPerlOpen(pattern, pos) || isNameOpen(pattern, pos)) { - UChar c = pattern.charAt(pos+1); - invert = (c == uniset_props_UPPER_P); - isName = (c == uniset_props_UPPER_N); + char16_t c = pattern.charAt(pos+1); + invert = (c == u'P'); + isName = (c == u'N'); pos += 2; pos = ICU_Utility::skipWhitespace(pattern, pos); - if (pos == pattern.length() || pattern.charAt(pos++) != uniset_props_OPEN_BRACE) { + if (pos == pattern.length() || pattern.charAt(pos++) != u'{') { // Syntax error; "\p" or "\P" not followed by "{" FAIL(ec); } @@ -1094,9 +1058,9 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern, // Look for the matching close delimiter, either :] or } int32_t close; if (posix) { - close = pattern.indexOf(uniset_props_POSIX_CLOSE, 2, pos); + close = pattern.indexOf(u":]", 2, pos); } else { - close = pattern.indexOf(uniset_props_CLOSE_BRACE, pos); + close = pattern.indexOf(u'}', pos); } if (close < 0) { // Syntax error; close delimiter missing @@ -1106,7 +1070,7 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern, // Look for an '=' sign. If this is present, we will parse a // medium \p{gc=Cf} or long \p{GeneralCategory=Format} // pattern. - int32_t equals = pattern.indexOf(uniset_props_EQUALS, pos); + int32_t equals = pattern.indexOf(u'=', pos); UnicodeString propName, valueName; if (equals >= 0 && equals < close && !isName) { // Equals seen; parse medium/long pattern @@ -1117,16 +1081,16 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern, else { // Handle case where no '=' is seen, and \N{} pattern.extractBetween(pos, close, propName); - + // Handle \N{name} if (isName) { // This is a little inefficient since it means we have to - // parse uniset_props_NAME_PROP back to UCHAR_NAME even though we already + // parse NAME_PROP back to UCHAR_NAME even though we already // know it's UCHAR_NAME. If we refactor the API to // support args of (UProperty, char*) then we can remove - // uniset_props_NAME_PROP and make this a little more efficient. + // NAME_PROP and make this a little more efficient. valueName = propName; - propName = UnicodeString(uniset_props_NAME_PROP, uniset_props_NAME_PROP_LENGTH, US_INV); + propName = UnicodeString(NAME_PROP, NAME_PROP_LENGTH, US_INV); } } @@ -1134,7 +1098,7 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern, if (U_SUCCESS(ec)) { if (invert) { - complement(); + complement().removeAllStrings(); // code point complement } // Move to the limit position after the close delimiter if the diff --git a/src/duckdb/extension/icu/third_party/icu/common/unisetspan.cpp b/src/duckdb/extension/icu/third_party/icu/common/unisetspan.cpp index 68e44d91e..b7256d8fd 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unisetspan.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unisetspan.cpp @@ -70,7 +70,7 @@ class OffsetList { // Only ever stack-allocated, does not need to inherit UMemo capacity=(int32_t)sizeof(staticList); } else { UBool *l=(UBool *)uprv_malloc(maxLength); - if(l!=NULL) { + if(l!=nullptr) { list=l; capacity=maxLength; } @@ -98,7 +98,7 @@ class OffsetList { // Only ever stack-allocated, does not need to inherit UMemo i-=capacity; } if(list[i]) { - list[i]=FALSE; + list[i]=false; --length; } start=i; @@ -111,7 +111,7 @@ class OffsetList { // Only ever stack-allocated, does not need to inherit UMemo if(i>=capacity) { i-=capacity; } - list[i]=TRUE; + list[i]=true; ++length; } @@ -132,7 +132,7 @@ class OffsetList { // Only ever stack-allocated, does not need to inherit UMemo int32_t i=start, result; while(++imaxLength16) { maxLength16=length16; @@ -280,8 +283,8 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set, utf8Lengths=staticLengths; } else { utf8Lengths=(int32_t *)uprv_malloc(allocSize); - if(utf8Lengths==NULL) { - maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return FALSE. + if(utf8Lengths==nullptr) { + maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return false. return; // Out of memory. } } @@ -309,10 +312,10 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set, for(i=0; i0) { // Relevant string. if(which&UTF16) { if(which&CONTAINED) { if(which&FWD) { @@ -362,7 +365,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set, addToSpanNotSet(c); } } - } else { // Irrelevant string. + } else { // Irrelevant string. (Also the empty string.) if(which&UTF8) { if(which&CONTAINED) { // Only necessary for LONGEST_MATCH. uint8_t *s8=utf8+utf8Count; @@ -392,11 +395,11 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set, // Copy constructor. Assumes which==ALL for a frozen set. UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStringSpan, const UVector &newParentSetStrings) - : spanSet(otherStringSpan.spanSet), pSpanNotSet(NULL), strings(newParentSetStrings), - utf8Lengths(NULL), spanLengths(NULL), utf8(NULL), + : spanSet(otherStringSpan.spanSet), pSpanNotSet(nullptr), strings(newParentSetStrings), + utf8Lengths(nullptr), spanLengths(nullptr), utf8(nullptr), utf8Length(otherStringSpan.utf8Length), maxLength16(otherStringSpan.maxLength16), maxLength8(otherStringSpan.maxLength8), - all(TRUE) { + all(true) { if(otherStringSpan.pSpanNotSet==&otherStringSpan.spanSet) { pSpanNotSet=&spanSet; } else { @@ -411,8 +414,8 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri utf8Lengths=staticLengths; } else { utf8Lengths=(int32_t *)uprv_malloc(allocSize); - if(utf8Lengths==NULL) { - maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return FALSE. + if(utf8Lengths==nullptr) { + maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return false. return; // Out of memory. } } @@ -423,21 +426,21 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri } UnicodeSetStringSpan::~UnicodeSetStringSpan() { - if(pSpanNotSet!=NULL && pSpanNotSet!=&spanSet) { + if(pSpanNotSet!=nullptr && pSpanNotSet!=&spanSet) { delete pSpanNotSet; } - if(utf8Lengths!=NULL && utf8Lengths!=staticLengths) { + if(utf8Lengths!=nullptr && utf8Lengths!=staticLengths) { uprv_free(utf8Lengths); } } void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) { - if(pSpanNotSet==NULL || pSpanNotSet==&spanSet) { + if(pSpanNotSet==nullptr || pSpanNotSet==&spanSet) { if(spanSet.contains(c)) { return; // Nothing to do. } UnicodeSet *newSet=spanSet.cloneAsThawed(); - if(newSet==NULL) { + if(newSet==nullptr) { return; // Out of memory. } else { pSpanNotSet=newSet; @@ -448,30 +451,30 @@ void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) { // Compare strings without any argument checks. Requires length>0. static inline UBool -matches16(const UChar *s, const UChar *t, int32_t length) { +matches16(const char16_t *s, const char16_t *t, int32_t length) { do { if(*s++!=*t++) { - return FALSE; + return false; } } while(--length>0); - return TRUE; + return true; } static inline UBool matches8(const uint8_t *s, const uint8_t *t, int32_t length) { do { if(*s++!=*t++) { - return FALSE; + return false; } } while(--length>0); - return TRUE; + return true; } // Compare 16-bit Unicode strings (which may be malformed UTF-16) // at code point boundaries. // That is, each edge of a match must not be in the middle of a surrogate pair. static inline UBool -matches16CPB(const UChar *s, int32_t start, int32_t limit, const UChar *t, int32_t length) { +matches16CPB(const char16_t *s, int32_t start, int32_t limit, const char16_t *t, int32_t length) { s+=start; limit-=start; return matches16(s, t, length) && @@ -482,8 +485,8 @@ matches16CPB(const UChar *s, int32_t start, int32_t limit, const UChar *t, int32 // Does the set contain the next code point? // If so, return its length; otherwise return its negative length. static inline int32_t -spanOne(const UnicodeSet &set, const UChar *s, int32_t length) { - UChar c=*s, c2; +spanOne(const UnicodeSet &set, const char16_t *s, int32_t length) { + char16_t c=*s, c2; if(c>=0xd800 && c<=0xdbff && length>=2 && U16_IS_TRAIL(c2=s[1])) { return set.contains(U16_GET_SUPPLEMENTARY(c, c2)) ? 2 : -2; } @@ -491,8 +494,8 @@ spanOne(const UnicodeSet &set, const UChar *s, int32_t length) { } static inline int32_t -spanOneBack(const UnicodeSet &set, const UChar *s, int32_t length) { - UChar c=s[length-1], c2; +spanOneBack(const UnicodeSet &set, const char16_t *s, int32_t length) { + char16_t c=s[length-1], c2; if(c>=0xdc00 && c<=0xdfff && length>=2 && U16_IS_LEAD(c2=s[length-2])) { return set.contains(U16_GET_SUPPLEMENTARY(c2, c)) ? 2 : -2; } @@ -631,7 +634,7 @@ spanOneBackUTF8(const UnicodeSet &set, const uint8_t *s, int32_t length) { * Stop if spanLength==0, otherwise continue the loop. */ -int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const { +int32_t UnicodeSetStringSpan::span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const { if(spanCondition==USET_SPAN_NOT_CONTAINED) { return spanNot(s, length); } @@ -653,11 +656,12 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi for(i=0; i0); // Try to match this string at pos-overlap..pos. if(overlap>=LONG_SPAN) { @@ -695,8 +699,11 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi // to find the match from the earliest start. const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i); - const UChar *s16=string.getBuffer(); + const char16_t *s16=string.getBuffer(); int32_t length16=string.length(); + if (length16==0) { + continue; // skip the empty string + } // Try to match this string at pos-overlap..pos. if(overlap>=LONG_SPAN) { @@ -791,7 +798,7 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi } } -int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const { +int32_t UnicodeSetStringSpan::spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const { if(spanCondition==USET_SPAN_NOT_CONTAINED) { return spanNotBack(s, length); } @@ -817,11 +824,12 @@ int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanC for(i=0; i0); // Try to match this string at pos-(length16-overlap)..pos-length16. if(overlap>=LONG_SPAN) { @@ -861,8 +869,11 @@ int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanC // to find the match from the latest end. const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i); - const UChar *s16=string.getBuffer(); + const char16_t *s16=string.getBuffer(); int32_t length16=string.length(); + if (length16==0) { + continue; // skip the empty string + } // Try to match this string at pos-(length16-overlap)..pos-length16. if(overlap>=LONG_SPAN) { @@ -1335,7 +1346,7 @@ int32_t UnicodeSetStringSpan::spanBackUTF8(const uint8_t *s, int32_t length, USe * when there is not actually a match for such a set string. */ -int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const { +int32_t UnicodeSetStringSpan::spanNot(const char16_t *s, int32_t length) const { int32_t pos=0, rest=length; int32_t i, stringsLength=strings.size(); do { @@ -1358,11 +1369,12 @@ int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const { // Try to match the strings at pos. for(i=0; i0); if(length16<=rest && matches16CPB(s, pos, length, s16, length16)) { return pos; // There is a set element at pos. } @@ -1377,7 +1389,7 @@ int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const { return length; // Reached the end of the string. } -int32_t UnicodeSetStringSpan::spanNotBack(const UChar *s, int32_t length) const { +int32_t UnicodeSetStringSpan::spanNotBack(const char16_t *s, int32_t length) const { int32_t pos=length; int32_t i, stringsLength=strings.size(); do { @@ -1401,11 +1413,12 @@ int32_t UnicodeSetStringSpan::spanNotBack(const UChar *s, int32_t length) const // it is easier and we only need to know whether the string is irrelevant // which is the same in either array. if(spanLengths[i]==ALL_CP_CONTAINED) { - continue; // Irrelevant string. + continue; // Irrelevant string. (Also the empty string.) } const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i); - const UChar *s16=string.getBuffer(); + const char16_t *s16=string.getBuffer(); int32_t length16=string.length(); + U_ASSERT(length>0); if(length16<=pos && matches16CPB(s, pos-length16, length, s16, length16)) { return pos; // There is a set element at pos. } diff --git a/src/duckdb/extension/icu/third_party/icu/common/unisetspan.h b/src/duckdb/extension/icu/third_party/icu/common/unisetspan.h index f1e78ff3e..f1dc8e6f7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unisetspan.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unisetspan.h @@ -65,8 +65,8 @@ class UnicodeSetStringSpan : public UMemory { /* * Do the strings need to be checked in span() etc.? - * @return TRUE if strings need to be checked (call span() here), - * FALSE if not (use a BMPSet for best performance). + * @return true if strings need to be checked (call span() here), + * false if not (use a BMPSet for best performance). */ inline UBool needsStringSpanUTF16(); inline UBool needsStringSpanUTF8(); @@ -74,9 +74,9 @@ class UnicodeSetStringSpan : public UMemory { // For fast UnicodeSet::contains(c). inline UBool contains(UChar32 c) const; - int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; + int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; - int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; + int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; int32_t spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const; @@ -95,8 +95,8 @@ class UnicodeSetStringSpan : public UMemory { // so that a character span ends before any string. void addToSpanNotSet(UChar32 c); - int32_t spanNot(const UChar *s, int32_t length) const; - int32_t spanNotBack(const UChar *s, int32_t length) const; + int32_t spanNot(const char16_t *s, int32_t length) const; + int32_t spanNotBack(const char16_t *s, int32_t length) const; int32_t spanNotUTF8(const uint8_t *s, int32_t length) const; int32_t spanNotBackUTF8(const uint8_t *s, int32_t length) const; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unistr.cpp b/src/duckdb/extension/icu/third_party/icu/common/unistr.cpp index bb9c31910..04f01cfa1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unistr.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unistr.cpp @@ -44,7 +44,7 @@ void print(const UnicodeString& s, const char *name) { - UChar c; + char16_t c; cout << name << ":|"; for(int i = 0; i < s.length(); ++i) { c = s[i]; @@ -57,11 +57,11 @@ print(const UnicodeString& s, } void -print(const UChar *s, +print(const char16_t *s, int32_t len, const char *name) { - UChar c; + char16_t c; cout << name << ":|"; for(int i = 0; i < len; ++i) { c = s[i]; @@ -80,17 +80,17 @@ print(const UChar *s, // need to copy areas that may overlap static inline void -us_arrayCopy(const UChar *src, int32_t srcStart, - UChar *dst, int32_t dstStart, int32_t count) +us_arrayCopy(const char16_t *src, int32_t srcStart, + char16_t *dst, int32_t dstStart, int32_t count) { if(count>0) { uprv_memmove(dst+dstStart, src+srcStart, (size_t)count*sizeof(*src)); } } -// u_unescapeAt() callback to get a UChar from a UnicodeString +// u_unescapeAt() callback to get a char16_t from a UnicodeString U_CDECL_BEGIN -static UChar U_CALLCONV +static char16_t U_CALLCONV UnicodeString_charAt(int32_t offset, void *context) { return ((icu::UnicodeString*) context)->charAt(offset); } @@ -159,8 +159,8 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) { capacity = length; } if(allocate(capacity)) { - UChar *array = getArrayStart(); - UChar unit = (UChar)c; + char16_t *array = getArrayStart(); + char16_t unit = (char16_t)c; for(int32_t i = 0; i < length; ++i) { array[i] = unit; } @@ -177,9 +177,9 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) { capacity = length; } if(allocate(capacity)) { - UChar *array = getArrayStart(); - UChar lead = U16_LEAD(c); - UChar trail = U16_TRAIL(c); + char16_t *array = getArrayStart(); + char16_t lead = U16_LEAD(c); + char16_t trail = U16_TRAIL(c); for(int32_t i = 0; i < length; i += 2) { array[i] = lead; array[i + 1] = trail; @@ -189,7 +189,7 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) { } } -UnicodeString::UnicodeString(UChar ch) { +UnicodeString::UnicodeString(char16_t ch) { fUnion.fFields.fLengthAndFlags = kLength1 | kShortString; fUnion.fStackFields.fBuffer[0] = ch; } @@ -197,7 +197,7 @@ UnicodeString::UnicodeString(UChar ch) { UnicodeString::UnicodeString(UChar32 ch) { fUnion.fFields.fLengthAndFlags = kShortString; int32_t i = 0; - UBool isError = FALSE; + UBool isError = false; U16_APPEND(fUnion.fStackFields.fBuffer, i, US_STACKBUF_SIZE, ch, isError); // We test isError so that the compiler does not complain that we don't. // If isError then i==0 which is what we want anyway. @@ -206,12 +206,12 @@ UnicodeString::UnicodeString(UChar32 ch) { } } -UnicodeString::UnicodeString(const UChar *text) { +UnicodeString::UnicodeString(const char16_t *text) { fUnion.fFields.fLengthAndFlags = kShortString; doAppend(text, 0, -1); } -UnicodeString::UnicodeString(const UChar *text, +UnicodeString::UnicodeString(const char16_t *text, int32_t textLength) { fUnion.fFields.fLengthAndFlags = kShortString; doAppend(text, 0, textLength); @@ -221,8 +221,8 @@ UnicodeString::UnicodeString(UBool isTerminated, ConstChar16Ptr textPtr, int32_t textLength) { fUnion.fFields.fLengthAndFlags = kReadonlyAlias; - const UChar *text = textPtr; - if(text == NULL) { + const char16_t *text = textPtr; + if(text == nullptr) { // treat as an empty string, do not alias setToEmpty(); } else if(textLength < -1 || @@ -235,16 +235,16 @@ UnicodeString::UnicodeString(UBool isTerminated, // text is terminated, or else it would have failed the above test textLength = u_strlen(text); } - setArray(const_cast(text), textLength, + setArray(const_cast(text), textLength, isTerminated ? textLength + 1 : textLength); } } -UnicodeString::UnicodeString(UChar *buff, +UnicodeString::UnicodeString(char16_t *buff, int32_t buffLength, int32_t buffCapacity) { fUnion.fFields.fLengthAndFlags = kWritableAlias; - if(buff == NULL) { + if(buff == nullptr) { // treat as an empty string, do not alias setToEmpty(); } else if(buffLength < -1 || buffCapacity < 0 || buffLength > buffCapacity) { @@ -252,7 +252,7 @@ UnicodeString::UnicodeString(UChar *buff, } else { if(buffLength == -1) { // fLength = u_strlen(buff); but do not look beyond buffCapacity - const UChar *p = buff, *limit = buff + buffCapacity; + const char16_t *p = buff, *limit = buff + buffCapacity; while(p != limit && *p != 0) { ++p; } @@ -264,13 +264,13 @@ UnicodeString::UnicodeString(UChar *buff, UnicodeString::UnicodeString(const char *src, int32_t length, EInvariant) { fUnion.fFields.fLengthAndFlags = kShortString; - if(src==NULL) { + if(src==nullptr) { // treat as an empty string } else { if(length<0) { length=(int32_t)uprv_strlen(src); } - if(cloneArrayIfNeeded(length, length, FALSE)) { + if(cloneArrayIfNeeded(length, length, false)) { u_charsToUChars(src, getArrayStart(), length); setLength(length); } else { @@ -308,8 +308,8 @@ UnicodeString::UnicodeString(const UnicodeString& that) { copyFrom(that); } -UnicodeString::UnicodeString(UnicodeString &&src) U_NOEXCEPT { - copyFieldsFrom(src, TRUE); +UnicodeString::UnicodeString(UnicodeString &&src) noexcept { + copyFieldsFrom(src, true); } UnicodeString::UnicodeString(const UnicodeString& that, @@ -328,13 +328,14 @@ UnicodeString::UnicodeString(const UnicodeString& that, // Replaceable base class clone() default implementation, does not clone Replaceable * Replaceable::clone() const { - return NULL; + return nullptr; } // UnicodeString overrides clone() with a real implementation UnicodeString * UnicodeString::clone() const { - return new UnicodeString(*this); + LocalPointer clonedString(new UnicodeString(*this)); + return clonedString.isValid() && !clonedString->isBogus() ? clonedString.orphan() : nullptr; } //======================================== @@ -369,7 +370,7 @@ UBool UnicodeString::allocate(int32_t capacity) { if(capacity <= US_STACKBUF_SIZE) { fUnion.fFields.fLengthAndFlags = kShortString; - return TRUE; + return true; } if(capacity <= kMaxCapacity) { ++capacity; // for the NUL @@ -379,22 +380,22 @@ UnicodeString::allocate(int32_t capacity) { // Round up to a multiple of 16. numBytes = (numBytes + 15) & ~15; int32_t *array = (int32_t *) uprv_malloc(numBytes); - if(array != NULL) { + if(array != nullptr) { // set initial refCount and point behind the refCount *array++ = 1; numBytes -= sizeof(int32_t); - // have fArray point to the first UChar - fUnion.fFields.fArray = (UChar *)array; + // have fArray point to the first char16_t + fUnion.fFields.fArray = (char16_t *)array; fUnion.fFields.fCapacity = (int32_t)(numBytes / U_SIZEOF_UCHAR); fUnion.fFields.fLengthAndFlags = kLongString; - return TRUE; + return true; } } fUnion.fFields.fLengthAndFlags = kIsBogus; fUnion.fFields.fArray = 0; fUnion.fFields.fCapacity = 0; - return FALSE; + return false; } //======================================== @@ -459,13 +460,13 @@ UnicodeString UnicodeString::fromUTF32(const UChar32 *utf32, int32_t length) { capacity = length + (length >> 4) + 4; } do { - UChar *utf16 = result.getBuffer(capacity); + char16_t *utf16 = result.getBuffer(capacity); int32_t length16; UErrorCode errorCode = U_ZERO_ERROR; u_strFromUTF32WithSub(utf16, result.getCapacity(), &length16, utf32, length, 0xfffd, // Substitution character. - NULL, // Don't care about number of substitutions. + nullptr, // Don't care about number of substitutions. &errorCode); result.releaseBuffer(length16); if(errorCode == U_BUFFER_OVERFLOW_ERROR) { @@ -475,7 +476,7 @@ UnicodeString UnicodeString::fromUTF32(const UChar32 *utf32, int32_t length) { result.setToBogus(); } break; - } while(TRUE); + } while(true); return result; } @@ -490,7 +491,7 @@ UnicodeString::operator=(const UnicodeString &src) { UnicodeString & UnicodeString::fastCopyFrom(const UnicodeString &src) { - return copyFrom(src, TRUE); + return copyFrom(src, true); } UnicodeString & @@ -526,7 +527,7 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) { case kLongString: // src uses a refCounted string buffer, use that buffer with refCount // src is const, use a cast - we don't actually change it - ((UnicodeString &)src).addRef(); + const_cast(src).addRef(); // copy all fields, share the reference-counted buffer fUnion.fFields.fArray = src.fUnion.fFields.fArray; fUnion.fFields.fCapacity = src.fUnion.fFields.fCapacity; @@ -571,16 +572,16 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) { return *this; } -UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT { +UnicodeString &UnicodeString::operator=(UnicodeString &&src) noexcept { // No explicit check for self move assignment, consistent with standard library. // Self move assignment causes no crash nor leak but might make the object bogus. releaseArray(); - copyFieldsFrom(src, TRUE); + copyFieldsFrom(src, true); return *this; } // Same as move assignment except without memory management. -void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT { +void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) noexcept { int16_t lengthAndFlags = fUnion.fFields.fLengthAndFlags = src.fUnion.fFields.fLengthAndFlags; if(lengthAndFlags & kUsingStackBuffer) { // Short string using the stack buffer, copy the contents. @@ -600,18 +601,18 @@ void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NO if(setSrcToBogus) { // Set src to bogus without releasing any memory. src.fUnion.fFields.fLengthAndFlags = kIsBogus; - src.fUnion.fFields.fArray = NULL; + src.fUnion.fFields.fArray = nullptr; src.fUnion.fFields.fCapacity = 0; } } } -void UnicodeString::swap(UnicodeString &other) U_NOEXCEPT { +void UnicodeString::swap(UnicodeString &other) noexcept { UnicodeString temp; // Empty short string: Known not to need releaseArray(). // Copy fields without resetting source values in between. - temp.copyFieldsFrom(*this, FALSE); - this->copyFieldsFrom(other, FALSE); - other.copyFieldsFrom(temp, FALSE); + temp.copyFieldsFrom(*this, false); + this->copyFieldsFrom(other, false); + other.copyFieldsFrom(temp, false); // Set temp to an empty string so that other's memory is not released twice. temp.fUnion.fFields.fLengthAndFlags = kShortString; } @@ -625,7 +626,7 @@ UnicodeString UnicodeString::unescape() const { if (result.isBogus()) { return result; } - const UChar *array = getBuffer(); + const char16_t *array = getBuffer(); int32_t len = length(); int32_t prev = 0; for (int32_t i=0;;) { @@ -661,10 +662,52 @@ UnicodeString::doEquals(const UnicodeString &text, int32_t len) const { return uprv_memcmp(getArrayStart(), text.getArrayStart(), len * U_SIZEOF_UCHAR) == 0; } +UBool +UnicodeString::doEqualsSubstring( int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const +{ + // compare illegal string values + if(isBogus()) { + return false; + } + + // pin indices to legal values + pinIndices(start, length); + + if(srcChars == nullptr) { + // treat const char16_t *srcChars==nullptr as an empty string + return length == 0 ? true : false; + } + + // get the correct pointer + const char16_t *chars = getArrayStart(); + + chars += start; + srcChars += srcStart; + + // get the srcLength if necessary + if(srcLength < 0) { + srcLength = u_strlen(srcChars + srcStart); + } + + if (length != srcLength) { + return false; + } + + if(length == 0 || chars == srcChars) { + return true; + } + + return u_memcmp(chars, srcChars, srcLength) == 0; +} + int8_t UnicodeString::doCompare( int32_t start, int32_t length, - const UChar *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { @@ -672,17 +715,17 @@ UnicodeString::doCompare( int32_t start, if(isBogus()) { return -1; } - + // pin indices to legal values pinIndices(start, length); - if(srcChars == NULL) { - // treat const UChar *srcChars==NULL as an empty string + if(srcChars == nullptr) { + // treat const char16_t *srcChars==nullptr as an empty string return length == 0 ? 0 : 1; } // get the correct pointer - const UChar *chars = getArrayStart(); + const char16_t *chars = getArrayStart(); chars += start; srcChars += srcStart; @@ -720,14 +763,14 @@ UnicodeString::doCompare( int32_t start, if(minLength > 0 && chars != srcChars) { int32_t result; -# if U_IS_BIG_ENDIAN +# if U_IS_BIG_ENDIAN // big-endian: byte comparison works - result = uprv_memcmp(chars, srcChars, minLength * sizeof(UChar)); + result = uprv_memcmp(chars, srcChars, minLength * sizeof(char16_t)); if(result != 0) { return (int8_t)(result >> 15 | 1); } # else - // little-endian: compare UChar units + // little-endian: compare char16_t units do { result = ((int32_t)*(chars++) - (int32_t)*(srcChars++)); if(result != 0) { @@ -743,12 +786,12 @@ UnicodeString::doCompare( int32_t start, int8_t UnicodeString::doCompareCodePointOrder(int32_t start, int32_t length, - const UChar *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { // compare illegal string values - // treat const UChar *srcChars==NULL as an empty string + // treat const char16_t *srcChars==nullptr as an empty string if(isBogus()) { return -1; } @@ -756,11 +799,11 @@ UnicodeString::doCompareCodePointOrder(int32_t start, // pin indices to legal values pinIndices(start, length); - if(srcChars == NULL) { + if(srcChars == nullptr) { srcStart = srcLength = 0; } - int32_t diff = uprv_strCompare(getArrayStart() + start, length, (srcChars!=NULL)?(srcChars + srcStart):NULL, srcLength, FALSE, TRUE); + int32_t diff = uprv_strCompare(getArrayStart() + start, length, (srcChars!=nullptr)?(srcChars + srcStart):nullptr, srcLength, false, true); /* translate the 32-bit result into an 8-bit one */ if(diff!=0) { return (int8_t)(diff >> 15 | 1); @@ -774,7 +817,7 @@ UnicodeString::getLength() const { return length(); } -UChar +char16_t UnicodeString::getCharAt(int32_t offset) const { return charAt(offset); } @@ -789,7 +832,7 @@ UnicodeString::char32At(int32_t offset) const { int32_t len = length(); if((uint32_t)offset < (uint32_t)len) { - const UChar *array = getArrayStart(); + const char16_t *array = getArrayStart(); UChar32 c; U16_GET(array, 0, offset, len, c); return c; @@ -801,7 +844,7 @@ UnicodeString::char32At(int32_t offset) const int32_t UnicodeString::getChar32Start(int32_t offset) const { if((uint32_t)offset < (uint32_t)length()) { - const UChar *array = getArrayStart(); + const char16_t *array = getArrayStart(); U16_SET_CP_START(array, 0, offset); return offset; } else { @@ -813,7 +856,7 @@ int32_t UnicodeString::getChar32Limit(int32_t offset) const { int32_t len = length(); if((uint32_t)offset < (uint32_t)len) { - const UChar *array = getArrayStart(); + const char16_t *array = getArrayStart(); U16_SET_CP_LIMIT(array, 0, offset, len); return offset; } else { @@ -824,14 +867,14 @@ UnicodeString::getChar32Limit(int32_t offset) const { int32_t UnicodeString::countChar32(int32_t start, int32_t length) const { pinIndices(start, length); - // if(isBogus()) then fArray==0 and start==0 - u_countChar32() checks for NULL + // if(isBogus()) then fArray==0 and start==0 - u_countChar32() checks for nullptr return u_countChar32(getArrayStart()+start, length); } UBool UnicodeString::hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const { pinIndices(start, length); - // if(isBogus()) then fArray==0 and start==0 - u_strHasMoreChar32Than() checks for NULL + // if(isBogus()) then fArray==0 and start==0 - u_strHasMoreChar32Than() checks for nullptr return u_strHasMoreChar32Than(getArrayStart()+start, length, number); } @@ -845,7 +888,7 @@ UnicodeString::moveIndex32(int32_t index, int32_t delta) const { index=len; } - const UChar *array = getArrayStart(); + const char16_t *array = getArrayStart(); if(delta>0) { U16_FWD_N(array, index, len, delta); } else { @@ -858,14 +901,14 @@ UnicodeString::moveIndex32(int32_t index, int32_t delta) const { void UnicodeString::doExtract(int32_t start, int32_t length, - UChar *dst, + char16_t *dst, int32_t dstStart) const { // pin indices to legal values pinIndices(start, length); // do not copy anything if we alias dst itself - const UChar *array = getArrayStart(); + const char16_t *array = getArrayStart(); if(array + start != dst + dstStart) { us_arrayCopy(array, start, dst, dstStart, length); } @@ -879,7 +922,7 @@ UnicodeString::extract(Char16Ptr dest, int32_t destCapacity, if(isBogus() || destCapacity<0 || (destCapacity>0 && dest==0)) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; } else { - const UChar *array = getArrayStart(); + const char16_t *array = getArrayStart(); if(len>0 && len<=destCapacity && array!=dest) { u_memcpy(dest, array, len); } @@ -898,7 +941,7 @@ UnicodeString::extract(int32_t start, enum EInvariant) const { // if the arguments are illegal, then do nothing - if(targetCapacity < 0 || (targetCapacity > 0 && target == NULL)) { + if(targetCapacity < 0 || (targetCapacity > 0 && target == nullptr)) { return 0; } @@ -915,12 +958,12 @@ UnicodeString::extract(int32_t start, UnicodeString UnicodeString::tempSubString(int32_t start, int32_t len) const { pinIndices(start, len); - const UChar *array = getBuffer(); // not getArrayStart() to check kIsBogus & kOpenGetBuffer - if(array==NULL) { - array=fUnion.fStackFields.fBuffer; // anything not NULL because that would make an empty string + const char16_t *array = getBuffer(); // not getArrayStart() to check kIsBogus & kOpenGetBuffer + if(array==nullptr) { + array=fUnion.fStackFields.fBuffer; // anything not nullptr because that would make an empty string len=-2; // bogus result string } - return UnicodeString(FALSE, array + start, len); + return UnicodeString(false, array + start, len); } int32_t @@ -932,7 +975,7 @@ UnicodeString::toUTF8(int32_t start, int32_t len, u_strToUTF8WithSub(target, capacity, &length8, getBuffer() + start, len, 0xFFFD, // Standard substitution character. - NULL, // Don't care about number of substitutions. + nullptr, // Don't care about number of substitutions. &errorCode); return length8; } @@ -952,7 +995,7 @@ UnicodeString::extract(int32_t start, int32_t len, // else see unistr_cnv.cpp #endif -void +void UnicodeString::extractBetween(int32_t start, int32_t limit, UnicodeString& target) const { @@ -971,7 +1014,7 @@ UnicodeString::toUTF8(ByteSink &sink) const { if(length16 != 0) { char stackBuffer[1024]; int32_t capacity = (int32_t)sizeof(stackBuffer); - UBool utf8IsOwned = FALSE; + UBool utf8IsOwned = false; char *utf8 = sink.GetAppendBuffer(length16 < capacity ? length16 : capacity, 3*length16, stackBuffer, capacity, @@ -981,17 +1024,17 @@ UnicodeString::toUTF8(ByteSink &sink) const { u_strToUTF8WithSub(utf8, capacity, &length8, getBuffer(), length16, 0xFFFD, // Standard substitution character. - NULL, // Don't care about number of substitutions. + nullptr, // Don't care about number of substitutions. &errorCode); if(errorCode == U_BUFFER_OVERFLOW_ERROR) { utf8 = (char *)uprv_malloc(length8); - if(utf8 != NULL) { - utf8IsOwned = TRUE; + if(utf8 != nullptr) { + utf8IsOwned = true; errorCode = U_ZERO_ERROR; u_strToUTF8WithSub(utf8, length8, &length8, getBuffer(), length16, 0xFFFD, // Standard substitution character. - NULL, // Don't care about number of substitutions. + nullptr, // Don't care about number of substitutions. &errorCode); } else { errorCode = U_MEMORY_ALLOCATION_ERROR; @@ -1015,14 +1058,14 @@ UnicodeString::toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) u_strToUTF32WithSub(utf32, capacity, &length32, getBuffer(), length(), 0xfffd, // Substitution character. - NULL, // Don't care about number of substitutions. + nullptr, // Don't care about number of substitutions. &errorCode); } return length32; } -int32_t -UnicodeString::indexOf(const UChar *srcChars, +int32_t +UnicodeString::indexOf(const char16_t *srcChars, int32_t srcStart, int32_t srcLength, int32_t start, @@ -1041,9 +1084,9 @@ UnicodeString::indexOf(const UChar *srcChars, pinIndices(start, length); // find the first occurrence of the substring - const UChar *array = getArrayStart(); - const UChar *match = u_strFindFirst(array + start, length, srcChars + srcStart, srcLength); - if(match == NULL) { + const char16_t *array = getArrayStart(); + const char16_t *match = u_strFindFirst(array + start, length, srcChars + srcStart, srcLength); + if(match == nullptr) { return -1; } else { return (int32_t)(match - array); @@ -1051,7 +1094,7 @@ UnicodeString::indexOf(const UChar *srcChars, } int32_t -UnicodeString::doIndexOf(UChar c, +UnicodeString::doIndexOf(char16_t c, int32_t start, int32_t length) const { @@ -1059,9 +1102,9 @@ UnicodeString::doIndexOf(UChar c, pinIndices(start, length); // find the first occurrence of c - const UChar *array = getArrayStart(); - const UChar *match = u_memchr(array + start, c, length); - if(match == NULL) { + const char16_t *array = getArrayStart(); + const char16_t *match = u_memchr(array + start, c, length); + if(match == nullptr) { return -1; } else { return (int32_t)(match - array); @@ -1076,17 +1119,17 @@ UnicodeString::doIndexOf(UChar32 c, pinIndices(start, length); // find the first occurrence of c - const UChar *array = getArrayStart(); - const UChar *match = u_memchr32(array + start, c, length); - if(match == NULL) { + const char16_t *array = getArrayStart(); + const char16_t *match = u_memchr32(array + start, c, length); + if(match == nullptr) { return -1; } else { return (int32_t)(match - array); } } -int32_t -UnicodeString::lastIndexOf(const UChar *srcChars, +int32_t +UnicodeString::lastIndexOf(const char16_t *srcChars, int32_t srcStart, int32_t srcLength, int32_t start, @@ -1105,9 +1148,9 @@ UnicodeString::lastIndexOf(const UChar *srcChars, pinIndices(start, length); // find the last occurrence of the substring - const UChar *array = getArrayStart(); - const UChar *match = u_strFindLast(array + start, length, srcChars + srcStart, srcLength); - if(match == NULL) { + const char16_t *array = getArrayStart(); + const char16_t *match = u_strFindLast(array + start, length, srcChars + srcStart, srcLength); + if(match == nullptr) { return -1; } else { return (int32_t)(match - array); @@ -1115,7 +1158,7 @@ UnicodeString::lastIndexOf(const UChar *srcChars, } int32_t -UnicodeString::doLastIndexOf(UChar c, +UnicodeString::doLastIndexOf(char16_t c, int32_t start, int32_t length) const { @@ -1127,9 +1170,9 @@ UnicodeString::doLastIndexOf(UChar c, pinIndices(start, length); // find the last occurrence of c - const UChar *array = getArrayStart(); - const UChar *match = u_memrchr(array + start, c, length); - if(match == NULL) { + const char16_t *array = getArrayStart(); + const char16_t *match = u_memrchr(array + start, c, length); + if(match == nullptr) { return -1; } else { return (int32_t)(match - array); @@ -1144,9 +1187,9 @@ UnicodeString::doLastIndexOf(UChar32 c, pinIndices(start, length); // find the last occurrence of c - const UChar *array = getArrayStart(); - const UChar *match = u_memrchr32(array + start, c, length); - if(match == NULL) { + const char16_t *array = getArrayStart(); + const char16_t *match = u_memrchr32(array + start, c, length); + if(match == nullptr) { return -1; } else { return (int32_t)(match - array); @@ -1157,7 +1200,7 @@ UnicodeString::doLastIndexOf(UChar32 c, // Write implementation //======================================== -UnicodeString& +UnicodeString& UnicodeString::findAndReplace(int32_t start, int32_t length, const UnicodeString& oldText, @@ -1219,12 +1262,12 @@ UnicodeString::getTerminatedBuffer() { if(!isWritable()) { return nullptr; } - UChar *array = getArrayStart(); + char16_t *array = getArrayStart(); int32_t len = length(); if(len < getCapacity()) { if(fUnion.fFields.fLengthAndFlags & kBufferIsReadonly) { // If len 0) { @@ -1372,9 +1415,9 @@ UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, UChar32 srcChar) { - UChar buffer[U16_MAX_LENGTH]; + char16_t buffer[U16_MAX_LENGTH]; int32_t count = 0; - UBool isError = FALSE; + UBool isError = false; U16_APPEND(buffer, count, U16_MAX_LENGTH, srcChar, isError); // We test isError so that the compiler does not complain that we don't. // If isError (srcChar is not a valid code point) then count==0 which means @@ -1384,9 +1427,9 @@ UnicodeString::replace(int32_t start, UnicodeString& UnicodeString::append(UChar32 srcChar) { - UChar buffer[U16_MAX_LENGTH]; + char16_t buffer[U16_MAX_LENGTH]; int32_t _length = 0; - UBool isError = FALSE; + UBool isError = false; U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError); // We test isError so that the compiler does not complain that we don't. // If isError then _length==0 which turns the doAppend() into a no-op anyway. @@ -1411,7 +1454,7 @@ UnicodeString::doReplace( int32_t start, UnicodeString& UnicodeString::doReplace(int32_t start, int32_t length, - const UChar *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) { @@ -1470,7 +1513,7 @@ UnicodeString::doReplace(int32_t start, newLength += srcLength; // Check for insertion into ourself - const UChar *oldArray = getArrayStart(); + const char16_t *oldArray = getArrayStart(); if (isBufferWritable() && oldArray < srcChars + srcLength && srcChars < oldArray + oldLength) { @@ -1483,9 +1526,9 @@ UnicodeString::doReplace(int32_t start, return doReplace(start, length, copy.getArrayStart(), 0, srcLength); } - // cloneArrayIfNeeded(doCopyArray=FALSE) may change fArray but will not copy the current contents; + // cloneArrayIfNeeded(doCopyArray=false) may change fArray but will not copy the current contents; // therefore we need to keep the current fArray - UChar oldStackBuffer[US_STACKBUF_SIZE]; + char16_t oldStackBuffer[US_STACKBUF_SIZE]; if((fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) && (newLength > US_STACKBUF_SIZE)) { // copy the stack buffer contents because it will be overwritten with // fUnion.fFields values @@ -1496,14 +1539,14 @@ UnicodeString::doReplace(int32_t start, // clone our array and allocate a bigger array if needed int32_t *bufferToDelete = 0; if(!cloneArrayIfNeeded(newLength, getGrowCapacity(newLength), - FALSE, &bufferToDelete) + false, &bufferToDelete) ) { return *this; } // now do the replace - UChar *newArray = getArrayStart(); + char16_t *newArray = getArrayStart(); if(newArray != oldArray) { // if fArray changed, then we need to copy everything except what will change us_arrayCopy(oldArray, 0, newArray, 0, start); @@ -1546,8 +1589,8 @@ UnicodeString::doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcL } UnicodeString& -UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLength) { - if(!isWritable() || srcLength == 0 || srcChars == NULL) { +UnicodeString::doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) { + if(!isWritable() || srcLength == 0 || srcChars == nullptr) { return *this; } @@ -1570,7 +1613,7 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng } // Check for append onto ourself - const UChar* oldArray = getArrayStart(); + const char16_t* oldArray = getArrayStart(); if (isBufferWritable() && oldArray < srcChars + srcLength && srcChars < oldArray + oldLength) { @@ -1586,9 +1629,9 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng // optimize append() onto a large-enough, owned string if((newLength <= getCapacity() && isBufferWritable()) || cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) { - UChar *newArray = getArrayStart(); + char16_t *newArray = getArrayStart(); // Do not copy characters when - // UChar *buffer=str.getAppendBuffer(...); + // char16_t *buffer=str.getAppendBuffer(...); // is followed by // str.append(buffer, length); // or @@ -1615,16 +1658,16 @@ UnicodeString::handleReplaceBetween(int32_t start, /** * Replaceable API */ -void +void UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) { if (limit <= start) { return; // Nothing to do; avoid bogus malloc call } - UChar* text = (UChar*) uprv_malloc( sizeof(UChar) * (limit - start) ); + char16_t* text = (char16_t*) uprv_malloc( sizeof(char16_t) * (limit - start) ); // Check to make sure text is not null. - if (text != NULL) { + if (text != nullptr) { extractBetween(start, limit, text, 0); - insert(dest, text, 0, limit - start); + insert(dest, text, 0, limit - start); uprv_free(text); } } @@ -1636,14 +1679,14 @@ UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) { * so we implement this function here. */ UBool Replaceable::hasMetaData() const { - return TRUE; + return true; } /** * Replaceable API */ UBool UnicodeString::hasMetaData() const { - return FALSE; + return false; } UnicodeString& @@ -1658,10 +1701,10 @@ UnicodeString::doReverse(int32_t start, int32_t length) { return *this; } - UChar *left = getArrayStart() + start; - UChar *right = left + length - 1; // -1 for inclusive boundary (length>=2) - UChar swap; - UBool hasSupplementary = FALSE; + char16_t *left = getArrayStart() + start; + char16_t *right = left + length - 1; // -1 for inclusive boundary (length>=2) + char16_t swap; + UBool hasSupplementary = false; // Before the loop we know left=2. do { @@ -1675,7 +1718,7 @@ UnicodeString::doReverse(int32_t start, int32_t length) { /* if there are supplementary code points in the reversed range, then re-swap their surrogates */ if(hasSupplementary) { - UChar swap2; + char16_t swap2; left = getArrayStart() + start; right = left + length - 1; // -1 so that we can look at *(left+1) if left= targetLength || !cloneArrayIfNeeded(targetLength)) { - return FALSE; + return false; } else { // move contents up by padding width - UChar *array = getArrayStart(); + char16_t *array = getArrayStart(); int32_t start = targetLength - oldLength; us_arrayCopy(array, 0, array, start, oldLength); @@ -1710,26 +1753,26 @@ UnicodeString::padLeading(int32_t targetLength, array[start] = padChar; } setLength(targetLength); - return TRUE; + return true; } } -UBool +UBool UnicodeString::padTrailing(int32_t targetLength, - UChar padChar) + char16_t padChar) { int32_t oldLength = length(); if(oldLength >= targetLength || !cloneArrayIfNeeded(targetLength)) { - return FALSE; + return false; } else { // fill in padding character - UChar *array = getArrayStart(); + char16_t *array = getArrayStart(); int32_t length = targetLength; while(--length >= oldLength) { array[length] = padChar; } setLength(targetLength); - return TRUE; + return true; } } @@ -1740,7 +1783,7 @@ int32_t UnicodeString::doHashCode() const { /* Delegate hash computation to uhash. This makes UnicodeString - * hashing consistent with UChar* hashing. */ + * hashing consistent with char16_t* hashing. */ int32_t hashCode = ustr_hashUCharsN(getArrayStart(), length()); if (hashCode == kInvalidHashCode) { hashCode = kEmptyHashCode; @@ -1770,7 +1813,7 @@ UnicodeString::releaseBuffer(int32_t newLength) { int32_t capacity=getCapacity(); if(newLength==-1) { // the new length is the string length, capped by fCapacity - const UChar *array=getArrayStart(), *p=array, *limit=array+capacity; + const char16_t *array=getArrayStart(), *p=array, *limit=array+capacity; while(p1, or * the buffer is too small. - * Return FALSE if memory could not be allocated. + * Return false if memory could not be allocated. */ if(forceClone || fUnion.fFields.fLengthAndFlags & kBufferIsReadonly || @@ -1825,8 +1868,8 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity, } // save old values - UChar oldStackBuffer[US_STACKBUF_SIZE]; - UChar *oldArray; + char16_t oldStackBuffer[US_STACKBUF_SIZE]; + char16_t *oldArray; int32_t oldLength = length(); int16_t flags = fUnion.fFields.fLengthAndFlags; @@ -1838,11 +1881,11 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity, us_arrayCopy(fUnion.fStackFields.fBuffer, 0, oldStackBuffer, 0, oldLength); oldArray = oldStackBuffer; } else { - oldArray = NULL; // no need to copy from the stack buffer to itself + oldArray = nullptr; // no need to copy from the stack buffer to itself } } else { oldArray = fUnion.fFields.fArray; - U_ASSERT(oldArray!=NULL); /* when stack buffer is not used, oldArray must have a non-NULL reference */ + U_ASSERT(oldArray!=nullptr); /* when stack buffer is not used, oldArray must have a non-nullptr reference */ } // allocate a new array @@ -1857,7 +1900,7 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity, if(newCapacity < minLength) { minLength = newCapacity; } - if(oldArray != NULL) { + if(oldArray != nullptr) { us_arrayCopy(oldArray, 0, getArrayStart(), 0, minLength); } setLength(minLength); @@ -1889,10 +1932,10 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity, } fUnion.fFields.fLengthAndFlags = flags; setToBogus(); - return FALSE; + return false; } } - return TRUE; + return true; } // UnicodeStringAppendable ------------------------------------------------- *** @@ -1900,21 +1943,21 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity, UnicodeStringAppendable::~UnicodeStringAppendable() {} UBool -UnicodeStringAppendable::appendCodeUnit(UChar c) { +UnicodeStringAppendable::appendCodeUnit(char16_t c) { return str.doAppend(&c, 0, 1).isWritable(); } UBool UnicodeStringAppendable::appendCodePoint(UChar32 c) { - UChar buffer[U16_MAX_LENGTH]; + char16_t buffer[U16_MAX_LENGTH]; int32_t cLength = 0; - UBool isError = FALSE; + UBool isError = false; U16_APPEND(buffer, cLength, U16_MAX_LENGTH, c, isError); return !isError && str.doAppend(buffer, 0, cLength).isWritable(); } UBool -UnicodeStringAppendable::appendString(const UChar *s, int32_t length) { +UnicodeStringAppendable::appendString(const char16_t *s, int32_t length) { return str.doAppend(s, 0, length).isWritable(); } @@ -1923,14 +1966,14 @@ UnicodeStringAppendable::reserveAppendCapacity(int32_t appendCapacity) { return str.cloneArrayIfNeeded(str.length() + appendCapacity); } -UChar * +char16_t * UnicodeStringAppendable::getAppendBuffer(int32_t minCapacity, int32_t desiredCapacityHint, - UChar *scratch, int32_t scratchCapacity, + char16_t *scratch, int32_t scratchCapacity, int32_t *resultCapacity) { if(minCapacity < 1 || scratchCapacity < minCapacity) { *resultCapacity = 0; - return NULL; + return nullptr; } int32_t oldLength = str.length(); if(minCapacity <= (kMaxCapacity - oldLength) && @@ -1950,7 +1993,7 @@ U_NAMESPACE_USE U_CAPI int32_t U_EXPORT2 uhash_hashUnicodeString(const UElement key) { const UnicodeString *str = (const UnicodeString*) key.pointer; - return (str == NULL) ? 0 : str->hashCode(); + return (str == nullptr) ? 0 : str->hashCode(); } // Moved here from uhash_us.cpp so that using a UVector of UnicodeString* @@ -1960,23 +2003,28 @@ uhash_compareUnicodeString(const UElement key1, const UElement key2) { const UnicodeString *str1 = (const UnicodeString*) key1.pointer; const UnicodeString *str2 = (const UnicodeString*) key2.pointer; if (str1 == str2) { - return TRUE; + return true; } - if (str1 == NULL || str2 == NULL) { - return FALSE; + if (str1 == nullptr || str2 == nullptr) { + return false; } return *str1 == *str2; } -// -// #ifdef U_STATIC_IMPLEMENTATION -// /* -// This should never be called. It is defined here to make sure that the -// virtual vector deleting destructor is defined within unistr.cpp. -// The vector deleting destructor is already a part of UObject, -// but defining it here makes sure that it is included with this object file. -// This makes sure that static library dependencies are kept to a minimum. -// */ -// static void uprv_UnicodeStringDummy(void) { -// delete [] (new UnicodeString[2]); -// } -// #endif + +#ifdef U_STATIC_IMPLEMENTATION +/* +This should never be called. It is defined here to make sure that the +virtual vector deleting destructor is defined within unistr.cpp. +The vector deleting destructor is already a part of UObject, +but defining it here makes sure that it is included with this object file. +This makes sure that static library dependencies are kept to a minimum. +*/ +#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 1100 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +static void uprv_UnicodeStringDummy() { + delete [] (new UnicodeString[2]); +} +#pragma GCC diagnostic pop +#endif +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unistr_case.cpp b/src/duckdb/extension/icu/third_party/icu/common/unistr_case.cpp index 2138d60c0..57f307c20 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unistr_case.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unistr_case.cpp @@ -41,13 +41,13 @@ U_NAMESPACE_BEGIN int8_t UnicodeString::doCaseCompare(int32_t start, int32_t length, - const UChar *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const { // compare illegal string values - // treat const UChar *srcChars==NULL as an empty string + // treat const char16_t *srcChars==nullptr as an empty string if(isBogus()) { return -1; } @@ -55,12 +55,12 @@ UnicodeString::doCaseCompare(int32_t start, // pin indices to legal values pinIndices(start, length); - if(srcChars == NULL) { + if(srcChars == nullptr) { srcStart = srcLength = 0; } // get the correct pointer - const UChar *chars = getArrayStart(); + const char16_t *chars = getArrayStart(); chars += start; if(srcStart!=0) { @@ -98,8 +98,8 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER return *this; } - UChar oldBuffer[2 * US_STACKBUF_SIZE]; - UChar *oldArray; + char16_t oldBuffer[2 * US_STACKBUF_SIZE]; + char16_t *oldArray; int32_t oldLength = length(); int32_t newLength; UBool writable = isBufferWritable(); @@ -115,7 +115,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER if (writable ? oldLength <= UPRV_LENGTHOF(oldBuffer) : oldLength < US_STACKBUF_SIZE) { // Short string: Copy the contents into a temporary buffer and // case-map back into the current array, or into the stack buffer. - UChar *buffer = getArrayStart(); + char16_t *buffer = getArrayStart(); int32_t capacity; oldArray = oldBuffer; u_memcpy(oldBuffer, buffer, oldLength); @@ -123,7 +123,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER capacity = getCapacity(); } else { // Switch from the read-only alias or shared heap buffer to the stack buffer. - if (!cloneArrayIfNeeded(US_STACKBUF_SIZE, US_STACKBUF_SIZE, /* doCopyArray= */ FALSE)) { + if (!cloneArrayIfNeeded(US_STACKBUF_SIZE, US_STACKBUF_SIZE, /* doCopyArray= */ false)) { return *this; } U_ASSERT(fUnion.fFields.fLengthAndFlags & kUsingStackBuffer); @@ -132,13 +132,13 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER } #if !UCONFIG_NO_BREAK_ITERATION if (iter != nullptr) { - oldString.setTo(FALSE, oldArray, oldLength); + oldString.setTo(false, oldArray, oldLength); iter->setText(oldString); } #endif newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR buffer, capacity, - oldArray, oldLength, NULL, errorCode); + oldArray, oldLength, nullptr, errorCode); if (U_SUCCESS(errorCode)) { setLength(newLength); return *this; @@ -155,10 +155,10 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER // and often does not change its length. oldArray = getArrayStart(); Edits edits; - UChar replacementChars[200]; + char16_t replacementChars[200]; #if !UCONFIG_NO_BREAK_ITERATION if (iter != nullptr) { - oldString.setTo(FALSE, oldArray, oldLength); + oldString.setTo(false, oldArray, oldLength); iter->setText(oldString); } #endif @@ -194,14 +194,14 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER // and deletes the old array itself after it is done. // In addition, we are forcing cloneArrayIfNeeded() to always allocate a new array. int32_t *bufferToDelete = 0; - if (!cloneArrayIfNeeded(newLength, newLength, FALSE, &bufferToDelete, TRUE)) { + if (!cloneArrayIfNeeded(newLength, newLength, false, &bufferToDelete, true)) { return *this; } errorCode = U_ZERO_ERROR; // No need to iter->setText() again: The case mapper restarts via iter->first(). newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR getArrayStart(), getCapacity(), - oldArray, oldLength, NULL, errorCode); + oldArray, oldLength, nullptr, errorCode); if (bufferToDelete) { uprv_free(bufferToDelete); } @@ -225,7 +225,7 @@ U_CAPI int32_t U_EXPORT2 uhash_hashCaselessUnicodeString(const UElement key) { U_NAMESPACE_USE const UnicodeString *str = (const UnicodeString*) key.pointer; - if (str == NULL) { + if (str == nullptr) { return 0; } // Inefficient; a better way would be to have a hash function in @@ -241,10 +241,10 @@ uhash_compareCaselessUnicodeString(const UElement key1, const UElement key2) { const UnicodeString *str1 = (const UnicodeString*) key1.pointer; const UnicodeString *str2 = (const UnicodeString*) key2.pointer; if (str1 == str2) { - return TRUE; + return true; } - if (str1 == NULL || str2 == NULL) { - return FALSE; + if (str1 == nullptr || str2 == nullptr) { + return false; } return str1->caseCompare(*str2, U_FOLD_CASE_DEFAULT) == 0; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/unistr_case_locale.cpp b/src/duckdb/extension/icu/third_party/icu/common/unistr_case_locale.cpp index f0f3048d0..8b6a9ca0c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unistr_case_locale.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unistr_case_locale.cpp @@ -31,7 +31,7 @@ U_NAMESPACE_BEGIN UnicodeString & UnicodeString::toLower() { - return caseMap(ustrcase_getCaseLocale(NULL), 0, + return caseMap(ustrcase_getCaseLocale(nullptr), 0, UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower); } @@ -43,7 +43,7 @@ UnicodeString::toLower(const Locale &locale) { UnicodeString & UnicodeString::toUpper() { - return caseMap(ustrcase_getCaseLocale(NULL), 0, + return caseMap(ustrcase_getCaseLocale(nullptr), 0, UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper); } diff --git a/src/duckdb/extension/icu/third_party/icu/common/unistr_cnv.cpp b/src/duckdb/extension/icu/third_party/icu/common/unistr_cnv.cpp deleted file mode 100644 index accfc3cbf..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/unistr_cnv.cpp +++ /dev/null @@ -1,417 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * -// * Copyright (C) 1999-2014, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ******************************************************************************* -// * file name: unistr_cnv.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:2 -// * -// * created on: 2004aug19 -// * created by: Markus W. Scherer -// * -// * Character conversion functions moved here from unistr.cpp -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/putil.h" -// #include "cstring.h" -// #include "cmemory.h" -// #include "unicode/ustring.h" -// #include "unicode/unistr.h" -// #include "unicode/ucnv.h" -// #include "ucnv_imp.h" -// #include "putilimp.h" -// #include "ustr_cnv.h" -// #include "ustr_imp.h" - -// U_NAMESPACE_BEGIN - -// //======================================== -// // Constructors -// //======================================== - -// #if !U_CHARSET_IS_UTF8 - -// UnicodeString::UnicodeString(const char *codepageData) { -// fUnion.fFields.fLengthAndFlags = kShortString; -// if(codepageData != 0) { -// doCodepageCreate(codepageData, (int32_t)uprv_strlen(codepageData), 0); -// } -// } - -// UnicodeString::UnicodeString(const char *codepageData, -// int32_t dataLength) { -// fUnion.fFields.fLengthAndFlags = kShortString; -// if(codepageData != 0) { -// doCodepageCreate(codepageData, dataLength, 0); -// } -// } - -// // else see unistr.cpp -// #endif - -// UnicodeString::UnicodeString(const char *codepageData, -// const char *codepage) { -// fUnion.fFields.fLengthAndFlags = kShortString; -// if(codepageData != 0) { -// doCodepageCreate(codepageData, (int32_t)uprv_strlen(codepageData), codepage); -// } -// } - -// UnicodeString::UnicodeString(const char *codepageData, -// int32_t dataLength, -// const char *codepage) { -// fUnion.fFields.fLengthAndFlags = kShortString; -// if(codepageData != 0) { -// doCodepageCreate(codepageData, dataLength, codepage); -// } -// } - -// UnicodeString::UnicodeString(const char *src, int32_t srcLength, -// UConverter *cnv, -// UErrorCode &errorCode) { -// fUnion.fFields.fLengthAndFlags = kShortString; -// if(U_SUCCESS(errorCode)) { -// // check arguments -// if(src==NULL) { -// // treat as an empty string, do nothing more -// } else if(srcLength<-1) { -// errorCode=U_ILLEGAL_ARGUMENT_ERROR; -// } else { -// // get input length -// if(srcLength==-1) { -// srcLength=(int32_t)uprv_strlen(src); -// } -// if(srcLength>0) { -// if(cnv!=0) { -// // use the provided converter -// ucnv_resetToUnicode(cnv); -// doCodepageCreate(src, srcLength, cnv, errorCode); -// } else { -// // use the default converter -// cnv=u_getDefaultConverter(&errorCode); -// doCodepageCreate(src, srcLength, cnv, errorCode); -// u_releaseDefaultConverter(cnv); -// } -// } -// } - -// if(U_FAILURE(errorCode)) { -// setToBogus(); -// } -// } -// } - -// //======================================== -// // Codeset conversion -// //======================================== - -// #if !U_CHARSET_IS_UTF8 - -// int32_t -// UnicodeString::extract(int32_t start, -// int32_t length, -// char *target, -// uint32_t dstSize) const { -// return extract(start, length, target, dstSize, 0); -// } - -// // else see unistr.cpp -// #endif - -// int32_t -// UnicodeString::extract(int32_t start, -// int32_t length, -// char *target, -// uint32_t dstSize, -// const char *codepage) const -// { -// // if the arguments are illegal, then do nothing -// if(/*dstSize < 0 || */(dstSize > 0 && target == 0)) { -// return 0; -// } - -// // pin the indices to legal values -// pinIndices(start, length); - -// // We need to cast dstSize to int32_t for all subsequent code. -// // I don't know why the API was defined with uint32_t but we are stuck with it. -// // Also, dstSize==0xffffffff means "unlimited" but if we use target+dstSize -// // as a limit in some functions, it may wrap around and yield a pointer -// // that compares less-than target. -// int32_t capacity; -// if(dstSize < 0x7fffffff) { -// // Assume that the capacity is real and a limit pointer won't wrap around. -// capacity = (int32_t)dstSize; -// } else { -// // Pin the capacity so that a limit pointer does not wrap around. -// char *targetLimit = (char *)U_MAX_PTR(target); -// // U_MAX_PTR(target) returns a targetLimit that is at most 0x7fffffff -// // greater than target and does not wrap around the top of the address space. -// capacity = (int32_t)(targetLimit - target); -// } - -// // create the converter -// UConverter *converter; -// UErrorCode status = U_ZERO_ERROR; - -// // just write the NUL if the string length is 0 -// if(length == 0) { -// return u_terminateChars(target, capacity, 0, &status); -// } - -// // if the codepage is the default, use our cache -// // if it is an empty string, then use the "invariant character" conversion -// if (codepage == 0) { -// const char *defaultName = ucnv_getDefaultName(); -// if(UCNV_FAST_IS_UTF8(defaultName)) { -// return toUTF8(start, length, target, capacity); -// } -// converter = u_getDefaultConverter(&status); -// } else if (*codepage == 0) { -// // use the "invariant characters" conversion -// int32_t destLength; -// if(length <= capacity) { -// destLength = length; -// } else { -// destLength = capacity; -// } -// u_UCharsToChars(getArrayStart() + start, target, destLength); -// return u_terminateChars(target, capacity, length, &status); -// } else { -// converter = ucnv_open(codepage, &status); -// } - -// length = doExtract(start, length, target, capacity, converter, status); - -// // close the converter -// if (codepage == 0) { -// u_releaseDefaultConverter(converter); -// } else { -// ucnv_close(converter); -// } - -// return length; -// } - -// int32_t -// UnicodeString::extract(char *dest, int32_t destCapacity, -// UConverter *cnv, -// UErrorCode &errorCode) const -// { -// if(U_FAILURE(errorCode)) { -// return 0; -// } - -// if(isBogus() || destCapacity<0 || (destCapacity>0 && dest==0)) { -// errorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } - -// // nothing to do? -// if(isEmpty()) { -// return u_terminateChars(dest, destCapacity, 0, &errorCode); -// } - -// // get the converter -// UBool isDefaultConverter; -// if(cnv==0) { -// isDefaultConverter=TRUE; -// cnv=u_getDefaultConverter(&errorCode); -// if(U_FAILURE(errorCode)) { -// return 0; -// } -// } else { -// isDefaultConverter=FALSE; -// ucnv_resetFromUnicode(cnv); -// } - -// // convert -// int32_t len=doExtract(0, length(), dest, destCapacity, cnv, errorCode); - -// // release the converter -// if(isDefaultConverter) { -// u_releaseDefaultConverter(cnv); -// } - -// return len; -// } - -// int32_t -// UnicodeString::doExtract(int32_t start, int32_t length, -// char *dest, int32_t destCapacity, -// UConverter *cnv, -// UErrorCode &errorCode) const -// { -// if(U_FAILURE(errorCode)) { -// if(destCapacity!=0) { -// *dest=0; -// } -// return 0; -// } - -// const UChar *src=getArrayStart()+start, *srcLimit=src+length; -// char *originalDest=dest; -// const char *destLimit; - -// if(destCapacity==0) { -// destLimit=dest=0; -// } else if(destCapacity==-1) { -// // Pin the limit to U_MAX_PTR if the "magic" destCapacity is used. -// destLimit=(char*)U_MAX_PTR(dest); -// // for NUL-termination, translate into highest int32_t -// destCapacity=0x7fffffff; -// } else { -// destLimit=dest+destCapacity; -// } - -// // perform the conversion -// ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, &errorCode); -// length=(int32_t)(dest-originalDest); - -// // if an overflow occurs, then get the preflighting length -// if(errorCode==U_BUFFER_OVERFLOW_ERROR) { -// char buffer[1024]; - -// destLimit=buffer+sizeof(buffer); -// do { -// dest=buffer; -// errorCode=U_ZERO_ERROR; -// ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, TRUE, &errorCode); -// length+=(int32_t)(dest-buffer); -// } while(errorCode==U_BUFFER_OVERFLOW_ERROR); -// } - -// return u_terminateChars(originalDest, destCapacity, length, &errorCode); -// } - -// void -// UnicodeString::doCodepageCreate(const char *codepageData, -// int32_t dataLength, -// const char *codepage) -// { -// // if there's nothing to convert, do nothing -// if(codepageData == 0 || dataLength == 0 || dataLength < -1) { -// return; -// } -// if(dataLength == -1) { -// dataLength = (int32_t)uprv_strlen(codepageData); -// } - -// UErrorCode status = U_ZERO_ERROR; - -// // create the converter -// // if the codepage is the default, use our cache -// // if it is an empty string, then use the "invariant character" conversion -// UConverter *converter; -// if (codepage == 0) { -// const char *defaultName = ucnv_getDefaultName(); -// if(UCNV_FAST_IS_UTF8(defaultName)) { -// setToUTF8(StringPiece(codepageData, dataLength)); -// return; -// } -// converter = u_getDefaultConverter(&status); -// } else if(*codepage == 0) { -// // use the "invariant characters" conversion -// if(cloneArrayIfNeeded(dataLength, dataLength, FALSE)) { -// u_charsToUChars(codepageData, getArrayStart(), dataLength); -// setLength(dataLength); -// } else { -// setToBogus(); -// } -// return; -// } else { -// converter = ucnv_open(codepage, &status); -// } - -// // if we failed, set the appropriate flags and return -// if(U_FAILURE(status)) { -// setToBogus(); -// return; -// } - -// // perform the conversion -// doCodepageCreate(codepageData, dataLength, converter, status); -// if(U_FAILURE(status)) { -// setToBogus(); -// } - -// // close the converter -// if(codepage == 0) { -// u_releaseDefaultConverter(converter); -// } else { -// ucnv_close(converter); -// } -// } - -// void -// UnicodeString::doCodepageCreate(const char *codepageData, -// int32_t dataLength, -// UConverter *converter, -// UErrorCode &status) -// { -// if(U_FAILURE(status)) { -// return; -// } - -// // set up the conversion parameters -// const char *mySource = codepageData; -// const char *mySourceEnd = mySource + dataLength; -// UChar *array, *myTarget; - -// // estimate the size needed: -// int32_t arraySize; -// if(dataLength <= US_STACKBUF_SIZE) { -// // try to use the stack buffer -// arraySize = US_STACKBUF_SIZE; -// } else { -// // 1.25 UChar's per source byte should cover most cases -// arraySize = dataLength + (dataLength >> 2); -// } - -// // we do not care about the current contents -// UBool doCopyArray = FALSE; -// for(;;) { -// if(!cloneArrayIfNeeded(arraySize, arraySize, doCopyArray)) { -// setToBogus(); -// break; -// } - -// // perform the conversion -// array = getArrayStart(); -// myTarget = array + length(); -// ucnv_toUnicode(converter, &myTarget, array + getCapacity(), -// &mySource, mySourceEnd, 0, TRUE, &status); - -// // update the conversion parameters -// setLength((int32_t)(myTarget - array)); - -// // allocate more space and copy data, if needed -// if(status == U_BUFFER_OVERFLOW_ERROR) { -// // reset the error code -// status = U_ZERO_ERROR; - -// // keep the previous conversion results -// doCopyArray = TRUE; - -// // estimate the new size needed, larger than before -// // try 2 UChar's per remaining source byte -// arraySize = (int32_t)(length() + 2 * (mySourceEnd - mySource)); -// } else { -// break; -// } -// } -// } - -// U_NAMESPACE_END - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/unistr_props.cpp b/src/duckdb/extension/icu/third_party/icu/common/unistr_props.cpp index 400647579..3d05233bb 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unistr_props.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unistr_props.cpp @@ -32,7 +32,7 @@ UnicodeString::trim() return *this; } - UChar *array = getArrayStart(); + char16_t *array = getArrayStart(); UChar32 c; int32_t oldLength = this->length(); int32_t i = oldLength, length; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unistr_titlecase_brkiter.cpp b/src/duckdb/extension/icu/third_party/icu/common/unistr_titlecase_brkiter.cpp deleted file mode 100644 index b9c783f7c..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/unistr_titlecase_brkiter.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * Copyright (C) 2011, International Business Machines -// * Corporation and others. All Rights Reserved. -// ******************************************************************************* -// * file name: unistr_titlecase_brkiter.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:2 -// * -// * created on: 2011may30 -// * created by: Markus W. Scherer -// * -// * Titlecasing functions that are based on BreakIterator -// * were moved here to break dependency cycles among parts of the common library. -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/brkiter.h" -// #include "unicode/locid.h" -// #include "unicode/ucasemap.h" -// #include "unicode/unistr.h" -// #include "ucasemap_imp.h" - -// U_NAMESPACE_BEGIN - -// UnicodeString & -// UnicodeString::toTitle(BreakIterator *iter) { -// return toTitle(iter, Locale::getDefault(), 0); -// } - -// UnicodeString & -// UnicodeString::toTitle(BreakIterator *iter, const Locale &locale) { -// return toTitle(iter, locale, 0); -// } - -// UnicodeString & -// UnicodeString::toTitle(BreakIterator *iter, const Locale &locale, uint32_t options) { -// LocalPointer ownedIter; -// UErrorCode errorCode = U_ZERO_ERROR; -// iter = ustrcase_getTitleBreakIterator(&locale, "", options, iter, ownedIter, errorCode); -// if (iter == nullptr) { -// setToBogus(); -// return *this; -// } -// caseMap(ustrcase_getCaseLocale(locale.getBaseName()), options, iter, ustrcase_internalToTitle); -// return *this; -// } - -// U_NAMESPACE_END - -// #endif // !UCONFIG_NO_BREAK_ITERATION diff --git a/src/duckdb/extension/icu/third_party/icu/common/unistrappender.h b/src/duckdb/extension/icu/third_party/icu/common/unistrappender.h index 75fcb9e77..ac49b5f2f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unistrappender.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unistrappender.h @@ -31,7 +31,7 @@ U_NAMESPACE_BEGIN * { * UnicodeStringAppender appender(astring); * for (int32_t i = 0; i < 100; ++i) { - * appender.append((UChar) i); + * appender.append((char16_t) i); * } * // appender flushed automatically when it goes out of scope. * } @@ -45,7 +45,7 @@ class UnicodeStringAppender : public UMemory { */ UnicodeStringAppender(UnicodeString &dest) : fDest(&dest), fIdx(0) { } - inline void append(UChar x) { + inline void append(char16_t x) { if (fIdx == UPRV_LENGTHOF(fBuffer)) { fDest->append(fBuffer, 0, fIdx); fIdx = 0; @@ -80,7 +80,7 @@ class UnicodeStringAppender : public UMemory { private: UnicodeString *fDest; int32_t fIdx; - UChar fBuffer[32]; + char16_t fBuffer[32]; UnicodeStringAppender(const UnicodeStringAppender &other); UnicodeStringAppender &operator=(const UnicodeStringAppender &other); }; diff --git a/src/duckdb/extension/icu/third_party/icu/common/unorm.cpp b/src/duckdb/extension/icu/third_party/icu/common/unorm.cpp index 2d9f46052..f2ef7fa66 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unorm.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unorm.cpp @@ -44,7 +44,7 @@ U_NAMESPACE_USE /* quick check functions ---------------------------------------------------- */ U_CAPI UNormalizationCheckResult U_EXPORT2 -unorm_quickCheck(const UChar *src, +unorm_quickCheck(const char16_t *src, int32_t srcLength, UNormalizationMode mode, UErrorCode *pErrorCode) { @@ -53,7 +53,7 @@ unorm_quickCheck(const UChar *src, } U_CAPI UNormalizationCheckResult U_EXPORT2 -unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, +unorm_quickCheckWithOptions(const char16_t *src, int32_t srcLength, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode) { const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode); @@ -68,7 +68,7 @@ unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, } U_CAPI UBool U_EXPORT2 -unorm_isNormalized(const UChar *src, int32_t srcLength, +unorm_isNormalized(const char16_t *src, int32_t srcLength, UNormalizationMode mode, UErrorCode *pErrorCode) { const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode); @@ -76,7 +76,7 @@ unorm_isNormalized(const UChar *src, int32_t srcLength, } U_CAPI UBool U_EXPORT2 -unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, +unorm_isNormalizedWithOptions(const char16_t *src, int32_t srcLength, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode) { const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode); @@ -94,9 +94,9 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, /** Public API for normalizing. */ U_CAPI int32_t U_EXPORT2 -unorm_normalize(const UChar *src, int32_t srcLength, +unorm_normalize(const char16_t *src, int32_t srcLength, UNormalizationMode mode, int32_t options, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode); if(options&UNORM_UNICODE_3_2) { @@ -115,20 +115,20 @@ unorm_normalize(const UChar *src, int32_t srcLength, static int32_t _iterate(UCharIterator *src, UBool forward, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, const Normalizer2 *n2, UBool doNormalize, UBool *pNeededToNormalize, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return 0; } - if(destCapacity<0 || (dest==NULL && destCapacity>0) || src==NULL) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0) || src==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } - if(pNeededToNormalize!=NULL) { - *pNeededToNormalize=FALSE; + if(pNeededToNormalize!=nullptr) { + *pNeededToNormalize=false; } if(!(forward ? src->hasNext(src) : src->hasPrevious(src))) { return u_terminateUChars(dest, destCapacity, 0, pErrorCode); @@ -163,7 +163,7 @@ _iterate(UCharIterator *src, UBool forward, UnicodeString destString(dest, 0, destCapacity); if(buffer.length()>0 && doNormalize) { n2->normalize(buffer, destString, *pErrorCode).extract(dest, destCapacity, *pErrorCode); - if(pNeededToNormalize!=NULL && U_SUCCESS(*pErrorCode)) { + if(pNeededToNormalize!=nullptr && U_SUCCESS(*pErrorCode)) { *pNeededToNormalize= destString!=buffer; } return destString.length(); @@ -175,7 +175,7 @@ _iterate(UCharIterator *src, UBool forward, static int32_t unorm_iterate(UCharIterator *src, UBool forward, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, UBool doNormalize, UBool *pNeededToNormalize, UErrorCode *pErrorCode) { @@ -195,11 +195,11 @@ unorm_iterate(UCharIterator *src, UBool forward, U_CAPI int32_t U_EXPORT2 unorm_previous(UCharIterator *src, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, UBool doNormalize, UBool *pNeededToNormalize, UErrorCode *pErrorCode) { - return unorm_iterate(src, FALSE, + return unorm_iterate(src, false, dest, destCapacity, mode, options, doNormalize, pNeededToNormalize, @@ -208,11 +208,11 @@ unorm_previous(UCharIterator *src, U_CAPI int32_t U_EXPORT2 unorm_next(UCharIterator *src, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, UBool doNormalize, UBool *pNeededToNormalize, UErrorCode *pErrorCode) { - return unorm_iterate(src, TRUE, + return unorm_iterate(src, true, dest, destCapacity, mode, options, doNormalize, pNeededToNormalize, @@ -222,22 +222,22 @@ unorm_next(UCharIterator *src, /* Concatenation of normalized strings -------------------------------------- */ static int32_t -_concatenate(const UChar *left, int32_t leftLength, - const UChar *right, int32_t rightLength, - UChar *dest, int32_t destCapacity, +_concatenate(const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength, + char16_t *dest, int32_t destCapacity, const Normalizer2 *n2, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return 0; } - if(destCapacity<0 || (dest==NULL && destCapacity>0) || - left==NULL || leftLength<-1 || right==NULL || rightLength<-1) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0) || + left==nullptr || leftLength<-1 || right==nullptr || rightLength<-1) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } /* check for overlapping right and destination */ - if( dest!=NULL && + if( dest!=nullptr && ((right>=dest && right<(dest+destCapacity)) || (rightLength>0 && dest>=right && dest<(right+rightLength))) ) { @@ -258,9 +258,9 @@ _concatenate(const UChar *left, int32_t leftLength, } U_CAPI int32_t U_EXPORT2 -unorm_concatenate(const UChar *left, int32_t leftLength, - const UChar *right, int32_t rightLength, - UChar *dest, int32_t destCapacity, +unorm_concatenate(const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength, + char16_t *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode) { const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode); diff --git a/src/duckdb/extension/icu/third_party/icu/common/unormcmp.cpp b/src/duckdb/extension/icu/third_party/icu/common/unormcmp.cpp index 02651415f..e11e716c8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unormcmp.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/unormcmp.cpp @@ -127,10 +127,10 @@ U_NAMESPACE_USE */ /* stack element for previous-level source/decomposition pointers */ -struct unormcmp_CmpEquivLevel { - const UChar *start, *s, *limit; +struct CmpEquivLevel { + const char16_t *start, *s, *limit; }; -typedef struct unormcmp_CmpEquivLevel unormcmp_CmpEquivLevel; +typedef struct CmpEquivLevel CmpEquivLevel; /** * Internal option for unorm_cmpEquivFold() for decomposing. @@ -140,27 +140,27 @@ typedef struct unormcmp_CmpEquivLevel unormcmp_CmpEquivLevel; /* internal function */ static int32_t -unorm_cmpEquivFold(const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, +unorm_cmpEquivFold(const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode) { const Normalizer2Impl *nfcImpl; /* current-level start/limit - s1/s2 as current */ - const UChar *start1, *start2, *limit1, *limit2; + const char16_t *start1, *start2, *limit1, *limit2; /* decomposition and case folding variables */ - const UChar *p; + const char16_t *p; int32_t length; /* stacks of previous-level start/current/limit */ - unormcmp_CmpEquivLevel stack1[2], stack2[2]; + CmpEquivLevel stack1[2], stack2[2]; /* buffers for algorithmic decompositions */ - UChar decomp1[4], decomp2[4]; + char16_t decomp1[4], decomp2[4]; /* case folding buffers, only use current-level start/limit */ - UChar fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1]; + char16_t fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1]; /* track which is the current level per string */ int32_t level1, level2; @@ -180,7 +180,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, if((options&_COMPARE_EQUIV)!=0) { nfcImpl=Normalizer2Factory::getNFCImpl(*pErrorCode); } else { - nfcImpl=NULL; + nfcImpl=nullptr; } if(U_FAILURE(*pErrorCode)) { return 0; @@ -189,14 +189,14 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, /* initialize */ start1=s1; if(length1==-1) { - limit1=NULL; + limit1=nullptr; } else { limit1=s1+length1; } start2=s2; if(length2==-1) { - limit2=NULL; + limit2=nullptr; } else { limit2=s2+length2; } @@ -214,7 +214,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, if(c1<0) { /* get next code unit from string 1, post-increment */ for(;;) { - if(s1==limit1 || ((c1=*s1)==0 && (limit1==NULL || (options&_STRNCMP_STYLE)))) { + if(s1==limit1 || ((c1=*s1)==0 && (limit1==nullptr || (options&_STRNCMP_STYLE)))) { if(level1==0) { c1=-1; break; @@ -228,7 +228,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, do { --level1; start1=stack1[level1].start; /*Not uninitialized*/ - } while(start1==NULL); + } while(start1==nullptr); s1=stack1[level1].s; /*Not uninitialized*/ limit1=stack1[level1].limit; /*Not uninitialized*/ } @@ -237,7 +237,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, if(c2<0) { /* get next code unit from string 2, post-increment */ for(;;) { - if(s2==limit2 || ((c2=*s2)==0 && (limit2==NULL || (options&_STRNCMP_STYLE)))) { + if(s2==limit2 || ((c2=*s2)==0 && (limit2==nullptr || (options&_STRNCMP_STYLE)))) { if(level2==0) { c2=-1; break; @@ -251,7 +251,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, do { --level2; start2=stack2[level2].start; /*Not uninitialized*/ - } while(start2==NULL); + } while(start2==nullptr); s2=stack2[level2].s; /*Not uninitialized*/ limit2=stack2[level2].limit; /*Not uninitialized*/ } @@ -277,7 +277,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, /* get complete code points for c1, c2 for lookups if either is a surrogate */ cp1=c1; if(U_IS_SURROGATE(c1)) { - UChar c; + char16_t c; if(U_IS_SURROGATE_LEAD(c1)) { if(s1!=limit1 && U16_IS_TRAIL(c=*s1)) { @@ -293,7 +293,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, cp2=c2; if(U_IS_SURROGATE(c2)) { - UChar c; + char16_t c; if(U_IS_SURROGATE_LEAD(c2)) { if(s2!=limit2 && U16_IS_TRAIL(c=*s2)) { @@ -431,7 +431,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, /* set empty intermediate level if skipped */ if(level1<2) { - stack1[level1++].start=NULL; + stack1[level1++].start=nullptr; } /* set next level pointers to decomposition */ @@ -472,7 +472,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, /* set empty intermediate level if skipped */ if(level2<2) { - stack2[level2++].start=NULL; + stack2[level2++].start=nullptr; } /* set next level pointers to decomposition */ @@ -529,14 +529,14 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1, } static -UBool _normalize(const Normalizer2 *n2, const UChar *s, int32_t length, +UBool _normalize(const Normalizer2 *n2, const char16_t *s, int32_t length, UnicodeString &normalized, UErrorCode *pErrorCode) { UnicodeString str(length<0, s, length); // check if s fulfill the conditions int32_t spanQCYes=n2->spanQuickCheckYes(str, *pErrorCode); if (U_FAILURE(*pErrorCode)) { - return FALSE; + return false; } /* * ICU 2.4 had a further optimization: @@ -548,18 +548,18 @@ UBool _normalize(const Normalizer2 *n2, const UChar *s, int32_t length, */ if(spanQCYesnormalizeSecondAndAppend(normalized, unnormalized, *pErrorCode); if (U_SUCCESS(*pErrorCode)) { - return TRUE; + return true; } } - return FALSE; + return false; } U_CAPI int32_t U_EXPORT2 -unorm_compare(const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, +unorm_compare(const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode) { /* argument checking */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/unormimp.h b/src/duckdb/extension/icu/third_party/icu/common/unormimp.h index 88c7975cc..f107eac67 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/unormimp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/unormimp.h @@ -388,7 +388,7 @@ enum { * * Strings are either stored as a single code unit or as the length * followed by that many units. - * const UChar *s=extraData+(index from auxTrie data bits 9..0); + * const char16_t *s=extraData+(index from auxTrie data bits 9..0); * int32_t length; * if(*s<0xff00) { * // s points to the single-unit string @@ -418,7 +418,7 @@ enum { * The same bit is used for NFC and NFKC; (c) differs for them. * As usual, we build the "not skippable" flags so that unassigned * code points get a 0 bit. - * This bit is only valid after (a)..(e) test FALSE; test NFD_NO before (f) as well. + * This bit is only valid after (a)..(e) test false; test NFD_NO before (f) as well. * Test Hangul LV syllables entirely in code. * * diff --git a/src/duckdb/extension/icu/third_party/icu/common/uobject.cpp b/src/duckdb/extension/icu/third_party/icu/common/uobject.cpp index e222b2ce9..c9e435cec 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uobject.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uobject.cpp @@ -58,32 +58,32 @@ U_NAMESPACE_BEGIN * and replace with uprv_malloc/uprv_free. */ -void * U_EXPORT2 UMemory::operator new(size_t size) U_NOEXCEPT { +void * U_EXPORT2 UMemory::operator new(size_t size) noexcept { return uprv_malloc(size); } -void U_EXPORT2 UMemory::operator delete(void *p) U_NOEXCEPT { - if(p!=NULL) { +void U_EXPORT2 UMemory::operator delete(void *p) noexcept { + if(p!=nullptr) { uprv_free(p); } } -void * U_EXPORT2 UMemory::operator new[](size_t size) U_NOEXCEPT { +void * U_EXPORT2 UMemory::operator new[](size_t size) noexcept { return uprv_malloc(size); } -void U_EXPORT2 UMemory::operator delete[](void *p) U_NOEXCEPT { - if(p!=NULL) { +void U_EXPORT2 UMemory::operator delete[](void *p) noexcept { + if(p!=nullptr) { uprv_free(p); } } #if U_HAVE_DEBUG_LOCATION_NEW -void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NOEXCEPT { +void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) noexcept { return UMemory::operator new(size); } -void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NOEXCEPT { +void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) noexcept { UMemory::operator delete(p); } #endif /* U_HAVE_DEBUG_LOCATION_NEW */ @@ -93,7 +93,7 @@ void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*lin UObject::~UObject() {} -UClassID UObject::getDynamicClassID() const { return NULL; } +UClassID UObject::getDynamicClassID() const { return nullptr; } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/uposixdefs.h b/src/duckdb/extension/icu/third_party/icu/common/uposixdefs.h index 45ca1233a..826c9bb47 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uposixdefs.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uposixdefs.h @@ -48,7 +48,7 @@ #endif /* - * Make sure things like readlink and such functions work. + * Make sure things like realpath and such functions work. * Poorly upgraded Solaris machines can't have this defined. * Cleanly installed Solaris can use this #define. * @@ -68,4 +68,10 @@ # define _STDC_C99 #endif +#if !defined _POSIX_C_SOURCE && \ + defined(__APPLE__) && defined(__MACH__) && !defined(__clang__) +// Needed to prevent EOWNERDEAD issues with GCC on Mac +#define _POSIX_C_SOURCE 200809L +#endif + #endif /* __UPOSIXDEFS_H__ */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/uprops.cpp b/src/duckdb/extension/icu/third_party/icu/common/uprops.cpp index 1604ad9a1..314fa6fb8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uprops.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uprops.cpp @@ -30,7 +30,9 @@ #include "unicode/unorm2.h" #include "unicode/uscript.h" #include "unicode/ustring.h" +#include "unicode/utf16.h" #include "cstring.h" +#include "emojiprops.h" #include "mutex.h" #include "normalizer2impl.h" #include "umutex.h" @@ -47,7 +49,7 @@ U_NAMESPACE_USE namespace { -icu::UInitOnce gLayoutInitOnce = U_INITONCE_INITIALIZER; +icu::UInitOnce gLayoutInitOnce {}; UDataMemory *gLayoutMemory = nullptr; UCPTrie *gInpcTrie = nullptr; // Indic_Positional_Category @@ -74,7 +76,7 @@ UBool U_CALLCONV uprops_cleanup() { gMaxVoValue = 0; gLayoutInitOnce.reset(); - return TRUE; + return true; } UBool U_CALLCONV @@ -139,7 +141,7 @@ void U_CALLCONV ulayout_load(UErrorCode &errorCode) { } UBool ulayout_ensureData(UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return FALSE; } + if (U_FAILURE(errorCode)) { return false; } umtx_initOnce(gLayoutInitOnce, &ulayout_load, errorCode); return U_SUCCESS(errorCode); } @@ -186,7 +188,7 @@ static UBool isJoinControl(const BinaryProperty &/*prop*/, UChar32 c, UProperty #if UCONFIG_NO_NORMALIZATION static UBool hasFullCompositionExclusion(const BinaryProperty &, UChar32, UProperty) { - return FALSE; + return false; } #else static UBool hasFullCompositionExclusion(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) { @@ -200,7 +202,7 @@ static UBool hasFullCompositionExclusion(const BinaryProperty &/*prop*/, UChar32 // UCHAR_NF*_INERT properties #if UCONFIG_NO_NORMALIZATION static UBool isNormInert(const BinaryProperty &, UChar32, UProperty) { - return FALSE; + return false; } #else static UBool isNormInert(const BinaryProperty &/*prop*/, UChar32 c, UProperty which) { @@ -213,7 +215,7 @@ static UBool isNormInert(const BinaryProperty &/*prop*/, UChar32 c, UProperty wh #if UCONFIG_NO_NORMALIZATION static UBool changesWhenCasefolded(const BinaryProperty &, UChar32, UProperty) { - return FALSE; + return false; } #else static UBool changesWhenCasefolded(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) { @@ -221,7 +223,7 @@ static UBool changesWhenCasefolded(const BinaryProperty &/*prop*/, UChar32 c, UP UErrorCode errorCode=U_ZERO_ERROR; const Normalizer2 *nfcNorm2=Normalizer2::getNFCInstance(errorCode); if(U_FAILURE(errorCode)) { - return FALSE; + return false; } if(nfcNorm2->getDecomposition(c, nfd)) { /* c has a decomposition */ @@ -235,36 +237,36 @@ static UBool changesWhenCasefolded(const BinaryProperty &/*prop*/, UChar32 c, UP c=U_SENTINEL; } } else if(c<0) { - return FALSE; /* protect against bad input */ + return false; /* protect against bad input */ } if(c>=0) { /* single code point */ - const UChar *resultString; + const char16_t *resultString; return (UBool)(ucase_toFullFolding(c, &resultString, U_FOLD_CASE_DEFAULT)>=0); } else { /* guess some large but stack-friendly capacity */ - UChar dest[2*UCASE_MAX_STRING_LENGTH]; + char16_t dest[2*UCASE_MAX_STRING_LENGTH]; int32_t destLength; destLength=u_strFoldCase(dest, UPRV_LENGTHOF(dest), nfd.getBuffer(), nfd.length(), U_FOLD_CASE_DEFAULT, &errorCode); return (UBool)(U_SUCCESS(errorCode) && 0!=u_strCompare(nfd.getBuffer(), nfd.length(), - dest, destLength, FALSE)); + dest, destLength, false)); } } #endif #if UCONFIG_NO_NORMALIZATION static UBool changesWhenNFKC_Casefolded(const BinaryProperty &, UChar32, UProperty) { - return FALSE; + return false; } #else static UBool changesWhenNFKC_Casefolded(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) { UErrorCode errorCode=U_ZERO_ERROR; const Normalizer2Impl *kcf=Normalizer2Factory::getNFKC_CFImpl(errorCode); if(U_FAILURE(errorCode)) { - return FALSE; + return false; } UnicodeString src(c); UnicodeString dest; @@ -274,9 +276,9 @@ static UBool changesWhenNFKC_Casefolded(const BinaryProperty &/*prop*/, UChar32 ReorderingBuffer buffer(*kcf, dest); // Small destCapacity for NFKC_CF(c). if(buffer.init(5, errorCode)) { - const UChar *srcArray=src.getBuffer(); - kcf->compose(srcArray, srcArray+src.length(), FALSE, - TRUE, buffer, errorCode); + const char16_t *srcArray=src.getBuffer(); + kcf->compose(srcArray, srcArray+src.length(), false, + true, buffer, errorCode); } } return U_SUCCESS(errorCode) && dest!=src; @@ -285,7 +287,7 @@ static UBool changesWhenNFKC_Casefolded(const BinaryProperty &/*prop*/, UChar32 #if UCONFIG_NO_NORMALIZATION static UBool isCanonSegmentStarter(const BinaryProperty &, UChar32, UProperty) { - return FALSE; + return false; } #else static UBool isCanonSegmentStarter(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) { @@ -322,6 +324,57 @@ static UBool isRegionalIndicator(const BinaryProperty &/*prop*/, UChar32 c, UPro return 0x1F1E6<=c && c<=0x1F1FF; } +static UBool hasEmojiProperty(const BinaryProperty &/*prop*/, UChar32 c, UProperty which) { + return EmojiProps::hasBinaryProperty(c, which); +} + +static UBool isIDSUnaryOperator(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) { + // New in Unicode 15.1 for just two characters. + return 0x2FFE<=c && c<=0x2FFF; +} + +/** Ranges (start/limit pairs) of ID_Compat_Math_Continue (only), from UCD PropList.txt. */ +static constexpr UChar32 ID_COMPAT_MATH_CONTINUE[] = { + 0x00B2, 0x00B3 + 1, + 0x00B9, 0x00B9 + 1, + 0x2070, 0x2070 + 1, + 0x2074, 0x207E + 1, + 0x2080, 0x208E + 1 +}; + +/** ID_Compat_Math_Start characters, from UCD PropList.txt. */ +static constexpr UChar32 ID_COMPAT_MATH_START[] = { + 0x2202, + 0x2207, + 0x221E, + 0x1D6C1, + 0x1D6DB, + 0x1D6FB, + 0x1D715, + 0x1D735, + 0x1D74F, + 0x1D76F, + 0x1D789, + 0x1D7A9, + 0x1D7C3 +}; + +static UBool isIDCompatMathStart(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) { + if (c < ID_COMPAT_MATH_START[0]) { return false; } // fastpath for common scripts + for (UChar32 startChar : ID_COMPAT_MATH_START) { + if (c == startChar) { return true; } + } + return false; +} + +static UBool isIDCompatMathContinue(const BinaryProperty &prop, UChar32 c, UProperty /*which*/) { + for (int32_t i = 0; i < UPRV_LENGTHOF(ID_COMPAT_MATH_CONTINUE); i += 2) { + if (c < ID_COMPAT_MATH_CONTINUE[i]) { return false; } // below range start + if (c < ID_COMPAT_MATH_CONTINUE[i + 1]) { return true; } // below range limit + } + return isIDCompatMathStart(prop, c, UCHAR_ID_COMPAT_MATH_START); +} + static const BinaryProperty binProps[UCHAR_BINARY_LIMIT]={ /* * column and mask values for binary properties from u_getUnicodeProperties(). @@ -388,14 +441,24 @@ static const BinaryProperty binProps[UCHAR_BINARY_LIMIT]={ { UPROPS_SRC_CASE_AND_NORM, 0, changesWhenCasefolded }, { UPROPS_SRC_CASE, 0, caseBinaryPropertyContains }, // UCHAR_CHANGES_WHEN_CASEMAPPED { UPROPS_SRC_NFKC_CF, 0, changesWhenNFKC_Casefolded }, - { 2, U_MASK(UPROPS_2_EMOJI), defaultContains }, - { 2, U_MASK(UPROPS_2_EMOJI_PRESENTATION), defaultContains }, - { 2, U_MASK(UPROPS_2_EMOJI_MODIFIER), defaultContains }, - { 2, U_MASK(UPROPS_2_EMOJI_MODIFIER_BASE), defaultContains }, - { 2, U_MASK(UPROPS_2_EMOJI_COMPONENT), defaultContains }, + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_EMOJI + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_EMOJI_PRESENTATION + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_EMOJI_MODIFIER + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_EMOJI_MODIFIER_BASE + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_EMOJI_COMPONENT { 2, 0, isRegionalIndicator }, { 1, U_MASK(UPROPS_PREPENDED_CONCATENATION_MARK), defaultContains }, - { 2, U_MASK(UPROPS_2_EXTENDED_PICTOGRAPHIC), defaultContains }, + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_EXTENDED_PICTOGRAPHIC + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_BASIC_EMOJI + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_EMOJI_KEYCAP_SEQUENCE + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_RGI_EMOJI_MODIFIER_SEQUENCE + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_RGI_EMOJI_FLAG_SEQUENCE + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_RGI_EMOJI_TAG_SEQUENCE + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_RGI_EMOJI_ZWJ_SEQUENCE + { UPROPS_SRC_EMOJI, 0, hasEmojiProperty }, // UCHAR_RGI_EMOJI + { UPROPS_SRC_IDSU, 0, isIDSUnaryOperator }, // UCHAR_IDS_UNARY_OPERATOR + { UPROPS_SRC_ID_COMPAT_MATH, 0, isIDCompatMathStart }, // UCHAR_ID_COMPAT_MATH_START + { UPROPS_SRC_ID_COMPAT_MATH, 0, isIDCompatMathContinue }, // UCHAR_ID_COMPAT_MATH_CONTINUE }; U_CAPI UBool U_EXPORT2 @@ -403,13 +466,46 @@ u_hasBinaryProperty(UChar32 c, UProperty which) { /* c is range-checked in the functions that are called from here */ if(which 0 ? i == length : s[i] == 0) { + return u_hasBinaryProperty(c, which); // single code point + } + } + // Only call into EmojiProps for a relevant property, + // so that we not unnecessarily try to load its data file. + return UCHAR_BASIC_EMOJI <= which && which <= UCHAR_RGI_EMOJI && + EmojiProps::hasBinaryProperty(s, length, which); +} + struct IntProperty; typedef int32_t IntPropertyGetValue(const IntProperty &prop, UChar32 c, UProperty which); @@ -637,7 +733,7 @@ U_CAPI int32_t U_EXPORT2 u_getIntPropertyMaxValue(UProperty which) { if(whichadd(sa->set, c); + } + // single characters + for (UChar32 c : ID_COMPAT_MATH_START) { + sa->add(sa->set, c); + sa->add(sa->set, c + 1); + } + return; + } if (!ulayout_ensureData(*pErrorCode)) { return; } const UCPTrie *trie; switch (src) { @@ -747,11 +856,11 @@ uprops_addPropertyStarts(UPropertySource src, const USetAdder *sa, UErrorCode *p #if !UCONFIG_NO_NORMALIZATION U_CAPI int32_t U_EXPORT2 -u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode) { - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { +u_getFC_NFKC_Closure(UChar32 c, char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(destCapacity<0 || (dest==NULL && destCapacity>0)) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -767,7 +876,7 @@ u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *p } // first: b = NFKC(Fold(a)) UnicodeString folded1String; - const UChar *folded1; + const char16_t *folded1; int32_t folded1Length=ucase_toFullFolding(c, &folded1, U_FOLD_CASE_DEFAULT); if(folded1Length<0) { const Normalizer2Impl *nfkcImpl=Normalizer2Factory::getImpl(nfkc); @@ -779,7 +888,7 @@ u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *p if(folded1Length>UCASE_MAX_STRING_LENGTH) { folded1String.setTo(folded1Length); } else { - folded1String.setTo(FALSE, folded1, folded1Length); + folded1String.setTo(false, folded1, folded1Length); } } UnicodeString kc1=nfkc->normalize(folded1String, *pErrorCode); diff --git a/src/duckdb/extension/icu/third_party/icu/common/uprops.h b/src/duckdb/extension/icu/third_party/icu/common/uprops.h index dacdba293..80347eab5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uprops.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uprops.h @@ -224,7 +224,8 @@ enum { /* * Properties in vector word 2 * Bits - * 31..26 http://www.unicode.org/reports/tr51/#Emoji_Properties + * 31..26 unused since ICU 70 added uemoji.icu; + * in ICU 57..69 stored emoji properties * 25..20 Line Break * 19..15 Sentence Break * 14..10 Word Break @@ -232,12 +233,12 @@ enum { * 4.. 0 Decomposition Type */ enum { - UPROPS_2_EXTENDED_PICTOGRAPHIC=26, - UPROPS_2_EMOJI_COMPONENT, - UPROPS_2_EMOJI, - UPROPS_2_EMOJI_PRESENTATION, - UPROPS_2_EMOJI_MODIFIER, - UPROPS_2_EMOJI_MODIFIER_BASE + UPROPS_2_UNUSED_WAS_EXTENDED_PICTOGRAPHIC=26, // ICU 62..69 + UPROPS_2_UNUSED_WAS_EMOJI_COMPONENT, // ICU 60..69 + UPROPS_2_UNUSED_WAS_EMOJI, // ICU 57..69 + UPROPS_2_UNUSED_WAS_EMOJI_PRESENTATION, // ICU 57..69 + UPROPS_2_UNUSED_WAS_EMOJI_MODIFIER, // ICU 57..69 + UPROPS_2_UNUSED_WAS_EMOJI_MODIFIER_BASE // ICU 57..69 }; #define UPROPS_LB_MASK 0x03f00000 @@ -310,73 +311,21 @@ u_isgraphPOSIX(UChar32 c); U_CFUNC UBool u_isprintPOSIX(UChar32 c); -/** Turn a bit index into a bit flag. @internal */ -#define UPROPS_FLAG(n) ((uint32_t)1<<(n)) - -/** Flags for general categories in the order of UCharCategory. @internal */ -#define _Cn UPROPS_FLAG(U_GENERAL_OTHER_TYPES) -#define _Lu UPROPS_FLAG(U_UPPERCASE_LETTER) -#define _Ll UPROPS_FLAG(U_LOWERCASE_LETTER) -#define _Lt UPROPS_FLAG(U_TITLECASE_LETTER) -#define _Lm UPROPS_FLAG(U_MODIFIER_LETTER) -/* #define _Lo UPROPS_FLAG(U_OTHER_LETTER) -- conflicts with MS Visual Studio 9.0 xiosbase */ -#define _Mn UPROPS_FLAG(U_NON_SPACING_MARK) -#define _Me UPROPS_FLAG(U_ENCLOSING_MARK) -#define _Mc UPROPS_FLAG(U_COMBINING_SPACING_MARK) -#define _Nd UPROPS_FLAG(U_DECIMAL_DIGIT_NUMBER) -#define _Nl UPROPS_FLAG(U_LETTER_NUMBER) -#define _No UPROPS_FLAG(U_OTHER_NUMBER) -#define _Zs UPROPS_FLAG(U_SPACE_SEPARATOR) -#define _Zl UPROPS_FLAG(U_LINE_SEPARATOR) -#define _Zp UPROPS_FLAG(U_PARAGRAPH_SEPARATOR) -#define _Cc UPROPS_FLAG(U_CONTROL_CHAR) -#define _Cf UPROPS_FLAG(U_FORMAT_CHAR) -#define _Co UPROPS_FLAG(U_PRIVATE_USE_CHAR) -#define _Cs UPROPS_FLAG(U_SURROGATE) -#define _Pd UPROPS_FLAG(U_DASH_PUNCTUATION) -#define _Ps UPROPS_FLAG(U_START_PUNCTUATION) -/* #define _Pe UPROPS_FLAG(U_END_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 xlocnum */ -/* #define _Pc UPROPS_FLAG(U_CONNECTOR_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 streambuf */ -#define _Po UPROPS_FLAG(U_OTHER_PUNCTUATION) -#define _Sm UPROPS_FLAG(U_MATH_SYMBOL) -#define _Sc UPROPS_FLAG(U_CURRENCY_SYMBOL) -#define _Sk UPROPS_FLAG(U_MODIFIER_SYMBOL) -#define _So UPROPS_FLAG(U_OTHER_SYMBOL) -#define _Pi UPROPS_FLAG(U_INITIAL_PUNCTUATION) -/* #define _Pf UPROPS_FLAG(U_FINAL_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 streambuf */ - /** Some code points. @internal */ enum { - uprops_TAB =0x0009, - uprops_LF =0x000a, - uprops_FF =0x000c, - uprops_CR =0x000d, - uprops_U_A =0x0041, - uprops_U_F =0x0046, - uprops_U_Z =0x005a, - uprops_U_a =0x0061, - uprops_U_f =0x0066, - uprops_U_z =0x007a, - uprops_DEL =0x007f, - uprops_NL =0x0085, - uprops_NBSP =0x00a0, - uprops_CGJ =0x034f, - uprops_FIGURESP=0x2007, - uprops_HAIRSP =0x200a, - uprops_ZWNJ =0x200c, - uprops_ZWJ =0x200d, - uprops_RLM =0x200f, - uprops_NNBSP =0x202f, - uprops_WJ =0x2060, - uprops_INHSWAP =0x206a, - uprops_NOMDIG =0x206f, - uprops_U_FW_A =0xff21, - uprops_U_FW_F =0xff26, - uprops_U_FW_Z =0xff3a, - uprops_U_FW_a =0xff41, - uprops_U_FW_f =0xff46, - uprops_U_FW_z =0xff5a, - uprops_ZWNBSP =0xfeff + TAB =0x0009, + LF =0x000a, + FF =0x000c, + CR =0x000d, + NBSP =0x00a0, + CGJ =0x034f, + FIGURESP=0x2007, + HAIRSP =0x200a, + ZWNJ =0x200c, + ZWJ =0x200d, + RLM =0x200f, + NNBSP =0x202f, + ZWNBSP =0xfeff }; /** @@ -429,6 +378,9 @@ enum UPropertySource { UPROPS_SRC_INPC, UPROPS_SRC_INSC, UPROPS_SRC_VO, + UPROPS_SRC_EMOJI, + UPROPS_SRC_IDSU, + UPROPS_SRC_ID_COMPAT_MATH, /** One more than the highest UPropertySource (UPROPS_SRC_) constant. */ UPROPS_SRC_COUNT }; @@ -491,6 +443,7 @@ class CharacterProperties { public: CharacterProperties() = delete; static const UnicodeSet *getInclusionsForProperty(UProperty prop, UErrorCode &errorCode); + static const UnicodeSet *getBinaryPropertySet(UProperty property, UErrorCode &errorCode); }; // implemented in uniset_props.cpp diff --git a/src/duckdb/extension/icu/third_party/icu/common/ures_cnv.cpp b/src/duckdb/extension/icu/third_party/icu/common/ures_cnv.cpp index 1aa58e753..0a2b1e912 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ures_cnv.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ures_cnv.cpp @@ -27,7 +27,7 @@ #include "ustr_cnv.h" U_CAPI UResourceBundle * U_EXPORT2 -ures_openU(const UChar *myPath, +ures_openU(const char16_t *myPath, const char *localeID, UErrorCode *status) { @@ -35,17 +35,17 @@ ures_openU(const UChar *myPath, int32_t length; char *path = pathBuffer; - if(status==NULL || U_FAILURE(*status)) { - return NULL; + if(status==nullptr || U_FAILURE(*status)) { + return nullptr; } - if(myPath==NULL) { - path = NULL; + if(myPath==nullptr) { + path = nullptr; } else { length=u_strlen(myPath); if(length>=(int32_t)sizeof(pathBuffer)) { *status=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } else if(uprv_isInvariantUString(myPath, length)) { /* * the invariant converter is sufficient for package and tree names @@ -59,17 +59,17 @@ ures_openU(const UChar *myPath, length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(pathBuffer), myPath, length, status); u_releaseDefaultConverter(cnv); if(U_FAILURE(*status)) { - return NULL; + return nullptr; } if(length>=(int32_t)sizeof(pathBuffer)) { /* not NUL-terminated - path too long */ *status=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } #else /* the default converter is not available */ *status=U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; #endif } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp b/src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp index 61b2f4334..5aa1c5fa2 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp @@ -24,6 +24,7 @@ #include "unicode/ures.h" #include "unicode/ustring.h" #include "unicode/ucnv.h" +#include "bytesinkutil.h" #include "charstr.h" #include "uresimp.h" #include "ustr_imp.h" @@ -44,12 +45,12 @@ using namespace icu; /* -Static uresbund_cache for already opened resource bundles - mostly for keeping fallback info -TODO: This uresbund_cache should probably be removed when the deprecated code is +Static cache for already opened resource bundles - mostly for keeping fallback info +TODO: This cache should probably be removed when the deprecated code is completely removed. */ -static UHashtable *uresbund_cache = NULL; -static icu::UInitOnce uresbund_gCacheInitOnce = U_INITONCE_INITIALIZER; +static UHashtable *cache = nullptr; +static icu::UInitOnce gCacheInitOnce {}; static UMutex resbMutex; @@ -77,18 +78,224 @@ static UBool U_CALLCONV compareEntries(const UHashTok p1, const UHashTok p2) { /** - * Internal function, gets parts of locale name according + * Internal function, gets parts of locale name according * to the position of '_' character */ static UBool chopLocale(char *name) { char *i = uprv_strrchr(name, '_'); - if(i != NULL) { + if(i != nullptr) { *i = '\0'; - return TRUE; + return true; } - return FALSE; + return false; +} + +static UBool hasVariant(const char* localeID) { + UErrorCode err = U_ZERO_ERROR; + int32_t variantLength = uloc_getVariant(localeID, nullptr, 0, &err); + return variantLength != 0; +} + +// This file contains the tables for doing locale fallback, which are generated +// by the CLDR-to-ICU process directly from the CLDR data. This file should only +// ever be included from here. +#define INCLUDED_FROM_URESBUND_CPP +#include "localefallback_data.h" + +static const char* performFallbackLookup(const char* key, + const char* keyStrs, + const char* valueStrs, + const int32_t* lookupTable, + int32_t lookupTableLength) { + const int32_t* bottom = lookupTable; + const int32_t* top = lookupTable + lookupTableLength; + + while (bottom < top) { + // Effectively, divide by 2 and round down to an even index + const int32_t* middle = bottom + (((top - bottom) / 4) * 2); + const char* entryKey = &(keyStrs[*middle]); + int32_t strcmpResult = uprv_strcmp(key, entryKey); + if (strcmpResult == 0) { + return &(valueStrs[middle[1]]); + } else if (strcmpResult < 0) { + top = middle; + } else { + bottom = middle + 2; + } + } + return nullptr; +} + +static CharString getDefaultScript(const CharString& language, const CharString& region) { + const char* defaultScript = nullptr; + UErrorCode err = U_ZERO_ERROR; + + // the default script will be "Latn" if we don't find the locale ID in the tables + CharString result("Latn", err); + + // if we were passed both language and region, make them into a locale ID and look that up in the default + // script table + if (!region.isEmpty()) { + CharString localeID; + localeID.append(language, err).append("_", err).append(region, err); + if (U_FAILURE(err)) { + return result; + } + defaultScript = performFallbackLookup(localeID.data(), dsLocaleIDChars, scriptCodeChars, defaultScriptTable, UPRV_LENGTHOF(defaultScriptTable)); + } + + // if we didn't find anything, look up just the language in the default script table + if (defaultScript == nullptr) { + defaultScript = performFallbackLookup(language.data(), dsLocaleIDChars, scriptCodeChars, defaultScriptTable, UPRV_LENGTHOF(defaultScriptTable)); + } + + // if either lookup above succeeded, copy the result from "defaultScript" into "result"; otherwise, return "Latn" + if (defaultScript != nullptr) { + result.clear(); + result.append(defaultScript, err); + } + return result; +} + +enum UResOpenType { + /** + * Open a resource bundle for the locale; + * if there is not even a base language bundle, then fall back to the default locale; + * if there is no bundle for that either, then load the root bundle. + * + * This is the default bundle loading behavior. + */ + URES_OPEN_LOCALE_DEFAULT_ROOT, + // TODO: ICU ticket #11271 "consistent default locale across locale trees" + // Add an option to look at the main locale tree for whether to + // fall back to root directly (if the locale has main data) or + // fall back to the default locale first (if the locale does not even have main data). + /** + * Open a resource bundle for the locale; + * if there is not even a base language bundle, then load the root bundle; + * never fall back to the default locale. + * + * This is used for algorithms that have good pan-Unicode default behavior, + * such as case mappings, collation, and segmentation (BreakIterator). + */ + URES_OPEN_LOCALE_ROOT, + /** + * Open a resource bundle for the exact bundle name as requested; + * no fallbacks, do not load parent bundles. + * + * This is used for supplemental (non-locale) data. + */ + URES_OPEN_DIRECT +}; +typedef enum UResOpenType UResOpenType; + +/** + * Internal function, determines the search path for resource bundle files. + * Currently, this function is used only by findFirstExisting() to help search for resource bundle files when a bundle for the specified + * locale doesn't exist. The code that supports inheritance of resources between existing resource bundle files continues to + * use chopLocale() below. + * @param name In-out parameter: On input, the locale ID to get a parent locale ID for (this is a locale's base name, without keywords); on output, the + * requested parent locale ID. + * @param origName The original locale ID the caller of findFirstExisting() requested. This is the same as `name` on the first call to this function, + * but as findFirstExisting() ascends the resource bundle's parent tree, this parameter will continue to be the original locale ID requested. + */ +static bool getParentLocaleID(char *name, const char *origName, UResOpenType openType) { + // early out if the locale ID has a variant code or ends with _ + size_t nameLen = uprv_strlen(name); + if (!nameLen || name[nameLen - 1] == '_' || hasVariant(name)) { + return chopLocale(name); + } + + UErrorCode err = U_ZERO_ERROR; + const char* tempNamePtr = name; + CharString language = ulocimp_getLanguage(tempNamePtr, &tempNamePtr, err); + if (*tempNamePtr == '_') { + ++tempNamePtr; + } + CharString script = ulocimp_getScript(tempNamePtr, &tempNamePtr, err); + if (*tempNamePtr == '_') { + ++tempNamePtr; + } + CharString region = ulocimp_getCountry(tempNamePtr, &tempNamePtr, err); + CharString workingLocale; + if (U_FAILURE(err)) { + // hopefully this never happens... + return chopLocale(name); + } + + // if the open type is URES_OPEN_LOCALE_DEFAULT_ROOT, first look the locale ID up in the parent locale table; + // if that table specifies a parent for it, return that (we don't do this for the other open types-- if we're not + // falling back through the system default locale, we also want to do straight truncation fallback instead + // of looking things up in the parent locale table-- see https://www.unicode.org/reports/tr35/tr35.html#Parent_Locales: + // "Collation data, however, is an exception...") + if (openType == URES_OPEN_LOCALE_DEFAULT_ROOT) { + const char* parentID = performFallbackLookup(name, parentLocaleChars, parentLocaleChars, parentLocaleTable, UPRV_LENGTHOF(parentLocaleTable)); + if (parentID != nullptr) { + uprv_strcpy(name, parentID); + return true; + } + } + + // if it's not in the parent locale table, figure out the fallback script algorithmically + // (see CLDR-15265 for an explanation of the algorithm) + if (!script.isEmpty() && !region.isEmpty()) { + // if "name" has both script and region, is the script the default script? + // - if so, remove it and keep the region + // - if not, remove the region and keep the script + if (getDefaultScript(language, region) == script.toStringPiece()) { + workingLocale.append(language, err).append("_", err).append(region, err); + } else { + workingLocale.append(language, err).append("_", err).append(script, err); + } + } else if (!region.isEmpty()) { + // if "name" has region but not script, did the original locale ID specify a script? + // - if yes, replace the region with the script from the original locale ID + // - if no, replace the region with the default script for that language and region + UErrorCode err = U_ZERO_ERROR; + tempNamePtr = origName; + CharString origNameLanguage = ulocimp_getLanguage(tempNamePtr, &tempNamePtr, err); + if (*tempNamePtr == '_') { + ++tempNamePtr; + } + CharString origNameScript = ulocimp_getScript(origName, nullptr, err); + if (!origNameScript.isEmpty()) { + workingLocale.append(language, err).append("_", err).append(origNameScript, err); + } else { + workingLocale.append(language, err).append("_", err).append(getDefaultScript(language, region), err); + } + } else if (!script.isEmpty()) { + // if "name" has script but not region (and our open type if URES_OPEN_LOCALE_DEFAULT_ROOT), is the script + // the default script for the language? + // - if so, remove it from the locale ID + // - if not, return false to continue up the chain + // (we don't do this for other open types for the same reason we don't look things up in the parent + // locale table for other open types-- see the reference to UTS #35 above) + if (openType != URES_OPEN_LOCALE_DEFAULT_ROOT || getDefaultScript(language, CharString()) == script.toStringPiece()) { + workingLocale.append(language, err); + } else { + return false; + } + } else { + // if "name" just contains a language code, return false so the calling code falls back to "root" + return false; + } + if (U_SUCCESS(err) && !workingLocale.isEmpty()) { + uprv_strcpy(name, workingLocale.data()); + return true; + } else { + return false; + } +} + +/** + * Called to check whether a name without '_' needs to be checked for a parent. + * Some code had assumed that locale IDs with '_' could not have a non-root parent. + * We may want a better way of doing this. + */ +static UBool mayHaveParent(char *name) { + return (name[0] != 0 && uprv_strstr("nb nn",name) != nullptr); } /** @@ -97,7 +304,7 @@ static UBool chopLocale(char *name) { static void entryIncrease(UResourceDataEntry *entry) { Mutex lock(&resbMutex); entry->fCountExisting++; - while(entry->fParent != NULL) { + while(entry->fParent != nullptr) { entry = entry->fParent; entry->fCountExisting++; } @@ -107,62 +314,64 @@ static void entryIncrease(UResourceDataEntry *entry) { * Internal function. Tries to find a resource in given Resource * Bundle, as well as in its parents */ -static const ResourceData *getFallbackData(const UResourceBundle* resBundle, const char* * resTag, UResourceDataEntry* *realData, Resource *res, UErrorCode *status) { - UResourceDataEntry *resB = resBundle->fData; +static UResourceDataEntry *getFallbackData( + const UResourceBundle *resBundle, + const char **resTag, Resource *res, UErrorCode *status) { + UResourceDataEntry *dataEntry = resBundle->fData; int32_t indexR = -1; int32_t i = 0; *res = RES_BOGUS; - if(resB != NULL) { - if(resB->fBogus == U_ZERO_ERROR) { /* if this resource is real, */ - *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag); /* try to get data from there */ - i++; - } - if(resBundle->fHasFallback == TRUE) { - while(*res == RES_BOGUS && resB->fParent != NULL) { /* Otherwise, we'll look in parents */ - resB = resB->fParent; - if(resB->fBogus == U_ZERO_ERROR) { - i++; - *res = res_getTableItemByKey(&(resB->fData), resB->fData.rootRes, &indexR, resTag); - } + if(dataEntry == nullptr) { + *status = U_MISSING_RESOURCE_ERROR; + return nullptr; + } + if(dataEntry->fBogus == U_ZERO_ERROR) { /* if this resource is real, */ + *res = res_getTableItemByKey(&(dataEntry->fData), dataEntry->fData.rootRes, &indexR, resTag); /* try to get data from there */ + i++; + } + if(resBundle->fHasFallback) { + // Otherwise, we'll look in parents. + while(*res == RES_BOGUS && dataEntry->fParent != nullptr) { + dataEntry = dataEntry->fParent; + if(dataEntry->fBogus == U_ZERO_ERROR) { + i++; + *res = res_getTableItemByKey(&(dataEntry->fData), dataEntry->fData.rootRes, &indexR, resTag); } } + } - if(*res != RES_BOGUS) { /* If the resource is found in parents, we need to adjust the error */ - if(i>1) { - if(uprv_strcmp(resB->fName, uloc_getDefault())==0 || uprv_strcmp(resB->fName, kRootLocaleName)==0) { - *status = U_USING_DEFAULT_WARNING; - } else { - *status = U_USING_FALLBACK_WARNING; - } - } - *realData = resB; - return (&(resB->fData)); - } else { /* If resource is not found, we need to give an error */ - *status = U_MISSING_RESOURCE_ERROR; - return NULL; + if(*res == RES_BOGUS) { + // If the resource is not found, we need to give an error. + *status = U_MISSING_RESOURCE_ERROR; + return nullptr; + } + // If the resource is found in parents, we need to adjust the error. + if(i>1) { + if(uprv_strcmp(dataEntry->fName, uloc_getDefault())==0 || uprv_strcmp(dataEntry->fName, kRootLocaleName)==0) { + *status = U_USING_DEFAULT_WARNING; + } else { + *status = U_USING_FALLBACK_WARNING; } - } else { - *status = U_MISSING_RESOURCE_ERROR; - return NULL; } + return dataEntry; } static void free_entry(UResourceDataEntry *entry) { UResourceDataEntry *alias; res_unload(&(entry->fData)); - if(entry->fName != NULL && entry->fName != entry->fNameBuffer) { + if(entry->fName != nullptr && entry->fName != entry->fNameBuffer) { uprv_free(entry->fName); } - if(entry->fPath != NULL) { + if(entry->fPath != nullptr) { uprv_free(entry->fPath); } - if(entry->fPool != NULL) { + if(entry->fPool != nullptr) { --entry->fPool->fCountExisting; } alias = entry->fAlias; - if(alias != NULL) { - while(alias->fAlias != NULL) { + if(alias != nullptr) { + while(alias->fAlias != nullptr) { alias = alias->fAlias; } --alias->fCountExisting; @@ -183,15 +392,15 @@ static int32_t ures_flushCache() * return 0 */ Mutex lock(&resbMutex); - if (uresbund_cache == NULL) { + if (cache == nullptr) { return 0; } do { - deletedMore = FALSE; + deletedMore = false; /*creates an enumeration to iterate through every element in the table */ pos = UHASH_FIRST; - while ((e = uhash_nextElement(uresbund_cache, &pos)) != NULL) + while ((e = uhash_nextElement(cache, &pos)) != nullptr) { resB = (UResourceDataEntry *) e->value.pointer; /* Deletes only if reference counter == 0 @@ -205,8 +414,8 @@ static int32_t ures_flushCache() if (resB->fCountExisting == 0) { rbDeletedNum++; - deletedMore = TRUE; - uhash_removeElement(uresbund_cache, e); + deletedMore = true; + uhash_removeElement(cache, e); free_entry(resB); } } @@ -222,64 +431,64 @@ static int32_t ures_flushCache() #ifdef URES_DEBUG #include -U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) { - UBool uresbund_cacheNotEmpty = FALSE; +U_CAPI UBool U_EXPORT2 ures_dumpCacheContents() { + UBool cacheNotEmpty = false; int32_t pos = UHASH_FIRST; const UHashElement *e; UResourceDataEntry *resB; - + Mutex lock(&resbMutex); - if (uresbund_cache == NULL) { - fprintf(stderr,"%s:%d: RB Cache is NULL.\n", __FILE__, __LINE__); - return FALSE; + if (cache == nullptr) { + fprintf(stderr,"%s:%d: RB Cache is nullptr.\n", __FILE__, __LINE__); + return false; } - while ((e = uhash_nextElement(uresbund_cache, &pos)) != NULL) { - uresbund_cacheNotEmpty=TRUE; + while ((e = uhash_nextElement(cache, &pos)) != nullptr) { + cacheNotEmpty=true; resB = (UResourceDataEntry *) e->value.pointer; fprintf(stderr,"%s:%d: RB Cache: Entry @0x%p, refcount %d, name %s:%s. Pool 0x%p, alias 0x%p, parent 0x%p\n", __FILE__, __LINE__, (void*)resB, resB->fCountExisting, - resB->fName?resB->fName:"NULL", - resB->fPath?resB->fPath:"NULL", + resB->fName?resB->fName:"nullptr", + resB->fPath?resB->fPath:"nullptr", (void*)resB->fPool, (void*)resB->fAlias, - (void*)resB->fParent); + (void*)resB->fParent); } - - fprintf(stderr,"%s:%d: RB Cache still contains %d items.\n", __FILE__, __LINE__, uhash_count(uresbund_cache)); - return uresbund_cacheNotEmpty; + + fprintf(stderr,"%s:%d: RB Cache still contains %d items.\n", __FILE__, __LINE__, uhash_count(cache)); + return cacheNotEmpty; } #endif -static UBool U_CALLCONV ures_cleanup(void) +static UBool U_CALLCONV ures_cleanup() { - if (uresbund_cache != NULL) { + if (cache != nullptr) { ures_flushCache(); - uhash_close(uresbund_cache); - uresbund_cache = NULL; + uhash_close(cache); + cache = nullptr; } - uresbund_gCacheInitOnce.reset(); - return TRUE; + gCacheInitOnce.reset(); + return true; } -/** INTERNAL: Initializes the uresbund_cache for resources */ +/** INTERNAL: Initializes the cache for resources */ static void U_CALLCONV createCache(UErrorCode &status) { - U_ASSERT(uresbund_cache == NULL); - uresbund_cache = uhash_open(hashEntry, compareEntries, NULL, &status); + U_ASSERT(cache == nullptr); + cache = uhash_open(hashEntry, compareEntries, nullptr, &status); ucln_common_registerCleanup(UCLN_COMMON_URES, ures_cleanup); } - + static void initCache(UErrorCode *status) { - umtx_initOnce(uresbund_gCacheInitOnce, &createCache, *status); + umtx_initOnce(gCacheInitOnce, &createCache, *status); } /** INTERNAL: sets the name (locale) of the resource bundle to given name */ static void setEntryName(UResourceDataEntry *res, const char *name, UErrorCode *status) { int32_t len = (int32_t)uprv_strlen(name); - if(res->fName != NULL && res->fName != res->fNameBuffer) { + if(res->fName != nullptr && res->fName != res->fNameBuffer) { uprv_free(res->fName); } if (len < (int32_t)sizeof(res->fNameBuffer)) { @@ -288,7 +497,7 @@ static void setEntryName(UResourceDataEntry *res, const char *name, UErrorCode * else { res->fName = (char *)uprv_malloc(len+1); } - if(res->fName == NULL) { + if(res->fName == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; } else { uprv_strcpy(res->fName, name); @@ -303,21 +512,21 @@ getPoolEntry(const char *path, UErrorCode *status); * CAUTION: resbMutex must be locked when calling this function. */ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UErrorCode *status) { - UResourceDataEntry *r = NULL; + UResourceDataEntry *r = nullptr; UResourceDataEntry find; /*int32_t hashValue;*/ const char *name; char aliasName[100] = { 0 }; int32_t aliasLen = 0; - /*UBool isAlias = FALSE;*/ + /*UBool isAlias = false;*/ /*UHashTok hashkey; */ if(U_FAILURE(*status)) { - return NULL; + return nullptr; } /* here we try to deduce the right locale name */ - if(localeID == NULL) { /* if localeID is NULL, we're trying to open default locale */ + if(localeID == nullptr) { /* if localeID is nullptr, we're trying to open default locale */ name = uloc_getDefault(); } else if(*localeID == 0) { /* if localeID is "" then we try to open root locale */ name = kRootLocaleName; @@ -333,13 +542,13 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE /*hashValue = hashEntry(hashkey);*/ /* check to see if we already have this entry */ - r = (UResourceDataEntry *)uhash_get(uresbund_cache, &find); - if(r == NULL) { + r = (UResourceDataEntry *)uhash_get(cache, &find); + if(r == nullptr) { /* if the entry is not yet in the hash table, we'll try to construct a new one */ r = (UResourceDataEntry *) uprv_malloc(sizeof(UResourceDataEntry)); - if(r == NULL) { + if(r == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uprv_memset(r, 0, sizeof(UResourceDataEntry)); @@ -348,15 +557,15 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE setEntryName(r, name, status); if (U_FAILURE(*status)) { uprv_free(r); - return NULL; + return nullptr; } - if(path != NULL) { + if(path != nullptr) { r->fPath = (char *)uprv_strdup(path); - if(r->fPath == NULL) { + if(r->fPath == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; uprv_free(r); - return NULL; + return nullptr; } } @@ -367,7 +576,7 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE /* if we failed to load due to an out-of-memory error, exit early. */ if (*status == U_MEMORY_ALLOCATION_ERROR) { uprv_free(r); - return NULL; + return nullptr; } /* we have no such entry in dll, so it will always use fallback */ *status = U_USING_FALLBACK_WARNING; @@ -394,8 +603,8 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE aliasres = res_getResource(&(r->fData), "%%ALIAS"); if (aliasres != RES_BOGUS) { // No tracing: called during initial data loading - const UChar *alias = res_getStringNoTrace(&(r->fData), aliasres, &aliasLen); - if(alias != NULL && aliasLen > 0) { /* if there is actual alias - unload and load new data */ + const char16_t *alias = res_getStringNoTrace(&(r->fData), aliasres, &aliasLen); + if(alias != nullptr && aliasLen > 0) { /* if there is actual alias - unload and load new data */ u_UCharsToChars(alias, aliasName, aliasLen+1); r->fAlias = init_entry(aliasName, path, status); } @@ -404,15 +613,15 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE } { - UResourceDataEntry *oldR = NULL; - if((oldR = (UResourceDataEntry *)uhash_get(uresbund_cache, r)) == NULL) { /* if the data is not uresbund_cached */ - /* just insert it in the uresbund_cache */ - UErrorCode uresbund_cacheStatus = U_ZERO_ERROR; - uhash_put(uresbund_cache, (void *)r, r, &uresbund_cacheStatus); - if (U_FAILURE(uresbund_cacheStatus)) { - *status = uresbund_cacheStatus; + UResourceDataEntry *oldR = nullptr; + if((oldR = (UResourceDataEntry *)uhash_get(cache, r)) == nullptr) { /* if the data is not cached */ + /* just insert it in the cache */ + UErrorCode cacheStatus = U_ZERO_ERROR; + uhash_put(cache, (void *)r, r, &cacheStatus); + if (U_FAILURE(cacheStatus)) { + *status = cacheStatus; free_entry(r); - r = NULL; + r = nullptr; } } else { /* somebody have already inserted it while we were working, discard newly opened data */ @@ -423,9 +632,9 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE } } - if(r != NULL) { + if(r != nullptr) { /* return the real bundle */ - while(r->fAlias != NULL) { + while(r->fAlias != nullptr) { r = r->fAlias; } r->fCountExisting++; /* we increase its reference count */ @@ -442,7 +651,7 @@ static UResourceDataEntry * getPoolEntry(const char *path, UErrorCode *status) { UResourceDataEntry *poolBundle = init_entry(kPoolBundleName, path, status); if( U_SUCCESS(*status) && - (poolBundle == NULL || poolBundle->fBogus != U_ZERO_ERROR || !poolBundle->fData.isPoolBundle) + (poolBundle == nullptr || poolBundle->fBogus != U_ZERO_ERROR || !poolBundle->fData.isPoolBundle) ) { *status = U_INVALID_FORMAT_ERROR; } @@ -452,30 +661,31 @@ getPoolEntry(const char *path, UErrorCode *status) { /* INTERNAL: */ /* CAUTION: resbMutex must be locked when calling this function! */ static UResourceDataEntry * -findFirstExisting(const char* path, char* name, - UBool *isRoot, UBool *hasChopped, UBool *isDefault, UErrorCode* status) { - UResourceDataEntry *r = NULL; - UBool hasRealData = FALSE; - const char *defaultLoc = uloc_getDefault(); - *hasChopped = TRUE; /* we're starting with a fresh name */ - - while(*hasChopped && !hasRealData) { +findFirstExisting(const char* path, char* name, const char* defaultLocale, UResOpenType openType, + UBool *isRoot, UBool *foundParent, UBool *isDefault, UErrorCode* status) { + UResourceDataEntry *r = nullptr; + UBool hasRealData = false; + *foundParent = true; /* we're starting with a fresh name */ + char origName[ULOC_FULLNAME_CAPACITY]; + + uprv_strcpy(origName, name); + while(*foundParent && !hasRealData) { r = init_entry(name, path, status); /* Null pointer test */ if (U_FAILURE(*status)) { - return NULL; + return nullptr; } - *isDefault = (UBool)(uprv_strncmp(name, defaultLoc, uprv_strlen(name)) == 0); + *isDefault = (UBool)(uprv_strncmp(name, defaultLocale, uprv_strlen(name)) == 0); hasRealData = (UBool)(r->fBogus == U_ZERO_ERROR); if(!hasRealData) { /* this entry is not real. We will discard it. */ /* However, the parent line for this entry is */ /* not to be used - as there might be parent */ - /* lines in uresbund_cache from previous openings that */ + /* lines in cache from previous openings that */ /* are not updated yet. */ r->fCountExisting--; /*entryCloseInt(r);*/ - r = NULL; + r = nullptr; *status = U_USING_FALLBACK_WARNING; } else { uprv_strcpy(name, r->fName); /* this is needed for supporting aliases */ @@ -484,8 +694,14 @@ findFirstExisting(const char* path, char* name, *isRoot = (UBool)(uprv_strcmp(name, kRootLocaleName) == 0); /*Fallback data stuff*/ - *hasChopped = chopLocale(name); - if (*hasChopped && *name == '\0') { + if (!hasRealData) { + *foundParent = getParentLocaleID(name, origName, openType); + } else { + // we've already found a real resource file; what we return to the caller is the parent + // locale ID for inheritance, which should come from chopLocale(), not getParentLocaleID() + *foundParent = chopLocale(name); + } + if (*foundParent && *name == '\0') { uprv_strcpy(name, "und"); } } @@ -503,13 +719,13 @@ static void ures_setIsStackObject( UResourceBundle* resB, UBool state) { } static UBool ures_isStackObject(const UResourceBundle* resB) { - return((resB->fMagic1 == MAGIC1 && resB->fMagic2 == MAGIC2)?FALSE:TRUE); + return((resB->fMagic1 == MAGIC1 && resB->fMagic2 == MAGIC2)?false:true); } U_CFUNC void ures_initStackObject(UResourceBundle* resB) { uprv_memset(resB, 0, sizeof(UResourceBundle)); - ures_setIsStackObject(resB, TRUE); + ures_setIsStackObject(resB, true); } U_NAMESPACE_BEGIN @@ -528,19 +744,19 @@ static UBool // returns U_SUCCESS(*status) loadParentsExceptRoot(UResourceDataEntry *&t1, char name[], int32_t nameCapacity, UBool usingUSRData, char usrDataPath[], UErrorCode *status) { - if (U_FAILURE(*status)) { return FALSE; } - UBool hasChopped = TRUE; - while (hasChopped && t1->fParent == NULL && !t1->fData.noFallback && + if (U_FAILURE(*status)) { return false; } + UBool checkParent = true; + while (checkParent && t1->fParent == nullptr && !t1->fData.noFallback && res_getResource(&t1->fData,"%%ParentIsRoot") == RES_BOGUS) { Resource parentRes = res_getResource(&t1->fData, "%%Parent"); if (parentRes != RES_BOGUS) { // An explicit parent was found. int32_t parentLocaleLen = 0; // No tracing: called during initial data loading - const UChar *parentLocaleName = res_getStringNoTrace(&(t1->fData), parentRes, &parentLocaleLen); - if(parentLocaleName != NULL && 0 < parentLocaleLen && parentLocaleLen < nameCapacity) { + const char16_t *parentLocaleName = res_getStringNoTrace(&(t1->fData), parentRes, &parentLocaleLen); + if(parentLocaleName != nullptr && 0 < parentLocaleLen && parentLocaleLen < nameCapacity) { u_UCharsToChars(parentLocaleName, name, parentLocaleLen + 1); if (uprv_strcmp(name, kRootLocaleName) == 0) { - return TRUE; + return true; } } } @@ -549,16 +765,16 @@ loadParentsExceptRoot(UResourceDataEntry *&t1, UResourceDataEntry *t2 = init_entry(name, t1->fPath, &parentStatus); if (U_FAILURE(parentStatus)) { *status = parentStatus; - return FALSE; + return false; } - UResourceDataEntry *u2 = NULL; + UResourceDataEntry *u2 = nullptr; UErrorCode usrStatus = U_ZERO_ERROR; if (usingUSRData) { // This code inserts user override data into the inheritance chain. u2 = init_entry(name, usrDataPath, &usrStatus); // If we failed due to out-of-memory, report that to the caller and exit early. if (usrStatus == U_MEMORY_ALLOCATION_ERROR) { *status = usrStatus; - return FALSE; + return false; } } @@ -573,68 +789,36 @@ loadParentsExceptRoot(UResourceDataEntry *&t1, } } t1 = t2; - hasChopped = chopLocale(name); + checkParent = chopLocale(name) || mayHaveParent(name); } - return TRUE; + return true; } static UBool // returns U_SUCCESS(*status) insertRootBundle(UResourceDataEntry *&t1, UErrorCode *status) { - if (U_FAILURE(*status)) { return FALSE; } + if (U_FAILURE(*status)) { return false; } UErrorCode parentStatus = U_ZERO_ERROR; UResourceDataEntry *t2 = init_entry(kRootLocaleName, t1->fPath, &parentStatus); if (U_FAILURE(parentStatus)) { *status = parentStatus; - return FALSE; + return false; } t1->fParent = t2; t1 = t2; - return TRUE; + return true; } -enum UResOpenType { - /** - * Open a resource bundle for the locale; - * if there is not even a base language bundle, then fall back to the default locale; - * if there is no bundle for that either, then load the root bundle. - * - * This is the default bundle loading behavior. - */ - URES_OPEN_LOCALE_DEFAULT_ROOT, - // TODO: ICU ticket #11271 "consistent default locale across locale trees" - // Add an option to look at the main locale tree for whether to - // fall back to root directly (if the locale has main data) or - // fall back to the default locale first (if the locale does not even have main data). - /** - * Open a resource bundle for the locale; - * if there is not even a base language bundle, then load the root bundle; - * never fall back to the default locale. - * - * This is used for algorithms that have good pan-Unicode default behavior, - * such as case mappings, collation, and segmentation (BreakIterator). - */ - URES_OPEN_LOCALE_ROOT, - /** - * Open a resource bundle for the exact bundle name as requested; - * no fallbacks, do not load parent bundles. - * - * This is used for supplemental (non-locale) data. - */ - URES_OPEN_DIRECT -}; -typedef enum UResOpenType UResOpenType; - static UResourceDataEntry *entryOpen(const char* path, const char* localeID, UResOpenType openType, UErrorCode* status) { U_ASSERT(openType != URES_OPEN_DIRECT); UErrorCode intStatus = U_ZERO_ERROR; - UResourceDataEntry *r = NULL; - UResourceDataEntry *t1 = NULL; - UBool isDefault = FALSE; - UBool isRoot = FALSE; - UBool hasRealData = FALSE; - UBool hasChopped = TRUE; - UBool usingUSRData = U_USE_USRDATA && ( path == NULL || uprv_strncmp(path,U_ICUDATA_NAME,8) == 0); + UResourceDataEntry *r = nullptr; + UResourceDataEntry *t1 = nullptr; + UBool isDefault = false; + UBool isRoot = false; + UBool hasRealData = false; + UBool hasChopped = true; + UBool usingUSRData = U_USE_USRDATA && ( path == nullptr || uprv_strncmp(path,U_ICUDATA_NAME,8) == 0); char name[ULOC_FULLNAME_CAPACITY]; char usrDataPath[96]; @@ -642,14 +826,14 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, initCache(status); if(U_FAILURE(*status)) { - return NULL; + return nullptr; } uprv_strncpy(name, localeID, sizeof(name) - 1); name[sizeof(name) - 1] = 0; if ( usingUSRData ) { - if ( path == NULL ) { + if ( path == nullptr ) { uprv_strcpy(usrDataPath, U_USRDATA_NAME); } else { uprv_strncpy(usrDataPath, path, sizeof(usrDataPath) - 1); @@ -659,11 +843,14 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, usrDataPath[sizeof(usrDataPath) - 1] = 0; } } + + // Note: We need to query the default locale *before* locking resbMutex. + const char *defaultLocale = uloc_getDefault(); Mutex lock(&resbMutex); // Lock resbMutex until the end of this function. /* We're going to skip all the locales that do not have any data */ - r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus); + r = findFirstExisting(path, name, defaultLocale, openType, &isRoot, &hasChopped, &isDefault, &intStatus); // If we failed due to out-of-memory, report the failure and exit early. if (intStatus == U_MEMORY_ALLOCATION_ERROR) { @@ -671,9 +858,9 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, goto finish; } - if(r != NULL) { /* if there is one real locale, we can look for parents. */ + if(r != nullptr) { /* if there is one real locale, we can look for parents. */ t1 = r; - hasRealData = TRUE; + hasRealData = true; if ( usingUSRData ) { /* This code inserts user override data into the inheritance chain */ UErrorCode usrStatus = U_ZERO_ERROR; UResourceDataEntry *u1 = init_entry(t1->fName, usrDataPath, &usrStatus); @@ -682,7 +869,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, *status = intStatus; goto finish; } - if ( u1 != NULL ) { + if ( u1 != nullptr ) { if(u1->fBogus == U_ZERO_ERROR) { u1->fParent = t1; r = u1; @@ -692,7 +879,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, } } } - if (hasChopped && !isRoot) { + if ((hasChopped || mayHaveParent(name)) && !isRoot) { if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) { goto finish; } @@ -701,22 +888,22 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, /* we could have reached this point without having any real data */ /* if that is the case, we need to chain in the default locale */ - if(r==NULL && openType == URES_OPEN_LOCALE_DEFAULT_ROOT && !isDefault && !isRoot) { + if(r==nullptr && openType == URES_OPEN_LOCALE_DEFAULT_ROOT && !isDefault && !isRoot) { /* insert default locale */ - uprv_strcpy(name, uloc_getDefault()); - r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus); + uprv_strcpy(name, defaultLocale); + r = findFirstExisting(path, name, defaultLocale, openType, &isRoot, &hasChopped, &isDefault, &intStatus); // If we failed due to out-of-memory, report the failure and exit early. if (intStatus == U_MEMORY_ALLOCATION_ERROR) { *status = intStatus; goto finish; } intStatus = U_USING_DEFAULT_WARNING; - if(r != NULL) { /* the default locale exists */ + if(r != nullptr) { /* the default locale exists */ t1 = r; - hasRealData = TRUE; - isDefault = TRUE; + hasRealData = true; + isDefault = true; // TODO: Why not if (usingUSRData) { ... } like in the non-default-locale code path? - if (hasChopped && !isRoot) { + if ((hasChopped || mayHaveParent(name)) && !isRoot) { if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) { goto finish; } @@ -724,26 +911,26 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, } } - /* we could still have r == NULL at this point - maybe even default locale is not */ + /* we could still have r == nullptr at this point - maybe even default locale is not */ /* present */ - if(r == NULL) { + if(r == nullptr) { uprv_strcpy(name, kRootLocaleName); - r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus); + r = findFirstExisting(path, name, defaultLocale, openType, &isRoot, &hasChopped, &isDefault, &intStatus); // If we failed due to out-of-memory, report the failure and exit early. if (intStatus == U_MEMORY_ALLOCATION_ERROR) { *status = intStatus; goto finish; } - if(r != NULL) { + if(r != nullptr) { t1 = r; intStatus = U_USING_DEFAULT_WARNING; - hasRealData = TRUE; + hasRealData = true; } else { /* we don't even have the root locale */ *status = U_MISSING_RESOURCE_ERROR; goto finish; } } else if(!isRoot && uprv_strcmp(t1->fName, kRootLocaleName) != 0 && - t1->fParent == NULL && !r->fData.noFallback) { + t1->fParent == nullptr && !r->fData.noFallback) { if (!insertRootBundle(t1, status)) { goto finish; } @@ -753,7 +940,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, } // TODO: Does this ever loop? - while(r != NULL && !isRoot && t1->fParent != NULL) { + while(r != nullptr && !isRoot && t1->fParent != nullptr) { t1->fParent->fCountExisting++; t1 = t1->fParent; } @@ -761,11 +948,11 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, finish: if(U_SUCCESS(*status)) { if(intStatus != U_ZERO_ERROR) { - *status = intStatus; + *status = intStatus; } return r; } else { - return NULL; + return nullptr; } } @@ -779,43 +966,53 @@ static UResourceDataEntry * entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) { initCache(status); if(U_FAILURE(*status)) { - return NULL; + return nullptr; + } + + // Note: We need to query the default locale *before* locking resbMutex. + // If the localeID is nullptr, then we want to use the default locale. + if (localeID == nullptr) { + localeID = uloc_getDefault(); + } else if (*localeID == 0) { + // If the localeID is "", then we want to use the root locale. + localeID = kRootLocaleName; } Mutex lock(&resbMutex); + // findFirstExisting() without fallbacks. UResourceDataEntry *r = init_entry(localeID, path, status); if(U_SUCCESS(*status)) { if(r->fBogus != U_ZERO_ERROR) { r->fCountExisting--; - r = NULL; + r = nullptr; } } else { - r = NULL; + r = nullptr; } // Some code depends on the ures_openDirect() bundle to have a parent bundle chain, // unless it is marked with "nofallback". UResourceDataEntry *t1 = r; - if(r != NULL && uprv_strcmp(localeID, kRootLocaleName) != 0 && // not root - r->fParent == NULL && !r->fData.noFallback && + if(r != nullptr && uprv_strcmp(localeID, kRootLocaleName) != 0 && // not root + r->fParent == nullptr && !r->fData.noFallback && uprv_strlen(localeID) < ULOC_FULLNAME_CAPACITY) { char name[ULOC_FULLNAME_CAPACITY]; uprv_strcpy(name, localeID); if(!chopLocale(name) || uprv_strcmp(name, kRootLocaleName) == 0 || - loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), FALSE, NULL, status)) { - if(uprv_strcmp(t1->fName, kRootLocaleName) != 0 && t1->fParent == NULL) { + loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), false, nullptr, status)) { + if(uprv_strcmp(t1->fName, kRootLocaleName) != 0 && t1->fParent == nullptr) { insertRootBundle(t1, status); } } if(U_FAILURE(*status)) { - r = NULL; + r = nullptr; } } - if(r != NULL) { + if(r != nullptr) { // TODO: Does this ever loop? - while(t1->fParent != NULL) { + while(t1->fParent != nullptr) { t1->fParent->fCountExisting++; t1 = t1->fParent; } @@ -831,22 +1028,22 @@ entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) { static void entryCloseInt(UResourceDataEntry *resB) { UResourceDataEntry *p = resB; - while(resB != NULL) { + while(resB != nullptr) { p = resB->fParent; resB->fCountExisting--; - /* Entries are left in the uresbund_cache. TODO: add ures_flushCache() to force a flush - of the uresbund_cache. */ + /* Entries are left in the cache. TODO: add ures_flushCache() to force a flush + of the cache. */ /* if(resB->fCountExisting <= 0) { - uhash_remove(uresbund_cache, resB); + uhash_remove(cache, resB); if(resB->fBogus == U_ZERO_ERROR) { res_unload(&(resB->fData)); } - if(resB->fName != NULL) { + if(resB->fName != nullptr) { uprv_free(resB->fName); } - if(resB->fPath != NULL) { + if(resB->fPath != nullptr) { uprv_free(resB->fPath); } uprv_free(resB); @@ -857,7 +1054,7 @@ static void entryCloseInt(UResourceDataEntry *resB) { } } -/** +/** * API: closes a resource bundle and cleans up. */ @@ -868,10 +1065,10 @@ static void entryClose(UResourceDataEntry *resB) { /* U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) { - if(resB->fResPath == NULL) { + if(resB->fResPath == nullptr) { resB->fResPath = resB->fResBuf; *(resB->fResPath) = 0; - } + } resB->fResPathLen = uprv_strlen(toAdd); if(RES_BUFSIZE <= resB->fResPathLen+1) { if(resB->fResPath == resB->fResBuf) { @@ -885,17 +1082,17 @@ U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) { */ static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd, UErrorCode *status) { int32_t resPathLenOrig = resB->fResPathLen; - if(resB->fResPath == NULL) { + if(resB->fResPath == nullptr) { resB->fResPath = resB->fResBuf; *(resB->fResPath) = 0; resB->fResPathLen = 0; - } + } resB->fResPathLen += lenToAdd; if(RES_BUFSIZE <= resB->fResPathLen+1) { if(resB->fResPath == resB->fResBuf) { resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char)); /* Check that memory was allocated correctly. */ - if (resB->fResPath == NULL) { + if (resB->fResPath == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -903,7 +1100,7 @@ static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t } else { char *temp = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char)); /* Check that memory was reallocated correctly. */ - if (temp == NULL) { + if (temp == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -917,23 +1114,23 @@ static void ures_freeResPath(UResourceBundle *resB) { if (resB->fResPath && resB->fResPath != resB->fResBuf) { uprv_free(resB->fResPath); } - resB->fResPath = NULL; + resB->fResPath = nullptr; resB->fResPathLen = 0; } static void ures_closeBundle(UResourceBundle* resB, UBool freeBundleObj) { - if(resB != NULL) { - if(resB->fData != NULL) { + if(resB != nullptr) { + if(resB->fData != nullptr) { entryClose(resB->fData); } - if(resB->fVersion != NULL) { + if(resB->fVersion != nullptr) { uprv_free(resB->fVersion); } ures_freeResPath(resB); - if(ures_isStackObject(resB) == FALSE && freeBundleObj) { + if(ures_isStackObject(resB) == false && freeBundleObj) { uprv_free(resB); } #if 0 /*U_DEBUG*/ @@ -948,282 +1145,309 @@ ures_closeBundle(UResourceBundle* resB, UBool freeBundleObj) U_CAPI void U_EXPORT2 ures_close(UResourceBundle* resB) { - ures_closeBundle(resB, TRUE); + ures_closeBundle(resB, true); } -static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r, - const char *key, int32_t idx, UResourceDataEntry *realData, - const UResourceBundle *parent, int32_t noAlias, - UResourceBundle *resB, UErrorCode *status) -{ - if(status == NULL || U_FAILURE(*status)) { +namespace { + +UResourceBundle *init_resb_result( + UResourceDataEntry *dataEntry, Resource r, const char *key, int32_t idx, + UResourceDataEntry *validLocaleDataEntry, const char *containerResPath, + int32_t recursionDepth, + UResourceBundle *resB, UErrorCode *status); + +// TODO: Try to refactor further, so that we output a dataEntry + Resource + (optionally) resPath, +// rather than a UResourceBundle. +// May need to entryIncrease() the resulting dataEntry. +UResourceBundle *getAliasTargetAsResourceBundle( + const ResourceData &resData, Resource r, const char *key, int32_t idx, + UResourceDataEntry *validLocaleDataEntry, const char *containerResPath, + int32_t recursionDepth, + UResourceBundle *resB, UErrorCode *status) { + // TODO: When an error occurs: Should we return nullptr vs. resB? + if (U_FAILURE(*status)) { return resB; } + U_ASSERT(RES_GET_TYPE(r) == URES_ALIAS); + int32_t len = 0; + const char16_t *alias = res_getAlias(&resData, r, &len); + if(len <= 0) { + // bad alias + *status = U_ILLEGAL_ARGUMENT_ERROR; return resB; } - if (parent == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; - } - if(RES_GET_TYPE(r) == URES_ALIAS) { /* This is an alias, need to exchange with real data */ - if(noAlias < URES_MAX_ALIAS_LEVEL) { - int32_t len = 0; - const UChar *alias = res_getAlias(rdata, r, &len); - if(len > 0) { - /* we have an alias, now let's cut it up */ - char stackAlias[200]; - char *chAlias = NULL, *path = NULL, *locale = NULL, *keyPath = NULL; - int32_t capacity; - - /* - * Allocate enough space for both the char * version - * of the alias and parent->fResPath. - * - * We do this so that res_findResource() can modify the path, - * which allows us to remove redundant _res_findResource() variants - * in uresdata.c. - * res_findResource() now NUL-terminates each segment so that table keys - * can always be compared with strcmp() instead of strncmp(). - * Saves code there and simplifies testing and code coverage. - * - * markus 2003oct17 - */ - ++len; /* count the terminating NUL */ - if(parent->fResPath != NULL) { - capacity = (int32_t)uprv_strlen(parent->fResPath) + 1; - } else { - capacity = 0; - } - if(capacity < len) { - capacity = len; + + // Copy the UTF-16 alias string into an invariant-character string. + // + // We do this so that res_findResource() can modify the path, + // which allows us to remove redundant _res_findResource() variants + // in uresdata.c. + // res_findResource() now NUL-terminates each segment so that table keys + // can always be compared with strcmp() instead of strncmp(). + // Saves code there and simplifies testing and code coverage. + // + // markus 2003oct17 + CharString chAlias; + chAlias.appendInvariantChars(alias, len, *status); + if (U_FAILURE(*status)) { + return nullptr; + } + + // We have an alias, now let's cut it up. + const char *path = nullptr, *locale = nullptr, *keyPath = nullptr; + if(chAlias[0] == RES_PATH_SEPARATOR) { + // There is a path included. + char *chAliasData = chAlias.data(); + char *sep = chAliasData + 1; + path = sep; + sep = uprv_strchr(sep, RES_PATH_SEPARATOR); + if(sep != nullptr) { + *sep++ = 0; + } + if(uprv_strcmp(path, "LOCALE") == 0) { + // This is an XPath alias, starting with "/LOCALE/". + // It contains the path to a resource which should be looked up + // starting in the valid locale. + // TODO: Can/should we forbid a /LOCALE alias without key path? + // It seems weird to alias to the same path, just starting from the valid locale. + // That will often yield an infinite loop. + keyPath = sep; + // Read from the valid locale which we already have. + path = locale = nullptr; + } else { + if(uprv_strcmp(path, "ICUDATA") == 0) { /* want ICU data */ + path = nullptr; + } + if (sep == nullptr) { + // TODO: This ends up using the root bundle. Can/should we forbid this? + locale = ""; + } else { + locale = sep; + sep = uprv_strchr(sep, RES_PATH_SEPARATOR); + if(sep != nullptr) { + *sep++ = 0; } - if(capacity <= (int32_t)sizeof(stackAlias)) { - capacity = (int32_t)sizeof(stackAlias); - chAlias = stackAlias; - } else { - chAlias = (char *)uprv_malloc(capacity); - /* test for NULL */ - if(chAlias == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } + keyPath = sep; + } + } + } else { + // No path, start with a locale. + char *sep = chAlias.data(); + locale = sep; + sep = uprv_strchr(sep, RES_PATH_SEPARATOR); + if(sep != nullptr) { + *sep++ = 0; + } + keyPath = sep; + path = validLocaleDataEntry->fPath; + } + + // Got almost everything, let's try to open. + // First, open the bundle with real data. + LocalUResourceBundlePointer mainRes; + UResourceDataEntry *dataEntry; + if (locale == nullptr) { + // alias = /LOCALE/keyPath + // Read from the valid locale which we already have. + dataEntry = validLocaleDataEntry; + } else { + UErrorCode intStatus = U_ZERO_ERROR; + // TODO: Shouldn't we use ures_open() for locale data bundles (!noFallback)? + mainRes.adoptInstead(ures_openDirect(path, locale, &intStatus)); + if(U_FAILURE(intStatus)) { + // We failed to open the resource bundle we're aliasing to. + *status = intStatus; + return resB; + } + dataEntry = mainRes->fData; + } + + const char* temp = nullptr; + if(keyPath == nullptr) { + // No key path. This means that we are going to to use the corresponding resource from + // another bundle. + // TODO: Why the special code path? + // Why not put together a key path from containerResPath + key or idx, + // as a comment below suggests, and go into the regular code branch? + // First, we are going to get a corresponding container + // resource to the one we are searching. + r = dataEntry->fData.rootRes; + if(containerResPath) { + chAlias.clear().append(containerResPath, *status); + if (U_FAILURE(*status)) { + return nullptr; + } + char *aKey = chAlias.data(); + // TODO: should res_findResource() return a new dataEntry, too? + r = res_findResource(&dataEntry->fData, r, &aKey, &temp); + } + if(key) { + // We need to make keyPath from the containerResPath and + // current key, if there is a key associated. + chAlias.clear().append(key, *status); + if (U_FAILURE(*status)) { + return nullptr; + } + char *aKey = chAlias.data(); + r = res_findResource(&dataEntry->fData, r, &aKey, &temp); + } else if(idx != -1) { + // If there is no key, but there is an index, try to get by the index. + // Here we have either a table or an array, so get the element. + int32_t type = RES_GET_TYPE(r); + if(URES_IS_TABLE(type)) { + const char *aKey; + r = res_getTableItemByIndex(&dataEntry->fData, r, idx, &aKey); + } else { /* array */ + r = res_getArrayItem(&dataEntry->fData, r, idx); + } + } + if(r != RES_BOGUS) { + resB = init_resb_result( + dataEntry, r, temp, -1, validLocaleDataEntry, nullptr, recursionDepth+1, + resB, status); + } else { + *status = U_MISSING_RESOURCE_ERROR; + } + } else { + // This one is a bit trickier. + // We start finding keys, but after we resolve one alias, the path might continue. + // Consider: + // aliastest:alias { "testtypes/anotheralias/Sequence" } + // anotheralias:alias { "/ICUDATA/sh/CollationElements" } + // aliastest resource should finally have the sequence, not collation elements. + CharString pathBuf(keyPath, *status); + if (U_FAILURE(*status)) { + return nullptr; + } + char *myPath = pathBuf.data(); + containerResPath = nullptr; + // Now we have fallback following here. + for(;;) { + r = dataEntry->fData.rootRes; + // TODO: Move containerResPath = nullptr to here, + // consistent with restarting from the rootRes of another bundle?! + + // This loop handles 'found' resources over several levels. + while(*myPath && U_SUCCESS(*status)) { + r = res_findResource(&(dataEntry->fData), r, &myPath, &temp); + if(r == RES_BOGUS) { + // No resource found, we don't really want to look anymore on this level. + break; } - u_UCharsToChars(alias, chAlias, len); - - if(*chAlias == RES_PATH_SEPARATOR) { - /* there is a path included */ - locale = uprv_strchr(chAlias+1, RES_PATH_SEPARATOR); - if(locale == NULL) { - locale = uprv_strchr(chAlias, 0); /* avoid locale == NULL to make code below work */ - } else { - *locale = 0; - locale++; - } - path = chAlias+1; - if(uprv_strcmp(path, "LOCALE") == 0) { - /* this is an XPath alias, starting with "/LOCALE/" */ - /* it contains the path to a resource which should be looked up */ - /* starting in the requested locale */ - keyPath = locale; - locale = parent->fTopLevelData->fName; /* this is the requested locale's name */ - path = realData->fPath; /* we will be looking in the same package */ - } else { - if(uprv_strcmp(path, "ICUDATA") == 0) { /* want ICU data */ - path = NULL; - } - keyPath = uprv_strchr(locale, RES_PATH_SEPARATOR); - if(keyPath) { - *keyPath = 0; - keyPath++; - } - } - } else { - /* no path, start with a locale */ - locale = chAlias; - keyPath = uprv_strchr(locale, RES_PATH_SEPARATOR); - if(keyPath) { - *keyPath = 0; - keyPath++; - } - path = realData->fPath; + // Found a resource, but it might be an indirection. + resB = init_resb_result( + dataEntry, r, temp, -1, + validLocaleDataEntry, containerResPath, recursionDepth+1, + resB, status); + if (U_FAILURE(*status)) { + break; } - - - { - /* got almost everything, let's try to open */ - /* first, open the bundle with real data */ - UResourceBundle *result = resB; - const char* temp = NULL; - UErrorCode intStatus = U_ZERO_ERROR; - UResourceBundle *mainRes = ures_openDirect(path, locale, &intStatus); - if(U_SUCCESS(intStatus)) { - if(keyPath == NULL) { - /* no key path. This means that we are going to - * to use the corresponding resource from - * another bundle - */ - /* first, we are going to get a corresponding parent - * resource to the one we are searching. - */ - char *aKey = parent->fResPath; - if(aKey) { - uprv_strcpy(chAlias, aKey); /* allocated large enough above */ - aKey = chAlias; - r = res_findResource(&(mainRes->fResData), mainRes->fRes, &aKey, &temp); - } else { - r = mainRes->fRes; - } - if(key) { - /* we need to make keyPath from parent's fResPath and - * current key, if there is a key associated - */ - len = (int32_t)(uprv_strlen(key) + 1); - if(len > capacity) { - capacity = len; - if(chAlias == stackAlias) { - chAlias = (char *)uprv_malloc(capacity); - } else { - chAlias = (char *)uprv_realloc(chAlias, capacity); - } - if(chAlias == NULL) { - ures_close(mainRes); - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - } - uprv_memcpy(chAlias, key, len); - aKey = chAlias; - r = res_findResource(&(mainRes->fResData), r, &aKey, &temp); - } else if(idx != -1) { - /* if there is no key, but there is an index, try to get by the index */ - /* here we have either a table or an array, so get the element */ - int32_t type = RES_GET_TYPE(r); - if(URES_IS_TABLE(type)) { - r = res_getTableItemByIndex(&(mainRes->fResData), r, idx, (const char **)&aKey); - } else { /* array */ - r = res_getArrayItem(&(mainRes->fResData), r, idx); - } - } - if(r != RES_BOGUS) { - result = init_resb_result(&(mainRes->fResData), r, temp, -1, mainRes->fData, mainRes, noAlias+1, resB, status); - } else { - *status = U_MISSING_RESOURCE_ERROR; - result = resB; - } - } else { - /* this one is a bit trickier. - * we start finding keys, but after we resolve one alias, the path might continue. - * Consider: - * aliastest:alias { "testtypes/anotheralias/Sequence" } - * anotheralias:alias { "/ICUDATA/sh/CollationElements" } - * aliastest resource should finally have the sequence, not collation elements. - */ - UResourceDataEntry *dataEntry = mainRes->fData; - char stackPath[URES_MAX_BUFFER_SIZE]; - char *pathBuf = stackPath, *myPath = pathBuf; - if(uprv_strlen(keyPath) >= UPRV_LENGTHOF(stackPath)) { - pathBuf = (char *)uprv_malloc((uprv_strlen(keyPath)+1)*sizeof(char)); - if(pathBuf == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - ures_close(mainRes); - return NULL; - } - } - uprv_strcpy(pathBuf, keyPath); - result = mainRes; - /* now we have fallback following here */ - do { - r = dataEntry->fData.rootRes; - /* this loop handles 'found' resources over several levels */ - while(*myPath && U_SUCCESS(*status)) { - r = res_findResource(&(dataEntry->fData), r, &myPath, &temp); - if(r != RES_BOGUS) { /* found a resource, but it might be an indirection */ - resB = init_resb_result(&(dataEntry->fData), r, temp, -1, dataEntry, result, noAlias+1, resB, status); - result = resB; - if(result) { - r = result->fRes; /* switch to a new resource, possibly a new tree */ - dataEntry = result->fData; - } - } else { /* no resource found, we don't really want to look anymore on this level */ - break; - } - } - dataEntry = dataEntry->fParent; - uprv_strcpy(pathBuf, keyPath); - myPath = pathBuf; - } while(r == RES_BOGUS && dataEntry != NULL); - if(r == RES_BOGUS) { - *status = U_MISSING_RESOURCE_ERROR; - result = resB; - } - if(pathBuf != stackPath) { - uprv_free(pathBuf); - } - } - } else { /* we failed to open the resource we're aliasing to */ - *status = intStatus; + if (temp == nullptr || uprv_strcmp(keyPath, temp) != 0) { + // The call to init_resb_result() above will set resB->fKeyPath to be + // the same as resB->fKey, + // throwing away any additional path elements if we had them -- + // if the key path wasn't just a single resource ID, clear out + // the bundle's key path and re-set it to be equal to keyPath. + ures_freeResPath(resB); + ures_appendResPath(resB, keyPath, (int32_t)uprv_strlen(keyPath), status); + if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) { + ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status); } - if(chAlias != stackAlias) { - uprv_free(chAlias); - } - if(mainRes != result) { - ures_close(mainRes); + if (U_FAILURE(*status)) { + break; } - ResourceTracer(resB).maybeTrace("getalias"); - return result; } - } else { - /* bad alias, should be an error */ - *status = U_ILLEGAL_ARGUMENT_ERROR; - return resB; + r = resB->fRes; /* switch to a new resource, possibly a new tree */ + dataEntry = resB->fData; + containerResPath = resB->fResPath; } - } else { + if (U_FAILURE(*status) || r != RES_BOGUS) { + break; + } + // Fall back to the parent bundle, if there is one. + dataEntry = dataEntry->fParent; + if (dataEntry == nullptr) { + *status = U_MISSING_RESOURCE_ERROR; + break; + } + // Copy the same keyPath again. + myPath = pathBuf.data(); + uprv_strcpy(myPath, keyPath); + } + } + if(mainRes.getAlias() == resB) { + mainRes.orphan(); + } + ResourceTracer(resB).maybeTrace("getalias"); + return resB; +} + +// Recursive function, should be called only by itself, by its simpler wrapper, +// or by getAliasTargetAsResourceBundle(). +UResourceBundle *init_resb_result( + UResourceDataEntry *dataEntry, Resource r, const char *key, int32_t idx, + UResourceDataEntry *validLocaleDataEntry, const char *containerResPath, + int32_t recursionDepth, + UResourceBundle *resB, UErrorCode *status) { + // TODO: When an error occurs: Should we return nullptr vs. resB? + if(status == nullptr || U_FAILURE(*status)) { + return resB; + } + if (validLocaleDataEntry == nullptr) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + return nullptr; + } + if(RES_GET_TYPE(r) == URES_ALIAS) { + // This is an alias, need to exchange with real data. + if(recursionDepth >= URES_MAX_ALIAS_LEVEL) { *status = U_TOO_MANY_ALIASES_ERROR; return resB; } + return getAliasTargetAsResourceBundle( + dataEntry->fData, r, key, idx, + validLocaleDataEntry, containerResPath, recursionDepth, resB, status); } - if(resB == NULL) { + if(resB == nullptr) { resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle)); - /* test for NULL */ - if (resB == NULL) { + if (resB == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - ures_setIsStackObject(resB, FALSE); - resB->fResPath = NULL; + ures_setIsStackObject(resB, false); + resB->fResPath = nullptr; resB->fResPathLen = 0; } else { - if(resB->fData != NULL) { + if(resB->fData != nullptr) { entryClose(resB->fData); } - if(resB->fVersion != NULL) { + if(resB->fVersion != nullptr) { uprv_free(resB->fVersion); } - /* + /* weiv: if stack object was passed in, it doesn't really need to be reinited, - since the purpose of initing is to remove stack junk. However, at this point + since the purpose of initing is to remove stack junk. However, at this point we would not do anything to an allocated object, so stack object should be treated the same */ /* - if(ures_isStackObject(resB) != FALSE) { + if(ures_isStackObject(resB) != false) { ures_initStackObject(resB); } */ - if(parent != resB) { + if(containerResPath != resB->fResPath) { ures_freeResPath(resB); } } - resB->fData = realData; + resB->fData = dataEntry; entryIncrease(resB->fData); - resB->fHasFallback = FALSE; - resB->fIsTopLevel = FALSE; + resB->fHasFallback = false; + resB->fIsTopLevel = false; resB->fIndex = -1; - resB->fKey = key; - /*resB->fParentRes = parent;*/ - resB->fTopLevelData = parent->fTopLevelData; - if(parent->fResPath && parent != resB) { - ures_appendResPath(resB, parent->fResPath, parent->fResPathLen, status); + resB->fKey = key; + resB->fValidLocaleDataEntry = validLocaleDataEntry; + if(containerResPath != resB->fResPath) { + ures_appendResPath( + resB, containerResPath, static_cast(uprv_strlen(containerResPath)), status); } - if(key != NULL) { + if(key != nullptr) { ures_appendResPath(resB, key, (int32_t)uprv_strlen(key), status); if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) { ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status); @@ -1242,41 +1466,51 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r, uprv_memset(resB->fResBuf + usedLen, 0, sizeof(resB->fResBuf) - usedLen); } - resB->fVersion = NULL; + resB->fVersion = nullptr; resB->fRes = r; - /*resB->fParent = parent->fRes;*/ - uprv_memmove(&resB->fResData, rdata, sizeof(ResourceData)); - resB->fSize = res_countArrayItems(&(resB->fResData), resB->fRes); + resB->fSize = res_countArrayItems(&resB->getResData(), resB->fRes); ResourceTracer(resB).trace("get"); return resB; } +UResourceBundle *init_resb_result( + UResourceDataEntry *dataEntry, Resource r, const char *key, int32_t idx, + // validLocaleDataEntry + containerResPath + const UResourceBundle *container, + UResourceBundle *resB, UErrorCode *status) { + return init_resb_result( + dataEntry, r, key, idx, + container->fValidLocaleDataEntry, container->fResPath, 0, resB, status); +} + +} // namespace + UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *original, UErrorCode *status) { UBool isStackObject; if(U_FAILURE(*status) || r == original) { return r; } - if(original != NULL) { - if(r == NULL) { - isStackObject = FALSE; + if(original != nullptr) { + if(r == nullptr) { + isStackObject = false; r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle)); - /* test for NULL */ - if (r == NULL) { + /* test for nullptr */ + if (r == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } } else { isStackObject = ures_isStackObject(r); - ures_closeBundle(r, FALSE); + ures_closeBundle(r, false); } uprv_memcpy(r, original, sizeof(UResourceBundle)); - r->fResPath = NULL; + r->fResPath = nullptr; r->fResPathLen = 0; if(original->fResPath) { ures_appendResPath(r, original->fResPath, original->fResPathLen, status); } ures_setIsStackObject(r, isStackObject); - if(r->fData != NULL) { + if(r->fData != nullptr) { entryIncrease(r->fData); } } @@ -1287,45 +1521,45 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin * Functions to retrieve data from resource bundles. */ -U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) { - const UChar *s; - if (status==NULL || U_FAILURE(*status)) { - return NULL; +U_CAPI const char16_t* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) { + const char16_t *s; + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - s = res_getString({resB}, &(resB->fResData), resB->fRes, len); - if (s == NULL) { + s = res_getString({resB}, &resB->getResData(), resB->fRes, len); + if (s == nullptr) { *status = U_RESOURCE_TYPE_MISMATCH; } return s; } static const char * -ures_toUTF8String(const UChar *s16, int32_t length16, +ures_toUTF8String(const char16_t *s16, int32_t length16, char *dest, int32_t *pLength, UBool forceCopy, UErrorCode *status) { int32_t capacity; if (U_FAILURE(*status)) { - return NULL; + return nullptr; } - if (pLength != NULL) { + if (pLength != nullptr) { capacity = *pLength; } else { capacity = 0; } - if (capacity < 0 || (capacity > 0 && dest == NULL)) { + if (capacity < 0 || (capacity > 0 && dest == nullptr)) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } if (length16 == 0) { /* empty string, return as read-only pointer */ - if (pLength != NULL) { + if (pLength != nullptr) { *pLength = 0; } if (forceCopy) { @@ -1338,18 +1572,18 @@ ures_toUTF8String(const UChar *s16, int32_t length16, /* We need to transform the string to the destination buffer. */ if (capacity < length16) { /* No chance for the string to fit. Pure preflighting. */ - return u_strToUTF8(NULL, 0, pLength, s16, length16, status); + return u_strToUTF8(nullptr, 0, pLength, s16, length16, status); } if (!forceCopy && (length16 <= 0x2aaaaaaa)) { /* - * We know the string will fit into dest because each UChar turns + * We know the string will fit into dest because each char16_t turns * into at most three UTF-8 bytes. Fill the latter part of dest * so that callers do not expect to use dest as a string pointer, * hopefully leading to more robust code for when resource bundles * may store UTF-8 natively. * (In which case dest would not be used at all.) * - * We do not do this if forceCopy=TRUE because then the caller + * We do not do this if forceCopy=true because then the caller * expects the string to start exactly at dest. * * The test above for <= 0x2aaaaaaa prevents overflows. @@ -1371,51 +1605,51 @@ ures_getUTF8String(const UResourceBundle *resB, UBool forceCopy, UErrorCode *status) { int32_t length16; - const UChar *s16 = ures_getString(resB, &length16, status); + const char16_t *s16 = ures_getString(resB, &length16, status); return ures_toUTF8String(s16, length16, dest, pLength, forceCopy, status); } -U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int32_t* len, +U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int32_t* len, UErrorCode* status) { const uint8_t *p; - if (status==NULL || U_FAILURE(*status)) { - return NULL; + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - p = res_getBinary({resB}, &(resB->fResData), resB->fRes, len); - if (p == NULL) { + p = res_getBinary({resB}, &resB->getResData(), resB->fRes, len); + if (p == nullptr) { *status = U_RESOURCE_TYPE_MISMATCH; } return p; } -U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len, +U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len, UErrorCode* status) { const int32_t *p; - if (status==NULL || U_FAILURE(*status)) { - return NULL; + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - p = res_getIntVector({resB}, &(resB->fResData), resB->fRes, len); - if (p == NULL) { + p = res_getIntVector({resB}, &resB->getResData(), resB->fRes, len); + if (p == nullptr) { *status = U_RESOURCE_TYPE_MISMATCH; } return p; } -/* this function returns a signed integer */ +/* this function returns a signed integer */ /* it performs sign extension */ U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *status) { - if (status==NULL || U_FAILURE(*status)) { + if (status==nullptr || U_FAILURE(*status)) { return 0xffffffff; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return 0xffffffff; } @@ -1427,10 +1661,10 @@ U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *st } U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) { - if (status==NULL || U_FAILURE(*status)) { + if (status==nullptr || U_FAILURE(*status)) { return 0xffffffff; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return 0xffffffff; } @@ -1442,7 +1676,7 @@ U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode * } U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) { - if(resB == NULL) { + if(resB == nullptr) { return URES_NONE; } return res_getPublicType(resB->fRes); @@ -1458,57 +1692,57 @@ U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resB) { // However, I believe we have some data (e.g., in res_index) where the key // strings are the data. Tracing the enclosing table should suffice. // - if(resB == NULL) { - return NULL; + if(resB == nullptr) { + return nullptr; } return(resB->fKey); } U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) { - if(resB == NULL) { + if(resB == nullptr) { return 0; } - + return resB->fSize; } -static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) { +static const char16_t* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) { if(RES_GET_TYPE(r) == URES_ALIAS) { - const UChar* result = 0; - UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, NULL, status); + const char16_t* result = 0; + UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, nullptr, status); result = ures_getString(tempRes, len, status); ures_close(tempRes); return result; } else { - return res_getString({resB, sIndex}, &(resB->fResData), r, len); + return res_getString({resB, sIndex}, &resB->getResData(), r, len); } } U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resB){ - if(resB == NULL) { + if(resB == nullptr) { return; } resB->fIndex = -1; } U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) { - if(resB == NULL) { - return FALSE; + if(resB == nullptr) { + return false; } return (UBool)(resB->fIndex < resB->fSize-1); } -U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) { +U_CAPI const char16_t* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) { Resource r = RES_BOGUS; - - if (status==NULL || U_FAILURE(*status)) { - return NULL; + + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - + if(resB->fIndex == resB->fSize-1) { *status = U_INDEX_OUTOFBOUNDS_ERROR; } else { @@ -1516,18 +1750,18 @@ U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* switch(RES_GET_TYPE(resB->fRes)) { case URES_STRING: case URES_STRING_V2: - return res_getString({resB}, &(resB->fResData), resB->fRes, len); + return res_getString({resB}, &resB->getResData(), resB->fRes, len); case URES_TABLE: case URES_TABLE16: case URES_TABLE32: - r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, key); + r = res_getTableItemByIndex(&resB->getResData(), resB->fRes, resB->fIndex, key); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } return ures_getStringWithAlias(resB, r, resB->fIndex, len, status); case URES_ARRAY: case URES_ARRAY16: - r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex); + r = res_getArrayItem(&resB->getResData(), resB->fRes, resB->fIndex); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } @@ -1540,30 +1774,30 @@ U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* *status = U_RESOURCE_TYPE_MISMATCH; U_FALLTHROUGH; default: - return NULL; + return nullptr; } } - return NULL; + return nullptr; } U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UResourceBundle *fillIn, UErrorCode *status) { - const char *key = NULL; + const char *key = nullptr; Resource r = RES_BOGUS; - if (status==NULL || U_FAILURE(*status)) { - /*return NULL;*/ + if (status==nullptr || U_FAILURE(*status)) { + /*return nullptr;*/ return fillIn; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - /*return NULL;*/ + /*return nullptr;*/ return fillIn; } if(resB->fIndex == resB->fSize-1) { *status = U_INDEX_OUTOFBOUNDS_ERROR; - /*return NULL;*/ + /*return nullptr;*/ } else { resB->fIndex++; switch(RES_GET_TYPE(resB->fRes)) { @@ -1576,38 +1810,38 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UR case URES_TABLE: case URES_TABLE16: case URES_TABLE32: - r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, resB->fIndex, &key); + r = res_getTableItemByIndex(&resB->getResData(), resB->fRes, resB->fIndex, &key); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } - return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status); + return init_resb_result(resB->fData, r, key, resB->fIndex, resB, fillIn, status); case URES_ARRAY: case URES_ARRAY16: - r = res_getArrayItem(&(resB->fResData), resB->fRes, resB->fIndex); + r = res_getArrayItem(&resB->getResData(), resB->fRes, resB->fIndex); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } - return init_resb_result(&(resB->fResData), r, key, resB->fIndex, resB->fData, resB, 0, fillIn, status); + return init_resb_result(resB->fData, r, key, resB->fIndex, resB, fillIn, status); default: - /*return NULL;*/ + /*return nullptr;*/ return fillIn; } } - /*return NULL;*/ + /*return nullptr;*/ return fillIn; } U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status) { - const char* key = NULL; + const char* key = nullptr; Resource r = RES_BOGUS; - if (status==NULL || U_FAILURE(*status)) { - /*return NULL;*/ + if (status==nullptr || U_FAILURE(*status)) { + /*return nullptr;*/ return fillIn; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - /*return NULL;*/ + /*return nullptr;*/ return fillIn; } @@ -1622,57 +1856,57 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, i case URES_TABLE: case URES_TABLE16: case URES_TABLE32: - r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexR, &key); + r = res_getTableItemByIndex(&resB->getResData(), resB->fRes, indexR, &key); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } - return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status); + return init_resb_result(resB->fData, r, key, indexR, resB, fillIn, status); case URES_ARRAY: case URES_ARRAY16: - r = res_getArrayItem(&(resB->fResData), resB->fRes, indexR); + r = res_getArrayItem(&resB->getResData(), resB->fRes, indexR); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } - return init_resb_result(&(resB->fResData), r, key, indexR, resB->fData, resB, 0, fillIn, status); + return init_resb_result(resB->fData, r, key, indexR, resB, fillIn, status); default: - /*return NULL;*/ + /*return nullptr;*/ return fillIn; } } else { *status = U_MISSING_RESOURCE_ERROR; } - /*return NULL;*/ + /*return nullptr;*/ return fillIn; } -U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) { - const char* key = NULL; +U_CAPI const char16_t* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) { + const char* key = nullptr; Resource r = RES_BOGUS; - if (status==NULL || U_FAILURE(*status)) { - return NULL; + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } if(indexS >= 0 && resB->fSize > indexS) { switch(RES_GET_TYPE(resB->fRes)) { case URES_STRING: case URES_STRING_V2: - return res_getString({resB}, &(resB->fResData), resB->fRes, len); + return res_getString({resB}, &resB->getResData(), resB->fRes, len); case URES_TABLE: case URES_TABLE16: case URES_TABLE32: - r = res_getTableItemByIndex(&(resB->fResData), resB->fRes, indexS, &key); + r = res_getTableItemByIndex(&resB->getResData(), resB->fRes, indexS, &key); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } return ures_getStringWithAlias(resB, r, indexS, len, status); case URES_ARRAY: case URES_ARRAY16: - r = res_getArrayItem(&(resB->fResData), resB->fRes, indexS); + r = res_getArrayItem(&resB->getResData(), resB->fRes, indexS); if(r == RES_BOGUS && resB->fHasFallback) { /* TODO: do the fallback */ } @@ -1692,7 +1926,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, } else { *status = U_MISSING_RESOURCE_ERROR; } - return NULL; + return nullptr; } U_CAPI const char * U_EXPORT2 @@ -1702,7 +1936,7 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB, UBool forceCopy, UErrorCode *status) { int32_t length16; - const UChar *s16 = ures_getStringByIndex(resB, idx, &length16, status); + const char16_t *s16 = ures_getStringByIndex(resB, idx, &length16, status); return ures_toUTF8String(s16, length16, dest, pLength, forceCopy, status); } @@ -1711,23 +1945,23 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB, }*/ U_CAPI UResourceBundle* U_EXPORT2 -ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status) +ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status) { - UResourceBundle *first = NULL; + UResourceBundle *first = nullptr; UResourceBundle *result = fillIn; - char *packageName = NULL; - char *pathToResource = NULL, *save = NULL; - char *locale = NULL, *localeEnd = NULL; + char *packageName = nullptr; + char *pathToResource = nullptr, *save = nullptr; + char *locale = nullptr, *localeEnd = nullptr; int32_t length; - if(status == NULL || U_FAILURE(*status)) { + if(status == nullptr || U_FAILURE(*status)) { return result; } length = (int32_t)(uprv_strlen(path)+1); save = pathToResource = (char *)uprv_malloc(length*sizeof(char)); - /* test for NULL */ - if(pathToResource == NULL) { + /* test for nullptr */ + if(pathToResource == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return result; } @@ -1738,7 +1972,7 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status) pathToResource++; packageName = pathToResource; pathToResource = uprv_strchr(pathToResource, RES_PATH_SEPARATOR); - if(pathToResource == NULL) { + if(pathToResource == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; } else { *pathToResource = 0; @@ -1747,7 +1981,7 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status) } localeEnd = uprv_strchr(locale, RES_PATH_SEPARATOR); - if(localeEnd != NULL) { + if(localeEnd != nullptr) { *localeEnd = 0; } @@ -1766,13 +2000,13 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status) } U_CAPI UResourceBundle* U_EXPORT2 -ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status) +ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status) { Resource res = RES_BOGUS; UResourceBundle *result = fillIn; const char *key; - if(status == NULL || U_FAILURE(*status)) { + if(status == nullptr || U_FAILURE(*status)) { return result; } @@ -1780,9 +2014,9 @@ ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *f /* this loop is here because aliasing is resolved on this level, not on res level */ /* so, when we encounter an alias, it is not an aggregate resource, so we return */ do { - res = res_findResource(&(resB->fResData), resB->fRes, &path, &key); + res = res_findResource(&resB->getResData(), resB->fRes, &path, &key); if(res != RES_BOGUS) { - result = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status); + result = init_resb_result(resB->fData, res, key, -1, resB, fillIn, status); resB = result; } else { *status = U_MISSING_RESOURCE_ERROR; @@ -1792,28 +2026,28 @@ ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *f return result; } -U_INTERNAL const UChar* U_EXPORT2 -ures_getStringByKeyWithFallback(const UResourceBundle *resB, - const char* inKey, +U_CAPI const char16_t* U_EXPORT2 +ures_getStringByKeyWithFallback(const UResourceBundle *resB, + const char* inKey, int32_t* len, UErrorCode *status) { UResourceBundle stack; - const UChar* retVal = NULL; + const char16_t* retVal = nullptr; ures_initStackObject(&stack); ures_getByKeyWithFallback(resB, inKey, &stack, status); int32_t length; retVal = ures_getString(&stack, &length, status); ures_close(&stack); if (U_FAILURE(*status)) { - return NULL; + return nullptr; } if (length == 3 && retVal[0] == EMPTY_SET && retVal[1] == EMPTY_SET && retVal[2] == EMPTY_SET ) { - retVal = NULL; + retVal = nullptr; length = 0; *status = U_MISSING_RESOURCE_ERROR; } - if (len != NULL) { + if (len != nullptr) { *len = length; } return retVal; @@ -1821,7 +2055,7 @@ ures_getStringByKeyWithFallback(const UResourceBundle *resB, /* Like res_getTableItemByKey but accepts full paths like "NumberElements/latn/patternsShort". -*/ +*/ static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource table, const char *key) { Resource resource = table; /* The current resource */ icu::CharString path; @@ -1832,7 +2066,7 @@ static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource tab UResType type = (UResType)RES_GET_TYPE(resource); /* the current resource type */ while (*pathPart && resource != RES_BOGUS && URES_IS_CONTAINER(type)) { char *nextPathPart = uprv_strchr(pathPart, RES_PATH_SEPARATOR); - if (nextPathPart != NULL) { + if (nextPathPart != nullptr) { *nextPathPart = 0; /* Terminating null for this part of path. */ nextPathPart++; } else { @@ -1842,7 +2076,7 @@ static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource tab const char *pathP = pathPart; resource = res_getTableItemByKey(pResData, resource, &t, &pathP); type = (UResType)RES_GET_TYPE(resource); - pathPart = nextPathPart; + pathPart = nextPathPart; } if (*pathPart) { return RES_BOGUS; @@ -1850,43 +2084,123 @@ static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource tab return resource; } +static void createPath(const char* origResPath, + int32_t origResPathLen, + const char* resPath, + int32_t resPathLen, + const char* inKey, + CharString& path, + UErrorCode* status) { + // This is a utility function used by ures_getByKeyWithFallback() below. This function builds a path from + // resPath and inKey, returning the result in `path`. Originally, this function just cleared `path` and + // appended resPath and inKey to it, but that caused problems for horizontal inheritance. + // + // In normal cases, resPath is the same as origResPath, but if ures_getByKeyWithFallback() has followed an + // alias, resPath may be different from origResPath. Not only may the existing path elements be different, + // but resPath may also have MORE path elements than origResPath did. If it does, those additional path + // elements SUPERSEDE the corresponding elements of inKey. So this code counts the number of elements in + // resPath and origResPath and, for each path element in resPath that doesn't have a counterpart in origResPath, + // deletes a path element from the beginning of inKey. The remainder of inKey is then appended to + // resPath to form the result. (We're not using uprv_strchr() here because resPath and origResPath may + // not be zero-terminated.) + path.clear(); + const char* key = inKey; + if (resPathLen > 0) { + path.append(resPath, resPathLen, *status); + if (U_SUCCESS(*status)) { + const char* resPathLimit = resPath + resPathLen; + const char* origResPathLimit = origResPath + origResPathLen; + const char* resPathPtr = resPath; + const char* origResPathPtr = origResPath; + + // Remove from the beginning of resPath the number of segments that are contained in origResPath. + // If origResPath has MORE segments than resPath, this will leave resPath as the empty string. + while (origResPathPtr < origResPathLimit && resPathPtr < resPathLimit) { + while (origResPathPtr < origResPathLimit && *origResPathPtr != RES_PATH_SEPARATOR) { + ++origResPathPtr; + } + if (origResPathPtr < origResPathLimit && *origResPathPtr == RES_PATH_SEPARATOR) { + ++origResPathPtr; + } + while (resPathPtr < resPathLimit && *resPathPtr != RES_PATH_SEPARATOR) { + ++resPathPtr; + } + if (resPathPtr < resPathLimit && *resPathPtr == RES_PATH_SEPARATOR) { + ++resPathPtr; + } + } + + // New remove from the beginning of `key` the number of segments remaining in resPath. + // If resPath has more segments than `key` does, `key` will end up empty. + while (resPathPtr < resPathLimit && *key != '\0') { + while (resPathPtr < resPathLimit && *resPathPtr != RES_PATH_SEPARATOR) { + ++resPathPtr; + } + if (resPathPtr < resPathLimit && *resPathPtr == RES_PATH_SEPARATOR) { + ++resPathPtr; + } + while (*key != '\0' && *key != RES_PATH_SEPARATOR) { + ++key; + } + if (*key == RES_PATH_SEPARATOR) { + ++key; + } + } + } + // Finally, append what's left of `key` to `path`. What you end up with here is `resPath`, plus + // any pieces of `key` that aren't superseded by `resPath`. + // Or, to put it another way, calculate <#-segments-in-key> - (<#-segments-in-resPath> - <#-segments-in-origResPath>), + // and append that many segments from the end of `key` to `resPath` to produce the result. + path.append(key, *status); + } else { + path.append(inKey, *status); + } +} + U_CAPI UResourceBundle* U_EXPORT2 ures_getByKeyWithFallback(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) { Resource res = RES_BOGUS, rootRes = RES_BOGUS; - /*UResourceDataEntry *realData = NULL;*/ - UResourceBundle *helper = NULL; + UResourceBundle *helper = nullptr; - if (status==NULL || U_FAILURE(*status)) { + if (status==nullptr || U_FAILURE(*status)) { return fillIn; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return fillIn; } int32_t type = RES_GET_TYPE(resB->fRes); if(URES_IS_TABLE(type)) { - res = getTableItemByKeyPath(&(resB->fResData), resB->fRes, inKey); + const char* origResPath = resB->fResPath; + int32_t origResPathLen = resB->fResPathLen; + res = getTableItemByKeyPath(&resB->getResData(), resB->fRes, inKey); const char* key = inKey; + bool didRootOnce = false; if(res == RES_BOGUS) { UResourceDataEntry *dataEntry = resB->fData; CharString path; - char *myPath = NULL; + char *myPath = nullptr; const char* resPath = resB->fResPath; int32_t len = resB->fResPathLen; - while(res == RES_BOGUS && dataEntry->fParent != NULL) { /* Otherwise, we'll look in parents */ - dataEntry = dataEntry->fParent; + while(res == RES_BOGUS && (dataEntry->fParent != nullptr || !didRootOnce)) { /* Otherwise, we'll look in parents */ + if (dataEntry->fParent != nullptr) { + dataEntry = dataEntry->fParent; + } else { + // We can't just stop when we get to a bundle whose fParent is nullptr. That'll work most of the time, + // but if the bundle that the caller passed to us was "root" (which happens in getAllItemsWithFallback(), + // this function will drop right out without doing anything if "root" doesn't contain the exact key path + // specified. In that case, we need one extra time through this loop to make sure we follow any + // applicable aliases at the root level. + didRootOnce = true; + } rootRes = dataEntry->fData.rootRes; if(dataEntry->fBogus == U_ZERO_ERROR) { - path.clear(); - if (len > 0) { - path.append(resPath, len, *status); - } - path.append(inKey, *status); + createPath(origResPath, origResPathLen, resPath, len, inKey, path, status); if (U_FAILURE(*status)) { ures_close(helper); return fillIn; @@ -1897,8 +2211,8 @@ ures_getByKeyWithFallback(const UResourceBundle *resB, res = res_findResource(&(dataEntry->fData), rootRes, &myPath, &key); if (RES_GET_TYPE(res) == URES_ALIAS && *myPath) { /* We hit an alias, but we didn't finish following the path. */ - helper = init_resb_result(&(dataEntry->fData), res, NULL, -1, dataEntry, resB, 0, helper, status); - /*helper = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, helper, status);*/ + helper = init_resb_result(dataEntry, res, nullptr, -1, resB, helper, status); + /*helper = init_resb_result(dataEntry, res, inKey, -1, resB, helper, status);*/ if(helper) { dataEntry = helper->fData; rootRes = helper->fRes; @@ -1908,11 +2222,13 @@ ures_getByKeyWithFallback(const UResourceBundle *resB, } else { break; } + } else if (res == RES_BOGUS) { + break; } } while(*myPath); /* Continue until the whole path is consumed */ } } - /*const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);*/ + /*dataEntry = getFallbackData(resB, &key, &res, status);*/ if(res != RES_BOGUS) { /* check if resB->fResPath gives the right name here */ if(uprv_strcmp(dataEntry->fName, uloc_getDefault())==0 || uprv_strcmp(dataEntry->fName, kRootLocaleName)==0) { @@ -1921,14 +2237,33 @@ ures_getByKeyWithFallback(const UResourceBundle *resB, *status = U_USING_FALLBACK_WARNING; } - fillIn = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, fillIn, status); + fillIn = init_resb_result(dataEntry, res, key, -1, resB, fillIn, status); + if (resPath != nullptr) { + createPath(origResPath, origResPathLen, resPath, len, inKey, path, status); + } else { + const char* separator = nullptr; + if (fillIn->fResPath != nullptr) { + separator = uprv_strchr(fillIn->fResPath, RES_PATH_SEPARATOR); + } + if (separator != nullptr && separator[1] != '\0') { + createPath(origResPath, origResPathLen, fillIn->fResPath, + static_cast(uprv_strlen(fillIn->fResPath)), inKey, path, status); + } else { + createPath(origResPath, origResPathLen, "", 0, inKey, path, status); + } + } + ures_freeResPath(fillIn); + ures_appendResPath(fillIn, path.data(), path.length(), status); + if(fillIn->fResPath[fillIn->fResPathLen-1] != RES_PATH_SEPARATOR) { + ures_appendResPath(fillIn, RES_PATH_SEPARATOR_S, 1, status); + } } else { *status = U_MISSING_RESOURCE_ERROR; } } else { - fillIn = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status); + fillIn = init_resb_result(resB->fData, res, key, -1, resB, fillIn, status); } - } + } else { *status = U_RESOURCE_TYPE_MISMATCH; } @@ -1940,8 +2275,7 @@ namespace { void getAllItemsWithFallback( const UResourceBundle *bundle, ResourceDataValue &value, - ResourceSink &sink, - UErrorCode &errorCode) { + ResourceSink &sink, UErrorCode &errorCode) { if (U_FAILURE(errorCode)) { return; } // We recursively enumerate child-first, // only storing parent items in the absence of child items. @@ -1953,9 +2287,10 @@ void getAllItemsWithFallback( // When the sink sees the no-fallback/no-inheritance marker, // then it would remove the parent's item. // We would deserialize parent values even though they are overridden in a child bundle. - value.setData(&bundle->fResData); + value.setData(bundle->getResData()); + value.setValidLocaleDataEntry(bundle->fValidLocaleDataEntry); UResourceDataEntry *parentEntry = bundle->fData->fParent; - UBool hasParent = parentEntry != NULL && U_SUCCESS(parentEntry->fBogus); + UBool hasParent = parentEntry != nullptr && U_SUCCESS(parentEntry->fBogus); value.setResource(bundle->fRes, ResourceTracer(bundle)); sink.put(bundle->fKey, value, !hasParent, errorCode); if (hasParent) { @@ -1967,38 +2302,135 @@ void getAllItemsWithFallback( // TODO: See if we can refactor ures_getByKeyWithFallback() // and pull out an inner function that takes and returns a UResourceDataEntry // so that we need not create UResourceBundle objects. - UResourceBundle parentBundle; - ures_initStackObject(&parentBundle); - parentBundle.fTopLevelData = parentBundle.fData = parentEntry; - // TODO: What is the difference between bundle fData and fTopLevelData? - uprv_memcpy(&parentBundle.fResData, &parentEntry->fData, sizeof(ResourceData)); - // TODO: Try to replace bundle.fResData with just using bundle.fData->fData. - parentBundle.fHasFallback = !parentBundle.fResData.noFallback; - parentBundle.fIsTopLevel = TRUE; - parentBundle.fRes = parentBundle.fResData.rootRes; - parentBundle.fSize = res_countArrayItems(&(parentBundle.fResData), parentBundle.fRes); - parentBundle.fIndex = -1; + StackUResourceBundle parentBundle; + UResourceBundle &parentRef = parentBundle.ref(); + parentRef.fData = parentEntry; + parentRef.fValidLocaleDataEntry = bundle->fValidLocaleDataEntry; + parentRef.fHasFallback = !parentRef.getResData().noFallback; + parentRef.fIsTopLevel = true; + parentRef.fRes = parentRef.getResData().rootRes; + parentRef.fSize = res_countArrayItems(&parentRef.getResData(), parentRef.fRes); + parentRef.fIndex = -1; entryIncrease(parentEntry); // Look up the container item in the parent bundle. - UResourceBundle containerBundle; - ures_initStackObject(&containerBundle); + StackUResourceBundle containerBundle; const UResourceBundle *rb; UErrorCode pathErrorCode = U_ZERO_ERROR; // Ignore if parents up to root do not have this path. - if (bundle->fResPath == NULL || *bundle->fResPath == 0) { - rb = &parentBundle; + if (bundle->fResPath == nullptr || *bundle->fResPath == 0) { + rb = parentBundle.getAlias(); } else { - rb = ures_getByKeyWithFallback(&parentBundle, bundle->fResPath, - &containerBundle, &pathErrorCode); + rb = ures_getByKeyWithFallback(parentBundle.getAlias(), bundle->fResPath, + containerBundle.getAlias(), &pathErrorCode); } if (U_SUCCESS(pathErrorCode)) { getAllItemsWithFallback(rb, value, sink, errorCode); } - ures_close(&containerBundle); - ures_close(&parentBundle); } } +struct GetAllChildrenSink : public ResourceSink { + // Destination sink + ResourceSink& dest; + + GetAllChildrenSink(ResourceSink& dest) + : dest(dest) {} + virtual ~GetAllChildrenSink() override; + virtual void put(const char *key, ResourceValue &value, UBool isRoot, + UErrorCode &errorCode) override { + ResourceTable itemsTable = value.getTable(errorCode); + if (U_FAILURE(errorCode)) { return; } + for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) { + if (value.getType() == URES_ALIAS) { + ResourceDataValue& rdv = static_cast(value); + StackUResourceBundle stackTempBundle; + UResourceBundle* aliasRB = getAliasTargetAsResourceBundle(rdv.getData(), rdv.getResource(), nullptr, -1, + rdv.getValidLocaleDataEntry(), nullptr, 0, + stackTempBundle.getAlias(), &errorCode); + if (U_SUCCESS(errorCode)) { + ResourceDataValue aliasedValue; + aliasedValue.setData(aliasRB->getResData()); + aliasedValue.setValidLocaleDataEntry(aliasRB->fValidLocaleDataEntry); + aliasedValue.setResource(aliasRB->fRes, ResourceTracer(aliasRB)); + + if (aliasedValue.getType() != URES_TABLE) { + dest.put(key, aliasedValue, isRoot, errorCode); + } else { + // if the resource we're aliasing over to is a table, the sink might iterate over its contents. + // If it does, it'll get only the things defined in the actual alias target, not the things + // the target inherits from its parent resources. So we walk the parent chain for the *alias target*, + // calling dest.put() for each of the parent tables we could be inheriting from. This means + // that dest.put() has to iterate over the children of multiple tables to get all of the inherited + // resource values, but it already has to do that to handle normal vertical inheritance. + UResType aliasedValueType = URES_TABLE; + CharString tablePath; + tablePath.append(aliasRB->fResPath, errorCode); + const char* parentKey = key; // dest.put() changes the key + dest.put(parentKey, aliasedValue, isRoot, errorCode); + UResourceDataEntry* entry = aliasRB->fData; + Resource res = aliasRB->fRes; + while (aliasedValueType == URES_TABLE && entry->fParent != nullptr) { + CharString localPath; + localPath.copyFrom(tablePath, errorCode); + char* localPathAsCharPtr = localPath.data(); + const char* childKey; + entry = entry->fParent; + res = entry->fData.rootRes; + Resource newRes = res_findResource(&entry->fData, res, &localPathAsCharPtr, &childKey); + if (newRes != RES_BOGUS) { + aliasedValue.setData(entry->fData); + // TODO: do I also need to call aliasedValue.setValueLocaleDataEntry() ? + aliasedValue.setResource(newRes, ResourceTracer(aliasRB)); // probably wrong to use aliasRB here + aliasedValueType = aliasedValue.getType(); + if (aliasedValueType == URES_ALIAS) { + // in a few rare cases, when we get to the root resource bundle, the resource in question + // won't be an actual table, but will instead be an alias to a table. That is, we have + // two aliases in the inheritance path. (For some locales, such as Zulu, we see this with + // children of the "fields" resource: "day-narrow" aliases to "day-short", which aliases + // to "day".) When this happens, we need to make sure we follow all the aliases. + ResourceDataValue& rdv2 = static_cast(aliasedValue); + aliasRB = getAliasTargetAsResourceBundle(rdv2.getData(), rdv2.getResource(), nullptr, -1, + rdv2.getValidLocaleDataEntry(), nullptr, 0, + stackTempBundle.getAlias(), &errorCode); + tablePath.clear(); + tablePath.append(aliasRB->fResPath, errorCode); + entry = aliasRB->fData; + res = aliasRB->fRes; + aliasedValue.setData(entry->fData); + // TODO: do I also need to call aliasedValue.setValueLocaleDataEntry() ? + aliasedValue.setResource(res, ResourceTracer(aliasRB)); // probably wrong to use aliasRB here + aliasedValueType = aliasedValue.getType(); + } + if (aliasedValueType == URES_TABLE) { + dest.put(parentKey, aliasedValue, isRoot, errorCode); + } else { + // once we've followed the alias, the resource we're looking at really should + // be a table + errorCode = U_INTERNAL_PROGRAM_ERROR; + return; + } + } + } + } + } + } else { + dest.put(key, value, isRoot, errorCode); + } + if (U_FAILURE(errorCode)) { return; } + } + } +}; + +// Virtual destructors must be defined out of line. +GetAllChildrenSink::~GetAllChildrenSink() {} + +U_CAPI void U_EXPORT2 +ures_getAllChildrenWithFallback(const UResourceBundle *bundle, const char *path, + icu::ResourceSink &sink, UErrorCode &errorCode) { + GetAllChildrenSink allChildrenSink(sink); + ures_getAllItemsWithFallback(bundle, path, allChildrenSink, errorCode); +} + } // namespace // Requires a ResourceDataValue fill-in, so that we need not cast from a ResourceValue. @@ -2029,7 +2461,8 @@ ures_getValueWithFallback(const UResourceBundle *bundle, const char *path, return; } } - value.setData(&rb->fResData); + value.setData(rb->getResData()); + value.setValidLocaleDataEntry(rb->fValidLocaleDataEntry); value.setResource(rb->fRes, ResourceTracer(rb)); } @@ -2059,13 +2492,13 @@ ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path, U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) { Resource res = RES_BOGUS; - UResourceDataEntry *realData = NULL; + UResourceDataEntry *dataEntry = nullptr; const char *key = inKey; - if (status==NULL || U_FAILURE(*status)) { + if (status==nullptr || U_FAILURE(*status)) { return fillIn; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return fillIn; } @@ -2073,14 +2506,14 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con int32_t type = RES_GET_TYPE(resB->fRes); if(URES_IS_TABLE(type)) { int32_t t; - res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key); + res = res_getTableItemByKey(&resB->getResData(), resB->fRes, &t, &key); if(res == RES_BOGUS) { key = inKey; - if(resB->fHasFallback == TRUE) { - const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status); + if(resB->fHasFallback) { + dataEntry = getFallbackData(resB, &key, &res, status); if(U_SUCCESS(*status)) { - /* check if resB->fResPath gives the right name here */ - return init_resb_result(rd, res, key, -1, realData, resB, 0, fillIn, status); + /* check if resB->fResPath gives the right name here */ + return init_resb_result(dataEntry, res, key, -1, resB, fillIn, status); } else { *status = U_MISSING_RESOURCE_ERROR; } @@ -2088,60 +2521,60 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con *status = U_MISSING_RESOURCE_ERROR; } } else { - return init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status); + return init_resb_result(resB->fData, res, key, -1, resB, fillIn, status); } - } + } #if 0 /* this is a kind of TODO item. If we have an array with an index table, we could do this. */ /* not currently */ - else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) { + else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == true) { /* here should go a first attempt to locate the key using index table */ - const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status); + dataEntry = getFallbackData(resB, &key, &res, status); if(U_SUCCESS(*status)) { - return init_resb_result(rd, res, key, realData, resB, fillIn, status); + return init_resb_result(dataEntry, res, key, resB, fillIn, status); } else { *status = U_MISSING_RESOURCE_ERROR; } } -#endif +#endif else { *status = U_RESOURCE_TYPE_MISMATCH; } return fillIn; } -U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* inKey, int32_t* len, UErrorCode *status) { +U_CAPI const char16_t* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* inKey, int32_t* len, UErrorCode *status) { Resource res = RES_BOGUS; - UResourceDataEntry *realData = NULL; + UResourceDataEntry *dataEntry = nullptr; const char* key = inKey; - if (status==NULL || U_FAILURE(*status)) { - return NULL; + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } - if(resB == NULL) { + if(resB == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } int32_t type = RES_GET_TYPE(resB->fRes); if(URES_IS_TABLE(type)) { int32_t t=0; - res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key); + res = res_getTableItemByKey(&resB->getResData(), resB->fRes, &t, &key); if(res == RES_BOGUS) { key = inKey; - if(resB->fHasFallback == TRUE) { - const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status); + if(resB->fHasFallback) { + dataEntry = getFallbackData(resB, &key, &res, status); if(U_SUCCESS(*status)) { switch (RES_GET_TYPE(res)) { case URES_STRING: case URES_STRING_V2: - return res_getString({resB, key}, rd, res, len); + return res_getString({resB, key}, &dataEntry->fData, res, len); case URES_ALIAS: { - const UChar* result = 0; - UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status); + const char16_t* result = 0; + UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status); result = ures_getString(tempRes, len, status); ures_close(tempRes); return result; @@ -2159,11 +2592,11 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c switch (RES_GET_TYPE(res)) { case URES_STRING: case URES_STRING_V2: - return res_getString({resB, key}, &(resB->fResData), res, len); + return res_getString({resB, key}, &resB->getResData(), res, len); case URES_ALIAS: { - const UChar* result = 0; - UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status); + const char16_t* result = 0; + UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status); result = ures_getString(tempRes, len, status); ures_close(tempRes); return result; @@ -2172,25 +2605,25 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c *status = U_RESOURCE_TYPE_MISMATCH; } } - } -#if 0 + } +#if 0 /* this is a kind of TODO item. If we have an array with an index table, we could do this. */ - /* not currently */ - else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) { + /* not currently */ + else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == true) { /* here should go a first attempt to locate the key using index table */ - const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status); + dataEntry = getFallbackData(resB, &key, &res, status); if(U_SUCCESS(*status)) { // TODO: Tracing return res_getString(rd, res, len); } else { *status = U_MISSING_RESOURCE_ERROR; } - } -#endif + } +#endif else { *status = U_RESOURCE_TYPE_MISMATCH; } - return NULL; + return nullptr; } U_CAPI const char * U_EXPORT2 @@ -2200,65 +2633,65 @@ ures_getUTF8StringByKey(const UResourceBundle *resB, UBool forceCopy, UErrorCode *status) { int32_t length16; - const UChar *s16 = ures_getStringByKey(resB, key, &length16, status); + const char16_t *s16 = ures_getStringByKey(resB, key, &length16, status); return ures_toUTF8String(s16, length16, dest, pLength, forceCopy, status); } /* TODO: clean from here down */ /** - * INTERNAL: Get the name of the first real locale (not placeholder) + * INTERNAL: Get the name of the first real locale (not placeholder) * that has resource bundle data. */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ures_getLocaleInternal(const UResourceBundle* resourceBundle, UErrorCode* status) { - if (status==NULL || U_FAILURE(*status)) { - return NULL; + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } if (!resourceBundle) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } else { return resourceBundle->fData->fName; } } -U_CAPI const char* U_EXPORT2 -ures_getLocale(const UResourceBundle* resourceBundle, +U_CAPI const char* U_EXPORT2 +ures_getLocale(const UResourceBundle* resourceBundle, UErrorCode* status) { return ures_getLocaleInternal(resourceBundle, status); } -U_CAPI const char* U_EXPORT2 -ures_getLocaleByType(const UResourceBundle* resourceBundle, - ULocDataLocaleType type, +U_CAPI const char* U_EXPORT2 +ures_getLocaleByType(const UResourceBundle* resourceBundle, + ULocDataLocaleType type, UErrorCode* status) { - if (status==NULL || U_FAILURE(*status)) { - return NULL; + if (status==nullptr || U_FAILURE(*status)) { + return nullptr; } if (!resourceBundle) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } else { switch(type) { case ULOC_ACTUAL_LOCALE: return resourceBundle->fData->fName; case ULOC_VALID_LOCALE: - return resourceBundle->fTopLevelData->fName; + return resourceBundle->fValidLocaleDataEntry->fName; case ULOC_REQUESTED_LOCALE: default: *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } } } U_CFUNC const char* ures_getName(const UResourceBundle* resB) { - if(resB == NULL) { - return NULL; + if(resB == nullptr) { + return nullptr; } return resB->fData->fName; @@ -2266,8 +2699,8 @@ U_CFUNC const char* ures_getName(const UResourceBundle* resB) { #ifdef URES_DEBUG U_CFUNC const char* ures_getPath(const UResourceBundle* resB) { - if(resB == NULL) { - return NULL; + if(resB == nullptr) { + return nullptr; } return resB->fData->fPath; @@ -2278,52 +2711,54 @@ static UResourceBundle* ures_openWithType(UResourceBundle *r, const char* path, const char* localeID, UResOpenType openType, UErrorCode* status) { if(U_FAILURE(*status)) { - return NULL; + return nullptr; } UResourceDataEntry *entry; if(openType != URES_OPEN_DIRECT) { /* first "canonicalize" the locale ID */ - char canonLocaleID[ULOC_FULLNAME_CAPACITY]; - uloc_getBaseName(localeID, canonLocaleID, UPRV_LENGTHOF(canonLocaleID), status); - if(U_FAILURE(*status) || *status == U_STRING_NOT_TERMINATED_WARNING) { + CharString canonLocaleID; + { + CharStringByteSink sink(&canonLocaleID); + ulocimp_getBaseName(localeID, sink, status); + } + if(U_FAILURE(*status)) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - entry = entryOpen(path, canonLocaleID, openType, status); + entry = entryOpen(path, canonLocaleID.data(), openType, status); } else { entry = entryOpenDirect(path, localeID, status); } if(U_FAILURE(*status)) { - return NULL; + return nullptr; } - if(entry == NULL) { + if(entry == nullptr) { *status = U_MISSING_RESOURCE_ERROR; - return NULL; + return nullptr; } UBool isStackObject; - if(r == NULL) { + if(r == nullptr) { r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle)); - if(r == NULL) { + if(r == nullptr) { entryClose(entry); *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - isStackObject = FALSE; + isStackObject = false; } else { // fill-in isStackObject = ures_isStackObject(r); - ures_closeBundle(r, FALSE); + ures_closeBundle(r, false); } uprv_memset(r, 0, sizeof(UResourceBundle)); ures_setIsStackObject(r, isStackObject); - r->fTopLevelData = r->fData = entry; - uprv_memcpy(&r->fResData, &entry->fData, sizeof(ResourceData)); - r->fHasFallback = openType != URES_OPEN_DIRECT && !r->fResData.noFallback; - r->fIsTopLevel = TRUE; - r->fRes = r->fResData.rootRes; - r->fSize = res_countArrayItems(&(r->fResData), r->fRes); + r->fValidLocaleDataEntry = r->fData = entry; + r->fHasFallback = openType != URES_OPEN_DIRECT && !r->getResData().noFallback; + r->fIsTopLevel = true; + r->fRes = r->getResData().rootRes; + r->fSize = res_countArrayItems(&r->getResData(), r->fRes); r->fIndex = -1; ResourceTracer(r).traceOpen(); @@ -2333,34 +2768,34 @@ ures_openWithType(UResourceBundle *r, const char* path, const char* localeID, U_CAPI UResourceBundle* U_EXPORT2 ures_open(const char* path, const char* localeID, UErrorCode* status) { - return ures_openWithType(NULL, path, localeID, URES_OPEN_LOCALE_DEFAULT_ROOT, status); + return ures_openWithType(nullptr, path, localeID, URES_OPEN_LOCALE_DEFAULT_ROOT, status); } U_CAPI UResourceBundle* U_EXPORT2 ures_openNoDefault(const char* path, const char* localeID, UErrorCode* status) { - return ures_openWithType(NULL, path, localeID, URES_OPEN_LOCALE_ROOT, status); + return ures_openWithType(nullptr, path, localeID, URES_OPEN_LOCALE_ROOT, status); } /** - * Opens a resource bundle without "canonicalizing" the locale name. No fallback will be performed + * Opens a resource bundle without "canonicalizing" the locale name. No fallback will be performed * or sought. However, alias substitution will happen! */ U_CAPI UResourceBundle* U_EXPORT2 ures_openDirect(const char* path, const char* localeID, UErrorCode* status) { - return ures_openWithType(NULL, path, localeID, URES_OPEN_DIRECT, status); + return ures_openWithType(nullptr, path, localeID, URES_OPEN_DIRECT, status); } /** - * Internal API: This function is used to open a resource bundle - * proper fallback chaining is executed while initialization. - * The result is stored in uresbund_cache for later fallback search. - * + * Internal API: This function is used to open a resource bundle + * proper fallback chaining is executed while initialization. + * The result is stored in cache for later fallback search. + * * Same as ures_open(), but uses the fill-in parameter and does not allocate a new bundle. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_openFillIn(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status) { - if(U_SUCCESS(*status) && r == NULL) { + if(U_SUCCESS(*status) && r == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -2370,9 +2805,9 @@ ures_openFillIn(UResourceBundle *r, const char* path, /** * Same as ures_openDirect(), but uses the fill-in parameter and does not allocate a new bundle. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_openDirectFillIn(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status) { - if(U_SUCCESS(*status) && r == NULL) { + if(U_SUCCESS(*status) && r == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -2390,17 +2825,17 @@ ures_countArrayItems(const UResourceBundle* resourceBundle, { UResourceBundle resData; ures_initStackObject(&resData); - if (status==NULL || U_FAILURE(*status)) { + if (status==nullptr || U_FAILURE(*status)) { return 0; } - if(resourceBundle == NULL) { + if(resourceBundle == nullptr) { *status = U_ILLEGAL_ARGUMENT_ERROR; return 0; } ures_getByKey(resourceBundle, resourceKey, &resData, status); - - if(resData.fResData.data != NULL) { - int32_t result = res_countArrayItems(&resData.fResData, resData.fRes); + + if(resData.getResData().data != nullptr) { + int32_t result = res_countArrayItems(&resData.getResData(), resData.fRes); ures_close(&resData); return result; } else { @@ -2420,12 +2855,12 @@ ures_countArrayItems(const UResourceBundle* resourceBundle, * @see ures_getVersion * @internal */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ures_getVersionNumberInternal(const UResourceBundle *resourceBundle) { - if (!resourceBundle) return NULL; + if (!resourceBundle) return nullptr; - if(resourceBundle->fVersion == NULL) { + if(resourceBundle->fVersion == nullptr) { /* If the version ID has not been built yet, then do so. Retrieve */ /* the minor version from the file. */ @@ -2433,25 +2868,25 @@ ures_getVersionNumberInternal(const UResourceBundle *resourceBundle) int32_t minor_len = 0; int32_t len; - const UChar* minor_version = ures_getStringByKey(resourceBundle, kVersionTag, &minor_len, &status); - + const char16_t* minor_version = ures_getStringByKey(resourceBundle, kVersionTag, &minor_len, &status); + /* Determine the length of of the final version string. This is */ /* the length of the major part + the length of the separator */ /* (==1) + the length of the minor part (+ 1 for the zero byte at */ /* the end). */ len = (minor_len > 0) ? minor_len : 1; - + /* Allocate the string, and build it up. */ /* + 1 for zero byte */ - ((UResourceBundle *)resourceBundle)->fVersion = (char *)uprv_malloc(1 + len); + ((UResourceBundle *)resourceBundle)->fVersion = (char *)uprv_malloc(1 + len); /* Check for null pointer. */ - if (((UResourceBundle *)resourceBundle)->fVersion == NULL) { - return NULL; + if (((UResourceBundle *)resourceBundle)->fVersion == nullptr) { + return nullptr; } - + if(minor_len > 0) { u_UCharsToChars(minor_version, resourceBundle->fVersion , minor_len); resourceBundle->fVersion[len] = '\0'; @@ -2514,8 +2949,8 @@ ures_loc_nextLocale(UEnumeration* en, UErrorCode* status) { ULocalesContext *ctx = (ULocalesContext *)en->context; UResourceBundle *res = &(ctx->installed); - UResourceBundle *k = NULL; - const char *result = NULL; + UResourceBundle *k = nullptr; + const char *result = nullptr; int32_t len = 0; if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != 0) { result = ures_getKey(k); @@ -2527,8 +2962,8 @@ ures_loc_nextLocale(UEnumeration* en, return result; } -static void U_CALLCONV -ures_loc_resetLocales(UEnumeration* en, +static void U_CALLCONV +ures_loc_resetLocales(UEnumeration* en, UErrorCode* /*status*/) { UResourceBundle *res = &((ULocalesContext *)en->context)->installed; ures_resetIterator(res); @@ -2537,8 +2972,8 @@ ures_loc_resetLocales(UEnumeration* en, U_CDECL_END static const UEnumeration gLocalesEnum = { - NULL, - NULL, + nullptr, + nullptr, ures_loc_closeLocales, ures_loc_countLocales, uenum_unextDefault, @@ -2550,12 +2985,12 @@ static const UEnumeration gLocalesEnum = { U_CAPI UEnumeration* U_EXPORT2 ures_openAvailableLocales(const char *path, UErrorCode *status) { - UResourceBundle *idx = NULL; - UEnumeration *en = NULL; - ULocalesContext *myContext = NULL; + UResourceBundle *idx = nullptr; + UEnumeration *en = nullptr; + ULocalesContext *myContext = nullptr; if(U_FAILURE(*status)) { - return NULL; + return nullptr; } myContext = static_cast(uprv_malloc(sizeof(ULocalesContext))); en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration)); @@ -2563,7 +2998,7 @@ ures_openAvailableLocales(const char *path, UErrorCode *status) *status = U_MEMORY_ALLOCATION_ERROR; uprv_free(en); uprv_free(myContext); - return NULL; + return nullptr; } uprv_memcpy(en, &gLocalesEnum, sizeof(UEnumeration)); @@ -2573,7 +3008,7 @@ ures_openAvailableLocales(const char *path, UErrorCode *status) ures_getByKey(idx, INDEX_TAG, &myContext->installed, status); if(U_SUCCESS(*status)) { #if defined(URES_TREE_DEBUG) - fprintf(stderr, "Got %s::%s::[%s] : %s\n", + fprintf(stderr, "Got %s::%s::[%s] : %s\n", path, INDEX_LOCALE_NAME, INDEX_TAG, ures_getKey(&myContext->installed)); #endif en->context = myContext; @@ -2584,22 +3019,47 @@ ures_openAvailableLocales(const char *path, UErrorCode *status) ures_close(&myContext->installed); uprv_free(myContext); uprv_free(en); - en = NULL; + en = nullptr; } - + ures_close(idx); - + return en; } static UBool isLocaleInList(UEnumeration *locEnum, const char *locToSearch, UErrorCode *status) { const char *loc; - while ((loc = uenum_next(locEnum, NULL, status)) != NULL) { + while ((loc = uenum_next(locEnum, nullptr, status)) != nullptr) { if (uprv_strcmp(loc, locToSearch) == 0) { - return TRUE; + return true; + } + } + return false; +} + +static void getParentForFunctionalEquivalent(const char* localeID, + UResourceBundle* res, + UResourceBundle* bund1, + char* parent, + int32_t parentCapacity) { + // Get parent. + // First check for a parent from %%Parent resource (Note that in resource trees + // such as collation, data may have different parents than in parentLocales). + UErrorCode subStatus = U_ZERO_ERROR; + parent[0] = '\0'; + if (res != NULL) { + ures_getByKey(res, "%%Parent", bund1, &subStatus); + if (U_SUCCESS(subStatus)) { + int32_t parentLen = parentCapacity; + ures_getUTF8String(bund1, parent, &parentLen, true, &subStatus); } } - return FALSE; + + // If none there, use normal truncation parent + if (U_FAILURE(subStatus) || parent[0] == 0) { + subStatus = U_ZERO_ERROR; + uloc_getParent(localeID, parent, parentCapacity, &subStatus); + } } U_CAPI int32_t U_EXPORT2 @@ -2607,37 +3067,42 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, const char *path, const char *resName, const char *keyword, const char *locid, UBool *isAvailable, UBool omitDefault, UErrorCode *status) { - char kwVal[1024] = ""; /* value of keyword 'keyword' */ char defVal[1024] = ""; /* default value for given locale */ char defLoc[1024] = ""; /* default value for given locale */ - char base[1024] = ""; /* base locale */ - char found[1024]; - char parent[1024]; + CharString base; /* base locale */ + char found[1024] = ""; + char parent[1024] = ""; char full[1024] = ""; UResourceBundle bund1, bund2; - UResourceBundle *res = NULL; + UResourceBundle *res = nullptr; UErrorCode subStatus = U_ZERO_ERROR; int32_t length = 0; if(U_FAILURE(*status)) return 0; - uloc_getKeywordValue(locid, keyword, kwVal, 1024-1,&subStatus); - if(!uprv_strcmp(kwVal, DEFAULT_TAG)) { - kwVal[0]=0; + CharString kwVal; + { + CharStringByteSink sink(&kwVal); + ulocimp_getKeywordValue(locid, keyword, sink, &subStatus); + } + if(kwVal == DEFAULT_TAG) { + kwVal.clear(); + } + { + CharStringByteSink sink(&base); + ulocimp_getBaseName(locid, sink, &subStatus); } - uloc_getBaseName(locid, base, 1024-1,&subStatus); #if defined(URES_TREE_DEBUG) - fprintf(stderr, "getFunctionalEquivalent: \"%s\" [%s=%s] in %s - %s\n", - locid, keyword, kwVal, base, u_errorName(subStatus)); + fprintf(stderr, "getFunctionalEquivalent: \"%s\" [%s=%s] in %s - %s\n", + locid, keyword, kwVal.data(), base.data(), u_errorName(subStatus)); #endif ures_initStackObject(&bund1); ures_initStackObject(&bund2); - - uprv_strcpy(parent, base); - uprv_strcpy(found, base); + base.extract(parent, UPRV_LENGTHOF(parent), subStatus); + base.extract(found, UPRV_LENGTHOF(found), subStatus); if(isAvailable) { UEnumeration *locEnum = ures_openAvailableLocales(path, &subStatus); - *isAvailable = TRUE; + *isAvailable = true; if (U_SUCCESS(subStatus)) { *isAvailable = isLocaleInList(locEnum, parent, &subStatus); } @@ -2648,17 +3113,17 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, *status = subStatus; return 0; } - + do { subStatus = U_ZERO_ERROR; res = ures_open(path, parent, &subStatus); if(((subStatus == U_USING_FALLBACK_WARNING) || (subStatus == U_USING_DEFAULT_WARNING)) && isAvailable) { - *isAvailable = FALSE; + *isAvailable = false; } - isAvailable = NULL; /* only want to set this the first time around */ - + isAvailable = nullptr; /* only want to set this the first time around */ + #if defined(URES_TREE_DEBUG) fprintf(stderr, "%s;%s -> %s [%s]\n", path?path:"ICUDATA", parent, u_errorName(subStatus), ures_getLocale(res, &subStatus)); #endif @@ -2667,7 +3132,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, } else if(subStatus == U_ZERO_ERROR) { ures_getByKey(res,resName,&bund1, &subStatus); if(subStatus == U_ZERO_ERROR) { - const UChar *defUstr; + const char16_t *defUstr; int32_t defLen; /* look for default item */ #if defined(URES_TREE_DEBUG) @@ -2678,46 +3143,49 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, if(U_SUCCESS(subStatus) && defLen) { u_UCharsToChars(defUstr, defVal, u_strlen(defUstr)); #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> default %s=%s, %s\n", + fprintf(stderr, "%s;%s -> default %s=%s, %s\n", path?path:"ICUDATA", parent, keyword, defVal, u_errorName(subStatus)); #endif uprv_strcpy(defLoc, parent); - if(kwVal[0]==0) { - uprv_strcpy(kwVal, defVal); + if(kwVal.isEmpty()) { + kwVal.append(defVal, defLen, subStatus); #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> kwVal = %s\n", - path?path:"ICUDATA", parent, keyword, kwVal); + fprintf(stderr, "%s;%s -> kwVal = %s\n", + path?path:"ICUDATA", parent, keyword, kwVal.data()); #endif } } } } - + subStatus = U_ZERO_ERROR; - if (res != NULL) { + if (res != nullptr) { uprv_strcpy(found, ures_getLocaleByType(res, ULOC_VALID_LOCALE, &subStatus)); } - uloc_getParent(found,parent,sizeof(parent),&subStatus); + if (uprv_strcmp(found, parent) != 0) { + uprv_strcpy(parent, found); + } else { + getParentForFunctionalEquivalent(found,res,&bund1,parent,sizeof(parent)); + } ures_close(res); } while(!defVal[0] && *found && uprv_strcmp(found, "root") != 0 && U_SUCCESS(*status)); - + /* Now, see if we can find the kwVal collator.. start the search over.. */ - uprv_strcpy(parent, base); - uprv_strcpy(found, base); + base.extract(parent, UPRV_LENGTHOF(parent), subStatus); + base.extract(found, UPRV_LENGTHOF(found), subStatus); do { - subStatus = U_ZERO_ERROR; res = ures_open(path, parent, &subStatus); if((subStatus == U_USING_FALLBACK_WARNING) && isAvailable) { - *isAvailable = FALSE; + *isAvailable = false; } - isAvailable = NULL; /* only want to set this the first time around */ - + isAvailable = nullptr; /* only want to set this the first time around */ + #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> %s (looking for %s)\n", - path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal); + fprintf(stderr, "%s;%s -> %s (looking for %s)\n", + path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal.data()); #endif if(U_FAILURE(subStatus)) { *status = subStatus; @@ -2727,14 +3195,14 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, /**/ fprintf(stderr,"@%d [%s] %s\n", __LINE__, resName, u_errorName(subStatus)); #endif if(subStatus == U_ZERO_ERROR) { - ures_getByKey(&bund1, kwVal, &bund2, &subStatus); + ures_getByKey(&bund1, kwVal.data(), &bund2, &subStatus); #if defined(URES_TREE_DEBUG) -/**/ fprintf(stderr,"@%d [%s] %s\n", __LINE__, kwVal, u_errorName(subStatus)); +/**/ fprintf(stderr,"@%d [%s] %s\n", __LINE__, kwVal.data(), u_errorName(subStatus)); #endif if(subStatus == U_ZERO_ERROR) { #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> full0 %s=%s, %s\n", - path?path:"ICUDATA", parent, keyword, kwVal, u_errorName(subStatus)); + fprintf(stderr, "%s;%s -> full0 %s=%s, %s\n", + path?path:"ICUDATA", parent, keyword, kwVal.data(), u_errorName(subStatus)); #endif uprv_strcpy(full, parent); if(*full == 0) { @@ -2742,18 +3210,18 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, } /* now, recalculate default kw if need be */ if(uprv_strlen(defLoc) > uprv_strlen(full)) { - const UChar *defUstr; + const char16_t *defUstr; int32_t defLen; /* look for default item */ #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> recalculating Default0\n", + fprintf(stderr, "%s;%s -> recalculating Default0\n", path?path:"ICUDATA", full); #endif defUstr = ures_getStringByKey(&bund1, DEFAULT_TAG, &defLen, &subStatus); if(U_SUCCESS(subStatus) && defLen) { u_UCharsToChars(defUstr, defVal, u_strlen(defUstr)); #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> default0 %s=%s, %s\n", + fprintf(stderr, "%s;%s -> default0 %s=%s, %s\n", path?path:"ICUDATA", full, keyword, defVal, u_errorName(subStatus)); #endif uprv_strcpy(defLoc, full); @@ -2766,70 +3234,93 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, #endif } else { #if defined(URES_TREE_DEBUG) - fprintf(stderr, "err=%s in %s looking for %s\n", - u_errorName(subStatus), parent, kwVal); + fprintf(stderr, "err=%s in %s looking for %s\n", + u_errorName(subStatus), parent, kwVal.data()); #endif } } } + + UBool haveFound = false; + // At least for collations which may be aliased, we need to use the VALID locale + // as the parent instead of just truncating, as long as the VALID locale is not + // root and has a different language than the parent. Use of the VALID locale + // here is similar to the procedure used at the end of the previous do-while loop + // for all resource types. + if (res != NULL && uprv_strcmp(resName, "collations") == 0) { + subStatus = U_ZERO_ERROR; + const char *validLoc = ures_getLocaleByType(res, ULOC_VALID_LOCALE, &subStatus); + if (U_SUCCESS(subStatus) && validLoc != NULL && validLoc[0] != 0 && uprv_strcmp(validLoc, "root") != 0) { + char validLang[ULOC_LANG_CAPACITY]; + char parentLang[ULOC_LANG_CAPACITY]; + uloc_getLanguage(validLoc, validLang, ULOC_LANG_CAPACITY, &subStatus); + uloc_getLanguage(parent, parentLang, ULOC_LANG_CAPACITY, &subStatus); + if (U_SUCCESS(subStatus) && uprv_strcmp(validLang, parentLang) != 0) { + // validLoc is not root and has a different language than parent, use it instead + uprv_strcpy(found, validLoc); + haveFound = true; + } + } + subStatus = U_ZERO_ERROR; + } + if (!haveFound) { + uprv_strcpy(found, parent); + } - subStatus = U_ZERO_ERROR; - - uprv_strcpy(found, parent); - uloc_getParent(found,parent,1023,&subStatus); + getParentForFunctionalEquivalent(found,res,&bund1,parent,1023); ures_close(res); + subStatus = U_ZERO_ERROR; } while(!full[0] && *found && U_SUCCESS(*status)); - if((full[0]==0) && uprv_strcmp(kwVal, defVal)) { + if((full[0]==0) && kwVal != defVal) { #if defined(URES_TREE_DEBUG) - fprintf(stderr, "Failed to locate kw %s - try default %s\n", kwVal, defVal); + fprintf(stderr, "Failed to locate kw %s - try default %s\n", kwVal.data(), defVal); #endif - uprv_strcpy(kwVal, defVal); - uprv_strcpy(parent, base); - uprv_strcpy(found, base); + kwVal.clear().append(defVal, subStatus); + base.extract(parent, UPRV_LENGTHOF(parent), subStatus); + base.extract(found, UPRV_LENGTHOF(found), subStatus); do { /* search for 'default' named item */ - subStatus = U_ZERO_ERROR; res = ures_open(path, parent, &subStatus); if((subStatus == U_USING_FALLBACK_WARNING) && isAvailable) { - *isAvailable = FALSE; + *isAvailable = false; } - isAvailable = NULL; /* only want to set this the first time around */ - + isAvailable = nullptr; /* only want to set this the first time around */ + #if defined(URES_TREE_DEBUG) fprintf(stderr, "%s;%s -> %s (looking for default %s)\n", - path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal); + path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal.data()); #endif if(U_FAILURE(subStatus)) { *status = subStatus; } else if(subStatus == U_ZERO_ERROR) { ures_getByKey(res,resName,&bund1, &subStatus); if(subStatus == U_ZERO_ERROR) { - ures_getByKey(&bund1, kwVal, &bund2, &subStatus); + ures_getByKey(&bund1, kwVal.data(), &bund2, &subStatus); if(subStatus == U_ZERO_ERROR) { #if defined(URES_TREE_DEBUG) fprintf(stderr, "%s;%s -> full1 %s=%s, %s\n", path?path:"ICUDATA", - parent, keyword, kwVal, u_errorName(subStatus)); + parent, keyword, kwVal.data(), u_errorName(subStatus)); #endif uprv_strcpy(full, parent); if(*full == 0) { uprv_strcpy(full, "root"); } - + /* now, recalculate default kw if need be */ if(uprv_strlen(defLoc) > uprv_strlen(full)) { - const UChar *defUstr; + const char16_t *defUstr; int32_t defLen; /* look for default item */ #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> recalculating Default1\n", + fprintf(stderr, "%s;%s -> recalculating Default1\n", path?path:"ICUDATA", full); #endif defUstr = ures_getStringByKey(&bund1, DEFAULT_TAG, &defLen, &subStatus); if(U_SUCCESS(subStatus) && defLen) { u_UCharsToChars(defUstr, defVal, u_strlen(defUstr)); #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s;%s -> default %s=%s, %s\n", + fprintf(stderr, "%s;%s -> default %s=%s, %s\n", path?path:"ICUDATA", full, keyword, defVal, u_errorName(subStatus)); #endif uprv_strcpy(defLoc, full); @@ -2843,41 +3334,41 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, } } } - subStatus = U_ZERO_ERROR; - + uprv_strcpy(found, parent); - uloc_getParent(found,parent,1023,&subStatus); + getParentForFunctionalEquivalent(found,res,&bund1,parent,1023); ures_close(res); + subStatus = U_ZERO_ERROR; } while(!full[0] && *found && U_SUCCESS(*status)); } - + if(U_SUCCESS(*status)) { if(!full[0]) { #if defined(URES_TREE_DEBUG) - fprintf(stderr, "Still could not load keyword %s=%s\n", keyword, kwVal); + fprintf(stderr, "Still could not load keyword %s=%s\n", keyword, kwVal.data()); #endif *status = U_MISSING_RESOURCE_ERROR; } else if(omitDefault) { #if defined(URES_TREE_DEBUG) fprintf(stderr,"Trim? full=%s, defLoc=%s, found=%s\n", full, defLoc, found); -#endif +#endif if(uprv_strlen(defLoc) <= uprv_strlen(full)) { /* found the keyword in a *child* of where the default tag was present. */ - if(!uprv_strcmp(kwVal, defVal)) { /* if the requested kw is default, */ + if(kwVal == defVal) { /* if the requested kw is default, */ /* and the default is in or in an ancestor of the current locale */ #if defined(URES_TREE_DEBUG) - fprintf(stderr, "Removing unneeded var %s=%s\n", keyword, kwVal); + fprintf(stderr, "Removing unneeded var %s=%s\n", keyword, kwVal.data()); #endif - kwVal[0]=0; + kwVal.clear(); } } } uprv_strcpy(found, full); - if(kwVal[0]) { + if(!kwVal.isEmpty()) { uprv_strcat(found, "@"); uprv_strcat(found, keyword); uprv_strcat(found, "="); - uprv_strcat(found, kwVal); + uprv_strcat(found, kwVal.data()); } else if(!omitDefault) { uprv_strcat(found, "@"); uprv_strcat(found, keyword); @@ -2886,10 +3377,10 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, } } /* we found the default locale - no need to repeat it.*/ - + ures_close(&bund1); ures_close(&bund2); - + length = (int32_t)uprv_strlen(found); if(U_SUCCESS(*status)) { @@ -2898,7 +3389,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, uprv_strncpy(result, found, copyLength); } if(length == 0) { - *status = U_MISSING_RESOURCE_ERROR; + *status = U_MISSING_RESOURCE_ERROR; } } else { length = 0; @@ -2912,58 +3403,58 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status) { #define VALUES_BUF_SIZE 2048 #define VALUES_LIST_SIZE 512 - + char valuesBuf[VALUES_BUF_SIZE]; int32_t valuesIndex = 0; const char *valuesList[VALUES_LIST_SIZE]; int32_t valuesCount = 0; - + const char *locale; int32_t locLen; - - UEnumeration *locs = NULL; - + + UEnumeration *locs = nullptr; + UResourceBundle item; UResourceBundle subItem; - + ures_initStackObject(&item); ures_initStackObject(&subItem); locs = ures_openAvailableLocales(path, status); - + if(U_FAILURE(*status)) { ures_close(&item); ures_close(&subItem); - return NULL; + return nullptr; } - + valuesBuf[0]=0; valuesBuf[1]=0; - + while((locale = uenum_next(locs, &locLen, status)) != 0) { - UResourceBundle *bund = NULL; - UResourceBundle *subPtr = NULL; + UResourceBundle *bund = nullptr; + UResourceBundle *subPtr = nullptr; UErrorCode subStatus = U_ZERO_ERROR; /* don't fail if a bundle is unopenable */ - bund = ures_openDirect(path, locale, &subStatus); - + bund = ures_open(path, locale, &subStatus); + #if defined(URES_TREE_DEBUG) if(!bund || U_FAILURE(subStatus)) { - fprintf(stderr, "%s-%s values: Can't open %s locale - skipping. (%s)\n", + fprintf(stderr, "%s-%s values: Can't open %s locale - skipping. (%s)\n", path?path:"", keyword, locale, u_errorName(subStatus)); } #endif - + ures_getByKey(bund, keyword, &item, &subStatus); - + if(!bund || U_FAILURE(subStatus)) { #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s-%s values: Can't find in %s - skipping. (%s)\n", + fprintf(stderr, "%s-%s values: Can't find in %s - skipping. (%s)\n", path?path:"", keyword, locale, u_errorName(subStatus)); #endif ures_close(bund); - bund = NULL; + bund = nullptr; continue; } - + while((subPtr = ures_getNextResource(&item,&subItem,&subStatus)) != 0 && U_SUCCESS(subStatus)) { const char *k; @@ -2973,18 +3464,18 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status) #if defined(URES_TREE_DEBUG) /* fprintf(stderr, "%s | %s | %s | %s\n", path?path:"", keyword, locale, k); */ #endif - if(k == NULL || *k == 0 || + if(k == nullptr || *k == 0 || uprv_strcmp(k, DEFAULT_TAG) == 0 || uprv_strncmp(k, "private-", 8) == 0) { // empty or "default" or unlisted type continue; } for(i=0; i= (VALUES_LIST_SIZE-1)) || /* no more space in list .. */ ((valuesIndex+kLen+1+1) >= VALUES_BUF_SIZE)) { /* no more space in buffer (string + 2 nulls) */ @@ -3004,87 +3495,87 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status) ures_close(bund); } valuesBuf[valuesIndex++] = 0; /* terminate */ - + ures_close(&item); ures_close(&subItem); uenum_close(locs); #if defined(URES_TREE_DEBUG) - fprintf(stderr, "%s: size %d, #%d\n", u_errorName(*status), + fprintf(stderr, "%s: size %d, #%d\n", u_errorName(*status), valuesIndex, valuesCount); #endif return uloc_openKeywordList(valuesBuf, valuesIndex, status); } #if 0 /* This code isn't needed, and given the documentation warnings the implementation is suspect */ -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ures_equal(const UResourceBundle* res1, const UResourceBundle* res2){ - if(res1==NULL || res2==NULL){ + if(res1==nullptr || res2==nullptr){ return res1==res2; /* pointer comparison */ } - if(res1->fKey==NULL|| res2->fKey==NULL){ + if(res1->fKey==nullptr|| res2->fKey==nullptr){ return (res1->fKey==res2->fKey); }else{ if(uprv_strcmp(res1->fKey, res2->fKey)!=0){ - return FALSE; + return false; } } if(uprv_strcmp(res1->fData->fName, res2->fData->fName)!=0){ - return FALSE; + return false; } - if(res1->fData->fPath == NULL|| res2->fData->fPath==NULL){ + if(res1->fData->fPath == nullptr|| res2->fData->fPath==nullptr){ return (res1->fData->fPath == res2->fData->fPath); }else{ if(uprv_strcmp(res1->fData->fPath, res2->fData->fPath)!=0){ - return FALSE; + return false; } } if(uprv_strcmp(res1->fData->fParent->fName, res2->fData->fParent->fName)!=0){ - return FALSE; + return false; } if(uprv_strcmp(res1->fData->fParent->fPath, res2->fData->fParent->fPath)!=0){ - return FALSE; + return false; } if(uprv_strncmp(res1->fResPath, res2->fResPath, res1->fResPathLen)!=0){ - return FALSE; + return false; } if(res1->fRes != res2->fRes){ - return FALSE; + return false; } - return TRUE; + return true; } -U_INTERNAL UResourceBundle* U_EXPORT2 +U_CAPI UResourceBundle* U_EXPORT2 ures_clone(const UResourceBundle* res, UErrorCode* status){ - UResourceBundle* bundle = NULL; - UResourceBundle* ret = NULL; - if(U_FAILURE(*status) || res == NULL){ - return NULL; + UResourceBundle* bundle = nullptr; + UResourceBundle* ret = nullptr; + if(U_FAILURE(*status) || res == nullptr){ + return nullptr; } bundle = ures_open(res->fData->fPath, res->fData->fName, status); - if(res->fResPath!=NULL){ - ret = ures_findSubResource(bundle, res->fResPath, NULL, status); + if(res->fResPath!=nullptr){ + ret = ures_findSubResource(bundle, res->fResPath, nullptr, status); ures_close(bundle); }else{ ret = bundle; } return ret; } -U_INTERNAL const UResourceBundle* U_EXPORT2 +U_CAPI const UResourceBundle* U_EXPORT2 ures_getParentBundle(const UResourceBundle* res){ - if(res==NULL){ - return NULL; + if(res==nullptr){ + return nullptr; } return res->fParentRes; } #endif -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 ures_getVersionByKey(const UResourceBundle* res, const char *key, UVersionInfo ver, UErrorCode *status) { - const UChar *str; + const char16_t *str; int32_t len; str = ures_getStringByKey(res, key, &len, status); if(U_SUCCESS(*status)) { u_versionFromUString(ver, str); - } + } } /* eof */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/uresdata.cpp b/src/duckdb/extension/icu/third_party/icu/common/uresdata.cpp index defb637c7..b219e40e2 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uresdata.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uresdata.cpp @@ -62,9 +62,9 @@ static const struct { static const struct { int32_t length; - UChar nul; - UChar pad; -} uresdata_gEmptyString={ 0, 0, 0 }; + char16_t nul; + char16_t pad; +} gEmptyString={ 0, 0, 0 }; /* * All the type-access functions assume that @@ -136,7 +136,7 @@ _res_findTable32Item(const ResourceData *pResData, const int32_t *keyOffsets, in /* helper for res_load() ---------------------------------------------------- */ static UBool U_CALLCONV -uresdata_isAcceptable(void *context, +isAcceptable(void *context, const char * /*type*/, const char * /*name*/, const UDataInfo *pInfo) { uprv_memcpy(context, pInfo->formatVersion, 4); @@ -234,7 +234,7 @@ res_init(ResourceData *pResData, * formatVersion 1: compare key strings in native-charset order * formatVersion 2 and up: compare key strings in ASCII order */ - pResData->useNativeStrcmp=TRUE; + pResData->useNativeStrcmp=true; } } @@ -248,7 +248,7 @@ res_read(ResourceData *pResData, if(U_FAILURE(*errorCode)) { return; } - if(!uresdata_isAcceptable(formatVersion, NULL, NULL, pInfo)) { + if(!isAcceptable(formatVersion, nullptr, nullptr, pInfo)) { *errorCode=U_INVALID_FORMAT_ERROR; return; } @@ -263,7 +263,7 @@ res_load(ResourceData *pResData, uprv_memset(pResData, 0, sizeof(ResourceData)); /* load the ResourceBundle file */ - pResData->data=udata_openChoice(path, "res", name, uresdata_isAcceptable, formatVersion, errorCode); + pResData->data=udata_openChoice(path, "res", name, isAcceptable, formatVersion, errorCode); if(U_FAILURE(*errorCode)) { return; } @@ -274,9 +274,9 @@ res_load(ResourceData *pResData, U_CFUNC void res_unload(ResourceData *pResData) { - if(pResData->data!=NULL) { + if(pResData->data!=nullptr) { udata_close(pResData->data); - pResData->data=NULL; + pResData->data=nullptr; } } @@ -307,17 +307,17 @@ res_getPublicType(Resource res) { return (UResType)gPublicTypes[RES_GET_TYPE(res)]; } -U_CAPI const UChar * U_EXPORT2 +U_CAPI const char16_t * U_EXPORT2 res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) { - const UChar *p; + const char16_t *p; uint32_t offset=RES_GET_OFFSET(res); int32_t length; if(RES_GET_TYPE(res)==URES_STRING_V2) { int32_t first; if((int32_t)offsetpoolStringIndexLimit) { - p=(const UChar *)pResData->poolBundleStrings+offset; + p=(const char16_t *)pResData->poolBundleStrings+offset; } else { - p=(const UChar *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit); + p=(const char16_t *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit); } first=*p; if(!U16_IS_TRAIL(first)) { @@ -333,11 +333,11 @@ res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLengt p+=3; } } else if(res==offset) /* RES_GET_TYPE(res)==URES_STRING */ { - const int32_t *p32= res==0 ? &uresdata_gEmptyString.length : pResData->pRoot+res; + const int32_t *p32= res==0 ? &gEmptyString.length : pResData->pRoot+res; length=*p32++; - p=(const UChar *)p32; + p=(const char16_t *)p32; } else { - p=NULL; + p=nullptr; length=0; } if(pLength) { @@ -361,14 +361,14 @@ UBool isNoInheritanceMarker(const ResourceData *pResData, Resource res) { } else if (res == offset) { const int32_t *p32=pResData->pRoot+res; int32_t length=*p32; - const UChar *p=(const UChar *)p32; + const char16_t *p=(const char16_t *)p32; return length == 3 && p[2] == 0x2205 && p[3] == 0x2205 && p[4] == 0x2205; } else if (RES_GET_TYPE(res) == URES_STRING_V2) { - const UChar *p; + const char16_t *p; if((int32_t)offsetpoolStringIndexLimit) { - p=(const UChar *)pResData->poolBundleStrings+offset; + p=(const char16_t *)pResData->poolBundleStrings+offset; } else { - p=(const UChar *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit); + p=(const char16_t *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit); } int32_t first=*p; if (first == 0x2205) { // implicit length @@ -377,10 +377,10 @@ UBool isNoInheritanceMarker(const ResourceData *pResData, Resource res) { return p[1] == 0x2205 && p[2] == 0x2205 && p[3] == 0x2205; } else { // Assume that the string has not been stored with more length units than necessary. - return FALSE; + return false; } } - return FALSE; + return false; } int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &array, @@ -389,7 +389,7 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a if(U_FAILURE(errorCode)) { return 0; } - if(dest == NULL ? capacity != 0 : capacity < 0) { + if(dest == nullptr ? capacity != 0 : capacity < 0) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -404,29 +404,29 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a for(int32_t i = 0; i < length; ++i) { int32_t sLength; // No tracing: handled by the caller - const UChar *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength); - if(s == NULL) { + const char16_t *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength); + if(s == nullptr) { errorCode = U_RESOURCE_TYPE_MISMATCH; return 0; } - dest[i].setTo(TRUE, s, sLength); + dest[i].setTo(true, s, sLength); } return length; } } // namespace -U_CAPI const UChar * U_EXPORT2 +U_CAPI const char16_t * U_EXPORT2 res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength) { - const UChar *p; + const char16_t *p; uint32_t offset=RES_GET_OFFSET(res); int32_t length; if(RES_GET_TYPE(res)==URES_ALIAS) { - const int32_t *p32= offset==0 ? &uresdata_gEmptyString.length : pResData->pRoot+offset; + const int32_t *p32= offset==0 ? &gEmptyString.length : pResData->pRoot+offset; length=*p32++; - p=(const UChar *)p32; + p=(const char16_t *)p32; } else { - p=NULL; + p=nullptr; length=0; } if(pLength) { @@ -445,7 +445,7 @@ res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLengt length=*p32++; p=(const uint8_t *)p32; } else { - p=NULL; + p=nullptr; length=0; } if(pLength) { @@ -464,7 +464,7 @@ res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLe p= offset==0 ? (const int32_t *)&gEmpty32 : pResData->pRoot+offset; length=*p++; } else { - p=NULL; + p=nullptr; length=0; } if(pLength) { @@ -505,23 +505,23 @@ UResType ResourceDataValue::getType() const { return res_getPublicType(res); } -const UChar *ResourceDataValue::getString(int32_t &length, UErrorCode &errorCode) const { +const char16_t *ResourceDataValue::getString(int32_t &length, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } - const UChar *s = res_getString(fTraceInfo, &getData(), res, &length); - if(s == NULL) { + const char16_t *s = res_getString(fTraceInfo, &getData(), res, &length); + if(s == nullptr) { errorCode = U_RESOURCE_TYPE_MISMATCH; } return s; } -const UChar *ResourceDataValue::getAliasString(int32_t &length, UErrorCode &errorCode) const { +const char16_t *ResourceDataValue::getAliasString(int32_t &length, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } - const UChar *s = res_getAlias(&getData(), res, &length); - if(s == NULL) { + const char16_t *s = res_getAlias(&getData(), res, &length); + if(s == nullptr) { errorCode = U_RESOURCE_TYPE_MISMATCH; } return s; @@ -549,10 +549,10 @@ uint32_t ResourceDataValue::getUInt(UErrorCode &errorCode) const { const int32_t *ResourceDataValue::getIntVector(int32_t &length, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } const int32_t *iv = res_getIntVector(fTraceInfo, &getData(), res, &length); - if(iv == NULL) { + if(iv == nullptr) { errorCode = U_RESOURCE_TYPE_MISMATCH; } return iv; @@ -560,10 +560,10 @@ const int32_t *ResourceDataValue::getIntVector(int32_t &length, UErrorCode &erro const uint8_t *ResourceDataValue::getBinary(int32_t &length, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } const uint8_t *b = res_getBinary(fTraceInfo, &getData(), res, &length); - if(b == NULL) { + if(b == nullptr) { errorCode = U_RESOURCE_TYPE_MISMATCH; } return b; @@ -573,8 +573,8 @@ ResourceArray ResourceDataValue::getArray(UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return ResourceArray(); } - const uint16_t *items16 = NULL; - const Resource *items32 = NULL; + const uint16_t *items16 = nullptr; + const Resource *items32 = nullptr; uint32_t offset=RES_GET_OFFSET(res); int32_t length = 0; switch(RES_GET_TYPE(res)) { @@ -599,10 +599,10 @@ ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return ResourceTable(); } - const uint16_t *keys16 = NULL; - const int32_t *keys32 = NULL; - const uint16_t *items16 = NULL; - const Resource *items32 = NULL; + const uint16_t *keys16 = nullptr; + const int32_t *keys32 = nullptr; + const uint16_t *items16 = nullptr; + const Resource *items32 = nullptr; uint32_t offset = RES_GET_OFFSET(res); int32_t length = 0; switch(RES_GET_TYPE(res)) { @@ -649,7 +649,7 @@ int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, in if(U_FAILURE(errorCode)) { return 0; } - if(dest == NULL ? capacity != 0 : capacity < 0) { + if(dest == nullptr ? capacity != 0 : capacity < 0) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -658,9 +658,9 @@ int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, in return 1; } int32_t sLength; - const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength); - if(s != NULL) { - dest[0].setTo(TRUE, s, sLength); + const char16_t *s = res_getString(fTraceInfo, &getData(), res, &sLength); + if(s != nullptr) { + dest[0].setTo(true, s, sLength); return 1; } errorCode = U_RESOURCE_TYPE_MISMATCH; @@ -673,9 +673,9 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode) return us; } int32_t sLength; - const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength); - if(s != NULL) { - us.setTo(TRUE, s, sLength); + const char16_t *s = res_getString(fTraceInfo, &getData(), res, &sLength); + if(s != nullptr) { + us.setTo(true, s, sLength); return us; } ResourceArray array = getArray(errorCode); @@ -685,8 +685,8 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode) if(array.getSize() > 0) { // Tracing is already performed above (unimportant for trace that this is an array) s = res_getStringNoTrace(&getData(), array.internalGetResource(&getData(), 0), &sLength); - if(s != NULL) { - us.setTo(TRUE, s, sLength); + if(s != nullptr) { + us.setTo(true, s, sLength); return us; } } @@ -714,7 +714,7 @@ res_getTableItemByKey(const ResourceData *pResData, Resource table, uint32_t offset=RES_GET_OFFSET(table); int32_t length; int32_t idx; - if(key == NULL || *key == NULL) { + if(key == nullptr || *key == nullptr) { return RES_BOGUS; } switch(RES_GET_TYPE(table)) { @@ -771,7 +771,7 @@ res_getTableItemByIndex(const ResourceData *pResData, Resource table, length=*p++; if(indexRp16BitUnits+offset; length=*p++; if(indexRpRoot+offset; length=*p++; if(indexR= 0 && *closeIndex == 0) { - /* if we indeed have an index, try to get the item by index */ - t2 = res_getTableItemByIndex(pResData, t1, indexR, key); - } // else t2 is already RES_BOGUS - } } else if(URES_IS_ARRAY(type)) { indexR = uprv_strtol(pathP, &closeIndex, 10); if(indexR >= 0 && *closeIndex == 0) { @@ -975,7 +967,7 @@ res_findResource(const ResourceData *pResData, Resource r, char** path, const ch } else { t2 = RES_BOGUS; /* have an array, but don't have a valid index */ } - *key = NULL; + *key = nullptr; } else { /* can't do much here, except setting t2 to bogus */ t2 = RES_BOGUS; } @@ -1049,7 +1041,7 @@ enum { static const char *const gUnknownKey=""; /* resource table key for collation binaries: "%%CollationBin" */ -static const UChar gCollationBinKey[]={ +static const char16_t gCollationBinKey[]={ 0x25, 0x25, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x69, 0x6e, @@ -1106,7 +1098,7 @@ ures_swapResource(const UDataSwapper *ds, count=udata_readInt32(ds, (int32_t)*p); /* swap length */ ds->swapArray32(ds, p, 4, q, pErrorCode); - /* swap each UChar (the terminating NUL would not change) */ + /* swap each char16_t (the terminating NUL would not change) */ ds->swapArray16(ds, p+1, 2*count, q+1, pErrorCode); break; case URES_BINARY: @@ -1117,7 +1109,7 @@ ures_swapResource(const UDataSwapper *ds, /* swap known formats */ #if !UCONFIG_NO_COLLATION - if( key!=NULL && /* the binary is in a table */ + if( key!=nullptr && /* the binary is in a table */ (key!=gUnknownKey ? /* its table key string is "%%CollationBin" */ 0==ds->compareInvChars(ds, key, -1, @@ -1147,7 +1139,7 @@ ures_swapResource(const UDataSwapper *ds, qKey16=(uint16_t *)q; count=ds->readUInt16(*pKey16); - pKey32=qKey32=NULL; + pKey32=qKey32=nullptr; /* swap count */ ds->swapArray16(ds, pKey16++, 2, qKey16++, pErrorCode); @@ -1159,7 +1151,7 @@ ures_swapResource(const UDataSwapper *ds, qKey32=(int32_t *)q; count=udata_readInt32(ds, *pKey32); - pKey16=qKey16=NULL; + pKey16=qKey16=nullptr; /* swap count */ ds->swapArray32(ds, pKey32++, 4, qKey32++, pErrorCode); @@ -1177,7 +1169,7 @@ ures_swapResource(const UDataSwapper *ds, /* recurse */ for(i=0; ireadUInt16(pKey16[i]); if(keyOffsetlocalKeyLimit) { itemKey=(const char *)outBundle+keyOffset; @@ -1199,7 +1191,7 @@ ures_swapResource(const UDataSwapper *ds, if(pTempTable->majorFormatVersion>1 || ds->inCharset==ds->outCharset) { /* no need to sort, just swap the offset/value arrays */ - if(pKey16!=NULL) { + if(pKey16!=nullptr) { ds->swapArray16(ds, pKey16, count*2, qKey16, pErrorCode); ds->swapArray32(ds, p, count*4, q, pErrorCode); } else { @@ -1217,7 +1209,7 @@ ures_swapResource(const UDataSwapper *ds, * sorting indexes and sort that. * Then we permutate and copy/swap the actual values. */ - if(pKey16!=NULL) { + if(pKey16!=nullptr) { for(i=0; irows[i].keyIndex=ds->readUInt16(pKey16[i]); pTempTable->rows[i].sortIndex=i; @@ -1230,7 +1222,7 @@ ures_swapResource(const UDataSwapper *ds, } uprv_sortArray(pTempTable->rows, count, sizeof(Row), ures_compareRows, pTempTable->keyChars, - FALSE, pErrorCode); + false, pErrorCode); if(U_FAILURE(*pErrorCode)) { udata_printError(ds, "ures_swapResource(table res=%08x).uprv_sortArray(%d items) failed\n", res, count); @@ -1245,7 +1237,7 @@ ures_swapResource(const UDataSwapper *ds, * before the results are copied to the outBundle. */ /* keys */ - if(pKey16!=NULL) { + if(pKey16!=nullptr) { uint16_t *rKey16; if(pKey16!=qKey16) { @@ -1309,7 +1301,7 @@ ures_swapResource(const UDataSwapper *ds, /* recurse */ for(i=0; ireadUInt32(p[i]); - ures_swapResource(ds, inBundle, outBundle, item, NULL, pTempTable, pErrorCode); + ures_swapResource(ds, inBundle, outBundle, item, nullptr, pTempTable, pErrorCode); if(U_FAILURE(*pErrorCode)) { udata_printError(ds, "ures_swapResource(array res=%08x)[%d].recurse(%08x) failed\n", res, i, item); @@ -1353,7 +1345,7 @@ ures_swap(const UDataSwapper *ds, /* udata_swapDataHeader checks the arguments */ headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode); - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } @@ -1447,7 +1439,7 @@ ures_swap(const UDataSwapper *ds, tempTable.resFlags=stackResFlags; } else { tempTable.resFlags=(uint32_t *)uprv_malloc(resFlagsLength); - if(tempTable.resFlags==NULL) { + if(tempTable.resFlags==nullptr) { udata_printError(ds, "ures_swap(): unable to allocate memory for tracking resources\n"); *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return 0; @@ -1484,7 +1476,7 @@ ures_swap(const UDataSwapper *ds, tempTable.resort=resort; } else { tempTable.rows=(Row *)uprv_malloc(maxTableLength*sizeof(Row)+maxTableLength*4); - if(tempTable.rows==NULL) { + if(tempTable.rows==nullptr) { udata_printError(ds, "ures_swap(): unable to allocate memory for sorting tables (max length: %d)\n", maxTableLength); *pErrorCode=U_MEMORY_ALLOCATION_ERROR; @@ -1497,7 +1489,7 @@ ures_swap(const UDataSwapper *ds, } /* swap the resources */ - ures_swapResource(ds, inBundle, outBundle, rootRes, NULL, &tempTable, pErrorCode); + ures_swapResource(ds, inBundle, outBundle, rootRes, nullptr, &tempTable, pErrorCode); if(U_FAILURE(*pErrorCode)) { udata_printError(ds, "ures_swapResource(root res=%08x) failed\n", rootRes); diff --git a/src/duckdb/extension/icu/third_party/icu/common/uresdata.h b/src/duckdb/extension/icu/third_party/icu/common/uresdata.h index d1b67babf..171189051 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uresdata.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uresdata.h @@ -399,10 +399,12 @@ typedef struct ResourceData { UBool useNativeStrcmp; } ResourceData; +struct UResourceDataEntry; // forward declared for ResoureDataValue below; actually defined in uresimp.h + /* * Read a resource bundle from memory. */ -U_INTERNAL void U_EXPORT2 +U_CAPI void U_EXPORT2 res_read(ResourceData *pResData, const UDataInfo *pInfo, const void *inBytes, int32_t length, UErrorCode *errorCode); @@ -422,7 +424,7 @@ res_load(ResourceData *pResData, U_CFUNC void res_unload(ResourceData *pResData); -U_INTERNAL UResType U_EXPORT2 +U_CAPI UResType U_EXPORT2 res_getPublicType(Resource res); /////////////////////////////////////////////////////////////////////////// @@ -434,31 +436,31 @@ res_getPublicType(Resource res); * and set its length in *pLength. * Returns NULL if not found. */ -U_INTERNAL const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL const uint8_t * U_EXPORT2 +U_CAPI const uint8_t * U_EXPORT2 res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL const int32_t * U_EXPORT2 +U_CAPI const int32_t * U_EXPORT2 res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL const UChar * U_EXPORT2 +U_CAPI const UChar * U_EXPORT2 res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getResource(const ResourceData *pResData, const char *key); -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 res_countArrayItems(const ResourceData *pResData, Resource res); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getArrayItem(const ResourceData *pResData, Resource array, int32_t indexS); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getTableItemByIndex(const ResourceData *pResData, Resource table, int32_t indexS, const char ** key); -U_INTERNAL Resource U_EXPORT2 +U_CAPI Resource U_EXPORT2 res_getTableItemByKey(const ResourceData *pResData, Resource table, int32_t *indexS, const char* * key); /** @@ -480,7 +482,7 @@ U_CFUNC Resource res_findResource(const ResourceData *pResData, Resource r, U_NAMESPACE_BEGIN -inline const UChar* res_getString(const ResourceTracer& traceInfo, +inline const char16_t* res_getString(const ResourceTracer& traceInfo, const ResourceData *pResData, Resource res, int32_t *pLength) { traceInfo.trace("string"); return res_getStringNoTrace(pResData, res, pLength); @@ -511,12 +513,18 @@ inline uint32_t res_getUInt(const ResourceTracer& traceInfo, Resource res) { class ResourceDataValue : public ResourceValue { public: ResourceDataValue() : + pResData(nullptr), + validLocaleDataEntry(nullptr), res(static_cast(URES_NONE)), fTraceInfo() {} virtual ~ResourceDataValue(); - void setData(const ResourceData *data) { - resData = *data; + void setData(const ResourceData &data) { + pResData = &data; + } + + void setValidLocaleDataEntry(UResourceDataEntry *entry) { + validLocaleDataEntry = entry; } void setResource(Resource r, ResourceTracer&& traceInfo) { @@ -524,27 +532,28 @@ class ResourceDataValue : public ResourceValue { fTraceInfo = traceInfo; } - const ResourceData &getData() const { return resData; } - virtual UResType getType() const; - virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const; - virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const; - virtual int32_t getInt(UErrorCode &errorCode) const; - virtual uint32_t getUInt(UErrorCode &errorCode) const; - virtual const int32_t *getIntVector(int32_t &length, UErrorCode &errorCode) const; - virtual const uint8_t *getBinary(int32_t &length, UErrorCode &errorCode) const; - virtual ResourceArray getArray(UErrorCode &errorCode) const; - virtual ResourceTable getTable(UErrorCode &errorCode) const; - virtual UBool isNoInheritanceMarker() const; + const ResourceData &getData() const { return *pResData; } + UResourceDataEntry *getValidLocaleDataEntry() const { return validLocaleDataEntry; } + Resource getResource() const { return res; } + virtual UResType getType() const override; + virtual const char16_t *getString(int32_t &length, UErrorCode &errorCode) const override; + virtual const char16_t *getAliasString(int32_t &length, UErrorCode &errorCode) const override; + virtual int32_t getInt(UErrorCode &errorCode) const override; + virtual uint32_t getUInt(UErrorCode &errorCode) const override; + virtual const int32_t *getIntVector(int32_t &length, UErrorCode &errorCode) const override; + virtual const uint8_t *getBinary(int32_t &length, UErrorCode &errorCode) const override; + virtual ResourceArray getArray(UErrorCode &errorCode) const override; + virtual ResourceTable getTable(UErrorCode &errorCode) const override; + virtual UBool isNoInheritanceMarker() const override; virtual int32_t getStringArray(UnicodeString *dest, int32_t capacity, - UErrorCode &errorCode) const; + UErrorCode &errorCode) const override; virtual int32_t getStringArrayOrStringAsArray(UnicodeString *dest, int32_t capacity, - UErrorCode &errorCode) const; - virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const; + UErrorCode &errorCode) const override; + virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const override; private: - // TODO(ICU-20769): If UResourceBundle.fResData becomes a pointer, - // then remove this value field again and just store a pResData pointer. - ResourceData resData; + const ResourceData *pResData; + UResourceDataEntry *validLocaleDataEntry; Resource res; ResourceTracer fTraceInfo; }; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uresimp.h b/src/duckdb/extension/icu/third_party/icu/common/uresimp.h index 381a0dbe8..8a1679717 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uresimp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uresimp.h @@ -31,7 +31,6 @@ #define MAGIC2 19641227 #define URES_MAX_ALIAS_LEVEL 256 -#define URES_MAX_BUFFER_SIZE 256 #define EMPTY_SET 0x2205 @@ -61,16 +60,27 @@ struct UResourceDataEntry { #define RES_PATH_SEPARATOR '/' #define RES_PATH_SEPARATOR_S "/" +U_CAPI void U_EXPORT2 ures_initStackObject(UResourceBundle* resB); + +#ifdef __cplusplus + struct UResourceBundle { const char *fKey; /*tag*/ + /** + * The dataEntry for the actual locale in which this item lives. + * Used for accessing the item's data. + * Non-const pointer for reference counting via entryIncrease(). + */ UResourceDataEntry *fData; /*for low-level access*/ char *fVersion; - UResourceDataEntry *fTopLevelData; /* for getting the valid locale */ + /** + * The dataEntry for the valid locale. + * Used for /LOCALE/path alias resolution that starts back from the valid locale, + * rather than from the actual locale of this item which might live in + * an ancestor bundle. + */ + UResourceDataEntry *fValidLocaleDataEntry; char *fResPath; /* full path to the resource: "zh_TW/CollationElements/Sequence" */ - // TODO(ICU-20769): Try to change the by-value fResData into a pointer, - // with the struct in only one place for each bundle. - // Also replace class ResourceDataValue.resData with a pResData pointer again. - ResourceData fResData; char fResBuf[RES_BUFSIZE]; int32_t fResPathLen; Resource fRes; @@ -81,13 +91,9 @@ struct UResourceBundle { int32_t fIndex; int32_t fSize; - /*const UResourceBundle *fParentRes;*/ /* needed to get the actual locale for a child resource */ + inline const ResourceData &getResData() const { return fData->fData; } }; -U_CAPI void U_EXPORT2 ures_initStackObject(UResourceBundle* resB); - -#ifdef __cplusplus - U_NAMESPACE_BEGIN /** @@ -112,10 +118,10 @@ U_NAMESPACE_BEGIN class U_COMMON_API StackUResourceBundle { public: // No heap allocation. Use only on the stack. - static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete; - static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t) noexcept = delete; + static void* U_EXPORT2 operator new[](size_t) noexcept = delete; #if U_HAVE_PLACEMENT_NEW - static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; #endif StackUResourceBundle(); @@ -157,13 +163,10 @@ U_CFUNC const char* ures_getName(const UResourceBundle* resB); U_CFUNC const char* ures_getPath(const UResourceBundle* resB); /** * If anything was in the RB cache, dump it to the screen. - * @return TRUE if there was anything into the cache + * @return true if there was anything into the cache */ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void); #endif -/*U_CFUNC void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd);*/ -/*U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd);*/ -/*U_CFUNC void ures_freeResPath(UResourceBundle *resB);*/ /* Candidates for export */ U_CFUNC UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *original, UErrorCode *status); @@ -172,10 +175,10 @@ U_CFUNC UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle * Returns a resource that can be located using the pathToResource argument. One needs optional package, locale * and path inside the locale, for example: "/myData/en/zoneStrings/3". Keys and indexes are supported. Keys * need to reference data in named structures, while indexes can reference both named and anonymous resources. - * Features a fill-in parameter. - * + * Features a fill-in parameter. + * * Note, this function does NOT have a syntax for specifying items within a tree. May want to consider a - * syntax that delineates between package/tree and resource. + * syntax that delineates between package/tree and resource. * * @param pathToResource a path that will lead to the requested resource * @param fillIn if NULL a new UResourceBundle struct is allocated and must be deleted by the caller. @@ -184,16 +187,16 @@ U_CFUNC UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it */ U_CAPI UResourceBundle* U_EXPORT2 -ures_findResource(const char* pathToResource, - UResourceBundle *fillIn, UErrorCode *status); +ures_findResource(const char* pathToResource, + UResourceBundle *fillIn, UErrorCode *status); /** - * Returns a sub resource that can be located using the pathToResource argument. One needs a path inside + * Returns a sub resource that can be located using the pathToResource argument. One needs a path inside * the supplied resource, for example, if you have "en_US" resource bundle opened, you might ask for * "zoneStrings/3". Keys and indexes are supported. Keys - * need to reference data in named structures, while indexes can reference both + * need to reference data in named structures, while indexes can reference both * named and anonymous resources. - * Features a fill-in parameter. + * Features a fill-in parameter. * * @param resourceBundle a resource * @param pathToResource a path that will lead to the requested resource @@ -203,8 +206,8 @@ ures_findResource(const char* pathToResource, * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it */ U_CAPI UResourceBundle* U_EXPORT2 -ures_findSubResource(const UResourceBundle *resB, - char* pathToResource, +ures_findSubResource(const UResourceBundle *resB, + char* pathToResource, UResourceBundle *fillIn, UErrorCode *status); /** @@ -215,23 +218,23 @@ ures_findSubResource(const UResourceBundle *resB, * @param resName top level resource. Example: "collations" * @param keyword locale keyword. Example: "collation" * @param locid The requested locale - * @param isAvailable If non-null, pointer to fillin parameter that indicates whether the - * requested locale was available. The locale is defined as 'available' if it physically + * @param isAvailable If non-null, pointer to fillin parameter that indicates whether the + * requested locale was available. The locale is defined as 'available' if it physically * exists within the specified tree. - * @param omitDefault if TRUE, omit keyword and value if default. 'de_DE\@collation=standard' -> 'de_DE' + * @param omitDefault if true, omit keyword and value if default. 'de_DE\@collation=standard' -> 'de_DE' * @param status error code - * @return the actual buffer size needed for the full locale. If it's greater + * @return the actual buffer size needed for the full locale. If it's greater * than resultCapacity, the returned full name will be truncated and an error code will be returned. */ U_CAPI int32_t U_EXPORT2 -ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, +ures_getFunctionalEquivalent(char *result, int32_t resultCapacity, const char *path, const char *resName, const char *keyword, const char *locid, UBool *isAvailable, UBool omitDefault, UErrorCode *status); /** * Given a tree path and keyword, return a string enumeration of all possible values for that keyword. * @param path path to the tree, or NULL for ICU data - * @param keyword a particular keyword to consider, must match a top level resource name + * @param keyword a particular keyword to consider, must match a top level resource name * within the tree. * @param status error code */ @@ -251,17 +254,16 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status) * Alternatively, you can supply a struct to be filled by this function. * @param status: fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found - * could be a non-failing error + * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it */ -U_CAPI UResourceBundle* U_EXPORT2 -ures_getByKeyWithFallback(const UResourceBundle *resB, - const char* inKey, - UResourceBundle *fillIn, +U_CAPI UResourceBundle* U_EXPORT2 +ures_getByKeyWithFallback(const UResourceBundle *resB, + const char* inKey, + UResourceBundle *fillIn, UErrorCode *status); - /** * Get a String with multi-level fallback. Normally only the top level resources will * fallback to its parent. This performs fallback on subresources. For example, when a table @@ -270,15 +272,17 @@ ures_getByKeyWithFallback(const UResourceBundle *resB, * function can perform fallback on the sub-resources of the table. * @param resB a resource * @param inKey a key associated with the requested resource + * @param len if not NULL, used to return the length of the string * @param status: fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found - * could be a non-failing error + * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING - * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it + * @return returns a pointer to a zero-terminated UChar array which lives in a + * memory mapped/DLL file. */ -U_CAPI const UChar* U_EXPORT2 -ures_getStringByKeyWithFallback(const UResourceBundle *resB, - const char* inKey, +U_CAPI const UChar* U_EXPORT2 +ures_getStringByKeyWithFallback(const UResourceBundle *resB, + const char* inKey, int32_t* len, UErrorCode *status); @@ -289,10 +293,39 @@ ures_getValueWithFallback(const UResourceBundle *bundle, const char *path, UResourceBundle *tempFillIn, icu::ResourceDataValue &value, UErrorCode &errorCode); +/** + * Locates the resource specified by `path` in the resource bundle specified by `bundle` (performing any + * necessary fallback and following any aliases) and calls the specified `sink`'s `put()` method with that + * resource. Then walks the bundle's parent chain, calling `put()` on the sink for each item in the + * parent chain. + * @param bundle The bundle to search + * @param path The path of the desired resource + * @param sink A `ResourceSink` that gets called for each resource in the parent chain + * @param errorCode The error code + */ U_CAPI void U_EXPORT2 ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path, icu::ResourceSink &sink, UErrorCode &errorCode); +/** + * Locates the resource specified by `path` in the resource bundle specified by `bundle` (performing any + * necessary fallback and following any aliases) and, if the resource is a table resource, iterates over its + * immediate child resources (again, following any aliases to get the individual resource values), and calls the specified + * `sink`'s `put()` method for each child resource (passing it that resource's key and either its actual value or, + * if that value is an alias, the value you get by following the alias). Then walks back over the bundle's + * parent chain, similarly iterating over each parent table resource's child resources. + * Does not descend beyond one level of table children. + * @param bundle The bundle to search + * @param path The path of the desired resource + * @param sink A `ResourceSink` that gets called for each child resource of the specified resource (and each child + * of the resources in its parent chain). + * @param errorCode The error code. This will be U_RESOURCE_TYPE_MISMATCH if the resource the caller + * is asking for isn't a table resource. + */ +U_CAPI void U_EXPORT2 +ures_getAllChildrenWithFallback(const UResourceBundle *bundle, const char *path, + icu::ResourceSink &sink, UErrorCode &errorCode); + #endif /* __cplusplus */ /** @@ -318,13 +351,13 @@ ures_getVersionByKey(const UResourceBundle *resB, * The caller does not own this string. * @see ures_getVersion */ -U_CAPI const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 ures_getVersionNumberInternal(const UResourceBundle *resourceBundle); /** * Return the name of the Locale associated with this ResourceBundle. This API allows - * you to query for the real locale of the resource. For example, if you requested - * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. + * you to query for the real locale of the resource. For example, if you requested + * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. * For subresources, the locale where this resource comes from will be returned. * If fallback has occurred, getLocale will reflect this. * @@ -334,13 +367,13 @@ ures_getVersionNumberInternal(const UResourceBundle *resourceBundle); * @param status just for catching illegal arguments * @return A Locale name */ -U_CAPI const char* U_EXPORT2 -ures_getLocaleInternal(const UResourceBundle* resourceBundle, +U_CAPI const char* U_EXPORT2 +ures_getLocaleInternal(const UResourceBundle* resourceBundle, UErrorCode* status); /** * Same as ures_openDirect() but uses the fill-in parameter instead of allocating a new bundle. - * + * * @param r The existing UResourceBundle to fill in. If NULL then status will be * set to U_ILLEGAL_ARGUMENT_ERROR. * @param packageName The packageName and locale together point to an ICU udata object, diff --git a/src/duckdb/extension/icu/third_party/icu/common/usc_impl.cpp b/src/duckdb/extension/icu/third_party/icu/common/usc_impl.cpp index 111029b97..cd5a4e5b8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/usc_impl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/usc_impl.cpp @@ -41,7 +41,7 @@ struct ParenStackEntry struct UScriptRun { int32_t textLength; - const UChar *textArray; + const char16_t *textArray; int32_t scriptStart; int32_t scriptLimit; @@ -189,19 +189,19 @@ sameScript(UScriptCode scriptOne, UScriptCode scriptTwo) } U_CAPI UScriptRun * U_EXPORT2 -uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode) +uscript_openRun(const char16_t *src, int32_t length, UErrorCode *pErrorCode) { - UScriptRun *result = NULL; + UScriptRun *result = nullptr; - if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) { - return NULL; + if (pErrorCode == nullptr || U_FAILURE(*pErrorCode)) { + return nullptr; } result = (UScriptRun *)uprv_malloc(sizeof (UScriptRun)); - if (result == NULL) { + if (result == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uscript_setRunText(result, src, length, pErrorCode); @@ -209,7 +209,7 @@ uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode) /* Release the UScriptRun if uscript_setRunText() returns an error */ if (U_FAILURE(*pErrorCode)) { uprv_free(result); - result = NULL; + result = nullptr; } return result; @@ -218,7 +218,7 @@ uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode) U_CAPI void U_EXPORT2 uscript_closeRun(UScriptRun *scriptRun) { - if (scriptRun != NULL) { + if (scriptRun != nullptr) { uprv_free(scriptRun); } } @@ -226,7 +226,7 @@ uscript_closeRun(UScriptRun *scriptRun) U_CAPI void U_EXPORT2 uscript_resetRun(UScriptRun *scriptRun) { - if (scriptRun != NULL) { + if (scriptRun != nullptr) { scriptRun->scriptStart = 0; scriptRun->scriptLimit = 0; scriptRun->scriptCode = USCRIPT_INVALID_CODE; @@ -237,13 +237,13 @@ uscript_resetRun(UScriptRun *scriptRun) } U_CAPI void U_EXPORT2 -uscript_setRunText(UScriptRun *scriptRun, const UChar *src, int32_t length, UErrorCode *pErrorCode) +uscript_setRunText(UScriptRun *scriptRun, const char16_t *src, int32_t length, UErrorCode *pErrorCode) { - if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) { + if (pErrorCode == nullptr || U_FAILURE(*pErrorCode)) { return; } - if (scriptRun == NULL || length < 0 || ((src == NULL) != (length == 0))) { + if (scriptRun == nullptr || length < 0 || ((src == nullptr) != (length == 0))) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -260,16 +260,16 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U UErrorCode error = U_ZERO_ERROR; /* if we've fallen off the end of the text, we're done */ - if (scriptRun == NULL || scriptRun->scriptLimit >= scriptRun->textLength) { - return FALSE; + if (scriptRun == nullptr || scriptRun->scriptLimit >= scriptRun->textLength) { + return false; } SYNC_FIXUP(scriptRun); scriptRun->scriptCode = USCRIPT_COMMON; for (scriptRun->scriptStart = scriptRun->scriptLimit; scriptRun->scriptLimit < scriptRun->textLength; scriptRun->scriptLimit += 1) { - UChar high = scriptRun->textArray[scriptRun->scriptLimit]; - UChar32 ch = high; + char16_t high = scriptRun->textArray[scriptRun->scriptLimit]; + UChar32 ch = high; UScriptCode sc; int32_t pairIndex; @@ -278,7 +278,7 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U * in the text, see if it's followed by a low surrogate */ if (high >= 0xD800 && high <= 0xDBFF && scriptRun->scriptLimit < scriptRun->textLength - 1) { - UChar low = scriptRun->textArray[scriptRun->scriptLimit + 1]; + char16_t low = scriptRun->textArray[scriptRun->scriptLimit + 1]; /* * if it is followed by a low surrogate, @@ -345,17 +345,17 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U } - if (pRunStart != NULL) { + if (pRunStart != nullptr) { *pRunStart = scriptRun->scriptStart; } - if (pRunLimit != NULL) { + if (pRunLimit != nullptr) { *pRunLimit = scriptRun->scriptLimit; } - if (pRunScript != NULL) { + if (pRunScript != nullptr) { *pRunScript = scriptRun->scriptCode; } - return TRUE; + return true; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/usc_impl.h b/src/duckdb/extension/icu/third_party/icu/common/usc_impl.h index 44899649d..cd7699050 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/usc_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/common/usc_impl.h @@ -33,7 +33,7 @@ * * Scripts are chosen based on the UScriptCode enumeration. * No attempt is made to combine related scripts into a single run. In - * particular, Hiragana, Katakana, and Han characters will appear in seperate + * particular, Hiragana, Katakana, and Han characters will appear in separate * runs. * Here is an example of how to iterate over script runs: diff --git a/src/duckdb/extension/icu/third_party/icu/common/uscript.cpp b/src/duckdb/extension/icu/third_party/icu/common/uscript.cpp index 98528c158..3cc2b6675 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uscript.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uscript.cpp @@ -58,8 +58,8 @@ static int32_t getCodesFromLocale(const char *locale, UScriptCode *scripts, int32_t capacity, UErrorCode *err) { UErrorCode internalErrorCode = U_ZERO_ERROR; - char lang[8]; - char script[8]; + char lang[8] = {0}; + char script[8] = {0}; int32_t scriptLength; if(U_FAILURE(*err)) { return 0; } // Multi-script languages, equivalent to the LocaleScript data @@ -107,20 +107,33 @@ uscript_getCode(const char* nameOrAbbrOrLocale, if(U_FAILURE(*err)) { return 0; } - if(nameOrAbbrOrLocale==NULL || - (fillIn == NULL ? capacity != 0 : capacity < 0)) { + if(nameOrAbbrOrLocale==nullptr || + (fillIn == nullptr ? capacity != 0 : capacity < 0)) { *err = U_ILLEGAL_ARGUMENT_ERROR; return 0; } - triedCode = FALSE; - if(uprv_strchr(nameOrAbbrOrLocale, '-')==NULL && uprv_strchr(nameOrAbbrOrLocale, '_')==NULL ){ + triedCode = false; + const char* lastSepPtr = uprv_strrchr(nameOrAbbrOrLocale, '-'); + if (lastSepPtr==nullptr) { + lastSepPtr = uprv_strrchr(nameOrAbbrOrLocale, '_'); + } + // Favor interpretation of nameOrAbbrOrLocale as a script alias if either + // 1. nameOrAbbrOrLocale does not contain -/_. Handles Han, Mro, Nko, etc. + // 2. The last instance of -/_ is at offset 3, and the portion after that is + // longer than 4 characters (i.e. not a script or region code). This handles + // Old_Hungarian, Old_Italic, etc. ("old" is a valid language code) + // 3. The last instance of -/_ is at offset 7, and the portion after that is + // 3 characters. This handles New_Tai_Lue ("new" is a valid language code). + if (lastSepPtr==nullptr + || (lastSepPtr-nameOrAbbrOrLocale == 3 && uprv_strlen(nameOrAbbrOrLocale) > 8) + || (lastSepPtr-nameOrAbbrOrLocale == 7 && uprv_strlen(nameOrAbbrOrLocale) == 11) ) { /* try long and abbreviated script names first */ UScriptCode code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, nameOrAbbrOrLocale); if(code!=USCRIPT_INVALID_CODE) { return setOneCode(code, fillIn, capacity, err); } - triedCode = TRUE; + triedCode = true; } internalErrorCode = U_ZERO_ERROR; length = getCodesFromLocale(nameOrAbbrOrLocale, fillIn, capacity, err); diff --git a/src/duckdb/extension/icu/third_party/icu/common/uscript_props.cpp b/src/duckdb/extension/icu/third_party/icu/common/uscript_props.cpp index 5d3848273..b26164408 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uscript_props.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uscript_props.cpp @@ -30,219 +30,226 @@ namespace { // Bits 20.. 0: sample character // Bits 23..21: usage -const int32_t up_UNKNOWN = 1 << 21; -const int32_t up_EXCLUSION = 2 << 21; -const int32_t up_LIMITED_USE = 3 << 21; +const int32_t UNKNOWN = 1 << 21; +const int32_t EXCLUSION = 2 << 21; +const int32_t LIMITED_USE = 3 << 21; // st int32_t ASPIRATIONAL = 4 << 21; -- not used any more since Unicode 10 -const int32_t up_RECOMMENDED = 5 << 21; +const int32_t RECOMMENDED = 5 << 21; // Bits 31..24: Single-bit flags -const int32_t up_RTL = 1 << 24; -const int32_t up_LB_LETTERS = 1 << 25; -const int32_t up_CASED = 1 << 26; +const int32_t RTL = 1 << 24; +const int32_t LB_LETTERS = 1 << 25; +const int32_t CASED = 1 << 26; -const int32_t up_SCRIPT_PROPS[] = { +const int32_t SCRIPT_PROPS[] = { // Begin copy-paste output from // tools/trunk/unicode/py/parsescriptmetadata.py - 0x0040 | up_RECOMMENDED, // Zyyy - 0x0308 | up_RECOMMENDED, // Zinh - 0x0628 | up_RECOMMENDED | up_RTL, // Arab - 0x0531 | up_RECOMMENDED | up_CASED, // Armn - 0x0995 | up_RECOMMENDED, // Beng - 0x3105 | up_RECOMMENDED | up_LB_LETTERS, // Bopo - 0x13C4 | up_LIMITED_USE | up_CASED, // Cher - 0x03E2 | up_EXCLUSION | up_CASED, // Copt - 0x042F | up_RECOMMENDED | up_CASED, // Cyrl - 0x10414 | up_EXCLUSION | up_CASED, // Dsrt - 0x0905 | up_RECOMMENDED, // Deva - 0x12A0 | up_RECOMMENDED, // Ethi - 0x10D3 | up_RECOMMENDED, // Geor - 0x10330 | up_EXCLUSION, // Goth - 0x03A9 | up_RECOMMENDED | up_CASED, // Grek - 0x0A95 | up_RECOMMENDED, // Gujr - 0x0A15 | up_RECOMMENDED, // Guru - 0x5B57 | up_RECOMMENDED | up_LB_LETTERS, // Hani - 0xAC00 | up_RECOMMENDED, // Hang - 0x05D0 | up_RECOMMENDED | up_RTL, // Hebr - 0x304B | up_RECOMMENDED | up_LB_LETTERS, // Hira - 0x0C95 | up_RECOMMENDED, // Knda - 0x30AB | up_RECOMMENDED | up_LB_LETTERS, // Kana - 0x1780 | up_RECOMMENDED | up_LB_LETTERS, // Khmr - 0x0EA5 | up_RECOMMENDED | up_LB_LETTERS, // Laoo - 0x004C | up_RECOMMENDED | up_CASED, // Latn - 0x0D15 | up_RECOMMENDED, // Mlym - 0x1826 | up_EXCLUSION, // Mong - 0x1000 | up_RECOMMENDED | up_LB_LETTERS, // Mymr - 0x168F | up_EXCLUSION, // Ogam - 0x10300 | up_EXCLUSION, // Ital - 0x0B15 | up_RECOMMENDED, // Orya - 0x16A0 | up_EXCLUSION, // Runr - 0x0D85 | up_RECOMMENDED, // Sinh - 0x0710 | up_LIMITED_USE | up_RTL, // Syrc - 0x0B95 | up_RECOMMENDED, // Taml - 0x0C15 | up_RECOMMENDED, // Telu - 0x078C | up_RECOMMENDED | up_RTL, // Thaa - 0x0E17 | up_RECOMMENDED | up_LB_LETTERS, // Thai - 0x0F40 | up_RECOMMENDED, // Tibt - 0x14C0 | up_LIMITED_USE, // Cans - 0xA288 | up_LIMITED_USE | up_LB_LETTERS, // Yiii - 0x1703 | up_EXCLUSION, // Tglg - 0x1723 | up_EXCLUSION, // Hano - 0x1743 | up_EXCLUSION, // Buhd - 0x1763 | up_EXCLUSION, // Tagb - 0x280E | up_UNKNOWN, // Brai - 0x10800 | up_EXCLUSION | up_RTL, // Cprt - 0x1900 | up_LIMITED_USE, // Limb - 0x10000 | up_EXCLUSION, // Linb - 0x10480 | up_EXCLUSION, // Osma - 0x10450 | up_EXCLUSION, // Shaw - 0x1950 | up_LIMITED_USE | up_LB_LETTERS, // Tale - 0x10380 | up_EXCLUSION, // Ugar + 0x0040 | RECOMMENDED, // Zyyy + 0x0308 | RECOMMENDED, // Zinh + 0x0628 | RECOMMENDED | RTL, // Arab + 0x0531 | RECOMMENDED | CASED, // Armn + 0x0995 | RECOMMENDED, // Beng + 0x3105 | RECOMMENDED | LB_LETTERS, // Bopo + 0x13C4 | LIMITED_USE | CASED, // Cher + 0x03E2 | EXCLUSION | CASED, // Copt + 0x042F | RECOMMENDED | CASED, // Cyrl + 0x10414 | EXCLUSION | CASED, // Dsrt + 0x0905 | RECOMMENDED, // Deva + 0x12A0 | RECOMMENDED, // Ethi + 0x10D3 | RECOMMENDED, // Geor + 0x10330 | EXCLUSION, // Goth + 0x03A9 | RECOMMENDED | CASED, // Grek + 0x0A95 | RECOMMENDED, // Gujr + 0x0A15 | RECOMMENDED, // Guru + 0x5B57 | RECOMMENDED | LB_LETTERS, // Hani + 0xAC00 | RECOMMENDED, // Hang + 0x05D0 | RECOMMENDED | RTL, // Hebr + 0x304B | RECOMMENDED | LB_LETTERS, // Hira + 0x0C95 | RECOMMENDED, // Knda + 0x30AB | RECOMMENDED | LB_LETTERS, // Kana + 0x1780 | RECOMMENDED | LB_LETTERS, // Khmr + 0x0EA5 | RECOMMENDED | LB_LETTERS, // Laoo + 0x004C | RECOMMENDED | CASED, // Latn + 0x0D15 | RECOMMENDED, // Mlym + 0x1826 | EXCLUSION, // Mong + 0x1000 | RECOMMENDED | LB_LETTERS, // Mymr + 0x168F | EXCLUSION, // Ogam + 0x10300 | EXCLUSION, // Ital + 0x0B15 | RECOMMENDED, // Orya + 0x16A0 | EXCLUSION, // Runr + 0x0D85 | RECOMMENDED, // Sinh + 0x0710 | LIMITED_USE | RTL, // Syrc + 0x0B95 | RECOMMENDED, // Taml + 0x0C15 | RECOMMENDED, // Telu + 0x078C | RECOMMENDED | RTL, // Thaa + 0x0E17 | RECOMMENDED | LB_LETTERS, // Thai + 0x0F40 | RECOMMENDED, // Tibt + 0x14C0 | LIMITED_USE, // Cans + 0xA288 | LIMITED_USE | LB_LETTERS, // Yiii + 0x1703 | EXCLUSION, // Tglg + 0x1723 | EXCLUSION, // Hano + 0x1743 | EXCLUSION, // Buhd + 0x1763 | EXCLUSION, // Tagb + 0x280E | UNKNOWN, // Brai + 0x10800 | EXCLUSION | RTL, // Cprt + 0x1900 | LIMITED_USE, // Limb + 0x10000 | EXCLUSION, // Linb + 0x10480 | EXCLUSION, // Osma + 0x10450 | EXCLUSION, // Shaw + 0x1950 | LIMITED_USE | LB_LETTERS, // Tale + 0x10380 | EXCLUSION, // Ugar 0, - 0x1A00 | up_EXCLUSION, // Bugi - 0x2C00 | up_EXCLUSION | up_CASED, // Glag - 0x10A00 | up_EXCLUSION | up_RTL, // Khar - 0xA800 | up_LIMITED_USE, // Sylo - 0x1980 | up_LIMITED_USE | up_LB_LETTERS, // Talu - 0x2D30 | up_LIMITED_USE, // Tfng - 0x103A0 | up_EXCLUSION, // Xpeo - 0x1B05 | up_LIMITED_USE, // Bali - 0x1BC0 | up_LIMITED_USE, // Batk + 0x1A00 | EXCLUSION, // Bugi + 0x2C00 | EXCLUSION | CASED, // Glag + 0x10A00 | EXCLUSION | RTL, // Khar + 0xA800 | LIMITED_USE, // Sylo + 0x1980 | LIMITED_USE | LB_LETTERS, // Talu + 0x2D30 | LIMITED_USE, // Tfng + 0x103A0 | EXCLUSION, // Xpeo + 0x1B05 | LIMITED_USE, // Bali + 0x1BC0 | LIMITED_USE, // Batk 0, - 0x11005 | up_EXCLUSION, // Brah - 0xAA00 | up_LIMITED_USE, // Cham + 0x11005 | EXCLUSION, // Brah + 0xAA00 | LIMITED_USE, // Cham 0, 0, 0, 0, - 0x13153 | up_EXCLUSION, // Egyp + 0x13153 | EXCLUSION, // Egyp 0, - 0x5B57 | up_RECOMMENDED | up_LB_LETTERS, // Hans - 0x5B57 | up_RECOMMENDED | up_LB_LETTERS, // Hant - 0x16B1C | up_EXCLUSION, // Hmng - 0x10CA1 | up_EXCLUSION | up_RTL | up_CASED, // Hung + 0x5B57 | RECOMMENDED | LB_LETTERS, // Hans + 0x5B57 | RECOMMENDED | LB_LETTERS, // Hant + 0x16B1C | EXCLUSION, // Hmng + 0x10CA1 | EXCLUSION | RTL | CASED, // Hung 0, - 0xA984 | up_LIMITED_USE, // Java - 0xA90A | up_LIMITED_USE, // Kali + 0xA984 | LIMITED_USE, // Java + 0xA90A | LIMITED_USE, // Kali 0, 0, - 0x1C00 | up_LIMITED_USE, // Lepc - 0x10647 | up_EXCLUSION, // Lina - 0x0840 | up_LIMITED_USE | up_RTL, // Mand + 0x1C00 | LIMITED_USE, // Lepc + 0x10647 | EXCLUSION, // Lina + 0x0840 | LIMITED_USE | RTL, // Mand 0, - 0x10980 | up_EXCLUSION | up_RTL, // Mero - 0x07CA | up_LIMITED_USE | up_RTL, // Nkoo - 0x10C00 | up_EXCLUSION | up_RTL, // Orkh - 0x1036B | up_EXCLUSION, // Perm - 0xA840 | up_EXCLUSION, // Phag - 0x10900 | up_EXCLUSION | up_RTL, // Phnx - 0x16F00 | up_LIMITED_USE, // Plrd + 0x10980 | EXCLUSION | RTL, // Mero + 0x07CA | LIMITED_USE | RTL, // Nkoo + 0x10C00 | EXCLUSION | RTL, // Orkh + 0x1036B | EXCLUSION, // Perm + 0xA840 | EXCLUSION, // Phag + 0x10900 | EXCLUSION | RTL, // Phnx + 0x16F00 | LIMITED_USE, // Plrd 0, 0, 0, 0, 0, 0, - 0xA549 | up_LIMITED_USE, // Vaii + 0xA549 | LIMITED_USE, // Vaii 0, - 0x12000 | up_EXCLUSION, // Xsux + 0x12000 | EXCLUSION, // Xsux 0, - 0xFDD0 | up_UNKNOWN, // Zzzz - 0x102A0 | up_EXCLUSION, // Cari - 0x304B | up_RECOMMENDED | up_LB_LETTERS, // Jpan - 0x1A20 | up_LIMITED_USE | up_LB_LETTERS, // Lana - 0x10280 | up_EXCLUSION, // Lyci - 0x10920 | up_EXCLUSION | up_RTL, // Lydi - 0x1C5A | up_LIMITED_USE, // Olck - 0xA930 | up_EXCLUSION, // Rjng - 0xA882 | up_LIMITED_USE, // Saur - 0x1D850 | up_EXCLUSION, // Sgnw - 0x1B83 | up_LIMITED_USE, // Sund + 0xFDD0 | UNKNOWN, // Zzzz + 0x102A0 | EXCLUSION, // Cari + 0x304B | RECOMMENDED | LB_LETTERS, // Jpan + 0x1A20 | LIMITED_USE | LB_LETTERS, // Lana + 0x10280 | EXCLUSION, // Lyci + 0x10920 | EXCLUSION | RTL, // Lydi + 0x1C5A | LIMITED_USE, // Olck + 0xA930 | EXCLUSION, // Rjng + 0xA882 | LIMITED_USE, // Saur + 0x1D850 | EXCLUSION, // Sgnw + 0x1B83 | LIMITED_USE, // Sund 0, - 0xABC0 | up_LIMITED_USE, // Mtei - 0x10840 | up_EXCLUSION | up_RTL, // Armi - 0x10B00 | up_EXCLUSION | up_RTL, // Avst - 0x11103 | up_LIMITED_USE, // Cakm - 0xAC00 | up_RECOMMENDED, // Kore - 0x11083 | up_EXCLUSION, // Kthi - 0x10AD8 | up_EXCLUSION | up_RTL, // Mani - 0x10B60 | up_EXCLUSION | up_RTL, // Phli - 0x10B8F | up_EXCLUSION | up_RTL, // Phlp + 0xABC0 | LIMITED_USE, // Mtei + 0x10840 | EXCLUSION | RTL, // Armi + 0x10B00 | EXCLUSION | RTL, // Avst + 0x11103 | LIMITED_USE, // Cakm + 0xAC00 | RECOMMENDED, // Kore + 0x11083 | EXCLUSION, // Kthi + 0x10AD8 | EXCLUSION | RTL, // Mani + 0x10B60 | EXCLUSION | RTL, // Phli + 0x10B8F | EXCLUSION | RTL, // Phlp 0, - 0x10B40 | up_EXCLUSION | up_RTL, // Prti - 0x0800 | up_EXCLUSION | up_RTL, // Samr - 0xAA80 | up_LIMITED_USE | up_LB_LETTERS, // Tavt + 0x10B40 | EXCLUSION | RTL, // Prti + 0x0800 | EXCLUSION | RTL, // Samr + 0xAA80 | LIMITED_USE | LB_LETTERS, // Tavt 0, 0, - 0xA6A0 | up_LIMITED_USE, // Bamu - 0xA4D0 | up_LIMITED_USE, // Lisu + 0xA6A0 | LIMITED_USE, // Bamu + 0xA4D0 | LIMITED_USE, // Lisu 0, - 0x10A60 | up_EXCLUSION | up_RTL, // Sarb - 0x16AE6 | up_EXCLUSION, // Bass - 0x1BC20 | up_EXCLUSION, // Dupl - 0x10500 | up_EXCLUSION, // Elba - 0x11315 | up_EXCLUSION, // Gran + 0x10A60 | EXCLUSION | RTL, // Sarb + 0x16AE6 | EXCLUSION, // Bass + 0x1BC20 | EXCLUSION, // Dupl + 0x10500 | EXCLUSION, // Elba + 0x11315 | EXCLUSION, // Gran 0, 0, - 0x1E802 | up_EXCLUSION | up_RTL, // Mend - 0x109A0 | up_EXCLUSION | up_RTL, // Merc - 0x10A95 | up_EXCLUSION | up_RTL, // Narb - 0x10896 | up_EXCLUSION | up_RTL, // Nbat - 0x10873 | up_EXCLUSION | up_RTL, // Palm - 0x112BE | up_EXCLUSION, // Sind - 0x118B4 | up_EXCLUSION | up_CASED, // Wara + 0x1E802 | EXCLUSION | RTL, // Mend + 0x109A0 | EXCLUSION | RTL, // Merc + 0x10A95 | EXCLUSION | RTL, // Narb + 0x10896 | EXCLUSION | RTL, // Nbat + 0x10873 | EXCLUSION | RTL, // Palm + 0x112BE | EXCLUSION, // Sind + 0x118B4 | EXCLUSION | CASED, // Wara 0, 0, - 0x16A4F | up_EXCLUSION, // Mroo - 0x1B1C4 | up_EXCLUSION | up_LB_LETTERS, // Nshu - 0x11183 | up_EXCLUSION, // Shrd - 0x110D0 | up_EXCLUSION, // Sora - 0x11680 | up_EXCLUSION, // Takr - 0x18229 | up_EXCLUSION | up_LB_LETTERS, // Tang + 0x16A4F | EXCLUSION, // Mroo + 0x1B1C4 | EXCLUSION | LB_LETTERS, // Nshu + 0x11183 | EXCLUSION, // Shrd + 0x110D0 | EXCLUSION, // Sora + 0x11680 | EXCLUSION, // Takr + 0x18229 | EXCLUSION | LB_LETTERS, // Tang 0, - 0x14400 | up_EXCLUSION, // Hluw - 0x11208 | up_EXCLUSION, // Khoj - 0x11484 | up_EXCLUSION, // Tirh - 0x10537 | up_EXCLUSION, // Aghb - 0x11152 | up_EXCLUSION, // Mahj - 0x11717 | up_EXCLUSION | up_LB_LETTERS, // Ahom - 0x108F4 | up_EXCLUSION | up_RTL, // Hatr - 0x1160E | up_EXCLUSION, // Modi - 0x1128F | up_EXCLUSION, // Mult - 0x11AC0 | up_EXCLUSION, // Pauc - 0x1158E | up_EXCLUSION, // Sidd - 0x1E909 | up_LIMITED_USE | up_RTL | up_CASED, // Adlm - 0x11C0E | up_EXCLUSION, // Bhks - 0x11C72 | up_EXCLUSION, // Marc - 0x11412 | up_LIMITED_USE, // Newa - 0x104B5 | up_LIMITED_USE | up_CASED, // Osge - 0x5B57 | up_RECOMMENDED | up_LB_LETTERS, // Hanb - 0x1112 | up_RECOMMENDED, // Jamo + 0x14400 | EXCLUSION, // Hluw + 0x11208 | EXCLUSION, // Khoj + 0x11484 | EXCLUSION, // Tirh + 0x10537 | EXCLUSION, // Aghb + 0x11152 | EXCLUSION, // Mahj + 0x11717 | EXCLUSION | LB_LETTERS, // Ahom + 0x108F4 | EXCLUSION | RTL, // Hatr + 0x1160E | EXCLUSION, // Modi + 0x1128F | EXCLUSION, // Mult + 0x11AC0 | EXCLUSION, // Pauc + 0x1158E | EXCLUSION, // Sidd + 0x1E909 | LIMITED_USE | RTL | CASED, // Adlm + 0x11C0E | EXCLUSION, // Bhks + 0x11C72 | EXCLUSION, // Marc + 0x11412 | LIMITED_USE, // Newa + 0x104B5 | LIMITED_USE | CASED, // Osge + 0x5B57 | RECOMMENDED | LB_LETTERS, // Hanb + 0x1112 | RECOMMENDED, // Jamo 0, - 0x11D10 | up_EXCLUSION, // Gonm - 0x11A5C | up_EXCLUSION, // Soyo - 0x11A0B | up_EXCLUSION, // Zanb - 0x1180B | up_EXCLUSION, // Dogr - 0x11D71 | up_LIMITED_USE, // Gong - 0x11EE5 | up_EXCLUSION, // Maka - 0x16E40 | up_EXCLUSION | up_CASED, // Medf - 0x10D12 | up_LIMITED_USE | up_RTL, // Rohg - 0x10F42 | up_EXCLUSION | up_RTL, // Sogd - 0x10F19 | up_EXCLUSION | up_RTL, // Sogo - 0x10FF1 | up_EXCLUSION | up_RTL, // Elym - 0x1E108 | up_LIMITED_USE, // Hmnp - 0x119CE | up_EXCLUSION, // Nand - 0x1E2E1 | up_LIMITED_USE, // Wcho - 0x10FBF | up_EXCLUSION | up_RTL, // Chrs - 0x1190C | up_EXCLUSION, // Diak - 0x18C65 | up_EXCLUSION | up_LB_LETTERS, // Kits - 0x10E88 | up_EXCLUSION | up_RTL, // Yezi + 0x11D10 | EXCLUSION, // Gonm + 0x11A5C | EXCLUSION, // Soyo + 0x11A0B | EXCLUSION, // Zanb + 0x1180B | EXCLUSION, // Dogr + 0x11D71 | LIMITED_USE, // Gong + 0x11EE5 | EXCLUSION, // Maka + 0x16E40 | EXCLUSION | CASED, // Medf + 0x10D12 | LIMITED_USE | RTL, // Rohg + 0x10F42 | EXCLUSION | RTL, // Sogd + 0x10F19 | EXCLUSION | RTL, // Sogo + 0x10FF1 | EXCLUSION | RTL, // Elym + 0x1E108 | LIMITED_USE, // Hmnp + 0x119CE | EXCLUSION, // Nand + 0x1E2E1 | LIMITED_USE, // Wcho + 0x10FBF | EXCLUSION | RTL, // Chrs + 0x1190C | EXCLUSION, // Diak + 0x18C65 | EXCLUSION | LB_LETTERS, // Kits + 0x10E88 | EXCLUSION | RTL, // Yezi + 0x12FE5 | EXCLUSION, // Cpmn + 0x10F7C | EXCLUSION | RTL, // Ougr + 0x16ABC | EXCLUSION, // Tnsa + 0x1E290 | EXCLUSION, // Toto + 0x10582 | EXCLUSION | CASED, // Vith + 0x11F1B | EXCLUSION | LB_LETTERS, // Kawi + 0x1E4E6 | EXCLUSION, // Nagm // End copy-paste from parsescriptmetadata.py }; int32_t getScriptProps(UScriptCode script) { - if (0 <= script && script < UPRV_LENGTHOF(up_SCRIPT_PROPS)) { - return up_SCRIPT_PROPS[script]; + if (0 <= script && script < UPRV_LENGTHOF(SCRIPT_PROPS)) { + return SCRIPT_PROPS[script]; } else { return 0; } @@ -251,9 +258,9 @@ int32_t getScriptProps(UScriptCode script) { } // namespace U_CAPI int32_t U_EXPORT2 -uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode) { +uscript_getSampleString(UScriptCode script, char16_t *dest, int32_t capacity, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return 0; } - if(capacity < 0 || (capacity > 0 && dest == NULL)) { + if(capacity < 0 || (capacity > 0 && dest == nullptr)) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -288,15 +295,15 @@ uscript_getUsage(UScriptCode script) { U_CAPI UBool U_EXPORT2 uscript_isRightToLeft(UScriptCode script) { - return (getScriptProps(script) & up_RTL) != 0; + return (getScriptProps(script) & RTL) != 0; } U_CAPI UBool U_EXPORT2 uscript_breaksBetweenLetters(UScriptCode script) { - return (getScriptProps(script) & up_LB_LETTERS) != 0; + return (getScriptProps(script) & LB_LETTERS) != 0; } U_CAPI UBool U_EXPORT2 uscript_isCased(UScriptCode script) { - return (getScriptProps(script) & up_CASED) != 0; + return (getScriptProps(script) & CASED) != 0; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uset.cpp b/src/duckdb/extension/icu/third_party/icu/common/uset.cpp index eae7981d5..b2d0b91d4 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uset.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uset.cpp @@ -87,14 +87,14 @@ uset_addRange(USet* set, UChar32 start, UChar32 end) { } U_CAPI void U_EXPORT2 -uset_addString(USet* set, const UChar* str, int32_t strLen) { +uset_addString(USet* set, const char16_t* str, int32_t strLen) { // UnicodeString handles -1 for strLen UnicodeString s(strLen<0, str, strLen); ((UnicodeSet*) set)->UnicodeSet::add(s); } U_CAPI void U_EXPORT2 -uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen) { +uset_addAllCodePoints(USet* set, const char16_t *str, int32_t strLen) { // UnicodeString handles -1 for strLen UnicodeString s(str, strLen); ((UnicodeSet*) set)->UnicodeSet::addAll(s); @@ -111,11 +111,17 @@ uset_removeRange(USet* set, UChar32 start, UChar32 end) { } U_CAPI void U_EXPORT2 -uset_removeString(USet* set, const UChar* str, int32_t strLen) { +uset_removeString(USet* set, const char16_t* str, int32_t strLen) { UnicodeString s(strLen==-1, str, strLen); ((UnicodeSet*) set)->UnicodeSet::remove(s); } +U_CAPI void U_EXPORT2 +uset_removeAllCodePoints(USet *set, const char16_t *str, int32_t length) { + UnicodeString s(length==-1, str, length); + ((UnicodeSet*) set)->UnicodeSet::removeAll(s); +} + U_CAPI void U_EXPORT2 uset_removeAll(USet* set, const USet* remove) { ((UnicodeSet*) set)->UnicodeSet::removeAll(*(const UnicodeSet*)remove); @@ -126,6 +132,18 @@ uset_retain(USet* set, UChar32 start, UChar32 end) { ((UnicodeSet*) set)->UnicodeSet::retain(start, end); } +U_CAPI void U_EXPORT2 +uset_retainString(USet *set, const char16_t *str, int32_t length) { + UnicodeString s(length==-1, str, length); + ((UnicodeSet*) set)->UnicodeSet::retain(s); +} + +U_CAPI void U_EXPORT2 +uset_retainAllCodePoints(USet *set, const char16_t *str, int32_t length) { + UnicodeString s(length==-1, str, length); + ((UnicodeSet*) set)->UnicodeSet::retainAll(s); +} + U_CAPI void U_EXPORT2 uset_retainAll(USet* set, const USet* retain) { ((UnicodeSet*) set)->UnicodeSet::retainAll(*(const UnicodeSet*)retain); @@ -141,6 +159,23 @@ uset_complement(USet* set) { ((UnicodeSet*) set)->UnicodeSet::complement(); } +U_CAPI void U_EXPORT2 +uset_complementRange(USet *set, UChar32 start, UChar32 end) { + ((UnicodeSet*) set)->UnicodeSet::complement(start, end); +} + +U_CAPI void U_EXPORT2 +uset_complementString(USet *set, const char16_t *str, int32_t length) { + UnicodeString s(length==-1, str, length); + ((UnicodeSet*) set)->UnicodeSet::complement(s); +} + +U_CAPI void U_EXPORT2 +uset_complementAllCodePoints(USet *set, const char16_t *str, int32_t length) { + UnicodeString s(length==-1, str, length); + ((UnicodeSet*) set)->UnicodeSet::complementAll(s); +} + U_CAPI void U_EXPORT2 uset_complementAll(USet* set, const USet* complement) { ((UnicodeSet*) set)->UnicodeSet::complementAll(*(const UnicodeSet*)complement); @@ -161,6 +196,11 @@ uset_isEmpty(const USet* set) { return ((const UnicodeSet*) set)->UnicodeSet::isEmpty(); } +U_CAPI UBool U_EXPORT2 +uset_hasStrings(const USet* set) { + return ((const UnicodeSet*) set)->UnicodeSet::hasStrings(); +} + U_CAPI UBool U_EXPORT2 uset_contains(const USet* set, UChar32 c) { return ((const UnicodeSet*) set)->UnicodeSet::contains(c); @@ -172,7 +212,7 @@ uset_containsRange(const USet* set, UChar32 start, UChar32 end) { } U_CAPI UBool U_EXPORT2 -uset_containsString(const USet* set, const UChar* str, int32_t strLen) { +uset_containsString(const USet* set, const char16_t* str, int32_t strLen) { UnicodeString s(strLen==-1, str, strLen); return ((const UnicodeSet*) set)->UnicodeSet::contains(s); } @@ -183,7 +223,7 @@ uset_containsAll(const USet* set1, const USet* set2) { } U_CAPI UBool U_EXPORT2 -uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen) { +uset_containsAllCodePoints(const USet* set, const char16_t *str, int32_t strLen) { // Create a string alias, since nothing is being added to the set. UnicodeString s(strLen==-1, str, strLen); return ((const UnicodeSet*) set)->UnicodeSet::containsAll(s); @@ -200,12 +240,12 @@ uset_containsSome(const USet* set1, const USet* set2) { } U_CAPI int32_t U_EXPORT2 -uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition) { +uset_span(const USet *set, const char16_t *s, int32_t length, USetSpanCondition spanCondition) { return ((UnicodeSet*) set)->UnicodeSet::span(s, length, spanCondition); } U_CAPI int32_t U_EXPORT2 -uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition) { +uset_spanBack(const USet *set, const char16_t *s, int32_t length, USetSpanCondition spanCondition) { return ((UnicodeSet*) set)->UnicodeSet::spanBack(s, length, spanCondition); } @@ -261,6 +301,11 @@ class USetAccess /* not : public UObject because all methods are static */ { }; U_NAMESPACE_END +U_CAPI int32_t U_EXPORT2 +uset_getRangeCount(const USet *set) { + return ((const UnicodeSet *)set)->UnicodeSet::getRangeCount(); +} + U_CAPI int32_t U_EXPORT2 uset_getItemCount(const USet* uset) { const UnicodeSet& set = *(const UnicodeSet*)uset; @@ -270,7 +315,7 @@ uset_getItemCount(const USet* uset) { U_CAPI int32_t U_EXPORT2 uset_getItem(const USet* uset, int32_t itemIndex, UChar32* start, UChar32* end, - UChar* str, int32_t strCapacity, + char16_t* str, int32_t strCapacity, UErrorCode* ec) { if (U_FAILURE(*ec)) return 0; const UnicodeSet& set = *(const UnicodeSet*)uset; @@ -295,21 +340,16 @@ uset_getItem(const USet* uset, int32_t itemIndex, } } -//U_CAPI int32_t U_EXPORT2 -//uset_getRangeCount(const USet* set) { -// return ((const UnicodeSet*) set)->getRangeCount(); -//} -// //U_CAPI UBool U_EXPORT2 //uset_getRange(const USet* set, int32_t rangeIndex, // UChar32* pStart, UChar32* pEnd) { // if ((uint32_t) rangeIndex >= (uint32_t) uset_getRangeCount(set)) { -// return FALSE; +// return false; // } // const UnicodeSet* us = (const UnicodeSet*) set; // *pStart = us->getRangeStart(rangeIndex); // *pEnd = us->getRangeEnd(rangeIndex); -// return TRUE; +// return true; //} /* @@ -320,7 +360,7 @@ uset_getItem(const USet* uset, int32_t itemIndex, * therefore all BMP code points precede all supplementary code points. * * Store each supplementary code point in 2 16-bit units, - * simply with higher-then-lower 16-bit halfs. + * simply with higher-then-lower 16-bit halves. * * Precede the entire list with the length. * If there are supplementary code points, then set bit 15 in the length @@ -332,7 +372,7 @@ uset_getItem(const USet* uset, int32_t itemIndex, */ U_CAPI int32_t U_EXPORT2 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* ec) { - if (ec==NULL || U_FAILURE(*ec)) { + if (ec==nullptr || U_FAILURE(*ec)) { return 0; } @@ -343,12 +383,12 @@ U_CAPI UBool U_EXPORT2 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength) { int32_t length; - if(fillSet==NULL) { - return FALSE; + if(fillSet==nullptr) { + return false; } - if(src==NULL || srcLength<=0) { + if(src==nullptr || srcLength<=0) { fillSet->length=fillSet->bmpLength=0; - return FALSE; + return false; } length=*src++; @@ -357,25 +397,25 @@ uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcL length&=0x7fff; if(srcLength<(2+length)) { fillSet->length=fillSet->bmpLength=0; - return FALSE; + return false; } fillSet->bmpLength=*src++; } else { /* only BMP values */ if(srcLength<(1+length)) { fillSet->length=fillSet->bmpLength=0; - return FALSE; + return false; } fillSet->bmpLength=length; } fillSet->array=src; fillSet->length=length; - return TRUE; + return true; } U_CAPI void U_EXPORT2 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c) { - if(fillSet==NULL || (uint32_t)c>0x10ffff) { + if(fillSet==nullptr || (uint32_t)c>0x10ffff) { return; } @@ -410,8 +450,8 @@ U_CAPI UBool U_EXPORT2 uset_serializedContains(const USerializedSet* set, UChar32 c) { const uint16_t* array; - if(set==NULL || (uint32_t)c>0x10ffff) { - return FALSE; + if(set==nullptr || (uint32_t)c>0x10ffff) { + return false; } array=set->array; @@ -466,7 +506,7 @@ uset_serializedContains(const USerializedSet* set, UChar32 c) { U_CAPI int32_t U_EXPORT2 uset_getSerializedRangeCount(const USerializedSet* set) { - if(set==NULL) { + if(set==nullptr) { return 0; } @@ -479,8 +519,8 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, const uint16_t* array; int32_t bmpLength, length; - if(set==NULL || rangeIndex<0 || pStart==NULL || pEnd==NULL) { - return FALSE; + if(set==nullptr || rangeIndex<0 || pStart==nullptr || pEnd==nullptr) { + return false; } array=set->array; @@ -497,7 +537,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, } else { *pEnd=0x10ffff; } - return TRUE; + return true; } else { rangeIndex-=bmpLength; rangeIndex*=2; /* address pairs of pairs of units */ @@ -511,9 +551,9 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, } else { *pEnd=0x10ffff; } - return TRUE; + return true; } else { - return FALSE; + return false; } } } @@ -550,15 +590,15 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, // addRemove(USet* set, UChar32 c, int32_t doRemove) { // int32_t i, length, more; // -// if(set==NULL || (uint32_t)c>0x10ffff) { -// return FALSE; +// if(set==nullptr || (uint32_t)c>0x10ffff) { +// return false; // } // // length=set->length; // i=findChar(set->array, length, c); // if((i&1)^doRemove) { // /* c is already in the set */ -// return TRUE; +// return true; // } // // /* how many more array items do we need? */ @@ -575,7 +615,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, // } // } // } -// return TRUE; +// return true; // } else if(i>0 && c==set->array[i-1]) { // /* c is just after the previous range, extend that in-place by one */ // if(++c<=0x10ffff) { @@ -592,7 +632,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, // /* extend the previous range (had limit 0x10ffff) to the end of Unicode */ // set->length=i-1; // } -// return TRUE; +// return true; // } else if(i==length && c==0x10ffff) { // /* insert one range limit c */ // more=1; @@ -606,8 +646,8 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, // /* reallocate */ // int32_t newCapacity=set->capacity+set->capacity/2+USET_GROW_DELTA; // UChar32* newArray=(UChar32* )uprv_malloc(newCapacity*4); -// if(newArray==NULL) { -// return FALSE; +// if(newArray==nullptr) { +// return false; // } // set->capacity=newCapacity; // uprv_memcpy(newArray, set->array, length*4); @@ -627,7 +667,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, // } // set->length+=more; // -// return TRUE; +// return true; // } // // U_CAPI UBool U_EXPORT2 diff --git a/src/duckdb/extension/icu/third_party/icu/common/uset_imp.h b/src/duckdb/extension/icu/third_party/icu/common/uset_imp.h index 7233b9303..77197aaed 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uset_imp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uset_imp.h @@ -58,5 +58,14 @@ typedef struct USetAdder USetAdder; U_CDECL_END -#endif +#ifdef __cplusplus + +namespace { + +constexpr int32_t USET_CASE_MASK = USET_CASE_INSENSITIVE | USET_ADD_CASE_MAPPINGS; +} // namespace + +#endif // __cplusplus + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/uset_props.cpp b/src/duckdb/extension/icu/third_party/icu/common/uset_props.cpp index f08e760b1..6f6e0c550 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uset_props.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uset_props.cpp @@ -30,12 +30,12 @@ U_NAMESPACE_USE U_CAPI USet* U_EXPORT2 -uset_openPattern(const UChar* pattern, int32_t patternLength, +uset_openPattern(const char16_t* pattern, int32_t patternLength, UErrorCode* ec) { UnicodeString pat(patternLength==-1, pattern, patternLength); UnicodeSet* set = new UnicodeSet(pat, *ec); - /* test for NULL */ + /* test for nullptr */ if(set == 0) { *ec = U_MEMORY_ALLOCATION_ERROR; return 0; @@ -43,19 +43,19 @@ uset_openPattern(const UChar* pattern, int32_t patternLength, if (U_FAILURE(*ec)) { delete set; - set = NULL; + set = nullptr; } return (USet*) set; } U_CAPI USet* U_EXPORT2 -uset_openPatternOptions(const UChar* pattern, int32_t patternLength, +uset_openPatternOptions(const char16_t* pattern, int32_t patternLength, uint32_t options, UErrorCode* ec) { UnicodeString pat(patternLength==-1, pattern, patternLength); - UnicodeSet* set = new UnicodeSet(pat, options, NULL, *ec); - /* test for NULL */ + UnicodeSet* set = new UnicodeSet(pat, options, nullptr, *ec); + /* test for nullptr */ if(set == 0) { *ec = U_MEMORY_ALLOCATION_ERROR; return 0; @@ -63,7 +63,7 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength, if (U_FAILURE(*ec)) { delete set; - set = NULL; + set = nullptr; } return (USet*) set; } @@ -71,20 +71,20 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength, U_CAPI int32_t U_EXPORT2 uset_applyPattern(USet *set, - const UChar *pattern, int32_t patternLength, + const char16_t *pattern, int32_t patternLength, uint32_t options, UErrorCode *status){ // status code needs to be checked since we // dereference it - if(status == NULL || U_FAILURE(*status)){ + if(status == nullptr || U_FAILURE(*status)){ return 0; } // check only the set paramenter - // if pattern is NULL or null terminate + // if pattern is nullptr or NUL terminated // UnicodeString constructor takes care of it - if(set == NULL){ + if(set == nullptr){ *status = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -93,7 +93,7 @@ uset_applyPattern(USet *set, ParsePosition pos; - ((UnicodeSet*) set)->applyPattern(pat, pos, options, NULL, *status); + ((UnicodeSet*) set)->applyPattern(pat, pos, options, nullptr, *status); return pos.getIndex(); } @@ -106,8 +106,8 @@ uset_applyIntPropertyValue(USet* set, U_CAPI void U_EXPORT2 uset_applyPropertyAlias(USet* set, - const UChar *prop, int32_t propLength, - const UChar *value, int32_t valueLength, + const char16_t *prop, int32_t propLength, + const char16_t *value, int32_t valueLength, UErrorCode* ec) { UnicodeString p(prop, propLength); @@ -117,19 +117,19 @@ uset_applyPropertyAlias(USet* set, } U_CAPI UBool U_EXPORT2 -uset_resemblesPattern(const UChar *pattern, int32_t patternLength, +uset_resemblesPattern(const char16_t *pattern, int32_t patternLength, int32_t pos) { UnicodeString pat(pattern, patternLength); return ((pos+1) < pat.length() && - pat.charAt(pos) == (UChar)91/*[*/) || + pat.charAt(pos) == (char16_t)91/*[*/) || UnicodeSet::resemblesPattern(pat, pos); } U_CAPI int32_t U_EXPORT2 uset_toPattern(const USet* set, - UChar* result, int32_t resultCapacity, + char16_t* result, int32_t resultCapacity, UBool escapeUnprintable, UErrorCode* ec) { UnicodeString pat; diff --git a/src/duckdb/extension/icu/third_party/icu/common/usetiter.cpp b/src/duckdb/extension/icu/third_party/icu/common/usetiter.cpp index 791516904..d24a15ab2 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/usetiter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/usetiter.cpp @@ -20,7 +20,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeSetIterator) * @param set set to iterate over */ UnicodeSetIterator::UnicodeSetIterator(const UnicodeSet& uSet) { - cpString = NULL; + cpString = nullptr; reset(uSet); } @@ -28,8 +28,8 @@ UnicodeSetIterator::UnicodeSetIterator(const UnicodeSet& uSet) { * Create an iterator. Convenience for when the contents are to be set later. */ UnicodeSetIterator::UnicodeSetIterator() { - this->set = NULL; - cpString = NULL; + this->set = nullptr; + cpString = nullptr; reset(); } @@ -49,20 +49,20 @@ UnicodeSetIterator::~UnicodeSetIterator() { UBool UnicodeSetIterator::next() { if (nextElement <= endElement) { codepoint = codepointEnd = nextElement++; - string = NULL; - return TRUE; + string = nullptr; + return true; } if (range < endRange) { loadRange(++range); codepoint = codepointEnd = nextElement++; - string = NULL; - return TRUE; + string = nullptr; + return true; } - if (nextString >= stringCount) return FALSE; + if (nextString >= stringCount) return false; codepoint = (UChar32)IS_STRING; // signal that value is actually a string string = (const UnicodeString*) set->strings->elementAt(nextString++); - return TRUE; + return true; } /** @@ -77,25 +77,25 @@ UBool UnicodeSetIterator::next() { *
    Note also that the codepointEnd is undefined after calling this method. */ UBool UnicodeSetIterator::nextRange() { - string = NULL; + string = nullptr; if (nextElement <= endElement) { codepointEnd = endElement; codepoint = nextElement; nextElement = endElement+1; - return TRUE; + return true; } if (range < endRange) { loadRange(++range); codepointEnd = endElement; codepoint = nextElement; nextElement = endElement+1; - return TRUE; + return true; } - if (nextString >= stringCount) return FALSE; + if (nextString >= stringCount) return false; codepoint = (UChar32)IS_STRING; // signal that value is actually a string string = (const UnicodeString*) set->strings->elementAt(nextString++); - return TRUE; + return true; } /** @@ -110,7 +110,7 @@ void UnicodeSetIterator::reset(const UnicodeSet& uSet) { * Resets to the start, to allow the iteration to start over again. */ void UnicodeSetIterator::reset() { - if (set == NULL) { + if (set == nullptr) { // Set up indices to empty iteration endRange = -1; stringCount = 0; @@ -125,7 +125,7 @@ void UnicodeSetIterator::reset() { loadRange(range); } nextString = 0; - string = NULL; + string = nullptr; } void UnicodeSetIterator::loadRange(int32_t iRange) { @@ -135,11 +135,11 @@ void UnicodeSetIterator::loadRange(int32_t iRange) { const UnicodeString& UnicodeSetIterator::getString() { - if (string==NULL && codepoint!=(UChar32)IS_STRING) { - if (cpString == NULL) { + if (string==nullptr && codepoint!=(UChar32)IS_STRING) { + if (cpString == nullptr) { cpString = new UnicodeString(); } - if (cpString != NULL) { + if (cpString != nullptr) { cpString->setTo((UChar32)codepoint); } string = cpString; diff --git a/src/duckdb/extension/icu/third_party/icu/common/ushape.cpp b/src/duckdb/extension/icu/third_party/icu/common/ushape.cpp index bd743c12d..d0ac95e0b 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ushape.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ushape.cpp @@ -31,7 +31,7 @@ /* * This implementation is designed for 16-bit Unicode strings. * The main assumption is that the Arabic characters and their - * presentation forms each fit into a single UChar. + * presentation forms each fit into a single char16_t. * With UTF-8, they occupy 2 or 3 bytes, and more than the ASCII * characters. */ @@ -49,36 +49,36 @@ /* definitions for Arabic letter shaping ------------------------------------ */ -#define USHAPE_IRRELEVANT 4 -#define USHAPE_LAMTYPE 16 -#define USHAPE_ALEFTYPE 32 -#define USHAPE_LINKR 1 -#define USHAPE_LINKL 2 -#define USHAPE_APRESENT 8 -#define USHAPE_SHADDA 64 -#define USHAPE_CSHADDA 128 -#define USHAPE_COMBINE (USHAPE_SHADDA+USHAPE_CSHADDA) - -#define USHAPE_HAMZAFE_CHAR 0xfe80 -#define USHAPE_HAMZA06_CHAR 0x0621 -#define USHAPE_YEH_HAMZA_CHAR 0x0626 -#define USHAPE_YEH_HAMZAFE_CHAR 0xFE89 -#define USHAPE_LAMALEF_SPACE_SUB 0xFFFF -#define USHAPE_TASHKEEL_SPACE_SUB 0xFFFE -#define USHAPE_NEW_TAIL_CHAR 0xFE73 -#define USHAPE_OLD_TAIL_CHAR 0x200B -#define USHAPE_LAM_CHAR 0x0644 -#define USHAPE_SPACE_CHAR 0x0020 -#define USHAPE_SHADDA_CHAR 0xFE7C -#define USHAPE_TATWEEL_CHAR 0x0640 -#define USHAPE_SHADDA_USHAPE_TATWEEL_CHAR 0xFE7D -#define USHAPE_SHADDA06_CHAR 0x0651 - -#define USHAPE_SHAPE_MODE 0 -#define USHAPE_DESHAPE_MODE 1 +#define IRRELEVANT 4 +#define LAMTYPE 16 +#define ALEFTYPE 32 +#define LINKR 1 +#define LINKL 2 +#define APRESENT 8 +#define SHADDA 64 +#define CSHADDA 128 +#define COMBINE (SHADDA+CSHADDA) + +#define HAMZAFE_CHAR 0xfe80 +#define HAMZA06_CHAR 0x0621 +#define YEH_HAMZA_CHAR 0x0626 +#define YEH_HAMZAFE_CHAR 0xFE89 +#define LAMALEF_SPACE_SUB 0xFFFF +#define TASHKEEL_SPACE_SUB 0xFFFE +#define NEW_TAIL_CHAR 0xFE73 +#define OLD_TAIL_CHAR 0x200B +#define LAM_CHAR 0x0644 +#define SPACE_CHAR 0x0020 +#define SHADDA_CHAR 0xFE7C +#define TATWEEL_CHAR 0x0640 +#define SHADDA_TATWEEL_CHAR 0xFE7D +#define SHADDA06_CHAR 0x0651 + +#define SHAPE_MODE 0 +#define DESHAPE_MODE 1 struct uShapeVariables { - UChar tailChar; + char16_t tailChar; uint32_t uShapeLamalefBegin; uint32_t uShapeLamalefEnd; uint32_t uShapeTashkeelBegin; @@ -122,7 +122,7 @@ static const uint8_t tashkeelMedial[] = { /* FE7F */ 1 }; -static const UChar yehHamzaToYeh[] = +static const char16_t yehHamzaToYeh[] = { /* isolated*/ 0xFEEF, /* final */ 0xFEF0 @@ -134,7 +134,7 @@ static const uint8_t IrrelevantPos[] = { }; -static const UChar convertLamAlef[] = +static const char16_t convertLamAlef[] = { /*FEF5*/ 0x0622, /*FEF6*/ 0x0622, @@ -146,7 +146,7 @@ static const UChar convertLamAlef[] = /*FEFC*/ 0x0627 }; -static const UChar araLink[178]= +static const char16_t araLink[178]= { 1 + 32 + 256 * 0x11,/*0x0622*/ 1 + 32 + 256 * 0x13,/*0x0623*/ @@ -294,7 +294,7 @@ static const uint8_t presBLink[]= /*FEF*/ 1, 0, 1, 2,1 + 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0 }; -static const UChar convertFBto06[] = +static const char16_t convertFBto06[] = { /***********0******1******2******3******4******5******6******7******8******9******A******B******C******D******E******F***/ /*FB5*/ 0x671, 0x671, 0x67B, 0x67B, 0x67B, 0x67B, 0x67E, 0x67E, 0x67E, 0x67E, 0, 0, 0, 0, 0x67A, 0x67A, @@ -310,7 +310,7 @@ static const UChar convertFBto06[] = /*FBF*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x6CC, 0x6CC, 0x6CC, 0x6CC }; -static const UChar convertFEto06[] = +static const char16_t convertFEto06[] = { /***********0******1******2******3******4******5******6******7******8******9******A******B******C******D******E******F***/ /*FE7*/ 0x64B, 0x64B, 0x64C, 0x64C, 0x64D, 0x64D, 0x64E, 0x64E, 0x64F, 0x64F, 0x650, 0x650, 0x651, 0x651, 0x652, 0x652, @@ -339,11 +339,11 @@ static const uint8_t shapeTable[4][4][4]= * we can safely just work with code units (again, at least UTF-16). */ static void -_shapeToArabicDigitsWithContext(UChar *s, int32_t length, - UChar digitBase, +_shapeToArabicDigitsWithContext(char16_t *s, int32_t length, + char16_t digitBase, UBool isLogical, UBool lastStrongWasAL) { int32_t i; - UChar c; + char16_t c; digitBase-=0x30; @@ -354,14 +354,14 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length, switch(ubidi_getClass(c)) { case U_LEFT_TO_RIGHT: /* L */ case U_RIGHT_TO_LEFT: /* R */ - lastStrongWasAL=FALSE; + lastStrongWasAL=false; break; case U_RIGHT_TO_LEFT_ARABIC: /* AL */ - lastStrongWasAL=TRUE; + lastStrongWasAL=true; break; case U_EUROPEAN_NUMBER: /* EN */ if(lastStrongWasAL && (uint32_t)(c-0x30)<10) { - s[i]=(UChar)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */ + s[i]=(char16_t)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */ } break; default : @@ -374,14 +374,14 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length, switch(ubidi_getClass(c)) { case U_LEFT_TO_RIGHT: /* L */ case U_RIGHT_TO_LEFT: /* R */ - lastStrongWasAL=FALSE; + lastStrongWasAL=false; break; case U_RIGHT_TO_LEFT_ARABIC: /* AL */ - lastStrongWasAL=TRUE; + lastStrongWasAL=true; break; case U_EUROPEAN_NUMBER: /* EN */ if(lastStrongWasAL && (uint32_t)(c-0x30)<10) { - s[i]=(UChar)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */ + s[i]=(char16_t)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */ } break; default : @@ -398,8 +398,8 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length, * U_SHAPE_TEXT_DIRECTION_LOGICAL */ static void -invertBuffer(UChar *buffer, int32_t size, uint32_t /*options*/, int32_t lowlimit, int32_t highlimit) { - UChar temp; +invertBuffer(char16_t *buffer, int32_t size, uint32_t /*options*/, int32_t lowlimit, int32_t highlimit) { + char16_t temp; int32_t i=0,j=0; for(i=lowlimit,j=size-highlimit-1;i= 0x0622 && ch <= 0x06D3) { return(araLink[ch-0x0622]); } else if(ch == 0x200D) { @@ -460,15 +460,15 @@ getLink(UChar ch) { * at each end of the logical buffer */ static void -countSpaces(UChar *dest, int32_t size, uint32_t /*options*/, int32_t *spacesCountl, int32_t *spacesCountr) { +countSpaces(char16_t *dest, int32_t size, uint32_t /*options*/, int32_t *spacesCountl, int32_t *spacesCountr) { int32_t i = 0; int32_t countl = 0,countr = 0; - while((dest[i] == USHAPE_SPACE_CHAR) && (countl < size)) { + while((dest[i] == SPACE_CHAR) && (countl < size)) { countl++; i++; } if (countl < size) { /* the entire buffer is not all space */ - while(dest[size-1] == USHAPE_SPACE_CHAR) { + while(dest[size-1] == SPACE_CHAR) { countr++; size--; } @@ -482,7 +482,7 @@ countSpaces(UChar *dest, int32_t size, uint32_t /*options*/, int32_t *spacesCoun *Function : Returns 1 for Tashkeel characters in 06 range else return 0 */ static inline int32_t -isTashkeelChar(UChar ch) { +isTashkeelChar(char16_t ch) { return (int32_t)( ch>=0x064B && ch<= 0x0652 ); } @@ -491,7 +491,7 @@ isTashkeelChar(UChar ch) { *Function : Returns 1 for Tashkeel characters in FE range else return 0 */ static inline int32_t -isTashkeelCharFE(UChar ch) { +isTashkeelCharFE(char16_t ch) { return (int32_t)( ch>=0xFE70 && ch<= 0xFE7F ); } @@ -500,7 +500,7 @@ isTashkeelCharFE(UChar ch) { *Function : Returns 1 for Alef characters else return 0 */ static inline int32_t -isAlefChar(UChar ch) { +isAlefChar(char16_t ch) { return (int32_t)( (ch==0x0622)||(ch==0x0623)||(ch==0x0625)||(ch==0x0627) ); } @@ -509,7 +509,7 @@ isAlefChar(UChar ch) { *Function : Returns 1 for LamAlef characters else return 0 */ static inline int32_t -isLamAlefChar(UChar ch) { +isLamAlefChar(char16_t ch) { return (int32_t)((ch>=0xFEF5)&&(ch<=0xFEFC) ); } @@ -519,8 +519,8 @@ isLamAlefChar(UChar ch) { */ static inline int32_t -isTailChar(UChar ch) { - if(ch == USHAPE_OLD_TAIL_CHAR || ch == USHAPE_NEW_TAIL_CHAR){ +isTailChar(char16_t ch) { + if(ch == OLD_TAIL_CHAR || ch == NEW_TAIL_CHAR){ return 1; }else{ return 0; @@ -534,7 +534,7 @@ isTailChar(UChar ch) { */ static inline int32_t -isSeenTailFamilyChar(UChar ch) { +isSeenTailFamilyChar(char16_t ch) { if(ch >= 0xfeb1 && ch < 0xfebf){ return tailFamilyIsolatedFinal [ch - 0xFEB1]; }else{ @@ -548,7 +548,7 @@ isSeenTailFamilyChar(UChar ch) { */ static inline int32_t -isSeenFamilyChar(UChar ch){ +isSeenFamilyChar(char16_t ch){ if(ch >= 0x633 && ch <= 0x636){ return 1; }else { @@ -563,7 +563,7 @@ isSeenFamilyChar(UChar ch){ * otherwise returns 0 */ static inline int32_t -isAlefMaksouraChar(UChar ch) { +isAlefMaksouraChar(char16_t ch) { return (int32_t)( (ch == 0xFEEF) || ( ch == 0xFEF0) || (ch == 0x0649)); } @@ -573,7 +573,7 @@ isAlefMaksouraChar(UChar ch) { * final is found otherwise returns 0 */ static inline int32_t -isYehHamzaChar(UChar ch) { +isYehHamzaChar(char16_t ch) { if((ch==0xFE89)||(ch==0xFE8A)){ return 1; }else{ @@ -589,11 +589,11 @@ isYehHamzaChar(UChar ch) { * returns 0 */ static inline int32_t -isTashkeelOnTatweelChar(UChar ch){ - if(ch >= 0xfe70 && ch <= 0xfe7f && ch != USHAPE_NEW_TAIL_CHAR && ch != 0xFE75 && ch != USHAPE_SHADDA_USHAPE_TATWEEL_CHAR) +isTashkeelOnTatweelChar(char16_t ch){ + if(ch >= 0xfe70 && ch <= 0xfe7f && ch != NEW_TAIL_CHAR && ch != 0xFE75 && ch != SHADDA_TATWEEL_CHAR) { return tashkeelMedial [ch - 0xFE70]; - }else if( (ch >= 0xfcf2 && ch <= 0xfcf4) || (ch == USHAPE_SHADDA_USHAPE_TATWEEL_CHAR)) { + }else if( (ch >= 0xfcf2 && ch <= 0xfcf4) || (ch == SHADDA_TATWEEL_CHAR)) { return 2; }else{ return 0; @@ -608,8 +608,8 @@ isTashkeelOnTatweelChar(UChar ch){ * returns 2 otherwise returns 0 */ static inline int32_t -isIsolatedTashkeelChar(UChar ch){ - if(ch >= 0xfe70 && ch <= 0xfe7f && ch != USHAPE_NEW_TAIL_CHAR && ch != 0xFE75){ +isIsolatedTashkeelChar(char16_t ch){ + if(ch >= 0xfe70 && ch <= 0xfe7f && ch != NEW_TAIL_CHAR && ch != 0xFE75){ return (1 - tashkeelMedial [ch - 0xFE70]); }else if(ch >= 0xfc5e && ch <= 0xfc63){ return 1; @@ -630,7 +630,7 @@ isIsolatedTashkeelChar(UChar ch){ */ static int32_t -calculateSize(const UChar *source, int32_t sourceLength, +calculateSize(const char16_t *source, int32_t sourceLength, int32_t destSize,uint32_t options) { int32_t i = 0; @@ -652,13 +652,13 @@ int32_t destSize,uint32_t options) { if(lamAlefOption || tashkeelOption){ if((options&U_SHAPE_TEXT_DIRECTION_MASK)==U_SHAPE_TEXT_DIRECTION_VISUAL_LTR) { for(i=0;i= 0) { - if ( (lamAlefOption && dest[i] == USHAPE_LAMALEF_SPACE_SUB) || - (tashkeelOption && dest[i] == USHAPE_TASHKEEL_SPACE_SUB) ){ + if ( (lamAlefOption && dest[i] == LAMALEF_SPACE_SUB) || + (tashkeelOption && dest[i] == TASHKEEL_SPACE_SUB) ){ j++; count++; }else { @@ -832,7 +832,7 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength, } for(i=0 ;i < count; i++){ - tempbuffer[i] = USHAPE_SPACE_CHAR; + tempbuffer[i] = SPACE_CHAR; } u_memcpy(dest, tempbuffer, sourceLength); @@ -860,8 +860,8 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength, i = j = 0; count = 0; while(i < sourceLength) { - if ( (lamAlefOption && dest[i] == USHAPE_LAMALEF_SPACE_SUB) || - (tashkeelOption && dest[i] == USHAPE_TASHKEEL_SPACE_SUB) ){ + if ( (lamAlefOption && dest[i] == LAMALEF_SPACE_SUB) || + (tashkeelOption && dest[i] == TASHKEEL_SPACE_SUB) ){ j--; count++; }else { @@ -872,7 +872,7 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength, } while(count >= 0) { - tempbuffer[i] = USHAPE_SPACE_CHAR; + tempbuffer[i] = SPACE_CHAR; i--; count--; } @@ -900,15 +900,15 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength, */ static int32_t -expandCompositCharAtBegin(UChar *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) { +expandCompositCharAtBegin(char16_t *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) { int32_t i = 0,j = 0; int32_t countl = 0; - UChar *tempbuffer=NULL; + char16_t *tempbuffer=nullptr; - tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); + tempbuffer = (char16_t *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); - /* Test for NULL */ - if(tempbuffer == NULL) { + /* Test for nullptr */ + if(tempbuffer == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -916,7 +916,7 @@ expandCompositCharAtBegin(UChar *dest, int32_t sourceLength, int32_t destSize,UE uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR); i = 0; - while(dest[i] == USHAPE_SPACE_CHAR) { + while(dest[i] == SPACE_CHAR) { countl++; i++; } @@ -925,7 +925,7 @@ expandCompositCharAtBegin(UChar *dest, int32_t sourceLength, int32_t destSize,UE while(i >= 0 && j >= 0) { if( countl>0 && isLamAlefChar(dest[i])) { - tempbuffer[j] = USHAPE_LAM_CHAR; + tempbuffer[j] = LAM_CHAR; /* to ensure the array index is within the range */ U_ASSERT(dest[i] >= 0xFEF5u && dest[i]-0xFEF5u < UPRV_LENGTHOF(convertLamAlef)); @@ -960,24 +960,24 @@ expandCompositCharAtBegin(UChar *dest, int32_t sourceLength, int32_t destSize,UE */ static int32_t -expandCompositCharAtEnd(UChar *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) { +expandCompositCharAtEnd(char16_t *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) { int32_t i = 0,j = 0; int32_t countr = 0; int32_t inpsize = sourceLength; - UChar *tempbuffer=NULL; - tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); + char16_t *tempbuffer=nullptr; + tempbuffer = (char16_t *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR); - /* Test for NULL */ - if(tempbuffer == NULL) { + /* Test for nullptr */ + if(tempbuffer == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; return 0; } uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR); - while(dest[inpsize-1] == USHAPE_SPACE_CHAR) { + while(dest[inpsize-1] == SPACE_CHAR) { countr++; inpsize--; } @@ -987,7 +987,7 @@ expandCompositCharAtEnd(UChar *dest, int32_t sourceLength, int32_t destSize,UErr while(i >= 0 && j >= 0) { if( countr>0 && isLamAlefChar(dest[i]) ) { - tempbuffer[j] = USHAPE_LAM_CHAR; + tempbuffer[j] = LAM_CHAR; tempbuffer[j-1] = convertLamAlef[ dest[i] - 0xFEF5 ]; j--; countr--; @@ -1005,7 +1005,7 @@ expandCompositCharAtEnd(UChar *dest, int32_t sourceLength, int32_t destSize,UErr u_memmove(tempbuffer, tempbuffer+countr, sourceLength); if(u_strlen(tempbuffer) < sourceLength) { for(i=sourceLength-1;i>=sourceLength-countr;i--) { - tempbuffer[i] = USHAPE_SPACE_CHAR; + tempbuffer[i] = SPACE_CHAR; } } } @@ -1027,33 +1027,33 @@ expandCompositCharAtEnd(UChar *dest, int32_t sourceLength, int32_t destSize,UErr */ static int32_t -expandCompositCharAtNear(UChar *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode, +expandCompositCharAtNear(char16_t *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode, int yehHamzaOption, int seenTailOption, int lamAlefOption, struct uShapeVariables shapeVars) { int32_t i = 0; - UChar lamalefChar, yehhamzaChar; + char16_t lamalefChar, yehhamzaChar; for(i = 0 ;i<=sourceLength-1;i++) { if (seenTailOption && isSeenTailFamilyChar(dest[i])) { - if ((i>0) && (dest[i-1] == USHAPE_SPACE_CHAR) ) { + if ((i>0) && (dest[i-1] == SPACE_CHAR) ) { dest[i-1] = shapeVars.tailChar; }else { *pErrorCode=U_NO_SPACE_AVAILABLE; } }else if(yehHamzaOption && (isYehHamzaChar(dest[i])) ) { - if ((i>0) && (dest[i-1] == USHAPE_SPACE_CHAR) ) { + if ((i>0) && (dest[i-1] == SPACE_CHAR) ) { yehhamzaChar = dest[i]; - dest[i] = yehHamzaToYeh[yehhamzaChar - USHAPE_YEH_HAMZAFE_CHAR]; - dest[i-1] = USHAPE_HAMZAFE_CHAR; + dest[i] = yehHamzaToYeh[yehhamzaChar - YEH_HAMZAFE_CHAR]; + dest[i-1] = HAMZAFE_CHAR; }else { *pErrorCode=U_NO_SPACE_AVAILABLE; } }else if(lamAlefOption && isLamAlefChar(dest[i+1])) { - if(dest[i] == USHAPE_SPACE_CHAR){ + if(dest[i] == SPACE_CHAR){ lamalefChar = dest[i+1]; - dest[i+1] = USHAPE_LAM_CHAR; + dest[i+1] = LAM_CHAR; dest[i] = convertLamAlef[ lamalefChar - 0xFEF5 ]; }else { *pErrorCode=U_NO_SPACE_AVAILABLE; @@ -1080,13 +1080,13 @@ expandCompositCharAtNear(UChar *dest, int32_t sourceLength, int32_t destSize,UEr */ static int32_t -expandCompositChar(UChar *dest, int32_t sourceLength, +expandCompositChar(char16_t *dest, int32_t sourceLength, int32_t destSize,uint32_t options, UErrorCode *pErrorCode, int shapingMode,struct uShapeVariables shapeVars) { int32_t i = 0,j = 0; - UChar *tempbuffer=NULL; + char16_t *tempbuffer=nullptr; int yehHamzaOption = 0; int seenTailOption = 0; int lamAlefOption = 0; @@ -1154,10 +1154,10 @@ expandCompositChar(UChar *dest, int32_t sourceLength, if (shapingMode == 1){ if ( (options&U_SHAPE_LAMALEF_MASK) == U_SHAPE_LAMALEF_RESIZE){ destSize = calculateSize(dest,sourceLength,destSize,options); - tempbuffer = (UChar *)uprv_malloc((destSize+1)*U_SIZEOF_UCHAR); + tempbuffer = (char16_t *)uprv_malloc((destSize+1)*U_SIZEOF_UCHAR); - /* Test for NULL */ - if(tempbuffer == NULL) { + /* Test for nullptr */ + if(tempbuffer == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -1168,7 +1168,7 @@ expandCompositChar(UChar *dest, int32_t sourceLength, while(i < destSize && j < destSize) { if(isLamAlefChar(dest[i]) ) { tempbuffer[j] = convertLamAlef[ dest[i] - 0xFEF5 ]; - tempbuffer[j+1] = USHAPE_LAM_CHAR; + tempbuffer[j+1] = LAM_CHAR; j++; }else { tempbuffer[j] = dest[i]; @@ -1193,7 +1193,7 @@ expandCompositChar(UChar *dest, int32_t sourceLength, * arabic Unicode buffer in FExx Range */ static int32_t -shapeUnicode(UChar *dest, int32_t sourceLength, +shapeUnicode(char16_t *dest, int32_t sourceLength, int32_t destSize,uint32_t options, UErrorCode *pErrorCode, int tashkeelFlag, struct uShapeVariables shapeVars) { @@ -1204,8 +1204,8 @@ shapeUnicode(UChar *dest, int32_t sourceLength, unsigned int Shape; int32_t lamalef_found = 0; int32_t seenfamFound = 0, yehhamzaFound =0, tashkeelFound = 0; - UChar prevLink = 0, lastLink = 0, currLink, nextLink = 0; - UChar wLamalef; + char16_t prevLink = 0, lastLink = 0, currLink, nextLink = 0; + char16_t wLamalef; /* * Converts the input buffer from FExx Range into 06xx Range @@ -1215,9 +1215,9 @@ shapeUnicode(UChar *dest, int32_t sourceLength, */ if ((options & U_SHAPE_PRESERVE_PRESENTATION_MASK) == U_SHAPE_PRESERVE_PRESENTATION_NOOP) { for (i = 0; i < sourceLength; i++) { - UChar inputChar = dest[i]; + char16_t inputChar = dest[i]; if ( (inputChar >= 0xFB50) && (inputChar <= 0xFBFF)) { - UChar c = convertFBto06 [ (inputChar - 0xFB50) ]; + char16_t c = convertFBto06 [ (inputChar - 0xFB50) ]; if (c != 0) dest[i] = c; } else if ( (inputChar >= 0xFE70) && (inputChar <= 0xFEFC)) { @@ -1246,7 +1246,7 @@ shapeUnicode(UChar *dest, int32_t sourceLength, while (i != iend) { /* If high byte of currLink > 0 then more than one shape */ - if ((currLink & 0xFF00) > 0 || (getLink(dest[i]) & USHAPE_IRRELEVANT) != 0) { + if ((currLink & 0xFF00) > 0 || (getLink(dest[i]) & IRRELEVANT) != 0) { Nw = i + step; while (Nx < 0) { /* we need to know about next char */ if(Nw == iend) { @@ -1254,7 +1254,7 @@ shapeUnicode(UChar *dest, int32_t sourceLength, Nx = 3000; } else { nextLink = getLink(dest[Nw]); - if((nextLink & USHAPE_IRRELEVANT) == 0) { + if((nextLink & IRRELEVANT) == 0) { Nx = Nw; } else { Nw = Nw + step; @@ -1262,29 +1262,29 @@ shapeUnicode(UChar *dest, int32_t sourceLength, } } - if ( ((currLink & USHAPE_ALEFTYPE) > 0) && ((lastLink & USHAPE_LAMTYPE) > 0) ) { + if ( ((currLink & ALEFTYPE) > 0) && ((lastLink & LAMTYPE) > 0) ) { lamalef_found = 1; wLamalef = changeLamAlef(dest[i]); /*get from 0x065C-0x065f */ if ( wLamalef != 0) { - dest[i] = USHAPE_LAMALEF_SPACE_SUB; /* The default case is to drop the Alef and replace */ - dest[lastPos] =wLamalef; /* it by USHAPE_LAMALEF_SPACE_SUB which is the last character in the */ + dest[i] = LAMALEF_SPACE_SUB; /* The default case is to drop the Alef and replace */ + dest[lastPos] =wLamalef; /* it by LAMALEF_SPACE_SUB which is the last character in the */ i=lastPos; /* unicode private use area, this is done to make */ } /* sure that removeLamAlefSpaces() handles only the */ lastLink = prevLink; /* spaces generated during lamalef generation. */ - currLink = getLink(wLamalef); /* USHAPE_LAMALEF_SPACE_SUB is added here and is replaced by spaces */ + currLink = getLink(wLamalef); /* LAMALEF_SPACE_SUB is added here and is replaced by spaces */ } /* in removeLamAlefSpaces() */ - if ((i > 0) && (dest[i-1] == USHAPE_SPACE_CHAR)){ + if ((i > 0) && (dest[i-1] == SPACE_CHAR)){ if ( isSeenFamilyChar(dest[i])) { seenfamFound = 1; - } else if (dest[i] == USHAPE_YEH_HAMZA_CHAR) { + } else if (dest[i] == YEH_HAMZA_CHAR) { yehhamzaFound = 1; } } else if(i==0){ if ( isSeenFamilyChar(dest[i])){ seenfamFound = 1; - } else if (dest[i] == USHAPE_YEH_HAMZA_CHAR) { + } else if (dest[i] == YEH_HAMZA_CHAR) { yehhamzaFound = 1; } } @@ -1294,21 +1294,21 @@ shapeUnicode(UChar *dest, int32_t sourceLength, * and of character; depends on the order of the shapes * (isolated, initial, middle, final) in the compatibility area */ - Shape = shapeTable[nextLink & (USHAPE_LINKR + USHAPE_LINKL)] - [lastLink & (USHAPE_LINKR + USHAPE_LINKL)] - [currLink & (USHAPE_LINKR + USHAPE_LINKL)]; + Shape = shapeTable[nextLink & (LINKR + LINKL)] + [lastLink & (LINKR + LINKL)] + [currLink & (LINKR + LINKL)]; - if ((currLink & (USHAPE_LINKR+USHAPE_LINKL)) == 1) { + if ((currLink & (LINKR+LINKL)) == 1) { Shape &= 1; } else if(isTashkeelChar(dest[i])) { - if( (lastLink & USHAPE_LINKL) && (nextLink & USHAPE_LINKR) && (tashkeelFlag == 1) && + if( (lastLink & LINKL) && (nextLink & LINKR) && (tashkeelFlag == 1) && dest[i] != 0x064C && dest[i] != 0x064D ) { Shape = 1; - if( (nextLink&USHAPE_ALEFTYPE) == USHAPE_ALEFTYPE && (lastLink&USHAPE_LAMTYPE) == USHAPE_LAMTYPE ) { + if( (nextLink&ALEFTYPE) == ALEFTYPE && (lastLink&LAMTYPE) == LAMTYPE ) { Shape = 0; } - } else if(tashkeelFlag == 2 && dest[i] == USHAPE_SHADDA06_CHAR){ + } else if(tashkeelFlag == 2 && dest[i] == SHADDA06_CHAR){ Shape = 1; } else { Shape = 0; @@ -1316,25 +1316,25 @@ shapeUnicode(UChar *dest, int32_t sourceLength, } if ((dest[i] ^ 0x0600) < 0x100) { if ( isTashkeelChar(dest[i]) ){ - if (tashkeelFlag == 2 && dest[i] != USHAPE_SHADDA06_CHAR){ - dest[i] = USHAPE_TASHKEEL_SPACE_SUB; + if (tashkeelFlag == 2 && dest[i] != SHADDA06_CHAR){ + dest[i] = TASHKEEL_SPACE_SUB; tashkeelFound = 1; } else { /* to ensure the array index is within the range */ U_ASSERT(dest[i] >= 0x064Bu && dest[i]-0x064Bu < UPRV_LENGTHOF(IrrelevantPos)); - dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + static_cast(Shape); + dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + static_cast(Shape); } - }else if ((currLink & USHAPE_APRESENT) > 0) { - dest[i] = (UChar)(0xFB50 + (currLink >> 8) + Shape); - }else if ((currLink >> 8) > 0 && (currLink & USHAPE_IRRELEVANT) == 0) { - dest[i] = (UChar)(0xFE70 + (currLink >> 8) + Shape); + }else if ((currLink & APRESENT) > 0) { + dest[i] = (char16_t)(0xFB50 + (currLink >> 8) + Shape); + }else if ((currLink >> 8) > 0 && (currLink & IRRELEVANT) == 0) { + dest[i] = (char16_t)(0xFE70 + (currLink >> 8) + Shape); } } } /* move one notch forward */ - if ((currLink & USHAPE_IRRELEVANT) == 0) { + if ((currLink & IRRELEVANT) == 0) { prevLink = lastLink; lastLink = currLink; lastPos = i; @@ -1354,7 +1354,7 @@ shapeUnicode(UChar *dest, int32_t sourceLength, } if ( (seenfamFound != 0) || (yehhamzaFound != 0) ) { - destSize = expandCompositChar(dest, sourceLength,destSize,options,pErrorCode, USHAPE_SHAPE_MODE,shapeVars); + destSize = expandCompositChar(dest, sourceLength,destSize,options,pErrorCode, SHAPE_MODE,shapeVars); } return destSize; } @@ -1365,7 +1365,7 @@ shapeUnicode(UChar *dest, int32_t sourceLength, * arabic Unicode buffer in 06xx Range */ static int32_t -deShapeUnicode(UChar *dest, int32_t sourceLength, +deShapeUnicode(char16_t *dest, int32_t sourceLength, int32_t destSize,uint32_t options, UErrorCode *pErrorCode, struct uShapeVariables shapeVars) { int32_t i = 0; @@ -1382,18 +1382,18 @@ deShapeUnicode(UChar *dest, int32_t sourceLength, */ for(i = 0; i < sourceLength; i++) { - UChar inputChar = dest[i]; + char16_t inputChar = dest[i]; if ( (inputChar >= 0xFB50) && (inputChar <= 0xFBFF)) { /* FBxx Arabic range */ - UChar c = convertFBto06 [ (inputChar - 0xFB50) ]; + char16_t c = convertFBto06 [ (inputChar - 0xFB50) ]; if (c != 0) dest[i] = c; - } else if( (yehHamzaComposeEnabled == 1) && ((inputChar == USHAPE_HAMZA06_CHAR) || (inputChar == USHAPE_HAMZAFE_CHAR)) + } else if( (yehHamzaComposeEnabled == 1) && ((inputChar == HAMZA06_CHAR) || (inputChar == HAMZAFE_CHAR)) && (i < (sourceLength - 1)) && isAlefMaksouraChar(dest[i+1] )) { - dest[i] = USHAPE_SPACE_CHAR; - dest[i+1] = USHAPE_YEH_HAMZA_CHAR; + dest[i] = SPACE_CHAR; + dest[i+1] = YEH_HAMZA_CHAR; } else if ( (seenComposeEnabled == 1) && (isTailChar(inputChar)) && (i< (sourceLength - 1)) && (isSeenTailFamilyChar(dest[i+1])) ) { - dest[i] = USHAPE_SPACE_CHAR; + dest[i] = SPACE_CHAR; } else if (( inputChar >= 0xFE70) && (inputChar <= 0xFEF4 )) { /* FExx Arabic range */ dest[i] = convertFEto06 [ (inputChar - 0xFE70) ]; } else { @@ -1406,7 +1406,7 @@ deShapeUnicode(UChar *dest, int32_t sourceLength, destSize = sourceLength; if (lamalef_found != 0){ - destSize = expandCompositChar(dest,sourceLength,destSize,options,pErrorCode,USHAPE_DESHAPE_MODE, shapeVars); + destSize = expandCompositChar(dest,sourceLength,destSize,options,pErrorCode,DESHAPE_MODE, shapeVars); } return destSize; } @@ -1418,21 +1418,21 @@ deShapeUnicode(UChar *dest, int32_t sourceLength, */ U_CAPI int32_t U_EXPORT2 -u_shapeArabic(const UChar *source, int32_t sourceLength, - UChar *dest, int32_t destCapacity, +u_shapeArabic(const char16_t *source, int32_t sourceLength, + char16_t *dest, int32_t destCapacity, uint32_t options, UErrorCode *pErrorCode) { int32_t destLength; - struct uShapeVariables shapeVars = { USHAPE_OLD_TAIL_CHAR,U_SHAPE_LAMALEF_BEGIN,U_SHAPE_LAMALEF_END,U_SHAPE_TASHKEEL_BEGIN,U_SHAPE_TASHKEEL_END,0}; + struct uShapeVariables shapeVars = { OLD_TAIL_CHAR,U_SHAPE_LAMALEF_BEGIN,U_SHAPE_LAMALEF_END,U_SHAPE_TASHKEEL_BEGIN,U_SHAPE_TASHKEEL_END,0}; /* usual error checking */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - /* make sure that no reserved options values are used; allow dest==NULL only for preflighting */ - if( source==NULL || sourceLength<-1 || (dest==NULL && destCapacity!=0) || destCapacity<0 || + /* make sure that no reserved options values are used; allow dest==nullptr only for preflighting */ + if( source==nullptr || sourceLength<-1 || (dest==nullptr && destCapacity!=0) || destCapacity<0 || (((options&U_SHAPE_TASHKEEL_MASK) > 0) && ((options&U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED) == U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED) ) || (((options&U_SHAPE_TASHKEEL_MASK) > 0) && @@ -1478,7 +1478,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, } /* check that source and destination do not overlap */ - if( dest!=NULL && + if( dest!=nullptr && ((source<=dest && dest0) { @@ -1507,11 +1507,11 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, int i=logical_order?-1:sourceLength; int end=logical_order?sourceLength:-1; int aggregation_possible = 1; - UChar prev = 0; - UChar prevLink, currLink = 0; + char16_t prev = 0; + char16_t prevLink, currLink = 0; int newSourceLength = 0; - tempsource = (UChar *)uprv_malloc(2*sourceLength*U_SIZEOF_UCHAR); - if(tempsource == NULL) { + tempsource = (char16_t *)uprv_malloc(2*sourceLength*U_SIZEOF_UCHAR); + if(tempsource == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -1519,7 +1519,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, while ((i+=step) != end) { prevLink = currLink; currLink = getLink(source[i]); - if (aggregate_tashkeel && ((prevLink|currLink)&USHAPE_COMBINE) == USHAPE_COMBINE && aggregation_possible) { + if (aggregate_tashkeel && ((prevLink|currLink)&COMBINE) == COMBINE && aggregation_possible) { aggregation_possible = 0; tempsource[j] = (prevdestCapacity) { *pErrorCode=U_BUFFER_OVERFLOW_ERROR; - if (tempsource != NULL) uprv_free(tempsource); + if (tempsource != nullptr) uprv_free(tempsource); return outputSize; } @@ -1562,17 +1562,17 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, outputSize=UPRV_LENGTHOF(buffer); tempbuffer=buffer; } else { - tempbuffer = (UChar *)uprv_malloc(outputSize*U_SIZEOF_UCHAR); + tempbuffer = (char16_t *)uprv_malloc(outputSize*U_SIZEOF_UCHAR); - /*Test for NULL*/ - if(tempbuffer == NULL) { + /*Test for nullptr*/ + if(tempbuffer == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - if (tempsource != NULL) uprv_free(tempsource); + if (tempsource != nullptr) uprv_free(tempsource); return 0; } } u_memcpy(tempbuffer, source, sourceLength); - if (tempsource != NULL){ + if (tempsource != nullptr){ uprv_free(tempsource); } @@ -1670,7 +1670,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, * "shape" the digits in-place. */ if((options&U_SHAPE_DIGITS_MASK)!=U_SHAPE_DIGITS_NOOP) { - UChar digitBase; + char16_t digitBase; int32_t i; /* select the requested digit group */ @@ -1710,13 +1710,13 @@ u_shapeArabic(const UChar *source, int32_t sourceLength, _shapeToArabicDigitsWithContext(dest, destLength, digitBase, (UBool)((options&U_SHAPE_TEXT_DIRECTION_MASK)==U_SHAPE_TEXT_DIRECTION_LOGICAL), - FALSE); + false); break; case U_SHAPE_DIGITS_ALEN2AN_INIT_AL: _shapeToArabicDigitsWithContext(dest, destLength, digitBase, (UBool)((options&U_SHAPE_TEXT_DIRECTION_MASK)==U_SHAPE_TEXT_DIRECTION_LOGICAL), - TRUE); + true); break; default: /* will never occur because of validity checks above */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/usprep.cpp b/src/duckdb/extension/icu/third_party/icu/common/usprep.cpp deleted file mode 100644 index 8351a7737..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/usprep.cpp +++ /dev/null @@ -1,871 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* - ******************************************************************************* - * - * Copyright (C) 2003-2016, International Business Machines - * Corporation and others. All Rights Reserved. - * - ******************************************************************************* - * file name: usprep.cpp - * encoding: UTF-8 - * tab size: 8 (not used) - * indentation:4 - * - * created on: 2003jul2 - * created by: Ram Viswanadha - */ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_IDNA - -#include "unicode/usprep.h" - -#include "unicode/normalizer2.h" -#include "unicode/ustring.h" -#include "unicode/uchar.h" -#include "unicode/uversion.h" -#include "umutex.h" -#include "cmemory.h" -#include "sprpimpl.h" -#include "ustr_imp.h" -#include "uhash.h" -#include "cstring.h" -#include "udataswp.h" -#include "ucln_cmn.h" -#include "ubidi_props.h" -#include "uprops.h" - -U_NAMESPACE_USE - -U_CDECL_BEGIN - -/* -Static cache for already opened StringPrep profiles -*/ -static UHashtable *SHARED_DATA_HASHTABLE = NULL; -static icu::UInitOnce gSharedDataInitOnce = U_INITONCE_INITIALIZER; - -static UMutex usprepMutex; -/* format version of spp file */ -//static uint8_t formatVersion[4]={ 0, 0, 0, 0 }; - -/* the Unicode version of the sprep data */ -static UVersionInfo dataVersion={ 0, 0, 0, 0 }; - -/* Profile names must be aligned to UStringPrepProfileType */ -static const char * const PROFILE_NAMES[] = { - "rfc3491", /* USPREP_RFC3491_NAMEPREP */ - "rfc3530cs", /* USPREP_RFC3530_NFS4_CS_PREP */ - "rfc3530csci", /* USPREP_RFC3530_NFS4_CS_PREP_CI */ - "rfc3491", /* USPREP_RFC3530_NSF4_CIS_PREP */ - "rfc3530mixp", /* USPREP_RFC3530_NSF4_MIXED_PREP_PREFIX */ - "rfc3491", /* USPREP_RFC3530_NSF4_MIXED_PREP_SUFFIX */ - "rfc3722", /* USPREP_RFC3722_ISCSI */ - "rfc3920node", /* USPREP_RFC3920_NODEPREP */ - "rfc3920res", /* USPREP_RFC3920_RESOURCEPREP */ - "rfc4011", /* USPREP_RFC4011_MIB */ - "rfc4013", /* USPREP_RFC4013_SASLPREP */ - "rfc4505", /* USPREP_RFC4505_TRACE */ - "rfc4518", /* USPREP_RFC4518_LDAP */ - "rfc4518ci", /* USPREP_RFC4518_LDAP_CI */ -}; - -static UBool U_CALLCONV -isSPrepAcceptable(void * /* context */, - const char * /* type */, - const char * /* name */, - const UDataInfo *pInfo) { - if( - pInfo->size>=20 && - pInfo->isBigEndian==U_IS_BIG_ENDIAN && - pInfo->charsetFamily==U_CHARSET_FAMILY && - pInfo->dataFormat[0]==0x53 && /* dataFormat="SPRP" */ - pInfo->dataFormat[1]==0x50 && - pInfo->dataFormat[2]==0x52 && - pInfo->dataFormat[3]==0x50 && - pInfo->formatVersion[0]==3 && - pInfo->formatVersion[2]==UTRIE_SHIFT && - pInfo->formatVersion[3]==UTRIE_INDEX_SHIFT - ) { - //uprv_memcpy(formatVersion, pInfo->formatVersion, 4); - uprv_memcpy(dataVersion, pInfo->dataVersion, 4); - return TRUE; - } else { - return FALSE; - } -} - -static int32_t U_CALLCONV -getSPrepFoldingOffset(uint32_t data) { - - return (int32_t)data; - -} - -/* hashes an entry */ -static int32_t U_CALLCONV -hashEntry(const UHashTok parm) { - UStringPrepKey *b = (UStringPrepKey *)parm.pointer; - UHashTok namekey, pathkey; - namekey.pointer = b->name; - pathkey.pointer = b->path; - uint32_t unsignedHash = static_cast(uhash_hashChars(namekey)) + - 37u * static_cast(uhash_hashChars(pathkey)); - return static_cast(unsignedHash); -} - -/* compares two entries */ -static UBool U_CALLCONV -compareEntries(const UHashTok p1, const UHashTok p2) { - UStringPrepKey *b1 = (UStringPrepKey *)p1.pointer; - UStringPrepKey *b2 = (UStringPrepKey *)p2.pointer; - UHashTok name1, name2, path1, path2; - name1.pointer = b1->name; - name2.pointer = b2->name; - path1.pointer = b1->path; - path2.pointer = b2->path; - return ((UBool)(uhash_compareChars(name1, name2) & - uhash_compareChars(path1, path2))); -} - -static void -usprep_unload(UStringPrepProfile* data){ - udata_close(data->sprepData); -} - -static int32_t -usprep_internal_flushCache(UBool noRefCount){ - UStringPrepProfile *profile = NULL; - UStringPrepKey *key = NULL; - int32_t pos = UHASH_FIRST; - int32_t deletedNum = 0; - const UHashElement *e; - - /* - * if shared data hasn't even been lazy evaluated yet - * return 0 - */ - umtx_lock(&usprepMutex); - if (SHARED_DATA_HASHTABLE == NULL) { - umtx_unlock(&usprepMutex); - return 0; - } - - /*creates an enumeration to iterate through every element in the table */ - while ((e = uhash_nextElement(SHARED_DATA_HASHTABLE, &pos)) != NULL) - { - profile = (UStringPrepProfile *) e->value.pointer; - key = (UStringPrepKey *) e->key.pointer; - - if ((noRefCount== FALSE && profile->refCount == 0) || - noRefCount== TRUE) { - deletedNum++; - uhash_removeElement(SHARED_DATA_HASHTABLE, e); - - /* unload the data */ - usprep_unload(profile); - - if(key->name != NULL) { - uprv_free(key->name); - key->name=NULL; - } - if(key->path != NULL) { - uprv_free(key->path); - key->path=NULL; - } - uprv_free(profile); - uprv_free(key); - } - - } - umtx_unlock(&usprepMutex); - - return deletedNum; -} - -/* Works just like ucnv_flushCache() -static int32_t -usprep_flushCache(){ - return usprep_internal_flushCache(FALSE); -} -*/ - -static UBool U_CALLCONV usprep_cleanup(void){ - if (SHARED_DATA_HASHTABLE != NULL) { - usprep_internal_flushCache(TRUE); - if (SHARED_DATA_HASHTABLE != NULL && uhash_count(SHARED_DATA_HASHTABLE) == 0) { - uhash_close(SHARED_DATA_HASHTABLE); - SHARED_DATA_HASHTABLE = NULL; - } - } - gSharedDataInitOnce.reset(); - return (SHARED_DATA_HASHTABLE == NULL); -} -U_CDECL_END - - -/** Initializes the cache for resources */ -static void U_CALLCONV -createCache(UErrorCode &status) { - SHARED_DATA_HASHTABLE = uhash_open(hashEntry, compareEntries, NULL, &status); - if (U_FAILURE(status)) { - SHARED_DATA_HASHTABLE = NULL; - } - ucln_common_registerCleanup(UCLN_COMMON_USPREP, usprep_cleanup); -} - -static void -initCache(UErrorCode *status) { - umtx_initOnce(gSharedDataInitOnce, &createCache, *status); -} - -static UBool U_CALLCONV -loadData(UStringPrepProfile* profile, - const char* path, - const char* name, - const char* type, - UErrorCode* errorCode) { - /* load Unicode SPREP data from file */ - UTrie _sprepTrie={ 0,0,0,0,0,0,0 }; - UDataMemory *dataMemory; - const int32_t *p=NULL; - const uint8_t *pb; - UVersionInfo normUnicodeVersion; - int32_t normUniVer, sprepUniVer, normCorrVer; - - if(errorCode==NULL || U_FAILURE(*errorCode)) { - return 0; - } - - /* open the data outside the mutex block */ - //TODO: change the path - dataMemory=udata_openChoice(path, type, name, isSPrepAcceptable, NULL, errorCode); - if(U_FAILURE(*errorCode)) { - return FALSE; - } - - p=(const int32_t *)udata_getMemory(dataMemory); - pb=(const uint8_t *)(p+_SPREP_INDEX_TOP); - utrie_unserialize(&_sprepTrie, pb, p[_SPREP_INDEX_TRIE_SIZE], errorCode); - _sprepTrie.getFoldingOffset=getSPrepFoldingOffset; - - - if(U_FAILURE(*errorCode)) { - udata_close(dataMemory); - return FALSE; - } - - /* in the mutex block, set the data for this process */ - umtx_lock(&usprepMutex); - if(profile->sprepData==NULL) { - profile->sprepData=dataMemory; - dataMemory=NULL; - uprv_memcpy(&profile->indexes, p, sizeof(profile->indexes)); - uprv_memcpy(&profile->sprepTrie, &_sprepTrie, sizeof(UTrie)); - } else { - p=(const int32_t *)udata_getMemory(profile->sprepData); - } - umtx_unlock(&usprepMutex); - /* initialize some variables */ - profile->mappingData=(uint16_t *)((uint8_t *)(p+_SPREP_INDEX_TOP)+profile->indexes[_SPREP_INDEX_TRIE_SIZE]); - - u_getUnicodeVersion(normUnicodeVersion); - normUniVer = (normUnicodeVersion[0] << 24) + (normUnicodeVersion[1] << 16) + - (normUnicodeVersion[2] << 8 ) + (normUnicodeVersion[3]); - sprepUniVer = (dataVersion[0] << 24) + (dataVersion[1] << 16) + - (dataVersion[2] << 8 ) + (dataVersion[3]); - normCorrVer = profile->indexes[_SPREP_NORM_CORRECTNS_LAST_UNI_VERSION]; - - if(U_FAILURE(*errorCode)){ - udata_close(dataMemory); - return FALSE; - } - if( normUniVer < sprepUniVer && /* the Unicode version of SPREP file must be less than the Unicode Vesion of the normalization data */ - normUniVer < normCorrVer && /* the Unicode version of the NormalizationCorrections.txt file should be less than the Unicode Vesion of the normalization data */ - ((profile->indexes[_SPREP_OPTIONS] & _SPREP_NORMALIZATION_ON) > 0) /* normalization turned on*/ - ){ - *errorCode = U_INVALID_FORMAT_ERROR; - udata_close(dataMemory); - return FALSE; - } - profile->isDataLoaded = TRUE; - - /* if a different thread set it first, then close the extra data */ - if(dataMemory!=NULL) { - udata_close(dataMemory); /* NULL if it was set correctly */ - } - - - return profile->isDataLoaded; -} - -static UStringPrepProfile* -usprep_getProfile(const char* path, - const char* name, - UErrorCode *status){ - - UStringPrepProfile* profile = NULL; - - initCache(status); - - if(U_FAILURE(*status)){ - return NULL; - } - - UStringPrepKey stackKey; - /* - * const is cast way to save malloc, strcpy and free calls - * we use the passed in pointers for fetching the data from the - * hash table which is safe - */ - stackKey.name = (char*) name; - stackKey.path = (char*) path; - - /* fetch the data from the cache */ - umtx_lock(&usprepMutex); - profile = (UStringPrepProfile*) (uhash_get(SHARED_DATA_HASHTABLE,&stackKey)); - if(profile != NULL) { - profile->refCount++; - } - umtx_unlock(&usprepMutex); - - if(profile == NULL) { - /* else load the data and put the data in the cache */ - LocalMemory newProfile; - if(newProfile.allocateInsteadAndReset() == NULL) { - *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - - /* load the data */ - if(!loadData(newProfile.getAlias(), path, name, _SPREP_DATA_TYPE, status) || U_FAILURE(*status) ){ - return NULL; - } - - /* get the options */ - newProfile->doNFKC = (UBool)((newProfile->indexes[_SPREP_OPTIONS] & _SPREP_NORMALIZATION_ON) > 0); - newProfile->checkBiDi = (UBool)((newProfile->indexes[_SPREP_OPTIONS] & _SPREP_CHECK_BIDI_ON) > 0); - - LocalMemory key; - LocalMemory keyName; - LocalMemory keyPath; - if( key.allocateInsteadAndReset() == NULL || - keyName.allocateInsteadAndCopy(static_cast(uprv_strlen(name)+1)) == NULL || - (path != NULL && - keyPath.allocateInsteadAndCopy(static_cast(uprv_strlen(path)+1)) == NULL) - ) { - *status = U_MEMORY_ALLOCATION_ERROR; - usprep_unload(newProfile.getAlias()); - return NULL; - } - - umtx_lock(&usprepMutex); - // If another thread already inserted the same key/value, refcount and cleanup our thread data - profile = (UStringPrepProfile*) (uhash_get(SHARED_DATA_HASHTABLE,&stackKey)); - if(profile != NULL) { - profile->refCount++; - usprep_unload(newProfile.getAlias()); - } - else { - /* initialize the key members */ - key->name = keyName.orphan(); - uprv_strcpy(key->name, name); - if(path != NULL){ - key->path = keyPath.orphan(); - uprv_strcpy(key->path, path); - } - profile = newProfile.orphan(); - - /* add the data object to the cache */ - profile->refCount = 1; - uhash_put(SHARED_DATA_HASHTABLE, key.orphan(), profile, status); - } - umtx_unlock(&usprepMutex); - } - - return profile; -} - -U_CAPI UStringPrepProfile* U_EXPORT2 -usprep_open(const char* path, - const char* name, - UErrorCode* status){ - - if(status == NULL || U_FAILURE(*status)){ - return NULL; - } - - /* initialize the profile struct members */ - return usprep_getProfile(path,name,status); -} - -U_CAPI UStringPrepProfile* U_EXPORT2 -usprep_openByType(UStringPrepProfileType type, - UErrorCode* status) { - if(status == NULL || U_FAILURE(*status)){ - return NULL; - } - int32_t index = (int32_t)type; - if (index < 0 || index >= UPRV_LENGTHOF(PROFILE_NAMES)) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; - } - return usprep_open(NULL, PROFILE_NAMES[index], status); -} - -U_CAPI void U_EXPORT2 -usprep_close(UStringPrepProfile* profile){ - if(profile==NULL){ - return; - } - - umtx_lock(&usprepMutex); - /* decrement the ref count*/ - if(profile->refCount > 0){ - profile->refCount--; - } - umtx_unlock(&usprepMutex); - -} - -U_CFUNC void -uprv_syntaxError(const UChar* rules, - int32_t pos, - int32_t rulesLen, - UParseError* parseError){ - if(parseError == NULL){ - return; - } - parseError->offset = pos; - parseError->line = 0 ; // we are not using line numbers - - // for pre-context - int32_t start = (pos < U_PARSE_CONTEXT_LEN)? 0 : (pos - (U_PARSE_CONTEXT_LEN-1)); - int32_t limit = pos; - - u_memcpy(parseError->preContext,rules+start,limit-start); - //null terminate the buffer - parseError->preContext[limit-start] = 0; - - // for post-context; include error rules[pos] - start = pos; - limit = start + (U_PARSE_CONTEXT_LEN-1); - if (limit > rulesLen) { - limit = rulesLen; - } - if (start < rulesLen) { - u_memcpy(parseError->postContext,rules+start,limit-start); - } - //null terminate the buffer - parseError->postContext[limit-start]= 0; -} - - -static inline UStringPrepType -getValues(uint16_t trieWord, int16_t& value, UBool& isIndex){ - - UStringPrepType type; - if(trieWord == 0){ - /* - * Initial value stored in the mapping table - * just return USPREP_TYPE_LIMIT .. so that - * the source codepoint is copied to the destination - */ - type = USPREP_TYPE_LIMIT; - isIndex =FALSE; - value = 0; - }else if(trieWord >= _SPREP_TYPE_THRESHOLD){ - type = (UStringPrepType) (trieWord - _SPREP_TYPE_THRESHOLD); - isIndex =FALSE; - value = 0; - }else{ - /* get the type */ - type = USPREP_MAP; - /* ascertain if the value is index or delta */ - if(trieWord & 0x02){ - isIndex = TRUE; - value = trieWord >> 2; //mask off the lower 2 bits and shift - }else{ - isIndex = FALSE; - value = (int16_t)trieWord; - value = (value >> 2); - } - - if((trieWord>>2) == _SPREP_MAX_INDEX_VALUE){ - type = USPREP_DELETE; - isIndex =FALSE; - value = 0; - } - } - return type; -} - -// TODO: change to writing to UnicodeString not UChar * -static int32_t -usprep_map( const UStringPrepProfile* profile, - const UChar* src, int32_t srcLength, - UChar* dest, int32_t destCapacity, - int32_t options, - UParseError* parseError, - UErrorCode* status ){ - - uint16_t result; - int32_t destIndex=0; - int32_t srcIndex; - UBool allowUnassigned = (UBool) ((options & USPREP_ALLOW_UNASSIGNED)>0); - UStringPrepType type; - int16_t value; - UBool isIndex; - const int32_t* indexes = profile->indexes; - - // no error checking the caller check for error and arguments - // no string length check the caller finds out the string length - - for(srcIndex=0;srcIndexsprepTrie,ch,result); - - type = getValues(result, value, isIndex); - - // check if the source codepoint is unassigned - if(type == USPREP_UNASSIGNED && allowUnassigned == FALSE){ - - uprv_syntaxError(src,srcIndex-U16_LENGTH(ch), srcLength,parseError); - *status = U_STRINGPREP_UNASSIGNED_ERROR; - return 0; - - }else if(type == USPREP_MAP){ - - int32_t index, length; - - if(isIndex){ - index = value; - if(index >= indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] && - index < indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START]){ - length = 1; - }else if(index >= indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START] && - index < indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START]){ - length = 2; - }else if(index >= indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START] && - index < indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START]){ - length = 3; - }else{ - length = profile->mappingData[index++]; - - } - - /* copy mapping to destination */ - for(int32_t i=0; i< length; i++){ - if(destIndex < destCapacity ){ - dest[destIndex] = profile->mappingData[index+i]; - } - destIndex++; /* for pre-flighting */ - } - continue; - }else{ - // subtract the delta to arrive at the code point - ch -= value; - } - - }else if(type==USPREP_DELETE){ - // just consume the codepoint and contine - continue; - } - //copy the code point into destination - if(ch <= 0xFFFF){ - if(destIndex < destCapacity ){ - dest[destIndex] = (UChar)ch; - } - destIndex++; - }else{ - if(destIndex+1 < destCapacity ){ - dest[destIndex] = U16_LEAD(ch); - dest[destIndex+1] = U16_TRAIL(ch); - } - destIndex +=2; - } - - } - - return u_terminateUChars(dest, destCapacity, destIndex, status); -} - -/* - 1) Map -- For each character in the input, check if it has a mapping - and, if so, replace it with its mapping. - - 2) Normalize -- Possibly normalize the result of step 1 using Unicode - normalization. - - 3) Prohibit -- Check for any characters that are not allowed in the - output. If any are found, return an error. - - 4) Check bidi -- Possibly check for right-to-left characters, and if - any are found, make sure that the whole string satisfies the - requirements for bidirectional strings. If the string does not - satisfy the requirements for bidirectional strings, return an - error. - [Unicode3.2] defines several bidirectional categories; each character - has one bidirectional category assigned to it. For the purposes of - the requirements below, an "RandALCat character" is a character that - has Unicode bidirectional categories "R" or "AL"; an "LCat character" - is a character that has Unicode bidirectional category "L". Note - - - that there are many characters which fall in neither of the above - definitions; Latin digits ( through ) are examples of - this because they have bidirectional category "EN". - - In any profile that specifies bidirectional character handling, all - three of the following requirements MUST be met: - - 1) The characters in section 5.8 MUST be prohibited. - - 2) If a string contains any RandALCat character, the string MUST NOT - contain any LCat character. - - 3) If a string contains any RandALCat character, a RandALCat - character MUST be the first character of the string, and a - RandALCat character MUST be the last character of the string. -*/ -U_CAPI int32_t U_EXPORT2 -usprep_prepare( const UStringPrepProfile* profile, - const UChar* src, int32_t srcLength, - UChar* dest, int32_t destCapacity, - int32_t options, - UParseError* parseError, - UErrorCode* status ){ - - // check error status - if(U_FAILURE(*status)){ - return 0; - } - - //check arguments - if(profile==NULL || - (src==NULL ? srcLength!=0 : srcLength<-1) || - (dest==NULL ? destCapacity!=0 : destCapacity<0)) { - *status=U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - - //get the string length - if(srcLength < 0){ - srcLength = u_strlen(src); - } - // map - UnicodeString s1; - UChar *b1 = s1.getBuffer(srcLength); - if(b1==NULL){ - *status = U_MEMORY_ALLOCATION_ERROR; - return 0; - } - int32_t b1Len = usprep_map(profile, src, srcLength, - b1, s1.getCapacity(), options, parseError, status); - s1.releaseBuffer(U_SUCCESS(*status) ? b1Len : 0); - - if(*status == U_BUFFER_OVERFLOW_ERROR){ - // redo processing of string - /* we do not have enough room so grow the buffer*/ - b1 = s1.getBuffer(b1Len); - if(b1==NULL){ - *status = U_MEMORY_ALLOCATION_ERROR; - return 0; - } - - *status = U_ZERO_ERROR; // reset error - b1Len = usprep_map(profile, src, srcLength, - b1, s1.getCapacity(), options, parseError, status); - s1.releaseBuffer(U_SUCCESS(*status) ? b1Len : 0); - } - if(U_FAILURE(*status)){ - return 0; - } - - // normalize - UnicodeString s2; - if(profile->doNFKC){ - const Normalizer2 *n2 = Normalizer2::getNFKCInstance(*status); - FilteredNormalizer2 fn2(*n2, *uniset_getUnicode32Instance(*status)); - if(U_FAILURE(*status)){ - return 0; - } - fn2.normalize(s1, s2, *status); - }else{ - s2.fastCopyFrom(s1); - } - if(U_FAILURE(*status)){ - return 0; - } - - // Prohibit and checkBiDi in one pass - const UChar *b2 = s2.getBuffer(); - int32_t b2Len = s2.length(); - UCharDirection direction=U_CHAR_DIRECTION_COUNT, firstCharDir=U_CHAR_DIRECTION_COUNT; - UBool leftToRight=FALSE, rightToLeft=FALSE; - int32_t rtlPos =-1, ltrPos =-1; - - for(int32_t b2Index=0; b2IndexsprepTrie,ch,result); - - int16_t value; - UBool isIndex; - UStringPrepType type = getValues(result, value, isIndex); - - if( type == USPREP_PROHIBITED || - ((result < _SPREP_TYPE_THRESHOLD) && (result & 0x01) /* first bit says it the code point is prohibited*/) - ){ - *status = U_STRINGPREP_PROHIBITED_ERROR; - uprv_syntaxError(b2, b2Index-U16_LENGTH(ch), b2Len, parseError); - return 0; - } - - if(profile->checkBiDi) { - direction = ubidi_getClass(ch); - if(firstCharDir == U_CHAR_DIRECTION_COUNT){ - firstCharDir = direction; - } - if(direction == U_LEFT_TO_RIGHT){ - leftToRight = TRUE; - ltrPos = b2Index-1; - } - if(direction == U_RIGHT_TO_LEFT || direction == U_RIGHT_TO_LEFT_ARABIC){ - rightToLeft = TRUE; - rtlPos = b2Index-1; - } - } - } - if(profile->checkBiDi == TRUE){ - // satisfy 2 - if( leftToRight == TRUE && rightToLeft == TRUE){ - *status = U_STRINGPREP_CHECK_BIDI_ERROR; - uprv_syntaxError(b2,(rtlPos>ltrPos) ? rtlPos : ltrPos, b2Len, parseError); - return 0; - } - - //satisfy 3 - if( rightToLeft == TRUE && - !((firstCharDir == U_RIGHT_TO_LEFT || firstCharDir == U_RIGHT_TO_LEFT_ARABIC) && - (direction == U_RIGHT_TO_LEFT || direction == U_RIGHT_TO_LEFT_ARABIC)) - ){ - *status = U_STRINGPREP_CHECK_BIDI_ERROR; - uprv_syntaxError(b2, rtlPos, b2Len, parseError); - return FALSE; - } - } - return s2.extract(dest, destCapacity, *status); -} - - -/* data swapping ------------------------------------------------------------ */ - -U_CAPI int32_t U_EXPORT2 -usprep_swap(const UDataSwapper *ds, - const void *inData, int32_t length, void *outData, - UErrorCode *pErrorCode) { - const UDataInfo *pInfo; - int32_t headerSize; - - const uint8_t *inBytes; - uint8_t *outBytes; - - const int32_t *inIndexes; - int32_t indexes[16]; - - int32_t i, offset, count, size; - - /* udata_swapDataHeader checks the arguments */ - headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode); - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { - return 0; - } - - /* check data format and format version */ - pInfo=(const UDataInfo *)((const char *)inData+4); - if(!( - pInfo->dataFormat[0]==0x53 && /* dataFormat="SPRP" */ - pInfo->dataFormat[1]==0x50 && - pInfo->dataFormat[2]==0x52 && - pInfo->dataFormat[3]==0x50 && - pInfo->formatVersion[0]==3 - )) { - udata_printError(ds, "usprep_swap(): data format %02x.%02x.%02x.%02x (format version %02x) is not recognized as StringPrep .spp data\n", - pInfo->dataFormat[0], pInfo->dataFormat[1], - pInfo->dataFormat[2], pInfo->dataFormat[3], - pInfo->formatVersion[0]); - *pErrorCode=U_UNSUPPORTED_ERROR; - return 0; - } - - inBytes=(const uint8_t *)inData+headerSize; - outBytes=(uint8_t *)outData+headerSize; - - inIndexes=(const int32_t *)inBytes; - - if(length>=0) { - length-=headerSize; - if(length<16*4) { - udata_printError(ds, "usprep_swap(): too few bytes (%d after header) for StringPrep .spp data\n", - length); - *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; - return 0; - } - } - - /* read the first 16 indexes (ICU 2.8/format version 3: _SPREP_INDEX_TOP==16, might grow) */ - for(i=0; i<16; ++i) { - indexes[i]=udata_readInt32(ds, inIndexes[i]); - } - - /* calculate the total length of the data */ - size= - 16*4+ /* size of indexes[] */ - indexes[_SPREP_INDEX_TRIE_SIZE]+ - indexes[_SPREP_INDEX_MAPPING_DATA_SIZE]; - - if(length>=0) { - if(lengthswapArray32(ds, inBytes, count, outBytes, pErrorCode); - offset+=count; - - /* swap the UTrie */ - count=indexes[_SPREP_INDEX_TRIE_SIZE]; - utrie_swap(ds, inBytes+offset, count, outBytes+offset, pErrorCode); - offset+=count; - - /* swap the uint16_t mappingTable[] */ - count=indexes[_SPREP_INDEX_MAPPING_DATA_SIZE]; - ds->swapArray16(ds, inBytes+offset, count, outBytes+offset, pErrorCode); - //offset+=count; - } - - return headerSize+size; -} - -#endif /* #if !UCONFIG_NO_IDNA */ diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustack.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustack.cpp index fb314b0eb..5b15efcd7 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustack.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ustack.cpp @@ -35,17 +35,16 @@ UStack::UStack(UObjectDeleter *d, UElementsAreEqual *c, int32_t initialCapacity, UStack::~UStack() {} -void* UStack::pop(void) { +void* UStack::pop() { int32_t n = size() - 1; - void* result = 0; + void* result = nullptr; if (n >= 0) { - result = elementAt(n); - removeElementAt(n); + result = orphanElementAt(n); } return result; } -int32_t UStack::popi(void) { +int32_t UStack::popi() { int32_t n = size() - 1; int32_t result = 0; if (n >= 0) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.cpp deleted file mode 100644 index 60918f06e..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.cpp +++ /dev/null @@ -1,256 +0,0 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ******************************************************************************* -// * -// * Copyright (C) 1998-2014, International Business Machines -// * Corporation and others. All Rights Reserved. -// * -// ******************************************************************************* -// * file name: ustr_cnv.cpp -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2004aug24 -// * created by: Markus W. Scherer -// * -// * Character conversion functions moved here from ustring.c -// */ - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_CONVERSION - -// #include "unicode/ustring.h" -// #include "unicode/ucnv.h" -// #include "cstring.h" -// #include "cmemory.h" -// #include "umutex.h" -// #include "ustr_cnv.h" -// #include "ucnv_bld.h" - -// /* mutexed access to a shared default converter ----------------------------- */ - -// static UConverter *gDefaultConverter = NULL; - -// U_CAPI UConverter* U_EXPORT2 -// u_getDefaultConverter(UErrorCode *status) -// { -// UConverter *converter = NULL; - -// if (gDefaultConverter != NULL) { -// icu::umtx_lock(NULL); - -// /* need to check to make sure it wasn't taken out from under us */ -// if (gDefaultConverter != NULL) { -// converter = gDefaultConverter; -// gDefaultConverter = NULL; -// } -// icu::umtx_unlock(NULL); -// } - -// /* if the cache was empty, create a converter */ -// if(converter == NULL) { -// converter = ucnv_open(NULL, status); -// if(U_FAILURE(*status)) { -// ucnv_close(converter); -// converter = NULL; -// } -// } - -// return converter; -// } - -// U_CAPI void U_EXPORT2 -// u_releaseDefaultConverter(UConverter *converter) -// { -// if(gDefaultConverter == NULL) { -// if (converter != NULL) { -// ucnv_reset(converter); -// } -// ucnv_enableCleanup(); -// icu::umtx_lock(NULL); -// if(gDefaultConverter == NULL) { -// gDefaultConverter = converter; -// converter = NULL; -// } -// icu::umtx_unlock(NULL); -// } - -// if(converter != NULL) { -// ucnv_close(converter); -// } -// } - -// U_CAPI void U_EXPORT2 -// u_flushDefaultConverter() -// { -// UConverter *converter = NULL; - -// if (gDefaultConverter != NULL) { -// icu::umtx_lock(NULL); - -// /* need to check to make sure it wasn't taken out from under us */ -// if (gDefaultConverter != NULL) { -// converter = gDefaultConverter; -// gDefaultConverter = NULL; -// } -// icu::umtx_unlock(NULL); -// } - -// /* if the cache was populated, flush it */ -// if(converter != NULL) { -// ucnv_close(converter); -// } -// } - - -// /* conversions between char* and UChar* ------------------------------------- */ - -// /* maximum string length for u_uastrcpy() and u_austrcpy() implementations */ -// #define MAX_STRLEN 0x0FFFFFFF - -// /* -// returns the minimum of (the length of the null-terminated string) and n. -// */ -// static int32_t u_astrnlen(const char *s1, int32_t n) -// { -// int32_t len = 0; - -// if (s1) -// { -// while (n-- && *(s1++)) -// { -// len++; -// } -// } -// return len; -// } - -// U_CAPI UChar* U_EXPORT2 -// u_uastrncpy(UChar *ucs1, -// const char *s2, -// int32_t n) -// { -// UChar *target = ucs1; -// UErrorCode err = U_ZERO_ERROR; -// UConverter *cnv = u_getDefaultConverter(&err); -// if(U_SUCCESS(err) && cnv != NULL) { -// ucnv_reset(cnv); -// ucnv_toUnicode(cnv, -// &target, -// ucs1+n, -// &s2, -// s2+u_astrnlen(s2, n), -// NULL, -// TRUE, -// &err); -// ucnv_reset(cnv); /* be good citizens */ -// u_releaseDefaultConverter(cnv); -// if(U_FAILURE(err) && (err != U_BUFFER_OVERFLOW_ERROR) ) { -// *ucs1 = 0; /* failure */ -// } -// if(target < (ucs1+n)) { /* U_BUFFER_OVERFLOW_ERROR isn't an err, just means no termination will happen. */ -// *target = 0; /* terminate */ -// } -// } else { -// *ucs1 = 0; -// } -// return ucs1; -// } - -// U_CAPI UChar* U_EXPORT2 -// u_uastrcpy(UChar *ucs1, -// const char *s2 ) -// { -// UErrorCode err = U_ZERO_ERROR; -// UConverter *cnv = u_getDefaultConverter(&err); -// if(U_SUCCESS(err) && cnv != NULL) { -// ucnv_toUChars(cnv, -// ucs1, -// MAX_STRLEN, -// s2, -// (int32_t)uprv_strlen(s2), -// &err); -// u_releaseDefaultConverter(cnv); -// if(U_FAILURE(err)) { -// *ucs1 = 0; -// } -// } else { -// *ucs1 = 0; -// } -// return ucs1; -// } - -// /* -// returns the minimum of (the length of the null-terminated string) and n. -// */ -// static int32_t u_ustrnlen(const UChar *ucs1, int32_t n) -// { -// int32_t len = 0; - -// if (ucs1) -// { -// while (n-- && *(ucs1++)) -// { -// len++; -// } -// } -// return len; -// } - -// U_CAPI char* U_EXPORT2 -// u_austrncpy(char *s1, -// const UChar *ucs2, -// int32_t n) -// { -// char *target = s1; -// UErrorCode err = U_ZERO_ERROR; -// UConverter *cnv = u_getDefaultConverter(&err); -// if(U_SUCCESS(err) && cnv != NULL) { -// ucnv_reset(cnv); -// ucnv_fromUnicode(cnv, -// &target, -// s1+n, -// &ucs2, -// ucs2+u_ustrnlen(ucs2, n), -// NULL, -// TRUE, -// &err); -// ucnv_reset(cnv); /* be good citizens */ -// u_releaseDefaultConverter(cnv); -// if(U_FAILURE(err) && (err != U_BUFFER_OVERFLOW_ERROR) ) { -// *s1 = 0; /* failure */ -// } -// if(target < (s1+n)) { /* U_BUFFER_OVERFLOW_ERROR isn't an err, just means no termination will happen. */ -// *target = 0; /* terminate */ -// } -// } else { -// *s1 = 0; -// } -// return s1; -// } - -// U_CAPI char* U_EXPORT2 -// u_austrcpy(char *s1, -// const UChar *ucs2 ) -// { -// UErrorCode err = U_ZERO_ERROR; -// UConverter *cnv = u_getDefaultConverter(&err); -// if(U_SUCCESS(err) && cnv != NULL) { -// int32_t len = ucnv_fromUChars(cnv, -// s1, -// MAX_STRLEN, -// ucs2, -// -1, -// &err); -// u_releaseDefaultConverter(cnv); -// s1[len] = 0; -// } else { -// *s1 = 0; -// } -// return s1; -// } - -// #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.h b/src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.h index 4aff45aa7..861e3ebff 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.h @@ -1,51 +1,51 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 1999-2010, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * file name: ustr_cnv.h -// * encoding: UTF-8 -// * tab size: 8 (not used) -// * indentation:4 -// * -// * created on: 2004Aug27 -// * created by: George Rhoten -// */ - -// #ifndef USTR_CNV_IMP_H -// #define USTR_CNV_IMP_H - -// #include "unicode/utypes.h" -// #include "unicode/ucnv.h" - -// #if !UCONFIG_NO_CONVERSION - -// /** -// * Get the default converter. This is a commonly used converter -// * that is used for the ustring and UnicodeString API. -// * Remember to use the u_releaseDefaultConverter when you are done. -// * @internal -// */ -// U_CAPI UConverter* U_EXPORT2 -// u_getDefaultConverter(UErrorCode *status); - - -// /** -// * Release the default converter to the converter cache. -// * @internal -// */ -// U_CAPI void U_EXPORT2 -// u_releaseDefaultConverter(UConverter *converter); - -// /** -// * Flush the default converter, if cached. -// * @internal -// */ -// U_CAPI void U_EXPORT2 -// u_flushDefaultConverter(void); - -// #endif - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2010, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: ustr_cnv.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004Aug27 +* created by: George Rhoten +*/ + +#ifndef USTR_CNV_IMP_H +#define USTR_CNV_IMP_H + +#include "unicode/utypes.h" +#include "unicode/ucnv.h" + +#if !UCONFIG_NO_CONVERSION + +/** + * Get the default converter. This is a commonly used converter + * that is used for the ustring and UnicodeString API. + * Remember to use the u_releaseDefaultConverter when you are done. + * @internal + */ +U_CAPI UConverter* U_EXPORT2 +u_getDefaultConverter(UErrorCode *status); + + +/** + * Release the default converter to the converter cache. + * @internal + */ +U_CAPI void U_EXPORT2 +u_releaseDefaultConverter(UConverter *converter); + +/** + * Flush the default converter, if cached. + * @internal + */ +U_CAPI void U_EXPORT2 +u_flushDefaultConverter(void); + +#endif + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustr_imp.h b/src/duckdb/extension/icu/third_party/icu/common/ustr_imp.h index c555ee37e..3c4b9cc2a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustr_imp.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ustr_imp.h @@ -29,7 +29,7 @@ /** * Compare two strings in code point order or code unit order. * Works in strcmp style (both lengths -1), - * strncmp style (lengths equal and >=0, flag TRUE), + * strncmp style (lengths equal and >=0, flag true), * and memcmp/UnicodeString style (at least one length >=0). */ U_CFUNC int32_t U_EXPORT2 @@ -46,6 +46,18 @@ ustr_hashCharsN(const char *str, int32_t length); U_CAPI int32_t U_EXPORT2 ustr_hashICharsN(const char *str, int32_t length); +/** + * Convert an ASCII-range lowercase character to uppercase. + * + * @param c A UChar. + * @return If UChar is a lowercase ASCII character, returns the uppercase version. + * Otherwise, returns the input character. + */ +U_CAPI UChar U_EXPORT2 +u_asciiToUpper(UChar c); + +// TODO: Add u_asciiToLower if/when there is a need for it. + /** * NUL-terminate a UChar * string if possible. * If length < destCapacity then NUL-terminate. @@ -121,7 +133,7 @@ class UTF8 { * @param t The i-th byte following the lead byte. * @param i The index (1..3) of byte t in the byte sequence. 0 &ownedIter, UErrorCode &errorCode) { -// if (U_FAILURE(errorCode)) { return nullptr; } -// options &= U_TITLECASE_ITERATOR_MASK; -// if (options != 0 && iter != nullptr) { -// errorCode = U_ILLEGAL_ARGUMENT_ERROR; -// return nullptr; -// } -// if (iter == nullptr) { -// switch (options) { -// case 0: -// iter = BreakIterator::createWordInstance( -// locale != nullptr ? *locale : Locale(locID), errorCode); -// break; -// case U_TITLECASE_WHOLE_STRING: -// iter = new WholeStringBreakIterator(); -// if (iter == nullptr) { -// errorCode = U_MEMORY_ALLOCATION_ERROR; -// } -// break; -// case U_TITLECASE_SENTENCES: -// iter = BreakIterator::createSentenceInstance( -// locale != nullptr ? *locale : Locale(locID), errorCode); -// break; -// default: -// errorCode = U_ILLEGAL_ARGUMENT_ERROR; -// break; -// } -// ownedIter.adoptInstead(iter); -// } -// return iter; -// } - -// int32_t CaseMap::toTitle( -// const char *locale, uint32_t options, BreakIterator *iter, -// const UChar *src, int32_t srcLength, -// UChar *dest, int32_t destCapacity, Edits *edits, -// UErrorCode &errorCode) { -// LocalPointer ownedIter; -// iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode); -// if(iter==NULL) { -// return 0; -// } -// UnicodeString s(srcLength<0, src, srcLength); -// iter->setText(s); -// return ustrcase_map( -// ustrcase_getCaseLocale(locale), options, iter, -// dest, destCapacity, -// src, srcLength, -// ustrcase_internalToTitle, edits, errorCode); -// } - -// U_NAMESPACE_END - -// U_NAMESPACE_USE - -// U_CAPI int32_t U_EXPORT2 -// u_strToTitle(UChar *dest, int32_t destCapacity, -// const UChar *src, int32_t srcLength, -// UBreakIterator *titleIter, -// const char *locale, -// UErrorCode *pErrorCode) { -// LocalPointer ownedIter; -// BreakIterator *iter = ustrcase_getTitleBreakIterator( -// nullptr, locale, 0, reinterpret_cast(titleIter), -// ownedIter, *pErrorCode); -// if (iter == nullptr) { -// return 0; -// } -// UnicodeString s(srcLength<0, src, srcLength); -// iter->setText(s); -// return ustrcase_mapWithOverlap( -// ustrcase_getCaseLocale(locale), 0, iter, -// dest, destCapacity, -// src, srcLength, -// ustrcase_internalToTitle, *pErrorCode); -// } - -// U_CAPI int32_t U_EXPORT2 -// ucasemap_toTitle(UCaseMap *csm, -// UChar *dest, int32_t destCapacity, -// const UChar *src, int32_t srcLength, -// UErrorCode *pErrorCode) { -// if (U_FAILURE(*pErrorCode)) { -// return 0; -// } -// if (csm->iter == NULL) { -// LocalPointer ownedIter; -// BreakIterator *iter = ustrcase_getTitleBreakIterator( -// nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode); -// if (iter == nullptr) { -// return 0; -// } -// csm->iter = ownedIter.orphan(); -// } -// UnicodeString s(srcLength<0, src, srcLength); -// csm->iter->setText(s); -// return ustrcase_map( -// csm->caseLocale, csm->options, csm->iter, -// dest, destCapacity, -// src, srcLength, -// ustrcase_internalToTitle, NULL, *pErrorCode); -// } - -// #endif // !UCONFIG_NO_BREAK_ITERATION diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustr_wcs.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustr_wcs.cpp index e9f278e96..efbbbc2f1 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustr_wcs.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ustr_wcs.cpp @@ -33,7 +33,7 @@ #define _BUFFER_CAPACITY_MULTIPLIER 2 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) -// TODO: We should use CharString for char buffers and UnicodeString for UChar buffers. +// TODO: We should use CharString for char buffers and UnicodeString for char16_t buffers. // Then we could change this to work only with wchar_t buffers. static inline UBool u_growAnyBufferFromStatic(void *context, @@ -42,7 +42,7 @@ u_growAnyBufferFromStatic(void *context, // Use char* not void* to avoid the compiler's strict-aliasing assumptions // and related warnings. char *newBuffer=(char *)uprv_malloc(reqCapacity*size); - if(newBuffer!=NULL) { + if(newBuffer!=nullptr) { if(length>0) { uprv_memcpy(newBuffer, *pBuffer, (size_t)length*size); } @@ -57,7 +57,7 @@ u_growAnyBufferFromStatic(void *context, } *pBuffer=newBuffer; - return (UBool)(newBuffer!=NULL); + return (UBool)(newBuffer!=nullptr); } /* helper function */ @@ -65,7 +65,7 @@ static wchar_t* _strToWCS(wchar_t *dest, int32_t destCapacity, int32_t *pDestLength, - const UChar *src, + const char16_t *src, int32_t srcLength, UErrorCode *pErrorCode){ @@ -73,19 +73,19 @@ _strToWCS(wchar_t *dest, char* tempBuf = stackBuffer; int32_t tempBufCapacity = _STACK_BUFFER_CAPACITY; char* tempBufLimit = stackBuffer + tempBufCapacity; - UConverter* conv = NULL; + UConverter* conv = nullptr; char* saveBuf = tempBuf; - wchar_t* intTarget=NULL; + wchar_t* intTarget=nullptr; int32_t intTargetCapacity=0; int count=0,retVal=0; - const UChar *pSrcLimit =NULL; - const UChar *pSrc = src; + const char16_t *pSrcLimit =nullptr; + const char16_t *pSrc = src; conv = u_getDefaultConverter(pErrorCode); if(U_FAILURE(*pErrorCode)){ - return NULL; + return nullptr; } if(srcLength == -1){ @@ -99,14 +99,14 @@ _strToWCS(wchar_t *dest, *pErrorCode = U_ZERO_ERROR; /* convert to chars using default converter */ - ucnv_fromUnicode(conv,&tempBuf,tempBufLimit,&pSrc,pSrcLimit,NULL,(UBool)(pSrc==pSrcLimit),pErrorCode); + ucnv_fromUnicode(conv,&tempBuf,tempBufLimit,&pSrc,pSrcLimit,nullptr,(UBool)(pSrc==pSrcLimit),pErrorCode); count =(tempBuf - saveBuf); /* This should rarely occur */ if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR){ tempBuf = saveBuf; - /* we dont have enough room on the stack grow the buffer */ + /* we don't have enough room on the stack grow the buffer */ int32_t newCapacity = 2 * srcLength; if(newCapacity <= tempBufCapacity) { newCapacity = _BUFFER_CAPACITY_MULTIPLIER * tempBufCapacity; @@ -132,7 +132,7 @@ _strToWCS(wchar_t *dest, /* done with conversion null terminate the char buffer */ if(count>=tempBufCapacity){ tempBuf = saveBuf; - /* we dont have enough room on the stack grow the buffer */ + /* we don't have enough room on the stack grow the buffer */ if(!u_growAnyBufferFromStatic(stackBuffer,(void**) &tempBuf, &tempBufCapacity, count+1, count, 1)) { goto cleanup; @@ -170,7 +170,7 @@ _strToWCS(wchar_t *dest, break; }else if(retVal== remaining){/* should never occur */ int numWritten = (pIntTarget-intTarget); - u_growAnyBufferFromStatic(NULL,(void**) &intTarget, + u_growAnyBufferFromStatic(nullptr,(void**) &intTarget, &intTargetCapacity, intTargetCapacity * _BUFFER_CAPACITY_MULTIPLIER, numWritten, @@ -232,20 +232,20 @@ U_CAPI wchar_t* U_EXPORT2 u_strToWCS(wchar_t *dest, int32_t destCapacity, int32_t *pDestLength, - const UChar *src, + const char16_t *src, int32_t srcLength, UErrorCode *pErrorCode){ /* args check */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)){ - return NULL; + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)){ + return nullptr; } - if( (src==NULL && srcLength!=0) || srcLength < -1 || - (destCapacity<0) || (dest == NULL && destCapacity > 0) + if( (src==nullptr && srcLength!=0) || srcLength < -1 || + (destCapacity<0) || (dest == nullptr && destCapacity > 0) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } #ifdef U_WCHAR_IS_UTF16 @@ -254,13 +254,13 @@ u_strToWCS(wchar_t *dest, srcLength = u_strlen(src); } if(0 < srcLength && srcLength <= destCapacity){ - u_memcpy((UChar *)dest, src, srcLength); + u_memcpy((char16_t *)dest, src, srcLength); } if(pDestLength){ *pDestLength = srcLength; } - u_terminateUChars((UChar *)dest,destCapacity,srcLength,pErrorCode); + u_terminateUChars((char16_t *)dest,destCapacity,srcLength,pErrorCode); return dest; @@ -279,8 +279,8 @@ u_strToWCS(wchar_t *dest, #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) /* helper function */ -static UChar* -_strFromWCS( UChar *dest, +static char16_t* +_strFromWCS( char16_t *dest, int32_t destCapacity, int32_t *pDestLength, const wchar_t *src, @@ -288,12 +288,12 @@ _strFromWCS( UChar *dest, UErrorCode *pErrorCode) { int32_t retVal =0, count =0 ; - UConverter* conv = NULL; - UChar* pTarget = NULL; - UChar* pTargetLimit = NULL; - UChar* target = NULL; + UConverter* conv = nullptr; + char16_t* pTarget = nullptr; + char16_t* pTargetLimit = nullptr; + char16_t* target = nullptr; - UChar uStack [_STACK_BUFFER_CAPACITY]; + char16_t uStack [_STACK_BUFFER_CAPACITY]; wchar_t wStack[_STACK_BUFFER_CAPACITY]; wchar_t* pWStack = wStack; @@ -303,10 +303,10 @@ _strFromWCS( UChar *dest, int32_t cStackCap = _STACK_BUFFER_CAPACITY; char* pCSrc=cStack; char* pCSave=pCSrc; - char* pCSrcLimit=NULL; + char* pCSrcLimit=nullptr; const wchar_t* pSrc = src; - const wchar_t* pSrcLimit = NULL; + const wchar_t* pSrcLimit = nullptr; if(srcLength ==-1){ /* if the wchar_t source is null terminated we can safely @@ -334,7 +334,7 @@ _strFromWCS( UChar *dest, }else{ /* here the source is not null terminated - * so it may have nulls embeded and we need to + * so it may have nulls embedded and we need to * do some extra processing */ int32_t remaining =cStackCap; @@ -364,7 +364,7 @@ _strFromWCS( UChar *dest, } /* we have found a null so convert the - * chunk from begining of non-null char to null + * chunk from beginning of non-null char to null */ retVal = uprv_wcstombs(pCSrc,pSrc,remaining); @@ -387,10 +387,10 @@ _strFromWCS( UChar *dest, * null terminate it and convert wchar_ts to chars */ if(nulLen >= _STACK_BUFFER_CAPACITY){ - /* Should rarely occcur */ + /* Should rarely occur */ /* allocate new buffer buffer */ pWStack =(wchar_t*) uprv_malloc(sizeof(wchar_t) * (nulLen + 1)); - if(pWStack==NULL){ + if(pWStack==nullptr){ *pErrorCode = U_MEMORY_ALLOCATION_ERROR; goto cleanup; } @@ -436,7 +436,7 @@ _strFromWCS( UChar *dest, conv= u_getDefaultConverter(pErrorCode); - if(U_FAILURE(*pErrorCode)|| conv==NULL){ + if(U_FAILURE(*pErrorCode)|| conv==nullptr){ goto cleanup; } @@ -445,7 +445,7 @@ _strFromWCS( UChar *dest, *pErrorCode = U_ZERO_ERROR; /* convert to stack buffer*/ - ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,NULL,(UBool)(pCSrc==pCSrcLimit),pErrorCode); + ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,nullptr,(UBool)(pCSrc==pCSrcLimit),pErrorCode); /* increment count to number written to stack */ count+= pTarget - target; @@ -482,8 +482,8 @@ _strFromWCS( UChar *dest, } #endif -U_CAPI UChar* U_EXPORT2 -u_strFromWCS(UChar *dest, +U_CAPI char16_t* U_EXPORT2 +u_strFromWCS(char16_t *dest, int32_t destCapacity, int32_t *pDestLength, const wchar_t *src, @@ -492,24 +492,24 @@ u_strFromWCS(UChar *dest, { /* args check */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)){ - return NULL; + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)){ + return nullptr; } - if( (src==NULL && srcLength!=0) || srcLength < -1 || - (destCapacity<0) || (dest == NULL && destCapacity > 0) + if( (src==nullptr && srcLength!=0) || srcLength < -1 || + (destCapacity<0) || (dest == nullptr && destCapacity > 0) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } #ifdef U_WCHAR_IS_UTF16 /* wchar_t is UTF-16 just do a memcpy */ if(srcLength == -1){ - srcLength = u_strlen((const UChar *)src); + srcLength = u_strlen((const char16_t *)src); } if(0 < srcLength && srcLength <= destCapacity){ - u_memcpy(dest, (const UChar *)src, srcLength); + u_memcpy(dest, (const char16_t *)src, srcLength); } if(pDestLength){ *pDestLength = srcLength; diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustrcase.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustrcase.cpp index 12806df87..e4aec8a1c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustrcase.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ustrcase.cpp @@ -36,6 +36,12 @@ #include "ustr_imp.h" #include "uassert.h" +/** + * Code point for COMBINING ACUTE ACCENT + * @internal + */ +#define ACUTE u'\u0301' + U_NAMESPACE_BEGIN namespace { @@ -45,7 +51,7 @@ int32_t checkOverflowAndEditsError(int32_t destIndex, int32_t destCapacity, if (U_SUCCESS(errorCode)) { if (destIndex > destCapacity) { errorCode = U_BUFFER_OVERFLOW_ERROR; - } else if (edits != NULL) { + } else if (edits != nullptr) { edits->copyErrorTo(errorCode); } } @@ -54,8 +60,8 @@ int32_t checkOverflowAndEditsError(int32_t destIndex, int32_t destCapacity, /* Appends a full case mapping result, see UCASE_MAX_STRING_LENGTH. */ inline int32_t -appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity, - int32_t result, const UChar *s, +appendResult(char16_t *dest, int32_t destIndex, int32_t destCapacity, + int32_t result, const char16_t *s, int32_t cpLength, uint32_t options, icu::Edits *edits) { UChar32 c; int32_t length; @@ -63,7 +69,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity, /* decode the result */ if(result<0) { /* (not) original code point */ - if(edits!=NULL) { + if(edits!=nullptr) { edits->addUnchanged(cpLength); } if(options & U_OMIT_UNCHANGED_TEXT) { @@ -71,7 +77,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity, } c=~result; if(destIndexaddReplace(cpLength, 1); } return destIndex; @@ -89,7 +95,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity, c=result; length=U16_LENGTH(c); } - if(edits!=NULL) { + if(edits!=nullptr) { edits->addReplace(cpLength, length); } } @@ -101,7 +107,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity, /* append the result */ if(c>=0) { /* code point */ - UBool isError=FALSE; + UBool isError=false; U16_APPEND(dest, destIndex, destCapacity, c, isError); if(isError) { /* overflow, nothing written */ @@ -127,7 +133,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity, } inline int32_t -appendUChar(UChar *dest, int32_t destIndex, int32_t destCapacity, UChar c) { +appendUChar(char16_t *dest, int32_t destIndex, int32_t destCapacity, char16_t c) { if(destIndexaddUnchanged(length); } if(options & U_OMIT_UNCHANGED_TEXT) { @@ -155,8 +161,8 @@ appendNonEmptyUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity, } inline int32_t -appendUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity, - const UChar *s, int32_t length, uint32_t options, icu::Edits *edits) { +appendUnchanged(char16_t *dest, int32_t destIndex, int32_t destCapacity, + const char16_t *s, int32_t length, uint32_t options, icu::Edits *edits) { if (length <= 0) { return destIndex; } @@ -183,12 +189,12 @@ utf16_caseContextIterator(void *context, int8_t dir) { if(dir<0) { if(csc->startindex) { - U16_PREV((const UChar *)csc->p, csc->start, csc->index, c); + U16_PREV((const char16_t *)csc->p, csc->start, csc->index, c); return c; } } else { if(csc->indexlimit) { - U16_NEXT((const UChar *)csc->p, csc->index, csc->limit, c); + U16_NEXT((const char16_t *)csc->p, csc->index, csc->limit, c); return c; } } @@ -200,8 +206,8 @@ utf16_caseContextIterator(void *context, int8_t dir) { * caseLocale < 0: Case-folds [srcStart..srcLimit[. */ int32_t toLower(int32_t caseLocale, uint32_t options, - UChar *dest, int32_t destCapacity, - const UChar *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit, + char16_t *dest, int32_t destCapacity, + const char16_t *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit, icu::Edits *edits, UErrorCode &errorCode) { const int8_t *latinToLower; if (caseLocale == UCASE_LOC_ROOT || @@ -218,7 +224,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options, int32_t srcIndex = srcStart; for (;;) { // fast path for simple cases - UChar lead = 0; + char16_t lead = 0; while (srcIndex < srcLimit) { lead = src[srcIndex]; int32_t delta; @@ -238,7 +244,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options, continue; } } - lead += static_cast(delta); + lead += static_cast(delta); destIndex = appendUnchanged(dest, destIndex, destCapacity, src + prev, srcIndex - 1 - prev, options, edits); if (destIndex >= 0) { @@ -258,7 +264,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options, } // slow path int32_t cpStart = srcIndex++; - UChar trail; + char16_t trail; UChar32 c; if (U16_IS_LEAD(lead) && srcIndex < srcLimit && U16_IS_TRAIL(trail = src[srcIndex])) { c = U16_GET_SUPPLEMENTARY(lead, trail); @@ -266,7 +272,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options, } else { c = lead; } - const UChar *s; + const char16_t *s; if (caseLocale >= 0) { csc->cpStart = cpStart; csc->cpLimit = srcIndex; @@ -298,8 +304,8 @@ int32_t toLower(int32_t caseLocale, uint32_t options, } int32_t toUpper(int32_t caseLocale, uint32_t options, - UChar *dest, int32_t destCapacity, - const UChar *src, UCaseContext *csc, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, UCaseContext *csc, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode) { const int8_t *latinToUpper; if (caseLocale == UCASE_LOC_TURKISH) { @@ -313,7 +319,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options, int32_t srcIndex = 0; for (;;) { // fast path for simple cases - UChar lead = 0; + char16_t lead = 0; while (srcIndex < srcLength) { lead = src[srcIndex]; int32_t delta; @@ -333,7 +339,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options, continue; } } - lead += static_cast(delta); + lead += static_cast(delta); destIndex = appendUnchanged(dest, destIndex, destCapacity, src + prev, srcIndex - 1 - prev, options, edits); if (destIndex >= 0) { @@ -354,7 +360,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options, // slow path int32_t cpStart; csc->cpStart = cpStart = srcIndex++; - UChar trail; + char16_t trail; UChar32 c; if (U16_IS_LEAD(lead) && srcIndex < srcLength && U16_IS_TRAIL(trail = src[srcIndex])) { c = U16_GET_SUPPLEMENTARY(lead, trail); @@ -363,7 +369,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options, c = lead; } csc->cpLimit = srcIndex; - const UChar *s; + const char16_t *s; c = ucase_toFullUpper(c, utf16_caseContextIterator, csc, &s, caseLocale); if (c >= 0) { destIndex = appendUnchanged(dest, destIndex, destCapacity, @@ -396,10 +402,98 @@ U_NAMESPACE_USE #if !UCONFIG_NO_BREAK_ITERATION +namespace { + +/** + * Input: c is a letter I with or without acute accent. + * start is the index in src after c, and is less than segmentLimit. + * If a plain i/I is followed by a plain j/J, + * or an i/I with acute (precomposed or decomposed) is followed by a j/J with acute, + * then we output accordingly. + * + * @return the src index after the titlecased sequence, or the start index if no Dutch IJ + */ +int32_t maybeTitleDutchIJ(const char16_t *src, UChar32 c, int32_t start, int32_t segmentLimit, + char16_t *dest, int32_t &destIndex, int32_t destCapacity, uint32_t options, + icu::Edits *edits) { + U_ASSERT(start < segmentLimit); + + int32_t index = start; + bool withAcute = false; + + // If the conditions are met, then the following variables tell us what to output. + int32_t unchanged1 = 0; // code units before the j, or the whole sequence (0..3) + bool doTitleJ = false; // true if the j needs to be titlecased + int32_t unchanged2 = 0; // after the j (0 or 1) + + // next character after the first letter + char16_t c2 = src[index++]; + + // Is the first letter an i/I with accent? + if (c == u'I') { + if (c2 == ACUTE) { + withAcute = true; + unchanged1 = 1; + if (index == segmentLimit) { return start; } + c2 = src[index++]; + } + } else { // Í + withAcute = true; + } + + // Is the next character a j/J? + if (c2 == u'j') { + doTitleJ = true; + } else if (c2 == u'J') { + ++unchanged1; + } else { + return start; + } + + // A plain i/I must be followed by a plain j/J. + // An i/I with acute must be followed by a j/J with acute. + if (withAcute) { + if (index == segmentLimit || src[index++] != ACUTE) { return start; } + if (doTitleJ) { + unchanged2 = 1; + } else { + ++unchanged1; + } + } + + // There must not be another combining mark. + if (index < segmentLimit) { + int32_t cp; + int32_t i = index; + U16_NEXT(src, i, segmentLimit, cp); + uint32_t typeMask = U_GET_GC_MASK(cp); + if ((typeMask & U_GC_M_MASK) != 0) { + return start; + } + } + + // Output the rest of the Dutch IJ. + destIndex = appendUnchanged(dest, destIndex, destCapacity, src + start, unchanged1, options, edits); + start += unchanged1; + if (doTitleJ) { + destIndex = appendUChar(dest, destIndex, destCapacity, u'J'); + if (edits != nullptr) { + edits->addReplace(1, 1); + } + ++start; + } + destIndex = appendUnchanged(dest, destIndex, destCapacity, src + start, unchanged2, options, edits); + + U_ASSERT(start + unchanged2 == index); + return index; +} + +} // namespace + U_CFUNC int32_t U_CALLCONV ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *iter, - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode) { if (!ustrcase_checkTitleAdjustmentOptions(options, errorCode)) { @@ -412,14 +506,14 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it csc.limit=srcLength; int32_t destIndex=0; int32_t prev=0; - UBool isFirstIndex=TRUE; + bool isFirstIndex=true; /* titlecasing loop */ while(prevfirst(); } else { index=iter->next(); @@ -446,7 +540,7 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it // Stop with titleStartaddReplace(1, 1); - } - titleLimit++; - } else if (src[titleStart+1] == 0x004A) { - // Keep the capital J from getting lowercased. - destIndex=appendUnchanged(dest, destIndex, destCapacity, - src+titleStart+1, 1, options, edits); - if(destIndex<0) { - errorCode=U_INDEX_OUTOFBOUNDS_ERROR; - return 0; - } - titleLimit++; + caseLocale == UCASE_LOC_DUTCH) { + if (c < 0) { + c = ~c; + } + + if (c == u'I' || c == u'Í') { + titleLimit = maybeTitleDutchIJ(src, c, titleStart + 1, index, + dest, destIndex, destCapacity, options, + edits); } } @@ -510,7 +592,7 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it destIndex+= toLower( caseLocale, options, - dest+destIndex, destCapacity-destIndex, + (dest==nullptr) ? nullptr: dest+destIndex, destCapacity-destIndex, src, &csc, titleLimit, index, edits, errorCode); if(errorCode==U_BUFFER_OVERFLOW_ERROR) { @@ -544,7 +626,7 @@ U_NAMESPACE_BEGIN namespace GreekUpper { // Data generated by prototype code, see -// http://site.icu-project.org/design/case/greek-upper +// https://icu.unicode.org/design/case/greek-upper // TODO: Move this data into ucase.icu. static const uint16_t data0370[] = { // U+0370..03FF @@ -997,7 +1079,7 @@ uint32_t getDiacriticData(UChar32 c) { } } -UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) { +UBool isFollowedByCasedLetter(const char16_t *s, int32_t i, int32_t length) { while (i < length) { UChar32 c; U16_NEXT(s, i, length, c); @@ -1005,12 +1087,12 @@ UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) { if ((type & UCASE_IGNORABLE) != 0) { // Case-ignorable, continue with the loop. } else if (type != UCASE_NONE) { - return TRUE; // Followed by cased letter. + return true; // Followed by cased letter. } else { - return FALSE; // Uncased and not case-ignorable. + return false; // Uncased and not case-ignorable. } } - return FALSE; // Not followed by cased letter. + return false; // Not followed by cased letter. } /** @@ -1020,8 +1102,8 @@ UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) { * TODO: Try to re-consolidate one way or another with the non-Greek function. */ int32_t toUpper(uint32_t options, - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, Edits *edits, UErrorCode &errorCode) { int32_t destIndex=0; @@ -1048,14 +1130,18 @@ int32_t toUpper(uint32_t options, // Adding one only to the final vowel in a longer sequence // (which does not occur in normal writing) would require lookahead. // Set the same flag as for preserving an existing dialytika. - if ((data & HAS_VOWEL) != 0 && (state & AFTER_VOWEL_WITH_ACCENT) != 0 && - (upper == 0x399 || upper == 0x3A5)) { - data |= HAS_DIALYTIKA; + if ((data & HAS_VOWEL) != 0 && + (state & (AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT | AFTER_VOWEL_WITH_COMBINING_ACCENT)) != + 0 && + (upper == 0x399 || upper == 0x3A5)) { + data |= (state & AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT) ? HAS_DIALYTIKA + : HAS_COMBINING_DIALYTIKA; } int32_t numYpogegrammeni = 0; // Map each one to a trailing, spacing, capital iota. if ((data & HAS_YPOGEGRAMMENI) != 0) { numYpogegrammeni = 1; } + const UBool hasPrecomposedAccent = (data & HAS_ACCENT) != 0; // Skip combining diacritics after this Greek letter. while (nextIndex < srcLength) { uint32_t diacriticData = getDiacriticData(src[nextIndex]); @@ -1070,10 +1156,11 @@ int32_t toUpper(uint32_t options, } } if ((data & HAS_VOWEL_AND_ACCENT_AND_DIALYTIKA) == HAS_VOWEL_AND_ACCENT) { - nextState |= AFTER_VOWEL_WITH_ACCENT; + nextState |= hasPrecomposedAccent ? AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT + : AFTER_VOWEL_WITH_COMBINING_ACCENT; } // Map according to Greek rules. - UBool addTonos = FALSE; + UBool addTonos = false; if (upper == 0x397 && (data & HAS_ACCENT) != 0 && numYpogegrammeni == 0 && @@ -1081,10 +1168,10 @@ int32_t toUpper(uint32_t options, !isFollowedByCasedLetter(src, nextIndex, srcLength)) { // Keep disjunctive "or" with (only) a tonos. // We use the same "word boundary" conditions as for the Final_Sigma test. - if (i == nextIndex) { + if (hasPrecomposedAccent) { upper = 0x389; // Preserve the precomposed form. } else { - addTonos = TRUE; + addTonos = true; } } else if ((data & HAS_DIALYTIKA) != 0) { // Preserve a vowel with dialytika in precomposed form if it exists. @@ -1099,7 +1186,7 @@ int32_t toUpper(uint32_t options, UBool change; if (edits == nullptr && (options & U_OMIT_UNCHANGED_TEXT) == 0) { - change = TRUE; // common, simple usage + change = true; // common, simple usage } else { // Find out first whether we are changing the text. change = src[i] != upper || numYpogegrammeni > 0; @@ -1116,11 +1203,11 @@ int32_t toUpper(uint32_t options, int32_t newLength = (i2 - i) + numYpogegrammeni; change |= oldLength != newLength; if (change) { - if (edits != NULL) { + if (edits != nullptr) { edits->addReplace(oldLength, newLength); } } else { - if (edits != NULL) { + if (edits != nullptr) { edits->addUnchanged(oldLength); } // Write unchanged text? @@ -1129,7 +1216,7 @@ int32_t toUpper(uint32_t options, } if (change) { - destIndex=appendUChar(dest, destIndex, destCapacity, (UChar)upper); + destIndex=appendUChar(dest, destIndex, destCapacity, (char16_t)upper); if (destIndex >= 0 && (data & HAS_EITHER_DIALYTIKA) != 0) { destIndex=appendUChar(dest, destIndex, destCapacity, 0x308); // restore or add a dialytika } @@ -1146,8 +1233,8 @@ int32_t toUpper(uint32_t options, } } } else { - const UChar *s; - c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK); + const char16_t *s; + c=ucase_toFullUpper(c, nullptr, nullptr, &s, UCASE_LOC_GREEK); destIndex = appendResult(dest, destIndex, destCapacity, c, s, nextIndex - i, options, edits); if (destIndex < 0) { @@ -1169,8 +1256,8 @@ U_NAMESPACE_END U_CFUNC int32_t U_CALLCONV ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode) { UCaseContext csc=UCASECONTEXT_INITIALIZER; @@ -1186,8 +1273,8 @@ ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_IT U_CFUNC int32_t U_CALLCONV ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode) { int32_t destIndex; @@ -1209,8 +1296,8 @@ ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_IT U_CFUNC int32_t U_CALLCONV ustrcase_internalFold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, icu::Edits *edits, UErrorCode &errorCode) { int32_t destIndex = toLower( @@ -1223,8 +1310,8 @@ ustrcase_internalFold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK U_CFUNC int32_t ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, UStringCaseMapper *stringCaseMapper, icu::Edits *edits, UErrorCode &errorCode) { @@ -1235,8 +1322,8 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM return 0; } if( destCapacity<0 || - (dest==NULL && destCapacity>0) || - src==NULL || + (dest==nullptr && destCapacity>0) || + src==nullptr || srcLength<-1 ) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; @@ -1249,7 +1336,7 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM } /* check for overlapping source and destination */ - if( dest!=NULL && + if( dest!=nullptr && ((src>=dest && src<(dest+destCapacity)) || (dest>=src && dest<(src+srcLength))) ) { @@ -1267,12 +1354,12 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM U_CFUNC int32_t ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM - UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, UStringCaseMapper *stringCaseMapper, UErrorCode &errorCode) { - UChar buffer[300]; - UChar *temp; + char16_t buffer[300]; + char16_t *temp; int32_t destLength; @@ -1281,8 +1368,8 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE return 0; } if( destCapacity<0 || - (dest==NULL && destCapacity>0) || - src==NULL || + (dest==nullptr && destCapacity>0) || + src==nullptr || srcLength<-1 ) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; @@ -1295,7 +1382,7 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE } /* check for overlapping source and destination */ - if( dest!=NULL && + if( dest!=nullptr && ((src>=dest && src<(dest+destCapacity)) || (dest>=src && dest<(src+srcLength))) ) { @@ -1305,8 +1392,8 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE temp=buffer; } else { /* allocate a buffer */ - temp=(UChar *)uprv_malloc(destCapacity*U_SIZEOF_UCHAR); - if(temp==NULL) { + temp=(char16_t *)uprv_malloc(destCapacity*U_SIZEOF_UCHAR); + if(temp==nullptr) { errorCode=U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -1316,7 +1403,7 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE } destLength=stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR - temp, destCapacity, src, srcLength, NULL, errorCode); + temp, destCapacity, src, srcLength, nullptr, errorCode); if(temp!=dest) { /* copy the result string to the destination buffer */ if (U_SUCCESS(errorCode) && 0 < destLength && destLength <= destCapacity) { @@ -1333,8 +1420,8 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE /* public API functions */ U_CAPI int32_t U_EXPORT2 -u_strFoldCase(UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, +u_strFoldCase(char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, uint32_t options, UErrorCode *pErrorCode) { return ustrcase_mapWithOverlap( @@ -1348,8 +1435,8 @@ U_NAMESPACE_BEGIN int32_t CaseMap::fold( uint32_t options, - const UChar *src, int32_t srcLength, - UChar *dest, int32_t destCapacity, Edits *edits, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode) { return ustrcase_map( UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL @@ -1372,19 +1459,19 @@ U_NAMESPACE_END */ /* stack element for previous-level source/decomposition pointers */ -struct ustrcase_CmpEquivLevel { - const UChar *start, *s, *limit; +struct CmpEquivLevel { + const char16_t *start, *s, *limit; }; -typedef struct ustrcase_CmpEquivLevel ustrcase_CmpEquivLevel; +typedef struct CmpEquivLevel CmpEquivLevel; /** * Internal implementation code comparing string with case fold. * This function is called from u_strcmpFold() and u_caseInsensitivePrefixMatch(). * * @param s1 input string 1 - * @param length1 length of string 1, or -1 (NULL terminated) + * @param length1 length of string 1, or -1 (NUL terminated) * @param s2 input string 2 - * @param length2 length of string 2, or -1 (NULL terminated) + * @param length2 length of string 2, or -1 (NUL terminated) * @param options compare options * @param matchLen1 (output) length of partial prefix match in s1 * @param matchLen2 (output) length of partial prefix match in s2 @@ -1392,31 +1479,31 @@ typedef struct ustrcase_CmpEquivLevel ustrcase_CmpEquivLevel; * @return The result of comparison */ static int32_t _cmpFold( - const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, + const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, uint32_t options, int32_t *matchLen1, int32_t *matchLen2, UErrorCode *pErrorCode) { int32_t cmpRes = 0; /* current-level start/limit - s1/s2 as current */ - const UChar *start1, *start2, *limit1, *limit2; + const char16_t *start1, *start2, *limit1, *limit2; /* points to the original start address */ - const UChar *org1, *org2; + const char16_t *org1, *org2; /* points to the end of match + 1 */ - const UChar *m1, *m2; + const char16_t *m1, *m2; /* case folding variables */ - const UChar *p; + const char16_t *p; int32_t length; /* stacks of previous-level start/current/limit */ - ustrcase_CmpEquivLevel stack1[2], stack2[2]; + CmpEquivLevel stack1[2], stack2[2]; /* case folding buffers, only use current-level start/limit */ - UChar fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1]; + char16_t fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1]; /* track which is the current level per string */ int32_t level1, level2; @@ -1436,21 +1523,21 @@ static int32_t _cmpFold( /* initialize */ if(matchLen1) { - U_ASSERT(matchLen2 !=NULL); + U_ASSERT(matchLen2 !=nullptr); *matchLen1=0; *matchLen2=0; } start1=m1=org1=s1; if(length1==-1) { - limit1=NULL; + limit1=nullptr; } else { limit1=s1+length1; } start2=m2=org2=s2; if(length2==-1) { - limit2=NULL; + limit2=nullptr; } else { limit2=s2+length2; } @@ -1468,7 +1555,7 @@ static int32_t _cmpFold( if(c1<0) { /* get next code unit from string 1, post-increment */ for(;;) { - if(s1==limit1 || ((c1=*s1)==0 && (limit1==NULL || (options&_STRNCMP_STYLE)))) { + if(s1==limit1 || ((c1=*s1)==0 && (limit1==nullptr || (options&_STRNCMP_STYLE)))) { if(level1==0) { c1=-1; break; @@ -1482,7 +1569,7 @@ static int32_t _cmpFold( do { --level1; start1=stack1[level1].start; /*Not uninitialized*/ - } while(start1==NULL); + } while(start1==nullptr); s1=stack1[level1].s; /*Not uninitialized*/ limit1=stack1[level1].limit; /*Not uninitialized*/ } @@ -1491,7 +1578,7 @@ static int32_t _cmpFold( if(c2<0) { /* get next code unit from string 2, post-increment */ for(;;) { - if(s2==limit2 || ((c2=*s2)==0 && (limit2==NULL || (options&_STRNCMP_STYLE)))) { + if(s2==limit2 || ((c2=*s2)==0 && (limit2==nullptr || (options&_STRNCMP_STYLE)))) { if(level2==0) { c2=-1; break; @@ -1505,7 +1592,7 @@ static int32_t _cmpFold( do { --level2; start2=stack2[level2].start; /*Not uninitialized*/ - } while(start2==NULL); + } while(start2==nullptr); s2=stack2[level2].s; /*Not uninitialized*/ limit2=stack2[level2].limit; /*Not uninitialized*/ } @@ -1516,7 +1603,7 @@ static int32_t _cmpFold( * either variable c1, c2 is -1 only if the corresponding string is finished */ if(c1==c2) { - const UChar *next1, *next2; + const char16_t *next1, *next2; if(c1<0) { cmpRes=0; /* c1==c2==-1 indicating end of strings */ @@ -1532,7 +1619,7 @@ static int32_t _cmpFold( * has no matching code point in s1, so this implementation returns * 2 as the prefix match length ("Fu"). */ - next1=next2=NULL; + next1=next2=nullptr; if(level1==0) { next1=s1; } else if(s1==limit1) { @@ -1547,7 +1634,7 @@ static int32_t _cmpFold( next1=stack1[0].s; } - if (next1!=NULL) { + if (next1!=nullptr) { if(level2==0) { next2=s2; } else if(s2==limit2) { @@ -1556,7 +1643,7 @@ static int32_t _cmpFold( /* is s2 at the end of the current stack? */ next2=stack2[0].s; } - if(next2!=NULL) { + if(next2!=nullptr) { m1=next1; m2=next2; } @@ -1575,7 +1662,7 @@ static int32_t _cmpFold( /* get complete code points for c1, c2 for lookups if either is a surrogate */ cp1=c1; if(U_IS_SURROGATE(c1)) { - UChar c; + char16_t c; if(U_IS_SURROGATE_LEAD(c1)) { if(s1!=limit1 && U16_IS_TRAIL(c=*s1)) { @@ -1591,7 +1678,7 @@ static int32_t _cmpFold( cp2=c2; if(U_IS_SURROGATE(c2)) { - UChar c; + char16_t c; if(U_IS_SURROGATE_LEAD(c2)) { if(s2!=limit2 && U16_IS_TRAIL(c=*s2)) { @@ -1755,25 +1842,25 @@ static int32_t _cmpFold( /* internal function */ U_CFUNC int32_t -u_strcmpFold(const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, +u_strcmpFold(const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode) { - return _cmpFold(s1, length1, s2, length2, options, NULL, NULL, pErrorCode); + return _cmpFold(s1, length1, s2, length2, options, nullptr, nullptr, pErrorCode); } /* public API functions */ U_CAPI int32_t U_EXPORT2 -u_strCaseCompare(const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, +u_strCaseCompare(const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode) { /* argument checking */ if(pErrorCode==0 || U_FAILURE(*pErrorCode)) { return 0; } - if(s1==NULL || length1<-1 || s2==NULL || length2<-1) { + if(s1==nullptr || length1<-1 || s2==nullptr || length2<-1) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1783,7 +1870,7 @@ u_strCaseCompare(const UChar *s1, int32_t length1, } U_CAPI int32_t U_EXPORT2 -u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options) { +u_strcasecmp(const char16_t *s1, const char16_t *s2, uint32_t options) { UErrorCode errorCode=U_ZERO_ERROR; return u_strcmpFold(s1, -1, s2, -1, options|U_COMPARE_IGNORE_CASE, @@ -1791,7 +1878,7 @@ u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options) { } U_CAPI int32_t U_EXPORT2 -u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options) { +u_memcasecmp(const char16_t *s1, const char16_t *s2, int32_t length, uint32_t options) { UErrorCode errorCode=U_ZERO_ERROR; return u_strcmpFold(s1, length, s2, length, options|U_COMPARE_IGNORE_CASE, @@ -1799,7 +1886,7 @@ u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options) } U_CAPI int32_t U_EXPORT2 -u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options) { +u_strncasecmp(const char16_t *s1, const char16_t *s2, int32_t n, uint32_t options) { UErrorCode errorCode=U_ZERO_ERROR; return u_strcmpFold(s1, n, s2, n, options|(U_COMPARE_IGNORE_CASE|_STRNCMP_STYLE), @@ -1808,8 +1895,8 @@ u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options) { /* internal API - detect length of shared prefix */ U_CAPI void -u_caseInsensitivePrefixMatch(const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, +u_caseInsensitivePrefixMatch(const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, uint32_t options, int32_t *matchLen1, int32_t *matchLen2, UErrorCode *pErrorCode) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustrcase_locale.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustrcase_locale.cpp index 2ecd24f03..176add9c5 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustrcase_locale.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ustrcase_locale.cpp @@ -29,7 +29,7 @@ U_CFUNC int32_t ustrcase_getCaseLocale(const char *locale) { - if (locale == NULL) { + if (locale == nullptr) { locale = uloc_getDefault(); } if (*locale == 0) { @@ -42,8 +42,8 @@ ustrcase_getCaseLocale(const char *locale) { /* public API functions */ U_CAPI int32_t U_EXPORT2 -u_strToLower(UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, +u_strToLower(char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode) { return ustrcase_mapWithOverlap( @@ -54,8 +54,8 @@ u_strToLower(UChar *dest, int32_t destCapacity, } U_CAPI int32_t U_EXPORT2 -u_strToUpper(UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, +u_strToUpper(char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode) { return ustrcase_mapWithOverlap( @@ -69,8 +69,8 @@ U_NAMESPACE_BEGIN int32_t CaseMap::toLower( const char *locale, uint32_t options, - const UChar *src, int32_t srcLength, - UChar *dest, int32_t destCapacity, Edits *edits, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode) { return ustrcase_map( ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL @@ -81,8 +81,8 @@ int32_t CaseMap::toLower( int32_t CaseMap::toUpper( const char *locale, uint32_t options, - const UChar *src, int32_t srcLength, - UChar *dest, int32_t destCapacity, Edits *edits, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode) { return ustrcase_map( ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp index 0d11fdd81..a60b2208f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp @@ -10,7 +10,7 @@ * Since: ICU 2.4 ********************************************************************** */ -#include "utypeinfo.h" // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/ustring.h" #include "unicode/strenum.h" @@ -29,7 +29,7 @@ StringEnumeration::StringEnumeration() } StringEnumeration::~StringEnumeration() { - if (chars != NULL && chars != charsBuffer) { + if (chars != nullptr && chars != charsBuffer) { uprv_free(chars); } } @@ -37,17 +37,17 @@ StringEnumeration::~StringEnumeration() { // StringEnumeration base class clone() default implementation, does not clone StringEnumeration * StringEnumeration::clone() const { - return NULL; + return nullptr; } const char * StringEnumeration::next(int32_t *resultLength, UErrorCode &status) { const UnicodeString *s=snext(status); - if(U_SUCCESS(status) && s!=NULL) { + if(U_SUCCESS(status) && s!=nullptr) { unistr=*s; ensureCharsCapacity(unistr.length()+1, status); if(U_SUCCESS(status)) { - if(resultLength!=NULL) { + if(resultLength!=nullptr) { *resultLength=unistr.length(); } unistr.extract(0, INT32_MAX, chars, charsCapacity, US_INV); @@ -55,21 +55,21 @@ StringEnumeration::next(int32_t *resultLength, UErrorCode &status) { } } - return NULL; + return nullptr; } -const UChar * +const char16_t * StringEnumeration::unext(int32_t *resultLength, UErrorCode &status) { const UnicodeString *s=snext(status); - if(U_SUCCESS(status) && s!=NULL) { + if(U_SUCCESS(status) && s!=nullptr) { unistr=*s; - if(resultLength!=NULL) { + if(resultLength!=nullptr) { *resultLength=unistr.length(); } return unistr.getTerminatedBuffer(); } - return NULL; + return nullptr; } const UnicodeString * @@ -90,7 +90,7 @@ StringEnumeration::ensureCharsCapacity(int32_t capacity, UErrorCode &status) { uprv_free(chars); } chars=(char *)uprv_malloc(capacity); - if(chars==NULL) { + if(chars==nullptr) { chars=charsBuffer; charsCapacity=sizeof(charsBuffer); status=U_MEMORY_ALLOCATION_ERROR; @@ -102,13 +102,13 @@ StringEnumeration::ensureCharsCapacity(int32_t capacity, UErrorCode &status) { UnicodeString * StringEnumeration::setChars(const char *s, int32_t length, UErrorCode &status) { - if(U_SUCCESS(status) && s!=NULL) { + if(U_SUCCESS(status) && s!=nullptr) { if(length<0) { length=(int32_t)uprv_strlen(s); } - UChar *buffer=unistr.getBuffer(length+1); - if(buffer!=NULL) { + char16_t *buffer=unistr.getBuffer(length+1); + if(buffer!=nullptr) { u_charsToUChars(s, buffer, length); buffer[length]=0; unistr.releaseBuffer(length); @@ -118,11 +118,11 @@ StringEnumeration::setChars(const char *s, int32_t length, UErrorCode &status) { } } - return NULL; + return nullptr; } bool StringEnumeration::operator==(const StringEnumeration& that)const { - return typeid(*this) == typeid(that); + return typeid(*this) == typeid(that); } bool @@ -137,13 +137,13 @@ UStringEnumeration::fromUEnumeration( UEnumeration *uenumToAdopt, UErrorCode &status) { if (U_FAILURE(status)) { uenum_close(uenumToAdopt); - return NULL; + return nullptr; } UStringEnumeration *result = new UStringEnumeration(uenumToAdopt); - if (result == NULL) { + if (result == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; uenum_close(uenumToAdopt); - return NULL; + return nullptr; } return result; } @@ -167,7 +167,7 @@ const char *UStringEnumeration::next(int32_t *resultLength, UErrorCode &status) const UnicodeString* UStringEnumeration::snext(UErrorCode& status) { int32_t length; - const UChar* str = uenum_unext(uenum, &length, &status); + const char16_t* str = uenum_unext(uenum, &length, &status); if (str == 0 || U_FAILURE(status)) { return 0; } @@ -183,7 +183,7 @@ U_NAMESPACE_END // C wrapper --------------------------------------------------------------- *** -#define ustrenum_THIS(en) ((icu::StringEnumeration*)(en->context)) +#define THIS(en) ((icu::StringEnumeration*)(en->context)) U_CDECL_BEGIN @@ -192,7 +192,7 @@ U_CDECL_BEGIN */ static void U_CALLCONV ustrenum_close(UEnumeration* en) { - delete ustrenum_THIS(en); + delete THIS(en); uprv_free(en); } @@ -203,18 +203,18 @@ static int32_t U_CALLCONV ustrenum_count(UEnumeration* en, UErrorCode* ec) { - return ustrenum_THIS(en)->count(*ec); + return THIS(en)->count(*ec); } /** * Wrapper API to make StringEnumeration look like UEnumeration. */ -static const UChar* U_CALLCONV +static const char16_t* U_CALLCONV ustrenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* ec) { - return ustrenum_THIS(en)->unext(resultLength, *ec); + return THIS(en)->unext(resultLength, *ec); } /** @@ -225,7 +225,7 @@ ustrenum_next(UEnumeration* en, int32_t* resultLength, UErrorCode* ec) { - return ustrenum_THIS(en)->next(resultLength, *ec); + return THIS(en)->next(resultLength, *ec); } /** @@ -235,7 +235,7 @@ static void U_CALLCONV ustrenum_reset(UEnumeration* en, UErrorCode* ec) { - ustrenum_THIS(en)->reset(*ec); + THIS(en)->reset(*ec); } /** @@ -243,8 +243,8 @@ ustrenum_reset(UEnumeration* en, * The StringEnumeration pointer will be stored in 'context'. */ static const UEnumeration USTRENUM_VT = { - NULL, - NULL, // store StringEnumeration pointer here + nullptr, + nullptr, // store StringEnumeration pointer here ustrenum_close, ustrenum_count, ustrenum_unext, @@ -260,18 +260,18 @@ U_CDECL_END * delete it (regardless of error status). */ U_CAPI UEnumeration* U_EXPORT2 -uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec) { - UEnumeration* result = NULL; - if (U_SUCCESS(*ec) && adopted != NULL) { +uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec) { + UEnumeration* result = nullptr; + if (U_SUCCESS(*ec) && adopted != nullptr) { result = (UEnumeration*) uprv_malloc(sizeof(UEnumeration)); - if (result == NULL) { + if (result == nullptr) { *ec = U_MEMORY_ALLOCATION_ERROR; } else { uprv_memcpy(result, &USTRENUM_VT, sizeof(USTRENUM_VT)); result->context = adopted; } } - if (result == NULL) { + if (result == nullptr) { delete adopted; } return result; @@ -297,15 +297,15 @@ ucharstrenum_count(UEnumeration* en, return ((UCharStringEnumeration*)en)->count; } -static const UChar* U_CALLCONV +static const char16_t* U_CALLCONV ucharstrenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* /*ec*/) { UCharStringEnumeration *e = (UCharStringEnumeration*) en; if (e->index >= e->count) { - return NULL; + return nullptr; } - const UChar* result = ((const UChar**)e->uenum.context)[e->index++]; + const char16_t* result = ((const char16_t**)e->uenum.context)[e->index++]; if (resultLength) { *resultLength = (int32_t)u_strlen(result); } @@ -319,7 +319,7 @@ ucharstrenum_next(UEnumeration* en, UErrorCode* /*ec*/) { UCharStringEnumeration *e = (UCharStringEnumeration*) en; if (e->index >= e->count) { - return NULL; + return nullptr; } const char* result = ((const char**)e->uenum.context)[e->index++]; if (resultLength) { @@ -335,8 +335,8 @@ ucharstrenum_reset(UEnumeration* en, } static const UEnumeration UCHARSTRENUM_VT = { - NULL, - NULL, // store StringEnumeration pointer here + nullptr, + nullptr, // store StringEnumeration pointer here ucharstrenum_close, ucharstrenum_count, uenum_unextDefault, @@ -345,8 +345,8 @@ static const UEnumeration UCHARSTRENUM_VT = { }; static const UEnumeration UCHARSTRENUM_U_VT = { - NULL, - NULL, // store StringEnumeration pointer here + nullptr, + nullptr, // store StringEnumeration pointer here ucharstrenum_close, ucharstrenum_count, ucharstrenum_unext, @@ -359,10 +359,10 @@ U_CDECL_END U_CAPI UEnumeration* U_EXPORT2 uenum_openCharStringsEnumeration(const char* const strings[], int32_t count, UErrorCode* ec) { - UCharStringEnumeration* result = NULL; + UCharStringEnumeration* result = nullptr; if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != 0)) { result = (UCharStringEnumeration*) uprv_malloc(sizeof(UCharStringEnumeration)); - if (result == NULL) { + if (result == nullptr) { *ec = U_MEMORY_ALLOCATION_ERROR; } else { U_ASSERT((char*)result==(char*)(&result->uenum)); @@ -376,12 +376,12 @@ uenum_openCharStringsEnumeration(const char* const strings[], int32_t count, } U_CAPI UEnumeration* U_EXPORT2 -uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count, +uenum_openUCharStringsEnumeration(const char16_t* const strings[], int32_t count, UErrorCode* ec) { - UCharStringEnumeration* result = NULL; + UCharStringEnumeration* result = nullptr; if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != 0)) { result = (UCharStringEnumeration*) uprv_malloc(sizeof(UCharStringEnumeration)); - if (result == NULL) { + if (result == nullptr) { *ec = U_MEMORY_ALLOCATION_ERROR; } else { U_ASSERT((char*)result==(char*)(&result->uenum)); diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustrenum.h b/src/duckdb/extension/icu/third_party/icu/common/ustrenum.h index a82162e2b..ff546ca0a 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustrenum.h +++ b/src/duckdb/extension/icu/third_party/icu/common/ustrenum.h @@ -47,28 +47,28 @@ class U_COMMON_API UStringEnumeration : public StringEnumeration { * @param status the error code. * @return number of elements in the iterator. */ - virtual int32_t count(UErrorCode& status) const; + virtual int32_t count(UErrorCode& status) const override; - virtual const char* next(int32_t *resultLength, UErrorCode& status); + virtual const char* next(int32_t *resultLength, UErrorCode& status) override; /** * Returns the next element a UnicodeString*. If there are no - * more elements, returns NULL. + * more elements, returns nullptr. * @param status the error code. - * @return a pointer to the string, or NULL. + * @return a pointer to the string, or nullptr. */ - virtual const UnicodeString* snext(UErrorCode& status); + virtual const UnicodeString* snext(UErrorCode& status) override; /** * Resets the iterator. * @param status the error code. */ - virtual void reset(UErrorCode& status); + virtual void reset(UErrorCode& status) override; /** * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; /** * ICU4C "poor man's RTTI", returns a UClassID for this ICU class. diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustrfmt.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustrfmt.cpp index 1a9b15a59..3db9f3582 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustrfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ustrfmt.cpp @@ -12,11 +12,11 @@ /*** - * Fills in a UChar* string with the radix-based representation of a + * Fills in a char16_t* string with the radix-based representation of a * uint32_t number padded with zeroes to minwidth. The result * will be null terminated if there is room. * - * @param buffer UChar buffer to receive result + * @param buffer char16_t buffer to receive result * @param capacity capacity of buffer * @param i the unsigned number to be formatted * @param radix the radix from 2..36 @@ -27,26 +27,26 @@ * null */ U_CAPI int32_t U_EXPORT2 -uprv_itou (UChar * buffer, int32_t capacity, +uprv_itou (char16_t * buffer, int32_t capacity, uint32_t i, uint32_t radix, int32_t minwidth) { int32_t length = 0; int digit; int32_t j; - UChar temp; + char16_t temp; do{ digit = (int)(i % radix); - buffer[length++]=(UChar)(digit<=9?(0x0030+digit):(0x0030+digit+7)); + buffer[length++]=(char16_t)(digit<=9?(0x0030+digit):(0x0030+digit+7)); i=i/radix; } while(i && length= 0) { - return (UChar *)string + idx; + return (char16_t *)string + idx; } else { - return NULL; + return nullptr; } } /* Search for a codepoint in a string that matches one of the matchSet codepoints. */ U_CAPI int32_t U_EXPORT2 -u_strcspn(const UChar *string, const UChar *matchSet) +u_strcspn(const char16_t *string, const char16_t *matchSet) { - int32_t idx = _matchFromSet(string, matchSet, TRUE); + int32_t idx = _matchFromSet(string, matchSet, true); if(idx >= 0) { return idx; } else { @@ -562,9 +562,9 @@ u_strcspn(const UChar *string, const UChar *matchSet) /* Search for a codepoint in a string that does not match one of the matchSet codepoints. */ U_CAPI int32_t U_EXPORT2 -u_strspn(const UChar *string, const UChar *matchSet) +u_strspn(const char16_t *string, const char16_t *matchSet) { - int32_t idx = _matchFromSet(string, matchSet, FALSE); + int32_t idx = _matchFromSet(string, matchSet, false); if(idx >= 0) { return idx; } else { @@ -574,17 +574,17 @@ u_strspn(const UChar *string, const UChar *matchSet) /* ----- Text manipulation functions --- */ -U_CAPI UChar* U_EXPORT2 -u_strtok_r(UChar *src, - const UChar *delim, - UChar **saveState) +U_CAPI char16_t* U_EXPORT2 +u_strtok_r(char16_t *src, + const char16_t *delim, + char16_t **saveState) { - UChar *tokSource; - UChar *nextToken; + char16_t *tokSource; + char16_t *nextToken; uint32_t nonDelimIdx; - /* If saveState is NULL, the user messed up. */ - if (src != NULL) { + /* If saveState is nullptr, the user messed up. */ + if (src != nullptr) { tokSource = src; *saveState = src; /* Set to "src" in case there are no delimiters */ } @@ -592,9 +592,9 @@ u_strtok_r(UChar *src, tokSource = *saveState; } else { - /* src == NULL && *saveState == NULL */ + /* src == nullptr && *saveState == nullptr */ /* This shouldn't happen. We already finished tokenizing. */ - return NULL; + return nullptr; } /* Skip initial delimiters */ @@ -603,7 +603,7 @@ u_strtok_r(UChar *src, if (*tokSource) { nextToken = u_strpbrk(tokSource, delim); - if (nextToken != NULL) { + if (nextToken != nullptr) { /* Create a token */ *(nextToken++) = 0; *saveState = nextToken; @@ -611,24 +611,24 @@ u_strtok_r(UChar *src, } else if (*saveState) { /* Return the last token */ - *saveState = NULL; + *saveState = nullptr; return tokSource; } } else { /* No tokens were found. Only delimiters were left. */ - *saveState = NULL; + *saveState = nullptr; } - return NULL; + return nullptr; } /* Miscellaneous functions -------------------------------------------------- */ -U_CAPI UChar* U_EXPORT2 -u_strcat(UChar *dst, - const UChar *src) +U_CAPI char16_t* U_EXPORT2 +u_strcat(char16_t *dst, + const char16_t *src) { - UChar *anchor = dst; /* save a pointer to start of dst */ + char16_t *anchor = dst; /* save a pointer to start of dst */ while(*dst != 0) { /* To end of first string */ ++dst; @@ -639,13 +639,13 @@ u_strcat(UChar *dst, return anchor; } -U_CAPI UChar* U_EXPORT2 -u_strncat(UChar *dst, - const UChar *src, - int32_t n ) +U_CAPI char16_t* U_EXPORT2 +u_strncat(char16_t *dst, + const char16_t *src, + int32_t n ) { if(n > 0) { - UChar *anchor = dst; /* save a pointer to start of dst */ + char16_t *anchor = dst; /* save a pointer to start of dst */ while(*dst != 0) { /* To end of first string */ ++dst; @@ -668,10 +668,10 @@ u_strncat(UChar *dst, /* ----- Text property functions --- */ U_CAPI int32_t U_EXPORT2 -u_strcmp(const UChar *s1, - const UChar *s2) +u_strcmp(const char16_t *s1, + const char16_t *s2) { - UChar c1, c2; + char16_t c1, c2; for(;;) { c1=*s1++; @@ -684,11 +684,11 @@ u_strcmp(const UChar *s1, } U_CFUNC int32_t U_EXPORT2 -uprv_strCompare(const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, +uprv_strCompare(const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, UBool strncmpStyle, UBool codePointOrder) { - const UChar *start1, *start2, *limit1, *limit2; - UChar c1, c2; + const char16_t *start1, *start2, *limit1, *limit2; + char16_t c1, c2; /* setup for fix-up */ start1=s1; @@ -715,7 +715,7 @@ uprv_strCompare(const UChar *s1, int32_t length1, } /* setup for fix-up */ - limit1=limit2=NULL; + limit1=limit2=nullptr; } else if(strncmpStyle) { /* special handling for strncmp, assume length1==length2>=0 but also check for NUL */ if(s1==s2) { @@ -830,7 +830,7 @@ u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrde UChar32 c1, c2; /* argument checking */ - if(iter1==NULL || iter2==NULL) { + if(iter1==nullptr || iter2==nullptr) { return 0; /* bad arguments */ } if(iter1==iter2) { @@ -922,26 +922,26 @@ void fragment { #endif U_CAPI int32_t U_EXPORT2 -u_strCompare(const UChar *s1, int32_t length1, - const UChar *s2, int32_t length2, +u_strCompare(const char16_t *s1, int32_t length1, + const char16_t *s2, int32_t length2, UBool codePointOrder) { /* argument checking */ - if(s1==NULL || length1<-1 || s2==NULL || length2<-1) { + if(s1==nullptr || length1<-1 || s2==nullptr || length2<-1) { return 0; } - return uprv_strCompare(s1, length1, s2, length2, FALSE, codePointOrder); + return uprv_strCompare(s1, length1, s2, length2, false, codePointOrder); } /* String compare in code point order - u_strcmp() compares in code unit order. */ U_CAPI int32_t U_EXPORT2 -u_strcmpCodePointOrder(const UChar *s1, const UChar *s2) { - return uprv_strCompare(s1, -1, s2, -1, FALSE, TRUE); +u_strcmpCodePointOrder(const char16_t *s1, const char16_t *s2) { + return uprv_strCompare(s1, -1, s2, -1, false, true); } U_CAPI int32_t U_EXPORT2 -u_strncmp(const UChar *s1, - const UChar *s2, - int32_t n) +u_strncmp(const char16_t *s1, + const char16_t *s2, + int32_t n) { if(n > 0) { int32_t rc; @@ -959,15 +959,15 @@ u_strncmp(const UChar *s1, } U_CAPI int32_t U_EXPORT2 -u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n) { - return uprv_strCompare(s1, n, s2, n, TRUE, TRUE); +u_strncmpCodePointOrder(const char16_t *s1, const char16_t *s2, int32_t n) { + return uprv_strCompare(s1, n, s2, n, true, true); } -U_CAPI UChar* U_EXPORT2 -u_strcpy(UChar *dst, - const UChar *src) +U_CAPI char16_t* U_EXPORT2 +u_strcpy(char16_t *dst, + const char16_t *src) { - UChar *anchor = dst; /* save a pointer to start of dst */ + char16_t *anchor = dst; /* save a pointer to start of dst */ while((*(dst++) = *(src++)) != 0) { /* copy string 2 over */ } @@ -975,12 +975,12 @@ u_strcpy(UChar *dst, return anchor; } -U_CAPI UChar* U_EXPORT2 -u_strncpy(UChar *dst, - const UChar *src, - int32_t n) +U_CAPI char16_t* U_EXPORT2 +u_strncpy(char16_t *dst, + const char16_t *src, + int32_t n) { - UChar *anchor = dst; /* save a pointer to start of dst */ + char16_t *anchor = dst; /* save a pointer to start of dst */ /* copy string 2 over */ while(n > 0 && (*(dst++) = *(src++)) != 0) { @@ -991,24 +991,24 @@ u_strncpy(UChar *dst, } U_CAPI int32_t U_EXPORT2 -u_strlen(const UChar *s) +u_strlen(const char16_t *s) { -// #if U_SIZEOF_WCHAR_T == U_SIZEOF_UCHAR -// return (int32_t)uprv_wcslen((const wchar_t *)s); -// #else - const UChar *t = s; +#if U_SIZEOF_WCHAR_T == U_SIZEOF_UCHAR + return (int32_t)uprv_wcslen((const wchar_t *)s); +#else + const char16_t *t = s; while(*t != 0) { ++t; } return t - s; -// #endif +#endif } U_CAPI int32_t U_EXPORT2 -u_countChar32(const UChar *s, int32_t length) { +u_countChar32(const char16_t *s, int32_t length) { int32_t count; - if(s==NULL || length<-1) { + if(s==nullptr || length<-1) { return 0; } @@ -1025,7 +1025,7 @@ u_countChar32(const UChar *s, int32_t length) { } } } else /* length==-1 */ { - UChar c; + char16_t c; for(;;) { if((c=*s++)==0) { @@ -1046,26 +1046,26 @@ u_countChar32(const UChar *s, int32_t length) { } U_CAPI UBool U_EXPORT2 -u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) { +u_strHasMoreChar32Than(const char16_t *s, int32_t length, int32_t number) { if(number<0) { - return TRUE; + return true; } - if(s==NULL || length<-1) { - return FALSE; + if(s==nullptr || length<-1) { + return false; } if(length==-1) { /* s is NUL-terminated */ - UChar c; + char16_t c; /* count code points until they exceed */ for(;;) { if((c=*s++)==0) { - return FALSE; + return false; } if(number==0) { - return TRUE; + return true; } if(U16_IS_LEAD(c) && U16_IS_TRAIL(*s)) { ++s; @@ -1074,38 +1074,38 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) { } } else { /* length>=0 known */ - const UChar *limit; + const char16_t *limit; int32_t maxSupplementary; /* s contains at least (length+1)/2 code points: <=2 UChars per cp */ if(((length+1)/2)>number) { - return TRUE; + return true; } /* check if s does not even contain enough UChars */ maxSupplementary=length-number; if(maxSupplementary<=0) { - return FALSE; + return false; } /* there are maxSupplementary=length-number more UChars than asked-for code points */ /* * count code points until they exceed and also check that there are - * no more than maxSupplementary supplementary code points (UChar pairs) + * no more than maxSupplementary supplementary code points (char16_t pairs) */ limit=s+length; for(;;) { if(s==limit) { - return FALSE; + return false; } if(number==0) { - return TRUE; + return true; } if(U16_IS_LEAD(*s++) && s!=limit && U16_IS_TRAIL(*s)) { ++s; if(--maxSupplementary<=0) { /* too many pairs - too few code points */ - return FALSE; + return false; } } --number; @@ -1113,27 +1113,27 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) { } } -U_CAPI UChar * U_EXPORT2 -u_memcpy(UChar *dest, const UChar *src, int32_t count) { +U_CAPI char16_t * U_EXPORT2 +u_memcpy(char16_t *dest, const char16_t *src, int32_t count) { if(count > 0) { uprv_memcpy(dest, src, (size_t)count*U_SIZEOF_UCHAR); } return dest; } -U_CAPI UChar * U_EXPORT2 -u_memmove(UChar *dest, const UChar *src, int32_t count) { +U_CAPI char16_t * U_EXPORT2 +u_memmove(char16_t *dest, const char16_t *src, int32_t count) { if(count > 0) { uprv_memmove(dest, src, (size_t)count*U_SIZEOF_UCHAR); } return dest; } -U_CAPI UChar * U_EXPORT2 -u_memset(UChar *dest, UChar c, int32_t count) { +U_CAPI char16_t * U_EXPORT2 +u_memset(char16_t *dest, char16_t c, int32_t count) { if(count > 0) { - UChar *ptr = dest; - UChar *limit = dest + count; + char16_t *ptr = dest; + char16_t *limit = dest + count; while (ptr < limit) { *(ptr++) = c; @@ -1143,9 +1143,9 @@ u_memset(UChar *dest, UChar c, int32_t count) { } U_CAPI int32_t U_EXPORT2 -u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count) { +u_memcmp(const char16_t *buf1, const char16_t *buf2, int32_t count) { if(count > 0) { - const UChar *limit = buf1 + count; + const char16_t *limit = buf1 + count; int32_t result; while (buf1 < limit) { @@ -1161,14 +1161,14 @@ u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count) { } U_CAPI int32_t U_EXPORT2 -u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count) { - return uprv_strCompare(s1, count, s2, count, FALSE, TRUE); +u_memcmpCodePointOrder(const char16_t *s1, const char16_t *s2, int32_t count) { + return uprv_strCompare(s1, count, s2, count, false, true); } /* u_unescape & support fns ------------------------------------------------- */ /* This map must be in ASCENDING ORDER OF THE ESCAPE CODE */ -static const UChar UNESCAPE_MAP[] = { +static const char16_t UNESCAPE_MAP[] = { /*" 0x22, 0x22 */ /*' 0x27, 0x27 */ /*? 0x3F, 0x3F */ @@ -1185,23 +1185,23 @@ static const UChar UNESCAPE_MAP[] = { enum { UNESCAPE_MAP_LENGTH = UPRV_LENGTHOF(UNESCAPE_MAP) }; /* Convert one octal digit to a numeric value 0..7, or -1 on failure */ -static int8_t _digit8(UChar c) { - if (c >= 0x0030 && c <= 0x0037) { - return (int8_t)(c - 0x0030); +static int32_t _digit8(char16_t c) { + if (c >= u'0' && c <= u'7') { + return c - u'0'; } return -1; } /* Convert one hex digit to a numeric value 0..F, or -1 on failure */ -static int8_t _digit16(UChar c) { - if (c >= 0x0030 && c <= 0x0039) { - return (int8_t)(c - 0x0030); +static int32_t _digit16(char16_t c) { + if (c >= u'0' && c <= u'9') { + return c - u'0'; } - if (c >= 0x0041 && c <= 0x0046) { - return (int8_t)(c - (0x0041 - 10)); + if (c >= u'A' && c <= u'F') { + return c - (u'A' - 10); } - if (c >= 0x0061 && c <= 0x0066) { - return (int8_t)(c - (0x0061 - 10)); + if (c >= u'a' && c <= u'f') { + return c - (u'a' - 10); } return -1; } @@ -1216,37 +1216,36 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt, void *context) { int32_t start = *offset; - UChar c; + UChar32 c; UChar32 result = 0; int8_t n = 0; int8_t minDig = 0; int8_t maxDig = 0; - int8_t bitsPerDigit = 4; - int8_t dig; - int32_t i; - UBool braces = FALSE; + int8_t bitsPerDigit = 4; + int32_t dig; + UBool braces = false; /* Check that offset is in range */ if (*offset < 0 || *offset >= length) { goto err; } - /* Fetch first UChar after '\\' */ + /* Fetch first char16_t after '\\' */ c = charAt((*offset)++, context); /* Convert hexadecimal and octal escapes */ switch (c) { - case 0x0075 /*'u'*/: + case u'u': minDig = maxDig = 4; break; - case 0x0055 /*'U'*/: + case u'U': minDig = maxDig = 8; break; - case 0x0078 /*'x'*/: + case u'x': minDig = 1; - if (*offset < length && charAt(*offset, context) == 0x7B /*{*/) { + if (*offset < length && charAt(*offset, context) == u'{') { ++(*offset); - braces = TRUE; + braces = true; maxDig = 8; } else { maxDig = 2; @@ -1266,7 +1265,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt, if (minDig != 0) { while (*offset < length && n < maxDig) { c = charAt(*offset, context); - dig = (int8_t)((bitsPerDigit == 3) ? _digit8(c) : _digit16(c)); + dig = (bitsPerDigit == 3) ? _digit8(c) : _digit16(c); if (dig < 0) { break; } @@ -1278,7 +1277,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt, goto err; } if (braces) { - if (c != 0x7D /*}*/) { + if (c != u'}') { goto err; } ++(*offset); @@ -1293,8 +1292,15 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt, if (*offset < length && U16_IS_LEAD(result)) { int32_t ahead = *offset + 1; c = charAt(*offset, context); - if (c == 0x5C /*'\\'*/ && ahead < length) { - c = (UChar) u_unescapeAt(charAt, &ahead, length, context); + if (c == u'\\' && ahead < length) { + // Calling ourselves recursively may cause a stack overflow if + // we have repeated escaped lead surrogates. + // Limit the length to 11 ("x{0000DFFF}") after ahead. + int32_t tailLimit = ahead + 11; + if (tailLimit > length) { + tailLimit = length; + } + c = u_unescapeAt(charAt, &ahead, tailLimit, context); } if (U16_IS_TRAIL(c)) { *offset = ahead; @@ -1305,7 +1311,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt, } /* Convert C-style escapes in table */ - for (i=0; i UChar*, with escape parsing */ +/* Do an invariant conversion of char* -> char16_t*, with escape parsing */ U_CAPI int32_t U_EXPORT2 -u_unescape(const char *src, UChar *dest, int32_t destCapacity) { +u_unescape(const char *src, char16_t *dest, int32_t destCapacity) { const char *segment = src; int32_t i = 0; char c; @@ -1381,7 +1387,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) { int32_t lenParsed = 0; UChar32 c32; if (src != segment) { - if (dest != NULL) { + if (dest != nullptr) { _appendUChars(dest + i, destCapacity - i, segment, (int32_t)(src - segment)); } @@ -1393,7 +1399,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) { goto err; } src += lenParsed; /* advance past escape seq. */ - if (dest != NULL && U16_LENGTH(c32) <= (destCapacity - i)) { + if (dest != nullptr && U16_LENGTH(c32) <= (destCapacity - i)) { U16_APPEND_UNSAFE(dest, i, c32); } else { i += U16_LENGTH(c32); @@ -1404,19 +1410,19 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) { } } if (src != segment) { - if (dest != NULL) { + if (dest != nullptr) { _appendUChars(dest + i, destCapacity - i, segment, (int32_t)(src - segment)); } i += (int32_t)(src - segment); } - if (dest != NULL && i < destCapacity) { + if (dest != nullptr && i < destCapacity) { dest[i] = 0; } return i; err: - if (dest != NULL && destCapacity > 0) { + if (dest != nullptr && destCapacity > 0) { *dest = 0; } return 0; @@ -1429,7 +1435,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) { * Set warning and error codes accordingly. */ #define __TERMINATE_STRING(dest, destCapacity, length, pErrorCode) UPRV_BLOCK_MACRO_BEGIN { \ - if(pErrorCode!=NULL && U_SUCCESS(*pErrorCode)) { \ + if(pErrorCode!=nullptr && U_SUCCESS(*pErrorCode)) { \ /* not a public function, so no complete argument checking */ \ \ if(length<0) { \ @@ -1451,8 +1457,16 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) { } \ } UPRV_BLOCK_MACRO_END +U_CAPI char16_t U_EXPORT2 +u_asciiToUpper(char16_t c) { + if (u'a' <= c && c <= u'z') { + c = c + u'A' - u'a'; + } + return c; +} + U_CAPI int32_t U_EXPORT2 -u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode) { +u_terminateUChars(char16_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode) { __TERMINATE_STRING(dest, destCapacity, length, pErrorCode); return length; } @@ -1492,7 +1506,7 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod #define STRING_HASH(TYPE, STR, STRLEN, DEREF) UPRV_BLOCK_MACRO_BEGIN { \ uint32_t hash = 0; \ const TYPE *p = (const TYPE*) STR; \ - if (p != NULL) { \ + if (p != nullptr) { \ int32_t len = (int32_t)(STRLEN); \ int32_t inc = ((len - 32) / 32) + 1; \ const TYPE *limit = p + len; \ @@ -1506,8 +1520,8 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod /* Used by UnicodeString to compute its hashcode - Not public API. */ U_CAPI int32_t U_EXPORT2 -ustr_hashUCharsN(const UChar *str, int32_t length) { - STRING_HASH(UChar, str, length, *p); +ustr_hashUCharsN(const char16_t *str, int32_t length) { + STRING_HASH(char16_t, str, length, *p); } U_CAPI int32_t U_EXPORT2 diff --git a/src/duckdb/extension/icu/third_party/icu/common/ustrtrns.cpp b/src/duckdb/extension/icu/third_party/icu/common/ustrtrns.cpp index 5dc032c02..244c111fc 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/ustrtrns.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/ustrtrns.cpp @@ -36,8 +36,8 @@ #include "ustr_imp.h" #include "uassert.h" -U_CAPI UChar* U_EXPORT2 -u_strFromUTF32WithSub(UChar *dest, +U_CAPI char16_t* U_EXPORT2 +u_strFromUTF32WithSub(char16_t *dest, int32_t destCapacity, int32_t *pDestLength, const UChar32 *src, @@ -46,29 +46,29 @@ u_strFromUTF32WithSub(UChar *dest, UErrorCode *pErrorCode) { const UChar32 *srcLimit; UChar32 ch; - UChar *destLimit; - UChar *pDest; + char16_t *destLimit; + char16_t *pDest; int32_t reqLength; int32_t numSubstitutions; /* args check */ if(U_FAILURE(*pErrorCode)){ - return NULL; + return nullptr; } - if( (src==NULL && srcLength!=0) || srcLength < -1 || - (destCapacity<0) || (dest == NULL && destCapacity > 0) || + if( (src==nullptr && srcLength!=0) || srcLength < -1 || + (destCapacity<0) || (dest == nullptr && destCapacity > 0) || subchar > 0x10ffff || U_IS_SURROGATE(subchar) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if(pNumSubstitutions != NULL) { + if(pNumSubstitutions != nullptr) { *pNumSubstitutions = 0; } pDest = dest; - destLimit = (dest!=NULL)?(dest + destCapacity):NULL; + destLimit = (dest!=nullptr)?(dest + destCapacity):nullptr; reqLength = 0; numSubstitutions = 0; @@ -78,7 +78,7 @@ u_strFromUTF32WithSub(UChar *dest, ((uint32_t)ch < 0xd800 || (0xe000 <= ch && ch <= 0xffff))) { ++src; if(pDest < destLimit) { - *pDest++ = (UChar)ch; + *pDest++ = (char16_t)ch; } else { ++reqLength; } @@ -89,7 +89,7 @@ u_strFromUTF32WithSub(UChar *dest, while(*++srcLimit != 0) {} } } else { - srcLimit = (src!=NULL)?(src + srcLength):NULL; + srcLimit = (src!=nullptr)?(src + srcLength):nullptr; } /* convert with length */ @@ -99,13 +99,13 @@ u_strFromUTF32WithSub(UChar *dest, /* usually "loops" once; twice only for writing subchar */ if((uint32_t)ch < 0xd800 || (0xe000 <= ch && ch <= 0xffff)) { if(pDest < destLimit) { - *pDest++ = (UChar)ch; + *pDest++ = (char16_t)ch; } else { ++reqLength; } break; } else if(0x10000 <= ch && ch <= 0x10ffff) { - if(pDest!=NULL && ((pDest + 2) <= destLimit)) { + if(pDest!=nullptr && ((pDest + 2) <= destLimit)) { *pDest++ = U16_LEAD(ch); *pDest++ = U16_TRAIL(ch); } else { @@ -115,18 +115,18 @@ u_strFromUTF32WithSub(UChar *dest, } else if((ch = subchar) < 0) { /* surrogate code point, or not a Unicode code point at all */ *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } else { ++numSubstitutions; } - } while(TRUE); + } while(true); } reqLength += (int32_t)(pDest - dest); if(pDestLength) { *pDestLength = reqLength; } - if(pNumSubstitutions != NULL) { + if(pNumSubstitutions != nullptr) { *pNumSubstitutions = numSubstitutions; } @@ -136,8 +136,8 @@ u_strFromUTF32WithSub(UChar *dest, return dest; } -U_CAPI UChar* U_EXPORT2 -u_strFromUTF32(UChar *dest, +U_CAPI char16_t* U_EXPORT2 +u_strFromUTF32(char16_t *dest, int32_t destCapacity, int32_t *pDestLength, const UChar32 *src, @@ -146,7 +146,7 @@ u_strFromUTF32(UChar *dest, return u_strFromUTF32WithSub( dest, destCapacity, pDestLength, src, srcLength, - U_SENTINEL, NULL, + U_SENTINEL, nullptr, pErrorCode); } @@ -154,13 +154,13 @@ U_CAPI UChar32* U_EXPORT2 u_strToUTF32WithSub(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, - const UChar *src, + const char16_t *src, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode) { - const UChar *srcLimit; + const char16_t *srcLimit; UChar32 ch; - UChar ch2; + char16_t ch2; UChar32 *destLimit; UChar32 *pDest; int32_t reqLength; @@ -168,22 +168,22 @@ u_strToUTF32WithSub(UChar32 *dest, /* args check */ if(U_FAILURE(*pErrorCode)){ - return NULL; + return nullptr; } - if( (src==NULL && srcLength!=0) || srcLength < -1 || - (destCapacity<0) || (dest == NULL && destCapacity > 0) || + if( (src==nullptr && srcLength!=0) || srcLength < -1 || + (destCapacity<0) || (dest == nullptr && destCapacity > 0) || subchar > 0x10ffff || U_IS_SURROGATE(subchar) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if(pNumSubstitutions != NULL) { + if(pNumSubstitutions != nullptr) { *pNumSubstitutions = 0; } pDest = dest; - destLimit = (dest!=NULL)?(dest + destCapacity):NULL; + destLimit = (dest!=nullptr)?(dest + destCapacity):nullptr; reqLength = 0; numSubstitutions = 0; @@ -203,7 +203,7 @@ u_strToUTF32WithSub(UChar32 *dest, while(*++srcLimit != 0) {} } } else { - srcLimit = (src!=NULL)?(src + srcLength):NULL; + srcLimit = (src!=nullptr)?(src + srcLength):nullptr; } /* convert with length */ @@ -217,7 +217,7 @@ u_strToUTF32WithSub(UChar32 *dest, } else if((ch = subchar) < 0) { /* unpaired surrogate */ *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } else { ++numSubstitutions; } @@ -232,7 +232,7 @@ u_strToUTF32WithSub(UChar32 *dest, if(pDestLength) { *pDestLength = reqLength; } - if(pNumSubstitutions != NULL) { + if(pNumSubstitutions != nullptr) { *pNumSubstitutions = numSubstitutions; } @@ -246,18 +246,18 @@ U_CAPI UChar32* U_EXPORT2 u_strToUTF32(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, - const UChar *src, + const char16_t *src, int32_t srcLength, UErrorCode *pErrorCode) { return u_strToUTF32WithSub( dest, destCapacity, pDestLength, src, srcLength, - U_SENTINEL, NULL, + U_SENTINEL, nullptr, pErrorCode); } -U_CAPI UChar* U_EXPORT2 -u_strFromUTF8WithSub(UChar *dest, +U_CAPI char16_t* U_EXPORT2 +u_strFromUTF8WithSub(char16_t *dest, int32_t destCapacity, int32_t *pDestLength, const char* src, @@ -266,21 +266,21 @@ u_strFromUTF8WithSub(UChar *dest, UErrorCode *pErrorCode){ /* args check */ if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - if( (src==NULL && srcLength!=0) || srcLength < -1 || - (destCapacity<0) || (dest == NULL && destCapacity > 0) || + if( (src==nullptr && srcLength!=0) || srcLength < -1 || + (destCapacity<0) || (dest == nullptr && destCapacity > 0) || subchar > 0x10ffff || U_IS_SURROGATE(subchar) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if(pNumSubstitutions!=NULL) { + if(pNumSubstitutions!=nullptr) { *pNumSubstitutions=0; } - UChar *pDest = dest; - UChar *pDestLimit = dest+destCapacity; + char16_t *pDest = dest; + char16_t *pDestLimit = dest+destCapacity; int32_t reqLength = 0; int32_t numSubstitutions=0; @@ -309,7 +309,7 @@ u_strFromUTF8WithSub(UChar *dest, // modified copy of U8_NEXT() ++i; if(U8_IS_SINGLE(c)) { - *pDest++=(UChar)c; + *pDest++=(char16_t)c; } else { uint8_t __t1, __t2; if( /* handle U+0800..U+FFFF inline */ @@ -328,9 +328,9 @@ u_strFromUTF8WithSub(UChar *dest, (c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), -1, c, -1); if(c<0 && (++numSubstitutions, c = subchar) < 0) { *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } else if(c<=0xFFFF) { - *(pDest++)=(UChar)c; + *(pDest++)=(char16_t)c; } else { *(pDest++)=U16_LEAD(c); if(pDest 0) + if( (src==nullptr && srcLength!=0) || srcLength < -1 || + (destCapacity<0) || (dest == nullptr && destCapacity > 0) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } if(srcLength < 0) { /* Transform a NUL-terminated string. */ - UChar *pDestLimit = (dest!=NULL)?(dest+destCapacity):NULL; + char16_t *pDestLimit = (dest!=nullptr)?(dest+destCapacity):nullptr; uint8_t t1, t2, t3; /* trail bytes */ while(((ch = *pSrc) != 0) && (pDest < pDestLimit)) { @@ -586,21 +586,21 @@ u_strFromUTF8Lenient(UChar *dest, * a single-byte sequence for better character boundary * resynchronization after illegal sequences. */ - *pDest++=(UChar)ch; + *pDest++=(char16_t)ch; ++pSrc; continue; } else if(ch < 0xe0) { /* U+0080..U+07FF */ if((t1 = pSrc[1]) != 0) { /* 0x3080 = (0xc0 << 6) + 0x80 */ - *pDest++ = (UChar)((ch << 6) + t1 - 0x3080); + *pDest++ = (char16_t)((ch << 6) + t1 - 0x3080); pSrc += 2; continue; } } else if(ch < 0xf0) { /* U+0800..U+FFFF */ if((t1 = pSrc[1]) != 0 && (t2 = pSrc[2]) != 0) { - /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ + /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */ /* 0x2080 = (0x80 << 6) + 0x80 */ - *pDest++ = (UChar)((ch << 12) + (t1 << 6) + t2 - 0x2080); + *pDest++ = (char16_t)((ch << 12) + (t1 << 6) + t2 - 0x2080); pSrc += 3; continue; } @@ -662,7 +662,7 @@ u_strFromUTF8Lenient(UChar *dest, break; } } else /* srcLength >= 0 */ { - const uint8_t *pSrcLimit = (pSrc!=NULL)?(pSrc + srcLength):NULL; + const uint8_t *pSrcLimit = (pSrc!=nullptr)?(pSrc + srcLength):nullptr; /* * This function requires that if srcLength is given, then it must be @@ -670,11 +670,11 @@ u_strFromUTF8Lenient(UChar *dest, * destination buffer overflow in the loop. */ if(destCapacity < srcLength) { - if(pDestLength != NULL) { + if(pDestLength != nullptr) { *pDestLength = srcLength; /* this likely overestimates the true destLength! */ } *pErrorCode = U_BUFFER_OVERFLOW_ERROR; - return NULL; + return nullptr; } if((pSrcLimit - pSrc) >= 4) { @@ -689,15 +689,15 @@ u_strFromUTF8Lenient(UChar *dest, * a single-byte sequence for better character boundary * resynchronization after illegal sequences. */ - *pDest++=(UChar)ch; + *pDest++=(char16_t)ch; } else if(ch < 0xe0) { /* U+0080..U+07FF */ /* 0x3080 = (0xc0 << 6) + 0x80 */ - *pDest++ = (UChar)((ch << 6) + *pSrc++ - 0x3080); + *pDest++ = (char16_t)((ch << 6) + *pSrc++ - 0x3080); } else if(ch < 0xf0) { /* U+0800..U+FFFF */ - /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ + /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */ /* 0x2080 = (0x80 << 6) + 0x80 */ ch = (ch << 12) + (*pSrc++ << 6); - *pDest++ = (UChar)(ch + *pSrc++ - 0x2080); + *pDest++ = (char16_t)(ch + *pSrc++ - 0x2080); } else /* f0..f4 */ { /* U+10000..U+10FFFF */ /* 0x3c82080 = (0xf0 << 18) + (0x80 << 12) + (0x80 << 6) + 0x80 */ ch = (ch << 18) + (*pSrc++ << 12); @@ -719,20 +719,20 @@ u_strFromUTF8Lenient(UChar *dest, * a single-byte sequence for better character boundary * resynchronization after illegal sequences. */ - *pDest++=(UChar)ch; + *pDest++=(char16_t)ch; continue; } else if(ch < 0xe0) { /* U+0080..U+07FF */ if(pSrc < pSrcLimit) { /* 0x3080 = (0xc0 << 6) + 0x80 */ - *pDest++ = (UChar)((ch << 6) + *pSrc++ - 0x3080); + *pDest++ = (char16_t)((ch << 6) + *pSrc++ - 0x3080); continue; } } else if(ch < 0xf0) { /* U+0800..U+FFFF */ if((pSrcLimit - pSrc) >= 2) { - /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ + /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */ /* 0x2080 = (0x80 << 6) + 0x80 */ ch = (ch << 12) + (*pSrc++ << 6); - *pDest++ = (UChar)(ch + *pSrc++ - 0x2080); + *pDest++ = (char16_t)(ch + *pSrc++ - 0x2080); pSrc += 3; continue; } @@ -793,30 +793,30 @@ U_CAPI char* U_EXPORT2 u_strToUTF8WithSub(char *dest, int32_t destCapacity, int32_t *pDestLength, - const UChar *pSrc, + const char16_t *pSrc, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode){ int32_t reqLength=0; uint32_t ch=0,ch2=0; uint8_t *pDest = (uint8_t *)dest; - uint8_t *pDestLimit = (pDest!=NULL)?(pDest + destCapacity):NULL; + uint8_t *pDestLimit = (pDest!=nullptr)?(pDest + destCapacity):nullptr; int32_t numSubstitutions; /* args check */ if(U_FAILURE(*pErrorCode)){ - return NULL; + return nullptr; } - if( (pSrc==NULL && srcLength!=0) || srcLength < -1 || - (destCapacity<0) || (dest == NULL && destCapacity > 0) || + if( (pSrc==nullptr && srcLength!=0) || srcLength < -1 || + (destCapacity<0) || (dest == nullptr && destCapacity > 0) || subchar > 0x10ffff || U_IS_SURROGATE(subchar) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if(pNumSubstitutions!=NULL) { + if(pNumSubstitutions!=nullptr) { *pNumSubstitutions=0; } numSubstitutions=0; @@ -861,7 +861,7 @@ u_strToUTF8WithSub(char *dest, } else { /* Unicode 3.2 forbids surrogate code points in UTF-8 */ *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } length = U8_LENGTH(ch); @@ -890,18 +890,18 @@ u_strToUTF8WithSub(char *dest, } else { /* Unicode 3.2 forbids surrogate code points in UTF-8 */ *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } } } else { - const UChar *pSrcLimit = (pSrc!=NULL)?(pSrc+srcLength):NULL; + const char16_t *pSrcLimit = (pSrc!=nullptr)?(pSrc+srcLength):nullptr; int32_t count; /* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */ for(;;) { /* * Each iteration of the inner loop progresses by at most 3 UTF-8 - * bytes and one UChar, for most characters. + * bytes and one char16_t, for most characters. * For supplementary code points (4 & 2), which are rare, * there is an additional adjustment. */ @@ -955,7 +955,7 @@ u_strToUTF8WithSub(char *dest, ++numSubstitutions; } else { *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } /* convert and append*/ @@ -1003,7 +1003,7 @@ u_strToUTF8WithSub(char *dest, } else { /* Unicode 3.2 forbids surrogate code points in UTF-8 */ *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } length = U8_LENGTH(ch); @@ -1033,14 +1033,14 @@ u_strToUTF8WithSub(char *dest, } else { /* Unicode 3.2 forbids surrogate code points in UTF-8 */ *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } } } reqLength+=(int32_t)(pDest - (uint8_t *)dest); - if(pNumSubstitutions!=NULL) { + if(pNumSubstitutions!=nullptr) { *pNumSubstitutions=numSubstitutions; } @@ -1057,19 +1057,19 @@ U_CAPI char* U_EXPORT2 u_strToUTF8(char *dest, int32_t destCapacity, int32_t *pDestLength, - const UChar *pSrc, + const char16_t *pSrc, int32_t srcLength, UErrorCode *pErrorCode){ return u_strToUTF8WithSub( dest, destCapacity, pDestLength, pSrc, srcLength, - U_SENTINEL, NULL, + U_SENTINEL, nullptr, pErrorCode); } -U_CAPI UChar* U_EXPORT2 +U_CAPI char16_t* U_EXPORT2 u_strFromJavaModifiedUTF8WithSub( - UChar *dest, + char16_t *dest, int32_t destCapacity, int32_t *pDestLength, const char *src, @@ -1078,21 +1078,21 @@ u_strFromJavaModifiedUTF8WithSub( UErrorCode *pErrorCode) { /* args check */ if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - if( (src==NULL && srcLength!=0) || srcLength < -1 || - (dest==NULL && destCapacity!=0) || destCapacity<0 || + if( (src==nullptr && srcLength!=0) || srcLength < -1 || + (dest==nullptr && destCapacity!=0) || destCapacity<0 || subchar > 0x10ffff || U_IS_SURROGATE(subchar) ) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if(pNumSubstitutions!=NULL) { + if(pNumSubstitutions!=nullptr) { *pNumSubstitutions=0; } - UChar *pDest = dest; - UChar *pDestLimit = dest+destCapacity; + char16_t *pDest = dest; + char16_t *pDestLimit = dest+destCapacity; int32_t reqLength = 0; int32_t numSubstitutions=0; @@ -1103,7 +1103,7 @@ u_strFromJavaModifiedUTF8WithSub( */ UChar32 c; while(((c = (uint8_t)*src) != 0) && c <= 0x7f && (pDest < pDestLimit)) { - *pDest++=(UChar)c; + *pDest++=(char16_t)c; ++src; } if(c == 0) { @@ -1140,7 +1140,7 @@ u_strFromJavaModifiedUTF8WithSub( } /* * Each iteration of the inner loop progresses by at most 3 UTF-8 - * bytes and one UChar. + * bytes and one char16_t. */ if(subchar > 0xFFFF) { break; @@ -1159,7 +1159,7 @@ u_strFromJavaModifiedUTF8WithSub( do { ch = (uint8_t)src[i++]; if(U8_IS_SINGLE(ch)) { - *pDest++=(UChar)ch; + *pDest++=(char16_t)ch; } else { if(ch >= 0xe0) { if( /* handle U+0000..U+FFFF inline */ @@ -1167,8 +1167,8 @@ u_strFromJavaModifiedUTF8WithSub( (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f && (t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f ) { - /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ - *pDest++ = (UChar)((ch << 12) | (t1 << 6) | t2); + /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */ + *pDest++ = (char16_t)((ch << 12) | (t1 << 6) | t2); i += 2; continue; } @@ -1177,7 +1177,7 @@ u_strFromJavaModifiedUTF8WithSub( ch >= 0xc0 && (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f ) { - *pDest++ = (UChar)(((ch & 0x1f) << 6) | t1); + *pDest++ = (char16_t)(((ch & 0x1f) << 6) | t1); ++i; continue; } @@ -1185,7 +1185,7 @@ u_strFromJavaModifiedUTF8WithSub( if(subchar < 0) { *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } else if(subchar > 0xffff && --count == 0) { /* * We need to write two UChars, adjusted count for that, @@ -1197,7 +1197,7 @@ u_strFromJavaModifiedUTF8WithSub( /* function call for error cases */ utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1); ++numSubstitutions; - *(pDest++)=(UChar)subchar; + *(pDest++)=(char16_t)subchar; } } } while(--count > 0); @@ -1206,7 +1206,7 @@ u_strFromJavaModifiedUTF8WithSub( while(i < srcLength && (pDest < pDestLimit)) { ch = (uint8_t)src[i++]; if(U8_IS_SINGLE(ch)){ - *pDest++=(UChar)ch; + *pDest++=(char16_t)ch; } else { if(ch >= 0xe0) { if( /* handle U+0000..U+FFFF inline */ @@ -1215,8 +1215,8 @@ u_strFromJavaModifiedUTF8WithSub( (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f && (t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f ) { - /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ - *pDest++ = (UChar)((ch << 12) | (t1 << 6) | t2); + /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */ + *pDest++ = (char16_t)((ch << 12) | (t1 << 6) | t2); i += 2; continue; } @@ -1226,7 +1226,7 @@ u_strFromJavaModifiedUTF8WithSub( i < srcLength && (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f ) { - *pDest++ = (UChar)(((ch & 0x1f) << 6) | t1); + *pDest++ = (char16_t)(((ch & 0x1f) << 6) | t1); ++i; continue; } @@ -1234,13 +1234,13 @@ u_strFromJavaModifiedUTF8WithSub( if(subchar < 0) { *pErrorCode = U_INVALID_CHAR_FOUND; - return NULL; + return nullptr; } else { /* function call for error cases */ utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1); ++numSubstitutions; if(subchar<=0xFFFF) { - *(pDest++)=(UChar)subchar; + *(pDest++)=(char16_t)subchar; } else { *(pDest++)=U16_LEAD(subchar); if(pDest= srcLength && srcLength > 0 && *src <= 0x7f) { /* fast ASCII loop */ - const UChar *prevSrc = src; + const char16_t *prevSrc = src; int32_t delta; while(src < pSrcLimit && (ch = *src) <= 0x7f && ch != 0) { *pDest++=(uint8_t)ch; @@ -1373,7 +1373,7 @@ u_strToJavaModifiedUTF8( } /* * Each iteration of the inner loop progresses by at most 3 UTF-8 - * bytes and one UChar. + * bytes and one char16_t. */ count /= 3; if(count > srcLength) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/utext.cpp b/src/duckdb/extension/icu/third_party/icu/common/utext.cpp index 925c88d35..eb0a6984b 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utext.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/utext.cpp @@ -16,6 +16,8 @@ * created by: Markus W. Scherer */ +#include + #include "unicode/utypes.h" #include "unicode/ustring.h" #include "unicode/unistr.h" @@ -47,14 +49,14 @@ utext_moveIndex32(UText *ut, int32_t delta) { UChar32 c; if (delta > 0) { do { - if(ut->chunkOffset>=ut->chunkLength && !utext_access(ut, ut->chunkNativeLimit, TRUE)) { - return FALSE; + if(ut->chunkOffset>=ut->chunkLength && !utext_access(ut, ut->chunkNativeLimit, true)) { + return false; } c = ut->chunkContents[ut->chunkOffset]; if (U16_IS_SURROGATE(c)) { c = utext_next32(ut); if (c == U_SENTINEL) { - return FALSE; + return false; } } else { ut->chunkOffset++; @@ -63,14 +65,14 @@ utext_moveIndex32(UText *ut, int32_t delta) { } else if (delta<0) { do { - if(ut->chunkOffset<=0 && !utext_access(ut, ut->chunkNativeStart, FALSE)) { - return FALSE; + if(ut->chunkOffset<=0 && !utext_access(ut, ut->chunkNativeStart, false)) { + return false; } c = ut->chunkContents[ut->chunkOffset-1]; if (U16_IS_SURROGATE(c)) { c = utext_previous32(ut); if (c == U_SENTINEL) { - return FALSE; + return false; } } else { ut->chunkOffset--; @@ -78,7 +80,7 @@ utext_moveIndex32(UText *ut, int32_t delta) { } while(++delta<0); } - return TRUE; + return true; } @@ -112,7 +114,7 @@ utext_setNativeIndex(UText *ut, int64_t index) { // Access the new position. Assume a forward iteration from here, // which will also be optimimum for a single random access. // Reverse iterations may suffer slightly. - ut->pFuncs->access(ut, index, TRUE); + ut->pFuncs->access(ut, index, true); } else if((int32_t)(index - ut->chunkNativeStart) <= ut->nativeIndexingLimit) { // utf-16 indexing. ut->chunkOffset=(int32_t)(index-ut->chunkNativeStart); @@ -122,13 +124,13 @@ utext_setNativeIndex(UText *ut, int64_t index) { // The convention is that the index must always be on a code point boundary. // Adjust the index position if it is in the middle of a surrogate pair. if (ut->chunkOffsetchunkLength) { - UChar c= ut->chunkContents[ut->chunkOffset]; + char16_t c= ut->chunkContents[ut->chunkOffset]; if (U16_IS_TRAIL(c)) { if (ut->chunkOffset==0) { - ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE); + ut->pFuncs->access(ut, ut->chunkNativeStart, false); } if (ut->chunkOffset>0) { - UChar lead = ut->chunkContents[ut->chunkOffset-1]; + char16_t lead = ut->chunkContents[ut->chunkOffset-1]; if (U16_IS_LEAD(lead)) { ut->chunkOffset--; } @@ -149,8 +151,8 @@ utext_getPreviousNativeIndex(UText *ut) { int32_t i = ut->chunkOffset - 1; int64_t result; if (i >= 0) { - UChar c = ut->chunkContents[i]; - if (U16_IS_TRAIL(c) == FALSE) { + char16_t c = ut->chunkContents[i]; + if (U16_IS_TRAIL(c) == false) { if (i <= ut->nativeIndexingLimit) { result = ut->chunkNativeStart + i; } else { @@ -187,14 +189,14 @@ utext_current32(UText *ut) { UChar32 c; if (ut->chunkOffset==ut->chunkLength) { // Current position is just off the end of the chunk. - if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) { + if (ut->pFuncs->access(ut, ut->chunkNativeLimit, true) == false) { // Off the end of the text. return U_SENTINEL; } } c = ut->chunkContents[ut->chunkOffset]; - if (U16_IS_LEAD(c) == FALSE) { + if (U16_IS_LEAD(c) == false) { // Normal, non-supplementary case. return c; } @@ -216,13 +218,16 @@ utext_current32(UText *ut) { // leading surrogate. The attempt to access the trail will fail, but // the original position before the unpaired lead still needs to be restored. int64_t nativePosition = ut->chunkNativeLimit; - int32_t originalOffset = ut->chunkOffset; - if (ut->pFuncs->access(ut, nativePosition, TRUE)) { + if (ut->pFuncs->access(ut, nativePosition, true)) { trail = ut->chunkContents[ut->chunkOffset]; } - UBool r = ut->pFuncs->access(ut, nativePosition, FALSE); // reverse iteration flag loads preceding chunk - U_ASSERT(r==TRUE); - ut->chunkOffset = originalOffset; + UBool r = ut->pFuncs->access(ut, nativePosition, false); // reverse iteration flag loads preceding chunk + U_ASSERT(r); + // Here we need to restore chunkOffset since the access functions were called with + // chunkNativeLimit but that is not where we were (we were 1 code unit before the + // limit). Restoring was originally added in ICU-4669 but did not support access + // functions that changed the chunk size, the following does. + ut->chunkOffset = ut->chunkLength - 1; if(!r) { return U_SENTINEL; } @@ -244,7 +249,7 @@ utext_char32At(UText *ut, int64_t nativeIndex) { if (nativeIndex>=ut->chunkNativeStart && nativeIndex < ut->chunkNativeStart + ut->nativeIndexingLimit) { ut->chunkOffset = (int32_t)(nativeIndex - ut->chunkNativeStart); c = ut->chunkContents[ut->chunkOffset]; - if (U16_IS_SURROGATE(c) == FALSE) { + if (U16_IS_SURROGATE(c) == false) { return c; } } @@ -268,13 +273,13 @@ utext_next32(UText *ut) { UChar32 c; if (ut->chunkOffset >= ut->chunkLength) { - if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) { + if (ut->pFuncs->access(ut, ut->chunkNativeLimit, true) == false) { return U_SENTINEL; } } c = ut->chunkContents[ut->chunkOffset++]; - if (U16_IS_LEAD(c) == FALSE) { + if (U16_IS_LEAD(c) == false) { // Normal case, not supplementary. // (A trail surrogate seen here is just returned as is, as a surrogate value. // It cannot be part of a pair.) @@ -282,14 +287,14 @@ utext_next32(UText *ut) { } if (ut->chunkOffset >= ut->chunkLength) { - if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) { + if (ut->pFuncs->access(ut, ut->chunkNativeLimit, true) == false) { // c is an unpaired lead surrogate at the end of the text. // return it as it is. return c; } } UChar32 trail = ut->chunkContents[ut->chunkOffset]; - if (U16_IS_TRAIL(trail) == FALSE) { + if (U16_IS_TRAIL(trail) == false) { // c was an unpaired lead surrogate, not at the end of the text. // return it as it is (unpaired). Iteration position is on the // following character, possibly in the next chunk, where the @@ -308,13 +313,13 @@ utext_previous32(UText *ut) { UChar32 c; if (ut->chunkOffset <= 0) { - if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) { + if (ut->pFuncs->access(ut, ut->chunkNativeStart, false) == false) { return U_SENTINEL; } } ut->chunkOffset--; c = ut->chunkContents[ut->chunkOffset]; - if (U16_IS_TRAIL(c) == FALSE) { + if (U16_IS_TRAIL(c) == false) { // Normal case, not supplementary. // (A lead surrogate seen here is just returned as is, as a surrogate value. // It cannot be part of a pair.) @@ -322,7 +327,7 @@ utext_previous32(UText *ut) { } if (ut->chunkOffset <= 0) { - if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) { + if (ut->pFuncs->access(ut, ut->chunkNativeStart, false) == false) { // c is an unpaired trail surrogate at the start of the text. // return it as it is. return c; @@ -330,7 +335,7 @@ utext_previous32(UText *ut) { } UChar32 lead = ut->chunkContents[ut->chunkOffset-1]; - if (U16_IS_LEAD(lead) == FALSE) { + if (U16_IS_LEAD(lead) == false) { // c was an unpaired trail surrogate, not at the end of the text. // return it as it is (unpaired). Iteration position is at c return c; @@ -349,7 +354,7 @@ utext_next32From(UText *ut, int64_t index) { if(indexchunkNativeStart || index>=ut->chunkNativeLimit) { // Desired position is outside of the current chunk. - if(!ut->pFuncs->access(ut, index, TRUE)) { + if(!ut->pFuncs->access(ut, index, true)) { // no chunk available here return U_SENTINEL; } @@ -380,7 +385,7 @@ utext_previous32From(UText *ut, int64_t index) { // UChar32 cPrev; // The character preceding cCurr, which is what we will return. - // Address the chunk containg the position preceding the incoming index + // Address the chunk containing the position preceding the incoming index // A tricky edge case: // We try to test the requested native index against the chunkNativeStart to determine // whether the character preceding the one at the index is in the current chunk. @@ -389,7 +394,7 @@ utext_previous32From(UText *ut, int64_t index) { // if(index<=ut->chunkNativeStart || index>ut->chunkNativeLimit) { // Requested native index is outside of the current chunk. - if(!ut->pFuncs->access(ut, index, FALSE)) { + if(!ut->pFuncs->access(ut, index, false)) { // no chunk available here return U_SENTINEL; } @@ -398,7 +403,7 @@ utext_previous32From(UText *ut, int64_t index) { ut->chunkOffset = (int32_t)(index - ut->chunkNativeStart); } else { ut->chunkOffset=ut->pFuncs->mapNativeIndexToUTF16(ut, index); - if (ut->chunkOffset==0 && !ut->pFuncs->access(ut, index, FALSE)) { + if (ut->chunkOffset==0 && !ut->pFuncs->access(ut, index, false)) { // no chunk available here return U_SENTINEL; } @@ -423,7 +428,7 @@ utext_previous32From(UText *ut, int64_t index) { U_CAPI int32_t U_EXPORT2 utext_extract(UText *ut, int64_t start, int64_t limit, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *status) { return ut->pFuncs->extract(ut, start, limit, dest, destCapacity, status); } @@ -432,28 +437,28 @@ utext_extract(UText *ut, U_CAPI UBool U_EXPORT2 utext_equals(const UText *a, const UText *b) { - if (a==NULL || b==NULL || + if (a==nullptr || b==nullptr || a->magic != UTEXT_MAGIC || b->magic != UTEXT_MAGIC) { // Null or invalid arguments don't compare equal to anything. - return FALSE; + return false; } if (a->pFuncs != b->pFuncs) { // Different types of text providers. - return FALSE; + return false; } if (a->context != b->context) { // Different sources (different strings) - return FALSE; + return false; } if (utext_getNativeIndex(a) != utext_getNativeIndex(b)) { // Different current position in the string. - return FALSE; + return false; } - return TRUE; + return true; } U_CAPI UBool U_EXPORT2 @@ -483,7 +488,7 @@ utext_hasMetaData(const UText *ut) U_CAPI int32_t U_EXPORT2 utext_replace(UText *ut, int64_t nativeStart, int64_t nativeLimit, - const UChar *replacementText, int32_t replacementLength, + const char16_t *replacementText, int32_t replacementLength, UErrorCode *status) { if (U_FAILURE(*status)) { @@ -525,7 +530,7 @@ utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCod if (U_FAILURE(*status)) { return result; } - if (result == NULL) { + if (result == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return result; } @@ -566,8 +571,8 @@ enum { // when a provider asks for a UText to be allocated with extra storage. struct ExtendedUText { - UText ut; - max_align_t extension; + UText ut; + std::max_align_t extension; }; static const UText emptyText = UTEXT_INITIALIZER; @@ -578,16 +583,16 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) { return ut; } - if (ut == NULL) { + if (ut == nullptr) { // We need to heap-allocate storage for the new UText int32_t spaceRequired = sizeof(UText); if (extraSpace > 0) { - spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(max_align_t); + spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(std::max_align_t); } ut = (UText *)uprv_malloc(spaceRequired); - if (ut == NULL) { + if (ut == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } else { *ut = emptyText; ut->flags |= UTEXT_HEAP_ALLOCATED; @@ -605,7 +610,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) { } // If the ut is already open and there's a provider supplied close // function, call it. - if ((ut->flags & UTEXT_OPEN) && ut->pFuncs->close != NULL) { + if ((ut->flags & UTEXT_OPEN) && ut->pFuncs->close != nullptr) { ut->pFuncs->close(ut); } ut->flags &= ~UTEXT_OPEN; @@ -620,7 +625,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) { ut->extraSize = 0; } ut->pExtra = uprv_malloc(extraSpace); - if (ut->pExtra == NULL) { + if (ut->pExtra == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; } else { ut->extraSize = extraSpace; @@ -633,11 +638,11 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) { // Initialize all remaining fields of the UText. // - ut->context = NULL; - ut->chunkContents = NULL; - ut->p = NULL; - ut->q = NULL; - ut->r = NULL; + ut->context = nullptr; + ut->chunkContents = nullptr; + ut->p = nullptr; + ut->q = nullptr; + ut->r = nullptr; ut->a = 0; ut->b = 0; ut->c = 0; @@ -650,8 +655,8 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) { ut->privA = 0; ut->privB = 0; ut->privC = 0; - ut->privP = NULL; - if (ut->pExtra!=NULL && ut->extraSize>0) + ut->privP = nullptr; + if (ut->pExtra!=nullptr && ut->extraSize>0) uprv_memset(ut->pExtra, 0, ut->extraSize); } @@ -661,7 +666,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) { U_CAPI UText * U_EXPORT2 utext_close(UText *ut) { - if (ut==NULL || + if (ut==nullptr || ut->magic != UTEXT_MAGIC || (ut->flags & UTEXT_OPEN) == 0) { @@ -672,7 +677,7 @@ utext_close(UText *ut) { // If the provider gave us a close function, call it now. // This will clean up anything allocated specifically by the provider. - if (ut->pFuncs->close != NULL) { + if (ut->pFuncs->close != nullptr) { ut->pFuncs->close(ut); } ut->flags &= ~UTEXT_OPEN; @@ -681,15 +686,15 @@ utext_close(UText *ut) { // delete it. if (ut->flags & UTEXT_EXTRA_HEAP_ALLOCATED) { uprv_free(ut->pExtra); - ut->pExtra = NULL; + ut->pExtra = nullptr; ut->flags &= ~UTEXT_EXTRA_HEAP_ALLOCATED; ut->extraSize = 0; } // Zero out function table of the closed UText. This is a defensive move, - // inteded to cause applications that inadvertantly use a closed + // intended to cause applications that inadvertently use a closed // utext to crash with null pointer errors. - ut->pFuncs = NULL; + ut->pFuncs = nullptr; if (ut->flags & UTEXT_HEAP_ALLOCATED) { // This UText was allocated by UText setup. We need to free it. @@ -697,7 +702,7 @@ utext_close(UText *ut) { // tries to reopen another UText using the deleted storage. ut->magic = 0; uprv_free(ut); - ut = NULL; + ut = nullptr; } return ut; } @@ -770,7 +775,7 @@ static void adjustPointer(UText *dest, const void **destPtr, const UText *src) { static UText * U_CALLCONV shallowTextClone(UText * dest, const UText * src, UErrorCode * status) { if (U_FAILURE(*status)) { - return NULL; + return nullptr; } int32_t srcExtraSize = src->extraSize; @@ -847,8 +852,8 @@ U_CDECL_END //------------------------------------------------------------------------------ // Chunk size. -// Must be less than 85 (256/3), because of byte mapping from UChar indexes to native indexes. -// Worst case is three native bytes to one UChar. (Supplemenaries are 4 native bytes +// Must be less than 85 (256/3), because of byte mapping from char16_t indexes to native indexes. +// Worst case is three native bytes to one char16_t. (Supplemenaries are 4 native bytes // to two UChars.) // The longest illegal byte sequence treated as a single error (and converted to U+FFFD) // is a three-byte sequence (truncated four-byte sequence). @@ -857,7 +862,7 @@ enum { UTF8_TEXT_CHUNK_SIZE=32 }; // // UTF8Buf Two of these structs will be set up in the UText's extra allocated space. -// Each contains the UChar chunk buffer, the to and from native maps, and +// Each contains the char16_t chunk buffer, the to and from native maps, and // header info. // // because backwards iteration fills the buffers starting at the end and @@ -870,7 +875,7 @@ enum { UTF8_TEXT_CHUNK_SIZE=32 }; // struct UTF8Buf { - int32_t bufNativeStart; // Native index of first char in UChar buf + int32_t bufNativeStart; // Native index of first char in char16_t buf int32_t bufNativeLimit; // Native index following last char in buf. int32_t bufStartIdx; // First filled position in buf. int32_t bufLimitIdx; // Limit of filled range in buf. @@ -880,19 +885,19 @@ struct UTF8Buf { // Set to bufNativeStart when filling forwards. // Set to computed value when filling backwards. - UChar buf[UTF8_TEXT_CHUNK_SIZE+4]; // The UChar buffer. Requires one extra position beyond the + char16_t buf[UTF8_TEXT_CHUNK_SIZE+4]; // The char16_t buffer. Requires one extra position beyond the // the chunk size, to allow for surrogate at the end. // Length must be identical to mapToNative array, below, // because of the way indexing works when the array is // filled backwards during a reverse iteration. Thus, // the additional extra size. - uint8_t mapToNative[UTF8_TEXT_CHUNK_SIZE+4]; // map UChar index in buf to + uint8_t mapToNative[UTF8_TEXT_CHUNK_SIZE+4]; // map char16_t index in buf to // native offset from bufNativeStart. // Requires two extra slots, // one for a supplementary starting in the last normal position, // and one for an entry for the buffer limit position. uint8_t mapToUChars[UTF8_TEXT_CHUNK_SIZE*3+6]; // Map native offset from bufNativeStart to - // correspoding offset in filled part of buf. + // corresponding offset in filled part of buf. int32_t align; }; @@ -939,7 +944,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // return; // const uint8_t *s8=(const uint8_t *)ut->context; - UTF8Buf *u8b = NULL; + UTF8Buf *u8b = nullptr; int32_t length = ut->b; // Length of original utf-8 int32_t ix= (int32_t)index; // Requested index, trimmed to 32 bits. int32_t mapIndex = 0; @@ -985,7 +990,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // Don't swap buffers, but do set the // current buffer position. ut->chunkOffset = ut->chunkLength; - return FALSE; + return false; } else { // End of current buffer. // check whether other buffer already has what we need. @@ -1014,7 +1019,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // Current buffer extends up to the end of the string. // Leave it as the current buffer. ut->chunkOffset = ut->chunkLength; - return FALSE; + return false; } if (ix == u8b->bufNativeLimit) { // Alternate buffer extends to the end of string. @@ -1036,7 +1041,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { mapIndex = ix - u8b->toUCharsMapStart; U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars)); ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; - return TRUE; + return true; } } @@ -1044,7 +1049,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // // Dispatch to the appropriate action for a - // Backwards Diretion iteration request. + // Backwards Direction iteration request. // if (ix==ut->chunkNativeStart) { // Check for normal sequential iteration cases first. @@ -1053,7 +1058,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // Don't swap buffers, but do set the // current buffer position. ut->chunkOffset = 0; - return FALSE; + return false; } else { // Start of current buffer. // check whether other buffer already has what we need. @@ -1106,9 +1111,9 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // one of the trailing bytes. Because there is no preceding , // character, this access fails. We can't pick up on the // situation sooner because the requested index is not zero. - return FALSE; + return false; } else { - return TRUE; + return true; } @@ -1137,7 +1142,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { U_ASSERT(mapIndex<(int32_t)sizeof(u8b->mapToUChars)); ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; - return TRUE; + return true; } @@ -1168,7 +1173,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { ut->chunkOffset = 0; U_ASSERT(ix == u8b->bufNativeStart); } - return FALSE; + return false; makeStubBuffer: // The user has done a seek/access past the start or end @@ -1201,18 +1206,18 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { ut->p = u8b_swap; int32_t strLen = ut->b; - UBool nulTerminated = FALSE; + UBool nulTerminated = false; if (strLen < 0) { strLen = 0x7fffffff; - nulTerminated = TRUE; + nulTerminated = true; } - UChar *buf = u8b_swap->buf; + char16_t *buf = u8b_swap->buf; uint8_t *mapToNative = u8b_swap->mapToNative; uint8_t *mapToUChars = u8b_swap->mapToUChars; int32_t destIx = 0; int32_t srcIx = ix; - UBool seenNonAscii = FALSE; + UBool seenNonAscii = false; UChar32 c = 0; // Fill the chunk buffer and mapping arrays. @@ -1221,15 +1226,15 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { if (c>0 && c<0x80) { // Special case ASCII range for speed. // zero is excluded to simplify bounds checking. - buf[destIx] = (UChar)c; + buf[destIx] = (char16_t)c; mapToNative[destIx] = (uint8_t)(srcIx - ix); mapToUChars[srcIx-ix] = (uint8_t)destIx; srcIx++; destIx++; } else { // General case, handle everything. - if (seenNonAscii == FALSE) { - seenNonAscii = TRUE; + if (seenNonAscii == false) { + seenNonAscii = true; u8b_swap->bufNILimit = destIx; } @@ -1267,7 +1272,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { u8b_swap->bufNativeLimit = srcIx; u8b_swap->bufStartIdx = 0; u8b_swap->bufLimitIdx = destIx; - if (seenNonAscii == FALSE) { + if (seenNonAscii == false) { u8b_swap->bufNILimit = destIx; } u8b_swap->toUCharsMapStart = u8b_swap->bufNativeStart; @@ -1291,7 +1296,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { ut->providerProperties &= ~I32_FLAG(UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE); } } - return TRUE; + return true; } @@ -1302,7 +1307,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // If index is at the end, there is no character there to look at. if (ix != ut->b) { // Note: this function will only move the index back if it is on a trail byte - // and there is a preceding lead byte and the sequence from the lead + // and there is a preceding lead byte and the sequence from the lead // through this trail could be part of a valid UTF-8 sequence // Otherwise the index remains unchanged. U8_SET_CP_START(s8, 0, ix); @@ -1315,7 +1320,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { ut->q = ut->p; ut->p = u8b_swap; - UChar *buf = u8b_swap->buf; + char16_t *buf = u8b_swap->buf; uint8_t *mapToNative = u8b_swap->mapToNative; uint8_t *mapToUChars = u8b_swap->mapToUChars; int32_t toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1; @@ -1347,7 +1352,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { c = s8[srcIx]; if (c<0x80) { // Special case ASCII range for speed. - buf[destIx] = (UChar)c; + buf[destIx] = (char16_t)c; U_ASSERT(toUCharsMapStart <= srcIx); mapToUChars[srcIx - toUCharsMapStart] = (uint8_t)destIx; mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart); @@ -1357,7 +1362,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { int32_t sIx = srcIx; // ix of last byte of multi-byte u8 char // Get the full character from the UTF8 string. - // use code derived from tbe macros in utf8.h + // use code derived from the macros in utf8.h // Leaves srcIx pointing at the first byte of the UTF-8 char. // c=utf8_prevCharSafeBody(s8, 0, &srcIx, c, -3); @@ -1365,7 +1370,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // Store the character in UTF-16 buffer. if (c<0x10000) { - buf[destIx] = (UChar)c; + buf[destIx] = (char16_t)c; mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart); } else { buf[destIx] = U16_TRAIL(c); @@ -1400,7 +1405,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { ut->chunkNativeStart = u8b_swap->bufNativeStart; ut->chunkNativeLimit = u8b_swap->bufNativeLimit; ut->nativeIndexingLimit = u8b_swap->bufNILimit; - return TRUE; + return true; } } @@ -1412,8 +1417,8 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) { // Inserts a Replacement Char rather than failing on invalid UTF-8 // Removes unnecessary features. // -static UChar* -utext_strFromUTF8(UChar *dest, +static char16_t* +utext_strFromUTF8(char16_t *dest, int32_t destCapacity, int32_t *pDestLength, const char* src, @@ -1422,8 +1427,8 @@ utext_strFromUTF8(UChar *dest, ) { - UChar *pDest = dest; - UChar *pDestLimit = (dest!=NULL)?(dest+destCapacity):NULL; + char16_t *pDest = dest; + char16_t *pDestLimit = (dest!=nullptr)?(dest+destCapacity):nullptr; UChar32 ch=0; int32_t index = 0; int32_t reqLength = 0; @@ -1433,11 +1438,11 @@ utext_strFromUTF8(UChar *dest, while((index < srcLength)&&(pDest0)) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1524,7 +1529,7 @@ utf8TextExtract(UText *ut, utext_strFromUTF8(dest, destCapacity, &destLength, (const char *)ut->context+start32, limit32-start32, pErrorCode); - utf8TextAccess(ut, limit32, TRUE); + utf8TextAccess(ut, limit32, true); return destLength; } @@ -1543,7 +1548,7 @@ utf8TextMapOffsetToNative(const UText *ut) { } // -// Map a native index to the corrsponding chunk offset +// Map a native index to the corresponding chunk offset // static int32_t U_CALLCONV utf8TextMapIndexToUTF16(const UText *ut, int64_t index64) { @@ -1568,7 +1573,7 @@ utf8TextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) // For deep clones, make a copy of the string. // The copied storage is owned by the newly created clone. // - // TODO: There is an isssue with using utext_nativeLength(). + // TODO: There is an issue with using utext_nativeLength(). // That function is non-const in cases where the input was NUL terminated // and the length has not yet been determined. // This function (clone()) is const. @@ -1577,7 +1582,7 @@ utf8TextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) if (deep && U_SUCCESS(*status)) { int32_t len = (int32_t)utext_nativeLength((UText *)src); char *copyStr = (char *)uprv_malloc(len+1); - if (copyStr == NULL) { + if (copyStr == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; } else { uprv_memcpy(copyStr, src->context, len+1); @@ -1597,7 +1602,7 @@ utf8TextClose(UText *ut) { if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { char *s = (char *)ut->context; uprv_free(s); - ut->context = NULL; + ut->context = nullptr; } } @@ -1612,31 +1617,31 @@ static const struct UTextFuncs utf8Funcs = utf8TextLength, utf8TextAccess, utf8TextExtract, - NULL, /* replace*/ - NULL, /* copy */ + nullptr, /* replace*/ + nullptr, /* copy */ utf8TextMapOffsetToNative, utf8TextMapIndexToUTF16, utf8TextClose, - NULL, // spare 1 - NULL, // spare 2 - NULL // spare 3 + nullptr, // spare 1 + nullptr, // spare 2 + nullptr // spare 3 }; -static const char utext_gEmptyString[] = {0}; +static const char gEmptyString[] = {0}; U_CAPI UText * U_EXPORT2 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status) { if(U_FAILURE(*status)) { - return NULL; + return nullptr; } - if(s==NULL && length==0) { - s = utext_gEmptyString; + if(s==nullptr && length==0) { + s = gEmptyString; } - if(s==NULL || length<-1 || length>INT32_MAX) { + if(s==nullptr || length<-1 || length>INT32_MAX) { *status=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } ut = utext_setup(ut, sizeof(UTF8Buf) * 2, status); @@ -1686,7 +1691,7 @@ struct ReplExtra { * Chunk UChars. * +1 to simplify filling with surrogate pair at the end. */ - UChar s[REP_TEXT_CHUNK_SIZE+1]; + char16_t s[REP_TEXT_CHUNK_SIZE+1]; }; @@ -1699,7 +1704,7 @@ repTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) { // For deep clones, make a copy of the Replaceable. // The copied Replaceable storage is owned by the newly created UText clone. - // A non-NULL pointer in UText.p is the signal to the close() function to delete + // A non-nullptr pointer in UText.p is the signal to the close() function to delete // it. // if (deep && U_SUCCESS(*status)) { @@ -1722,7 +1727,7 @@ repTextClose(UText *ut) { if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { Replaceable *rep = (Replaceable *)ut->context; delete rep; - ut->context = NULL; + ut->context = nullptr; } } @@ -1749,7 +1754,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) { * Compute start/limit boundaries around index, for a segment of text * to be extracted. * To allow for the possibility that our user gave an index to the trailing - * half of a surrogate pair, we must request one extra preceding UChar when + * half of a surrogate pair, we must request one extra preceding char16_t when * going in the forward direction. This will ensure that the buffer has the * entire code point at the specified index. */ @@ -1758,13 +1763,13 @@ repTextAccess(UText *ut, int64_t index, UBool forward) { if (index32>=ut->chunkNativeStart && index32chunkNativeLimit) { // Buffer already contains the requested position. ut->chunkOffset = (int32_t)(index - ut->chunkNativeStart); - return TRUE; + return true; } if (index32>=length && ut->chunkNativeLimit==length) { // Request for end of string, and buffer already extends up to it. // Can't get the data, but don't change the buffer. ut->chunkOffset = length - (int32_t)ut->chunkNativeStart; - return FALSE; + return false; } ut->chunkNativeLimit = index + REP_TEXT_CHUNK_SIZE - 1; @@ -1785,19 +1790,19 @@ repTextAccess(UText *ut, int64_t index, UBool forward) { if (index32>ut->chunkNativeStart && index32<=ut->chunkNativeLimit) { // Requested position already in buffer. ut->chunkOffset = index32 - (int32_t)ut->chunkNativeStart; - return TRUE; + return true; } if (index32==0 && ut->chunkNativeStart==0) { // Request for start, buffer already begins at start. // No data, but keep the buffer as is. ut->chunkOffset = 0; - return FALSE; + return false; } // Figure out the bounds of the chunk to extract for reverse iteration. // Need to worry about chunk not splitting surrogate pairs, and while still // containing the data we need. - // Fix by requesting a chunk that includes an extra UChar at the end. + // Fix by requesting a chunk that includes an extra char16_t at the end. // If this turns out to be a lead surrogate, we can lop it off and still have // the data we wanted. ut->chunkNativeStart = index32 + 1 - REP_TEXT_CHUNK_SIZE; @@ -1832,7 +1837,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) { } } - // if the first UChar in the chunk could be the trailing half of a surrogate pair, + // if the first char16_t in the chunk could be the trailing half of a surrogate pair, // trim it off. if(ut->chunkNativeStart>0 && U16_IS_TRAIL(ex->s[0])) { ++(ut->chunkContents); @@ -1847,7 +1852,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) { // Use fast indexing for get/setNativeIndex() ut->nativeIndexingLimit = ut->chunkLength; - return TRUE; + return true; } @@ -1855,7 +1860,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) { static int32_t U_CALLCONV repTextExtract(UText *ut, int64_t start, int64_t limit, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *status) { const Replaceable *rep=(const Replaceable *)ut->context; int32_t length=rep->length(); @@ -1863,7 +1868,7 @@ repTextExtract(UText *ut, if(U_FAILURE(*status)) { return 0; } - if(destCapacity<0 || (dest==NULL && destCapacity>0)) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0)) { *status=U_ILLEGAL_ARGUMENT_ERROR; } if(start>limit) { @@ -1890,7 +1895,7 @@ repTextExtract(UText *ut, } UnicodeString buffer(dest, 0, destCapacity); // writable alias rep->extractBetween(start32, limit32, buffer); - repTextAccess(ut, limit32, TRUE); + repTextAccess(ut, limit32, true); return u_terminateUChars(dest, destCapacity, length, status); } @@ -1898,7 +1903,7 @@ repTextExtract(UText *ut, static int32_t U_CALLCONV repTextReplace(UText *ut, int64_t start, int64_t limit, - const UChar *src, int32_t length, + const char16_t *src, int32_t length, UErrorCode *status) { Replaceable *rep=(Replaceable *)ut->context; int32_t oldLength; @@ -1906,7 +1911,7 @@ repTextReplace(UText *ut, if(U_FAILURE(*status)) { return 0; } - if(src==NULL && length!=0) { + if(src==nullptr && length!=0) { *status=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1946,7 +1951,7 @@ repTextReplace(UText *ut, // set the iteration position to the end of the newly inserted replacement text. int32_t newIndexPos = limit32 + lengthDelta; - repTextAccess(ut, newIndexPos, TRUE); + repTextAccess(ut, newIndexPos, true); return lengthDelta; } @@ -2010,7 +2015,7 @@ repTextCopy(UText *ut, } // Set position, reload chunk if needed. - repTextAccess(ut, nativeIterIndex, TRUE); + repTextAccess(ut, nativeIterIndex, true); } static const struct UTextFuncs repFuncs = @@ -2023,12 +2028,12 @@ static const struct UTextFuncs repFuncs = repTextExtract, repTextReplace, repTextCopy, - NULL, // MapOffsetToNative, - NULL, // MapIndexToUTF16, + nullptr, // MapOffsetToNative, + nullptr, // MapIndexToUTF16, repTextClose, - NULL, // spare 1 - NULL, // spare 2 - NULL // spare 3 + nullptr, // spare 1 + nullptr, // spare 2 + nullptr // spare 3 }; @@ -2036,11 +2041,11 @@ U_CAPI UText * U_EXPORT2 utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status) { if(U_FAILURE(*status)) { - return NULL; + return nullptr; } - if(rep==NULL) { + if(rep==nullptr) { *status=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } ut = utext_setup(ut, sizeof(ReplExtra), status); if(U_FAILURE(*status)) { @@ -2075,7 +2080,7 @@ U_CDECL_END // Use of UText data members: // context pointer to UnicodeString // p pointer to UnicodeString IF this UText owns the string -// and it must be deleted on close(). NULL otherwise. +// and it must be deleted on close(). nullptr otherwise. // //------------------------------------------------------------------------------ @@ -2089,7 +2094,7 @@ unistrTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) { // For deep clones, make a copy of the UnicodeSring. // The copied UnicodeString storage is owned by the newly created UText clone. - // A non-NULL pointer in UText.p is the signal to the close() function to delete + // A non-nullptr pointer in UText.p is the signal to the close() function to delete // the UText. // if (deep && U_SUCCESS(*status)) { @@ -2111,7 +2116,7 @@ unistrTextClose(UText *ut) { if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { UnicodeString *str = (UnicodeString *)ut->context; delete str; - ut->context = NULL; + ut->context = nullptr; } } @@ -2137,7 +2142,7 @@ unistrTextAccess(UText *ut, int64_t index, UBool forward) { static int32_t U_CALLCONV unistrTextExtract(UText *t, int64_t start, int64_t limit, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { const UnicodeString *us=(const UnicodeString *)t->context; int32_t length=us->length(); @@ -2145,7 +2150,7 @@ unistrTextExtract(UText *t, if(U_FAILURE(*pErrorCode)) { return 0; } - if(destCapacity<0 || (dest==NULL && destCapacity>0)) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } if(start<0 || start>limit) { @@ -2157,7 +2162,7 @@ unistrTextExtract(UText *t, int32_t limit32 = limitgetChar32Start((int32_t)limit) : length; length=limit32-start32; - if (destCapacity>0 && dest!=NULL) { + if (destCapacity>0 && dest!=nullptr) { int32_t trimmedLength = length; if(trimmedLength>destCapacity) { trimmedLength=destCapacity; @@ -2174,7 +2179,7 @@ unistrTextExtract(UText *t, static int32_t U_CALLCONV unistrTextReplace(UText *ut, int64_t start, int64_t limit, - const UChar *src, int32_t length, + const char16_t *src, int32_t length, UErrorCode *pErrorCode) { UnicodeString *us=(UnicodeString *)ut->context; int32_t oldLength; @@ -2182,7 +2187,7 @@ unistrTextReplace(UText *ut, if(U_FAILURE(*pErrorCode)) { return 0; } - if(src==NULL && length!=0) { + if(src==nullptr && length!=0) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } if(start>limit) { @@ -2252,7 +2257,7 @@ unistrTextCopy(UText *ut, // update chunk description, set iteration position. ut->chunkContents = us->getBuffer(); - if (move==FALSE) { + if (move==false) { // copy operation, string length grows ut->chunkLength += limit32-start32; ut->chunkNativeLimit = ut->chunkLength; @@ -2277,12 +2282,12 @@ static const struct UTextFuncs unistrFuncs = unistrTextExtract, unistrTextReplace, unistrTextCopy, - NULL, // MapOffsetToNative, - NULL, // MapIndexToUTF16, + nullptr, // MapOffsetToNative, + nullptr, // MapIndexToUTF16, unistrTextClose, - NULL, // spare 1 - NULL, // spare 2 - NULL // spare 3 + nullptr, // spare 1 + nullptr, // spare 2 + nullptr // spare 3 }; @@ -2306,7 +2311,7 @@ utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *stat if (U_SUCCESS(*status) && s->isBogus()) { // The UnicodeString is bogus, but we still need to detach the UText // from whatever it was hooked to before, if anything. - utext_openUChars(ut, NULL, 0, status); + utext_openUChars(ut, nullptr, 0, status); *status = U_ILLEGAL_ARGUMENT_ERROR; return ut; } @@ -2329,7 +2334,7 @@ utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *stat //------------------------------------------------------------------------------ // -// UText implementation for const UChar * strings +// UText implementation for const char16_t * strings // // Use of UText data members: // context pointer to UnicodeString @@ -2349,7 +2354,7 @@ ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status) // For deep clones, make a copy of the string. // The copied storage is owned by the newly created clone. - // A non-NULL pointer in UText.p is the signal to the close() function to delete + // A non-nullptr pointer in UText.p is the signal to the close() function to delete // it. // if (deep && U_SUCCESS(*status)) { @@ -2357,9 +2362,9 @@ ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status) int32_t len = (int32_t)utext_nativeLength(dest); // The cloned string IS going to be NUL terminated, whether or not the original was. - const UChar *srcStr = (const UChar *)src->context; - UChar *copyStr = (UChar *)uprv_malloc((len+1) * sizeof(UChar)); - if (copyStr == NULL) { + const char16_t *srcStr = (const char16_t *)src->context; + char16_t *copyStr = (char16_t *)uprv_malloc((len+1) * sizeof(char16_t)); + if (copyStr == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; } else { int64_t i; @@ -2381,9 +2386,9 @@ ucstrTextClose(UText *ut) { // All that needs to be done here is delete the string if the UText // owns it. This occurs if the UText was created by cloning. if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) { - UChar *s = (UChar *)ut->context; + char16_t *s = (char16_t *)ut->context; uprv_free(s); - ut->context = NULL; + ut->context = nullptr; } } @@ -2392,10 +2397,10 @@ ucstrTextClose(UText *ut) { static int64_t U_CALLCONV ucstrTextLength(UText *ut) { if (ut->a < 0) { - // null terminated, we don't yet know the length. Scan for it. + // null terminated, we don't yet know the length. Scan for it. // Access is not convenient for doing this - // because the current interation postion can't be changed. - const UChar *str = (const UChar *)ut->context; + // because the current iteration position can't be changed. + const char16_t *str = (const char16_t *)ut->context; for (;;) { if (str[ut->chunkNativeLimit] == 0) { break; @@ -2413,7 +2418,7 @@ ucstrTextLength(UText *ut) { static UBool U_CALLCONV ucstrTextAccess(UText *ut, int64_t index, UBool forward) { - const UChar *str = (const UChar *)ut->context; + const char16_t *str = (const char16_t *)ut->context; // pin the requested index to the bounds of the string, // and set current iteration position. @@ -2503,18 +2508,18 @@ ucstrTextAccess(UText *ut, int64_t index, UBool forward) { static int32_t U_CALLCONV ucstrTextExtract(UText *ut, int64_t start, int64_t limit, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return 0; } - if(destCapacity<0 || (dest==NULL && destCapacity>0) || start>limit) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0) || start>limit) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } - //const UChar *s=(const UChar *)ut->context; + //const char16_t *s=(const char16_t *)ut->context; int32_t si, di; int32_t start32; @@ -2523,8 +2528,8 @@ ucstrTextExtract(UText *ut, // Access the start. Does two things we need: // Pins 'start' to the length of the string, if it came in out-of-bounds. // Snaps 'start' to the beginning of a code point. - ucstrTextAccess(ut, start, TRUE); - const UChar *s=ut->chunkContents; + ucstrTextAccess(ut, start, true); + const char16_t *s=ut->chunkContents; start32 = ut->chunkOffset; int32_t strLength=(int32_t)ut->a; @@ -2577,7 +2582,7 @@ ucstrTextExtract(UText *ut, if (si <= ut->chunkNativeLimit) { ut->chunkOffset = si; } else { - ucstrTextAccess(ut, si, TRUE); + ucstrTextAccess(ut, si, true); } // Add a terminating NUL if space in the buffer permits, @@ -2594,31 +2599,31 @@ static const struct UTextFuncs ucstrFuncs = ucstrTextLength, ucstrTextAccess, ucstrTextExtract, - NULL, // Replace - NULL, // Copy - NULL, // MapOffsetToNative, - NULL, // MapIndexToUTF16, + nullptr, // Replace + nullptr, // Copy + nullptr, // MapOffsetToNative, + nullptr, // MapIndexToUTF16, ucstrTextClose, - NULL, // spare 1 - NULL, // spare 2 - NULL, // spare 3 + nullptr, // spare 1 + nullptr, // spare 2 + nullptr, // spare 3 }; U_CDECL_END -static const UChar gEmptyUString[] = {0}; +static const char16_t gEmptyUString[] = {0}; U_CAPI UText * U_EXPORT2 -utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status) { +utext_openUChars(UText *ut, const char16_t *s, int64_t length, UErrorCode *status) { if (U_FAILURE(*status)) { - return NULL; + return nullptr; } - if(s==NULL && length==0) { + if(s==nullptr && length==0) { s = gEmptyUString; } - if (s==NULL || length < -1 || length>INT32_MAX) { + if (s==nullptr || length < -1 || length>INT32_MAX) { *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } ut = utext_setup(ut, 0, status); if (U_SUCCESS(*status)) { @@ -2665,7 +2670,7 @@ charIterTextClose(UText *ut) { // owns it. This occurs if the UText was created by cloning. CharacterIterator *ci = (CharacterIterator *)ut->r; delete ci; - ut->r = NULL; + ut->r = nullptr; } static int64_t U_CALLCONV @@ -2695,25 +2700,25 @@ charIterTextAccess(UText *ut, int64_t index, UBool forward) { // Find the native index of the start of the buffer containing what we want. neededIndex -= neededIndex % CIBufSize; - UChar *buf = NULL; - UBool needChunkSetup = TRUE; + char16_t *buf = nullptr; + UBool needChunkSetup = true; int i; if (ut->chunkNativeStart == neededIndex) { // The buffer we want is already the current chunk. - needChunkSetup = FALSE; + needChunkSetup = false; } else if (ut->b == neededIndex) { // The first buffer (buffer p) has what we need. - buf = (UChar *)ut->p; + buf = (char16_t *)ut->p; } else if (ut->c == neededIndex) { // The second buffer (buffer q) has what we need. - buf = (UChar *)ut->q; + buf = (char16_t *)ut->q; } else { // Neither buffer already has what we need. // Load new data from the character iterator. // Use the buf that is not the current buffer. - buf = (UChar *)ut->p; + buf = (char16_t *)ut->p; if (ut->p == ut->chunkContents) { - buf = (UChar *)ut->q; + buf = (char16_t *)ut->q; } ci->setIndex(neededIndex); for (i=0; icontext; srcCI = srcCI->clone(); @@ -2772,13 +2777,13 @@ charIterTextClone(UText *dest, const UText *src, UBool deep, UErrorCode * status static int32_t U_CALLCONV charIterTextExtract(UText *ut, int64_t start, int64_t limit, - UChar *dest, int32_t destCapacity, + char16_t *dest, int32_t destCapacity, UErrorCode *status) { if(U_FAILURE(*status)) { return 0; } - if(destCapacity<0 || (dest==NULL && destCapacity>0) || start>limit) { + if(destCapacity<0 || (dest==nullptr && destCapacity>0) || start>limit) { *status=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -2807,7 +2812,7 @@ charIterTextExtract(UText *ut, srci += len; } - charIterTextAccess(ut, copyLimit, TRUE); + charIterTextAccess(ut, copyLimit, true); u_terminateUChars(dest, destCapacity, desti, status); return desti; @@ -2821,14 +2826,14 @@ static const struct UTextFuncs charIterFuncs = charIterTextLength, charIterTextAccess, charIterTextExtract, - NULL, // Replace - NULL, // Copy - NULL, // MapOffsetToNative, - NULL, // MapIndexToUTF16, + nullptr, // Replace + nullptr, // Copy + nullptr, // MapOffsetToNative, + nullptr, // MapIndexToUTF16, charIterTextClose, - NULL, // spare 1 - NULL, // spare 2 - NULL // spare 3 + nullptr, // spare 1 + nullptr, // spare 2 + nullptr // spare 3 }; U_CDECL_END @@ -2836,17 +2841,17 @@ U_CDECL_END U_CAPI UText * U_EXPORT2 utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status) { if (U_FAILURE(*status)) { - return NULL; + return nullptr; } if (ci->startIndex() > 0) { // No support for CharacterIterators that do not start indexing from zero. *status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } // Extra space in UText for 2 buffers of CIBufSize UChars each. - int32_t extraSpace = 2 * CIBufSize * sizeof(UChar); + int32_t extraSpace = 2 * CIBufSize * sizeof(char16_t); ut = utext_setup(ut, extraSpace, status); if (U_SUCCESS(*status)) { ut->pFuncs = &charIterFuncs; @@ -2855,7 +2860,7 @@ utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status ut->a = ci->endIndex(); // Length of text ut->p = ut->pExtra; // First buffer ut->b = -1; // Native index of first buffer contents - ut->q = (UChar*)ut->pExtra+CIBufSize; // Second buffer + ut->q = (char16_t*)ut->pExtra+CIBufSize; // Second buffer ut->c = -1; // Native index of second buffer contents // Initialize current chunk contents to be empty. @@ -2864,7 +2869,7 @@ utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status // so that getNativeIndex() will correctly compute to zero // if no call to Access() has ever been made. They can't be both // zero without Access() thinking that the chunk is valid. - ut->chunkContents = (UChar *)ut->p; + ut->chunkContents = (char16_t *)ut->p; ut->chunkNativeStart = -1; ut->chunkOffset = 1; ut->chunkNativeLimit = 0; diff --git a/src/duckdb/extension/icu/third_party/icu/common/utf_impl.cpp b/src/duckdb/extension/icu/third_party/icu/common/utf_impl.cpp index 9dd241a12..827a82daf 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utf_impl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/utf_impl.cpp @@ -55,7 +55,7 @@ * -finish: * (BSR: Bit Scan Reverse, scans for a 1-bit, starting from the MSB) */ -extern "C" U_EXPORT const uint8_t +U_CAPI const uint8_t utf8_countTrailBytes[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -117,11 +117,11 @@ errorValue(int32_t count, int8_t strict) { * Unicode 16-bit strings that are not well-formed UTF-16, that is, they * contain unpaired surrogates. * -3: All illegal byte sequences yield U+FFFD. - * 0 Obsolete "safe" behavior of UTF8_NEXT_CHAR_SAFE(..., FALSE): + * 0 Obsolete "safe" behavior of UTF8_NEXT_CHAR_SAFE(..., false): * All illegal byte sequences yield a positive code point such that this * result code point would be encoded with the same number of bytes as * the illegal sequence. - * >0 Obsolete "strict" behavior of UTF8_NEXT_CHAR_SAFE(..., TRUE): + * >0 Obsolete "strict" behavior of UTF8_NEXT_CHAR_SAFE(..., true): * Same as the obsolete "safe" behavior, but non-characters are also treated * like illegal sequences. * @@ -213,8 +213,8 @@ utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool } } /* c>0x10ffff or not enough space, write an error value */ - if(pIsError!=NULL) { - *pIsError=TRUE; + if(pIsError!=nullptr) { + *pIsError=true; } else { length-=i; if(length>0) { diff --git a/src/duckdb/extension/icu/third_party/icu/common/util.cpp b/src/duckdb/extension/icu/third_party/icu/common/util.cpp index 1a7fc9f34..f6a13aa44 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/util.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/util.cpp @@ -15,16 +15,16 @@ #include "patternprops.h" #include "util.h" -// Define UChar constants using hex for EBCDIC compatibility +// Define char16_t constants using hex for EBCDIC compatibility -static const UChar u_util_BACKSLASH = 0x005C; /*\*/ -static const UChar u_util_UPPER_U = 0x0055; /*U*/ -static const UChar u_util_LOWER_U = 0x0075; /*u*/ -static const UChar u_util_APOSTROPHE = 0x0027; // '\'' -static const UChar u_util_SPACE = 0x0020; // ' ' +static const char16_t BACKSLASH = 0x005C; /*\*/ +static const char16_t UPPER_U = 0x0055; /*U*/ +static const char16_t LOWER_U = 0x0075; /*u*/ +static const char16_t APOSTROPHE = 0x0027; // '\'' +static const char16_t SPACE = 0x0020; // ' ' // "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" -static const UChar u_util_DIGITS[] = { +static const char16_t DIGITS[] = { 48,49,50,51,52,53,54,55,56,57, 65,66,67,68,69,70,71,72,73,74, 75,76,77,78,79,80,81,82,83,84, @@ -37,12 +37,12 @@ UnicodeString& ICU_Utility::appendNumber(UnicodeString& result, int32_t n, int32_t radix, int32_t minDigits) { if (radix < 2 || radix > 36) { // Bogus radix - return result.append((UChar)63/*?*/); + return result.append((char16_t)63/*?*/); } // Handle negatives if (n < 0) { n = -n; - result.append((UChar)45/*-*/); + result.append((char16_t)45/*-*/); } // First determine the number of digits int32_t nn = n; @@ -54,49 +54,63 @@ UnicodeString& ICU_Utility::appendNumber(UnicodeString& result, int32_t n, } // Now generate the digits while (--minDigits > 0) { - result.append(u_util_DIGITS[0]); + result.append(DIGITS[0]); } while (r > 0) { int32_t digit = n / r; - result.append(u_util_DIGITS[digit]); + result.append(DIGITS[digit]); n -= digit * r; r /= radix; } return result; } -/** - * Return true if the character is NOT printable ASCII. - */ UBool ICU_Utility::isUnprintable(UChar32 c) { return !(c >= 0x20 && c <= 0x7E); } -/** - * Escape unprintable characters using \uxxxx notation for U+0000 to - * U+FFFF and \Uxxxxxxxx for U+10000 and above. If the character is - * printable ASCII, then do nothing and return FALSE. Otherwise, - * append the escaped notation and return TRUE. - */ +UBool ICU_Utility::shouldAlwaysBeEscaped(UChar32 c) { + if (c < 0x20) { + return true; // C0 control codes + } else if (c <= 0x7e) { + return false; // printable ASCII + } else if (c <= 0x9f) { + return true; // C1 control codes + } else if (c < 0xd800) { + return false; // most of the BMP + } else if (c <= 0xdfff || (0xfdd0 <= c && c <= 0xfdef) || (c & 0xfffe) == 0xfffe) { + return true; // surrogate or noncharacter code points + } else if (c <= 0x10ffff) { + return false; // all else + } else { + return true; // not a code point + } +} + UBool ICU_Utility::escapeUnprintable(UnicodeString& result, UChar32 c) { if (isUnprintable(c)) { - result.append(u_util_BACKSLASH); - if (c & ~0xFFFF) { - result.append(u_util_UPPER_U); - result.append(u_util_DIGITS[0xF&(c>>28)]); - result.append(u_util_DIGITS[0xF&(c>>24)]); - result.append(u_util_DIGITS[0xF&(c>>20)]); - result.append(u_util_DIGITS[0xF&(c>>16)]); - } else { - result.append(u_util_LOWER_U); - } - result.append(u_util_DIGITS[0xF&(c>>12)]); - result.append(u_util_DIGITS[0xF&(c>>8)]); - result.append(u_util_DIGITS[0xF&(c>>4)]); - result.append(u_util_DIGITS[0xF&c]); - return TRUE; + escape(result, c); + return true; } - return FALSE; + return false; +} + +UnicodeString &ICU_Utility::escape(UnicodeString& result, UChar32 c) { + result.append(BACKSLASH); + if (c & ~0xFFFF) { + result.append(UPPER_U); + result.append(DIGITS[0xF&(c>>28)]); + result.append(DIGITS[0xF&(c>>24)]); + result.append(DIGITS[0xF&(c>>20)]); + result.append(DIGITS[0xF&(c>>16)]); + } else { + result.append(LOWER_U); + } + result.append(DIGITS[0xF&(c>>12)]); + result.append(DIGITS[0xF&(c>>8)]); + result.append(DIGITS[0xF&(c>>4)]); + result.append(DIGITS[0xF&c]); + return result; } /** @@ -108,14 +122,14 @@ UBool ICU_Utility::escapeUnprintable(UnicodeString& result, UChar32 c) { /* int32_t ICU_Utility::quotedIndexOf(const UnicodeString& text, int32_t start, int32_t limit, - UChar charToFind) { + char16_t charToFind) { for (int32_t i=start; i= u'0' && c <= u'9') { result = result * 10 + (c - u'0'); pos++; @@ -288,7 +302,7 @@ int32_t ICU_Utility::parseAsciiInteger(const UnicodeString& str, int32_t& pos) { /** * Append a character to a rule that is being built up. To flush - * the quoteBuf to rule, make one final call with isLiteral == TRUE. + * the quoteBuf to rule, make one final call with isLiteral == true. * If there is no final character, pass in (UChar32)-1 as c. * @param rule the string to append the character to * @param c the character to append, or (UChar32)-1 if none. @@ -315,36 +329,36 @@ void ICU_Utility::appendToRule(UnicodeString& rule, if (isLiteral || (escapeUnprintable && ICU_Utility::isUnprintable(c))) { if (quoteBuf.length() > 0) { - // We prefer backslash u_util_APOSTROPHE to double u_util_APOSTROPHE + // We prefer backslash APOSTROPHE to double APOSTROPHE // (more readable, less similar to ") so if there are - // double u_util_APOSTROPHEs at the ends, we pull them outside + // double APOSTROPHEs at the ends, we pull them outside // of the quote. - // If the first thing in the quoteBuf is u_util_APOSTROPHE + // If the first thing in the quoteBuf is APOSTROPHE // (doubled) then pull it out. while (quoteBuf.length() >= 2 && - quoteBuf.charAt(0) == u_util_APOSTROPHE && - quoteBuf.charAt(1) == u_util_APOSTROPHE) { - rule.append(u_util_BACKSLASH).append(u_util_APOSTROPHE); + quoteBuf.charAt(0) == APOSTROPHE && + quoteBuf.charAt(1) == APOSTROPHE) { + rule.append(BACKSLASH).append(APOSTROPHE); quoteBuf.remove(0, 2); } - // If the last thing in the quoteBuf is u_util_APOSTROPHE + // If the last thing in the quoteBuf is APOSTROPHE // (doubled) then remove and count it and add it after. int32_t trailingCount = 0; while (quoteBuf.length() >= 2 && - quoteBuf.charAt(quoteBuf.length()-2) == u_util_APOSTROPHE && - quoteBuf.charAt(quoteBuf.length()-1) == u_util_APOSTROPHE) { + quoteBuf.charAt(quoteBuf.length()-2) == APOSTROPHE && + quoteBuf.charAt(quoteBuf.length()-1) == APOSTROPHE) { quoteBuf.truncate(quoteBuf.length()-2); ++trailingCount; } if (quoteBuf.length() > 0) { - rule.append(u_util_APOSTROPHE); + rule.append(APOSTROPHE); rule.append(quoteBuf); - rule.append(u_util_APOSTROPHE); + rule.append(APOSTROPHE); quoteBuf.truncate(0); } while (trailingCount-- > 0) { - rule.append(u_util_BACKSLASH).append(u_util_APOSTROPHE); + rule.append(BACKSLASH).append(APOSTROPHE); } } if (c != (UChar32)-1) { @@ -353,7 +367,7 @@ void ICU_Utility::appendToRule(UnicodeString& rule, * only if there isn't already one at the end of the * rule. */ - if (c == u_util_SPACE) { + if (c == SPACE) { int32_t len = rule.length(); if (len > 0 && rule.charAt(len-1) != c) { rule.append(c); @@ -366,8 +380,8 @@ void ICU_Utility::appendToRule(UnicodeString& rule, // Escape ' and '\' and don't begin a quote just for them else if (quoteBuf.length() == 0 && - (c == u_util_APOSTROPHE || c == u_util_BACKSLASH)) { - rule.append(u_util_BACKSLASH); + (c == APOSTROPHE || c == BACKSLASH)) { + rule.append(BACKSLASH); rule.append(c); } @@ -382,11 +396,11 @@ void ICU_Utility::appendToRule(UnicodeString& rule, PatternProps::isWhiteSpace(c)) { quoteBuf.append(c); // Double ' within a quote - if (c == u_util_APOSTROPHE) { + if (c == APOSTROPHE) { quoteBuf.append(c); } } - + // Otherwise just append else { rule.append(c); @@ -411,10 +425,10 @@ void ICU_Utility::appendToRule(UnicodeString& rule, const UnicodeMatcher* matcher, UBool escapeUnprintable, UnicodeString& quoteBuf) { - if (matcher != NULL) { + if (matcher != nullptr) { UnicodeString pat; appendToRule(rule, matcher->toPattern(pat, escapeUnprintable), - TRUE, escapeUnprintable, quoteBuf); + true, escapeUnprintable, quoteBuf); } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/util.h b/src/duckdb/extension/icu/third_party/icu/common/util.h index f3f71dce4..cf71b9623 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/util.h +++ b/src/duckdb/extension/icu/third_party/icu/common/util.h @@ -13,10 +13,10 @@ #ifndef ICU_UTIL_H #define ICU_UTIL_H -#include "unicode/utypes.h" -#include "unicode/uobject.h" +#include "charstr.h" #include "unicode/unistr.h" - +#include "unicode/uobject.h" +#include "unicode/utypes.h" //-------------------------------------------------------------------- // class ICU_Utility // i18n utility functions, scoped into the class ICU_Utility. @@ -55,20 +55,30 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s /** * Return true if the character is NOT printable ASCII. - * - * This method should really be in UnicodeString (or similar). For - * now, we implement it here and share it with friend classes. + * The tab, newline and linefeed characters are considered unprintable. */ static UBool isUnprintable(UChar32 c); /** - * Escape unprintable characters using \uxxxx notation for U+0000 to + * @return true for control codes and for surrogate and noncharacter code points + */ + static UBool shouldAlwaysBeEscaped(UChar32 c); + + /** + * Escapes one unprintable code point using \uxxxx notation for U+0000 to * U+FFFF and \Uxxxxxxxx for U+10000 and above. If the character is - * printable ASCII, then do nothing and return FALSE. Otherwise, - * append the escaped notation and return TRUE. + * printable ASCII, then do nothing and return false. Otherwise, + * append the escaped notation and return true. */ static UBool escapeUnprintable(UnicodeString& result, UChar32 c); + /** + * Escapes one code point using \uxxxx notation + * for U+0000 to U+FFFF and \Uxxxxxxxx for U+10000 and above. + * @return result + */ + static UnicodeString &escape(UnicodeString& result, UChar32 c); + /** * Returns the index of a character, ignoring quoted text. * For example, in the string "abc'hide'h", the 'h' in "hide" will not be @@ -84,7 +94,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s //?FOR FUTURE USE. DISABLE FOR NOW for coverage reasons. // static int32_t quotedIndexOf(const UnicodeString& text, // int32_t start, int32_t limit, -// UChar c); +// char16_t c); /** * Skip over a sequence of zero or more white space characters at pos. @@ -95,7 +105,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s * after pos, or str.length(), if there is none. */ static int32_t skipWhitespace(const UnicodeString& str, int32_t& pos, - UBool advance = FALSE); + UBool advance = false); /** * Skip over Pattern_White_Space in a Replaceable. @@ -130,7 +140,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s * @return true if 'ch' is seen preceded by zero or more * whitespace characters. */ - static UBool parseChar(const UnicodeString& id, int32_t& pos, UChar ch); + static UBool parseChar(const UnicodeString& id, int32_t& pos, char16_t ch); /** * Parse a pattern string starting at offset pos. Keywords are @@ -199,7 +209,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s * position. Return the identifier, or an empty string if there * is no identifier. * @param str the string to parse - * @param pos INPUT-OUPUT parameter. On INPUT, pos is the + * @param pos INPUT-OUTPUT parameter. On INPUT, pos is the * first character to examine. It must be less than str.length(), * and it must not point to a whitespace character. That is, must * have pos < str.length() and @@ -248,7 +258,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s private: // do not instantiate - ICU_Utility(); + ICU_Utility() = delete; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/util_props.cpp b/src/duckdb/extension/icu/third_party/icu/common/util_props.cpp index 95a112bc9..5991769d0 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/util_props.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/util_props.cpp @@ -91,8 +91,8 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& rule, int32_t pos, int32_ int32_t p; int32_t intCount = 0; // number of integers parsed for (int32_t i=0; i= limit) { @@ -120,7 +120,7 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& rule, int32_t pos, int32_ if (pos >= limit) { return -1; } - c = (UChar) u_tolower(rule.charAt(pos++)); + c = (char16_t) u_tolower(rule.charAt(pos++)); if (c != cpat) { return -1; } @@ -135,7 +135,7 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& rule, int32_t pos, int32_ * position. Return the identifier, or an empty string if there * is no identifier. * @param str the string to parse - * @param pos INPUT-OUPUT parameter. On INPUT, pos is the + * @param pos INPUT-OUTPUT parameter. On INPUT, pos is the * first character to examine. It must be less than str.length(), * and it must not point to a whitespace character. That is, must * have pos < str.length(). On diff --git a/src/duckdb/extension/icu/third_party/icu/common/utrace.cpp b/src/duckdb/extension/icu/third_party/icu/common/utrace.cpp index c98154659..1f536d564 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utrace.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/utrace.cpp @@ -18,10 +18,10 @@ #include "ucln_cmn.h" -static UTraceEntry *pTraceEntryFunc = NULL; -static UTraceExit *pTraceExitFunc = NULL; -static UTraceData *pTraceDataFunc = NULL; -static const void *gTraceContext = NULL; +static UTraceEntry *pTraceEntryFunc = nullptr; +static UTraceExit *pTraceExitFunc = nullptr; +static UTraceData *pTraceDataFunc = nullptr; +static const void *gTraceContext = nullptr; /** * \var utrace_level @@ -32,7 +32,7 @@ utrace_level = UTRACE_ERROR; U_CAPI void U_EXPORT2 utrace_entry(int32_t fnNumber) { - if (pTraceEntryFunc != NULL) { + if (pTraceEntryFunc != nullptr) { (*pTraceEntryFunc)(gTraceContext, fnNumber); } } @@ -46,7 +46,7 @@ static const char gExitFmtPtrStatus[] = "Returns %d. Status = %p."; U_CAPI void U_EXPORT2 utrace_exit(int32_t fnNumber, int32_t returnType, ...) { - if (pTraceExitFunc != NULL) { + if (pTraceExitFunc != nullptr) { va_list args; const char *fmt; @@ -67,7 +67,7 @@ utrace_exit(int32_t fnNumber, int32_t returnType, ...) { fmt = gExitFmtPtrStatus; break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } va_start(args, returnType); @@ -80,7 +80,7 @@ utrace_exit(int32_t fnNumber, int32_t returnType, ...) { U_CAPI void U_EXPORT2 utrace_data(int32_t fnNumber, int32_t level, const char *fmt, ...) { - if (pTraceDataFunc != NULL) { + if (pTraceDataFunc != nullptr) { va_list args; va_start(args, fmt ); (*pTraceDataFunc)(gTraceContext, fnNumber, level, fmt, args); @@ -93,7 +93,7 @@ static void outputChar(char c, char *outBuf, int32_t *outIx, int32_t capacity, i int32_t i; /* Check whether a start of line indenting is needed. Three cases: * 1. At the start of the first line (output index == 0). - * 2. At the start of subsequent lines (preceeding char in buffer == '\n') + * 2. At the start of subsequent lines (preceding char in buffer == '\n') * 3. When preflighting buffer len (buffer capacity is exceeded), when * a \n is output. Ideally we wouldn't do the indent until the following char * is received, but that won't work because there's no place to remember that @@ -117,9 +117,9 @@ static void outputChar(char c, char *outBuf, int32_t *outIx, int32_t capacity, i outBuf[*outIx] = c; } if (c != 0) { - /* Nulls only appear as end-of-string terminators. Move them to the output + /* NULs only appear as end-of-string terminators. Move them to the output * buffer, but do not update the length of the buffer, so that any - * following output will overwrite the null. */ + * following output will overwrite the NUL. */ (*outIx)++; } } @@ -157,7 +157,7 @@ static void outputPtrBytes(void *val, char *outBuf, int32_t *outIx, int32_t capa static void outputString(const char *s, char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) { int32_t i = 0; char c; - if (s==NULL) { + if (s==nullptr) { s = "*NULL*"; } do { @@ -168,12 +168,12 @@ static void outputString(const char *s, char *outBuf, int32_t *outIx, int32_t ca -static void outputUString(const UChar *s, int32_t len, +static void outputUString(const char16_t *s, int32_t len, char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) { int32_t i = 0; - UChar c; - if (s==NULL) { - outputString(NULL, outBuf, outIx, capacity, indent); + char16_t c; + if (s==nullptr) { + outputString(nullptr, outBuf, outIx, capacity, indent); return; } @@ -205,7 +205,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, /* Literal character, not part of a %sequence. Just copy it to the output. */ outputChar(fmtC, outBuf, &outIx, capacity, indent); if (fmtC == 0) { - /* We hit the null that terminates the format string. + /* We hit the NUL that terminates the format string. * This is the normal (and only) exit from the loop that * interprets the format */ @@ -225,16 +225,16 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, break; case 's': - /* char * string, null terminated. */ + /* char * string, NUL terminated. */ ptrArg = va_arg(args, char *); outputString((const char *)ptrArg, outBuf, &outIx, capacity, indent); break; case 'S': - /* UChar * string, with length, len==-1 for null terminated. */ + /* char16_t * string, with length, len==-1 for NUL terminated. */ ptrArg = va_arg(args, char *); /* Ptr */ intArg =(int32_t)va_arg(args, int32_t); /* Length */ - outputUString((const UChar *)ptrArg, intArg, outBuf, &outIx, capacity, indent); + outputUString((const char16_t *)ptrArg, intArg, outBuf, &outIx, capacity, indent); break; case 'b': @@ -269,7 +269,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, case 0: /* Single '%' at end of fmt string. Output as literal '%'. - * Back up index into format string so that the terminating null will be + * Back up index into format string so that the terminating NUL will be * re-fetched in the outer loop, causing it to terminate. */ outputChar('%', outBuf, &outIx, capacity, indent); @@ -299,7 +299,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, i64Ptr = (int64_t *)i8Ptr; ptrPtr = (void **)i8Ptr; vectorLen =(int32_t)va_arg(args, int32_t); - if (ptrPtr == NULL) { + if (ptrPtr == nullptr) { outputString("*NULL* ", outBuf, &outIx, capacity, indent); } else { for (i=0; i=(level)) /** - * Flag bit in utraceFnNumber, the local variable added to each function + * Flag bit in utraceFnNumber, the local variable added to each function * with tracing code to contains the function number. * * Set the flag if the function's entry is traced, which will cause the - * function's exit to also be traced. utraceFnNumber is uncoditionally + * function's exit to also be traced. utraceFnNumber is uncoditionally * set at entry, whether or not the entry is traced, so that it will * always be available for error trace output. * @internal - */ + */ #define UTRACE_TRACED_ENTRY 0x80000000 /** @@ -193,9 +193,9 @@ UPRV_BLOCK_MACRO_BEGIN { \ * Trace statement for each exit point of a function that has a UTRACE_ENTRY() * statement, and that returns a value. * - * @param val The function's return value, int32_t or comatible type. + * @param val The function's return value, int32_t or compatible type. * - * @internal + * @internal */ #define UTRACE_EXIT_VALUE(val) UPRV_BLOCK_MACRO_BEGIN { \ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \ diff --git a/src/duckdb/extension/icu/third_party/icu/common/utrie.cpp b/src/duckdb/extension/icu/third_party/icu/common/utrie.cpp index 75cad6dd5..83be0e340 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utrie.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/utrie.cpp @@ -34,7 +34,7 @@ #define ABS(x) ((x)>=0 ? (x) : -(x)) static inline UBool -utrie_equal_uint32(const uint32_t *s, const uint32_t *t, int32_t length) { +equal_uint32(const uint32_t *s, const uint32_t *t, int32_t length) { while(length>0 && *s==*t) { ++s; ++t; @@ -56,30 +56,30 @@ utrie_open(UNewTrie *fillIn, if( maxDataLengthisAllocated= (UBool)(fillIn==NULL); + trie->isAllocated= (UBool)(fillIn==nullptr); - if(aliasData!=NULL) { + if(aliasData!=nullptr) { trie->data=aliasData; - trie->isDataAllocated=FALSE; + trie->isDataAllocated=false; } else { trie->data=(uint32_t *)uprv_malloc(maxDataLength*4); - if(trie->data==NULL) { + if(trie->data==nullptr) { uprv_free(trie); - return NULL; + return nullptr; } - trie->isDataAllocated=TRUE; + trie->isDataAllocated=true; } /* preallocate and reset the first data block (block index 0) */ @@ -108,7 +108,7 @@ utrie_open(UNewTrie *fillIn, trie->indexLength=UTRIE_MAX_INDEX_LENGTH; trie->dataCapacity=maxDataLength; trie->isLatin1Linear=latin1Linear; - trie->isCompacted=FALSE; + trie->isCompacted=false; return trie; } @@ -118,26 +118,26 @@ utrie_clone(UNewTrie *fillIn, const UNewTrie *other, uint32_t *aliasData, int32_ UBool isDataAllocated; /* do not clone if other is not valid or already compacted */ - if(other==NULL || other->data==NULL || other->isCompacted) { - return NULL; + if(other==nullptr || other->data==nullptr || other->isCompacted) { + return nullptr; } /* clone data */ - if(aliasData!=NULL && aliasDataCapacity>=other->dataCapacity) { - isDataAllocated=FALSE; + if(aliasData!=nullptr && aliasDataCapacity>=other->dataCapacity) { + isDataAllocated=false; } else { aliasDataCapacity=other->dataCapacity; aliasData=(uint32_t *)uprv_malloc(other->dataCapacity*4); - if(aliasData==NULL) { - return NULL; + if(aliasData==nullptr) { + return nullptr; } - isDataAllocated=TRUE; + isDataAllocated=true; } trie=utrie_open(fillIn, aliasData, aliasDataCapacity, other->data[0], other->leadUnitValue, other->isLatin1Linear); - if(trie==NULL) { + if(trie==nullptr) { uprv_free(aliasData); } else { uprv_memcpy(trie->index, other->index, sizeof(trie->index)); @@ -151,10 +151,10 @@ utrie_clone(UNewTrie *fillIn, const UNewTrie *other, uint32_t *aliasData, int32_ U_CAPI void U_EXPORT2 utrie_close(UNewTrie *trie) { - if(trie!=NULL) { + if(trie!=nullptr) { if(trie->isDataAllocated) { uprv_free(trie->data); - trie->data=NULL; + trie->data=nullptr; } if(trie->isAllocated) { uprv_free(trie); @@ -164,8 +164,8 @@ utrie_close(UNewTrie *trie) { U_CAPI uint32_t * U_EXPORT2 utrie_getData(UNewTrie *trie, int32_t *pLength) { - if(trie==NULL || pLength==NULL) { - return NULL; + if(trie==nullptr || pLength==nullptr) { + return nullptr; } *pLength=trie->dataLength; @@ -216,24 +216,24 @@ utrie_getDataBlock(UNewTrie *trie, UChar32 c) { } /** - * @return TRUE if the value was successfully set + * @return true if the value was successfully set */ U_CAPI UBool U_EXPORT2 utrie_set32(UNewTrie *trie, UChar32 c, uint32_t value) { int32_t block; /* valid, uncompacted trie and valid c? */ - if(trie==NULL || trie->isCompacted || (uint32_t)c>0x10ffff) { - return FALSE; + if(trie==nullptr || trie->isCompacted || (uint32_t)c>0x10ffff) { + return false; } block=utrie_getDataBlock(trie, c); if(block<0) { - return FALSE; + return false; } trie->data[block+(c&UTRIE_MASK)]=value; - return TRUE; + return true; } U_CAPI uint32_t U_EXPORT2 @@ -241,15 +241,15 @@ utrie_get32(UNewTrie *trie, UChar32 c, UBool *pInBlockZero) { int32_t block; /* valid, uncompacted trie and valid c? */ - if(trie==NULL || trie->isCompacted || (uint32_t)c>0x10ffff) { - if(pInBlockZero!=NULL) { - *pInBlockZero=TRUE; + if(trie==nullptr || trie->isCompacted || (uint32_t)c>0x10ffff) { + if(pInBlockZero!=nullptr) { + *pInBlockZero=true; } return 0; } block=trie->index[c>>UTRIE_SHIFT]; - if(pInBlockZero!=NULL) { + if(pInBlockZero!=nullptr) { *pInBlockZero= (UBool)(block==0); } @@ -291,13 +291,13 @@ utrie_setRange32(UNewTrie *trie, UChar32 start, UChar32 limit, uint32_t value, U int32_t block, rest, repeatBlock; /* valid, uncompacted trie and valid indexes? */ - if( trie==NULL || trie->isCompacted || + if( trie==nullptr || trie->isCompacted || (uint32_t)start>0x10ffff || (uint32_t)limit>0x110000 || start>limit ) { - return FALSE; + return false; } if(start==limit) { - return TRUE; /* nothing to do */ + return true; /* nothing to do */ } initialValue=trie->data[0]; @@ -307,7 +307,7 @@ utrie_setRange32(UNewTrie *trie, UChar32 start, UChar32 limit, uint32_t value, U /* set partial block at [start..following block boundary[ */ block=utrie_getDataBlock(trie, start); if(block<0) { - return FALSE; + return false; } nextStart=(start+UTRIE_DATA_BLOCK_LENGTH)&~UTRIE_MASK; @@ -318,7 +318,7 @@ utrie_setRange32(UNewTrie *trie, UChar32 start, UChar32 limit, uint32_t value, U } else { utrie_fillBlock(trie->data+block, start&UTRIE_MASK, limit&UTRIE_MASK, value, initialValue, overwrite); - return TRUE; + return true; } } @@ -348,12 +348,12 @@ utrie_setRange32(UNewTrie *trie, UChar32 start, UChar32 limit, uint32_t value, U /* create and set and fill the repeatBlock */ repeatBlock=utrie_getDataBlock(trie, start); if(repeatBlock<0) { - return FALSE; + return false; } /* set the negative block number to indicate that it is a repeat block */ trie->index[start>>UTRIE_SHIFT]=-repeatBlock; - utrie_fillBlock(trie->data+repeatBlock, 0, UTRIE_DATA_BLOCK_LENGTH, value, initialValue, TRUE); + utrie_fillBlock(trie->data+repeatBlock, 0, UTRIE_DATA_BLOCK_LENGTH, value, initialValue, true); } } @@ -364,13 +364,13 @@ utrie_setRange32(UNewTrie *trie, UChar32 start, UChar32 limit, uint32_t value, U /* set partial block at [last block boundary..limit[ */ block=utrie_getDataBlock(trie, start); if(block<0) { - return FALSE; + return false; } utrie_fillBlock(trie->data+block, 0, rest, value, initialValue, overwrite); } - return TRUE; + return true; } static int32_t @@ -437,7 +437,7 @@ utrie_fold(UNewTrie *trie, UNewTrieGetFoldedValue *getFoldedValue, UErrorCode *p *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return; } - utrie_fillBlock(trie->data+block, 0, UTRIE_DATA_BLOCK_LENGTH, trie->leadUnitValue, trie->data[0], TRUE); + utrie_fillBlock(trie->data+block, 0, UTRIE_DATA_BLOCK_LENGTH, trie->leadUnitValue, trie->data[0], true); block=-block; /* negative block number to indicate that it is a repeat block */ } for(c=(0xd800>>UTRIE_SHIFT); c<(0xdc00>>UTRIE_SHIFT); ++c) { @@ -473,7 +473,7 @@ utrie_fold(UNewTrie *trie, UNewTrieGetFoldedValue *getFoldedValue, UErrorCode *p * set it for the lead surrogate code unit */ value=getFoldedValue(trie, c, block+UTRIE_SURROGATE_BLOCK_COUNT); - if(value!=utrie_get32(trie, U16_LEAD(c), NULL)) { + if(value!=utrie_get32(trie, U16_LEAD(c), nullptr)) { if(!utrie_set32(trie, U16_LEAD(c), value)) { /* data table overflow */ *pErrorCode=U_MEMORY_ALLOCATION_ERROR; @@ -567,7 +567,7 @@ _findSameDataBlock(const uint32_t *data, int32_t dataLength, dataLength-=UTRIE_DATA_BLOCK_LENGTH; for(block=0; block<=dataLength; block+=step) { - if(utrie_equal_uint32(data+block, data+otherBlock, UTRIE_DATA_BLOCK_LENGTH)) { + if(equal_uint32(data+block, data+otherBlock, UTRIE_DATA_BLOCK_LENGTH)) { return block; } } @@ -579,7 +579,7 @@ _findSameDataBlock(const uint32_t *data, int32_t dataLength, * * The compaction * - removes blocks that are identical with earlier ones - * - overlaps adjacent blocks as much as possible (if overlap==TRUE) + * - overlaps adjacent blocks as much as possible (if overlap==true) * - moves blocks in steps of the data granularity * - moves and overlaps blocks that overlap with multiple values in the overlap region * @@ -590,12 +590,12 @@ static void utrie_compact(UNewTrie *trie, UBool overlap, UErrorCode *pErrorCode) { int32_t i, start, newStart, overlapStart; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return; } /* valid, uncompacted trie? */ - if(trie==NULL) { + if(trie==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -652,7 +652,7 @@ utrie_compact(UNewTrie *trie, UBool overlap, UErrorCode *pErrorCode) { if(overlap && start>=overlapStart) { /* look for maximum overlap (modulo granularity) with the previous, adjacent block */ for(i=UTRIE_DATA_BLOCK_LENGTH-UTRIE_DATA_GRANULARITY; - i>0 && !utrie_equal_uint32(trie->data+(newStart-i), trie->data+start, i); + i>0 && !equal_uint32(trie->data+(newStart-i), trie->data+start, i); i-=UTRIE_DATA_GRANULARITY) {} } else { i=0; @@ -747,18 +747,18 @@ utrie_serialize(UNewTrie *trie, void *dt, int32_t capacity, uint32_t *p; uint16_t *dest16; int32_t i, length; - uint8_t* data = NULL; + uint8_t* data = nullptr; /* argument check */ - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(trie==NULL || capacity<0 || (capacity>0 && dt==NULL)) { + if(trie==nullptr || capacity<0 || (capacity>0 && dt==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } - if(getFoldedValue==NULL) { + if(getFoldedValue==nullptr) { getFoldedValue=defaultGetFoldedValue; } @@ -766,15 +766,15 @@ utrie_serialize(UNewTrie *trie, void *dt, int32_t capacity, /* fold and compact if necessary, also checks that indexLength is within limits */ if(!trie->isCompacted) { /* compact once without overlap to improve folding */ - utrie_compact(trie, FALSE, pErrorCode); + utrie_compact(trie, false, pErrorCode); /* fold the supplementary part of the index array */ utrie_fold(trie, getFoldedValue, pErrorCode); /* compact again with overlap for minimum data array length */ - utrie_compact(trie, TRUE, pErrorCode); + utrie_compact(trie, true, pErrorCode); - trie->isCompacted=TRUE; + trie->isCompacted=true; if(U_FAILURE(*pErrorCode)) { return 0; } @@ -859,7 +859,7 @@ utrie_unserialize(UTrie *trie, const void *data, int32_t length, UErrorCode *pEr const uint16_t *p16; uint32_t options; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return -1; } @@ -918,7 +918,7 @@ utrie_unserialize(UTrie *trie, const void *data, int32_t length, UErrorCode *pEr } /* the "data16" data is used via the index pointer */ - trie->data32=NULL; + trie->data32=nullptr; trie->initialValue=trie->index[trie->indexLength]; length=(int32_t)sizeof(UTrieHeader)+2*trie->indexLength+2*trie->dataLength; } @@ -938,7 +938,7 @@ utrie_unserializeDummy(UTrie *trie, int32_t actualLength, latin1Length, i, limit; uint16_t block; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return -1; } @@ -966,7 +966,7 @@ utrie_unserializeDummy(UTrie *trie, return actualLength; } - trie->isLatin1Linear=TRUE; + trie->isLatin1Linear=true; trie->initialValue=initialValue; /* fill the index and data arrays */ @@ -991,7 +991,7 @@ utrie_unserializeDummy(UTrie *trie, } } - trie->data32=NULL; + trie->data32=nullptr; /* Latin-1 data */ p16+=trie->indexLength; @@ -1047,7 +1047,7 @@ utrie_unserializeDummy(UTrie *trie, /* default UTrieEnumValue() returns the input value itself */ static uint32_t U_CALLCONV -utrie_enumSameValue(const void * /*context*/, uint32_t value) { +enumSameValue(const void * /*context*/, uint32_t value) { return value; } @@ -1066,11 +1066,11 @@ utrie_enum(const UTrie *trie, int32_t l, i, j, block, prevBlock, nullBlock, offset; /* check arguments */ - if(trie==NULL || trie->index==NULL || enumRange==NULL) { + if(trie==nullptr || trie->index==nullptr || enumRange==nullptr) { return; } - if(enumValue==NULL) { - enumValue=utrie_enumSameValue; + if(enumValue==nullptr) { + enumValue=enumSameValue; } idx=trie->index; @@ -1079,7 +1079,7 @@ utrie_enum(const UTrie *trie, /* get the enumeration value that corresponds to an initial-value trie data entry */ initialValue=enumValue(context, trie->initialValue); - if(data32==NULL) { + if(data32==nullptr) { nullBlock=trie->indexLength; } else { nullBlock=0; @@ -1120,7 +1120,7 @@ utrie_enum(const UTrie *trie, } else { prevBlock=block; for(j=0; jgetFoldingOffset(value); @@ -1206,7 +1206,7 @@ utrie_enum(const UTrie *trie, } else { prevBlock=block; for(j=0; jdata16!=NULL) { + if(trie->data16!=nullptr) { return UTRIE2_GET16(trie, c); - } else if(trie->data32!=NULL) { + } else if(trie->data32!=nullptr) { return UTRIE2_GET32(trie, c); } else if((uint32_t)c>0x10ffff) { return trie->errorValue; } else { - return get32(trie->newTrie, c, TRUE); + return get32(trie->newTrie, c, true); } } @@ -75,12 +75,12 @@ utrie2_get32FromLeadSurrogateCodeUnit(const UTrie2 *trie, UChar32 c) { if(!U_IS_LEAD(c)) { return trie->errorValue; } - if(trie->data16!=NULL) { + if(trie->data16!=nullptr) { return UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, c); - } else if(trie->data32!=NULL) { + } else if(trie->data32!=nullptr) { return UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c); } else { - return get32(trie->newTrie, c, FALSE); + return get32(trie->newTrie, c, false); } } @@ -89,7 +89,7 @@ u8Index(const UTrie2 *trie, UChar32 c, int32_t i) { int32_t idx= _UTRIE2_INDEX_FROM_CP( trie, - trie->data32==NULL ? trie->indexLength : 0, + trie->data32==nullptr ? trie->indexLength : 0, c); return (idx<<3)|i; } @@ -136,16 +136,16 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits, UTrie2 tempTrie; UTrie2 *trie; - if (U_FAILURE(*pErrorCode)) { + if(U_FAILURE(*pErrorCode)) { return 0; } -// if( length<=0 || (U_POINTER_MASK_LSB(data, 3)!=0) || -// valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits -// ) { -// *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; -// return 0; -// } + if( length<=0 || /*(U_POINTER_MASK_LSB(data, 3)!=0) ||*/ + valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits + ) { + *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } /* enough data for a trie header? */ if(length<(int32_t)sizeof(UTrie2Header)) { @@ -193,14 +193,14 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits, /* allocate the trie */ trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2)); - if(trie==NULL) { + if(trie==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return 0; } uprv_memcpy(trie, &tempTrie, sizeof(tempTrie)); trie->memory=(uint32_t *)data; trie->length=actualLength; - trie->isMemoryOwned=FALSE; + trie->isMemoryOwned=false; #ifdef UTRIE2_DEBUG trie->name="fromSerialized"; #endif @@ -214,12 +214,12 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits, switch(valueBits) { case UTRIE2_16_VALUE_BITS: trie->data16=p16; - trie->data32=NULL; + trie->data32=nullptr; trie->initialValue=trie->index[trie->dataNullOffset]; trie->errorValue=trie->data16[UTRIE2_BAD_UTF8_DATA_OFFSET]; break; case UTRIE2_32_VALUE_BITS: - trie->data16=NULL; + trie->data16=nullptr; trie->data32=(const uint32_t *)p16; trie->initialValue=trie->data32[trie->dataNullOffset]; trie->errorValue=trie->data32[UTRIE2_BAD_UTF8_DATA_OFFSET]; @@ -229,7 +229,7 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits, return 0; } - if(pActualLength!=NULL) { + if(pActualLength!=nullptr) { *pActualLength=actualLength; } return trie; @@ -267,19 +267,19 @@ utrie2_openDummy(UTrie2ValueBits valueBits, /* allocate the trie */ trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2)); - if(trie==NULL) { + if(trie==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return 0; } uprv_memset(trie, 0, sizeof(UTrie2)); trie->memory=uprv_malloc(length); - if(trie->memory==NULL) { + if(trie->memory==nullptr) { uprv_free(trie); *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return 0; } trie->length=length; - trie->isMemoryOwned=TRUE; + trie->isMemoryOwned=true; /* set the UTrie2 fields */ if(valueBits==UTRIE2_16_VALUE_BITS) { @@ -334,7 +334,7 @@ utrie2_openDummy(UTrie2ValueBits valueBits, case UTRIE2_16_VALUE_BITS: /* write 16-bit data values */ trie->data16=dest16; - trie->data32=NULL; + trie->data32=nullptr; for(i=0; i<0x80; ++i) { *dest16++=(uint16_t)initialValue; } @@ -349,7 +349,7 @@ utrie2_openDummy(UTrie2ValueBits valueBits, case UTRIE2_32_VALUE_BITS: /* write 32-bit data values */ p=(uint32_t *)dest16; - trie->data16=NULL; + trie->data16=nullptr; trie->data32=p; for(i=0; i<0x80; ++i) { *p++=initialValue; @@ -372,11 +372,11 @@ utrie2_openDummy(UTrie2ValueBits valueBits, U_CAPI void U_EXPORT2 utrie2_close(UTrie2 *trie) { - if(trie!=NULL) { + if(trie!=nullptr) { if(trie->isMemoryOwned) { uprv_free(trie->memory); } - if(trie->newTrie!=NULL) { + if(trie->newTrie!=nullptr) { uprv_free(trie->newTrie->data); #ifdef UCPTRIE_DEBUG umutablecptrie_close(trie->newTrie->t3); @@ -389,7 +389,7 @@ utrie2_close(UTrie2 *trie) { U_CAPI UBool U_EXPORT2 utrie2_isFrozen(const UTrie2 *trie) { - return (UBool)(trie->newTrie==NULL); + return (UBool)(trie->newTrie==nullptr); } U_CAPI int32_t U_EXPORT2 @@ -401,8 +401,8 @@ utrie2_serialize(const UTrie2 *trie, return 0; } - if( trie==NULL || trie->memory==NULL || trie->newTrie!=NULL || - capacity<0 || (capacity>0 && (data==NULL || (U_POINTER_MASK_LSB(data, 3)!=0))) + if( trie==nullptr || trie->memory==nullptr || trie->newTrie!=nullptr || + capacity<0 || (capacity>0 && (data==nullptr || (U_POINTER_MASK_LSB(data, 3)!=0))) ) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; @@ -422,7 +422,7 @@ utrie2_serialize(const UTrie2 *trie, /* default UTrie2EnumValue() returns the input value itself */ static uint32_t U_CALLCONV -utrie2_enumSameValue(const void * /*context*/, uint32_t value) { +enumSameValue(const void * /*context*/, uint32_t value) { return value; } @@ -450,26 +450,26 @@ enumEitherTrie(const UTrie2 *trie, UChar32 c, prev, highStart; int32_t j, i2Block, prevI2Block, index2NullOffset, block, prevBlock, nullBlock; - if(enumRange==NULL) { + if(enumRange==nullptr) { return; } - if(enumValue==NULL) { - enumValue=utrie2_enumSameValue; + if(enumValue==nullptr) { + enumValue=enumSameValue; } - if(trie->newTrie==NULL) { + if(trie->newTrie==nullptr) { /* frozen trie */ idx=trie->index; - U_ASSERT(idx!=NULL); /* the following code assumes trie->newTrie is not NULL when idx is NULL */ + U_ASSERT(idx!=nullptr); /* the following code assumes trie->newTrie is not nullptr when idx is nullptr */ data32=trie->data32; index2NullOffset=trie->index2NullOffset; nullBlock=trie->dataNullOffset; } else { /* unfrozen, mutable trie */ - idx=NULL; + idx=nullptr; data32=trie->newTrie->data; - U_ASSERT(data32!=NULL); /* the following code assumes idx is not NULL when data32 is NULL */ + U_ASSERT(data32!=nullptr); /* the following code assumes idx is not nullptr when data32 is nullptr */ index2NullOffset=trie->newTrie->index2NullOffset; nullBlock=trie->newTrie->dataNullOffset; @@ -513,7 +513,7 @@ enumEitherTrie(const UTrie2 *trie, } } else { /* supplementary code points */ - if(idx!=NULL) { + if(idx!=nullptr) { i2Block=idx[(UTRIE2_INDEX_1_OFFSET-UTRIE2_OMITTED_BMP_INDEX_1_LENGTH)+ (c>>UTRIE2_SHIFT_1)]; } else { @@ -551,7 +551,7 @@ enumEitherTrie(const UTrie2 *trie, i2Limit=UTRIE2_INDEX_2_BLOCK_LENGTH; } for(; i2newTrie->index2[i2Block+i2]; @@ -574,7 +574,7 @@ enumEitherTrie(const UTrie2 *trie, c+=UTRIE2_DATA_BLOCK_LENGTH; } else { for(j=0; jhighValueIndex] : idx[trie->highValueIndex]; } else { diff --git a/src/duckdb/extension/icu/third_party/icu/common/utrie2.h b/src/duckdb/extension/icu/third_party/icu/common/utrie2.h index 671f44e16..431f11568 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utrie2.h +++ b/src/duckdb/extension/icu/third_party/icu/common/utrie2.h @@ -161,13 +161,13 @@ UTrie2EnumValue(const void *context, uint32_t value); * of code points with the same value as retrieved from the trie and * transformed by the UTrie2EnumValue function. * - * The callback function can stop the enumeration by returning FALSE. + * The callback function can stop the enumeration by returning false. * * @param context an opaque pointer, as passed into utrie2_enum() * @param start the first code point in a contiguous range with value * @param end the last code point in a contiguous range with value (inclusive) * @param value the value that is set for all code points in [start..end] - * @return FALSE to stop the enumeration + * @return false to stop the enumeration */ typedef UBool U_CALLCONV UTrie2EnumRange(const void *context, UChar32 start, UChar32 end, uint32_t value); @@ -256,7 +256,7 @@ utrie2_set32(UTrie2 *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode); /** * Set a value in a range of code points [start..end]. * All code points c with start<=c<=end will get the value if - * overwrite is TRUE or if the old value is the initial value. + * overwrite is true or if the old value is the initial value. * * @param trie the unfrozen trie * @param start the first code point to get the value @@ -298,7 +298,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode); * Test if the trie is frozen. (See utrie2_freeze().) * * @param trie the trie - * @return TRUE if the trie is frozen, that is, immutable, ready for serialization + * @return true if the trie is frozen, that is, immutable, ready for serialization * and for use with fast macros */ U_CAPI UBool U_EXPORT2 @@ -591,42 +591,42 @@ U_CDECL_END #ifdef __cplusplus +#include "unicode/uobject.h" #include "unicode/utf.h" -#include "mutex.h" U_NAMESPACE_BEGIN // Use the Forward/Backward subclasses below. class UTrie2StringIterator : public UMemory { public: - UTrie2StringIterator(const UTrie2 *t, const UChar *p) : + UTrie2StringIterator(const UTrie2 *t, const char16_t *p) : trie(t), codePointStart(p), codePointLimit(p), codePoint(U_SENTINEL) {} const UTrie2 *trie; - const UChar *codePointStart, *codePointLimit; + const char16_t *codePointStart, *codePointLimit; UChar32 codePoint; }; class BackwardUTrie2StringIterator : public UTrie2StringIterator { public: - BackwardUTrie2StringIterator(const UTrie2 *t, const UChar *s, const UChar *p) : + BackwardUTrie2StringIterator(const UTrie2 *t, const char16_t *s, const char16_t *p) : UTrie2StringIterator(t, p), start(s) {} uint16_t previous16(); - const UChar *start; + const char16_t *start; }; class ForwardUTrie2StringIterator : public UTrie2StringIterator { public: - // Iteration limit l can be NULL. + // Iteration limit l can be nullptr. // In that case, the caller must detect c==0 and stop. - ForwardUTrie2StringIterator(const UTrie2 *t, const UChar *p, const UChar *l) : + ForwardUTrie2StringIterator(const UTrie2 *t, const char16_t *p, const char16_t *l) : UTrie2StringIterator(t, p), limit(l) {} uint16_t next16(); - const UChar *limit; + const char16_t *limit; }; U_NAMESPACE_END @@ -670,7 +670,7 @@ struct UTrie2 { /* private: used by builder and unserialization functions */ void *memory; /* serialized bytes; NULL if not frozen yet */ int32_t length; /* number of serialized bytes at memory; 0 if not frozen yet */ - UBool isMemoryOwned; /* TRUE if the trie owns the memory */ + UBool isMemoryOwned; /* true if the trie owns the memory */ UBool padding1; int16_t padding2; UNewTrie2 *newTrie; /* builder object; NULL when frozen */ @@ -796,7 +796,7 @@ enum { * Do not call directly. * @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrie2_internalU8NextIndex(const UTrie2 *trie, UChar32 c, const uint8_t *src, const uint8_t *limit); @@ -805,7 +805,7 @@ utrie2_internalU8NextIndex(const UTrie2 *trie, UChar32 c, * Do not call directly. * @internal */ -U_INTERNAL int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c, const uint8_t *start, const uint8_t *src); diff --git a/src/duckdb/extension/icu/third_party/icu/common/utrie2_builder.cpp b/src/duckdb/extension/icu/third_party/icu/common/utrie2_builder.cpp index 4cdc003b0..1254e8cba 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utrie2_builder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/utrie2_builder.cpp @@ -120,13 +120,13 @@ utrie2_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode) int32_t i, j; if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2)); newTrie=(UNewTrie2 *)uprv_malloc(sizeof(UNewTrie2)); data=(uint32_t *)uprv_malloc(UNEWTRIE2_INITIAL_DATA_LENGTH*4); - if(trie==NULL || newTrie==NULL || data==NULL) { + if(trie==nullptr || newTrie==nullptr || data==nullptr) { uprv_free(trie); uprv_free(newTrie); uprv_free(data); @@ -152,7 +152,7 @@ utrie2_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode) newTrie->errorValue=errorValue; newTrie->highStart=0x110000; newTrie->firstFreeBlock=0; /* no free block in the list */ - newTrie->isCompacted=FALSE; + newTrie->isCompacted=false; /* * preallocate and reset @@ -250,14 +250,14 @@ cloneBuilder(const UNewTrie2 *other) { UNewTrie2 *trie; trie=(UNewTrie2 *)uprv_malloc(sizeof(UNewTrie2)); - if(trie==NULL) { - return NULL; + if(trie==nullptr) { + return nullptr; } trie->data=(uint32_t *)uprv_malloc(other->dataCapacity*4); - if(trie->data==NULL) { + if(trie->data==nullptr) { uprv_free(trie); - return NULL; + return nullptr; } #ifdef UCPTRIE_DEBUG if(other->t3==nullptr) { @@ -300,43 +300,43 @@ utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode) { UTrie2 *trie; if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - if(other==NULL || (other->memory==NULL && other->newTrie==NULL)) { + if(other==nullptr || (other->memory==nullptr && other->newTrie==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2)); - if(trie==NULL) { + if(trie==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } uprv_memcpy(trie, other, sizeof(UTrie2)); - if(other->memory!=NULL) { + if(other->memory!=nullptr) { trie->memory=uprv_malloc(other->length); - if(trie->memory!=NULL) { - trie->isMemoryOwned=TRUE; + if(trie->memory!=nullptr) { + trie->isMemoryOwned=true; uprv_memcpy(trie->memory, other->memory, other->length); /* make the clone's pointers point to its own memory */ trie->index=(uint16_t *)trie->memory+(other->index-(uint16_t *)other->memory); - if(other->data16!=NULL) { + if(other->data16!=nullptr) { trie->data16=(uint16_t *)trie->memory+(other->data16-(uint16_t *)other->memory); } - if(other->data32!=NULL) { + if(other->data32!=nullptr) { trie->data32=(uint32_t *)trie->memory+(other->data32-(uint32_t *)other->memory); } } - } else /* other->newTrie!=NULL */ { + } else /* other->newTrie!=nullptr */ { trie->newTrie=cloneBuilder(other->newTrie); } - if(trie->memory==NULL && trie->newTrie==NULL) { + if(trie->memory==nullptr && trie->newTrie==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; uprv_free(trie); - trie=NULL; + trie=nullptr; } return trie; } @@ -357,11 +357,11 @@ copyEnumRange(const void *context, UChar32 start, UChar32 end, uint32_t value) { if(start==end) { utrie2_set32(nt->trie, start, value, &nt->errorCode); } else { - utrie2_setRange32(nt->trie, start, end, value, TRUE, &nt->errorCode); + utrie2_setRange32(nt->trie, start, end, value, true, &nt->errorCode); } return U_SUCCESS(nt->errorCode); } else { - return TRUE; + return true; } } @@ -386,7 +386,7 @@ static void utrie_printLengths(const UTrie *trie) { long indexLength=trie->indexLength; long dataLength=(long)trie->dataLength; - long totalLength=(long)sizeof(UTrieHeader)+indexLength*2+dataLength*(trie->data32!=NULL ? 4 : 2); + long totalLength=(long)sizeof(UTrieHeader)+indexLength*2+dataLength*(trie->data32!=nullptr ? 4 : 2); printf("**UTrieLengths** index:%6ld data:%6ld serialized:%6ld\n", indexLength, dataLength, totalLength); } @@ -395,7 +395,7 @@ static void utrie2_printLengths(const UTrie2 *trie, const char *which) { long indexLength=trie->indexLength; long dataLength=(long)trie->dataLength; - long totalLength=(long)sizeof(UTrie2Header)+indexLength*2+dataLength*(trie->data32!=NULL ? 4 : 2); + long totalLength=(long)sizeof(UTrie2Header)+indexLength*2+dataLength*(trie->data32!=nullptr ? 4 : 2); printf("**UTrie2Lengths(%s %s)** index:%6ld data:%6ld countInitial:%6ld serialized:%6ld\n", which, trie->name, indexLength, dataLength, countInitial(trie), totalLength); } @@ -404,31 +404,31 @@ utrie2_printLengths(const UTrie2 *trie, const char *which) { U_CAPI UTrie2 * U_EXPORT2 utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode) { NewTrieAndStatus context; - UChar lead; + char16_t lead; if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - if(other==NULL || (other->memory==NULL && other->newTrie==NULL)) { + if(other==nullptr || (other->memory==nullptr && other->newTrie==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if(other->newTrie!=NULL && !other->newTrie->isCompacted) { + if(other->newTrie!=nullptr && !other->newTrie->isCompacted) { return utrie2_clone(other, pErrorCode); /* clone an unfrozen trie */ } /* Clone the frozen trie by enumerating it and building a new one. */ context.trie=utrie2_open(other->initialValue, other->errorValue, pErrorCode); if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - context.exclusiveLimit=FALSE; + context.exclusiveLimit=false; context.errorCode=*pErrorCode; - utrie2_enum(other, NULL, copyEnumRange, &context); + utrie2_enum(other, nullptr, copyEnumRange, &context); *pErrorCode=context.errorCode; for(lead=0xd800; lead<0xdc00; ++lead) { uint32_t value; - if(other->data32==NULL) { + if(other->data32==nullptr) { value=UTRIE2_GET16_FROM_U16_SINGLE_LEAD(other, lead); } else { value=UTRIE2_GET32_FROM_U16_SINGLE_LEAD(other, lead); @@ -439,7 +439,7 @@ utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode) { } if(U_FAILURE(*pErrorCode)) { utrie2_close(context.trie); - context.trie=NULL; + context.trie=nullptr; } return context.trie; } @@ -448,26 +448,26 @@ utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode) { U_CAPI UTrie2 * U_EXPORT2 utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode) { NewTrieAndStatus context; - UChar lead; + char16_t lead; if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - if(trie1==NULL) { + if(trie1==nullptr) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } context.trie=utrie2_open(trie1->initialValue, errorValue, pErrorCode); if(U_FAILURE(*pErrorCode)) { - return NULL; + return nullptr; } - context.exclusiveLimit=TRUE; + context.exclusiveLimit=true; context.errorCode=*pErrorCode; - utrie_enum(trie1, NULL, copyEnumRange, &context); + utrie_enum(trie1, nullptr, copyEnumRange, &context); *pErrorCode=context.errorCode; for(lead=0xd800; lead<0xdc00; ++lead) { uint32_t value; - if(trie1->data32==NULL) { + if(trie1->data32==nullptr) { value=UTRIE_GET16_FROM_LEAD(trie1, lead); } else { value=UTRIE_GET32_FROM_LEAD(trie1, lead); @@ -478,7 +478,7 @@ utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode } if(U_SUCCESS(*pErrorCode)) { utrie2_freeze(context.trie, - trie1->data32!=NULL ? UTRIE2_32_VALUE_BITS : UTRIE2_16_VALUE_BITS, + trie1->data32!=nullptr ? UTRIE2_32_VALUE_BITS : UTRIE2_16_VALUE_BITS, pErrorCode); } #ifdef UTRIE2_DEBUG @@ -489,7 +489,7 @@ utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode #endif if(U_FAILURE(*pErrorCode)) { utrie2_close(context.trie); - context.trie=NULL; + context.trie=nullptr; } return context.trie; } @@ -578,7 +578,7 @@ allocDataBlock(UNewTrie2 *trie, int32_t copyBlock) { return -1; } data=(uint32_t *)uprv_malloc(capacity*4); - if(data==NULL) { + if(data==nullptr) { return -1; } uprv_memcpy(data, trie->data, (size_t)trie->dataLength*4); @@ -649,7 +649,7 @@ getDataBlock(UNewTrie2 *trie, UChar32 c, UBool forLSCP) { } /** - * @return TRUE if the value was successfully set + * @return true if the value was successfully set */ static void set32(UNewTrie2 *trie, @@ -657,7 +657,7 @@ set32(UNewTrie2 *trie, UErrorCode *pErrorCode) { int32_t block; - if(trie==NULL || trie->isCompacted) { + if(trie==nullptr || trie->isCompacted) { *pErrorCode=U_NO_WRITE_PERMISSION; return; } @@ -683,7 +683,7 @@ utrie2_set32(UTrie2 *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } - set32(trie->newTrie, c, TRUE, value, pErrorCode); + set32(trie->newTrie, c, true, value, pErrorCode); } U_CAPI void U_EXPORT2 @@ -697,11 +697,11 @@ utrie2_set32ForLeadSurrogateCodeUnit(UTrie2 *trie, *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } - set32(trie->newTrie, c, FALSE, value, pErrorCode); + set32(trie->newTrie, c, false, value, pErrorCode); } static void -utrie2builder_writeBlock(uint32_t *block, uint32_t value) { +writeBlock(uint32_t *block, uint32_t value) { uint32_t *limit=block+UTRIE2_DATA_BLOCK_LENGTH; while(blocknewTrie; - if(newTrie==NULL || newTrie->isCompacted) { + if(newTrie==nullptr || newTrie->isCompacted) { *pErrorCode=U_NO_WRITE_PERMISSION; return; } @@ -771,7 +771,7 @@ utrie2_setRange32(UTrie2 *trie, UChar32 nextStart; /* set partial block at [start..following block boundary[ */ - block=getDataBlock(newTrie, start, TRUE); + block=getDataBlock(newTrie, start, true); if(block<0) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return; @@ -804,15 +804,15 @@ utrie2_setRange32(UTrie2 *trie, while(startinitialValue && isInNullBlock(newTrie, start, TRUE)) { + if(value==newTrie->initialValue && isInNullBlock(newTrie, start, true)) { start+=UTRIE2_DATA_BLOCK_LENGTH; /* nothing to do */ continue; } /* get index value */ - i2=getIndex2Block(newTrie, start, TRUE); + i2=getIndex2Block(newTrie, start, true); if(i2<0) { *pErrorCode=U_INTERNAL_PROGRAM_ERROR; return; @@ -827,7 +827,7 @@ utrie2_setRange32(UTrie2 *trie, * protected (ASCII-linear or 2-byte UTF-8) block: * replace with the repeatBlock. */ - setRepeatBlock=TRUE; + setRepeatBlock=true; } else { /* !overwrite, or protected block: just write the values into this block */ fillBlock(newTrie->data+block, @@ -851,19 +851,19 @@ utrie2_setRange32(UTrie2 *trie, * and if we overwrite any data or if the data is all initial values * (which is the same as the block being the null block, see above). */ - setRepeatBlock=TRUE; + setRepeatBlock=true; } if(setRepeatBlock) { if(repeatBlock>=0) { setIndex2Entry(newTrie, i2, repeatBlock); } else { /* create and set and fill the repeatBlock */ - repeatBlock=getDataBlock(newTrie, start, TRUE); + repeatBlock=getDataBlock(newTrie, start, true); if(repeatBlock<0) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return; } - utrie2builder_writeBlock(newTrie->data+repeatBlock, value); + writeBlock(newTrie->data+repeatBlock, value); } } @@ -872,7 +872,7 @@ utrie2_setRange32(UTrie2 *trie, if(rest>0) { /* set partial block at [last block boundary..limit[ */ - block=getDataBlock(newTrie, start, TRUE); + block=getDataBlock(newTrie, start, true); if(block<0) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return; @@ -887,7 +887,7 @@ utrie2_setRange32(UTrie2 *trie, /* compaction --------------------------------------------------------------- */ static inline UBool -utrie2_builder_equal_int32(const int32_t *s, const int32_t *t, int32_t length) { +equal_int32(const int32_t *s, const int32_t *t, int32_t length) { while(length>0 && *s==*t) { ++s; ++t; @@ -897,7 +897,7 @@ utrie2_builder_equal_int32(const int32_t *s, const int32_t *t, int32_t length) { } static inline UBool -utrie2_builder_equal_uint32(const uint32_t *s, const uint32_t *t, int32_t length) { +equal_uint32(const uint32_t *s, const uint32_t *t, int32_t length) { while(length>0 && *s==*t) { ++s; ++t; @@ -914,7 +914,7 @@ findSameIndex2Block(const int32_t *idx, int32_t index2Length, int32_t otherBlock index2Length-=UTRIE2_INDEX_2_BLOCK_LENGTH; for(block=0; block<=index2Length; ++block) { - if(utrie2_builder_equal_int32(idx+block, idx+otherBlock, UTRIE2_INDEX_2_BLOCK_LENGTH)) { + if(equal_int32(idx+block, idx+otherBlock, UTRIE2_INDEX_2_BLOCK_LENGTH)) { return block; } } @@ -929,7 +929,7 @@ findSameDataBlock(const uint32_t *data, int32_t dataLength, int32_t otherBlock, dataLength-=blockLength; for(block=0; block<=dataLength; block+=UTRIE2_DATA_GRANULARITY) { - if(utrie2_builder_equal_uint32(data+block, data+otherBlock, blockLength)) { + if(equal_uint32(data+block, data+otherBlock, blockLength)) { return block; } } @@ -1019,7 +1019,7 @@ findHighStart(UNewTrie2 *trie, uint32_t highValue) { * * The compaction * - removes blocks that are identical with earlier ones - * - overlaps adjacent blocks as much as possible (if overlap==TRUE) + * - overlaps adjacent blocks as much as possible (if overlap==true) * - moves blocks in steps of the data granularity * - moves and overlaps blocks that overlap with multiple values in the overlap region * @@ -1091,7 +1091,7 @@ compactData(UNewTrie2 *trie) { /* see if the beginning of this block can be overlapped with the end of the previous block */ /* look for maximum overlap (modulo granularity) with the previous, adjacent block */ for(overlap=blockLength-UTRIE2_DATA_GRANULARITY; - overlap>0 && !utrie2_builder_equal_uint32(trie->data+(newStart-overlap), trie->data+start, overlap); + overlap>0 && !equal_uint32(trie->data+(newStart-overlap), trie->data+start, overlap); overlap-=UTRIE2_DATA_GRANULARITY) {} #ifdef UTRIE2_DEBUG @@ -1180,7 +1180,7 @@ compactIndex2(UNewTrie2 *trie) { /* see if the beginning of this block can be overlapped with the end of the previous block */ /* look for maximum overlap with the previous, adjacent block */ for(overlap=UTRIE2_INDEX_2_BLOCK_LENGTH-1; - overlap>0 && !utrie2_builder_equal_int32(trie->index2+(newStart-overlap), trie->index2+start, overlap); + overlap>0 && !equal_int32(trie->index2+(newStart-overlap), trie->index2+start, overlap); --overlap) {} if(overlap>0 || newStartinitialValue, TRUE, pErrorCode); + utrie2_setRange32(trie, suppHighStart, 0x10ffff, trie->initialValue, true, pErrorCode); if(U_FAILURE(*pErrorCode)) { return; } @@ -1281,7 +1281,7 @@ compactTrie(UTrie2 *trie, UErrorCode *pErrorCode) { newTrie->data[newTrie->dataLength++]=trie->initialValue; } - newTrie->isCompacted=TRUE; + newTrie->isCompacted=true; } /* serialization ------------------------------------------------------------ */ @@ -1317,17 +1317,17 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return; } - if( trie==NULL || + if( trie==nullptr || valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits ) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } newTrie=trie->newTrie; - if(newTrie==NULL) { + if(newTrie==nullptr) { /* already frozen */ UTrie2ValueBits frozenValueBits= - trie->data16!=NULL ? UTRIE2_16_VALUE_BITS : UTRIE2_32_VALUE_BITS; + trie->data16!=nullptr ? UTRIE2_16_VALUE_BITS : UTRIE2_32_VALUE_BITS; if(valueBits!=frozenValueBits) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } @@ -1377,12 +1377,12 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) { } trie->memory=uprv_malloc(length); - if(trie->memory==NULL) { + if(trie->memory==nullptr) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return; } trie->length=length; - trie->isMemoryOwned=TRUE; + trie->isMemoryOwned=true; trie->indexLength=allIndexesLength; trie->dataLength=newTrie->dataLength; @@ -1449,7 +1449,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) { case UTRIE2_16_VALUE_BITS: /* write 16-bit data values */ trie->data16=dest16; - trie->data32=NULL; + trie->data32=nullptr; p=newTrie->data; for(i=newTrie->dataLength; i>0; --i) { *dest16++=(uint16_t)*p++; @@ -1457,7 +1457,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) { break; case UTRIE2_32_VALUE_BITS: /* write 32-bit data values */ - trie->data16=NULL; + trie->data16=nullptr; trie->data32=(uint32_t *)dest16; uprv_memcpy(dest16, newTrie->data, (size_t)newTrie->dataLength*4); break; @@ -1479,5 +1479,5 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) { /* Delete the UNewTrie2. */ uprv_free(newTrie->data); uprv_free(newTrie); - trie->newTrie=NULL; + trie->newTrie=nullptr; } diff --git a/src/duckdb/extension/icu/third_party/icu/common/utrie_swap.cpp b/src/duckdb/extension/icu/third_party/icu/common/utrie_swap.cpp index 5dab46afd..83d183699 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utrie_swap.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/utrie_swap.cpp @@ -18,7 +18,7 @@ namespace { -constexpr int32_t UTRIE_ASCII_LIMIT = 0x80; +constexpr int32_t ASCII_LIMIT = 0x80; } // namespace @@ -31,10 +31,10 @@ utrie_swap(const UDataSwapper *ds, int32_t size; UBool dataIs32; - if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || (length>=0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -105,7 +105,7 @@ utrie2_swap(const UDataSwapper *ds, if(U_FAILURE(*pErrorCode)) { return 0; } - if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) { + if(ds==nullptr || inData==nullptr || (length>=0 && outData==nullptr)) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -220,7 +220,7 @@ ucptrie_swap(const UDataSwapper *ds, (trie.options & UCPTRIE_OPTIONS_RESERVED_MASK) != 0 || valueWidth > UCPTRIE_VALUE_BITS_8 || trie.indexLength < minIndexLength || - dataLength < UTRIE_ASCII_LIMIT + dataLength < ASCII_LIMIT ) { *pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UCPTrie */ return 0; @@ -256,20 +256,24 @@ ucptrie_swap(const UDataSwapper *ds, ds->swapArray32(ds, &inTrie->signature, 4, &outTrie->signature, pErrorCode); ds->swapArray16(ds, &inTrie->options, 12, &outTrie->options, pErrorCode); - /* swap the index and the data */ + /* swap the index */ + const uint16_t *inIndex=reinterpret_cast(inTrie+1); + uint16_t *outIndex=reinterpret_cast(outTrie+1); + ds->swapArray16(ds, inIndex, trie.indexLength*2, outIndex, pErrorCode); + + /* swap the data */ + const uint16_t *inData=inIndex+trie.indexLength; + uint16_t *outData=outIndex+trie.indexLength; switch(valueWidth) { case UCPTRIE_VALUE_BITS_16: - ds->swapArray16(ds, inTrie+1, (trie.indexLength+dataLength)*2, outTrie+1, pErrorCode); + ds->swapArray16(ds, inData, dataLength*2, outData, pErrorCode); break; case UCPTRIE_VALUE_BITS_32: - ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode); - ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, dataLength*4, - (uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode); + ds->swapArray32(ds, inData, dataLength*4, outData, pErrorCode); break; case UCPTRIE_VALUE_BITS_8: - ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode); if(inTrie!=outTrie) { - uprv_memmove((outTrie+1)+trie.indexLength, (inTrie+1)+trie.indexLength, dataLength); + uprv_memmove(outData, inData, dataLength); } break; default: @@ -290,8 +294,8 @@ namespace { * @param data a pointer to 32-bit-aligned memory containing the serialized form of a trie * @param length the number of bytes available at data; * can be more than necessary (see return value) - * @param anyEndianOk If FALSE, only platform-endian serialized forms are recognized. - * If TRUE, opposite-endian serialized forms are recognized as well. + * @param anyEndianOk If false, only platform-endian serialized forms are recognized. + * If true, opposite-endian serialized forms are recognized as well. * @return the trie version of the serialized form, or 0 if it is not * recognized as a serialized trie */ @@ -330,7 +334,7 @@ utrie_swapAnyVersion(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { if(U_FAILURE(*pErrorCode)) { return 0; } - switch(getVersion(inData, length, TRUE)) { + switch(getVersion(inData, length, true)) { case 1: return utrie_swap(ds, inData, length, outData, pErrorCode); case 2: diff --git a/src/duckdb/extension/icu/third_party/icu/common/uts46.cpp b/src/duckdb/extension/icu/third_party/icu/common/uts46.cpp deleted file mode 100644 index b9e6cb023..000000000 --- a/src/duckdb/extension/icu/third_party/icu/common/uts46.cpp +++ /dev/null @@ -1,1484 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* Copyright (C) 2010-2015, International Business Machines -* Corporation and others. All Rights Reserved. -******************************************************************************* -* file name: uts46.cpp -* encoding: UTF-8 -* tab size: 8 (not used) -* indentation:4 -* -* created on: 2010mar09 -* created by: Markus W. Scherer -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_IDNA - -#include "unicode/idna.h" -#include "unicode/normalizer2.h" -#include "unicode/uscript.h" -#include "unicode/ustring.h" -#include "unicode/utf16.h" -#include "cmemory.h" -#include "cstring.h" -#include "punycode.h" -#include "ubidi_props.h" -#include "ustr_imp.h" - -// Note about tests for UIDNA_ERROR_DOMAIN_NAME_TOO_LONG: -// -// The domain name length limit is 255 octets in an internal DNS representation -// where the last ("root") label is the empty label -// represented by length byte 0 alone. -// In a conventional string, this translates to 253 characters, or 254 -// if there is a trailing dot for the root label. - -U_NAMESPACE_BEGIN - -// Severe errors which usually result in a U+FFFD replacement character in the result string. -const uint32_t severeErrors= - UIDNA_ERROR_LEADING_COMBINING_MARK| - UIDNA_ERROR_DISALLOWED| - UIDNA_ERROR_PUNYCODE| - UIDNA_ERROR_LABEL_HAS_DOT| - UIDNA_ERROR_INVALID_ACE_LABEL; - -static inline UBool -isASCIIString(const UnicodeString &dest) { - const UChar *s=dest.getBuffer(); - const UChar *limit=s+dest.length(); - while(s0x7f) { - return FALSE; - } - } - return TRUE; -} - -static UBool -isASCIIOkBiDi(const UChar *s, int32_t length); - -static UBool -isASCIIOkBiDi(const char *s, int32_t length); - -// IDNA class default implementations -------------------------------------- *** - -IDNA::~IDNA() {} - -void -IDNA::labelToASCII_UTF8(StringPiece label, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - if(U_SUCCESS(errorCode)) { - UnicodeString destString; - labelToASCII(UnicodeString::fromUTF8(label), destString, - info, errorCode).toUTF8(dest); - } -} - -void -IDNA::labelToUnicodeUTF8(StringPiece label, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - if(U_SUCCESS(errorCode)) { - UnicodeString destString; - labelToUnicode(UnicodeString::fromUTF8(label), destString, - info, errorCode).toUTF8(dest); - } -} - -void -IDNA::nameToASCII_UTF8(StringPiece name, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - if(U_SUCCESS(errorCode)) { - UnicodeString destString; - nameToASCII(UnicodeString::fromUTF8(name), destString, - info, errorCode).toUTF8(dest); - } -} - -void -IDNA::nameToUnicodeUTF8(StringPiece name, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - if(U_SUCCESS(errorCode)) { - UnicodeString destString; - nameToUnicode(UnicodeString::fromUTF8(name), destString, - info, errorCode).toUTF8(dest); - } -} - -// UTS46 class declaration ------------------------------------------------- *** - -class UTS46 : public IDNA { -public: - UTS46(uint32_t options, UErrorCode &errorCode); - virtual ~UTS46(); - - virtual UnicodeString & - labelToASCII(const UnicodeString &label, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - virtual UnicodeString & - labelToUnicode(const UnicodeString &label, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - virtual UnicodeString & - nameToASCII(const UnicodeString &name, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - virtual UnicodeString & - nameToUnicode(const UnicodeString &name, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - virtual void - labelToASCII_UTF8(StringPiece label, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - virtual void - labelToUnicodeUTF8(StringPiece label, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - virtual void - nameToASCII_UTF8(StringPiece name, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - virtual void - nameToUnicodeUTF8(StringPiece name, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - -private: - UnicodeString & - process(const UnicodeString &src, - UBool isLabel, UBool toASCII, - UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - void - processUTF8(StringPiece src, - UBool isLabel, UBool toASCII, - ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - UnicodeString & - processUnicode(const UnicodeString &src, - int32_t labelStart, int32_t mappingStart, - UBool isLabel, UBool toASCII, - UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const; - - // returns the new dest.length() - int32_t - mapDevChars(UnicodeString &dest, int32_t labelStart, int32_t mappingStart, - UErrorCode &errorCode) const; - - // returns the new label length - int32_t - processLabel(UnicodeString &dest, - int32_t labelStart, int32_t labelLength, - UBool toASCII, - IDNAInfo &info, UErrorCode &errorCode) const; - int32_t - markBadACELabel(UnicodeString &dest, - int32_t labelStart, int32_t labelLength, - UBool toASCII, IDNAInfo &info, UErrorCode &errorCode) const; - - void - checkLabelBiDi(const UChar *label, int32_t labelLength, IDNAInfo &info) const; - - UBool - isLabelOkContextJ(const UChar *label, int32_t labelLength) const; - - void - checkLabelContextO(const UChar *label, int32_t labelLength, IDNAInfo &info) const; - - const Normalizer2 &uts46Norm2; // uts46.nrm - uint32_t options; -}; - -IDNA * -IDNA::createUTS46Instance(uint32_t options, UErrorCode &errorCode) { - if(U_SUCCESS(errorCode)) { - IDNA *idna=new UTS46(options, errorCode); - if(idna==NULL) { - errorCode=U_MEMORY_ALLOCATION_ERROR; - } else if(U_FAILURE(errorCode)) { - delete idna; - idna=NULL; - } - return idna; - } else { - return NULL; - } -} - -// UTS46 implementation ---------------------------------------------------- *** - -UTS46::UTS46(uint32_t opt, UErrorCode &errorCode) - : uts46Norm2(*Normalizer2::getInstance(NULL, "uts46", UNORM2_COMPOSE, errorCode)), - options(opt) {} - -UTS46::~UTS46() {} - -UnicodeString & -UTS46::labelToASCII(const UnicodeString &label, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - return process(label, TRUE, TRUE, dest, info, errorCode); -} - -UnicodeString & -UTS46::labelToUnicode(const UnicodeString &label, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - return process(label, TRUE, FALSE, dest, info, errorCode); -} - -UnicodeString & -UTS46::nameToASCII(const UnicodeString &name, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - process(name, FALSE, TRUE, dest, info, errorCode); - if( dest.length()>=254 && (info.errors&UIDNA_ERROR_DOMAIN_NAME_TOO_LONG)==0 && - isASCIIString(dest) && - (dest.length()>254 || dest[253]!=0x2e) - ) { - info.errors|=UIDNA_ERROR_DOMAIN_NAME_TOO_LONG; - } - return dest; -} - -UnicodeString & -UTS46::nameToUnicode(const UnicodeString &name, UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - return process(name, FALSE, FALSE, dest, info, errorCode); -} - -void -UTS46::labelToASCII_UTF8(StringPiece label, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - processUTF8(label, TRUE, TRUE, dest, info, errorCode); -} - -void -UTS46::labelToUnicodeUTF8(StringPiece label, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - processUTF8(label, TRUE, FALSE, dest, info, errorCode); -} - -void -UTS46::nameToASCII_UTF8(StringPiece name, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - processUTF8(name, FALSE, TRUE, dest, info, errorCode); -} - -void -UTS46::nameToUnicodeUTF8(StringPiece name, ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - processUTF8(name, FALSE, FALSE, dest, info, errorCode); -} - -// UTS #46 data for ASCII characters. -// The normalizer (using uts46.nrm) maps uppercase ASCII letters to lowercase -// and passes through all other ASCII characters. -// If UIDNA_USE_STD3_RULES is set, then non-LDH characters are disallowed -// using this data. -// The ASCII fastpath also uses this data. -// Values: -1=disallowed 0==valid 1==mapped (lowercase) -static const int8_t asciiData[128]={ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - // 002D..002E; valid # HYPHEN-MINUS..FULL STOP - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, - // 0030..0039; valid # DIGIT ZERO..DIGIT NINE - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, - // 0041..005A; mapped # LATIN CAPITAL LETTER A..LATIN CAPITAL LETTER Z - -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, - // 0061..007A; valid # LATIN SMALL LETTER A..LATIN SMALL LETTER Z - -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1 -}; - -UnicodeString & -UTS46::process(const UnicodeString &src, - UBool isLabel, UBool toASCII, - UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - // uts46Norm2.normalize() would do all of this error checking and setup, - // but with the ASCII fastpath we do not always call it, and do not - // call it first. - if(U_FAILURE(errorCode)) { - dest.setToBogus(); - return dest; - } - const UChar *srcArray=src.getBuffer(); - if(&dest==&src || srcArray==NULL) { - errorCode=U_ILLEGAL_ARGUMENT_ERROR; - dest.setToBogus(); - return dest; - } - // Arguments are fine, reset output values. - dest.remove(); - info.reset(); - int32_t srcLength=src.length(); - if(srcLength==0) { - info.errors|=UIDNA_ERROR_EMPTY_LABEL; - return dest; - } - UChar *destArray=dest.getBuffer(srcLength); - if(destArray==NULL) { - errorCode=U_MEMORY_ALLOCATION_ERROR; - return dest; - } - // ASCII fastpath - UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0; - int32_t labelStart=0; - int32_t i; - for(i=0;; ++i) { - if(i==srcLength) { - if(toASCII) { - if((i-labelStart)>63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - // There is a trailing dot if labelStart==i. - if(!isLabel && i>=254 && (i>254 || labelStart0x7f) { - break; - } - int cData=asciiData[c]; - if(cData>0) { - destArray[i]=c+0x20; // Lowercase an uppercase ASCII letter. - } else if(cData<0 && disallowNonLDHDot) { - break; // Replacing with U+FFFD can be complicated for toASCII. - } else { - destArray[i]=c; - if(c==0x2d) { // hyphen - if(i==(labelStart+3) && srcArray[i-1]==0x2d) { - // "??--..." is Punycode or forbidden. - ++i; // '-' was copied to dest already - break; - } - if(i==labelStart) { - // label starts with "-" - info.labelErrors|=UIDNA_ERROR_LEADING_HYPHEN; - } - if((i+1)==srcLength || srcArray[i+1]==0x2e) { - // label ends with "-" - info.labelErrors|=UIDNA_ERROR_TRAILING_HYPHEN; - } - } else if(c==0x2e) { // dot - if(isLabel) { - // Replacing with U+FFFD can be complicated for toASCII. - ++i; // '.' was copied to dest already - break; - } - if(i==labelStart) { - info.labelErrors|=UIDNA_ERROR_EMPTY_LABEL; - } - if(toASCII && (i-labelStart)>63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - info.errors|=info.labelErrors; - info.labelErrors=0; - labelStart=i+1; - } - } - } - info.errors|=info.labelErrors; - dest.releaseBuffer(i); - processUnicode(src, labelStart, i, isLabel, toASCII, dest, info, errorCode); - if( info.isBiDi && U_SUCCESS(errorCode) && (info.errors&severeErrors)==0 && - (!info.isOkBiDi || (labelStart>0 && !isASCIIOkBiDi(dest.getBuffer(), labelStart))) - ) { - info.errors|=UIDNA_ERROR_BIDI; - } - return dest; -} - -void -UTS46::processUTF8(StringPiece src, - UBool isLabel, UBool toASCII, - ByteSink &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - if(U_FAILURE(errorCode)) { - return; - } - const char *srcArray=src.data(); - int32_t srcLength=src.length(); - if(srcArray==NULL && srcLength!=0) { - errorCode=U_ILLEGAL_ARGUMENT_ERROR; - return; - } - // Arguments are fine, reset output values. - info.reset(); - if(srcLength==0) { - info.errors|=UIDNA_ERROR_EMPTY_LABEL; - dest.Flush(); - return; - } - UnicodeString destString; - int32_t labelStart=0; - if(srcLength<=256) { // length of stackArray[] - // ASCII fastpath - char stackArray[256]; - int32_t destCapacity; - char *destArray=dest.GetAppendBuffer(srcLength, srcLength+20, - stackArray, UPRV_LENGTHOF(stackArray), &destCapacity); - UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0; - int32_t i; - for(i=0;; ++i) { - if(i==srcLength) { - if(toASCII) { - if((i-labelStart)>63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - // There is a trailing dot if labelStart==i. - if(!isLabel && i>=254 && (i>254 || labelStart0x7f - break; - } - int cData=asciiData[(int)c]; // Cast: gcc warns about indexing with a char. - if(cData>0) { - destArray[i]=c+0x20; // Lowercase an uppercase ASCII letter. - } else if(cData<0 && disallowNonLDHDot) { - break; // Replacing with U+FFFD can be complicated for toASCII. - } else { - destArray[i]=c; - if(c==0x2d) { // hyphen - if(i==(labelStart+3) && srcArray[i-1]==0x2d) { - // "??--..." is Punycode or forbidden. - break; - } - if(i==labelStart) { - // label starts with "-" - info.labelErrors|=UIDNA_ERROR_LEADING_HYPHEN; - } - if((i+1)==srcLength || srcArray[i+1]==0x2e) { - // label ends with "-" - info.labelErrors|=UIDNA_ERROR_TRAILING_HYPHEN; - } - } else if(c==0x2e) { // dot - if(isLabel) { - break; // Replacing with U+FFFD can be complicated for toASCII. - } - if(i==labelStart) { - info.labelErrors|=UIDNA_ERROR_EMPTY_LABEL; - } - if(toASCII && (i-labelStart)>63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - info.errors|=info.labelErrors; - info.labelErrors=0; - labelStart=i+1; - } - } - } - info.errors|=info.labelErrors; - // Convert the processed ASCII prefix of the current label to UTF-16. - int32_t mappingStart=i-labelStart; - destString=UnicodeString::fromUTF8(StringPiece(destArray+labelStart, mappingStart)); - // Output the previous ASCII labels and process the rest of src in UTF-16. - dest.Append(destArray, labelStart); - processUnicode(UnicodeString::fromUTF8(StringPiece(src, labelStart)), 0, mappingStart, - isLabel, toASCII, - destString, info, errorCode); - } else { - // src is too long for the ASCII fastpath implementation. - processUnicode(UnicodeString::fromUTF8(src), 0, 0, - isLabel, toASCII, - destString, info, errorCode); - } - destString.toUTF8(dest); // calls dest.Flush() - if(toASCII && !isLabel) { - // length==labelStart==254 means that there is a trailing dot (ok) and - // destString is empty (do not index at 253-labelStart). - int32_t length=labelStart+destString.length(); - if( length>=254 && isASCIIString(destString) && - (length>254 || - (labelStart<254 && destString[253-labelStart]!=0x2e)) - ) { - info.errors|=UIDNA_ERROR_DOMAIN_NAME_TOO_LONG; - } - } - if( info.isBiDi && U_SUCCESS(errorCode) && (info.errors&severeErrors)==0 && - (!info.isOkBiDi || (labelStart>0 && !isASCIIOkBiDi(srcArray, labelStart))) - ) { - info.errors|=UIDNA_ERROR_BIDI; - } -} - -UnicodeString & -UTS46::processUnicode(const UnicodeString &src, - int32_t labelStart, int32_t mappingStart, - UBool isLabel, UBool toASCII, - UnicodeString &dest, - IDNAInfo &info, UErrorCode &errorCode) const { - if(mappingStart==0) { - uts46Norm2.normalize(src, dest, errorCode); - } else { - uts46Norm2.normalizeSecondAndAppend(dest, src.tempSubString(mappingStart), errorCode); - } - if(U_FAILURE(errorCode)) { - return dest; - } - UBool doMapDevChars= - toASCII ? (options&UIDNA_NONTRANSITIONAL_TO_ASCII)==0 : - (options&UIDNA_NONTRANSITIONAL_TO_UNICODE)==0; - const UChar *destArray=dest.getBuffer(); - int32_t destLength=dest.length(); - int32_t labelLimit=labelStart; - while(labelLimit=0x200c)) { - info.isTransDiff=TRUE; - if(doMapDevChars) { - destLength=mapDevChars(dest, labelStart, labelLimit, errorCode); - if(U_FAILURE(errorCode)) { - return dest; - } - destArray=dest.getBuffer(); - // All deviation characters have been mapped, no need to check for them again. - doMapDevChars=FALSE; - // Do not increment labelLimit in case c was removed. - continue; - } - } else if(U16_IS_SURROGATE(c)) { - if(U16_IS_SURROGATE_LEAD(c) ? - (labelLimit+1)==destLength || !U16_IS_TRAIL(destArray[labelLimit+1]) : - labelLimit==labelStart || !U16_IS_LEAD(destArray[labelLimit-1])) { - // Map an unpaired surrogate to U+FFFD before normalization so that when - // that removes characters we do not turn two unpaired ones into a pair. - info.labelErrors|=UIDNA_ERROR_DISALLOWED; - dest.setCharAt(labelLimit, 0xfffd); - destArray=dest.getBuffer(); - } - } - ++labelLimit; - } - // Permit an empty label at the end (0=4 && label[0]==0x78 && label[1]==0x6e && label[2]==0x2d && label[3]==0x2d) { - // Label starts with "xn--", try to un-Punycode it. - wasPunycode=TRUE; - UChar *unicodeBuffer=fromPunycode.getBuffer(-1); // capacity==-1: most labels should fit - if(unicodeBuffer==NULL) { - // Should never occur if we used capacity==-1 which uses the internal buffer. - errorCode=U_MEMORY_ALLOCATION_ERROR; - return labelLength; - } - UErrorCode punycodeErrorCode=U_ZERO_ERROR; - int32_t unicodeLength=u_strFromPunycode(label+4, labelLength-4, - unicodeBuffer, fromPunycode.getCapacity(), - NULL, &punycodeErrorCode); - if(punycodeErrorCode==U_BUFFER_OVERFLOW_ERROR) { - fromPunycode.releaseBuffer(0); - unicodeBuffer=fromPunycode.getBuffer(unicodeLength); - if(unicodeBuffer==NULL) { - errorCode=U_MEMORY_ALLOCATION_ERROR; - return labelLength; - } - punycodeErrorCode=U_ZERO_ERROR; - unicodeLength=u_strFromPunycode(label+4, labelLength-4, - unicodeBuffer, fromPunycode.getCapacity(), - NULL, &punycodeErrorCode); - } - fromPunycode.releaseBuffer(unicodeLength); - if(U_FAILURE(punycodeErrorCode)) { - info.labelErrors|=UIDNA_ERROR_PUNYCODE; - return markBadACELabel(dest, labelStart, labelLength, toASCII, info, errorCode); - } - // Check for NFC, and for characters that are not - // valid or deviation characters according to the normalizer. - // If there is something wrong, then the string will change. - // Note that the normalizer passes through non-LDH ASCII and deviation characters. - // Deviation characters are ok in Punycode even in transitional processing. - // In the code further below, if we find non-LDH ASCII and we have UIDNA_USE_STD3_RULES - // then we will set UIDNA_ERROR_INVALID_ACE_LABEL there too. - UBool isValid=uts46Norm2.isNormalized(fromPunycode, errorCode); - if(U_FAILURE(errorCode)) { - return labelLength; - } - if(!isValid) { - info.labelErrors|=UIDNA_ERROR_INVALID_ACE_LABEL; - return markBadACELabel(dest, labelStart, labelLength, toASCII, info, errorCode); - } - labelString=&fromPunycode; - label=fromPunycode.getBuffer(); - labelStart=0; - labelLength=fromPunycode.length(); - } else { - wasPunycode=FALSE; - labelString=&dest; - } - // Validity check - if(labelLength==0) { - info.labelErrors|=UIDNA_ERROR_EMPTY_LABEL; - return replaceLabel(dest, destLabelStart, destLabelLength, - *labelString, labelLength, errorCode); - } - // labelLength>0 - if(labelLength>=4 && label[2]==0x2d && label[3]==0x2d) { - // label starts with "??--" - info.labelErrors|=UIDNA_ERROR_HYPHEN_3_4; - } - if(label[0]==0x2d) { - // label starts with "-" - info.labelErrors|=UIDNA_ERROR_LEADING_HYPHEN; - } - if(label[labelLength-1]==0x2d) { - // label ends with "-" - info.labelErrors|=UIDNA_ERROR_TRAILING_HYPHEN; - } - // If the label was not a Punycode label, then it was the result of - // mapping, normalization and label segmentation. - // If the label was in Punycode, then we mapped it again above - // and checked its validity. - // Now we handle the STD3 restriction to LDH characters (if set) - // and we look for U+FFFD which indicates disallowed characters - // in a non-Punycode label or U+FFFD itself in a Punycode label. - // We also check for dots which can come from the input to a single-label function. - // Ok to cast away const because we own the UnicodeString. - UChar *s=(UChar *)label; - const UChar *limit=label+labelLength; - UChar oredChars=0; - // If we enforce STD3 rules, then ASCII characters other than LDH and dot are disallowed. - UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0; - do { - UChar c=*s; - if(c<=0x7f) { - if(c==0x2e) { - info.labelErrors|=UIDNA_ERROR_LABEL_HAS_DOT; - *s=0xfffd; - } else if(disallowNonLDHDot && asciiData[c]<0) { - info.labelErrors|=UIDNA_ERROR_DISALLOWED; - *s=0xfffd; - } - } else { - oredChars|=c; - if(disallowNonLDHDot && isNonASCIIDisallowedSTD3Valid(c)) { - info.labelErrors|=UIDNA_ERROR_DISALLOWED; - *s=0xfffd; - } else if(c==0xfffd) { - info.labelErrors|=UIDNA_ERROR_DISALLOWED; - } - } - ++s; - } while(sreplace(labelStart, cpLength, (UChar)0xfffd); - label=labelString->getBuffer()+labelStart; - labelLength+=1-cpLength; - if(labelString==&dest) { - destLabelLength=labelLength; - } - } - if((info.labelErrors&severeErrors)==0) { - // Do contextual checks only if we do not have U+FFFD from a severe error - // because U+FFFD can make these checks fail. - if((options&UIDNA_CHECK_BIDI)!=0 && (!info.isBiDi || info.isOkBiDi)) { - checkLabelBiDi(label, labelLength, info); - } - if( (options&UIDNA_CHECK_CONTEXTJ)!=0 && (oredChars&0x200c)==0x200c && - !isLabelOkContextJ(label, labelLength) - ) { - info.labelErrors|=UIDNA_ERROR_CONTEXTJ; - } - if((options&UIDNA_CHECK_CONTEXTO)!=0 && oredChars>=0xb7) { - checkLabelContextO(label, labelLength, info); - } - if(toASCII) { - if(wasPunycode) { - // Leave a Punycode label unchanged if it has no severe errors. - if(destLabelLength>63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - return destLabelLength; - } else if(oredChars>=0x80) { - // Contains non-ASCII characters. - UnicodeString punycode; - UChar *buffer=punycode.getBuffer(63); // 63==maximum DNS label length - if(buffer==NULL) { - errorCode=U_MEMORY_ALLOCATION_ERROR; - return destLabelLength; - } - buffer[0]=0x78; // Write "xn--". - buffer[1]=0x6e; - buffer[2]=0x2d; - buffer[3]=0x2d; - int32_t punycodeLength=u_strToPunycode(label, labelLength, - buffer+4, punycode.getCapacity()-4, - NULL, &errorCode); - if(errorCode==U_BUFFER_OVERFLOW_ERROR) { - errorCode=U_ZERO_ERROR; - punycode.releaseBuffer(4); - buffer=punycode.getBuffer(4+punycodeLength); - if(buffer==NULL) { - errorCode=U_MEMORY_ALLOCATION_ERROR; - return destLabelLength; - } - punycodeLength=u_strToPunycode(label, labelLength, - buffer+4, punycode.getCapacity()-4, - NULL, &errorCode); - } - punycodeLength+=4; - punycode.releaseBuffer(punycodeLength); - if(U_FAILURE(errorCode)) { - return destLabelLength; - } - if(punycodeLength>63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - return replaceLabel(dest, destLabelStart, destLabelLength, - punycode, punycodeLength, errorCode); - } else { - // all-ASCII label - if(labelLength>63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - } - } - } else { - // If a Punycode label has severe errors, - // then leave it but make sure it does not look valid. - if(wasPunycode) { - info.labelErrors|=UIDNA_ERROR_INVALID_ACE_LABEL; - return markBadACELabel(dest, destLabelStart, destLabelLength, toASCII, info, errorCode); - } - } - return replaceLabel(dest, destLabelStart, destLabelLength, - *labelString, labelLength, errorCode); -} - -// Make sure an ACE label does not look valid. -// Append U+FFFD if the label has only LDH characters. -// If UIDNA_USE_STD3_RULES, also replace disallowed ASCII characters with U+FFFD. -int32_t -UTS46::markBadACELabel(UnicodeString &dest, - int32_t labelStart, int32_t labelLength, - UBool toASCII, IDNAInfo &info, UErrorCode &errorCode) const { - if(U_FAILURE(errorCode)) { - return 0; - } - UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0; - UBool isASCII=TRUE; - UBool onlyLDH=TRUE; - const UChar *label=dest.getBuffer()+labelStart; - // Ok to cast away const because we own the UnicodeString. - UChar *s=(UChar *)label+4; // After the initial "xn--". - const UChar *limit=label+labelLength; - do { - UChar c=*s; - if(c<=0x7f) { - if(c==0x2e) { - info.labelErrors|=UIDNA_ERROR_LABEL_HAS_DOT; - *s=0xfffd; - isASCII=onlyLDH=FALSE; - } else if(asciiData[c]<0) { - onlyLDH=FALSE; - if(disallowNonLDHDot) { - *s=0xfffd; - isASCII=FALSE; - } - } - } else { - isASCII=onlyLDH=FALSE; - } - } while(++s63) { - info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; - } - } - return labelLength; -} - -const uint32_t L_MASK=U_MASK(U_LEFT_TO_RIGHT); -const uint32_t R_AL_MASK=U_MASK(U_RIGHT_TO_LEFT)|U_MASK(U_RIGHT_TO_LEFT_ARABIC); -const uint32_t L_R_AL_MASK=L_MASK|R_AL_MASK; - -const uint32_t R_AL_AN_MASK=R_AL_MASK|U_MASK(U_ARABIC_NUMBER); - -const uint32_t EN_AN_MASK=U_MASK(U_EUROPEAN_NUMBER)|U_MASK(U_ARABIC_NUMBER); -const uint32_t R_AL_EN_AN_MASK=R_AL_MASK|EN_AN_MASK; -const uint32_t L_EN_MASK=L_MASK|U_MASK(U_EUROPEAN_NUMBER); - -const uint32_t ES_CS_ET_ON_BN_NSM_MASK= - U_MASK(U_EUROPEAN_NUMBER_SEPARATOR)| - U_MASK(U_COMMON_NUMBER_SEPARATOR)| - U_MASK(U_EUROPEAN_NUMBER_TERMINATOR)| - U_MASK(U_OTHER_NEUTRAL)| - U_MASK(U_BOUNDARY_NEUTRAL)| - U_MASK(U_DIR_NON_SPACING_MARK); -const uint32_t L_EN_ES_CS_ET_ON_BN_NSM_MASK=L_EN_MASK|ES_CS_ET_ON_BN_NSM_MASK; -const uint32_t R_AL_AN_EN_ES_CS_ET_ON_BN_NSM_MASK=R_AL_MASK|EN_AN_MASK|ES_CS_ET_ON_BN_NSM_MASK; - -// We scan the whole label and check both for whether it contains RTL characters -// and whether it passes the BiDi Rule. -// In a BiDi domain name, all labels must pass the BiDi Rule, but we might find -// that a domain name is a BiDi domain name (has an RTL label) only after -// processing several earlier labels. -void -UTS46::checkLabelBiDi(const UChar *label, int32_t labelLength, IDNAInfo &info) const { - // IDNA2008 BiDi rule - // Get the directionality of the first character. - UChar32 c; - int32_t i=0; - U16_NEXT_UNSAFE(label, i, c); - uint32_t firstMask=U_MASK(u_charDirection(c)); - // 1. The first character must be a character with BIDI property L, R - // or AL. If it has the R or AL property, it is an RTL label; if it - // has the L property, it is an LTR label. - if((firstMask&~L_R_AL_MASK)!=0) { - info.isOkBiDi=FALSE; - } - // Get the directionality of the last non-NSM character. - uint32_t lastMask; - for(;;) { - if(i>=labelLength) { - lastMask=firstMask; - break; - } - U16_PREV_UNSAFE(label, labelLength, c); - UCharDirection dir=u_charDirection(c); - if(dir!=U_DIR_NON_SPACING_MARK) { - lastMask=U_MASK(dir); - break; - } - } - // 3. In an RTL label, the end of the label must be a character with - // BIDI property R, AL, EN or AN, followed by zero or more - // characters with BIDI property NSM. - // 6. In an LTR label, the end of the label must be a character with - // BIDI property L or EN, followed by zero or more characters with - // BIDI property NSM. - if( (firstMask&L_MASK)!=0 ? - (lastMask&~L_EN_MASK)!=0 : - (lastMask&~R_AL_EN_AN_MASK)!=0 - ) { - info.isOkBiDi=FALSE; - } - // Add the directionalities of the intervening characters. - uint32_t mask=firstMask|lastMask; - while(ilabelStart) { - c=s[i-1]; - if(!(0x61<=c && c<=0x7a) && !(0x30<=c && c<=0x39)) { - // Last character in the label is not an L or EN. - return FALSE; - } - } - labelStart=i+1; - } else if(i==labelStart) { - if(!(0x61<=c && c<=0x7a)) { - // First character in the label is not an L. - return FALSE; - } - } else { - if(c<=0x20 && (c>=0x1c || (9<=c && c<=0xd))) { - // Intermediate character in the label is a B, S or WS. - return FALSE; - } - } - } - return TRUE; -} - -// UTF-8 version, called for source ASCII prefix. -// Can contain uppercase A-Z. -// s[length-1] must be the trailing dot. -static UBool -isASCIIOkBiDi(const char *s, int32_t length) { - int32_t labelStart=0; - for(int32_t i=0; ilabelStart) { - c=s[i-1]; - if(!(0x61<=c && c<=0x7a) && !(0x41<=c && c<=0x5a) && !(0x30<=c && c<=0x39)) { - // Last character in the label is not an L or EN. - return FALSE; - } - } - labelStart=i+1; - } else if(i==labelStart) { - if(!(0x61<=c && c<=0x7a) && !(0x41<=c && c<=0x5a)) { - // First character in the label is not an L. - return FALSE; - } - } else { - if(c<=0x20 && (c>=0x1c || (9<=c && c<=0xd))) { - // Intermediate character in the label is a B, S or WS. - return FALSE; - } - } - } - return TRUE; -} - -UBool -UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const { - // [IDNA2008-Tables] - // 200C..200D ; CONTEXTJ # ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER - for(int32_t i=0; i0) { - info.labelErrors|=UIDNA_ERROR_CONTEXTO_DIGITS; - } - arabicDigits=-1; - } else if(0x6f0<=c) { - if(arabicDigits<0) { - info.labelErrors|=UIDNA_ERROR_CONTEXTO_DIGITS; - } - arabicDigits=1; - } - } - } else if(c==0x30fb) { - // Appendix A.7. KATAKANA MIDDLE DOT (U+30FB) - // Rule Set: - // False; - // For All Characters: - // If Script(cp) .in. {Hiragana, Katakana, Han} Then True; - // End For; - UErrorCode errorCode=U_ZERO_ERROR; - for(int j=0;;) { - if(j>labelEnd) { - info.labelErrors|=UIDNA_ERROR_CONTEXTO_PUNCTUATION; - break; - } - U16_NEXT(label, j, labelLength, c); - UScriptCode script=uscript_getScript(c, &errorCode); - if(script==USCRIPT_HIRAGANA || script==USCRIPT_KATAKANA || script==USCRIPT_HAN) { - break; - } - } - } - } -} - -U_NAMESPACE_END - -// C API ------------------------------------------------------------------- *** - -U_NAMESPACE_USE - -U_CAPI UIDNA * U_EXPORT2 -uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode) { - return reinterpret_cast(IDNA::createUTS46Instance(options, *pErrorCode)); -} - -U_CAPI void U_EXPORT2 -uidna_close(UIDNA *idna) { - delete reinterpret_cast(idna); -} - -static UBool -checkArgs(const void *label, int32_t length, - void *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(U_FAILURE(*pErrorCode)) { - return FALSE; - } - // sizeof(UIDNAInfo)=16 in the first API version. - if(pInfo==NULL || pInfo->size<16) { - *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; - } - if( (label==NULL ? length!=0 : length<-1) || - (dest==NULL ? capacity!=0 : capacity<0) || - (dest==label && label!=NULL) - ) { - *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; - } - // Set all *pInfo bytes to 0 except for the size field itself. - uprv_memset(&pInfo->size+1, 0, pInfo->size-sizeof(pInfo->size)); - return TRUE; -} - -static void -idnaInfoToStruct(IDNAInfo &info, UIDNAInfo *pInfo) { - pInfo->isTransitionalDifferent=info.isTransitionalDifferent(); - pInfo->errors=info.getErrors(); -} - -U_CAPI int32_t U_EXPORT2 -uidna_labelToASCII(const UIDNA *idna, - const UChar *label, int32_t length, - UChar *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - UnicodeString src((UBool)(length<0), label, length); - UnicodeString destString(dest, 0, capacity); - IDNAInfo info; - reinterpret_cast(idna)->labelToASCII(src, destString, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return destString.extract(dest, capacity, *pErrorCode); -} - -U_CAPI int32_t U_EXPORT2 -uidna_labelToUnicode(const UIDNA *idna, - const UChar *label, int32_t length, - UChar *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - UnicodeString src((UBool)(length<0), label, length); - UnicodeString destString(dest, 0, capacity); - IDNAInfo info; - reinterpret_cast(idna)->labelToUnicode(src, destString, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return destString.extract(dest, capacity, *pErrorCode); -} - -U_CAPI int32_t U_EXPORT2 -uidna_nameToASCII(const UIDNA *idna, - const UChar *name, int32_t length, - UChar *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - UnicodeString src((UBool)(length<0), name, length); - UnicodeString destString(dest, 0, capacity); - IDNAInfo info; - reinterpret_cast(idna)->nameToASCII(src, destString, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return destString.extract(dest, capacity, *pErrorCode); -} - -U_CAPI int32_t U_EXPORT2 -uidna_nameToUnicode(const UIDNA *idna, - const UChar *name, int32_t length, - UChar *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - UnicodeString src((UBool)(length<0), name, length); - UnicodeString destString(dest, 0, capacity); - IDNAInfo info; - reinterpret_cast(idna)->nameToUnicode(src, destString, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return destString.extract(dest, capacity, *pErrorCode); -} - -U_CAPI int32_t U_EXPORT2 -uidna_labelToASCII_UTF8(const UIDNA *idna, - const char *label, int32_t length, - char *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - StringPiece src(label, length<0 ? static_cast(uprv_strlen(label)) : length); - CheckedArrayByteSink sink(dest, capacity); - IDNAInfo info; - reinterpret_cast(idna)->labelToASCII_UTF8(src, sink, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return u_terminateChars(dest, capacity, sink.NumberOfBytesAppended(), pErrorCode); -} - -U_CAPI int32_t U_EXPORT2 -uidna_labelToUnicodeUTF8(const UIDNA *idna, - const char *label, int32_t length, - char *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - StringPiece src(label, length<0 ? static_cast(uprv_strlen(label)) : length); - CheckedArrayByteSink sink(dest, capacity); - IDNAInfo info; - reinterpret_cast(idna)->labelToUnicodeUTF8(src, sink, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return u_terminateChars(dest, capacity, sink.NumberOfBytesAppended(), pErrorCode); -} - -U_CAPI int32_t U_EXPORT2 -uidna_nameToASCII_UTF8(const UIDNA *idna, - const char *name, int32_t length, - char *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - StringPiece src(name, length<0 ? static_cast(uprv_strlen(name)) : length); - CheckedArrayByteSink sink(dest, capacity); - IDNAInfo info; - reinterpret_cast(idna)->nameToASCII_UTF8(src, sink, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return u_terminateChars(dest, capacity, sink.NumberOfBytesAppended(), pErrorCode); -} - -U_CAPI int32_t U_EXPORT2 -uidna_nameToUnicodeUTF8(const UIDNA *idna, - const char *name, int32_t length, - char *dest, int32_t capacity, - UIDNAInfo *pInfo, UErrorCode *pErrorCode) { - if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) { - return 0; - } - StringPiece src(name, length<0 ? static_cast(uprv_strlen(name)) : length); - CheckedArrayByteSink sink(dest, capacity); - IDNAInfo info; - reinterpret_cast(idna)->nameToUnicodeUTF8(src, sink, info, *pErrorCode); - idnaInfoToStruct(info, pInfo); - return u_terminateChars(dest, capacity, sink.NumberOfBytesAppended(), pErrorCode); -} - -#endif // UCONFIG_NO_IDNA diff --git a/src/duckdb/extension/icu/third_party/icu/common/utypes.cpp b/src/duckdb/extension/icu/third_party/icu/common/utypes.cpp index 7531e4656..63e05b124 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/utypes.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/utypes.cpp @@ -104,7 +104,8 @@ _uErrorName[U_STANDARD_ERROR_LIMIT]={ "U_INVALID_STATE_ERROR", "U_COLLATOR_VERSION_MISMATCH", "U_USELESS_COLLATOR_ERROR", - "U_NO_WRITE_PERMISSION" + "U_NO_WRITE_PERMISSION", + "U_INPUT_TOO_LONG_ERROR" }; static const char * const _uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = { diff --git a/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp b/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp index e91cea72c..f93d73a3c 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp @@ -17,68 +17,43 @@ U_NAMESPACE_BEGIN -#define UVECTOR_DEFAULT_CAPACITY 8 +constexpr int32_t DEFAULT_CAPACITY = 8; /* * Constants for hinting whether a key is an integer * or a pointer. If a hint bit is zero, then the associated * token is assumed to be an integer. This is needed for iSeries */ -#define HINT_KEY_POINTER (1) -#define HINT_KEY_INTEGER (0) - +constexpr int8_t HINT_KEY_POINTER = 1; +constexpr int8_t HINT_KEY_INTEGER = 0; + UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector) UVector::UVector(UErrorCode &status) : - count(0), - capacity(0), - elements(0), - deleter(0), - comparer(0) -{ - _init(UVECTOR_DEFAULT_CAPACITY, status); + UVector(nullptr, nullptr, DEFAULT_CAPACITY, status) { } UVector::UVector(int32_t initialCapacity, UErrorCode &status) : - count(0), - capacity(0), - elements(0), - deleter(0), - comparer(0) -{ - _init(initialCapacity, status); + UVector(nullptr, nullptr, initialCapacity, status) { } UVector::UVector(UObjectDeleter *d, UElementsAreEqual *c, UErrorCode &status) : - count(0), - capacity(0), - elements(0), - deleter(d), - comparer(c) -{ - _init(UVECTOR_DEFAULT_CAPACITY, status); + UVector(d, c, DEFAULT_CAPACITY, status) { } UVector::UVector(UObjectDeleter *d, UElementsAreEqual *c, int32_t initialCapacity, UErrorCode &status) : - count(0), - capacity(0), - elements(0), deleter(d), comparer(c) { - _init(initialCapacity, status); -} - -void UVector::_init(int32_t initialCapacity, UErrorCode &status) { if (U_FAILURE(status)) { return; } // Fix bogus initialCapacity values; avoid malloc(0) and integer overflow if ((initialCapacity < 1) || (initialCapacity > (int32_t)(INT32_MAX / sizeof(UElement)))) { - initialCapacity = UVECTOR_DEFAULT_CAPACITY; + initialCapacity = DEFAULT_CAPACITY; } elements = (UElement *)uprv_malloc(sizeof(UElement)*initialCapacity); - if (elements == 0) { + if (elements == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } else { capacity = initialCapacity; @@ -88,7 +63,7 @@ void UVector::_init(int32_t initialCapacity, UErrorCode &status) { UVector::~UVector() { removeAllElements(); uprv_free(elements); - elements = 0; + elements = nullptr; } /** @@ -100,7 +75,7 @@ void UVector::assign(const UVector& other, UElementAssigner *assign, UErrorCode setSize(other.count, ec); if (U_SUCCESS(ec)) { for (int32_t i=0; iindex; --i) { - elements[i] = elements[i-1]; + if (ensureCapacity(count + 1, status)) { + if (0 <= index && index <= count) { + for (int32_t i=count; i>index; --i) { + elements[i] = elements[i-1]; + } + elements[index].pointer = obj; + ++count; + } else { + /* index out of range */ + status = U_ILLEGAL_ARGUMENT_ERROR; } - elements[index].pointer = obj; - ++count; } - /* else index out of range */ + if (U_FAILURE(status) && deleter != nullptr) { + (*deleter)(obj); + } } void UVector::insertElementAt(int32_t elem, int32_t index, UErrorCode &status) { + U_ASSERT(deleter == nullptr); // Usage error. Mixing up ints and pointers. // must have 0 <= index <= count - if (0 <= index && index <= count && ensureCapacity(count + 1, status)) { - for (int32_t i=count; i>index; --i) { - elements[i] = elements[i-1]; + if (ensureCapacity(count + 1, status)) { + if (0 <= index && index <= count) { + for (int32_t i=count; i>index; --i) { + elements[i] = elements[i-1]; + } + elements[index].pointer = nullptr; + elements[index].integer = elem; + ++count; + } else { + /* index out of range */ + status = U_ILLEGAL_ARGUMENT_ERROR; } - elements[index].pointer = NULL; - elements[index].integer = elem; - ++count; } - /* else index out of range */ } void* UVector::elementAt(int32_t index) const { @@ -196,40 +193,40 @@ int32_t UVector::elementAti(int32_t index) const { UBool UVector::containsAll(const UVector& other) const { for (int32_t i=0; i= 0) { - return FALSE; + return false; } } - return TRUE; + return true; } UBool UVector::removeAll(const UVector& other) { - UBool changed = FALSE; + UBool changed = false; for (int32_t i=0; i= 0) { removeElementAt(j); - changed = TRUE; + changed = true; } } return changed; } UBool UVector::retainAll(const UVector& other) { - UBool changed = FALSE; + UBool changed = false; for (int32_t j=size()-1; j>=0; --j) { int32_t i = other.indexOf(elements[j]); if (i < 0) { removeElementAt(j); - changed = TRUE; + changed = true; } } return changed; @@ -237,7 +234,7 @@ UBool UVector::retainAll(const UVector& other) { void UVector::removeElementAt(int32_t index) { void* e = orphanElementAt(index); - if (e != 0 && deleter != 0) { + if (e != nullptr && deleter != nullptr) { (*deleter)(e); } } @@ -246,15 +243,15 @@ UBool UVector::removeElement(void* obj) { int32_t i = indexOf(obj); if (i >= 0) { removeElementAt(i); - return TRUE; + return true; } - return FALSE; + return false; } -void UVector::removeAllElements(void) { - if (deleter != 0) { +void UVector::removeAllElements() { + if (deleter != nullptr) { for (int32_t i=0; icount != other.count) { - return FALSE; + return false; } - if (comparer == 0) { + if (comparer == nullptr) { for (i=0; i (INT32_MAX - 1) / 2) { // integer overflow check - status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + status = U_ILLEGAL_ARGUMENT_ERROR; + return false; } int32_t newCap = capacity * 2; if (newCap < minimumCapacity) { newCap = minimumCapacity; } if (newCap > (int32_t)(INT32_MAX / sizeof(UElement))) { // integer overflow check - // We keep the original memory contents on bad minimumCapacity. - status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + // We keep the original memory contents on bad minimumCapacity. + status = U_ILLEGAL_ARGUMENT_ERROR; + return false; } UElement* newElems = (UElement *)uprv_realloc(elements, sizeof(UElement)*newCap); - if (newElems == NULL) { + if (newElems == nullptr) { // We keep the original contents on the memory failure on realloc or bad minimumCapacity. status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } elements = newElems; capacity = newCap; } - return TRUE; + return true; } /** * Change the size of this vector as follows: If newSize is smaller, * then truncate the array, possibly deleting held elements for i >= * newSize. If newSize is larger, grow the array, filling in new - * slots with NULL. + * slots with nullptr. */ void UVector::setSize(int32_t newSize, UErrorCode &status) { - int32_t i; - if (newSize < 0) { + if (!ensureCapacity(newSize, status)) { return; } if (newSize > count) { - if (!ensureCapacity(newSize, status)) { - return; - } UElement empty; - empty.pointer = NULL; + empty.pointer = nullptr; empty.integer = 0; - for (i=count; i=newSize; --i) { + for (int32_t i=count-1; i>=newSize; --i) { removeElementAt(i); } } @@ -422,7 +416,7 @@ UElementsAreEqual *UVector::setComparer(UElementsAreEqual *d) { * then 0 is returned and the vector is unchanged. */ void* UVector::orphanElementAt(int32_t index) { - void* e = 0; + void* e = nullptr; if (0 <= index && index < count) { e = elements[index].pointer; for (int32_t i=index; i 0) { max = probe; } else { @@ -474,13 +475,11 @@ void UVector::sortedInsert(UElement e, UElementComparator *compare, UErrorCode& min = probe + 1; } } - if (ensureCapacity(count + 1, ec)) { - for (int32_t i=count; i>min; --i) { - elements[i] = elements[i-1]; - } - elements[min] = e; - ++count; + for (int32_t i=count; i>min; --i) { + elements[i] = elements[i-1]; } + elements[min] = e; + ++count; } /** @@ -492,7 +491,7 @@ void UVector::sortedInsert(UElement e, UElementComparator *compare, UErrorCode& * * The context pointer to this function is a pointer back * (with some extra indirection) to the user supplied comparator. - * + * */ static int32_t U_CALLCONV sortComparator(const void *context, const void *left, const void *right) { @@ -518,7 +517,7 @@ sortiComparator(const void * /*context */, const void *left, const void *right) } /** - * Sort the vector, assuming it constains ints. + * Sort the vector, assuming it contains ints. * (A more general sort would take a comparison function, but it's * not clear whether UVector's UElementComparator or * UComparator from uprv_sortAray would be more appropriate.) @@ -526,7 +525,7 @@ sortiComparator(const void * /*context */, const void *left, const void *right) void UVector::sorti(UErrorCode &ec) { if (U_SUCCESS(ec)) { uprv_sortArray(elements, count, sizeof(UElement), - sortiComparator, NULL, FALSE, &ec); + sortiComparator, nullptr, false, &ec); } } @@ -539,7 +538,7 @@ void UVector::sorti(UErrorCode &ec) { * required by uprv_sortArray(). This is handled by passing the * the UVector sort function pointer via the context pointer to a * sortArray() comparator function, which can then call back to - * the original user functtion. + * the original user function. * * An additional twist is that it's not safe to pass a pointer-to-function * as a (void *) data pointer, so instead we pass a (data) pointer to a @@ -548,7 +547,7 @@ void UVector::sorti(UErrorCode &ec) { void UVector::sort(UElementComparator *compare, UErrorCode &ec) { if (U_SUCCESS(ec)) { uprv_sortArray(elements, count, sizeof(UElement), - sortComparator, &compare, FALSE, &ec); + sortComparator, &compare, false, &ec); } } @@ -559,7 +558,7 @@ void UVector::sort(UElementComparator *compare, UErrorCode &ec) { void UVector::sortWithUComparator(UComparator *compare, const void *context, UErrorCode &ec) { if (U_SUCCESS(ec)) { uprv_sortArray(elements, count, sizeof(UElement), - compare, context, TRUE, &ec); + compare, context, true, &ec); } } diff --git a/src/duckdb/extension/icu/third_party/icu/common/uvector.h b/src/duckdb/extension/icu/third_party/icu/common/uvector.h index 01403cc2a..1b2a58da8 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uvector.h +++ b/src/duckdb/extension/icu/third_party/icu/common/uvector.h @@ -23,48 +23,49 @@ U_NAMESPACE_BEGIN /** - *

    Ultralightweight C++ implementation of a void* vector + * Ultralightweight C++ implementation of a `void*` vector * that is (mostly) compatible with java.util.Vector. * - *

    This is a very simple implementation, written to satisfy an + * This is a very simple implementation, written to satisfy an * immediate porting need. As such, it is not completely fleshed out, * and it aims for simplicity and conformity. Nonetheless, it serves * its purpose (porting code from java that uses java.util.Vector) * well, and it could be easily made into a more robust vector class. * - *

    Design notes + * *Design notes* * - *

    There is index bounds checking, but little is done about it. If + * There is index bounds checking, but little is done about it. If * indices are out of bounds, either nothing happens, or zero is - * returned. We do avoid indexing off into the weeds. + * returned. We *do* avoid indexing off into the weeds. * - *

    There is detection of out of memory, but the handling is very - * coarse-grained -- similar to UnicodeString's protocol, but even - * coarser. The class contains one static flag that is set - * when any call to new returns zero. This allows the caller - * to use several vectors and make just one check at the end to see if - * a memory failure occurred. This is more efficient than making a - * check after each call on each vector when doing many operations on - * multiple vectors. The single static flag works best when memory - * failures are infrequent, and when recovery options are limited or - * nonexistent. - * - *

    Since we don't have garbage collection, UVector was given the - * option to ownits contents. To employ this, set a deleter - * function. The deleter is called on a void* pointer when that + * Since we don't have garbage collection, UVector was given the + * option to *own* its contents. To employ this, set a deleter + * function. The deleter is called on a `void *` pointer when that * pointer is released by the vector, either when the vector itself is - * destructed, or when a call to setElementAt() overwrites an element, - * or when a call to remove() or one of its variants explicitly + * destructed, or when a call to `setElementAt()` overwrites an element, + * or when a call to remove()` or one of its variants explicitly * removes an element. If no deleter is set, or the deleter is set to * zero, then it is assumed that the caller will delete elements as * needed. * - *

    In order to implement methods such as contains() and indexOf(), + * *Error Handling* Functions that can fail, from out of memory conditions + * for example, include a UErrorCode parameter. Any function called + * with an error code already indicating a failure will not modify the + * vector in any way. + * + * For vectors that have a deleter function, any failure in inserting + * an element into the vector will instead delete the element that + * could not be adopted. This simplifies object ownership + * management around calls to `addElement()` and `insertElementAt()`; + * error or no, the function always takes ownership of an incoming object + * from the caller. + * + * In order to implement methods such as `contains()` and `indexOf()`, * UVector needs a way to compare objects for equality. To do so, it * uses a comparison function, or "comparer." If the comparer is not * set, or is set to zero, then all such methods will act as if the * vector contains no element. That is, indexOf() will always return - * -1, contains() will always return FALSE, etc. + * -1, contains() will always return false, etc. * *

    To do * @@ -73,23 +74,21 @@ U_NAMESPACE_BEGIN * @author Alan Liu */ class U_COMMON_API UVector : public UObject { - // NOTE: UVector uses the UHashKey (union of void* and int32_t) as + // NOTE: UVector uses the UElement (union of void* and int32_t) as // its basic storage type. It uses UElementsAreEqual as its // comparison function. It uses UObjectDeleter as its deleter - // function. These are named for hashtables, but used here as-is - // rather than duplicating the type. This allows sharing of - // support functions. + // function. This allows sharing of support functions with UHashtable. private: - int32_t count; + int32_t count = 0; - int32_t capacity; + int32_t capacity = 0; - UElement* elements; + UElement* elements = nullptr; - UObjectDeleter *deleter; + UObjectDeleter *deleter = nullptr; - UElementsAreEqual *comparer; + UElementsAreEqual *comparer = nullptr; public: UVector(UErrorCode &status); @@ -113,18 +112,38 @@ class U_COMMON_API UVector : public UObject { * equal if they are of the same size and all elements are equal, * as compared using this object's comparer. */ - bool operator==(const UVector& other); + bool operator==(const UVector& other) const; /** * Equivalent to !operator==() */ - inline bool operator!=(const UVector& other); + inline bool operator!=(const UVector& other) const {return !operator==(other);} //------------------------------------------------------------ // java.util.Vector API //------------------------------------------------------------ - void addElement(void* obj, UErrorCode &status); + /** + * Add an element at the end of the vector. + * For use only with vectors that do not adopt their elements, which is to say, + * have not set an element deleter function. See `adoptElement()`. + */ + void addElement(void *obj, UErrorCode &status); + + /** + * Add an element at the end of the vector. + * For use only with vectors that adopt their elements, which is to say, + * have set an element deleter function. See `addElement()`. + * + * If the element cannot be successfully added, it will be deleted. This is + * normal ICU _adopt_ behavior - one way or another ownership of the incoming + * object is transferred from the caller. + * + * `addElement()` and `adoptElement()` are separate functions to make it easier + * to see what the function is doing at call sites. Having a single combined function, + * as in earlier versions of UVector, had proved to be error-prone. + */ + void adoptElement(void *obj, UErrorCode &status); void addElement(int32_t elem, UErrorCode &status); @@ -142,19 +161,19 @@ class U_COMMON_API UVector : public UObject { UBool equals(const UVector &other) const; - inline void* firstElement(void) const; + inline void* firstElement() const {return elementAt(0);} - inline void* lastElement(void) const; + inline void* lastElement() const {return elementAt(count-1);} - inline int32_t lastElementi(void) const; + inline int32_t lastElementi() const {return elementAti(count-1);} int32_t indexOf(void* obj, int32_t startIndex = 0) const; int32_t indexOf(int32_t obj, int32_t startIndex = 0) const; - inline UBool contains(void* obj) const; + inline UBool contains(void* obj) const {return indexOf(obj) >= 0;} - inline UBool contains(int32_t obj) const; + inline UBool contains(int32_t obj) const {return indexOf(obj) >= 0;} UBool containsAll(const UVector& other) const; @@ -168,9 +187,9 @@ class U_COMMON_API UVector : public UObject { void removeAllElements(); - inline int32_t size(void) const; + inline int32_t size() const {return count;} - inline UBool isEmpty(void) const; + inline UBool isEmpty() const {return count == 0;} UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status); @@ -178,7 +197,7 @@ class U_COMMON_API UVector : public UObject { * Change the size of this vector as follows: If newSize is * smaller, then truncate the array, possibly deleting held * elements for i >= newSize. If newSize is larger, grow the - * array, filling in new slots with NULL. + * array, filling in new slots with nullptr. */ void setSize(int32_t newSize, UErrorCode &status); @@ -192,10 +211,11 @@ class U_COMMON_API UVector : public UObject { //------------------------------------------------------------ UObjectDeleter *setDeleter(UObjectDeleter *d); + bool hasDeleter() {return deleter != nullptr;} UElementsAreEqual *setComparer(UElementsAreEqual *c); - inline void* operator[](int32_t index) const; + inline void* operator[](int32_t index) const {return elementAt(index);} /** * Removes the element at the given index from this vector and @@ -260,36 +280,35 @@ class U_COMMON_API UVector : public UObject { /** * ICU "poor man's RTTI", returns a UClassID for the actual class. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; private: - void _init(int32_t initialCapacity, UErrorCode &status); - int32_t indexOf(UElement key, int32_t startIndex = 0, int8_t hint = 0) const; void sortedInsert(UElement e, UElementComparator *compare, UErrorCode& ec); +public: // Disallow - UVector(const UVector&); + UVector(const UVector&) = delete; // Disallow - UVector& operator=(const UVector&); + UVector& operator=(const UVector&) = delete; }; /** - *

    Ultralightweight C++ implementation of a void* stack + * Ultralightweight C++ implementation of a `void*` stack * that is (mostly) compatible with java.util.Stack. As in java, this * is merely a paper thin layer around UVector. See the UVector * documentation for further information. * - *

    Design notes + * *Design notes* * - *

    The element at index n-1 is (of course) the top of the + * The element at index `n-1` is (of course) the top of the * stack. * - *

    The poorly named empty() method doesn't empty the + * The poorly named `empty()` method doesn't empty the * stack; it determines if the stack is empty. * * @author Alan Liu @@ -309,19 +328,35 @@ class U_COMMON_API UStack : public UVector { // It's okay not to have a virtual destructor (in UVector) // because UStack has no special cleanup to do. - inline UBool empty(void) const; + inline UBool empty() const {return isEmpty();} - inline void* peek(void) const; + inline void* peek() const {return lastElement();} - inline int32_t peeki(void) const; + inline int32_t peeki() const {return lastElementi();} - void* pop(void); + /** + * Pop and return an element from the stack. + * For stacks with a deleter function, the caller takes ownership + * of the popped element. + */ + void* pop(); - int32_t popi(void); + int32_t popi(); - inline void* push(void* obj, UErrorCode &status); - - inline int32_t push(int32_t i, UErrorCode &status); + inline void* push(void* obj, UErrorCode &status) { + if (hasDeleter()) { + adoptElement(obj, status); + return (U_SUCCESS(status)) ? obj : nullptr; + } else { + addElement(obj, status); + return obj; + } + } + + inline int32_t push(int32_t i, UErrorCode &status) { + addElement(i, status); + return i; + } /* If the object o occurs as an item in this stack, @@ -337,79 +372,15 @@ class U_COMMON_API UStack : public UVector { /** * ICU "poor man's RTTI", returns a UClassID for the actual class. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; -private: // Disallow - UStack(const UStack&); + UStack(const UStack&) = delete; // Disallow - UStack& operator=(const UStack&); + UStack& operator=(const UStack&) = delete; }; - -// UVector inlines - -inline int32_t UVector::size(void) const { - return count; -} - -inline UBool UVector::isEmpty(void) const { - return count == 0; -} - -inline UBool UVector::contains(void* obj) const { - return indexOf(obj) >= 0; -} - -inline UBool UVector::contains(int32_t obj) const { - return indexOf(obj) >= 0; -} - -inline void* UVector::firstElement(void) const { - return elementAt(0); -} - -inline void* UVector::lastElement(void) const { - return elementAt(count-1); -} - -inline int32_t UVector::lastElementi(void) const { - return elementAti(count-1); -} - -inline void* UVector::operator[](int32_t index) const { - return elementAt(index); -} - -inline bool UVector::operator!=(const UVector& other) { - return !operator==(other); -} - -// UStack inlines - -inline UBool UStack::empty(void) const { - return isEmpty(); -} - -inline void* UStack::peek(void) const { - return lastElement(); -} - -inline int32_t UStack::peeki(void) const { - return lastElementi(); -} - -inline void* UStack::push(void* obj, UErrorCode &status) { - addElement(obj, status); - return obj; -} - -inline int32_t UStack::push(int32_t i, UErrorCode &status) { - addElement(i, status); - return i; -} - U_NAMESPACE_END #endif diff --git a/src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp b/src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp index 571d92bd0..fb554729f 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp @@ -16,23 +16,23 @@ U_NAMESPACE_BEGIN -#define UVECTOR32_DEFAULT_CAPACITY 8 +#define DEFAULT_CAPACITY 8 /* * Constants for hinting whether a key is an integer * or a pointer. If a hint bit is zero, then the associated * token is assumed to be an integer. This is needed for iSeries */ - + UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector32) UVector32::UVector32(UErrorCode &status) : count(0), capacity(0), maxCapacity(0), - elements(NULL) + elements(nullptr) { - _init(UVECTOR32_DEFAULT_CAPACITY, status); + _init(DEFAULT_CAPACITY, status); } UVector32::UVector32(int32_t initialCapacity, UErrorCode &status) : @@ -49,13 +49,13 @@ UVector32::UVector32(int32_t initialCapacity, UErrorCode &status) : void UVector32::_init(int32_t initialCapacity, UErrorCode &status) { // Fix bogus initialCapacity values; avoid malloc(0) if (initialCapacity < 1) { - initialCapacity = UVECTOR32_DEFAULT_CAPACITY; + initialCapacity = DEFAULT_CAPACITY; } if (maxCapacity>0 && maxCapacity (int32_t)(INT32_MAX / sizeof(int32_t))) { - initialCapacity = uprv_min(UVECTOR32_DEFAULT_CAPACITY, maxCapacity); + initialCapacity = uprv_min(DEFAULT_CAPACITY, maxCapacity); } elements = (int32_t *)uprv_malloc(sizeof(int32_t)*initialCapacity); if (elements == 0) { @@ -83,15 +83,15 @@ void UVector32::assign(const UVector32& other, UErrorCode &ec) { } -bool UVector32::operator==(const UVector32& other) { +bool UVector32::operator==(const UVector32& other) const { int32_t i; - if (count != other.count) return FALSE; + if (count != other.count) return false; for (i=0; i= 0) { - return FALSE; + return false; } } - return TRUE; + return true; } UBool UVector32::removeAll(const UVector32& other) { - UBool changed = FALSE; + UBool changed = false; for (int32_t i=0; i= 0) { removeElementAt(j); - changed = TRUE; + changed = true; } } return changed; } UBool UVector32::retainAll(const UVector32& other) { - UBool changed = FALSE; + UBool changed = false; for (int32_t j=size()-1; j>=0; --j) { int32_t i = other.indexOf(elements[j]); if (i < 0) { removeElementAt(j); - changed = TRUE; + changed = true; } } return changed; @@ -165,7 +165,7 @@ void UVector32::removeElementAt(int32_t index) { } } -void UVector32::removeAllElements(void) { +void UVector32::removeAllElements() { count = 0; } @@ -173,14 +173,14 @@ UBool UVector32::equals(const UVector32 &other) const { int i; if (this->count != other.count) { - return FALSE; + return false; } for (i=0; i= minimumCapacity) { - return TRUE; + return true; } if (maxCapacity>0 && minimumCapacity>maxCapacity) { status = U_BUFFER_OVERFLOW_ERROR; - return FALSE; + return false; } if (capacity > (INT32_MAX - 1) / 2) { // integer overflow check status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } int32_t newCap = capacity * 2; if (newCap < minimumCapacity) { @@ -226,17 +226,17 @@ UBool UVector32::expandCapacity(int32_t minimumCapacity, UErrorCode &status) { if (newCap > (int32_t)(INT32_MAX / sizeof(int32_t))) { // integer overflow check // We keep the original memory contents on bad minimumCapacity/maxCapacity. status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } int32_t* newElems = (int32_t *)uprv_realloc(elements, sizeof(int32_t)*newCap); - if (newElems == NULL) { + if (newElems == nullptr) { // We keep the original contents on the memory failure on realloc. status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } elements = newElems; capacity = newCap; - return TRUE; + return true; } void UVector32::setMaxCapacity(int32_t limit) { @@ -253,11 +253,11 @@ void UVector32::setMaxCapacity(int32_t limit) { // Current capacity is within the new limit. return; } - + // New maximum capacity is smaller than the current size. // Realloc the storage to the new, smaller size. int32_t* newElems = (int32_t *)uprv_realloc(elements, sizeof(int32_t)*maxCapacity); - if (newElems == NULL) { + if (newElems == nullptr) { // Realloc to smaller failed. // Just keep what we had. No need to call it a failure. return; @@ -273,7 +273,7 @@ void UVector32::setMaxCapacity(int32_t limit) { * Change the size of this vector as follows: If newSize is smaller, * then truncate the array, possibly deleting held elements for i >= * newSize. If newSize is larger, grow the array, filling in new - * slots with NULL. + * slots with nullptr. */ void UVector32::setSize(int32_t newSize) { int32_t i; @@ -288,7 +288,7 @@ void UVector32::setSize(int32_t newSize) { for (i=count; i= 0) && (capacity >= minimumCapacity)) { - return TRUE; + return true; } else { return expandCapacity(minimumCapacity, status); } @@ -233,8 +233,8 @@ inline void UVector32::addElement(int32_t elem, UErrorCode &status) { } inline int32_t *UVector32::reserveBlock(int32_t size, UErrorCode &status) { - if (ensureCapacity(count+size, status) == FALSE) { - return NULL; + if (ensureCapacity(count+size, status) == false) { + return nullptr; } int32_t *rp = elements+count; count += size; @@ -252,11 +252,11 @@ inline int32_t *UVector32::popFrame(int32_t size) { -inline int32_t UVector32::size(void) const { +inline int32_t UVector32::size() const { return count; } -inline UBool UVector32::isEmpty(void) const { +inline UBool UVector32::isEmpty() const { return count == 0; } @@ -264,11 +264,11 @@ inline UBool UVector32::contains(int32_t obj) const { return indexOf(obj) >= 0; } -inline int32_t UVector32::lastElementi(void) const { +inline int32_t UVector32::lastElementi() const { return elementAti(count-1); } -inline bool UVector32::operator!=(const UVector32& other) { +inline bool UVector32::operator!=(const UVector32& other) const { return !operator==(other); } @@ -279,11 +279,11 @@ inline int32_t *UVector32::getBuffer() const { // UStack inlines -inline UBool UVector32::empty(void) const { +inline UBool UVector32::empty() const { return isEmpty(); } -inline int32_t UVector32::peeki(void) const { +inline int32_t UVector32::peeki() const { return lastElementi(); } @@ -292,7 +292,7 @@ inline int32_t UVector32::push(int32_t i, UErrorCode &status) { return i; } -inline int32_t UVector32::popi(void) { +inline int32_t UVector32::popi() { int32_t result = 0; if (count > 0) { count--; diff --git a/src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp b/src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp index aa00cf91f..05559dd83 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp @@ -13,23 +13,23 @@ U_NAMESPACE_BEGIN -#define UVECTOR64_DEFAULT_CAPACITY 8 +#define DEFAULT_CAPACITY 8 /* * Constants for hinting whether a key is an integer * or a pointer. If a hint bit is zero, then the associated * token is assumed to be an integer. This is needed for iSeries */ - + UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector64) UVector64::UVector64(UErrorCode &status) : count(0), capacity(0), maxCapacity(0), - elements(NULL) + elements(nullptr) { - _init(UVECTOR64_DEFAULT_CAPACITY, status); + _init(DEFAULT_CAPACITY, status); } UVector64::UVector64(int32_t initialCapacity, UErrorCode &status) : @@ -46,13 +46,13 @@ UVector64::UVector64(int32_t initialCapacity, UErrorCode &status) : void UVector64::_init(int32_t initialCapacity, UErrorCode &status) { // Fix bogus initialCapacity values; avoid malloc(0) if (initialCapacity < 1) { - initialCapacity = UVECTOR64_DEFAULT_CAPACITY; + initialCapacity = DEFAULT_CAPACITY; } if (maxCapacity>0 && maxCapacity (int32_t)(INT32_MAX / sizeof(int64_t))) { - initialCapacity = uprv_min(UVECTOR64_DEFAULT_CAPACITY, maxCapacity); + initialCapacity = uprv_min(DEFAULT_CAPACITY, maxCapacity); } elements = (int64_t *)uprv_malloc(sizeof(int64_t)*initialCapacity); if (elements == 0) { @@ -82,13 +82,13 @@ void UVector64::assign(const UVector64& other, UErrorCode &ec) { bool UVector64::operator==(const UVector64& other) { int32_t i; - if (count != other.count) return FALSE; + if (count != other.count) return false; for (i=0; i= minimumCapacity) { - return TRUE; + return true; } if (maxCapacity>0 && minimumCapacity>maxCapacity) { status = U_BUFFER_OVERFLOW_ERROR; - return FALSE; + return false; } if (capacity > (INT32_MAX - 1) / 2) { // integer overflow check status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } int32_t newCap = capacity * 2; if (newCap < minimumCapacity) { @@ -144,17 +144,17 @@ UBool UVector64::expandCapacity(int32_t minimumCapacity, UErrorCode &status) { if (newCap > (int32_t)(INT32_MAX / sizeof(int64_t))) { // integer overflow check // We keep the original memory contents on bad minimumCapacity/maxCapacity. status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } int64_t* newElems = (int64_t *)uprv_realloc(elements, sizeof(int64_t)*newCap); - if (newElems == NULL) { + if (newElems == nullptr) { // We keep the original contents on the memory failure on realloc. status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } elements = newElems; capacity = newCap; - return TRUE; + return true; } void UVector64::setMaxCapacity(int32_t limit) { @@ -171,11 +171,11 @@ void UVector64::setMaxCapacity(int32_t limit) { // Current capacity is within the new limit. return; } - + // New maximum capacity is smaller than the current size. // Realloc the storage to the new, smaller size. int64_t* newElems = (int64_t *)uprv_realloc(elements, sizeof(int64_t)*maxCapacity); - if (newElems == NULL) { + if (newElems == nullptr) { // Realloc to smaller failed. // Just keep what we had. No need to call it a failure. return; @@ -191,7 +191,7 @@ void UVector64::setMaxCapacity(int32_t limit) { * Change the size of this vector as follows: If newSize is smaller, * then truncate the array, possibly deleting held elements for i >= * newSize. If newSize is larger, grow the array, filling in new - * slots with NULL. + * slots with nullptr. */ void UVector64::setSize(int32_t newSize) { int32_t i; @@ -206,7 +206,7 @@ void UVector64::setSize(int32_t newSize) { for (i=count; i= 0) && (capacity >= minimumCapacity)) { - return TRUE; + return true; } else { return expandCapacity(minimumCapacity, status); } @@ -222,8 +222,8 @@ inline void UVector64::addElement(int64_t elem, UErrorCode &status) { } inline int64_t *UVector64::reserveBlock(int32_t size, UErrorCode &status) { - if (ensureCapacity(count+size, status) == FALSE) { - return NULL; + if (ensureCapacity(count+size, status) == false) { + return nullptr; } int64_t *rp = elements+count; count += size; @@ -241,11 +241,11 @@ inline int64_t *UVector64::popFrame(int32_t size) { -inline int32_t UVector64::size(void) const { +inline int32_t UVector64::size() const { return count; } -inline int64_t UVector64::lastElementi(void) const { +inline int64_t UVector64::lastElementi() const { return elementAti(count-1); } @@ -265,7 +265,7 @@ inline int64_t UVector64::push(int64_t i, UErrorCode &status) { return i; } -inline int64_t UVector64::popi(void) { +inline int64_t UVector64::popi() { int64_t result = 0; if (count > 0) { count--; diff --git a/src/duckdb/extension/icu/third_party/icu/common/wintz.cpp b/src/duckdb/extension/icu/third_party/icu/common/wintz.cpp index 115512e70..ef9cd6801 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/wintz.cpp +++ b/src/duckdb/extension/icu/third_party/icu/common/wintz.cpp @@ -16,11 +16,12 @@ #if U_PLATFORM_USES_ONLY_WIN32_API #include "wintz.h" +#include "charstr.h" #include "cmemory.h" #include "cstring.h" #include "unicode/ures.h" -#include "unicode/ustring.h" +#include "unicode/unistr.h" #include "uresimp.h" #ifndef WIN32_LEAN_AND_MEAN @@ -35,89 +36,295 @@ U_NAMESPACE_BEGIN -// The max size of TimeZoneKeyName is 128, defined in DYNAMIC_TIME_ZONE_INFORMATION -#define MAX_TIMEZONE_ID_LENGTH 128 +// Note these constants and the struct are only used when dealing with the fallback path for RDP sessions. + +// This is the location of the time zones in the registry on Vista+ systems. +// See: https://docs.microsoft.com/windows/win32/api/timezoneapi/ns-timezoneapi-dynamic_time_zone_information +#define WINDOWS_TIMEZONES_REG_KEY_PATH L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones" + +// Max length for a registry key is 255. +1 for null. +// See: https://docs.microsoft.com/windows/win32/sysinfo/registry-element-size-limits +#define WINDOWS_MAX_REG_KEY_LENGTH 256 + +#if U_PLATFORM_HAS_WINUWP_API == 0 + +// This is the layout of the TZI binary value in the registry. +// See: https://docs.microsoft.com/windows/win32/api/timezoneapi/ns-timezoneapi-time_zone_information +typedef struct _REG_TZI_FORMAT { + LONG Bias; + LONG StandardBias; + LONG DaylightBias; + SYSTEMTIME StandardDate; + SYSTEMTIME DaylightDate; +} REG_TZI_FORMAT; + +#endif // U_PLATFORM_HAS_WINUWP_API /** -* Main Windows time zone detection function. -* Returns the Windows time zone converted to an ICU time zone as a heap-allocated buffer, or nullptr upon failure. -* Note: We use the Win32 API GetDynamicTimeZoneInformation to get the current time zone info. -* This API returns a non-localized time zone name, which we can then map to an ICU time zone name. +* This is main Windows time zone detection function. +* +* It returns the Windows time zone converted to an ICU time zone as a heap-allocated buffer, or nullptr upon failure. +* +* We use the Win32 API GetDynamicTimeZoneInformation (which is available since Vista) to get the current time zone info, +* as this API returns a non-localized time zone name which can be then mapped to an ICU time zone. +* +* However, in some RDP/terminal services situations, this struct isn't always fully complete, and the TimeZoneKeyName +* field of the struct might be nullptr. This can happen with some 3rd party RDP clients, and also when using older versions +* of the RDP protocol, which don't send the newer TimeZoneKeyNamei information and only send the StandardName and DaylightName. +* +* Since these 3rd party clients and older RDP clients only send the pre-Vista time zone information to the server, this means that we +* need to fallback on using the pre-Vista methods to determine the time zone. This unfortunately requires examining the registry directly +* in order to try and determine the current time zone. +* +* Note that this can however still fail in some cases though if the client and server are using different languages, as the StandardName +* that is sent by client is localized in the client's language. However, we must compare this to the names that are on the server, which +* are localized in registry using the server's language. Despite that, this is the best we can do. +* +* Note: This fallback method won't work for the UWP version though, as we can't use the registry APIs in UWP. +* +* Once we have the current Windows time zone, then we can then map it to an ICU time zone ID (~ Olsen ID). */ -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uprv_detectWindowsTimeZone() { - UErrorCode status = U_ZERO_ERROR; - char* icuid = nullptr; - char dynamicTZKeyName[MAX_TIMEZONE_ID_LENGTH]; - char tmpid[MAX_TIMEZONE_ID_LENGTH]; - int32_t len; - int id = GEOID_NOT_AVAILABLE; - int errorCode; - wchar_t ISOcodeW[3] = {}; /* 2 letter ISO code in UTF-16 */ - char ISOcode[3] = {}; /* 2 letter ISO code in UTF-8 */ - + // We first try to obtain the time zone directly by using the TimeZoneKeyName field of the DYNAMIC_TIME_ZONE_INFORMATION struct. DYNAMIC_TIME_ZONE_INFORMATION dynamicTZI; uprv_memset(&dynamicTZI, 0, sizeof(dynamicTZI)); - uprv_memset(dynamicTZKeyName, 0, sizeof(dynamicTZKeyName)); - uprv_memset(tmpid, 0, sizeof(tmpid)); + SYSTEMTIME systemTimeAllZero; + uprv_memset(&systemTimeAllZero, 0, sizeof(systemTimeAllZero)); - /* Obtain TIME_ZONE_INFORMATION from the API and get the non-localized time zone name. */ - if (TIME_ZONE_ID_INVALID == GetDynamicTimeZoneInformation(&dynamicTZI)) { + if (GetDynamicTimeZoneInformation(&dynamicTZI) == TIME_ZONE_ID_INVALID) { return nullptr; } - id = GetUserGeoID(GEOCLASS_NATION); - errorCode = GetGeoInfoW(id, GEO_ISO2, ISOcodeW, 3, 0); + // If the DST setting has been turned off in the Control Panel, then return "Etc/GMT". + // + // Note: This logic is based on how the Control Panel itself determines if DST is 'off' on Windows. + // The code is somewhat convoluted; in a sort of pseudo-code it looks like this: + // + // IF (GetDynamicTimeZoneInformation != TIME_ZONE_ID_INVALID) && (DynamicDaylightTimeDisabled != 0) && + // (StandardDate == DaylightDate) && + // ( + // (TimeZoneKeyName != Empty && StandardDate == 0) || + // (TimeZoneKeyName == Empty && StandardDate != 0) + // ) + // THEN + // DST setting is "Disabled". + // + if (dynamicTZI.DynamicDaylightTimeDisabled != 0 && + uprv_memcmp(&dynamicTZI.StandardDate, &dynamicTZI.DaylightDate, sizeof(dynamicTZI.StandardDate)) == 0 && + ((dynamicTZI.TimeZoneKeyName[0] != L'\0' && uprv_memcmp(&dynamicTZI.StandardDate, &systemTimeAllZero, sizeof(systemTimeAllZero)) == 0) || + (dynamicTZI.TimeZoneKeyName[0] == L'\0' && uprv_memcmp(&dynamicTZI.StandardDate, &systemTimeAllZero, sizeof(systemTimeAllZero)) != 0))) + { + LONG utcOffsetMins = dynamicTZI.Bias; + if (utcOffsetMins == 0) { + return uprv_strdup("Etc/UTC"); + } - // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8). - u_strToUTF8(ISOcode, UPRV_LENGTHOF(ISOcode), nullptr, - reinterpret_cast(ISOcodeW), UPRV_LENGTHOF(ISOcodeW), &status); + // No way to support when DST is turned off and the offset in minutes is not a multiple of 60. + if (utcOffsetMins % 60 == 0) { + char gmtOffsetTz[11] = {}; // "Etc/GMT+dd" is 11-char long with a terminal null. + // Important note on the sign convention for zones: + // + // From https://en.wikipedia.org/wiki/Tz_database#Area + // "In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed + // from the standard ISO 8601 convention. In the "Etc" area, zones west of GMT have a positive sign and those + // east have a negative sign in their name (e.g "Etc/GMT-14" is 14 hours ahead of GMT)." + // + // Regarding the POSIX style, from https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html + // "The offset specifies the time value you must add to the local time to get a Coordinated Universal Time value." + // + // However, the Bias value in DYNAMIC_TIME_ZONE_INFORMATION *already* follows the POSIX convention. + // + // From https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/ns-timezoneapi-dynamic_time_zone_information + // "The bias is the difference, in minutes, between Coordinated Universal Time (UTC) and + // local time. All translations between UTC and local time are based on the following formula: + // UTC = local time + bias" + // + // For example, a time zone that is 3 hours ahead of UTC (UTC+03:00) would have a Bias value of -180, and the + // corresponding time zone ID would be "Etc/GMT-3". (So there is no need to negate utcOffsetMins below.) + int ret = snprintf(gmtOffsetTz, sizeof(gmtOffsetTz), "Etc/GMT%+ld", utcOffsetMins / 60); + if (ret > 0 && ret < UPRV_LENGTHOF(gmtOffsetTz)) { + return uprv_strdup(gmtOffsetTz); + } + } + } - LocalUResourceBundlePointer bundle(ures_openDirect(nullptr, "windowsZones", &status)); - ures_getByKey(bundle.getAlias(), "mapTimezones", bundle.getAlias(), &status); + // If DST is NOT disabled, but the TimeZoneKeyName field of the struct is nullptr, then we may be dealing with a + // RDP/terminal services session where the 'Time Zone Redirection' feature is enabled. However, either the RDP + // client sent the server incomplete info (some 3rd party RDP clients only send the StandardName and DaylightName, + // but do not send the important TimeZoneKeyName), or if the RDP server has not appropriately populated the struct correctly. + // + // In this case we unfortunately have no choice but to fallback to using the pre-Vista method of determining the + // time zone, which requires examining the registry directly. + // + // Note that this can however still fail though if the client and server are using different languages, as the StandardName + // that is sent by client is *localized* in the client's language. However, we must compare this to the names that are + // on the server, which are *localized* in registry using the server's language. + // + // One other note is that this fallback method doesn't work for the UWP version, as we can't use the registry APIs. - // convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8). - u_strToUTF8(dynamicTZKeyName, UPRV_LENGTHOF(dynamicTZKeyName), nullptr, - reinterpret_cast(dynamicTZI.TimeZoneKeyName), -1, &status); + // windowsTimeZoneName will point at timezoneSubKeyName if we had to fallback to using the registry, and we found a match. + WCHAR timezoneSubKeyName[WINDOWS_MAX_REG_KEY_LENGTH]; + WCHAR *windowsTimeZoneName = dynamicTZI.TimeZoneKeyName; - if (U_FAILURE(status)) { + if (dynamicTZI.TimeZoneKeyName[0] == 0) { + +// We can't use the registry APIs in the UWP version. +#if U_PLATFORM_HAS_WINUWP_API == 1 + (void)timezoneSubKeyName; // suppress unused variable warnings. return nullptr; - } +#else + // Open the path to the time zones in the Windows registry. + LONG ret; + HKEY hKeyAllTimeZones = nullptr; + ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, WINDOWS_TIMEZONES_REG_KEY_PATH, 0, KEY_READ, + reinterpret_cast(&hKeyAllTimeZones)); + + if (ret != ERROR_SUCCESS) { + // If we can't open the key, then we can't do much, so fail. + return nullptr; + } + + // Read the number of subkeys under the time zone registry path. + DWORD numTimeZoneSubKeys; + ret = RegQueryInfoKeyW(hKeyAllTimeZones, nullptr, nullptr, nullptr, &numTimeZoneSubKeys, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); + + if (ret != ERROR_SUCCESS) { + RegCloseKey(hKeyAllTimeZones); + return nullptr; + } + + // Examine each of the subkeys to try and find a match for the localized standard name ("Std"). + // + // Note: The name of the time zone subkey itself is not localized, but the "Std" name is localized. This means + // that we could fail to find a match if the RDP client and RDP server are using different languages, but unfortunately + // there isn't much we can do about it. + HKEY hKeyTimeZoneSubKey = nullptr; + ULONG registryValueType; + WCHAR registryStandardName[WINDOWS_MAX_REG_KEY_LENGTH]; - if (dynamicTZI.TimeZoneKeyName[0] != 0) { - StackUResourceBundle winTZ; - ures_getByKey(bundle.getAlias(), dynamicTZKeyName, winTZ.getAlias(), &status); + for (DWORD i = 0; i < numTimeZoneSubKeys; i++) { + // Note: RegEnumKeyExW wants the size of the buffer in characters. + DWORD size = UPRV_LENGTHOF(timezoneSubKeyName); + ret = RegEnumKeyExW(hKeyAllTimeZones, i, timezoneSubKeyName, &size, nullptr, nullptr, nullptr, nullptr); - if (U_SUCCESS(status)) { - const UChar* icuTZ = nullptr; - if (errorCode != 0) { - icuTZ = ures_getStringByKey(winTZ.getAlias(), ISOcode, &len, &status); + if (ret != ERROR_SUCCESS) { + RegCloseKey(hKeyAllTimeZones); + return nullptr; } - if (errorCode == 0 || icuTZ == nullptr) { - /* fallback to default "001" and reset status */ - status = U_ZERO_ERROR; - icuTZ = ures_getStringByKey(winTZ.getAlias(), "001", &len, &status); + + ret = RegOpenKeyExW(hKeyAllTimeZones, timezoneSubKeyName, 0, KEY_READ, + reinterpret_cast(&hKeyTimeZoneSubKey)); + + if (ret != ERROR_SUCCESS) { + RegCloseKey(hKeyAllTimeZones); + return nullptr; } - if (U_SUCCESS(status)) { - int index = 0; + // Note: RegQueryValueExW wants the size of the buffer in bytes. + size = sizeof(registryStandardName); + ret = RegQueryValueExW(hKeyTimeZoneSubKey, L"Std", nullptr, ®istryValueType, + reinterpret_cast(registryStandardName), &size); + + if (ret != ERROR_SUCCESS || registryValueType != REG_SZ) { + RegCloseKey(hKeyTimeZoneSubKey); + RegCloseKey(hKeyAllTimeZones); + return nullptr; + } + + // Note: wcscmp does an ordinal (byte) comparison. + if (wcscmp(reinterpret_cast(registryStandardName), dynamicTZI.StandardName) == 0) { + // Since we are comparing the *localized* time zone name, it's possible that some languages might use + // the same string for more than one time zone. Thus we need to examine the TZI data in the registry to + // compare the GMT offset (the bias), and the DST transition dates, to ensure it's the same time zone + // as the currently reported one. + REG_TZI_FORMAT registryTziValue; + uprv_memset(®istryTziValue, 0, sizeof(registryTziValue)); + + // Note: RegQueryValueExW wants the size of the buffer in bytes. + DWORD timezoneTziValueSize = sizeof(registryTziValue); + ret = RegQueryValueExW(hKeyTimeZoneSubKey, L"TZI", nullptr, ®istryValueType, + reinterpret_cast(®istryTziValue), &timezoneTziValueSize); - while (!(*icuTZ == '\0' || *icuTZ == ' ')) { - // time zone IDs only contain ASCII invariant characters. - tmpid[index++] = (char)(*icuTZ++); + if (ret == ERROR_SUCCESS) { + if ((dynamicTZI.Bias == registryTziValue.Bias) && + (memcmp((const void *)&dynamicTZI.StandardDate, (const void *)®istryTziValue.StandardDate, sizeof(SYSTEMTIME)) == 0) && + (memcmp((const void *)&dynamicTZI.DaylightDate, (const void *)®istryTziValue.DaylightDate, sizeof(SYSTEMTIME)) == 0)) + { + // We found a matching time zone. + windowsTimeZoneName = timezoneSubKeyName; + break; + } } - tmpid[index] = '\0'; } + RegCloseKey(hKeyTimeZoneSubKey); + hKeyTimeZoneSubKey = nullptr; + } + + if (hKeyTimeZoneSubKey != nullptr) { + RegCloseKey(hKeyTimeZoneSubKey); } + if (hKeyAllTimeZones != nullptr) { + RegCloseKey(hKeyAllTimeZones); + } +#endif // U_PLATFORM_HAS_WINUWP_API } - // Copy the timezone ID to icuid to be returned. - if (tmpid[0] != 0) { - icuid = uprv_strdup(tmpid); + CharString winTZ; + UErrorCode status = U_ZERO_ERROR; + winTZ.appendInvariantChars(UnicodeString(true, windowsTimeZoneName, -1), status); + + // Map Windows Timezone name (non-localized) to ICU timezone ID (~ Olson timezone id). + StackUResourceBundle winTZBundle; + ures_openDirectFillIn(winTZBundle.getAlias(), nullptr, "windowsZones", &status); + ures_getByKey(winTZBundle.getAlias(), "mapTimezones", winTZBundle.getAlias(), &status); + ures_getByKey(winTZBundle.getAlias(), winTZ.data(), winTZBundle.getAlias(), &status); + + if (U_FAILURE(status)) { + return nullptr; + } + + // Note: Since the ISO 3166 country/region codes are all invariant ASCII chars, we can + // directly downcast from wchar_t to do the conversion. + // We could call the A version of the GetGeoInfo API, but that would be slightly slower than calling the W API, + // as the A version of the API will end up calling MultiByteToWideChar anyways internally. + wchar_t regionCodeW[3] = {}; + char regionCode[3] = {}; // 2 letter ISO 3166 country/region code made entirely of invariant chars. + int geoId = GetUserGeoID(GEOCLASS_NATION); + int regionCodeLen = GetGeoInfoW(geoId, GEO_ISO2, regionCodeW, UPRV_LENGTHOF(regionCodeW), 0); + + const char16_t *icuTZ16 = nullptr; + int32_t tzListLen = 0; + + if (regionCodeLen != 0) { + for (int i = 0; i < UPRV_LENGTHOF(regionCodeW); i++) { + regionCode[i] = static_cast(regionCodeW[i]); + } + icuTZ16 = ures_getStringByKey(winTZBundle.getAlias(), regionCode, &tzListLen, &status); + } + if (regionCodeLen == 0 || U_FAILURE(status)) { + // fallback to default "001" (world) + status = U_ZERO_ERROR; + icuTZ16 = ures_getStringByKey(winTZBundle.getAlias(), "001", &tzListLen, &status); + } + + // Note: We want the first entry in the string returned by ures_getStringByKey. + // However this string can be a space delimited list of timezones: + // Ex: "America/New_York America/Detroit America/Indiana/Petersburg ..." + // We need to stop at the first space, so we pass tzLen (instead of tzListLen) to appendInvariantChars below. + int32_t tzLen = 0; + if (tzListLen > 0) { + while (!(icuTZ16[tzLen] == u'\0' || icuTZ16[tzLen] == u' ')) { + tzLen++; + } } - return icuid; + // Note: cloneData returns nullptr if the status is a failure, so this + // will return nullptr if the above look-up fails. + CharString icuTZStr; + return icuTZStr.appendInvariantChars(icuTZ16, tzLen, status).cloneData(status); } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/common/wintz.h b/src/duckdb/extension/icu/third_party/icu/common/wintz.h index 98e78152d..ce9c1e901 100644 --- a/src/duckdb/extension/icu/third_party/icu/common/wintz.h +++ b/src/duckdb/extension/icu/third_party/icu/common/wintz.h @@ -11,15 +11,15 @@ ******************************************************************************** */ -#ifndef __WINTZ_H -#define __WINTZ_H +#ifndef __WINTZ +#define __WINTZ #include "unicode/utypes.h" #if U_PLATFORM_USES_ONLY_WIN32_API /** - * \file + * \file * \brief C API: Utilities for dealing w/ Windows time zones. */ @@ -28,7 +28,7 @@ U_CDECL_BEGIN typedef struct _TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION; U_CDECL_END -U_INTERNAL const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 uprv_detectWindowsTimeZone(); #endif /* U_PLATFORM_USES_ONLY_WIN32_API */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp index c6c47258e..1b49d3b54 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp @@ -40,7 +40,7 @@ namespace { * Prefix string for Chinese index buckets. * See http://unicode.org/repos/cldr/trunk/specs/ldml/tr35-collation.html#Collation_Indexes */ -const UChar BASE[1] = { 0xFDD0 }; +const char16_t BASE[1] = { 0xFDD0 }; const int32_t BASE_LENGTH = 1; UBool isOneLabelBetterThanOther(const Normalizer2 &nfkdNormalizer, @@ -64,12 +64,12 @@ namespace { UnicodeString *ownedString(const UnicodeString &s, LocalPointer &owned, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } if (owned.isValid()) { return owned.orphan(); } UnicodeString *p = new UnicodeString(s); - if (p == NULL) { + if (p == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; } return p; @@ -158,7 +158,7 @@ class BucketList : public UObject { } } const AlphabeticIndex::Bucket *bucket = getBucket(*bucketList_, start); - if (bucket->displayBucket_ != NULL) { + if (bucket->displayBucket_ != nullptr) { bucket = bucket->displayBucket_; } return bucket->displayIndex_; @@ -198,29 +198,29 @@ AlphabeticIndex::ImmutableIndex::getBucket(int32_t index) const { if (0 <= index && index < buckets_->getBucketCount()) { return icu::getBucket(*buckets_->immutableVisibleList_, index); } else { - return NULL; + return nullptr; } } AlphabeticIndex::AlphabeticIndex(const Locale &locale, UErrorCode &status) - : inputList_(NULL), - labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(NULL), + : inputList_(nullptr), + labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(nullptr), maxLabelCount_(99), - initialLabels_(NULL), firstCharsInScripts_(NULL), - collator_(NULL), collatorPrimaryOnly_(NULL), - buckets_(NULL) { + initialLabels_(nullptr), firstCharsInScripts_(nullptr), + collator_(nullptr), collatorPrimaryOnly_(nullptr), + buckets_(nullptr) { init(&locale, status); } AlphabeticIndex::AlphabeticIndex(RuleBasedCollator *collator, UErrorCode &status) - : inputList_(NULL), - labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(NULL), + : inputList_(nullptr), + labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(nullptr), maxLabelCount_(99), - initialLabels_(NULL), firstCharsInScripts_(NULL), - collator_(collator), collatorPrimaryOnly_(NULL), - buckets_(NULL) { - init(NULL, status); + initialLabels_(nullptr), firstCharsInScripts_(nullptr), + collator_(collator), collatorPrimaryOnly_(nullptr), + buckets_(nullptr) { + init(nullptr, status); } @@ -253,22 +253,22 @@ AlphabeticIndex &AlphabeticIndex::addLabels(const Locale &locale, UErrorCode &st AlphabeticIndex::ImmutableIndex *AlphabeticIndex::buildImmutableIndex(UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } // In C++, the ImmutableIndex must own its copy of the BucketList, // even if it contains no records, for proper memory management. - // We could clone the buckets_ if they are not NULL, + // We could clone the buckets_ if they are not nullptr, // but that would be worth it only if this method is called multiple times, // or called after using the old-style bucket iterator API. LocalPointer immutableBucketList(createBucketList(errorCode)); LocalPointer coll(collatorPrimaryOnly_->clone()); if (immutableBucketList.isNull() || coll.isNull()) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } ImmutableIndex *immIndex = new ImmutableIndex(immutableBucketList.getAlias(), coll.getAlias()); - if (immIndex == NULL) { + if (immIndex == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } // The ImmutableIndex adopted its parameter objects. immutableBucketList.orphan(); @@ -286,13 +286,14 @@ int32_t AlphabeticIndex::getBucketCount(UErrorCode &status) { int32_t AlphabeticIndex::getRecordCount(UErrorCode &status) { - if (U_FAILURE(status) || inputList_ == NULL) { + if (U_FAILURE(status) || inputList_ == nullptr) { return 0; } return inputList_->size(); } void AlphabeticIndex::initLabels(UVector &indexCharacters, UErrorCode &errorCode) const { + U_ASSERT(indexCharacters.hasDeleter()); const Normalizer2 *nfkdNormalizer = Normalizer2::getNFKDInstance(errorCode); if (U_FAILURE(errorCode)) { return; } @@ -305,26 +306,26 @@ void AlphabeticIndex::initLabels(UVector &indexCharacters, UErrorCode &errorCode // That is, we might have c, ch, d, where "ch" sorts just like "c", "h". // We filter out those cases. UnicodeSetIterator iter(*initialLabels_); - while (iter.next()) { + while (U_SUCCESS(errorCode) && iter.next()) { const UnicodeString *item = &iter.getString(); LocalPointer ownedItem; UBool checkDistinct; int32_t itemLength = item->length(); if (!item->hasMoreChar32Than(0, itemLength, 1)) { - checkDistinct = FALSE; + checkDistinct = false; } else if(item->charAt(itemLength - 1) == 0x2a && // '*' item->charAt(itemLength - 2) != 0x2a) { // Use a label if it is marked with one trailing star, // even if the label string sorts the same when all contractions are suppressed. ownedItem.adoptInstead(new UnicodeString(*item, 0, itemLength - 1)); item = ownedItem.getAlias(); - if (item == NULL) { + if (item == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } - checkDistinct = FALSE; + checkDistinct = false; } else { - checkDistinct = TRUE; + checkDistinct = true; } if (collatorPrimaryOnly_->compare(*item, firstScriptBoundary, errorCode) < 0) { // Ignore a primary-ignorable or non-alphabetic index character. @@ -375,19 +376,19 @@ const UnicodeString &fixLabel(const UnicodeString ¤t, UnicodeString &temp) if (!current.startsWith(BASE, BASE_LENGTH)) { return current; } - UChar rest = current.charAt(BASE_LENGTH); + char16_t rest = current.charAt(BASE_LENGTH); if (0x2800 < rest && rest <= 0x28FF) { // stroke count int32_t count = rest-0x2800; - temp.setTo((UChar)(0x30 + count % 10)); + temp.setTo((char16_t)(0x30 + count % 10)); if (count >= 10) { count /= 10; - temp.insert(0, (UChar)(0x30 + count % 10)); + temp.insert(0, (char16_t)(0x30 + count % 10)); if (count >= 10) { count /= 10; - temp.insert(0, (UChar)(0x30 + count)); + temp.insert(0, (char16_t)(0x30 + count)); } } - return temp.append((UChar)0x5283); + return temp.append((char16_t)0x5283); } return temp.setTo(current, BASE_LENGTH); } @@ -397,20 +398,20 @@ UBool hasMultiplePrimaryWeights( const UnicodeString &s, UVector64 &ces, UErrorCode &errorCode) { ces.removeAllElements(); coll.internalGetCEs(s, ces, errorCode); - if (U_FAILURE(errorCode)) { return FALSE; } - UBool seenPrimary = FALSE; + if (U_FAILURE(errorCode)) { return false; } + UBool seenPrimary = false; for (int32_t i = 0; i < ces.size(); ++i) { int64_t ce = ces.elementAti(i); uint32_t p = (uint32_t)(ce >> 32); if (p > variableTop) { // not primary ignorable if (seenPrimary) { - return TRUE; + return true; } - seenPrimary = TRUE; + seenPrimary = true; } } - return FALSE; + return false; } } // namespace @@ -420,7 +421,7 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { UVector indexCharacters(errorCode); indexCharacters.setDeleter(uprv_deleteUObject); initLabels(indexCharacters, errorCode); - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } // Variables for hasMultiplePrimaryWeights(). UVector64 ces(errorCode); @@ -430,33 +431,32 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { } else { variableTop = 0; } - UBool hasInvisibleBuckets = FALSE; + UBool hasInvisibleBuckets = false; // Helper arrays for Chinese Pinyin collation. Bucket *asciiBuckets[26] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; Bucket *pinyinBuckets[26] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; - UBool hasPinyin = FALSE; + UBool hasPinyin = false; LocalPointer bucketList(new UVector(errorCode), errorCode); if (U_FAILURE(errorCode)) { - return NULL; + return nullptr; } bucketList->setDeleter(uprv_deleteUObject); // underflow bucket - Bucket *bucket = new Bucket(getUnderflowLabel(), emptyString_, U_ALPHAINDEX_UNDERFLOW); - if (bucket == NULL) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + LocalPointer bucket(new Bucket(getUnderflowLabel(), emptyString_, U_ALPHAINDEX_UNDERFLOW), errorCode); + if (U_FAILURE(errorCode)) { + return nullptr; } - bucketList->addElement(bucket, errorCode); - if (U_FAILURE(errorCode)) { return NULL; } + bucketList->adoptElement(bucket.orphan(), errorCode); + if (U_FAILURE(errorCode)) { return nullptr; } UnicodeString temp; @@ -469,40 +469,36 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { if (collatorPrimaryOnly_->compare(current, *scriptUpperBoundary, errorCode) >= 0) { // We crossed the script boundary into a new script. const UnicodeString &inflowBoundary = *scriptUpperBoundary; - UBool skippedScript = FALSE; + UBool skippedScript = false; for (;;) { scriptUpperBoundary = getString(*firstCharsInScripts_, ++scriptIndex); if (collatorPrimaryOnly_->compare(current, *scriptUpperBoundary, errorCode) < 0) { break; } - skippedScript = TRUE; + skippedScript = true; } if (skippedScript && bucketList->size() > 1) { // We are skipping one or more scripts, // and we are not just getting out of the underflow label. - bucket = new Bucket(getInflowLabel(), inflowBoundary, U_ALPHAINDEX_INFLOW); - if (bucket == NULL) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - bucketList->addElement(bucket, errorCode); + bucket.adoptInsteadAndCheckErrorCode( + new Bucket(getInflowLabel(), inflowBoundary, U_ALPHAINDEX_INFLOW), errorCode); + bucketList->adoptElement(bucket.orphan(), errorCode); + if (U_FAILURE(errorCode)) { return nullptr; } } } // Add a bucket with the current label. - bucket = new Bucket(fixLabel(current, temp), current, U_ALPHAINDEX_NORMAL); - if (bucket == NULL) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - bucketList->addElement(bucket, errorCode); + bucket.adoptInsteadAndCheckErrorCode( + new Bucket(fixLabel(current, temp), current, U_ALPHAINDEX_NORMAL), errorCode); + bucketList->adoptElement(bucket.orphan(), errorCode); + if (U_FAILURE(errorCode)) { return nullptr; } // Remember ASCII and Pinyin buckets for Pinyin redirects. - UChar c; + char16_t c; if (current.length() == 1 && 0x41 <= (c = current.charAt(0)) && c <= 0x5A) { // A-Z - asciiBuckets[c - 0x41] = bucket; + asciiBuckets[c - 0x41] = (Bucket *)bucketList->lastElement(); } else if (current.length() == BASE_LENGTH + 1 && current.startsWith(BASE, BASE_LENGTH) && 0x41 <= (c = current.charAt(BASE_LENGTH)) && c <= 0x5A) { - pinyinBuckets[c - 0x41] = bucket; - hasPinyin = TRUE; + pinyinBuckets[c - 0x41] = (Bucket *)bucketList->lastElement(); + hasPinyin = true; } // Check for multiple primary weights. if (!current.startsWith(BASE, BASE_LENGTH) && @@ -517,7 +513,7 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { // underflow or inflow label. break; } - if (singleBucket->displayBucket_ == NULL && + if (singleBucket->displayBucket_ == nullptr && !hasMultiplePrimaryWeights(*collatorPrimaryOnly_, variableTop, singleBucket->lowerBoundary_, ces, errorCode)) { @@ -525,60 +521,59 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { // to the previous single-character bucket. // For example, after ... Q R S Sch we add Sch\uFFFF->S // and after ... Q R S Sch Sch\uFFFF St we add St\uFFFF->S. - bucket = new Bucket(emptyString_, - UnicodeString(current).append((UChar)0xFFFF), - U_ALPHAINDEX_NORMAL); - if (bucket == NULL) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + bucket.adoptInsteadAndCheckErrorCode(new Bucket(emptyString_, + UnicodeString(current).append((char16_t)0xFFFF), + U_ALPHAINDEX_NORMAL), + errorCode); + if (U_FAILURE(errorCode)) { + return nullptr; } bucket->displayBucket_ = singleBucket; - bucketList->addElement(bucket, errorCode); - hasInvisibleBuckets = TRUE; + bucketList->adoptElement(bucket.orphan(), errorCode); + if (U_FAILURE(errorCode)) { return nullptr; } + hasInvisibleBuckets = true; break; } } } } - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } if (bucketList->size() == 1) { // No real labels, show only the underflow label. BucketList *bl = new BucketList(bucketList.getAlias(), bucketList.getAlias()); - if (bl == NULL) { + if (bl == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } bucketList.orphan(); return bl; } // overflow bucket - bucket = new Bucket(getOverflowLabel(), *scriptUpperBoundary, U_ALPHAINDEX_OVERFLOW); - if (bucket == NULL) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; - } - bucketList->addElement(bucket, errorCode); // final + bucket.adoptInsteadAndCheckErrorCode( + new Bucket(getOverflowLabel(), *scriptUpperBoundary, U_ALPHAINDEX_OVERFLOW), errorCode); + bucketList->adoptElement(bucket.orphan(), errorCode); // final + if (U_FAILURE(errorCode)) { return nullptr; } if (hasPinyin) { // Redirect Pinyin buckets. - Bucket *asciiBucket = NULL; + Bucket *asciiBucket = nullptr; for (int32_t i = 0; i < 26; ++i) { - if (asciiBuckets[i] != NULL) { + if (asciiBuckets[i] != nullptr) { asciiBucket = asciiBuckets[i]; } - if (pinyinBuckets[i] != NULL && asciiBucket != NULL) { + if (pinyinBuckets[i] != nullptr && asciiBucket != nullptr) { pinyinBuckets[i]->displayBucket_ = asciiBucket; - hasInvisibleBuckets = TRUE; + hasInvisibleBuckets = true; } } } - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } if (!hasInvisibleBuckets) { BucketList *bl = new BucketList(bucketList.getAlias(), bucketList.getAlias()); - if (bl == NULL) { + if (bl == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } bucketList.orphan(); return bl; @@ -588,8 +583,8 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { int32_t i = bucketList->size() - 1; Bucket *nextBucket = getBucket(*bucketList, i); while (--i > 0) { - bucket = getBucket(*bucketList, i); - if (bucket->displayBucket_ != NULL) { + Bucket *bucket = getBucket(*bucketList, i); + if (bucket->displayBucket_ != nullptr) { continue; // skip invisible buckets } if (bucket->labelType_ == U_ALPHAINDEX_INFLOW) { @@ -603,21 +598,21 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { LocalPointer publicBucketList(new UVector(errorCode), errorCode); if (U_FAILURE(errorCode)) { - return NULL; + return nullptr; } // Do not call publicBucketList->setDeleter(): // This vector shares its objects with the bucketList. for (int32_t j = 0; j < bucketList->size(); ++j) { - bucket = getBucket(*bucketList, j); - if (bucket->displayBucket_ == NULL) { + Bucket *bucket = getBucket(*bucketList, j); + if (bucket->displayBucket_ == nullptr) { publicBucketList->addElement(bucket, errorCode); } } - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } BucketList *bl = new BucketList(bucketList.getAlias(), publicBucketList.getAlias()); - if (bl == NULL) { + if (bl == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } bucketList.orphan(); publicBucketList.orphan(); @@ -628,11 +623,11 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const { * Creates an index, and buckets and sorts the list of records into the index. */ void AlphabeticIndex::initBuckets(UErrorCode &errorCode) { - if (U_FAILURE(errorCode) || buckets_ != NULL) { + if (U_FAILURE(errorCode) || buckets_ != nullptr) { return; } buckets_ = createBucketList(errorCode); - if (U_FAILURE(errorCode) || inputList_ == NULL || inputList_->isEmpty()) { + if (U_FAILURE(errorCode) || inputList_ == nullptr || inputList_->isEmpty()) { return; } @@ -654,14 +649,14 @@ void AlphabeticIndex::initBuckets(UErrorCode &errorCode) { nextBucket = getBucket(*buckets_->bucketList_, bucketIndex++); upperBoundary = &nextBucket->lowerBoundary_; } else { - nextBucket = NULL; - upperBoundary = NULL; + nextBucket = nullptr; + upperBoundary = nullptr; } for (int32_t i = 0; i < inputList_->size(); ++i) { Record *r = getRecord(*inputList_, i); // if the current bucket isn't the right one, find the one that is // We have a special flag for the last bucket so that we don't look any further - while (upperBoundary != NULL && + while (upperBoundary != nullptr && collatorPrimaryOnly_->compare(r->name_, *upperBoundary, errorCode) >= 0) { currentBucket = nextBucket; // now reset the boundary that we compare against @@ -669,36 +664,36 @@ void AlphabeticIndex::initBuckets(UErrorCode &errorCode) { nextBucket = getBucket(*buckets_->bucketList_, bucketIndex++); upperBoundary = &nextBucket->lowerBoundary_; } else { - upperBoundary = NULL; + upperBoundary = nullptr; } } // now put the record into the bucket. Bucket *bucket = currentBucket; - if (bucket->displayBucket_ != NULL) { + if (bucket->displayBucket_ != nullptr) { bucket = bucket->displayBucket_; } - if (bucket->records_ == NULL) { - bucket->records_ = new UVector(errorCode); - if (bucket->records_ == NULL) { - errorCode = U_MEMORY_ALLOCATION_ERROR; + if (bucket->records_ == nullptr) { + LocalPointer records(new UVector(errorCode), errorCode); + if (U_FAILURE(errorCode)) { return; } + bucket->records_ = records.orphan(); } bucket->records_->addElement(r, errorCode); } } void AlphabeticIndex::clearBuckets() { - if (buckets_ != NULL) { + if (buckets_ != nullptr) { delete buckets_; - buckets_ = NULL; + buckets_ = nullptr; internalResetBucketIterator(); } } void AlphabeticIndex::internalResetBucketIterator() { labelsIterIndex_ = -1; - currentBucket_ = NULL; + currentBucket_ = nullptr; } @@ -741,7 +736,7 @@ void AlphabeticIndex::addIndexExemplars(const Locale &locale, UErrorCode &status // the base is 0 mod 8. UnicodeSet ethiopic(UnicodeString(u"[ሀለሐመሠረሰሸቀቈቐቘበቨተቸኀኈነኘአከኰኸዀወዐዘዠየደዸጀገጐጘጠጨጰጸፀፈፐፘ]"), status); ethiopic.retainAll(exemplars); - exemplars.remove(u'\x1200', 0x137F).addAll(ethiopic); + exemplars.remove(u'ሀ', 0x137F).addAll(ethiopic); } // Upper-case any that aren't already so. @@ -759,27 +754,27 @@ void AlphabeticIndex::addIndexExemplars(const Locale &locale, UErrorCode &status UBool AlphabeticIndex::addChineseIndexCharacters(UErrorCode &errorCode) { UnicodeSet contractions; collatorPrimaryOnly_->internalAddContractions(BASE[0], contractions, errorCode); - if (U_FAILURE(errorCode) || contractions.isEmpty()) { return FALSE; } + if (U_FAILURE(errorCode) || contractions.isEmpty()) { return false; } initialLabels_->addAll(contractions); UnicodeSetIterator iter(contractions); while (iter.next()) { const UnicodeString &s = iter.getString(); U_ASSERT (s.startsWith(BASE, BASE_LENGTH)); - UChar c = s.charAt(s.length() - 1); + char16_t c = s.charAt(s.length() - 1); if (0x41 <= c && c <= 0x5A) { // A-Z // There are Pinyin labels, add ASCII A-Z labels as well. initialLabels_->add(0x41, 0x5A); // A-Z break; } } - return TRUE; + return true; } /* * Return the string with interspersed CGJs. Input must have more than 2 codepoints. */ -static const UChar alphaindex_CGJ = 0x034F; +static const char16_t CGJ = 0x034F; UnicodeString AlphabeticIndex::separated(const UnicodeString &item) { UnicodeString result; if (item.length() == 0) { @@ -793,19 +788,19 @@ UnicodeString AlphabeticIndex::separated(const UnicodeString &item) { if (i >= item.length()) { break; } - result.append(alphaindex_CGJ); + result.append(CGJ); } return result; } bool AlphabeticIndex::operator==(const AlphabeticIndex& /* other */) const { - return FALSE; + return false; } bool AlphabeticIndex::operator!=(const AlphabeticIndex& /* other */) const { - return FALSE; + return false; } @@ -874,40 +869,40 @@ AlphabeticIndex &AlphabeticIndex::setMaxLabelCount(int32_t maxLabelCount, UError void AlphabeticIndex::init(const Locale *locale, UErrorCode &status) { if (U_FAILURE(status)) { return; } - if (locale == NULL && collator_ == NULL) { + if (locale == nullptr && collator_ == nullptr) { status = U_ILLEGAL_ARGUMENT_ERROR; return; } initialLabels_ = new UnicodeSet(); - if (initialLabels_ == NULL) { + if (initialLabels_ == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } - inflowLabel_.setTo((UChar)0x2026); // Ellipsis + inflowLabel_.setTo((char16_t)0x2026); // Ellipsis overflowLabel_ = inflowLabel_; underflowLabel_ = inflowLabel_; - if (collator_ == NULL) { + if (collator_ == nullptr) { Collator *coll = Collator::createInstance(*locale, status); if (U_FAILURE(status)) { delete coll; return; } - if (coll == NULL) { + if (coll == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } collator_ = dynamic_cast(coll); - if (collator_ == NULL) { + if (collator_ == nullptr) { delete coll; status = U_UNSUPPORTED_ERROR; return; } } collatorPrimaryOnly_ = collator_->clone(); - if (collatorPrimaryOnly_ == NULL) { + if (collatorPrimaryOnly_ == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -935,7 +930,7 @@ void AlphabeticIndex::init(const Locale *locale, UErrorCode &status) { // Chinese index characters, which are specific to each of the several Chinese tailorings, // take precedence over the single locale data exemplar set per language. - if (!addChineseIndexCharacters(status) && locale != NULL) { + if (!addChineseIndexCharacters(status) && locale != nullptr) { addIndexExemplars(*locale, status); } } @@ -952,13 +947,13 @@ collatorComparator(const void *context, const void *left, const void *right) { const UnicodeString *rightString = static_cast(rightElement->pointer); if (leftString == rightString) { - // Catches case where both are NULL + // Catches case where both are nullptr return 0; } - if (leftString == NULL) { + if (leftString == nullptr) { return 1; } - if (rightString == NULL) { + if (rightString == nullptr) { return -1; } const Collator *col = static_cast(context); @@ -982,11 +977,11 @@ recordCompareFn(const void *context, const void *left, const void *right) { UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } LocalPointer dest(new UVector(status), status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } dest->setDeleter(uprv_deleteUObject); // Fetch the script-first-primary contractions which are defined in the root collator. @@ -994,11 +989,11 @@ UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) { UnicodeSet set; collatorPrimaryOnly_->internalAddContractions(0xFDD1, set, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } if (set.isEmpty()) { status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } UnicodeSetIterator iter(set); while (iter.next()) { @@ -1010,12 +1005,11 @@ UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) { // and the one for unassigned implicit weights (Cn). continue; } - UnicodeString *s = new UnicodeString(boundary); - if (s == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + LocalPointer s(new UnicodeString(boundary), status); + dest->adoptElement(s.orphan(), status); + if (U_FAILURE(status)) { + return nullptr; } - dest->addElement(s, status); } return dest.orphan(); } @@ -1034,7 +1028,7 @@ UBool isOneLabelBetterThanOther(const Normalizer2 &nfkdNormalizer, UErrorCode status = U_ZERO_ERROR; UnicodeString n1 = nfkdNormalizer.normalize(one, status); UnicodeString n2 = nfkdNormalizer.normalize(other, status); - if (U_FAILURE(status)) { return FALSE; } + if (U_FAILURE(status)) { return false; } int32_t result = n1.countChar32() - n2.countChar32(); if (result != 0) { return result < 0; @@ -1065,31 +1059,30 @@ AlphabeticIndex & AlphabeticIndex::addRecord(const UnicodeString &name, const vo if (U_FAILURE(status)) { return *this; } - if (inputList_ == NULL) { - inputList_ = new UVector(status); - if (inputList_ == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; + if (inputList_ == nullptr) { + LocalPointer inputList(new UVector(status), status); + if (U_FAILURE(status)) { return *this; } + inputList_ = inputList.orphan(); inputList_->setDeleter(alphaIndex_deleteRecord); } - Record *r = new Record(name, data); - if (r == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; + LocalPointer r(new Record(name, data), status); + inputList_->adoptElement(r.orphan(), status); + if (U_FAILURE(status)) { return *this; } - inputList_->addElement(r, status); clearBuckets(); //std::string ss; //std::string ss2; - //std::cout << "added record: name = \"" << r->name_.toUTF8String(ss) << "\"" << + //std::cout << "added record: name = \"" << r->name_.toUTF8String(ss) << "\"" << // " sortingName = \"" << r->sortingName_.toUTF8String(ss2) << "\"" << std::endl; return *this; } AlphabeticIndex &AlphabeticIndex::clearRecords(UErrorCode &status) { - if (U_SUCCESS(status) && inputList_ != NULL && !inputList_->isEmpty()) { + if (U_SUCCESS(status) && inputList_ != nullptr && !inputList_->isEmpty()) { inputList_->removeAllElements(); clearBuckets(); } @@ -1112,28 +1105,28 @@ int32_t AlphabeticIndex::getBucketIndex() const { UBool AlphabeticIndex::nextBucket(UErrorCode &status) { if (U_FAILURE(status)) { - return FALSE; + return false; } - if (buckets_ == NULL && currentBucket_ != NULL) { + if (buckets_ == nullptr && currentBucket_ != nullptr) { status = U_ENUM_OUT_OF_SYNC_ERROR; - return FALSE; + return false; } initBuckets(status); if (U_FAILURE(status)) { - return FALSE; + return false; } ++labelsIterIndex_; if (labelsIterIndex_ >= buckets_->getBucketCount()) { labelsIterIndex_ = buckets_->getBucketCount(); - return FALSE; + return false; } currentBucket_ = getBucket(*buckets_->immutableVisibleList_, labelsIterIndex_); resetRecordIterator(); - return TRUE; + return true; } const UnicodeString &AlphabeticIndex::getBucketLabel() const { - if (currentBucket_ != NULL) { + if (currentBucket_ != nullptr) { return currentBucket_->label_; } else { return emptyString_; @@ -1142,7 +1135,7 @@ const UnicodeString &AlphabeticIndex::getBucketLabel() const { UAlphabeticIndexLabelType AlphabeticIndex::getBucketLabelType() const { - if (currentBucket_ != NULL) { + if (currentBucket_ != nullptr) { return currentBucket_->labelType_; } else { return U_ALPHAINDEX_NORMAL; @@ -1151,7 +1144,7 @@ UAlphabeticIndexLabelType AlphabeticIndex::getBucketLabelType() const { int32_t AlphabeticIndex::getBucketRecordCount() const { - if (currentBucket_ != NULL && currentBucket_->records_ != NULL) { + if (currentBucket_ != nullptr && currentBucket_->records_ != nullptr) { return currentBucket_->records_->size(); } else { return 0; @@ -1170,33 +1163,33 @@ AlphabeticIndex &AlphabeticIndex::resetBucketIterator(UErrorCode &status) { UBool AlphabeticIndex::nextRecord(UErrorCode &status) { if (U_FAILURE(status)) { - return FALSE; + return false; } - if (currentBucket_ == NULL) { + if (currentBucket_ == nullptr) { // We are trying to iterate over the items in a bucket, but there is no // current bucket from the enumeration of buckets. status = U_INVALID_STATE_ERROR; - return FALSE; + return false; } - if (buckets_ == NULL) { + if (buckets_ == nullptr) { status = U_ENUM_OUT_OF_SYNC_ERROR; - return FALSE; + return false; } - if (currentBucket_->records_ == NULL) { - return FALSE; + if (currentBucket_->records_ == nullptr) { + return false; } ++itemsIterIndex_; if (itemsIterIndex_ >= currentBucket_->records_->size()) { itemsIterIndex_ = currentBucket_->records_->size(); - return FALSE; + return false; } - return TRUE; + return true; } const UnicodeString &AlphabeticIndex::getRecordName() const { const UnicodeString *retStr = &emptyString_; - if (currentBucket_ != NULL && currentBucket_->records_ != NULL && + if (currentBucket_ != nullptr && currentBucket_->records_ != nullptr && itemsIterIndex_ >= 0 && itemsIterIndex_ < currentBucket_->records_->size()) { Record *item = static_cast(currentBucket_->records_->elementAt(itemsIterIndex_)); @@ -1206,8 +1199,8 @@ const UnicodeString &AlphabeticIndex::getRecordName() const { } const void *AlphabeticIndex::getRecordData() const { - const void *retPtr = NULL; - if (currentBucket_ != NULL && currentBucket_->records_ != NULL && + const void *retPtr = nullptr; + if (currentBucket_ != nullptr && currentBucket_->records_ != nullptr && itemsIterIndex_ >= 0 && itemsIterIndex_ < currentBucket_->records_->size()) { Record *item = static_cast(currentBucket_->records_->elementAt(itemsIterIndex_)); @@ -1228,8 +1221,8 @@ AlphabeticIndex::Bucket::Bucket(const UnicodeString &label, const UnicodeString &lowerBoundary, UAlphabeticIndexLabelType type) : label_(label), lowerBoundary_(lowerBoundary), labelType_(type), - displayBucket_(NULL), displayIndex_(-1), - records_(NULL) { + displayBucket_(nullptr), displayIndex_(-1), + records_(nullptr) { } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/anytrans.h b/src/duckdb/extension/icu/third_party/icu/i18n/anytrans.h index 627dee3c8..9aa7eef2c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/anytrans.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/anytrans.h @@ -66,18 +66,18 @@ class AnyTransliterator : public Transliterator { /** * Transliterator API. */ - virtual AnyTransliterator* clone() const; + virtual AnyTransliterator* clone() const override; /** * Implements {@link Transliterator#handleTransliterate}. */ virtual void handleTransliterate(Replaceable& text, UTransPosition& index, - UBool incremental) const; + UBool incremental) const override; /** * ICU "poor man's RTTI", returns a UClassID for the actual class. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; /** * ICU "poor man's RTTI", returns a UClassID for this class. @@ -107,7 +107,7 @@ class AnyTransliterator : public Transliterator { /** * Returns a transliterator from the given source to our target or - * target/variant. Returns NULL if the source is the same as our + * target/variant. Returns nullptr if the source is the same as our * target script, or if the source is USCRIPT_INVALID_CODE. * Caches the result and returns the same transliterator the next * time. The caller does NOT own the result and must not delete diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/astro.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/astro.cpp index 22c861ffe..575efeb17 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/astro.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/astro.cpp @@ -21,42 +21,42 @@ #include "putilimp.h" #include // for toString() -#if defined (PI) +#if defined (PI) #undef PI #endif #ifdef U_DEBUG_ASTRO -// # include "uresimp.h" // for debugging - -// static void debug_astro_loc(const char *f, int32_t l) -// { -// fprintf(stderr, "%s:%d: ", f, l); -// } - -// static void debug_astro_msg(const char *pat, ...) -// { -// va_list ap; -// va_start(ap, pat); -// vfprintf(stderr, pat, ap); -// fflush(stderr); -// } -// #include "unicode/datefmt.h" -// #include "unicode/ustring.h" -// static const char * debug_astro_date(UDate d) { -// static char gStrBuf[1024]; -// static DateFormat *df = NULL; -// if(df == NULL) { -// df = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS()); -// df->adoptTimeZone(TimeZone::getGMT()->clone()); -// } -// UnicodeString str; -// df->format(d,str); -// u_austrncpy(gStrBuf,str.getTerminatedBuffer(),sizeof(gStrBuf)-1); -// return gStrBuf; -// } - -// // must use double parens, i.e.: U_DEBUG_ASTRO_MSG(("four is: %d",4)); -// #define U_DEBUG_ASTRO_MSG(x) {debug_astro_loc(__FILE__,__LINE__);debug_astro_msg x;} +# include "uresimp.h" // for debugging + +static void debug_astro_loc(const char *f, int32_t l) +{ + fprintf(stderr, "%s:%d: ", f, l); +} + +static void debug_astro_msg(const char *pat, ...) +{ + va_list ap; + va_start(ap, pat); + vfprintf(stderr, pat, ap); + fflush(stderr); +} +#include "unicode/datefmt.h" +#include "unicode/ustring.h" +static const char * debug_astro_date(UDate d) { + static char gStrBuf[1024]; + static DateFormat *df = nullptr; + if(df == nullptr) { + df = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS()); + df->adoptTimeZone(TimeZone::getGMT()->clone()); + } + UnicodeString str; + df->format(d,str); + u_austrncpy(gStrBuf,str.getTerminatedBuffer(),sizeof(gStrBuf)-1); + return gStrBuf; +} + +// must use double parens, i.e.: U_DEBUG_ASTRO_MSG(("four is: %d",4)); +#define U_DEBUG_ASTRO_MSG(x) {debug_astro_loc(__FILE__,__LINE__);debug_astro_msg x;} #else #define U_DEBUG_ASTRO_MSG(x) #endif @@ -68,8 +68,8 @@ static inline UBool isINVALID(double d) { static icu::UMutex ccLock; U_CDECL_BEGIN -static UBool calendar_astro_cleanup(void) { - return TRUE; +static UBool calendar_astro_cleanup() { + return true; } U_CDECL_END @@ -242,7 +242,7 @@ inline static double normPI(double angle) { * @deprecated ICU 2.4. This class may be removed or modified. */ CalendarAstronomer::CalendarAstronomer(): - fTime(Calendar::getNow()), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(FALSE) { + fTime(Calendar::getNow()), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(false) { clearCache(); } @@ -252,7 +252,7 @@ CalendarAstronomer::CalendarAstronomer(): * @internal * @deprecated ICU 2.4. This class may be removed or modified. */ -CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(FALSE) { +CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0), moonPosition(0,0), moonPositionSet(false) { clearCache(); } @@ -272,7 +272,7 @@ CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d), fLongitude(0.0), fLat * @deprecated ICU 2.4. This class may be removed or modified. */ CalendarAstronomer::CalendarAstronomer(double longitude, double latitude) : - fTime(Calendar::getNow()), moonPosition(0,0), moonPositionSet(FALSE) { + fTime(Calendar::getNow()), moonPosition(0,0), moonPositionSet(false) { fLongitude = normPI(longitude * (double)DEG_RAD); fLatitude = normPI(latitude * (double)DEG_RAD); fGmtOffset = (double)(fLongitude * 24. * (double)HOUR_MS / (double)CalendarAstronomer_PI2); @@ -379,7 +379,7 @@ double CalendarAstronomer::getJulianCentury() { */ double CalendarAstronomer::getGreenwichSidereal() { if (isINVALID(siderealTime)) { - // See page 86 of "Practial Astronomy with your Calculator", + // See page 86 of "Practical Astronomy with your Calculator", // by Peter Duffet-Smith, for details on the algorithm. double UT = normalize(fTime/(double)HOUR_MS, 24.); @@ -460,7 +460,7 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(Calenda */ CalendarAstronomer::Equatorial& CalendarAstronomer::eclipticToEquatorial(CalendarAstronomer::Equatorial& result, double eclipLong, double eclipLat) { - // See page 42 of "Practial Astronomy with your Calculator", + // See page 42 of "Practical Astronomy with your Calculator", // by Peter Duffet-Smith, for details on the algorithm. double obliq = eclipticObliquity(); @@ -623,7 +623,7 @@ static double trueAnomaly(double meanAnomaly, double eccentricity) */ double CalendarAstronomer::getSunLongitude() { - // See page 86 of "Practial Astronomy with your Calculator", + // See page 86 of "Practical Astronomy with your Calculator", // by Peter Duffet-Smith, for details on the algorithm. if (isINVALID(sunLongitude)) { @@ -637,7 +637,7 @@ double CalendarAstronomer::getSunLongitude() */ /*public*/ void CalendarAstronomer::getSunLongitude(double jDay, double &longitude, double &meanAnomaly) { - // See page 86 of "Practial Astronomy with your Calculator", + // See page 86 of "Practical Astronomy with your Calculator", // by Peter Duffet-Smith, for details on the algorithm. double day = jDay - JD_EPOCH; // Days since epoch @@ -723,7 +723,7 @@ CalendarAstronomer::AngleFunc::~AngleFunc() {} class SunTimeAngleFunc : public CalendarAstronomer::AngleFunc { public: virtual ~SunTimeAngleFunc(); - virtual double eval(CalendarAstronomer& a) { return a.getSunLongitude(); } + virtual double eval(CalendarAstronomer& a) override { return a.getSunLongitude(); } }; SunTimeAngleFunc::~SunTimeAngleFunc() {} @@ -743,7 +743,7 @@ CalendarAstronomer::CoordFunc::~CoordFunc() {} class RiseSetCoordFunc : public CalendarAstronomer::CoordFunc { public: virtual ~RiseSetCoordFunc(); - virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { a.getSunPosition(result); } + virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer& a) override { a.getSunPosition(result); } }; RiseSetCoordFunc::~RiseSetCoordFunc() {} @@ -1066,10 +1066,10 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise) const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition() { // - // See page 142 of "Practial Astronomy with your Calculator", + // See page 142 of "Practical Astronomy with your Calculator", // by Peter Duffet-Smith, for details on the algorithm. // - if (moonPositionSet == FALSE) { + if (moonPositionSet == false) { // Calculate the solar longitude. Has the side effect of // filling in "meanAnomalySun" as well. getSunLongitude(); @@ -1138,7 +1138,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition() double moonEclipLat = ::asin(y * ::sin(moonI)); eclipticToEquatorial(moonPosition, moonEclipLong, moonEclipLat); - moonPositionSet = TRUE; + moonPositionSet = true; } return moonPosition; } @@ -1154,7 +1154,7 @@ const CalendarAstronomer::Equatorial& CalendarAstronomer::getMoonPosition() * @deprecated ICU 2.4. This class may be removed or modified. */ double CalendarAstronomer::getMoonAge() { - // See page 147 of "Practial Astronomy with your Calculator", + // See page 147 of "Practical Astronomy with your Calculator", // by Peter Duffet-Smith, for details on the algorithm. // // Force the moon's position to be calculated. We're going to use @@ -1181,7 +1181,7 @@ double CalendarAstronomer::getMoonAge() { * @deprecated ICU 2.4. This class may be removed or modified. */ double CalendarAstronomer::getMoonPhase() { - // See page 147 of "Practial Astronomy with your Calculator", + // See page 147 of "Practical Astronomy with your Calculator", // by Peter Duffet-Smith, for details on the algorithm. return 0.5 * (1 - cos(getMoonAge())); } @@ -1225,7 +1225,7 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::FULL_MOON() { class MoonTimeAngleFunc : public CalendarAstronomer::AngleFunc { public: virtual ~MoonTimeAngleFunc(); - virtual double eval(CalendarAstronomer&a) { return a.getMoonAge(); } + virtual double eval(CalendarAstronomer& a) override { return a.getMoonAge(); } }; MoonTimeAngleFunc::~MoonTimeAngleFunc() {} @@ -1239,8 +1239,8 @@ MoonTimeAngleFunc::~MoonTimeAngleFunc() {} * longitude will have the desired value. *

    * @param desired The desired longitude. - * @param next true if the next occurrance of the phase - * is desired, false for the previous occurrance. + * @param next true if the next occurrence of the phase + * is desired, false for the previous occurrence. * @internal * @deprecated ICU 2.4. This class may be removed or modified. */ @@ -1259,8 +1259,8 @@ UDate CalendarAstronomer::getMoonTime(double desired, UBool next) * desired phase. *

    * @param desired The desired phase of the moon. - * @param next true if the next occurrance of the phase - * is desired, false for the previous occurrance. + * @param next true if the next occurrence of the phase + * is desired, false for the previous occurrence. * @internal * @deprecated ICU 2.4. This class may be removed or modified. */ @@ -1271,7 +1271,7 @@ UDate CalendarAstronomer::getMoonTime(const CalendarAstronomer::MoonAge& desired class MoonRiseSetCoordFunc : public CalendarAstronomer::CoordFunc { public: virtual ~MoonRiseSetCoordFunc(); - virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { result = a.getMoonPosition(); } + virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer& a) override { result = a.getMoonPosition(); } }; MoonRiseSetCoordFunc::~MoonRiseSetCoordFunc() {} @@ -1446,7 +1446,7 @@ void CalendarAstronomer::clearCache() { eclipObliquity = INVALID; siderealTime = INVALID; siderealT0 = INVALID; - moonPositionSet = FALSE; + moonPositionSet = false; } //private static void out(String s) { @@ -1471,7 +1471,7 @@ void CalendarAstronomer::clearCache() { int32_t rawOffset; int32_t dstOffset; UErrorCode status = U_ZERO_ERROR; - tz->getOffset(localMillis, TRUE, rawOffset, dstOffset, status); + tz->getOffset(localMillis, true, rawOffset, dstOffset, status); delete tz; return localMillis - rawOffset; }*/ @@ -1481,7 +1481,7 @@ UnicodeString CalendarAstronomer::Ecliptic::toString() const { #ifdef U_DEBUG_ASTRO char tmp[800]; - sprintf(tmp, "[%.5f,%.5f]", longitude*RAD_DEG, latitude*RAD_DEG); + snprintf(tmp, sizeof(tmp), "[%.5f,%.5f]", longitude*RAD_DEG, latitude*RAD_DEG); return UnicodeString(tmp, ""); #else return UnicodeString(); @@ -1492,7 +1492,7 @@ UnicodeString CalendarAstronomer::Equatorial::toString() const { #ifdef U_DEBUG_ASTRO char tmp[400]; - sprintf(tmp, "%f,%f", + snprintf(tmp, sizeof(tmp), "%f,%f", (ascension*RAD_DEG), (declination*RAD_DEG)); return UnicodeString(tmp, ""); #else @@ -1504,7 +1504,7 @@ UnicodeString CalendarAstronomer::Horizon::toString() const { #ifdef U_DEBUG_ASTRO char tmp[800]; - sprintf(tmp, "[%.5f,%.5f]", altitude*RAD_DEG, azimuth*RAD_DEG); + snprintf(tmp, sizeof(tmp), "[%.5f,%.5f]", altitude*RAD_DEG, azimuth*RAD_DEG); return UnicodeString(tmp, ""); #else return UnicodeString(); @@ -1532,13 +1532,13 @@ UnicodeString CalendarAstronomer::Horizon::toString() const void CalendarCache::createCache(CalendarCache** cache, UErrorCode& status) { ucln_i18n_registerCleanup(UCLN_I18N_ASTRO_CALENDAR, calendar_astro_cleanup); - if(cache == NULL) { + if(cache == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } else { *cache = new CalendarCache(32, status); if(U_FAILURE(status)) { delete *cache; - *cache = NULL; + *cache = nullptr; } } } @@ -1551,7 +1551,7 @@ int32_t CalendarCache::get(CalendarCache** cache, int32_t key, UErrorCode &statu } umtx_lock(&ccLock); - if(*cache == NULL) { + if(*cache == nullptr) { createCache(cache, status); if(U_FAILURE(status)) { umtx_unlock(&ccLock); @@ -1572,7 +1572,7 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro } umtx_lock(&ccLock); - if(*cache == NULL) { + if(*cache == nullptr) { createCache(cache, status); if(U_FAILURE(status)) { umtx_unlock(&ccLock); @@ -1587,12 +1587,12 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro } CalendarCache::CalendarCache(int32_t size, UErrorCode &status) { - fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, size, &status); + fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, nullptr, size, &status); U_DEBUG_ASTRO_MSG(("%p: Opening.\n", fTable)); } CalendarCache::~CalendarCache() { - if(fTable != NULL) { + if(fTable != nullptr) { U_DEBUG_ASTRO_MSG(("%p: Closing.\n", fTable)); uhash_close(fTable); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/astro.h b/src/duckdb/extension/icu/third_party/icu/i18n/astro.h index a24648900..372a79ac6 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/astro.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/astro.h @@ -626,8 +626,8 @@ class U_I18N_API CalendarAstronomer : public UMemory { * longitude will have the desired value. *

    * @param desired The desired longitude. - * @param next true if the next occurrance of the phase - * is desired, false for the previous occurrance. + * @param next true if the next occurrence of the phase + * is desired, false for the previous occurrence. * @internal */ UDate getMoonTime(double desired, UBool next); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/basictz.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/basictz.cpp index 4ad55f47b..2490fadcc 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/basictz.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/basictz.cpp @@ -39,59 +39,59 @@ UBool BasicTimeZone::hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UDate end, UBool ignoreDstAmount, UErrorCode& status) const { if (U_FAILURE(status)) { - return FALSE; + return false; } if (hasSameRules(tz)) { - return TRUE; + return true; } // Check the offsets at the start time int32_t raw1, raw2, dst1, dst2; - getOffset(start, FALSE, raw1, dst1, status); + getOffset(start, false, raw1, dst1, status); if (U_FAILURE(status)) { - return FALSE; + return false; } - tz.getOffset(start, FALSE, raw2, dst2, status); + tz.getOffset(start, false, raw2, dst2, status); if (U_FAILURE(status)) { - return FALSE; + return false; } if (ignoreDstAmount) { if ((raw1 + dst1 != raw2 + dst2) || (dst1 != 0 && dst2 == 0) || (dst1 == 0 && dst2 != 0)) { - return FALSE; + return false; } } else { if (raw1 != raw2 || dst1 != dst2) { - return FALSE; - } + return false; + } } // Check transitions in the range UDate time = start; TimeZoneTransition tr1, tr2; - while (TRUE) { - UBool avail1 = getNextTransition(time, FALSE, tr1); - UBool avail2 = tz.getNextTransition(time, FALSE, tr2); + while (true) { + UBool avail1 = getNextTransition(time, false, tr1); + UBool avail2 = tz.getNextTransition(time, false, tr2); if (ignoreDstAmount) { // Skip a transition which only differ the amount of DST savings - while (TRUE) { + while (true) { if (avail1 && tr1.getTime() <= end && (tr1.getFrom()->getRawOffset() + tr1.getFrom()->getDSTSavings() == tr1.getTo()->getRawOffset() + tr1.getTo()->getDSTSavings()) && (tr1.getFrom()->getDSTSavings() != 0 && tr1.getTo()->getDSTSavings() != 0)) { - getNextTransition(tr1.getTime(), FALSE, tr1); + getNextTransition(tr1.getTime(), false, tr1); } else { break; } } - while (TRUE) { + while (true) { if (avail2 && tr2.getTime() <= end && (tr2.getFrom()->getRawOffset() + tr2.getFrom()->getDSTSavings() == tr2.getTo()->getRawOffset() + tr2.getTo()->getDSTSavings()) && (tr2.getFrom()->getDSTSavings() != 0 && tr2.getTo()->getDSTSavings() != 0)) { - tz.getNextTransition(tr2.getTime(), FALSE, tr2); + tz.getNextTransition(tr2.getTime(), false, tr2); } else { break; } @@ -105,49 +105,49 @@ BasicTimeZone::hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UD break; } if (!inRange1 || !inRange2) { - return FALSE; + return false; } if (tr1.getTime() != tr2.getTime()) { - return FALSE; + return false; } if (ignoreDstAmount) { if (tr1.getTo()->getRawOffset() + tr1.getTo()->getDSTSavings() != tr2.getTo()->getRawOffset() + tr2.getTo()->getDSTSavings() || (tr1.getTo()->getDSTSavings() != 0 && tr2.getTo()->getDSTSavings() == 0) || (tr1.getTo()->getDSTSavings() == 0 && tr2.getTo()->getDSTSavings() != 0)) { - return FALSE; + return false; } } else { if (tr1.getTo()->getRawOffset() != tr2.getTo()->getRawOffset() || tr1.getTo()->getDSTSavings() != tr2.getTo()->getDSTSavings()) { - return FALSE; + return false; } } time = tr1.getTime(); } - return TRUE; + return true; } void BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const { - initial = NULL; - std = NULL; - dst = NULL; + initial = nullptr; + std = nullptr; + dst = nullptr; if (U_FAILURE(status)) { return; } int32_t initialRaw, initialDst; UnicodeString initialName; - AnnualTimeZoneRule *ar1 = NULL; - AnnualTimeZoneRule *ar2 = NULL; + AnnualTimeZoneRule *ar1 = nullptr; + AnnualTimeZoneRule *ar2 = nullptr; UnicodeString name; UBool avail; TimeZoneTransition tr; // Get the next transition - avail = getNextTransition(date, FALSE, tr); + avail = getNextTransition(date, false, tr); if (avail) { tr.getFrom()->getName(initialName); initialRaw = tr.getFrom()->getRawOffset(); @@ -159,7 +159,7 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, if (((tr.getFrom()->getDSTSavings() == 0 && tr.getTo()->getDSTSavings() != 0) || (tr.getFrom()->getDSTSavings() != 0 && tr.getTo()->getDSTSavings() == 0)) && (date + MILLIS_PER_YEAR > nextTransitionTime)) { - + int32_t year, month, dom, dow, doy, mid; UDate d; @@ -182,7 +182,7 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, if (tr.getTo()->getRawOffset() == initialRaw) { // Get the next next transition - avail = getNextTransition(nextTransitionTime, FALSE, tr); + avail = getNextTransition(nextTransitionTime, false, tr); if (avail) { // Check if the next next transition is either DST->STD or STD->DST // and within roughly 1 year from the next transition @@ -201,20 +201,20 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, dtr, year - 1, AnnualTimeZoneRule::MAX_YEAR); // Make sure this rule can be applied to the specified date - avail = ar2->getPreviousStart(date, tr.getFrom()->getRawOffset(), tr.getFrom()->getDSTSavings(), TRUE, d); + avail = ar2->getPreviousStart(date, tr.getFrom()->getRawOffset(), tr.getFrom()->getDSTSavings(), true, d); if (!avail || d > date || initialRaw != tr.getTo()->getRawOffset() || initialDst != tr.getTo()->getDSTSavings()) { // We cannot use this rule as the second transition rule delete ar2; - ar2 = NULL; + ar2 = nullptr; } } } } - if (ar2 == NULL) { + if (ar2 == nullptr) { // Try previous transition - avail = getPreviousTransition(date, TRUE, tr); + avail = getPreviousTransition(date, true, tr); if (avail) { // Check if the previous transition is either DST->STD or STD->DST. // The actual transition time does not matter here. @@ -234,19 +234,19 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, dtr, ar1->getStartYear() - 1, AnnualTimeZoneRule::MAX_YEAR); // Check if this rule start after the first rule after the specified date - avail = ar2->getNextStart(date, tr.getFrom()->getRawOffset(), tr.getFrom()->getDSTSavings(), FALSE, d); + avail = ar2->getNextStart(date, tr.getFrom()->getRawOffset(), tr.getFrom()->getDSTSavings(), false, d); if (!avail || d <= nextTransitionTime) { // We cannot use this rule as the second transition rule delete ar2; - ar2 = NULL; + ar2 = nullptr; } } } } - if (ar2 == NULL) { + if (ar2 == nullptr) { // Cannot find a good pair of AnnualTimeZoneRule delete ar1; - ar1 = NULL; + ar1 = nullptr; } else { // The initial rule should represent the rule before the previous transition ar1->getName(initialName); @@ -257,14 +257,14 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, } else { // Try the previous one - avail = getPreviousTransition(date, TRUE, tr); + avail = getPreviousTransition(date, true, tr); if (avail) { tr.getTo()->getName(initialName); initialRaw = tr.getTo()->getRawOffset(); initialDst = tr.getTo()->getDSTSavings(); } else { // No transitions in the past. Just use the current offsets - getOffset(date, FALSE, initialRaw, initialDst, status); + getOffset(date, false, initialRaw, initialDst, status); if (U_FAILURE(status)) { return; } @@ -274,7 +274,7 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, initial = new InitialTimeZoneRule(initialName, initialRaw, initialDst); // Set the standard and daylight saving rules - if (ar1 != NULL && ar2 != NULL) { + if (ar1 != nullptr && ar2 != nullptr) { if (ar1->getDSTSavings() != 0) { dst = ar1; std = ar2; @@ -293,95 +293,101 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, } const InitialTimeZoneRule *orgini; - const TimeZoneRule **orgtrs = NULL; TimeZoneTransition tzt; - UBool avail; - UVector *orgRules = NULL; + bool avail; int32_t ruleCount; - TimeZoneRule *r = NULL; - UBool *done = NULL; - InitialTimeZoneRule *res_initial = NULL; - UVector *filteredRules = NULL; + TimeZoneRule *r = nullptr; UnicodeString name; int32_t i; UDate time, t; - UDate *newTimes = NULL; UDate firstStart; - UBool bFinalStd = FALSE, bFinalDst = FALSE; + UBool bFinalStd = false, bFinalDst = false; + + initial = nullptr; + transitionRules = nullptr; // Original transition rules ruleCount = countTransitionRules(status); if (U_FAILURE(status)) { return; } - orgRules = new UVector(ruleCount, status); + LocalPointer orgRules( + new UVector(uprv_deleteUObject, nullptr, ruleCount, status), status); if (U_FAILURE(status)) { return; } - orgtrs = (const TimeZoneRule**)uprv_malloc(sizeof(TimeZoneRule*)*ruleCount); - if (orgtrs == NULL) { + LocalMemory orgtrs( + static_cast(uprv_malloc(sizeof(TimeZoneRule*)*ruleCount))); + if (orgtrs.isNull()) { status = U_MEMORY_ALLOCATION_ERROR; - goto error; + return; } - getTimeZoneRules(orgini, orgtrs, ruleCount, status); + getTimeZoneRules(orgini, &orgtrs[0], ruleCount, status); if (U_FAILURE(status)) { - goto error; + return; } for (i = 0; i < ruleCount; i++) { - orgRules->addElement(orgtrs[i]->clone(), status); + LocalPointer lpRule(orgtrs[i]->clone(), status); + orgRules->adoptElement(lpRule.orphan(), status); if (U_FAILURE(status)) { - goto error; + return; } } - uprv_free(orgtrs); - orgtrs = NULL; - avail = getPreviousTransition(start, TRUE, tzt); + avail = getPreviousTransition(start, true, tzt); if (!avail) { // No need to filter out rules only applicable to time before the start initial = orgini->clone(); - transitionRules = orgRules; + if (initial == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + transitionRules = orgRules.orphan(); return; } - done = (UBool*)uprv_malloc(sizeof(UBool)*ruleCount); - if (done == NULL) { + LocalMemory done(static_cast(uprv_malloc(sizeof(bool)*ruleCount))); + if (done.isNull()) { status = U_MEMORY_ALLOCATION_ERROR; - goto error; + return; } - filteredRules = new UVector(status); + LocalPointer filteredRules( + new UVector(uprv_deleteUObject, nullptr, status), status); if (U_FAILURE(status)) { - goto error; + return; } // Create initial rule tzt.getTo()->getName(name); - res_initial = new InitialTimeZoneRule(name, tzt.getTo()->getRawOffset(), - tzt.getTo()->getDSTSavings()); + LocalPointer res_initial( + new InitialTimeZoneRule(name, tzt.getTo()->getRawOffset(), tzt.getTo()->getDSTSavings()), status); + if (U_FAILURE(status)) { + return; + } // Mark rules which does not need to be processed for (i = 0; i < ruleCount; i++) { r = (TimeZoneRule*)orgRules->elementAt(i); - avail = r->getNextStart(start, res_initial->getRawOffset(), res_initial->getDSTSavings(), FALSE, time); + avail = r->getNextStart(start, res_initial->getRawOffset(), res_initial->getDSTSavings(), false, time); done[i] = !avail; } time = start; while (!bFinalStd || !bFinalDst) { - avail = getNextTransition(time, FALSE, tzt); + avail = getNextTransition(time, false, tzt); if (!avail) { break; } UDate updatedTime = tzt.getTime(); if (updatedTime == time) { // Can get here if rules for start & end of daylight time have exactly - // the same time. + // the same time. // TODO: fix getNextTransition() to prevent it? status = U_INVALID_STATE_ERROR; - goto error; + return; } time = updatedTime; - + const TimeZoneRule *toRule = tzt.getTo(); for (i = 0; i < ruleCount; i++) { r = (TimeZoneRule*)orgRules->elementAt(i); @@ -392,23 +398,23 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, if (i >= ruleCount) { // This case should never happen status = U_INVALID_STATE_ERROR; - goto error; + return; } if (done[i]) { continue; } const TimeArrayTimeZoneRule *tar = dynamic_cast(toRule); const AnnualTimeZoneRule *ar; - if (tar != NULL) { + if (tar != nullptr) { // Get the previous raw offset and DST savings before the very first start time TimeZoneTransition tzt0; t = start; - while (TRUE) { - avail = getNextTransition(t, FALSE, tzt0); + while (true) { + avail = getNextTransition(t, false, tzt0); if (!avail) { break; } - if (*tar == *(tzt0.getTo())) { + if (*(tzt0.getTo()) == *tar) { break; } t = tzt0.getTime(); @@ -418,12 +424,13 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, tar->getFirstStart(tzt.getFrom()->getRawOffset(), tzt.getFrom()->getDSTSavings(), firstStart); if (firstStart > start) { // Just add the rule as is - filteredRules->addElement(tar->clone(), status); + LocalPointer lpTar(tar->clone(), status); + filteredRules->adoptElement(lpTar.orphan(), status); if (U_FAILURE(status)) { - goto error; + return; } } else { - // Colllect transitions after the start time + // Collect transitions after the start time int32_t startTimes; DateTimeRule::TimeRuleType timeType; int32_t idx; @@ -442,39 +449,37 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, break; } } + if (U_FAILURE(status)) { + return; + } int32_t asize = startTimes - idx; if (asize > 0) { - newTimes = (UDate*)uprv_malloc(sizeof(UDate) * asize); - if (newTimes == NULL) { + LocalMemory newTimes(static_cast(uprv_malloc(sizeof(UDate) * asize))); + if (newTimes.isNull()) { status = U_MEMORY_ALLOCATION_ERROR; - goto error; + return; } for (int32_t newidx = 0; newidx < asize; newidx++) { tar->getStartTimeAt(idx + newidx, newTimes[newidx]); - if (U_FAILURE(status)) { - uprv_free(newTimes); - newTimes = NULL; - goto error; - } } tar->getName(name); - TimeArrayTimeZoneRule *newTar = new TimeArrayTimeZoneRule(name, - tar->getRawOffset(), tar->getDSTSavings(), newTimes, asize, timeType); - uprv_free(newTimes); - filteredRules->addElement(newTar, status); + LocalPointer newTar(new TimeArrayTimeZoneRule( + name, tar->getRawOffset(), tar->getDSTSavings(), &newTimes[0], asize, timeType), status); + filteredRules->adoptElement(newTar.orphan(), status); if (U_FAILURE(status)) { - goto error; + return; } } } } - } else if ((ar = dynamic_cast(toRule)) != NULL) { + } else if ((ar = dynamic_cast(toRule)) != nullptr) { ar->getFirstStart(tzt.getFrom()->getRawOffset(), tzt.getFrom()->getDSTSavings(), firstStart); if (firstStart == tzt.getTime()) { // Just add the rule as is - filteredRules->addElement(ar->clone(), status); + LocalPointer arClone(ar->clone(), status); + filteredRules->adoptElement(arClone.orphan(), status); if (U_FAILURE(status)) { - goto error; + return; } } else { // Calculate the transition year @@ -482,11 +487,11 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, Grego::timeToFields(tzt.getTime(), year, month, dom, dow, doy, mid); // Re-create the rule ar->getName(name); - AnnualTimeZoneRule *newAr = new AnnualTimeZoneRule(name, ar->getRawOffset(), ar->getDSTSavings(), - *(ar->getRule()), year, ar->getEndYear()); - filteredRules->addElement(newAr, status); + LocalPointer newAr(new AnnualTimeZoneRule(name, ar->getRawOffset(), ar->getDSTSavings(), + *(ar->getRule()), year, ar->getEndYear()), status); + filteredRules->adoptElement(newAr.orphan(), status); if (U_FAILURE(status)) { - goto error; + return; } } // check if this is a final rule @@ -494,67 +499,39 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, // After bot final standard and dst rules are processed, // exit this while loop. if (ar->getDSTSavings() == 0) { - bFinalStd = TRUE; + bFinalStd = true; } else { - bFinalDst = TRUE; + bFinalDst = true; } } } - done[i] = TRUE; + done[i] = true; } // Set the results - if (orgRules != NULL) { - while (!orgRules->isEmpty()) { - r = (TimeZoneRule*)orgRules->orphanElementAt(0); - delete r; - } - delete orgRules; - } - if (done != NULL) { - uprv_free(done); - } - - initial = res_initial; - transitionRules = filteredRules; + initial = res_initial.orphan(); + transitionRules = filteredRules.orphan(); return; - -error: - if (orgtrs != NULL) { - uprv_free(orgtrs); - } - if (orgRules != NULL) { - while (!orgRules->isEmpty()) { - r = (TimeZoneRule*)orgRules->orphanElementAt(0); - delete r; - } - delete orgRules; - } - if (done != NULL) { - if (filteredRules != NULL) { - while (!filteredRules->isEmpty()) { - r = (TimeZoneRule*)filteredRules->orphanElementAt(0); - delete r; - } - delete filteredRules; - } - delete res_initial; - uprv_free(done); - } - - initial = NULL; - transitionRules = NULL; } void -BasicTimeZone::getOffsetFromLocal(UDate /*date*/, int32_t /*nonExistingTimeOpt*/, int32_t /*duplicatedTimeOpt*/, - int32_t& /*rawOffset*/, int32_t& /*dstOffset*/, UErrorCode& status) const { +BasicTimeZone::getOffsetFromLocal(UDate /*date*/, UTimeZoneLocalOption /*nonExistingTimeOpt*/, + UTimeZoneLocalOption /*duplicatedTimeOpt*/, + int32_t& /*rawOffset*/, int32_t& /*dstOffset*/, + UErrorCode& status) const { if (U_FAILURE(status)) { return; } status = U_UNSUPPORTED_ERROR; } +void BasicTimeZone::getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, + int32_t& rawOffset, int32_t& dstOffset, + UErrorCode& status) const { + getOffsetFromLocal(date, (UTimeZoneLocalOption)nonExistingTimeOpt, + (UTimeZoneLocalOption)duplicatedTimeOpt, rawOffset, dstOffset, status); +} + U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/bocsu.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/bocsu.cpp index 861a76a04..585415643 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/bocsu.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/bocsu.cpp @@ -98,7 +98,7 @@ u_writeDiff(int32_t diff, uint8_t *p) { * NFD text - there are never Hangul characters included. */ U_CFUNC UChar32 -u_writeIdenticalLevelRun(UChar32 prev, const UChar *s, int32_t length, icu::ByteSink &sink) { +u_writeIdenticalLevelRun(UChar32 prev, const char16_t *s, int32_t length, icu::ByteSink &sink) { char scratch[64]; int32_t capacity; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/brktrans.h b/src/duckdb/extension/icu/third_party/icu/i18n/brktrans.h index db3d5cf22..5dcc8c50c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/brktrans.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/brktrans.h @@ -1,104 +1,104 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2008-2015, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 05/11/2008 Andy Heninger Ported from Java -// ********************************************************************** -// */ -// #ifndef BRKTRANS_H -// #define BRKTRANS_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION - -// #include "unicode/translit.h" - -// #include "unicode/localpointer.h" - - -// U_NAMESPACE_BEGIN - -// class UVector32; - -// /** -// * A transliterator that pInserts the specified characters at word breaks. -// * To restrict it to particular characters, use a filter. -// * TODO: this is an internal class, and only temporary. -// * Remove it once we have \b notation in Transliterator. -// */ -// class BreakTransliterator : public Transliterator { -// public: - -// /** -// * Constructs a transliterator. -// * @param adoptedFilter the filter for this transliterator. -// */ -// BreakTransliterator(UnicodeFilter* adoptedFilter = 0); - -// /** -// * Destructor. -// */ -// virtual ~BreakTransliterator(); - -// /** -// * Copy constructor. -// */ -// BreakTransliterator(const BreakTransliterator&); - -// /** -// * Transliterator API. -// * @return A copy of the object. -// */ -// virtual BreakTransliterator* clone() const; - -// virtual const UnicodeString &getInsertion() const; - -// virtual void setInsertion(const UnicodeString &insertion); - -// /** -// * ICU "poor man's RTTI", returns a UClassID for the actual class. -// */ -// virtual UClassID getDynamicClassID() const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for this class. -// */ -// U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); - -// protected: - -// /** -// * Implements {@link Transliterator#handleTransliterate}. -// * @param text the buffer holding transliterated and -// * untransliterated text -// * @param offset the start and limit of the text, the position -// * of the cursor, and the start and limit of transliteration. -// * @param incremental if true, assume more text may be coming after -// * pos.contextLimit. Otherwise, assume the text is complete. -// */ -// virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, -// UBool isIncremental) const; - -// private: -// LocalPointer cachedBI; -// LocalPointer cachedBoundaries; -// UnicodeString fInsertion; - -// static UnicodeString replaceableAsString(Replaceable &r); - -// /** -// * Assignment operator. -// */ -// BreakTransliterator& operator=(const BreakTransliterator&); -// }; - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2008-2015, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 05/11/2008 Andy Heninger Ported from Java +********************************************************************** +*/ +#ifndef BRKTRANS_H +#define BRKTRANS_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/translit.h" + +#include "unicode/localpointer.h" + + +U_NAMESPACE_BEGIN + +class UVector32; + +/** + * A transliterator that pInserts the specified characters at word breaks. + * To restrict it to particular characters, use a filter. + * TODO: this is an internal class, and only temporary. + * Remove it once we have \b notation in Transliterator. + */ +class BreakTransliterator : public Transliterator { +public: + + /** + * Constructs a transliterator. + * @param adoptedFilter the filter for this transliterator. + */ + BreakTransliterator(UnicodeFilter* adoptedFilter = 0); + + /** + * Destructor. + */ + virtual ~BreakTransliterator(); + + /** + * Copy constructor. + */ + BreakTransliterator(const BreakTransliterator&); + + /** + * Transliterator API. + * @return A copy of the object. + */ + virtual BreakTransliterator* clone() const override; + + virtual const UnicodeString &getInsertion() const; + + virtual void setInsertion(const UnicodeString &insertion); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + + protected: + + /** + * Implements {@link Transliterator#handleTransliterate}. + * @param text the buffer holding transliterated and + * untransliterated text + * @param offset the start and limit of the text, the position + * of the cursor, and the start and limit of transliteration. + * @param incremental if true, assume more text may be coming after + * pos.contextLimit. Otherwise, assume the text is complete. + */ + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, + UBool isIncremental) const override; + + private: + LocalPointer cachedBI; + LocalPointer cachedBoundaries; + UnicodeString fInsertion; + + static UnicodeString replaceableAsString(Replaceable &r); + + /** + * Assignment operator. + */ + BreakTransliterator& operator=(const BreakTransliterator&); +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.cpp index db0db1609..dc14af00b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.cpp @@ -30,7 +30,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(BuddhistCalendar) static const int32_t kBuddhistEraStart = -543; // 544 BC (Gregorian) -static const int32_t buddhcal_kGregorianEpoch = 1970; // used as the default value of EXTENDED_YEAR +static const int32_t kGregorianEpoch = 1970; // used as the default value of EXTENDED_YEAR BuddhistCalendar::BuddhistCalendar(const Locale& aLocale, UErrorCode& success) : GregorianCalendar(aLocale, success) @@ -69,22 +69,15 @@ int32_t BuddhistCalendar::handleGetExtendedYear() // The default value of EXTENDED_YEAR is 1970 (Buddhist 2513) int32_t year; if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR) { - year = internalGet(UCAL_EXTENDED_YEAR, buddhcal_kGregorianEpoch); + year = internalGet(UCAL_EXTENDED_YEAR, kGregorianEpoch); } else { - // extended year is a gregorian year, where 1 = 1AD, 0 = 1BC, -1 = 2BC, etc - year = internalGet(UCAL_YEAR, buddhcal_kGregorianEpoch - kBuddhistEraStart) + // extended year is a gregorian year, where 1 = 1AD, 0 = 1BC, -1 = 2BC, etc + year = internalGet(UCAL_YEAR, kGregorianEpoch - kBuddhistEraStart) + kBuddhistEraStart; } return year; } -int32_t BuddhistCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, - - UBool useMonth) const -{ - return GregorianCalendar::handleComputeMonthStart(eyear, month, useMonth); -} - void BuddhistCalendar::handleComputeFields(int32_t julianDay, UErrorCode& status) { GregorianCalendar::handleComputeFields(julianDay, status); @@ -131,18 +124,18 @@ void BuddhistCalendar::timeToFields(UDate theTime, UBool quick, UErrorCode& stat * the first time it is used. Once the system default century date and year * are set, they do not change. */ -static UDate buddhcal_gSystemDefaultCenturyStart = DBL_MIN; -static int32_t buddhcal_gSystemDefaultCenturyStartYear = -1; -static icu::UInitOnce gBCInitOnce = U_INITONCE_INITIALIZER; +static UDate gSystemDefaultCenturyStart = DBL_MIN; +static int32_t gSystemDefaultCenturyStartYear = -1; +static icu::UInitOnce gBCInitOnce {}; UBool BuddhistCalendar::haveDefaultCentury() const { - return TRUE; + return true; } static void U_CALLCONV -initializeBuddhCalSystemDefaultCentury() +initializeSystemDefaultCentury() { // initialize systemDefaultCentury and systemDefaultCenturyYear based // on the current time. They'll be set to 80 years before @@ -154,8 +147,8 @@ initializeBuddhCalSystemDefaultCentury() calendar.add(UCAL_YEAR, -80, status); UDate newStart = calendar.getTime(status); int32_t newYear = calendar.get(UCAL_YEAR, status); - buddhcal_gSystemDefaultCenturyStartYear = newYear; - buddhcal_gSystemDefaultCenturyStart = newStart; + gSystemDefaultCenturyStartYear = newYear; + gSystemDefaultCenturyStart = newStart; } // We have no recourse upon failure unless we want to propagate the failure // out. @@ -164,15 +157,15 @@ initializeBuddhCalSystemDefaultCentury() UDate BuddhistCalendar::defaultCenturyStart() const { // lazy-evaluate systemDefaultCenturyStart and systemDefaultCenturyStartYear - umtx_initOnce(gBCInitOnce, &initializeBuddhCalSystemDefaultCentury); - return buddhcal_gSystemDefaultCenturyStart; + umtx_initOnce(gBCInitOnce, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStart; } int32_t BuddhistCalendar::defaultCenturyStartYear() const { - // lazy-evaluate systemDefaultCenturyStartYear and systemDefaultCenturyStart - umtx_initOnce(gBCInitOnce, &initializeBuddhCalSystemDefaultCentury); - return buddhcal_gSystemDefaultCenturyStartYear; + // lazy-evaluate systemDefaultCenturyStartYear and systemDefaultCenturyStart + umtx_initOnce(gBCInitOnce, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStartYear; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.h b/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.h index 0ad0886df..01b59341c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.h @@ -94,7 +94,7 @@ class BuddhistCalendar : public GregorianCalendar { * @return return a polymorphic copy of this calendar. * @internal */ - virtual BuddhistCalendar* clone() const; + virtual BuddhistCalendar* clone() const override; public: /** @@ -107,7 +107,7 @@ class BuddhistCalendar : public GregorianCalendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -120,7 +120,7 @@ class BuddhistCalendar : public GregorianCalendar { * @return The class ID for all objects of this class. * @internal */ - U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); /** * return the calendar type, "buddhist". @@ -128,7 +128,7 @@ class BuddhistCalendar : public GregorianCalendar { * @return calendar type * @internal */ - virtual const char * getType() const; + virtual const char * getType() const override; private: BuddhistCalendar(); // default constructor not implemented @@ -142,13 +142,13 @@ class BuddhistCalendar : public GregorianCalendar { * @return the extended year * @internal */ - virtual int32_t handleGetExtendedYear(); + virtual int32_t handleGetExtendedYear() override; /** * Subclasses may override this method to compute several fields * specific to each calendar system. * @internal */ - virtual void handleComputeFields(int32_t julianDay, UErrorCode& status); + virtual void handleComputeFields(int32_t julianDay, UErrorCode& status) override; /** * Subclass API for defining limits of different types. * @param field one of the field numbers @@ -156,41 +156,26 @@ class BuddhistCalendar : public GregorianCalendar { * LEAST_MAXIMUM, or MAXIMUM * @internal */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; - /** - * Return the Julian day number of day before the first day of the - * given month in the given extended year. Subclasses should override - * this method to implement their calendar system. - * @param eyear the extended year - * @param month the zero-based month, or 0 if useMonth is false - * @param useMonth if false, compute the day before the first day of - * the given year, otherwise, compute the day before the first day of - * the given month - * @param return the Julian day number of the day before the first - * day of the given month and year - * @internal - */ - virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, - UBool useMonth) const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; /** - * Returns TRUE because the Buddhist Calendar does have a default century + * Returns true because the Buddhist Calendar does have a default century * @internal */ - virtual UBool haveDefaultCentury() const; + virtual UBool haveDefaultCentury() const override; /** * Returns the date of the start of the default century * @return start of century - in milliseconds since epoch, 1970 * @internal */ - virtual UDate defaultCenturyStart() const; + virtual UDate defaultCenturyStart() const override; /** * Returns the year in which the default century begins * @internal */ - virtual int32_t defaultCenturyStartYear() const; + virtual int32_t defaultCenturyStartYear() const override; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp index 6ab481d42..4b6edc87c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp @@ -22,7 +22,7 @@ * 07/28/98 stephen Sync up with JDK 1.2 * 09/02/98 stephen Sync with JDK 1.2 8/31 build (getActualMin/Max) * 03/17/99 stephen Changed adoptTimeZone() - now fAreFieldsSet is -* set to FALSE to force update of time. +* set to false to force update of time. ******************************************************************************* */ @@ -45,6 +45,7 @@ #include "hebrwcal.h" #include "persncal.h" #include "indiancal.h" +#include "iso8601cal.h" #include "chnsecal.h" #include "coptccal.h" #include "dangical.h" @@ -62,22 +63,24 @@ #include "sharedcalendar.h" #include "unifiedcache.h" #include "ulocimp.h" +#include "bytesinkutil.h" +#include "charstr.h" #if !UCONFIG_NO_SERVICE -static icu::ICULocaleService* gService = NULL; -static icu::UInitOnce gServiceInitOnce = U_INITONCE_INITIALIZER; +static icu::ICULocaleService* gService = nullptr; +static icu::UInitOnce gServiceInitOnce {}; // INTERNAL - for cleanup U_CDECL_BEGIN -static UBool calendar_cleanup(void) { +static UBool calendar_cleanup() { #if !UCONFIG_NO_SERVICE if (gService) { delete gService; - gService = NULL; + gService = nullptr; } gServiceInitOnce.reset(); #endif - return TRUE; + return true; } U_CDECL_END #endif @@ -99,7 +102,7 @@ U_CDECL_END * CPPFLAGS+=-I$(top_srcdir)/tools/toolutil * LIBS+=$(LIBICUTOOLUTIL) */ -// #include "udbgutil.h" +#include "udbgutil.h" #include /** @@ -175,7 +178,7 @@ static const char * const gCalTypes[] = { "islamic-umalqura", "islamic-tbla", "islamic-rgsa", - NULL + nullptr }; // Must be in the order of gCalTypes above @@ -210,22 +213,25 @@ SharedCalendar::~SharedCalendar() { template<> U_I18N_API const SharedCalendar *LocaleCacheKey::createObject( const void * /*unusedCreationContext*/, UErrorCode &status) const { + if (U_FAILURE(status)) { + return nullptr; + } Calendar *calendar = Calendar::makeInstance(fLoc, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } SharedCalendar *shared = new SharedCalendar(calendar); - if (shared == NULL) { + if (shared == nullptr) { delete calendar; status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } shared->addRef(); return shared; } static ECalType getCalendarType(const char *s) { - for (int i = 0; gCalTypes[i] != NULL; i++) { + for (int i = 0; gCalTypes[i] != nullptr; i++) { if (uprv_stricmp(s, gCalTypes[i]) == 0) { return (ECalType)i; } @@ -237,52 +243,38 @@ static ECalType getCalendarType(const char *s) { // Only used with service registration. static UBool isStandardSupportedKeyword(const char *keyword, UErrorCode& status) { if(U_FAILURE(status)) { - return FALSE; + return false; } ECalType calType = getCalendarType(keyword); return (calType != CALTYPE_UNKNOWN); } -// only used with service registration. -static void getCalendarKeyword(const UnicodeString &id, char *targetBuffer, int32_t targetBufferSize) { - UnicodeString calendarKeyword = UNICODE_STRING_SIMPLE("calendar="); - int32_t calKeyLen = calendarKeyword.length(); - int32_t keyLen = 0; - - int32_t keywordIdx = id.indexOf((UChar)0x003D); /* '=' */ - if (id[0] == 0x40/*'@'*/ - && id.compareBetween(1, keywordIdx+1, calendarKeyword, 0, calKeyLen) == 0) - { - keyLen = id.extract(keywordIdx+1, id.length(), targetBuffer, targetBufferSize, US_INV); - } - targetBuffer[keyLen] = 0; -} #endif static ECalType getCalendarTypeForLocale(const char *locid) { UErrorCode status = U_ZERO_ERROR; ECalType calType = CALTYPE_UNKNOWN; - //TODO: ULOC_FULL_NAME is out of date and too small.. - char canonicalName[256]; - - // canonicalize, so grandfathered variant will be transformed to keywords + // Canonicalize, so that an old-style variant will be transformed to keywords. // e.g ja_JP_TRADITIONAL -> ja_JP@calendar=japanese // NOTE: Since ICU-20187, ja_JP_TRADITIONAL no longer canonicalizes, and // the Gregorian calendar is returned instead. - int32_t canonicalLen = uloc_canonicalize(locid, canonicalName, sizeof(canonicalName) - 1, &status); + CharString canonicalName; + { + CharStringByteSink sink(&canonicalName); + ulocimp_canonicalize(locid, sink, &status); + } if (U_FAILURE(status)) { return CALTYPE_GREGORIAN; } - canonicalName[canonicalLen] = 0; // terminate - - char calTypeBuf[32]; - int32_t calTypeBufLen; - calTypeBufLen = uloc_getKeywordValue(canonicalName, "calendar", calTypeBuf, sizeof(calTypeBuf) - 1, &status); + CharString calTypeBuf; + { + CharStringByteSink sink(&calTypeBuf); + ulocimp_getKeywordValue(canonicalName.data(), "calendar", sink, &status); + } if (U_SUCCESS(status)) { - calTypeBuf[calTypeBufLen] = 0; - calType = getCalendarType(calTypeBuf); + calType = getCalendarType(calTypeBuf.data()); if (calType != CALTYPE_UNKNOWN) { return calType; } @@ -292,30 +284,27 @@ static ECalType getCalendarTypeForLocale(const char *locid) { // when calendar keyword is not available or not supported, read supplementalData // to get the default calendar type for the locale's region char region[ULOC_COUNTRY_CAPACITY]; - (void)ulocimp_getRegionForSupplementalData(canonicalName, TRUE, region, sizeof(region), &status); + (void)ulocimp_getRegionForSupplementalData(canonicalName.data(), true, region, sizeof(region), &status); if (U_FAILURE(status)) { return CALTYPE_GREGORIAN; } // Read preferred calendar values from supplementalData calendarPreference - UResourceBundle *rb = ures_openDirect(NULL, "supplementalData", &status); + UResourceBundle *rb = ures_openDirect(nullptr, "supplementalData", &status); ures_getByKey(rb, "calendarPreferenceData", rb, &status); - UResourceBundle *order = ures_getByKey(rb, region, NULL, &status); - if (status == U_MISSING_RESOURCE_ERROR && rb != NULL) { + UResourceBundle *order = ures_getByKey(rb, region, nullptr, &status); + if (status == U_MISSING_RESOURCE_ERROR && rb != nullptr) { status = U_ZERO_ERROR; - order = ures_getByKey(rb, "001", NULL, &status); + order = ures_getByKey(rb, "001", nullptr, &status); } - calTypeBuf[0] = 0; - if (U_SUCCESS(status) && order != NULL) { - // the first calender type is the default for the region + calTypeBuf.clear(); + if (U_SUCCESS(status) && order != nullptr) { + // the first calendar type is the default for the region int32_t len = 0; - const UChar *uCalType = ures_getStringByIndex(order, 0, &len, &status); - if (len < (int32_t)sizeof(calTypeBuf)) { - u_UCharsToChars(uCalType, calTypeBuf, len); - *(calTypeBuf + len) = 0; // terminate; - calType = getCalendarType(calTypeBuf); - } + const char16_t *uCalType = ures_getStringByIndex(order, 0, &len, &status); + calTypeBuf.appendInvariantChars(uCalType, len, status); + calType = getCalendarType(calTypeBuf.data()); } ures_close(order); @@ -351,18 +340,19 @@ static Calendar *createStandardCalendar(ECalType calType, const Locale &loc, UEr cal.adoptInsteadAndCheckErrorCode(new PersianCalendar(loc, status), status); break; case CALTYPE_ISLAMIC_TBLA: - cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::TBLA), status); + cal.adoptInsteadAndCheckErrorCode(new IslamicTBLACalendar(loc, status), status); break; case CALTYPE_ISLAMIC_CIVIL: - cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::CIVIL), status); + cal.adoptInsteadAndCheckErrorCode(new IslamicCivilCalendar(loc, status), status); break; case CALTYPE_ISLAMIC_RGSA: - // default any region specific not handled individually to islamic + cal.adoptInsteadAndCheckErrorCode(new IslamicRGSACalendar(loc, status), status); + break; case CALTYPE_ISLAMIC: - cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::ASTRONOMICAL), status); + cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status), status); break; case CALTYPE_ISLAMIC_UMALQURA: - cal.adoptInsteadAndCheckErrorCode(new IslamicCalendar(loc, status, IslamicCalendar::UMALQURA), status); + cal.adoptInsteadAndCheckErrorCode(new IslamicUmalquraCalendar(loc, status), status); break; case CALTYPE_HEBREW: cal.adoptInsteadAndCheckErrorCode(new HebrewCalendar(loc, status), status); @@ -377,17 +367,13 @@ static Calendar *createStandardCalendar(ECalType calType, const Locale &loc, UEr cal.adoptInsteadAndCheckErrorCode(new CopticCalendar(loc, status), status); break; case CALTYPE_ETHIOPIC: - cal.adoptInsteadAndCheckErrorCode(new EthiopicCalendar(loc, status, EthiopicCalendar::AMETE_MIHRET_ERA), status); + cal.adoptInsteadAndCheckErrorCode(new EthiopicCalendar(loc, status), status); break; case CALTYPE_ETHIOPIC_AMETE_ALEM: - cal.adoptInsteadAndCheckErrorCode(new EthiopicCalendar(loc, status, EthiopicCalendar::AMETE_ALEM_ERA), status); + cal.adoptInsteadAndCheckErrorCode(new EthiopicAmeteAlemCalendar(loc, status), status); break; case CALTYPE_ISO8601: - cal.adoptInsteadAndCheckErrorCode(new GregorianCalendar(loc, status), status); - if (cal.isValid()) { - cal->setFirstDayOfWeek(UCAL_MONDAY); - cal->setMinimalDaysInFirstWeek(4); - } + cal.adoptInsteadAndCheckErrorCode(new ISO8601Calendar(loc, status), status); break; case CALTYPE_DANGI: cal.adoptInsteadAndCheckErrorCode(new DangiCalendar(loc, status), status); @@ -420,18 +406,18 @@ class BasicCalendarFactory : public LocaleKeyFactory { protected: //virtual UBool isSupportedID( const UnicodeString& id, UErrorCode& status) const { // if(U_FAILURE(status)) { - // return FALSE; + // return false; // } // char keyword[ULOC_FULLNAME_CAPACITY]; // getCalendarKeyword(id, keyword, (int32_t)sizeof(keyword)); // return isStandardSupportedKeyword(keyword, status); //} - virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const override { if (U_SUCCESS(status)) { - for(int32_t i=0;gCalTypes[i] != NULL;i++) { - UnicodeString id((UChar)0x40); /* '@' a variant character */ + for(int32_t i=0;gCalTypes[i] != nullptr;i++) { + UnicodeString id((char16_t)0x40); /* '@' a variant character */ id.append(UNICODE_STRING_SIMPLE("calendar=")); id.append(UnicodeString(gCalTypes[i], -1, US_INV)); result.put(id, (void*)this, status); @@ -439,24 +425,25 @@ class BasicCalendarFactory : public LocaleKeyFactory { } } - virtual UObject* create(const ICUServiceKey& key, const ICUService* /*service*/, UErrorCode& status) const { + virtual UObject* create(const ICUServiceKey& key, const ICUService* /*service*/, UErrorCode& status) const override { + if (U_FAILURE(status)) { + return nullptr; + } #ifdef U_DEBUG_CALSVC - if(dynamic_cast(&key) == NULL) { + if(dynamic_cast(&key) == nullptr) { fprintf(stderr, "::create - not a LocaleKey!\n"); } #endif - const LocaleKey& lkey = (LocaleKey&)key; + const LocaleKey* lkey = dynamic_cast(&key); + U_ASSERT(lkey != nullptr); Locale curLoc; // current locale Locale canLoc; // Canonical locale - lkey.currentLocale(curLoc); - lkey.canonicalLocale(canLoc); + lkey->currentLocale(curLoc); + lkey->canonicalLocale(canLoc); char keyword[ULOC_FULLNAME_CAPACITY]; - UnicodeString str; - - key.currentID(str); - getCalendarKeyword(str, keyword, (int32_t) sizeof(keyword)); + curLoc.getKeywordValue("calendar", keyword, (int32_t) sizeof(keyword), status); #ifdef U_DEBUG_CALSVC fprintf(stderr, "BasicCalendarFactory::create() - cur %s, can %s\n", (const char*)curLoc.getName(), (const char*)canLoc.getName()); @@ -467,7 +454,7 @@ class BasicCalendarFactory : public LocaleKeyFactory { fprintf(stderr, "BasicCalendarFactory - not handling %s.[%s]\n", (const char*) curLoc.getName(), tmp ); #endif - return NULL; + return nullptr; } return createStandardCalendar(getCalendarType(keyword), canLoc, status); @@ -485,17 +472,21 @@ class DefaultCalendarFactory : public ICUResourceBundleFactory { DefaultCalendarFactory() : ICUResourceBundleFactory() { } virtual ~DefaultCalendarFactory(); protected: - virtual UObject* create(const ICUServiceKey& key, const ICUService* /*service*/, UErrorCode& status) const { + virtual UObject* create(const ICUServiceKey& key, const ICUService* /*service*/, UErrorCode& status) const override { + if (U_FAILURE(status)) { + return nullptr; + } - LocaleKey &lkey = (LocaleKey&)key; + const LocaleKey *lkey = dynamic_cast(&key); + U_ASSERT(lkey != nullptr); Locale loc; - lkey.currentLocale(loc); + lkey->currentLocale(loc); UnicodeString *ret = new UnicodeString(); - if (ret == NULL) { + if (ret == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } else { - ret->append((UChar)0x40); // '@' is a variant character + ret->append((char16_t)0x40); // '@' is a variant character ret->append(UNICODE_STRING("calendar=", 9)); ret->append(UnicodeString(gCalTypes[getCalendarTypeForLocale(loc.getName())], -1, US_INV)); } @@ -517,9 +508,9 @@ class CalendarService : public ICULocaleService { virtual ~CalendarService(); - virtual UObject* cloneInstance(UObject* instance) const { + virtual UObject* cloneInstance(UObject* instance) const override { UnicodeString *s = dynamic_cast(instance); - if(s != NULL) { + if(s != nullptr) { return s->clone(); } else { #ifdef U_DEBUG_CALSVC_F @@ -530,8 +521,11 @@ class CalendarService : public ICULocaleService { } } - virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /*actualID*/, UErrorCode& status) const { - LocaleKey& lkey = (LocaleKey&)key; + virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /*actualID*/, UErrorCode& status) const override { + if (U_FAILURE(status)) { + return nullptr; + } + LocaleKey& lkey = static_cast(const_cast(key)); //int32_t kind = lkey.kind(); Locale loc; @@ -555,7 +549,7 @@ class CalendarService : public ICULocaleService { return nc; } - virtual UBool isDefault() const { + virtual UBool isDefault() const override { return countFactories() == 1; } }; @@ -577,9 +571,12 @@ initCalendarService(UErrorCode &status) #ifdef U_DEBUG_CALSVC fprintf(stderr, "Spinning up Calendar Service\n"); #endif + if (U_FAILURE(status)) { + return; + } ucln_i18n_registerCleanup(UCLN_I18N_CALENDAR, calendar_cleanup); gService = new CalendarService(); - if (gService == NULL) { + if (gService == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -599,7 +596,7 @@ initCalendarService(UErrorCode &status) fprintf(stderr, "err (%s) registering classes, deleting service.....\n", u_errorName(status)); #endif delete gService; - gService = NULL; + gService = nullptr; } } @@ -639,14 +636,15 @@ static const int32_t kCalendarLimits[UCAL_FIELD_COUNT][4] = { { 0, 0, 59, 59 }, // MINUTE { 0, 0, 59, 59 }, // SECOND { 0, 0, 999, 999 }, // MILLISECOND - {-12*kOneHour, -12*kOneHour, 12*kOneHour, 15*kOneHour }, // ZONE_OFFSET - { 0, 0, 1*kOneHour, 1*kOneHour }, // DST_OFFSET + {-24*kOneHour, -16*kOneHour, 12*kOneHour, 30*kOneHour }, // ZONE_OFFSET + { -1*kOneHour, -1*kOneHour, 2*kOneHour, 2*kOneHour }, // DST_OFFSET {/*N/A*/-1, /*N/A*/-1, /*N/A*/-1, /*N/A*/-1}, // YEAR_WOY { 1, 1, 7, 7 }, // DOW_LOCAL {/*N/A*/-1, /*N/A*/-1, /*N/A*/-1, /*N/A*/-1}, // EXTENDED_YEAR { -0x7F000000, -0x7F000000, 0x7F000000, 0x7F000000 }, // JULIAN_DAY { 0, 0, 24*kOneHour-1, 24*kOneHour-1 }, // MILLISECONDS_IN_DAY { 0, 0, 1, 1 }, // IS_LEAP_MONTH + { 0, 0, 11, 11 } // ORDINAL_MONTH }; // Resource bundle tags read by this class @@ -708,14 +706,14 @@ static const char gGregorian[] = "gregorian"; Calendar::Calendar(UErrorCode& success) : UObject(), -fIsTimeSet(FALSE), -fAreFieldsSet(FALSE), -fAreAllFieldsSet(FALSE), -fAreFieldsVirtuallySet(FALSE), +fIsTimeSet(false), +fAreFieldsSet(false), +fAreAllFieldsSet(false), +fAreFieldsVirtuallySet(false), fNextStamp((int32_t)kMinimumUserStamp), fTime(0), -fLenient(TRUE), -fZone(NULL), +fLenient(true), +fZone(nullptr), fRepeatedWallTime(UCAL_WALLTIME_LAST), fSkippedWallTime(UCAL_WALLTIME_LAST) { @@ -726,24 +724,24 @@ fSkippedWallTime(UCAL_WALLTIME_LAST) return; } fZone = TimeZone::createDefault(); - if (fZone == NULL) { + if (fZone == nullptr) { success = U_MEMORY_ALLOCATION_ERROR; } - setWeekData(Locale::getDefault(), NULL, success); + setWeekData(Locale::getDefault(), nullptr, success); } // ------------------------------------- Calendar::Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success) : UObject(), -fIsTimeSet(FALSE), -fAreFieldsSet(FALSE), -fAreAllFieldsSet(FALSE), -fAreFieldsVirtuallySet(FALSE), +fIsTimeSet(false), +fAreFieldsSet(false), +fAreAllFieldsSet(false), +fAreFieldsVirtuallySet(false), fNextStamp((int32_t)kMinimumUserStamp), fTime(0), -fLenient(TRUE), -fZone(NULL), +fLenient(true), +fZone(nullptr), fRepeatedWallTime(UCAL_WALLTIME_LAST), fSkippedWallTime(UCAL_WALLTIME_LAST) { @@ -764,21 +762,21 @@ fSkippedWallTime(UCAL_WALLTIME_LAST) clear(); fZone = zone; - setWeekData(aLocale, NULL, success); + setWeekData(aLocale, nullptr, success); } // ------------------------------------- Calendar::Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success) : UObject(), -fIsTimeSet(FALSE), -fAreFieldsSet(FALSE), -fAreAllFieldsSet(FALSE), -fAreFieldsVirtuallySet(FALSE), +fIsTimeSet(false), +fAreFieldsSet(false), +fAreAllFieldsSet(false), +fAreFieldsVirtuallySet(false), fNextStamp((int32_t)kMinimumUserStamp), fTime(0), -fLenient(TRUE), -fZone(NULL), +fLenient(true), +fZone(nullptr), fRepeatedWallTime(UCAL_WALLTIME_LAST), fSkippedWallTime(UCAL_WALLTIME_LAST) { @@ -789,10 +787,10 @@ fSkippedWallTime(UCAL_WALLTIME_LAST) } clear(); fZone = zone.clone(); - if (fZone == NULL) { + if (fZone == nullptr) { success = U_MEMORY_ALLOCATION_ERROR; } - setWeekData(aLocale, NULL, success); + setWeekData(aLocale, nullptr, success); } // ------------------------------------- @@ -807,7 +805,7 @@ Calendar::~Calendar() Calendar::Calendar(const Calendar &source) : UObject(source) { - fZone = NULL; + fZone = nullptr; *this = source; } @@ -829,8 +827,8 @@ Calendar::operator=(const Calendar &right) fRepeatedWallTime = right.fRepeatedWallTime; fSkippedWallTime = right.fSkippedWallTime; delete fZone; - fZone = NULL; - if (right.fZone != NULL) { + fZone = nullptr; + if (right.fZone != nullptr) { fZone = right.fZone->clone(); } fFirstDayOfWeek = right.fFirstDayOfWeek; @@ -870,7 +868,7 @@ Calendar::createInstance(const TimeZone& zone, UErrorCode& success) Calendar* U_EXPORT2 Calendar::createInstance(const Locale& aLocale, UErrorCode& success) { - return createInstance(TimeZone::createDefault(), aLocale, success); + return createInstance(TimeZone::forLocaleOrDefault(aLocale), aLocale, success); } // ------------------------------------- Adopting @@ -880,11 +878,11 @@ Calendar::createInstance(const Locale& aLocale, UErrorCode& success) Calendar * U_EXPORT2 Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) { if (U_FAILURE(success)) { - return NULL; + return nullptr; } Locale actualLoc; - UObject* u = NULL; + UObject* u = nullptr; #if !UCONFIG_NO_SERVICE if (isCalendarServiceUsed()) { @@ -895,18 +893,18 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) { { u = createStandardCalendar(getCalendarTypeForLocale(aLocale.getName()), aLocale, success); } - Calendar* c = NULL; + Calendar* c = nullptr; if(U_FAILURE(success) || !u) { if(U_SUCCESS(success)) { // Propagate some kind of err success = U_INTERNAL_PROGRAM_ERROR; } - return NULL; + return nullptr; } #if !UCONFIG_NO_SERVICE const UnicodeString* str = dynamic_cast(u); - if(str != NULL) { + if(str != nullptr) { // It's a unicode string telling us what type of calendar to load ("gregorian", etc) // Create a Locale over this string Locale l(""); @@ -918,7 +916,7 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) { Locale actualLoc2; delete u; - u = NULL; + u = nullptr; // Don't overwrite actualLoc, since the actual loc from this call // may be something like "@calendar=gregorian" -- TODO investigate @@ -929,11 +927,11 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) { if(U_SUCCESS(success)) { success = U_INTERNAL_PROGRAM_ERROR; // Propagate some err } - return NULL; + return nullptr; } str = dynamic_cast(c); - if(str != NULL) { + if(str != nullptr) { // recursed! Second lookup returned a UnicodeString. // Perhaps DefaultCalendar{} was set to another locale. #ifdef U_DEBUG_CALSVC @@ -951,14 +949,14 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) { #endif success = U_MISSING_RESOURCE_ERROR; // requested a calendar type which could NOT be found. delete c; - return NULL; + return nullptr; } #ifdef U_DEBUG_CALSVC fprintf(stderr, "%p: setting week count data to locale %s, actual locale %s\n", c, (const char*)aLocale.getName(), (const char *)actualLoc.getName()); #endif - c->setWeekData(aLocale, c->getType(), success); // set the correct locale (this was an indirected calendar) + c->setWeekData(aLocale, c->getType(), success); // set the correct locale (this was an indirect calendar) - char keyword[ULOC_FULLNAME_CAPACITY]; + char keyword[ULOC_FULLNAME_CAPACITY] = ""; UErrorCode tmpStatus = U_ZERO_ERROR; l.getKeywordValue("calendar", keyword, ULOC_FULLNAME_CAPACITY, tmpStatus); if (U_SUCCESS(tmpStatus) && uprv_strcmp(keyword, "iso8601") == 0) { @@ -980,16 +978,16 @@ Calendar* U_EXPORT2 Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& success) { LocalPointer zonePtr(zone); - const SharedCalendar *shared = NULL; + const SharedCalendar *shared = nullptr; UnifiedCache::getByLocale(aLocale, shared, success); if (U_FAILURE(success)) { - return NULL; + return nullptr; } Calendar *c = (*shared)->clone(); shared->removeRef(); - if (c == NULL) { + if (c == nullptr) { success = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } // Now, reset calendar to default state: @@ -1019,7 +1017,7 @@ Calendar::getCalendarTypeFromLocale( char *typeBuffer, int32_t typeBufferSize, UErrorCode &success) { - const SharedCalendar *shared = NULL; + const SharedCalendar *shared = nullptr; UnifiedCache::getByLocale(aLocale, shared, success); if (U_FAILURE(success)) { return; @@ -1103,7 +1101,7 @@ Calendar::getKeywordValuesForLocale(const char* key, commonlyUsed, &status); if (U_FAILURE(status)) { uenum_close(uenum); - return NULL; + return nullptr; } UStringEnumeration* ustringenum = new UStringEnumeration(uenum); if (ustringenum == nullptr) { @@ -1170,16 +1168,19 @@ Calendar::setTimeInMillis( double millis, UErrorCode& status ) { status = U_ILLEGAL_ARGUMENT_ERROR; return; } + } else if (uprv_isNaN(millis)) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; } fTime = millis; - fAreFieldsSet = fAreAllFieldsSet = FALSE; - fIsTimeSet = fAreFieldsVirtuallySet = TRUE; + fAreFieldsSet = fAreAllFieldsSet = false; + fIsTimeSet = fAreFieldsVirtuallySet = true; for (int32_t i=0; i= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } // field values are only computed when actually requested; for more on when computation // of various things happens, see the "data flow in Calendar" description at the top // of this file @@ -1202,6 +1210,9 @@ Calendar::get(UCalendarDateFields field, UErrorCode& status) const void Calendar::set(UCalendarDateFields field, int32_t value) { + if (field < 0 || field >= UCAL_FIELD_COUNT) { + return; + } if (fAreFieldsVirtuallySet) { UErrorCode ec = U_ZERO_ERROR; computeFields(ec); @@ -1212,8 +1223,8 @@ Calendar::set(UCalendarDateFields field, int32_t value) recalculateStamp(); } fStamp[field] = fNextStamp++; - fIsSet[field] = TRUE; // Remove later - fIsTimeSet = fAreFieldsSet = fAreFieldsVirtuallySet = FALSE; + fIsSet[field] = true; // Remove later + fIsTimeSet = fAreFieldsSet = fAreFieldsVirtuallySet = false; } // ------------------------------------- @@ -1252,130 +1263,14 @@ Calendar::set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t m } // ------------------------------------- -// For now the full getRelatedYear implementation is here; -// per #10752 move the non-default implementation to subclasses -// (default implementation will do no year adjustment) - -static int32_t gregoYearFromIslamicStart(int32_t year) { - // ad hoc conversion, improve under #10752 - // rough est for now, ok for grego 1846-2138, - // otherwise occasionally wrong (for 3% of years) - int cycle, offset, shift = 0; - if (year >= 1397) { - cycle = (year - 1397) / 67; - offset = (year - 1397) % 67; - shift = 2*cycle + ((offset >= 33)? 1: 0); - } else { - cycle = (year - 1396) / 67 - 1; - offset = -(year - 1396) % 67; - shift = 2*cycle + ((offset <= 33)? 1: 0); - } - return year + 579 - shift; -} - int32_t Calendar::getRelatedYear(UErrorCode &status) const { - if (U_FAILURE(status)) { - return 0; - } - int32_t year = get(UCAL_EXTENDED_YEAR, status); - if (U_FAILURE(status)) { - return 0; - } - // modify for calendar type - ECalType type = getCalendarType(getType()); - switch (type) { - case CALTYPE_PERSIAN: - year += 622; break; - case CALTYPE_HEBREW: - year -= 3760; break; - case CALTYPE_CHINESE: - year -= 2637; break; - case CALTYPE_INDIAN: - year += 79; break; - case CALTYPE_COPTIC: - year += 284; break; - case CALTYPE_ETHIOPIC: - year += 8; break; - case CALTYPE_ETHIOPIC_AMETE_ALEM: - year -=5492; break; - case CALTYPE_DANGI: - year -= 2333; break; - case CALTYPE_ISLAMIC_CIVIL: - case CALTYPE_ISLAMIC: - case CALTYPE_ISLAMIC_UMALQURA: - case CALTYPE_ISLAMIC_TBLA: - case CALTYPE_ISLAMIC_RGSA: - year = gregoYearFromIslamicStart(year); break; - default: - // CALTYPE_GREGORIAN - // CALTYPE_JAPANESE - // CALTYPE_BUDDHIST - // CALTYPE_ROC - // CALTYPE_ISO8601 - // do nothing, EXTENDED_YEAR same as Gregorian - break; - } - return year; + return get(UCAL_EXTENDED_YEAR, status); } // ------------------------------------- -// For now the full setRelatedYear implementation is here; -// per #10752 move the non-default implementation to subclasses -// (default implementation will do no year adjustment) - -static int32_t firstIslamicStartYearFromGrego(int32_t year) { - // ad hoc conversion, improve under #10752 - // rough est for now, ok for grego 1846-2138, - // otherwise occasionally wrong (for 3% of years) - int cycle, offset, shift = 0; - if (year >= 1977) { - cycle = (year - 1977) / 65; - offset = (year - 1977) % 65; - shift = 2*cycle + ((offset >= 32)? 1: 0); - } else { - cycle = (year - 1976) / 65 - 1; - offset = -(year - 1976) % 65; - shift = 2*cycle + ((offset <= 32)? 1: 0); - } - return year - 579 + shift; -} void Calendar::setRelatedYear(int32_t year) { - // modify for calendar type - ECalType type = getCalendarType(getType()); - switch (type) { - case CALTYPE_PERSIAN: - year -= 622; break; - case CALTYPE_HEBREW: - year += 3760; break; - case CALTYPE_CHINESE: - year += 2637; break; - case CALTYPE_INDIAN: - year -= 79; break; - case CALTYPE_COPTIC: - year -= 284; break; - case CALTYPE_ETHIOPIC: - year -= 8; break; - case CALTYPE_ETHIOPIC_AMETE_ALEM: - year +=5492; break; - case CALTYPE_DANGI: - year += 2333; break; - case CALTYPE_ISLAMIC_CIVIL: - case CALTYPE_ISLAMIC: - case CALTYPE_ISLAMIC_UMALQURA: - case CALTYPE_ISLAMIC_TBLA: - case CALTYPE_ISLAMIC_RGSA: - year = firstIslamicStartYearFromGrego(year); break; - default: - // CALTYPE_GREGORIAN - // CALTYPE_JAPANESE - // CALTYPE_BUDDHIST - // CALTYPE_ROC - // CALTYPE_ISO8601 - // do nothing, EXTENDED_YEAR same as Gregorian - break; - } // set extended year set(UCAL_EXTENDED_YEAR, year); } @@ -1388,9 +1283,9 @@ Calendar::clear() for (int32_t i=0; i= UCAL_FIELD_COUNT) { + return; + } if (fAreFieldsVirtuallySet) { UErrorCode ec = U_ZERO_ERROR; computeFields(ec); } fFields[field] = 0; fStamp[field] = kUnset; - fIsSet[field] = FALSE; // Remove later - fIsTimeSet = fAreFieldsSet = fAreAllFieldsSet = fAreFieldsVirtuallySet = FALSE; + if (field == UCAL_MONTH) { + fFields[UCAL_ORDINAL_MONTH] = 0; + fStamp[UCAL_ORDINAL_MONTH] = kUnset; + fIsSet[UCAL_ORDINAL_MONTH] = false; // Remove later + } + if (field == UCAL_ORDINAL_MONTH) { + fFields[UCAL_MONTH] = 0; + fStamp[UCAL_MONTH] = kUnset; + fIsSet[UCAL_MONTH] = false; // Remove later + } + fIsTimeSet = fAreFieldsSet = fAreAllFieldsSet = fAreFieldsVirtuallySet = false; } // ------------------------------------- @@ -1414,6 +1321,9 @@ Calendar::clear(UCalendarDateFields field) UBool Calendar::isSet(UCalendarDateFields field) const { + if (field < 0 || field >= UCAL_FIELD_COUNT) { + return false; + } return fAreFieldsVirtuallySet || (fStamp[field] != kUnset); } @@ -1435,6 +1345,9 @@ int32_t Calendar::newestStamp(UCalendarDateFields first, UCalendarDateFields las void Calendar::complete(UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } if (!fIsTimeSet) { updateTime(status); /* Test for buffer overflows */ @@ -1448,8 +1361,8 @@ Calendar::complete(UErrorCode& status) if(U_FAILURE(status)) { return; } - fAreFieldsSet = TRUE; - fAreAllFieldsSet = TRUE; + fAreFieldsSet = true; + fAreAllFieldsSet = true; } } @@ -1486,6 +1399,13 @@ Calendar::complete(UErrorCode& status) * @stable ICU 2.0 */ void Calendar::pinField(UCalendarDateFields field, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } int32_t max = getActualMaximum(field, status); int32_t min = getActualMinimum(field, status); @@ -1499,13 +1419,16 @@ void Calendar::pinField(UCalendarDateFields field, UErrorCode& status) { void Calendar::computeFields(UErrorCode &ec) { - if (U_FAILURE(ec)) { + if (U_FAILURE(ec)) { return; } // Compute local wall millis double localMillis = internalGetTime(); int32_t rawOffset, dstOffset; - getTimeZone().getOffset(localMillis, FALSE, rawOffset, dstOffset, ec); + getTimeZone().getOffset(localMillis, false, rawOffset, dstOffset, ec); + if (U_FAILURE(ec)) { + return; + } localMillis += (rawOffset + dstOffset); // Mark fields as set. Do this before calling handleComputeFields(). @@ -1515,15 +1438,16 @@ void Calendar::computeFields(UErrorCode &ec) (1 << UCAL_MONTH) | (1 << UCAL_DAY_OF_MONTH) | // = UCAL_DATE (1 << UCAL_DAY_OF_YEAR) | - (1 << UCAL_EXTENDED_YEAR); + (1 << UCAL_EXTENDED_YEAR) | + (1 << UCAL_ORDINAL_MONTH); for (int32_t i=0; i>= 1; } @@ -1537,7 +1461,8 @@ void Calendar::computeFields(UErrorCode &ec) // JULIAN_DAY field and also removes some inelegant code. - Liu // 11/6/00 - int32_t days = (int32_t)ClockMath::floorDivide(localMillis, (double)kOneDay); + int32_t millisInDay; + int32_t days = ClockMath::floorDivide(localMillis, kOneDay, &millisInDay); internalSet(UCAL_JULIAN_DAY,days + kEpochStartAsJulianDay); @@ -1558,22 +1483,53 @@ void Calendar::computeFields(UErrorCode &ec) // fields computed by handleComputeFields(). computeWeekFields(ec); - // Compute time-related fields. These are indepent of the date and + // Compute time-related fields. These are independent of the date and // of the subclass algorithm. They depend only on the local zone // wall milliseconds in day. - int32_t millisInDay = (int32_t) (localMillis - (days * kOneDay)); + if (U_FAILURE(ec)) { + return; + } + fFields[UCAL_MILLISECONDS_IN_DAY] = millisInDay; + U_ASSERT(getMinimum(UCAL_MILLISECONDS_IN_DAY) <= + fFields[UCAL_MILLISECONDS_IN_DAY]); + U_ASSERT(fFields[UCAL_MILLISECONDS_IN_DAY] <= + getMaximum(UCAL_MILLISECONDS_IN_DAY)); + fFields[UCAL_MILLISECOND] = millisInDay % 1000; + U_ASSERT(getMinimum(UCAL_MILLISECOND) <= fFields[UCAL_MILLISECOND]); + U_ASSERT(fFields[UCAL_MILLISECOND] <= getMaximum(UCAL_MILLISECOND)); + millisInDay /= 1000; fFields[UCAL_SECOND] = millisInDay % 60; + U_ASSERT(getMinimum(UCAL_SECOND) <= fFields[UCAL_SECOND]); + U_ASSERT(fFields[UCAL_SECOND] <= getMaximum(UCAL_SECOND)); + millisInDay /= 60; fFields[UCAL_MINUTE] = millisInDay % 60; + U_ASSERT(getMinimum(UCAL_MINUTE) <= fFields[UCAL_MINUTE]); + U_ASSERT(fFields[UCAL_MINUTE] <= getMaximum(UCAL_MINUTE)); + millisInDay /= 60; fFields[UCAL_HOUR_OF_DAY] = millisInDay; + U_ASSERT(getMinimum(UCAL_HOUR_OF_DAY) <= fFields[UCAL_HOUR_OF_DAY]); + U_ASSERT(fFields[UCAL_HOUR_OF_DAY] <= getMaximum(UCAL_HOUR_OF_DAY)); + fFields[UCAL_AM_PM] = millisInDay / 12; // Assume AM == 0 + U_ASSERT(getMinimum(UCAL_AM_PM) <= fFields[UCAL_AM_PM]); + U_ASSERT(fFields[UCAL_AM_PM] <= getMaximum(UCAL_AM_PM)); + fFields[UCAL_HOUR] = millisInDay % 12; + U_ASSERT(getMinimum(UCAL_HOUR) <= fFields[UCAL_HOUR]); + U_ASSERT(fFields[UCAL_HOUR] <= getMaximum(UCAL_HOUR)); + fFields[UCAL_ZONE_OFFSET] = rawOffset; + U_ASSERT(getMinimum(UCAL_ZONE_OFFSET) <= fFields[UCAL_ZONE_OFFSET]); + U_ASSERT(fFields[UCAL_ZONE_OFFSET] <= getMaximum(UCAL_ZONE_OFFSET)); + fFields[UCAL_DST_OFFSET] = dstOffset; + U_ASSERT(getMinimum(UCAL_DST_OFFSET) <= fFields[UCAL_DST_OFFSET]); + U_ASSERT(fFields[UCAL_DST_OFFSET] <= getMaximum(UCAL_DST_OFFSET)); } uint8_t Calendar::julianDayToDayOfWeek(double julian) @@ -1595,6 +1551,9 @@ uint8_t Calendar::julianDayToDayOfWeek(double julian) void Calendar::computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec) { computeGregorianFields(julianDay, ec); + if (U_FAILURE(ec)) { + return; + } // Compute day of week: JD 0 = Monday int32_t dow = julianDayToDayOfWeek(julianDay); @@ -1616,7 +1575,10 @@ void Calendar::computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec) * subclasses that are Gregorian derivatives. Subclasses may call this * method to perform a Gregorian calendar millis->fields computation. */ -void Calendar::computeGregorianFields(int32_t julianDay, UErrorCode & /* ec */) { +void Calendar::computeGregorianFields(int32_t julianDay, UErrorCode& ec) { + if (U_FAILURE(ec)) { + return; + } int32_t gregorianDayOfWeekUnused; Grego::dayToFields(julianDay - kEpochStartAsJulianDay, fGregorianYear, fGregorianMonth, fGregorianDayOfMonth, gregorianDayOfWeekUnused, fGregorianDayOfYear); } @@ -1699,11 +1661,20 @@ void Calendar::computeWeekFields(UErrorCode &ec) { } fFields[UCAL_WEEK_OF_YEAR] = woy; fFields[UCAL_YEAR_WOY] = yearOfWeekOfYear; + // min/max of years are not constrains for caller, so not assert here. // WEEK_OF_YEAR end int32_t dayOfMonth = fFields[UCAL_DAY_OF_MONTH]; fFields[UCAL_WEEK_OF_MONTH] = weekNumber(dayOfMonth, dayOfWeek); + U_ASSERT(getMinimum(UCAL_WEEK_OF_MONTH) <= fFields[UCAL_WEEK_OF_MONTH]); + U_ASSERT(fFields[UCAL_WEEK_OF_MONTH] <= getMaximum(UCAL_WEEK_OF_MONTH)); + fFields[UCAL_DAY_OF_WEEK_IN_MONTH] = (dayOfMonth-1) / 7 + 1; + U_ASSERT(getMinimum(UCAL_DAY_OF_WEEK_IN_MONTH) <= + fFields[UCAL_DAY_OF_WEEK_IN_MONTH]); + U_ASSERT(fFields[UCAL_DAY_OF_WEEK_IN_MONTH] <= + getMaximum(UCAL_DAY_OF_WEEK_IN_MONTH)); + #if defined (U_DEBUG_CAL) if(fFields[UCAL_DAY_OF_WEEK_IN_MONTH]==0) fprintf(stderr, "%s:%d: DOWIM %d on %g\n", __FILE__, __LINE__,fFields[UCAL_DAY_OF_WEEK_IN_MONTH], fTime); @@ -1732,9 +1703,14 @@ int32_t Calendar::weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t da return weekNo; } -void Calendar::handleComputeFields(int32_t /* julianDay */, UErrorCode &/* status */) +void Calendar::handleComputeFields(int32_t /* julianDay */, UErrorCode& status) { - internalSet(UCAL_MONTH, getGregorianMonth()); + if (U_FAILURE(status)) { + return; + } + int32_t month = getGregorianMonth(); + internalSet(UCAL_MONTH, month); + internalSet(UCAL_ORDINAL_MONTH, month); internalSet(UCAL_DAY_OF_MONTH, getGregorianDayOfMonth()); internalSet(UCAL_DAY_OF_YEAR, getGregorianDayOfYear()); int32_t eyear = getGregorianYear(); @@ -1755,8 +1731,7 @@ void Calendar::roll(EDateFields field, int32_t amount, UErrorCode& status) roll((UCalendarDateFields)field, amount, status); } -void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) -{ +void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) UPRV_NO_SANITIZE_UNDEFINED { if (amount == 0) { return; // Nothing to do } @@ -1766,6 +1741,10 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu if(U_FAILURE(status)) { return; } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } switch (field) { case UCAL_DAY_OF_MONTH: case UCAL_AM_PM: @@ -1816,6 +1795,7 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu } case UCAL_MONTH: + case UCAL_ORDINAL_MONTH: // Rolling the month involves both pinning the final value // and adjusting the DAY_OF_MONTH if necessary. We only adjust the // DAY_OF_MONTH if, after updating the MONTH field, it is illegal. @@ -1842,13 +1822,13 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu // * If era==0 and years go backwards in time, change sign of amount. // * Until we have new API per #9393, we temporarily hardcode knowledge of // which calendars have era 0 years that go backwards. - UBool era0WithYearsThatGoBackwards = FALSE; + UBool era0WithYearsThatGoBackwards = false; int32_t era = get(UCAL_ERA, status); if (era == 0) { const char * calType = getType(); if ( uprv_strcmp(calType,"gregorian")==0 || uprv_strcmp(calType,"roc")==0 || uprv_strcmp(calType,"coptic")==0 ) { amount = -amount; - era0WithYearsThatGoBackwards = TRUE; + era0WithYearsThatGoBackwards = true; } } int32_t newYear = internalGet(field) + amount; @@ -1947,6 +1927,10 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu // Now roll between start and (limit - 1). int32_t gap = limit - start; + if (gap == 0) { + status = U_INTERNAL_PROGRAM_ERROR; + return; + } int32_t day_of_month = (internalGet(UCAL_DAY_OF_MONTH) + amount*7 - start) % gap; if (day_of_month < 0) day_of_month += gap; @@ -2005,6 +1989,10 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu // Now roll between start and (limit - 1). int32_t gap = limit - start; + if (gap == 0) { + status = U_INTERNAL_PROGRAM_ERROR; + return; + } int32_t day_of_year = (internalGet(UCAL_DAY_OF_YEAR) + amount*7 - start) % gap; if (day_of_year < 0) day_of_year += gap; @@ -2020,6 +2008,7 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu // have to be updated as well. set(UCAL_DAY_OF_YEAR, day_of_year); clear(UCAL_MONTH); + clear(UCAL_ORDINAL_MONTH); return; } case UCAL_DAY_OF_YEAR: @@ -2103,6 +2092,13 @@ void Calendar::add(EDateFields field, int32_t amount, UErrorCode& status) // ------------------------------------- void Calendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } if (amount == 0) { return; // Do nothing! } @@ -2114,7 +2110,7 @@ void Calendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& status // we don't want the wall time to shift due to changes in DST. If the // result of the add operation is to move from DST to Standard, or // vice versa, we need to adjust by an hour forward or back, - // respectively. For such fields we set keepWallTimeInvariant to TRUE. + // respectively. For such fields we set keepWallTimeInvariant to true. // We only adjust the DST for fields larger than an hour. For // fields smaller than an hour, we cannot adjust for DST without @@ -2129,7 +2125,7 @@ void Calendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& status // , rather than => . double delta = amount; // delta in ms - UBool keepWallTimeInvariant = TRUE; + UBool keepWallTimeInvariant = true; switch (field) { case UCAL_ERA: @@ -2159,12 +2155,13 @@ void Calendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& status U_FALLTHROUGH; case UCAL_EXTENDED_YEAR: case UCAL_MONTH: + case UCAL_ORDINAL_MONTH: { UBool oldLenient = isLenient(); - setLenient(TRUE); + setLenient(true); set(field, get(field, status) + amount); pinField(UCAL_DAY_OF_MONTH, status); - if(oldLenient==FALSE) { + if(oldLenient==false) { complete(status); /* force recalculate */ setLenient(oldLenient); } @@ -2192,22 +2189,22 @@ void Calendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& status case UCAL_HOUR_OF_DAY: case UCAL_HOUR: delta *= kOneHour; - keepWallTimeInvariant = FALSE; + keepWallTimeInvariant = false; break; case UCAL_MINUTE: delta *= kOneMinute; - keepWallTimeInvariant = FALSE; + keepWallTimeInvariant = false; break; case UCAL_SECOND: delta *= kOneSecond; - keepWallTimeInvariant = FALSE; + keepWallTimeInvariant = false; break; case UCAL_MILLISECOND: case UCAL_MILLISECONDS_IN_DAY: - keepWallTimeInvariant = FALSE; + keepWallTimeInvariant = false; break; default: @@ -2288,10 +2285,16 @@ int32_t Calendar::fieldDifference(UDate when, EDateFields field, UErrorCode& sta } int32_t Calendar::fieldDifference(UDate targetMs, UCalendarDateFields field, UErrorCode& ec) { - if (U_FAILURE(ec)) return 0; + if (U_FAILURE(ec)) { + return 0; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + ec = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } int32_t min = 0; double startMs = getTimeInMillis(ec); - // Always add from the start millis. This accomodates + // Always add from the start millis. This accommodates // operations like adding years from February 29, 2000 up to // February 29, 2004. If 1, 1, 1, 1 is added to the year // field, the DOM gets pinned to 28 and stays there, giving an @@ -2350,7 +2353,7 @@ int32_t Calendar::fieldDifference(UDate targetMs, UCalendarDateFields field, UEr break; } else { min = max; - max = ((uint32_t) max) << 1; + max = (int32_t)((uint32_t)(max) << 1); if (max == 0) { // Field difference too large to fit into int32_t #if defined (U_DEBUG_CAL) @@ -2392,15 +2395,17 @@ int32_t Calendar::fieldDifference(UDate targetMs, UCalendarDateFields field, UEr void Calendar::adoptTimeZone(TimeZone* zone) { - // Do nothing if passed-in zone is NULL - if (zone == NULL) return; + // Do nothing if passed-in zone is nullptr + if (zone == nullptr) { + return; + } // fZone should always be non-null delete fZone; fZone = zone; // if the zone changes, we need to recompute the time fields - fAreFieldsSet = FALSE; + fAreFieldsSet = false; } // ------------------------------------- @@ -2415,7 +2420,7 @@ Calendar::setTimeZone(const TimeZone& zone) const TimeZone& Calendar::getTimeZone() const { - U_ASSERT(fZone != NULL); + U_ASSERT(fZone != nullptr); return *fZone; } @@ -2426,9 +2431,9 @@ Calendar::orphanTimeZone() { // we let go of the time zone; the new time zone is the system default time zone TimeZone *defaultZone = TimeZone::createDefault(); - if (defaultZone == NULL) { - // No error handling available. Must keep fZone non-NULL, there are many unchecked uses. - return NULL; + if (defaultZone == nullptr) { + // No error handling available. Must keep fZone non-nullptr, there are many unchecked uses. + return nullptr; } TimeZone *z = fZone; fZone = defaultZone; @@ -2464,7 +2469,7 @@ Calendar::setRepeatedWallTimeOption(UCalendarWallTimeOption option) // ------------------------------------- UCalendarWallTimeOption -Calendar::getRepeatedWallTimeOption(void) const +Calendar::getRepeatedWallTimeOption() const { return fRepeatedWallTime; } @@ -2480,7 +2485,7 @@ Calendar::setSkippedWallTimeOption(UCalendarWallTimeOption option) // ------------------------------------- UCalendarWallTimeOption -Calendar::getSkippedWallTimeOption(void) const +Calendar::getSkippedWallTimeOption() const { return fSkippedWallTime; } @@ -2488,12 +2493,11 @@ Calendar::getSkippedWallTimeOption(void) const // ------------------------------------- void -Calendar::setFirstDayOfWeek(UCalendarDaysOfWeek value) -{ +Calendar::setFirstDayOfWeek(UCalendarDaysOfWeek value) UPRV_NO_SANITIZE_UNDEFINED { if (fFirstDayOfWeek != value && value >= UCAL_SUNDAY && value <= UCAL_SATURDAY) { fFirstDayOfWeek = value; - fAreFieldsSet = FALSE; + fAreFieldsSet = false; } } @@ -2525,7 +2529,7 @@ Calendar::setMinimalDaysInFirstWeek(uint8_t value) } if (fMinimalDaysInFirstWeek != value) { fMinimalDaysInFirstWeek = value; - fAreFieldsSet = FALSE; + fAreFieldsSet = false; } } @@ -2592,15 +2596,15 @@ UBool Calendar::isWeekend(UDate date, UErrorCode &status) const { if (U_FAILURE(status)) { - return FALSE; + return false; } // clone the calendar so we don't mess with the real one. Calendar *work = this->clone(); - if (work == NULL) { + if (work == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } - UBool result = FALSE; + UBool result = false; work->setTime(date, status); if (U_SUCCESS(status)) { result = work->isWeekend(); @@ -2610,7 +2614,7 @@ Calendar::isWeekend(UDate date, UErrorCode &status) const } UBool -Calendar::isWeekend(void) const +Calendar::isWeekend() const { UErrorCode status = U_ZERO_ERROR; UCalendarDaysOfWeek dayOfWeek = (UCalendarDaysOfWeek)get(UCAL_DAY_OF_WEEK, status); @@ -2618,9 +2622,9 @@ Calendar::isWeekend(void) const if (U_SUCCESS(status)) { switch (dayType) { case UCAL_WEEKDAY: - return FALSE; + return false; case UCAL_WEEKEND: - return TRUE; + return true; case UCAL_WEEKEND_ONSET: case UCAL_WEEKEND_CEASE: // Use internalGet() because the above call to get() populated all fields. @@ -2632,14 +2636,14 @@ Calendar::isWeekend(void) const (millisInDay >= transitionMillis): (millisInDay < transitionMillis); } - // else fall through, return FALSE + // else fall through, return false U_FALLTHROUGH; } default: break; } } - return FALSE; + return false; } // ------------------------------------- limits @@ -2741,10 +2745,16 @@ int32_t Calendar::getLimit(UCalendarDateFields field, ELimitType limitType) cons } } - int32_t Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const { + if (U_FAILURE(status)) { + return 0; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } int32_t fieldValue = getGreatestMinimum(field); int32_t endValue = getMinimum(field); @@ -2756,11 +2766,11 @@ Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const // clone the calendar so we don't mess with the real one, and set it to // accept anything for the field values Calendar *work = this->clone(); - if (work == NULL) { + if (work == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } - work->setLenient(TRUE); + work->setLenient(true); // now try each value from getLeastMaximum() to getMaximum() one by one until // we get a value that normalizes to another value. The last value that @@ -2789,7 +2799,65 @@ Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const // ------------------------------------- +UBool +Calendar::inDaylightTime(UErrorCode& status) const +{ + if (U_FAILURE(status) || !getTimeZone().useDaylightTime()) { + return false; + } + // Force an update of the state of the Calendar. + ((Calendar*)this)->complete(status); // cast away const + + return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : false); +} + +bool +Calendar::inTemporalLeapYear(UErrorCode& status) const +{ + // Default to Gregorian based leap year rule. + return getActualMaximum(UCAL_DAY_OF_YEAR, status) == 366; +} + +// ------------------------------------- + +static const char * const gTemporalMonthCodes[] = { + "M01", "M02", "M03", "M04", "M05", "M06", + "M07", "M08", "M09", "M10", "M11", "M12", nullptr +}; + +const char* +Calendar::getTemporalMonthCode(UErrorCode& status) const +{ + int32_t month = get(UCAL_MONTH, status); + if (U_FAILURE(status)) { + return nullptr; + } + U_ASSERT(month < 12); + U_ASSERT(internalGet(UCAL_IS_LEAP_MONTH) == 0); + return gTemporalMonthCodes[month]; +} + +void +Calendar::setTemporalMonthCode(const char* code, UErrorCode& status ) +{ + if (U_FAILURE(status)) { + return; + } + int32_t len = static_cast(uprv_strlen(code)); + if (len == 3 && code[0] == 'M') { + for (int m = 0; gTemporalMonthCodes[m] != nullptr; m++) { + if (uprv_strcmp(code, gTemporalMonthCodes[m]) == 0) { + set(UCAL_MONTH, m); + set(UCAL_IS_LEAP_MONTH, 0); + return; + } + } + } + status = U_ILLEGAL_ARGUMENT_ERROR; +} + +// ------------------------------------- /** * Ensure that each field is within its valid range by calling {@link @@ -2799,6 +2867,9 @@ Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const * @see #validateField(int) */ void Calendar::validateFields(UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } for (int32_t field = 0; U_SUCCESS(status) && (field < UCAL_FIELD_COUNT); field++) { if (fStamp[field] >= kMinimumUserStamp) { validateField((UCalendarDateFields)field, status); @@ -2814,11 +2885,18 @@ void Calendar::validateFields(UErrorCode &status) { * @see #validateField(int, int, int) */ void Calendar::validateField(UCalendarDateFields field, UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } int32_t y; switch (field) { case UCAL_DAY_OF_MONTH: y = handleGetExtendedYear(); - validateField(field, 1, handleGetMonthLength(y, internalGet(UCAL_MONTH)), status); + validateField(field, 1, handleGetMonthLength(y, internalGetMonth()), status); break; case UCAL_DAY_OF_YEAR: y = handleGetExtendedYear(); @@ -2850,6 +2928,13 @@ void Calendar::validateField(UCalendarDateFields field, UErrorCode &status) { */ void Calendar::validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } int32_t value = fFields[field]; if (value < min || value > max) { #if defined (U_DEBUG_CAL) @@ -2876,7 +2961,7 @@ UCalendarDateFields Calendar::newerField(UCalendarDateFields defaultField, UCale return defaultField; } -UCalendarDateFields Calendar::resolveFields(const UFieldResolutionTable* precedenceTable) { +UCalendarDateFields Calendar::resolveFields(const UFieldResolutionTable* precedenceTable) const { int32_t bestField = UCAL_FIELD_COUNT; int32_t tempBestField; for (int32_t g=0; precedenceTable[g][0][0] != -1 && (bestField == UCAL_FIELD_COUNT); ++g) { @@ -2945,6 +3030,16 @@ const UFieldResolutionTable Calendar::kDatePrecedence[] = }; +const UFieldResolutionTable Calendar::kMonthPrecedence[] = +{ + { + { UCAL_MONTH,kResolveSTOP, kResolveSTOP }, + { UCAL_ORDINAL_MONTH,kResolveSTOP, kResolveSTOP }, + {kResolveSTOP} + }, + {{kResolveSTOP}} +}; + const UFieldResolutionTable Calendar::kDOWPrecedence[] = { { @@ -2972,6 +3067,9 @@ const UFieldResolutionTable Calendar::kYearPrecedence[] = void Calendar::computeTime(UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } if (!isLenient()) { validateFields(status); if (U_FAILURE(status)) { @@ -2981,10 +3079,6 @@ void Calendar::computeTime(UErrorCode& status) { // Compute the Julian day int32_t julianDay = computeJulianDay(); - if (julianDay < getMinimum(UCAL_JULIAN_DAY) || julianDay > getMaximum(UCAL_JULIAN_DAY)) { - status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } double millis = Grego::julianDayToMillis(julianDay); @@ -3054,7 +3148,7 @@ void Calendar::computeTime(UErrorCode& status) { UDate tmpTime = millis + millisInDay - zoneOffset; int32_t raw, dst; - fZone->getOffset(tmpTime, FALSE, raw, dst, status); + fZone->getOffset(tmpTime, false, raw, dst, status); if (U_SUCCESS(status)) { // zoneOffset != (raw + dst) only when the given wall time fall into @@ -3087,16 +3181,19 @@ void Calendar::computeTime(UErrorCode& status) { } /** - * Find the previous zone transtion near the given time. + * Find the previous zone transition near the given time. */ UBool Calendar::getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const { + if (U_FAILURE(status)) { + return false; + } BasicTimeZone *btz = getBasicTimeZone(); if (btz) { TimeZoneTransition trans; - UBool hasTransition = btz->getPreviousTransition(base, TRUE, trans); + UBool hasTransition = btz->getPreviousTransition(base, true, trans); if (hasTransition) { *transitionTime = trans.getTime(); - return TRUE; + return true; } else { // Could not find any transitions. // Note: This should never happen. @@ -3107,7 +3204,7 @@ UBool Calendar::getImmediatePreviousZoneTransition(UDate base, UDate *transition // TODO: We may support non-BasicTimeZone in future. status = U_UNSUPPORTED_ERROR; } - return FALSE; + return false; } /** @@ -3163,19 +3260,22 @@ double Calendar::computeMillisInDay() { * @stable ICU 2.0 */ int32_t Calendar::computeZoneOffset(double millis, double millisInDay, UErrorCode &ec) { + if (U_FAILURE(ec)) { + return 0; + } int32_t rawOffset, dstOffset; UDate wall = millis + millisInDay; BasicTimeZone* btz = getBasicTimeZone(); if (btz) { - int duplicatedTimeOpt = (fRepeatedWallTime == UCAL_WALLTIME_FIRST) ? BasicTimeZone::kFormer : BasicTimeZone::kLatter; - int nonExistingTimeOpt = (fSkippedWallTime == UCAL_WALLTIME_FIRST) ? BasicTimeZone::kLatter : BasicTimeZone::kFormer; + UTimeZoneLocalOption duplicatedTimeOpt = (fRepeatedWallTime == UCAL_WALLTIME_FIRST) ? UCAL_TZ_LOCAL_FORMER : UCAL_TZ_LOCAL_LATTER; + UTimeZoneLocalOption nonExistingTimeOpt = (fSkippedWallTime == UCAL_WALLTIME_FIRST) ? UCAL_TZ_LOCAL_LATTER : UCAL_TZ_LOCAL_FORMER; btz->getOffsetFromLocal(wall, nonExistingTimeOpt, duplicatedTimeOpt, rawOffset, dstOffset, ec); } else { const TimeZone& tz = getTimeZone(); // By default, TimeZone::getOffset behaves UCAL_WALLTIME_LAST for both. - tz.getOffset(wall, TRUE, rawOffset, dstOffset, ec); + tz.getOffset(wall, true, rawOffset, dstOffset, ec); - UBool sawRecentNegativeShift = FALSE; + UBool sawRecentNegativeShift = false; if (fRepeatedWallTime == UCAL_WALLTIME_FIRST) { // Check if the given wall time falls into repeated time range UDate tgmt = wall - (rawOffset + dstOffset); @@ -3184,16 +3284,16 @@ int32_t Calendar::computeZoneOffset(double millis, double millisInDay, UErrorCod // Note: The maximum historic negative zone transition is -3 hours in the tz database. // 6 hour window would be sufficient for this purpose. int32_t tmpRaw, tmpDst; - tz.getOffset(tgmt - 6*60*60*1000, FALSE, tmpRaw, tmpDst, ec); + tz.getOffset(tgmt - 6*60*60*1000, false, tmpRaw, tmpDst, ec); int32_t offsetDelta = (rawOffset + dstOffset) - (tmpRaw + tmpDst); U_ASSERT(offsetDelta < -6*60*60*1000); if (offsetDelta < 0) { - sawRecentNegativeShift = TRUE; + sawRecentNegativeShift = true; // Negative shift within last 6 hours. When UCAL_WALLTIME_FIRST is used and the given wall time falls // into the repeated time range, use offsets before the transition. // Note: If it does not fall into the repeated time range, offsets remain unchanged below. - tz.getOffset(wall + offsetDelta, TRUE, rawOffset, dstOffset, ec); + tz.getOffset(wall + offsetDelta, true, rawOffset, dstOffset, ec); } } if (!sawRecentNegativeShift && fSkippedWallTime == UCAL_WALLTIME_FIRST) { @@ -3201,9 +3301,9 @@ int32_t Calendar::computeZoneOffset(double millis, double millisInDay, UErrorCod // recalculate offsets from the resolved time (non-wall). // When the given wall time falls into skipped wall time, // the offsets will be based on the zone offsets AFTER - // the transition (which means, earliest possibe interpretation). + // the transition (which means, earliest possible interpretation). UDate tgmt = wall - (rawOffset + dstOffset); - tz.getOffset(tgmt, FALSE, rawOffset, dstOffset, ec); + tz.getOffset(tgmt, false, rawOffset, dstOffset, ec); } } return rawOffset + dstOffset; @@ -3222,6 +3322,7 @@ int32_t Calendar::computeJulianDay() if (fStamp[UCAL_JULIAN_DAY] >= (int32_t)kMinimumUserStamp) { int32_t bestStamp = newestStamp(UCAL_ERA, UCAL_DAY_OF_WEEK_IN_MONTH, kUnset); bestStamp = newestStamp(UCAL_YEAR_WOY, UCAL_EXTENDED_YEAR, bestStamp); + bestStamp = newestStamp(UCAL_ORDINAL_MONTH, UCAL_ORDINAL_MONTH, bestStamp); if (bestStamp <= fStamp[UCAL_JULIAN_DAY]) { return internalGet(UCAL_JULIAN_DAY); } @@ -3261,8 +3362,8 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) { // give calendar subclass a chance to have a default 'first' month int32_t month; - if(isSet(UCAL_MONTH)) { - month = internalGet(UCAL_MONTH); + if(isSet(UCAL_MONTH) || isSet(UCAL_ORDINAL_MONTH)) { + month = internalGetMonth(); } else { month = getDefaultMonthInYear(year); } @@ -3330,7 +3431,7 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) { // past the first of the given day-of-week in this month. // Note that we handle -2, -3, etc. correctly, even though // values < -1 are technically disallowed. - int32_t m = internalGet(UCAL_MONTH, UCAL_JANUARY); + int32_t m = internalGetMonth(UCAL_JANUARY); int32_t monthLength = handleGetMonthLength(year, m); date += ((monthLength - date) / 7 + dim + 1) * 7; } @@ -3347,7 +3448,7 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) { // need to be sure to stay in 'real' year. int32_t woy = internalGet(bestField); - int32_t nextJulianDay = handleComputeMonthStart(year+1, 0, FALSE); // jd of day before jan 1 + int32_t nextJulianDay = handleComputeMonthStart(year+1, 0, false); // jd of day before jan 1 int32_t nextFirst = julianDayToDayOfWeek(nextJulianDay + 1) - firstDayOfWeek; if (nextFirst < 0) { // 0..6 ldow of Jan 1 @@ -3398,7 +3499,7 @@ int32_t Calendar::handleComputeJulianDay(UCalendarDateFields bestField) { #endif if(julianDay+testDate > nextJulianDay) { // is it past Dec 31? (nextJulianDay is day BEFORE year+1's Jan 1) // Fire up the calculating engines.. retry YWOY = (year-1) - julianDay = handleComputeMonthStart(year-1, 0, FALSE); // jd before Jan 1 of previous year + julianDay = handleComputeMonthStart(year-1, 0, false); // jd before Jan 1 of previous year first = julianDayToDayOfWeek(julianDay + 1) - firstDayOfWeek; // 0 based local dow of first week if(first < 0) { // 0..6 @@ -3478,8 +3579,8 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w // Now, a local DOW int32_t dowLocal = getLocalDOW(); // 0..6 int32_t firstDayOfWeek = getFirstDayOfWeek(); // Localized fdw - int32_t jan1Start = handleComputeMonthStart(yearWoy, 0, FALSE); - int32_t nextJan1Start = handleComputeMonthStart(yearWoy+1, 0, FALSE); // next year's Jan1 start + int32_t jan1Start = handleComputeMonthStart(yearWoy, 0, false); + int32_t nextJan1Start = handleComputeMonthStart(yearWoy+1, 0, false); // next year's Jan1 start // At this point julianDay is the 0-based day BEFORE the first day of // January 1, year 1 of the given calendar. If julianDay == 0, it @@ -3505,21 +3606,21 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w //} int32_t minDays = getMinimalDaysInFirstWeek(); - UBool jan1InPrevYear = FALSE; // January 1st in the year of WOY is the 1st week? (i.e. first week is < minimal ) - //UBool nextJan1InPrevYear = FALSE; // January 1st of Year of WOY + 1 is in the first week? + UBool jan1InPrevYear = false; // January 1st in the year of WOY is the 1st week? (i.e. first week is < minimal ) + //UBool nextJan1InPrevYear = false; // January 1st of Year of WOY + 1 is in the first week? if((7 - first) < minDays) { - jan1InPrevYear = TRUE; + jan1InPrevYear = true; } // if((7 - nextFirst) < minDays) { - // nextJan1InPrevYear = TRUE; + // nextJan1InPrevYear = true; // } switch(bestField) { case UCAL_WEEK_OF_YEAR: if(woy == 1) { - if(jan1InPrevYear == TRUE) { + if(jan1InPrevYear) { // the first week of January is in the previous year // therefore WOY1 is always solidly within yearWoy return yearWoy; @@ -3538,7 +3639,7 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w (7-first) + // days in the first week (Jan 1.. ) (woy-1)*7 + // add the weeks of the year dowLocal; // the local dow (0..6) of last week - if(jan1InPrevYear==FALSE) { + if(jan1InPrevYear==false) { jd -= 7; // woy already includes Jan 1's week. } @@ -3555,23 +3656,25 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w } case UCAL_DATE: - if((internalGet(UCAL_MONTH)==0) && + { + int32_t m = internalGetMonth(); + if((m == 0) && (woy >= getLeastMaximum(UCAL_WEEK_OF_YEAR))) { return yearWoy+1; // month 0, late woy = in the next year } else if(woy==1) { //if(nextJan1InPrevYear) { - if(internalGet(UCAL_MONTH)==0) { + if(m == 0) { return yearWoy; } else { return yearWoy-1; } //} } - - //(internalGet(UCAL_DATE) <= (7-first)) /* && in minDow */ ) { - //within 1st week and in this month.. - //return yearWoy+1; - return yearWoy; + } + //(internalGet(UCAL_DATE) <= (7-first)) /* && in minDow */ ) { + //within 1st week and in this month.. + //return yearWoy+1; + return yearWoy; default: // assume the year is appropriate return yearWoy; @@ -3580,27 +3683,36 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w int32_t Calendar::handleGetMonthLength(int32_t extendedYear, int32_t month) const { - return handleComputeMonthStart(extendedYear, month+1, TRUE) - - handleComputeMonthStart(extendedYear, month, TRUE); + return handleComputeMonthStart(extendedYear, month+1, true) - + handleComputeMonthStart(extendedYear, month, true); } int32_t Calendar::handleGetYearLength(int32_t eyear) const { - return handleComputeMonthStart(eyear+1, 0, FALSE) - - handleComputeMonthStart(eyear, 0, FALSE); + return handleComputeMonthStart(eyear+1, 0, false) - + handleComputeMonthStart(eyear, 0, false); } int32_t Calendar::getActualMaximum(UCalendarDateFields field, UErrorCode& status) const { + if (U_FAILURE(status)) { + return 0; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } int32_t result; switch (field) { case UCAL_DATE: { - if(U_FAILURE(status)) return 0; Calendar *cal = clone(); - if(!cal) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } - cal->setLenient(TRUE); - cal->prepareGetActual(field,FALSE,status); + if(!cal) { + status = U_MEMORY_ALLOCATION_ERROR; + return 0; + } + cal->setLenient(true); + cal->prepareGetActual(field,false,status); result = handleGetMonthLength(cal->get(UCAL_EXTENDED_YEAR, status), cal->get(UCAL_MONTH, status)); delete cal; } @@ -3608,11 +3720,13 @@ Calendar::getActualMaximum(UCalendarDateFields field, UErrorCode& status) const case UCAL_DAY_OF_YEAR: { - if(U_FAILURE(status)) return 0; Calendar *cal = clone(); - if(!cal) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } - cal->setLenient(TRUE); - cal->prepareGetActual(field,FALSE,status); + if(!cal) { + status = U_MEMORY_ALLOCATION_ERROR; + return 0; + } + cal->setLenient(true); + cal->prepareGetActual(field,false,status); result = handleGetYearLength(cal->get(UCAL_EXTENDED_YEAR, status)); delete cal; } @@ -3634,6 +3748,10 @@ Calendar::getActualMaximum(UCalendarDateFields field, UErrorCode& status) const result = getMaximum(field); break; + case UCAL_ORDINAL_MONTH: + result = inTemporalLeapYear(status) ? getMaximum(UCAL_ORDINAL_MONTH) : getLeastMaximum(UCAL_ORDINAL_MONTH); + break; + default: // For all other fields, do it the hard way.... result = getActualHelper(field, getLeastMaximum(field), getMaximum(field),status); @@ -3666,6 +3784,13 @@ Calendar::getActualMaximum(UCalendarDateFields field, UErrorCode& status) const */ void Calendar::prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } set(UCAL_MILLISECONDS_IN_DAY, 0); switch (field) { @@ -3721,6 +3846,13 @@ int32_t Calendar::getActualHelper(UCalendarDateFields field, int32_t startValue, #if defined (U_DEBUG_CAL) fprintf(stderr, "getActualHelper(%d,%d .. %d, %s)\n", field, startValue, endValue, u_errorName(status)); #endif + if (U_FAILURE(status)) { + return 0; + } + if (field < 0 || field >= UCAL_FIELD_COUNT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } if (startValue == endValue) { // if we know that the maximum value is always the same, just return it return startValue; @@ -3730,15 +3862,20 @@ int32_t Calendar::getActualHelper(UCalendarDateFields field, int32_t startValue, // clone the calendar so we don't mess with the real one, and set it to // accept anything for the field values - if(U_FAILURE(status)) return startValue; + if(U_FAILURE(status)) { + return startValue; + } Calendar *work = clone(); - if(!work) { status = U_MEMORY_ALLOCATION_ERROR; return startValue; } + if(!work) { + status = U_MEMORY_ALLOCATION_ERROR; + return startValue; + } // need to resolve time here, otherwise, fields set for actual limit // may cause conflict with fields previously set (but not yet resolved). work->complete(status); - work->setLenient(TRUE); + work->setLenient(true); work->prepareGetActual(field, delta < 0, status); // now try each value from the start to the end one by one until @@ -3786,7 +3923,9 @@ void Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& status) { - if (U_FAILURE(status)) return; + if (U_FAILURE(status)) { + return; + } fFirstDayOfWeek = UCAL_SUNDAY; fMinimalDaysInFirstWeek = 1; @@ -3826,12 +3965,12 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& // Get the monthNames resource bundle for the calendar 'type'. Fallback to gregorian if the resource is not // found. - LocalUResourceBundlePointer calData(ures_open(NULL, useLocale.getBaseName(), &status)); + LocalUResourceBundlePointer calData(ures_open(nullptr, useLocale.getBaseName(), &status)); ures_getByKey(calData.getAlias(), gCalendar, calData.getAlias(), &status); LocalUResourceBundlePointer monthNames; - if (type != NULL && *type != '\0' && uprv_strcmp(type, gGregorian) != 0) { - monthNames.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), type, NULL, &status)); + if (type != nullptr && *type != '\0' && uprv_strcmp(type, gGregorian) != 0) { + monthNames.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), type, nullptr, &status)); ures_getByKeyWithFallback(monthNames.getAlias(), gMonthNames, monthNames.getAlias(), &status); } @@ -3854,15 +3993,15 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& } char region[ULOC_COUNTRY_CAPACITY]; - (void)ulocimp_getRegionForSupplementalData(desiredLocale.getName(), TRUE, region, sizeof(region), &status); + (void)ulocimp_getRegionForSupplementalData(desiredLocale.getName(), true, region, sizeof(region), &status); // Read week data values from supplementalData week data - UResourceBundle *rb = ures_openDirect(NULL, "supplementalData", &status); + UResourceBundle *rb = ures_openDirect(nullptr, "supplementalData", &status); ures_getByKey(rb, "weekData", rb, &status); - UResourceBundle *weekData = ures_getByKey(rb, region, NULL, &status); - if (status == U_MISSING_RESOURCE_ERROR && rb != NULL) { + UResourceBundle *weekData = ures_getByKey(rb, region, nullptr, &status); + if (status == U_MISSING_RESOURCE_ERROR && rb != nullptr) { status = U_ZERO_ERROR; - weekData = ures_getByKey(rb, "001", NULL, &status); + weekData = ures_getByKey(rb, "001", nullptr, &status); } if (U_FAILURE(status)) { @@ -3884,6 +4023,29 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& } else { status = U_INVALID_FORMAT_ERROR; } + + // Check if the locale has a "fw" u extension and we honor it if present. + // And we don't change the overal status, as the presence / lack of "fw" is not an error. + UErrorCode fwStatus = U_ZERO_ERROR; + char fwExt[ULOC_FULLNAME_CAPACITY] = ""; + desiredLocale.getKeywordValue("fw", fwExt, ULOC_FULLNAME_CAPACITY, fwStatus); + if (U_SUCCESS(fwStatus)) { + if (uprv_strcmp(fwExt, "sun") == 0) { + fFirstDayOfWeek = UCAL_SUNDAY; + } else if (uprv_strcmp(fwExt, "mon") == 0) { + fFirstDayOfWeek = UCAL_MONDAY; + } else if (uprv_strcmp(fwExt, "tue") == 0) { + fFirstDayOfWeek = UCAL_TUESDAY; + } else if (uprv_strcmp(fwExt, "wed") == 0) { + fFirstDayOfWeek = UCAL_WEDNESDAY; + } else if (uprv_strcmp(fwExt, "thu") == 0) { + fFirstDayOfWeek = UCAL_THURSDAY; + } else if (uprv_strcmp(fwExt, "fri") == 0) { + fFirstDayOfWeek = UCAL_FRIDAY; + } else if (uprv_strcmp(fwExt, "sat") == 0) { + fFirstDayOfWeek = UCAL_SATURDAY; + } + } } ures_close(weekData); ures_close(rb); @@ -3905,10 +4067,10 @@ Calendar::updateTime(UErrorCode& status) // the values. Also, if we haven't set all the fields yet (i.e., // in a newly-created object), we need to fill in the fields. [LIU] if (isLenient() || ! fAreAllFieldsSet) - fAreFieldsSet = FALSE; + fAreFieldsSet = false; - fIsTimeSet = TRUE; - fAreFieldsVirtuallySet = FALSE; + fIsTimeSet = true; + fAreFieldsVirtuallySet = false; } Locale @@ -3957,15 +4119,29 @@ Calendar::internalSet(EDateFields field, int32_t value) internalSet((UCalendarDateFields) field, value); } +int32_t Calendar::internalGetMonth() const { + if (resolveFields(kMonthPrecedence) == UCAL_MONTH) { + return internalGet(UCAL_MONTH); + } + return internalGet(UCAL_ORDINAL_MONTH); +} + +int32_t Calendar::internalGetMonth(int32_t defaultValue) const { + if (resolveFields(kMonthPrecedence) == UCAL_MONTH) { + return internalGet(UCAL_MONTH, defaultValue); + } + return internalGet(UCAL_ORDINAL_MONTH); +} + BasicTimeZone* -Calendar::getBasicTimeZone(void) const { - if (dynamic_cast(fZone) != NULL - || dynamic_cast(fZone) != NULL - || dynamic_cast(fZone) != NULL - || dynamic_cast(fZone) != NULL) { +Calendar::getBasicTimeZone() const { + if (dynamic_cast(fZone) != nullptr + || dynamic_cast(fZone) != nullptr + || dynamic_cast(fZone) != nullptr + || dynamic_cast(fZone) != nullptr) { return (BasicTimeZone*)fZone; } - return NULL; + return nullptr; } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/casetrn.h b/src/duckdb/extension/icu/third_party/icu/i18n/casetrn.h index 2ec3e736d..a00480db6 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/casetrn.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/casetrn.h @@ -58,7 +58,7 @@ class CaseMapTransliterator : public Transliterator { * Transliterator API. * @return a copy of the object. */ - virtual CaseMapTransliterator* clone() const = 0; + virtual CaseMapTransliterator* clone() const override = 0; /** * ICU "poor man's RTTI", returns a UClassID for the actual class. @@ -82,7 +82,7 @@ class CaseMapTransliterator : public Transliterator { */ virtual void handleTransliterate(Replaceable& text, UTransPosition& offsets, - UBool isIncremental) const; + UBool isIncremental) const override; UCaseMapFull *fMap; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/cecal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/cecal.cpp index de3c0895d..456801ee3 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/cecal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/cecal.cpp @@ -13,10 +13,11 @@ #include "cecal.h" #include "gregoimp.h" //Math +#include "cstring.h" U_NAMESPACE_BEGIN -static const int32_t CECAL_LIMITS[UCAL_FIELD_COUNT][4] = { +static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = { // Minimum Greatest Least Maximum // Minimum Maximum { 0, 0, 1, 1}, // ERA @@ -42,6 +43,7 @@ static const int32_t CECAL_LIMITS[UCAL_FIELD_COUNT][4] = { {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // JULIAN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // MILLISECONDS_IN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // IS_LEAP_MONTH + { 0, 0, 12, 12}, // ORDINAL_MONTH }; //------------------------------------------------------------------------- @@ -49,12 +51,12 @@ static const int32_t CECAL_LIMITS[UCAL_FIELD_COUNT][4] = { //------------------------------------------------------------------------- CECalendar::CECalendar(const Locale& aLocale, UErrorCode& success) -: Calendar(TimeZone::createDefault(), aLocale, success) +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); } -CECalendar::CECalendar (const CECalendar& other) +CECalendar::CECalendar (const CECalendar& other) : Calendar(other) { } @@ -83,26 +85,13 @@ CECalendar::handleComputeMonthStart(int32_t eyear,int32_t emonth, UBool /*useMon int32_t CECalendar::handleGetLimit(UCalendarDateFields field, ELimitType limitType) const { - return CECAL_LIMITS[field][limitType]; -} - -UBool -CECalendar::inDaylightTime(UErrorCode& status) const -{ - if (U_FAILURE(status) || !getTimeZone().useDaylightTime()) { - return FALSE; - } - - // Force an update of the state of the Calendar. - ((CECalendar*)this)->complete(status); // cast away const - - return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : FALSE); + return LIMITS[field][limitType]; } UBool CECalendar::haveDefaultCentury() const { - return TRUE; + return true; } //------------------------------------------------------------------------- @@ -135,7 +124,7 @@ CECalendar::jdToCE(int32_t julianDay, int32_t jdEpochOffset, int32_t& year, int3 int32_t c4; // number of 4 year cycle (1461 days) int32_t r4; // remainder of 4 year cycle, always positive - c4 = ClockMath::floorDivide(julianDay - jdEpochOffset, 1461, r4); + c4 = ClockMath::floorDivide(julianDay - jdEpochOffset, 1461, &r4); year = 4 * c4 + (r4/365 - r4/1460); // 4 * + @@ -145,6 +134,24 @@ CECalendar::jdToCE(int32_t julianDay, int32_t jdEpochOffset, int32_t& year, int3 day = (doy % 30) + 1; // 1-based days in a month } +static const char* kMonthCode13 = "M13"; + +const char* CECalendar::getTemporalMonthCode(UErrorCode& status) const { + if (get(UCAL_MONTH, status) == 12) return kMonthCode13; + return Calendar::getTemporalMonthCode(status); +} + +void +CECalendar::setTemporalMonthCode(const char* code, UErrorCode& status) { + if (U_FAILURE(status)) return; + if (uprv_strcmp(code, kMonthCode13) == 0) { + set(UCAL_MONTH, 12); + set(UCAL_IS_LEAP_MONTH, 0); + return; + } + Calendar::setTemporalMonthCode(code, status); +} + U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/cecal.h b/src/duckdb/extension/icu/third_party/icu/i18n/cecal.h index c380f0bea..16f36a797 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/cecal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/cecal.h @@ -24,6 +24,36 @@ U_NAMESPACE_BEGIN */ class U_I18N_API CECalendar : public Calendar { +public: + + /** + * Gets The Temporal monthCode value corresponding to the month for the date. + * The value is a string identifier that starts with the literal grapheme + * "M" followed by two graphemes representing the zero-padded month number + * of the current month in a normal (non-leap) year. For the short thirteen + * month in each year in the CECalendar, the value is "M13". + * + * @param status ICU Error Code + * @return One of 13 possible strings in {"M01".. "M12", "M13"}. + * @draft ICU 73 + */ + virtual const char* getTemporalMonthCode(UErrorCode& status) const override; + + /** + * Sets The Temporal monthCode which is a string identifier that starts + * with the literal grapheme "M" followed by two graphemes representing + * the zero-padded month number of the current month in a normal + * (non-leap) year. For CECalendar calendar, the values + * are "M01" .. "M13" while the "M13" is represent the short thirteen month + * in each year. + * + * @param temporalMonth The value to be set for temporal monthCode. + * @param status ICU Error Code + * + * @draft ICU 73 + */ + virtual void setTemporalMonthCode(const char* code, UErrorCode& status) override; + protected: //------------------------------------------------------------------------- // Constructors... @@ -68,30 +98,19 @@ class U_I18N_API CECalendar : public Calendar { * Return JD of start of given month/extended year * @internal */ - virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const; + virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const override; /** * Calculate the limit for a specified type of limit and field * @internal */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; - - /** - * (Overrides Calendar) Return true if the current date for this Calendar is in - * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. - * - * @param status Fill-in parameter which receives the status of this operation. - * @return True if the current date for this Calendar is in Daylight Savings Time, - * false, otherwise. - * @internal - */ - virtual UBool inDaylightTime(UErrorCode&) const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; /** - * Returns TRUE because Coptic/Ethiopic Calendar does have a default century + * Returns true because Coptic/Ethiopic Calendar does have a default century * @internal */ - virtual UBool haveDefaultCentury() const; + virtual UBool haveDefaultCentury() const override; protected: /** diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.cpp index ba5357dbc..c7c573bac 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.cpp @@ -17,6 +17,8 @@ #include "chnsecal.h" +#include + #if !UCONFIG_NO_FORMATTING #include "umutex.h" @@ -26,6 +28,7 @@ #include "unicode/simpletz.h" #include "uhash.h" #include "ucln_in.h" +#include "cstring.h" // Debugging #ifdef U_DEBUG_CHNSECAL @@ -52,14 +55,14 @@ static void debug_chnsecal_msg(const char *pat, ...) // --- The cache -- static icu::UMutex astroLock; -static icu::CalendarAstronomer *gChineseCalendarAstro = NULL; +static icu::CalendarAstronomer *gChineseCalendarAstro = nullptr; // Lazy Creation & Access synchronized by class CalendarCache with a mutex. -static icu::CalendarCache *gChineseCalendarWinterSolsticeCache = NULL; -static icu::CalendarCache *gChineseCalendarNewYearCache = NULL; +static icu::CalendarCache *gChineseCalendarWinterSolsticeCache = nullptr; +static icu::CalendarCache *gChineseCalendarNewYearCache = nullptr; -static icu::TimeZone *gChineseCalendarZoneAstroCalc = NULL; -static icu::UInitOnce gChineseCalendarZoneAstroCalcInitOnce = U_INITONCE_INITIALIZER; +static icu::TimeZone *gChineseCalendarZoneAstroCalc = nullptr; +static icu::UInitOnce gChineseCalendarZoneAstroCalcInitOnce {}; /** * The start year of the Chinese calendar, the 61st year of the reign @@ -85,25 +88,25 @@ static const int32_t SYNODIC_GAP = 25; U_CDECL_BEGIN -static UBool calendar_chinese_cleanup(void) { +static UBool calendar_chinese_cleanup() { if (gChineseCalendarAstro) { delete gChineseCalendarAstro; - gChineseCalendarAstro = NULL; + gChineseCalendarAstro = nullptr; } if (gChineseCalendarWinterSolsticeCache) { delete gChineseCalendarWinterSolsticeCache; - gChineseCalendarWinterSolsticeCache = NULL; + gChineseCalendarWinterSolsticeCache = nullptr; } if (gChineseCalendarNewYearCache) { delete gChineseCalendarNewYearCache; - gChineseCalendarNewYearCache = NULL; + gChineseCalendarNewYearCache = nullptr; } if (gChineseCalendarZoneAstroCalc) { delete gChineseCalendarZoneAstroCalc; - gChineseCalendarZoneAstroCalc = NULL; + gChineseCalendarZoneAstroCalc = nullptr; } gChineseCalendarZoneAstroCalcInitOnce.reset(); - return TRUE; + return true; } U_CDECL_END @@ -123,8 +126,8 @@ ChineseCalendar* ChineseCalendar::clone() const { } ChineseCalendar::ChineseCalendar(const Locale& aLocale, UErrorCode& success) -: Calendar(TimeZone::createDefault(), aLocale, success), - isLeapYear(FALSE), +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success), + hasLeapMonthBetweenWinterSolstices(false), fEpochYear(CHINESE_EPOCH_YEAR), fZoneAstroCalc(getChineseCalZoneAstroCalc()) { @@ -133,8 +136,8 @@ ChineseCalendar::ChineseCalendar(const Locale& aLocale, UErrorCode& success) ChineseCalendar::ChineseCalendar(const Locale& aLocale, int32_t epochYear, const TimeZone* zoneAstroCalc, UErrorCode &success) -: Calendar(TimeZone::createDefault(), aLocale, success), - isLeapYear(FALSE), +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success), + hasLeapMonthBetweenWinterSolstices(false), fEpochYear(epochYear), fZoneAstroCalc(zoneAstroCalc) { @@ -142,7 +145,7 @@ ChineseCalendar::ChineseCalendar(const Locale& aLocale, int32_t epochYear, } ChineseCalendar::ChineseCalendar(const ChineseCalendar& other) : Calendar(other) { - isLeapYear = other.isLeapYear; + hasLeapMonthBetweenWinterSolstices = other.hasLeapMonthBetweenWinterSolstices; fEpochYear = other.fEpochYear; fZoneAstroCalc = other.fZoneAstroCalc; } @@ -151,7 +154,7 @@ ChineseCalendar::~ChineseCalendar() { } -const char *ChineseCalendar::getType() const { +const char *ChineseCalendar::getType() const { return "chinese"; } @@ -160,7 +163,7 @@ static void U_CALLCONV initChineseCalZoneAstroCalc() { ucln_i18n_registerCleanup(UCLN_I18N_CHINESE_CALENDAR, calendar_chinese_cleanup); } -const TimeZone* ChineseCalendar::getChineseCalZoneAstroCalc(void) const { +const TimeZone* ChineseCalendar::getChineseCalZoneAstroCalc() const { umtx_initOnce(gChineseCalendarZoneAstroCalcInitOnce, &initChineseCalZoneAstroCalc); return gChineseCalendarZoneAstroCalc; } @@ -170,7 +173,7 @@ const TimeZone* ChineseCalendar::getChineseCalZoneAstroCalc(void) const { //------------------------------------------------------------------------- -static const int32_t CHNSECAL_LIMITS[UCAL_FIELD_COUNT][4] = { +static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = { // Minimum Greatest Least Maximum // Minimum Maximum { 1, 1, 83333, 83333}, // ERA @@ -196,6 +199,7 @@ static const int32_t CHNSECAL_LIMITS[UCAL_FIELD_COUNT][4] = { {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // JULIAN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // MILLISECONDS_IN_DAY { 0, 0, 1, 1}, // IS_LEAP_MONTH + { 0, 0, 11, 12}, // ORDINAL_MONTH }; @@ -203,7 +207,7 @@ static const int32_t CHNSECAL_LIMITS[UCAL_FIELD_COUNT][4] = { * @draft ICU 2.4 */ int32_t ChineseCalendar::handleGetLimit(UCalendarDateFields field, ELimitType limitType) const { - return CHNSECAL_LIMITS[field][limitType]; + return LIMITS[field][limitType]; } @@ -239,9 +243,9 @@ int32_t ChineseCalendar::handleGetExtendedYear() { * @stable ICU 2.8 */ int32_t ChineseCalendar::handleGetMonthLength(int32_t extendedYear, int32_t month) const { - int32_t thisStart = handleComputeMonthStart(extendedYear, month, TRUE) - + int32_t thisStart = handleComputeMonthStart(extendedYear, month, true) - kEpochStartAsJulianDay + 1; // Julian day -> local days - int32_t nextStart = newMoonNear(thisStart + SYNODIC_GAP, TRUE); + int32_t nextStart = newMoonNear(thisStart + SYNODIC_GAP, true); return nextStart - thisStart; } @@ -255,7 +259,7 @@ int32_t ChineseCalendar::handleGetMonthLength(int32_t extendedYear, int32_t mont *

  • DAY_OF_MONTH *
  • DAY_OF_YEAR *
  • EXTENDED_YEAR - * + * * The DAY_OF_WEEK and DOW_LOCAL fields are already set when this * method is called. The getGregorianXxx() methods return Gregorian * calendar equivalents for the given Julian day. @@ -267,7 +271,7 @@ void ChineseCalendar::handleComputeFields(int32_t julianDay, UErrorCode &/*statu computeChineseFields(julianDay - kEpochStartAsJulianDay, // local days getGregorianYear(), getGregorianMonth(), - TRUE); // set all fields + true); // set all fields } /** @@ -310,7 +314,7 @@ const UFieldResolutionTable* ChineseCalendar::getFieldResolutionTable() const { /** * Return the Julian day number of day before the first day of the * given month in the given extended year. - * + * *

    Note: This method reads the IS_LEAP_MONTH field to determine * whether the given month is a leap month. * @param eyear the extended year @@ -321,25 +325,25 @@ const UFieldResolutionTable* ChineseCalendar::getFieldResolutionTable() const { * @stable ICU 2.8 */ int32_t ChineseCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const { - ChineseCalendar *nonConstThis = (ChineseCalendar*)this; // cast away const // If the month is out of range, adjust it into range, and // modify the extended year value accordingly. if (month < 0 || month > 11) { double m = month; - eyear += (int32_t)ClockMath::floorDivide(m, 12.0, m); + eyear += (int32_t)ClockMath::floorDivide(m, 12.0, &m); month = (int32_t)m; } int32_t gyear = eyear + fEpochYear - 1; // Gregorian year int32_t theNewYear = newYear(gyear); - int32_t newMoon = newMoonNear(theNewYear + month * 29, TRUE); - + int32_t newMoon = newMoonNear(theNewYear + month * 29, true); + int32_t julianDay = newMoon + kEpochStartAsJulianDay; // Save fields for later restoration int32_t saveMonth = internalGet(UCAL_MONTH); + int32_t saveOrdinalMonth = internalGet(UCAL_ORDINAL_MONTH); int32_t saveIsLeapMonth = internalGet(UCAL_IS_LEAP_MONTH); // Ignore IS_LEAP_MONTH field if useMonth is false @@ -349,20 +353,20 @@ int32_t ChineseCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, U nonConstThis->computeGregorianFields(julianDay, status); if (U_FAILURE(status)) return 0; - + // This will modify the MONTH and IS_LEAP_MONTH fields (only) nonConstThis->computeChineseFields(newMoon, getGregorianYear(), - getGregorianMonth(), FALSE); + getGregorianMonth(), false); if (month != internalGet(UCAL_MONTH) || isLeapMonth != internalGet(UCAL_IS_LEAP_MONTH)) { - newMoon = newMoonNear(newMoon + SYNODIC_GAP, TRUE); + newMoon = newMoonNear(newMoon + SYNODIC_GAP, true); julianDay = newMoon + kEpochStartAsJulianDay; } nonConstThis->internalSet(UCAL_MONTH, saveMonth); + nonConstThis->internalSet(UCAL_ORDINAL_MONTH, saveOrdinalMonth); nonConstThis->internalSet(UCAL_IS_LEAP_MONTH, saveIsLeapMonth); - return julianDay - 1; } @@ -374,13 +378,14 @@ int32_t ChineseCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, U void ChineseCalendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& status) { switch (field) { case UCAL_MONTH: + case UCAL_ORDINAL_MONTH: if (amount != 0) { int32_t dom = get(UCAL_DAY_OF_MONTH, status); if (U_FAILURE(status)) break; int32_t day = get(UCAL_JULIAN_DAY, status) - kEpochStartAsJulianDay; // Get local day if (U_FAILURE(status)) break; - int32_t moon = day - dom + 1; // New moon - offsetMonth(moon, dom, amount); + int32_t moon = day - dom + 1; // New moon + offsetMonth(moon, dom, amount, status); } break; default: @@ -404,6 +409,7 @@ void ChineseCalendar::add(EDateFields field, int32_t amount, UErrorCode& status) void ChineseCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) { switch (field) { case UCAL_MONTH: + case UCAL_ORDINAL_MONTH: if (amount != 0) { int32_t dom = get(UCAL_DAY_OF_MONTH, status); if (U_FAILURE(status)) break; @@ -419,7 +425,7 @@ void ChineseCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode // leap year. int32_t m = get(UCAL_MONTH, status); // 0-based month if (U_FAILURE(status)) break; - if (isLeapYear) { // (member variable) + if (hasLeapMonthBetweenWinterSolstices) { // (member variable) if (get(UCAL_IS_LEAP_MONTH, status) == 1) { ++m; } else { @@ -432,7 +438,7 @@ void ChineseCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode // otherwise it will be the start of month 1. int moon1 = moon - (int) (CalendarAstronomer::SYNODIC_MONTH * (m - 0.5)); - moon1 = newMoonNear(moon1, TRUE); + moon1 = newMoonNear(moon1, true); if (isLeapMonthBetween(moon1, moon)) { ++m; } @@ -442,14 +448,14 @@ void ChineseCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode // Now do the standard roll computation on m, with the // allowed range of 0..n-1, where n is 12 or 13. - int32_t n = isLeapYear ? 13 : 12; // Months in this year + int32_t n = hasLeapMonthBetweenWinterSolstices ? 13 : 12; // Months in this year int32_t newM = (m + amount) % n; if (newM < 0) { newM += n; } if (newM != m) { - offsetMonth(moon, dom, newM - m); + offsetMonth(moon, dom, newM - m, status); } } break; @@ -470,22 +476,22 @@ void ChineseCalendar::roll(EDateFields field, int32_t amount, UErrorCode& status /** * Convert local days to UTC epoch milliseconds. - * This is not an accurate conversion in that getTimezoneOffset - * takes the milliseconds in GMT (not local time). In theory, more - * accurate algorithm can be implemented but practically we do not need - * to go through that complication as long as the historical timezone - * changes did not happen around the 'tricky' new moon (new moon around - * midnight). - * + * This is not an accurate conversion in that getTimezoneOffset + * takes the milliseconds in GMT (not local time). In theory, more + * accurate algorithm can be implemented but practically we do not need + * to go through that complication as long as the historical timezone + * changes did not happen around the 'tricky' new moon (new moon around + * midnight). + * * @param days days after January 1, 1970 0:00 in the astronomical base zone * @return milliseconds after January 1, 1970 0:00 GMT */ double ChineseCalendar::daysToMillis(double days) const { double millis = days * (double)kOneDay; - if (fZoneAstroCalc != NULL) { + if (fZoneAstroCalc != nullptr) { int32_t rawOffset, dstOffset; UErrorCode status = U_ZERO_ERROR; - fZoneAstroCalc->getOffset(millis, FALSE, rawOffset, dstOffset, status); + fZoneAstroCalc->getOffset(millis, false, rawOffset, dstOffset, status); if (U_SUCCESS(status)) { return millis - (double)(rawOffset + dstOffset); } @@ -499,10 +505,10 @@ double ChineseCalendar::daysToMillis(double days) const { * @return days after January 1, 1970 0:00 in the astronomical base zone */ double ChineseCalendar::millisToDays(double millis) const { - if (fZoneAstroCalc != NULL) { + if (fZoneAstroCalc != nullptr) { int32_t rawOffset, dstOffset; UErrorCode status = U_ZERO_ERROR; - fZoneAstroCalc->getOffset(millis, FALSE, rawOffset, dstOffset, status); + fZoneAstroCalc->getOffset(millis, false, rawOffset, dstOffset, status); if (U_SUCCESS(status)) { return ClockMath::floorDivide(millis + (double)(rawOffset + dstOffset), kOneDay); } @@ -536,12 +542,12 @@ int32_t ChineseCalendar::winterSolstice(int32_t gyear) const { double ms = daysToMillis(Grego::fieldsToDay(gyear, UCAL_DECEMBER, 1)); umtx_lock(&astroLock); - if(gChineseCalendarAstro == NULL) { + if(gChineseCalendarAstro == nullptr) { gChineseCalendarAstro = new CalendarAstronomer(); ucln_i18n_registerCleanup(UCLN_I18N_CHINESE_CALENDAR, calendar_chinese_cleanup); } gChineseCalendarAstro->setTime(ms); - UDate solarLong = gChineseCalendarAstro->getSunTime(CalendarAstronomer::WINTER_SOLSTICE(), TRUE); + UDate solarLong = gChineseCalendarAstro->getSunTime(CalendarAstronomer::WINTER_SOLSTICE(), true); umtx_unlock(&astroLock); // Winter solstice is 270 degrees solar longitude aka Dongzhi @@ -564,16 +570,16 @@ int32_t ChineseCalendar::winterSolstice(int32_t gyear) const { * new moon after or before days */ int32_t ChineseCalendar::newMoonNear(double days, UBool after) const { - + umtx_lock(&astroLock); - if(gChineseCalendarAstro == NULL) { + if(gChineseCalendarAstro == nullptr) { gChineseCalendarAstro = new CalendarAstronomer(); ucln_i18n_registerCleanup(UCLN_I18N_CHINESE_CALENDAR, calendar_chinese_cleanup); } gChineseCalendarAstro->setTime(daysToMillis(days)); UDate newMoon = gChineseCalendarAstro->getMoonTime(CalendarAstronomer::NEW_MOON(), after); umtx_unlock(&astroLock); - + return (int32_t) millisToDays(newMoon); } @@ -596,9 +602,9 @@ int32_t ChineseCalendar::synodicMonthsBetween(int32_t day1, int32_t day2) const * @param days days after January 1, 1970 0:00 Asia/Shanghai */ int32_t ChineseCalendar::majorSolarTerm(int32_t days) const { - + umtx_lock(&astroLock); - if(gChineseCalendarAstro == NULL) { + if(gChineseCalendarAstro == nullptr) { gChineseCalendarAstro = new CalendarAstronomer(); ucln_i18n_registerCleanup(UCLN_I18N_CHINESE_CALENDAR, calendar_chinese_cleanup); } @@ -621,7 +627,7 @@ int32_t ChineseCalendar::majorSolarTerm(int32_t days) const { */ UBool ChineseCalendar::hasNoMajorSolarTerm(int32_t newMoon) const { return majorSolarTerm(newMoon) == - majorSolarTerm(newMoonNear(newMoon + SYNODIC_GAP, TRUE)); + majorSolarTerm(newMoonNear(newMoon + SYNODIC_GAP, true)); } @@ -649,9 +655,13 @@ UBool ChineseCalendar::isLeapMonthBetween(int32_t newMoon1, int32_t newMoon2) co } #endif - return (newMoon2 >= newMoon1) && - (isLeapMonthBetween(newMoon1, newMoonNear(newMoon2 - SYNODIC_GAP, FALSE)) || - hasNoMajorSolarTerm(newMoon2)); + while (newMoon2 >= newMoon1) { + if (hasNoMajorSolarTerm(newMoon2)) { + return true; + } + newMoon2 = newMoonNear(newMoon2 - SYNODIC_GAP, false); + } + return false; } /** @@ -661,7 +671,7 @@ UBool ChineseCalendar::isLeapMonthBetween(int32_t newMoon1, int32_t newMoon2) co * IS_LEAP_MONTH fields, as required by * handleComputeMonthStart(). * - *

    As a side effect, this method sets {@link #isLeapYear}. + *

    As a side effect, this method sets {@link #hasLeapMonthBetweenWinterSolstices}. * @param days days after January 1, 1970 0:00 astronomical base zone * of the date to compute fields for * @param gyear the Gregorian year of the given date @@ -672,7 +682,6 @@ UBool ChineseCalendar::isLeapMonthBetween(int32_t newMoon1, int32_t newMoon2) co */ void ChineseCalendar::computeChineseFields(int32_t days, int32_t gyear, int32_t gmonth, UBool setAllFields) { - // Find the winter solstices before and after the target date. // These define the boundaries of this Chinese year, specifically, // the position of month 11, which always contains the solstice. @@ -689,31 +698,40 @@ void ChineseCalendar::computeChineseFields(int32_t days, int32_t gyear, int32_t // Find the start of the month after month 11. This will be either // the prior month 12 or leap month 11 (very rare). Also find the // start of the following month 11. - int32_t firstMoon = newMoonNear(solsticeBefore + 1, TRUE); - int32_t lastMoon = newMoonNear(solsticeAfter + 1, FALSE); - int32_t thisMoon = newMoonNear(days + 1, FALSE); // Start of this month - // Note: isLeapYear is a member variable - isLeapYear = synodicMonthsBetween(firstMoon, lastMoon) == 12; + int32_t firstMoon = newMoonNear(solsticeBefore + 1, true); + int32_t lastMoon = newMoonNear(solsticeAfter + 1, false); + int32_t thisMoon = newMoonNear(days + 1, false); // Start of this month + // Note: hasLeapMonthBetweenWinterSolstices is a member variable + hasLeapMonthBetweenWinterSolstices = synodicMonthsBetween(firstMoon, lastMoon) == 12; int32_t month = synodicMonthsBetween(firstMoon, thisMoon); - if (isLeapYear && isLeapMonthBetween(firstMoon, thisMoon)) { + int32_t theNewYear = newYear(gyear); + if (days < theNewYear) { + theNewYear = newYear(gyear-1); + } + if (hasLeapMonthBetweenWinterSolstices && isLeapMonthBetween(firstMoon, thisMoon)) { month--; } if (month < 1) { month += 12; } - - UBool isLeapMonth = isLeapYear && + int32_t ordinalMonth = synodicMonthsBetween(theNewYear, thisMoon); + if (ordinalMonth < 0) { + ordinalMonth += 12; + } + UBool isLeapMonth = hasLeapMonthBetweenWinterSolstices && hasNoMajorSolarTerm(thisMoon) && - !isLeapMonthBetween(firstMoon, newMoonNear(thisMoon - SYNODIC_GAP, FALSE)); + !isLeapMonthBetween(firstMoon, newMoonNear(thisMoon - SYNODIC_GAP, false)); internalSet(UCAL_MONTH, month-1); // Convert from 1-based to 0-based + internalSet(UCAL_ORDINAL_MONTH, ordinalMonth); // Convert from 1-based to 0-based internalSet(UCAL_IS_LEAP_MONTH, isLeapMonth?1:0); + if (setAllFields) { // Extended year and cycle year is based on the epoch year - + int32_t extended_year = gyear - fEpochYear; int cycle_year = gyear - CHINESE_EPOCH_YEAR; if (month < 11 || @@ -727,7 +745,7 @@ void ChineseCalendar::computeChineseFields(int32_t days, int32_t gyear, int32_t // 0->0,60 1->1,1 60->1,60 61->2,1 etc. int32_t yearOfCycle; - int32_t cycle = ClockMath::floorDivide(cycle_year - 1, 60, yearOfCycle); + int32_t cycle = ClockMath::floorDivide(cycle_year - 1, 60, &yearOfCycle); internalSet(UCAL_ERA, cycle + 1); internalSet(UCAL_YEAR, yearOfCycle + 1); @@ -764,13 +782,13 @@ int32_t ChineseCalendar::newYear(int32_t gyear) const { int32_t solsticeBefore= winterSolstice(gyear - 1); int32_t solsticeAfter = winterSolstice(gyear); - int32_t newMoon1 = newMoonNear(solsticeBefore + 1, TRUE); - int32_t newMoon2 = newMoonNear(newMoon1 + SYNODIC_GAP, TRUE); - int32_t newMoon11 = newMoonNear(solsticeAfter + 1, FALSE); - + int32_t newMoon1 = newMoonNear(solsticeBefore + 1, true); + int32_t newMoon2 = newMoonNear(newMoon1 + SYNODIC_GAP, true); + int32_t newMoon11 = newMoonNear(solsticeAfter + 1, false); + if (synodicMonthsBetween(newMoon1, newMoon11) == 12 && (hasNoMajorSolarTerm(newMoon1) || hasNoMajorSolarTerm(newMoon2))) { - cacheValue = newMoonNear(newMoon2 + SYNODIC_GAP, TRUE); + cacheValue = newMoonNear(newMoon2 + SYNODIC_GAP, true); } else { cacheValue = newMoon2; } @@ -793,15 +811,24 @@ int32_t ChineseCalendar::newYear(int32_t gyear) const { * @param dom the 1-based day-of-month of the start position * @param delta the number of months to move forward or backward from * the start position + * @param status The status. */ -void ChineseCalendar::offsetMonth(int32_t newMoon, int32_t dom, int32_t delta) { - UErrorCode status = U_ZERO_ERROR; +void ChineseCalendar::offsetMonth(int32_t newMoon, int32_t dom, int32_t delta, + UErrorCode& status) { + if (U_FAILURE(status)) { return; } // Move to the middle of the month before our target month. - newMoon += (int32_t) (CalendarAstronomer::SYNODIC_MONTH * (delta - 0.5)); + double value = newMoon; + value += (CalendarAstronomer::SYNODIC_MONTH * + (static_cast(delta) - 0.5)); + if (value < INT32_MIN || value > INT32_MAX) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } + newMoon = static_cast(value); // Search forward to the target month's new moon - newMoon = newMoonNear(newMoon, TRUE); + newMoon = newMoonNear(newMoon, true); // Find the target dom int32_t jd = newMoon + kEpochStartAsJulianDay - 1 + dom; @@ -825,30 +852,33 @@ void ChineseCalendar::offsetMonth(int32_t newMoon, int32_t dom, int32_t delta) { } } +constexpr uint32_t kChineseRelatedYearDiff = -2637; -UBool -ChineseCalendar::inDaylightTime(UErrorCode& status) const +int32_t ChineseCalendar::getRelatedYear(UErrorCode &status) const { - // copied from GregorianCalendar - if (U_FAILURE(status) || !getTimeZone().useDaylightTime()) - return FALSE; - - // Force an update of the state of the Calendar. - ((ChineseCalendar*)this)->complete(status); // cast away const + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; + } + return year + kChineseRelatedYearDiff; +} - return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : FALSE); +void ChineseCalendar::setRelatedYear(int32_t year) +{ + // set extended year + set(UCAL_EXTENDED_YEAR, year - kChineseRelatedYearDiff); } // default century -static UDate chnsecal_gSystemDefaultCenturyStart = DBL_MIN; -static int32_t chnsecal_gSystemDefaultCenturyStartYear = -1; -static icu::UInitOnce chnsecal_gSystemDefaultCenturyInitOnce = U_INITONCE_INITIALIZER; +static UDate gSystemDefaultCenturyStart = DBL_MIN; +static int32_t gSystemDefaultCenturyStartYear = -1; +static icu::UInitOnce gSystemDefaultCenturyInitOnce {}; UBool ChineseCalendar::haveDefaultCentury() const { - return TRUE; + return true; } UDate ChineseCalendar::defaultCenturyStart() const @@ -861,7 +891,7 @@ int32_t ChineseCalendar::defaultCenturyStartYear() const return internalGetDefaultCenturyStartYear(); } -static void U_CALLCONV initializeChnseCalSystemDefaultCentury() +static void U_CALLCONV initializeSystemDefaultCentury() { // initialize systemDefaultCentury and systemDefaultCenturyYear based // on the current time. They'll be set to 80 years before @@ -871,8 +901,8 @@ static void U_CALLCONV initializeChnseCalSystemDefaultCentury() if (U_SUCCESS(status)) { calendar.setTime(Calendar::getNow(), status); calendar.add(UCAL_YEAR, -80, status); - chnsecal_gSystemDefaultCenturyStart = calendar.getTime(status); - chnsecal_gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); + gSystemDefaultCenturyStart = calendar.getTime(status); + gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); } // We have no recourse upon failure unless we want to propagate the failure // out. @@ -882,20 +912,96 @@ UDate ChineseCalendar::internalGetDefaultCenturyStart() const { // lazy-evaluate systemDefaultCenturyStart - umtx_initOnce(chnsecal_gSystemDefaultCenturyInitOnce, &initializeChnseCalSystemDefaultCentury); - return chnsecal_gSystemDefaultCenturyStart; + umtx_initOnce(gSystemDefaultCenturyInitOnce, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStart; } int32_t ChineseCalendar::internalGetDefaultCenturyStartYear() const { // lazy-evaluate systemDefaultCenturyStartYear - umtx_initOnce(chnsecal_gSystemDefaultCenturyInitOnce, &initializeChnseCalSystemDefaultCentury); - return chnsecal_gSystemDefaultCenturyStartYear; + umtx_initOnce(gSystemDefaultCenturyInitOnce, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStartYear; +} + +bool +ChineseCalendar::inTemporalLeapYear(UErrorCode &status) const +{ + int32_t days = getActualMaximum(UCAL_DAY_OF_YEAR, status); + if (U_FAILURE(status)) return false; + return days > 360; } UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ChineseCalendar) + +static const char * const gTemporalLeapMonthCodes[] = { + "M01L", "M02L", "M03L", "M04L", "M05L", "M06L", + "M07L", "M08L", "M09L", "M10L", "M11L", "M12L", nullptr +}; + +const char* ChineseCalendar::getTemporalMonthCode(UErrorCode &status) const { + // We need to call get, not internalGet, to force the calculation + // from UCAL_ORDINAL_MONTH. + int32_t is_leap = get(UCAL_IS_LEAP_MONTH, status); + if (U_FAILURE(status)) return nullptr; + if (is_leap != 0) { + int32_t month = get(UCAL_MONTH, status); + if (U_FAILURE(status)) return nullptr; + return gTemporalLeapMonthCodes[month]; + } + return Calendar::getTemporalMonthCode(status); +} + +void +ChineseCalendar::setTemporalMonthCode(const char* code, UErrorCode& status ) +{ + if (U_FAILURE(status)) return; + int32_t len = static_cast(uprv_strlen(code)); + if (len != 4 || code[0] != 'M' || code[3] != 'L') { + set(UCAL_IS_LEAP_MONTH, 0); + return Calendar::setTemporalMonthCode(code, status); + } + for (int m = 0; gTemporalLeapMonthCodes[m] != nullptr; m++) { + if (uprv_strcmp(code, gTemporalLeapMonthCodes[m]) == 0) { + set(UCAL_MONTH, m); + set(UCAL_IS_LEAP_MONTH, 1); + return; + } + } + status = U_ILLEGAL_ARGUMENT_ERROR; +} + +int32_t ChineseCalendar::internalGetMonth() const { + if (resolveFields(kMonthPrecedence) == UCAL_MONTH) { + return internalGet(UCAL_MONTH); + } + LocalPointer temp(this->clone()); + temp->set(UCAL_MONTH, 0); + temp->set(UCAL_IS_LEAP_MONTH, 0); + temp->set(UCAL_DATE, 1); + // Calculate the UCAL_MONTH and UCAL_IS_LEAP_MONTH by adding number of + // months. + UErrorCode status = U_ZERO_ERROR; + temp->roll(UCAL_MONTH, internalGet(UCAL_ORDINAL_MONTH), status); + U_ASSERT(U_SUCCESS(status)); + + ChineseCalendar *nonConstThis = (ChineseCalendar*)this; // cast away const + nonConstThis->internalSet(UCAL_IS_LEAP_MONTH, temp->get(UCAL_IS_LEAP_MONTH, status)); + U_ASSERT(U_SUCCESS(status)); + int32_t month = temp->get(UCAL_MONTH, status); + U_ASSERT(U_SUCCESS(status)); + nonConstThis->internalSet(UCAL_MONTH, month); + return month; +} + +int32_t ChineseCalendar::internalGetMonth(int32_t defaultValue) const { + if (resolveFields(kMonthPrecedence) == UCAL_MONTH) { + return internalGet(UCAL_MONTH, defaultValue); + } + return internalGetMonth(); +} + U_NAMESPACE_END #endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.h b/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.h index a0c21b6b5..e4910f6eb 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.h @@ -75,10 +75,6 @@ U_NAMESPACE_BEGIN *

  • Dershowitz and Reingold, Calendrical Calculations, * Cambridge University Press, 1997
  • * - *
  • Helmer Aslaksen's - * - * Chinese Calendar page
  • - * *
  • The * Calendar FAQ
  • * @@ -113,6 +109,49 @@ class U_I18N_API ChineseCalendar : public Calendar { */ ChineseCalendar(const Locale& aLocale, UErrorCode &success); + /** + * Returns true if the date is in a leap year. + * + * @param status ICU Error Code + * @return True if the date in the fields is in a Temporal proposal + * defined leap year. False otherwise. + */ + virtual bool inTemporalLeapYear(UErrorCode &status) const override; + + /** + * Gets The Temporal monthCode value corresponding to the month for the date. + * The value is a string identifier that starts with the literal grapheme + * "M" followed by two graphemes representing the zero-padded month number + * of the current month in a normal (non-leap) year and suffixed by an + * optional literal grapheme "L" if this is a leap month in a lunisolar + * calendar. For Chinese calendars (including Dangi), the values are + * "M01" .. "M12" for non-leap year, and "M01" .. "M12" with one of + * "M01L" .. "M12L" for leap year. + * + * @param status ICU Error Code + * @return One of 24 possible strings in + * {"M01" .. "M12", "M01L" .. "M12L"}. + * @draft ICU 73 + */ + virtual const char* getTemporalMonthCode(UErrorCode &status) const override; + + /** + * Sets The Temporal monthCode which is a string identifier that starts + * with the literal grapheme "M" followed by two graphemes representing + * the zero-padded month number of the current month in a normal + * (non-leap) year and suffixed by an optional literal grapheme "L" if this + * is a leap month in a lunisolar calendar. For Chinese calendars, the values + * are "M01" .. "M12" for non-leap years, and "M01" .. "M12" plus one in + * "M01L" .. "M12L" for leap year. + * + * @param temporalMonth The value to be set for temporal monthCode. One of + * 24 possible strings in {"M01" .. "M12", "M01L" .. "M12L"}. + * @param status ICU Error Code + * + * @draft ICU 73 + */ + virtual void setTemporalMonthCode(const char* code, UErrorCode& status) override; + protected: /** @@ -144,7 +183,7 @@ class U_I18N_API ChineseCalendar : public Calendar { virtual ~ChineseCalendar(); // clone - virtual ChineseCalendar* clone() const; + virtual ChineseCalendar* clone() const override; private: @@ -152,7 +191,12 @@ class U_I18N_API ChineseCalendar : public Calendar { // Internal data.... //------------------------------------------------------------------------- - UBool isLeapYear; + // There is a leap month between the Winter Solstice before and after the + // current date.This is different from leap year because in some year, such as + // 1813 and 2033, the leap month is after the Winter Solstice of that year. So + // this value could be false for a date prior to the Winter Solstice of that + // year but that year still has a leap month and therefor is a leap year. + UBool hasLeapMonthBetweenWinterSolstices; int32_t fEpochYear; // Start year of this Chinese calendar instance. const TimeZone* fZoneAstroCalc; // Zone used for the astronomical calculation // of this Chinese calendar instance. @@ -162,18 +206,32 @@ class U_I18N_API ChineseCalendar : public Calendar { //---------------------------------------------------------------------- protected: - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; - virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const; - virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const; - virtual int32_t handleGetExtendedYear(); - virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); - virtual const UFieldResolutionTable* getFieldResolutionTable() const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const override; + virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const override; + virtual int32_t handleGetExtendedYear() override; + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; + virtual const UFieldResolutionTable* getFieldResolutionTable() const override; public: - virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode &status); - virtual void add(EDateFields field, int32_t amount, UErrorCode &status); - virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode &status); - virtual void roll(EDateFields field, int32_t amount, UErrorCode &status); + virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode &status) override; + virtual void add(EDateFields field, int32_t amount, UErrorCode &status) override; + virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode &status) override; + virtual void roll(EDateFields field, int32_t amount, UErrorCode &status) override; + + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const override; + + /** + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field + * @internal + */ + virtual void setRelatedYear(int32_t year) override; //---------------------------------------------------------------------- // Internal methods & astronomical calculations @@ -194,8 +252,8 @@ class U_I18N_API ChineseCalendar : public Calendar { virtual void computeChineseFields(int32_t days, int32_t gyear, int32_t gmonth, UBool setAllFields); virtual int32_t newYear(int32_t gyear) const; - virtual void offsetMonth(int32_t newMoon, int32_t dom, int32_t delta); - const TimeZone* getChineseCalZoneAstroCalc(void) const; + virtual void offsetMonth(int32_t newMoon, int32_t dom, int32_t delta, UErrorCode& status); + const TimeZone* getChineseCalZoneAstroCalc() const; // UObject stuff public: @@ -204,7 +262,7 @@ class U_I18N_API ChineseCalendar : public Calendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -217,7 +275,7 @@ class U_I18N_API ChineseCalendar : public Calendar { * @return The class ID for all objects of this class. * @internal */ - static UClassID U_EXPORT2 getStaticClassID(void); + static UClassID U_EXPORT2 getStaticClassID(); /** * return the calendar type, "chinese". @@ -225,40 +283,32 @@ class U_I18N_API ChineseCalendar : public Calendar { * @return calendar type * @internal */ - virtual const char * getType() const; - + virtual const char * getType() const override; protected: - /** - * (Overrides Calendar) Return true if the current date for this Calendar is in - * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. - * - * @param status Fill-in parameter which receives the status of this operation. - * @return True if the current date for this Calendar is in Daylight Savings Time, - * false, otherwise. - * @internal - */ - virtual UBool inDaylightTime(UErrorCode& status) const; + virtual int32_t internalGetMonth(int32_t defaultValue) const override; + virtual int32_t internalGetMonth() const override; + protected: /** - * Returns TRUE because the Islamic Calendar does have a default century + * Returns true because the Islamic Calendar does have a default century * @internal */ - virtual UBool haveDefaultCentury() const; + virtual UBool haveDefaultCentury() const override; /** * Returns the date of the start of the default century * @return start of century - in milliseconds since epoch, 1970 * @internal */ - virtual UDate defaultCenturyStart() const; + virtual UDate defaultCenturyStart() const override; /** * Returns the year in which the default century begins * @internal */ - virtual int32_t defaultCenturyStartYear() const; + virtual int32_t defaultCenturyStartYear() const override; private: // default century stuff. @@ -266,15 +316,15 @@ class U_I18N_API ChineseCalendar : public Calendar { * Returns the beginning date of the 100-year window that dates * with 2-digit years are considered to fall within. */ - UDate internalGetDefaultCenturyStart(void) const; + UDate internalGetDefaultCenturyStart() const; /** * Returns the first year of the 100-year window that dates with * 2-digit years are considered to fall within. */ - int32_t internalGetDefaultCenturyStartYear(void) const; + int32_t internalGetDefaultCenturyStartYear() const; - ChineseCalendar(); // default constructor not implemented + ChineseCalendar() = delete; // default constructor not implemented }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp index 8458fba72..96e73fabc 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp @@ -12,11 +12,11 @@ * * Date Name Description * 02/19/97 aliu Converted from java. -* 03/20/97 helena Finished first cut of implementation and got rid +* 03/20/97 helena Finished first cut of implementation and got rid * of nextDouble/previousDouble and replaced with * boolean array. * 4/10/97 aliu Clean up. Modified to work on AIX. -* 06/04/97 helena Fixed applyPattern(), toPattern() and not to include +* 06/04/97 helena Fixed applyPattern(), toPattern() and not to include * wchar.h. * 07/09/97 helena Made ParsePosition into a class. * 08/06/97 nos removed overloaded constructor, fixed 'format(array)' @@ -50,26 +50,26 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ChoiceFormat) // Special characters used by ChoiceFormat. There are two characters // used interchangeably to indicate <=. Either is parsed, but only -// CHOICE_FORMAT_LESS_EQUAL is generated by toPattern(). -#define CHOICE_FORMAT_SINGLE_QUOTE ((UChar)0x0027) /*'*/ -#define CHOICE_FORMAT_LESS_THAN ((UChar)0x003C) /*<*/ -#define CHOICE_FORMAT_LESS_EQUAL ((UChar)0x0023) /*#*/ -#define CHOICE_FORMAT_LESS_EQUAL2 ((UChar)0x2264) -#define CHOICE_FORMAT_VERTICAL_BAR ((UChar)0x007C) /*|*/ -#define CHOICE_FORMAT_MINUS ((UChar)0x002D) /*-*/ - -static const UChar LEFT_CURLY_BRACE = 0x7B; /*{*/ -static const UChar RIGHT_CURLY_BRACE = 0x7D; /*}*/ - -#ifdef CHOICE_FORMAT_INFINITY -#undef CHOICE_FORMAT_INFINITY +// LESS_EQUAL is generated by toPattern(). +#define SINGLE_QUOTE ((char16_t)0x0027) /*'*/ +#define LESS_THAN ((char16_t)0x003C) /*<*/ +#define LESS_EQUAL ((char16_t)0x0023) /*#*/ +#define LESS_EQUAL2 ((char16_t)0x2264) +#define VERTICAL_BAR ((char16_t)0x007C) /*|*/ +#define MINUS ((char16_t)0x002D) /*-*/ + +static const char16_t LEFT_CURLY_BRACE = 0x7B; /*{*/ +static const char16_t RIGHT_CURLY_BRACE = 0x7D; /*}*/ + +#ifdef INFINITY +#undef INFINITY #endif -#define CHOICE_FORMAT_INFINITY ((UChar)0x221E) +#define INFINITY ((char16_t)0x221E) -//static const UChar gPositiveInfinity[] = {CHOICE_FORMAT_INFINITY, 0}; -//static const UChar gNegativeInfinity[] = {CHOICE_FORMAT_MINUS, CHOICE_FORMAT_INFINITY, 0}; -#define CHOICE_FORMAT_POSITIVE_INF_STRLEN 1 -#define CHOICE_FORMAT_NEGATIVE_INF_STRLEN 2 +//static const char16_t gPositiveInfinity[] = {INFINITY, 0}; +//static const char16_t gNegativeInfinity[] = {MINUS, INFINITY, 0}; +#define POSITIVE_INF_STRLEN 1 +#define NEGATIVE_INF_STRLEN 2 // ------------------------------------- // Creates a ChoiceFormat instance based on the pattern. @@ -83,23 +83,23 @@ ChoiceFormat::ChoiceFormat(const UnicodeString& newPattern, } // ------------------------------------- -// Creates a ChoiceFormat instance with the limit array and +// Creates a ChoiceFormat instance with the limit array and // format strings for each limit. -ChoiceFormat::ChoiceFormat(const double* limits, - const UnicodeString* formats, +ChoiceFormat::ChoiceFormat(const double* limits, + const UnicodeString* formats, int32_t cnt ) : constructorErrorCode(U_ZERO_ERROR), msgPattern(constructorErrorCode) { - setChoices(limits, NULL, formats, cnt, constructorErrorCode); + setChoices(limits, nullptr, formats, cnt, constructorErrorCode); } // ------------------------------------- -ChoiceFormat::ChoiceFormat(const double* limits, +ChoiceFormat::ChoiceFormat(const double* limits, const UBool* closures, - const UnicodeString* formats, + const UnicodeString* formats, int32_t cnt ) : constructorErrorCode(U_ZERO_ERROR), msgPattern(constructorErrorCode) @@ -110,7 +110,7 @@ ChoiceFormat::ChoiceFormat(const double* limits, // ------------------------------------- // copy constructor -ChoiceFormat::ChoiceFormat(const ChoiceFormat& that) +ChoiceFormat::ChoiceFormat(const ChoiceFormat& that) : NumberFormat(that), constructorErrorCode(that.constructorErrorCode), msgPattern(that.msgPattern) @@ -118,8 +118,8 @@ ChoiceFormat::ChoiceFormat(const ChoiceFormat& that) } // ------------------------------------- -// Private constructor that creates a -// ChoiceFormat instance based on the +// Private constructor that creates a +// ChoiceFormat instance based on the // pattern and populates UParseError ChoiceFormat::ChoiceFormat(const UnicodeString& newPattern, @@ -135,9 +135,9 @@ ChoiceFormat::ChoiceFormat(const UnicodeString& newPattern, bool ChoiceFormat::operator==(const Format& that) const { - if (this == &that) return TRUE; - if (!NumberFormat::operator==(that)) return FALSE; - ChoiceFormat& thatAlias = (ChoiceFormat&)that; + if (this == &that) return true; + if (!NumberFormat::operator==(that)) return false; + const ChoiceFormat& thatAlias = static_cast(that); return msgPattern == thatAlias.msgPattern; } @@ -175,12 +175,10 @@ ChoiceFormat::dtos(double value, char *itrPtr = temp; char *expPtr; - int used_buffer = snprintf(temp, DBL_DIG + 16, "%.*g", DBL_DIG, value); - (void)used_buffer; - U_ASSERT(used_buffer > 0); + snprintf(temp, sizeof(temp), "%.*g", DBL_DIG, value); /* Find and convert the decimal point. - Using setlocale on some machines will cause sprintf to use a comma for certain locales. + Using setlocale on some machines will cause snprintf to use a comma for certain locales. */ while (*itrPtr && (*itrPtr == '-' || isdigit(*itrPtr))) { itrPtr++; @@ -211,7 +209,7 @@ ChoiceFormat::dtos(double value, while (*itrPtr) { *(expPtr++) = *(itrPtr++); } - // NULL terminate + // NUL terminate *expPtr = 0; } } @@ -227,7 +225,7 @@ void ChoiceFormat::applyPattern(const UnicodeString& pattern, UErrorCode& status) { - msgPattern.parseChoiceStyle(pattern, NULL, status); + msgPattern.parseChoiceStyle(pattern, nullptr, status); constructorErrorCode = status; } @@ -252,22 +250,22 @@ ChoiceFormat::toPattern(UnicodeString& result) const } // ------------------------------------- -// Sets the limit and format arrays. +// Sets the limit and format arrays. void -ChoiceFormat::setChoices( const double* limits, - const UnicodeString* formats, +ChoiceFormat::setChoices( const double* limits, + const UnicodeString* formats, int32_t cnt ) { UErrorCode errorCode = U_ZERO_ERROR; - setChoices(limits, NULL, formats, cnt, errorCode); + setChoices(limits, nullptr, formats, cnt, errorCode); } // ------------------------------------- -// Sets the limit and format arrays. +// Sets the limit and format arrays. void -ChoiceFormat::setChoices( const double* limits, +ChoiceFormat::setChoices( const double* limits, const UBool* closures, - const UnicodeString* formats, + const UnicodeString* formats, int32_t cnt ) { UErrorCode errorCode = U_ZERO_ERROR; @@ -283,7 +281,7 @@ ChoiceFormat::setChoices(const double* limits, if (U_FAILURE(errorCode)) { return; } - if (limits == NULL || formats == NULL) { + if (limits == nullptr || formats == nullptr) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -292,21 +290,21 @@ ChoiceFormat::setChoices(const double* limits, UnicodeString result; for (int32_t i = 0; i < count; ++i) { if (i != 0) { - result += CHOICE_FORMAT_VERTICAL_BAR; + result += VERTICAL_BAR; } UnicodeString buf; if (uprv_isPositiveInfinity(limits[i])) { - result += CHOICE_FORMAT_INFINITY; + result += INFINITY; } else if (uprv_isNegativeInfinity(limits[i])) { - result += CHOICE_FORMAT_MINUS; - result += CHOICE_FORMAT_INFINITY; + result += MINUS; + result += INFINITY; } else { result += dtos(limits[i], buf); } - if (closures != NULL && closures[i]) { - result += CHOICE_FORMAT_LESS_THAN; + if (closures != nullptr && closures[i]) { + result += LESS_THAN; } else { - result += CHOICE_FORMAT_LESS_EQUAL; + result += LESS_EQUAL; } // Append formats[i], using quotes if there are special // characters. Single quotes themselves must be escaped in @@ -315,11 +313,11 @@ ChoiceFormat::setChoices(const double* limits, int32_t textLength = text.length(); int32_t nestingLevel = 0; for (int32_t j = 0; j < textLength; ++j) { - UChar c = text[j]; - if (c == CHOICE_FORMAT_SINGLE_QUOTE && nestingLevel == 0) { + char16_t c = text[j]; + if (c == SINGLE_QUOTE && nestingLevel == 0) { // Double each top-level apostrophe. result.append(c); - } else if (c == CHOICE_FORMAT_VERTICAL_BAR && nestingLevel == 0) { + } else if (c == VERTICAL_BAR && nestingLevel == 0) { // Surround each pipe symbol with apostrophes for quoting. // If the next character is an apostrophe, then that will be doubled, // and although the parser will see the apostrophe pairs beginning @@ -328,7 +326,7 @@ ChoiceFormat::setChoices(const double* limits, // | -> '|' // |' -> '|''' // |'' -> '|''''' etc. - result.append(CHOICE_FORMAT_SINGLE_QUOTE).append(c).append(CHOICE_FORMAT_SINGLE_QUOTE); + result.append(SINGLE_QUOTE).append(c).append(SINGLE_QUOTE); continue; // Skip the append(c) at the end of the loop body. } else if (c == LEFT_CURLY_BRACE) { ++nestingLevel; @@ -346,20 +344,20 @@ ChoiceFormat::setChoices(const double* limits, // Gets the limit array. const double* -ChoiceFormat::getLimits(int32_t& cnt) const +ChoiceFormat::getLimits(int32_t& cnt) const { cnt = 0; - return NULL; + return nullptr; } // ------------------------------------- // Gets the closures array. const UBool* -ChoiceFormat::getClosures(int32_t& cnt) const +ChoiceFormat::getClosures(int32_t& cnt) const { cnt = 0; - return NULL; + return nullptr; } // ------------------------------------- @@ -369,7 +367,7 @@ const UnicodeString* ChoiceFormat::getFormats(int32_t& cnt) const { cnt = 0; - return NULL; + return nullptr; } // ------------------------------------- @@ -378,8 +376,8 @@ ChoiceFormat::getFormats(int32_t& cnt) const // from the input number because of this. UnicodeString& -ChoiceFormat::format(int64_t number, - UnicodeString& appendTo, +ChoiceFormat::format(int64_t number, + UnicodeString& appendTo, FieldPosition& status) const { return format((double) number, appendTo, status); @@ -390,8 +388,8 @@ ChoiceFormat::format(int64_t number, // a double. UnicodeString& -ChoiceFormat::format(int32_t number, - UnicodeString& appendTo, +ChoiceFormat::format(int32_t number, + UnicodeString& appendTo, FieldPosition& status) const { return format((double) number, appendTo, status); @@ -401,8 +399,8 @@ ChoiceFormat::format(int32_t number, // Formats a double number. UnicodeString& -ChoiceFormat::format(double number, - UnicodeString& appendTo, +ChoiceFormat::format(double number, + UnicodeString& appendTo, FieldPosition& /*pos*/) const { if (msgPattern.countParts() == 0) { @@ -452,8 +450,8 @@ ChoiceFormat::findSubMessage(const MessagePattern &pattern, int32_t partIndex, d double boundary = pattern.getNumericValue(part); // Fetch the ARG_SELECTOR character. int32_t selectorIndex = pattern.getPatternIndex(partIndex++); - UChar boundaryChar = pattern.getPatternString().charAt(selectorIndex); - if (boundaryChar == CHOICE_FORMAT_LESS_THAN ? !(number > boundary) : !(number >= boundary)) { + char16_t boundaryChar = pattern.getPatternString().charAt(selectorIndex); + if (boundaryChar == LESS_THAN ? !(number > boundary) : !(number >= boundary)) { // The number is in the interval between the previous boundary and the current one. // Return with the sub-message between them. // The !(a>b) and !(a>=b) comparisons are equivalent to @@ -466,7 +464,7 @@ ChoiceFormat::findSubMessage(const MessagePattern &pattern, int32_t partIndex, d // ------------------------------------- // Formats an array of objects. Checks if the data type of the objects -// to get the right value for formatting. +// to get the right value for formatting. UnicodeString& ChoiceFormat::format(const Formattable* objs, @@ -497,7 +495,7 @@ ChoiceFormat::format(const Formattable* objs, // ------------------------------------- void -ChoiceFormat::parse(const UnicodeString& text, +ChoiceFormat::parse(const UnicodeString& text, Formattable& result, ParsePosition& pos) const { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp index 2a7dd65e2..be0a8e469 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp @@ -20,7 +20,7 @@ * 08/03/98 erm Synched with 1.2 version of CollationElementIterator.java * 12/10/99 aliu Ported Thai collation support from Java. * 01/25/01 swquek Modified to a C++ wrapper calling C APIs (ucoliter.h) -* 02/19/01 swquek Removed CollationElementIterator() since it is +* 02/19/01 swquek Removed CollationElementIterator() since it is * private constructor and no calls are made to it * 2012-2014 markus Rewritten in C++ again. */ @@ -53,8 +53,8 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CollationElementIterator) /* CollationElementIterator public constructor/destructor ------------------ */ CollationElementIterator::CollationElementIterator( - const CollationElementIterator& other) - : UObject(other), iter_(NULL), rbc_(NULL), otherHalf_(0), dir_(0), offsets_(NULL) { + const CollationElementIterator& other) + : UObject(other), iter_(nullptr), rbc_(nullptr), otherHalf_(0), dir_(0), offsets_(nullptr) { *this = other; } @@ -82,7 +82,7 @@ UBool ceNeedsTwoParts(int64_t ce) { int32_t CollationElementIterator::getOffset() const { - if (dir_ < 0 && offsets_ != NULL && !offsets_->isEmpty()) { + if (dir_ < 0 && offsets_ != nullptr && !offsets_->isEmpty()) { // CollationIterator::previousCE() decrements the CEs length // while it pops CEs from its internal buffer. int32_t i = iter_->getCEsLength(); @@ -98,7 +98,7 @@ int32_t CollationElementIterator::getOffset() const /** * Get the ordering priority of the next character in the string. -* @return the next character's ordering. Returns NULLORDER if an error has +* @return the next character's ordering. Returns NULLORDER if an error has * occurred or if the end of string has been reached */ int32_t CollationElementIterator::next(UErrorCode& status) @@ -147,7 +147,7 @@ bool CollationElementIterator::operator==( const CollationElementIterator& that) const { if (this == &that) { - return TRUE; + return true; } return @@ -161,7 +161,7 @@ bool CollationElementIterator::operator==( /** * Get the ordering priority of the previous collation element in the string. * @param status the error code status. -* @return the previous element's ordering. Returns NULLORDER if an error has +* @return the previous element's ordering. Returns NULLORDER if an error has * occurred or if the start of string has been reached. */ int32_t CollationElementIterator::previous(UErrorCode& status) @@ -185,9 +185,9 @@ int32_t CollationElementIterator::previous(UErrorCode& status) status = U_INVALID_STATE_ERROR; return NULLORDER; } - if (offsets_ == NULL) { + if (offsets_ == nullptr) { offsets_ = new UVector32(status); - if (offsets_ == NULL) { + if (offsets_ == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return NULLORDER; } @@ -227,14 +227,14 @@ void CollationElementIterator::reset() dir_ = 0; } -void CollationElementIterator::setOffset(int32_t newOffset, +void CollationElementIterator::setOffset(int32_t newOffset, UErrorCode& status) { if (U_FAILURE(status)) { return; } if (0 < newOffset && newOffset < string_.length()) { int32_t offset = newOffset; do { - UChar c = string_.charAt(offset); + char16_t c = string_.charAt(offset); if (!rbc_->isUnsafe(c) || (U16_IS_LEAD(c) && !rbc_->isUnsafe(string_.char32At(offset)))) { break; @@ -278,7 +278,7 @@ void CollationElementIterator::setText(const UnicodeString& source, } string_ = source; - const UChar *s = string_.getBuffer(); + const char16_t *s = string_.getBuffer(); CollationIterator *newIter; UBool numeric = rbc_->settings->isNumeric(); if (rbc_->settings->dontCheckFCD()) { @@ -286,7 +286,7 @@ void CollationElementIterator::setText(const UnicodeString& source, } else { newIter = new FCDUTF16CollationIterator(rbc_->data, numeric, s, s, s + string_.length()); } - if (newIter == NULL) { + if (newIter == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -297,10 +297,10 @@ void CollationElementIterator::setText(const UnicodeString& source, } // Sets the source to the new character iterator. -void CollationElementIterator::setText(CharacterIterator& source, +void CollationElementIterator::setText(CharacterIterator& source, UErrorCode& status) { - if (U_FAILURE(status)) + if (U_FAILURE(status)) return; source.getText(string_); @@ -323,7 +323,7 @@ int32_t CollationElementIterator::strengthOrder(int32_t order) const /* CollationElementIterator private constructors/destructors --------------- */ -/** +/** * This is the "real" constructor for this class; it constructs an iterator * over the source text using the specified collator */ @@ -331,19 +331,19 @@ CollationElementIterator::CollationElementIterator( const UnicodeString &source, const RuleBasedCollator *coll, UErrorCode &status) - : iter_(NULL), rbc_(coll), otherHalf_(0), dir_(0), offsets_(NULL) { + : iter_(nullptr), rbc_(coll), otherHalf_(0), dir_(0), offsets_(nullptr) { setText(source, status); } -/** -* This is the "real" constructor for this class; it constructs an iterator over +/** +* This is the "real" constructor for this class; it constructs an iterator over * the source text using the specified collator */ CollationElementIterator::CollationElementIterator( const CharacterIterator &source, const RuleBasedCollator *coll, UErrorCode &status) - : iter_(NULL), rbc_(coll), otherHalf_(0), dir_(0), offsets_(NULL) { + : iter_(nullptr), rbc_(coll), otherHalf_(0), dir_(0), offsets_(nullptr) { // We only call source.getText() which should be const anyway. setText(const_cast(source), status); } @@ -360,18 +360,18 @@ const CollationElementIterator& CollationElementIterator::operator=( CollationIterator *newIter; const FCDUTF16CollationIterator *otherFCDIter = dynamic_cast(other.iter_); - if(otherFCDIter != NULL) { + if(otherFCDIter != nullptr) { newIter = new FCDUTF16CollationIterator(*otherFCDIter, string_.getBuffer()); } else { const UTF16CollationIterator *otherIter = dynamic_cast(other.iter_); - if(otherIter != NULL) { + if(otherIter != nullptr) { newIter = new UTF16CollationIterator(*otherIter, string_.getBuffer()); } else { - newIter = NULL; + newIter = nullptr; } } - if(newIter != NULL) { + if(newIter != nullptr) { delete iter_; iter_ = newIter; rbc_ = other.rbc_; @@ -380,12 +380,12 @@ const CollationElementIterator& CollationElementIterator::operator=( string_ = other.string_; } - if(other.dir_ < 0 && other.offsets_ != NULL && !other.offsets_->isEmpty()) { + if(other.dir_ < 0 && other.offsets_ != nullptr && !other.offsets_->isEmpty()) { UErrorCode errorCode = U_ZERO_ERROR; - if(offsets_ == NULL) { + if(offsets_ == nullptr) { offsets_ = new UVector32(other.offsets_->size(), errorCode); } - if(offsets_ != NULL) { + if(offsets_ != nullptr) { offsets_->assign(*other.offsets_, errorCode); } } @@ -398,8 +398,8 @@ class MaxExpSink : public ContractionsAndExpansions::CESink { public: MaxExpSink(UHashtable *h, UErrorCode &ec) : maxExpansions(h), errorCode(ec) {} virtual ~MaxExpSink(); - virtual void handleCE(int64_t /*ce*/) {} - virtual void handleExpansion(const int64_t ces[], int32_t length) { + virtual void handleCE(int64_t /*ce*/) override {} + virtual void handleExpansion(const int64_t ces[], int32_t length) override { if (length <= 1) { // We do not need to add single CEs into the map. return; @@ -435,15 +435,15 @@ MaxExpSink::~MaxExpSink() {} UHashtable * CollationElementIterator::computeMaxExpansions(const CollationData *data, UErrorCode &errorCode) { - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } UHashtable *maxExpansions = uhash_open(uhash_hashLong, uhash_compareLong, uhash_compareLong, &errorCode); - if (U_FAILURE(errorCode)) { return NULL; } + if (U_FAILURE(errorCode)) { return nullptr; } MaxExpSink sink(maxExpansions, errorCode); - ContractionsAndExpansions(NULL, NULL, &sink, TRUE).forData(data, errorCode); + ContractionsAndExpansions(nullptr, nullptr, &sink, true).forData(data, errorCode); if (U_FAILURE(errorCode)) { uhash_close(maxExpansions); - return NULL; + return nullptr; } return maxExpansions; } @@ -457,7 +457,7 @@ int32_t CollationElementIterator::getMaxExpansion(const UHashtable *maxExpansions, int32_t order) { if (order == 0) { return 1; } int32_t max; - if(maxExpansions != NULL && (max = uhash_igeti(maxExpansions, order)) != 0) { + if(maxExpansions != nullptr && (max = uhash_igeti(maxExpansions, order)) != 0) { return max; } if ((order & 0xc0) == 0xc0) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp index 52b83d01c..ced55c8db 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp @@ -33,14 +33,14 @@ * 05/06/97 helena Added memory allocation error detection. * 05/08/97 helena Added createInstance(). * 6/20/97 helena Java class name change. - * 04/23/99 stephen Removed EDecompositionMode, merged with + * 04/23/99 stephen Removed EDecompositionMode, merged with * Normalizer::EMode * 11/23/9 srl Inlining of some critical functions * 01/29/01 synwee Modified into a C++ wrapper calling C APIs (ucol.h) * 2012-2014 markus Rewritten in C++ again. */ -#include "utypeinfo.h" // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" @@ -61,33 +61,33 @@ #include "uresimp.h" #include "ucln_in.h" -static icu::Locale* availableLocaleList = NULL; +static icu::Locale* availableLocaleList = nullptr; static int32_t availableLocaleListCount; #if !UCONFIG_NO_SERVICE -static icu::ICULocaleService* gService = NULL; -static icu::UInitOnce gServiceInitOnce = U_INITONCE_INITIALIZER; +static icu::ICULocaleService* gService = nullptr; +static icu::UInitOnce gServiceInitOnce {}; #endif -static icu::UInitOnce gAvailableLocaleListInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce gAvailableLocaleListInitOnce {}; /** * Release all static memory held by collator. */ U_CDECL_BEGIN -static UBool U_CALLCONV collator_cleanup(void) { +static UBool U_CALLCONV collator_cleanup() { #if !UCONFIG_NO_SERVICE if (gService) { delete gService; - gService = NULL; + gService = nullptr; } gServiceInitOnce.reset(); #endif if (availableLocaleList) { delete []availableLocaleList; - availableLocaleList = NULL; + availableLocaleList = nullptr; } availableLocaleListCount = 0; gAvailableLocaleListInitOnce.reset(); - return TRUE; + return true; } U_CDECL_END @@ -108,14 +108,14 @@ CollatorFactory::~CollatorFactory() {} //------------------------------------------- UBool -CollatorFactory::visible(void) const { - return TRUE; +CollatorFactory::visible() const { + return true; } //------------------------------------------- -UnicodeString& -CollatorFactory::getDisplayName(const Locale& objectLocale, +UnicodeString& +CollatorFactory::getDisplayName(const Locale& objectLocale, const Locale& displayLocale, UnicodeString& result) { @@ -129,7 +129,7 @@ class ICUCollatorFactory : public ICUResourceBundleFactory { ICUCollatorFactory() : ICUResourceBundleFactory(UnicodeString(U_ICUDATA_COLL, -1, US_INV)) { } virtual ~ICUCollatorFactory(); protected: - virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override; }; ICUCollatorFactory::~ICUCollatorFactory() {} @@ -137,16 +137,16 @@ ICUCollatorFactory::~ICUCollatorFactory() {} UObject* ICUCollatorFactory::create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const { if (handlesKey(key, status)) { - const LocaleKey& lkey = (const LocaleKey&)key; + const LocaleKey& lkey = static_cast(key); Locale loc; // make sure the requested locale is correct // default LocaleFactory uses currentLocale since that's the one vetted by handlesKey // but for ICU rb resources we use the actual one since it will fallback again lkey.canonicalLocale(loc); - + return Collator::makeInstance(loc, status); } - return NULL; + return nullptr; } // ------------------------------------- @@ -162,12 +162,13 @@ class ICUCollatorService : public ICULocaleService { virtual ~ICUCollatorService(); - virtual UObject* cloneInstance(UObject* instance) const { + virtual UObject* cloneInstance(UObject* instance) const override { return ((Collator*)instance)->clone(); } - - virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* actualID, UErrorCode& status) const { - LocaleKey& lkey = (LocaleKey&)key; + + virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* actualID, UErrorCode& status) const override { + const LocaleKey* lkey = dynamic_cast(&key); + U_ASSERT(lkey != nullptr); if (actualID) { // Ugly Hack Alert! We return an empty actualID to signal // to callers that this is a default object, not a "real" @@ -175,19 +176,19 @@ class ICUCollatorService : public ICULocaleService { actualID->truncate(0); } Locale loc(""); - lkey.canonicalLocale(loc); + lkey->canonicalLocale(loc); return Collator::makeInstance(loc, status); } - - virtual UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const { + + virtual UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const override { UnicodeString ar; - if (actualReturn == NULL) { + if (actualReturn == nullptr) { actualReturn = &ar; } return (Collator*)ICULocaleService::getKey(key, actualReturn, status); } - virtual UBool isDefault() const { + virtual UBool isDefault() const override { return countFactories() == 1; } }; @@ -202,8 +203,8 @@ static void U_CALLCONV initService() { } -static ICULocaleService* -getService(void) +static ICULocaleService* +getService() { umtx_initOnce(gServiceInitOnce, &initService); return gService; @@ -212,35 +213,35 @@ getService(void) // ------------------------------------- static inline UBool -hasService(void) +hasService() { - UBool retVal = !gServiceInitOnce.isReset() && (getService() != NULL); + UBool retVal = !gServiceInitOnce.isReset() && (getService() != nullptr); return retVal; } #endif /* UCONFIG_NO_SERVICE */ -static void U_CALLCONV +static void U_CALLCONV initAvailableLocaleList(UErrorCode &status) { U_ASSERT(availableLocaleListCount == 0); - U_ASSERT(availableLocaleList == NULL); + U_ASSERT(availableLocaleList == nullptr); // for now, there is a hardcoded list, so just walk through that list and set it up. - UResourceBundle *index = NULL; + UResourceBundle *index = nullptr; StackUResourceBundle installed; int32_t i = 0; - + index = ures_openDirect(U_ICUDATA_COLL, "res_index", &status); ures_getByKey(index, "InstalledLocales", installed.getAlias(), &status); if(U_SUCCESS(status)) { availableLocaleListCount = ures_getSize(installed.getAlias()); availableLocaleList = new Locale[availableLocaleListCount]; - - if (availableLocaleList != NULL) { + + if (availableLocaleList != nullptr) { ures_resetIterator(installed.getAlias()); while(ures_hasNext(installed.getAlias())) { - const char *tempKey = NULL; - ures_getNextString(installed.getAlias(), NULL, &tempKey, &status); + const char *tempKey = nullptr; + ures_getNextString(installed.getAlias(), nullptr, &tempKey, &status); availableLocaleList[i++] = Locale(tempKey); } } @@ -372,7 +373,7 @@ void setAttributesFromKeywords(const Locale &loc, Collator &coll, UErrorCode &er return; } if (length != 0) { - int32_t codes[USCRIPT_CODE_LIMIT + UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST]; + int32_t codes[USCRIPT_CODE_LIMIT + (UCOL_REORDER_CODE_LIMIT - UCOL_REORDER_CODE_FIRST)]; int32_t codesLength = 0; char *scriptName = value; for (;;) { @@ -421,7 +422,7 @@ void setAttributesFromKeywords(const Locale &loc, Collator &coll, UErrorCode &er } // namespace -Collator* U_EXPORT2 Collator::createInstance(UErrorCode& success) +Collator* U_EXPORT2 Collator::createInstance(UErrorCode& success) { return createInstance(Locale::getDefault(), success); } @@ -429,12 +430,12 @@ Collator* U_EXPORT2 Collator::createInstance(UErrorCode& success) Collator* U_EXPORT2 Collator::createInstance(const Locale& desiredLocale, UErrorCode& status) { - if (U_FAILURE(status)) + if (U_FAILURE(status)) return 0; if (desiredLocale.isBogus()) { // Locale constructed from malformed locale ID or language tag. status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } Collator* coll; @@ -446,18 +447,18 @@ Collator* U_EXPORT2 Collator::createInstance(const Locale& desiredLocale, #endif { coll = makeInstance(desiredLocale, status); - // Either returns NULL with U_FAILURE(status), or non-NULL with U_SUCCESS(status) + // Either returns nullptr with U_FAILURE(status), or non-nullptr with U_SUCCESS(status) } - // The use of *coll in setAttributesFromKeywords can cause the NULL check to be + // The use of *coll in setAttributesFromKeywords can cause the nullptr check to be // optimized out of the delete even though setAttributesFromKeywords returns // immediately if U_FAILURE(status), so we add a check here. if (U_FAILURE(status)) { - return NULL; + return nullptr; } setAttributesFromKeywords(desiredLocale, *coll, status); if (U_FAILURE(status)) { delete coll; - return NULL; + return nullptr; } return coll; } @@ -467,7 +468,7 @@ Collator* Collator::makeInstance(const Locale& desiredLocale, UErrorCode& statu const CollationCacheEntry *entry = CollationLoader::loadTailoring(desiredLocale, status); if (U_SUCCESS(status)) { Collator *result = new RuleBasedCollator(entry); - if (result != NULL) { + if (result != nullptr) { // Both the unified cache's get() and the RBC constructor // did addRef(). Undo one of them. entry->removeRef(); @@ -475,11 +476,11 @@ Collator* Collator::makeInstance(const Locale& desiredLocale, UErrorCode& statu } status = U_MEMORY_ALLOCATION_ERROR; } - if (entry != NULL) { + if (entry != nullptr) { // Undo the addRef() from the cache.get(). entry->removeRef(); } - return NULL; + return nullptr; } Collator * @@ -488,7 +489,7 @@ Collator::safeClone() const { } // implement deprecated, previously abstract method -Collator::EComparisonResult Collator::compare(const UnicodeString& source, +Collator::EComparisonResult Collator::compare(const UnicodeString& source, const UnicodeString& target) const { UErrorCode ec = U_ZERO_ERROR; @@ -505,8 +506,8 @@ Collator::EComparisonResult Collator::compare(const UnicodeString& source, } // implement deprecated, previously abstract method -Collator::EComparisonResult Collator::compare(const UChar* source, int32_t sourceLength, - const UChar* target, int32_t targetLength) +Collator::EComparisonResult Collator::compare(const char16_t* source, int32_t sourceLength, + const char16_t* target, int32_t targetLength) const { UErrorCode ec = U_ZERO_ERROR; @@ -535,21 +536,21 @@ UCollationResult Collator::compareUTF8(const StringPiece &source, return compare(sIter, tIter, status); } -UBool Collator::equals(const UnicodeString& source, +UBool Collator::equals(const UnicodeString& source, const UnicodeString& target) const { UErrorCode ec = U_ZERO_ERROR; return (compare(source, target, ec) == UCOL_EQUAL); } -UBool Collator::greaterOrEqual(const UnicodeString& source, +UBool Collator::greaterOrEqual(const UnicodeString& source, const UnicodeString& target) const { UErrorCode ec = U_ZERO_ERROR; return (compare(source, target, ec) != UCOL_LESS); } -UBool Collator::greater(const UnicodeString& source, +UBool Collator::greater(const UnicodeString& source, const UnicodeString& target) const { UErrorCode ec = U_ZERO_ERROR; @@ -558,10 +559,10 @@ UBool Collator::greater(const UnicodeString& source, // this API ignores registered collators, since it returns an // array of indefinite lifetime -const Locale* U_EXPORT2 Collator::getAvailableLocales(int32_t& count) +const Locale* U_EXPORT2 Collator::getAvailableLocales(int32_t& count) { UErrorCode status = U_ZERO_ERROR; - Locale *result = NULL; + Locale *result = nullptr; count = 0; if (isAvailableLocaleListInitialized(status)) { @@ -587,14 +588,14 @@ UnicodeString& U_EXPORT2 Collator::getDisplayName(const Locale& objectLocale, UnicodeString& U_EXPORT2 Collator::getDisplayName(const Locale& objectLocale, UnicodeString& name) -{ +{ return getDisplayName(objectLocale, Locale::getDefault(), name); } /* This is useless information */ /*void Collator::getVersion(UVersionInfo versionInfo) const { - if (versionInfo!=NULL) + if (versionInfo!=nullptr) uprv_memcpy(versionInfo, fVersion, U_MAX_VERSION_LENGTH); } */ @@ -604,7 +605,7 @@ UnicodeString& U_EXPORT2 Collator::getDisplayName(const Locale& objectLocale, /** * Default constructor. * Constructor is different from the old default Collator constructor. -* The task for determing the default collation strength and normalization mode +* The task for determining the default collation strength and normalization mode * is left to the child class. */ Collator::Collator() @@ -616,7 +617,7 @@ Collator::Collator() * Constructor. * Empty constructor, does not handle the arguments. * This constructor is done for backward compatibility with 1.7 and 1.8. -* The task for handling the argument collation strength and normalization +* The task for handling the argument collation strength and normalization * mode is left to the child class. * @param collationStrength collation strength * @param decompositionMode @@ -644,7 +645,7 @@ bool Collator::operator==(const Collator& other) const bool Collator::operator!=(const Collator& other) const { - return (UBool)!(*this == other); + return !operator==(other); } int32_t U_EXPORT2 Collator::getBound(const uint8_t *source, @@ -665,7 +666,7 @@ Collator::setLocales(const Locale& /* requestedLocale */, const Locale& /* valid UnicodeSet *Collator::getTailoredSet(UErrorCode &status) const { if(U_FAILURE(status)) { - return NULL; + return nullptr; } // everything can be changed return new UnicodeSet(0, 0x10FFFF); @@ -675,7 +676,7 @@ UnicodeSet *Collator::getTailoredSet(UErrorCode &status) const #if !UCONFIG_NO_SERVICE URegistryKey U_EXPORT2 -Collator::registerInstance(Collator* toAdopt, const Locale& locale, UErrorCode& status) +Collator::registerInstance(Collator* toAdopt, const Locale& locale, UErrorCode& status) { if (U_SUCCESS(status)) { // Set the collator locales while registering so that createInstance() @@ -684,7 +685,7 @@ Collator::registerInstance(Collator* toAdopt, const Locale& locale, UErrorCode& toAdopt->setLocales(locale, locale, locale); return getService()->registerInstance(toAdopt, locale, status); } - return NULL; + return nullptr; } // ------------------------------------- @@ -693,12 +694,12 @@ class CFactory : public LocaleKeyFactory { private: CollatorFactory* _delegate; Hashtable* _ids; - + public: - CFactory(CollatorFactory* delegate, UErrorCode& status) + CFactory(CollatorFactory* delegate, UErrorCode& status) : LocaleKeyFactory(delegate->visible() ? VISIBLE : INVISIBLE) , _delegate(delegate) - , _ids(NULL) + , _ids(nullptr) { if (U_SUCCESS(status)) { int32_t count = 0; @@ -709,7 +710,7 @@ class CFactory : public LocaleKeyFactory { _ids->put(idlist[i], (void*)this, status); if (U_FAILURE(status)) { delete _ids; - _ids = NULL; + _ids = nullptr; return; } } @@ -721,19 +722,19 @@ class CFactory : public LocaleKeyFactory { virtual ~CFactory(); - virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; - + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override; + protected: - virtual const Hashtable* getSupportedIDs(UErrorCode& status) const + virtual const Hashtable* getSupportedIDs(UErrorCode& status) const override { if (U_SUCCESS(status)) { return _ids; } - return NULL; + return nullptr; } - + virtual UnicodeString& - getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; + getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const override; }; CFactory::~CFactory() @@ -742,25 +743,26 @@ CFactory::~CFactory() delete _ids; } -UObject* +UObject* CFactory::create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const { if (handlesKey(key, status)) { - const LocaleKey& lkey = (const LocaleKey&)key; + const LocaleKey* lkey = dynamic_cast(&key); + U_ASSERT(lkey != nullptr); Locale validLoc; - lkey.currentLocale(validLoc); + lkey->currentLocale(validLoc); return _delegate->createCollator(validLoc); } - return NULL; + return nullptr; } UnicodeString& -CFactory::getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const +CFactory::getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const { if ((_coverage & 0x1) == 0) { UErrorCode status = U_ZERO_ERROR; const Hashtable* ids = getSupportedIDs(status); - if (ids && (ids->get(id) != NULL)) { + if (ids && (ids->get(id) != nullptr)) { Locale loc; LocaleUtility::initLocaleFromName(id, loc); return _delegate->getDisplayName(loc, locale, result); @@ -780,13 +782,13 @@ Collator::registerFactory(CollatorFactory* toAdopt, UErrorCode& status) } status = U_MEMORY_ALLOCATION_ERROR; } - return NULL; + return nullptr; } // ------------------------------------- UBool U_EXPORT2 -Collator::unregister(URegistryKey key, UErrorCode& status) +Collator::unregister(URegistryKey key, UErrorCode& status) { if (U_SUCCESS(status)) { if (hasService()) { @@ -794,7 +796,7 @@ Collator::unregister(URegistryKey key, UErrorCode& status) } status = U_ILLEGAL_ARGUMENT_ERROR; } - return FALSE; + return false; } #endif /* UCONFIG_NO_SERVICE */ @@ -802,8 +804,8 @@ class CollationLocaleListEnumeration : public StringEnumeration { private: int32_t index; public: - static UClassID U_EXPORT2 getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID U_EXPORT2 getStaticClassID(); + virtual UClassID getDynamicClassID() const override; public: CollationLocaleListEnumeration() : index(0) @@ -814,7 +816,7 @@ class CollationLocaleListEnumeration : public StringEnumeration { virtual ~CollationLocaleListEnumeration(); - virtual StringEnumeration * clone() const + virtual StringEnumeration * clone() const override { CollationLocaleListEnumeration *result = new CollationLocaleListEnumeration(); if (result) { @@ -823,33 +825,33 @@ class CollationLocaleListEnumeration : public StringEnumeration { return result; } - virtual int32_t count(UErrorCode &/*status*/) const { + virtual int32_t count(UErrorCode &/*status*/) const override { return availableLocaleListCount; } - virtual const char* next(int32_t* resultLength, UErrorCode& /*status*/) { + virtual const char* next(int32_t* resultLength, UErrorCode& /*status*/) override { const char* result; if(index < availableLocaleListCount) { result = availableLocaleList[index++].getName(); - if(resultLength != NULL) { + if(resultLength != nullptr) { *resultLength = (int32_t)uprv_strlen(result); } } else { - if(resultLength != NULL) { + if(resultLength != nullptr) { *resultLength = 0; } - result = NULL; + result = nullptr; } return result; } - virtual const UnicodeString* snext(UErrorCode& status) { + virtual const UnicodeString* snext(UErrorCode& status) override { int32_t resultLength = 0; const char *s = next(&resultLength, status); return setChars(s, resultLength, status); } - virtual void reset(UErrorCode& /*status*/) { + virtual void reset(UErrorCode& /*status*/) override { index = 0; } }; @@ -862,7 +864,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CollationLocaleListEnumeration) // ------------------------------------- StringEnumeration* U_EXPORT2 -Collator::getAvailableLocales(void) +Collator::getAvailableLocales() { #if !UCONFIG_NO_SERVICE if (hasService()) { @@ -873,7 +875,7 @@ Collator::getAvailableLocales(void) if (isAvailableLocaleListInitialized(status)) { return new CollationLocaleListEnumeration(); } - return NULL; + return nullptr; } StringEnumeration* U_EXPORT2 @@ -911,7 +913,7 @@ Collator::getFunctionalEquivalent(const char* keyword, const Locale& locale, } Collator::ECollationStrength -Collator::getStrength(void) const { +Collator::getStrength() const { UErrorCode intStatus = U_ZERO_ERROR; return (ECollationStrength)getAttribute(UCOL_STRENGTH, intStatus); } @@ -961,7 +963,7 @@ Collator::getEquivalentReorderCodes(int32_t reorderCode, int32_t *dest, int32_t capacity, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return 0; } - if(capacity < 0 || (dest == NULL && capacity > 0)) { + if(capacity < 0 || (dest == nullptr && capacity > 0)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -986,7 +988,7 @@ Collator::internalCompareUTF8(const char *left, int32_t leftLength, const char *right, int32_t rightLength, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return UCOL_EQUAL; } - if((left == NULL && leftLength != 0) || (right == NULL && rightLength != 0)) { + if((left == nullptr && leftLength != 0) || (right == nullptr && rightLength != 0)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return UCOL_EQUAL; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collation.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collation.cpp index 14cb86576..705ee12e2 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collation.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collation.cpp @@ -20,15 +20,6 @@ U_NAMESPACE_BEGIN -// Some compilers don't care if constants are defined in the .cpp file. -// MS Visual C++ does not like it, but gcc requires it. clang does not care. -#ifndef _MSC_VER -const uint8_t Collation::LEVEL_SEPARATOR_BYTE; -const uint8_t Collation::MERGE_SEPARATOR_BYTE; -const uint32_t Collation::ONLY_TERTIARY_MASK; -const uint32_t Collation::CASE_AND_TERTIARY_MASK; -#endif - uint32_t Collation::incTwoBytePrimaryByOffset(uint32_t basePrimary, UBool isCompressible, int32_t offset) { // Extract the second byte, minus the minimum byte value, diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collation.h b/src/duckdb/extension/icu/third_party/icu/i18n/collation.h index e9256c9c1..2062ef294 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collation.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collation.h @@ -221,7 +221,8 @@ class U_I18N_API Collation { /** * Points to contraction data. * Bits 31..13: Index into prefix/contraction data. - * Bits 12..11: Unused, 0. + * Bit 12: Unused, 0. + * Bit 11: CONTRACT_HAS_STARTER flag. (Used by ICU4X only.) * Bit 10: CONTRACT_TRAILING_CCC flag. * Bit 9: CONTRACT_NEXT_CCC flag. * Bit 8: CONTRACT_SINGLE_CP_NO_MATCH flag. @@ -250,7 +251,7 @@ class U_I18N_API Collation { * Tag for a lead surrogate code unit. * Optional optimization for UTF-16 string processing. * Bits 31..10: Unused, 0. - * 9.. 8: =0: All associated supplementary code points are unassigned-implict. + * 9.. 8: =0: All associated supplementary code points are unassigned-implicit. * =1: All associated supplementary code points fall back to the base data. * else: (Normally 2) Look up the data for the supplementary code point. */ @@ -298,6 +299,8 @@ class U_I18N_API Collation { static const uint32_t CONTRACT_NEXT_CCC = 0x200; /** Set if any contraction suffix ends with lccc!=0. */ static const uint32_t CONTRACT_TRAILING_CCC = 0x400; + /** Set if any contraction suffix contains a starter. (Used by ICU4X only.) */ + static const uint32_t CONTRACT_HAS_STARTER = 0x800; /** For HANGUL_TAG: None of its Jamo CE32s isSpecialCE32(). */ static const uint32_t HANGUL_NO_SPECIAL_JAMO = 0x100; @@ -356,7 +359,7 @@ class U_I18N_API Collation { } /** - * @return TRUE if the ce32 yields one or more CEs without further data lookups + * @return true if the ce32 yields one or more CEs without further data lookups */ static UBool isSelfContainedCE32(uint32_t ce32) { return !isSpecialCE32(ce32) || @@ -491,7 +494,7 @@ class U_I18N_API Collation { } private: - Collation(); // No instantiation. + Collation() = delete; // No instantiation. }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.cpp index 4a19c31e9..3da74cc48 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.cpp @@ -59,7 +59,7 @@ class BundleImporter : public CollationRuleParser::Importer { virtual void getRules( const char *localeID, const char *collationType, UnicodeString &rules, - const char *&errorReason, UErrorCode &errorCode); + const char *&errorReason, UErrorCode &errorCode) override; }; BundleImporter::~BundleImporter() {} @@ -83,75 +83,75 @@ BundleImporter::getRules( // most code will not have a static dependency on the builder code. RuleBasedCollator::RuleBasedCollator() - : data(NULL), - settings(NULL), - tailoring(NULL), - cacheEntry(NULL), + : data(nullptr), + settings(nullptr), + tailoring(nullptr), + cacheEntry(nullptr), validLocale(""), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { + actualLocaleIsSameAsValid(false) { } RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules, UErrorCode &errorCode) - : data(NULL), - settings(NULL), - tailoring(NULL), - cacheEntry(NULL), + : data(nullptr), + settings(nullptr), + tailoring(nullptr), + cacheEntry(nullptr), validLocale(""), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { - internalBuildTailoring(rules, UCOL_DEFAULT, UCOL_DEFAULT, NULL, NULL, errorCode); + actualLocaleIsSameAsValid(false) { + internalBuildTailoring(rules, UCOL_DEFAULT, UCOL_DEFAULT, nullptr, nullptr, errorCode); } RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules, ECollationStrength strength, UErrorCode &errorCode) - : data(NULL), - settings(NULL), - tailoring(NULL), - cacheEntry(NULL), + : data(nullptr), + settings(nullptr), + tailoring(nullptr), + cacheEntry(nullptr), validLocale(""), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { - internalBuildTailoring(rules, strength, UCOL_DEFAULT, NULL, NULL, errorCode); + actualLocaleIsSameAsValid(false) { + internalBuildTailoring(rules, strength, UCOL_DEFAULT, nullptr, nullptr, errorCode); } RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules, UColAttributeValue decompositionMode, UErrorCode &errorCode) - : data(NULL), - settings(NULL), - tailoring(NULL), - cacheEntry(NULL), + : data(nullptr), + settings(nullptr), + tailoring(nullptr), + cacheEntry(nullptr), validLocale(""), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { - internalBuildTailoring(rules, UCOL_DEFAULT, decompositionMode, NULL, NULL, errorCode); + actualLocaleIsSameAsValid(false) { + internalBuildTailoring(rules, UCOL_DEFAULT, decompositionMode, nullptr, nullptr, errorCode); } RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules, ECollationStrength strength, UColAttributeValue decompositionMode, UErrorCode &errorCode) - : data(NULL), - settings(NULL), - tailoring(NULL), - cacheEntry(NULL), + : data(nullptr), + settings(nullptr), + tailoring(nullptr), + cacheEntry(nullptr), validLocale(""), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { - internalBuildTailoring(rules, strength, decompositionMode, NULL, NULL, errorCode); + actualLocaleIsSameAsValid(false) { + internalBuildTailoring(rules, strength, decompositionMode, nullptr, nullptr, errorCode); } RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules, UParseError &parseError, UnicodeString &reason, UErrorCode &errorCode) - : data(NULL), - settings(NULL), - tailoring(NULL), - cacheEntry(NULL), + : data(nullptr), + settings(nullptr), + tailoring(nullptr), + cacheEntry(nullptr), validLocale(""), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { + actualLocaleIsSameAsValid(false) { internalBuildTailoring(rules, UCOL_DEFAULT, UCOL_DEFAULT, &parseError, &reason, errorCode); } @@ -163,7 +163,7 @@ RuleBasedCollator::internalBuildTailoring(const UnicodeString &rules, UErrorCode &errorCode) { const CollationTailoring *base = CollationRoot::getRoot(errorCode); if(U_FAILURE(errorCode)) { return; } - if(outReason != NULL) { outReason->remove(); } + if(outReason != nullptr) { outReason->remove(); } CollationBuilder builder(base, errorCode); UVersionInfo noVersion = { 0, 0, 0, 0 }; BundleImporter importer; @@ -172,7 +172,7 @@ RuleBasedCollator::internalBuildTailoring(const UnicodeString &rules, outParseError, errorCode)); if(U_FAILURE(errorCode)) { const char *reason = builder.getErrorReason(); - if(reason != NULL && outReason != NULL) { + if(reason != nullptr && outReason != nullptr) { *outReason = UnicodeString(reason, -1, US_INV); } return; @@ -191,14 +191,7 @@ RuleBasedCollator::internalBuildTailoring(const UnicodeString &rules, // CollationBuilder implementation ----------------------------------------- *** -// Some compilers don't care if constants are defined in the .cpp file. -// MS Visual C++ does not like it, but gcc requires it. clang does not care. -#ifndef _MSC_VER -const int32_t CollationBuilder::HAS_BEFORE2; -const int32_t CollationBuilder::HAS_BEFORE3; -#endif - -CollationBuilder::CollationBuilder(const CollationTailoring *b, UErrorCode &errorCode) +CollationBuilder::CollationBuilder(const CollationTailoring *b, UBool icu4xMode, UErrorCode &errorCode) : nfd(*Normalizer2::getNFDInstance(errorCode)), fcd(*Normalizer2Factory::getFCDInstance(errorCode)), nfcImpl(*Normalizer2Factory::getNFCImpl(errorCode)), @@ -206,8 +199,9 @@ CollationBuilder::CollationBuilder(const CollationTailoring *b, UErrorCode &erro baseData(b->data), rootElements(b->data->rootElements, b->data->rootElementsLength), variableTop(0), - dataBuilder(new CollationDataBuilder(errorCode)), fastLatinEnabled(TRUE), - errorReason(NULL), + dataBuilder(new CollationDataBuilder(icu4xMode, errorCode)), fastLatinEnabled(true), + icu4xMode(icu4xMode), + errorReason(nullptr), cesLength(0), rootPrimaryIndexes(errorCode), nodes(errorCode) { nfcImpl.ensureCanonIterData(errorCode); @@ -215,7 +209,7 @@ CollationBuilder::CollationBuilder(const CollationTailoring *b, UErrorCode &erro errorReason = "CollationBuilder fields initialization failed"; return; } - if(dataBuilder == NULL) { + if(dataBuilder == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -225,6 +219,10 @@ CollationBuilder::CollationBuilder(const CollationTailoring *b, UErrorCode &erro } } +CollationBuilder::CollationBuilder(const CollationTailoring *b, UErrorCode &errorCode) + : CollationBuilder(b, false, errorCode) +{} + CollationBuilder::~CollationBuilder() { delete dataBuilder; } @@ -235,19 +233,19 @@ CollationBuilder::parseAndBuild(const UnicodeString &ruleString, CollationRuleParser::Importer *importer, UParseError *outParseError, UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return NULL; } - if(baseData->rootElements == NULL) { + if(U_FAILURE(errorCode)) { return nullptr; } + if(baseData->rootElements == nullptr) { errorCode = U_MISSING_RESOURCE_ERROR; errorReason = "missing root elements data, tailoring not supported"; - return NULL; + return nullptr; } LocalPointer tailoring(new CollationTailoring(base->settings)); if(tailoring.isNull() || tailoring->isBogus()) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } CollationRuleParser parser(baseData, errorCode); - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } // Note: This always bases &[last variable] and &[first regular] // on the root collator's maxVariable/variableTop. // If we wanted this to change after [maxVariable x], then we would keep @@ -259,28 +257,32 @@ CollationBuilder::parseAndBuild(const UnicodeString &ruleString, CollationSettings &ownedSettings = *SharedObject::copyOnWrite(tailoring->settings); parser.parse(ruleString, ownedSettings, outParseError, errorCode); errorReason = parser.getErrorReason(); - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } if(dataBuilder->hasMappings()) { makeTailoredCEs(errorCode); - closeOverComposites(errorCode); + if (!icu4xMode) { + closeOverComposites(errorCode); + } finalizeCEs(errorCode); - // Copy all of ASCII, and Latin-1 letters, into each tailoring. - optimizeSet.add(0, 0x7f); - optimizeSet.add(0xc0, 0xff); - // Hangul is decomposed on the fly during collation, - // and the tailoring data is always built with HANGUL_TAG specials. - optimizeSet.remove(Hangul::HANGUL_BASE, Hangul::HANGUL_END); - dataBuilder->optimize(optimizeSet, errorCode); + if (!icu4xMode) { + // Copy all of ASCII, and Latin-1 letters, into each tailoring. + optimizeSet.add(0, 0x7f); + optimizeSet.add(0xc0, 0xff); + // Hangul is decomposed on the fly during collation, + // and the tailoring data is always built with HANGUL_TAG specials. + optimizeSet.remove(Hangul::HANGUL_BASE, Hangul::HANGUL_END); + dataBuilder->optimize(optimizeSet, errorCode); + } tailoring->ensureOwnedData(errorCode); - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } if(fastLatinEnabled) { dataBuilder->enableFastLatin(); } dataBuilder->build(*tailoring->ownedData, errorCode); tailoring->builder = dataBuilder; - dataBuilder = NULL; + dataBuilder = nullptr; } else { tailoring->data = baseData; } - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } ownedSettings.fastLatinOptions = CollationFastLatin::getOptions( tailoring->data, ownedSettings, ownedSettings.fastLatinPrimaries, UPRV_LENGTHOF(ownedSettings.fastLatinPrimaries)); @@ -484,7 +486,7 @@ CollationBuilder::getSpecialResetPosition(const UnicodeString &str, U_ASSERT(str.length() == 2); int64_t ce; int32_t strength = UCOL_PRIMARY; - UBool isBoundary = FALSE; + UBool isBoundary = false; UChar32 pos = str.charAt(1) - CollationRuleParser::POS_BASE; U_ASSERT(0 <= pos && pos <= CollationRuleParser::LAST_TRAILING); switch(pos) { @@ -544,14 +546,14 @@ CollationBuilder::getSpecialResetPosition(const UnicodeString &str, break; case CollationRuleParser::FIRST_VARIABLE: ce = rootElements.getFirstPrimaryCE(); - isBoundary = TRUE; // FractionalUCA.txt: FDD1 00A0, SPACE first primary + isBoundary = true; // FractionalUCA.txt: FDD1 00A0, SPACE first primary break; case CollationRuleParser::LAST_VARIABLE: ce = rootElements.lastCEWithPrimaryBefore(variableTop + 1); break; case CollationRuleParser::FIRST_REGULAR: ce = rootElements.firstCEWithPrimaryAtLeast(variableTop + 1); - isBoundary = TRUE; // FractionalUCA.txt: FDD1 263A, SYMBOL first primary + isBoundary = true; // FractionalUCA.txt: FDD1 263A, SYMBOL first primary break; case CollationRuleParser::LAST_REGULAR: // Use the Hani-first-primary rather than the actual last "regular" CE before it, @@ -570,14 +572,14 @@ CollationBuilder::getSpecialResetPosition(const UnicodeString &str, return 0; case CollationRuleParser::FIRST_TRAILING: ce = Collation::makeCE(Collation::FIRST_TRAILING_PRIMARY); - isBoundary = TRUE; // trailing first primary (there is no mapping for it) + isBoundary = true; // trailing first primary (there is no mapping for it) break; case CollationRuleParser::LAST_TRAILING: errorCode = U_ILLEGAL_ARGUMENT_ERROR; parserErrorReason = "LDML forbids tailoring to U+FFFF"; return 0; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } int32_t index = findOrInsertNodeForRootCE(ce, strength, errorCode); @@ -667,7 +669,7 @@ CollationBuilder::addRelation(int32_t strength, const UnicodeString &prefix, // It does not work with certain types of contextual mappings. int32_t nfdLength = nfdString.length(); if(nfdLength >= 2) { - UChar c = nfdString.charAt(0); + char16_t c = nfdString.charAt(0); if(Hangul::isJamoL(c) || Hangul::isJamoV(c)) { // While handling a Hangul syllable, contractions starting with Jamo L or V // would not see the following Jamo of that syllable. @@ -688,7 +690,7 @@ CollationBuilder::addRelation(int32_t strength, const UnicodeString &prefix, // A Hangul syllable completely inside a contraction is ok. } // Note: If there is a prefix, then the parser checked that - // both the prefix and the string beging with NFC boundaries (not Jamo V or T). + // both the prefix and the string begin with NFC boundaries (not Jamo V or T). // Therefore: prefix.isEmpty() || !isJamoVOrT(nfdString.charAt(0)) // (While handling a Hangul syllable, prefixes on Jamo V or T // would not see the previous Jamo of that syllable.) @@ -743,14 +745,18 @@ CollationBuilder::addRelation(int32_t strength, const UnicodeString &prefix, } } uint32_t ce32 = Collation::UNASSIGNED_CE32; - if((prefix != nfdPrefix || str != nfdString) && + if(!icu4xMode && (prefix != nfdPrefix || str != nfdString) && !ignorePrefix(prefix, errorCode) && !ignoreString(str, errorCode)) { // Map from the original input to the CEs. // We do this in case the canonical closure is incomplete, // so that it is possible to explicitly provide the missing mappings. ce32 = addIfDifferent(prefix, str, ces, cesLength, ce32, errorCode); } - addWithClosure(nfdPrefix, nfdString, ces, cesLength, ce32, errorCode); + if (!icu4xMode) { + addWithClosure(nfdPrefix, nfdString, ces, cesLength, ce32, errorCode); + } else { + addIfDifferent(nfdPrefix, nfdString, ces, cesLength, ce32, errorCode); + } if(U_FAILURE(errorCode)) { parserErrorReason = "writing collation elements"; return; @@ -1024,8 +1030,8 @@ CollationBuilder::setCaseBits(const UnicodeString &nfdString, int64_t cases = 0; if(numTailoredPrimaries > 0) { - const UChar *s = nfdString.getBuffer(); - UTF16CollationIterator baseCEs(baseData, FALSE, s, s, s + nfdString.length()); + const char16_t *s = nfdString.getBuffer(); + UTF16CollationIterator baseCEs(baseData, false, s, s, s + nfdString.length()); int32_t baseCEsLength = baseCEs.fetchCEs(errorCode) - 1; if(U_FAILURE(errorCode)) { parserErrorReason = "fetching root CEs for tailored string"; @@ -1107,12 +1113,23 @@ CollationBuilder::addWithClosure(const UnicodeString &nfdPrefix, const UnicodeSt return ce32; } +// ICU-22517 +// This constant defines a limit for the addOnlyClosure to return +// error, to avoid taking a long time for canonical closure expansion. +// Please let us know if you have a reasonable use case that needed +// for a practical Collation rule that needs to increase this limit. +// This value is needed for compiling a rule with eight Hangul syllables such as +// "&a=b쫊쫊쫊쫊쫊쫊쫊쫊" without error, which should be more than realistic +// usage. +static constexpr int32_t kClosureLoopLimit = 6560; + uint32_t CollationBuilder::addOnlyClosure(const UnicodeString &nfdPrefix, const UnicodeString &nfdString, const int64_t newCEs[], int32_t newCEsLength, uint32_t ce32, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return ce32; } + int32_t loop = 0; // Map from canonically equivalent input to the CEs. (But not from the all-NFD input.) if(nfdPrefix.isEmpty()) { CanonicalIterator stringIter(nfdString, errorCode); @@ -1122,6 +1139,11 @@ CollationBuilder::addOnlyClosure(const UnicodeString &nfdPrefix, const UnicodeSt UnicodeString str = stringIter.next(); if(str.isBogus()) { break; } if(ignoreString(str, errorCode) || str == nfdString) { continue; } + if (loop++ > kClosureLoopLimit) { + // To avoid hang as in ICU-22517, return with error. + errorCode = U_INPUT_TOO_LONG_ERROR; + return ce32; + } ce32 = addIfDifferent(prefix, str, newCEs, newCEsLength, ce32, errorCode); if(U_FAILURE(errorCode)) { return ce32; } } @@ -1138,6 +1160,11 @@ CollationBuilder::addOnlyClosure(const UnicodeString &nfdPrefix, const UnicodeSt UnicodeString str = stringIter.next(); if(str.isBogus()) { break; } if(ignoreString(str, errorCode) || (samePrefix && str == nfdString)) { continue; } + if (loop++ > kClosureLoopLimit) { + // To avoid hang as in ICU-22517, return with error. + errorCode = U_INPUT_TOO_LONG_ERROR; + return ce32; + } ce32 = addIfDifferent(prefix, str, newCEs, newCEsLength, ce32, errorCode); if(U_FAILURE(errorCode)) { return ce32; } } @@ -1217,18 +1244,18 @@ CollationBuilder::mergeCompositeIntoString(const UnicodeString &nfdString, UChar32 composite, const UnicodeString &decomp, UnicodeString &newNFDString, UnicodeString &newString, UErrorCode &errorCode) const { - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } U_ASSERT(nfdString.char32At(indexAfterLastStarter - 1) == decomp.char32At(0)); int32_t lastStarterLength = decomp.moveIndex32(0, 1); if(lastStarterLength == decomp.length()) { // Singleton decompositions should be found by addWithClosure() // and the CanonicalIterator, so we can ignore them here. - return FALSE; + return false; } if(nfdString.compare(indexAfterLastStarter, 0x7fffffff, decomp, lastStarterLength, 0x7fffffff) == 0) { // same strings, nothing new to be found here - return FALSE; + return false; } // Make new FCD strings that combine a composite, or its decomposition, @@ -1238,7 +1265,7 @@ CollationBuilder::mergeCompositeIntoString(const UnicodeString &nfdString, newString.setTo(nfdString, 0, indexAfterLastStarter - lastStarterLength).append(composite); // The following is related to discontiguous contraction matching, - // but builds only FCD strings (or else returns FALSE). + // but builds only FCD strings (or else returns false). int32_t sourceIndex = indexAfterLastStarter; int32_t decompIndex = lastStarterLength; // Small optimization: We keep the source character across loop iterations @@ -1265,16 +1292,16 @@ CollationBuilder::mergeCompositeIntoString(const UnicodeString &nfdString, // Unable to merge because the source contains a non-zero combining mark // but the composite's decomposition contains another starter. // The strings would not be equivalent. - return FALSE; + return false; } else if(sourceCC < decompCC) { // Composite + sourceChar would not be FCD. - return FALSE; + return false; } else if(decompCC < sourceCC) { newNFDString.append(decompChar); decompIndex += U16_LENGTH(decompChar); } else if(decompChar != sourceChar) { // Blocked because same combining class. - return FALSE; + return false; } else { // match: decompChar == sourceChar newNFDString.append(decompChar); decompIndex += U16_LENGTH(decompChar); @@ -1286,7 +1313,7 @@ CollationBuilder::mergeCompositeIntoString(const UnicodeString &nfdString, if(sourceChar >= 0) { // more characters from nfdString but not from decomp if(sourceCC < decompCC) { // Appending the next source character to the composite would not be FCD. - return FALSE; + return false; } newNFDString.append(nfdString, sourceIndex, 0x7fffffff); newString.append(nfdString, sourceIndex, 0x7fffffff); @@ -1296,7 +1323,7 @@ CollationBuilder::mergeCompositeIntoString(const UnicodeString &nfdString, U_ASSERT(nfd.isNormalized(newNFDString, errorCode)); U_ASSERT(fcd.isNormalized(newString, errorCode)); U_ASSERT(nfd.normalize(newString, errorCode) == newNFDString); // canonically equivalent - return TRUE; + return true; } UBool @@ -1361,13 +1388,13 @@ UBool CollationBuilder::sameCEs(const int64_t ces1[], int32_t ces1Length, const int64_t ces2[], int32_t ces2Length) { if(ces1Length != ces2Length) { - return FALSE; + return false; } U_ASSERT(ces1Length <= Collation::MAX_EXPANSION_LENGTH); for(int32_t i = 0; i < ces1Length; ++i) { - if(ces1[i] != ces2[i]) { return FALSE; } + if(ces1[i] != ces2[i]) { return false; } } - return TRUE; + return true; } #ifdef DEBUG_COLLATION_BUILDER @@ -1399,9 +1426,9 @@ CollationBuilder::makeTailoredCEs(UErrorCode &errorCode) { uint32_t s = p == 0 ? 0 : Collation::COMMON_WEIGHT16; uint32_t t = s; uint32_t q = 0; - UBool pIsTailored = FALSE; - UBool sIsTailored = FALSE; - UBool tIsTailored = FALSE; + UBool pIsTailored = false; + UBool sIsTailored = false; + UBool tIsTailored = false; #ifdef DEBUG_COLLATION_BUILDER printf("\nprimary %lx\n", (long)alignWeightRight(p)); #endif @@ -1455,13 +1482,13 @@ CollationBuilder::makeTailoredCEs(UErrorCode &errorCode) { errorReason = "tertiary tailoring gap too small"; return; } - tIsTailored = TRUE; + tIsTailored = true; } t = tertiaries.nextWeight(); U_ASSERT(t != 0xffffffff); } else { t = weight16FromNode(node); - tIsTailored = FALSE; + tIsTailored = false; #ifdef DEBUG_COLLATION_BUILDER printf(" ter %lx\n", (long)alignWeightRight(t)); #endif @@ -1507,13 +1534,13 @@ CollationBuilder::makeTailoredCEs(UErrorCode &errorCode) { #endif return; } - sIsTailored = TRUE; + sIsTailored = true; } s = secondaries.nextWeight(); U_ASSERT(s != 0xffffffff); } else { s = weight16FromNode(node); - sIsTailored = FALSE; + sIsTailored = false; #ifdef DEBUG_COLLATION_BUILDER printf(" sec %lx\n", (long)alignWeightRight(s)); #endif @@ -1536,15 +1563,15 @@ CollationBuilder::makeTailoredCEs(UErrorCode &errorCode) { errorReason = "primary tailoring gap too small"; return; } - pIsTailored = TRUE; + pIsTailored = true; } p = primaries.nextWeight(); U_ASSERT(p != 0xffffffff); s = Collation::COMMON_WEIGHT16; - sIsTailored = FALSE; + sIsTailored = false; } t = s == 0 ? 0 : Collation::COMMON_WEIGHT16; - tIsTailored = FALSE; + tIsTailored = false; } q = 0; } @@ -1581,7 +1608,7 @@ class CEFinalizer : public CollationDataBuilder::CEModifier { public: CEFinalizer(const int64_t *ces) : finalCEs(ces) {} virtual ~CEFinalizer(); - virtual int64_t modifyCE32(uint32_t ce32) const { + virtual int64_t modifyCE32(uint32_t ce32) const override { U_ASSERT(!Collation::isSpecialCE32(ce32)); if(CollationBuilder::isTempCE32(ce32)) { // retain case bits @@ -1590,7 +1617,7 @@ class CEFinalizer : public CollationDataBuilder::CEModifier { return Collation::NO_CE; } } - virtual int64_t modifyCE(int64_t ce) const { + virtual int64_t modifyCE(int64_t ce) const override { if(CollationBuilder::isTempCE(ce)) { // retain case bits return finalCEs[CollationBuilder::indexFromTempCE(ce)] | (ce & 0xc000); @@ -1608,7 +1635,7 @@ CEFinalizer::~CEFinalizer() {} void CollationBuilder::finalizeCEs(UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - LocalPointer newBuilder(new CollationDataBuilder(errorCode), errorCode); + LocalPointer newBuilder(new CollationDataBuilder(icu4xMode, errorCode), errorCode); if(U_FAILURE(errorCode)) { return; } @@ -1635,29 +1662,29 @@ U_NAMESPACE_END U_NAMESPACE_USE U_CAPI UCollator * U_EXPORT2 -ucol_openRules(const UChar *rules, int32_t rulesLength, +ucol_openRules(const char16_t *rules, int32_t rulesLength, UColAttributeValue normalizationMode, UCollationStrength strength, UParseError *parseError, UErrorCode *pErrorCode) { - if(U_FAILURE(*pErrorCode)) { return NULL; } - if(rules == NULL && rulesLength != 0) { + if(U_FAILURE(*pErrorCode)) { return nullptr; } + if(rules == nullptr && rulesLength != 0) { *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } RuleBasedCollator *coll = new RuleBasedCollator(); - if(coll == NULL) { + if(coll == nullptr) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } UnicodeString r((UBool)(rulesLength < 0), rules, rulesLength); - coll->internalBuildTailoring(r, strength, normalizationMode, parseError, NULL, *pErrorCode); + coll->internalBuildTailoring(r, strength, normalizationMode, parseError, nullptr, *pErrorCode); if(U_FAILURE(*pErrorCode)) { delete coll; - return NULL; + return nullptr; } return coll->toUCollator(); } -static const int32_t collationbuilder_internalBufferSize = 512; +static const int32_t internalBufferSize = 512; // The @internal ucol_getUnsafeSet() was moved here from ucol_sit.cpp // because it calls UnicodeSet "builder" code that depends on all Unicode properties, @@ -1670,13 +1697,13 @@ ucol_getUnsafeSet( const UCollator *coll, USet *unsafe, UErrorCode *status) { - UChar buffer[collationbuilder_internalBufferSize]; + char16_t buffer[internalBufferSize]; int32_t len = 0; uset_clear(unsafe); // cccpattern = "[[:^tccc=0:][:^lccc=0:]]", unfortunately variant - static const UChar cccpattern[25] = { 0x5b, 0x5b, 0x3a, 0x5e, 0x74, 0x63, 0x63, 0x63, 0x3d, 0x30, 0x3a, 0x5d, + static const char16_t cccpattern[25] = { 0x5b, 0x5b, 0x3a, 0x5e, 0x74, 0x63, 0x63, 0x63, 0x3d, 0x30, 0x3a, 0x5d, 0x5b, 0x3a, 0x5e, 0x6c, 0x63, 0x63, 0x63, 0x3d, 0x30, 0x3a, 0x5d, 0x5d, 0x00 }; // add chars that fail the fcd check @@ -1690,14 +1717,14 @@ ucol_getUnsafeSet( const UCollator *coll, USet *contractions = uset_open(0,0); int32_t i = 0, j = 0; - ucol_getContractionsAndExpansions(coll, contractions, NULL, FALSE, status); + ucol_getContractionsAndExpansions(coll, contractions, nullptr, false, status); int32_t contsSize = uset_size(contractions); UChar32 c = 0; // Contraction set consists only of strings // to get unsafe code points, we need to // break the strings apart and add them to the unsafe set for(i = 0; i < contsSize; i++) { - len = uset_getItem(contractions, i, NULL, NULL, buffer, collationbuilder_internalBufferSize, status); + len = uset_getItem(contractions, i, nullptr, nullptr, buffer, internalBufferSize, status); if(len > 0) { j = 0; while(j < len) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.h index 2f20050f9..22e24ddb8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.h @@ -39,10 +39,11 @@ class Normalizer2Impl; class U_I18N_API CollationBuilder : public CollationRuleParser::Sink { public: + CollationBuilder(const CollationTailoring *b, UBool icu4xMode, UErrorCode &errorCode); CollationBuilder(const CollationTailoring *base, UErrorCode &errorCode); virtual ~CollationBuilder(); - void disableFastLatin() { fastLatinEnabled = FALSE; } + void disableFastLatin() { fastLatinEnabled = false; } CollationTailoring *parseAndBuild(const UnicodeString &ruleString, const UVersionInfo rulesVersion, @@ -57,7 +58,7 @@ class U_I18N_API CollationBuilder : public CollationRuleParser::Sink { /** Implements CollationRuleParser::Sink. */ virtual void addReset(int32_t strength, const UnicodeString &str, - const char *&errorReason, UErrorCode &errorCode); + const char *&errorReason, UErrorCode &errorCode) override; /** * Returns the secondary or tertiary weight preceding the current node's weight. * node=nodes[index]. @@ -70,7 +71,7 @@ class U_I18N_API CollationBuilder : public CollationRuleParser::Sink { /** Implements CollationRuleParser::Sink. */ virtual void addRelation(int32_t strength, const UnicodeString &prefix, const UnicodeString &str, const UnicodeString &extension, - const char *&errorReason, UErrorCode &errorCode); + const char *&errorReason, UErrorCode &errorCode) override; /** * Picks one of the current CEs and finds or inserts a node in the graph @@ -115,11 +116,11 @@ class U_I18N_API CollationBuilder : public CollationRuleParser::Sink { /** Implements CollationRuleParser::Sink. */ virtual void suppressContractions(const UnicodeSet &set, const char *&parserErrorReason, - UErrorCode &errorCode); + UErrorCode &errorCode) override; /** Implements CollationRuleParser::Sink. */ virtual void optimize(const UnicodeSet &set, const char *&parserErrorReason, - UErrorCode &errorCode); + UErrorCode &errorCode) override; /** * Adds the mapping and its canonical closure. @@ -302,6 +303,7 @@ class U_I18N_API CollationBuilder : public CollationRuleParser::Sink { CollationDataBuilder *dataBuilder; UBool fastLatinEnabled; + UBool icu4xMode; UnicodeSet optimizeSet; const char *errorReason; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationcompare.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationcompare.cpp index cbf32c9fe..d9048afc2 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationcompare.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationcompare.cpp @@ -39,7 +39,7 @@ CollationCompare::compareUpToQuaternary(CollationIterator &left, CollationIterat // +1 so that we can use "<" and primary ignorables test out early. variableTop = settings.variableTop + 1; } - UBool anyVariable = FALSE; + UBool anyVariable = false; // Fetch CEs, compare primaries, store secondary & tertiary weights. for(;;) { @@ -51,7 +51,7 @@ CollationCompare::compareUpToQuaternary(CollationIterator &left, CollationIterat if(leftPrimary < variableTop && leftPrimary > Collation::MERGE_SEPARATOR_PRIMARY) { // Variable CE, shift it to quaternary level. // Ignore all following primary ignorables, and shift further variable CEs. - anyVariable = TRUE; + anyVariable = true; do { // Store only the primary of the variable CE. left.setCurrentCE(ce & INT64_C(0xffffffff00000000)); @@ -76,7 +76,7 @@ CollationCompare::compareUpToQuaternary(CollationIterator &left, CollationIterat if(rightPrimary < variableTop && rightPrimary > Collation::MERGE_SEPARATOR_PRIMARY) { // Variable CE, shift it to quaternary level. // Ignore all following primary ignorables, and shift further variable CEs. - anyVariable = TRUE; + anyVariable = true; do { // Store only the primary of the variable CE. right.setCurrentCE(ce & INT64_C(0xffffffff00000000)); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.cpp index 688770f8f..1b8b6a76d 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.cpp @@ -205,7 +205,7 @@ CollationData::getEquivalentScripts(int32_t script, void CollationData::makeReorderRanges(const int32_t *reorder, int32_t length, UVector32 &ranges, UErrorCode &errorCode) const { - makeReorderRanges(reorder, length, FALSE, ranges, errorCode); + makeReorderRanges(reorder, length, false, ranges, errorCode); } void @@ -277,12 +277,12 @@ CollationData::makeReorderRanges(const int32_t *reorder, int32_t length, // Reorder according to the input scripts, continuing from the bottom of the primary range. int32_t originalLength = length; // length will be decremented if "others" is in the list. - UBool hasReorderToEnd = FALSE; + UBool hasReorderToEnd = false; for(int32_t i = 0; i < length;) { int32_t script = reorder[i++]; if(script == USCRIPT_UNKNOWN) { // Put the remaining scripts at the top. - hasReorderToEnd = TRUE; + hasReorderToEnd = true; while(i < length) { script = reorder[--length]; if(script == USCRIPT_UNKNOWN || // Must occur at most once. @@ -329,7 +329,7 @@ CollationData::makeReorderRanges(const int32_t *reorder, int32_t length, if(lowStart > highLimit) { if((lowStart - (skippedReserved & 0xff00)) <= highLimit) { // Try not skipping the before-Latin reserved range. - makeReorderRanges(reorder, originalLength, TRUE, ranges, errorCode); + makeReorderRanges(reorder, originalLength, true, ranges, errorCode); return; } // We need more primary lead bytes than available, despite the reserved ranges. diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.h index ab9b4c47e..d4f66828f 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdata.h @@ -41,29 +41,25 @@ struct U_I18N_API CollationData : public UMemory { // Note: The ucadata.icu loader could discover the reserved ranges by setting an array // parallel with the ranges, and resetting ranges that are indexed. // The reordering builder code could clone the resulting template array. - enum { - REORDER_RESERVED_BEFORE_LATIN = UCOL_REORDER_CODE_FIRST + 14, - REORDER_RESERVED_AFTER_LATIN - }; + static constexpr int32_t REORDER_RESERVED_BEFORE_LATIN = UCOL_REORDER_CODE_FIRST + 14; + static constexpr int32_t REORDER_RESERVED_AFTER_LATIN = REORDER_RESERVED_BEFORE_LATIN + 1; - enum { - MAX_NUM_SPECIAL_REORDER_CODES = 8, - /** C++ only, data reader check scriptStartsLength. */ - MAX_NUM_SCRIPT_RANGES = 256 - }; + static constexpr int32_t MAX_NUM_SPECIAL_REORDER_CODES = 8; + /** C++ only, data reader check scriptStartsLength. */ + static constexpr int32_t MAX_NUM_SCRIPT_RANGES = 256; CollationData(const Normalizer2Impl &nfc) - : trie(NULL), - ce32s(NULL), ces(NULL), contexts(NULL), base(NULL), - jamoCE32s(NULL), + : trie(nullptr), + ce32s(nullptr), ces(nullptr), contexts(nullptr), base(nullptr), + jamoCE32s(nullptr), nfcImpl(nfc), numericPrimary(0x12000000), ce32sLength(0), cesLength(0), contextsLength(0), - compressibleBytes(NULL), - unsafeBackwardSet(NULL), - fastLatinTable(NULL), fastLatinTableLength(0), - numScripts(0), scriptsIndex(NULL), scriptStarts(NULL), scriptStartsLength(0), - rootElements(NULL), rootElementsLength(0) {} + compressibleBytes(nullptr), + unsafeBackwardSet(nullptr), + fastLatinTable(nullptr), fastLatinTableLength(0), + numScripts(0), scriptsIndex(nullptr), scriptStarts(nullptr), scriptStartsLength(0), + rootElements(nullptr), rootElementsLength(0) {} uint32_t getCE32(UChar32 c) const { return UTRIE2_GET32(trie, c); @@ -94,7 +90,7 @@ struct U_I18N_API CollationData : public UMemory { * Returns the CE32 from two contexts words. * Access to the defaultCE32 for contraction and prefix matching. */ - static uint32_t readCE32(const UChar *p) { + static uint32_t readCE32(const char16_t *p) { return ((uint32_t)p[0] << 16) | p[1]; } @@ -182,8 +178,8 @@ struct U_I18N_API CollationData : public UMemory { /** Array of CE values for expansions and OFFSET_TAG. */ const int64_t *ces; /** Array of prefix and contraction-suffix matching data. */ - const UChar *contexts; - /** Base collation data, or NULL if this data itself is a base. */ + const char16_t *contexts; + /** Base collation data, or nullptr if this data itself is a base. */ const CollationData *base; /** * Simple array of JAMO_CE32S_LENGTH=19+21+27 CE32s, one per canonical Jamo L/V/T. @@ -242,7 +238,7 @@ struct U_I18N_API CollationData : public UMemory { /** * Collation elements in the root collator. * Used by the CollationRootElements class. The data structure is described there. - * NULL in a tailoring. + * nullptr in a tailoring. */ const uint32_t *rootElements; int32_t rootElementsLength; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.cpp index 53361b86c..7c6f1b881 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.cpp @@ -86,18 +86,30 @@ struct ConditionalCE32 : public UMemory { * When fetching CEs from the builder, the contexts are built into their runtime form * so that the normal collation implementation can process them. * The result is cached in the list head. It is reset when the contexts are modified. + * All of these builtCE32 are invalidated by clearContexts(), + * via incrementing the contextsEra. */ uint32_t builtCE32; + /** + * The "era" of building intermediate contexts when the above builtCE32 was set. + * When the array of cached, temporary contexts overflows, then clearContexts() + * removes them all and invalidates the builtCE32 that used to point to built tries. + */ + int32_t era = -1; /** * Index of the next ConditionalCE32. * Negative for the end of the list. */ int32_t next; + // Note: We could create a separate class for all of the contextual mappings for + // a code point, with the builtCE32, the era, and a list of the actual mappings. + // The class that represents one mapping would then not need to + // store those fields in each element. }; U_CDECL_BEGIN -U_CAPI void U_CALLCONV +void U_CALLCONV uprv_deleteConditionalCE32(void *obj) { delete static_cast(obj); } @@ -131,18 +143,18 @@ class DataBuilderCollationIterator : public CollationIterator { int32_t fetchCEs(const UnicodeString &str, int32_t start, int64_t ces[], int32_t cesLength); - virtual void resetToOffset(int32_t newOffset); - virtual int32_t getOffset() const; + virtual void resetToOffset(int32_t newOffset) override; + virtual int32_t getOffset() const override; - virtual UChar32 nextCodePoint(UErrorCode &errorCode); - virtual UChar32 previousCodePoint(UErrorCode &errorCode); + virtual UChar32 nextCodePoint(UErrorCode &errorCode) override; + virtual UChar32 previousCodePoint(UErrorCode &errorCode) override; protected: - virtual void forwardNumCodePoints(int32_t num, UErrorCode &errorCode); - virtual void backwardNumCodePoints(int32_t num, UErrorCode &errorCode); + virtual void forwardNumCodePoints(int32_t num, UErrorCode &errorCode) override; + virtual void backwardNumCodePoints(int32_t num, UErrorCode &errorCode) override; - virtual uint32_t getDataCE32(UChar32 c) const; - virtual uint32_t getCE32FromBuilderData(uint32_t ce32, UErrorCode &errorCode); + virtual uint32_t getDataCE32(UChar32 c) const override; + virtual uint32_t getCE32FromBuilderData(uint32_t ce32, UErrorCode &errorCode) override; CollationDataBuilder &builder; CollationData builderData; @@ -152,9 +164,9 @@ class DataBuilderCollationIterator : public CollationIterator { }; DataBuilderCollationIterator::DataBuilderCollationIterator(CollationDataBuilder &b) - : CollationIterator(&builderData, /*numeric=*/ FALSE), + : CollationIterator(&builderData, /*numeric=*/ false), builder(b), builderData(b.nfcImpl), - s(NULL), pos(0) { + s(nullptr), pos(0) { builderData.base = builder.base; // Set all of the jamoCE32s[] to indirection CE32s. for(int32_t j = 0; j < CollationData::JAMO_CE32S_LENGTH; ++j) { // Count across Jamo types. @@ -192,7 +204,7 @@ DataBuilderCollationIterator::fetchCEs(const UnicodeString &str, int32_t start, } else { d = &builderData; } - appendCEsFromCE32(d, c, ce32, /*forward=*/ TRUE, errorCode); + appendCEsFromCE32(d, c, ce32, /*forward=*/ true, errorCode); U_ASSERT(U_SUCCESS(errorCode)); for(int32_t i = 0; i < getCEsLength(); ++i) { int64_t ce = getCE(i); @@ -255,13 +267,19 @@ DataBuilderCollationIterator::getDataCE32(UChar32 c) const { uint32_t DataBuilderCollationIterator::getCE32FromBuilderData(uint32_t ce32, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return 0; } U_ASSERT(Collation::hasCE32Tag(ce32, Collation::BUILDER_DATA_TAG)); if((ce32 & CollationDataBuilder::IS_BUILDER_JAMO_CE32) != 0) { UChar32 jamo = Collation::indexFromCE32(ce32); return utrie2_get32(builder.trie, jamo); } else { ConditionalCE32 *cond = builder.getConditionalCE32ForCE32(ce32); - if(cond->builtCE32 == Collation::NO_CE32) { + if (cond == nullptr) { + errorCode = U_INTERNAL_PROGRAM_ERROR; + // TODO: ICU-21531 figure out why this happens. + return 0; + } + if(cond->builtCE32 == Collation::NO_CE32 || cond->era != builder.contextsEra) { // Build the context-sensitive mappings into their runtime form and cache the result. cond->builtCE32 = builder.buildContext(cond, errorCode); if(errorCode == U_BUFFER_OVERFLOW_ERROR) { @@ -269,6 +287,7 @@ DataBuilderCollationIterator::getCE32FromBuilderData(uint32_t ce32, UErrorCode & builder.clearContexts(); cond->builtCE32 = builder.buildContext(cond, errorCode); } + cond->era = builder.contextsEra; builderData.contexts = builder.contexts.getBuffer(); } return cond->builtCE32; @@ -277,16 +296,19 @@ DataBuilderCollationIterator::getCE32FromBuilderData(uint32_t ce32, UErrorCode & // ------------------------------------------------------------------------- *** -CollationDataBuilder::CollationDataBuilder(UErrorCode &errorCode) +CollationDataBuilder::CollationDataBuilder(UBool icu4xMode, UErrorCode &errorCode) : nfcImpl(*Normalizer2Factory::getNFCImpl(errorCode)), - base(NULL), baseSettings(NULL), - trie(NULL), + base(nullptr), baseSettings(nullptr), + trie(nullptr), ce32s(errorCode), ce64s(errorCode), conditionalCE32s(errorCode), - modified(FALSE), - fastLatinEnabled(FALSE), fastLatinBuilder(NULL), - collIter(NULL) { + modified(false), + icu4xMode(icu4xMode), + fastLatinEnabled(false), fastLatinBuilder(nullptr), + collIter(nullptr) { // Reserve the first CE32 for U+0000. - ce32s.addElement(0, errorCode); + if (!icu4xMode) { + ce32s.addElement(0, errorCode); + } conditionalCE32s.setDeleter(uprv_deleteConditionalCE32); } @@ -299,38 +321,42 @@ CollationDataBuilder::~CollationDataBuilder() { void CollationDataBuilder::initForTailoring(const CollationData *b, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - if(trie != NULL) { + if(trie != nullptr) { errorCode = U_INVALID_STATE_ERROR; return; } - if(b == NULL) { + if(b == nullptr) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } base = b; // For a tailoring, the default is to fall back to the base. - trie = utrie2_open(Collation::FALLBACK_CE32, Collation::FFFD_CE32, &errorCode); - - // Set the Latin-1 letters block so that it is allocated first in the data array, - // to try to improve locality of reference when sorting Latin-1 text. - // Do not use utrie2_setRange32() since that will not actually allocate blocks - // that are filled with the default value. - // ASCII (0..7F) is already preallocated anyway. - for(UChar32 c = 0xc0; c <= 0xff; ++c) { - utrie2_set32(trie, c, Collation::FALLBACK_CE32, &errorCode); - } + // For ICU4X, use the same value for fallback as for the default + // to avoid having to have different blocks for the two. + trie = utrie2_open(Collation::FALLBACK_CE32, icu4xMode ? Collation::FALLBACK_CE32 : Collation::FFFD_CE32, &errorCode); + + if (!icu4xMode) { + // Set the Latin-1 letters block so that it is allocated first in the data array, + // to try to improve locality of reference when sorting Latin-1 text. + // Do not use utrie2_setRange32() since that will not actually allocate blocks + // that are filled with the default value. + // ASCII (0..7F) is already preallocated anyway. + for(UChar32 c = 0xc0; c <= 0xff; ++c) { + utrie2_set32(trie, c, Collation::FALLBACK_CE32, &errorCode); + } - // Hangul syllables are not tailorable (except via tailoring Jamos). - // Always set the Hangul tag to help performance. - // Do this here, rather than in buildMappings(), - // so that we see the HANGUL_TAG in various assertions. - uint32_t hangulCE32 = Collation::makeCE32FromTagAndIndex(Collation::HANGUL_TAG, 0); - utrie2_setRange32(trie, Hangul::HANGUL_BASE, Hangul::HANGUL_END, hangulCE32, TRUE, &errorCode); + // Hangul syllables are not tailorable (except via tailoring Jamos). + // Always set the Hangul tag to help performance. + // Do this here, rather than in buildMappings(), + // so that we see the HANGUL_TAG in various assertions. + uint32_t hangulCE32 = Collation::makeCE32FromTagAndIndex(Collation::HANGUL_TAG, 0); + utrie2_setRange32(trie, Hangul::HANGUL_BASE, Hangul::HANGUL_END, hangulCE32, true, &errorCode); - // Copy the set contents but don't copy/clone the set as a whole because - // that would copy the isFrozen state too. - unsafeBackwardSet.addAll(*b->unsafeBackwardSet); + // Copy the set contents but don't copy/clone the set as a whole because + // that would copy the isFrozen state too. + unsafeBackwardSet.addAll(*b->unsafeBackwardSet); + } if(U_FAILURE(errorCode)) { return; } } @@ -339,7 +365,7 @@ UBool CollationDataBuilder::maybeSetPrimaryRange(UChar32 start, UChar32 end, uint32_t primary, int32_t step, UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } U_ASSERT(start <= end); // TODO: Do we need to check what values are currently set for start..end? // An offset range is worth it only if we can achieve an overlap between @@ -364,11 +390,11 @@ CollationDataBuilder::maybeSetPrimaryRange(UChar32 start, UChar32 end, return 0; } uint32_t offsetCE32 = Collation::makeCE32FromTagAndIndex(Collation::OFFSET_TAG, index); - utrie2_setRange32(trie, start, end, offsetCE32, TRUE, &errorCode); - modified = TRUE; - return TRUE; + utrie2_setRange32(trie, start, end, offsetCE32, true, &errorCode); + modified = true; + return true; } else { - return FALSE; + return false; } } @@ -389,7 +415,7 @@ CollationDataBuilder::setPrimaryRangeAndReturnNext(UChar32 start, UChar32 end, primary = Collation::incThreeBytePrimaryByOffset(primary, isCompressible, step); if(start > end) { return primary; } } - modified = TRUE; + modified = true; } } @@ -425,10 +451,10 @@ int64_t CollationDataBuilder::getSingleCE(UChar32 c, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return 0; } // Keep parallel with CollationData::getSingleCE(). - UBool fromBase = FALSE; + UBool fromBase = false; uint32_t ce32 = utrie2_get32(trie, c); if(ce32 == Collation::FALLBACK_CE32) { - fromBase = TRUE; + fromBase = true; ce32 = base->getCE32(c); } while(Collation::isSpecialCE32(ce32)) { @@ -516,12 +542,11 @@ CollationDataBuilder::addConditionalCE32(const UnicodeString &context, uint32_t errorCode = U_BUFFER_OVERFLOW_ERROR; return -1; } - ConditionalCE32 *cond = new ConditionalCE32(context, ce32); - if(cond == NULL) { - errorCode = U_MEMORY_ALLOCATION_ERROR; + LocalPointer cond(new ConditionalCE32(context, ce32), errorCode); + conditionalCE32s.adoptElement(cond.orphan(), errorCode); + if(U_FAILURE(errorCode)) { return -1; } - conditionalCE32s.addElement(cond, errorCode); return index; } @@ -541,7 +566,7 @@ CollationDataBuilder::addCE32(const UnicodeString &prefix, const UnicodeString & errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } - if(trie == NULL || utrie2_isFrozen(trie)) { + if(trie == nullptr || utrie2_isFrozen(trie)) { errorCode = U_INVALID_STATE_ERROR; return; } @@ -549,6 +574,98 @@ CollationDataBuilder::addCE32(const UnicodeString &prefix, const UnicodeString & int32_t cLength = U16_LENGTH(c); uint32_t oldCE32 = utrie2_get32(trie, c); UBool hasContext = !prefix.isEmpty() || s.length() > cLength; + + if (icu4xMode) { + if (base && c >= 0x1100 && c < 0x1200) { + // Omit jamo tailorings. + // TODO(https://github.com/unicode-org/icu4x/issues/1941). + } + const Normalizer2* nfdNormalizer = Normalizer2::getNFDInstance(errorCode); + UnicodeString sInNfd; + nfdNormalizer->normalize(s, sInNfd, errorCode); + if (s != sInNfd) { + // s is not in NFD, so it cannot match in ICU4X, since ICU4X only + // does NFD lookups. + // Now check that we're only rejecting known cases. + if (s.length() == 2) { + char16_t second = s.charAt(1); + if (second == 0x0F73 || second == 0x0F75 || second == 0x0F81) { + // Second is a special decomposing Tibetan vowel sign. + // These also get added in the decomposed form, so ignoring + // this instance is OK. + return; + } + if (c == 0xFDD1 && second == 0xAC00) { + // This strange contraction exists in the root and + // doesn't have a decomposed counterpart there. + // This won't match in ICU4X anyway and is very strange: + // Unassigned Arabic presentation form contracting with + // the very first Hangul syllable. Let's ignore this + // explicitly. + return; + } + } + // Unknown case worth investigating if ever found. + errorCode = U_UNSUPPORTED_ERROR; + return; + } + + if (!prefix.isEmpty()) { + UnicodeString prefixInNfd; + nfdNormalizer->normalize(prefix, prefixInNfd, errorCode); + if (prefix != prefixInNfd) { + errorCode = U_UNSUPPORTED_ERROR; + return; + } + + int32_t count = prefix.countChar32(); + if (count > 2) { + // Prefix too long for ICU4X. + errorCode = U_UNSUPPORTED_ERROR; + return; + } + UChar32 utf32[4]; + int32_t len = prefix.toUTF32(utf32, 4, errorCode); + if (len != count) { + errorCode = U_INVALID_STATE_ERROR; + return; + } + UChar32 c = utf32[0]; + if (u_getCombiningClass(c)) { + // Prefix must start with as starter for ICU4X. + errorCode = U_UNSUPPORTED_ERROR; + return; + } + // XXX: Korean searchjl has jamo in prefix, so commenting out this + // check for now. ICU4X currently ignores non-root jamo tables anyway. + // searchjl was added in + // https://unicode-org.atlassian.net/browse/CLDR-3560 + // Contractions were changed to prefixes in + // https://unicode-org.atlassian.net/browse/CLDR-6546 + // + // if ((c >= 0x1100 && c < 0x1200) || (c >= 0xAC00 && c < 0xD7A4)) { + // errorCode = U_UNSUPPORTED_ERROR; + // return; + // } + if ((len > 1) && !(utf32[1] == 0x3099 || utf32[1] == 0x309A)) { + // Second character in prefix, if present, must be a kana voicing mark for ICU4X. + errorCode = U_UNSUPPORTED_ERROR; + return; + } + } + + if (s.length() > cLength) { + // Check that there's no modern Hangul in contractions. + for (int32_t i = 0; i < s.length(); ++i) { + char16_t c = s.charAt(i); + if ((c >= 0x1100 && c < 0x1100 + 19) || (c >= 0x1161 && c < 0x1161 + 21) || (c >= 0x11A7 && c < 0x11A7 + 28) || (c >= 0xAC00 && c < 0xD7A4)) { + errorCode = U_UNSUPPORTED_ERROR; + return; + } + } + } + } + if(oldCE32 == Collation::FALLBACK_CE32) { // First tailoring for c. // If c has contextual base mappings or if we add a contextual mapping, @@ -556,7 +673,7 @@ CollationDataBuilder::addCE32(const UnicodeString &prefix, const UnicodeString & // Otherwise we just override the base mapping. uint32_t baseCE32 = base->getFinalCE32(base->getCE32(c)); if(hasContext || Collation::ce32HasContext(baseCE32)) { - oldCE32 = copyFromBaseCE32(c, baseCE32, TRUE, errorCode); + oldCE32 = copyFromBaseCE32(c, baseCE32, true, errorCode); utrie2_set32(trie, c, oldCE32, &errorCode); if(U_FAILURE(errorCode)) { return; } } @@ -575,7 +692,7 @@ CollationDataBuilder::addCE32(const UnicodeString &prefix, const UnicodeString & if(!isBuilderContextCE32(oldCE32)) { // Replace the simple oldCE32 with a builder context CE32 // pointing to a new ConditionalCE32 list head. - int32_t index = addConditionalCE32(UnicodeString((UChar)0), oldCE32, errorCode); + int32_t index = addConditionalCE32(UnicodeString((char16_t)0), oldCE32, errorCode); if(U_FAILURE(errorCode)) { return; } uint32_t contextCE32 = makeBuilderContextCE32(index); utrie2_set32(trie, c, contextCE32, &errorCode); @@ -586,7 +703,7 @@ CollationDataBuilder::addCE32(const UnicodeString &prefix, const UnicodeString & cond->builtCE32 = Collation::NO_CE32; } UnicodeString suffix(s, cLength); - UnicodeString context((UChar)prefix.length()); + UnicodeString context((char16_t)prefix.length()); context.append(prefix).append(suffix); unsafeBackwardSet.addAll(suffix); for(;;) { @@ -616,7 +733,7 @@ CollationDataBuilder::addCE32(const UnicodeString &prefix, const UnicodeString & cond = nextCond; } } - modified = TRUE; + modified = true; } uint32_t @@ -660,7 +777,7 @@ CollationDataBuilder::encodeCEs(const int64_t ces[], int32_t cesLength, errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } - if(trie == NULL || utrie2_isFrozen(trie)) { + if(trie == nullptr || utrie2_isFrozen(trie)) { errorCode = U_INVALID_STATE_ERROR; return 0; } @@ -670,8 +787,11 @@ CollationDataBuilder::encodeCEs(const int64_t ces[], int32_t cesLength, return encodeOneCEAsCE32(0); } else if(cesLength == 1) { return encodeOneCE(ces[0], errorCode); - } else if(cesLength == 2) { + } else if(cesLength == 2 && !icu4xMode) { // Try to encode two CEs as one CE32. + // Turn this off for ICU4X, because without the canonical closure + // these are so rare that it doesn't make sense to spend a branch + // on checking this tag when using the data. int64_t ce0 = ces[0]; int64_t ce1 = ces[1]; uint32_t p0 = (uint32_t)(ce0 >> 32); @@ -794,18 +914,18 @@ CollationDataBuilder::copyFromBaseCE32(UChar32 c, uint32_t ce32, UBool withConte case Collation::PREFIX_TAG: { // Flatten prefixes and nested suffixes (contractions) // into a linear list of ConditionalCE32. - const UChar *p = base->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = base->contexts + Collation::indexFromCE32(ce32); ce32 = CollationData::readCE32(p); // Default if no prefix match. if(!withContext) { - return copyFromBaseCE32(c, ce32, FALSE, errorCode); + return copyFromBaseCE32(c, ce32, false, errorCode); } ConditionalCE32 head; - UnicodeString context((UChar)0); + UnicodeString context((char16_t)0); int32_t index; if(Collation::isContractionCE32(ce32)) { index = copyContractionsFromBaseCE32(context, c, ce32, &head, errorCode); } else { - ce32 = copyFromBaseCE32(c, ce32, TRUE, errorCode); + ce32 = copyFromBaseCE32(c, ce32, true, errorCode); head.next = index = addConditionalCE32(context, ce32, errorCode); } if(U_FAILURE(errorCode)) { return 0; } @@ -814,12 +934,12 @@ CollationDataBuilder::copyFromBaseCE32(UChar32 c, uint32_t ce32, UBool withConte while(prefixes.next(errorCode)) { context = prefixes.getString(); context.reverse(); - context.insert(0, (UChar)context.length()); + context.insert(0, (char16_t)context.length()); ce32 = (uint32_t)prefixes.getValue(); if(Collation::isContractionCE32(ce32)) { index = copyContractionsFromBaseCE32(context, c, ce32, cond, errorCode); } else { - ce32 = copyFromBaseCE32(c, ce32, TRUE, errorCode); + ce32 = copyFromBaseCE32(c, ce32, true, errorCode); cond->next = index = addConditionalCE32(context, ce32, errorCode); } if(U_FAILURE(errorCode)) { return 0; } @@ -831,12 +951,12 @@ CollationDataBuilder::copyFromBaseCE32(UChar32 c, uint32_t ce32, UBool withConte } case Collation::CONTRACTION_TAG: { if(!withContext) { - const UChar *p = base->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = base->contexts + Collation::indexFromCE32(ce32); ce32 = CollationData::readCE32(p); // Default if no suffix match. - return copyFromBaseCE32(c, ce32, FALSE, errorCode); + return copyFromBaseCE32(c, ce32, false, errorCode); } ConditionalCE32 head; - UnicodeString context((UChar)0); + UnicodeString context((char16_t)0); copyContractionsFromBaseCE32(context, c, ce32, &head, errorCode); ce32 = makeBuilderContextCE32(head.next); contextChars.add(c); @@ -846,13 +966,13 @@ CollationDataBuilder::copyFromBaseCE32(UChar32 c, uint32_t ce32, UBool withConte errorCode = U_UNSUPPORTED_ERROR; // We forbid tailoring of Hangul syllables. break; case Collation::OFFSET_TAG: - ce32 = getCE32FromOffsetCE32(TRUE, c, ce32); + ce32 = getCE32FromOffsetCE32(true, c, ce32); break; case Collation::IMPLICIT_TAG: ce32 = encodeOneCE(Collation::unassignedCEFromCodePoint(c), errorCode); break; default: - UPRV_UNREACHABLE; // require ce32 == base->getFinalCE32(ce32) + UPRV_UNREACHABLE_EXIT; // require ce32 == base->getFinalCE32(ce32) } return ce32; } @@ -861,7 +981,7 @@ int32_t CollationDataBuilder::copyContractionsFromBaseCE32(UnicodeString &context, UChar32 c, uint32_t ce32, ConditionalCE32 *cond, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return 0; } - const UChar *p = base->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = base->contexts + Collation::indexFromCE32(ce32); int32_t index; if((ce32 & Collation::CONTRACT_SINGLE_CP_NO_MATCH) != 0) { // No match on the single code point. @@ -872,7 +992,7 @@ CollationDataBuilder::copyContractionsFromBaseCE32(UnicodeString &context, UChar } else { ce32 = CollationData::readCE32(p); // Default if no suffix match. U_ASSERT(!Collation::isContractionCE32(ce32)); - ce32 = copyFromBaseCE32(c, ce32, TRUE, errorCode); + ce32 = copyFromBaseCE32(c, ce32, true, errorCode); cond->next = index = addConditionalCE32(context, ce32, errorCode); if(U_FAILURE(errorCode)) { return 0; } cond = getConditionalCE32(index); @@ -882,7 +1002,7 @@ CollationDataBuilder::copyContractionsFromBaseCE32(UnicodeString &context, UChar UCharsTrie::Iterator suffixes(p + 2, 0, errorCode); while(suffixes.next(errorCode)) { context.append(suffixes.getString()); - ce32 = copyFromBaseCE32(c, (uint32_t)suffixes.getValue(), TRUE, errorCode); + ce32 = copyFromBaseCE32(c, (uint32_t)suffixes.getValue(), true, errorCode); cond->next = index = addConditionalCE32(context, ce32, errorCode); if(U_FAILURE(errorCode)) { return 0; } // No need to update the unsafeBackwardSet because the tailoring set @@ -903,7 +1023,7 @@ class CopyHelper { UBool copyRangeCE32(UChar32 start, UChar32 end, uint32_t ce32) { ce32 = copyCE32(ce32); - utrie2_setRange32(dest.trie, start, end, ce32, TRUE, &errorCode); + utrie2_setRange32(dest.trie, start, end, ce32, true, &errorCode); if(CollationDataBuilder::isBuilderContextCE32(ce32)) { dest.contextChars.add(start, end); } @@ -924,7 +1044,7 @@ class CopyHelper { int32_t length = Collation::lengthFromCE32(ce32); // Inspect the source CE32s. Just copy them if none are modified. // Otherwise copy to modifiedCEs, with modifications. - UBool isModified = FALSE; + UBool isModified = false; for(int32_t i = 0; i < length; ++i) { ce32 = srcCE32s[i]; int64_t ce; @@ -938,7 +1058,7 @@ class CopyHelper { for(int32_t j = 0; j < i; ++j) { modifiedCEs[j] = Collation::ceFromCE32(srcCE32s[j]); } - isModified = TRUE; + isModified = true; } modifiedCEs[i] = ce; } @@ -955,7 +1075,7 @@ class CopyHelper { int32_t length = Collation::lengthFromCE32(ce32); // Inspect the source CEs. Just copy them if none are modified. // Otherwise copy to modifiedCEs, with modifications. - UBool isModified = FALSE; + UBool isModified = false; for(int32_t i = 0; i < length; ++i) { int64_t srcCE = srcCEs[i]; int64_t ce = modifier.modifyCE(srcCE); @@ -968,7 +1088,7 @@ class CopyHelper { for(int32_t j = 0; j < i; ++j) { modifiedCEs[j] = srcCEs[j]; } - isModified = TRUE; + isModified = true; } modifiedCEs[i] = ce; } @@ -1028,12 +1148,12 @@ void CollationDataBuilder::copyFrom(const CollationDataBuilder &src, const CEModifier &modifier, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - if(trie == NULL || utrie2_isFrozen(trie)) { + if(trie == nullptr || utrie2_isFrozen(trie)) { errorCode = U_INVALID_STATE_ERROR; return; } CopyHelper helper(src, *this, modifier, errorCode); - utrie2_enum(src.trie, NULL, enumRangeForCopy, &helper); + utrie2_enum(src.trie, nullptr, enumRangeForCopy, &helper); errorCode = helper.errorCode; // Update the contextChars and the unsafeBackwardSet while copying, // in case a character had conditional mappings in the source builder @@ -1050,11 +1170,11 @@ CollationDataBuilder::optimize(const UnicodeSet &set, UErrorCode &errorCode) { uint32_t ce32 = utrie2_get32(trie, c); if(ce32 == Collation::FALLBACK_CE32) { ce32 = base->getFinalCE32(base->getCE32(c)); - ce32 = copyFromBaseCE32(c, ce32, TRUE, errorCode); + ce32 = copyFromBaseCE32(c, ce32, true, errorCode); utrie2_set32(trie, c, ce32, &errorCode); } } - modified = TRUE; + modified = true; } void @@ -1067,7 +1187,7 @@ CollationDataBuilder::suppressContractions(const UnicodeSet &set, UErrorCode &er if(ce32 == Collation::FALLBACK_CE32) { ce32 = base->getFinalCE32(base->getCE32(c)); if(Collation::ce32HasContext(ce32)) { - ce32 = copyFromBaseCE32(c, ce32, FALSE /* without context */, errorCode); + ce32 = copyFromBaseCE32(c, ce32, false /* without context */, errorCode); utrie2_set32(trie, c, ce32, &errorCode); } } else if(isBuilderContextCE32(ce32)) { @@ -1079,23 +1199,23 @@ CollationDataBuilder::suppressContractions(const UnicodeSet &set, UErrorCode &er contextChars.remove(c); } } - modified = TRUE; + modified = true; } UBool CollationDataBuilder::getJamoCE32s(uint32_t jamoCE32s[], UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } - UBool anyJamoAssigned = base == NULL; // always set jamoCE32s in the base data - UBool needToCopyFromBase = FALSE; + if(U_FAILURE(errorCode)) { return false; } + UBool anyJamoAssigned = base == nullptr; // always set jamoCE32s in the base data + UBool needToCopyFromBase = false; for(int32_t j = 0; j < CollationData::JAMO_CE32S_LENGTH; ++j) { // Count across Jamo types. UChar32 jamo = jamoCpFromIndex(j); - UBool fromBase = FALSE; + UBool fromBase = false; uint32_t ce32 = utrie2_get32(trie, jamo); anyJamoAssigned |= Collation::isAssignedCE32(ce32); // TODO: Try to prevent [optimize [Jamo]] from counting as anyJamoAssigned. // (As of CLDR 24 [2013] the Korean tailoring does not optimize conjoining Jamo.) if(ce32 == Collation::FALLBACK_CE32) { - fromBase = TRUE; + fromBase = true; ce32 = base->getCE32(jamo); } if(Collation::isSpecialCE32(ce32)) { @@ -1112,14 +1232,14 @@ CollationDataBuilder::getJamoCE32s(uint32_t jamoCE32s[], UErrorCode &errorCode) if(fromBase) { // Defer copying until we know if anyJamoAssigned. ce32 = Collation::FALLBACK_CE32; - needToCopyFromBase = TRUE; + needToCopyFromBase = true; } break; case Collation::IMPLICIT_TAG: // An unassigned Jamo should only occur in tests with incomplete bases. U_ASSERT(fromBase); ce32 = Collation::FALLBACK_CE32; - needToCopyFromBase = TRUE; + needToCopyFromBase = true; break; case Collation::OFFSET_TAG: ce32 = getCE32FromOffsetCE32(fromBase, jamo, ce32); @@ -1132,7 +1252,7 @@ CollationDataBuilder::getJamoCE32s(uint32_t jamoCE32s[], UErrorCode &errorCode) case Collation::HANGUL_TAG: case Collation::LEAD_SURROGATE_TAG: errorCode = U_INTERNAL_PROGRAM_ERROR; - return FALSE; + return false; } } jamoCE32s[j] = ce32; @@ -1142,7 +1262,7 @@ CollationDataBuilder::getJamoCE32s(uint32_t jamoCE32s[], UErrorCode &errorCode) if(jamoCE32s[j] == Collation::FALLBACK_CE32) { UChar32 jamo = jamoCpFromIndex(j); jamoCE32s[j] = copyFromBaseCE32(jamo, base->getCE32(jamo), - /*withContext=*/ TRUE, errorCode); + /*withContext=*/ true, errorCode); } } } @@ -1183,24 +1303,24 @@ enumRangeLeadValue(const void *context, UChar32 /*start*/, UChar32 /*end*/, uint value = Collation::LEAD_ALL_FALLBACK; } else { *pValue = Collation::LEAD_MIXED; - return FALSE; + return false; } if(*pValue < 0) { *pValue = (int32_t)value; } else if(*pValue != (int32_t)value) { *pValue = Collation::LEAD_MIXED; - return FALSE; + return false; } - return TRUE; + return true; } U_CDECL_END void CollationDataBuilder::setLeadSurrogates(UErrorCode &errorCode) { - for(UChar lead = 0xd800; lead < 0xdc00; ++lead) { + for(char16_t lead = 0xd800; lead < 0xdc00; ++lead) { int32_t value = -1; - utrie2_enumForLeadSurrogate(trie, lead, NULL, enumRangeLeadValue, &value); + utrie2_enumForLeadSurrogate(trie, lead, nullptr, enumRangeLeadValue, &value); utrie2_set32ForLeadSurrogateCodeUnit( trie, lead, Collation::makeCE32FromTagAndIndex(Collation::LEAD_SURROGATE_TAG, 0) | (uint32_t)value, @@ -1211,7 +1331,7 @@ CollationDataBuilder::setLeadSurrogates(UErrorCode &errorCode) { void CollationDataBuilder::build(CollationData &data, UErrorCode &errorCode) { buildMappings(data, errorCode); - if(base != NULL) { + if(base != nullptr) { data.numericPrimary = base->numericPrimary; data.compressibleBytes = base->compressibleBytes; data.numScripts = base->numScripts; @@ -1225,7 +1345,7 @@ CollationDataBuilder::build(CollationData &data, UErrorCode &errorCode) { void CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - if(trie == NULL || utrie2_isFrozen(trie)) { + if(trie == nullptr || utrie2_isFrozen(trie)) { errorCode = U_INVALID_STATE_ERROR; return; } @@ -1246,10 +1366,10 @@ CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) // In order to still have good trie compression and keep this code simple, // we only set this flag if a whole block of 588 Hangul syllables starting with // a common leading consonant (Jamo L) has this property. - UBool isAnyJamoVTSpecial = FALSE; + UBool isAnyJamoVTSpecial = false; for(int32_t i = Hangul::JAMO_L_COUNT; i < CollationData::JAMO_CE32S_LENGTH; ++i) { if(Collation::isSpecialCE32(jamoCE32s[i])) { - isAnyJamoVTSpecial = TRUE; + isAnyJamoVTSpecial = true; break; } } @@ -1261,7 +1381,7 @@ CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) ce32 |= Collation::HANGUL_NO_SPECIAL_JAMO; } UChar32 limit = c + Hangul::JAMO_VT_COUNT; - utrie2_setRange32(trie, c, limit - 1, ce32, TRUE, &errorCode); + utrie2_setRange32(trie, c, limit - 1, ce32, true, &errorCode); c = limit; } } else { @@ -1271,7 +1391,7 @@ CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) uint32_t ce32 = base->getCE32(c); U_ASSERT(Collation::hasCE32Tag(ce32, Collation::HANGUL_TAG)); UChar32 limit = c + Hangul::JAMO_VT_COUNT; - utrie2_setRange32(trie, c, limit - 1, ce32, TRUE, &errorCode); + utrie2_setRange32(trie, c, limit - 1, ce32, true, &errorCode); c = limit; } } @@ -1279,9 +1399,11 @@ CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) setDigitTags(errorCode); setLeadSurrogates(errorCode); - // For U+0000, move its normal ce32 into CE32s[0] and set U0000_TAG. - ce32s.setElementAt((int32_t)utrie2_get32(trie, 0), 0); - utrie2_set32(trie, 0, Collation::makeCE32FromTagAndIndex(Collation::U0000_TAG, 0), &errorCode); + if (!icu4xMode) { + // For U+0000, move its normal ce32 into CE32s[0] and set U0000_TAG. + ce32s.setElementAt((int32_t)utrie2_get32(trie, 0), 0); + utrie2_set32(trie, 0, Collation::makeCE32FromTagAndIndex(Collation::U0000_TAG, 0), &errorCode); + } utrie2_freeze(trie, UTRIE2_32_VALUE_BITS, &errorCode); if(U_FAILURE(errorCode)) { return; } @@ -1289,7 +1411,7 @@ CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) // Mark each lead surrogate as "unsafe" // if any of its 1024 associated supplementary code points is "unsafe". UChar32 c = 0x10000; - for(UChar lead = 0xd800; lead < 0xdc00; ++lead, c += 0x400) { + for(char16_t lead = 0xd800; lead < 0xdc00; ++lead, c += 0x400) { if(unsafeBackwardSet.containsSome(c, c + 0x3ff)) { unsafeBackwardSet.add(lead); } @@ -1317,13 +1439,10 @@ CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) void CollationDataBuilder::clearContexts() { contexts.remove(); - UnicodeSetIterator iter(contextChars); - while(iter.next()) { - U_ASSERT(!iter.isString()); - uint32_t ce32 = utrie2_get32(trie, iter.getCodepoint()); - U_ASSERT(isBuilderContextCE32(ce32)); - getConditionalCE32ForCE32(ce32)->builtCE32 = Collation::NO_CE32; - } + // Incrementing the contexts build "era" invalidates all of the builtCE32 + // from before this clearContexts() call. + // Simpler than finding and resetting all of those fields. + ++contextsEra; } void @@ -1331,7 +1450,7 @@ CollationDataBuilder::buildContexts(UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } // Ignore abandoned lists and the cached builtCE32, // and build all contexts from scratch. - contexts.remove(); + clearContexts(); UnicodeSetIterator iter(contextChars); while(U_SUCCESS(errorCode) && iter.next()) { U_ASSERT(!iter.isString()); @@ -1357,18 +1476,34 @@ CollationDataBuilder::buildContext(ConditionalCE32 *head, UErrorCode &errorCode) U_ASSERT(head->next >= 0); UCharsTrieBuilder prefixBuilder(errorCode); UCharsTrieBuilder contractionBuilder(errorCode); + // This outer loop goes from each prefix to the next. + // For each prefix it finds the one or more same-prefix entries (firstCond..lastCond). + // If there are multiple suffixes for the same prefix, + // then an inner loop builds a contraction trie for them. for(ConditionalCE32 *cond = head;; cond = getConditionalCE32(cond->next)) { + if(U_FAILURE(errorCode)) { return 0; } // early out for memory allocation errors // After the list head, the prefix or suffix can be empty, but not both. U_ASSERT(cond == head || cond->hasContext()); int32_t prefixLength = cond->prefixLength(); UnicodeString prefix(cond->context, 0, prefixLength + 1); // Collect all contraction suffixes for one prefix. ConditionalCE32 *firstCond = cond; - ConditionalCE32 *lastCond = cond; - while(cond->next >= 0 && - (cond = getConditionalCE32(cond->next))->context.startsWith(prefix)) { + ConditionalCE32 *lastCond; + do { lastCond = cond; - } + // Clear the defaultCE32 fields as we go. + // They are left over from building a previous version of this list of contexts. + // + // One of the code paths below may copy a preceding defaultCE32 + // into its emptySuffixCE32. + // If a new suffix has been inserted before what used to be + // the firstCond for its prefix, then that previous firstCond could still + // contain an outdated defaultCE32 from an earlier buildContext() and + // result in an incorrect emptySuffixCE32. + // So we reset all defaultCE32 before reading and setting new values. + cond->defaultCE32 = Collation::NO_CE32; + } while(cond->next >= 0 && + (cond = getConditionalCE32(cond->next))->context.startsWith(prefix)); uint32_t ce32; int32_t suffixStart = prefixLength + 1; // == prefix.length() if(lastCond->context.length() == suffixStart) { @@ -1423,6 +1558,20 @@ CollationDataBuilder::buildContext(ConditionalCE32 *head, UErrorCode &errorCode) // The last suffix character has lccc!=0, allowing for discontiguous contractions. flags |= Collation::CONTRACT_TRAILING_CCC; } + if (icu4xMode && (flags & Collation::CONTRACT_HAS_STARTER) == 0) { + for (int32_t i = 0; i < suffix.length();) { + UChar32 c = suffix.char32At(i); + if (!u_getCombiningClass(c)) { + flags |= Collation::CONTRACT_HAS_STARTER; + break; + } + if (c > 0xFFFF) { + i += 2; + } else { + ++i; + } + } + } contractionBuilder.add(suffix, (int32_t)cond->ce32, errorCode); if(cond == lastCond) { break; } cond = getConditionalCE32(cond->next); @@ -1463,7 +1612,7 @@ int32_t CollationDataBuilder::addContextTrie(uint32_t defaultCE32, UCharsTrieBuilder &trieBuilder, UErrorCode &errorCode) { UnicodeString context; - context.append((UChar)(defaultCE32 >> 16)).append((UChar)defaultCE32); + context.append((char16_t)(defaultCE32 >> 16)).append((char16_t)defaultCE32); UnicodeString trieString; context.append(trieBuilder.buildUnicodeString(USTRINGTRIE_BUILD_SMALL, trieString, errorCode)); if(U_FAILURE(errorCode)) { return -1; } @@ -1481,25 +1630,25 @@ CollationDataBuilder::buildFastLatinTable(CollationData &data, UErrorCode &error delete fastLatinBuilder; fastLatinBuilder = new CollationFastLatinBuilder(errorCode); - if(fastLatinBuilder == NULL) { + if(fastLatinBuilder == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } if(fastLatinBuilder->forData(data, errorCode)) { const uint16_t *table = fastLatinBuilder->getTable(); int32_t length = fastLatinBuilder->lengthOfTable(); - if(base != NULL && length == base->fastLatinTableLength && + if(base != nullptr && length == base->fastLatinTableLength && uprv_memcmp(table, base->fastLatinTable, length * 2) == 0) { // Same fast Latin table as in the base, use that one instead. delete fastLatinBuilder; - fastLatinBuilder = NULL; + fastLatinBuilder = nullptr; table = base->fastLatinTable; } data.fastLatinTable = table; data.fastLatinTableLength = length; } else { delete fastLatinBuilder; - fastLatinBuilder = NULL; + fastLatinBuilder = nullptr; } } @@ -1522,9 +1671,9 @@ CollationDataBuilder::getCEs(const UnicodeString &prefix, const UnicodeString &s int32_t CollationDataBuilder::getCEs(const UnicodeString &s, int32_t start, int64_t ces[], int32_t cesLength) { - if(collIter == NULL) { + if(collIter == nullptr) { collIter = new DataBuilderCollationIterator(*this); - if(collIter == NULL) { return 0; } + if(collIter == nullptr) { return 0; } } return collIter->fetchCEs(s, start, ces, cesLength); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.h index fee444dee..cbbd8f264 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.h @@ -60,7 +60,7 @@ class U_I18N_API CollationDataBuilder : public UObject { virtual int64_t modifyCE(int64_t ce) const = 0; }; - CollationDataBuilder(UErrorCode &errorCode); + CollationDataBuilder(UBool icu4xMode, UErrorCode &errorCode); virtual ~CollationDataBuilder(); @@ -73,12 +73,12 @@ class U_I18N_API CollationDataBuilder : public UObject { } /** - * @return TRUE if this builder has mappings (e.g., add() has been called) + * @return true if this builder has mappings (e.g., add() has been called) */ UBool hasMappings() const { return modified; } /** - * @return TRUE if c has CEs in this builder + * @return true if c has CEs in this builder */ UBool isAssigned(UChar32 c) const; @@ -118,7 +118,7 @@ class U_I18N_API CollationDataBuilder : public UObject { * @param primary primary weight for 'start' * @param step per-code point primary-weight increment * @param errorCode ICU in/out error code - * @return TRUE if an OFFSET_TAG range was used for start..end + * @return true if an OFFSET_TAG range was used for start..end */ UBool maybeSetPrimaryRange(UChar32 start, UChar32 end, uint32_t primary, int32_t step, @@ -150,7 +150,7 @@ class U_I18N_API CollationDataBuilder : public UObject { void optimize(const UnicodeSet &set, UErrorCode &errorCode); void suppressContractions(const UnicodeSet &set, UErrorCode &errorCode); - void enableFastLatin() { fastLatinEnabled = TRUE; } + void enableFastLatin() { fastLatinEnabled = true; } virtual void build(CollationData &data, UErrorCode &errorCode); /** @@ -244,8 +244,18 @@ class U_I18N_API CollationDataBuilder : public UObject { UnicodeSet contextChars; // Serialized UCharsTrie structures for finalized contexts. UnicodeString contexts; +private: + /** + * The "era" of building intermediate contexts. + * When the array of cached, temporary contexts overflows, then clearContexts() + * removes them all and invalidates the builtCE32 that used to point to built tries. + * See ConditionalCE32::era. + */ + int32_t contextsEra = 0; +protected: UnicodeSet unsafeBackwardSet; UBool modified; + UBool icu4xMode; UBool fastLatinEnabled; CollationFastLatinBuilder *fastLatinBuilder; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.cpp index 0eb186134..1884208ea 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.cpp @@ -47,14 +47,14 @@ void CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes, int32_t inLength, CollationTailoring &tailoring, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - if(base != NULL) { - if(inBytes == NULL || (0 <= inLength && inLength < 24)) { + if(base != nullptr) { + if(inBytes == nullptr || (0 <= inLength && inLength < 24)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } const DataHeader *header = reinterpret_cast(inBytes); if(!(header->dataHeader.magic1 == 0xda && header->dataHeader.magic2 == 0x27 && - isAcceptable(tailoring.version, NULL, NULL, &header->info))) { + isAcceptable(tailoring.version, nullptr, nullptr, &header->info))) { errorCode = U_INVALID_FORMAT_ERROR; return; } @@ -69,7 +69,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes } } - if(inBytes == NULL || (0 <= inLength && inLength < 8)) { + if(inBytes == nullptr || (0 <= inLength && inLength < 8)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -81,7 +81,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes } // Assume that the tailoring data is in initial state, - // with NULL pointers and 0 lengths. + // with nullptr pointers and 0 lengths. // Set pointers to non-empty data parts. // Do this in order of their byte offsets. (Should help porting to Java.) @@ -102,16 +102,16 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes return; } - const CollationData *baseData = base == NULL ? NULL : base->data; - const int32_t *reorderCodes = NULL; + const CollationData *baseData = base == nullptr ? nullptr : base->data; + const int32_t *reorderCodes = nullptr; int32_t reorderCodesLength = 0; - const uint32_t *reorderRanges = NULL; + const uint32_t *reorderRanges = nullptr; int32_t reorderRangesLength = 0; index = IX_REORDER_CODES_OFFSET; offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 4) { - if(baseData == NULL) { + if(baseData == nullptr) { // We assume for collation settings that // the base data does not have a reordering. errorCode = U_INVALID_FORMAT_ERROR; @@ -138,7 +138,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes // There should be a reorder table only if there are reorder codes. // However, when there are reorder codes the reorder table may be omitted to reduce // the data size. - const uint8_t *reorderTable = NULL; + const uint8_t *reorderTable = nullptr; index = IX_REORDER_TABLE_OFFSET; offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; @@ -153,11 +153,11 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes // when the CollationData is otherwise complete. } - if(baseData != NULL && baseData->numericPrimary != (inIndexes[IX_OPTIONS] & 0xff000000)) { + if(baseData != nullptr && baseData->numericPrimary != (inIndexes[IX_OPTIONS] & 0xff000000)) { errorCode = U_INVALID_FORMAT_ERROR; return; } - CollationData *data = NULL; // Remains NULL if there are no mappings. + CollationData *data = nullptr; // Remains nullptr if there are no mappings. index = IX_TRIE_OFFSET; offset = getIndex(inIndexes, indexesLength, index); @@ -168,10 +168,10 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes data->base = baseData; data->numericPrimary = inIndexes[IX_OPTIONS] & 0xff000000; data->trie = tailoring.trie = utrie2_openFromSerialized( - UTRIE2_32_VALUE_BITS, inBytes + offset, length, NULL, + UTRIE2_32_VALUE_BITS, inBytes + offset, length, nullptr, &errorCode); if(U_FAILURE(errorCode)) { return; } - } else if(baseData != NULL) { + } else if(baseData != nullptr) { // Use the base data. Only the settings are tailored. tailoring.data = baseData; } else { @@ -183,7 +183,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 8) { - if(data == NULL) { + if(data == nullptr) { errorCode = U_INVALID_FORMAT_ERROR; // Tailored ces without tailored trie. return; } @@ -195,7 +195,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 4) { - if(data == NULL) { + if(data == nullptr) { errorCode = U_INVALID_FORMAT_ERROR; // Tailored ce32s without tailored trie. return; } @@ -205,14 +205,14 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes int32_t jamoCE32sStart = getIndex(inIndexes, indexesLength, IX_JAMO_CE32S_START); if(jamoCE32sStart >= 0) { - if(data == NULL || data->ce32s == NULL) { + if(data == nullptr || data->ce32s == nullptr) { errorCode = U_INVALID_FORMAT_ERROR; // Index into non-existent ce32s[]. return; } data->jamoCE32s = data->ce32s + jamoCE32sStart; - } else if(data == NULL) { + } else if(data == nullptr) { // Nothing to do. - } else if(baseData != NULL) { + } else if(baseData != nullptr) { data->jamoCE32s = baseData->jamoCE32s; } else { errorCode = U_INVALID_FORMAT_ERROR; // No Jamo CE32s for Hangul processing. @@ -224,7 +224,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 4) { length /= 4; - if(data == NULL || length <= CollationRootElements::IX_SEC_TER_BOUNDARIES) { + if(data == nullptr || length <= CollationRootElements::IX_SEC_TER_BOUNDARIES) { errorCode = U_INVALID_FORMAT_ERROR; return; } @@ -248,11 +248,11 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 2) { - if(data == NULL) { + if(data == nullptr) { errorCode = U_INVALID_FORMAT_ERROR; // Tailored contexts without tailored trie. return; } - data->contexts = reinterpret_cast(inBytes + offset); + data->contexts = reinterpret_cast(inBytes + offset); data->contextsLength = length / 2; } @@ -260,14 +260,14 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 2) { - if(data == NULL) { + if(data == nullptr) { errorCode = U_INVALID_FORMAT_ERROR; return; } - if(baseData == NULL) { + if(baseData == nullptr) { #if defined(COLLUNSAFE_COLL_VERSION) && defined (COLLUNSAFE_SERIALIZE) tailoring.unsafeBackwardSet = new UnicodeSet(unsafe_serializedData, unsafe_serializedCount, UnicodeSet::kSerialized, errorCode); - if(tailoring.unsafeBackwardSet == NULL) { + if(tailoring.unsafeBackwardSet == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } else if (U_FAILURE(errorCode)) { @@ -286,7 +286,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes // new UnicodeSet("[[:^lccc=0:][\\udc00-\\udfff]]"). // It is faster and requires fewer code dependencies. tailoring.unsafeBackwardSet = new UnicodeSet(0xdc00, 0xdfff); // trail surrogates - if(tailoring.unsafeBackwardSet == NULL) { + if(tailoring.unsafeBackwardSet == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -296,7 +296,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes // Clone the root collator's set contents. tailoring.unsafeBackwardSet = static_cast( baseData->unsafeBackwardSet->cloneAsThawed()); - if(tailoring.unsafeBackwardSet == NULL) { + if(tailoring.unsafeBackwardSet == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -317,16 +317,16 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes // Mark each lead surrogate as "unsafe" // if any of its 1024 associated supplementary code points is "unsafe". UChar32 c = 0x10000; - for(UChar lead = 0xd800; lead < 0xdc00; ++lead, c += 0x400) { + for(char16_t lead = 0xd800; lead < 0xdc00; ++lead, c += 0x400) { if(!tailoring.unsafeBackwardSet->containsNone(c, c + 0x3ff)) { tailoring.unsafeBackwardSet->add(lead); } } tailoring.unsafeBackwardSet->freeze(); data->unsafeBackwardSet = tailoring.unsafeBackwardSet; - } else if(data == NULL) { + } else if(data == nullptr) { // Nothing to do. - } else if(baseData != NULL) { + } else if(baseData != nullptr) { // No tailoring-specific data: Alias the root collator's set. data->unsafeBackwardSet = baseData->unsafeBackwardSet; } else { @@ -337,8 +337,8 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes // If the fast Latin format version is different, // or the version is set to 0 for "no fast Latin table", // then just always use the normal string comparison path. - if(data != NULL) { - data->fastLatinTable = NULL; + if(data != nullptr) { + data->fastLatinTable = nullptr; data->fastLatinTableLength = 0; if(((inIndexes[IX_OPTIONS] >> 16) & 0xff) == CollationFastLatin::VERSION) { index = IX_FAST_LATIN_TABLE_OFFSET; @@ -351,7 +351,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes errorCode = U_INVALID_FORMAT_ERROR; // header vs. table version mismatch return; } - } else if(baseData != NULL) { + } else if(baseData != nullptr) { data->fastLatinTable = baseData->fastLatinTable; data->fastLatinTableLength = baseData->fastLatinTableLength; } @@ -362,7 +362,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 2) { - if(data == NULL) { + if(data == nullptr) { errorCode = U_INVALID_FORMAT_ERROR; return; } @@ -385,9 +385,9 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes errorCode = U_INVALID_FORMAT_ERROR; return; } - } else if(data == NULL) { + } else if(data == nullptr) { // Nothing to do. - } else if(baseData != NULL) { + } else if(baseData != nullptr) { data->numScripts = baseData->numScripts; data->scriptsIndex = baseData->scriptsIndex; data->scriptStarts = baseData->scriptStarts; @@ -398,14 +398,14 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes offset = getIndex(inIndexes, indexesLength, index); length = getIndex(inIndexes, indexesLength, index + 1) - offset; if(length >= 256) { - if(data == NULL) { + if(data == nullptr) { errorCode = U_INVALID_FORMAT_ERROR; return; } data->compressibleBytes = reinterpret_cast(inBytes + offset); - } else if(data == NULL) { + } else if(data == nullptr) { // Nothing to do. - } else if(baseData != NULL) { + } else if(baseData != nullptr) { data->compressibleBytes = baseData->compressibleBytes; } else { errorCode = U_INVALID_FORMAT_ERROR; // No compressibleBytes[]. @@ -429,14 +429,14 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes } CollationSettings *settings = SharedObject::copyOnWrite(tailoring.settings); - if(settings == NULL) { + if(settings == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } settings->options = options; // Set variableTop from options and scripts data. settings->variableTop = tailoring.data->getLastPrimaryForGroup( - UCOL_REORDER_CODE_FIRST + settings->getMaxVariable()); + UCOL_REORDER_CODE_FIRST + int32_t{settings->getMaxVariable()}); if(settings->variableTop == 0) { errorCode = U_INVALID_FORMAT_ERROR; return; @@ -468,12 +468,12 @@ CollationDataReader::isAcceptable(void *context, pInfo->formatVersion[0] == 5 ) { UVersionInfo *version = static_cast(context); - if(version != NULL) { + if(version != nullptr) { uprv_memcpy(version, pInfo->dataVersion, 4); } - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.h index 44e69399e..5030f6c85 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.h @@ -80,7 +80,7 @@ struct U_I18N_API CollationDataReader /* all static */ { /** Byte offset to uint32_t rootElements[]. */ IX_ROOT_ELEMENTS_OFFSET, // 12 - /** Byte offset to UChar *contexts[]. */ + /** Byte offset to char16_t *contexts[]. */ IX_CONTEXTS_OFFSET, /** Byte offset to uint16_t [] with serialized unsafeBackwardSet. */ IX_UNSAFE_BWD_OFFSET, @@ -106,7 +106,7 @@ struct U_I18N_API CollationDataReader /* all static */ { isAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo); private: - CollationDataReader(); // no constructor + CollationDataReader() = delete; // no constructor }; /* @@ -198,7 +198,7 @@ struct U_I18N_API CollationDataReader /* all static */ { * Compact storage for all of the CEs that occur in the root collation. * See the CollationRootElements class. * - * UChar *contexts[]; + * char16_t *contexts[]; * Serialized UCharsTrie structures with prefix (pre-context) and contraction mappings. * * uint16_t unsafeBackwardSet[]; -- see UnicodeSet::serialize() diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.cpp index 823c8eb01..ce78a0526 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.cpp @@ -33,22 +33,22 @@ U_NAMESPACE_BEGIN uint8_t * RuleBasedCollator::cloneRuleData(int32_t &length, UErrorCode &errorCode) const { - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } LocalMemory buffer((uint8_t *)uprv_malloc(20000)); if(buffer.isNull()) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } length = cloneBinary(buffer.getAlias(), 20000, errorCode); if(errorCode == U_BUFFER_OVERFLOW_ERROR) { - if(buffer.allocateInsteadAndCopy(length, 0) == NULL) { + if(buffer.allocateInsteadAndCopy(length, 0) == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } errorCode = U_ZERO_ERROR; length = cloneBinary(buffer.getAlias(), length, errorCode); } - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } return buffer.orphan(); } @@ -79,7 +79,7 @@ CollationDataWriter::writeBase(const CollationData &data, const CollationSetting const void *rootElements, int32_t rootElementsLength, int32_t indexes[], uint8_t *dest, int32_t capacity, UErrorCode &errorCode) { - return write(TRUE, NULL, + return write(true, nullptr, data, settings, rootElements, rootElementsLength, indexes, dest, capacity, errorCode); @@ -89,9 +89,9 @@ int32_t CollationDataWriter::writeTailoring(const CollationTailoring &t, const CollationSettings &settings, int32_t indexes[], uint8_t *dest, int32_t capacity, UErrorCode &errorCode) { - return write(FALSE, t.version, + return write(false, t.version, *t.data, settings, - NULL, 0, + nullptr, 0, indexes, dest, capacity, errorCode); } @@ -102,7 +102,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, int32_t indexes[], uint8_t *dest, int32_t capacity, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return 0; } - if(capacity < 0 || (capacity > 0 && dest == NULL)) { + if(capacity < 0 || (capacity > 0 && dest == nullptr)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -117,7 +117,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, const CollationData *baseData = data.base; int32_t fastLatinVersion; - if(data.fastLatinTable != NULL) { + if(data.fastLatinTable != nullptr) { fastLatinVersion = (int32_t)CollationFastLatin::VERSION << 16; } else { fastLatinVersion = 0; @@ -129,11 +129,11 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, // so that we start with an 8-aligned offset. indexesLength = CollationDataReader::IX_TOTAL_SIZE + 1; U_ASSERT(settings.reorderCodesLength == 0); - hasMappings = TRUE; + hasMappings = true; unsafeBackwardSet = *data.unsafeBackwardSet; fastLatinTableLength = data.fastLatinTableLength; - } else if(baseData == NULL) { - hasMappings = FALSE; + } else if(baseData == nullptr) { + hasMappings = false; if(settings.reorderCodesLength == 0) { // only options indexesLength = CollationDataReader::IX_OPTIONS + 1; // no limit offset here @@ -142,7 +142,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, indexesLength = CollationDataReader::IX_REORDER_TABLE_OFFSET + 2; } } else { - hasMappings = TRUE; + hasMappings = true; // Tailored mappings, and what else? // Check in ascending order of optional tailoring data items. indexesLength = CollationDataReader::IX_CE32S_OFFSET + 2; @@ -207,7 +207,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, dest += headerSize; capacity -= headerSize; } else { - dest = NULL; + dest = nullptr; capacity = 0; } } @@ -233,7 +233,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, totalSize += reorderCodesLength * 4; indexes[CollationDataReader::IX_REORDER_TABLE_OFFSET] = totalSize; - if(settings.reorderTable != NULL) { + if(settings.reorderTable != nullptr) { totalSize += 256; } @@ -245,7 +245,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, length = utrie2_serialize(data.trie, dest + totalSize, capacity - totalSize, &errorCode2); } else { - length = utrie2_serialize(data.trie, NULL, 0, &errorCode2); + length = utrie2_serialize(data.trie, nullptr, 0, &errorCode2); } if(U_FAILURE(errorCode2) && errorCode2 != U_BUFFER_OVERFLOW_ERROR) { errorCode = errorCode2; @@ -287,7 +287,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, length = unsafeBackwardSet.serialize( p, (capacity - totalSize) / 2, errorCode2); } else { - length = unsafeBackwardSet.serialize(NULL, 0, errorCode2); + length = unsafeBackwardSet.serialize(nullptr, 0, errorCode2); } if(U_FAILURE(errorCode2) && errorCode2 != U_BUFFER_OVERFLOW_ERROR) { errorCode = errorCode2; @@ -302,9 +302,9 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion, UnicodeString scripts; indexes[CollationDataReader::IX_SCRIPTS_OFFSET] = totalSize; if(isBase) { - scripts.append((UChar)data.numScripts); - scripts.append(reinterpret_cast(data.scriptsIndex), data.numScripts + 16); - scripts.append(reinterpret_cast(data.scriptStarts), data.scriptStartsLength); + scripts.append((char16_t)data.numScripts); + scripts.append(reinterpret_cast(data.scriptsIndex), data.numScripts + 16); + scripts.append(reinterpret_cast(data.scriptStarts), data.scriptStartsLength); totalSize += scripts.length() * 2; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.h index 197cd5309..6ba9a9c2c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.h @@ -39,7 +39,7 @@ class U_I18N_API CollationDataWriter /* all static */ { UErrorCode &errorCode); private: - CollationDataWriter(); // no constructor + CollationDataWriter() = delete; // no constructor static int32_t write(UBool isBase, const UVersionInfo dataVersion, const CollationData &data, const CollationSettings &settings, diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.cpp index b98b8457f..f40781a11 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.cpp @@ -27,7 +27,7 @@ int32_t CollationFastLatin::getOptions(const CollationData *data, const CollationSettings &settings, uint16_t *primaries, int32_t capacity) { const uint16_t *table = data->fastLatinTable; - if(table == NULL) { return -1; } + if(table == nullptr) { return -1; } U_ASSERT(capacity == LATIN_LIMIT); if(capacity != LATIN_LIMIT) { return -1; } @@ -45,7 +45,7 @@ CollationFastLatin::getOptions(const CollationData *data, const CollationSetting miniVarTop = table[i]; } - UBool digitsAreReordered = FALSE; + UBool digitsAreReordered = false; if(settings.hasReordering()) { uint32_t prevStart = 0; uint32_t beforeDigitStart = 0; @@ -80,7 +80,7 @@ CollationFastLatin::getOptions(const CollationData *data, const CollationSetting afterDigitStart = latinStart; } if(!(beforeDigitStart < digitStart && digitStart < afterDigitStart)) { - digitsAreReordered = TRUE; + digitsAreReordered = true; } } @@ -107,8 +107,8 @@ CollationFastLatin::getOptions(const CollationData *data, const CollationSetting int32_t CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primaries, int32_t options, - const UChar *left, int32_t leftLength, - const UChar *right, int32_t rightLength) { + const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength) { // This is a modified copy of CollationCompare::compareUpToQuaternary(), // optimized for common Latin text. // Keep them in sync! @@ -154,7 +154,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie leftPair &= LONG_PRIMARY_MASK; break; } else { - leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength); if(leftPair == BAIL_OUT) { return BAIL_OUT_RESULT; } leftPair = getPrimaries(variableTop, leftPair); } @@ -185,7 +185,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie rightPair &= LONG_PRIMARY_MASK; break; } else { - rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength); if(rightPair == BAIL_OUT) { return BAIL_OUT_RESULT; } rightPair = getPrimaries(variableTop, rightPair); } @@ -236,7 +236,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie leftPair = COMMON_SEC_PLUS_OFFSET; break; } else { - leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength); leftPair = getSecondaries(variableTop, leftPair); } } @@ -261,7 +261,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie rightPair = COMMON_SEC_PLUS_OFFSET; break; } else { - rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength); rightPair = getSecondaries(variableTop, rightPair); } } @@ -300,7 +300,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie UChar32 c = left[leftIndex++]; leftPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c); if(leftPair < MIN_LONG) { - leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength); } leftPair = getCases(variableTop, strengthIsPrimary, leftPair); } @@ -313,7 +313,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie UChar32 c = right[rightIndex++]; rightPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c); if(rightPair < MIN_LONG) { - rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength); } rightPair = getCases(variableTop, strengthIsPrimary, rightPair); } @@ -353,7 +353,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie UChar32 c = left[leftIndex++]; leftPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c); if(leftPair < MIN_LONG) { - leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength); } leftPair = getTertiaries(variableTop, withCaseBits, leftPair); } @@ -366,7 +366,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie UChar32 c = right[rightIndex++]; rightPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c); if(rightPair < MIN_LONG) { - rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength); } rightPair = getTertiaries(variableTop, withCaseBits, rightPair); } @@ -409,7 +409,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie UChar32 c = left[leftIndex++]; leftPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c); if(leftPair < MIN_LONG) { - leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength); } leftPair = getQuaternaries(variableTop, leftPair); } @@ -422,7 +422,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie UChar32 c = right[rightIndex++]; rightPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c); if(rightPair < MIN_LONG) { - rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength); } rightPair = getQuaternaries(variableTop, rightPair); } @@ -499,7 +499,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries leftPair &= LONG_PRIMARY_MASK; break; } else { - leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength); if(leftPair == BAIL_OUT) { return BAIL_OUT_RESULT; } leftPair = getPrimaries(variableTop, leftPair); } @@ -536,7 +536,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries rightPair &= LONG_PRIMARY_MASK; break; } else { - rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength); if(rightPair == BAIL_OUT) { return BAIL_OUT_RESULT; } rightPair = getPrimaries(variableTop, rightPair); } @@ -587,7 +587,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries leftPair = COMMON_SEC_PLUS_OFFSET; break; } else { - leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength); leftPair = getSecondaries(variableTop, leftPair); } } @@ -612,7 +612,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries rightPair = COMMON_SEC_PLUS_OFFSET; break; } else { - rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength); rightPair = getSecondaries(variableTop, rightPair); } } @@ -651,7 +651,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries UChar32 c = left[leftIndex++]; leftPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, left, leftIndex); if(leftPair < MIN_LONG) { - leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength); } leftPair = getCases(variableTop, strengthIsPrimary, leftPair); } @@ -664,7 +664,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries UChar32 c = right[rightIndex++]; rightPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, right, rightIndex); if(rightPair < MIN_LONG) { - rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength); } rightPair = getCases(variableTop, strengthIsPrimary, rightPair); } @@ -704,7 +704,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries UChar32 c = left[leftIndex++]; leftPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, left, leftIndex); if(leftPair < MIN_LONG) { - leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength); } leftPair = getTertiaries(variableTop, withCaseBits, leftPair); } @@ -717,7 +717,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries UChar32 c = right[rightIndex++]; rightPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, right, rightIndex); if(rightPair < MIN_LONG) { - rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength); } rightPair = getTertiaries(variableTop, withCaseBits, rightPair); } @@ -760,7 +760,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries UChar32 c = left[leftIndex++]; leftPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, left, leftIndex); if(leftPair < MIN_LONG) { - leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength); + leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength); } leftPair = getQuaternaries(variableTop, leftPair); } @@ -773,7 +773,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries UChar32 c = right[rightIndex++]; rightPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, right, rightIndex); if(rightPair < MIN_LONG) { - rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength); + rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength); } rightPair = getQuaternaries(variableTop, rightPair); } @@ -854,7 +854,7 @@ CollationFastLatin::lookupUTF8Unsafe(const uint16_t *table, UChar32 c, uint32_t CollationFastLatin::nextPair(const uint16_t *table, UChar32 c, uint32_t ce, - const UChar *s16, const uint8_t *s8, int32_t &sIndex, int32_t &sLength) { + const char16_t *s16, const uint8_t *s8, int32_t &sIndex, int32_t &sLength) { if(ce >= MIN_LONG || ce < CONTRACTION) { return ce; // simple or special mini CE } else if(ce >= EXPANSION) { @@ -872,7 +872,7 @@ CollationFastLatin::nextPair(const uint16_t *table, UChar32 c, uint32_t ce, // Read the next character. int32_t c2; int32_t nextIndex = sIndex; - if(s16 != NULL) { + if(s16 != nullptr) { c2 = s16[nextIndex++]; if(c2 > LATIN_MAX) { if(PUNCT_START <= c2 && c2 < PUNCT_LIMIT) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.h index 4bac79740..d4caddcb6 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.h @@ -188,7 +188,7 @@ class U_I18N_API CollationFastLatin /* all static */ { */ static const int32_t BAIL_OUT_RESULT = -2; - static inline int32_t getCharIndex(UChar c) { + static inline int32_t getCharIndex(char16_t c) { if(c <= LATIN_MAX) { return c; } else if(PUNCT_START <= c && c < PUNCT_LIMIT) { @@ -211,8 +211,8 @@ class U_I18N_API CollationFastLatin /* all static */ { uint16_t *primaries, int32_t capacity); static int32_t compareUTF16(const uint16_t *table, const uint16_t *primaries, int32_t options, - const UChar *left, int32_t leftLength, - const UChar *right, int32_t rightLength); + const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength); static int32_t compareUTF8(const uint16_t *table, const uint16_t *primaries, int32_t options, const uint8_t *left, int32_t leftLength, @@ -226,7 +226,7 @@ class U_I18N_API CollationFastLatin /* all static */ { const uint8_t *s8, int32_t &sIndex); static uint32_t nextPair(const uint16_t *table, UChar32 c, uint32_t ce, - const UChar *s16, const uint8_t *s8, int32_t &sIndex, int32_t &sLength); + const char16_t *s16, const uint8_t *s8, int32_t &sIndex, int32_t &sLength); static inline uint32_t getPrimaries(uint32_t variableTop, uint32_t pair) { uint32_t ce = pair & 0xffff; @@ -249,7 +249,7 @@ class U_I18N_API CollationFastLatin /* all static */ { static uint32_t getQuaternaries(uint32_t variableTop, uint32_t pair); private: - CollationFastLatin(); // no constructor + CollationFastLatin() = delete; // no constructor }; /* diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatinbuilder.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatinbuilder.cpp index e5ba2f0e2..b1fd3af70 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatinbuilder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatinbuilder.cpp @@ -89,9 +89,9 @@ binarySearch(const int64_t list[], int32_t limit, int64_t ce) { CollationFastLatinBuilder::CollationFastLatinBuilder(UErrorCode &errorCode) : ce0(0), ce1(0), contractionCEs(errorCode), uniqueCEs(errorCode), - miniCEs(NULL), + miniCEs(nullptr), firstDigitPrimary(0), firstLatinPrimary(0), lastLatinPrimary(0), - firstShortPrimary(0), shortPrimaryOverflow(FALSE), + firstShortPrimary(0), shortPrimaryOverflow(false), headerLength(0) { } @@ -101,24 +101,24 @@ CollationFastLatinBuilder::~CollationFastLatinBuilder() { UBool CollationFastLatinBuilder::forData(const CollationData &data, UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } if(!result.isEmpty()) { // This builder is not reusable. errorCode = U_INVALID_STATE_ERROR; - return FALSE; + return false; } - if(!loadGroups(data, errorCode)) { return FALSE; } + if(!loadGroups(data, errorCode)) { return false; } // Fast handling of digits. firstShortPrimary = firstDigitPrimary; getCEs(data, errorCode); - if(!encodeUniqueCEs(errorCode)) { return FALSE; } + if(!encodeUniqueCEs(errorCode)) { return false; } if(shortPrimaryOverflow) { // Give digits long mini primaries, // so that there are more short primaries for letters. firstShortPrimary = firstLatinPrimary; resetCEs(); getCEs(data, errorCode); - if(!encodeUniqueCEs(errorCode)) { return FALSE; } + if(!encodeUniqueCEs(errorCode)) { return false; } } // Note: If we still have a short-primary overflow but not a long-primary overflow, // then we could calculate how many more long primaries would fit, @@ -126,7 +126,7 @@ CollationFastLatinBuilder::forData(const CollationData &data, UErrorCode &errorC // and try again. // However, this might only benefit the en_US_POSIX tailoring, // and it is simpler to suppress building fast Latin data for it in genrb, - // or by returning FALSE here if shortPrimaryOverflow. + // or by returning false here if shortPrimaryOverflow. UBool ok = !shortPrimaryOverflow && encodeCharCEs(errorCode) && encodeContractions(errorCode); @@ -137,19 +137,19 @@ CollationFastLatinBuilder::forData(const CollationData &data, UErrorCode &errorC UBool CollationFastLatinBuilder::loadGroups(const CollationData &data, UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } headerLength = 1 + NUM_SPECIAL_GROUPS; uint32_t r0 = (CollationFastLatin::VERSION << 8) | headerLength; - result.append((UChar)r0); + result.append((char16_t)r0); // The first few reordering groups should be special groups // (space, punct, ..., digit) followed by Latn, then Grek and other scripts. for(int32_t i = 0; i < NUM_SPECIAL_GROUPS; ++i) { lastSpecialPrimaries[i] = data.getLastPrimaryForGroup(UCOL_REORDER_CODE_FIRST + i); if(lastSpecialPrimaries[i] == 0) { // missing data - return FALSE; + return false; } - result.append((UChar)0); // reserve a slot for this group + result.append((char16_t)0); // reserve a slot for this group } firstDigitPrimary = data.getFirstPrimaryForGroup(UCOL_REORDER_CODE_DIGIT); @@ -157,9 +157,9 @@ CollationFastLatinBuilder::loadGroups(const CollationData &data, UErrorCode &err lastLatinPrimary = data.getLastPrimaryForGroup(USCRIPT_LATIN); if(firstDigitPrimary == 0 || firstLatinPrimary == 0) { // missing data - return FALSE; + return false; } - return TRUE; + return true; } UBool @@ -169,7 +169,7 @@ CollationFastLatinBuilder::inSameGroup(uint32_t p, uint32_t q) const { if(p >= firstShortPrimary) { return q >= firstShortPrimary; } else if(q >= firstShortPrimary) { - return FALSE; + return false; } // Both or neither must be potentially-variable, // so that we can test only one and determine if both are variable. @@ -177,7 +177,7 @@ CollationFastLatinBuilder::inSameGroup(uint32_t p, uint32_t q) const { if(p > lastVariablePrimary) { return q > lastVariablePrimary; } else if(q > lastVariablePrimary) { - return FALSE; + return false; } // Both will be encoded with long mini primaries. // They must be in the same special reordering group, @@ -188,7 +188,7 @@ CollationFastLatinBuilder::inSameGroup(uint32_t p, uint32_t q) const { if(p <= lastPrimary) { return q <= lastPrimary; } else if(q <= lastPrimary) { - return FALSE; + return false; } } } @@ -197,7 +197,7 @@ void CollationFastLatinBuilder::resetCEs() { contractionCEs.removeAllElements(); uniqueCEs.removeAllElements(); - shortPrimaryOverflow = FALSE; + shortPrimaryOverflow = false; result.truncate(headerLength); } @@ -205,7 +205,7 @@ void CollationFastLatinBuilder::getCEs(const CollationData &data, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } int32_t i = 0; - for(UChar c = 0;; ++i, ++c) { + for(char16_t c = 0;; ++i, ++c) { if(c == CollationFastLatin::LATIN_LIMIT) { c = CollationFastLatin::PUNCT_START; } else if(c == CollationFastLatin::PUNCT_LIMIT) { @@ -245,7 +245,7 @@ CollationFastLatinBuilder::getCEs(const CollationData &data, UErrorCode &errorCo UBool CollationFastLatinBuilder::getCEsFromCE32(const CollationData &data, UChar32 c, uint32_t ce32, UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } ce32 = data.getFinalCE32(ce32); ce1 = 0; if(Collation::isSimpleOrLongCE32(ce32)) { @@ -266,7 +266,7 @@ CollationFastLatinBuilder::getCEsFromCE32(const CollationData &data, UChar32 c, } break; } else { - return FALSE; + return false; } } case Collation::EXPANSION_TAG: { @@ -279,7 +279,7 @@ CollationFastLatinBuilder::getCEsFromCE32(const CollationData &data, UChar32 c, } break; } else { - return FALSE; + return false; } } // Note: We could support PREFIX_TAG (assert c>=0) @@ -295,24 +295,24 @@ CollationFastLatinBuilder::getCEsFromCE32(const CollationData &data, UChar32 c, ce0 = data.getCEFromOffsetCE32(c, ce32); break; default: - return FALSE; + return false; } } // A mapping can be completely ignorable. if(ce0 == 0) { return ce1 == 0; } // We do not support an ignorable ce0 unless it is completely ignorable. uint32_t p0 = (uint32_t)(ce0 >> 32); - if(p0 == 0) { return FALSE; } + if(p0 == 0) { return false; } // We only support primaries up to the Latin script. - if(p0 > lastLatinPrimary) { return FALSE; } + if(p0 > lastLatinPrimary) { return false; } // We support non-common secondary and case weights only together with short primaries. uint32_t lower32_0 = (uint32_t)ce0; if(p0 < firstShortPrimary) { uint32_t sc0 = lower32_0 & Collation::SECONDARY_AND_CASE_MASK; - if(sc0 != Collation::COMMON_SECONDARY_CE) { return FALSE; } + if(sc0 != Collation::COMMON_SECONDARY_CE) { return false; } } // No below-common tertiary weights. - if((lower32_0 & Collation::ONLY_TERTIARY_MASK) < Collation::COMMON_WEIGHT16) { return FALSE; } + if((lower32_0 & Collation::ONLY_TERTIARY_MASK) < Collation::COMMON_WEIGHT16) { return false; } if(ce1 != 0) { // Both primaries must be in the same group, // or both must get short mini primaries, @@ -320,29 +320,29 @@ CollationFastLatinBuilder::getCEsFromCE32(const CollationData &data, UChar32 c, // This is so that we can test the first primary and use the same mask for both, // and determine for both whether they are variable. uint32_t p1 = (uint32_t)(ce1 >> 32); - if(p1 == 0 ? p0 < firstShortPrimary : !inSameGroup(p0, p1)) { return FALSE; } + if(p1 == 0 ? p0 < firstShortPrimary : !inSameGroup(p0, p1)) { return false; } uint32_t lower32_1 = (uint32_t)ce1; // No tertiary CEs. - if((lower32_1 >> 16) == 0) { return FALSE; } + if((lower32_1 >> 16) == 0) { return false; } // We support non-common secondary and case weights // only for secondary CEs or together with short primaries. if(p1 != 0 && p1 < firstShortPrimary) { uint32_t sc1 = lower32_1 & Collation::SECONDARY_AND_CASE_MASK; - if(sc1 != Collation::COMMON_SECONDARY_CE) { return FALSE; } + if(sc1 != Collation::COMMON_SECONDARY_CE) { return false; } } // No below-common tertiary weights. - if((lower32_1 & Collation::ONLY_TERTIARY_MASK) < Collation::COMMON_WEIGHT16) { return FALSE; } + if((lower32_1 & Collation::ONLY_TERTIARY_MASK) < Collation::COMMON_WEIGHT16) { return false; } } // No quaternary weights. - if(((ce0 | ce1) & Collation::QUATERNARY_MASK) != 0) { return FALSE; } - return TRUE; + if(((ce0 | ce1) & Collation::QUATERNARY_MASK) != 0) { return false; } + return true; } UBool CollationFastLatinBuilder::getCEsFromContractionCE32(const CollationData &data, uint32_t ce32, UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } - const UChar *p = data.contexts + Collation::indexFromCE32(ce32); + if(U_FAILURE(errorCode)) { return false; } + const char16_t *p = data.contexts + Collation::indexFromCE32(ce32); ce32 = CollationData::readCE32(p); // Default if no suffix match. // Since the original ce32 is not a prefix mapping, // the default ce32 must not be another contraction. @@ -357,7 +357,7 @@ CollationFastLatinBuilder::getCEsFromContractionCE32(const CollationData &data, // Handle an encodable contraction unless the next contraction is too long // and starts with the same character. int32_t prevX = -1; - UBool addContraction = FALSE; + UBool addContraction = false; UCharsTrie::Iterator suffixes(p + 2, 0, errorCode); while(suffixes.next(errorCode)) { const UnicodeString &suffix = suffixes.getString(); @@ -367,7 +367,7 @@ CollationFastLatinBuilder::getCEsFromContractionCE32(const CollationData &data, if(addContraction) { // Bail out for all contractions starting with this character. addContractionEntry(x, Collation::NO_CE, 0, errorCode); - addContraction = FALSE; + addContraction = false; } continue; } @@ -376,17 +376,17 @@ CollationFastLatinBuilder::getCEsFromContractionCE32(const CollationData &data, } ce32 = (uint32_t)suffixes.getValue(); if(suffix.length() == 1 && getCEsFromCE32(data, U_SENTINEL, ce32, errorCode)) { - addContraction = TRUE; + addContraction = true; } else { addContractionEntry(x, Collation::NO_CE, 0, errorCode); - addContraction = FALSE; + addContraction = false; } prevX = x; } if(addContraction) { addContractionEntry(prevX, ce0, ce1, errorCode); } - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } // Note: There might not be any fast Latin contractions, but // we need to enter contraction handling anyway so that we can bail out // when there is a non-fast-Latin character following. @@ -394,7 +394,7 @@ CollationFastLatinBuilder::getCEsFromContractionCE32(const CollationData &data, // following umlaut and bail out, rather than return the difference of Y vs. u. ce0 = ((int64_t)Collation::NO_CE_PRIMARY << 32) | CONTRACTION_FLAG | contractionIndex; ce1 = 0; - return TRUE; + return true; } void @@ -428,12 +428,12 @@ CollationFastLatinBuilder::getMiniCE(int64_t ce) const { UBool CollationFastLatinBuilder::encodeUniqueCEs(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } uprv_free(miniCEs); miniCEs = (uint16_t *)uprv_malloc(uniqueCEs.size() * 2); - if(miniCEs == NULL) { + if(miniCEs == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } int32_t group = 0; uint32_t lastGroupPrimary = lastSpecialPrimaries[group]; @@ -454,7 +454,7 @@ CollationFastLatinBuilder::encodeUniqueCEs(UErrorCode &errorCode) { U_ASSERT(pri <= CollationFastLatin::MAX_LONG); // Set the group's header entry to the // last "long primary" in or before the group. - result.setCharAt(1 + group, (UChar)pri); + result.setCharAt(1 + group, (char16_t)pri); if(++group < NUM_SPECIAL_GROUPS) { lastGroupPrimary = lastSpecialPrimaries[group]; } else { @@ -484,7 +484,7 @@ CollationFastLatinBuilder::encodeUniqueCEs(UErrorCode &errorCode) { #if DEBUG_COLLATION_FAST_LATIN_BUILDER printf("short-primary overflow for %08x\n", p); #endif - shortPrimaryOverflow = TRUE; + shortPrimaryOverflow = true; miniCEs[i] = CollationFastLatin::BAIL_OUT; continue; } @@ -563,10 +563,10 @@ CollationFastLatinBuilder::encodeUniqueCEs(UErrorCode &errorCode) { UBool CollationFastLatinBuilder::encodeCharCEs(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } int32_t miniCEsStart = result.length(); for(int32_t i = 0; i < CollationFastLatin::NUM_FAST_CHARS; ++i) { - result.append((UChar)0); // initialize to completely ignorable + result.append((char16_t)0); // initialize to completely ignorable } int32_t indexBase = result.length(); for(int32_t i = 0; i < CollationFastLatin::NUM_FAST_CHARS; ++i) { @@ -581,11 +581,11 @@ CollationFastLatinBuilder::encodeCharCEs(UErrorCode &errorCode) { if(expansionIndex > (int32_t)CollationFastLatin::INDEX_MASK) { miniCE = CollationFastLatin::BAIL_OUT; } else { - result.append((UChar)(miniCE >> 16)).append((UChar)miniCE); + result.append((char16_t)(miniCE >> 16)).append((char16_t)miniCE); miniCE = CollationFastLatin::EXPANSION | expansionIndex; } } - result.setCharAt(miniCEsStart + i, (UChar)miniCE); + result.setCharAt(miniCEsStart + i, (char16_t)miniCE); } return U_SUCCESS(errorCode); } @@ -594,7 +594,7 @@ UBool CollationFastLatinBuilder::encodeContractions(UErrorCode &errorCode) { // We encode all contraction lists so that the first word of a list // terminates the previous list, and we only need one additional terminator at the end. - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } int32_t indexBase = headerLength + CollationFastLatin::NUM_FAST_CHARS; int32_t firstContractionIndex = result.length(); for(int32_t i = 0; i < CollationFastLatin::NUM_FAST_CHARS; ++i) { @@ -605,7 +605,7 @@ CollationFastLatinBuilder::encodeContractions(UErrorCode &errorCode) { result.setCharAt(headerLength + i, CollationFastLatin::BAIL_OUT); continue; } - UBool firstTriple = TRUE; + UBool firstTriple = true; for(int32_t index = (int32_t)ce & 0x7fffffff;; index += 3) { int32_t x = static_cast(contractionCEs.elementAti(index)); if((uint32_t)x == CollationFastLatin::CONTR_CHAR_MASK && !firstTriple) { break; } @@ -613,29 +613,29 @@ CollationFastLatinBuilder::encodeContractions(UErrorCode &errorCode) { int64_t cce1 = contractionCEs.elementAti(index + 2); uint32_t miniCE = encodeTwoCEs(cce0, cce1); if(miniCE == CollationFastLatin::BAIL_OUT) { - result.append((UChar)(x | (1 << CollationFastLatin::CONTR_LENGTH_SHIFT))); + result.append((char16_t)(x | (1 << CollationFastLatin::CONTR_LENGTH_SHIFT))); } else if(miniCE <= 0xffff) { - result.append((UChar)(x | (2 << CollationFastLatin::CONTR_LENGTH_SHIFT))); - result.append((UChar)miniCE); + result.append((char16_t)(x | (2 << CollationFastLatin::CONTR_LENGTH_SHIFT))); + result.append((char16_t)miniCE); } else { - result.append((UChar)(x | (3 << CollationFastLatin::CONTR_LENGTH_SHIFT))); - result.append((UChar)(miniCE >> 16)).append((UChar)miniCE); + result.append((char16_t)(x | (3 << CollationFastLatin::CONTR_LENGTH_SHIFT))); + result.append((char16_t)(miniCE >> 16)).append((char16_t)miniCE); } - firstTriple = FALSE; + firstTriple = false; } // Note: There is a chance that this new contraction list is the same as a previous one, // and if so, then we could truncate the result and reuse the other list. // However, that seems unlikely. result.setCharAt(headerLength + i, - (UChar)(CollationFastLatin::CONTRACTION | contractionIndex)); + (char16_t)(CollationFastLatin::CONTRACTION | contractionIndex)); } if(result.length() > firstContractionIndex) { // Terminate the last contraction list. - result.append((UChar)CollationFastLatin::CONTR_CHAR_MASK); + result.append((char16_t)CollationFastLatin::CONTR_CHAR_MASK); } if(result.isBogus()) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } #if DEBUG_COLLATION_FAST_LATIN_BUILDER printf("** fast Latin %d * 2 = %d bytes\n", result.length(), result.length() * 2); @@ -663,7 +663,7 @@ CollationFastLatinBuilder::encodeContractions(UErrorCode &errorCode) { } puts(""); #endif - return TRUE; + return true; } uint32_t diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.cpp index 9f73ff389..e1f1d0330 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.cpp @@ -1,6 +1,5 @@ -// © 2016 and later: Unicode, Inc. and others. +// Copyright (C) 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -// // Copyright (C) 1999-2016, International Business Machines // Corporation and others. All Rights Reserved. // @@ -8,7 +7,6 @@ // // machine-generated by: icu/tools/unicode/c/genuca/genuca.cpp - #include "unicode/utypes.h" #if !UCONFIG_NO_COLLATION @@ -22,27 +20,27 @@ const uint8_t CollationFCD::lcccIndex[2048]={ 0,0,0,0,0,0,0,0,1,1,2,3,0,0,0,0, 0,0,0,0,4,0,0,0,0,0,0,0,5,6,7,0, 8,0,9,0xa,0,0,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0x10, -0x11,0x12,0x13,0,0,0,0x14,0x15,0,0x16,0x17,0,0,0x16,0x18,0x19, -0,0x16,0x18,0,0,0x16,0x18,0,0,0x16,0x18,0,0,0,0x18,0, -0,0,0x1a,0,0,0x16,0x18,0,0,0x1b,0x18,0,0,0,0x1c,0, -0,0x1d,0x1e,0,0,0x1d,0x1e,0,0x1f,0x20,0,0x21,0x22,0,0x23,0, -0,0x24,0,0,0x18,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0x25,0,0,0,0,0, +0x11,0x12,0x13,0,0x14,0,0x15,0x16,0,0x17,0x18,0,0,0x17,0x19,0x1a, +0,0x17,0x19,0,0,0x17,0x19,0,0,0x17,0x19,0,0,0,0x19,0, +0,0x17,0x1b,0,0,0x17,0x19,0,0,0x1c,0x19,0,0,0,0x1d,0, +0,0x1e,0x1f,0,0,0x1e,0x1f,0,0x20,0x21,0,0x22,0x23,0,0x24,0, +0,0x25,0,0,0x19,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0x26,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x26,0x26,0,0,0,0,0x27,0, -0,0,0,0,0,0x28,0,0,0,0x13,0,0,0,0,0,0, -0x29,0,0,0x2a,0,0x2b,0x2c,0,0,0x26,0x2d,0x2e,0,0x2f,0,0x30, -0,0x31,0,0,0,0,0x32,0x33,0,0,0,0,0,0,1,0x34, +0,0,0,0,0,0,0,0,0x27,0x28,0,0,0,0,0x29,0, +0,0,0,0,0,0x2a,0,0,0,0x13,0,0,0,0,0,0, +0x2b,0,0,0x2c,0,0x2d,0x2e,0,0,0x28,0x2f,0x30,0,0x31,0,0x32, +0,0x33,0,0,0,0,0x34,0x35,0,0,0,0,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0x35,0x36,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0x36,0x37,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0x37,0,0,0,0x38,0,0,0,1, +0,0,0,0,0,0,0,0x38,0,0,0,0x39,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0x39,0,0,0x3a,0,0,0,0,0,0,0,0,0,0,0, +0,0x3a,0,0,0x3b,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -101,9 +99,9 @@ const uint8_t CollationFCD::lcccIndex[2048]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0x3b,0x3c,0,0,0x3d,0,0,0,0,0,0,0,0, -0x23,0x3e,0,0,0,0,0x2d,0x3f,0,0x40,0x41,0,0,0x41,0x2c,0, -0,0,0,0,0,0x42,0x43,0x44,0,0,0,0,0,0,0,0x18, +0,0,0,0x3c,0x3d,0,0,0x3e,0,0,0,0,0,0,0,0, +0x24,0x3f,0,0,0,0,0x2f,0x40,0,0x41,0x42,0,0,0x42,0x43,0, +0,0,0,0,0,0x44,0x45,0x46,0,0,0,0,0,0,0,0x19, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -126,7 +124,7 @@ const uint8_t CollationFCD::lcccIndex[2048]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x45,0x46,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x47,0x48,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -143,17 +141,17 @@ const uint8_t CollationFCD::lcccIndex[2048]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x19,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x1a,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; -const uint32_t CollationFCD::lcccBits[71]={ +const uint32_t CollationFCD::lcccBits[73]={ 0,0xffffffff,0xffff7fff,0xffff,0xf8,0xfffe0000,0xbfffffff,0xb6,0x7ff0000,0xfffff800,0x10000,0x9fc00000,0x3d9f,0x20000,0xffff0000,0x7ff, -0x200ff800,0xfbc00000,0x3eef,0xe000000,0xfff80000,0xfffffffb,0x10000000,0x1e2000,0x2000,0x40000000,0x602000,0x18000000,0x400,0x7000000,0xf00,0x3000000, -0x2a00000,0x3c3e0000,0xdf,0x40,0x6800000,0xe0000000,0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,1,0x10,0xff800,0xc00, -0xc0040,0x800000,0xfff70000,0x31021fd,0xfbffffff,0x1fff0000,0x1ffe2,0x38000,0x80000000,0xfc00,0x6000000,0x3ff08000,0xc0000000,0x30000,0x1000,0x3ffff, -0x3800,0x80000,0xc19d0000,2,0x400000,0xc0000fd,0x5108000 +0x200ff800,0xfbc00000,0x3eef,0xe000000,0xff000000,0xfffffc00,0xfffffffb,0x10000000,0x1e2000,0x2000,0x40000000,0x602000,0x18000000,0x400,0x7000000,0xf00, +0x3000000,0x2a00000,0x3c3e0000,0xdf,0x40,0x6800000,0xe0000000,0x300000,0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,0x7fff,0x10, +0xff800,0xc00,0xc0040,0x800000,0xfff70000,0x31021fd,0x1fff0000,0x1ffe2,0x38000,0x80000000,0xfc00,0x6000000,0x3ff08000,0xc0000000,0x30000,0x1000, +0x3ffff,0x3800,0x80000,1,0xc19d0000,2,0x400000,0xc0000fd,0x7108000 }; const uint8_t CollationFCD::tcccIndex[2048]={ @@ -161,27 +159,27 @@ const uint8_t CollationFCD::tcccIndex[2048]={ 0xb,0xc,0,0,0,0,0,0,1,1,0xd,0xe,0xf,0x10,0x11,0, 0x12,0x13,0x14,0x15,0x16,0,0x17,0x18,0,0,0,0,0x19,0x1a,0x1b,0, 0x1c,0x1d,0x1e,0x1f,0,0,0x20,0x21,0x22,0x23,0x24,0,0,0,0,0x25, -0x26,0x27,0x28,0,0,0,0x29,0x2a,0,0x2b,0x2c,0,0,0x2d,0x2e,0x2f, -0,0x30,0x31,0,0,0x2d,0x32,0,0,0x2d,0x33,0,0,0,0x32,0, -0,0,0x34,0,0,0x2d,0x32,0,0,0x35,0x32,0,0,0,0x36,0, -0,0x37,0x38,0,0,0x37,0x38,0,0x39,0x3a,0,0x3b,0x3c,0,0x3d,0, -0,0x3e,0,0,0x32,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0x3f,0,0,0,0,0, +0x26,0x27,0x28,0,0x29,0,0x2a,0x2b,0,0x2c,0x2d,0,0,0x2e,0x2f,0x30, +0,0x31,0x32,0,0,0x2e,0x33,0,0,0x2e,0x34,0,0,0,0x33,0, +0,0x2e,0x35,0,0,0x2e,0x33,0,0,0x36,0x33,0,0,0,0x37,0, +0,0x38,0x39,0,0,0x38,0x39,0,0x3a,0x3b,0,0x3c,0x3d,0,0x3e,0, +0,0x3f,0,0,0x33,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0x40,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x40,0x40,0,0,0,0,0x41,0, -0,0,0,0,0,0x42,0,0,0,0x28,0,0,0,0,0,0, -0x43,0,0,0x44,0,0x45,0x46,0,0,0x40,0x47,0x48,0,0x49,0,0x4a, -0,0x4b,0,0,0,0,0x4c,0x4d,0,0,0,0,0,0,1,0x4e, -1,1,1,1,0x4f,1,1,0x50,0x51,1,0x52,0x53,1,0x54,0x55,0x56, -0,0,0,0,0,0,0x57,0x58,0,0x59,0,0,0x5a,0x5b,0x5c,0, -0x5d,0x5e,0x5f,0x60,0x61,0x62,0,0x63,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x41,0x42,0,0,0,0,0x43,0, +0,0,0,0,0,0x44,0,0,0,0x28,0,0,0,0,0,0, +0x45,0,0,0x46,0,0x47,0x48,0,0,0x42,0x49,0x4a,0,0x4b,0,0x4c, +0,0x4d,0,0,0,0,0x4e,0x4f,0,0,0,0,0,0,1,1, +1,1,1,1,0x50,1,1,0x51,0x52,1,0x53,0x54,1,0x55,0x56,0x57, +0,0,0,0,0,0,0x58,0x59,0,0x5a,0,0,0x5b,0x5c,0x5d,0, +0x5e,0x5f,0x60,0x61,0x62,0x63,0,0x64,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0x2d,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0x64,0,0,0,0x65,0,0,0,1, +0,0,0,0,0,0,0x2e,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0x65,0,0,0,0x66,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0x66,0x67,0x68,0x69,0x67,0x68,0x6a,0,0,0,0,0,0,0,0, +0,0x67,0x68,0x69,0x6a,0x68,0x69,0x6b,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -240,9 +238,9 @@ const uint8_t CollationFCD::tcccIndex[2048]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0x6b,0x6c,0,0,0x6d,0,0,0,0,0,0,0,0, -0x3d,0x6e,0,0,0,0,0x47,0x6f,0,0x70,0x71,0,0,0x71,0x46,0, -0,0,0,0,0,0x72,0x73,0x74,0,0,0,0,0,0,0,0x32, +0,0,0,0x6c,0x6d,0,0,0x6e,0,0,0,0,0,0,0,0, +0x3e,0x6f,0,0,0,0,0x49,0x70,0,0x71,0x72,0,0,0x72,0x73,0, +0,0,0,0,0,0x74,0x75,0x76,0,0,0,0,0,0,0,0x33, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -265,7 +263,7 @@ const uint8_t CollationFCD::tcccIndex[2048]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0x75,0x76,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0x77,0x78,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -282,20 +280,20 @@ const uint8_t CollationFCD::tcccIndex[2048]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0x3f,0x77,0x78,0,0,0,0,0, +0,0,0,0,0,0,0,0,0x40,0x79,0x7a,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xe,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; -const uint32_t CollationFCD::tcccBits[121]={ +const uint32_t CollationFCD::tcccBits[123]={ 0,0xffffffff,0x3e7effbf,0xbe7effbf,0xfffcffff,0x7ef1ff3f,0xfff3f1f8,0x7fffff3f,0x18003,0xdfffe000,0xff31ffcf,0xcfffffff,0xfffc0,0xffff7fff,0xffff,0x1d760, 0x1fc00,0x187c00,0x200708b,0x2000000,0x708b0000,0xc00000,0xf8,0xfccf0006,0x33ffcfc,0xfffe0000,0xbfffffff,0xb6,0x7ff0000,0x7c,0xfffff800,0x10000, -0x9fc80005,0x3d9f,0x20000,0xffff0000,0x7ff,0x200ff800,0xfbc00000,0x3eef,0xe000000,0xfff80000,0xfffffffb,0x10120200,0xff1e2000,0x10000000,0xb0002000,0x40000000, -0x10480000,0x4e002000,0x2000,0x30002000,0x602100,0x18000000,0x24000400,0x7000000,0xf00,0x3000000,0x2a00000,0x3d7e0000,0xdf,0x40,0x6800000,0xe0000000, -0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,1,0x10,0xff800,0xc00,0xc0040,0x800000,0xfff70000,0x31021fd,0xfbffffff,0xbffffff, -0x3ffffff,0x3f3fffff,0xaaff3f3f,0x3fffffff,0x1fdfffff,0xefcfffde,0x1fdc7fff,0x1fff0000,0x1ffe2,0x800,0xc000000,0x4000,0xe000,0x1210,0x50,0x292, -0x333e005,0x333,0xf000,0x3c0f,0x38000,0x80000000,0xfc00,0x55555000,0x36db02a5,0x46100000,0x47900000,0x3ff08000,0xc0000000,0x30000,0x1000,0x3ffff, -0x3800,0x80000,0xc19d0000,2,0x400000,0xc0000fd,0x5108000,0x5f7ffc00,0x7fdb +0x9fc80005,0x3d9f,0x20000,0xffff0000,0x7ff,0x200ff800,0xfbc00000,0x3eef,0xe000000,0xff000000,0xfffffc00,0xfffffffb,0x10120200,0xff1e2000,0x10000000,0xb0002000, +0x40000000,0x10480000,0x4e002000,0x2000,0x30002000,0x602100,0x18000000,0x24000400,0x7000000,0xf00,0x3000000,0x2a00000,0x3d7e0000,0xdf,0x40,0x6800000, +0xe0000000,0x300000,0x100000,0x20040000,0x200,0x1800000,0x9fe00001,0xbfff0000,0x7fff,0x10,0xff800,0xc00,0xc0040,0x800000,0xfff70000,0x31021fd, +0xbffffff,0x3ffffff,0x3f3fffff,0xaaff3f3f,0x3fffffff,0x1fdfffff,0xefcfffde,0x1fdc7fff,0x1fff0000,0x1ffe2,0x800,0xc000000,0x4000,0xe000,0x1210,0x50, +0x292,0x333e005,0x333,0xf000,0x3c0f,0x38000,0x80000000,0xfc00,0x55555000,0x36db02a5,0x46100000,0x47900000,0x3ff08000,0xc0000000,0x30000,0x1000, +0x3ffff,0x3800,0x80000,1,0xc19d0000,2,0x400000,0xc0000fd,0x7108000,0x5f7ffc00,0x7fdb }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.h index ec7167d76..9620452b9 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.h @@ -84,7 +84,7 @@ class U_I18N_API CollationFCD { // Handles all of Unicode 0..10FFFF. // c can be negative, e.g., U_SENTINEL. // U+0300 is the first character with lccc!=0. - if(c < 0x300) { return FALSE; } + if(c < 0x300) { return false; } if(c > 0xffff) { c = U16_LEAD(c); } int32_t i; return @@ -101,7 +101,7 @@ class U_I18N_API CollationFCD { * This is a fast and imprecise test. * * @param c a code point - * @return TRUE if c is U+0F73, U+0F75 or U+0F81 or one of several other Tibetan characters + * @return true if c is U+0F73, U+0F75 or U+0F81 or one of several other Tibetan characters */ static inline UBool maybeTibetanCompositeVowel(UChar32 c) { return (c & 0x1fff01) == 0xf01; @@ -116,14 +116,14 @@ class U_I18N_API CollationFCD { * They have distinct lccc/tccc combinations: 129/130 or 129/132. * * @param fcd16 the FCD value (lccc/tccc combination) of a code point - * @return TRUE if fcd16 is from U+0F73, U+0F75 or U+0F81 + * @return true if fcd16 is from U+0F73, U+0F75 or U+0F81 */ static inline UBool isFCD16OfTibetanCompositeVowel(uint16_t fcd16) { return fcd16 == 0x8182 || fcd16 == 0x8184; } private: - CollationFCD(); // No instantiation. + CollationFCD() = delete; // No instantiation. static const uint8_t lcccIndex[2048]; static const uint8_t tcccIndex[2048]; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp index 9041710b1..f8c6da22b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp @@ -36,8 +36,8 @@ CollationIterator::CEBuffer::~CEBuffer() {} UBool CollationIterator::CEBuffer::ensureAppendCapacity(int32_t appCap, UErrorCode &errorCode) { int32_t capacity = buffer.getCapacity(); - if((length + appCap) <= capacity) { return TRUE; } - if(U_FAILURE(errorCode)) { return FALSE; } + if((length + appCap) <= capacity) { return true; } + if(U_FAILURE(errorCode)) { return false; } do { if(capacity < 1000) { capacity *= 4; @@ -46,11 +46,11 @@ CollationIterator::CEBuffer::ensureAppendCapacity(int32_t appCap, UErrorCode &er } } while(capacity < (length + appCap)); int64_t *p = buffer.resize(capacity, length); - if(p == NULL) { + if(p == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } - return TRUE; + return true; } // State of combining marks skipped in discontiguous contraction. @@ -149,7 +149,7 @@ CollationIterator::CollationIterator(const CollationIterator &other) trie(other.trie), data(other.data), cesIndex(other.cesIndex), - skipped(NULL), + skipped(nullptr), numCpFwd(other.numCpFwd), isNumeric(other.isNumeric) { UErrorCode errorCode = U_ZERO_ERROR; @@ -180,18 +180,18 @@ CollationIterator::operator==(const CollationIterator &other) const { cesIndex == other.cesIndex && numCpFwd == other.numCpFwd && isNumeric == other.isNumeric)) { - return FALSE; + return false; } for(int32_t i = 0; i < ceBuffer.length; ++i) { - if(ceBuffer.get(i) != other.ceBuffer.get(i)) { return FALSE; } + if(ceBuffer.get(i) != other.ceBuffer.get(i)) { return false; } } - return TRUE; + return true; } void CollationIterator::reset() { cesIndex = ceBuffer.length = 0; - if(skipped != NULL) { skipped->clear(); } + if(skipped != nullptr) { skipped->clear(); } } int32_t @@ -209,19 +209,19 @@ CollationIterator::handleNextCE32(UChar32 &c, UErrorCode &errorCode) { return (c < 0) ? Collation::FALLBACK_CE32 : data->getCE32(c); } -UChar +char16_t CollationIterator::handleGetTrailSurrogate() { return 0; } UBool CollationIterator::foundNULTerminator() { - return FALSE; + return false; } UBool CollationIterator::forbidSurrogateCodePoints() const { - return FALSE; + return false; } uint32_t @@ -239,7 +239,7 @@ int64_t CollationIterator::nextCEFromCE32(const CollationData *d, UChar32 c, uint32_t ce32, UErrorCode &errorCode) { --ceBuffer.length; // Undo ceBuffer.incLength(). - appendCEsFromCE32(d, c, ce32, TRUE, errorCode); + appendCEsFromCE32(d, c, ce32, true, errorCode); if(U_SUCCESS(errorCode)) { return ceBuffer.get(cesIndex++); } else { @@ -303,7 +303,7 @@ CollationIterator::appendCEsFromCE32(const CollationData *d, UChar32 c, uint32_t if(forward) { forwardNumCodePoints(1, errorCode); } break; case Collation::CONTRACTION_TAG: { - const UChar *p = d->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = d->contexts + Collation::indexFromCE32(ce32); uint32_t defaultCE32 = CollationData::readCE32(p); // Default if no suffix match. if(!forward) { // Backward contractions are handled by previousCEUnsafe(). @@ -312,7 +312,7 @@ CollationIterator::appendCEsFromCE32(const CollationData *d, UChar32 c, uint32_t break; } UChar32 nextCp; - if(skipped == NULL && numCpFwd < 0) { + if(skipped == nullptr && numCpFwd < 0) { // Some portion of nextCE32FromContraction() pulled out here as an ASCII fast path, // avoiding the function call and the nextSkippedCodePoint() overhead. nextCp = nextCodePoint(errorCode); @@ -408,7 +408,7 @@ CollationIterator::appendCEsFromCE32(const CollationData *d, UChar32 c, uint32_t case Collation::LEAD_SURROGATE_TAG: { U_ASSERT(forward); // Backward iteration should never see lead surrogate code _unit_ data. U_ASSERT(U16_IS_LEAD(c)); - UChar trail; + char16_t trail; if(U16_IS_TRAIL(trail = handleGetTrailSurrogate())) { c = U16_GET_SUPPLEMENTARY(c, trail); ce32 &= Collation::LEAD_TYPE_MASK; @@ -447,7 +447,7 @@ CollationIterator::appendCEsFromCE32(const CollationData *d, UChar32 c, uint32_t uint32_t CollationIterator::getCE32FromPrefix(const CollationData *d, uint32_t ce32, UErrorCode &errorCode) { - const UChar *p = d->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = d->contexts + Collation::indexFromCE32(ce32); ce32 = CollationData::readCE32(p); // Default if no prefix match. p += 2; // Number of code points read before the original code point. @@ -469,17 +469,17 @@ CollationIterator::getCE32FromPrefix(const CollationData *d, uint32_t ce32, UChar32 CollationIterator::nextSkippedCodePoint(UErrorCode &errorCode) { - if(skipped != NULL && skipped->hasNext()) { return skipped->next(); } + if(skipped != nullptr && skipped->hasNext()) { return skipped->next(); } if(numCpFwd == 0) { return U_SENTINEL; } UChar32 c = nextCodePoint(errorCode); - if(skipped != NULL && !skipped->isEmpty() && c >= 0) { skipped->incBeyond(); } + if(skipped != nullptr && !skipped->isEmpty() && c >= 0) { skipped->incBeyond(); } if(numCpFwd > 0 && c >= 0) { --numCpFwd; } return c; } void CollationIterator::backwardNumSkipped(int32_t n, UErrorCode &errorCode) { - if(skipped != NULL && !skipped->isEmpty()) { + if(skipped != nullptr && !skipped->isEmpty()) { n = skipped->backwardNumCodePoints(n); } backwardNumCodePoints(n, errorCode); @@ -488,7 +488,7 @@ CollationIterator::backwardNumSkipped(int32_t n, UErrorCode &errorCode) { uint32_t CollationIterator::nextCE32FromContraction(const CollationData *d, uint32_t contractionCE32, - const UChar *p, uint32_t ce32, UChar32 c, + const char16_t *p, uint32_t ce32, UChar32 c, UErrorCode &errorCode) { // c: next code point after the original one @@ -501,7 +501,7 @@ CollationIterator::nextCE32FromContraction(const CollationData *d, uint32_t cont // and therefore need not remember the suffixes state from before a mismatch for retrying. // If we are already processing skipped combining marks, then we do track the state. UCharsTrie suffixes(p); - if(skipped != NULL && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); } + if(skipped != nullptr && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); } UStringTrieResult match = suffixes.firstForCodePoint(c); for(;;) { UChar32 nextCp; @@ -510,7 +510,7 @@ CollationIterator::nextCE32FromContraction(const CollationData *d, uint32_t cont if(!USTRINGTRIE_HAS_NEXT(match) || (c = nextSkippedCodePoint(errorCode)) < 0) { return ce32; } - if(skipped != NULL && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); } + if(skipped != nullptr && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); } sinceMatch = 1; } else if(match == USTRINGTRIE_NO_MATCH || (nextCp = nextSkippedCodePoint(errorCode)) < 0) { // No match for c, or partial match (USTRINGTRIE_NO_VALUE) and no further text. @@ -597,10 +597,10 @@ CollationIterator::nextCE32FromDiscontiguousContraction( // We have read and matched (lookAhead-2) code points, // read non-matching c and peeked ahead at nextCp. // Return to the state before the mismatch and continue matching with nextCp. - if(skipped == NULL || skipped->isEmpty()) { - if(skipped == NULL) { + if(skipped == nullptr || skipped->isEmpty()) { + if(skipped == nullptr) { skipped = new SkippedState(); - if(skipped == NULL) { + if(skipped == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -661,7 +661,7 @@ CollationIterator::nextCE32FromDiscontiguousContraction( // and then from the combining marks that we skipped before the match. c = U_SENTINEL; for(;;) { - appendCEsFromCE32(d, c, ce32, TRUE, errorCode); + appendCEsFromCE32(d, c, ce32, true, errorCode); // Fetch CE32s for skipped combining marks from the normal data, with fallback, // rather than from the CollationData where we found the contraction. if(!skipped->hasNext()) { break; } @@ -864,7 +864,7 @@ CollationIterator::previousCE(UVector32 &offsets, UErrorCode &errorCode) { if(Collation::isSimpleOrLongCE32(ce32)) { return Collation::ceFromCE32(ce32); } - appendCEsFromCE32(d, c, ce32, FALSE, errorCode); + appendCEsFromCE32(d, c, ce32, false, errorCode); if(U_SUCCESS(errorCode)) { if(ceBuffer.length > 1) { offsets.addElement(getOffset(), errorCode); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.h index cd386e49b..07bdf6198 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.h @@ -76,9 +76,9 @@ class U_I18N_API CollationIterator : public UObject { // (Rather than buffer.getCapacity().) if(length < INITIAL_CAPACITY || ensureAppendCapacity(1, errorCode)) { ++length; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -92,8 +92,8 @@ class U_I18N_API CollationIterator : public UObject { int32_t length; private: - CEBuffer(const CEBuffer &); - void operator=(const CEBuffer &); + CEBuffer(const CEBuffer &) = delete; + void operator=(const CEBuffer &) = delete; MaybeStackArray buffer; }; @@ -103,7 +103,7 @@ class U_I18N_API CollationIterator : public UObject { : trie(d->trie), data(d), cesIndex(0), - skipped(NULL), + skipped(nullptr), numCpFwd(-1), isNumeric(numeric) {} @@ -242,7 +242,7 @@ class U_I18N_API CollationIterator : public UObject { * if a trail surrogate follows the lead surrogate. * Otherwise returns any other code unit and does not advance. */ - virtual UChar handleGetTrailSurrogate(); + virtual char16_t handleGetTrailSurrogate(); /** * Called when handleNextCE32() returns with c==0, to see whether it is a NUL terminator. @@ -251,9 +251,9 @@ class U_I18N_API CollationIterator : public UObject { virtual UBool foundNULTerminator(); /** - * @return FALSE if surrogate code points U+D800..U+DFFF + * @return false if surrogate code points U+D800..U+DFFF * map to their own implicit primary weights (for UTF-16), - * or TRUE if they map to CE(U+FFFD) (for UTF-8) + * or true if they map to CE(U+FFFD) (for UTF-8) */ virtual UBool forbidSurrogateCodePoints() const; @@ -290,7 +290,7 @@ class U_I18N_API CollationIterator : public UObject { uint32_t nextCE32FromContraction( const CollationData *d, uint32_t contractionCE32, - const UChar *p, uint32_t ce32, UChar32 c, + const char16_t *p, uint32_t ce32, UChar32 c, UErrorCode &errorCode); uint32_t nextCE32FromDiscontiguousContraction( diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.cpp index b5c322fb4..c429ac3f8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.cpp @@ -28,7 +28,7 @@ SortKeyByteSink::~SortKeyByteSink() {} void SortKeyByteSink::Append(const char *bytes, int32_t n) { - if (n <= 0 || bytes == NULL) { + if (n <= 0 || bytes == nullptr) { return; } if (ignore_ > 0) { @@ -63,7 +63,7 @@ SortKeyByteSink::GetAppendBuffer(int32_t min_capacity, int32_t *result_capacity) { if (min_capacity < 1 || scratch_capacity < min_capacity) { *result_capacity = 0; - return NULL; + return nullptr; } if (ignore_ > 0) { // Do not write ignored bytes right at the end of the buffer. @@ -90,10 +90,10 @@ namespace { */ class SortKeyLevel : public UMemory { public: - SortKeyLevel() : len(0), ok(TRUE) {} + SortKeyLevel() : len(0), ok(true) {} ~SortKeyLevel() {} - /** @return FALSE if memory allocation failed */ + /** @return false if memory allocation failed */ UBool isOk() const { return ok; } UBool isEmpty() const { return len == 0; } int32_t length() const { return len; } @@ -182,7 +182,7 @@ SortKeyLevel::appendReverseWeight16(uint32_t w) { UBool SortKeyLevel::ensureCapacity(int32_t appendCapacity) { if(!ok) { - return FALSE; + return false; } int32_t newCapacity = 2 * buffer.getCapacity(); int32_t altCapacity = len + 2 * appendCapacity; @@ -192,10 +192,10 @@ UBool SortKeyLevel::ensureCapacity(int32_t appendCapacity) { if (newCapacity < 200) { newCapacity = 200; } - if(buffer.resize(newCapacity, len)==NULL) { - return ok = FALSE; + if(buffer.resize(newCapacity, len)==nullptr) { + return ok = false; } - return TRUE; + return true; } } // namespace @@ -203,7 +203,7 @@ UBool SortKeyLevel::ensureCapacity(int32_t appendCapacity) { CollationKeys::LevelCallback::~LevelCallback() {} UBool -CollationKeys::LevelCallback::needToWrite(Collation::Level /*level*/) { return TRUE; } +CollationKeys::LevelCallback::needToWrite(Collation::Level /*level*/) { return true; } /** * Map from collation strength (UColAttributeValue) @@ -619,7 +619,7 @@ CollationKeys::writeSortKeyUpToQuaternary(CollationIterator &iter, if(U_FAILURE(errorCode)) { return; } // Append the beyond-primary levels. - UBool ok = TRUE; + UBool ok = true; if((levels & Collation::SECONDARY_LEVEL_FLAG) != 0) { if(!callback.needToWrite(Collation::SECONDARY_LEVEL)) { return; } ok &= secondaries.isOk(); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.h index 60d9e50c0..d13315661 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.h @@ -38,7 +38,7 @@ class SortKeyByteSink : public ByteSink { void IgnoreBytes(int32_t numIgnore) { ignore_ = numIgnore; } - virtual void Append(const char *bytes, int32_t n); + virtual void Append(const char *bytes, int32_t n) override; void Append(uint32_t b) { if (ignore_ > 0) { --ignore_; @@ -52,7 +52,7 @@ class SortKeyByteSink : public ByteSink { virtual char *GetAppendBuffer(int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, - int32_t *result_capacity); + int32_t *result_capacity) override; int32_t NumberOfBytesAppended() const { return appended_; } /** @@ -65,15 +65,15 @@ class SortKeyByteSink : public ByteSink { } UBool Overflowed() const { return appended_ > capacity_; } - /** @return FALSE if memory allocation failed */ - UBool IsOk() const { return buffer_ != NULL; } + /** @return false if memory allocation failed */ + UBool IsOk() const { return buffer_ != nullptr; } protected: virtual void AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length) = 0; virtual UBool Resize(int32_t appendCapacity, int32_t length) = 0; void SetNotOk() { - buffer_ = NULL; + buffer_ = nullptr; capacity_ = 0; } @@ -94,8 +94,8 @@ class U_I18N_API CollationKeys /* not : public UObject because all methods are s virtual ~LevelCallback(); /** * @param level The next level about to be written to the ByteSink. - * @return TRUE if the level is to be written - * (the base class implementation always returns TRUE) + * @return true if the level is to be written + * (the base class implementation always returns true) */ virtual UBool needToWrite(Collation::Level level); }; @@ -103,7 +103,7 @@ class U_I18N_API CollationKeys /* not : public UObject because all methods are s /** * Writes the sort key bytes for minLevel up to the iterator data's strength. * Optionally writes the case level. - * Stops writing levels when callback.needToWrite(level) returns FALSE. + * Stops writing levels when callback.needToWrite(level) returns false. * Separates levels with the LEVEL_SEPARATOR_BYTE * but does not write a TERMINATOR_BYTE. */ @@ -116,7 +116,7 @@ class U_I18N_API CollationKeys /* not : public UObject because all methods are s private: friend struct CollationDataReader; - CollationKeys(); // no instantiation + CollationKeys() = delete; // no instantiation // Secondary level: Compress up to 33 common weights as 05..25 or 25..45. static const uint32_t SEC_COMMON_LOW = Collation::COMMON_BYTE; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.cpp index 09f9224cc..99686345f 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.cpp @@ -27,13 +27,14 @@ #include "ucln_in.h" #include "udatamem.h" #include "umutex.h" +#include "umapfile.h" U_NAMESPACE_BEGIN namespace { -static const CollationCacheEntry *rootSingleton = NULL; -static UInitOnce collationroot_initOnce = U_INITONCE_INITIALIZER; +static const CollationCacheEntry *rootSingleton = nullptr; +static UInitOnce initOnce {}; } // namespace @@ -41,30 +42,59 @@ U_CDECL_BEGIN static UBool U_CALLCONV uprv_collation_root_cleanup() { SharedObject::clearPtr(rootSingleton); - collationroot_initOnce.reset(); - return TRUE; + initOnce.reset(); + return true; } U_CDECL_END +UDataMemory* +CollationRoot::loadFromFile(const char* ucadataPath, UErrorCode &errorCode) { + UDataMemory dataMemory; + UDataMemory *rDataMem = nullptr; + if (U_FAILURE(errorCode)) { + return nullptr; + } + if (uprv_mapFile(&dataMemory, ucadataPath, &errorCode)) { + if (dataMemory.pHeader->dataHeader.magic1 == 0xda && + dataMemory.pHeader->dataHeader.magic2 == 0x27 && + CollationDataReader::isAcceptable(nullptr, "icu", "ucadata", &dataMemory.pHeader->info)) { + rDataMem = UDataMemory_createNewInstance(&errorCode); + if (U_FAILURE(errorCode)) { + return nullptr; + } + rDataMem->pHeader = dataMemory.pHeader; + rDataMem->mapAddr = dataMemory.mapAddr; + rDataMem->map = dataMemory.map; + return rDataMem; + } + errorCode = U_INVALID_FORMAT_ERROR; + return nullptr; + } + errorCode = U_MISSING_RESOURCE_ERROR; + return nullptr; +} + void U_CALLCONV -CollationRoot::load(UErrorCode &errorCode) { +CollationRoot::load(const char* ucadataPath, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - LocalPointer t(new CollationTailoring(NULL)); + LocalPointer t(new CollationTailoring(nullptr)); if(t.isNull() || t->isBogus()) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } - t->memory = udata_openChoice(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll", - "icu", "ucadata", - CollationDataReader::isAcceptable, t->version, &errorCode); + t->memory = ucadataPath ? CollationRoot::loadFromFile(ucadataPath, errorCode) : + udata_openChoice(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll", + "icu", "ucadata", + CollationDataReader::isAcceptable, + t->version, &errorCode); if(U_FAILURE(errorCode)) { return; } const uint8_t *inBytes = static_cast(udata_getMemory(t->memory)); - CollationDataReader::read(NULL, inBytes, udata_getLength(t->memory), *t, errorCode); + CollationDataReader::read(nullptr, inBytes, udata_getLength(t->memory), *t, errorCode); if(U_FAILURE(errorCode)) { return; } ucln_i18n_registerCleanup(UCLN_I18N_COLLATION_ROOT, uprv_collation_root_cleanup); CollationCacheEntry *entry = new CollationCacheEntry(Locale::getRoot(), t.getAlias()); - if(entry != NULL) { + if(entry != nullptr) { t.orphan(); // The rootSingleton took ownership of the tailoring. entry->addRef(); rootSingleton = entry; @@ -73,32 +103,38 @@ CollationRoot::load(UErrorCode &errorCode) { const CollationCacheEntry * CollationRoot::getRootCacheEntry(UErrorCode &errorCode) { - umtx_initOnce(collationroot_initOnce, CollationRoot::load, errorCode); - if(U_FAILURE(errorCode)) { return NULL; } + umtx_initOnce(initOnce, CollationRoot::load, static_cast(nullptr), errorCode); + if(U_FAILURE(errorCode)) { return nullptr; } return rootSingleton; } const CollationTailoring * CollationRoot::getRoot(UErrorCode &errorCode) { - umtx_initOnce(collationroot_initOnce, CollationRoot::load, errorCode); - if(U_FAILURE(errorCode)) { return NULL; } + umtx_initOnce(initOnce, CollationRoot::load, static_cast(nullptr), errorCode); + if(U_FAILURE(errorCode)) { return nullptr; } return rootSingleton->tailoring; } const CollationData * CollationRoot::getData(UErrorCode &errorCode) { const CollationTailoring *root = getRoot(errorCode); - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } return root->data; } const CollationSettings * CollationRoot::getSettings(UErrorCode &errorCode) { const CollationTailoring *root = getRoot(errorCode); - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } return root->settings; } +void +CollationRoot::forceLoadFromFile(const char* ucadataPath, UErrorCode &errorCode) { + umtx_initOnce(initOnce, CollationRoot::load, ucadataPath, errorCode); +} + + U_NAMESPACE_END #endif // !UCONFIG_NO_COLLATION diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.h index 8cd3046cd..b203f612b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationroot.h @@ -15,6 +15,7 @@ #define __COLLATIONROOT_H__ #include "unicode/utypes.h" +#include "unicode/udata.h" #if !UCONFIG_NO_COLLATION @@ -34,9 +35,11 @@ class U_I18N_API CollationRoot { // purely static static const CollationTailoring *getRoot(UErrorCode &errorCode); static const CollationData *getData(UErrorCode &errorCode); static const CollationSettings *getSettings(UErrorCode &errorCode); + static void U_EXPORT2 forceLoadFromFile(const char* ucadataPath, UErrorCode &errorCode); private: - static void U_CALLCONV load(UErrorCode &errorCode); + static void U_CALLCONV load(const char* ucadataPath, UErrorCode &errorCode); + static UDataMemory* loadFromFile(const char* ucadataPath, UErrorCode &errorCode); }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.cpp index ade6ecb55..ba740e8d1 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.cpp @@ -24,6 +24,7 @@ #include "unicode/uloc.h" #include "unicode/unistr.h" #include "unicode/utf16.h" +#include "bytesinkutil.h" #include "charstr.h" #include "cmemory.h" #include "collation.h" @@ -34,13 +35,14 @@ #include "cstring.h" #include "patternprops.h" #include "uassert.h" +#include "ulocimp.h" #include "uvectr32.h" U_NAMESPACE_BEGIN namespace { -static const UChar BEFORE[] = { 0x5b, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0 }; // "[before" +static const char16_t BEFORE[] = { 0x5b, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0 }; // "[before" const int32_t BEFORE_LENGTH = 7; } // namespace @@ -58,9 +60,9 @@ CollationRuleParser::Importer::~Importer() {} CollationRuleParser::CollationRuleParser(const CollationData *base, UErrorCode &errorCode) : nfd(*Normalizer2::getNFDInstance(errorCode)), nfc(*Normalizer2::getNFCInstance(errorCode)), - rules(NULL), baseData(base), settings(NULL), - parseError(NULL), errorReason(NULL), - sink(NULL), importer(NULL), + rules(nullptr), baseData(base), settings(nullptr), + parseError(nullptr), errorReason(nullptr), + sink(nullptr), importer(nullptr), ruleIndex(0) { } @@ -75,13 +77,13 @@ CollationRuleParser::parse(const UnicodeString &ruleString, if(U_FAILURE(errorCode)) { return; } settings = &outSettings; parseError = outParseError; - if(parseError != NULL) { + if(parseError != nullptr) { parseError->line = 0; parseError->offset = -1; parseError->preContext[0] = 0; parseError->postContext[0] = 0; } - errorReason = NULL; + errorReason = nullptr; parse(ruleString, errorCode); } @@ -92,7 +94,7 @@ CollationRuleParser::parse(const UnicodeString &ruleString, UErrorCode &errorCod ruleIndex = 0; while(ruleIndex < rules->length()) { - UChar c = rules->charAt(ruleIndex); + char16_t c = rules->charAt(ruleIndex); if(PatternProps::isWhiteSpace(c)) { ++ruleIndex; continue; @@ -128,7 +130,7 @@ CollationRuleParser::parse(const UnicodeString &ruleString, UErrorCode &errorCod void CollationRuleParser::parseRuleChain(UErrorCode &errorCode) { int32_t resetStrength = parseResetAndPosition(errorCode); - UBool isFirstRelation = TRUE; + UBool isFirstRelation = true; for(;;) { int32_t result = parseRelationOperator(errorCode); if(U_FAILURE(errorCode)) { return; } @@ -165,7 +167,7 @@ CollationRuleParser::parseRuleChain(UErrorCode &errorCode) { parseStarredCharacters(strength, i, errorCode); } if(U_FAILURE(errorCode)) { return; } - isFirstRelation = FALSE; + isFirstRelation = false; } } @@ -174,7 +176,7 @@ CollationRuleParser::parseResetAndPosition(UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return UCOL_DEFAULT; } int32_t i = skipWhiteSpace(ruleIndex + 1); int32_t j; - UChar c; + char16_t c; int32_t resetStrength; if(rules->compare(i, BEFORE_LENGTH, BEFORE, 0, BEFORE_LENGTH) == 0 && (j = i + BEFORE_LENGTH) < rules->length() && @@ -211,7 +213,7 @@ CollationRuleParser::parseRelationOperator(UErrorCode &errorCode) { if(ruleIndex >= rules->length()) { return UCOL_DEFAULT; } int32_t strength; int32_t i = ruleIndex; - UChar c = rules->charAt(i++); + char16_t c = rules->charAt(i++); switch(c) { case 0x3c: // '<' if(i < rules->length() && rules->charAt(i) == 0x3c) { // << @@ -262,7 +264,7 @@ CollationRuleParser::parseRelationStrings(int32_t strength, int32_t i, UErrorCod UnicodeString prefix, str, extension; i = parseTailoringString(i, str, errorCode); if(U_FAILURE(errorCode)) { return; } - UChar next = (i < rules->length()) ? rules->charAt(i) : 0; + char16_t next = (i < rules->length()) ? rules->charAt(i) : 0; if(next == 0x7c) { // '|' separates the context prefix from the string. prefix = str; i = parseTailoringString(i + 1, str, errorCode); @@ -377,7 +379,7 @@ CollationRuleParser::parseString(int32_t i, UnicodeString &raw, UErrorCode &erro if(c == 0x27) { // apostrophe if(i < rules->length() && rules->charAt(i) == 0x27) { // Double apostrophe, encodes a single one. - raw.append((UChar)0x27); + raw.append((char16_t)0x27); ++i; continue; } @@ -397,7 +399,7 @@ CollationRuleParser::parseString(int32_t i, UnicodeString &raw, UErrorCode &erro break; } } - raw.append((UChar)c); + raw.append((char16_t)c); } } else if(c == 0x5c) { // backslash if(i == rules->length()) { @@ -417,7 +419,7 @@ CollationRuleParser::parseString(int32_t i, UnicodeString &raw, UErrorCode &erro --i; break; } else { - raw.append((UChar)c); + raw.append((char16_t)c); } } for(int32_t j = 0; j < raw.length();) { @@ -465,16 +467,16 @@ CollationRuleParser::parseSpecialPosition(int32_t i, UnicodeString &str, UErrorC ++j; for(int32_t pos = 0; pos < UPRV_LENGTHOF(positions); ++pos) { if(raw == UnicodeString(positions[pos], -1, US_INV)) { - str.setTo((UChar)POS_LEAD).append((UChar)(POS_BASE + pos)); + str.setTo((char16_t)POS_LEAD).append((char16_t)(POS_BASE + pos)); return j; } } if(raw == UNICODE_STRING_SIMPLE("top")) { - str.setTo((UChar)POS_LEAD).append((UChar)(POS_BASE + LAST_REGULAR)); + str.setTo((char16_t)POS_LEAD).append((char16_t)(POS_BASE + LAST_REGULAR)); return j; } if(raw == UNICODE_STRING_SIMPLE("variable top")) { - str.setTo((UChar)POS_LEAD).append((UChar)(POS_BASE + LAST_VARIABLE)); + str.setTo((char16_t)POS_LEAD).append((char16_t)(POS_BASE + LAST_VARIABLE)); return j; } } @@ -506,14 +508,14 @@ CollationRuleParser::parseSetting(UErrorCode &errorCode) { return; } UnicodeString v; - int32_t valueIndex = raw.lastIndexOf((UChar)0x20); + int32_t valueIndex = raw.lastIndexOf((char16_t)0x20); if(valueIndex >= 0) { v.setTo(raw, valueIndex + 1); raw.truncate(valueIndex); } if(raw == UNICODE_STRING_SIMPLE("strength") && v.length() == 1) { int32_t value = UCOL_DEFAULT; - UChar c = v.charAt(0); + char16_t c = v.charAt(0); if(0x31 <= c && c <= 0x34) { // 1..4 value = UCOL_PRIMARY + (c - 0x31); } else if(c == 0x49) { // 'I' @@ -604,19 +606,20 @@ CollationRuleParser::parseSetting(UErrorCode &errorCode) { lang.appendInvariantChars(v, errorCode); if(errorCode == U_MEMORY_ALLOCATION_ERROR) { return; } // BCP 47 language tag -> ICU locale ID - char localeID[ULOC_FULLNAME_CAPACITY]; + CharString localeID; int32_t parsedLength; - int32_t length = uloc_forLanguageTag(lang.data(), localeID, ULOC_FULLNAME_CAPACITY, - &parsedLength, &errorCode); - if(U_FAILURE(errorCode) || - parsedLength != lang.length() || length >= ULOC_FULLNAME_CAPACITY) { + { + CharStringByteSink sink(&localeID); + ulocimp_forLanguageTag(lang.data(), -1, sink, &parsedLength, &errorCode); + } + if(U_FAILURE(errorCode) || parsedLength != lang.length()) { errorCode = U_ZERO_ERROR; setParseError("expected language tag in [import langTag]", errorCode); return; } // localeID minus all keywords char baseID[ULOC_FULLNAME_CAPACITY]; - length = uloc_getBaseName(localeID, baseID, ULOC_FULLNAME_CAPACITY, &errorCode); + int32_t length = uloc_getBaseName(localeID.data(), baseID, ULOC_FULLNAME_CAPACITY, &errorCode); if(U_FAILURE(errorCode) || length >= ULOC_KEYWORDS_CAPACITY) { errorCode = U_ZERO_ERROR; setParseError("expected language tag in [import langTag]", errorCode); @@ -629,23 +632,25 @@ CollationRuleParser::parseSetting(UErrorCode &errorCode) { uprv_memcpy(baseID, "und", 3); } // @collation=type, or length=0 if not specified - char collationType[ULOC_KEYWORDS_CAPACITY]; - length = uloc_getKeywordValue(localeID, "collation", - collationType, ULOC_KEYWORDS_CAPACITY, - &errorCode); - if(U_FAILURE(errorCode) || length >= ULOC_KEYWORDS_CAPACITY) { + CharString collationType; + { + CharStringByteSink sink(&collationType); + ulocimp_getKeywordValue(localeID.data(), "collation", sink, &errorCode); + } + if(U_FAILURE(errorCode)) { errorCode = U_ZERO_ERROR; setParseError("expected language tag in [import langTag]", errorCode); return; } - if(importer == NULL) { + if(importer == nullptr) { setParseError("[import langTag] is not supported", errorCode); } else { UnicodeString importedRules; - importer->getRules(baseID, length > 0 ? collationType : "standard", + importer->getRules(baseID, + !collationType.isEmpty() ? collationType.data() : "standard", importedRules, errorReason, errorCode); if(U_FAILURE(errorCode)) { - if(errorReason == NULL) { + if(errorReason == nullptr) { errorReason = "[import langTag] failed"; } setErrorContext(); @@ -655,7 +660,7 @@ CollationRuleParser::parseSetting(UErrorCode &errorCode) { int32_t outerRuleIndex = ruleIndex; parse(importedRules, errorCode); if(U_FAILURE(errorCode)) { - if(parseError != NULL) { + if(parseError != nullptr) { parseError->offset = outerRuleIndex; } } @@ -698,7 +703,7 @@ CollationRuleParser::parseReordering(const UnicodeString &raw, UErrorCode &error CharString word; while(i < raw.length()) { ++i; // skip the word-separating space - int32_t limit = raw.indexOf((UChar)0x20, i); + int32_t limit = raw.indexOf((char16_t)0x20, i); if(limit < 0) { limit = raw.length(); } word.clear().appendInvariantChars(raw.tempSubStringBetween(i, limit), errorCode); if(U_FAILURE(errorCode)) { return; } @@ -756,7 +761,7 @@ CollationRuleParser::parseUnicodeSet(int32_t i, UnicodeSet &set, UErrorCode &err setParseError("unbalanced UnicodeSet pattern brackets", errorCode); return j; } - UChar c = rules->charAt(j++); + char16_t c = rules->charAt(j++); if(c == 0x5b) { // '[' ++level; } else if(c == 0x5d) { // ']' @@ -779,12 +784,12 @@ CollationRuleParser::parseUnicodeSet(int32_t i, UnicodeSet &set, UErrorCode &err int32_t CollationRuleParser::readWords(int32_t i, UnicodeString &raw) const { - static const UChar sp = 0x20; + static const char16_t sp = 0x20; raw.remove(); i = skipWhiteSpace(i); for(;;) { if(i >= rules->length()) { return 0; } - UChar c = rules->charAt(i); + char16_t c = rules->charAt(i); if(isSyntaxChar(c) && c != 0x2d && c != 0x5f) { // syntax except -_ if(raw.isEmpty()) { return i; } if(raw.endsWith(&sp, 1)) { // remove trailing space @@ -806,7 +811,7 @@ int32_t CollationRuleParser::skipComment(int32_t i) const { // skip to past the newline while(i < rules->length()) { - UChar c = rules->charAt(i++); + char16_t c = rules->charAt(i++); // LF or FF or CR or NEL or LS or PS if(c == 0xa || c == 0xc || c == 0xd || c == 0x85 || c == 0x2028 || c == 0x2029) { // Unicode Newline Guidelines: "A readline function should stop at NLF, LS, FF, or PS." @@ -825,12 +830,12 @@ CollationRuleParser::setParseError(const char *reason, UErrorCode &errorCode) { // rather than U_PARSE_ERROR; errorCode = U_INVALID_FORMAT_ERROR; errorReason = reason; - if(parseError != NULL) { setErrorContext(); } + if(parseError != nullptr) { setErrorContext(); } } void CollationRuleParser::setErrorContext() { - if(parseError == NULL) { return; } + if(parseError == nullptr) { return; } // Note: This relies on the calling code maintaining the ruleIndex // at a position that is useful for debugging. diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.h index e124881fc..aabdf03f5 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.h @@ -60,13 +60,13 @@ class U_I18N_API CollationRuleParser : public UMemory { * * The second contraction character is POS_BASE + Position. */ - static const UChar POS_LEAD = 0xfffe; + static const char16_t POS_LEAD = 0xfffe; /** * Base for the second character of contractions that encode special reset positions. * Braille characters U+28xx are printable and normalization-inert. * @see POS_LEAD */ - static const UChar POS_BASE = 0x2800; + static const char16_t POS_BASE = 0x2800; class U_I18N_API Sink : public UObject { public: diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.cpp index 09581416a..62e6a5d18 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.cpp @@ -34,7 +34,7 @@ U_CDECL_BEGIN static UBool U_CALLCONV enumTailoredRange(const void *context, UChar32 start, UChar32 end, uint32_t ce32) { if(ce32 == Collation::FALLBACK_CE32) { - return TRUE; // fallback to base, not tailored + return true; // fallback to base, not tailored } TailoredSet *ts = (TailoredSet *)context; return ts->handleCE32(start, end, ce32); @@ -48,8 +48,8 @@ TailoredSet::forData(const CollationData *d, UErrorCode &ec) { errorCode = ec; // Preserve info & warning codes. data = d; baseData = d->base; - U_ASSERT(baseData != NULL); - utrie2_enum(data->trie, NULL, enumTailoredRange, this); + U_ASSERT(baseData != nullptr); + utrie2_enum(data->trie, nullptr, enumTailoredRange, this); ec = errorCode; } @@ -82,30 +82,30 @@ TailoredSet::handleCE32(UChar32 start, UChar32 end, uint32_t ce32) { void TailoredSet::compare(UChar32 c, uint32_t ce32, uint32_t baseCE32) { if(Collation::isPrefixCE32(ce32)) { - const UChar *p = data->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = data->contexts + Collation::indexFromCE32(ce32); ce32 = data->getFinalCE32(CollationData::readCE32(p)); if(Collation::isPrefixCE32(baseCE32)) { - const UChar *q = baseData->contexts + Collation::indexFromCE32(baseCE32); + const char16_t *q = baseData->contexts + Collation::indexFromCE32(baseCE32); baseCE32 = baseData->getFinalCE32(CollationData::readCE32(q)); comparePrefixes(c, p + 2, q + 2); } else { addPrefixes(data, c, p + 2); } } else if(Collation::isPrefixCE32(baseCE32)) { - const UChar *q = baseData->contexts + Collation::indexFromCE32(baseCE32); + const char16_t *q = baseData->contexts + Collation::indexFromCE32(baseCE32); baseCE32 = baseData->getFinalCE32(CollationData::readCE32(q)); addPrefixes(baseData, c, q + 2); } if(Collation::isContractionCE32(ce32)) { - const UChar *p = data->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = data->contexts + Collation::indexFromCE32(ce32); if((ce32 & Collation::CONTRACT_SINGLE_CP_NO_MATCH) != 0) { ce32 = Collation::NO_CE32; } else { ce32 = data->getFinalCE32(CollationData::readCE32(p)); } if(Collation::isContractionCE32(baseCE32)) { - const UChar *q = baseData->contexts + Collation::indexFromCE32(baseCE32); + const char16_t *q = baseData->contexts + Collation::indexFromCE32(baseCE32); if((baseCE32 & Collation::CONTRACT_SINGLE_CP_NO_MATCH) != 0) { baseCE32 = Collation::NO_CE32; } else { @@ -116,7 +116,7 @@ TailoredSet::compare(UChar32 c, uint32_t ce32, uint32_t baseCE32) { addContractions(c, p + 2); } } else if(Collation::isContractionCE32(baseCE32)) { - const UChar *q = baseData->contexts + Collation::indexFromCE32(baseCE32); + const char16_t *q = baseData->contexts + Collation::indexFromCE32(baseCE32); baseCE32 = baseData->getFinalCE32(CollationData::readCE32(q)); addContractions(c, q + 2); } @@ -202,7 +202,7 @@ TailoredSet::compare(UChar32 c, uint32_t ce32, uint32_t baseCE32) { } } } else if(tag == Collation::HANGUL_TAG) { - UChar jamos[3]; + char16_t jamos[3]; int32_t length = Hangul::decompose(c, jamos); if(tailored->contains(jamos[0]) || tailored->contains(jamos[1]) || (length == 3 && tailored->contains(jamos[2]))) { @@ -214,24 +214,24 @@ TailoredSet::compare(UChar32 c, uint32_t ce32, uint32_t baseCE32) { } void -TailoredSet::comparePrefixes(UChar32 c, const UChar *p, const UChar *q) { +TailoredSet::comparePrefixes(UChar32 c, const char16_t *p, const char16_t *q) { // Parallel iteration over prefixes of both tables. UCharsTrie::Iterator prefixes(p, 0, errorCode); UCharsTrie::Iterator basePrefixes(q, 0, errorCode); - const UnicodeString *tp = NULL; // Tailoring prefix. - const UnicodeString *bp = NULL; // Base prefix. + const UnicodeString *tp = nullptr; // Tailoring prefix. + const UnicodeString *bp = nullptr; // Base prefix. // Use a string with a U+FFFF as the limit sentinel. // U+FFFF is untailorable and will not occur in prefixes. - UnicodeString none((UChar)0xffff); + UnicodeString none((char16_t)0xffff); for(;;) { - if(tp == NULL) { + if(tp == nullptr) { if(prefixes.next(errorCode)) { tp = &prefixes.getString(); } else { tp = &none; } } - if(bp == NULL) { + if(bp == nullptr) { if(basePrefixes.next(errorCode)) { bp = &basePrefixes.getString(); } else { @@ -243,42 +243,42 @@ TailoredSet::comparePrefixes(UChar32 c, const UChar *p, const UChar *q) { if(cmp < 0) { // tp occurs in the tailoring but not in the base. addPrefix(data, *tp, c, (uint32_t)prefixes.getValue()); - tp = NULL; + tp = nullptr; } else if(cmp > 0) { // bp occurs in the base but not in the tailoring. addPrefix(baseData, *bp, c, (uint32_t)basePrefixes.getValue()); - bp = NULL; + bp = nullptr; } else { setPrefix(*tp); compare(c, (uint32_t)prefixes.getValue(), (uint32_t)basePrefixes.getValue()); resetPrefix(); - tp = NULL; - bp = NULL; + tp = nullptr; + bp = nullptr; } } } void -TailoredSet::compareContractions(UChar32 c, const UChar *p, const UChar *q) { +TailoredSet::compareContractions(UChar32 c, const char16_t *p, const char16_t *q) { // Parallel iteration over suffixes of both tables. UCharsTrie::Iterator suffixes(p, 0, errorCode); UCharsTrie::Iterator baseSuffixes(q, 0, errorCode); - const UnicodeString *ts = NULL; // Tailoring suffix. - const UnicodeString *bs = NULL; // Base suffix. + const UnicodeString *ts = nullptr; // Tailoring suffix. + const UnicodeString *bs = nullptr; // Base suffix. // Use a string with two U+FFFF as the limit sentinel. // U+FFFF is untailorable and will not occur in contractions except maybe // as a single suffix character for a root-collator boundary contraction. - UnicodeString none((UChar)0xffff); - none.append((UChar)0xffff); + UnicodeString none((char16_t)0xffff); + none.append((char16_t)0xffff); for(;;) { - if(ts == NULL) { + if(ts == nullptr) { if(suffixes.next(errorCode)) { ts = &suffixes.getString(); } else { ts = &none; } } - if(bs == NULL) { + if(bs == nullptr) { if(baseSuffixes.next(errorCode)) { bs = &baseSuffixes.getString(); } else { @@ -290,23 +290,23 @@ TailoredSet::compareContractions(UChar32 c, const UChar *p, const UChar *q) { if(cmp < 0) { // ts occurs in the tailoring but not in the base. addSuffix(c, *ts); - ts = NULL; + ts = nullptr; } else if(cmp > 0) { // bs occurs in the base but not in the tailoring. addSuffix(c, *bs); - bs = NULL; + bs = nullptr; } else { suffix = ts; compare(c, (uint32_t)suffixes.getValue(), (uint32_t)baseSuffixes.getValue()); - suffix = NULL; - ts = NULL; - bs = NULL; + suffix = nullptr; + ts = nullptr; + bs = nullptr; } } } void -TailoredSet::addPrefixes(const CollationData *d, UChar32 c, const UChar *p) { +TailoredSet::addPrefixes(const CollationData *d, UChar32 c, const char16_t *p) { UCharsTrie::Iterator prefixes(p, 0, errorCode); while(prefixes.next(errorCode)) { addPrefix(d, prefixes.getString(), c, (uint32_t)prefixes.getValue()); @@ -318,7 +318,7 @@ TailoredSet::addPrefix(const CollationData *d, const UnicodeString &pfx, UChar32 setPrefix(pfx); ce32 = d->getFinalCE32(ce32); if(Collation::isContractionCE32(ce32)) { - const UChar *p = d->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = d->contexts + Collation::indexFromCE32(ce32); addContractions(c, p + 2); } tailored->add(UnicodeString(unreversedPrefix).append(c)); @@ -326,7 +326,7 @@ TailoredSet::addPrefix(const CollationData *d, const UnicodeString &pfx, UChar32 } void -TailoredSet::addContractions(UChar32 c, const UChar *p) { +TailoredSet::addContractions(UChar32 c, const char16_t *p) { UCharsTrie::Iterator suffixes(p, 0, errorCode); while(suffixes.next(errorCode)) { addSuffix(c, suffixes.getString()); @@ -340,12 +340,12 @@ TailoredSet::addSuffix(UChar32 c, const UnicodeString &sfx) { void TailoredSet::add(UChar32 c) { - if(unreversedPrefix.isEmpty() && suffix == NULL) { + if(unreversedPrefix.isEmpty() && suffix == nullptr) { tailored->add(c); } else { UnicodeString s(unreversedPrefix); s.append(c); - if(suffix != NULL) { + if(suffix != nullptr) { s.append(*suffix); } tailored->add(s); @@ -365,14 +365,14 @@ enumCnERange(const void *context, UChar32 start, UChar32 end, uint32_t ce32) { } else if(cne->checkTailored < 0) { // Collect the set of code points with mappings in the tailoring data. if(ce32 == Collation::FALLBACK_CE32) { - return TRUE; // fallback to base, not tailored + return true; // fallback to base, not tailored } else { cne->tailored.add(start, end); } // checkTailored > 0: Exclude tailored ranges from the base data enumeration. } else if(start == end) { if(cne->tailored.contains(start)) { - return TRUE; + return true; } } else if(cne->tailored.containsSome(start, end)) { cne->ranges.set(start, end).removeAll(cne->tailored); @@ -393,12 +393,12 @@ ContractionsAndExpansions::forData(const CollationData *d, UErrorCode &ec) { if(U_FAILURE(ec)) { return; } errorCode = ec; // Preserve info & warning codes. // Add all from the data, can be tailoring or base. - if(d->base != NULL) { + if(d->base != nullptr) { checkTailored = -1; } data = d; - utrie2_enum(data->trie, NULL, enumCnERange, this); - if(d->base == NULL || U_FAILURE(errorCode)) { + utrie2_enum(data->trie, nullptr, enumCnERange, this); + if(d->base == nullptr || U_FAILURE(errorCode)) { ec = errorCode; return; } @@ -406,7 +406,7 @@ ContractionsAndExpansions::forData(const CollationData *d, UErrorCode &ec) { tailored.freeze(); checkTailored = 1; data = d->base; - utrie2_enum(data->trie, NULL, enumCnERange, this); + utrie2_enum(data->trie, nullptr, enumCnERange, this); ec = errorCode; } @@ -429,7 +429,7 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32) for(;;) { if((ce32 & 0xff) < Collation::SPECIAL_CE32_LOW_BYTE) { // !isSpecialCE32() - if(sink != NULL) { + if(sink != nullptr) { sink->handleCE(Collation::ceFromSimpleCE32(ce32)); } return; @@ -443,17 +443,17 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32) if(U_SUCCESS(errorCode)) { errorCode = U_INTERNAL_PROGRAM_ERROR; } return; case Collation::LONG_PRIMARY_TAG: - if(sink != NULL) { + if(sink != nullptr) { sink->handleCE(Collation::ceFromLongPrimaryCE32(ce32)); } return; case Collation::LONG_SECONDARY_TAG: - if(sink != NULL) { + if(sink != nullptr) { sink->handleCE(Collation::ceFromLongSecondaryCE32(ce32)); } return; case Collation::LATIN_EXPANSION_TAG: - if(sink != NULL) { + if(sink != nullptr) { ces[0] = Collation::latinCE0FromCE32(ce32); ces[1] = Collation::latinCE1FromCE32(ce32); sink->handleExpansion(ces, 2); @@ -465,7 +465,7 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32) } return; case Collation::EXPANSION32_TAG: - if(sink != NULL) { + if(sink != nullptr) { const uint32_t *ce32s = data->ce32s + Collation::indexFromCE32(ce32); int32_t length = Collation::lengthFromCE32(ce32); for(int32_t i = 0; i < length; ++i) { @@ -480,7 +480,7 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32) } return; case Collation::EXPANSION_TAG: - if(sink != NULL) { + if(sink != nullptr) { int32_t length = Collation::lengthFromCE32(ce32); sink->handleExpansion(data->ces + Collation::indexFromCE32(ce32), length); } @@ -506,13 +506,13 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32) ce32 = data->ce32s[0]; break; case Collation::HANGUL_TAG: - if(sink != NULL) { + if(sink != nullptr) { // TODO: This should be optimized, // especially if [start..end] is the complete Hangul range. (assert that) - UTF16CollationIterator iter(data, FALSE, NULL, NULL, NULL); - UChar hangul[1] = { 0 }; + UTF16CollationIterator iter(data, false, nullptr, nullptr, nullptr); + char16_t hangul[1] = { 0 }; for(UChar32 c = start; c <= end; ++c) { - hangul[0] = (UChar)c; + hangul[0] = (char16_t)c; iter.setText(hangul, hangul + 1); int32_t length = iter.fetchCEs(errorCode); if(U_FAILURE(errorCode)) { return; } @@ -540,7 +540,7 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32) void ContractionsAndExpansions::handlePrefixes( UChar32 start, UChar32 end, uint32_t ce32) { - const UChar *p = data->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = data->contexts + Collation::indexFromCE32(ce32); ce32 = CollationData::readCE32(p); // Default if no prefix match. handleCE32(start, end, ce32); if(!addPrefixes) { return; } @@ -559,7 +559,7 @@ ContractionsAndExpansions::handlePrefixes( void ContractionsAndExpansions::handleContractions( UChar32 start, UChar32 end, uint32_t ce32) { - const UChar *p = data->contexts + Collation::indexFromCE32(ce32); + const char16_t *p = data->contexts + Collation::indexFromCE32(ce32); if((ce32 & Collation::CONTRACT_SINGLE_CP_NO_MATCH) != 0) { // No match on the single code point. // We are underneath a prefix, and the default mapping is just @@ -579,13 +579,13 @@ ContractionsAndExpansions::handleContractions( } handleCE32(start, end, (uint32_t)suffixes.getValue()); } - suffix = NULL; + suffix = nullptr; } void ContractionsAndExpansions::addExpansions(UChar32 start, UChar32 end) { - if(unreversedPrefix.isEmpty() && suffix == NULL) { - if(expansions != NULL) { + if(unreversedPrefix.isEmpty() && suffix == nullptr) { + if(expansions != nullptr) { expansions->add(start, end); } } else { @@ -595,11 +595,11 @@ ContractionsAndExpansions::addExpansions(UChar32 start, UChar32 end) { void ContractionsAndExpansions::addStrings(UChar32 start, UChar32 end, UnicodeSet *set) { - if(set == NULL) { return; } + if(set == nullptr) { return; } UnicodeString s(unreversedPrefix); do { s.append(start); - if(suffix != NULL) { + if(suffix != nullptr) { s.append(*suffix); } set->add(s); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.h index aed41f7ac..99aa194e7 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationsets.h @@ -43,9 +43,9 @@ struct CollationData; class TailoredSet : public UMemory { public: TailoredSet(UnicodeSet *t) - : data(NULL), baseData(NULL), + : data(nullptr), baseData(nullptr), tailored(t), - suffix(NULL), + suffix(nullptr), errorCode(U_ZERO_ERROR) {} void forData(const CollationData *d, UErrorCode &errorCode); @@ -58,12 +58,12 @@ class TailoredSet : public UMemory { private: void compare(UChar32 c, uint32_t ce32, uint32_t baseCE32); - void comparePrefixes(UChar32 c, const UChar *p, const UChar *q); - void compareContractions(UChar32 c, const UChar *p, const UChar *q); + void comparePrefixes(UChar32 c, const char16_t *p, const char16_t *q); + void compareContractions(UChar32 c, const char16_t *p, const char16_t *q); - void addPrefixes(const CollationData *d, UChar32 c, const UChar *p); + void addPrefixes(const CollationData *d, UChar32 c, const char16_t *p); void addPrefix(const CollationData *d, const UnicodeString &pfx, UChar32 c, uint32_t ce32); - void addContractions(UChar32 c, const UChar *p); + void addContractions(UChar32 c, const char16_t *p); void addSuffix(UChar32 c, const UnicodeString &sfx); void add(UChar32 c); @@ -94,12 +94,12 @@ class ContractionsAndExpansions : public UMemory { }; ContractionsAndExpansions(UnicodeSet *con, UnicodeSet *exp, CESink *s, UBool prefixes) - : data(NULL), + : data(nullptr), contractions(con), expansions(exp), sink(s), addPrefixes(prefixes), checkTailored(0), - suffix(NULL), + suffix(nullptr), errorCode(U_ZERO_ERROR) {} void forData(const CollationData *d, UErrorCode &errorCode); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp index 2d716fd56..1533daf38 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp @@ -30,10 +30,10 @@ U_NAMESPACE_BEGIN CollationSettings::CollationSettings(const CollationSettings &other) : SharedObject(other), options(other.options), variableTop(other.variableTop), - reorderTable(NULL), + reorderTable(nullptr), minHighNoReorder(other.minHighNoReorder), - reorderRanges(NULL), reorderRangesLength(0), - reorderCodes(NULL), reorderCodesLength(0), reorderCodesCapacity(0), + reorderRanges(nullptr), reorderRangesLength(0), + reorderCodes(nullptr), reorderCodesLength(0), reorderCodesCapacity(0), fastLatinOptions(other.fastLatinOptions) { UErrorCode errorCode = U_ZERO_ERROR; copyReorderingFrom(other, errorCode); @@ -50,13 +50,13 @@ CollationSettings::~CollationSettings() { bool CollationSettings::operator==(const CollationSettings &other) const { - if(options != other.options) { return FALSE; } - if((options & ALTERNATE_MASK) != 0 && variableTop != other.variableTop) { return FALSE; } - if(reorderCodesLength != other.reorderCodesLength) { return FALSE; } + if(options != other.options) { return false; } + if((options & ALTERNATE_MASK) != 0 && variableTop != other.variableTop) { return false; } + if(reorderCodesLength != other.reorderCodesLength) { return false; } for(int32_t i = 0; i < reorderCodesLength; ++i) { - if(reorderCodes[i] != other.reorderCodes[i]) { return FALSE; } + if(reorderCodes[i] != other.reorderCodes[i]) { return false; } } - return TRUE; + return true; } int32_t @@ -72,10 +72,10 @@ CollationSettings::hashCode() const { void CollationSettings::resetReordering() { - // When we turn off reordering, we want to set a NULL permutation + // When we turn off reordering, we want to set a nullptr permutation // rather than a no-op permutation. // Keep the memory via reorderCodes and its capacity. - reorderTable = NULL; + reorderTable = nullptr; minHighNoReorder = 0; reorderRangesLength = 0; reorderCodesLength = 0; @@ -86,7 +86,7 @@ CollationSettings::aliasReordering(const CollationData &data, const int32_t *cod const uint32_t *ranges, int32_t rangesLength, const uint8_t *table, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - if(table != NULL && + if(table != nullptr && (rangesLength == 0 ? !reorderTableHasSplitBytes(table) : rangesLength >= 2 && @@ -111,7 +111,7 @@ CollationSettings::aliasReordering(const CollationData &data, const int32_t *cod if(firstSplitByteRangeIndex == rangesLength) { U_ASSERT(!reorderTableHasSplitBytes(table)); minHighNoReorder = 0; - reorderRanges = NULL; + reorderRanges = nullptr; reorderRangesLength = 0; } else { U_ASSERT(table[ranges[firstSplitByteRangeIndex] >> 24] == 0); @@ -201,7 +201,7 @@ CollationSettings::setReorderArrays(const int32_t *codes, int32_t codesLength, // Allocate one memory block for the codes, the ranges, and the 16-aligned table. int32_t capacity = (totalLength + 3) & ~3; // round up to a multiple of 4 ints ownedCodes = (int32_t *)uprv_malloc(capacity * 4 + 256); - if(ownedCodes == NULL) { + if(ownedCodes == nullptr) { resetReordering(); errorCode = U_MEMORY_ALLOCATION_ERROR; return; @@ -248,10 +248,10 @@ CollationSettings::reorderTableHasSplitBytes(const uint8_t table[256]) { U_ASSERT(table[0] == 0); for(int32_t i = 1; i < 256; ++i) { if(table[i] == 0) { - return TRUE; + return true; } } - return FALSE; + return false; } uint32_t diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.h index 3da8f6214..43a181211 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.h @@ -106,10 +106,10 @@ struct U_I18N_API CollationSettings : public SharedObject { : options((UCOL_DEFAULT_STRENGTH << STRENGTH_SHIFT) | (MAX_VAR_PUNCT << MAX_VARIABLE_SHIFT)), variableTop(0), - reorderTable(NULL), + reorderTable(nullptr), minHighNoReorder(0), - reorderRanges(NULL), reorderRangesLength(0), - reorderCodes(NULL), reorderCodesLength(0), reorderCodesCapacity(0), + reorderRanges(nullptr), reorderRangesLength(0), + reorderCodes(nullptr), reorderCodesLength(0), reorderCodesCapacity(0), fastLatinOptions(-1) {} CollationSettings(const CollationSettings &other); @@ -131,7 +131,7 @@ struct U_I18N_API CollationSettings : public SharedObject { UErrorCode &errorCode); void copyReorderingFrom(const CollationSettings &other, UErrorCode &errorCode); - inline UBool hasReordering() const { return reorderTable != NULL; } + inline UBool hasReordering() const { return reorderTable != nullptr; } static UBool reorderTableHasSplitBytes(const uint8_t table[256]); inline uint32_t reorder(uint32_t p) const { uint8_t b = reorderTable[p >> 24]; @@ -216,7 +216,7 @@ struct U_I18N_API CollationSettings : public SharedObject { /** Variable-top primary weight. */ uint32_t variableTop; /** - * 256-byte table for reordering permutation of primary lead bytes; NULL if no reordering. + * 256-byte table for reordering permutation of primary lead bytes; nullptr if no reordering. * A 0 entry at a non-zero index means that the primary lead byte is "split" * (there are different offsets for primaries that share that lead byte) * and the reordering offset must be determined via the reorderRanges. diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.cpp index 78a11fbb2..8d22cf251 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.cpp @@ -33,20 +33,20 @@ U_NAMESPACE_BEGIN CollationTailoring::CollationTailoring(const CollationSettings *baseSettings) - : data(NULL), settings(baseSettings), + : data(nullptr), settings(baseSettings), actualLocale(""), - ownedData(NULL), - builder(NULL), memory(NULL), bundle(NULL), - trie(NULL), unsafeBackwardSet(NULL), - maxExpansions(NULL) { - if(baseSettings != NULL) { + ownedData(nullptr), + builder(nullptr), memory(nullptr), bundle(nullptr), + trie(nullptr), unsafeBackwardSet(nullptr), + maxExpansions(nullptr) { + if(baseSettings != nullptr) { U_ASSERT(baseSettings->reorderCodesLength == 0); - U_ASSERT(baseSettings->reorderTable == NULL); + U_ASSERT(baseSettings->reorderTable == nullptr); U_ASSERT(baseSettings->minHighNoReorder == 0); } else { settings = new CollationSettings(); } - if(settings != NULL) { + if(settings != nullptr) { settings->addRef(); } rules.getTerminatedBuffer(); // ensure NUL-termination @@ -68,18 +68,18 @@ CollationTailoring::~CollationTailoring() { UBool CollationTailoring::ensureOwnedData(UErrorCode &errorCode) { - if(U_FAILURE(errorCode)) { return FALSE; } - if(ownedData == NULL) { + if(U_FAILURE(errorCode)) { return false; } + if(ownedData == nullptr) { const Normalizer2Impl *nfcImpl = Normalizer2Factory::getNFCImpl(errorCode); - if(U_FAILURE(errorCode)) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } ownedData = new CollationData(*nfcImpl); - if(ownedData == NULL) { + if(ownedData == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } } data = ownedData; - return TRUE; + return true; } void diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.h index 9a636cf1e..ed7e46e3b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.h @@ -24,6 +24,8 @@ #include "collationsettings.h" #include "uhash.h" #include "umutex.h" +#include "unifiedcache.h" + struct UDataMemory; struct UResourceBundle; @@ -50,9 +52,9 @@ struct U_I18N_API CollationTailoring : public SharedObject { virtual ~CollationTailoring(); /** - * Returns TRUE if the constructor could not initialize properly. + * Returns true if the constructor could not initialize properly. */ - UBool isBogus() { return settings == NULL; } + UBool isBogus() { return settings == nullptr; } UBool ensureOwnedData(UErrorCode &errorCode); @@ -89,13 +91,13 @@ struct U_I18N_API CollationTailoring : public SharedObject { * No copy constructor: A CollationTailoring cannot be copied. * It is immutable, and the data trie cannot be copied either. */ - CollationTailoring(const CollationTailoring &other); + CollationTailoring(const CollationTailoring &other) = delete; }; -struct CollationCacheEntry : public SharedObject { +struct U_I18N_API CollationCacheEntry : public SharedObject { CollationCacheEntry(const Locale &loc, const CollationTailoring *t) : validLocale(loc), tailoring(t) { - if(t != NULL) { + if(t != nullptr) { t->addRef(); } } @@ -105,6 +107,10 @@ struct CollationCacheEntry : public SharedObject { const CollationTailoring *tailoring; }; +template<> U_I18N_API +const CollationCacheEntry * +LocaleCacheKey::createObject(const void *creationContext, + UErrorCode &errorCode) const; U_NAMESPACE_END #endif // !UCONFIG_NO_COLLATION diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.cpp index 05458962c..235148459 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.cpp @@ -227,7 +227,7 @@ CollationWeights::getWeightRanges(uint32_t lowerLimit, uint32_t upperLimit) { #ifdef UCOL_DEBUG printf("error: no space between lower & upper limits\n"); #endif - return FALSE; + return false; } /* check that neither is a prefix of the other */ @@ -236,7 +236,7 @@ CollationWeights::getWeightRanges(uint32_t lowerLimit, uint32_t upperLimit) { #ifdef UCOL_DEBUG printf("error: lower limit 0x%08lx is a prefix of upper limit 0x%08lx\n", lowerLimit, upperLimit); #endif - return FALSE; + return false; } } /* if the upper limit is a prefix of the lower limit then the earlier test lowerLimit>=upperLimit has caught it */ @@ -307,7 +307,7 @@ CollationWeights::getWeightRanges(uint32_t lowerLimit, uint32_t upperLimit) { // maxByte (for lowerEnd) or minByte (for upperStart). const uint32_t lowerEnd=lower[length].end; const uint32_t upperStart=upper[length].start; - UBool merged=FALSE; + UBool merged=false; if(lowerEnd>upperStart) { // These two lower and upper ranges collide. @@ -326,7 +326,7 @@ CollationWeights::getWeightRanges(uint32_t lowerLimit, uint32_t upperLimit) { (int32_t)getWeightTrail(lower[length].start, length)+1; // count might be <=0 in which case there is no room, // and the range-collecting code below will ignore this range. - merged=TRUE; + merged=true; } else if(lowerEnd==upperStart) { // Not possible, unless minByte==maxByte which is not allowed. U_ASSERT(minBytes[length]countBytes - merged=TRUE; + merged=true; } } if(merged) { @@ -409,14 +409,14 @@ CollationWeights::allocWeightsInShortRanges(int32_t n, int32_t minLength) { /* sort the ranges by weight values */ UErrorCode errorCode=U_ZERO_ERROR; uprv_sortArray(ranges, rangeCount, sizeof(WeightRange), - compareRanges, NULL, FALSE, &errorCode); + compareRanges, nullptr, false, &errorCode); /* ignore error code: we know that the internal sort function will not fail here */ } - return TRUE; + return true; } n -= ranges[i].count; // still >0 } - return FALSE; + return false; } UBool @@ -433,7 +433,7 @@ CollationWeights::allocWeightsInMinLengthRanges(int32_t n, int32_t minLength) { } int32_t nextCountBytes = countBytes(minLength + 1); - if(n > count * nextCountBytes) { return FALSE; } + if(n > count * nextCountBytes) { return false; } // Use the minLength ranges. Merge them, and then split again as necessary. uint32_t start = ranges[0].start; @@ -485,7 +485,7 @@ CollationWeights::allocWeightsInMinLengthRanges(int32_t n, int32_t minLength) { lengthenRange(ranges[1]); rangeCount = 2; } - return TRUE; + return true; } /* @@ -503,7 +503,7 @@ CollationWeights::allocWeights(uint32_t lowerLimit, uint32_t upperLimit, int32_t #ifdef UCOL_DEBUG printf("error: unable to get Weight ranges\n"); #endif - return FALSE; + return false; } /* try until we find suitably large ranges */ @@ -518,7 +518,7 @@ CollationWeights::allocWeights(uint32_t lowerLimit, uint32_t upperLimit, int32_t printf("error: the maximum number of %ld weights is insufficient for n=%ld\n", minLengthCount, n); #endif - return FALSE; + return false; } if(allocWeightsInMinLengthRanges(n, minLength)) { break; } @@ -541,7 +541,7 @@ CollationWeights::allocWeights(uint32_t lowerLimit, uint32_t upperLimit, int32_t #endif rangeIndex = 0; - return TRUE; + return true; } uint32_t diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.h b/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.h index b41588218..0d20b927b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/collationweights.h @@ -62,7 +62,7 @@ class U_I18N_API CollationWeights : public UMemory { * weights less than this one. * @param n The number of collation element weights w necessary such that * lowerLimit(getUnit()); +} + UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyAmount) U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.cpp index 0ad0492ee..b7dfc09c5 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.cpp @@ -50,7 +50,7 @@ void CurrencyFormat::parseObject(const UnicodeString& source, ParsePosition& pos) const { CurrencyAmount* currAmt = getCurrencyFormatInternal().parseCurrency(source, pos); - if (currAmt != NULL) { + if (currAmt != nullptr) { result.adoptObject(currAmt); } } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.h b/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.h index 69a031957..2a75cae2b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/currfmt.h @@ -57,7 +57,7 @@ class CurrencyFormat : public MeasureFormat { /** * Override Format API. */ - virtual CurrencyFormat* clone() const; + virtual CurrencyFormat* clone() const override; using MeasureFormat::format; @@ -68,19 +68,19 @@ class CurrencyFormat : public MeasureFormat { virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPosition& pos, - UErrorCode& ec) const; + UErrorCode& ec) const override; /** * Override Format API. */ virtual void parseObject(const UnicodeString& source, Formattable& result, - ParsePosition& pos) const; + ParsePosition& pos) const override; /** * Override Format API. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; /** * Returns the class ID for this class. diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp index dda4e7f7f..7c5adaaf7 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp @@ -29,7 +29,7 @@ U_NAMESPACE_BEGIN -static const UChar gNumberPatternSeparator = 0x3B; // ; +static const char16_t gNumberPatternSeparator = 0x3B; // ; U_CDECL_BEGIN @@ -50,17 +50,17 @@ U_CDECL_END UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyPluralInfo) -static const UChar currpinf_gDefaultCurrencyPluralPattern[] = {'0', '.', '#', '#', ' ', 0xA4, 0xA4, 0xA4, 0}; -static const UChar currpinf_gTripleCurrencySign[] = {0xA4, 0xA4, 0xA4, 0}; -static const UChar currpinf_gPluralCountOther[] = {0x6F, 0x74, 0x68, 0x65, 0x72, 0}; -static const UChar currpinf_gPart0[] = {0x7B, 0x30, 0x7D, 0}; -static const UChar currpinf_gPart1[] = {0x7B, 0x31, 0x7D, 0}; +static const char16_t gDefaultCurrencyPluralPattern[] = {'0', '.', '#', '#', ' ', 0xA4, 0xA4, 0xA4, 0}; +static const char16_t gTripleCurrencySign[] = {0xA4, 0xA4, 0xA4, 0}; +static const char16_t gPluralCountOther[] = {0x6F, 0x74, 0x68, 0x65, 0x72, 0}; +static const char16_t gPart0[] = {0x7B, 0x30, 0x7D, 0}; +static const char16_t gPart1[] = {0x7B, 0x31, 0x7D, 0}; -static const char currpinf_gNumberElementsTag[]="NumberElements"; -static const char currpinf_gLatnTag[]="latn"; -static const char currpinf_gPatternsTag[]="patterns"; -static const char currpinf_gDecimalFormatTag[]="decimalFormat"; -static const char currpinf_gCurrUnitPtnTag[]="CurrencyUnitPatterns"; +static const char gNumberElementsTag[]="NumberElements"; +static const char gLatnTag[]="latn"; +static const char gPatternsTag[]="patterns"; +static const char gDecimalFormatTag[]="decimalFormat"; +static const char gCurrUnitPtnTag[]="CurrencyUnitPatterns"; CurrencyPluralInfo::CurrencyPluralInfo(UErrorCode& status) : fPluralCountToCurrencyUnitPattern(nullptr), @@ -78,7 +78,7 @@ CurrencyPluralInfo::CurrencyPluralInfo(const Locale& locale, UErrorCode& status) initialize(locale, status); } -CurrencyPluralInfo::CurrencyPluralInfo(const CurrencyPluralInfo& info) +CurrencyPluralInfo::CurrencyPluralInfo(const CurrencyPluralInfo& info) : UObject(info), fPluralCountToCurrencyUnitPattern(nullptr), fPluralRules(nullptr), @@ -101,7 +101,7 @@ CurrencyPluralInfo::operator=(const CurrencyPluralInfo& info) { deleteHash(fPluralCountToCurrencyUnitPattern); fPluralCountToCurrencyUnitPattern = initHash(fInternalStatus); - copyHash(info.fPluralCountToCurrencyUnitPattern, + copyHash(info.fPluralCountToCurrencyUnitPattern, fPluralCountToCurrencyUnitPattern, fInternalStatus); if ( U_FAILURE(fInternalStatus) ) { return *this; @@ -176,7 +176,7 @@ CurrencyPluralInfo::clone() const { return newObj; } -const PluralRules* +const PluralRules* CurrencyPluralInfo::getPluralRules() const { return fPluralRules; } @@ -184,21 +184,21 @@ CurrencyPluralInfo::getPluralRules() const { UnicodeString& CurrencyPluralInfo::getCurrencyPluralPattern(const UnicodeString& pluralCount, UnicodeString& result) const { - const UnicodeString* currencyPluralPattern = + const UnicodeString* currencyPluralPattern = (UnicodeString*)fPluralCountToCurrencyUnitPattern->get(pluralCount); if (currencyPluralPattern == nullptr) { // fall back to "other" - if (pluralCount.compare(currpinf_gPluralCountOther, 5)) { - currencyPluralPattern = - (UnicodeString*)fPluralCountToCurrencyUnitPattern->get(UnicodeString(TRUE, currpinf_gPluralCountOther, 5)); + if (pluralCount.compare(gPluralCountOther, 5)) { + currencyPluralPattern = + (UnicodeString*)fPluralCountToCurrencyUnitPattern->get(UnicodeString(true, gPluralCountOther, 5)); } if (currencyPluralPattern == nullptr) { - // no currencyUnitPatterns defined, + // no currencyUnitPatterns defined, // fallback to predefined default. // This should never happen when ICU resource files are // available, since currencyUnitPattern of "other" is always // defined in root. - result = UnicodeString(currpinf_gDefaultCurrencyPluralPattern); + result = UnicodeString(gDefaultCurrencyPluralPattern); return result; } } @@ -242,13 +242,13 @@ CurrencyPluralInfo::setLocale(const Locale& loc, UErrorCode& status) { initialize(loc, status); } -void +void CurrencyPluralInfo::initialize(const Locale& loc, UErrorCode& status) { if (U_FAILURE(status)) { return; } delete fLocale; - fLocale = nullptr; + fLocale = nullptr; delete fPluralRules; fPluralRules = nullptr; @@ -266,7 +266,7 @@ CurrencyPluralInfo::initialize(const Locale& loc, UErrorCode& status) { fPluralRules = PluralRules::forLocale(loc, status); setupCurrencyPluralPattern(loc, status); } - + void CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status) { if (U_FAILURE(status)) { @@ -285,20 +285,20 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st } UErrorCode ec = U_ZERO_ERROR; LocalUResourceBundlePointer rb(ures_open(nullptr, loc.getName(), &ec)); - LocalUResourceBundlePointer numElements(ures_getByKeyWithFallback(rb.getAlias(), currpinf_gNumberElementsTag, nullptr, &ec)); + LocalUResourceBundlePointer numElements(ures_getByKeyWithFallback(rb.getAlias(), gNumberElementsTag, nullptr, &ec)); ures_getByKeyWithFallback(numElements.getAlias(), ns->getName(), rb.getAlias(), &ec); - ures_getByKeyWithFallback(rb.getAlias(), currpinf_gPatternsTag, rb.getAlias(), &ec); + ures_getByKeyWithFallback(rb.getAlias(), gPatternsTag, rb.getAlias(), &ec); int32_t ptnLen; - const UChar* numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), currpinf_gDecimalFormatTag, &ptnLen, &ec); + const char16_t* numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), gDecimalFormatTag, &ptnLen, &ec); // Fall back to "latn" if num sys specific pattern isn't there. - if ( ec == U_MISSING_RESOURCE_ERROR && (uprv_strcmp(ns->getName(), currpinf_gLatnTag) != 0)) { + if ( ec == U_MISSING_RESOURCE_ERROR && (uprv_strcmp(ns->getName(), gLatnTag) != 0)) { ec = U_ZERO_ERROR; - ures_getByKeyWithFallback(numElements.getAlias(), currpinf_gLatnTag, rb.getAlias(), &ec); - ures_getByKeyWithFallback(rb.getAlias(), currpinf_gPatternsTag, rb.getAlias(), &ec); - numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), currpinf_gDecimalFormatTag, &ptnLen, &ec); + ures_getByKeyWithFallback(numElements.getAlias(), gLatnTag, rb.getAlias(), &ec); + ures_getByKeyWithFallback(rb.getAlias(), gPatternsTag, rb.getAlias(), &ec); + numberStylePattern = ures_getStringByKeyWithFallback(rb.getAlias(), gDecimalFormatTag, &ptnLen, &ec); } int32_t numberStylePatternLen = ptnLen; - const UChar* negNumberStylePattern = nullptr; + const char16_t* negNumberStylePattern = nullptr; int32_t negNumberStylePatternLen = 0; // TODO: Java // parse to check whether there is ";" separator in the numberStylePattern @@ -324,8 +324,8 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st } LocalUResourceBundlePointer currRb(ures_open(U_ICUDATA_CURR, loc.getName(), &ec)); - LocalUResourceBundlePointer currencyRes(ures_getByKeyWithFallback(currRb.getAlias(), currpinf_gCurrUnitPtnTag, nullptr, &ec)); - + LocalUResourceBundlePointer currencyRes(ures_getByKeyWithFallback(currRb.getAlias(), gCurrUnitPtnTag, nullptr, &ec)); + #ifdef CURRENCY_PLURAL_INFO_DEBUG std::cout << "in set up\n"; #endif @@ -335,7 +335,7 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st while (((pluralCount = keywords->next(nullptr, ec)) != nullptr) && U_SUCCESS(ec)) { int32_t ptnLength; UErrorCode err = U_ZERO_ERROR; - const UChar* patternChars = ures_getStringByKeyWithFallback(currencyRes.getAlias(), pluralCount, &ptnLength, &err); + const char16_t* patternChars = ures_getStringByKeyWithFallback(currencyRes.getAlias(), pluralCount, &ptnLength, &err); if (err == U_MEMORY_ALLOCATION_ERROR || patternChars == nullptr) { ec = err; break; @@ -351,15 +351,15 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st pattern->extract(0, pattern->length(), result_1, "UTF-8"); std::cout << "pluralCount: " << pluralCount << "; pattern: " << result_1 << "\n"; #endif - pattern->findAndReplace(UnicodeString(TRUE, currpinf_gPart0, 3), + pattern->findAndReplace(UnicodeString(true, gPart0, 3), UnicodeString(numberStylePattern, numberStylePatternLen)); - pattern->findAndReplace(UnicodeString(TRUE, currpinf_gPart1, 3), UnicodeString(TRUE, currpinf_gTripleCurrencySign, 3)); + pattern->findAndReplace(UnicodeString(true, gPart1, 3), UnicodeString(true, gTripleCurrencySign, 3)); if (hasSeparator) { UnicodeString negPattern(patternChars, ptnLength); - negPattern.findAndReplace(UnicodeString(TRUE, currpinf_gPart0, 3), + negPattern.findAndReplace(UnicodeString(true, gPart0, 3), UnicodeString(negNumberStylePattern, negNumberStylePatternLen)); - negPattern.findAndReplace(UnicodeString(TRUE, currpinf_gPart1, 3), UnicodeString(TRUE, currpinf_gTripleCurrencySign, 3)); + negPattern.findAndReplace(UnicodeString(true, gPart1, 3), UnicodeString(true, gTripleCurrencySign, 3)); pattern->append(gNumberPatternSeparator); pattern->append(negPattern); } @@ -400,7 +400,7 @@ CurrencyPluralInfo::initHash(UErrorCode& status) { if (U_FAILURE(status)) { return nullptr; } - LocalPointer hTable(new Hashtable(TRUE, status), status); + LocalPointer hTable(new Hashtable(true, status), status); if (U_FAILURE(status)) { return nullptr; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/currunit.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/currunit.cpp index dab6dda53..98f28365c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/currunit.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/currunit.cpp @@ -16,12 +16,12 @@ #include "unicode/currunit.h" #include "unicode/ustring.h" +#include "unicode/uchar.h" #include "cstring.h" #include "uinvchar.h" #include "charstr.h" - -static constexpr char16_t kDefaultCurrency[] = u"XXX"; -static constexpr char kDefaultCurrency8[] = "XXX"; +#include "ustr_imp.h" +#include "measunit_impl.h" U_NAMESPACE_BEGIN @@ -31,22 +31,25 @@ CurrencyUnit::CurrencyUnit(ConstChar16Ptr _isoCode, UErrorCode& ec) { // non-NUL-terminated string to be passed as an argument, so it is not possible to check length. // However, we allow a NUL-terminated empty string, which should have the same behavior as nullptr. // Consider NUL-terminated strings of length 1 or 2 as invalid. - const char16_t* isoCodeToUse; + bool useDefault = false; if (U_FAILURE(ec) || _isoCode == nullptr || _isoCode[0] == 0) { - isoCodeToUse = kDefaultCurrency; + useDefault = true; } else if (_isoCode[1] == 0 || _isoCode[2] == 0) { - isoCodeToUse = kDefaultCurrency; + useDefault = true; ec = U_ILLEGAL_ARGUMENT_ERROR; } else if (!uprv_isInvariantUString(_isoCode, 3)) { // TODO: Perform a more strict ASCII check like in ICU4J isAlpha3Code? - isoCodeToUse = kDefaultCurrency; + useDefault = true; ec = U_INVARIANT_CONVERSION_ERROR; } else { - isoCodeToUse = _isoCode; + for (int32_t i=0; i<3; i++) { + isoCode[i] = u_asciiToUpper(_isoCode[i]); + } + isoCode[3] = 0; + } + if (useDefault) { + uprv_memcpy(isoCode, kDefaultCurrency, sizeof(char16_t) * 4); } - // TODO: Perform uppercasing here like in ICU4J Currency.getInstance()? - uprv_memcpy(isoCode, isoCodeToUse, sizeof(UChar) * 3); - isoCode[3] = 0; char simpleIsoCode[4]; u_UCharsToChars(isoCode, simpleIsoCode, 4); initCurrency(simpleIsoCode); @@ -66,13 +69,13 @@ CurrencyUnit::CurrencyUnit(StringPiece _isoCode, UErrorCode& ec) { ec = U_INVARIANT_CONVERSION_ERROR; } else { // Have to use isoCodeBuffer to ensure the string is NUL-terminated - uprv_strncpy(isoCodeBuffer, _isoCode.data(), 3); + for (int32_t i=0; i<3; i++) { + isoCodeBuffer[i] = uprv_toupper(_isoCode.data()[i]); + } isoCodeBuffer[3] = 0; isoCodeToUse = isoCodeBuffer; } - // TODO: Perform uppercasing here like in ICU4J Currency.getInstance()? - u_charsToUChars(isoCodeToUse, isoCode, 3); - isoCode[3] = 0; + u_charsToUChars(isoCodeToUse, isoCode, 4); initCurrency(isoCodeToUse); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp index 7e02ff18b..2b340ee4b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp @@ -23,8 +23,8 @@ #include "unicode/tzrule.h" // --- The cache -- -static icu::TimeZone *gDangiCalendarZoneAstroCalc = NULL; -static icu::UInitOnce gDangiCalendarInitOnce = U_INITONCE_INITIALIZER; +static icu::TimeZone *gDangiCalendarZoneAstroCalc = nullptr; +static icu::UInitOnce gDangiCalendarInitOnce {}; /** * The start year of the Korean traditional calendar (Dan-gi) is the inaugural @@ -33,13 +33,13 @@ static icu::UInitOnce gDangiCalendarInitOnce = U_INITONCE_INITIALIZER; static const int32_t DANGI_EPOCH_YEAR = -2332; // Gregorian year U_CDECL_BEGIN -static UBool calendar_dangi_cleanup(void) { +static UBool calendar_dangi_cleanup() { if (gDangiCalendarZoneAstroCalc) { delete gDangiCalendarZoneAstroCalc; - gDangiCalendarZoneAstroCalc = NULL; + gDangiCalendarZoneAstroCalc = nullptr; } gDangiCalendarInitOnce.reset(); - return TRUE; + return true; } U_CDECL_END @@ -52,11 +52,11 @@ U_NAMESPACE_BEGIN //------------------------------------------------------------------------- DangiCalendar::DangiCalendar(const Locale& aLocale, UErrorCode& success) -: ChineseCalendar(aLocale, DANGI_EPOCH_YEAR, getDangiCalZoneAstroCalc(), success) +: ChineseCalendar(aLocale, DANGI_EPOCH_YEAR, getDangiCalZoneAstroCalc(success), success) { } -DangiCalendar::DangiCalendar (const DangiCalendar& other) +DangiCalendar::DangiCalendar (const DangiCalendar& other) : ChineseCalendar(other) { } @@ -71,67 +71,93 @@ DangiCalendar::clone() const return new DangiCalendar(*this); } -const char *DangiCalendar::getType() const { +const char *DangiCalendar::getType() const { return "dangi"; } /** * The time zone used for performing astronomical computations for - * Dangi calendar. In Korea various timezones have been used historically - * (cf. http://www.math.snu.ac.kr/~kye/others/lunar.html): - * - * - 1908/04/01: GMT+8 - * 1908/04/01 - 1911/12/31: GMT+8.5 - * 1912/01/01 - 1954/03/20: GMT+9 - * 1954/03/21 - 1961/08/09: GMT+8.5 - * 1961/08/10 - : GMT+9 - * - * Note that, in 1908-1911, the government did not apply the timezone change - * but used GMT+8. In addition, 1954-1961's timezone change does not affect - * the lunar date calculation. Therefore, the following simpler rule works: - * - * -1911: GMT+8 - * 1912-: GMT+9 - * - * Unfortunately, our astronomer's approximation doesn't agree with the - * references (http://www.math.snu.ac.kr/~kye/others/lunar.html and - * http://astro.kasi.re.kr/Life/ConvertSolarLunarForm.aspx?MenuID=115) - * in 1897/7/30. So the following ad hoc fix is used here: - * - * -1896: GMT+8 - * 1897: GMT+7 - * 1898-1911: GMT+8 - * 1912- : GMT+9 + * Dangi calendar. In Korea various timezones have been used historically + * (cf. http://www.math.snu.ac.kr/~kye/others/lunar.html): + * + * - 1908/04/01: GMT+8 + * 1908/04/01 - 1911/12/31: GMT+8.5 + * 1912/01/01 - 1954/03/20: GMT+9 + * 1954/03/21 - 1961/08/09: GMT+8.5 + * 1961/08/10 - : GMT+9 + * + * Note that, in 1908-1911, the government did not apply the timezone change + * but used GMT+8. In addition, 1954-1961's timezone change does not affect + * the lunar date calculation. Therefore, the following simpler rule works: + * + * -1911: GMT+8 + * 1912-: GMT+9 + * + * Unfortunately, our astronomer's approximation doesn't agree with the + * references (http://www.math.snu.ac.kr/~kye/others/lunar.html and + * http://astro.kasi.re.kr/Life/ConvertSolarLunarForm.aspx?MenuID=115) + * in 1897/7/30. So the following ad hoc fix is used here: + * + * -1896: GMT+8 + * 1897: GMT+7 + * 1898-1911: GMT+8 + * 1912- : GMT+9 */ -static void U_CALLCONV initDangiCalZoneAstroCalc(void) { - U_ASSERT(gDangiCalendarZoneAstroCalc == NULL); +static void U_CALLCONV initDangiCalZoneAstroCalc(UErrorCode &status) { + U_ASSERT(gDangiCalendarZoneAstroCalc == nullptr); const UDate millis1897[] = { (UDate)((1897 - 1970) * 365 * kOneDay) }; // some days of error is not a problem here const UDate millis1898[] = { (UDate)((1898 - 1970) * 365 * kOneDay) }; // some days of error is not a problem here const UDate millis1912[] = { (UDate)((1912 - 1970) * 365 * kOneDay) }; // this doesn't create an issue for 1911/12/20 - InitialTimeZoneRule* initialTimeZone = new InitialTimeZoneRule(UNICODE_STRING_SIMPLE("GMT+8"), 8*kOneHour, 0); - TimeZoneRule* rule1897 = new TimeArrayTimeZoneRule(UNICODE_STRING_SIMPLE("Korean 1897"), 7*kOneHour, 0, millis1897, 1, DateTimeRule::STANDARD_TIME); - TimeZoneRule* rule1898to1911 = new TimeArrayTimeZoneRule(UNICODE_STRING_SIMPLE("Korean 1898-1911"), 8*kOneHour, 0, millis1898, 1, DateTimeRule::STANDARD_TIME); - TimeZoneRule* ruleFrom1912 = new TimeArrayTimeZoneRule(UNICODE_STRING_SIMPLE("Korean 1912-"), 9*kOneHour, 0, millis1912, 1, DateTimeRule::STANDARD_TIME); - UErrorCode status = U_ZERO_ERROR; - RuleBasedTimeZone* dangiCalZoneAstroCalc = new RuleBasedTimeZone(UNICODE_STRING_SIMPLE("KOREA_ZONE"), initialTimeZone); // adopts initialTimeZone - dangiCalZoneAstroCalc->addTransitionRule(rule1897, status); // adopts rule1897 - dangiCalZoneAstroCalc->addTransitionRule(rule1898to1911, status); - dangiCalZoneAstroCalc->addTransitionRule(ruleFrom1912, status); + LocalPointer initialTimeZone(new InitialTimeZoneRule( + UnicodeString(u"GMT+8"), 8*kOneHour, 0), status); + + LocalPointer rule1897(new TimeArrayTimeZoneRule( + UnicodeString(u"Korean 1897"), 7*kOneHour, 0, millis1897, 1, DateTimeRule::STANDARD_TIME), status); + + LocalPointer rule1898to1911(new TimeArrayTimeZoneRule( + UnicodeString(u"Korean 1898-1911"), 8*kOneHour, 0, millis1898, 1, DateTimeRule::STANDARD_TIME), status); + + LocalPointer ruleFrom1912(new TimeArrayTimeZoneRule( + UnicodeString(u"Korean 1912-"), 9*kOneHour, 0, millis1912, 1, DateTimeRule::STANDARD_TIME), status); + + LocalPointer dangiCalZoneAstroCalc(new RuleBasedTimeZone( + UnicodeString(u"KOREA_ZONE"), initialTimeZone.orphan()), status); // adopts initialTimeZone + + if (U_FAILURE(status)) { + return; + } + dangiCalZoneAstroCalc->addTransitionRule(rule1897.orphan(), status); // adopts rule1897 + dangiCalZoneAstroCalc->addTransitionRule(rule1898to1911.orphan(), status); + dangiCalZoneAstroCalc->addTransitionRule(ruleFrom1912.orphan(), status); dangiCalZoneAstroCalc->complete(status); if (U_SUCCESS(status)) { - gDangiCalendarZoneAstroCalc = dangiCalZoneAstroCalc; - } else { - delete dangiCalZoneAstroCalc; - gDangiCalendarZoneAstroCalc = NULL; + gDangiCalendarZoneAstroCalc = dangiCalZoneAstroCalc.orphan(); } ucln_i18n_registerCleanup(UCLN_I18N_DANGI_CALENDAR, calendar_dangi_cleanup); } -TimeZone* DangiCalendar::getDangiCalZoneAstroCalc(void) { - umtx_initOnce(gDangiCalendarInitOnce, &initDangiCalZoneAstroCalc); +const TimeZone* DangiCalendar::getDangiCalZoneAstroCalc(UErrorCode &status) const { + umtx_initOnce(gDangiCalendarInitOnce, &initDangiCalZoneAstroCalc, status); return gDangiCalendarZoneAstroCalc; } +constexpr uint32_t kDangiRelatedYearDiff = -2333; + +int32_t DangiCalendar::getRelatedYear(UErrorCode &status) const +{ + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; + } + return year + kDangiRelatedYearDiff; +} + +void DangiCalendar::setRelatedYear(int32_t year) +{ + // set extended year + set(UCAL_EXTENDED_YEAR, year - kDangiRelatedYearDiff); +} + UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DangiCalendar) diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dangical.h b/src/duckdb/extension/icu/third_party/icu/i18n/dangical.h index e60a1fde6..3e5b0bb85 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dangical.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dangical.h @@ -27,7 +27,7 @@ U_NAMESPACE_BEGIN *

    DangiCalendar is a concrete subclass of {@link Calendar} * that implements a traditional Korean lunisolar calendar.

    * - *

    DangiCalendar usually should be instantiated using + *

    DangiCalendar usually should be instantiated using * {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a ULocale * with the tag "@calendar=dangi".

    * @@ -66,24 +66,38 @@ class DangiCalendar : public ChineseCalendar { * Clone. * @internal */ - virtual DangiCalendar* clone() const; + virtual DangiCalendar* clone() const override; //---------------------------------------------------------------------- // Internal methods & astronomical calculations //---------------------------------------------------------------------- + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const override; + + /** + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field + * @internal + */ + virtual void setRelatedYear(int32_t year) override; + private: - static TimeZone* getDangiCalZoneAstroCalc(void); + const TimeZone* getDangiCalZoneAstroCalc(UErrorCode &status) const; // UObject stuff - public: + public: /** * @return The class ID for this object. All objects of a given class have the * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -96,7 +110,7 @@ class DangiCalendar : public ChineseCalendar { * @return The class ID for all objects of this class. * @internal */ - U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); /** * return the calendar type, "dangi". @@ -104,11 +118,11 @@ class DangiCalendar : public ChineseCalendar { * @return calendar type * @internal */ - const char * getType() const; + const char * getType() const override; private: - + DangiCalendar(); // default constructor not implemented }; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp index 8e20e6b2e..029634e3d 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp @@ -46,7 +46,7 @@ U_NAMESPACE_BEGIN -class U_I18N_API DateFmtBestPattern : public SharedObject { +class DateFmtBestPattern : public SharedObject { public: UnicodeString fPattern; @@ -58,16 +58,24 @@ class U_I18N_API DateFmtBestPattern : public SharedObject { DateFmtBestPattern::~DateFmtBestPattern() { } -template<> U_I18N_API +template<> const DateFmtBestPattern *LocaleCacheKey::createObject( const void * /*creationContext*/, UErrorCode &status) const { status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } -class U_I18N_API DateFmtBestPatternKey : public LocaleCacheKey { +class DateFmtBestPatternKey : public LocaleCacheKey { private: UnicodeString fSkeleton; +protected: + virtual bool equals(const CacheKeyBase &other) const override { + if (!LocaleCacheKey::equals(other)) { + return false; + } + // We know that this and other are of same class if we get this far. + return operator==(static_cast(other)); + } public: DateFmtBestPatternKey( const Locale &loc, @@ -79,31 +87,21 @@ class U_I18N_API DateFmtBestPatternKey : public LocaleCacheKey(other), fSkeleton(other.fSkeleton) { } virtual ~DateFmtBestPatternKey(); - virtual int32_t hashCode() const { + virtual int32_t hashCode() const override { return (int32_t)(37u * (uint32_t)LocaleCacheKey::hashCode() + (uint32_t)fSkeleton.hashCode()); } - virtual bool operator==(const CacheKeyBase &other) const { - // reflexive - if (this == &other) { - return TRUE; - } - if (!LocaleCacheKey::operator==(other)) { - return FALSE; - } - // We know that this and other are of same class if we get this far. - const DateFmtBestPatternKey &realOther = - static_cast(other); - return (realOther.fSkeleton == fSkeleton); + inline bool operator==(const DateFmtBestPatternKey &other) const { + return fSkeleton == other.fSkeleton; } - virtual CacheKeyBase *clone() const { + virtual CacheKeyBase *clone() const override { return new DateFmtBestPatternKey(*this); } virtual const DateFmtBestPattern *createObject( - const void * /*unused*/, UErrorCode &status) const { + const void * /*unused*/, UErrorCode &status) const override { LocalPointer dtpg( DateTimePatternGenerator::createInstance(fLoc, status)); if (U_FAILURE(status)) { - return NULL; + return nullptr; } LocalPointer pattern( @@ -111,7 +109,7 @@ class U_I18N_API DateFmtBestPatternKey : public LocaleCacheKeygetBestPattern(fSkeleton, status)), status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } DateFmtBestPattern *result = pattern.orphan(); result->addRef(); @@ -151,12 +149,12 @@ DateFormat& DateFormat::operator=(const DateFormat& other) if(other.fCalendar) { fCalendar = other.fCalendar->clone(); } else { - fCalendar = NULL; + fCalendar = nullptr; } if(other.fNumberFormat) { fNumberFormat = other.fNumberFormat->clone(); } else { - fNumberFormat = NULL; + fNumberFormat = nullptr; } fBoolFlags = other.fBoolFlags; fCapitalizationContext = other.fCapitalizationContext; @@ -177,18 +175,17 @@ DateFormat::~DateFormat() bool DateFormat::operator==(const Format& other) const { - // This protected comparison operator should only be called by subclasses - // which have confirmed that the other object being compared against is - // an instance of a sublcass of DateFormat. THIS IS IMPORTANT. - + if (this == &other) { + return true; + } + if (!(Format::operator==(other))) { + return false; + } // Format::operator== guarantees that this cast is safe DateFormat* fmt = (DateFormat*)&other; - - return (this == fmt) || - (Format::operator==(other) && - fCalendar&&(fCalendar->isEquivalentTo(*fmt->fCalendar)) && + return fCalendar&&(fCalendar->isEquivalentTo(*fmt->fCalendar)) && (fNumberFormat && *fNumberFormat == *fmt->fNumberFormat) && - (fCapitalizationContext == fmt->fCapitalizationContext) ); + (fCapitalizationContext == fmt->fCapitalizationContext); } //---------------------------------------------------------------------- @@ -279,10 +276,10 @@ DateFormat::format(Calendar& /* unused cal */, UnicodeString& DateFormat::format(UDate date, UnicodeString& appendTo, FieldPosition& fieldPosition) const { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { // Use a clone of our calendar instance Calendar* calClone = fCalendar->clone(); - if (calClone != NULL) { + if (calClone != nullptr) { UErrorCode ec = U_ZERO_ERROR; calClone->setTime(date, ec); if (U_SUCCESS(ec)) { @@ -299,9 +296,9 @@ DateFormat::format(UDate date, UnicodeString& appendTo, FieldPosition& fieldPosi UnicodeString& DateFormat::format(UDate date, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { Calendar* calClone = fCalendar->clone(); - if (calClone != NULL) { + if (calClone != nullptr) { calClone->setTime(date, status); if (U_SUCCESS(status)) { format(*calClone, appendTo, posIter, status); @@ -330,9 +327,9 @@ DateFormat::parse(const UnicodeString& text, ParsePosition& pos) const { UDate d = 0; // Error return UDate is 0 (the epoch) - if (fCalendar != NULL) { + if (fCalendar != nullptr) { Calendar* calClone = fCalendar->clone(); - if (calClone != NULL) { + if (calClone != nullptr) { int32_t start = pos.getIndex(); calClone->clear(); parse(text, *calClone, pos); @@ -436,7 +433,7 @@ DateFormat::getBestPattern( return UnicodeString(); } DateFmtBestPatternKey key(locale, skeleton, status); - const DateFmtBestPattern *patternPtr = NULL; + const DateFmtBestPattern *patternPtr = nullptr; cache->get(key, patternPtr, status); if (U_FAILURE(status)) { return UnicodeString(); @@ -454,20 +451,20 @@ DateFormat::createInstanceForSkeleton( UErrorCode &status) { LocalPointer calendar(calendarToAdopt); if (U_FAILURE(status)) { - return NULL; + return nullptr; } if (calendar.isNull()) { status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } Locale localeWithCalendar = locale; localeWithCalendar.setKeywordValue("calendar", calendar->getType(), status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } DateFormat *result = createInstanceForSkeleton(skeleton, localeWithCalendar, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } result->adoptCalendar(calendar.orphan()); return result; @@ -479,14 +476,14 @@ DateFormat::createInstanceForSkeleton( const Locale &locale, UErrorCode &status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } LocalPointer df( new SimpleDateFormat( getBestPattern(locale, skeleton, status), locale, status), status); - return U_SUCCESS(status) ? df.orphan() : NULL; + return U_SUCCESS(status) ? df.orphan() : nullptr; } DateFormat* U_EXPORT2 @@ -570,7 +567,7 @@ void DateFormat::setCalendar(const Calendar& newCalendar) { Calendar* newCalClone = newCalendar.clone(); - if (newCalClone != NULL) { + if (newCalClone != nullptr) { adoptCalendar(newCalClone); } } @@ -590,8 +587,8 @@ DateFormat::adoptNumberFormat(NumberFormat* newNumberFormat) { delete fNumberFormat; fNumberFormat = newNumberFormat; - newNumberFormat->setParseIntegerOnly(TRUE); - newNumberFormat->setGroupingUsed(FALSE); + newNumberFormat->setParseIntegerOnly(true); + newNumberFormat->setGroupingUsed(false); } //---------------------------------------------------------------------- @@ -599,7 +596,7 @@ void DateFormat::setNumberFormat(const NumberFormat& newNumberFormat) { NumberFormat* newNumFmtClone = newNumberFormat.clone(); - if (newNumFmtClone != NULL) { + if (newNumFmtClone != nullptr) { adoptNumberFormat(newNumFmtClone); } } @@ -617,7 +614,7 @@ DateFormat::getNumberFormat() const void DateFormat::adoptTimeZone(TimeZone* zone) { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { fCalendar->adoptTimeZone(zone); } } @@ -626,7 +623,7 @@ DateFormat::adoptTimeZone(TimeZone* zone) void DateFormat::setTimeZone(const TimeZone& zone) { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { fCalendar->setTimeZone(zone); } } @@ -636,7 +633,7 @@ DateFormat::setTimeZone(const TimeZone& zone) const TimeZone& DateFormat::getTimeZone() const { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { return fCalendar->getTimeZone(); } // If calendar doesn't exists, create default timezone. @@ -649,7 +646,7 @@ DateFormat::getTimeZone() const void DateFormat::setLenient(UBool lenient) { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { fCalendar->setLenient(lenient); } UErrorCode status = U_ZERO_ERROR; @@ -662,8 +659,8 @@ DateFormat::setLenient(UBool lenient) UBool DateFormat::isLenient() const { - UBool lenient = TRUE; - if (fCalendar != NULL) { + UBool lenient = true; + if (fCalendar != nullptr) { lenient = fCalendar->isLenient(); } UErrorCode status = U_ZERO_ERROR; @@ -675,7 +672,7 @@ DateFormat::isLenient() const void DateFormat::setCalendarLenient(UBool lenient) { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { fCalendar->setLenient(lenient); } } @@ -685,11 +682,11 @@ DateFormat::setCalendarLenient(UBool lenient) UBool DateFormat::isCalendarLenient() const { - if (fCalendar != NULL) { + if (fCalendar != nullptr) { return fCalendar->isLenient(); } // fCalendar is rarely null - return FALSE; + return false; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.cpp index f2fb87c12..294390cce 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.cpp @@ -14,23 +14,27 @@ #include "dayperiodrules.h" #include "unicode/ures.h" +#include "bytesinkutil.h" #include "charstr.h" #include "cstring.h" #include "ucln_in.h" #include "uhash.h" +#include "ulocimp.h" #include "umutex.h" #include "uresimp.h" U_NAMESPACE_BEGIN +namespace { + struct DayPeriodRulesData : public UMemory { - DayPeriodRulesData() : localeToRuleSetNumMap(NULL), rules(NULL), maxRuleSetNum(0) {} + DayPeriodRulesData() : localeToRuleSetNumMap(nullptr), rules(nullptr), maxRuleSetNum(0) {} UHashtable *localeToRuleSetNumMap; DayPeriodRules *rules; int32_t maxRuleSetNum; -} *data = NULL; +} *data = nullptr; enum CutoffType { CUTOFF_TYPE_UNKNOWN = -1, @@ -40,13 +44,15 @@ enum CutoffType { CUTOFF_TYPE_AT }; +} // namespace + struct DayPeriodRulesDataSink : public ResourceSink { DayPeriodRulesDataSink() { for (int32_t i = 0; i < UPRV_LENGTHOF(cutoffs); ++i) { cutoffs[i] = 0; } } virtual ~DayPeriodRulesDataSink(); - virtual void put(const char *key, ResourceValue &value, UBool, UErrorCode &errorCode) { + virtual void put(const char *key, ResourceValue &value, UBool, UErrorCode &errorCode) override { ResourceTable dayPeriodData = value.getTable(errorCode); if (U_FAILURE(errorCode)) { return; } @@ -63,7 +69,7 @@ struct DayPeriodRulesDataSink : public ResourceSink { } else if (uprv_strcmp(key, "rules") == 0) { // Allocate one more than needed to skip [0]. See comment in parseSetNum(). data->rules = new DayPeriodRules[data->maxRuleSetNum + 1]; - if (data->rules == NULL) { + if (data->rules == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -192,9 +198,9 @@ struct DayPeriodRulesDataSink : public ResourceSink { // AT cutoffs must be either midnight or noon. if (cutoffs[startHour] & (1 << CUTOFF_TYPE_AT)) { if (startHour == 0 && period == DayPeriodRules::DAYPERIOD_MIDNIGHT) { - rule.fHasMidnight = TRUE; + rule.fHasMidnight = true; } else if (startHour == 12 && period == DayPeriodRules::DAYPERIOD_NOON) { - rule.fHasNoon = TRUE; + rule.fHasNoon = true; } else { errorCode = U_INVALID_FORMAT_ERROR; // Bad data. return; @@ -278,7 +284,7 @@ struct DayPeriodRulesDataSink : public ResourceSink { struct DayPeriodRulesCountSink : public ResourceSink { virtual ~DayPeriodRulesCountSink(); - virtual void put(const char *key, ResourceValue &value, UBool, UErrorCode &errorCode) { + virtual void put(const char *key, ResourceValue &value, UBool, UErrorCode &errorCode) override { ResourceTable rules = value.getTable(errorCode); if (U_FAILURE(errorCode)) { return; } @@ -297,14 +303,14 @@ DayPeriodRulesCountSink::~DayPeriodRulesCountSink() {} namespace { -UInitOnce initOnce = U_INITONCE_INITIALIZER; +UInitOnce initOnce {}; U_CFUNC UBool U_CALLCONV dayPeriodRulesCleanup() { delete[] data->rules; uhash_close(data->localeToRuleSetNumMap); delete data; - data = NULL; - return TRUE; + data = nullptr; + return true; } } // namespace @@ -315,8 +321,8 @@ void U_CALLCONV DayPeriodRules::load(UErrorCode &errorCode) { } data = new DayPeriodRulesData(); - data->localeToRuleSetNumMap = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &errorCode); - LocalUResourceBundlePointer rb_dayPeriods(ures_openDirect(NULL, "dayPeriods", &errorCode)); + data->localeToRuleSetNumMap = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &errorCode); + LocalUResourceBundlePointer rb_dayPeriods(ures_openDirect(nullptr, "dayPeriods", &errorCode)); // Get the largest rule set number (so we allocate enough objects). DayPeriodRulesCountSink countSink; @@ -333,12 +339,11 @@ const DayPeriodRules *DayPeriodRules::getInstance(const Locale &locale, UErrorCo umtx_initOnce(initOnce, DayPeriodRules::load, errorCode); // If the entire day period rules data doesn't conform to spec (even if the part we want - // does), return NULL. - if(U_FAILURE(errorCode)) { return NULL; } + // does), return nullptr. + if(U_FAILURE(errorCode)) { return nullptr; } const char *localeCode = locale.getBaseName(); char name[ULOC_FULLNAME_CAPACITY]; - char parentName[ULOC_FULLNAME_CAPACITY]; if (uprv_strlen(localeCode) < ULOC_FULLNAME_CAPACITY) { uprv_strcpy(name, localeCode); @@ -349,20 +354,21 @@ const DayPeriodRules *DayPeriodRules::getInstance(const Locale &locale, UErrorCo } } else { errorCode = U_BUFFER_OVERFLOW_ERROR; - return NULL; + return nullptr; } int32_t ruleSetNum = 0; // NB there is no rule set 0 and 0 is returned upon lookup failure. while (*name != '\0') { ruleSetNum = uhash_geti(data->localeToRuleSetNumMap, name); if (ruleSetNum == 0) { - // name and parentName can't be the same pointer, so fill in parent then copy to child. - uloc_getParent(name, parentName, ULOC_FULLNAME_CAPACITY, &errorCode); - if (*parentName == '\0') { + CharString parent; + CharStringByteSink sink(&parent); + ulocimp_getParent(name, sink, &errorCode); + if (parent.isEmpty()) { // Saves a lookup in the hash table. break; } - uprv_strcpy(name, parentName); + parent.extract(name, UPRV_LENGTHOF(name), errorCode); } else { break; } @@ -371,13 +377,13 @@ const DayPeriodRules *DayPeriodRules::getInstance(const Locale &locale, UErrorCo if (ruleSetNum <= 0 || data->rules[ruleSetNum].getDayPeriodForHour(0) == DAYPERIOD_UNKNOWN) { // If day period for hour 0 is UNKNOWN then day period for all hours are UNKNOWN. // Data doesn't exist even with fallback. - return NULL; + return nullptr; } else { return &data->rules[ruleSetNum]; } } -DayPeriodRules::DayPeriodRules() : fHasMidnight(FALSE), fHasNoon(FALSE) { +DayPeriodRules::DayPeriodRules() : fHasMidnight(false), fHasNoon(false) { for (int32_t i = 0; i < 24; ++i) { fDayPeriodForHour[i] = DayPeriodRules::DAYPERIOD_UNKNOWN; } @@ -500,10 +506,10 @@ void DayPeriodRules::add(int32_t startHour, int32_t limitHour, DayPeriod period) UBool DayPeriodRules::allHoursAreSet() { for (int32_t i = 0; i < 24; ++i) { - if (fDayPeriodForHour[i] == DAYPERIOD_UNKNOWN) { return FALSE; } + if (fDayPeriodForHour[i] == DAYPERIOD_UNKNOWN) { return false; } } - return TRUE; + return true; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.h b/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.h index 610c6175b..4bfca762b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.h @@ -66,7 +66,7 @@ class DayPeriodRules : public UMemory { // Sets period type for all hours in [startHour, limitHour). void add(int32_t startHour, int32_t limitHour, DayPeriod period); - // Returns TRUE if for all i, DayPeriodForHour[i] has a type other than UNKNOWN. + // Returns true if for all i, DayPeriodForHour[i] has a type other than UNKNOWN. // Values of HasNoon and HasMidnight do not affect the return value. UBool allHoursAreSet(); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp index 6035c0091..ac1f77739 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp @@ -48,84 +48,85 @@ U_NAMESPACE_BEGIN UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DecimalFormatSymbols) -static const char dcfmtsym_gNumberElements[] = "NumberElements"; -static const char dcfmtsym_gCurrencySpacingTag[] = "currencySpacing"; -static const char dcfmtsym_gBeforeCurrencyTag[] = "beforeCurrency"; -static const char dcfmtsym_gAfterCurrencyTag[] = "afterCurrency"; -static const char dcfmtsym_gCurrencyMatchTag[] = "currencyMatch"; -static const char dcfmtsym_gCurrencySudMatchTag[] = "surroundingMatch"; -static const char dcfmtsym_gCurrencyInsertBtnTag[] = "insertBetween"; -static const char dcfmtsym_gLatn[] = "latn"; -static const char dcfmtsym_gSymbols[] = "symbols"; -static const char dcfmtsym_gNumberElementsLatnSymbols[] = "NumberElements/latn/symbols"; - -static const UChar INTL_CURRENCY_SYMBOL_STR[] = {0xa4, 0xa4, 0}; +static const char gNumberElements[] = "NumberElements"; +static const char gCurrencySpacingTag[] = "currencySpacing"; +static const char gBeforeCurrencyTag[] = "beforeCurrency"; +static const char gAfterCurrencyTag[] = "afterCurrency"; +static const char gCurrencyMatchTag[] = "currencyMatch"; +static const char gCurrencySudMatchTag[] = "surroundingMatch"; +static const char gCurrencyInsertBtnTag[] = "insertBetween"; +static const char gLatn[] = "latn"; +static const char gSymbols[] = "symbols"; +static const char gNumberElementsLatnSymbols[] = "NumberElements/latn/symbols"; + +static const char16_t INTL_CURRENCY_SYMBOL_STR[] = {0xa4, 0xa4, 0}; // List of field names to be loaded from the data files. // These are parallel with the enum ENumberFormatSymbol in unicode/dcfmtsym.h. static const char *gNumberElementKeys[DecimalFormatSymbols::kFormatSymbolCount] = { "decimal", "group", - NULL, /* #11897: the symbol is NOT the pattern separator symbol */ + nullptr, /* #11897: the symbol is NOT the pattern separator symbol */ "percentSign", - NULL, /* Native zero digit is deprecated from CLDR - get it from the numbering system */ - NULL, /* Pattern digit character is deprecated from CLDR - use # by default always */ + nullptr, /* Native zero digit is deprecated from CLDR - get it from the numbering system */ + nullptr, /* Pattern digit character is deprecated from CLDR - use # by default always */ "minusSign", "plusSign", - NULL, /* currency symbol - Wait until we know the currency before loading from CLDR */ - NULL, /* intl currency symbol - Wait until we know the currency before loading from CLDR */ + nullptr, /* currency symbol - Wait until we know the currency before loading from CLDR */ + nullptr, /* intl currency symbol - Wait until we know the currency before loading from CLDR */ "currencyDecimal", "exponential", "perMille", - NULL, /* Escape padding character - not in CLDR */ + nullptr, /* Escape padding character - not in CLDR */ "infinity", "nan", - NULL, /* Significant digit symbol - not in CLDR */ + nullptr, /* Significant digit symbol - not in CLDR */ "currencyGroup", - NULL, /* one digit - get it from the numbering system */ - NULL, /* two digit - get it from the numbering system */ - NULL, /* three digit - get it from the numbering system */ - NULL, /* four digit - get it from the numbering system */ - NULL, /* five digit - get it from the numbering system */ - NULL, /* six digit - get it from the numbering system */ - NULL, /* seven digit - get it from the numbering system */ - NULL, /* eight digit - get it from the numbering system */ - NULL, /* nine digit - get it from the numbering system */ + nullptr, /* one digit - get it from the numbering system */ + nullptr, /* two digit - get it from the numbering system */ + nullptr, /* three digit - get it from the numbering system */ + nullptr, /* four digit - get it from the numbering system */ + nullptr, /* five digit - get it from the numbering system */ + nullptr, /* six digit - get it from the numbering system */ + nullptr, /* seven digit - get it from the numbering system */ + nullptr, /* eight digit - get it from the numbering system */ + nullptr, /* nine digit - get it from the numbering system */ "superscriptingExponent", /* Multiplication (x) symbol for exponents */ + "approximatelySign" /* Approximately sign symbol */ }; // ------------------------------------- // Initializes this with the decimal format symbols in the default locale. DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status) - : UObject(), locale(), currPattern(NULL) { - initialize(locale, status, TRUE); + : UObject(), locale() { + initialize(locale, status, true); } // ------------------------------------- // Initializes this with the decimal format symbols in the desired locale. DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, UErrorCode& status) - : UObject(), locale(loc), currPattern(NULL) { + : UObject(), locale(loc) { initialize(locale, status); } DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, const NumberingSystem& ns, UErrorCode& status) - : UObject(), locale(loc), currPattern(NULL) { - initialize(locale, status, FALSE, &ns); + : UObject(), locale(loc) { + initialize(locale, status, false, &ns); } DecimalFormatSymbols::DecimalFormatSymbols() - : UObject(), locale(Locale::getRoot()), currPattern(NULL) { + : UObject(), locale(Locale::getRoot()) { *validLocale = *actualLocale = 0; initialize(); } DecimalFormatSymbols* DecimalFormatSymbols::createWithLastResortData(UErrorCode& status) { - if (U_FAILURE(status)) { return NULL; } + if (U_FAILURE(status)) { return nullptr; } DecimalFormatSymbols* sym = new DecimalFormatSymbols(); - if (sym == NULL) { + if (sym == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } return sym; @@ -164,9 +165,11 @@ DecimalFormatSymbols::operator=(const DecimalFormatSymbols& rhs) locale = rhs.locale; uprv_strcpy(validLocale, rhs.validLocale); uprv_strcpy(actualLocale, rhs.actualLocale); - fIsCustomCurrencySymbol = rhs.fIsCustomCurrencySymbol; - fIsCustomIntlCurrencySymbol = rhs.fIsCustomIntlCurrencySymbol; + fIsCustomCurrencySymbol = rhs.fIsCustomCurrencySymbol; + fIsCustomIntlCurrencySymbol = rhs.fIsCustomIntlCurrencySymbol; fCodePointZero = rhs.fCodePointZero; + currPattern = rhs.currPattern; + uprv_strcpy(nsName, rhs.nsName); } return *this; } @@ -177,25 +180,25 @@ bool DecimalFormatSymbols::operator==(const DecimalFormatSymbols& that) const { if (this == &that) { - return TRUE; - } - if (fIsCustomCurrencySymbol != that.fIsCustomCurrencySymbol) { - return FALSE; - } - if (fIsCustomIntlCurrencySymbol != that.fIsCustomIntlCurrencySymbol) { - return FALSE; + return true; } + if (fIsCustomCurrencySymbol != that.fIsCustomCurrencySymbol) { + return false; + } + if (fIsCustomIntlCurrencySymbol != that.fIsCustomIntlCurrencySymbol) { + return false; + } for(int32_t i = 0; i < (int32_t)kFormatSymbolCount; ++i) { if(fSymbols[(ENumberFormatSymbol)i] != that.fSymbols[(ENumberFormatSymbol)i]) { - return FALSE; + return false; } } for(int32_t i = 0; i < (int32_t)UNUM_CURRENCY_SPACING_COUNT; ++i) { if(currencySpcBeforeSym[i] != that.currencySpcBeforeSym[i]) { - return FALSE; + return false; } if(currencySpcAfterSym[i] != that.currencySpcAfterSym[i]) { - return FALSE; + return false; } } // No need to check fCodePointZero since it is based on fSymbols @@ -220,24 +223,24 @@ struct DecFmtSymDataSink : public ResourceSink { // Destination for data, modified via setters. DecimalFormatSymbols& dfs; // Boolean array of whether or not we have seen a particular symbol yet. - // Can't simpy check fSymbols because it is pre-populated with defaults. + // Can't simply check fSymbols because it is pre-populated with defaults. UBool seenSymbol[DecimalFormatSymbols::kFormatSymbolCount]; // Constructor/Destructor DecFmtSymDataSink(DecimalFormatSymbols& _dfs) : dfs(_dfs) { - uprv_memset(seenSymbol, FALSE, sizeof(seenSymbol)); + uprv_memset(seenSymbol, false, sizeof(seenSymbol)); } virtual ~DecFmtSymDataSink(); virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { + UErrorCode &errorCode) override { ResourceTable symbolsTable = value.getTable(errorCode); if (U_FAILURE(errorCode)) { return; } for (int32_t j = 0; symbolsTable.getKeyAndValue(j, key, value); ++j) { for (int32_t i=0; insName, nsName); // Open resource bundles const char* locStr = loc.getName(); - LocalUResourceBundlePointer resource(ures_open(NULL, locStr, &status)); + LocalUResourceBundlePointer resource(ures_open(nullptr, locStr, &status)); LocalUResourceBundlePointer numberElementsRes( - ures_getByKeyWithFallback(resource.getAlias(), dcfmtsym_gNumberElements, NULL, &status)); + ures_getByKeyWithFallback(resource.getAlias(), gNumberElements, nullptr, &status)); if (U_FAILURE(status)) { if ( useLastResortData ) { @@ -408,13 +414,13 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status, // Now load the rest of the data from the data sink. // Start with loading this nsName if it is not Latin. DecFmtSymDataSink sink(*this); - if (uprv_strcmp(nsName, dcfmtsym_gLatn) != 0) { + if (uprv_strcmp(nsName, gLatn) != 0) { CharString path; - path.append(dcfmtsym_gNumberElements, status) + path.append(gNumberElements, status) .append('/', status) .append(nsName, status) .append('/', status) - .append(dcfmtsym_gSymbols, status); + .append(gSymbols, status); ures_getAllItemsWithFallback(resource.getAlias(), path.data(), sink, status); // If no symbols exist for the given nsName and resource bundle, silently ignore @@ -428,7 +434,7 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status, // Continue with Latin if necessary. if (!sink.seenAll()) { - ures_getAllItemsWithFallback(resource.getAlias(), dcfmtsym_gNumberElementsLatnSymbols, sink, status); + ures_getAllItemsWithFallback(resource.getAlias(), gNumberElementsLatnSymbols, sink, status); if (U_FAILURE(status)) { return; } } @@ -453,63 +459,21 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status, } fCodePointZero = tempCodePointZero; - // Obtain currency data from the currency API. This is strictly - // for backward compatibility; we don't use DecimalFormatSymbols - // for currency data anymore. + // Get the default currency from the currency API. UErrorCode internalStatus = U_ZERO_ERROR; // don't propagate failures out - UChar curriso[4]; + char16_t curriso[4]; UnicodeString tempStr; int32_t currisoLength = ucurr_forLocale(locStr, curriso, UPRV_LENGTHOF(curriso), &internalStatus); if (U_SUCCESS(internalStatus) && currisoLength == 3) { - uprv_getStaticCurrencyName(curriso, locStr, tempStr, internalStatus); - if (U_SUCCESS(internalStatus)) { - fSymbols[kIntlCurrencySymbol].setTo(curriso, currisoLength); - fSymbols[kCurrencySymbol] = tempStr; - } - } - /* else use the default values. */ - - //load the currency data - UChar ucc[4]={0}; //Currency Codes are always 3 chars long - int32_t uccLen = 4; - const char* locName = loc.getName(); - UErrorCode localStatus = U_ZERO_ERROR; - uccLen = ucurr_forLocale(locName, ucc, uccLen, &localStatus); - - // TODO: Currency pattern data loading is duplicated in number_formatimpl.cpp - if(U_SUCCESS(localStatus) && uccLen > 0) { - char cc[4]={0}; - u_UCharsToChars(ucc, cc, uccLen); - /* An explicit currency was requested */ - LocalUResourceBundlePointer currencyResource(ures_open(U_ICUDATA_CURR, locStr, &localStatus)); - LocalUResourceBundlePointer currency( - ures_getByKeyWithFallback(currencyResource.getAlias(), "Currencies", NULL, &localStatus)); - ures_getByKeyWithFallback(currency.getAlias(), cc, currency.getAlias(), &localStatus); - if(U_SUCCESS(localStatus) && ures_getSize(currency.getAlias())>2) { // the length is 3 if more data is present - ures_getByIndex(currency.getAlias(), 2, currency.getAlias(), &localStatus); - int32_t currPatternLen = 0; - currPattern = - ures_getStringByIndex(currency.getAlias(), (int32_t)0, &currPatternLen, &localStatus); - UnicodeString decimalSep = - ures_getUnicodeStringByIndex(currency.getAlias(), (int32_t)1, &localStatus); - UnicodeString groupingSep = - ures_getUnicodeStringByIndex(currency.getAlias(), (int32_t)2, &localStatus); - if(U_SUCCESS(localStatus)){ - fSymbols[kMonetaryGroupingSeparatorSymbol] = groupingSep; - fSymbols[kMonetarySeparatorSymbol] = decimalSep; - //pattern.setTo(TRUE, currPattern, currPatternLen); - status = localStatus; - } - } - /* else An explicit currency was requested and is unknown or locale data is malformed. */ - /* ucurr_* API will get the correct value later on. */ + setCurrency(curriso, status); + } else { + setCurrency(nullptr, status); } - // else ignore the error if no currency // Currency Spacing. LocalUResourceBundlePointer currencyResource(ures_open(U_ICUDATA_CURR, locStr, &status)); CurrencySpacingSink currencySink(*this); - ures_getAllItemsWithFallback(currencyResource.getAlias(), dcfmtsym_gCurrencySpacingTag, currencySink, status); + ures_getAllItemsWithFallback(currencyResource.getAlias(), gCurrencySpacingTag, currencySink, status); currencySink.resolveMissing(); if (U_FAILURE(status)) { return; } } @@ -521,39 +485,85 @@ DecimalFormatSymbols::initialize() { * cannot initialize a static array with class constructors. * markus 2000may25 */ - fSymbols[kDecimalSeparatorSymbol] = (UChar)0x2e; // '.' decimal separator + fSymbols[kDecimalSeparatorSymbol] = (char16_t)0x2e; // '.' decimal separator fSymbols[kGroupingSeparatorSymbol].remove(); // group (thousands) separator - fSymbols[kPatternSeparatorSymbol] = (UChar)0x3b; // ';' pattern separator - fSymbols[kPercentSymbol] = (UChar)0x25; // '%' percent sign - fSymbols[kZeroDigitSymbol] = (UChar)0x30; // '0' native 0 digit - fSymbols[kOneDigitSymbol] = (UChar)0x31; // '1' native 1 digit - fSymbols[kTwoDigitSymbol] = (UChar)0x32; // '2' native 2 digit - fSymbols[kThreeDigitSymbol] = (UChar)0x33; // '3' native 3 digit - fSymbols[kFourDigitSymbol] = (UChar)0x34; // '4' native 4 digit - fSymbols[kFiveDigitSymbol] = (UChar)0x35; // '5' native 5 digit - fSymbols[kSixDigitSymbol] = (UChar)0x36; // '6' native 6 digit - fSymbols[kSevenDigitSymbol] = (UChar)0x37; // '7' native 7 digit - fSymbols[kEightDigitSymbol] = (UChar)0x38; // '8' native 8 digit - fSymbols[kNineDigitSymbol] = (UChar)0x39; // '9' native 9 digit - fSymbols[kDigitSymbol] = (UChar)0x23; // '#' pattern digit - fSymbols[kPlusSignSymbol] = (UChar)0x002b; // '+' plus sign - fSymbols[kMinusSignSymbol] = (UChar)0x2d; // '-' minus sign - fSymbols[kCurrencySymbol] = (UChar)0xa4; // 'OX' currency symbol - fSymbols[kIntlCurrencySymbol].setTo(TRUE, INTL_CURRENCY_SYMBOL_STR, 2); - fSymbols[kMonetarySeparatorSymbol] = (UChar)0x2e; // '.' monetary decimal separator - fSymbols[kExponentialSymbol] = (UChar)0x45; // 'E' exponential - fSymbols[kPerMillSymbol] = (UChar)0x2030; // '%o' per mill - fSymbols[kPadEscapeSymbol] = (UChar)0x2a; // '*' pad escape symbol - fSymbols[kInfinitySymbol] = (UChar)0x221e; // 'oo' infinite - fSymbols[kNaNSymbol] = (UChar)0xfffd; // SUB NaN - fSymbols[kSignificantDigitSymbol] = (UChar)0x0040; // '@' significant digit - fSymbols[kMonetaryGroupingSeparatorSymbol].remove(); // - fSymbols[kExponentMultiplicationSymbol] = (UChar)0xd7; // 'x' multiplication symbol for exponents - fIsCustomCurrencySymbol = FALSE; - fIsCustomIntlCurrencySymbol = FALSE; + fSymbols[kPatternSeparatorSymbol] = (char16_t)0x3b; // ';' pattern separator + fSymbols[kPercentSymbol] = (char16_t)0x25; // '%' percent sign + fSymbols[kZeroDigitSymbol] = (char16_t)0x30; // '0' native 0 digit + fSymbols[kOneDigitSymbol] = (char16_t)0x31; // '1' native 1 digit + fSymbols[kTwoDigitSymbol] = (char16_t)0x32; // '2' native 2 digit + fSymbols[kThreeDigitSymbol] = (char16_t)0x33; // '3' native 3 digit + fSymbols[kFourDigitSymbol] = (char16_t)0x34; // '4' native 4 digit + fSymbols[kFiveDigitSymbol] = (char16_t)0x35; // '5' native 5 digit + fSymbols[kSixDigitSymbol] = (char16_t)0x36; // '6' native 6 digit + fSymbols[kSevenDigitSymbol] = (char16_t)0x37; // '7' native 7 digit + fSymbols[kEightDigitSymbol] = (char16_t)0x38; // '8' native 8 digit + fSymbols[kNineDigitSymbol] = (char16_t)0x39; // '9' native 9 digit + fSymbols[kDigitSymbol] = (char16_t)0x23; // '#' pattern digit + fSymbols[kPlusSignSymbol] = (char16_t)0x002b; // '+' plus sign + fSymbols[kMinusSignSymbol] = (char16_t)0x2d; // '-' minus sign + fSymbols[kCurrencySymbol] = (char16_t)0xa4; // 'OX' currency symbol + fSymbols[kIntlCurrencySymbol].setTo(true, INTL_CURRENCY_SYMBOL_STR, 2); + fSymbols[kMonetarySeparatorSymbol] = (char16_t)0x2e; // '.' monetary decimal separator + fSymbols[kExponentialSymbol] = (char16_t)0x45; // 'E' exponential + fSymbols[kPerMillSymbol] = (char16_t)0x2030; // '%o' per mill + fSymbols[kPadEscapeSymbol] = (char16_t)0x2a; // '*' pad escape symbol + fSymbols[kInfinitySymbol] = (char16_t)0x221e; // 'oo' infinite + fSymbols[kNaNSymbol] = (char16_t)0xfffd; // SUB NaN + fSymbols[kSignificantDigitSymbol] = (char16_t)0x0040; // '@' significant digit + fSymbols[kMonetaryGroupingSeparatorSymbol].remove(); // + fSymbols[kExponentMultiplicationSymbol] = (char16_t)0xd7; // 'x' multiplication symbol for exponents + fSymbols[kApproximatelySignSymbol] = u'~'; // '~' approximately sign + fIsCustomCurrencySymbol = false; + fIsCustomIntlCurrencySymbol = false; fCodePointZero = 0x30; U_ASSERT(fCodePointZero == fSymbols[kZeroDigitSymbol].char32At(0)); + currPattern = nullptr; + nsName[0] = 0; +} + +void DecimalFormatSymbols::setCurrency(const char16_t* currency, UErrorCode& status) { + // TODO: If this method is made public: + // - Adopt ICU4J behavior of not allowing currency to be null. + // - Also verify that the length of currency is 3. + if (!currency) { + return; + } + UnicodeString tempStr; + uprv_getStaticCurrencyName(currency, locale.getName(), tempStr, status); + if (U_SUCCESS(status)) { + fSymbols[kIntlCurrencySymbol].setTo(currency, 3); + fSymbols[kCurrencySymbol] = tempStr; + } + + char cc[4]={0}; + u_UCharsToChars(currency, cc, 3); + + /* An explicit currency was requested */ + // TODO(ICU-13297): Move this data loading logic into a centralized place + UErrorCode localStatus = U_ZERO_ERROR; + LocalUResourceBundlePointer rbTop(ures_open(U_ICUDATA_CURR, locale.getName(), &localStatus)); + LocalUResourceBundlePointer rb( + ures_getByKeyWithFallback(rbTop.getAlias(), "Currencies", nullptr, &localStatus)); + ures_getByKeyWithFallback(rb.getAlias(), cc, rb.getAlias(), &localStatus); + if(U_SUCCESS(localStatus) && ures_getSize(rb.getAlias())>2) { // the length is 3 if more data is present + ures_getByIndex(rb.getAlias(), 2, rb.getAlias(), &localStatus); + int32_t currPatternLen = 0; + currPattern = + ures_getStringByIndex(rb.getAlias(), (int32_t)0, &currPatternLen, &localStatus); + UnicodeString decimalSep = + ures_getUnicodeStringByIndex(rb.getAlias(), (int32_t)1, &localStatus); + UnicodeString groupingSep = + ures_getUnicodeStringByIndex(rb.getAlias(), (int32_t)2, &localStatus); + if(U_SUCCESS(localStatus)){ + fSymbols[kMonetaryGroupingSeparatorSymbol] = groupingSep; + fSymbols[kMonetarySeparatorSymbol] = decimalSep; + //pattern.setTo(true, currPattern, currPatternLen); + } + } + /* else An explicit currency was requested and is unknown or locale data is malformed. */ + /* ucurr_* API will get the correct value later on. */ } Locale diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/decContext.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/decContext.cpp index 6ec6d32af..bdc5f22fe 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/decContext.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/decContext.cpp @@ -150,7 +150,7 @@ U_CAPI uInt U_EXPORT2 uprv_decContextGetStatus(decContext *context) { /* newstatus is the source for the bits to be restored */ /* mask indicates the bits to be restored (the status bit that */ /* corresponds to each 1 bit in the mask is set to the value of */ -/* the correspnding bit in newstatus) */ +/* the corresponding bit in newstatus) */ /* returns context */ /* */ /* No error is possible. */ @@ -219,7 +219,7 @@ U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatus(decContext *context, uIn /* is raised if appropriate. */ /* */ /* returns the context structure, unless the string is equal to */ -/* DEC_Condition_MU or is not recognized. In these cases NULL is */ +/* DEC_Condition_MU or is not recognized. In these cases nullptr is */ /* returned. */ /* ------------------------------------------------------------------ */ U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromString(decContext *context, @@ -256,7 +256,7 @@ U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromString(decContext *co return uprv_decContextSetStatus(context, DEC_Underflow); if (strcmp(string, DEC_Condition_ZE)==0) return context; - return NULL; /* Multiple status, or unknown */ + return nullptr; /* Multiple status, or unknown */ } /* decContextSetStatusFromString */ /* ------------------------------------------------------------------ */ @@ -270,7 +270,7 @@ U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromString(decContext *co /* raised. */ /* */ /* returns the context structure, unless the string is equal to */ -/* DEC_Condition_MU or is not recognized. In these cases NULL is */ +/* DEC_Condition_MU or is not recognized. In these cases nullptr is */ /* returned. */ /* ------------------------------------------------------------------ */ U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContext *context, @@ -307,7 +307,7 @@ U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContex return uprv_decContextSetStatusQuiet(context, DEC_Underflow); if (strcmp(string, DEC_Condition_ZE)==0) return context; - return NULL; /* Multiple status, or unknown */ + return nullptr; /* Multiple status, or unknown */ } /* decContextSetStatusFromStringQuiet */ /* ------------------------------------------------------------------ */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/decContext.h b/src/duckdb/extension/icu/third_party/icu/i18n/decContext.h index 11d867f20..91c673973 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/decContext.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/decContext.h @@ -19,10 +19,8 @@ /* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */ /* ------------------------------------------------------------------ */ -#ifndef DECCONTEXT_H_ -#define DECCONTEXT_H_ /* Modified version, for use from within ICU. - * Renamed public functions, to avoid an unwanted export of the + * Renamed public functions, to avoid an unwanted export of the * standard names from the ICU library. * * Use ICU's uprv_malloc() and uprv_free() @@ -53,6 +51,8 @@ /* */ /* ------------------------------------------------------------------ */ +#if !defined(DECCONTEXT) + #define DECCONTEXT #define DECCNAME "decContext" /* Short name */ #define DECCFULLNAME "Decimal Context Descriptor" /* Verbose name */ #define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */ @@ -60,8 +60,8 @@ #if !defined(int32_t) /* #include */ /* C99 standard integers */ #endif -#include /* for printf, etc. */ -#include /* for traps */ + #include /* for printf, etc. */ + #include /* for traps */ /* Extended flags setting -- set this to 0 to use only IEEE flags */ #if !defined(DECEXTFLAG) @@ -250,21 +250,20 @@ #define DEC_INIT_DECQUAD DEC_INIT_DECIMAL128 /* decContext routines */ - U_INTERNAL decContext * U_EXPORT2 uprv_decContextClearStatus(decContext *, uint32_t); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextDefault(decContext *, int32_t); - U_INTERNAL enum rounding U_EXPORT2 uprv_decContextGetRounding(decContext *); - U_INTERNAL uint32_t U_EXPORT2 uprv_decContextGetStatus(decContext *); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextRestoreStatus(decContext *, uint32_t, uint32_t); - U_INTERNAL uint32_t U_EXPORT2 uprv_decContextSaveStatus(decContext *, uint32_t); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextSetRounding(decContext *, enum rounding); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextSetStatus(decContext *, uint32_t); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextSetStatusFromString(decContext *, const char *); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContext *, const char *); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextSetStatusQuiet(decContext *, uint32_t); - U_INTERNAL const char * U_EXPORT2 uprv_decContextStatusToString(const decContext *); - U_INTERNAL int32_t U_EXPORT2 uprv_decContextTestEndian(uint8_t); - U_INTERNAL uint32_t U_EXPORT2 uprv_decContextTestSavedStatus(uint32_t, uint32_t); - U_INTERNAL uint32_t U_EXPORT2 uprv_decContextTestStatus(decContext *, uint32_t); - U_INTERNAL decContext * U_EXPORT2 uprv_decContextZeroStatus(decContext *); + U_CAPI decContext * U_EXPORT2 uprv_decContextClearStatus(decContext *, uint32_t); + U_CAPI decContext * U_EXPORT2 uprv_decContextDefault(decContext *, int32_t); + U_CAPI enum rounding U_EXPORT2 uprv_decContextGetRounding(decContext *); + U_CAPI uint32_t U_EXPORT2 uprv_decContextGetStatus(decContext *); + U_CAPI decContext * U_EXPORT2 uprv_decContextRestoreStatus(decContext *, uint32_t, uint32_t); + U_CAPI uint32_t U_EXPORT2 uprv_decContextSaveStatus(decContext *, uint32_t); + U_CAPI decContext * U_EXPORT2 uprv_decContextSetRounding(decContext *, enum rounding); + U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatus(decContext *, uint32_t); + U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromString(decContext *, const char *); + U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContext *, const char *); + U_CAPI decContext * U_EXPORT2 uprv_decContextSetStatusQuiet(decContext *, uint32_t); + U_CAPI const char * U_EXPORT2 uprv_decContextStatusToString(const decContext *); + U_CAPI uint32_t U_EXPORT2 uprv_decContextTestSavedStatus(uint32_t, uint32_t); + U_CAPI uint32_t U_EXPORT2 uprv_decContextTestStatus(decContext *, uint32_t); + U_CAPI decContext * U_EXPORT2 uprv_decContextZeroStatus(decContext *); #endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.cpp index e35fb8895..42da36dc4 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.cpp @@ -20,7 +20,7 @@ /* ------------------------------------------------------------------ */ /* Modified version, for use from within ICU. - * Renamed public functions, to avoid an unwanted export of the + * Renamed public functions, to avoid an unwanted export of the * standard names from the ICU library. * * Use ICU's uprv_malloc() and uprv_free() @@ -95,11 +95,11 @@ /* conversions are available in separate modules. */ /* */ /* 7. Normally, input operands are assumed to be valid. Set DECCHECK */ -/* to 1 for extended operand checking (including NULL operands). */ -/* Results are undefined if a badly-formed structure (or a NULL */ +/* to 1 for extended operand checking (including nullptr operands). */ +/* Results are undefined if a badly-formed structure (or a nullptr */ /* pointer to a structure) is provided, though with DECCHECK */ /* enabled the operator routines are protected against exceptions. */ -/* (Except if the result pointer is NULL, which is unrecoverable.) */ +/* (Except if the result pointer is nullptr, which is unrecoverable.) */ /* */ /* However, the routines will never cause exceptions if they are */ /* given well-formed operands, even if the value of the operands */ @@ -189,28 +189,28 @@ /* Public lookup table used by the D2U macro */ static const uByte d2utable[DECMAXD2U+1]=D2UTABLE; -#define DECNUMBER_DECVERB 1 /* set to 1 for verbose DECCHECK */ -#define DECNUMBER_powers DECPOWERS /* old internal name */ +#define DECVERB 1 /* set to 1 for verbose DECCHECK */ +#define powers DECPOWERS /* old internal name */ /* Local constants */ -#define DECNUMBER_DIVIDE 0x80 /* Divide operators */ -#define DECNUMBER_REMAINDER 0x40 /* .. */ -#define DECNUMBER_DIVIDEINT 0x20 /* .. */ -#define DECNUMBER_REMNEAR 0x10 /* .. */ -#define DECNUMBER_COMPARE 0x01 /* Compare operators */ -#define DECNUMBER_COMPMAX 0x02 /* .. */ -#define DECNUMBER_COMPMIN 0x03 /* .. */ -#define DECNUMBER_COMPTOTAL 0x04 /* .. */ -#define DECNUMBER_COMPNAN 0x05 /* .. [NaN processing] */ -#define DECNUMBER_COMPSIG 0x06 /* .. [signaling DECNUMBER_COMPARE] */ -#define DECNUMBER_COMPMAXMAG 0x07 /* .. */ -#define DECNUMBER_COMPMINMAG 0x08 /* .. */ - -#define DECNUMBER_DEC_sNaN 0x40000000 /* local status: sNaN signal */ -#define DECNUMBER_BADINT (Int)0x80000000 /* most-negative Int; error indicator */ +#define DIVIDE 0x80 /* Divide operators */ +#define REMAINDER 0x40 /* .. */ +#define DIVIDEINT 0x20 /* .. */ +#define REMNEAR 0x10 /* .. */ +#define COMPARE 0x01 /* Compare operators */ +#define COMPMAX 0x02 /* .. */ +#define COMPMIN 0x03 /* .. */ +#define COMPTOTAL 0x04 /* .. */ +#define COMPNAN 0x05 /* .. [NaN processing] */ +#define COMPSIG 0x06 /* .. [signaling COMPARE] */ +#define COMPMAXMAG 0x07 /* .. */ +#define COMPMINMAG 0x08 /* .. */ + +#define DEC_sNaN 0x40000000 /* local status: sNaN signal */ +#define BADINT (Int)0x80000000 /* most-negative Int; error indicator */ /* Next two indicate an integer >= 10**6, and its parity (bottom bit) */ -#define DECNUMBER_BIGEVEN (Int)0x80000002 -#define DECNUMBER_BIGODD (Int)0x80000003 +#define BIGEVEN (Int)0x80000002 +#define BIGODD (Int)0x80000003 static const Unit uarrone[1]={1}; /* Unit array of 1, used for incrementing */ @@ -222,7 +222,7 @@ static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */ #endif /* ------------------------------------------------------------------ */ -/* Powers of ten (DECNUMBER_powers[n]==10**n, 0<=n<=9) */ +/* Powers of ten (powers[n]==10**n, 0<=n<=9) */ /* ------------------------------------------------------------------ */ static const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; @@ -233,7 +233,7 @@ static const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000, #define eInt Int /* extended integer */ #define ueInt uInt /* unsigned extended integer */ /* Constant multipliers for divide-by-power-of five using reciprocal */ - /* multiply, after removing DECNUMBER_powers of 2 by shifting, and final shift */ + /* multiply, after removing powers of 2 by shifting, and final shift */ /* of 17 [we only need up to **4] */ static const uInt multies[]={131073, 26215, 5243, 1049, 210}; /* QUOT10 -- macro to return the quotient of unit u divided by 10**n */ @@ -305,21 +305,21 @@ static decNumber * decRoundOperand(const decNumber *, decContext *, uInt *); #define SPECIALARG (rhs->bits & DECSPECIAL) #define SPECIALARGS ((lhs->bits | rhs->bits) & DECSPECIAL) -// /* For use in ICU */ -// #define malloc(a) uprv_malloc(a) -// #define free(a) uprv_free(a) +/* For use in ICU */ +#define malloc(a) uprv_malloc(a) +#define free(a) uprv_free(a) /* Diagnostic macros, etc. */ #if DECALLOC /* Handle malloc/free accounting. If enabled, our accountable routines */ /* are used; otherwise the code just goes straight to the system malloc */ -// /* and free routines. */ -// #define malloc(a) decMalloc(a) -// #define free(a) decFree(a) +/* and free routines. */ +#define malloc(a) decMalloc(a) +#define free(a) decFree(a) #define DECFENCE 0x5a /* corruption detector */ /* 'Our' malloc and free: */ -// static void *decMalloc(size_t); -// static void decFree(void *); +static void *decMalloc(size_t); +static void decFree(void *); uInt decAllocBytes=0; /* count of bytes allocated */ /* Note that DECALLOC code only checks for storage buffer overflow. */ /* To check for memory leaks, the decAllocBytes variable must be */ @@ -368,8 +368,8 @@ static void decDumpAr(char, const Unit *, Int); U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromInt32(decNumber *dn, Int in) { uInt unsig; if (in>=0) unsig=in; - else { /* negative (possibly DECNUMBER_BADINT) */ - if (in==DECNUMBER_BADINT) unsig=(uInt)1073741824*2; /* special case */ + else { /* negative (possibly BADINT) */ + if (in==BADINT) unsig=(uInt)1073741824*2; /* special case */ else unsig=-in; /* invert */ } /* in is now positive */ @@ -419,7 +419,7 @@ U_CAPI Int U_EXPORT2 uprv_decNumberToInt32(const decNumber *dn, decContext *set) #endif up++; /* collect remaining Units, if any, into hi */ - for (d=DECDPUN; ddigits; up++, d+=DECDPUN) hi+=*up*DECNUMBER_powers[d-1]; + for (d=DECDPUN; ddigits; up++, d+=DECDPUN) hi+=*up*powers[d-1]; /* now low has the lsd, hi the remainder */ if (hi>214748364 || (hi==214748364 && lo>7)) { /* out of range? */ /* most-negative is a reprieve */ @@ -455,7 +455,7 @@ U_CAPI uInt U_EXPORT2 uprv_decNumberToUInt32(const decNumber *dn, decContext *se #endif up++; /* collect remaining Units, if any, into hi */ - for (d=DECDPUN; ddigits; up++, d+=DECDPUN) hi+=*up*DECNUMBER_powers[d-1]; + for (d=DECDPUN; ddigits; up++, d+=DECDPUN) hi+=*up*powers[d-1]; /* now low has the lsd, hi the remainder */ if (hi>429496729 || (hi==429496729 && lo>5)) ; /* no reprieve possible */ @@ -516,11 +516,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char Unit *res; /* where result will be built */ Unit resbuff[SD2U(DECBUFFER+9)];/* local buffer in case need temporary */ /* [+9 allows for ln() constants] */ - Unit *allocres=NULL; /* -> allocated result, iff allocated */ + Unit *allocres=nullptr; /* -> allocated result, iff allocated */ Int d=0; /* count of digits found in decimal part */ - const char *dotchar=NULL; /* where dot was found */ + const char *dotchar=nullptr; /* where dot was found */ const char *cfirst=chars; /* -> first character of decimal part */ - const char *last=NULL; /* -> last digit of decimal part */ + const char *last=nullptr; /* -> last digit of decimal part */ const char *c; /* work */ Unit *up; /* .. */ #if DECDPUN>1 @@ -541,7 +541,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char d++; /* count of real digits */ continue; /* still in decimal part */ } - if (*c=='.' && dotchar==NULL) { /* first '.' */ + if (*c=='.' && dotchar==nullptr) { /* first '.' */ dotchar=c; /* record offset into decimal part */ if (c==cfirst) cfirst++; /* first digit must follow */ continue;} @@ -558,7 +558,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char break; } /* c */ - if (last==NULL) { /* no digits yet */ + if (last==nullptr) { /* no digits yet */ status=DEC_Conversion_syntax;/* assume the worst */ if (*c=='\0') break; /* and no more to come... */ #if DECSUBSET @@ -566,7 +566,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char if (!set->extended) break; /* hopeless */ #endif /* Infinities and NaNs are possible, here */ - if (dotchar!=NULL) break; /* .. unless had a dot */ + if (dotchar!=nullptr) break; /* .. unless had a dot */ uprv_decNumberZero(dn); /* be optimistic */ if (decBiStr(c, "infinity", "INFINITY") || decBiStr(c, "inf", "INF")) { @@ -609,7 +609,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char /* good; drop through to convert the integer to coefficient */ status=0; /* syntax is OK */ bits=dn->bits; /* for copy-back */ - } /* last==NULL */ + } /* last==nullptr */ else if (*c!='\0') { /* more to process... */ /* had some digits; exponent is only valid sequence now */ @@ -667,7 +667,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char } /* at least one leading 0 */ /* Handle decimal point... */ - if (dotchar!=NULL && dotchar(last-dotchar); /* adjust exponent */ /* [we can now ignore the .] */ @@ -679,7 +679,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char res=resbuff; /* assume use local buffer */ if (needbytes>(Int)sizeof(resbuff)) { /* too big for local */ allocres=(Unit *)malloc(needbytes); - if (allocres==NULL) {status|=DEC_Insufficient_storage; break;} + if (allocres==nullptr) {status|=DEC_Insufficient_storage; break;} res=allocres; } } @@ -736,7 +736,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char /* decNumberShow(dn); */ } while(0); /* [for break] */ - if (allocres!=NULL) free(allocres); /* drop any storage used */ + if (allocres!=nullptr) free(allocres); /* drop any storage used */ if (status!=0) decStatus(dn, status, set); return dn; } /* decNumberFromString */ @@ -854,7 +854,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberAnd(decNumber *res, const decNumber * *uc=0; /* can now write back */ /* This loop could be unrolled and/or use BIN2BCD tables */ for (i=0; i allocated bufa, iff allocated */ + decNumber *allocbufa=nullptr; /* -> allocated bufa, iff allocated */ decNumber bufb[D2N(DECBUFFER+1)]; - decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */ + decNumber *allocbufb=nullptr; /* -> allocated bufb, iff allocated */ decNumber *a, *b; /* temporary pointers */ #if DECCHECK @@ -969,7 +969,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const needbytes=sizeof(decNumber)+(D2U(lhs->digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { /* need malloc space */ allocbufa=(decNumber *)malloc(needbytes); - if (allocbufa==NULL) { /* hopeless -- abandon */ + if (allocbufa==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} a=allocbufa; /* use the allocated space */ @@ -983,7 +983,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufb)) { /* need malloc space */ allocbufb=(decNumber *)malloc(needbytes); - if (allocbufb==NULL) { /* hopeless -- abandon */ + if (allocbufb==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} b=allocbufb; /* use the allocated space */ @@ -992,11 +992,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const b->bits&=~DECNEG; /* .. and clear the sign */ rhs=b; /* use copy from here on */ } - decCompareOp(res, lhs, rhs, set, DECNUMBER_COMPTOTAL, &status); + decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status); } while(0); /* end protected */ - if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */ - if (allocbufb!=NULL) free(allocbufb); /* .. */ + if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used */ + if (allocbufb!=nullptr) free(allocbufb); /* .. */ if (status!=0) decStatus(res, status, set); return res; } /* decNumberCompareTotalMag */ @@ -1016,7 +1016,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivide(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decDivideOp(res, lhs, rhs, set, DECNUMBER_DIVIDE, &status); + decDivideOp(res, lhs, rhs, set, DIVIDE, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -1039,7 +1039,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivide(decNumber *res, const decNumbe U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivideInteger(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decDivideOp(res, lhs, rhs, set, DECNUMBER_DIVIDEINT, &status); + decDivideOp(res, lhs, rhs, set, DIVIDEINT, &status); if (status!=0) decStatus(res, status, set); return res; } /* decNumberDivideInteger */ @@ -1073,7 +1073,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber * decContext *set) { uInt status=0; /* accumulator */ #if DECSUBSET - decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */ + decNumber *allocrhs=nullptr; /* non-nullptr if rounded rhs allocated */ #endif #if DECCHECK @@ -1090,7 +1090,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber * /* reduce operand and set lostDigits status, as needed */ if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } } @@ -1099,7 +1099,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber * } while(0); /* end protected */ #if DECSUBSET - if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */ + if (allocrhs !=nullptr) free(allocrhs); /* drop any storage used */ #endif /* apply significant status */ if (status!=0) decStatus(res, status, set); @@ -1132,7 +1132,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber * decContext dcmul; /* context for the multiplication */ uInt needbytes; /* for space calculations */ decNumber bufa[D2N(DECBUFFER*2+1)]; - decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */ + decNumber *allocbufa=nullptr; /* -> allocated bufa, iff allocated */ decNumber *acc; /* accumulator pointer */ decNumber dzero; /* work */ @@ -1162,7 +1162,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber * needbytes=sizeof(decNumber)+(D2U(dcmul.digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { /* need malloc space */ allocbufa=(decNumber *)malloc(needbytes); - if (allocbufa==NULL) { /* hopeless -- abandon */ + if (allocbufa==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} acc=allocbufa; /* use the allocated space */ @@ -1177,7 +1177,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber * /* Note sNaN has to go through addOp to shorten payload if */ /* necessary */ if ((status&DEC_Invalid_operation)!=0) { - if (!(status&DECNUMBER_DEC_sNaN)) { /* but be true invalid */ + if (!(status&DEC_sNaN)) { /* but be true invalid */ uprv_decNumberZero(res); /* acc not yet set */ res->bits=DECNAN; break; @@ -1194,7 +1194,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber * decAddOp(res, acc, fhs, set, 0, &status); } while(0); /* end protected */ - if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */ + if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used */ if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -1244,7 +1244,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberInvert(decNumber *res, const decNumbe /* always need to examine all bits in rhs */ /* This loop could be unrolled and/or use BIN2BCD tables */ for (i=0; i1) { @@ -1293,7 +1293,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *r decContext *set) { uInt status=0; /* accumulator */ #if DECSUBSET - decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */ + decNumber *allocrhs=nullptr; /* non-nullptr if rounded rhs allocated */ #endif #if DECCHECK @@ -1308,7 +1308,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *r /* reduce operand and set lostDigits status, as needed */ if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } /* special check in subset for rhs=0 */ @@ -1321,7 +1321,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *r } while(0); /* end protected */ #if DECSUBSET - if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */ + if (allocrhs !=nullptr) free(allocrhs); /* drop any storage used */ #endif /* apply significant status */ if (status!=0) decStatus(res, status, set); @@ -1364,7 +1364,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *res, const decNumber #endif /* NaNs as usual; Infinities return +Infinity; 0->oops */ - if (decNumberIsNaN(rhs)) decNaNs(res, rhs, NULL, set, &status); + if (decNumberIsNaN(rhs)) decNaNs(res, rhs, nullptr, set, &status); else if (decNumberIsInfinite(rhs)) uprv_decNumberCopyAbs(res, rhs); else if (decNumberIsZero(rhs)) { uprv_decNumberZero(res); /* prepare for Infinity */ @@ -1425,15 +1425,15 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber /* buffers for a and b working decimals */ /* (adjustment calculator, same size) */ decNumber bufa[D2N(DECBUFFER+2)]; - decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */ + decNumber *allocbufa=nullptr; /* -> allocated bufa, iff allocated */ decNumber *a=bufa; /* temporary a */ decNumber bufb[D2N(DECBUFFER+2)]; - decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */ + decNumber *allocbufb=nullptr; /* -> allocated bufb, iff allocated */ decNumber *b=bufb; /* temporary b */ decNumber bufw[D2N(10)]; /* working 2-10 digit number */ decNumber *w=bufw; /* .. */ #if DECSUBSET - decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */ + decNumber *allocrhs=nullptr; /* non-nullptr if rounded rhs allocated */ #endif decContext aset; /* working context */ @@ -1450,7 +1450,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber /* reduce operand and set lostDigits status, as needed */ if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } /* special check in subset for rhs=0 */ @@ -1462,7 +1462,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber uprv_decContextDefault(&aset, DEC_INIT_DECIMAL64); /* clean context */ - /* handle exact DECNUMBER_powers of 10; only check if +ve finite */ + /* handle exact powers of 10; only check if +ve finite */ if (!(rhs->bits&(DECNEG|DECSPECIAL)) && !ISZERO(rhs)) { Int residue=0; /* (no residue) */ uInt copystat=0; /* clean status */ @@ -1495,7 +1495,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { /* need malloc space */ allocbufa=(decNumber *)malloc(needbytes); - if (allocbufa==NULL) { /* hopeless -- abandon */ + if (allocbufa==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} a=allocbufa; /* use the allocated space */ @@ -1508,7 +1508,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber /* skip the division if the result so far is infinite, NaN, or */ /* zero, or there was an error; note NaN from sNaN needs copy */ - if (status&DEC_NaNs && !(status&DECNUMBER_DEC_sNaN)) break; + if (status&DEC_NaNs && !(status&DEC_sNaN)) break; if (a->bits&DECSPECIAL || ISZERO(a)) { uprv_decNumberCopy(res, a); /* [will fit] */ break;} @@ -1518,7 +1518,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit); if (needbytes>sizeof(bufb)) { /* need malloc space */ allocbufb=(decNumber *)malloc(needbytes); - if (allocbufb==NULL) { /* hopeless -- abandon */ + if (allocbufb==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} b=allocbufb; /* use the allocated space */ @@ -1535,13 +1535,13 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber decLnOp(b, w, &aset, &ignore); /* b=ln(10) */ aset.digits=set->digits; /* for final divide */ - decDivideOp(res, a, b, &aset, DECNUMBER_DIVIDE, &status); /* into result */ + decDivideOp(res, a, b, &aset, DIVIDE, &status); /* into result */ } while(0); /* [for break] */ - if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */ - if (allocbufb!=NULL) free(allocbufb); /* .. */ + if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used */ + if (allocbufb!=nullptr) free(allocbufb); /* .. */ #if DECSUBSET - if (allocrhs !=NULL) free(allocrhs); /* .. */ + if (allocrhs !=nullptr) free(allocrhs); /* .. */ #endif /* apply significant status */ if (status!=0) decStatus(res, status, set); @@ -1569,7 +1569,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber U_CAPI decNumber * U_EXPORT2 uprv_decNumberMax(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decCompareOp(res, lhs, rhs, set, DECNUMBER_COMPMAX, &status); + decCompareOp(res, lhs, rhs, set, COMPMAX, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -1592,7 +1592,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberMax(decNumber *res, const decNumber * U_CAPI decNumber * U_EXPORT2 uprv_decNumberMaxMag(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decCompareOp(res, lhs, rhs, set, DECNUMBER_COMPMAXMAG, &status); + decCompareOp(res, lhs, rhs, set, COMPMAXMAG, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -1615,7 +1615,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberMaxMag(decNumber *res, const decNumbe U_CAPI decNumber * U_EXPORT2 uprv_decNumberMin(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decCompareOp(res, lhs, rhs, set, DECNUMBER_COMPMIN, &status); + decCompareOp(res, lhs, rhs, set, COMPMIN, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -1638,7 +1638,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberMin(decNumber *res, const decNumber * U_CAPI decNumber * U_EXPORT2 uprv_decNumberMinMag(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decCompareOp(res, lhs, rhs, set, DECNUMBER_COMPMINMAG, &status); + decCompareOp(res, lhs, rhs, set, COMPMINMAG, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -1710,7 +1710,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextMinus(decNumber *res, const decNu dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */ workset.round=DEC_ROUND_FLOOR; decAddOp(res, rhs, &dtiny, &workset, DECNEG, &status); - status&=DEC_Invalid_operation|DECNUMBER_DEC_sNaN; /* only sNaN Invalid please */ + status&=DEC_Invalid_operation|DEC_sNaN; /* only sNaN Invalid please */ if (status!=0) decStatus(res, status, set); return res; } /* decNumberNextMinus */ @@ -1747,7 +1747,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextPlus(decNumber *res, const decNum dtiny.exponent=DEC_MIN_EMIN-1; /* .. smaller than tiniest */ workset.round=DEC_ROUND_CEILING; decAddOp(res, rhs, &dtiny, &workset, 0, &status); - status&=DEC_Invalid_operation|DECNUMBER_DEC_sNaN; /* only sNaN Invalid please */ + status&=DEC_Invalid_operation|DEC_sNaN; /* only sNaN Invalid please */ if (status!=0) decStatus(res, status, set); return res; } /* decNumberNextPlus */ @@ -1781,7 +1781,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextToward(decNumber *res, const decN } else { /* Is numeric, so no chance of sNaN Invalid, etc. */ result=decCompare(lhs, rhs, 0); /* sign matters */ - if (result==DECNUMBER_BADINT) status|=DEC_Insufficient_storage; /* rare */ + if (result==BADINT) status|=DEC_Insufficient_storage; /* rare */ else { /* valid compare */ if (result==0) uprv_decNumberCopySign(res, lhs, rhs); /* easy */ else { /* differ: need NextPlus or NextMinus */ @@ -1868,7 +1868,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberOr(decNumber *res, const decNumber *l Int i, j; /* This loop could be unrolled and/or use BIN2BCD tables */ for (i=0; i allocated acc buffer, iff used */ - decNumber *allocinv=NULL; /* -> allocated 1/x buffer, iff used */ + decNumber *allocdac=nullptr; /* -> allocated acc buffer, iff used */ + decNumber *allocinv=nullptr; /* -> allocated 1/x buffer, iff used */ Int reqdigits=set->digits; /* requested DIGITS */ Int n; /* rhs in binary */ Flag rhsint=0; /* 1 if rhs is an integer */ @@ -2010,12 +2010,12 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber if (!set->extended) { /* reduce operands and set status, as needed */ if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, &status); - if (alloclhs==NULL) break; + if (alloclhs==nullptr) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { allocrhs=decRoundOperand(rhs, set, &status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } } @@ -2058,10 +2058,10 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber /* Original rhs may be an integer that fits and is in range */ n=decGetInt(rhs); - if (n!=DECNUMBER_BADINT) { /* it is an integer */ + if (n!=BADINT) { /* it is an integer */ rhsint=1; /* record the fact for 1**n */ isoddint=(Flag)n&1; /* [works even if big] */ - if (n!=DECNUMBER_BIGEVEN && n!=DECNUMBER_BIGODD) /* can use integer path? */ + if (n!=BIGEVEN && n!=BIGODD) /* can use integer path? */ useint=1; /* looks good */ } @@ -2166,7 +2166,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber /* [needbytes also used below if 1/lhs needed] */ if (needbytes>sizeof(dacbuff)) { allocdac=(decNumber *)malloc(needbytes); - if (allocdac==NULL) { /* hopeless -- abandon */ + if (allocdac==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} dac=allocdac; /* use the allocated space */ @@ -2203,17 +2203,17 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber /* if a negative power the constant 1 is needed, and if not subset */ /* invert the lhs now rather than inverting the result later */ if (decNumberIsNegative(rhs)) { /* was a **-n [hence digits>0] */ - decNumber *inv=invbuff; /* asssume use fixed buffer */ + decNumber *inv=invbuff; /* assume use fixed buffer */ uprv_decNumberCopy(&dnOne, dac); /* dnOne=1; [needed now or later] */ #if DECSUBSET if (set->extended) { /* need to calculate 1/lhs */ #endif /* divide lhs into 1, putting result in dac [dac=1/dac] */ - decDivideOp(dac, &dnOne, lhs, &aset, DECNUMBER_DIVIDE, &status); + decDivideOp(dac, &dnOne, lhs, &aset, DIVIDE, &status); /* now locate or allocate space for the inverted lhs */ if (needbytes>sizeof(invbuff)) { allocinv=(decNumber *)malloc(needbytes); - if (allocinv==NULL) { /* hopeless -- abandon */ + if (allocinv==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} inv=allocinv; /* use the allocated space */ @@ -2272,7 +2272,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber if (!set->extended && /* subset math */ decNumberIsNegative(rhs)) { /* was a **-n [hence digits>0] */ /* so divide result into 1 [dac=1/dac] */ - decDivideOp(dac, &dnOne, dac, &aset, DECNUMBER_DIVIDE, &status); + decDivideOp(dac, &dnOne, dac, &aset, DIVIDE, &status); } #endif } /* rhs integer path */ @@ -2285,11 +2285,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber #endif } while(0); /* end protected */ - if (allocdac!=NULL) free(allocdac); /* drop any storage used */ - if (allocinv!=NULL) free(allocinv); /* .. */ + if (allocdac!=nullptr) free(allocdac); /* drop any storage used */ + if (allocinv!=nullptr) free(allocinv); /* .. */ #if DECSUBSET - if (alloclhs!=NULL) free(alloclhs); /* .. */ - if (allocrhs!=NULL) free(allocrhs); /* .. */ + if (alloclhs!=nullptr) free(alloclhs); /* .. */ + if (allocrhs!=nullptr) free(allocrhs); /* .. */ #endif if (status!=0) decStatus(res, status, set); #if DECCHECK @@ -2344,7 +2344,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberNormalize(decNumber *res, const decNu U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumber *rhs, decContext *set) { #if DECSUBSET - decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */ + decNumber *allocrhs=nullptr; /* non-nullptr if rounded rhs allocated */ #endif uInt status=0; /* as usual */ Int residue=0; /* as usual */ @@ -2360,7 +2360,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumbe /* reduce operand and set lostDigits status, as needed */ if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } } @@ -2369,7 +2369,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumbe /* Infinities copy through; NaNs need usual treatment */ if (decNumberIsNaN(rhs)) { - decNaNs(res, rhs, NULL, set, &status); + decNaNs(res, rhs, nullptr, set, &status); break; } @@ -2381,7 +2381,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumbe } while(0); /* end protected */ #if DECSUBSET - if (allocrhs !=NULL) free(allocrhs); /* .. */ + if (allocrhs !=nullptr) free(allocrhs); /* .. */ #endif if (status!=0) decStatus(res, status, set);/* then report status */ return res; @@ -2428,7 +2428,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberRescale(decNumber *res, const decNumb U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainder(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decDivideOp(res, lhs, rhs, set, DECNUMBER_REMAINDER, &status); + decDivideOp(res, lhs, rhs, set, REMAINDER, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -2451,7 +2451,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainder(decNumber *res, const decNu U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainderNear(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; /* accumulator */ - decDivideOp(res, lhs, rhs, set, DECNUMBER_REMNEAR, &status); + decDivideOp(res, lhs, rhs, set, REMNEAR, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); @@ -2501,8 +2501,8 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *res, const decNumbe status=DEC_Invalid_operation; else { /* both numeric, rhs is an integer */ rotate=decGetInt(rhs); /* [cannot fail] */ - if (rotate==DECNUMBER_BADINT /* something bad .. */ - || rotate==DECNUMBER_BIGODD || rotate==DECNUMBER_BIGEVEN /* .. very big .. */ + if (rotate==BADINT /* something bad .. */ + || rotate==BIGODD || rotate==BIGEVEN /* .. very big .. */ || abs(rotate)>set->digits) /* .. or out of range */ status=DEC_Invalid_operation; else { /* rhs is OK */ @@ -2555,16 +2555,16 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *res, const decNumbe units=rotate/DECDPUN; /* whole units to rotate */ shift=rotate%DECDPUN; /* left-over digits count */ if (shift>0) { /* not an exact number of units */ - uInt save=res->lsu[0]%DECNUMBER_powers[shift]; /* save low digit(s) */ + uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */ decShiftToLeast(res->lsu, D2U(res->digits), shift); if (shift>msudigits) { /* msumax-1 needs >0 digits */ - uInt rem=save%DECNUMBER_powers[shift-msudigits];/* split save */ - *msumax=(Unit)(save/DECNUMBER_powers[shift-msudigits]); /* and insert */ + uInt rem=save%powers[shift-msudigits];/* split save */ + *msumax=(Unit)(save/powers[shift-msudigits]); /* and insert */ *(msumax-1)=*(msumax-1) - +(Unit)(rem*DECNUMBER_powers[DECDPUN-(shift-msudigits)]); /* .. */ + +(Unit)(rem*powers[DECDPUN-(shift-msudigits)]); /* .. */ } else { /* all fits in msumax */ - *msumax=*msumax+(Unit)(save*DECNUMBER_powers[msudigits-shift]); /* [maybe *1] */ + *msumax=*msumax+(Unit)(save*powers[msudigits-shift]); /* [maybe *1] */ } } /* digits shift needed */ @@ -2575,9 +2575,9 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *res, const decNumbe /* 0, again) */ shift=DECDPUN-msudigits; if (shift>0) { /* not an exact number of units */ - uInt save=res->lsu[0]%DECNUMBER_powers[shift]; /* save low digit(s) */ + uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */ decShiftToLeast(res->lsu, units, shift); - *msumax=*msumax+(Unit)(save*DECNUMBER_powers[msudigits]); + *msumax=*msumax+(Unit)(save*powers[msudigits]); } /* partial shift needed */ /* Step 3: rotate the units array using triple reverse */ @@ -2659,8 +2659,8 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberScaleB(decNumber *res, const decNumbe else { /* lhs is a number; rhs is a finite with q==0 */ reqexp=decGetInt(rhs); /* [cannot fail] */ - if (reqexp==DECNUMBER_BADINT /* something bad .. */ - || reqexp==DECNUMBER_BIGODD || reqexp==DECNUMBER_BIGEVEN /* .. very big .. */ + if (reqexp==BADINT /* something bad .. */ + || reqexp==BIGODD || reqexp==BIGEVEN /* .. very big .. */ || abs(reqexp)>(2*(set->digits+set->emax))) /* .. or out of range */ status=DEC_Invalid_operation; else { /* rhs is OK */ @@ -2714,8 +2714,8 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberShift(decNumber *res, const decNumber status=DEC_Invalid_operation; else { /* both numeric, rhs is an integer */ shift=decGetInt(rhs); /* [cannot fail] */ - if (shift==DECNUMBER_BADINT /* something bad .. */ - || shift==DECNUMBER_BIGODD || shift==DECNUMBER_BIGEVEN /* .. very big .. */ + if (shift==BADINT /* something bad .. */ + || shift==BIGODD || shift==BIGEVEN /* .. very big .. */ || abs(shift)>set->digits) /* .. or out of range */ status=DEC_Invalid_operation; else { /* rhs is OK */ @@ -2845,7 +2845,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN Int dropped; /* .. */ #if DECSUBSET - decNumber *allocrhs=NULL; /* non-NULL if rounded rhs allocated */ + decNumber *allocrhs=nullptr; /* non-nullptr if rounded rhs allocated */ #endif /* buffer for f [needs +1 in case DECBUFFER 0] */ decNumber buff[D2N(DECBUFFER+1)]; @@ -2853,9 +2853,9 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN decNumber bufa[D2N(DECBUFFER+2)]; /* buffer for temporary, b [must be same size as a] */ decNumber bufb[D2N(DECBUFFER+2)]; - decNumber *allocbuff=NULL; /* -> allocated buff, iff allocated */ - decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */ - decNumber *allocbufb=NULL; /* -> allocated bufb, iff allocated */ + decNumber *allocbuff=nullptr; /* -> allocated buff, iff allocated */ + decNumber *allocbufa=nullptr; /* -> allocated bufa, iff allocated */ + decNumber *allocbufb=nullptr; /* -> allocated bufb, iff allocated */ decNumber *f=buff; /* reduced fraction */ decNumber *a=bufa; /* approximation to result */ decNumber *b=bufb; /* intermediate result */ @@ -2873,7 +2873,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN /* reduce operand and set lostDigits status, as needed */ if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; /* [Note: 'f' allocation below could reuse this buffer if */ /* used, but as this is rare they are kept separate for clarity.] */ rhs=allocrhs; @@ -2888,7 +2888,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN if (decNumberIsNegative(rhs)) status|=DEC_Invalid_operation; else uprv_decNumberCopy(res, rhs); /* +Infinity */ } - else decNaNs(res, rhs, NULL, set, &status); /* a NaN */ + else decNaNs(res, rhs, nullptr, set, &status); /* a NaN */ break; } @@ -2926,7 +2926,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); if (needbytes>(Int)sizeof(buff)) { allocbuff=(decNumber *)malloc(needbytes); - if (allocbuff==NULL) { /* hopeless -- abandon */ + if (allocbuff==nullptr) { /* hopeless -- abandon */ status|=DEC_Insufficient_storage; break;} f=allocbuff; /* use the allocated space */ @@ -2936,7 +2936,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN if (needbytes>(Int)sizeof(bufa)) { /* [same applies to b] */ allocbufa=(decNumber *)malloc(needbytes); allocbufb=(decNumber *)malloc(needbytes); - if (allocbufa==NULL || allocbufb==NULL) { /* hopeless */ + if (allocbufa==nullptr || allocbufb==nullptr) { /* hopeless */ status|=DEC_Insufficient_storage; break;} a=allocbufa; /* use the allocated spaces */ @@ -3009,7 +3009,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN workset.digits=MINI(workset.digits*2-2, maxp); /* a = 0.5 * (a + f/a) */ /* [calculated at p then rounded to currentprecision] */ - decDivideOp(b, f, a, &workset, DECNUMBER_DIVIDE, &ignore); /* b=f/a */ + decDivideOp(b, f, a, &workset, DIVIDE, &ignore); /* b=f/a */ decAddOp(b, b, a, &workset, 0, &ignore); /* b=b+a */ decMultiplyOp(a, b, t, &workset, &ignore); /* a=b*0.5 */ } /* loop */ @@ -3050,7 +3050,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN decAddOp(b, a, t, &workset, DECNEG, &ignore); /* b = a - 0.5 ulp */ workset.round=DEC_ROUND_UP; decMultiplyOp(b, b, b, &workset, &ignore); /* b = mulru(b, b) */ - decCompareOp(b, f, b, &workset, DECNUMBER_COMPARE, &ignore); /* b ? f, reversed */ + decCompareOp(b, f, b, &workset, COMPARE, &ignore); /* b ? f, reversed */ if (decNumberIsNegative(b)) { /* f < b [i.e., b > f] */ /* this is the more common adjustment, though both are rare */ t->exponent++; /* make 1.0 ulp */ @@ -3065,7 +3065,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN decAddOp(b, a, t, &workset, 0, &ignore); /* b = a + 0.5 ulp */ workset.round=DEC_ROUND_DOWN; decMultiplyOp(b, b, b, &workset, &ignore); /* b = mulrd(b, b) */ - decCompareOp(b, b, f, &workset, DECNUMBER_COMPARE, &ignore); /* b ? f */ + decCompareOp(b, b, f, &workset, COMPARE, &ignore); /* b ? f */ if (decNumberIsNegative(b)) { /* b < f */ t->exponent++; /* make 1.0 ulp */ t->lsu[0]=1; /* .. */ @@ -3101,7 +3101,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN status|=DEC_Inexact|DEC_Rounded; } else { /* plausible */ - decCompareOp(t, b, rhs, &workset, DECNUMBER_COMPARE, &mstatus); /* b ? rhs */ + decCompareOp(t, b, rhs, &workset, COMPARE, &mstatus); /* b ? rhs */ if (!ISZERO(t)) status|=DEC_Inexact|DEC_Rounded; /* not equal */ else { /* is Exact */ /* here, dropped is the count of trailing zeros in 'a' */ @@ -3147,11 +3147,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN uprv_decNumberCopy(res, a); /* a is now the result */ } while(0); /* end protected */ - if (allocbuff!=NULL) free(allocbuff); /* drop any storage used */ - if (allocbufa!=NULL) free(allocbufa); /* .. */ - if (allocbufb!=NULL) free(allocbufb); /* .. */ + if (allocbuff!=nullptr) free(allocbuff); /* drop any storage used */ + if (allocbufa!=nullptr) free(allocbufa); /* .. */ + if (allocbufb!=nullptr) free(allocbufb); /* .. */ #if DECSUBSET - if (allocrhs !=NULL) free(allocrhs); /* .. */ + if (allocrhs !=nullptr) free(allocrhs); /* .. */ #endif if (status!=0) decStatus(res, status, set);/* then report status */ #if DECCHECK @@ -3221,7 +3221,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralExact(decNumber *res, const /* handle infinities and NaNs */ if (SPECIALARG) { if (decNumberIsInfinite(rhs)) uprv_decNumberCopy(res, rhs); /* an Infinity */ - else decNaNs(res, rhs, NULL, set, &status); /* a NaN */ + else decNaNs(res, rhs, nullptr, set, &status); /* a NaN */ } else { /* finite */ /* have a finite number; no error possible (res must be big enough) */ @@ -3298,7 +3298,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberXor(decNumber *res, const decNumber * Int i, j; /* This loop could be unrolled and/or use BIN2BCD tables */ for (i=0; i allocated acc buffer, iff allocated */ + Unit *allocacc=nullptr; /* -> allocated acc buffer, iff allocated */ Int reqdigits=set->digits; /* local copy; requested DIGITS */ Int padding; /* work */ @@ -3864,12 +3864,12 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, /* reduce operands and set lostDigits status, as needed */ if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, status); - if (alloclhs==NULL) break; + if (alloclhs==nullptr) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { allocrhs=decRoundOperand(rhs, set, status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } } @@ -3983,7 +3983,7 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, partial+=*rhs->lsu; if ((partial<=DECDPUNMAX) /* result fits in unit */ && (lhs->digits>=DECDPUN || /* .. and no digits-count change */ - partial<(Int)DECNUMBER_powers[lhs->digits])) { /* .. */ + partial<(Int)powers[lhs->digits])) { /* .. */ if (res!=lhs) uprv_decNumberCopy(res, lhs); /* not in place */ *res->lsu=(Unit)partial; /* [copy could have overwritten RHS] */ break; @@ -4051,7 +4051,7 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, /* LHS digits may affect result */ rhsshift=D2U(padding+1)-1; /* this much by Unit shift .. */ - mult=DECNUMBER_powers[padding-(rhsshift*DECDPUN)]; /* .. this by multiplication */ + mult=powers[padding-(rhsshift*DECDPUN)]; /* .. this by multiplication */ } /* padding needed */ if (diffsign) mult=-mult; /* signs differ */ @@ -4075,7 +4075,7 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, if (need*sizeof(Unit)>sizeof(accbuff)) { /* printf("malloc add %ld %ld\n", need, sizeof(accbuff)); */ allocacc=(Unit *)malloc(need*sizeof(Unit)); - if (allocacc==NULL) { /* hopeless -- abandon */ + if (allocacc==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} acc=allocacc; @@ -4171,10 +4171,10 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, } } while(0); /* end protected */ - if (allocacc!=NULL) free(allocacc); /* drop any storage used */ + if (allocacc!=nullptr) free(allocacc); /* drop any storage used */ #if DECSUBSET - if (allocrhs!=NULL) free(allocrhs); /* .. */ - if (alloclhs!=NULL) free(alloclhs); /* .. */ + if (allocrhs!=nullptr) free(allocrhs); /* .. */ + if (alloclhs!=nullptr) free(alloclhs); /* .. */ #endif return res; } /* decAddOp */ @@ -4191,7 +4191,7 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, /* lhs is A */ /* rhs is B */ /* set is the context */ -/* op is DECNUMBER_DIVIDE, DECNUMBER_DIVIDEINT, DECNUMBER_REMAINDER, or DECNUMBER_REMNEAR respectively. */ +/* op is DIVIDE, DIVIDEINT, REMAINDER, or REMNEAR respectively. */ /* status is the usual accumulator */ /* */ /* C must have space for set->digits digits. */ @@ -4247,18 +4247,18 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, /* long subtractions. These are acc and var1 respectively. */ /* var1 is a copy of the lhs coefficient, var2 is the rhs coefficient.*/ /* The static buffers may be larger than might be expected to allow */ -/* for calls from higher-level funtions (notable exp). */ +/* for calls from higher-level functions (notable exp). */ /* ------------------------------------------------------------------ */ static decNumber * decDivideOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, Flag op, uInt *status) { #if DECSUBSET - decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */ - decNumber *allocrhs=NULL; /* .., rhs */ + decNumber *alloclhs=nullptr; /* non-nullptr if rounded lhs allocated */ + decNumber *allocrhs=nullptr; /* .., rhs */ #endif Unit accbuff[SD2U(DECBUFFER+DECDPUN+10)]; /* local buffer */ Unit *acc=accbuff; /* -> accumulator array for result */ - Unit *allocacc=NULL; /* -> allocated buffer, iff allocated */ + Unit *allocacc=nullptr; /* -> allocated buffer, iff allocated */ Unit *accnext; /* -> where next digit will go */ Int acclength; /* length of acc needed [Units] */ Int accunits; /* count of units accumulated */ @@ -4266,7 +4266,7 @@ static decNumber * decDivideOp(decNumber *res, Unit varbuff[SD2U(DECBUFFER*2+DECDPUN)]; /* buffer for var1 */ Unit *var1=varbuff; /* -> var1 array for long subtraction */ - Unit *varalloc=NULL; /* -> allocated buffer, iff used */ + Unit *varalloc=nullptr; /* -> allocated buffer, iff used */ Unit *msu1; /* -> msu of var1 */ const Unit *var2; /* -> var2 array */ @@ -4283,7 +4283,7 @@ static decNumber * decDivideOp(decNumber *res, Int residue; /* for rounding */ Int reqdigits=set->digits; /* requested DIGITS */ Int exponent; /* working exponent */ - Int maxexponent=0; /* DECNUMBER_DIVIDE maximum exponent if unrounded */ + Int maxexponent=0; /* DIVIDE maximum exponent if unrounded */ uByte bits; /* working sign */ Unit *target; /* work */ const Unit *source; /* .. */ @@ -4303,12 +4303,12 @@ static decNumber * decDivideOp(decNumber *res, /* reduce operands and set lostDigits status, as needed */ if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, status); - if (alloclhs==NULL) break; + if (alloclhs==nullptr) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { allocrhs=decRoundOperand(rhs, set, status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } } @@ -4326,7 +4326,7 @@ static decNumber * decDivideOp(decNumber *res, /* one or two infinities */ if (decNumberIsInfinite(lhs)) { /* LHS (dividend) is infinite */ if (decNumberIsInfinite(rhs) || /* two infinities are invalid .. */ - op & (DECNUMBER_REMAINDER | DECNUMBER_REMNEAR)) { /* as is remainder of infinity */ + op & (REMAINDER | REMNEAR)) { /* as is remainder of infinity */ *status|=DEC_Invalid_operation; break; } @@ -4337,16 +4337,16 @@ static decNumber * decDivideOp(decNumber *res, } else { /* RHS (divisor) is infinite */ residue=0; - if (op&(DECNUMBER_REMAINDER|DECNUMBER_REMNEAR)) { + if (op&(REMAINDER|REMNEAR)) { /* result is [finished clone of] lhs */ decCopyFit(res, lhs, set, &residue, status); } else { /* a division */ uprv_decNumberZero(res); res->bits=bits; /* set +/- zero */ - /* for DECNUMBER_DIVIDEINT the exponent is always 0. For DECNUMBER_DIVIDE, result */ + /* for DIVIDEINT the exponent is always 0. For DIVIDE, result */ /* is a 0 with infinitely negative exponent, clamped to minimum */ - if (op&DECNUMBER_DIVIDE) { + if (op&DIVIDE) { res->exponent=set->emin-set->digits+1; *status|=DEC_Clamped; } @@ -4364,7 +4364,7 @@ static decNumber * decDivideOp(decNumber *res, } else { uprv_decNumberZero(res); - if (op&(DECNUMBER_REMAINDER|DECNUMBER_REMNEAR)) *status|=DEC_Invalid_operation; + if (op&(REMAINDER|REMNEAR)) *status|=DEC_Invalid_operation; else { *status|=DEC_Division_by_zero; /* x/0 */ res->bits=bits|DECINF; /* .. is +/- Infinity */ @@ -4378,7 +4378,7 @@ static decNumber * decDivideOp(decNumber *res, if (!set->extended) uprv_decNumberZero(res); else { #endif - if (op&DECNUMBER_DIVIDE) { + if (op&DIVIDE) { residue=0; exponent=lhs->exponent-rhs->exponent; /* ideal exponent */ uprv_decNumberCopy(res, lhs); /* [zeros always fit] */ @@ -4386,7 +4386,7 @@ static decNumber * decDivideOp(decNumber *res, res->exponent=exponent; /* exponent, too */ decFinalize(res, set, &residue, status); /* check exponent */ } - else if (op&DECNUMBER_DIVIDEINT) { + else if (op&DIVIDEINT) { uprv_decNumberZero(res); /* integer 0 */ res->bits=bits; /* sign as computed */ } @@ -4408,9 +4408,9 @@ static decNumber * decDivideOp(decNumber *res, /* If the working exponent is -ve, then some quick exits are */ /* possible because the quotient is known to be <1 */ - /* [for DECNUMBER_REMNEAR, it needs to be < -1, as -0.5 could need work] */ - if (exponent<0 && !(op==DECNUMBER_DIVIDE)) { - if (op&DECNUMBER_DIVIDEINT) { + /* [for REMNEAR, it needs to be < -1, as -0.5 could need work] */ + if (exponent<0 && !(op==DIVIDE)) { + if (op&DIVIDEINT) { uprv_decNumberZero(res); /* integer part is 0 */ #if DECSUBSET if (set->extended) @@ -4420,15 +4420,15 @@ static decNumber * decDivideOp(decNumber *res, /* fastpath remainders so long as the lhs has the smaller */ /* (or equal) exponent */ if (lhs->exponent<=rhs->exponent) { - if (op&DECNUMBER_REMAINDER || exponent<-1) { - /* It is DECNUMBER_REMAINDER or safe DECNUMBER_REMNEAR; result is [finished */ + if (op&REMAINDER || exponent<-1) { + /* It is REMAINDER or safe REMNEAR; result is [finished */ /* clone of] lhs (r = x - 0*y) */ residue=0; decCopyFit(res, lhs, set, &residue, status); decFinish(res, set, &residue, status); break; } - /* [unsafe DECNUMBER_REMNEAR drops through] */ + /* [unsafe REMNEAR drops through] */ } } /* fastpaths */ @@ -4440,7 +4440,7 @@ static decNumber * decDivideOp(decNumber *res, if (acclength*sizeof(Unit)>sizeof(accbuff)) { /* printf("malloc dvacc %ld units\n", acclength); */ allocacc=(Unit *)malloc(acclength*sizeof(Unit)); - if (allocacc==NULL) { /* hopeless -- abandon */ + if (allocacc==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} acc=allocacc; /* use the allocated space */ @@ -4455,17 +4455,17 @@ static decNumber * decDivideOp(decNumber *res, /* whichever is larger */ /* +1 -- for rounding of slide to right */ /* +1 -- for leading 0s */ - /* +1 -- for pre-adjust if a remainder or DECNUMBER_DIVIDEINT */ + /* +1 -- for pre-adjust if a remainder or DIVIDEINT */ /* [Note: unused units do not participate in decUnitAddSub data] */ maxdigits=rhs->digits+reqdigits-1; if (lhs->digits>maxdigits) maxdigits=lhs->digits; var1units=D2U(maxdigits)+2; - /* allocate a guard unit above msu1 for DECNUMBER_REMAINDERNEAR */ - if (!(op&DECNUMBER_DIVIDE)) var1units++; + /* allocate a guard unit above msu1 for REMAINDERNEAR */ + if (!(op&DIVIDE)) var1units++; if ((var1units+1)*sizeof(Unit)>sizeof(varbuff)) { /* printf("malloc dvvar %ld units\n", var1units+1); */ varalloc=(Unit *)malloc((var1units+1)*sizeof(Unit)); - if (varalloc==NULL) { /* hopeless -- abandon */ + if (varalloc==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} var1=varalloc; /* use the allocated space */ @@ -4476,7 +4476,7 @@ static decNumber * decDivideOp(decNumber *res, /* subtract in place is always possible. The rhs (var2) has */ /* virtual padding (implemented by decUnitAddSub). */ /* One guard unit was allocated above msu1 for rem=rem+rem in */ - /* DECNUMBER_REMAINDERNEAR. */ + /* REMAINDERNEAR. */ msu1=var1+var1units-1; /* msu of var1 */ source=lhs->lsu+D2U(lhs->digits)-1; /* msu of input array */ for (target=msu1; source>=lhs->lsu; source--, target--) *target=*source; @@ -4504,15 +4504,15 @@ static decNumber * decDivideOp(decNumber *res, /* number of leading zeros in var1 msu and subtract those in var2 msu. */ /* [This is actually done by counting the digits and negating, as */ /* lead1=DECDPUN-digits1, and similarly for lead2.] */ - for (pow=&DECNUMBER_powers[1]; *msu1>=*pow; pow++) exponent--; - for (pow=&DECNUMBER_powers[1]; *msu2>=*pow; pow++) exponent++; + for (pow=&powers[1]; *msu1>=*pow; pow++) exponent--; + for (pow=&powers[1]; *msu2>=*pow; pow++) exponent++; /* Now, if doing an integer divide or remainder, ensure that */ /* the result will be Unit-aligned. To do this, shift the var1 */ /* accumulator towards least if need be. (It's much easier to */ /* do this now than to reassemble the residue afterwards, if */ /* doing a remainder.) Also ensure the exponent is not negative. */ - if (!(op&DECNUMBER_DIVIDE)) { + if (!(op&DIVIDE)) { Unit *u; /* work */ /* save the initial 'false' padding of var1, in digits */ var1initpad=(var1units-D2U(lhs->digits))*DECDPUN; @@ -4525,10 +4525,10 @@ static decNumber * decDivideOp(decNumber *res, /* clean any most-significant units which were just emptied */ for (u=msu1; cut>=DECDPUN; cut-=DECDPUN, u--) *u=0; } /* align */ - else { /* is DECNUMBER_DIVIDE */ + else { /* is DIVIDE */ maxexponent=lhs->exponent-rhs->exponent; /* save */ /* optimization: if the first iteration will just produce 0, */ - /* preadjust to skip it [valid for DECNUMBER_DIVIDE only] */ + /* preadjust to skip it [valid for DIVIDE only] */ if (*msu1<*msu2) { var2ulen--; /* shift down */ exponent-=DECDPUN; /* update the exponent */ @@ -4609,7 +4609,7 @@ static decNumber * decDivideOp(decNumber *res, /* account exactly for the new digits */ if (accunits==0) { accdigits++; /* at least one */ - for (pow=&DECNUMBER_powers[1]; thisunit>=*pow; pow++) accdigits++; + for (pow=&powers[1]; thisunit>=*pow; pow++) accdigits++; } else accdigits+=DECDPUN; accunits++; /* update count */ @@ -4620,13 +4620,13 @@ static decNumber * decDivideOp(decNumber *res, /* if the residue is zero, the operation is done (unless divide */ /* or divideInteger and still not enough digits yet) */ if (*var1==0 && var1units==1) { /* residue is 0 */ - if (op&(DECNUMBER_REMAINDER|DECNUMBER_REMNEAR)) break; - if ((op&DECNUMBER_DIVIDE) && (exponent<=maxexponent)) break; + if (op&(REMAINDER|REMNEAR)) break; + if ((op&DIVIDE) && (exponent<=maxexponent)) break; /* [drop through if divideInteger] */ } /* also done enough if calculating remainder or integer */ /* divide and just did the last ('units') unit */ - if (exponent==0 && !(op&DECNUMBER_DIVIDE)) break; + if (exponent==0 && !(op&DIVIDE)) break; /* to get here, var1 is less than var2, so divide var2 by the per- */ /* Unit power of ten and go for the next digit */ @@ -4648,7 +4648,7 @@ static decNumber * decDivideOp(decNumber *res, /* accnext now -> lowest unit of result */ residue=0; /* assume no residue */ - if (op&DECNUMBER_DIVIDE) { + if (op&DIVIDE) { /* record the presence of any residue, for rounding */ if (*var1!=0 || var1units>1) residue=1; else { /* no residue */ @@ -4665,9 +4665,9 @@ static decNumber * decDivideOp(decNumber *res, if (exponent>=maxexponent) break; /* don't chop real 0s */ #if DECDPUN<=4 if ((lsu-QUOT10(lsu, drop+1) - *DECNUMBER_powers[drop+1])!=0) break; /* found non-0 digit */ + *powers[drop+1])!=0) break; /* found non-0 digit */ #else - if (lsu%DECNUMBER_powers[drop+1]!=0) break; /* found non-0 digit */ + if (lsu%powers[drop+1]!=0) break; /* found non-0 digit */ #endif exponent++; } @@ -4681,13 +4681,13 @@ static decNumber * decDivideOp(decNumber *res, #endif } /* exact divide */ } /* divide */ - else /* op!=DECNUMBER_DIVIDE */ { + else /* op!=DIVIDE */ { /* check for coefficient overflow */ if (accdigits+exponent>reqdigits) { *status|=DEC_Division_impossible; break; } - if (op & (DECNUMBER_REMAINDER|DECNUMBER_REMNEAR)) { + if (op & (REMAINDER|REMNEAR)) { /* [Here, the exponent will be 0, because var1 was adjusted */ /* appropriately.] */ Int postshift; /* work */ @@ -4736,7 +4736,7 @@ static decNumber * decDivideOp(decNumber *res, /* Now correct the result if doing remainderNear; if it */ /* (looking just at coefficients) is > rhs/2, or == rhs/2 and */ /* the integer was odd then the result should be rem-rhs. */ - if (op&DECNUMBER_REMNEAR) { + if (op&REMNEAR) { Int compare, tarunits; /* work */ Unit *up; /* .. */ /* calculate remainder*2 into the var1 buffer (which has */ @@ -4751,7 +4751,7 @@ static decNumber * decDivideOp(decNumber *res, /* RHS. The remainder's exponent may be smaller than the RHS's. */ compare=decUnitCompare(accnext, tarunits, rhs->lsu, D2U(rhs->digits), rhs->exponent-exponent); - if (compare==DECNUMBER_BADINT) { /* deep trouble */ + if (compare==BADINT) { /* deep trouble */ *status|=DEC_Insufficient_storage; break;} @@ -4779,7 +4779,7 @@ static decNumber * decDivideOp(decNumber *res, if (*up!=DECDPUNMAX) break;/* non-nines */ } else { /* this is the last Unit */ - if (*up==DECNUMBER_powers[quotdigits]-1) allnines=1; + if (*up==powers[quotdigits]-1) allnines=1; break; } quotdigits-=DECDPUN; /* checked those digits */ @@ -4798,15 +4798,15 @@ static decNumber * decDivideOp(decNumber *res, /* subtract [A+B*(-m)]; the result will always be negative */ accunits=-decUnitAddSub(accnext, accunits, rhs->lsu, D2U(rhs->digits), - expunits, accnext, -(Int)DECNUMBER_powers[exprem]); + expunits, accnext, -(Int)powers[exprem]); accdigits=decGetDigits(accnext, accunits); /* count digits exactly */ accunits=D2U(accdigits); /* and recalculate the units for copy */ /* [exponent is as for original remainder] */ bits^=DECNEG; /* flip the sign */ } - } /* DECNUMBER_REMNEAR */ - } /* DECNUMBER_REMAINDER or DECNUMBER_REMNEAR */ - } /* not DECNUMBER_DIVIDE */ + } /* REMNEAR */ + } /* REMAINDER or REMNEAR */ + } /* not DIVIDE */ /* Set exponent and bits */ res->exponent=exponent; @@ -4819,15 +4819,15 @@ static decNumber * decDivideOp(decNumber *res, #if DECSUBSET /* If a divide then strip trailing zeros if subset [after round] */ - if (!set->extended && (op==DECNUMBER_DIVIDE)) decTrim(res, set, 0, 1, &dropped); + if (!set->extended && (op==DIVIDE)) decTrim(res, set, 0, 1, &dropped); #endif } while(0); /* end protected */ - if (varalloc!=NULL) free(varalloc); /* drop any storage used */ - if (allocacc!=NULL) free(allocacc); /* .. */ + if (varalloc!=nullptr) free(varalloc); /* drop any storage used */ + if (allocacc!=nullptr) free(allocacc); /* .. */ #if DECSUBSET - if (allocrhs!=NULL) free(allocrhs); /* .. */ - if (alloclhs!=NULL) free(alloclhs); /* .. */ + if (allocrhs!=nullptr) free(allocrhs); /* .. */ + if (alloclhs!=nullptr) free(alloclhs); /* .. */ #endif return res; } /* decDivideOp */ @@ -4878,7 +4878,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, uByte bits; /* result sign */ Unit *acc; /* -> accumulator Unit array */ Int needbytes; /* size calculator */ - void *allocacc=NULL; /* -> allocated accumulator, iff allocated */ + void *allocacc=nullptr; /* -> allocated accumulator, iff allocated */ Unit accbuff[SD2U(DECBUFFER*4+1)]; /* buffer (+1 for DECBUFFER==0, */ /* *4 for calls from other operations) */ const Unit *mer, *mermsup; /* work */ @@ -4902,10 +4902,10 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, /* lazy carry evaluation */ uInt zlhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0) */ uInt *zlhi=zlhibuff; /* -> lhs array */ - uInt *alloclhi=NULL; /* -> allocated buffer, iff allocated */ + uInt *alloclhi=nullptr; /* -> allocated buffer, iff allocated */ uInt zrhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0) */ uInt *zrhi=zrhibuff; /* -> rhs array */ - uInt *allocrhi=NULL; /* -> allocated buffer, iff allocated */ + uInt *allocrhi=nullptr; /* -> allocated buffer, iff allocated */ uLong zaccbuff[(DECBUFFER*2+1)/4+2]; /* buffer (+1 for DECBUFFER==0) */ /* [allocacc is shared for both paths, as only one will run] */ uLong *zacc=zaccbuff; /* -> accumulator array for exact result */ @@ -4926,8 +4926,8 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, #endif #if DECSUBSET - decNumber *alloclhs=NULL; /* -> allocated buffer, iff allocated */ - decNumber *allocrhs=NULL; /* -> allocated buffer, iff allocated */ + decNumber *alloclhs=nullptr; /* -> allocated buffer, iff allocated */ + decNumber *allocrhs=nullptr; /* -> allocated buffer, iff allocated */ #endif #if DECCHECK @@ -4967,12 +4967,12 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, /* reduce operands and set lostDigits status, as needed */ if (lhs->digits>set->digits) { alloclhs=decRoundOperand(lhs, set, status); - if (alloclhs==NULL) break; + if (alloclhs==nullptr) break; lhs=alloclhs; } if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } } @@ -5018,7 +5018,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, if (needbytes>(Int)sizeof(zaccbuff)) { allocacc=(uLong *)malloc(needbytes); zacc=(uLong *)allocacc;} - if (zlhi==NULL||zrhi==NULL||zacc==NULL) { + if (zlhi==nullptr||zrhi==nullptr||zacc==nullptr) { *status|=DEC_Insufficient_storage; break;} @@ -5031,12 +5031,12 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, for (count=lhs->digits, cup=lhs->lsu, lip=zlhi; count>0; lip++) for (p=0, *lip=0; p0; p+=DECDPUN, cup++, count-=DECDPUN) - *lip+=*cup*DECNUMBER_powers[p]; + *lip+=*cup*powers[p]; lmsi=lip-1; /* save -> msi */ for (count=rhs->digits, cup=rhs->lsu, rip=zrhi; count>0; rip++) for (p=0, *rip=0; p0; p+=DECDPUN, cup++, count-=DECDPUN) - *rip+=*cup*DECNUMBER_powers[p]; + *rip+=*cup*powers[p]; rmsi=rip-1; /* save -> msi */ /* zero the accumulator */ @@ -5113,7 +5113,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, needbytes=(D2U(lhs->digits)+D2U(rhs->digits))*sizeof(Unit); if (needbytes>(Int)sizeof(accbuff)) { allocacc=(Unit *)malloc(needbytes); - if (allocacc==NULL) {*status|=DEC_Insufficient_storage; break;} + if (allocacc==nullptr) {*status|=DEC_Insufficient_storage; break;} acc=(Unit *)allocacc; /* use the allocated space */ } @@ -5172,14 +5172,14 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, decFinish(res, set, &residue, status); /* final cleanup */ } while(0); /* end protected */ - if (allocacc!=NULL) free(allocacc); /* drop any storage used */ + if (allocacc!=nullptr) free(allocacc); /* drop any storage used */ #if DECSUBSET - if (allocrhs!=NULL) free(allocrhs); /* .. */ - if (alloclhs!=NULL) free(alloclhs); /* .. */ + if (allocrhs!=nullptr) free(allocrhs); /* .. */ + if (alloclhs!=nullptr) free(alloclhs); /* .. */ #endif #if FASTMUL - if (allocrhi!=NULL) free(allocrhi); /* .. */ - if (alloclhi!=NULL) free(alloclhi); /* .. */ + if (allocrhi!=nullptr) free(allocrhi); /* .. */ + if (alloclhi!=nullptr) free(alloclhi); /* .. */ #endif return res; } /* decMultiplyOp */ @@ -5242,7 +5242,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, /* exp(-x) where x can be the tiniest number (Ntiny). */ /* */ /* 2. Normalizing x to be <=0.1 (instead of <=1) reduces loop */ -/* iterations by appoximately a third with additional (although */ +/* iterations by approximately a third with additional (although */ /* diminishing) returns as the range is reduced to even smaller */ /* fractions. However, h (the power of 10 used to correct the */ /* result at the end, see below) must be kept <=8 as otherwise */ @@ -5278,7 +5278,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, /* is treated like other buffers, using DECBUFFER, +1 in case */ /* DECBUFFER is 0 */ decNumber bufr[D2N(DECBUFFER*2+1)]; - decNumber *allocrhs=NULL; /* non-NULL if rhs buffer allocated */ + decNumber *allocrhs=nullptr; /* non-nullptr if rhs buffer allocated */ /* the working precision will be no more than set->digits+8+1 */ /* so for on-stack buffers DECBUFFER+9 is used, +1 in case DECBUFFER */ @@ -5286,11 +5286,11 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, /* buffer for t, term (working precision plus) */ decNumber buft[D2N(DECBUFFER*2+9+1)]; - decNumber *allocbuft=NULL; /* -> allocated buft, iff allocated */ + decNumber *allocbuft=nullptr; /* -> allocated buft, iff allocated */ decNumber *t=buft; /* term */ /* buffer for a, accumulator (working precision * 2), at least 9 */ decNumber bufa[D2N(DECBUFFER*4+18+1)]; - decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */ + decNumber *allocbufa=nullptr; /* -> allocated bufa, iff allocated */ decNumber *a=bufa; /* accumulator */ /* decNumber for the divisor term; this needs at most 9 digits */ /* and so can be fixed size [16 so can use standard context] */ @@ -5310,7 +5310,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, uprv_decNumberZero(res); else uprv_decNumberCopy(res, rhs); /* +Infinity -> self */ } - else decNaNs(res, rhs, NULL, set, status); /* a NaN */ + else decNaNs(res, rhs, nullptr, set, status); /* a NaN */ break;} if (ISZERO(rhs)) { /* zeros -> exact 1 */ @@ -5337,7 +5337,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, d->exponent=-set->digits; /* * 10**(-d) */ if (decNumberIsNegative(rhs)) d->exponent--; /* negative case */ comp=decCompare(d, rhs, 1); /* signless compare */ - if (comp==DECNUMBER_BADINT) { + if (comp==BADINT) { *status|=DEC_Insufficient_storage; break;} if (comp>=0) { /* rhs < d */ @@ -5400,7 +5400,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufr)) { /* need malloc space */ allocrhs=(decNumber *)malloc(needbytes); - if (allocrhs==NULL) { /* hopeless -- abandon */ + if (allocrhs==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} newrhs=allocrhs; /* use the allocated space */ @@ -5432,7 +5432,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, needbytes=sizeof(decNumber)+(D2U(p*2)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { /* need malloc space */ allocbufa=(decNumber *)malloc(needbytes); - if (allocbufa==NULL) { /* hopeless -- abandon */ + if (allocbufa==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} a=allocbufa; /* use the allocated space */ @@ -5444,7 +5444,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, needbytes=sizeof(decNumber)+(D2U(p+2)-1)*sizeof(Unit); if (needbytes>sizeof(buft)) { /* need malloc space */ allocbuft=(decNumber *)malloc(needbytes); - if (allocbuft==NULL) { /* hopeless -- abandon */ + if (allocbuft==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} t=allocbuft; /* use the allocated space */ @@ -5474,7 +5474,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, /* [but it should remain unchanged after first add] */ decAddOp(a, a, t, &aset, 0, status); /* a=a+t */ decMultiplyOp(t, t, x, &tset, &ignore); /* t=t*x */ - decDivideOp(t, t, d, &tset, DECNUMBER_DIVIDE, &ignore); /* t=t/d */ + decDivideOp(t, t, d, &tset, DIVIDE, &ignore); /* t=t/d */ /* the iteration ends when the term cannot affect the result, */ /* if rounded to p digits, which is when its value is smaller */ /* than the accumulator by p+1 digits. There must also be */ @@ -5497,7 +5497,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, if (h>0) { Int seenbit=0; /* set once a 1-bit is seen */ Int i; /* counter */ - Int n=DECNUMBER_powers[h]; /* always positive */ + Int n=powers[h]; /* always positive */ aset.digits=p+2; /* sufficient precision */ /* avoid the overhead and many extra digits of decNumberPower */ /* as all that is needed is the short 'multipliers' loop; here */ @@ -5528,9 +5528,9 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs, decFinish(res, set, &residue, status); /* cleanup/set flags */ } while(0); /* end protected */ - if (allocrhs !=NULL) free(allocrhs); /* drop any storage used */ - if (allocbufa!=NULL) free(allocbufa); /* .. */ - if (allocbuft!=NULL) free(allocbuft); /* .. */ + if (allocrhs !=nullptr) free(allocrhs); /* drop any storage used */ + if (allocbufa!=nullptr) free(allocbufa); /* .. */ + if (allocbuft!=nullptr) free(allocbuft); /* .. */ /* [status is handled by caller] */ return res; } /* decExpOp */ @@ -5616,7 +5616,7 @@ static const uShort LNnn[90]={9016, 8652, 8316, 8008, 7724, 7456, 7208, /* would certainly save at least one if it were made ten times */ /* bigger, too (for truncated fractions 0.100 through 0.999). */ /* However, for most practical evaluations, at least four or five */ -/* iterations will be neede -- so this would only speed up by */ +/* iterations will be needed -- so this would only speed up by */ /* 20-25% and that probably does not justify increasing the table */ /* size. */ /* */ @@ -5640,10 +5640,10 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs, /* buffers for a (accumulator, typically precision+2) and b */ /* (adjustment calculator, same size) */ decNumber bufa[D2N(DECBUFFER+12)]; - decNumber *allocbufa=NULL; /* -> allocated bufa, iff allocated */ + decNumber *allocbufa=nullptr; /* -> allocated bufa, iff allocated */ decNumber *a=bufa; /* accumulator/work */ decNumber bufb[D2N(DECBUFFER*2+2)]; - decNumber *allocbufb=NULL; /* -> allocated bufa, iff allocated */ + decNumber *allocbufb=nullptr; /* -> allocated bufa, iff allocated */ decNumber *b=bufb; /* adjustment/work */ decNumber numone; /* constant 1 */ @@ -5662,7 +5662,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs, *status|=DEC_Invalid_operation; else uprv_decNumberCopy(res, rhs); /* +Infinity -> self */ } - else decNaNs(res, rhs, NULL, set, status); /* a NaN */ + else decNaNs(res, rhs, nullptr, set, status); /* a NaN */ break;} if (ISZERO(rhs)) { /* +/- zeros -> -Infinity */ @@ -5713,7 +5713,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs, needbytes=sizeof(decNumber)+(D2U(MAXI(p,16))-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { /* need malloc space */ allocbufa=(decNumber *)malloc(needbytes); - if (allocbufa==NULL) { /* hopeless -- abandon */ + if (allocbufa==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} a=allocbufa; /* use the allocated space */ @@ -5722,7 +5722,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs, needbytes=sizeof(decNumber)+(D2U(MAXI(pp,16))-1)*sizeof(Unit); if (needbytes>sizeof(bufb)) { /* need malloc space */ allocbufb=(decNumber *)malloc(needbytes); - if (allocbufb==NULL) { /* hopeless -- abandon */ + if (allocbufb==nullptr) { /* hopeless -- abandon */ *status|=DEC_Insufficient_storage; break;} b=allocbufb; /* use the allocated space */ @@ -5809,7 +5809,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs, (a->digits+a->exponent)>=(b->digits+b->exponent+set->digits+1)) { if (a->digits==p) break; if (decNumberIsZero(a)) { - decCompareOp(&cmp, rhs, &numone, &aset, DECNUMBER_COMPARE, &ignore); /* rhs=1 ? */ + decCompareOp(&cmp, rhs, &numone, &aset, COMPARE, &ignore); /* rhs=1 ? */ if (cmp.lsu[0]==0) a->exponent=0; /* yes, exact 0 */ else *status|=(DEC_Inexact | DEC_Rounded); /* no, inexact */ break; @@ -5843,8 +5843,8 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs, decFinish(res, set, &residue, status); /* cleanup/set flags */ } while(0); /* end protected */ - if (allocbufa!=NULL) free(allocbufa); /* drop any storage used */ - if (allocbufb!=NULL) free(allocbufb); /* .. */ + if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used */ + if (allocbufb!=nullptr) free(allocbufb); /* .. */ /* [status is handled by caller] */ return res; } /* decLnOp */ @@ -5878,8 +5878,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, Flag quant, uInt *status) { #if DECSUBSET - decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */ - decNumber *allocrhs=NULL; /* .., rhs */ + decNumber *alloclhs=nullptr; /* non-nullptr if rounded lhs allocated */ + decNumber *allocrhs=nullptr; /* .., rhs */ #endif const decNumber *inrhs=rhs; /* save original rhs */ Int reqdigits=set->digits; /* requested DIGITS */ @@ -5897,12 +5897,12 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs, /* reduce operands and set lostDigits status, as needed */ if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, status); - if (alloclhs==NULL) break; + if (alloclhs==nullptr) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { /* [this only checks lostDigits] */ allocrhs=decRoundOperand(rhs, set, status); - if (allocrhs==NULL) break; + if (allocrhs==nullptr) break; rhs=allocrhs; } } @@ -5935,8 +5935,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs, if (!set->extended) etiny=set->emin; /* no subnormals */ #endif - if (reqexp==DECNUMBER_BADINT /* bad (rescale only) or .. */ - || reqexp==DECNUMBER_BIGODD || reqexp==DECNUMBER_BIGEVEN /* very big (ditto) or .. */ + if (reqexp==BADINT /* bad (rescale only) or .. */ + || reqexp==BIGODD || reqexp==BIGEVEN /* very big (ditto) or .. */ || (reqexpset->emax)) { /* > emax */ *status|=DEC_Invalid_operation; @@ -6011,8 +6011,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs, } while(0); /* end protected */ #if DECSUBSET - if (allocrhs!=NULL) free(allocrhs); /* drop any storage used */ - if (alloclhs!=NULL) free(alloclhs); /* .. */ + if (allocrhs!=nullptr) free(allocrhs); /* drop any storage used */ + if (alloclhs!=nullptr) free(alloclhs); /* .. */ #endif return res; } /* decQuantizeOp */ @@ -6021,16 +6021,16 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs, /* decCompareOp -- compare, min, or max two Numbers */ /* */ /* This computes C = A ? B and carries out one of four operations: */ -/* DECNUMBER_COMPARE -- returns the signum (as a number) giving the */ +/* COMPARE -- returns the signum (as a number) giving the */ /* result of a comparison unless one or both */ /* operands is a NaN (in which case a NaN results) */ -/* DECNUMBER_COMPSIG -- as DECNUMBER_COMPARE except that a quiet NaN raises */ +/* COMPSIG -- as COMPARE except that a quiet NaN raises */ /* Invalid operation. */ -/* DECNUMBER_COMPMAX -- returns the larger of the operands, using the */ +/* COMPMAX -- returns the larger of the operands, using the */ /* 754 maxnum operation */ -/* DECNUMBER_COMPMAXMAG -- ditto, comparing absolute values */ -/* DECNUMBER_COMPMIN -- the 754 minnum operation */ -/* DECNUMBER_COMPMINMAG -- ditto, comparing absolute values */ +/* COMPMAXMAG -- ditto, comparing absolute values */ +/* COMPMIN -- the 754 minnum operation */ +/* COMPMINMAG -- ditto, comparing absolute values */ /* COMTOTAL -- returns the signum (as a number) giving the */ /* result of a comparison using 754 total ordering */ /* */ @@ -6041,8 +6041,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs, /* op is the operation flag */ /* status is the usual accumulator */ /* */ -/* C must have space for one digit for DECNUMBER_COMPARE or set->digits for */ -/* DECNUMBER_COMPMAX, DECNUMBER_COMPMIN, DECNUMBER_COMPMAXMAG, or DECNUMBER_COMPMINMAG. */ +/* C must have space for one digit for COMPARE or set->digits for */ +/* COMPMAX, COMPMIN, COMPMAXMAG, or COMPMINMAG. */ /* ------------------------------------------------------------------ */ /* The emphasis here is on speed for common cases, and avoiding */ /* coefficient comparison if possible. */ @@ -6051,8 +6051,8 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, Flag op, uInt *status) { #if DECSUBSET - decNumber *alloclhs=NULL; /* non-NULL if rounded lhs allocated */ - decNumber *allocrhs=NULL; /* .., rhs */ + decNumber *alloclhs=nullptr; /* non-nullptr if rounded lhs allocated */ + decNumber *allocrhs=nullptr; /* .., rhs */ #endif Int result=0; /* default result value */ uByte merged; /* work */ @@ -6067,12 +6067,12 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, /* reduce operands and set lostDigits status, as needed */ if (lhs->digits>set->digits) { alloclhs=decRoundOperand(lhs, set, status); - if (alloclhs==NULL) {result=DECNUMBER_BADINT; break;} + if (alloclhs==nullptr) {result=BADINT; break;} lhs=alloclhs; } if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, status); - if (allocrhs==NULL) {result=DECNUMBER_BADINT; break;} + if (allocrhs==nullptr) {result=BADINT; break;} rhs=allocrhs; } } @@ -6080,7 +6080,7 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, /* [following code does not require input rounding] */ /* If total ordering then handle differing signs 'up front' */ - if (op==DECNUMBER_COMPTOTAL) { /* total ordering */ + if (op==COMPTOTAL) { /* total ordering */ if (decNumberIsNegative(lhs) && !decNumberIsNegative(rhs)) { result=-1; break; @@ -6095,10 +6095,10 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, /* This assumes sNaN (even just one) leads to NaN. */ merged=(lhs->bits | rhs->bits) & (DECSNAN | DECNAN); if (merged) { /* a NaN bit set */ - if (op==DECNUMBER_COMPARE); /* result will be NaN */ - else if (op==DECNUMBER_COMPSIG) /* treat qNaN as sNaN */ - *status|=DEC_Invalid_operation | DECNUMBER_DEC_sNaN; - else if (op==DECNUMBER_COMPTOTAL) { /* total ordering, always finite */ + if (op==COMPARE); /* result will be NaN */ + else if (op==COMPSIG) /* treat qNaN as sNaN */ + *status|=DEC_Invalid_operation | DEC_sNaN; + else if (op==COMPTOTAL) { /* total ordering, always finite */ /* signs are known to be the same; compute the ordering here */ /* as if the signs are both positive, then invert for negatives */ if (!decNumberIsNaN(lhs)) result=-1; @@ -6121,25 +6121,25 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, /* min or max -- 754 rules ignore single NaN */ if (!decNumberIsNaN(lhs) || !decNumberIsNaN(rhs)) { /* just one NaN; force choice to be the non-NaN operand */ - op=DECNUMBER_COMPMAX; + op=COMPMAX; if (lhs->bits & DECNAN) result=-1; /* pick rhs */ else result=+1; /* pick lhs */ break; } } /* max or min */ - op=DECNUMBER_COMPNAN; /* use special path */ + op=COMPNAN; /* use special path */ decNaNs(res, lhs, rhs, set, status); /* propagate NaN */ break; } /* have numbers */ - if (op==DECNUMBER_COMPMAXMAG || op==DECNUMBER_COMPMINMAG) result=decCompare(lhs, rhs, 1); + if (op==COMPMAXMAG || op==COMPMINMAG) result=decCompare(lhs, rhs, 1); else result=decCompare(lhs, rhs, 0); /* sign matters */ } while(0); /* end protected */ - if (result==DECNUMBER_BADINT) *status|=DEC_Insufficient_storage; /* rare */ + if (result==BADINT) *status|=DEC_Insufficient_storage; /* rare */ else { - if (op==DECNUMBER_COMPARE || op==DECNUMBER_COMPSIG ||op==DECNUMBER_COMPTOTAL) { /* returning signum */ - if (op==DECNUMBER_COMPTOTAL && result==0) { + if (op==COMPARE || op==COMPSIG ||op==COMPTOTAL) { /* returning signum */ + if (op==COMPTOTAL && result==0) { /* operands are numerically equal or same NaN (and same sign, */ /* tested first); if identical, leave result 0 */ if (lhs->exponent!=rhs->exponent) { @@ -6154,7 +6154,7 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, if (result<0) res->bits=DECNEG; } } - else if (op==DECNUMBER_COMPNAN); /* special, drop through */ + else if (op==COMPNAN); /* special, drop through */ else { /* MAX or MIN, non-NaN result */ Int residue=0; /* rounding accumulator */ /* choose the operand for the result */ @@ -6165,7 +6165,7 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, uByte srhs=(rhs->bits & DECNEG); #if DECSUBSET if (!set->extended) { /* subset: force left-hand */ - op=DECNUMBER_COMPMAX; + op=COMPMAX; result=+1; } else @@ -6186,7 +6186,7 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, } } /* numerically equal */ /* here result will be non-0; reverse if looking for MIN */ - if (op==DECNUMBER_COMPMIN || op==DECNUMBER_COMPMINMAG) result=-result; + if (op==COMPMIN || op==COMPMINMAG) result=-result; choice=(result>0 ? lhs : rhs); /* choose */ /* copy chosen to result, rounding if need be */ decCopyFit(res, choice, set, &residue, status); @@ -6194,8 +6194,8 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, } } #if DECSUBSET - if (allocrhs!=NULL) free(allocrhs); /* free any storage used */ - if (alloclhs!=NULL) free(alloclhs); /* .. */ + if (allocrhs!=nullptr) free(allocrhs); /* free any storage used */ + if (alloclhs!=nullptr) free(alloclhs); /* .. */ #endif return res; } /* decCompareOp */ @@ -6209,7 +6209,7 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs, /* Arg2 is B, a decNumber which is not a NaN */ /* Arg3 is 1 for a sign-independent compare, 0 otherwise */ /* */ -/* returns -1, 0, or 1 for AB, or DECNUMBER_BADINT if failure */ +/* returns -1, 0, or 1 for AB, or BADINT if failure */ /* (the only possible failure is an allocation error) */ /* ------------------------------------------------------------------ */ static Int decCompare(const decNumber *lhs, const decNumber *rhs, @@ -6255,7 +6255,7 @@ static Int decCompare(const decNumber *lhs, const decNumber *rhs, compare=decUnitCompare(lhs->lsu, D2U(lhs->digits), rhs->lsu, D2U(rhs->digits), rhs->exponent-lhs->exponent); - if (compare!=DECNUMBER_BADINT) compare*=result; /* comparison succeeded */ + if (compare!=BADINT) compare*=result; /* comparison succeeded */ return compare; } /* decCompare */ @@ -6272,7 +6272,7 @@ static Int decCompare(const decNumber *lhs, const decNumber *rhs, /* Arg4 is B length in Units */ /* Arg5 is E (0 if the units are aligned) */ /* */ -/* returns -1, 0, or 1 for AB, or DECNUMBER_BADINT if failure */ +/* returns -1, 0, or 1 for AB, or BADINT if failure */ /* (the only possible failure is an allocation error, which can */ /* only occur if E!=0) */ /* ------------------------------------------------------------------ */ @@ -6280,7 +6280,7 @@ static Int decUnitCompare(const Unit *a, Int alength, const Unit *b, Int blength, Int exp) { Unit *acc; /* accumulator for result */ Unit accbuff[SD2U(DECBUFFER*2+1)]; /* local buffer */ - Unit *allocacc=NULL; /* -> allocated acc buffer, iff allocated */ + Unit *allocacc=nullptr; /* -> allocated acc buffer, iff allocated */ Int accunits, need; /* units in use or needed for acc */ const Unit *l, *r, *u; /* work */ Int expunits, exprem, result; /* .. */ @@ -6312,7 +6312,7 @@ static Int decUnitCompare(const Unit *a, Int alength, acc=accbuff; /* assume use local buffer */ if (need*sizeof(Unit)>sizeof(accbuff)) { allocacc=(Unit *)malloc(need*sizeof(Unit)); - if (allocacc==NULL) return DECNUMBER_BADINT; /* hopeless -- abandon */ + if (allocacc==nullptr) return BADINT; /* hopeless -- abandon */ acc=allocacc; } /* Calculate units and remainder from exponent. */ @@ -6320,7 +6320,7 @@ static Int decUnitCompare(const Unit *a, Int alength, exprem=exp%DECDPUN; /* subtract [A+B*(-m)] */ accunits=decUnitAddSub(a, alength, b, blength, expunits, acc, - -(Int)DECNUMBER_powers[exprem]); + -(Int)powers[exprem]); /* [UnitAddSub result may have leading zeros, even on zero] */ if (accunits<0) result=-1; /* negative result */ else { /* non-negative result */ @@ -6329,7 +6329,7 @@ static Int decUnitCompare(const Unit *a, Int alength, result=(*u==0 ? 0 : +1); } /* clean up and return the result */ - if (allocacc!=NULL) free(allocacc); /* drop any storage used */ + if (allocacc!=nullptr) free(allocacc); /* drop any storage used */ return result; } /* decUnitCompare */ @@ -6657,12 +6657,12 @@ static decNumber * decTrim(decNumber *dn, decContext *set, Flag all, cut=1; /* digit (1-DECDPUN) in Unit */ up=dn->lsu; /* -> current Unit */ for (d=0; ddigits-1; d++) { /* [don't strip the final digit] */ - /* slice by DECNUMBER_powers */ + /* slice by powers */ #if DECDPUN<=4 uInt quot=QUOT10(*up, cut); - if ((*up-quot*DECNUMBER_powers[cut])!=0) break; /* found non-0 digit */ + if ((*up-quot*powers[cut])!=0) break; /* found non-0 digit */ #else - if (*up%DECNUMBER_powers[cut]!=0) break; /* found non-0 digit */ + if (*up%powers[cut]!=0) break; /* found non-0 digit */ #endif /* have a trailing 0 */ if (!all) { /* trimming */ @@ -6735,7 +6735,7 @@ static Int decShiftToMost(Unit *uar, Int digits, Int shift) { if (shift==0) return digits; /* [fastpath] nothing to do */ if ((digits+shift)<=DECDPUN) { /* [fastpath] single-unit case */ - *uar=(Unit)(*uar*DECNUMBER_powers[shift]); + *uar=(Unit)(*uar*powers[shift]); return digits+shift; } @@ -6752,14 +6752,14 @@ static Int decShiftToMost(Unit *uar, Int digits, Int shift) { /* split the source Unit and accumulate remainder for next */ #if DECDPUN<=4 uInt quot=QUOT10(*source, cut); - uInt rem=*source-quot*DECNUMBER_powers[cut]; + uInt rem=*source-quot*powers[cut]; next+=quot; #else - uInt rem=*source%DECNUMBER_powers[cut]; - next+=*source/DECNUMBER_powers[cut]; + uInt rem=*source%powers[cut]; + next+=*source/powers[cut]; #endif if (target<=first) *target=(Unit)next; /* write to target iff valid */ - next=rem*DECNUMBER_powers[DECDPUN-cut]; /* save remainder for next Unit */ + next=rem*powers[DECDPUN-cut]; /* save remainder for next Unit */ } } /* shift-move */ @@ -6809,7 +6809,7 @@ static Int decShiftToLeast(Unit *uar, Int units, Int shift) { #if DECDPUN<=4 quot=QUOT10(*up, cut); #else - quot=*up/DECNUMBER_powers[cut]; + quot=*up/powers[cut]; #endif for (; ; target++) { *target=(Unit)quot; @@ -6819,12 +6819,12 @@ static Int decShiftToLeast(Unit *uar, Int units, Int shift) { quot=*up; #if DECDPUN<=4 quot=QUOT10(quot, cut); - rem=*up-quot*DECNUMBER_powers[cut]; + rem=*up-quot*powers[cut]; #else - rem=quot%DECNUMBER_powers[cut]; - quot=quot/DECNUMBER_powers[cut]; + rem=quot%powers[cut]; + quot=quot/powers[cut]; #endif - *target=(Unit)(*target+rem*DECNUMBER_powers[DECDPUN-cut]); + *target=(Unit)(*target+rem*powers[DECDPUN-cut]); count-=cut; if (count<=0) break; } @@ -6847,7 +6847,7 @@ static Int decShiftToLeast(Unit *uar, Int units, Int shift) { /* Instead, return an allocated decNumber, rounded as required. */ /* It is the caller's responsibility to free the allocated storage. */ /* */ -/* If no storage is available then the result cannot be used, so NULL */ +/* If no storage is available then the result cannot be used, so nullptr */ /* is returned. */ /* ------------------------------------------------------------------ */ static decNumber *decRoundOperand(const decNumber *dn, decContext *set, @@ -6860,9 +6860,9 @@ static decNumber *decRoundOperand(const decNumber *dn, decContext *set, /* length specified by the context */ res=(decNumber *)malloc(sizeof(decNumber) +(D2U(set->digits)-1)*sizeof(Unit)); - if (res==NULL) { + if (res==nullptr) { *status|=DEC_Insufficient_storage; - return NULL; + return nullptr; } decCopyFit(res, dn, set, &residue, &newstatus); decApplyRound(res, set, residue, &newstatus); @@ -6995,7 +6995,7 @@ static void decSetCoeff(decNumber *dn, decContext *set, const Unit *lsu, /* here up -> Unit with first discarded digit */ cut=discard-(count-DECDPUN)-1; if (cut==DECDPUN-1) { /* unit-boundary case (fast) */ - Unit half=(Unit)DECNUMBER_powers[DECDPUN]>>1; + Unit half=(Unit)powers[DECDPUN]>>1; /* set residue directly */ if (*up>=half) { if (*up>half) *residue=7; @@ -7026,10 +7026,10 @@ static void decSetCoeff(decNumber *dn, decContext *set, const Unit *lsu, #if DECDPUN<=4 U_ASSERT(/* cut >= 0 &&*/ cut <= 4); quot=QUOT10(*up, cut); - rem=*up-quot*DECNUMBER_powers[cut]; + rem=*up-quot*powers[cut]; #else - rem=*up%DECNUMBER_powers[cut]; - quot=*up/DECNUMBER_powers[cut]; + rem=*up%powers[cut]; + quot=*up/powers[cut]; #endif if (rem!=0) *residue=1; } @@ -7066,12 +7066,12 @@ static void decSetCoeff(decNumber *dn, decContext *set, const Unit *lsu, quot=*up; #if DECDPUN<=4 quot=QUOT10(quot, cut); - rem=*up-quot*DECNUMBER_powers[cut]; + rem=*up-quot*powers[cut]; #else - rem=quot%DECNUMBER_powers[cut]; - quot=quot/DECNUMBER_powers[cut]; + rem=quot%powers[cut]; + quot=quot/powers[cut]; #endif - *target=(Unit)(*target+rem*DECNUMBER_powers[DECDPUN-cut]); + *target=(Unit)(*target+rem*powers[DECDPUN-cut]); count-=cut; if (count<=0) break; } /* shift-copy loop */ @@ -7186,7 +7186,7 @@ static void decApplyRound(decNumber *dn, decContext *set, Int residue, default: { /* e.g., DEC_ROUND_MAX */ *status|=DEC_Invalid_context; - #if DECTRACE || (DECCHECK && DECNUMBER_DECVERB) + #if DECTRACE || (DECCHECK && DECVERB) printf("Unknown rounding mode: %d\n", set->round); #endif break;} @@ -7206,9 +7206,9 @@ static void decApplyRound(decNumber *dn, decContext *set, Int residue, for (up=dn->lsu; ; up++) { if (count<=DECDPUN) { /* this is the last Unit (the msu) */ - if (*up!=DECNUMBER_powers[count]-1) break; /* not still 9s */ + if (*up!=powers[count]-1) break; /* not still 9s */ /* here if it, too, is all nines */ - *up=(Unit)DECNUMBER_powers[count-1]; /* here 999 -> 100 etc. */ + *up=(Unit)powers[count-1]; /* here 999 -> 100 etc. */ for (up=up-1; up>=dn->lsu; up--) *up=0; /* others all to 0 */ dn->exponent++; /* and bump exponent */ /* [which, very rarely, could cause Overflow...] */ @@ -7230,12 +7230,12 @@ static void decApplyRound(decNumber *dn, decContext *set, Int residue, for (up=dn->lsu; ; up++) { if (count<=DECDPUN) { /* this is the last Unit (the msu) */ - if (*up!=DECNUMBER_powers[count-1]) break; /* not 100.. */ + if (*up!=powers[count-1]) break; /* not 100.. */ /* here if have the 1000... case */ sup=up; /* save msu pointer */ - *up=(Unit)DECNUMBER_powers[count]-1; /* here 100 in msu -> 999 */ + *up=(Unit)powers[count]-1; /* here 100 in msu -> 999 */ /* others all to all-nines, too */ - for (up=up-1; up>=dn->lsu; up--) *up=(Unit)DECNUMBER_powers[DECDPUN]-1; + for (up=up-1; up>=dn->lsu; up--) *up=(Unit)powers[DECDPUN]-1; dn->exponent--; /* and bump exponent */ /* iff the number was at the subnormal boundary (exponent=etiny) */ @@ -7246,7 +7246,7 @@ static void decApplyRound(decNumber *dn, decContext *set, Int residue, if (dn->exponent+1==set->emin-set->digits+1) { if (count==1 && dn->digits==1) *sup=0; /* here 9 -> 0[.9] */ else { - *sup=(Unit)DECNUMBER_powers[count-1]-1; /* here 999.. in msu -> 99.. */ + *sup=(Unit)powers[count-1]-1; /* here 999.. in msu -> 99.. */ dn->digits--; } dn->exponent++; @@ -7343,7 +7343,7 @@ static void decFinalize(decNumber *dn, decContext *set, Int *residue, nmin.lsu[0]=1; nmin.exponent=set->emin; comp=decCompare(dn, &nmin, 1); /* (signless compare) */ - if (comp==DECNUMBER_BADINT) { /* oops */ + if (comp==BADINT) { /* oops */ *status|=DEC_Insufficient_storage; /* abandon... */ return; } @@ -7446,7 +7446,7 @@ static void decSetMaxValue(decNumber *dn, decContext *set) { for (up=dn->lsu; ; up++) { if (count>DECDPUN) *up=DECDPUNMAX; /* unit full o'nines */ else { /* this is the msu */ - *up=(Unit)(DECNUMBER_powers[count]-1); + *up=(Unit)(powers[count]-1); break; } count-=DECDPUN; /* filled those digits */ @@ -7577,14 +7577,14 @@ static uInt decCheckMath(const decNumber *rhs, decContext *set, /* dn is the number [which will not be altered] */ /* */ /* returns one of: */ -/* DECNUMBER_BADINT if there is a non-zero fraction */ +/* BADINT if there is a non-zero fraction */ /* the converted integer */ -/* DECNUMBER_BIGEVEN if the integer is even and magnitude > 2*10**9 */ -/* DECNUMBER_BIGODD if the integer is odd and magnitude > 2*10**9 */ +/* BIGEVEN if the integer is even and magnitude > 2*10**9 */ +/* BIGODD if the integer is odd and magnitude > 2*10**9 */ /* */ /* This checks and gets a whole number from the input decNumber. */ -/* The sign can be determined from dn by the caller when DECNUMBER_BIGEVEN or */ -/* DECNUMBER_BIGODD is returned. */ +/* The sign can be determined from dn by the caller when BIGEVEN or */ +/* BIGODD is returned. */ /* ------------------------------------------------------------------ */ static Int decGetInt(const decNumber *dn) { Int theInt; /* result accumulator */ @@ -7613,7 +7613,7 @@ static Int decGetInt(const decNumber *dn) { Int count=-dn->exponent; /* digits to discard */ /* spin up whole units until reach the Unit with the unit digit */ for (; count>=DECDPUN; up++) { - if (*up!=0) return DECNUMBER_BADINT; /* non-zero Unit to discard */ + if (*up!=0) return BADINT; /* non-zero Unit to discard */ count-=DECDPUN; } if (count==0) got=0; /* [a multiple of DECDPUN] */ @@ -7622,12 +7622,12 @@ static Int decGetInt(const decNumber *dn) { /* slice off fraction digits and check for non-zero */ #if DECDPUN<=4 theInt=QUOT10(*up, count); - rem=*up-theInt*DECNUMBER_powers[count]; + rem=*up-theInt*powers[count]; #else - rem=*up%DECNUMBER_powers[count]; /* slice off discards */ - theInt=*up/DECNUMBER_powers[count]; + rem=*up%powers[count]; /* slice off discards */ + theInt=*up/powers[count]; #endif - if (rem!=0) return DECNUMBER_BADINT; /* non-zero fraction */ + if (rem!=0) return BADINT; /* non-zero fraction */ /* it looks good */ got=DECDPUN-count; /* number of digits so far */ up++; /* ready for next */ @@ -7642,12 +7642,12 @@ static Int decGetInt(const decNumber *dn) { Int save=theInt; /* collect any remaining unit(s) */ for (; got1999999997) ilength=11; else if (!neg && theInt>999999999) ilength=11; if (ilength==11) theInt=save; /* restore correct low bit */ @@ -7655,8 +7655,8 @@ static Int decGetInt(const decNumber *dn) { } if (ilength>10) { /* too big */ - if (theInt&1) return DECNUMBER_BIGODD; /* bottom bit 1 */ - return DECNUMBER_BIGEVEN; /* bottom bit 0 */ + if (theInt&1) return BIGODD; /* bottom bit 1 */ + return BIGEVEN; /* bottom bit 0 */ } if (neg) theInt=-theInt; /* apply sign */ @@ -7690,7 +7690,7 @@ static decNumber *decDecap(decNumber *dn, Int drop) { } msu=dn->lsu+D2U(dn->digits-drop)-1; /* -> likely msu */ cut=MSUDIGITS(dn->digits-drop); /* digits to be in use in msu */ - if (cut!=DECDPUN) *msu%=DECNUMBER_powers[cut]; /* clear left digits */ + if (cut!=DECDPUN) *msu%=powers[cut]; /* clear left digits */ /* that may have left leading zero digits, so do a proper count... */ dn->digits=decGetDigits(dn->lsu, static_cast(msu-dn->lsu+1)); return dn; @@ -7725,7 +7725,7 @@ static Flag decBiStr(const char *targ, const char *str1, const char *str2) { /* */ /* res is the result number */ /* lhs is the first operand */ -/* rhs is the second operand, or NULL if none */ +/* rhs is the second operand, or nullptr if none */ /* context is used to limit payload length */ /* status contains the current status */ /* returns res in case convenient */ @@ -7740,11 +7740,11 @@ static decNumber * decNaNs(decNumber *res, const decNumber *lhs, /* This decision tree ends up with LHS being the source pointer, */ /* and status updated if need be */ if (lhs->bits & DECSNAN) - *status|=DEC_Invalid_operation | DECNUMBER_DEC_sNaN; - else if (rhs==NULL); + *status|=DEC_Invalid_operation | DEC_sNaN; + else if (rhs==nullptr); else if (rhs->bits & DECSNAN) { lhs=rhs; - *status|=DEC_Invalid_operation | DECNUMBER_DEC_sNaN; + *status|=DEC_Invalid_operation | DEC_sNaN; } else if (lhs->bits & DECNAN); else lhs=rhs; @@ -7788,7 +7788,7 @@ static decNumber * decNaNs(decNumber *res, const decNumber *lhs, static void decStatus(decNumber *dn, uInt status, decContext *set) { if (status & DEC_NaNs) { /* error status -> NaN */ /* if cause was an sNaN, clear and propagate [NaN is already set up] */ - if (status & DECNUMBER_DEC_sNaN) status&=~DECNUMBER_DEC_sNaN; + if (status & DEC_sNaN) status&=~DEC_sNaN; else { uprv_decNumberZero(dn); /* other error: clean throughout */ dn->bits=DECNAN; /* and make a quiet NaN */ @@ -7838,7 +7838,7 @@ static Int decGetDigits(Unit *uar, Int len) { if (*up<1000) break; /* is 100-999 */ digits++; #if DECDPUN>4 /* count the rest ... */ - for (pow=&DECNUMBER_powers[4]; *up>=*pow; pow++) digits++; + for (pow=&powers[4]; *up>=*pow; pow++) digits++; #endif #endif #endif @@ -7862,8 +7862,8 @@ void uprv_decNumberShow(const decNumber *dn) { uInt u, d; /* .. */ Int cut; /* .. */ char isign='+'; /* main sign */ - if (dn==NULL) { - printf("NULL\n"); + if (dn==nullptr) { + printf("nullptr\n"); return;} if (decNumberIsNegative(dn)) isign='-'; printf(" >> %c ", isign); @@ -7888,8 +7888,8 @@ void uprv_decNumberShow(const decNumber *dn) { u=*up; printf(":"); for (cut=DECDPUN-1; cut>=0; cut--) { - d=u/DECNUMBER_powers[cut]; - u-=d*DECNUMBER_powers[cut]; + d=u/powers[cut]; + u-=d*powers[cut]; printf("%ld", (LI)d); } /* cut */ } /* up */ @@ -7944,39 +7944,39 @@ static void decDumpAr(char name, const Unit *ar, Int len) { /* ------------------------------------------------------------------ */ /* decCheckOperands -- check operand(s) to a routine */ /* res is the result structure (not checked; it will be set to */ -/* quiet NaN if error found (and it is not NULL)) */ +/* quiet NaN if error found (and it is not nullptr)) */ /* lhs is the first operand (may be DECUNRESU) */ /* rhs is the second (may be DECUNUSED) */ /* set is the context (may be DECUNCONT) */ /* returns 0 if both operands, and the context are clean, or 1 */ /* otherwise (in which case the context will show an error, */ -/* unless NULL). Note that res is not cleaned; caller should */ -/* handle this so res=NULL case is safe. */ +/* unless nullptr). Note that res is not cleaned; caller should */ +/* handle this so res=nullptr case is safe. */ /* The caller is expected to abandon immediately if 1 is returned. */ /* ------------------------------------------------------------------ */ static Flag decCheckOperands(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { Flag bad=0; - if (set==NULL) { /* oops; hopeless */ - #if DECTRACE || DECNUMBER_DECVERB - printf("Reference to context is NULL.\n"); + if (set==nullptr) { /* oops; hopeless */ + #if DECTRACE || DECVERB + printf("Reference to context is nullptr.\n"); #endif bad=1; return 1;} else if (set!=DECUNCONT && (set->digits<1 || set->round>=DEC_ROUND_MAX)) { bad=1; - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("Bad context [digits=%ld round=%ld].\n", (LI)set->digits, (LI)set->round); #endif } else { - if (res==NULL) { + if (res==nullptr) { bad=1; #if DECTRACE - /* this one not DECNUMBER_DECVERB as standard tests include NULL */ - printf("Reference to result is NULL.\n"); + /* this one not DECVERB as standard tests include nullptr */ + printf("Reference to result is nullptr.\n"); #endif } if (!bad && lhs!=DECUNUSED) bad=(decCheckNumber(lhs)); @@ -7984,7 +7984,7 @@ static Flag decCheckOperands(decNumber *res, const decNumber *lhs, } if (bad) { if (set!=DECUNCONT) uprv_decContextSetStatus(set, DEC_Invalid_operation); - if (res!=DECUNRESU && res!=NULL) { + if (res!=DECUNRESU && res!=nullptr) { uprv_decNumberZero(res); res->bits=DECNAN; /* qNaN */ } @@ -8006,17 +8006,17 @@ static Flag decCheckNumber(const decNumber *dn) { Int ae, d, digits; /* .. */ Int emin, emax; /* .. */ - if (dn==NULL) { /* hopeless */ + if (dn==nullptr) { /* hopeless */ #if DECTRACE - /* this one not DECNUMBER_DECVERB as standard tests include NULL */ - printf("Reference to decNumber is NULL.\n"); + /* this one not DECVERB as standard tests include nullptr */ + printf("Reference to decNumber is nullptr.\n"); #endif return 1;} /* check special values */ if (dn->bits & DECSPECIAL) { if (dn->exponent!=0) { - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("Exponent %ld (not 0) for a special value [%02x].\n", (LI)dn->exponent, dn->bits); #endif @@ -8025,12 +8025,12 @@ static Flag decCheckNumber(const decNumber *dn) { /* 2003.09.08: NaNs may now have coefficients, so next tests Inf only */ if (decNumberIsInfinite(dn)) { if (dn->digits!=1) { - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("Digits %ld (not 1) for an infinity.\n", (LI)dn->digits); #endif return 1;} if (*dn->lsu!=0) { - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("LSU %ld (not 0) for an infinity.\n", (LI)*dn->lsu); #endif decDumpAr('I', dn->lsu, D2U(dn->digits)); @@ -8043,7 +8043,7 @@ static Flag decCheckNumber(const decNumber *dn) { /* check the coefficient */ if (dn->digits<1 || dn->digits>DECNUMMAXP) { - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("Digits %ld in number.\n", (LI)dn->digits); #endif return 1;} @@ -8053,16 +8053,16 @@ static Flag decCheckNumber(const decNumber *dn) { for (up=dn->lsu; d>0; up++) { if (d>DECDPUN) maxuint=DECDPUNMAX; else { /* reached the msu */ - maxuint=DECNUMBER_powers[d]-1; - if (dn->digits>1 && *updigits>1 && *upmaxuint) { - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("Bad Unit [%08lx] in %ld-digit number at offset %ld [maxuint %ld].\n", (LI)*up, (LI)dn->digits, (LI)(up-dn->lsu), (LI)maxuint); #endif @@ -8078,13 +8078,13 @@ static Flag decCheckNumber(const decNumber *dn) { emin=DECNUMMINE; digits=DECNUMMAXP; if (ae+emax) { - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("Adjusted exponent overflow [%ld].\n", (LI)ae); uprv_decNumberShow(dn); #endif @@ -8105,7 +8105,7 @@ static void decCheckInexact(const decNumber *dn, decContext *set) { #if !DECSUBSET && DECEXTFLAG if ((set->status & (DEC_Inexact|DEC_Subnormal))==DEC_Inexact && (set->digits!=dn->digits) && !(dn->bits & DECSPECIAL)) { - #if DECTRACE || DECNUMBER_DECVERB + #if DECTRACE || DECVERB printf("Insufficient digits [%ld] on normal Inexact result.\n", (LI)dn->digits); uprv_decNumberShow(dn); @@ -8114,7 +8114,7 @@ static void decCheckInexact(const decNumber *dn, decContext *set) { } #else /* next is a noop for quiet compiler */ - if (dn!=NULL && dn->digits==0) set->status|=DEC_Invalid_operation; + if (dn!=nullptr && dn->digits==0) set->status|=DEC_Invalid_operation; #endif return; } /* decCheckInexact */ @@ -8144,7 +8144,7 @@ static void *decMalloc(size_t n) { uInt uiwork; /* for macros */ alloc=malloc(size); /* -> allocated storage */ - if (alloc==NULL) return NULL; /* out of strorage */ + if (alloc==nullptr) return nullptr; /* out of strorage */ b0=(uByte *)alloc; /* as bytes */ decAllocBytes+=n; /* account for storage */ UBFROMUI(alloc, n); /* save n */ @@ -8171,7 +8171,7 @@ static void decFree(void *alloc) { uByte *b, *b0; /* work */ uInt uiwork; /* for macros */ - if (alloc==NULL) return; /* allowed; it's a nop */ + if (alloc==nullptr) return; /* allowed; it's a nop */ b0=(uByte *)alloc; /* as bytes */ b0-=8; /* -> true start of storage */ n=UBTOUI(b0); /* lift length */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.h b/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.h index 8f3c50b48..4a1eb364e 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/decNumber.h @@ -20,7 +20,7 @@ /* ------------------------------------------------------------------ */ /* Modified version, for use from within ICU. - * Renamed public functions, to avoid an unwanted export of the + * Renamed public functions, to avoid an unwanted export of the * standard names from the ICU library. * * Use ICU's uprv_malloc() and uprv_free() @@ -30,16 +30,15 @@ * Remove a few compiler warnings. */ -#ifndef DECNUMBER_H -#define DECNUMBER_H - +#if !defined(DECNUMBER) + #define DECNUMBER #define DECNAME "decNumber" /* Short name */ #define DECFULLNAME "Decimal Number Module" /* Verbose name */ #define DECAUTHOR "Mike Cowlishaw" /* Who to blame */ -#if !defined(DECCONTEXT) -#include "decContext.h" -#endif + #if !defined(DECCONTEXT) + #include "decContext.h" + #endif /* Bit settings for decNumber.bits */ #define DECNEG 0x80 /* Sign; 1=negative, 0=positive or zero */ @@ -113,74 +112,74 @@ /* decNumber public functions and macros */ /* ---------------------------------------------------------------- */ /* Conversions */ - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberFromInt32(decNumber *, int32_t); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberFromUInt32(decNumber *, uint32_t); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *, const char *, decContext *); - U_INTERNAL char * U_EXPORT2 uprv_decNumberToString(const decNumber *, char *); - U_INTERNAL char * U_EXPORT2 uprv_decNumberToEngString(const decNumber *, char *); - U_INTERNAL uint32_t U_EXPORT2 uprv_decNumberToUInt32(const decNumber *, decContext *); - U_INTERNAL int32_t U_EXPORT2 uprv_decNumberToInt32(const decNumber *, decContext *); - U_INTERNAL uint8_t * U_EXPORT2 uprv_decNumberGetBCD(const decNumber *, uint8_t *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberSetBCD(decNumber *, const uint8_t *, uint32_t); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromInt32(decNumber *, int32_t); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromUInt32(decNumber *, uint32_t); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *, const char *, decContext *); + U_CAPI char * U_EXPORT2 uprv_decNumberToString(const decNumber *, char *); + U_CAPI char * U_EXPORT2 uprv_decNumberToEngString(const decNumber *, char *); + U_CAPI uint32_t U_EXPORT2 uprv_decNumberToUInt32(const decNumber *, decContext *); + U_CAPI int32_t U_EXPORT2 uprv_decNumberToInt32(const decNumber *, decContext *); + U_CAPI uint8_t * U_EXPORT2 uprv_decNumberGetBCD(const decNumber *, uint8_t *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberSetBCD(decNumber *, const uint8_t *, uint32_t); /* Operators and elementary functions */ - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberAbs(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberAdd(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberAnd(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCompare(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCompareSignal(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCompareTotal(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberDivide(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberDivideInteger(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *, const decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberInvert(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberMax(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberMaxMag(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberMin(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberMinMag(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberMinus(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberMultiply(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberNormalize(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberOr(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberPlus(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberQuantize(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberRemainder(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberRemainderNear(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberRescale(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberSameQuantum(decNumber *, const decNumber *, const decNumber *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberScaleB(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberShift(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberSubtract(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberToIntegralExact(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberToIntegralValue(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberXor(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberAbs(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberAdd(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberAnd(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompare(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareSignal(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotal(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivide(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberDivideInteger(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *, const decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberInvert(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberMax(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberMaxMag(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberMin(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberMinMag(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberMinus(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberMultiply(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberNormalize(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberOr(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberPlus(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberQuantize(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainder(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberRemainderNear(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberRescale(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberSameQuantum(decNumber *, const decNumber *, const decNumber *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberScaleB(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberShift(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberSubtract(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralExact(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralValue(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberXor(decNumber *, const decNumber *, const decNumber *, decContext *); /* Utilities */ enum decClass uprv_decNumberClass(const decNumber *, decContext *); - U_INTERNAL const char * U_EXPORT2 uprv_decNumberClassToString(enum decClass); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCopy(decNumber *, const decNumber *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCopyAbs(decNumber *, const decNumber *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCopyNegate(decNumber *, const decNumber *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberCopySign(decNumber *, const decNumber *, const decNumber *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberNextMinus(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberNextPlus(decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberNextToward(decNumber *, const decNumber *, const decNumber *, decContext *); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberTrim(decNumber *); - U_INTERNAL const char * U_EXPORT2 uprv_decNumberVersion(void); - U_INTERNAL decNumber * U_EXPORT2 uprv_decNumberZero(decNumber *); + U_CAPI const char * U_EXPORT2 uprv_decNumberClassToString(enum decClass); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopy(decNumber *, const decNumber *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopyAbs(decNumber *, const decNumber *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopyNegate(decNumber *, const decNumber *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopySign(decNumber *, const decNumber *, const decNumber *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextMinus(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextPlus(decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberNextToward(decNumber *, const decNumber *, const decNumber *, decContext *); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberTrim(decNumber *); + U_CAPI const char * U_EXPORT2 uprv_decNumberVersion(); + U_CAPI decNumber * U_EXPORT2 uprv_decNumberZero(decNumber *); /* Functions for testing decNumbers (normality depends on context) */ - U_INTERNAL int32_t U_EXPORT2 uprv_decNumberIsNormal(const decNumber *, decContext *); - U_INTERNAL int32_t U_EXPORT2 uprv_decNumberIsSubnormal(const decNumber *, decContext *); + U_CAPI int32_t U_EXPORT2 uprv_decNumberIsNormal(const decNumber *, decContext *); + U_CAPI int32_t U_EXPORT2 uprv_decNumberIsSubnormal(const decNumber *, decContext *); /* Macros for testing decNumber *dn */ #define decNumberIsCanonical(dn) (1) /* All decNumbers are saintly */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/decNumberLocal.h b/src/duckdb/extension/icu/third_party/icu/i18n/decNumberLocal.h index c3cb3066f..1c5a79b70 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/decNumberLocal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/decNumberLocal.h @@ -24,13 +24,14 @@ /* decNumber.h or one of decDouble (etc.) must be included first. */ /* ------------------------------------------------------------------ */ -#ifndef DECNUMBERLOC_H -#define DECNUMBERLOC_H -#define DECVERSION "decNumber 3.61" /* Package Version [16 max.] */ +#if !defined(DECNUMBERLOC) + #define DECNUMBERLOC + #define DECVERSION "decNumber 3.61" /* Package Version [16 max.] */ + #define DECNLAUTHOR "Mike Cowlishaw" /* Who to blame */ -#include /* for abs */ -#include /* for memset, strcpy */ -#include "decContext.h" + #include /* for abs */ + #include /* for memset, strcpy */ + #include "decContext.h" /* Conditional code flag -- set this to match hardware platform */ #if !defined(DECLITEND) @@ -145,7 +146,7 @@ /* ---------------------------------------------------------------- */ - /* Definitions for arbitary-precision modules (only valid after */ + /* Definitions for arbitrary-precision modules (only valid after */ /* decNumber.h has been included) */ /* ---------------------------------------------------------------- */ @@ -165,14 +166,57 @@ /* Set DECDPUNMAX -- the maximum integer that fits in DECDPUN */ /* digits, and D2UTABLE -- the initializer for the D2U table */ - // #ifndef DECDPUN + #ifndef DECDPUN // no-op - // #elif DECDPUN==1 + #elif DECDPUN==1 #define DECDPUNMAX 9 #define D2UTABLE {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17, \ 18,19,20,21,22,23,24,25,26,27,28,29,30,31,32, \ 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, \ 48,49} + #elif DECDPUN==2 + #define DECDPUNMAX 99 + #define D2UTABLE {0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10, \ + 11,11,12,12,13,13,14,14,15,15,16,16,17,17,18, \ + 18,19,19,20,20,21,21,22,22,23,23,24,24,25} + #elif DECDPUN==3 + #define DECDPUNMAX 999 + #define D2UTABLE {0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7, \ + 8,8,8,9,9,9,10,10,10,11,11,11,12,12,12,13,13, \ + 13,14,14,14,15,15,15,16,16,16,17} + #elif DECDPUN==4 + #define DECDPUNMAX 9999 + #define D2UTABLE {0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6, \ + 6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11, \ + 11,11,11,12,12,12,12,13} + #elif DECDPUN==5 + #define DECDPUNMAX 99999 + #define D2UTABLE {0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5, \ + 5,5,5,5,6,6,6,6,6,7,7,7,7,7,8,8,8,8,8,9,9,9, \ + 9,9,10,10,10,10} + #elif DECDPUN==6 + #define DECDPUNMAX 999999 + #define D2UTABLE {0,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4, \ + 4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,8, \ + 8,8,8,8,8,9} + #elif DECDPUN==7 + #define DECDPUNMAX 9999999 + #define D2UTABLE {0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3, \ + 4,4,4,4,4,4,4,5,5,5,5,5,5,5,6,6,6,6,6,6,6,7, \ + 7,7,7,7,7,7} + #elif DECDPUN==8 + #define DECDPUNMAX 99999999 + #define D2UTABLE {0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3, \ + 3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6, \ + 6,6,6,6,6,7} + #elif DECDPUN==9 + #define DECDPUNMAX 999999999 + #define D2UTABLE {0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3, \ + 3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5, \ + 5,5,6,6,6,6} + #else + #error DECDPUN must be in the range 1-9 + #endif /* ----- Shared data (in decNumber.c) ----- */ /* Public lookup table used by the D2U macro (see below) */ @@ -284,6 +328,401 @@ extern void decShowNum(const bcdnum *, const char *); #endif -// #else -// #error decNumberLocal included more than once + /* Format-dependent macros and constants */ + #if defined(DECPMAX) + + /* Useful constants */ + #define DECPMAX9 (ROUNDUP(DECPMAX, 9)/9) /* 'Pmax' in 10**9s */ + /* Top words for a zero */ + #define SINGLEZERO 0x22500000 + #define DOUBLEZERO 0x22380000 + #define QUADZERO 0x22080000 + /* [ZEROWORD is defined to be one of these in the DFISZERO macro] */ + + /* Format-dependent common tests: */ + /* DFISZERO -- test for (any) zero */ + /* DFISCCZERO -- test for coefficient continuation being zero */ + /* DFISCC01 -- test for coefficient contains only 0s and 1s */ + /* DFISINT -- test for finite and exponent q=0 */ + /* DFISUINT01 -- test for sign=0, finite, exponent q=0, and */ + /* MSD=0 or 1 */ + /* ZEROWORD is also defined here. */ + /* In DFISZERO the first test checks the least-significant word */ + /* (most likely to be non-zero); the penultimate tests MSD and */ + /* DPDs in the signword, and the final test excludes specials and */ + /* MSD>7. DFISINT similarly has to allow for the two forms of */ + /* MSD codes. DFISUINT01 only has to allow for one form of MSD */ + /* code. */ + #if DECPMAX==7 + #define ZEROWORD SINGLEZERO + /* [test macros not needed except for Zero] */ + #define DFISZERO(df) ((DFWORD(df, 0)&0x1c0fffff)==0 \ + && (DFWORD(df, 0)&0x60000000)!=0x60000000) + #elif DECPMAX==16 + #define ZEROWORD DOUBLEZERO + #define DFISZERO(df) ((DFWORD(df, 1)==0 \ + && (DFWORD(df, 0)&0x1c03ffff)==0 \ + && (DFWORD(df, 0)&0x60000000)!=0x60000000)) + #define DFISINT(df) ((DFWORD(df, 0)&0x63fc0000)==0x22380000 \ + ||(DFWORD(df, 0)&0x7bfc0000)==0x6a380000) + #define DFISUINT01(df) ((DFWORD(df, 0)&0xfbfc0000)==0x22380000) + #define DFISCCZERO(df) (DFWORD(df, 1)==0 \ + && (DFWORD(df, 0)&0x0003ffff)==0) + #define DFISCC01(df) ((DFWORD(df, 0)&~0xfffc9124)==0 \ + && (DFWORD(df, 1)&~0x49124491)==0) + #elif DECPMAX==34 + #define ZEROWORD QUADZERO + #define DFISZERO(df) ((DFWORD(df, 3)==0 \ + && DFWORD(df, 2)==0 \ + && DFWORD(df, 1)==0 \ + && (DFWORD(df, 0)&0x1c003fff)==0 \ + && (DFWORD(df, 0)&0x60000000)!=0x60000000)) + #define DFISINT(df) ((DFWORD(df, 0)&0x63ffc000)==0x22080000 \ + ||(DFWORD(df, 0)&0x7bffc000)==0x6a080000) + #define DFISUINT01(df) ((DFWORD(df, 0)&0xfbffc000)==0x22080000) + #define DFISCCZERO(df) (DFWORD(df, 3)==0 \ + && DFWORD(df, 2)==0 \ + && DFWORD(df, 1)==0 \ + && (DFWORD(df, 0)&0x00003fff)==0) + + #define DFISCC01(df) ((DFWORD(df, 0)&~0xffffc912)==0 \ + && (DFWORD(df, 1)&~0x44912449)==0 \ + && (DFWORD(df, 2)&~0x12449124)==0 \ + && (DFWORD(df, 3)&~0x49124491)==0) + #endif + + /* Macros to test if a certain 10 bits of a uInt or pair of uInts */ + /* are a canonical declet [higher or lower bits are ignored]. */ + /* declet is at offset 0 (from the right) in a uInt: */ + #define CANONDPD(dpd) (((dpd)&0x300)==0 || ((dpd)&0x6e)!=0x6e) + /* declet is at offset k (a multiple of 2) in a uInt: */ + #define CANONDPDOFF(dpd, k) (((dpd)&(0x300<<(k)))==0 \ + || ((dpd)&(((uInt)0x6e)<<(k)))!=(((uInt)0x6e)<<(k))) + /* declet is at offset k (a multiple of 2) in a pair of uInts: */ + /* [the top 2 bits will always be in the more-significant uInt] */ + #define CANONDPDTWO(hi, lo, k) (((hi)&(0x300>>(32-(k))))==0 \ + || ((hi)&(0x6e>>(32-(k))))!=(0x6e>>(32-(k))) \ + || ((lo)&(((uInt)0x6e)<<(k)))!=(((uInt)0x6e)<<(k))) + + /* Macro to test whether a full-length (length DECPMAX) BCD8 */ + /* coefficient, starting at uByte u, is all zeros */ + /* Test just the LSWord first, then the remainder as a sequence */ + /* of tests in order to avoid same-level use of UBTOUI */ + #if DECPMAX==7 + #define ISCOEFFZERO(u) ( \ + UBTOUI((u)+DECPMAX-4)==0 \ + && UBTOUS((u)+DECPMAX-6)==0 \ + && *(u)==0) + #elif DECPMAX==16 + #define ISCOEFFZERO(u) ( \ + UBTOUI((u)+DECPMAX-4)==0 \ + && UBTOUI((u)+DECPMAX-8)==0 \ + && UBTOUI((u)+DECPMAX-12)==0 \ + && UBTOUI(u)==0) + #elif DECPMAX==34 + #define ISCOEFFZERO(u) ( \ + UBTOUI((u)+DECPMAX-4)==0 \ + && UBTOUI((u)+DECPMAX-8)==0 \ + && UBTOUI((u)+DECPMAX-12)==0 \ + && UBTOUI((u)+DECPMAX-16)==0 \ + && UBTOUI((u)+DECPMAX-20)==0 \ + && UBTOUI((u)+DECPMAX-24)==0 \ + && UBTOUI((u)+DECPMAX-28)==0 \ + && UBTOUI((u)+DECPMAX-32)==0 \ + && UBTOUS(u)==0) + #endif + + /* Macros and masks for the exponent continuation field and MSD */ + /* Get the exponent continuation from a decFloat *df as an Int */ + #define GETECON(df) ((Int)((DFWORD((df), 0)&0x03ffffff)>>(32-6-DECECONL))) + /* Ditto, from the next-wider format */ + #define GETWECON(df) ((Int)((DFWWORD((df), 0)&0x03ffffff)>>(32-6-DECWECONL))) + /* Get the biased exponent similarly */ + #define GETEXP(df) ((Int)(DECCOMBEXP[DFWORD((df), 0)>>26]+GETECON(df))) + /* Get the unbiased exponent similarly */ + #define GETEXPUN(df) ((Int)GETEXP(df)-DECBIAS) + /* Get the MSD similarly (as uInt) */ + #define GETMSD(df) (DECCOMBMSD[DFWORD((df), 0)>>26]) + + /* Compile-time computes of the exponent continuation field masks */ + /* full exponent continuation field: */ + #define ECONMASK ((0x03ffffff>>(32-6-DECECONL))<<(32-6-DECECONL)) + /* same, not including its first digit (the qNaN/sNaN selector): */ + #define ECONNANMASK ((0x01ffffff>>(32-6-DECECONL))<<(32-6-DECECONL)) + + /* Macros to decode the coefficient in a finite decFloat *df into */ + /* a BCD string (uByte *bcdin) of length DECPMAX uBytes. */ + + /* In-line sequence to convert least significant 10 bits of uInt */ + /* dpd to three BCD8 digits starting at uByte u. Note that an */ + /* extra byte is written to the right of the three digits because */ + /* four bytes are moved at a time for speed; the alternative */ + /* macro moves exactly three bytes (usually slower). */ + #define dpd2bcd8(u, dpd) memcpy(u, &DPD2BCD8[((dpd)&0x3ff)*4], 4) + #define dpd2bcd83(u, dpd) memcpy(u, &DPD2BCD8[((dpd)&0x3ff)*4], 3) + + /* Decode the declets. After extracting each one, it is decoded */ + /* to BCD8 using a table lookup (also used for variable-length */ + /* decode). Each DPD decode is 3 bytes BCD8 plus a one-byte */ + /* length which is not used, here). Fixed-length 4-byte moves */ + /* are fast, however, almost everywhere, and so are used except */ + /* for the final three bytes (to avoid overrun). The code below */ + /* is 36 instructions for Doubles and about 70 for Quads, even */ + /* on IA32. */ + + /* Two macros are defined for each format: */ + /* GETCOEFF extracts the coefficient of the current format */ + /* GETWCOEFF extracts the coefficient of the next-wider format. */ + /* The latter is a copy of the next-wider GETCOEFF using DFWWORD. */ + + #if DECPMAX==7 + #define GETCOEFF(df, bcd) { \ + uInt sourhi=DFWORD(df, 0); \ + *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ + dpd2bcd8(bcd+1, sourhi>>10); \ + dpd2bcd83(bcd+4, sourhi);} + #define GETWCOEFF(df, bcd) { \ + uInt sourhi=DFWWORD(df, 0); \ + uInt sourlo=DFWWORD(df, 1); \ + *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ + dpd2bcd8(bcd+1, sourhi>>8); \ + dpd2bcd8(bcd+4, (sourhi<<2) | (sourlo>>30)); \ + dpd2bcd8(bcd+7, sourlo>>20); \ + dpd2bcd8(bcd+10, sourlo>>10); \ + dpd2bcd83(bcd+13, sourlo);} + + #elif DECPMAX==16 + #define GETCOEFF(df, bcd) { \ + uInt sourhi=DFWORD(df, 0); \ + uInt sourlo=DFWORD(df, 1); \ + *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ + dpd2bcd8(bcd+1, sourhi>>8); \ + dpd2bcd8(bcd+4, (sourhi<<2) | (sourlo>>30)); \ + dpd2bcd8(bcd+7, sourlo>>20); \ + dpd2bcd8(bcd+10, sourlo>>10); \ + dpd2bcd83(bcd+13, sourlo);} + #define GETWCOEFF(df, bcd) { \ + uInt sourhi=DFWWORD(df, 0); \ + uInt sourmh=DFWWORD(df, 1); \ + uInt sourml=DFWWORD(df, 2); \ + uInt sourlo=DFWWORD(df, 3); \ + *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ + dpd2bcd8(bcd+1, sourhi>>4); \ + dpd2bcd8(bcd+4, ((sourhi)<<6) | (sourmh>>26)); \ + dpd2bcd8(bcd+7, sourmh>>16); \ + dpd2bcd8(bcd+10, sourmh>>6); \ + dpd2bcd8(bcd+13, ((sourmh)<<4) | (sourml>>28)); \ + dpd2bcd8(bcd+16, sourml>>18); \ + dpd2bcd8(bcd+19, sourml>>8); \ + dpd2bcd8(bcd+22, ((sourml)<<2) | (sourlo>>30)); \ + dpd2bcd8(bcd+25, sourlo>>20); \ + dpd2bcd8(bcd+28, sourlo>>10); \ + dpd2bcd83(bcd+31, sourlo);} + + #elif DECPMAX==34 + #define GETCOEFF(df, bcd) { \ + uInt sourhi=DFWORD(df, 0); \ + uInt sourmh=DFWORD(df, 1); \ + uInt sourml=DFWORD(df, 2); \ + uInt sourlo=DFWORD(df, 3); \ + *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ + dpd2bcd8(bcd+1, sourhi>>4); \ + dpd2bcd8(bcd+4, ((sourhi)<<6) | (sourmh>>26)); \ + dpd2bcd8(bcd+7, sourmh>>16); \ + dpd2bcd8(bcd+10, sourmh>>6); \ + dpd2bcd8(bcd+13, ((sourmh)<<4) | (sourml>>28)); \ + dpd2bcd8(bcd+16, sourml>>18); \ + dpd2bcd8(bcd+19, sourml>>8); \ + dpd2bcd8(bcd+22, ((sourml)<<2) | (sourlo>>30)); \ + dpd2bcd8(bcd+25, sourlo>>20); \ + dpd2bcd8(bcd+28, sourlo>>10); \ + dpd2bcd83(bcd+31, sourlo);} + + #define GETWCOEFF(df, bcd) {??} /* [should never be used] */ + #endif + + /* Macros to decode the coefficient in a finite decFloat *df into */ + /* a base-billion uInt array, with the least-significant */ + /* 0-999999999 'digit' at offset 0. */ + + /* Decode the declets. After extracting each one, it is decoded */ + /* to binary using a table lookup. Three tables are used; one */ + /* the usual DPD to binary, the other two pre-multiplied by 1000 */ + /* and 1000000 to avoid multiplication during decode. These */ + /* tables can also be used for multiplying up the MSD as the DPD */ + /* code for 0 through 9 is the identity. */ + #define DPD2BIN0 DPD2BIN /* for prettier code */ + + #if DECPMAX==7 + #define GETCOEFFBILL(df, buf) { \ + uInt sourhi=DFWORD(df, 0); \ + (buf)[0]=DPD2BIN0[sourhi&0x3ff] \ + +DPD2BINK[(sourhi>>10)&0x3ff] \ + +DPD2BINM[DECCOMBMSD[sourhi>>26]];} + + #elif DECPMAX==16 + #define GETCOEFFBILL(df, buf) { \ + uInt sourhi, sourlo; \ + sourlo=DFWORD(df, 1); \ + (buf)[0]=DPD2BIN0[sourlo&0x3ff] \ + +DPD2BINK[(sourlo>>10)&0x3ff] \ + +DPD2BINM[(sourlo>>20)&0x3ff]; \ + sourhi=DFWORD(df, 0); \ + (buf)[1]=DPD2BIN0[((sourhi<<2) | (sourlo>>30))&0x3ff] \ + +DPD2BINK[(sourhi>>8)&0x3ff] \ + +DPD2BINM[DECCOMBMSD[sourhi>>26]];} + + #elif DECPMAX==34 + #define GETCOEFFBILL(df, buf) { \ + uInt sourhi, sourmh, sourml, sourlo; \ + sourlo=DFWORD(df, 3); \ + (buf)[0]=DPD2BIN0[sourlo&0x3ff] \ + +DPD2BINK[(sourlo>>10)&0x3ff] \ + +DPD2BINM[(sourlo>>20)&0x3ff]; \ + sourml=DFWORD(df, 2); \ + (buf)[1]=DPD2BIN0[((sourml<<2) | (sourlo>>30))&0x3ff] \ + +DPD2BINK[(sourml>>8)&0x3ff] \ + +DPD2BINM[(sourml>>18)&0x3ff]; \ + sourmh=DFWORD(df, 1); \ + (buf)[2]=DPD2BIN0[((sourmh<<4) | (sourml>>28))&0x3ff] \ + +DPD2BINK[(sourmh>>6)&0x3ff] \ + +DPD2BINM[(sourmh>>16)&0x3ff]; \ + sourhi=DFWORD(df, 0); \ + (buf)[3]=DPD2BIN0[((sourhi<<6) | (sourmh>>26))&0x3ff] \ + +DPD2BINK[(sourhi>>4)&0x3ff] \ + +DPD2BINM[DECCOMBMSD[sourhi>>26]];} + + #endif + + /* Macros to decode the coefficient in a finite decFloat *df into */ + /* a base-thousand uInt array (of size DECLETS+1, to allow for */ + /* the MSD), with the least-significant 0-999 'digit' at offset 0.*/ + + /* Decode the declets. After extracting each one, it is decoded */ + /* to binary using a table lookup. */ + #if DECPMAX==7 + #define GETCOEFFTHOU(df, buf) { \ + uInt sourhi=DFWORD(df, 0); \ + (buf)[0]=DPD2BIN[sourhi&0x3ff]; \ + (buf)[1]=DPD2BIN[(sourhi>>10)&0x3ff]; \ + (buf)[2]=DECCOMBMSD[sourhi>>26];} + + #elif DECPMAX==16 + #define GETCOEFFTHOU(df, buf) { \ + uInt sourhi, sourlo; \ + sourlo=DFWORD(df, 1); \ + (buf)[0]=DPD2BIN[sourlo&0x3ff]; \ + (buf)[1]=DPD2BIN[(sourlo>>10)&0x3ff]; \ + (buf)[2]=DPD2BIN[(sourlo>>20)&0x3ff]; \ + sourhi=DFWORD(df, 0); \ + (buf)[3]=DPD2BIN[((sourhi<<2) | (sourlo>>30))&0x3ff]; \ + (buf)[4]=DPD2BIN[(sourhi>>8)&0x3ff]; \ + (buf)[5]=DECCOMBMSD[sourhi>>26];} + + #elif DECPMAX==34 + #define GETCOEFFTHOU(df, buf) { \ + uInt sourhi, sourmh, sourml, sourlo; \ + sourlo=DFWORD(df, 3); \ + (buf)[0]=DPD2BIN[sourlo&0x3ff]; \ + (buf)[1]=DPD2BIN[(sourlo>>10)&0x3ff]; \ + (buf)[2]=DPD2BIN[(sourlo>>20)&0x3ff]; \ + sourml=DFWORD(df, 2); \ + (buf)[3]=DPD2BIN[((sourml<<2) | (sourlo>>30))&0x3ff]; \ + (buf)[4]=DPD2BIN[(sourml>>8)&0x3ff]; \ + (buf)[5]=DPD2BIN[(sourml>>18)&0x3ff]; \ + sourmh=DFWORD(df, 1); \ + (buf)[6]=DPD2BIN[((sourmh<<4) | (sourml>>28))&0x3ff]; \ + (buf)[7]=DPD2BIN[(sourmh>>6)&0x3ff]; \ + (buf)[8]=DPD2BIN[(sourmh>>16)&0x3ff]; \ + sourhi=DFWORD(df, 0); \ + (buf)[9]=DPD2BIN[((sourhi<<6) | (sourmh>>26))&0x3ff]; \ + (buf)[10]=DPD2BIN[(sourhi>>4)&0x3ff]; \ + (buf)[11]=DECCOMBMSD[sourhi>>26];} + #endif + + + /* Macros to decode the coefficient in a finite decFloat *df and */ + /* add to a base-thousand uInt array (as for GETCOEFFTHOU). */ + /* After the addition then most significant 'digit' in the array */ + /* might have a value larger then 10 (with a maximum of 19). */ + #if DECPMAX==7 + #define ADDCOEFFTHOU(df, buf) { \ + uInt sourhi=DFWORD(df, 0); \ + (buf)[0]+=DPD2BIN[sourhi&0x3ff]; \ + if (buf[0]>999) {buf[0]-=1000; buf[1]++;} \ + (buf)[1]+=DPD2BIN[(sourhi>>10)&0x3ff]; \ + if (buf[1]>999) {buf[1]-=1000; buf[2]++;} \ + (buf)[2]+=DECCOMBMSD[sourhi>>26];} + + #elif DECPMAX==16 + #define ADDCOEFFTHOU(df, buf) { \ + uInt sourhi, sourlo; \ + sourlo=DFWORD(df, 1); \ + (buf)[0]+=DPD2BIN[sourlo&0x3ff]; \ + if (buf[0]>999) {buf[0]-=1000; buf[1]++;} \ + (buf)[1]+=DPD2BIN[(sourlo>>10)&0x3ff]; \ + if (buf[1]>999) {buf[1]-=1000; buf[2]++;} \ + (buf)[2]+=DPD2BIN[(sourlo>>20)&0x3ff]; \ + if (buf[2]>999) {buf[2]-=1000; buf[3]++;} \ + sourhi=DFWORD(df, 0); \ + (buf)[3]+=DPD2BIN[((sourhi<<2) | (sourlo>>30))&0x3ff]; \ + if (buf[3]>999) {buf[3]-=1000; buf[4]++;} \ + (buf)[4]+=DPD2BIN[(sourhi>>8)&0x3ff]; \ + if (buf[4]>999) {buf[4]-=1000; buf[5]++;} \ + (buf)[5]+=DECCOMBMSD[sourhi>>26];} + + #elif DECPMAX==34 + #define ADDCOEFFTHOU(df, buf) { \ + uInt sourhi, sourmh, sourml, sourlo; \ + sourlo=DFWORD(df, 3); \ + (buf)[0]+=DPD2BIN[sourlo&0x3ff]; \ + if (buf[0]>999) {buf[0]-=1000; buf[1]++;} \ + (buf)[1]+=DPD2BIN[(sourlo>>10)&0x3ff]; \ + if (buf[1]>999) {buf[1]-=1000; buf[2]++;} \ + (buf)[2]+=DPD2BIN[(sourlo>>20)&0x3ff]; \ + if (buf[2]>999) {buf[2]-=1000; buf[3]++;} \ + sourml=DFWORD(df, 2); \ + (buf)[3]+=DPD2BIN[((sourml<<2) | (sourlo>>30))&0x3ff]; \ + if (buf[3]>999) {buf[3]-=1000; buf[4]++;} \ + (buf)[4]+=DPD2BIN[(sourml>>8)&0x3ff]; \ + if (buf[4]>999) {buf[4]-=1000; buf[5]++;} \ + (buf)[5]+=DPD2BIN[(sourml>>18)&0x3ff]; \ + if (buf[5]>999) {buf[5]-=1000; buf[6]++;} \ + sourmh=DFWORD(df, 1); \ + (buf)[6]+=DPD2BIN[((sourmh<<4) | (sourml>>28))&0x3ff]; \ + if (buf[6]>999) {buf[6]-=1000; buf[7]++;} \ + (buf)[7]+=DPD2BIN[(sourmh>>6)&0x3ff]; \ + if (buf[7]>999) {buf[7]-=1000; buf[8]++;} \ + (buf)[8]+=DPD2BIN[(sourmh>>16)&0x3ff]; \ + if (buf[8]>999) {buf[8]-=1000; buf[9]++;} \ + sourhi=DFWORD(df, 0); \ + (buf)[9]+=DPD2BIN[((sourhi<<6) | (sourmh>>26))&0x3ff]; \ + if (buf[9]>999) {buf[9]-=1000; buf[10]++;} \ + (buf)[10]+=DPD2BIN[(sourhi>>4)&0x3ff]; \ + if (buf[10]>999) {buf[10]-=1000; buf[11]++;} \ + (buf)[11]+=DECCOMBMSD[sourhi>>26];} + #endif + + + /* Set a decFloat to the maximum positive finite number (Nmax) */ + #if DECPMAX==7 + #define DFSETNMAX(df) \ + {DFWORD(df, 0)=0x77f3fcff;} + #elif DECPMAX==16 + #define DFSETNMAX(df) \ + {DFWORD(df, 0)=0x77fcff3f; \ + DFWORD(df, 1)=0xcff3fcff;} + #elif DECPMAX==34 + #define DFSETNMAX(df) \ + {DFWORD(df, 0)=0x77ffcff3; \ + DFWORD(df, 1)=0xfcff3fcf; \ + DFWORD(df, 2)=0xf3fcff3f; \ + DFWORD(df, 3)=0xcff3fcff;} + #endif + + /* [end of format-dependent macros and constants] */ + #endif + +#else + #error decNumberLocal included more than once #endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp index 007185446..75906991d 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp @@ -7,10 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif - #include #include @@ -140,7 +137,7 @@ DecimalFormat::setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErro if (U_FAILURE(status)) { return *this; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; return *this; } @@ -272,9 +269,9 @@ DecimalFormat::setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErro int32_t DecimalFormat::getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const { if (U_FAILURE(status)) { return -1; } - + if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; return -1; } @@ -442,7 +439,7 @@ DecimalFormat::DecimalFormat(const DecimalFormat& source) : NumberFormat(source) return; // no way to report an error. } UErrorCode status = U_ZERO_ERROR; - fields->symbols.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(*source.fields->symbols), status); + fields->symbols.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(*source.getDecimalFormatSymbols()), status); // In order to simplify error handling logic in the various getters/setters/etc, we do not allow // any partially populated DecimalFormatFields object. We must have a fully complete fields object // or else we set it to nullptr. @@ -466,7 +463,7 @@ DecimalFormat& DecimalFormat::operator=(const DecimalFormat& rhs) { fields->properties = rhs.fields->properties; fields->exportedProperties.clear(); UErrorCode status = U_ZERO_ERROR; - LocalPointer dfs(new DecimalFormatSymbols(*rhs.fields->symbols), status); + LocalPointer dfs(new DecimalFormatSymbols(*rhs.getDecimalFormatSymbols()), status); if (U_FAILURE(status)) { // We failed to allocate DecimalFormatSymbols, release fields and its members. // We must have a fully complete fields object, we cannot have partially populated members. @@ -510,7 +507,7 @@ bool DecimalFormat::operator==(const Format& other) const { if (fields == nullptr || otherDF->fields == nullptr) { return false; } - return fields->properties == otherDF->fields->properties && *fields->symbols == *otherDF->fields->symbols; + return fields->properties == otherDF->fields->properties && *getDecimalFormatSymbols() == *otherDF->getDecimalFormatSymbols(); } UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, FieldPosition& pos) const { @@ -522,7 +519,9 @@ UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, Fie return appendTo; } UErrorCode localStatus = U_ZERO_ERROR; - FormattedNumber output = fields->formatter.formatDouble(number, localStatus); + UFormattedNumberData output; + output.quantity.setToDouble(number); + fields->formatter.formatImpl(&output, localStatus); fieldPositionHelper(output, pos, appendTo.length(), localStatus); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, localStatus); @@ -535,7 +534,7 @@ UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, Fie return appendTo; // don't overwrite status if it's already a failure. } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; appendTo.setToBogus(); return appendTo; @@ -543,7 +542,9 @@ UnicodeString& DecimalFormat::format(double number, UnicodeString& appendTo, Fie if (pos.getField() == FieldPosition::DONT_CARE && fastFormatDouble(number, appendTo)) { return appendTo; } - FormattedNumber output = fields->formatter.formatDouble(number, status); + UFormattedNumberData output; + output.quantity.setToDouble(number); + fields->formatter.formatImpl(&output, status); fieldPositionHelper(output, pos, appendTo.length(), status); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, status); @@ -557,7 +558,7 @@ DecimalFormat::format(double number, UnicodeString& appendTo, FieldPositionItera return appendTo; // don't overwrite status if it's already a failure. } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; appendTo.setToBogus(); return appendTo; @@ -565,7 +566,9 @@ DecimalFormat::format(double number, UnicodeString& appendTo, FieldPositionItera if (posIter == nullptr && fastFormatDouble(number, appendTo)) { return appendTo; } - FormattedNumber output = fields->formatter.formatDouble(number, status); + UFormattedNumberData output; + output.quantity.setToDouble(number); + fields->formatter.formatImpl(&output, status); fieldPositionIteratorHelper(output, posIter, appendTo.length(), status); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, status); @@ -596,7 +599,9 @@ UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, Fi return appendTo; } UErrorCode localStatus = U_ZERO_ERROR; - FormattedNumber output = fields->formatter.formatInt(number, localStatus); + UFormattedNumberData output; + output.quantity.setToLong(number); + fields->formatter.formatImpl(&output, localStatus); fieldPositionHelper(output, pos, appendTo.length(), localStatus); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, localStatus); @@ -609,7 +614,7 @@ UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, Fi return appendTo; // don't overwrite status if it's already a failure. } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; appendTo.setToBogus(); return appendTo; @@ -617,7 +622,9 @@ UnicodeString& DecimalFormat::format(int64_t number, UnicodeString& appendTo, Fi if (pos.getField() == FieldPosition::DONT_CARE && fastFormatInt64(number, appendTo)) { return appendTo; } - FormattedNumber output = fields->formatter.formatInt(number, status); + UFormattedNumberData output; + output.quantity.setToLong(number); + fields->formatter.formatImpl(&output, status); fieldPositionHelper(output, pos, appendTo.length(), status); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, status); @@ -631,7 +638,7 @@ DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPositionIter return appendTo; // don't overwrite status if it's already a failure. } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; appendTo.setToBogus(); return appendTo; @@ -639,7 +646,9 @@ DecimalFormat::format(int64_t number, UnicodeString& appendTo, FieldPositionIter if (posIter == nullptr && fastFormatInt64(number, appendTo)) { return appendTo; } - FormattedNumber output = fields->formatter.formatInt(number, status); + UFormattedNumberData output; + output.quantity.setToLong(number); + fields->formatter.formatImpl(&output, status); fieldPositionIteratorHelper(output, posIter, appendTo.length(), status); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, status); @@ -653,12 +662,14 @@ DecimalFormat::format(StringPiece number, UnicodeString& appendTo, FieldPosition return appendTo; // don't overwrite status if it's already a failure. } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; appendTo.setToBogus(); return appendTo; } - FormattedNumber output = fields->formatter.formatDecimal(number, status); + UFormattedNumberData output; + output.quantity.setToDecNumber(number, status); + fields->formatter.formatImpl(&output, status); fieldPositionIteratorHelper(output, posIter, appendTo.length(), status); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, status); @@ -671,12 +682,14 @@ UnicodeString& DecimalFormat::format(const DecimalQuantity& number, UnicodeStrin return appendTo; // don't overwrite status if it's already a failure. } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; appendTo.setToBogus(); return appendTo; } - FormattedNumber output = fields->formatter.formatDecimalQuantity(number, status); + UFormattedNumberData output; + output.quantity = number; + fields->formatter.formatImpl(&output, status); fieldPositionIteratorHelper(output, posIter, appendTo.length(), status); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, status); @@ -690,12 +703,14 @@ DecimalFormat::format(const DecimalQuantity& number, UnicodeString& appendTo, Fi return appendTo; // don't overwrite status if it's already a failure. } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; appendTo.setToBogus(); return appendTo; } - FormattedNumber output = fields->formatter.formatDecimalQuantity(number, status); + UFormattedNumberData output; + output.quantity = number; + fields->formatter.formatImpl(&output, status); fieldPositionHelper(output, pos, appendTo.length(), status); auto appendable = UnicodeStringAppendable(appendTo); output.appendTo(appendable, status); @@ -775,16 +790,20 @@ CurrencyAmount* DecimalFormat::parseCurrency(const UnicodeString& text, ParsePos } } -const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols(void) const { +const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols() const { if (fields == nullptr) { return nullptr; } - return fields->symbols.getAlias(); + if (!fields->symbols.isNull()) { + return fields->symbols.getAlias(); + } else { + return fields->formatter.getDecimalFormatSymbols(); + } } void DecimalFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt) { if (symbolsToAdopt == nullptr) { - return; // do not allow caller to set fields->symbols to NULL + return; // do not allow caller to set fields->symbols to nullptr } // we must take ownership of symbolsToAdopt, even in a failure case. LocalPointer dfs(symbolsToAdopt); @@ -812,7 +831,7 @@ void DecimalFormat::setDecimalFormatSymbols(const DecimalFormatSymbols& symbols) touchNoError(); } -const CurrencyPluralInfo* DecimalFormat::getCurrencyPluralInfo(void) const { +const CurrencyPluralInfo* DecimalFormat::getCurrencyPluralInfo() const { if (fields == nullptr) { return nullptr; } @@ -938,7 +957,7 @@ void DecimalFormat::setSignAlwaysShown(UBool value) { touchNoError(); } -int32_t DecimalFormat::getMultiplier(void) const { +int32_t DecimalFormat::getMultiplier() const { const DecimalFormatProperties *dfp; // Not much we can do to report an error. if (fields == nullptr) { @@ -1002,7 +1021,7 @@ void DecimalFormat::setMultiplierScale(int32_t newValue) { touchNoError(); } -double DecimalFormat::getRoundingIncrement(void) const { +double DecimalFormat::getRoundingIncrement() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1018,7 +1037,7 @@ void DecimalFormat::setRoundingIncrement(double newValue) { touchNoError(); } -ERoundingMode DecimalFormat::getRoundingMode(void) const { +ERoundingMode DecimalFormat::getRoundingMode() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1028,7 +1047,7 @@ ERoundingMode DecimalFormat::getRoundingMode(void) const { return static_cast(fields->exportedProperties.roundingMode.getNoError()); } -void DecimalFormat::setRoundingMode(ERoundingMode roundingMode) { +void DecimalFormat::setRoundingMode(ERoundingMode roundingMode) UPRV_NO_SANITIZE_UNDEFINED { if (fields == nullptr) { return; } auto uRoundingMode = static_cast(roundingMode); if (!fields->properties.roundingMode.isNull() && uRoundingMode == fields->properties.roundingMode.getNoError()) { @@ -1039,7 +1058,7 @@ void DecimalFormat::setRoundingMode(ERoundingMode roundingMode) { touchNoError(); } -int32_t DecimalFormat::getFormatWidth(void) const { +int32_t DecimalFormat::getFormatWidth() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1058,7 +1077,7 @@ void DecimalFormat::setFormatWidth(int32_t width) { UnicodeString DecimalFormat::getPadCharacterString() const { if (fields == nullptr || fields->properties.padString.isBogus()) { // Readonly-alias the static string kFallbackPaddingString - return {TRUE, kFallbackPaddingString, -1}; + return {true, kFallbackPaddingString, -1}; } else { return fields->properties.padString; } @@ -1075,7 +1094,7 @@ void DecimalFormat::setPadCharacter(const UnicodeString& padChar) { touchNoError(); } -EPadPosition DecimalFormat::getPadPosition(void) const { +EPadPosition DecimalFormat::getPadPosition() const { if (fields == nullptr || fields->properties.padPosition.isNull()) { return EPadPosition::kPadBeforePrefix; } else { @@ -1094,7 +1113,7 @@ void DecimalFormat::setPadPosition(EPadPosition padPos) { touchNoError(); } -UBool DecimalFormat::isScientificNotation(void) const { +UBool DecimalFormat::isScientificNotation() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1115,7 +1134,7 @@ void DecimalFormat::setScientificNotation(UBool useScientific) { touchNoError(); } -int8_t DecimalFormat::getMinimumExponentDigits(void) const { +int8_t DecimalFormat::getMinimumExponentDigits() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1131,7 +1150,7 @@ void DecimalFormat::setMinimumExponentDigits(int8_t minExpDig) { touchNoError(); } -UBool DecimalFormat::isExponentSignAlwaysShown(void) const { +UBool DecimalFormat::isExponentSignAlwaysShown() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1147,7 +1166,7 @@ void DecimalFormat::setExponentSignAlwaysShown(UBool expSignAlways) { touchNoError(); } -int32_t DecimalFormat::getGroupingSize(void) const { +int32_t DecimalFormat::getGroupingSize() const { int32_t groupingSize; // Not much we can do to report an error. if (fields == nullptr) { @@ -1169,7 +1188,7 @@ void DecimalFormat::setGroupingSize(int32_t newValue) { touchNoError(); } -int32_t DecimalFormat::getSecondaryGroupingSize(void) const { +int32_t DecimalFormat::getSecondaryGroupingSize() const { int32_t grouping2; // Not much we can do to report an error. if (fields == nullptr) { @@ -1207,7 +1226,7 @@ void DecimalFormat::setMinimumGroupingDigits(int32_t newValue) { touchNoError(); } -UBool DecimalFormat::isDecimalSeparatorAlwaysShown(void) const { +UBool DecimalFormat::isDecimalSeparatorAlwaysShown() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1223,7 +1242,7 @@ void DecimalFormat::setDecimalSeparatorAlwaysShown(UBool newValue) { touchNoError(); } -UBool DecimalFormat::isDecimalPatternMatchRequired(void) const { +UBool DecimalFormat::isDecimalPatternMatchRequired() const { // Not much we can do to report an error. if (fields == nullptr) { // Fallback to using the default instance of DecimalFormatProperties. @@ -1289,7 +1308,7 @@ void DecimalFormat::setFormatFailIfMoreThanMaxDigits(UBool value) { UnicodeString& DecimalFormat::toPattern(UnicodeString& result) const { if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. result.setToBogus(); return result; } @@ -1303,6 +1322,7 @@ UnicodeString& DecimalFormat::toPattern(UnicodeString& result) const { !tprops.currency.isNull() || !tprops.currencyPluralInfo.fPtr.isNull() || !tprops.currencyUsage.isNull() || + tprops.currencyAsDecimal || AffixUtils::hasCurrencySymbols(tprops.positivePrefixPattern, localStatus) || AffixUtils::hasCurrencySymbols(tprops.positiveSuffixPattern, localStatus) || AffixUtils::hasCurrencySymbols(tprops.negativePrefixPattern, localStatus) || @@ -1318,13 +1338,13 @@ UnicodeString& DecimalFormat::toPattern(UnicodeString& result) const { UnicodeString& DecimalFormat::toLocalizedPattern(UnicodeString& result) const { if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. result.setToBogus(); return result; } ErrorCode localStatus; result = toPattern(result); - result = PatternStringUtils::convertLocalized(result, *fields->symbols, true, localStatus); + result = PatternStringUtils::convertLocalized(result, *getDecimalFormatSymbols(), true, localStatus); return result; } @@ -1337,7 +1357,7 @@ void DecimalFormat::applyPattern(const UnicodeString& pattern, UErrorCode& statu // don't overwrite status if it's already a failure. if (U_FAILURE(status)) { return; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1355,12 +1375,12 @@ void DecimalFormat::applyLocalizedPattern(const UnicodeString& localizedPattern, // don't overwrite status if it's already a failure. if (U_FAILURE(status)) { return; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; return; } UnicodeString pattern = PatternStringUtils::convertLocalized( - localizedPattern, *fields->symbols, false, status); + localizedPattern, *getDecimalFormatSymbols(), false, status); applyPattern(pattern, status); } @@ -1465,12 +1485,12 @@ UBool DecimalFormat::areSignificantDigitsUsed() const { } else { dfp = &fields->properties; } - return dfp->minimumSignificantDigits != -1 || dfp->maximumSignificantDigits != -1; + return dfp->minimumSignificantDigits != -1 || dfp->maximumSignificantDigits != -1; } void DecimalFormat::setSignificantDigitsUsed(UBool useSignificantDigits) { if (fields == nullptr) { return; } - + // These are the default values from the old implementation. if (useSignificantDigits) { if (fields->properties.minimumSignificantDigits != -1 || @@ -1494,7 +1514,7 @@ void DecimalFormat::setCurrency(const char16_t* theCurrency, UErrorCode& ec) { // don't overwrite ec if it's already a failure. if (U_FAILURE(ec)) { return; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. ec = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1505,8 +1525,11 @@ void DecimalFormat::setCurrency(const char16_t* theCurrency, UErrorCode& ec) { } NumberFormat::setCurrency(theCurrency, ec); // to set field for compatibility fields->properties.currency = currencyUnit; - // TODO: Set values in fields->symbols, too? - touchNoError(); + // In Java, the DecimalFormatSymbols is mutable. Why not in C++? + LocalPointer newSymbols(new DecimalFormatSymbols(*getDecimalFormatSymbols()), ec); + newSymbols->setCurrency(currencyUnit.getISOCurrency(), ec); + fields->symbols.adoptInsteadAndCheckErrorCode(newSymbols.orphan(), ec); + touch(ec); } void DecimalFormat::setCurrency(const char16_t* theCurrency) { @@ -1518,7 +1541,7 @@ void DecimalFormat::setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec) { // don't overwrite ec if it's already a failure. if (U_FAILURE(*ec)) { return; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. *ec = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1543,7 +1566,7 @@ DecimalFormat::formatToDecimalQuantity(double number, DecimalQuantity& output, U // don't overwrite status if it's already a failure. if (U_FAILURE(status)) { return; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1555,7 +1578,7 @@ void DecimalFormat::formatToDecimalQuantity(const Formattable& number, DecimalQu // don't overwrite status if it's already a failure. if (U_FAILURE(status)) { return; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1569,7 +1592,7 @@ const number::LocalizedNumberFormatter* DecimalFormat::toNumberFormatter(UErrorC // We sometimes need to return nullptr here (see ICU-20380) if (U_FAILURE(status)) { return nullptr; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. status = U_MEMORY_ALLOCATION_ERROR; return nullptr; } @@ -1582,7 +1605,7 @@ void DecimalFormat::touch(UErrorCode& status) { return; } if (fields == nullptr) { - // We only get here if an OOM error happend during construction, copy construction, assignment, or modification. + // We only get here if an OOM error happened during construction, copy construction, assignment, or modification. // For regular construction, the caller should have checked the status variable for errors. // For copy construction, there is unfortunately nothing to report the error, so we need to guard against // this possible bad state here and set the status to an error. @@ -1590,20 +1613,26 @@ void DecimalFormat::touch(UErrorCode& status) { return; } - // In C++, fields->symbols is the source of truth for the locale. - Locale locale = fields->symbols->getLocale(); - + // In C++, fields->symbols (or, if it's null, the DecimalFormatSymbols owned by the underlying LocalizedNumberFormatter) + // is the source of truth for the locale. + const DecimalFormatSymbols* symbols = getDecimalFormatSymbols(); + Locale locale = symbols->getLocale(); + // Note: The formatter is relatively cheap to create, and we need it to populate fields->exportedProperties, // so automatically recompute it here. The parser is a bit more expensive and is not needed until the // parse method is called, so defer that until needed. // TODO: Only update the pieces that changed instead of re-computing the whole formatter? - + // Since memory has already been allocated for the formatter, we can move assign a stack-allocated object // and don't need to call new. (Which is slower and could possibly fail). + // [Note that "symbols" above might point to the DecimalFormatSymbols object owned by fields->formatter. + // That's okay, because NumberPropertyMapper::create() will clone it before fields->formatter's assignment + // operator deletes it. But it does mean that "symbols" can't be counted on to be good after this line.] fields->formatter = NumberPropertyMapper::create( - fields->properties, *fields->symbols, fields->warehouse, fields->exportedProperties, status + fields->properties, *symbols, fields->warehouse, fields->exportedProperties, status ).locale(locale); - + fields->symbols.adoptInstead(nullptr); // the fields->symbols property is only temporary, until we can copy it into a new LocalizedNumberFormatter + // Do this after fields->exportedProperties are set up setupFastFormat(); @@ -1650,7 +1679,7 @@ const numparse::impl::NumberParserImpl* DecimalFormat::getParser(UErrorCode& sta } // Try computing the parser on our own - auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *fields->symbols, false, status); + auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *getDecimalFormatSymbols(), false, status); if (U_FAILURE(status)) { return nullptr; } @@ -1683,7 +1712,7 @@ const numparse::impl::NumberParserImpl* DecimalFormat::getCurrencyParser(UErrorC } // Try computing the parser on our own - auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *fields->symbols, true, status); + auto* temp = NumberParserImpl::createParserFromProperties(fields->properties, *getDecimalFormatSymbols(), true, status); if (temp == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; // although we may still dereference, call sites should be guarded @@ -1703,8 +1732,11 @@ const numparse::impl::NumberParserImpl* DecimalFormat::getCurrencyParser(UErrorC } void -DecimalFormat::fieldPositionHelper(const number::FormattedNumber& formatted, FieldPosition& fieldPosition, - int32_t offset, UErrorCode& status) { +DecimalFormat::fieldPositionHelper( + const UFormattedNumberData& formatted, + FieldPosition& fieldPosition, + int32_t offset, + UErrorCode& status) { if (U_FAILURE(status)) { return; } // always return first occurrence: fieldPosition.setBeginIndex(0); @@ -1717,12 +1749,15 @@ DecimalFormat::fieldPositionHelper(const number::FormattedNumber& formatted, Fie } void -DecimalFormat::fieldPositionIteratorHelper(const number::FormattedNumber& formatted, FieldPositionIterator* fpi, - int32_t offset, UErrorCode& status) { +DecimalFormat::fieldPositionIteratorHelper( + const UFormattedNumberData& formatted, + FieldPositionIterator* fpi, + int32_t offset, + UErrorCode& status) { if (U_SUCCESS(status) && (fpi != nullptr)) { FieldPositionIteratorHandler fpih(fpi, status); fpih.setShift(offset); - formatted.getAllFieldPositionsImpl(fpih, status); + formatted.getAllFieldPositions(fpih, status); } } @@ -1751,11 +1786,13 @@ void DecimalFormat::setupFastFormat() { return; } + const DecimalFormatSymbols* symbols = getDecimalFormatSymbols(); + // Grouping (secondary grouping is forbidden in equalsDefaultExceptFastFormat): bool groupingUsed = fields->properties.groupingUsed; int32_t groupingSize = fields->properties.groupingSize; bool unusualGroupingSize = groupingSize > 0 && groupingSize != 3; - const UnicodeString& groupingString = fields->symbols->getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol); + const UnicodeString& groupingString = symbols->getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol); if (groupingUsed && (unusualGroupingSize || groupingString.length() != 1)) { trace("no fast format: grouping\n"); fields->canUseFastFormat = false; @@ -1781,8 +1818,8 @@ void DecimalFormat::setupFastFormat() { } // Other symbols: - const UnicodeString& minusSignString = fields->symbols->getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol); - UChar32 codePointZero = fields->symbols->getCodePointZero(); + const UnicodeString& minusSignString = symbols->getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol); + UChar32 codePointZero = symbols->getCodePointZero(); if (minusSignString.length() != 1 || U16_LENGTH(codePointZero) != 1) { trace("no fast format: symbols\n"); fields->canUseFastFormat = false; @@ -1804,7 +1841,7 @@ bool DecimalFormat::fastFormatDouble(double input, UnicodeString& output) const return false; } if (std::isnan(input) - || std::trunc(input) != input + || uprv_trunc(input) != input || input <= INT32_MIN || input > INT32_MAX) { return false; @@ -1837,7 +1874,8 @@ void DecimalFormat::doFastFormatInt32(int32_t input, bool isNegative, UnicodeStr char16_t localBuffer[localCapacity]; char16_t* ptr = localBuffer + localCapacity; int8_t group = 0; - for (int8_t i = 0; i < fields->fastData.maxInt && (input != 0 || i < fields->fastData.minInt); i++) { + int8_t minInt = (fields->fastData.minInt < 1)? 1: fields->fastData.minInt; + for (int8_t i = 0; i < fields->fastData.maxInt && (input != 0 || i < minInt); i++) { if (group++ == 3 && fields->fastData.cpGroupingSeparator != 0) { *(--ptr) = fields->fastData.cpGroupingSeparator; group = 1; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/displayoptions.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/displayoptions.cpp new file mode 100644 index 000000000..bb49e6033 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/displayoptions.cpp @@ -0,0 +1,167 @@ +// © 2022 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/displayoptions.h" +#include "unicode/udisplayoptions.h" +#include "cstring.h" + +U_NAMESPACE_BEGIN + +DisplayOptions::Builder DisplayOptions::builder() { return DisplayOptions::Builder(); } + +DisplayOptions::Builder DisplayOptions::copyToBuilder() const { return Builder(*this); } + +DisplayOptions::DisplayOptions(const Builder &builder) { + grammaticalCase = builder.grammaticalCase; + nounClass = builder.nounClass; + pluralCategory = builder.pluralCategory; + capitalization = builder.capitalization; + nameStyle = builder.nameStyle; + displayLength = builder.displayLength; + substituteHandling = builder.substituteHandling; +} + +DisplayOptions::Builder::Builder() { + // Sets default values. + grammaticalCase = UDISPOPT_GRAMMATICAL_CASE_UNDEFINED; + nounClass = UDISPOPT_NOUN_CLASS_UNDEFINED; + pluralCategory = UDISPOPT_PLURAL_CATEGORY_UNDEFINED; + capitalization = UDISPOPT_CAPITALIZATION_UNDEFINED; + nameStyle = UDISPOPT_NAME_STYLE_UNDEFINED; + displayLength = UDISPOPT_DISPLAY_LENGTH_UNDEFINED; + substituteHandling = UDISPOPT_SUBSTITUTE_HANDLING_UNDEFINED; +} + +DisplayOptions::Builder::Builder(const DisplayOptions &displayOptions) { + grammaticalCase = displayOptions.grammaticalCase; + nounClass = displayOptions.nounClass; + pluralCategory = displayOptions.pluralCategory; + capitalization = displayOptions.capitalization; + nameStyle = displayOptions.nameStyle; + displayLength = displayOptions.displayLength; + substituteHandling = displayOptions.substituteHandling; +} + +U_NAMESPACE_END + +// C API ------------------------------------------------------------------- *** + +U_NAMESPACE_USE + +namespace { + +const char *grammaticalCaseIds[] = { + "undefined", // 0 + "ablative", // 1 + "accusative", // 2 + "comitative", // 3 + "dative", // 4 + "ergative", // 5 + "genitive", // 6 + "instrumental", // 7 + "locative", // 8 + "locative_copulative", // 9 + "nominative", // 10 + "oblique", // 11 + "prepositional", // 12 + "sociative", // 13 + "vocative", // 14 +}; + +} // namespace + +U_CAPI const char * U_EXPORT2 +udispopt_getGrammaticalCaseIdentifier(UDisplayOptionsGrammaticalCase grammaticalCase) { + if (grammaticalCase >= 0 && grammaticalCase < UPRV_LENGTHOF(grammaticalCaseIds)) { + return grammaticalCaseIds[grammaticalCase]; + } + + return grammaticalCaseIds[0]; +} + +U_CAPI UDisplayOptionsGrammaticalCase U_EXPORT2 +udispopt_fromGrammaticalCaseIdentifier(const char *identifier) { + for (int32_t i = 0; i < UPRV_LENGTHOF(grammaticalCaseIds); i++) { + if (uprv_strcmp(identifier, grammaticalCaseIds[i]) == 0) { + return static_cast(i); + } + } + + return UDISPOPT_GRAMMATICAL_CASE_UNDEFINED; +} + +namespace { + +const char *pluralCategoryIds[] = { + "undefined", // 0 + "zero", // 1 + "one", // 2 + "two", // 3 + "few", // 4 + "many", // 5 + "other", // 6 +}; + +} // namespace + +U_CAPI const char * U_EXPORT2 +udispopt_getPluralCategoryIdentifier(UDisplayOptionsPluralCategory pluralCategory) { + if (pluralCategory >= 0 && pluralCategory < UPRV_LENGTHOF(pluralCategoryIds)) { + return pluralCategoryIds[pluralCategory]; + } + + return pluralCategoryIds[0]; +} + +U_CAPI UDisplayOptionsPluralCategory U_EXPORT2 +udispopt_fromPluralCategoryIdentifier(const char *identifier) { + for (int32_t i = 0; i < UPRV_LENGTHOF(pluralCategoryIds); i++) { + if (uprv_strcmp(identifier, pluralCategoryIds[i]) == 0) { + return static_cast(i); + } + } + + return UDISPOPT_PLURAL_CATEGORY_UNDEFINED; +} + +namespace { + +const char *nounClassIds[] = { + "undefined", // 0 + "other", // 1 + "neuter", // 2 + "feminine", // 3 + "masculine", // 4 + "animate", // 5 + "inanimate", // 6 + "personal", // 7 + "common", // 8 +}; + +} // namespace + +U_CAPI const char * U_EXPORT2 +udispopt_getNounClassIdentifier(UDisplayOptionsNounClass nounClass) { + if (nounClass >= 0 && nounClass < UPRV_LENGTHOF(nounClassIds)) { + return nounClassIds[nounClass]; + } + + return nounClassIds[0]; +} + +U_CAPI UDisplayOptionsNounClass U_EXPORT2 +udispopt_fromNounClassIdentifier(const char *identifier) { + for (int32_t i = 0; i < UPRV_LENGTHOF(nounClassIds); i++) { + if (uprv_strcmp(identifier, nounClassIds[i]) == 0) { + return static_cast(i); + } + } + + return UDISPOPT_NOUN_CLASS_UNDEFINED; +} + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp index a95910df0..638e9cb04 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp @@ -290,7 +290,7 @@ static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator, // Let v = numerator / denominator < 10. // Then we generate 'count' digits of d = x.xxxxx... (without the decimal point) -// from left to right. Once 'count' digits have been produced we decide wether +// from left to right. Once 'count' digits have been produced we decide whether // to round up or down. Remainders of exactly .5 round upwards. Numbers such // as 9.999999 propagate a carry all the way, and change the // exponent (decimal_point), when rounding upwards. @@ -384,7 +384,7 @@ static void BignumToFixed(int requested_digits, int* decimal_point, // Returns an estimation of k such that 10^(k-1) <= v < 10^k where // v = f * 2^exponent and 2^52 <= f < 2^53. // v is hence a normalized double with the given exponent. The output is an -// approximation for the exponent of the decimal approimation .digits * 10^k. +// approximation for the exponent of the decimal approximation .digits * 10^k. // // The result might undershoot by 1 in which case 10^k <= v < 10^k+1. // Note: this property holds for v's upper boundary m+ too. @@ -562,7 +562,7 @@ static void InitialScaledStartValuesNegativeExponentNegativePower( // // Let ep == estimated_power, then the returned values will satisfy: // v / 10^ep = numerator / denominator. -// v's boundarys m- and m+: +// v's boundaries m- and m+: // m- / 10^ep == v / 10^ep - delta_minus / denominator // m+ / 10^ep == v / 10^ep + delta_plus / denominator // Or in other words: diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp index 996d75c9f..d2b701a21 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp @@ -150,7 +150,7 @@ void Bignum::AssignHexString(Vector value) { DOUBLE_CONVERSION_ASSERT(sizeof(uint64_t) * 8 >= kBigitSize + 4); // TODO: static_assert // Accumulates converted hex digits until at least kBigitSize bits. // Works with non-factor-of-four kBigitSizes. - uint64_t tmp = 0; // Accumulates converted hex digits until at least + uint64_t tmp = 0; for (int cnt = 0; !value.is_empty(); value.pop_back()) { tmp |= (HexCharValue(value.last()) << cnt); if ((cnt += 4) >= kBigitSize) { @@ -160,7 +160,8 @@ void Bignum::AssignHexString(Vector value) { } } if (tmp > 0) { - RawBigit(used_bigits_++) = tmp; + DOUBLE_CONVERSION_ASSERT(tmp <= kBigitMask); + RawBigit(used_bigits_++) = static_cast(tmp & kBigitMask); } Clamp(); } @@ -217,7 +218,7 @@ void Bignum::AddBignum(const Bignum& other) { carry = sum >> kBigitSize; ++bigit_pos; } - used_bigits_ = (std::max)(bigit_pos, static_cast(used_bigits_)); + used_bigits_ = static_cast(std::max(bigit_pos, static_cast(used_bigits_))); DOUBLE_CONVERSION_ASSERT(IsClamped()); } @@ -253,7 +254,7 @@ void Bignum::ShiftLeft(const int shift_amount) { if (used_bigits_ == 0) { return; } - exponent_ += (shift_amount / kBigitSize); + exponent_ += static_cast(shift_amount / kBigitSize); const int local_shift = shift_amount % kBigitSize; EnsureCapacity(used_bigits_ + 1); BigitsShiftLeft(local_shift); @@ -431,7 +432,7 @@ void Bignum::Square() { DOUBLE_CONVERSION_ASSERT(accumulator == 0); // Don't forget to update the used_digits and the exponent. - used_bigits_ = product_length; + used_bigits_ = static_cast(product_length); exponent_ *= 2; Clamp(); } @@ -752,8 +753,8 @@ void Bignum::Align(const Bignum& other) { for (int i = 0; i < zero_bigits; ++i) { RawBigit(i) = 0; } - used_bigits_ += zero_bigits; - exponent_ -= zero_bigits; + used_bigits_ += static_cast(zero_bigits); + exponent_ -= static_cast(zero_bigits); DOUBLE_CONVERSION_ASSERT(used_bigits_ >= 0); DOUBLE_CONVERSION_ASSERT(exponent_ >= 0); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-cached-powers.h b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-cached-powers.h index dd106c26c..ade27baef 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-cached-powers.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-cached-powers.h @@ -53,9 +53,7 @@ namespace PowersOfTenCache { static const int kDecimalExponentDistance = 8; static const int kMinDecimalExponent = -348; -#if U_DEBUG static const int kMaxDecimalExponent = 340; -#endif // Returns a cached power-of-ten with a binary exponent in the range // [min_exponent; max_exponent] (boundaries included). diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp index 44c176f4f..938484bca 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp @@ -71,7 +71,7 @@ bool DoubleToStringConverter::HandleSpecialValues( StringBuilder* result_builder) const { Double double_inspect(value); if (double_inspect.IsInfinite()) { - if (infinity_symbol_ == NULL) return false; + if (infinity_symbol_ == DOUBLE_CONVERSION_NULLPTR) return false; if (value < 0) { result_builder->AddCharacter('-'); } @@ -79,7 +79,7 @@ bool DoubleToStringConverter::HandleSpecialValues( return true; } if (double_inspect.IsNan()) { - if (nan_symbol_ == NULL) return false; + if (nan_symbol_ == DOUBLE_CONVERSION_NULLPTR) return false; result_builder->AddString(nan_symbol_); return true; } @@ -94,7 +94,14 @@ void DoubleToStringConverter::CreateExponentialRepresentation( StringBuilder* result_builder) const { DOUBLE_CONVERSION_ASSERT(length != 0); result_builder->AddCharacter(decimal_digits[0]); - if (length != 1) { + if (length == 1) { + if ((flags_ & EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL) != 0) { + result_builder->AddCharacter('.'); + if ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL) != 0) { + result_builder->AddCharacter('0'); + } + } + } else { result_builder->AddCharacter('.'); result_builder->AddSubstring(&decimal_digits[1], length-1); } @@ -107,19 +114,19 @@ void DoubleToStringConverter::CreateExponentialRepresentation( result_builder->AddCharacter('+'); } } - if (exponent == 0) { - result_builder->AddCharacter('0'); - return; - } DOUBLE_CONVERSION_ASSERT(exponent < 1e4); // Changing this constant requires updating the comment of DoubleToStringConverter constructor const int kMaxExponentLength = 5; char buffer[kMaxExponentLength + 1]; buffer[kMaxExponentLength] = '\0'; int first_char_pos = kMaxExponentLength; - while (exponent > 0) { - buffer[--first_char_pos] = '0' + (exponent % 10); - exponent /= 10; + if (exponent == 0) { + buffer[--first_char_pos] = '0'; + } else { + while (exponent > 0) { + buffer[--first_char_pos] = '0' + (exponent % 10); + exponent /= 10; + } } // Add prefix '0' to make exponent width >= min(min_exponent_with_, kMaxExponentLength) // For example: convert 1e+9 -> 1e+09, if min_exponent_with_ is set to 2 @@ -342,9 +349,21 @@ bool DoubleToStringConverter::ToPrecision(double value, int exponent = decimal_point - 1; int extra_zero = ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) ? 1 : 0; - if ((-decimal_point + 1 > max_leading_padding_zeroes_in_precision_mode_) || + bool as_exponential = + (-decimal_point + 1 > max_leading_padding_zeroes_in_precision_mode_) || (decimal_point - precision + extra_zero > - max_trailing_padding_zeroes_in_precision_mode_)) { + max_trailing_padding_zeroes_in_precision_mode_); + if ((flags_ & NO_TRAILING_ZERO) != 0) { + // Truncate trailing zeros that occur after the decimal point (if exponential, + // that is everything after the first digit). + int stop = as_exponential ? 1 : std::max(1, decimal_point); + while (decimal_rep_length > stop && decimal_rep[decimal_rep_length - 1] == '0') { + --decimal_rep_length; + } + // Clamp precision to avoid the code below re-adding the zeros. + precision = std::min(precision, decimal_rep_length); + } + if (as_exponential) { // Fill buffer to contain 'precision' digits. // Usually the buffer is already at the correct length, but 'DoubleToAscii' // is allowed to return less characters. diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.h b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.h index 27bd86784..b8cb06a8b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.h @@ -48,12 +48,11 @@ namespace double_conversion { class DoubleToStringConverter { public: -#if 0 // not needed for ICU // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the // function returns false. static const int kMaxFixedDigitsBeforePoint = 60; - static const int kMaxFixedDigitsAfterPoint = 60; + static const int kMaxFixedDigitsAfterPoint = 100; // When calling ToExponential with a requested_digits // parameter > kMaxExponentialDigits then the function returns false. @@ -65,12 +64,38 @@ class DoubleToStringConverter { static const int kMinPrecisionDigits = 1; static const int kMaxPrecisionDigits = 120; + // The maximal number of digits that are needed to emit a double in base 10. + // A higher precision can be achieved by using more digits, but the shortest + // accurate representation of any double will never use more digits than + // kBase10MaximalLength. + // Note that DoubleToAscii null-terminates its input. So the given buffer + // should be at least kBase10MaximalLength + 1 characters long. + static const int kBase10MaximalLength = 17; + + // The maximal number of digits that are needed to emit a single in base 10. + // A higher precision can be achieved by using more digits, but the shortest + // accurate representation of any single will never use more digits than + // kBase10MaximalLengthSingle. + static const int kBase10MaximalLengthSingle = 9; + + // The length of the longest string that 'ToShortest' can produce when the + // converter is instantiated with EcmaScript defaults (see + // 'EcmaScriptConverter') + // This value does not include the trailing '\0' character. + // This amount of characters is needed for negative values that hit the + // 'decimal_in_shortest_low' limit. For example: "-0.0000033333333333333333" + static const int kMaxCharsEcmaScriptShortest = 25; + +#if 0 // not needed for ICU enum Flags { NO_FLAGS = 0, EMIT_POSITIVE_EXPONENT_SIGN = 1, EMIT_TRAILING_DECIMAL_POINT = 2, EMIT_TRAILING_ZERO_AFTER_POINT = 4, - UNIQUE_ZERO = 8 + UNIQUE_ZERO = 8, + NO_TRAILING_ZERO = 16, + EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL = 32, + EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL = 64 }; // Flags should be a bit-or combination of the possible Flags-enum. @@ -82,12 +107,23 @@ class DoubleToStringConverter { // Example: 2345.0 is converted to "2345.". // - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point // emits a trailing '0'-character. This flag requires the - // EXMIT_TRAILING_DECIMAL_POINT flag. + // EMIT_TRAILING_DECIMAL_POINT flag. // Example: 2345.0 is converted to "2345.0". // - UNIQUE_ZERO: "-0.0" is converted to "0.0". + // - NO_TRAILING_ZERO: Trailing zeros are removed from the fractional portion + // of the result in precision mode. Matches printf's %g. + // When EMIT_TRAILING_ZERO_AFTER_POINT is also given, one trailing zero is + // preserved. + // - EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL: when the input number has + // exactly one significant digit and is converted into exponent form then a + // trailing decimal point is appended to the significand in shortest mode + // or in precision mode with one requested digit. + // - EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL: in addition to a trailing + // decimal point emits a trailing '0'-character. This flag requires the + // EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag. // // Infinity symbol and nan_symbol provide the string representation for these - // special values. If the string is NULL and the special value is encountered + // special values. If the string is nullptr and the special value is encountered // then the conversion functions return false. // // The exponent_character is used in exponential representations. It is @@ -111,7 +147,7 @@ class DoubleToStringConverter { // Example with max_leading_padding_zeroes_in_precision_mode = 6. // ToPrecision(0.0000012345, 2) -> "0.0000012" // ToPrecision(0.00000012345, 2) -> "1.2e-7" - // Similarily the converter may add up to + // Similarly the converter may add up to // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid // returning an exponential representation. A zero added by the // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. @@ -120,6 +156,22 @@ class DoubleToStringConverter { // ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT. // ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT. // + // When converting numbers with exactly one significant digit to exponent + // form in shortest mode or in precision mode with one requested digit, the + // EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT flags have + // no effect. Use the EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL flag to + // append a decimal point in this case and the + // EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL flag to also append a + // '0'-character in this case. + // Example with decimal_in_shortest_low = 0: + // ToShortest(0.0009) -> "9e-4" + // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL deactivated. + // ToShortest(0.0009) -> "9.e-4" + // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated. + // ToShortest(0.0009) -> "9.0e-4" + // with EMIT_TRAILING_DECIMAL_POINT_IN_EXPONENTIAL activated and + // EMIT_TRAILING_ZERO_AFTER_POINT_IN_EXPONENTIAL activated. + // // The min_exponent_width is used for exponential representations. // The converter adds leading '0's to the exponent until the exponent // is at least min_exponent_width digits long. @@ -152,6 +204,14 @@ class DoubleToStringConverter { } // Returns a converter following the EcmaScript specification. + // + // Flags: UNIQUE_ZERO and EMIT_POSITIVE_EXPONENT_SIGN. + // Special values: "Infinity" and "NaN". + // Lower case 'e' for exponential values. + // decimal_in_shortest_low: -6 + // decimal_in_shortest_high: 21 + // max_leading_padding_zeroes_in_precision_mode: 6 + // max_trailing_padding_zeroes_in_precision_mode: 0 static const DoubleToStringConverter& EcmaScriptConverter(); // Computes the shortest string of digits that correctly represent the input @@ -161,7 +221,7 @@ class DoubleToStringConverter { // Example with decimal_in_shortest_low = -6, // decimal_in_shortest_high = 21, // EMIT_POSITIVE_EXPONENT_SIGN activated, and - // EMIT_TRAILING_DECIMAL_POINT deactived: + // EMIT_TRAILING_DECIMAL_POINT deactivated: // ToShortest(0.000001) -> "0.000001" // ToShortest(0.0000001) -> "1e-7" // ToShortest(111111111111111111111.0) -> "111111111111111110000" @@ -177,6 +237,21 @@ class DoubleToStringConverter { // Returns true if the conversion succeeds. The conversion always succeeds // except when the input value is special and no infinity_symbol or // nan_symbol has been given to the constructor. + // + // The length of the longest result is the maximum of the length of the + // following string representations (each with possible examples): + // - NaN and negative infinity: "NaN", "-Infinity", "-inf". + // - -10^(decimal_in_shortest_high - 1): + // "-100000000000000000000", "-1000000000000000.0" + // - the longest string in range [0; -10^decimal_in_shortest_low]. Generally, + // this string is 3 + kBase10MaximalLength - decimal_in_shortest_low. + // (Sign, '0', decimal point, padding zeroes for decimal_in_shortest_low, + // and the significant digits). + // "-0.0000033333333333333333", "-0.0012345678901234567" + // - the longest exponential representation. (A negative number with + // kBase10MaximalLength significant digits). + // "-1.7976931348623157e+308", "-1.7976931348623157E308" + // In addition, the buffer must be able to hold the trailing '\0' character. bool ToShortest(double value, StringBuilder* result_builder) const { return ToShortestIeeeNumber(value, result_builder, SHORTEST); } @@ -217,9 +292,11 @@ class DoubleToStringConverter { // been provided to the constructor, // - 'value' > 10^kMaxFixedDigitsBeforePoint, or // - 'requested_digits' > kMaxFixedDigitsAfterPoint. - // The last two conditions imply that the result will never contain more than - // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters + // The last two conditions imply that the result for non-special values never + // contains more than + // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters // (one additional character for the sign, and one for the decimal point). + // In addition, the buffer must be able to hold the trailing '\0' character. bool ToFixed(double value, int requested_digits, StringBuilder* result_builder) const; @@ -248,14 +325,17 @@ class DoubleToStringConverter { // - the input value is special and no infinity_symbol or nan_symbol has // been provided to the constructor, // - 'requested_digits' > kMaxExponentialDigits. - // The last condition implies that the result will never contain more than + // + // The last condition implies that the result never contains more than // kMaxExponentialDigits + 8 characters (the sign, the digit before the // decimal point, the decimal point, the exponent character, the // exponent's sign, and at most 3 exponent digits). + // In addition, the buffer must be able to hold the trailing '\0' character. bool ToExponential(double value, int requested_digits, StringBuilder* result_builder) const; + // Computes 'precision' leading digits of the given 'value' and returns them // either in exponential or decimal format, depending on // max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the @@ -265,7 +345,7 @@ class DoubleToStringConverter { // Example with max_leading_padding_zeroes_in_precision_mode = 6. // ToPrecision(0.0000012345, 2) -> "0.0000012" // ToPrecision(0.00000012345, 2) -> "1.2e-7" - // Similarily the converter may add up to + // Similarly the converter may add up to // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid // returning an exponential representation. A zero added by the // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit. @@ -287,9 +367,11 @@ class DoubleToStringConverter { // been provided to the constructor, // - precision < kMinPericisionDigits // - precision > kMaxPrecisionDigits - // The last condition implies that the result will never contain more than + // + // The last condition implies that the result never contains more than // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the // exponent character, the exponent's sign, and at most 3 exponent digits). + // In addition, the buffer must be able to hold the trailing '\0' character. bool ToPrecision(double value, int precision, StringBuilder* result_builder) const; @@ -310,14 +392,6 @@ class DoubleToStringConverter { PRECISION }; - // The maximal number of digits that are needed to emit a double in base 10. - // A higher precision can be achieved by using more digits, but the shortest - // accurate representation of any double will never use more digits than - // kBase10MaximalLength. - // Note that DoubleToAscii null-terminates its input. So the given buffer - // should be at least kBase10MaximalLength + 1 characters long. - static const int kBase10MaximalLength = 17; - // Converts the given double 'v' to digit characters. 'v' must not be NaN, // +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also // applies to 'v' after it has been casted to a single-precision float. That @@ -380,7 +454,7 @@ class DoubleToStringConverter { // If the value is a special value (NaN or Infinity) constructs the // corresponding string using the configured infinity/nan-symbol. - // If either of them is NULL or the value is not special then the + // If either of them is nullptr or the value is not special then the // function returns false. bool HandleSpecialValues(double value, StringBuilder* result_builder) const; // Constructs an exponential representation (i.e. 1.234e56). diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp index 87a3d536b..06e4cf125 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp @@ -579,7 +579,7 @@ static bool Grisu3(double v, // the difference between w and boundary_minus/plus (a power of 2) and to // compute scaled_boundary_minus/plus by subtracting/adding from // scaled_w. However the code becomes much less readable and the speed - // enhancements are not terriffic. + // enhancements are not terrific. DiyFp scaled_boundary_minus = DiyFp::Times(boundary_minus, ten_mk); DiyFp scaled_boundary_plus = DiyFp::Times(boundary_plus, ten_mk); @@ -587,7 +587,7 @@ static bool Grisu3(double v, // v == (double) (scaled_w * 10^-mk). // Set decimal_exponent == -mk and pass it to DigitGen. If scaled_w is not an // integer than it will be updated. For instance if scaled_w == 1.23 then - // the buffer will be filled with "123" und the decimal_exponent will be + // the buffer will be filled with "123" and the decimal_exponent will be // decreased by 2. int kappa; bool result = DigitGen(scaled_boundary_minus, scaled_w, scaled_boundary_plus, diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.h b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.h index e688c268f..58a647005 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.h @@ -60,9 +60,9 @@ enum FastDtoaMode { // FastDtoa will produce at most kFastDtoaMaximalLength digits. This does not // include the terminating '\0' character. -// static const int kFastDtoaMaximalLength = 17; +static const int kFastDtoaMaximalLength = 17; // Same for single-precision numbers. -// static const int kFastDtoaMaximalSingleLength = 9; +static const int kFastDtoaMaximalSingleLength = 9; // Provides a decimal representation of v. // The result should be interpreted as buffer * 10^(point - length). diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-ieee.h b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-ieee.h index f4c62a9a9..2940acb16 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-ieee.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-ieee.h @@ -59,6 +59,7 @@ class Double { static const uint64_t kExponentMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000); static const uint64_t kSignificandMask = DOUBLE_CONVERSION_UINT64_2PART_C(0x000FFFFF, FFFFFFFF); static const uint64_t kHiddenBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00100000, 00000000); + static const uint64_t kQuietNanBit = DOUBLE_CONVERSION_UINT64_2PART_C(0x00080000, 00000000); static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit. static const int kSignificandSize = 53; static const int kExponentBias = 0x3FF + kPhysicalSignificandSize; @@ -162,6 +163,23 @@ class Double { ((d64 & kSignificandMask) != 0); } + bool IsQuietNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint64() & kQuietNanBit) == 0); +#else + return IsNan() && ((AsUint64() & kQuietNanBit) != 0); +#endif + } + + bool IsSignalingNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint64() & kQuietNanBit) != 0); +#else + return IsNan() && ((AsUint64() & kQuietNanBit) == 0); +#endif + } + + bool IsInfinite() const { uint64_t d64 = AsUint64(); return ((d64 & kExponentMask) == kExponentMask) && @@ -240,7 +258,12 @@ class Double { private: static const int kDenormalExponent = -kExponentBias + 1; static const uint64_t kInfinity = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF00000, 00000000); +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + static const uint64_t kNaN = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF7FFFF, FFFFFFFF); +#else static const uint64_t kNaN = DOUBLE_CONVERSION_UINT64_2PART_C(0x7FF80000, 00000000); +#endif + const uint64_t d64_; @@ -280,6 +303,7 @@ class Single { static const uint32_t kExponentMask = 0x7F800000; static const uint32_t kSignificandMask = 0x007FFFFF; static const uint32_t kHiddenBit = 0x00800000; + static const uint32_t kQuietNanBit = 0x00400000; static const int kPhysicalSignificandSize = 23; // Excludes the hidden bit. static const int kSignificandSize = 24; @@ -338,6 +362,23 @@ class Single { ((d32 & kSignificandMask) != 0); } + bool IsQuietNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint32() & kQuietNanBit) == 0); +#else + return IsNan() && ((AsUint32() & kQuietNanBit) != 0); +#endif + } + + bool IsSignalingNan() const { +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + return IsNan() && ((AsUint32() & kQuietNanBit) != 0); +#else + return IsNan() && ((AsUint32() & kQuietNanBit) == 0); +#endif + } + + bool IsInfinite() const { uint32_t d32 = AsUint32(); return ((d32 & kExponentMask) == kExponentMask) && @@ -404,7 +445,11 @@ class Single { static const int kDenormalExponent = -kExponentBias + 1; static const int kMaxExponent = 0xFF - kExponentBias; static const uint32_t kInfinity = 0x7F800000; +#if (defined(__mips__) && !defined(__mips_nan2008)) || defined(__hppa__) + static const uint32_t kNaN = 0x7FBFFFFF; +#else static const uint32_t kNaN = 0x7FC00000; +#endif const uint32_t d32_; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp index 946b2b26e..727fff24e 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp @@ -51,6 +51,18 @@ // ICU PATCH: Wrap in ICU namespace U_NAMESPACE_BEGIN +#ifdef _MSC_VER +# if _MSC_VER >= 1900 +// Fix MSVC >= 2015 (_MSC_VER == 1900) warning +// C4244: 'argument': conversion from 'const uc16' to 'char', possible loss of data +// against Advance and friends, when instantiated with **it as char, not uc16. + __pragma(warning(disable: 4244)) +# endif +# if _MSC_VER <= 1700 // VS2012, see IsDecimalDigitForRadix warning fix, below +# define VS2012_RADIXWARN +# endif +#endif + namespace double_conversion { namespace { @@ -170,9 +182,9 @@ static double SignedZero(bool sign) { // // The function is small and could be inlined, but VS2012 emitted a warning // because it constant-propagated the radix and concluded that the last -// condition was always true. By moving it into a separate function the -// compiler wouldn't warn anymore. -#ifdef _MSC_VER +// condition was always true. Moving it into a separate function and +// suppressing optimisation keeps the compiler from warning. +#ifdef VS2012_RADIXWARN #pragma optimize("",off) static bool IsDecimalDigitForRadix(int c, int radix) { return '0' <= c && c <= '9' && (c - '0') < radix; @@ -462,11 +474,6 @@ double StringToDoubleConverter::StringToIeee( } } - // The longest form of simplified number is: "-.1eXXX\0". - const int kBufferSize = kMaxSignificantDigits + 10; - char buffer[kBufferSize]; // NOLINT: size is known at compile time. - int buffer_pos = 0; - // Exponent will be adjusted if insignificant digits of the integer part // or insignificant leading zeros of the fractional part are dropped. int exponent = 0; @@ -488,7 +495,7 @@ double StringToDoubleConverter::StringToIeee( current = next_non_space; } - if (infinity_symbol_ != NULL) { + if (infinity_symbol_ != DOUBLE_CONVERSION_NULLPTR) { if (ConsumeFirstCharacter(*current, infinity_symbol_, allow_case_insensitivity)) { if (!ConsumeSubString(¤t, end, infinity_symbol_, allow_case_insensitivity)) { return junk_string_value_; @@ -501,13 +508,12 @@ double StringToDoubleConverter::StringToIeee( return junk_string_value_; } - DOUBLE_CONVERSION_ASSERT(buffer_pos == 0); *processed_characters_count = static_cast(current - input); return sign ? -Double::Infinity() : Double::Infinity(); } } - if (nan_symbol_ != NULL) { + if (nan_symbol_ != DOUBLE_CONVERSION_NULLPTR) { if (ConsumeFirstCharacter(*current, nan_symbol_, allow_case_insensitivity)) { if (!ConsumeSubString(¤t, end, nan_symbol_, allow_case_insensitivity)) { return junk_string_value_; @@ -520,7 +526,6 @@ double StringToDoubleConverter::StringToIeee( return junk_string_value_; } - DOUBLE_CONVERSION_ASSERT(buffer_pos == 0); *processed_characters_count = static_cast(current - input); return sign ? -Double::NaN() : Double::NaN(); } @@ -577,6 +582,12 @@ double StringToDoubleConverter::StringToIeee( bool octal = leading_zero && (flags_ & ALLOW_OCTALS) != 0; + // The longest form of simplified number is: "-.1eXXX\0". + const int kBufferSize = kMaxSignificantDigits + 10; + DOUBLE_CONVERSION_STACK_UNINITIALIZED char + buffer[kBufferSize]; // NOLINT: size is known at compile time. + int buffer_pos = 0; + // Copy significant digits of the integer part (if any) to the buffer. while (*current >= '0' && *current <= '9') { if (significant_digits < kMaxSignificantDigits) { @@ -739,11 +750,17 @@ double StringToDoubleConverter::StringToIeee( DOUBLE_CONVERSION_ASSERT(buffer_pos < kBufferSize); buffer[buffer_pos] = '\0'; + // Code above ensures there are no leading zeros and the buffer has fewer than + // kMaxSignificantDecimalDigits characters. Trim trailing zeros. + Vector chars(buffer, buffer_pos); + chars = TrimTrailingZeros(chars); + exponent += buffer_pos - chars.length(); + double converted; if (read_as_double) { - converted = Strtod(Vector(buffer, buffer_pos), exponent); + converted = StrtodTrimmed(chars, exponent); } else { - converted = Strtof(Vector(buffer, buffer_pos), exponent); + converted = StrtofTrimmed(chars, exponent); } *processed_characters_count = static_cast(current - input); return sign? -converted: converted; @@ -783,6 +800,42 @@ float StringToDoubleConverter::StringToFloat( processed_characters_count)); } + +template<> +double StringToDoubleConverter::StringTo( + const char* buffer, + int length, + int* processed_characters_count) const { + return StringToDouble(buffer, length, processed_characters_count); +} + + +template<> +float StringToDoubleConverter::StringTo( + const char* buffer, + int length, + int* processed_characters_count) const { + return StringToFloat(buffer, length, processed_characters_count); +} + + +template<> +double StringToDoubleConverter::StringTo( + const uc16* buffer, + int length, + int* processed_characters_count) const { + return StringToDouble(buffer, length, processed_characters_count); +} + + +template<> +float StringToDoubleConverter::StringTo( + const uc16* buffer, + int length, + int* processed_characters_count) const { + return StringToFloat(buffer, length, processed_characters_count); +} + } // namespace double_conversion // ICU PATCH: Close ICU namespace diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.h b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.h index 2eb0c1f89..1d4e3dddd 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.h @@ -100,7 +100,7 @@ class StringToDoubleConverter { // This *must* start with "0x" and separate the exponent with "p". // Examples: 0x1.2p3 == 9.0 // 0x10.1p0 == 16.0625 - // ALLOW_HEX and ALLOW_HEX_FLOATS are indendent. + // ALLOW_HEX and ALLOW_HEX_FLOATS are indented. // // empty_string_value is returned when an empty string is given as input. // If ALLOW_LEADING_SPACES or ALLOW_TRAILING_SPACES are set, then a string @@ -158,8 +158,8 @@ class StringToDoubleConverter { // flags = ALLOW_OCTAL | ALLOW_LEADING_SPACES, // empty_string_value = 0.0, // junk_string_value = NaN, - // infinity_symbol = NULL, - // nan_symbol = NULL: + // infinity_symbol = nullptr, + // nan_symbol = nullptr: // StringToDouble("0x1234") -> NaN // junk_string_value. // StringToDouble("01234") -> 668.0. // StringToDouble("") -> 0.0 // empty_string_value. @@ -218,6 +218,18 @@ class StringToDoubleConverter { int length, int* processed_characters_count) const; + // Same as StringToDouble for T = double, and StringToFloat for T = float. + template + T StringTo(const char* buffer, + int length, + int* processed_characters_count) const; + + // Same as StringTo above but for 16 bit characters. + template + T StringTo(const uc16* buffer, + int length, + int* processed_characters_count) const; + private: const int flags_; const double empty_string_value_; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp index 9cf485442..eea820328 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp @@ -49,10 +49,12 @@ U_NAMESPACE_BEGIN namespace double_conversion { +#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS) // 2^53 = 9007199254740992. // Any integer with at most 15 decimal digits will hence fit into a double // (which has a 53bit significand) without loss of precision. static const int kMaxExactDoubleIntegerDecimalDigits = 15; +#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS) // 2^64 = 18446744073709551616 > 10^19 static const int kMaxUint64DecimalDigits = 19; @@ -69,6 +71,7 @@ static const int kMinDecimalPower = -324; static const uint64_t kMaxUint64 = DOUBLE_CONVERSION_UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF); +#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS) static const double exact_powers_of_ten[] = { 1.0, // 10^0 10.0, @@ -96,6 +99,7 @@ static const double exact_powers_of_ten[] = { 10000000000000000000000.0 }; static const int kExactPowersOfTenSize = DOUBLE_CONVERSION_ARRAY_SIZE(exact_powers_of_ten); +#endif // #if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS) // Maximum number of significant digits in the decimal representation. // In fact the value is 772 (see conversions.cc), but to give us some margin @@ -111,17 +115,6 @@ static Vector TrimLeadingZeros(Vector buffer) { return Vector(buffer.start(), 0); } - -static Vector TrimTrailingZeros(Vector buffer) { - for (int i = buffer.length() - 1; i >= 0; --i) { - if (buffer[i] != '0') { - return buffer.SubVector(0, i + 1); - } - } - return Vector(buffer.start(), 0); -} - - static void CutToMaxSignificantDigits(Vector buffer, int exponent, char* significant_buffer, @@ -212,12 +205,14 @@ static bool DoubleStrtod(Vector trimmed, int exponent, double* result) { #if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS) + // Avoid "unused parameter" warnings + (void) trimmed; + (void) exponent; + (void) result; // On x86 the floating-point stack can be 64 or 80 bits wide. If it is // 80 bits wide (as is the case on Linux) then double-rounding occurs and the // result is not accurate. // We know that Windows32 uses 64 bits and is therefore accurate. - // Note that the ARM simulator is compiled for 32bits. It therefore exhibits - // the same problem. return false; #else if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) { @@ -469,6 +464,11 @@ static bool IsNonZeroDigit(const char d) { return ('1' <= d) && (d <= '9'); } +#ifdef __has_cpp_attribute +#if __has_cpp_attribute(maybe_unused) +[[maybe_unused]] +#endif +#endif static bool AssertTrimmedDigits(const Vector& buffer) { for(int i = 0; i < buffer.length(); ++i) { if(!IsDigit(buffer[i])) { @@ -541,6 +541,12 @@ float Strtof(Vector buffer, int exponent) { TrimAndCut(buffer, exponent, copy_buffer, kMaxSignificantDecimalDigits, &trimmed, &updated_exponent); exponent = updated_exponent; + return StrtofTrimmed(trimmed, exponent); +} + +float StrtofTrimmed(Vector trimmed, int exponent) { + DOUBLE_CONVERSION_ASSERT(trimmed.length() <= kMaxSignificantDecimalDigits); + DOUBLE_CONVERSION_ASSERT(AssertTrimmedDigits(trimmed)); double double_guess; bool is_correct = ComputeGuess(trimmed, exponent, &double_guess); @@ -560,7 +566,7 @@ float Strtof(Vector buffer, int exponent) { // low-precision (3 digits): // when read from input: 123 // when rounded from high precision: 124. - // To do this we simply look at the neigbors of the correct result and see + // To do this we simply look at the neighbors of the correct result and see // if they would round to the same float. If the guess is not correct we have // to look at four values (since two different doubles could be the correct // double). diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.h b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.h index 50ef74640..abfe00a33 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.h @@ -54,11 +54,25 @@ double Strtod(Vector buffer, int exponent); // contain a dot or a sign. It must not start with '0', and must not be empty. float Strtof(Vector buffer, int exponent); -// For special use cases, the heart of the Strtod() function is also available -// separately, it assumes that 'trimmed' is as produced by TrimAndCut(), i.e. -// no leading or trailing zeros, also no lone zero, and not 'too many' digits. +// Same as Strtod, but assumes that 'trimmed' is already trimmed, as if run +// through TrimAndCut. That is, 'trimmed' must have no leading or trailing +// zeros, must not be a lone zero, and must not have 'too many' digits. double StrtodTrimmed(Vector trimmed, int exponent); +// Same as Strtof, but assumes that 'trimmed' is already trimmed, as if run +// through TrimAndCut. That is, 'trimmed' must have no leading or trailing +// zeros, must not be a lone zero, and must not have 'too many' digits. +float StrtofTrimmed(Vector trimmed, int exponent); + +inline Vector TrimTrailingZeros(Vector buffer) { + for (int i = buffer.length() - 1; i >= 0; --i) { + if (buffer[i] != '0') { + return buffer.SubVector(0, i + 1); + } + } + return Vector(buffer.start(), 0); +} + } // namespace double_conversion // ICU PATCH: Close ICU namespace diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-utils.h b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-utils.h index 099298460..303668f93 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-utils.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-utils.h @@ -37,18 +37,36 @@ #ifndef DOUBLE_CONVERSION_UTILS_H_ #define DOUBLE_CONVERSION_UTILS_H_ +// Use DOUBLE_CONVERSION_NON_PREFIXED_MACROS to get unprefixed macros as was +// the case in double-conversion releases prior to 3.1.6 + #include #include +// For pre-C++11 compatibility +#if __cplusplus >= 201103L +#define DOUBLE_CONVERSION_NULLPTR nullptr +#else +#define DOUBLE_CONVERSION_NULLPTR NULL +#endif + // ICU PATCH: Use U_ASSERT instead of #include "uassert.h" #ifndef DOUBLE_CONVERSION_ASSERT #define DOUBLE_CONVERSION_ASSERT(condition) \ - U_ASSERT(condition); + U_ASSERT(condition) +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(ASSERT) +#define ASSERT DOUBLE_CONVERSION_ASSERT #endif + #ifndef DOUBLE_CONVERSION_UNIMPLEMENTED #define DOUBLE_CONVERSION_UNIMPLEMENTED() (abort()) #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UNIMPLEMENTED) +#define UNIMPLEMENTED DOUBLE_CONVERSION_UNIMPLEMENTED +#endif + #ifndef DOUBLE_CONVERSION_NO_RETURN #ifdef _MSC_VER #define DOUBLE_CONVERSION_NO_RETURN __declspec(noreturn) @@ -56,6 +74,10 @@ #define DOUBLE_CONVERSION_NO_RETURN __attribute__((noreturn)) #endif #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(NO_RETURN) +#define NO_RETURN DOUBLE_CONVERSION_NO_RETURN +#endif + #ifndef DOUBLE_CONVERSION_UNREACHABLE #ifdef _MSC_VER void DOUBLE_CONVERSION_NO_RETURN abort_noreturn(); @@ -65,14 +87,37 @@ inline void abort_noreturn() { abort(); } #define DOUBLE_CONVERSION_UNREACHABLE() (abort()) #endif #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UNREACHABLE) +#define UNREACHABLE DOUBLE_CONVERSION_UNREACHABLE +#endif + +// Not all compilers support __has_attribute and combining a check for both +// ifdef and __has_attribute on the same preprocessor line isn't portable. +#ifdef __has_attribute +# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define DOUBLE_CONVERSION_HAS_ATTRIBUTE(x) 0 +#endif #ifndef DOUBLE_CONVERSION_UNUSED -#ifdef __GNUC__ +#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(unused) #define DOUBLE_CONVERSION_UNUSED __attribute__((unused)) #else #define DOUBLE_CONVERSION_UNUSED #endif #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UNUSED) +#define UNUSED DOUBLE_CONVERSION_UNUSED +#endif + +#if DOUBLE_CONVERSION_HAS_ATTRIBUTE(uninitialized) +#define DOUBLE_CONVERSION_STACK_UNINITIALIZED __attribute__((uninitialized)) +#else +#define DOUBLE_CONVERSION_STACK_UNINITIALIZED +#endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(STACK_UNINITIALIZED) +#define STACK_UNINITIALIZED DOUBLE_CONVERSION_STACK_UNINITIALIZED +#endif // Double operations detection based on target architecture. // Linux uses a 80bit wide floating point stack on x86. This induces double @@ -104,6 +149,8 @@ int main(int argc, char** argv) { defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \ defined(__hppa__) || defined(__ia64__) || \ defined(__mips__) || \ + defined(__loongarch__) || \ + defined(__nios2__) || defined(__ghs) || \ defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \ defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ @@ -111,8 +158,9 @@ int main(int argc, char** argv) { defined(_MIPS_ARCH_MIPS32R2) || defined(__ARMEB__) ||\ defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \ defined(__riscv) || defined(__e2k__) || \ - defined(__or1k__) || defined(__arc__) || \ - defined(__EMSCRIPTEN__) + defined(__or1k__) || defined(__arc__) || defined(__ARC64__) || \ + defined(__microblaze__) || defined(__XTENSA__) || \ + defined(__EMSCRIPTEN__) || defined(__wasm32__) #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 #elif defined(__mc68000__) || \ defined(__pnacl__) || defined(__native_client__) @@ -127,6 +175,9 @@ int main(int argc, char** argv) { #else #error Target architecture was not detected as supported by Double-Conversion. #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(CORRECT_DOUBLE_OPERATIONS) +#define CORRECT_DOUBLE_OPERATIONS DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS +#endif #if defined(_WIN32) && !defined(__MINGW32__) @@ -152,7 +203,9 @@ typedef uint16_t uc16; // Usage: instead of writing 0x1234567890123456 // write DOUBLE_CONVERSION_UINT64_2PART_C(0x12345678,90123456); #define DOUBLE_CONVERSION_UINT64_2PART_C(a, b) (((static_cast(a) << 32) + 0x##b##u)) - +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(UINT64_2PART_C) +#define UINT64_2PART_C DOUBLE_CONVERSION_UINT64_2PART_C +#endif // The expression DOUBLE_CONVERSION_ARRAY_SIZE(a) is a compile-time constant of type // size_t which represents the number of elements of the given @@ -163,6 +216,9 @@ typedef uint16_t uc16; ((sizeof(a) / sizeof(*(a))) / \ static_cast(!(sizeof(a) % sizeof(*(a))))) #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(ARRAY_SIZE) +#define ARRAY_SIZE DOUBLE_CONVERSION_ARRAY_SIZE +#endif // A macro to disallow the evil copy constructor and operator= functions // This should be used in the private: declarations for a class @@ -171,6 +227,9 @@ typedef uint16_t uc16; TypeName(const TypeName&); \ void operator=(const TypeName&) #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(DC_DISALLOW_COPY_AND_ASSIGN) +#define DC_DISALLOW_COPY_AND_ASSIGN DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN +#endif // A macro to disallow all the implicit constructors, namely the // default constructor, copy constructor and operator= functions. @@ -183,6 +242,9 @@ typedef uint16_t uc16; TypeName(); \ DOUBLE_CONVERSION_DISALLOW_COPY_AND_ASSIGN(TypeName) #endif +#if defined(DOUBLE_CONVERSION_NON_PREFIXED_MACROS) && !defined(DC_DISALLOW_IMPLICIT_CONSTRUCTORS) +#define DC_DISALLOW_IMPLICIT_CONSTRUCTORS DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS +#endif // ICU PATCH: Wrap in ICU namespace U_NAMESPACE_BEGIN @@ -199,9 +261,9 @@ inline int StrLength(const char* string) { template class Vector { public: - Vector() : start_(NULL), length_(0) {} + Vector() : start_(DOUBLE_CONVERSION_NULLPTR), length_(0) {} Vector(T* data, int len) : start_(data), length_(len) { - DOUBLE_CONVERSION_ASSERT(len == 0 || (len > 0 && data != NULL)); + DOUBLE_CONVERSION_ASSERT(len == 0 || (len > 0 && data != DOUBLE_CONVERSION_NULLPTR)); } // Returns a vector using the same backing storage as this one, @@ -284,7 +346,7 @@ class StringBuilder { void AddSubstring(const char* s, int n) { DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ + n < buffer_.length()); DOUBLE_CONVERSION_ASSERT(static_cast(n) <= strlen(s)); - memmove(&buffer_[position_], s, n); + memmove(&buffer_[position_], s, static_cast(n)); position_ += n; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dt_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/dt_impl.h index b01947943..a21b68ce1 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dt_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dt_impl.h @@ -25,66 +25,66 @@ #include "unicode/unistr.h" -#define dt_impl_QUOTE ((UChar)0x0027) -#define dt_impl_LOW_LINE ((UChar)0x005F) -#define dt_impl_COLON ((UChar)0x003A) -#define dt_impl_LEFT_CURLY_BRACKET ((UChar)0x007B) -#define dt_impl_RIGHT_CURLY_BRACKET ((UChar)0x007D) -#define dt_impl_SPACE ((UChar)0x0020) -#define dt_impl_EN_DASH ((UChar)0x2013) -#define dt_impl_SOLIDUS ((UChar)0x002F) -#define dt_impl_PERCENT ((UChar)0x0025) +#define QUOTE ((char16_t)0x0027) +#define LOW_LINE ((char16_t)0x005F) +#define COLON ((char16_t)0x003A) +#define LEFT_CURLY_BRACKET ((char16_t)0x007B) +#define RIGHT_CURLY_BRACKET ((char16_t)0x007D) +#define SPACE ((char16_t)0x0020) +#define EN_DASH ((char16_t)0x2013) +#define SOLIDUS ((char16_t)0x002F) +#define PERCENT ((char16_t)0x0025) -#define dt_impl_DIGIT_ZERO ((UChar)0x0030) -#define dt_impl_DIGIT_ONE ((UChar)0x0031) +#define DIGIT_ZERO ((char16_t)0x0030) +#define DIGIT_ONE ((char16_t)0x0031) -#define dt_impl_LOW_A ((UChar)0x0061) -#define dt_impl_LOW_B ((UChar)0x0062) -#define dt_impl_LOW_C ((UChar)0x0063) -#define dt_impl_LOW_D ((UChar)0x0064) -#define dt_impl_LOW_E ((UChar)0x0065) -#define dt_impl_LOW_F ((UChar)0x0066) -#define dt_impl_LOW_G ((UChar)0x0067) -#define dt_impl_LOW_H ((UChar)0x0068) -#define dt_impl_LOW_I ((UChar)0x0069) -#define dt_impl_LOW_J ((UChar)0x006a) -#define dt_impl_LOW_K ((UChar)0x006B) -#define dt_impl_LOW_L ((UChar)0x006C) -#define dt_impl_LOW_M ((UChar)0x006D) -#define dt_impl_LOW_N ((UChar)0x006E) -#define dt_impl_LOW_O ((UChar)0x006F) -#define dt_impl_LOW_P ((UChar)0x0070) -#define dt_impl_LOW_Q ((UChar)0x0071) -#define dt_impl_LOW_R ((UChar)0x0072) -#define dt_impl_LOW_S ((UChar)0x0073) -#define dt_impl_LOW_T ((UChar)0x0074) -#define dt_impl_LOW_U ((UChar)0x0075) -#define dt_impl_LOW_V ((UChar)0x0076) -#define dt_impl_LOW_W ((UChar)0x0077) -#define dt_impl_LOW_Y ((UChar)0x0079) -#define dt_impl_LOW_Z ((UChar)0x007A) +#define LOW_A ((char16_t)0x0061) +#define LOW_B ((char16_t)0x0062) +#define LOW_C ((char16_t)0x0063) +#define LOW_D ((char16_t)0x0064) +#define LOW_E ((char16_t)0x0065) +#define LOW_F ((char16_t)0x0066) +#define LOW_G ((char16_t)0x0067) +#define LOW_H ((char16_t)0x0068) +#define LOW_I ((char16_t)0x0069) +#define LOW_J ((char16_t)0x006a) +#define LOW_K ((char16_t)0x006B) +#define LOW_L ((char16_t)0x006C) +#define LOW_M ((char16_t)0x006D) +#define LOW_N ((char16_t)0x006E) +#define LOW_O ((char16_t)0x006F) +#define LOW_P ((char16_t)0x0070) +#define LOW_Q ((char16_t)0x0071) +#define LOW_R ((char16_t)0x0072) +#define LOW_S ((char16_t)0x0073) +#define LOW_T ((char16_t)0x0074) +#define LOW_U ((char16_t)0x0075) +#define LOW_V ((char16_t)0x0076) +#define LOW_W ((char16_t)0x0077) +#define LOW_Y ((char16_t)0x0079) +#define LOW_Z ((char16_t)0x007A) -#define dt_impl_CAP_A ((UChar)0x0041) -#define dt_impl_CAP_C ((UChar)0x0043) -#define dt_impl_CAP_D ((UChar)0x0044) -#define dt_impl_CAP_E ((UChar)0x0045) -#define dt_impl_CAP_F ((UChar)0x0046) -#define dt_impl_CAP_G ((UChar)0x0047) -#define dt_impl_CAP_H ((UChar)0x0048) -#define dt_impl_CAP_K ((UChar)0x004B) -#define dt_impl_CAP_L ((UChar)0x004C) -#define dt_impl_CAP_M ((UChar)0x004D) -#define dt_impl_CAP_N ((UChar)0x004E) -#define dt_impl_CAP_O ((UChar)0x004F) -#define dt_impl_CAP_P ((UChar)0x0050) -#define dt_impl_CAP_Q ((UChar)0x0051) -#define dt_impl_CAP_S ((UChar)0x0053) -#define dt_impl_CAP_T ((UChar)0x0054) -#define dt_impl_CAP_U ((UChar)0x0055) -#define dt_impl_CAP_V ((UChar)0x0056) -#define dt_impl_CAP_W ((UChar)0x0057) -#define dt_impl_CAP_Y ((UChar)0x0059) -#define dt_impl_CAP_Z ((UChar)0x005A) +#define CAP_A ((char16_t)0x0041) +#define CAP_C ((char16_t)0x0043) +#define CAP_D ((char16_t)0x0044) +#define CAP_E ((char16_t)0x0045) +#define CAP_F ((char16_t)0x0046) +#define CAP_G ((char16_t)0x0047) +#define CAP_H ((char16_t)0x0048) +#define CAP_K ((char16_t)0x004B) +#define CAP_L ((char16_t)0x004C) +#define CAP_M ((char16_t)0x004D) +#define CAP_N ((char16_t)0x004E) +#define CAP_O ((char16_t)0x004F) +#define CAP_P ((char16_t)0x0050) +#define CAP_Q ((char16_t)0x0051) +#define CAP_S ((char16_t)0x0053) +#define CAP_T ((char16_t)0x0054) +#define CAP_U ((char16_t)0x0055) +#define CAP_V ((char16_t)0x0056) +#define CAP_W ((char16_t)0x0057) +#define CAP_Y ((char16_t)0x0059) +#define CAP_Z ((char16_t)0x005A) #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp index b9ab31caa..943f6e21d 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp @@ -70,7 +70,7 @@ * Unlocalized date-time pattern characters. For example: 'y', 'd', etc. All * locales use the same these unlocalized pattern characters. */ -static const UChar gPatternChars[] = { +static const char16_t gPatternChars[] = { // if UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR: // GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxrbB: // else: @@ -91,7 +91,7 @@ static const UChar gPatternChars[] = { // files. They aren't designed for actual use, just for backup. // These are the month names and abbreviations of last resort. -static const UChar gLastResortMonthNames[13][3] = +static const char16_t gLastResortMonthNames[13][3] = { {0x0030, 0x0031, 0x0000}, /* "01" */ {0x0030, 0x0032, 0x0000}, /* "02" */ @@ -109,7 +109,7 @@ static const UChar gLastResortMonthNames[13][3] = }; // These are the weekday names and abbreviations of last resort. -static const UChar gLastResortDayNames[8][2] = +static const char16_t gLastResortDayNames[8][2] = { {0x0030, 0x0000}, /* "0" */ {0x0031, 0x0000}, /* "1" */ @@ -122,7 +122,7 @@ static const UChar gLastResortDayNames[8][2] = }; // These are the quarter names and abbreviations of last resort. -static const UChar gLastResortQuarters[4][2] = +static const char16_t gLastResortQuarters[4][2] = { {0x0031, 0x0000}, /* "1" */ {0x0032, 0x0000}, /* "2" */ @@ -131,13 +131,13 @@ static const UChar gLastResortQuarters[4][2] = }; // These are the am/pm and BC/AD markers of last resort. -static const UChar gLastResortAmPmMarkers[2][3] = +static const char16_t gLastResortAmPmMarkers[2][3] = { {0x0041, 0x004D, 0x0000}, /* "AM" */ {0x0050, 0x004D, 0x0000} /* "PM" */ }; -static const UChar gLastResortEras[2][3] = +static const char16_t gLastResortEras[2][3] = { {0x0042, 0x0043, 0x0000}, /* "BC" */ {0x0041, 0x0044, 0x0000} /* "AD" */ @@ -179,17 +179,17 @@ const SharedDateFormatSymbols * char type[256]; Calendar::getCalendarTypeFromLocale(fLoc, type, UPRV_LENGTHOF(type), status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } SharedDateFormatSymbols *shared = new SharedDateFormatSymbols(fLoc, type, status); - if (shared == NULL) { + if (shared == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } if (U_FAILURE(status)) { delete shared; - return NULL; + return nullptr; } shared->addRef(); return shared; @@ -203,31 +203,31 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateFormatSymbols) * These are the tags we expect to see in normal resource bundle files associated * with a locale and calendar */ -static const char dtfmtsym_gCalendarTag[]="calendar"; -static const char dtfmtsym_gGregorianTag[]="gregorian"; -static const char dtfmtsym_gErasTag[]="eras"; -static const char dtfmtsym_gCyclicNameSetsTag[]="cyclicNameSets"; -static const char dtfmtsym_gNameSetYearsTag[]="years"; -static const char dtfmtsym_gNameSetZodiacsTag[]="zodiacs"; -static const char dtfmtsym_gMonthNamesTag[]="monthNames"; -static const char dtfmtsym_gMonthPatternsTag[]="monthPatterns"; -static const char dtfmtsym_gDayNamesTag[]="dayNames"; -static const char dtfmtsym_gNamesWideTag[]="wide"; -static const char dtfmtsym_gNamesAbbrTag[]="abbreviated"; -static const char dtfmtsym_gNamesShortTag[]="short"; -static const char dtfmtsym_gNamesNarrowTag[]="narrow"; -static const char dtfmtsym_gNamesAllTag[]="all"; -static const char dtfmtsym_gNamesFormatTag[]="format"; -static const char dtfmtsym_gNamesStandaloneTag[]="stand-alone"; -static const char dtfmtsym_gNamesNumericTag[]="numeric"; -static const char dtfmtsym_gAmPmMarkersTag[]="AmPmMarkers"; -static const char dtfmtsym_gAmPmMarkersAbbrTag[]="AmPmMarkersAbbr"; -static const char dtfmtsym_gAmPmMarkersNarrowTag[]="AmPmMarkersNarrow"; -static const char dtfmtsym_gQuartersTag[]="quarters"; -static const char dtfmtsym_gNumberElementsTag[]="NumberElements"; -static const char dtfmtsym_gSymbolsTag[]="symbols"; -static const char dtfmtsym_gTimeSeparatorTag[]="timeSeparator"; -static const char dtfmtsym_gDayPeriodTag[]="dayPeriod"; +static const char gCalendarTag[]="calendar"; +static const char gGregorianTag[]="gregorian"; +static const char gErasTag[]="eras"; +static const char gCyclicNameSetsTag[]="cyclicNameSets"; +static const char gNameSetYearsTag[]="years"; +static const char gNameSetZodiacsTag[]="zodiacs"; +static const char gMonthNamesTag[]="monthNames"; +static const char gMonthPatternsTag[]="monthPatterns"; +static const char gDayNamesTag[]="dayNames"; +static const char gNamesWideTag[]="wide"; +static const char gNamesAbbrTag[]="abbreviated"; +static const char gNamesShortTag[]="short"; +static const char gNamesNarrowTag[]="narrow"; +static const char gNamesAllTag[]="all"; +static const char gNamesFormatTag[]="format"; +static const char gNamesStandaloneTag[]="stand-alone"; +static const char gNamesNumericTag[]="numeric"; +static const char gAmPmMarkersTag[]="AmPmMarkers"; +static const char gAmPmMarkersAbbrTag[]="AmPmMarkersAbbr"; +static const char gAmPmMarkersNarrowTag[]="AmPmMarkersNarrow"; +static const char gQuartersTag[]="quarters"; +static const char gNumberElementsTag[]="NumberElements"; +static const char gSymbolsTag[]="symbols"; +static const char gTimeSeparatorTag[]="timeSeparator"; +static const char gDayPeriodTag[]="dayPeriod"; // static const char gZoneStringsTag[]="zoneStrings"; @@ -248,16 +248,16 @@ static inline UnicodeString* newUnicodeStringArray(size_t count) { DateFormatSymbols * U_EXPORT2 DateFormatSymbols::createForLocale( const Locale& locale, UErrorCode &status) { - const SharedDateFormatSymbols *shared = NULL; + const SharedDateFormatSymbols *shared = nullptr; UnifiedCache::getByLocale(locale, shared, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } DateFormatSymbols *result = new DateFormatSymbols(shared->get()); shared->removeRef(); - if (result == NULL) { + if (result == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } return result; } @@ -266,13 +266,13 @@ DateFormatSymbols::DateFormatSymbols(const Locale& locale, UErrorCode& status) : UObject() { - initializeData(locale, NULL, status); + initializeData(locale, nullptr, status); } DateFormatSymbols::DateFormatSymbols(UErrorCode& status) : UObject() { - initializeData(Locale::getDefault(), NULL, status, TRUE); + initializeData(Locale::getDefault(), nullptr, status, true); } @@ -287,7 +287,7 @@ DateFormatSymbols::DateFormatSymbols(const Locale& locale, DateFormatSymbols::DateFormatSymbols(const char *type, UErrorCode& status) : UObject() { - initializeData(Locale::getDefault(), type, status, TRUE); + initializeData(Locale::getDefault(), type, status, true); } DateFormatSymbols::DateFormatSymbols(const DateFormatSymbols& other) @@ -314,9 +314,17 @@ DateFormatSymbols::assignArray(UnicodeString*& dstArray, // only from a locale bundle or set via the cloning API, // *and* for as long as all the strings are in *private* fields, preventing // a subclass from creating these strings in an "unsafe" way (with respect to fastCopyFrom()). + if(srcArray == nullptr) { + // Do not attempt to copy bogus input (which will crash). + // Note that this assignArray method already had the potential to return a null dstArray; + // see handling below for "if(dstArray != nullptr)". + dstCount = 0; + dstArray = nullptr; + return; + } dstCount = srcCount; dstArray = newUnicodeStringArray(srcCount); - if(dstArray != NULL) { + if(dstArray != nullptr) { int32_t i; for(i=0; i0) { --count; - if (array1[count] != array2[count]) return FALSE; + if (array1[count] != array2[count]) return false; } - return TRUE; + return true; } bool @@ -539,7 +552,7 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const { // First do cheap comparisons if (this == &other) { - return TRUE; + return true; } if (fErasCount == other.fErasCount && fEraNamesCount == other.fEraNamesCount && @@ -562,8 +575,10 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const fNarrowAmPmsCount == other.fNarrowAmPmsCount && fQuartersCount == other.fQuartersCount && fShortQuartersCount == other.fShortQuartersCount && + fNarrowQuartersCount == other.fNarrowQuartersCount && fStandaloneQuartersCount == other.fStandaloneQuartersCount && fStandaloneShortQuartersCount == other.fStandaloneShortQuartersCount && + fStandaloneNarrowQuartersCount == other.fStandaloneNarrowQuartersCount && fLeapMonthPatternsCount == other.fLeapMonthPatternsCount && fShortYearNamesCount == other.fShortYearNamesCount && fShortZodiacNamesCount == other.fShortZodiacNamesCount && @@ -598,8 +613,10 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const fTimeSeparator == other.fTimeSeparator && arrayCompare(fQuarters, other.fQuarters, fQuartersCount) && arrayCompare(fShortQuarters, other.fShortQuarters, fShortQuartersCount) && + arrayCompare(fNarrowQuarters, other.fNarrowQuarters, fNarrowQuartersCount) && arrayCompare(fStandaloneQuarters, other.fStandaloneQuarters, fStandaloneQuartersCount) && arrayCompare(fStandaloneShortQuarters, other.fStandaloneShortQuarters, fStandaloneShortQuartersCount) && + arrayCompare(fStandaloneNarrowQuarters, other.fStandaloneNarrowQuarters, fStandaloneNarrowQuartersCount) && arrayCompare(fLeapMonthPatterns, other.fLeapMonthPatterns, fLeapMonthPatternsCount) && arrayCompare(fShortYearNames, other.fShortYearNames, fShortYearNamesCount) && arrayCompare(fShortZodiacNames, other.fShortZodiacNames, fShortZodiacNamesCount) && @@ -614,24 +631,24 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const fStandaloneWideDayPeriodsCount)) { // Compare the contents of fZoneStrings - if (fZoneStrings == NULL && other.fZoneStrings == NULL) { + if (fZoneStrings == nullptr && other.fZoneStrings == nullptr) { if (fZSFLocale == other.fZSFLocale) { - return TRUE; + return true; } - } else if (fZoneStrings != NULL && other.fZoneStrings != NULL) { + } else if (fZoneStrings != nullptr && other.fZoneStrings != nullptr) { if (fZoneStringsRowCount == other.fZoneStringsRowCount && fZoneStringsColCount == other.fZoneStringsColCount) { - UBool cmpres = TRUE; + bool cmpres = true; for (int32_t i = 0; (i < fZoneStringsRowCount) && cmpres; i++) { cmpres = arrayCompare(fZoneStrings[i], other.fZoneStrings[i], fZoneStringsColCount); } return cmpres; } } - return FALSE; + return false; } } - return FALSE; + return false; } //------------------------------------------------------ @@ -674,7 +691,7 @@ DateFormatSymbols::getShortMonths(int32_t &count) const const UnicodeString* DateFormatSymbols::getMonths(int32_t &count, DtContextType context, DtWidthType width ) const { - UnicodeString *returnValue = NULL; + UnicodeString *returnValue = nullptr; switch (context) { case FORMAT : @@ -738,7 +755,7 @@ DateFormatSymbols::getShortWeekdays(int32_t &count) const const UnicodeString* DateFormatSymbols::getWeekdays(int32_t &count, DtContextType context, DtWidthType width) const { - UnicodeString *returnValue = NULL; + UnicodeString *returnValue = nullptr; switch (context) { case FORMAT : switch(width) { @@ -793,7 +810,7 @@ DateFormatSymbols::getWeekdays(int32_t &count, DtContextType context, DtWidthTyp const UnicodeString* DateFormatSymbols::getQuarters(int32_t &count, DtContextType context, DtWidthType width ) const { - UnicodeString *returnValue = NULL; + UnicodeString *returnValue = nullptr; switch (context) { case FORMAT : @@ -808,8 +825,8 @@ DateFormatSymbols::getQuarters(int32_t &count, DtContextType context, DtWidthTyp returnValue = fShortQuarters; break; case NARROW : - count = 0; - returnValue = NULL; + count = fNarrowQuartersCount; + returnValue = fNarrowQuarters; break; case DT_WIDTH_COUNT : break; @@ -827,8 +844,8 @@ DateFormatSymbols::getQuarters(int32_t &count, DtContextType context, DtWidthTyp returnValue = fStandaloneShortQuarters; break; case NARROW : - count = 0; - returnValue = NULL; + count = fStandaloneNarrowQuartersCount; + returnValue = fStandaloneNarrowQuarters; break; case DT_WIDTH_COUNT : break; @@ -1177,13 +1194,11 @@ DateFormatSymbols::setQuarters(const UnicodeString* quartersArray, int32_t count fShortQuartersCount = count; break; case NARROW : - /* if (fNarrowQuarters) delete[] fNarrowQuarters; fNarrowQuarters = newUnicodeStringArray(count); uprv_arrayCopy( quartersArray,fNarrowQuarters,count); fNarrowQuartersCount = count; - */ break; default : break; @@ -1206,13 +1221,11 @@ DateFormatSymbols::setQuarters(const UnicodeString* quartersArray, int32_t count fStandaloneShortQuartersCount = count; break; case NARROW : - /* if (fStandaloneNarrowQuarters) delete[] fStandaloneNarrowQuarters; fStandaloneNarrowQuarters = newUnicodeStringArray(count); uprv_arrayCopy( quartersArray,fStandaloneNarrowQuarters,count); fStandaloneNarrowQuartersCount = count; - */ break; default : break; @@ -1245,12 +1258,12 @@ DateFormatSymbols::setTimeSeparatorString(const UnicodeString& newTimeSeparator) const UnicodeString** DateFormatSymbols::getZoneStrings(int32_t& rowCount, int32_t& columnCount) const { - const UnicodeString **result = NULL; + const UnicodeString **result = nullptr; static UMutex LOCK; umtx_lock(&LOCK); - if (fZoneStrings == NULL) { - if (fLocaleZoneStrings == NULL) { + if (fZoneStrings == nullptr) { + if (fLocaleZoneStrings == nullptr) { ((DateFormatSymbols*)this)->initZoneStringsArray(); } result = (const UnicodeString**)fLocaleZoneStrings; @@ -1269,16 +1282,16 @@ DateFormatSymbols::getZoneStrings(int32_t& rowCount, int32_t& columnCount) const // This code must be called within a synchronized block void -DateFormatSymbols::initZoneStringsArray(void) { - if (fZoneStrings != NULL || fLocaleZoneStrings != NULL) { +DateFormatSymbols::initZoneStringsArray() { + if (fZoneStrings != nullptr || fLocaleZoneStrings != nullptr) { return; } UErrorCode status = U_ZERO_ERROR; - StringEnumeration *tzids = NULL; - UnicodeString ** zarray = NULL; - TimeZoneNames *tzNames = NULL; + StringEnumeration *tzids = nullptr; + UnicodeString ** zarray = nullptr; + TimeZoneNames *tzNames = nullptr; int32_t rows = 0; static const UTimeZoneNameType TYPES[] = { @@ -1289,7 +1302,7 @@ DateFormatSymbols::initZoneStringsArray(void) { do { // dummy do-while - tzids = TimeZone::createTimeZoneIDEnumeration(ZONE_SET, NULL, NULL, status); + tzids = TimeZone::createTimeZoneIDEnumeration(ZONE_SET, nullptr, nullptr, status); rows = tzids->count(status); if (U_FAILURE(status)) { break; @@ -1298,7 +1311,7 @@ DateFormatSymbols::initZoneStringsArray(void) { // Allocate array int32_t size = rows * sizeof(UnicodeString*); zarray = (UnicodeString**)uprv_malloc(size); - if (zarray == NULL) { + if (zarray == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; break; } @@ -1319,7 +1332,7 @@ DateFormatSymbols::initZoneStringsArray(void) { } zarray[i] = new UnicodeString[5]; - if (zarray[i] == NULL) { + if (zarray[i] == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; break; } @@ -1329,7 +1342,7 @@ DateFormatSymbols::initZoneStringsArray(void) { i++; } - } while (FALSE); + } while (false); if (U_FAILURE(status)) { if (zarray) { @@ -1339,7 +1352,7 @@ DateFormatSymbols::initZoneStringsArray(void) { } } uprv_free(zarray); - zarray = NULL; + zarray = nullptr; } } @@ -1371,15 +1384,15 @@ DateFormatSymbols::setZoneStrings(const UnicodeString* const *strings, int32_t r //------------------------------------------------------ const char16_t * U_EXPORT2 -DateFormatSymbols::getPatternUChars(void) +DateFormatSymbols::getPatternUChars() { return gPatternChars; } UDateFormatField U_EXPORT2 -DateFormatSymbols::getPatternCharIndex(UChar c) { - const UChar *p = u_strchr(gPatternChars, c); - if (p == NULL) { +DateFormatSymbols::getPatternCharIndex(char16_t c) { + const char16_t *p = u_strchr(gPatternChars, c); + if (p == nullptr) { return UDAT_FIELD_COUNT; } else { return static_cast(p - gPatternChars); @@ -1417,14 +1430,14 @@ static const uint64_t kNumericFieldsForCount12 = UBool U_EXPORT2 DateFormatSymbols::isNumericField(UDateFormatField f, int32_t count) { if (f == UDAT_FIELD_COUNT) { - return FALSE; + return false; } uint64_t flag = ((uint64_t)1 << f); return ((kNumericFieldsAlways & flag) != 0 || ((kNumericFieldsForCount12 & flag) != 0 && count < 3)); } UBool U_EXPORT2 -DateFormatSymbols::isNumericPatternChar(UChar c, int32_t count) { +DateFormatSymbols::isNumericPatternChar(char16_t c, int32_t count) { return isNumericField(getPatternCharIndex(c), count); } @@ -1450,36 +1463,36 @@ DateFormatSymbols::setLocalPatternChars(const UnicodeString& newLocalPatternChar namespace { // Constants declarations -static const UChar kCalendarAliasPrefixUChar[] = { - dt_impl_SOLIDUS, dt_impl_CAP_L, dt_impl_CAP_O, dt_impl_CAP_C, dt_impl_CAP_A, dt_impl_CAP_L, dt_impl_CAP_E, dt_impl_SOLIDUS, - dt_impl_LOW_C, dt_impl_LOW_A, dt_impl_LOW_L, dt_impl_LOW_E, dt_impl_LOW_N, dt_impl_LOW_D, dt_impl_LOW_A, dt_impl_LOW_R, dt_impl_SOLIDUS +static const char16_t kCalendarAliasPrefixUChar[] = { + SOLIDUS, CAP_L, CAP_O, CAP_C, CAP_A, CAP_L, CAP_E, SOLIDUS, + LOW_C, LOW_A, LOW_L, LOW_E, LOW_N, LOW_D, LOW_A, LOW_R, SOLIDUS }; -static const UChar kGregorianTagUChar[] = { - dt_impl_LOW_G, dt_impl_LOW_R, dt_impl_LOW_E, dt_impl_LOW_G, dt_impl_LOW_O, dt_impl_LOW_R, dt_impl_LOW_I, dt_impl_LOW_A, dt_impl_LOW_N +static const char16_t kGregorianTagUChar[] = { + LOW_G, LOW_R, LOW_E, LOW_G, LOW_O, LOW_R, LOW_I, LOW_A, LOW_N }; -static const UChar kVariantTagUChar[] = { - dt_impl_PERCENT, dt_impl_LOW_V, dt_impl_LOW_A, dt_impl_LOW_R, dt_impl_LOW_I, dt_impl_LOW_A, dt_impl_LOW_N, dt_impl_LOW_T +static const char16_t kVariantTagUChar[] = { + PERCENT, LOW_V, LOW_A, LOW_R, LOW_I, LOW_A, LOW_N, LOW_T }; -static const UChar kLeapTagUChar[] = { - dt_impl_LOW_L, dt_impl_LOW_E, dt_impl_LOW_A, dt_impl_LOW_P +static const char16_t kLeapTagUChar[] = { + LOW_L, LOW_E, LOW_A, LOW_P }; -static const UChar kCyclicNameSetsTagUChar[] = { - dt_impl_LOW_C, dt_impl_LOW_Y, dt_impl_LOW_C, dt_impl_LOW_L, dt_impl_LOW_I, dt_impl_LOW_C, dt_impl_CAP_N, dt_impl_LOW_A, dt_impl_LOW_M, dt_impl_LOW_E, dt_impl_CAP_S, dt_impl_LOW_E, dt_impl_LOW_T, dt_impl_LOW_S +static const char16_t kCyclicNameSetsTagUChar[] = { + LOW_C, LOW_Y, LOW_C, LOW_L, LOW_I, LOW_C, CAP_N, LOW_A, LOW_M, LOW_E, CAP_S, LOW_E, LOW_T, LOW_S }; -static const UChar kYearsTagUChar[] = { - dt_impl_SOLIDUS, dt_impl_LOW_Y, dt_impl_LOW_E, dt_impl_LOW_A, dt_impl_LOW_R, dt_impl_LOW_S +static const char16_t kYearsTagUChar[] = { + SOLIDUS, LOW_Y, LOW_E, LOW_A, LOW_R, LOW_S }; -static const UChar kZodiacsUChar[] = { - dt_impl_SOLIDUS, dt_impl_LOW_Z, dt_impl_LOW_O, dt_impl_LOW_D, dt_impl_LOW_I, dt_impl_LOW_A, dt_impl_LOW_C, dt_impl_LOW_S +static const char16_t kZodiacsUChar[] = { + SOLIDUS, LOW_Z, LOW_O, LOW_D, LOW_I, LOW_A, LOW_C, LOW_S }; -static const UChar kDayPartsTagUChar[] = { - dt_impl_SOLIDUS, dt_impl_LOW_D, dt_impl_LOW_A, dt_impl_LOW_Y, dt_impl_CAP_P, dt_impl_LOW_A, dt_impl_LOW_R, dt_impl_LOW_T, dt_impl_LOW_S +static const char16_t kDayPartsTagUChar[] = { + SOLIDUS, LOW_D, LOW_A, LOW_Y, CAP_P, LOW_A, LOW_R, LOW_T, LOW_S }; -static const UChar kFormatTagUChar[] = { - dt_impl_SOLIDUS, dt_impl_LOW_F, dt_impl_LOW_O, dt_impl_LOW_R, dt_impl_LOW_M, dt_impl_LOW_A, dt_impl_LOW_T +static const char16_t kFormatTagUChar[] = { + SOLIDUS, LOW_F, LOW_O, LOW_R, LOW_M, LOW_A, LOW_T }; -static const UChar kAbbrTagUChar[] = { - dt_impl_SOLIDUS, dt_impl_LOW_A, dt_impl_LOW_B, dt_impl_LOW_B, dt_impl_LOW_R, dt_impl_LOW_E, dt_impl_LOW_V, dt_impl_LOW_I, dt_impl_LOW_A, dt_impl_LOW_T, dt_impl_LOW_E, dt_impl_LOW_D +static const char16_t kAbbrTagUChar[] = { + SOLIDUS, LOW_A, LOW_B, LOW_B, LOW_R, LOW_E, LOW_V, LOW_I, LOW_A, LOW_T, LOW_E, LOW_D }; // ResourceSink to enumerate all calendar resources @@ -1497,7 +1510,7 @@ struct CalendarDataSink : public ResourceSink { Hashtable arrays; Hashtable arraySizes; Hashtable maps; - /** + /** * Whenever there are aliases, the same object will be added twice to 'map'. * To avoid double deletion, 'maps' won't take ownership of the objects. Instead, * 'mapRefs' will own them and will delete them when CalendarDataSink is deleted. @@ -1519,18 +1532,18 @@ struct CalendarDataSink : public ResourceSink { // Initializes CalendarDataSink with default values CalendarDataSink(UErrorCode& status) - : arrays(FALSE, status), arraySizes(FALSE, status), maps(FALSE, status), + : arrays(false, status), arraySizes(false, status), maps(false, status), mapRefs(), aliasPathPairs(uprv_deleteUObject, uhash_compareUnicodeString, status), currentCalendarType(), nextCalendarType(), - resourcesToVisit(NULL), aliasRelativePath() { + resourcesToVisit(nullptr), aliasRelativePath() { if (U_FAILURE(status)) { return; } } virtual ~CalendarDataSink(); // Configure the CalendarSink to visit all the resources void visitAllResources() { - resourcesToVisit.adoptInstead(NULL); + resourcesToVisit.adoptInstead(nullptr); } // Actions to be done before enumerating @@ -1540,12 +1553,12 @@ struct CalendarDataSink : public ResourceSink { aliasPathPairs.removeAllElements(); } - virtual void put(const char *key, ResourceValue &value, UBool, UErrorCode &errorCode) { + virtual void put(const char *key, ResourceValue &value, UBool, UErrorCode &errorCode) override { if (U_FAILURE(errorCode)) { return; } U_ASSERT(!currentCalendarType.isEmpty()); // Stores the resources to visit on the next calendar. - LocalPointer resourcesToVisitNext(NULL); + LocalPointer resourcesToVisitNext(nullptr); ResourceTable calendarData = value.getTable(errorCode); if (U_FAILURE(errorCode)) { return; } @@ -1569,26 +1582,20 @@ struct CalendarDataSink : public ResourceSink { errorCode); if (U_FAILURE(errorCode)) { return; } } - LocalPointer aliasRelativePathCopy(new UnicodeString(aliasRelativePath), errorCode); - resourcesToVisitNext->addElement(aliasRelativePathCopy.getAlias(), errorCode); + LocalPointer aliasRelativePathCopy(aliasRelativePath.clone(), errorCode); + resourcesToVisitNext->adoptElement(aliasRelativePathCopy.orphan(), errorCode); if (U_FAILURE(errorCode)) { return; } - // Only release ownership after resourcesToVisitNext takes it (no error happened): - aliasRelativePathCopy.orphan(); continue; } else if (aliasType == SAME_CALENDAR) { // Register same-calendar alias - if (arrays.get(aliasRelativePath) == NULL && maps.get(aliasRelativePath) == NULL) { - LocalPointer aliasRelativePathCopy(new UnicodeString(aliasRelativePath), errorCode); - aliasPathPairs.addElement(aliasRelativePathCopy.getAlias(), errorCode); + if (arrays.get(aliasRelativePath) == nullptr && maps.get(aliasRelativePath) == nullptr) { + LocalPointer aliasRelativePathCopy(aliasRelativePath.clone(), errorCode); + aliasPathPairs.adoptElement(aliasRelativePathCopy.orphan(), errorCode); if (U_FAILURE(errorCode)) { return; } - // Only release ownership after aliasPathPairs takes it (no error happened): - aliasRelativePathCopy.orphan(); - LocalPointer keyUStringCopy(new UnicodeString(keyUString), errorCode); - aliasPathPairs.addElement(keyUStringCopy.getAlias(), errorCode); + LocalPointer keyUStringCopy(keyUString.clone(), errorCode); + aliasPathPairs.adoptElement(keyUStringCopy.orphan(), errorCode); if (U_FAILURE(errorCode)) { return; } - // Only release ownership after aliasPathPairs takes it (no error happened): - keyUStringCopy.orphan(); } continue; } @@ -1596,13 +1603,13 @@ struct CalendarDataSink : public ResourceSink { // Only visit the resources that were referenced by an alias on the previous calendar // (AmPmMarkersAbbr is an exception). if (!resourcesToVisit.isNull() && !resourcesToVisit->isEmpty() && !resourcesToVisit->contains(&keyUString) - && uprv_strcmp(key, dtfmtsym_gAmPmMarkersAbbrTag) != 0) { continue; } + && uprv_strcmp(key, gAmPmMarkersAbbrTag) != 0) { continue; } // == Handle data == - if (uprv_strcmp(key, dtfmtsym_gAmPmMarkersTag) == 0 - || uprv_strcmp(key, dtfmtsym_gAmPmMarkersAbbrTag) == 0 - || uprv_strcmp(key, dtfmtsym_gAmPmMarkersNarrowTag) == 0) { - if (arrays.get(keyUString) == NULL) { + if (uprv_strcmp(key, gAmPmMarkersTag) == 0 + || uprv_strcmp(key, gAmPmMarkersAbbrTag) == 0 + || uprv_strcmp(key, gAmPmMarkersNarrowTag) == 0) { + if (arrays.get(keyUString) == nullptr) { ResourceArray resourceArray = value.getArray(errorCode); int32_t arraySize = resourceArray.getSize(); LocalArray stringArray(new UnicodeString[arraySize], errorCode); @@ -1611,13 +1618,13 @@ struct CalendarDataSink : public ResourceSink { arraySizes.puti(keyUString, arraySize, errorCode); if (U_FAILURE(errorCode)) { return; } } - } else if (uprv_strcmp(key, dtfmtsym_gErasTag) == 0 - || uprv_strcmp(key, dtfmtsym_gDayNamesTag) == 0 - || uprv_strcmp(key, dtfmtsym_gMonthNamesTag) == 0 - || uprv_strcmp(key, dtfmtsym_gQuartersTag) == 0 - || uprv_strcmp(key, dtfmtsym_gDayPeriodTag) == 0 - || uprv_strcmp(key, dtfmtsym_gMonthPatternsTag) == 0 - || uprv_strcmp(key, dtfmtsym_gCyclicNameSetsTag) == 0) { + } else if (uprv_strcmp(key, gErasTag) == 0 + || uprv_strcmp(key, gDayNamesTag) == 0 + || uprv_strcmp(key, gMonthNamesTag) == 0 + || uprv_strcmp(key, gQuartersTag) == 0 + || uprv_strcmp(key, gDayPeriodTag) == 0 + || uprv_strcmp(key, gMonthPatternsTag) == 0 + || uprv_strcmp(key, gCyclicNameSetsTag) == 0) { processResource(keyUString, key, value, errorCode); } } @@ -1631,9 +1638,9 @@ struct CalendarDataSink : public ResourceSink { UnicodeString *alias = (UnicodeString*)aliasPathPairs[i]; UnicodeString *aliasArray; Hashtable *aliasMap; - if ((aliasArray = (UnicodeString*)arrays.get(*alias)) != NULL) { + if ((aliasArray = (UnicodeString*)arrays.get(*alias)) != nullptr) { UnicodeString *path = (UnicodeString*)aliasPathPairs[i + 1]; - if (arrays.get(*path) == NULL) { + if (arrays.get(*path) == nullptr) { // Clone the array int32_t aliasArraySize = arraySizes.geti(*alias); LocalArray aliasArrayCopy(new UnicodeString[aliasArraySize], errorCode); @@ -1645,9 +1652,9 @@ struct CalendarDataSink : public ResourceSink { } if (U_FAILURE(errorCode)) { return; } mod = true; - } else if ((aliasMap = (Hashtable*)maps.get(*alias)) != NULL) { + } else if ((aliasMap = (Hashtable*)maps.get(*alias)) != nullptr) { UnicodeString *path = (UnicodeString*)aliasPathPairs[i + 1]; - if (maps.get(*path) == NULL) { + if (maps.get(*path) == nullptr) { maps.put(*path, aliasMap, errorCode); } if (U_FAILURE(errorCode)) { return; } @@ -1675,7 +1682,7 @@ struct CalendarDataSink : public ResourceSink { ResourceTable table = value.getTable(errorCode); if (U_FAILURE(errorCode)) return; - Hashtable* stringMap = NULL; + Hashtable* stringMap = nullptr; // Iterate over all the elements of the table and add them to the map for (int i = 0; table.getKeyAndValue(i, key, value); i++) { @@ -1691,8 +1698,8 @@ struct CalendarDataSink : public ResourceSink { // We are on a leaf, store the map elements into the stringMap if (i == 0) { // mapRefs will keep ownership of 'stringMap': - stringMap = mapRefs.create(FALSE, errorCode); - if (stringMap == NULL) { + stringMap = mapRefs.create(false, errorCode); + if (stringMap == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1700,25 +1707,25 @@ struct CalendarDataSink : public ResourceSink { if (U_FAILURE(errorCode)) { return; } stringMap->setValueDeleter(uprv_deleteUObject); } - U_ASSERT(stringMap != NULL); + U_ASSERT(stringMap != nullptr); int32_t valueStringSize; - const UChar *valueString = value.getString(valueStringSize, errorCode); + const char16_t *valueString = value.getString(valueStringSize, errorCode); if (U_FAILURE(errorCode)) { return; } - LocalPointer valueUString(new UnicodeString(TRUE, valueString, valueStringSize), errorCode); + LocalPointer valueUString(new UnicodeString(true, valueString, valueStringSize), errorCode); stringMap->put(keyUString, valueUString.orphan(), errorCode); if (U_FAILURE(errorCode)) { return; } continue; } - U_ASSERT(stringMap == NULL); + U_ASSERT(stringMap == nullptr); // Store the current path's length and append the current key to the path. int32_t pathLength = path.length(); - path.append(dt_impl_SOLIDUS).append(keyUString); + path.append(SOLIDUS).append(keyUString); // In cyclicNameSets ignore everything but years/format/abbreviated // and zodiacs/format/abbreviated if (path.startsWith(kCyclicNameSetsTagUChar, UPRV_LENGTHOF(kCyclicNameSetsTagUChar))) { - UBool skip = TRUE; + UBool skip = true; int32_t startIndex = UPRV_LENGTHOF(kCyclicNameSetsTagUChar); int32_t length = 0; if (startIndex == path.length() @@ -1733,7 +1740,7 @@ struct CalendarDataSink : public ResourceSink { length = 0; if (startIndex == path.length() || path.compare(startIndex, (length = UPRV_LENGTHOF(kAbbrTagUChar)), kAbbrTagUChar, 0, UPRV_LENGTHOF(kAbbrTagUChar)) == 0) { - skip = FALSE; + skip = false; } } } @@ -1745,7 +1752,7 @@ struct CalendarDataSink : public ResourceSink { } // == Handle aliases == - if (arrays.get(path) != NULL || maps.get(path) != NULL) { + if (arrays.get(path) != nullptr || maps.get(path) != nullptr) { // Drop the latest key on the path and continue path.retainBetween(0, pathLength); continue; @@ -1755,16 +1762,12 @@ struct CalendarDataSink : public ResourceSink { if (U_FAILURE(errorCode)) { return; } if (aliasType == SAME_CALENDAR) { // Store the alias path and the current path on aliasPathPairs - LocalPointer aliasRelativePathCopy(new UnicodeString(aliasRelativePath), errorCode); - aliasPathPairs.addElement(aliasRelativePathCopy.getAlias(), errorCode); + LocalPointer aliasRelativePathCopy(aliasRelativePath.clone(), errorCode); + aliasPathPairs.adoptElement(aliasRelativePathCopy.orphan(), errorCode); if (U_FAILURE(errorCode)) { return; } - // Only release ownership after aliasPathPairs takes it (no error happened): - aliasRelativePathCopy.orphan(); - LocalPointer pathCopy(new UnicodeString(path), errorCode); - aliasPathPairs.addElement(pathCopy.getAlias(), errorCode); + LocalPointer pathCopy(path.clone(), errorCode); + aliasPathPairs.adoptElement(pathCopy.orphan(), errorCode); if (U_FAILURE(errorCode)) { return; } - // Only release ownership after aliasPathPairs takes it (no error happened): - pathCopy.orphan(); // Drop the latest key on the path and continue path.retainBetween(0, pathLength); @@ -1800,13 +1803,13 @@ struct CalendarDataSink : public ResourceSink { if (value.getType() == URES_ALIAS) { int32_t aliasPathSize; - const UChar* aliasPathUChar = value.getAliasString(aliasPathSize, errorCode); + const char16_t* aliasPathUChar = value.getAliasString(aliasPathSize, errorCode); if (U_FAILURE(errorCode)) { return NONE; } UnicodeString aliasPath(aliasPathUChar, aliasPathSize); const int32_t aliasPrefixLength = UPRV_LENGTHOF(kCalendarAliasPrefixUChar); if (aliasPath.startsWith(kCalendarAliasPrefixUChar, aliasPrefixLength) && aliasPath.length() > aliasPrefixLength) { - int32_t typeLimit = aliasPath.indexOf(dt_impl_SOLIDUS, aliasPrefixLength); + int32_t typeLimit = aliasPath.indexOf(SOLIDUS, aliasPrefixLength); if (typeLimit > aliasPrefixLength) { const UnicodeString aliasCalendarType = aliasPath.tempSubStringBetween(aliasPrefixLength, typeLimit); @@ -1851,7 +1854,7 @@ CalendarDataSink::~CalendarDataSink() { //------------------------------------------------------ static void -initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status) { +initField(UnicodeString **field, int32_t& length, const char16_t *data, LastResortSize numStr, LastResortSize strLen, UErrorCode &status) { if (U_SUCCESS(status)) { length = numStr; *field = newUnicodeStringArray((size_t)numStr); @@ -1859,7 +1862,7 @@ initField(UnicodeString **field, int32_t& length, const UChar *data, LastResortS for(int32_t i = 0; isetTo(TRUE, data+(i*((int32_t)strLen)), -1); + (*(field)+i)->setTo(true, data+(i*((int32_t)strLen)), -1); } } else { @@ -1875,7 +1878,7 @@ initField(UnicodeString **field, int32_t& length, CalendarDataSink &sink, CharSt UnicodeString keyUString(key.data(), -1, US_INV); UnicodeString* array = static_cast(sink.arrays.get(keyUString)); - if (array != NULL) { + if (array != nullptr) { length = sink.arraySizes.geti(keyUString); *field = array; // DateFormatSymbols takes ownership of the array: @@ -1893,11 +1896,11 @@ initField(UnicodeString **field, int32_t& length, CalendarDataSink &sink, CharSt UnicodeString keyUString(key.data(), -1, US_INV); UnicodeString* array = static_cast(sink.arrays.get(keyUString)); - if (array != NULL) { + if (array != nullptr) { int32_t arrayLength = sink.arraySizes.geti(keyUString); length = arrayLength + arrayOffset; *field = new UnicodeString[length]; - if (*field == NULL) { + if (*field == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1915,10 +1918,10 @@ initLeapMonthPattern(UnicodeString *field, int32_t index, CalendarDataSink &sink if (U_SUCCESS(status)) { UnicodeString pathUString(path.data(), -1, US_INV); Hashtable *leapMonthTable = static_cast(sink.maps.get(pathUString)); - if (leapMonthTable != NULL) { - UnicodeString leapLabel(FALSE, kLeapTagUChar, UPRV_LENGTHOF(kLeapTagUChar)); + if (leapMonthTable != nullptr) { + UnicodeString leapLabel(false, kLeapTagUChar, UPRV_LENGTHOF(kLeapTagUChar)); UnicodeString *leapMonthPattern = static_cast(leapMonthTable->get(leapLabel)); - if (leapMonthPattern != NULL) { + if (leapMonthPattern != nullptr) { field[index].fastCopyFrom(*leapMonthPattern); } else { field[index].setToBogus(); @@ -1961,7 +1964,7 @@ typedef struct { } ContextUsageTypeNameToEnumValue; static const ContextUsageTypeNameToEnumValue contextUsageTypeMap[] = { - // Entries must be sorted by usageTypeName; entry with NULL name terminates list. + // Entries must be sorted by usageTypeName; entry with nullptr name terminates list. { "day-format-except-narrow", DateFormatSymbols::kCapContextUsageDayFormat }, { "day-narrow", DateFormatSymbols::kCapContextUsageDayNarrow }, { "day-standalone-except-narrow", DateFormatSymbols::kCapContextUsageDayStandalone }, @@ -1975,7 +1978,7 @@ static const ContextUsageTypeNameToEnumValue contextUsageTypeMap[] = { { "month-standalone-except-narrow", DateFormatSymbols::kCapContextUsageMonthStandalone }, { "zone-long", DateFormatSymbols::kCapContextUsageZoneLong }, { "zone-short", DateFormatSymbols::kCapContextUsageZoneShort }, - { NULL, (DateFormatSymbols::ECapitalizationContextUsageType)0 }, + { nullptr, (DateFormatSymbols::ECapitalizationContextUsageType)0 }, }; // Resource keys to look up localized strings for day periods. @@ -1987,23 +1990,23 @@ static const char *dayPeriodKeys[] = {"midnight", "noon", UnicodeString* loadDayPeriodStrings(CalendarDataSink &sink, CharString &path, int32_t &stringCount, UErrorCode &status) { - if (U_FAILURE(status)) { return NULL; } + if (U_FAILURE(status)) { return nullptr; } UnicodeString pathUString(path.data(), -1, US_INV); Hashtable* map = static_cast(sink.maps.get(pathUString)); stringCount = UPRV_LENGTHOF(dayPeriodKeys); UnicodeString *strings = new UnicodeString[stringCount]; - if (strings == NULL) { + if (strings == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - if (map != NULL) { + if (map != nullptr) { for (int32_t i = 0; i < stringCount; ++i) { UnicodeString dayPeriodKey(dayPeriodKeys[i], -1, US_INV); UnicodeString *dayPeriod = static_cast(map->get(dayPeriodKey)); - if (dayPeriod != NULL) { + if (dayPeriod != nullptr) { strings[i].fastCopyFrom(*dayPeriod); } else { strings[i].setToBogus(); @@ -2022,75 +2025,79 @@ void DateFormatSymbols::initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData) { int32_t len = 0; - /* In case something goes wrong, initialize all of the data to NULL. */ - fEras = NULL; + /* In case something goes wrong, initialize all of the data to nullptr. */ + fEras = nullptr; fErasCount = 0; - fEraNames = NULL; + fEraNames = nullptr; fEraNamesCount = 0; - fNarrowEras = NULL; + fNarrowEras = nullptr; fNarrowErasCount = 0; - fMonths = NULL; + fMonths = nullptr; fMonthsCount=0; - fShortMonths = NULL; + fShortMonths = nullptr; fShortMonthsCount=0; - fNarrowMonths = NULL; + fNarrowMonths = nullptr; fNarrowMonthsCount=0; - fStandaloneMonths = NULL; + fStandaloneMonths = nullptr; fStandaloneMonthsCount=0; - fStandaloneShortMonths = NULL; + fStandaloneShortMonths = nullptr; fStandaloneShortMonthsCount=0; - fStandaloneNarrowMonths = NULL; + fStandaloneNarrowMonths = nullptr; fStandaloneNarrowMonthsCount=0; - fWeekdays = NULL; + fWeekdays = nullptr; fWeekdaysCount=0; - fShortWeekdays = NULL; + fShortWeekdays = nullptr; fShortWeekdaysCount=0; - fShorterWeekdays = NULL; + fShorterWeekdays = nullptr; fShorterWeekdaysCount=0; - fNarrowWeekdays = NULL; + fNarrowWeekdays = nullptr; fNarrowWeekdaysCount=0; - fStandaloneWeekdays = NULL; + fStandaloneWeekdays = nullptr; fStandaloneWeekdaysCount=0; - fStandaloneShortWeekdays = NULL; + fStandaloneShortWeekdays = nullptr; fStandaloneShortWeekdaysCount=0; - fStandaloneShorterWeekdays = NULL; + fStandaloneShorterWeekdays = nullptr; fStandaloneShorterWeekdaysCount=0; - fStandaloneNarrowWeekdays = NULL; + fStandaloneNarrowWeekdays = nullptr; fStandaloneNarrowWeekdaysCount=0; - fAmPms = NULL; + fAmPms = nullptr; fAmPmsCount=0; - fNarrowAmPms = NULL; + fNarrowAmPms = nullptr; fNarrowAmPmsCount=0; fTimeSeparator.setToBogus(); - fQuarters = NULL; + fQuarters = nullptr; fQuartersCount = 0; - fShortQuarters = NULL; + fShortQuarters = nullptr; fShortQuartersCount = 0; - fStandaloneQuarters = NULL; + fNarrowQuarters = nullptr; + fNarrowQuartersCount = 0; + fStandaloneQuarters = nullptr; fStandaloneQuartersCount = 0; - fStandaloneShortQuarters = NULL; + fStandaloneShortQuarters = nullptr; fStandaloneShortQuartersCount = 0; - fLeapMonthPatterns = NULL; + fStandaloneNarrowQuarters = nullptr; + fStandaloneNarrowQuartersCount = 0; + fLeapMonthPatterns = nullptr; fLeapMonthPatternsCount = 0; - fShortYearNames = NULL; + fShortYearNames = nullptr; fShortYearNamesCount = 0; - fShortZodiacNames = NULL; + fShortZodiacNames = nullptr; fShortZodiacNamesCount = 0; fZoneStringsRowCount = 0; fZoneStringsColCount = 0; - fZoneStrings = NULL; - fLocaleZoneStrings = NULL; - fAbbreviatedDayPeriods = NULL; + fZoneStrings = nullptr; + fLocaleZoneStrings = nullptr; + fAbbreviatedDayPeriods = nullptr; fAbbreviatedDayPeriodsCount = 0; - fWideDayPeriods = NULL; + fWideDayPeriods = nullptr; fWideDayPeriodsCount = 0; - fNarrowDayPeriods = NULL; + fNarrowDayPeriods = nullptr; fNarrowDayPeriodsCount = 0; - fStandaloneAbbreviatedDayPeriods = NULL; + fStandaloneAbbreviatedDayPeriods = nullptr; fStandaloneAbbreviatedDayPeriodsCount = 0; - fStandaloneWideDayPeriods = NULL; + fStandaloneWideDayPeriods = nullptr; fStandaloneWideDayPeriodsCount = 0; - fStandaloneNarrowDayPeriods = NULL; + fStandaloneNarrowDayPeriods = nullptr; fStandaloneNarrowDayPeriodsCount = 0; uprv_memset(fCapitalization, 0, sizeof(fCapitalization)); @@ -2102,15 +2109,15 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError if (U_FAILURE(status)) return; - // Create a CalendarDataSink to process this data and the resouce bundles + // Create a CalendarDataSink to process this data and the resource bundles CalendarDataSink calendarSink(status); - UResourceBundle *rb = ures_open(NULL, locale.getBaseName(), &status); - UResourceBundle *cb = ures_getByKey(rb, dtfmtsym_gCalendarTag, NULL, &status); + UResourceBundle *rb = ures_open(nullptr, locale.getBaseName(), &status); + UResourceBundle *cb = ures_getByKey(rb, gCalendarTag, nullptr, &status); if (U_FAILURE(status)) return; // Iterate over the resource bundle data following the fallbacks through different calendar types - UnicodeString calendarType((type != NULL && *type != '\0')? type : dtfmtsym_gGregorianTag, -1, US_INV); + UnicodeString calendarType((type != nullptr && *type != '\0')? type : gGregorianTag, -1, US_INV); while (!calendarType.isBogus()) { CharString calendarTypeBuffer; calendarTypeBuffer.appendInvariantChars(calendarType, status); @@ -2119,11 +2126,11 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Enumerate this calendar type. If the calendar is not found fallback to gregorian UErrorCode oldStatus = status; - UResourceBundle *ctb = ures_getByKeyWithFallback(cb, calendarTypeCArray, NULL, &status); + UResourceBundle *ctb = ures_getByKeyWithFallback(cb, calendarTypeCArray, nullptr, &status); if (status == U_MISSING_RESOURCE_ERROR) { ures_close(ctb); - if (uprv_strcmp(calendarTypeCArray, dtfmtsym_gGregorianTag) != 0) { - calendarType.setTo(FALSE, kGregorianTagUChar, UPRV_LENGTHOF(kGregorianTagUChar)); + if (uprv_strcmp(calendarTypeCArray, gGregorianTag) != 0) { + calendarType.setTo(false, kGregorianTagUChar, UPRV_LENGTHOF(kGregorianTagUChar)); calendarSink.visitAllResources(); status = oldStatus; continue; @@ -2137,7 +2144,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError if (U_FAILURE(status)) break; // Stop loading when gregorian was loaded - if (uprv_strcmp(calendarTypeCArray, dtfmtsym_gGregorianTag) == 0) { + if (uprv_strcmp(calendarTypeCArray, gGregorianTag) == 0) { break; } @@ -2146,7 +2153,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Gregorian is always the last fallback if (calendarType.isBogus()) { - calendarType.setTo(FALSE, kGregorianTagUChar, UPRV_LENGTHOF(kGregorianTagUChar)); + calendarType.setTo(false, kGregorianTagUChar, UPRV_LENGTHOF(kGregorianTagUChar)); calendarSink.visitAllResources(); } } @@ -2159,19 +2166,19 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError fLeapMonthPatterns = newUnicodeStringArray(kMonthPatternsCount); if (fLeapMonthPatterns) { initLeapMonthPattern(fLeapMonthPatterns, kLeapMonthPatternFormatWide, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthPatternsTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesWideTag, tempStatus), tempStatus); + buildResourcePath(path, gMonthPatternsTag, gNamesFormatTag, gNamesWideTag, tempStatus), tempStatus); initLeapMonthPattern(fLeapMonthPatterns, kLeapMonthPatternFormatAbbrev, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthPatternsTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesAbbrTag, tempStatus), tempStatus); + buildResourcePath(path, gMonthPatternsTag, gNamesFormatTag, gNamesAbbrTag, tempStatus), tempStatus); initLeapMonthPattern(fLeapMonthPatterns, kLeapMonthPatternFormatNarrow, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthPatternsTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesNarrowTag, tempStatus), tempStatus); + buildResourcePath(path, gMonthPatternsTag, gNamesFormatTag, gNamesNarrowTag, tempStatus), tempStatus); initLeapMonthPattern(fLeapMonthPatterns, kLeapMonthPatternStandaloneWide, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthPatternsTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesWideTag, tempStatus), tempStatus); + buildResourcePath(path, gMonthPatternsTag, gNamesStandaloneTag, gNamesWideTag, tempStatus), tempStatus); initLeapMonthPattern(fLeapMonthPatterns, kLeapMonthPatternStandaloneAbbrev, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthPatternsTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesAbbrTag, tempStatus), tempStatus); + buildResourcePath(path, gMonthPatternsTag, gNamesStandaloneTag, gNamesAbbrTag, tempStatus), tempStatus); initLeapMonthPattern(fLeapMonthPatterns, kLeapMonthPatternStandaloneNarrow, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthPatternsTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesNarrowTag, tempStatus), tempStatus); + buildResourcePath(path, gMonthPatternsTag, gNamesStandaloneTag, gNamesNarrowTag, tempStatus), tempStatus); initLeapMonthPattern(fLeapMonthPatterns, kLeapMonthPatternNumeric, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthPatternsTag, dtfmtsym_gNamesNumericTag, dtfmtsym_gNamesAllTag, tempStatus), tempStatus); + buildResourcePath(path, gMonthPatternsTag, gNamesNumericTag, gNamesAllTag, tempStatus), tempStatus); if (U_SUCCESS(tempStatus)) { // Hack to fix bad C inheritance for dangi monthPatterns (OK in J); this should be handled by aliases in root, but isn't. // The ordering of the following statements is important. @@ -2191,36 +2198,36 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError fLeapMonthPatternsCount = kMonthPatternsCount; } else { delete[] fLeapMonthPatterns; - fLeapMonthPatterns = NULL; + fLeapMonthPatterns = nullptr; } } // Load cyclic names sets tempStatus = status; initField(&fShortYearNames, fShortYearNamesCount, calendarSink, - buildResourcePath(path, dtfmtsym_gCyclicNameSetsTag, dtfmtsym_gNameSetYearsTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesAbbrTag, tempStatus), tempStatus); + buildResourcePath(path, gCyclicNameSetsTag, gNameSetYearsTag, gNamesFormatTag, gNamesAbbrTag, tempStatus), tempStatus); initField(&fShortZodiacNames, fShortZodiacNamesCount, calendarSink, - buildResourcePath(path, dtfmtsym_gCyclicNameSetsTag, dtfmtsym_gNameSetZodiacsTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesAbbrTag, tempStatus), tempStatus); + buildResourcePath(path, gCyclicNameSetsTag, gNameSetZodiacsTag, gNamesFormatTag, gNamesAbbrTag, tempStatus), tempStatus); // Load context transforms and capitalization tempStatus = U_ZERO_ERROR; - UResourceBundle *localeBundle = ures_open(NULL, locale.getName(), &tempStatus); + UResourceBundle *localeBundle = ures_open(nullptr, locale.getName(), &tempStatus); if (U_SUCCESS(tempStatus)) { - UResourceBundle *contextTransforms = ures_getByKeyWithFallback(localeBundle, gContextTransformsTag, NULL, &tempStatus); + UResourceBundle *contextTransforms = ures_getByKeyWithFallback(localeBundle, gContextTransformsTag, nullptr, &tempStatus); if (U_SUCCESS(tempStatus)) { UResourceBundle *contextTransformUsage; - while ( (contextTransformUsage = ures_getNextResource(contextTransforms, NULL, &tempStatus)) != NULL ) { + while ( (contextTransformUsage = ures_getNextResource(contextTransforms, nullptr, &tempStatus)) != nullptr ) { const int32_t * intVector = ures_getIntVector(contextTransformUsage, &len, &status); - if (U_SUCCESS(tempStatus) && intVector != NULL && len >= 2) { + if (U_SUCCESS(tempStatus) && intVector != nullptr && len >= 2) { const char* usageType = ures_getKey(contextTransformUsage); - if (usageType != NULL) { + if (usageType != nullptr) { const ContextUsageTypeNameToEnumValue * typeMapPtr = contextUsageTypeMap; int32_t compResult = 0; // linear search; list is short and we cannot be sure that bsearch is available - while ( typeMapPtr->usageTypeName != NULL && (compResult = uprv_strcmp(usageType, typeMapPtr->usageTypeName)) > 0 ) { + while ( typeMapPtr->usageTypeName != nullptr && (compResult = uprv_strcmp(usageType, typeMapPtr->usageTypeName)) > 0 ) { ++typeMapPtr; } - if (typeMapPtr->usageTypeName != NULL && compResult == 0) { + if (typeMapPtr->usageTypeName != nullptr && compResult == 0) { fCapitalization[typeMapPtr->usageTypeEnumValue][0] = static_cast(intVector[0]); fCapitalization[typeMapPtr->usageTypeEnumValue][1] = static_cast(intVector[1]); } @@ -2236,17 +2243,17 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError const LocalPointer numberingSystem( NumberingSystem::createInstance(locale, tempStatus), tempStatus); if (U_SUCCESS(tempStatus)) { - // These functions all fail gracefully if passed NULL pointers and + // These functions all fail gracefully if passed nullptr pointers and // do nothing unless U_SUCCESS(tempStatus), so it's only necessary // to check for errors once after all calls are made. const LocalUResourceBundlePointer numberElementsData(ures_getByKeyWithFallback( - localeBundle, dtfmtsym_gNumberElementsTag, NULL, &tempStatus)); + localeBundle, gNumberElementsTag, nullptr, &tempStatus)); const LocalUResourceBundlePointer nsNameData(ures_getByKeyWithFallback( - numberElementsData.getAlias(), numberingSystem->getName(), NULL, &tempStatus)); + numberElementsData.getAlias(), numberingSystem->getName(), nullptr, &tempStatus)); const LocalUResourceBundlePointer symbolsData(ures_getByKeyWithFallback( - nsNameData.getAlias(), dtfmtsym_gSymbolsTag, NULL, &tempStatus)); + nsNameData.getAlias(), gSymbolsTag, nullptr, &tempStatus)); fTimeSeparator = ures_getUnicodeStringByKey( - symbolsData.getAlias(), dtfmtsym_gTimeSeparatorTag, &tempStatus); + symbolsData.getAlias(), gTimeSeparatorTag, &tempStatus); if (U_FAILURE(tempStatus)) { fTimeSeparator.setToBogus(); } @@ -2260,24 +2267,48 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError } // Load day periods + fAbbreviatedDayPeriods = loadDayPeriodStrings(calendarSink, + buildResourcePath(path, gDayPeriodTag, gNamesFormatTag, gNamesAbbrTag, status), + fAbbreviatedDayPeriodsCount, status); + fWideDayPeriods = loadDayPeriodStrings(calendarSink, - buildResourcePath(path, dtfmtsym_gDayPeriodTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesWideTag, status), + buildResourcePath(path, gDayPeriodTag, gNamesFormatTag, gNamesWideTag, status), fWideDayPeriodsCount, status); fNarrowDayPeriods = loadDayPeriodStrings(calendarSink, - buildResourcePath(path, dtfmtsym_gDayPeriodTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesNarrowTag, status), + buildResourcePath(path, gDayPeriodTag, gNamesFormatTag, gNamesNarrowTag, status), fNarrowDayPeriodsCount, status); - fAbbreviatedDayPeriods = loadDayPeriodStrings(calendarSink, - buildResourcePath(path, dtfmtsym_gDayPeriodTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesAbbrTag, status), - fAbbreviatedDayPeriodsCount, status); + + fStandaloneAbbreviatedDayPeriods = loadDayPeriodStrings(calendarSink, + buildResourcePath(path, gDayPeriodTag, gNamesStandaloneTag, gNamesAbbrTag, status), + fStandaloneAbbreviatedDayPeriodsCount, status); + fStandaloneWideDayPeriods = loadDayPeriodStrings(calendarSink, - buildResourcePath(path, dtfmtsym_gDayPeriodTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesWideTag, status), + buildResourcePath(path, gDayPeriodTag, gNamesStandaloneTag, gNamesWideTag, status), fStandaloneWideDayPeriodsCount, status); fStandaloneNarrowDayPeriods = loadDayPeriodStrings(calendarSink, - buildResourcePath(path, dtfmtsym_gDayPeriodTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesNarrowTag, status), + buildResourcePath(path, gDayPeriodTag, gNamesStandaloneTag, gNamesNarrowTag, status), fStandaloneNarrowDayPeriodsCount, status); - fStandaloneAbbreviatedDayPeriods = loadDayPeriodStrings(calendarSink, - buildResourcePath(path, dtfmtsym_gDayPeriodTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesAbbrTag, status), - fStandaloneAbbreviatedDayPeriodsCount, status); + + // Fill in for missing/bogus items (dayPeriods are a map so single items might be missing) + if (U_SUCCESS(status)) { + for (int32_t dpidx = 0; dpidx < fAbbreviatedDayPeriodsCount; ++dpidx) { + if (dpidx < fWideDayPeriodsCount && fWideDayPeriods != nullptr && fWideDayPeriods[dpidx].isBogus()) { + fWideDayPeriods[dpidx].fastCopyFrom(fAbbreviatedDayPeriods[dpidx]); + } + if (dpidx < fNarrowDayPeriodsCount && fNarrowDayPeriods != nullptr && fNarrowDayPeriods[dpidx].isBogus()) { + fNarrowDayPeriods[dpidx].fastCopyFrom(fAbbreviatedDayPeriods[dpidx]); + } + if (dpidx < fStandaloneAbbreviatedDayPeriodsCount && fStandaloneAbbreviatedDayPeriods != nullptr && fStandaloneAbbreviatedDayPeriods[dpidx].isBogus()) { + fStandaloneAbbreviatedDayPeriods[dpidx].fastCopyFrom(fAbbreviatedDayPeriods[dpidx]); + } + if (dpidx < fStandaloneWideDayPeriodsCount && fStandaloneWideDayPeriods != nullptr && fStandaloneWideDayPeriods[dpidx].isBogus()) { + fStandaloneWideDayPeriods[dpidx].fastCopyFrom(fStandaloneAbbreviatedDayPeriods[dpidx]); + } + if (dpidx < fStandaloneNarrowDayPeriodsCount && fStandaloneNarrowDayPeriods != nullptr && fStandaloneNarrowDayPeriods[dpidx].isBogus()) { + fStandaloneNarrowDayPeriods[dpidx].fastCopyFrom(fStandaloneAbbreviatedDayPeriods[dpidx]); + } + } + } U_LOCALE_BASED(locBased, *this); // if we make it to here, the resource data is cool, and we can get everything out @@ -2287,16 +2318,16 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError ures_getLocaleByType(cb, ULOC_ACTUAL_LOCALE, &status)); // Load eras - initField(&fEras, fErasCount, calendarSink, buildResourcePath(path, dtfmtsym_gErasTag, dtfmtsym_gNamesAbbrTag, status), status); + initField(&fEras, fErasCount, calendarSink, buildResourcePath(path, gErasTag, gNamesAbbrTag, status), status); UErrorCode oldStatus = status; - initField(&fEraNames, fEraNamesCount, calendarSink, buildResourcePath(path, dtfmtsym_gErasTag, dtfmtsym_gNamesWideTag, status), status); + initField(&fEraNames, fEraNamesCount, calendarSink, buildResourcePath(path, gErasTag, gNamesWideTag, status), status); if (status == U_MISSING_RESOURCE_ERROR) { // Workaround because eras/wide was omitted from CLDR 1.3 status = oldStatus; assignArray(fEraNames, fEraNamesCount, fEras, fErasCount); } // current ICU4J falls back to abbreviated if narrow eras are missing, so we will too oldStatus = status; - initField(&fNarrowEras, fNarrowErasCount, calendarSink, buildResourcePath(path, dtfmtsym_gErasTag, dtfmtsym_gNamesNarrowTag, status), status); + initField(&fNarrowEras, fNarrowErasCount, calendarSink, buildResourcePath(path, gErasTag, gNamesNarrowTag, status), status); if (status == U_MISSING_RESOURCE_ERROR) { // Workaround because eras/wide was omitted from CLDR 1.3 status = oldStatus; assignArray(fNarrowEras, fNarrowErasCount, fEras, fErasCount); @@ -2304,17 +2335,17 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Load month names initField(&fMonths, fMonthsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthNamesTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesWideTag, status), status); + buildResourcePath(path, gMonthNamesTag, gNamesFormatTag, gNamesWideTag, status), status); initField(&fShortMonths, fShortMonthsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthNamesTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesAbbrTag, status), status); + buildResourcePath(path, gMonthNamesTag, gNamesFormatTag, gNamesAbbrTag, status), status); initField(&fStandaloneMonths, fStandaloneMonthsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthNamesTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesWideTag, status), status); + buildResourcePath(path, gMonthNamesTag, gNamesStandaloneTag, gNamesWideTag, status), status); if (status == U_MISSING_RESOURCE_ERROR) { /* If standalone/wide not available, use format/wide */ status = U_ZERO_ERROR; assignArray(fStandaloneMonths, fStandaloneMonthsCount, fMonths, fMonthsCount); } initField(&fStandaloneShortMonths, fStandaloneShortMonthsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthNamesTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesAbbrTag, status), status); + buildResourcePath(path, gMonthNamesTag, gNamesStandaloneTag, gNamesAbbrTag, status), status); if (status == U_MISSING_RESOURCE_ERROR) { /* If standalone/abbreviated not available, use format/abbreviated */ status = U_ZERO_ERROR; assignArray(fStandaloneShortMonths, fStandaloneShortMonthsCount, fShortMonths, fShortMonthsCount); @@ -2323,14 +2354,14 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError UErrorCode narrowMonthsEC = status; UErrorCode standaloneNarrowMonthsEC = status; initField(&fNarrowMonths, fNarrowMonthsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthNamesTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesNarrowTag, narrowMonthsEC), narrowMonthsEC); + buildResourcePath(path, gMonthNamesTag, gNamesFormatTag, gNamesNarrowTag, narrowMonthsEC), narrowMonthsEC); initField(&fStandaloneNarrowMonths, fStandaloneNarrowMonthsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gMonthNamesTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesNarrowTag, narrowMonthsEC), standaloneNarrowMonthsEC); + buildResourcePath(path, gMonthNamesTag, gNamesStandaloneTag, gNamesNarrowTag, narrowMonthsEC), standaloneNarrowMonthsEC); if (narrowMonthsEC == U_MISSING_RESOURCE_ERROR && standaloneNarrowMonthsEC != U_MISSING_RESOURCE_ERROR) { // If format/narrow not available, use standalone/narrow assignArray(fNarrowMonths, fNarrowMonthsCount, fStandaloneNarrowMonths, fStandaloneNarrowMonthsCount); } else if (narrowMonthsEC != U_MISSING_RESOURCE_ERROR && standaloneNarrowMonthsEC == U_MISSING_RESOURCE_ERROR) { - // If standalone/narrow not availabe, use format/narrow + // If standalone/narrow not available, use format/narrow assignArray(fStandaloneNarrowMonths, fStandaloneNarrowMonthsCount, fNarrowMonths, fNarrowMonthsCount); } else if (narrowMonthsEC == U_MISSING_RESOURCE_ERROR && standaloneNarrowMonthsEC == U_MISSING_RESOURCE_ERROR) { // If neither is available, use format/abbreviated @@ -2341,63 +2372,81 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Load AM/PM markers; if wide or narrow not available, use short UErrorCode ampmStatus = U_ZERO_ERROR; initField(&fAmPms, fAmPmsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gAmPmMarkersTag, ampmStatus), ampmStatus); + buildResourcePath(path, gAmPmMarkersTag, ampmStatus), ampmStatus); if (U_FAILURE(ampmStatus)) { initField(&fAmPms, fAmPmsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gAmPmMarkersAbbrTag, status), status); + buildResourcePath(path, gAmPmMarkersAbbrTag, status), status); } ampmStatus = U_ZERO_ERROR; initField(&fNarrowAmPms, fNarrowAmPmsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gAmPmMarkersNarrowTag, ampmStatus), ampmStatus); + buildResourcePath(path, gAmPmMarkersNarrowTag, ampmStatus), ampmStatus); if (U_FAILURE(ampmStatus)) { initField(&fNarrowAmPms, fNarrowAmPmsCount, calendarSink, - buildResourcePath(path, dtfmtsym_gAmPmMarkersAbbrTag, status), status); + buildResourcePath(path, gAmPmMarkersAbbrTag, status), status); + } + if(status == U_MISSING_RESOURCE_ERROR) { + status = U_ZERO_ERROR; + assignArray(fNarrowAmPms, fNarrowAmPmsCount, fAmPms, fAmPmsCount); } // Load quarters initField(&fQuarters, fQuartersCount, calendarSink, - buildResourcePath(path, dtfmtsym_gQuartersTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesWideTag, status), status); + buildResourcePath(path, gQuartersTag, gNamesFormatTag, gNamesWideTag, status), status); initField(&fShortQuarters, fShortQuartersCount, calendarSink, - buildResourcePath(path, dtfmtsym_gQuartersTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesAbbrTag, status), status); + buildResourcePath(path, gQuartersTag, gNamesFormatTag, gNamesAbbrTag, status), status); + if(status == U_MISSING_RESOURCE_ERROR) { + status = U_ZERO_ERROR; + assignArray(fShortQuarters, fShortQuartersCount, fQuarters, fQuartersCount); + } initField(&fStandaloneQuarters, fStandaloneQuartersCount, calendarSink, - buildResourcePath(path, dtfmtsym_gQuartersTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesWideTag, status), status); + buildResourcePath(path, gQuartersTag, gNamesStandaloneTag, gNamesWideTag, status), status); if(status == U_MISSING_RESOURCE_ERROR) { status = U_ZERO_ERROR; assignArray(fStandaloneQuarters, fStandaloneQuartersCount, fQuarters, fQuartersCount); } initField(&fStandaloneShortQuarters, fStandaloneShortQuartersCount, calendarSink, - buildResourcePath(path, dtfmtsym_gQuartersTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesAbbrTag, status), status); + buildResourcePath(path, gQuartersTag, gNamesStandaloneTag, gNamesAbbrTag, status), status); if(status == U_MISSING_RESOURCE_ERROR) { status = U_ZERO_ERROR; assignArray(fStandaloneShortQuarters, fStandaloneShortQuartersCount, fShortQuarters, fShortQuartersCount); } + // unlike the fields above, narrow format quarters fall back on narrow standalone quarters + initField(&fStandaloneNarrowQuarters, fStandaloneNarrowQuartersCount, calendarSink, + buildResourcePath(path, gQuartersTag, gNamesStandaloneTag, gNamesNarrowTag, status), status); + initField(&fNarrowQuarters, fNarrowQuartersCount, calendarSink, + buildResourcePath(path, gQuartersTag, gNamesFormatTag, gNamesNarrowTag, status), status); + if(status == U_MISSING_RESOURCE_ERROR) { + status = U_ZERO_ERROR; + assignArray(fNarrowQuarters, fNarrowQuartersCount, fStandaloneNarrowQuarters, fStandaloneNarrowQuartersCount); + } + // ICU 3.8 or later version no longer uses localized date-time pattern characters by default (ticket#5597) /* // fastCopyFrom()/setTo() - see assignArray comments resStr = ures_getStringByKey(fResourceBundle, gLocalPatternCharsTag, &len, &status); - fLocalPatternChars.setTo(TRUE, resStr, len); + fLocalPatternChars.setTo(true, resStr, len); // If the locale data does not include new pattern chars, use the defaults // TODO: Consider making this an error, since this may add conflicting characters. if (len < PATTERN_CHARS_LEN) { - fLocalPatternChars.append(UnicodeString(TRUE, &gPatternChars[len], PATTERN_CHARS_LEN-len)); + fLocalPatternChars.append(UnicodeString(true, &gPatternChars[len], PATTERN_CHARS_LEN-len)); } */ - fLocalPatternChars.setTo(TRUE, gPatternChars, PATTERN_CHARS_LEN); + fLocalPatternChars.setTo(true, gPatternChars, PATTERN_CHARS_LEN); // Format wide weekdays -> fWeekdays // {sfb} fixed to handle 1-based weekdays initField(&fWeekdays, fWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesWideTag, status), 1, status); + buildResourcePath(path, gDayNamesTag, gNamesFormatTag, gNamesWideTag, status), 1, status); // Format abbreviated weekdays -> fShortWeekdays initField(&fShortWeekdays, fShortWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesAbbrTag, status), 1, status); + buildResourcePath(path, gDayNamesTag, gNamesFormatTag, gNamesAbbrTag, status), 1, status); // Format short weekdays -> fShorterWeekdays (fall back to abbreviated) initField(&fShorterWeekdays, fShorterWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesShortTag, status), 1, status); + buildResourcePath(path, gDayNamesTag, gNamesFormatTag, gNamesShortTag, status), 1, status); if (status == U_MISSING_RESOURCE_ERROR) { status = U_ZERO_ERROR; assignArray(fShorterWeekdays, fShorterWeekdaysCount, fShortWeekdays, fShortWeekdaysCount); @@ -2405,7 +2454,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Stand-alone wide weekdays -> fStandaloneWeekdays initField(&fStandaloneWeekdays, fStandaloneWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesWideTag, status), 1, status); + buildResourcePath(path, gDayNamesTag, gNamesStandaloneTag, gNamesWideTag, status), 1, status); if (status == U_MISSING_RESOURCE_ERROR) { /* If standalone/wide is not available, use format/wide */ status = U_ZERO_ERROR; assignArray(fStandaloneWeekdays, fStandaloneWeekdaysCount, fWeekdays, fWeekdaysCount); @@ -2413,7 +2462,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Stand-alone abbreviated weekdays -> fStandaloneShortWeekdays initField(&fStandaloneShortWeekdays, fStandaloneShortWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesAbbrTag, status), 1, status); + buildResourcePath(path, gDayNamesTag, gNamesStandaloneTag, gNamesAbbrTag, status), 1, status); if (status == U_MISSING_RESOURCE_ERROR) { /* If standalone/abbreviated is not available, use format/abbreviated */ status = U_ZERO_ERROR; assignArray(fStandaloneShortWeekdays, fStandaloneShortWeekdaysCount, fShortWeekdays, fShortWeekdaysCount); @@ -2421,7 +2470,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Stand-alone short weekdays -> fStandaloneShorterWeekdays (fall back to format abbreviated) initField(&fStandaloneShorterWeekdays, fStandaloneShorterWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesShortTag, status), 1, status); + buildResourcePath(path, gDayNamesTag, gNamesStandaloneTag, gNamesShortTag, status), 1, status); if (status == U_MISSING_RESOURCE_ERROR) { /* If standalone/short is not available, use format/short */ status = U_ZERO_ERROR; assignArray(fStandaloneShorterWeekdays, fStandaloneShorterWeekdaysCount, fShorterWeekdays, fShorterWeekdaysCount); @@ -2430,11 +2479,11 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError // Format narrow weekdays -> fNarrowWeekdays UErrorCode narrowWeeksEC = status; initField(&fNarrowWeekdays, fNarrowWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesFormatTag, dtfmtsym_gNamesNarrowTag, status), 1, narrowWeeksEC); + buildResourcePath(path, gDayNamesTag, gNamesFormatTag, gNamesNarrowTag, status), 1, narrowWeeksEC); // Stand-alone narrow weekdays -> fStandaloneNarrowWeekdays UErrorCode standaloneNarrowWeeksEC = status; initField(&fStandaloneNarrowWeekdays, fStandaloneNarrowWeekdaysCount, calendarSink, - buildResourcePath(path, dtfmtsym_gDayNamesTag, dtfmtsym_gNamesStandaloneTag, dtfmtsym_gNamesNarrowTag, status), 1, standaloneNarrowWeeksEC); + buildResourcePath(path, gDayNamesTag, gNamesStandaloneTag, gNamesNarrowTag, status), 1, standaloneNarrowWeeksEC); if (narrowWeeksEC == U_MISSING_RESOURCE_ERROR && standaloneNarrowWeeksEC != U_MISSING_RESOURCE_ERROR) { // If format/narrow not available, use standalone/narrow @@ -2460,30 +2509,32 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError status = U_USING_FALLBACK_WARNING; //TODO(fabalbon): make sure we are storing las resort data for all fields in here. - initField(&fEras, fErasCount, (const UChar *)gLastResortEras, kEraNum, kEraLen, status); - initField(&fEraNames, fEraNamesCount, (const UChar *)gLastResortEras, kEraNum, kEraLen, status); - initField(&fNarrowEras, fNarrowErasCount, (const UChar *)gLastResortEras, kEraNum, kEraLen, status); - initField(&fMonths, fMonthsCount, (const UChar *)gLastResortMonthNames, kMonthNum, kMonthLen, status); - initField(&fShortMonths, fShortMonthsCount, (const UChar *)gLastResortMonthNames, kMonthNum, kMonthLen, status); - initField(&fNarrowMonths, fNarrowMonthsCount, (const UChar *)gLastResortMonthNames, kMonthNum, kMonthLen, status); - initField(&fStandaloneMonths, fStandaloneMonthsCount, (const UChar *)gLastResortMonthNames, kMonthNum, kMonthLen, status); - initField(&fStandaloneShortMonths, fStandaloneShortMonthsCount, (const UChar *)gLastResortMonthNames, kMonthNum, kMonthLen, status); - initField(&fStandaloneNarrowMonths, fStandaloneNarrowMonthsCount, (const UChar *)gLastResortMonthNames, kMonthNum, kMonthLen, status); - initField(&fWeekdays, fWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fShortWeekdays, fShortWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fShorterWeekdays, fShorterWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fNarrowWeekdays, fNarrowWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fStandaloneWeekdays, fStandaloneWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fStandaloneShortWeekdays, fStandaloneShortWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fStandaloneShorterWeekdays, fStandaloneShorterWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fStandaloneNarrowWeekdays, fStandaloneNarrowWeekdaysCount, (const UChar *)gLastResortDayNames, kDayNum, kDayLen, status); - initField(&fAmPms, fAmPmsCount, (const UChar *)gLastResortAmPmMarkers, kAmPmNum, kAmPmLen, status); - initField(&fNarrowAmPms, fNarrowAmPmsCount, (const UChar *)gLastResortAmPmMarkers, kAmPmNum, kAmPmLen, status); - initField(&fQuarters, fQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); - initField(&fShortQuarters, fShortQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); - initField(&fStandaloneQuarters, fStandaloneQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); - initField(&fStandaloneShortQuarters, fStandaloneShortQuartersCount, (const UChar *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); - fLocalPatternChars.setTo(TRUE, gPatternChars, PATTERN_CHARS_LEN); + initField(&fEras, fErasCount, (const char16_t *)gLastResortEras, kEraNum, kEraLen, status); + initField(&fEraNames, fEraNamesCount, (const char16_t *)gLastResortEras, kEraNum, kEraLen, status); + initField(&fNarrowEras, fNarrowErasCount, (const char16_t *)gLastResortEras, kEraNum, kEraLen, status); + initField(&fMonths, fMonthsCount, (const char16_t *)gLastResortMonthNames, kMonthNum, kMonthLen, status); + initField(&fShortMonths, fShortMonthsCount, (const char16_t *)gLastResortMonthNames, kMonthNum, kMonthLen, status); + initField(&fNarrowMonths, fNarrowMonthsCount, (const char16_t *)gLastResortMonthNames, kMonthNum, kMonthLen, status); + initField(&fStandaloneMonths, fStandaloneMonthsCount, (const char16_t *)gLastResortMonthNames, kMonthNum, kMonthLen, status); + initField(&fStandaloneShortMonths, fStandaloneShortMonthsCount, (const char16_t *)gLastResortMonthNames, kMonthNum, kMonthLen, status); + initField(&fStandaloneNarrowMonths, fStandaloneNarrowMonthsCount, (const char16_t *)gLastResortMonthNames, kMonthNum, kMonthLen, status); + initField(&fWeekdays, fWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fShortWeekdays, fShortWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fShorterWeekdays, fShorterWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fNarrowWeekdays, fNarrowWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fStandaloneWeekdays, fStandaloneWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fStandaloneShortWeekdays, fStandaloneShortWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fStandaloneShorterWeekdays, fStandaloneShorterWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fStandaloneNarrowWeekdays, fStandaloneNarrowWeekdaysCount, (const char16_t *)gLastResortDayNames, kDayNum, kDayLen, status); + initField(&fAmPms, fAmPmsCount, (const char16_t *)gLastResortAmPmMarkers, kAmPmNum, kAmPmLen, status); + initField(&fNarrowAmPms, fNarrowAmPmsCount, (const char16_t *)gLastResortAmPmMarkers, kAmPmNum, kAmPmLen, status); + initField(&fQuarters, fQuartersCount, (const char16_t *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); + initField(&fShortQuarters, fShortQuartersCount, (const char16_t *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); + initField(&fNarrowQuarters, fNarrowQuartersCount, (const char16_t *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); + initField(&fStandaloneQuarters, fStandaloneQuartersCount, (const char16_t *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); + initField(&fStandaloneShortQuarters, fStandaloneShortQuartersCount, (const char16_t *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); + initField(&fStandaloneNarrowQuarters, fStandaloneNarrowQuartersCount, (const char16_t *)gLastResortQuarters, kQuarterNum, kQuarterLen, status); + fLocalPatternChars.setTo(true, gPatternChars, PATTERN_CHARS_LEN); } } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dtitv_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/dtitv_impl.h index ba10d2c00..2cc776481 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dtitv_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dtitv_impl.h @@ -19,79 +19,81 @@ * \file * \brief C++ API: Defines macros for interval format implementation */ - + #if !UCONFIG_NO_FORMATTING #include "unicode/unistr.h" -#define dtitv_impl_QUOTE ((UChar)0x0027) -#define dtitv_impl_LOW_LINE ((UChar)0x005F) -#define dtitv_impl_COLON ((UChar)0x003A) -#define dtitv_impl_LEFT_CURLY_BRACKET ((UChar)0x007B) -#define dtitv_impl_RIGHT_CURLY_BRACKET ((UChar)0x007D) -#define dtitv_impl_SPACE ((UChar)0x0020) -#define dtitv_impl_EN_DASH ((UChar)0x2013) -#define dtitv_impl_SOLIDUS ((UChar)0x002F) +#define QUOTE ((char16_t)0x0027) +#define LOW_LINE ((char16_t)0x005F) +#define COLON ((char16_t)0x003A) +#define LEFT_CURLY_BRACKET ((char16_t)0x007B) +#define RIGHT_CURLY_BRACKET ((char16_t)0x007D) +#define SPACE ((char16_t)0x0020) +#define EN_DASH ((char16_t)0x2013) +#define SOLIDUS ((char16_t)0x002F) -#define dtitv_impl_DIGIT_ZERO ((UChar)0x0030) -#define dtitv_impl_DIGIT_ONE ((UChar)0x0031) +#define DIGIT_ZERO ((char16_t)0x0030) +#define DIGIT_ONE ((char16_t)0x0031) -#define dtitv_impl_LOW_A ((UChar)0x0061) -#define dtitv_impl_LOW_B ((UChar)0x0062) -#define dtitv_impl_LOW_C ((UChar)0x0063) -#define dtitv_impl_LOW_D ((UChar)0x0064) -#define dtitv_impl_LOW_E ((UChar)0x0065) -#define dtitv_impl_LOW_F ((UChar)0x0066) -#define dtitv_impl_LOW_G ((UChar)0x0067) -#define dtitv_impl_LOW_H ((UChar)0x0068) -#define dtitv_impl_LOW_I ((UChar)0x0069) -#define dtitv_impl_LOW_J ((UChar)0x006a) -#define dtitv_impl_LOW_K ((UChar)0x006B) -#define dtitv_impl_LOW_L ((UChar)0x006C) -#define dtitv_impl_LOW_M ((UChar)0x006D) -#define dtitv_impl_LOW_N ((UChar)0x006E) -#define dtitv_impl_LOW_O ((UChar)0x006F) -#define dtitv_impl_LOW_P ((UChar)0x0070) -#define dtitv_impl_LOW_Q ((UChar)0x0071) -#define dtitv_impl_LOW_R ((UChar)0x0072) -#define dtitv_impl_LOW_S ((UChar)0x0073) -#define dtitv_impl_LOW_T ((UChar)0x0074) -#define dtitv_impl_LOW_U ((UChar)0x0075) -#define dtitv_impl_LOW_V ((UChar)0x0076) -#define dtitv_impl_LOW_W ((UChar)0x0077) -#define dtitv_impl_LOW_Y ((UChar)0x0079) -#define dtitv_impl_LOW_Z ((UChar)0x007A) +#define LOW_A ((char16_t)0x0061) +#define LOW_B ((char16_t)0x0062) +#define LOW_C ((char16_t)0x0063) +#define LOW_D ((char16_t)0x0064) +#define LOW_E ((char16_t)0x0065) +#define LOW_F ((char16_t)0x0066) +#define LOW_G ((char16_t)0x0067) +#define LOW_H ((char16_t)0x0068) +#define LOW_I ((char16_t)0x0069) +#define LOW_J ((char16_t)0x006a) +#define LOW_K ((char16_t)0x006B) +#define LOW_L ((char16_t)0x006C) +#define LOW_M ((char16_t)0x006D) +#define LOW_N ((char16_t)0x006E) +#define LOW_O ((char16_t)0x006F) +#define LOW_P ((char16_t)0x0070) +#define LOW_Q ((char16_t)0x0071) +#define LOW_R ((char16_t)0x0072) +#define LOW_S ((char16_t)0x0073) +#define LOW_T ((char16_t)0x0074) +#define LOW_U ((char16_t)0x0075) +#define LOW_V ((char16_t)0x0076) +#define LOW_W ((char16_t)0x0077) +#define LOW_Y ((char16_t)0x0079) +#define LOW_Z ((char16_t)0x007A) -#define dtitv_impl_CAP_A ((UChar)0x0041) -#define dtitv_impl_CAP_C ((UChar)0x0043) -#define dtitv_impl_CAP_D ((UChar)0x0044) -#define dtitv_impl_CAP_E ((UChar)0x0045) -#define dtitv_impl_CAP_F ((UChar)0x0046) -#define dtitv_impl_CAP_G ((UChar)0x0047) -#define dtitv_impl_CAP_H ((UChar)0x0048) -#define dtitv_impl_CAP_K ((UChar)0x004B) -#define dtitv_impl_CAP_L ((UChar)0x004C) -#define dtitv_impl_CAP_M ((UChar)0x004D) -#define dtitv_impl_CAP_O ((UChar)0x004F) -#define dtitv_impl_CAP_Q ((UChar)0x0051) -#define dtitv_impl_CAP_S ((UChar)0x0053) -#define dtitv_impl_CAP_T ((UChar)0x0054) -#define dtitv_impl_CAP_U ((UChar)0x0055) -#define dtitv_impl_CAP_V ((UChar)0x0056) -#define dtitv_impl_CAP_W ((UChar)0x0057) -#define dtitv_impl_CAP_Y ((UChar)0x0059) -#define dtitv_impl_CAP_Z ((UChar)0x005A) +#define CAP_A ((char16_t)0x0041) +#define CAP_B ((char16_t)0x0042) +#define CAP_C ((char16_t)0x0043) +#define CAP_D ((char16_t)0x0044) +#define CAP_E ((char16_t)0x0045) +#define CAP_F ((char16_t)0x0046) +#define CAP_G ((char16_t)0x0047) +#define CAP_J ((char16_t)0x004A) +#define CAP_H ((char16_t)0x0048) +#define CAP_K ((char16_t)0x004B) +#define CAP_L ((char16_t)0x004C) +#define CAP_M ((char16_t)0x004D) +#define CAP_O ((char16_t)0x004F) +#define CAP_Q ((char16_t)0x0051) +#define CAP_S ((char16_t)0x0053) +#define CAP_T ((char16_t)0x0054) +#define CAP_U ((char16_t)0x0055) +#define CAP_V ((char16_t)0x0056) +#define CAP_W ((char16_t)0x0057) +#define CAP_Y ((char16_t)0x0059) +#define CAP_Z ((char16_t)0x005A) //#define MINIMUM_SUPPORTED_CALENDAR_FIELD UCAL_MINUTE -#define dtitv_impl_MAX_E_COUNT 5 -#define dtitv_impl_MAX_M_COUNT 5 +#define MAX_E_COUNT 5 +#define MAX_M_COUNT 5 //#define MAX_INTERVAL_INDEX 4 -#define dtitv_impl_MAX_POSITIVE_INT 56632 +#define MAX_POSITIVE_INT 56632 #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif +#endif //eof diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp index 810348ad0..608701466 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp @@ -23,6 +23,7 @@ #include "unicode/dtptngen.h" #include "unicode/dtitvinf.h" #include "unicode/simpleformatter.h" +#include "unicode/udisplaycontext.h" #include "cmemory.h" #include "cstring.h" #include "dtitv_impl.h" @@ -43,27 +44,27 @@ U_NAMESPACE_BEGIN #endif -static const UChar dtitvfmt_gDateFormatSkeleton[][11] = { +static const char16_t gDateFormatSkeleton[][11] = { //yMMMMEEEEd -{dtitv_impl_LOW_Y, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_CAP_E, dtitv_impl_CAP_E, dtitv_impl_CAP_E, dtitv_impl_CAP_E, dtitv_impl_LOW_D, 0}, +{LOW_Y, CAP_M, CAP_M, CAP_M, CAP_M, CAP_E, CAP_E, CAP_E, CAP_E, LOW_D, 0}, //yMMMMd -{dtitv_impl_LOW_Y, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_LOW_D, 0}, +{LOW_Y, CAP_M, CAP_M, CAP_M, CAP_M, LOW_D, 0}, //yMMMd -{dtitv_impl_LOW_Y, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_CAP_M, dtitv_impl_LOW_D, 0}, +{LOW_Y, CAP_M, CAP_M, CAP_M, LOW_D, 0}, //yMd -{dtitv_impl_LOW_Y, dtitv_impl_CAP_M, dtitv_impl_LOW_D, 0} }; +{LOW_Y, CAP_M, LOW_D, 0} }; -static const char dtitvfmt_gCalendarTag[] = "calendar"; -static const char dtitvfmt_gGregorianTag[] = "gregorian"; -static const char dtitvfmt_gDateTimePatternsTag[] = "DateTimePatterns"; +static const char gCalendarTag[] = "calendar"; +static const char gGregorianTag[] = "gregorian"; +static const char gDateTimePatternsTag[] = "DateTimePatterns"; // latestFirst: -static const UChar dtitvfmt_gLaterFirstPrefix[] = {dtitv_impl_LOW_L, dtitv_impl_LOW_A, dtitv_impl_LOW_T, dtitv_impl_LOW_E, dtitv_impl_LOW_S,dtitv_impl_LOW_T, dtitv_impl_CAP_F, dtitv_impl_LOW_I, dtitv_impl_LOW_R, dtitv_impl_LOW_S, dtitv_impl_LOW_T, dtitv_impl_COLON}; +static const char16_t gLaterFirstPrefix[] = {LOW_L, LOW_A, LOW_T, LOW_E, LOW_S,LOW_T, CAP_F, LOW_I, LOW_R, LOW_S, LOW_T, COLON}; // earliestFirst: -static const UChar dtitvfmt_gEarlierFirstPrefix[] = {dtitv_impl_LOW_E, dtitv_impl_LOW_A, dtitv_impl_LOW_R, dtitv_impl_LOW_L, dtitv_impl_LOW_I, dtitv_impl_LOW_E, dtitv_impl_LOW_S, dtitv_impl_LOW_T, dtitv_impl_CAP_F, dtitv_impl_LOW_I, dtitv_impl_LOW_R, dtitv_impl_LOW_S, dtitv_impl_LOW_T, dtitv_impl_COLON}; +static const char16_t gEarlierFirstPrefix[] = {LOW_E, LOW_A, LOW_R, LOW_L, LOW_I, LOW_E, LOW_S, LOW_T, CAP_F, LOW_I, LOW_R, LOW_S, LOW_T, COLON}; class FormattedDateIntervalData : public FormattedValueFieldPositionIteratorImpl { @@ -103,11 +104,15 @@ DateIntervalFormat::createInstance(const UnicodeString& skeleton, UnicodeString pat; ((SimpleDateFormat*)dtfmt)->toPattern(pat); pat.extract(0, pat.length(), result_1, "UTF-8"); - sprintf(mesg, "skeleton: %s; pattern: %s\n", result, result_1); + snprintf(mesg, sizeof(mesg), "skeleton: %s; pattern: %s\n", result, result_1); PRINTMESG(mesg) #endif DateIntervalInfo* dtitvinf = new DateIntervalInfo(locale, status); + if (dtitvinf == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } return create(locale, dtitvinf, &skeleton, status); } @@ -132,27 +137,29 @@ DateIntervalFormat::createInstance(const UnicodeString& skeleton, DateIntervalFormat::DateIntervalFormat() -: fInfo(NULL), - fDateFormat(NULL), - fFromCalendar(NULL), - fToCalendar(NULL), +: fInfo(nullptr), + fDateFormat(nullptr), + fFromCalendar(nullptr), + fToCalendar(nullptr), fLocale(Locale::getRoot()), - fDatePattern(NULL), - fTimePattern(NULL), - fDateTimeFormat(NULL) + fDatePattern(nullptr), + fTimePattern(nullptr), + fDateTimeFormat(nullptr), + fCapitalizationContext(UDISPCTX_CAPITALIZATION_NONE) {} DateIntervalFormat::DateIntervalFormat(const DateIntervalFormat& itvfmt) : Format(itvfmt), - fInfo(NULL), - fDateFormat(NULL), - fFromCalendar(NULL), - fToCalendar(NULL), + fInfo(nullptr), + fDateFormat(nullptr), + fFromCalendar(nullptr), + fToCalendar(nullptr), fLocale(itvfmt.fLocale), - fDatePattern(NULL), - fTimePattern(NULL), - fDateTimeFormat(NULL) { + fDatePattern(nullptr), + fTimePattern(nullptr), + fDateTimeFormat(nullptr), + fCapitalizationContext(UDISPCTX_CAPITALIZATION_NONE) { *this = itvfmt; } @@ -172,23 +179,23 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) { if ( itvfmt.fDateFormat ) { fDateFormat = itvfmt.fDateFormat->clone(); } else { - fDateFormat = NULL; + fDateFormat = nullptr; } if ( itvfmt.fFromCalendar ) { fFromCalendar = itvfmt.fFromCalendar->clone(); } else { - fFromCalendar = NULL; + fFromCalendar = nullptr; } if ( itvfmt.fToCalendar ) { fToCalendar = itvfmt.fToCalendar->clone(); } else { - fToCalendar = NULL; + fToCalendar = nullptr; } } if ( itvfmt.fInfo ) { fInfo = itvfmt.fInfo->clone(); } else { - fInfo = NULL; + fInfo = nullptr; } fSkeleton = itvfmt.fSkeleton; int8_t i; @@ -196,9 +203,10 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) { fIntervalPatterns[i] = itvfmt.fIntervalPatterns[i]; } fLocale = itvfmt.fLocale; - fDatePattern = (itvfmt.fDatePattern)? itvfmt.fDatePattern->clone(): NULL; - fTimePattern = (itvfmt.fTimePattern)? itvfmt.fTimePattern->clone(): NULL; - fDateTimeFormat = (itvfmt.fDateTimeFormat)? itvfmt.fDateTimeFormat->clone(): NULL; + fDatePattern = (itvfmt.fDatePattern)? itvfmt.fDatePattern->clone(): nullptr; + fTimePattern = (itvfmt.fTimePattern)? itvfmt.fTimePattern->clone(): nullptr; + fDateTimeFormat = (itvfmt.fDateTimeFormat)? itvfmt.fDateTimeFormat->clone(): nullptr; + fCapitalizationContext = itvfmt.fCapitalizationContext; } return *this; } @@ -223,34 +231,35 @@ DateIntervalFormat::clone() const { bool DateIntervalFormat::operator==(const Format& other) const { - if (typeid(*this) != typeid(other)) {return FALSE;} + if (typeid(*this) != typeid(other)) {return false;} const DateIntervalFormat* fmt = (DateIntervalFormat*)&other; - if (this == fmt) {return TRUE;} - if (!Format::operator==(other)) {return FALSE;} - if ((fInfo != fmt->fInfo) && (fInfo == NULL || fmt->fInfo == NULL)) {return FALSE;} - if (fInfo && fmt->fInfo && (*fInfo != *fmt->fInfo )) {return FALSE;} + if (this == fmt) {return true;} + if (!Format::operator==(other)) {return false;} + if ((fInfo != fmt->fInfo) && (fInfo == nullptr || fmt->fInfo == nullptr)) {return false;} + if (fInfo && fmt->fInfo && (*fInfo != *fmt->fInfo )) {return false;} { Mutex lock(&gFormatterMutex); - if (fDateFormat != fmt->fDateFormat && (fDateFormat == NULL || fmt->fDateFormat == NULL)) {return FALSE;} - if (fDateFormat && fmt->fDateFormat && (*fDateFormat != *fmt->fDateFormat)) {return FALSE;} + if (fDateFormat != fmt->fDateFormat && (fDateFormat == nullptr || fmt->fDateFormat == nullptr)) {return false;} + if (fDateFormat && fmt->fDateFormat && (*fDateFormat != *fmt->fDateFormat)) {return false;} } // note: fFromCalendar and fToCalendar hold no persistent state, and therefore do not participate in operator ==. - // fDateFormat has the master calendar for the DateIntervalFormat. - if (fSkeleton != fmt->fSkeleton) {return FALSE;} - if (fDatePattern != fmt->fDatePattern && (fDatePattern == NULL || fmt->fDatePattern == NULL)) {return FALSE;} - if (fDatePattern && fmt->fDatePattern && (*fDatePattern != *fmt->fDatePattern)) {return FALSE;} - if (fTimePattern != fmt->fTimePattern && (fTimePattern == NULL || fmt->fTimePattern == NULL)) {return FALSE;} - if (fTimePattern && fmt->fTimePattern && (*fTimePattern != *fmt->fTimePattern)) {return FALSE;} - if (fDateTimeFormat != fmt->fDateTimeFormat && (fDateTimeFormat == NULL || fmt->fDateTimeFormat == NULL)) {return FALSE;} - if (fDateTimeFormat && fmt->fDateTimeFormat && (*fDateTimeFormat != *fmt->fDateTimeFormat)) {return FALSE;} - if (fLocale != fmt->fLocale) {return FALSE;} + // fDateFormat has the primary calendar for the DateIntervalFormat. + if (fSkeleton != fmt->fSkeleton) {return false;} + if (fDatePattern != fmt->fDatePattern && (fDatePattern == nullptr || fmt->fDatePattern == nullptr)) {return false;} + if (fDatePattern && fmt->fDatePattern && (*fDatePattern != *fmt->fDatePattern)) {return false;} + if (fTimePattern != fmt->fTimePattern && (fTimePattern == nullptr || fmt->fTimePattern == nullptr)) {return false;} + if (fTimePattern && fmt->fTimePattern && (*fTimePattern != *fmt->fTimePattern)) {return false;} + if (fDateTimeFormat != fmt->fDateTimeFormat && (fDateTimeFormat == nullptr || fmt->fDateTimeFormat == nullptr)) {return false;} + if (fDateTimeFormat && fmt->fDateTimeFormat && (*fDateTimeFormat != *fmt->fDateTimeFormat)) {return false;} + if (fLocale != fmt->fLocale) {return false;} for (int32_t i = 0; i< DateIntervalInfo::kIPI_MAX_INDEX; ++i ) { - if (fIntervalPatterns[i].firstPart != fmt->fIntervalPatterns[i].firstPart) {return FALSE;} - if (fIntervalPatterns[i].secondPart != fmt->fIntervalPatterns[i].secondPart ) {return FALSE;} - if (fIntervalPatterns[i].laterDateFirst != fmt->fIntervalPatterns[i].laterDateFirst) {return FALSE;} + if (fIntervalPatterns[i].firstPart != fmt->fIntervalPatterns[i].firstPart) {return false;} + if (fIntervalPatterns[i].secondPart != fmt->fIntervalPatterns[i].secondPart ) {return false;} + if (fIntervalPatterns[i].laterDateFirst != fmt->fIntervalPatterns[i].laterDateFirst) {return false;} } - return TRUE; + if (fCapitalizationContext != fmt->fCapitalizationContext) {return false;} + return true; } @@ -266,7 +275,7 @@ DateIntervalFormat::format(const Formattable& obj, if ( obj.getType() == Formattable::kObject ) { const UObject* formatObj = obj.getObject(); const DateInterval* interval = dynamic_cast(formatObj); - if (interval != NULL) { + if (interval != nullptr) { return format(interval, appendTo, fieldPosition, status); } } @@ -283,13 +292,13 @@ DateIntervalFormat::format(const DateInterval* dtInterval, if ( U_FAILURE(status) ) { return appendTo; } - if (fDateFormat == NULL || fInfo == NULL) { + if (fDateFormat == nullptr || fInfo == nullptr) { status = U_INVALID_STATE_ERROR; return appendTo; } FieldPositionOnlyHandler handler(fieldPosition); - handler.setAcceptFirstOnly(TRUE); + handler.setAcceptFirstOnly(true); int8_t ignore; Mutex lock(&gFormatterMutex); @@ -300,6 +309,10 @@ DateIntervalFormat::format(const DateInterval* dtInterval, FormattedDateInterval DateIntervalFormat::formatToValue( const DateInterval& dtInterval, UErrorCode& status) const { + if (U_FAILURE(status)) { + return FormattedDateInterval(status); + } + // LocalPointer only sets OOM status if U_SUCCESS is true. LocalPointer result(new FormattedDateIntervalData(status), status); if (U_FAILURE(status)) { return FormattedDateInterval(status); @@ -338,7 +351,7 @@ DateIntervalFormat::format(Calendar& fromCalendar, FieldPosition& pos, UErrorCode& status) const { FieldPositionOnlyHandler handler(pos); - handler.setAcceptFirstOnly(TRUE); + handler.setAcceptFirstOnly(true); int8_t ignore; Mutex lock(&gFormatterMutex); @@ -350,6 +363,10 @@ FormattedDateInterval DateIntervalFormat::formatToValue( Calendar& fromCalendar, Calendar& toCalendar, UErrorCode& status) const { + if (U_FAILURE(status)) { + return FormattedDateInterval(status); + } + // LocalPointer only sets OOM status if U_SUCCESS is true. LocalPointer result(new FormattedDateIntervalData(status), status); if (U_FAILURE(status)) { return FormattedDateInterval(status); @@ -397,6 +414,7 @@ UnicodeString& DateIntervalFormat::formatIntervalImpl( } +// The following is only called from within the gFormatterMutex lock UnicodeString& DateIntervalFormat::formatImpl(Calendar& fromCalendar, Calendar& toCalendar, @@ -444,18 +462,26 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar, } else if ( fromCalendar.get(UCAL_SECOND, status) != toCalendar.get(UCAL_SECOND, status) ) { field = UCAL_SECOND; + } else if ( fromCalendar.get(UCAL_MILLISECOND, status) != + toCalendar.get(UCAL_MILLISECOND, status) ) { + field = UCAL_MILLISECOND; } if ( U_FAILURE(status) ) { return appendTo; } + UErrorCode tempStatus = U_ZERO_ERROR; // for setContext, ignored + // Set up fDateFormat to handle the first or only part of the interval + // (override later for any second part). Inside lock, OK to modify fDateFormat. + fDateFormat->setContext(fCapitalizationContext, tempStatus); + if ( field == UCAL_FIELD_COUNT ) { /* ignore the millisecond etc. small fields' difference. * use single date when all the above are the same. */ return fDateFormat->_format(fromCalendar, appendTo, fphandler, status); } - UBool fromToOnSameDay = (field==UCAL_AM_PM || field==UCAL_HOUR || field==UCAL_MINUTE || field==UCAL_SECOND); + UBool fromToOnSameDay = (field==UCAL_AM_PM || field==UCAL_HOUR || field==UCAL_MINUTE || field==UCAL_SECOND || field==UCAL_MILLISECOND); // following call should not set wrong status, // all the pass-in fields are valid till here @@ -506,6 +532,9 @@ DateIntervalFormat::formatImpl(Calendar& fromCalendar, if ( !intervalPattern.secondPart.isEmpty() ) { fDateFormat->applyPattern(intervalPattern.secondPart); + // No capitalization for second part of interval + tempStatus = U_ZERO_ERROR; + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(*secondCal, appendTo, fphandler, status); } fDateFormat->applyPattern(originalPattern); @@ -537,14 +566,17 @@ DateIntervalFormat::setDateIntervalInfo(const DateIntervalInfo& newItvPattern, UErrorCode& status) { delete fInfo; fInfo = new DateIntervalInfo(newItvPattern); + if (fInfo == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } // Delete patterns that get reset by initializePattern delete fDatePattern; - fDatePattern = NULL; + fDatePattern = nullptr; delete fTimePattern; - fTimePattern = NULL; + fTimePattern = nullptr; delete fDateTimeFormat; - fDateTimeFormat = NULL; + fDateTimeFormat = nullptr; if (fDateFormat) { initializePattern(status); @@ -562,10 +594,10 @@ DateIntervalFormat::getDateFormat() const { void DateIntervalFormat::adoptTimeZone(TimeZone* zone) { - if (fDateFormat != NULL) { + if (fDateFormat != nullptr) { fDateFormat->adoptTimeZone(zone); } - // The fDateFormat has the master calendar for the DateIntervalFormat and has + // The fDateFormat has the primary calendar for the DateIntervalFormat and has // ownership of any adopted TimeZone; fFromCalendar and fToCalendar are internal // work clones of that calendar (and should not also be given ownership of the // adopted TimeZone). @@ -580,10 +612,10 @@ DateIntervalFormat::adoptTimeZone(TimeZone* zone) void DateIntervalFormat::setTimeZone(const TimeZone& zone) { - if (fDateFormat != NULL) { + if (fDateFormat != nullptr) { fDateFormat->setTimeZone(zone); } - // The fDateFormat has the master calendar for the DateIntervalFormat; + // The fDateFormat has the primary calendar for the DateIntervalFormat; // fFromCalendar and fToCalendar are internal work clones of that calendar. if (fFromCalendar) { fFromCalendar->setTimeZone(zone); @@ -596,26 +628,51 @@ DateIntervalFormat::setTimeZone(const TimeZone& zone) const TimeZone& DateIntervalFormat::getTimeZone() const { - if (fDateFormat != NULL) { + if (fDateFormat != nullptr) { Mutex lock(&gFormatterMutex); return fDateFormat->getTimeZone(); } - // If fDateFormat is NULL (unexpected), create default timezone. + // If fDateFormat is nullptr (unexpected), create default timezone. return *(TimeZone::createDefault()); } +void +DateIntervalFormat::setContext(UDisplayContext value, UErrorCode& status) +{ + if (U_FAILURE(status)) + return; + if ( (UDisplayContextType)((uint32_t)value >> 8) == UDISPCTX_TYPE_CAPITALIZATION ) { + fCapitalizationContext = value; + } else { + status = U_ILLEGAL_ARGUMENT_ERROR; + } +} + +UDisplayContext +DateIntervalFormat::getContext(UDisplayContextType type, UErrorCode& status) const +{ + if (U_FAILURE(status)) + return (UDisplayContext)0; + if (type != UDISPCTX_TYPE_CAPITALIZATION) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return (UDisplayContext)0; + } + return fCapitalizationContext; +} + DateIntervalFormat::DateIntervalFormat(const Locale& locale, DateIntervalInfo* dtItvInfo, const UnicodeString* skeleton, UErrorCode& status) -: fInfo(NULL), - fDateFormat(NULL), - fFromCalendar(NULL), - fToCalendar(NULL), +: fInfo(nullptr), + fDateFormat(nullptr), + fFromCalendar(nullptr), + fToCalendar(nullptr), fLocale(locale), - fDatePattern(NULL), - fTimePattern(NULL), - fDateTimeFormat(NULL) + fDatePattern(nullptr), + fTimePattern(nullptr), + fDateTimeFormat(nullptr), + fCapitalizationContext(UDISPCTX_CAPITALIZATION_NONE) { LocalPointer info(dtItvInfo, status); LocalPointer dtfmt(static_cast( @@ -643,11 +700,11 @@ DateIntervalFormat::create(const Locale& locale, UErrorCode& status) { DateIntervalFormat* f = new DateIntervalFormat(locale, dtitvinf, skeleton, status); - if ( f == NULL ) { + if ( f == nullptr ) { status = U_MEMORY_ALLOCATION_ERROR; delete dtitvinf; } else if ( U_FAILURE(status) ) { - // safe to delete f, although nothing acutally is saved + // safe to delete f, although nothing actually is saved delete f; f = 0; } @@ -704,7 +761,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { char result_1[1000]; char mesg[2000]; fSkeleton.extract(0, fSkeleton.length(), result, "UTF-8"); - sprintf(mesg, "in getBestSkeleton: fSkeleton: %s; \n", result); + snprintf(mesg, sizeof(mesg), "in getBestSkeleton: fSkeleton: %s; \n", result); PRINTMESG(mesg) #endif // fSkeleton is already set by createDateIntervalInstance() @@ -733,7 +790,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { /* the difference between time skeleton and normalizedTimeSkeleton are: * 1. (Formerly, normalized time skeleton folded 'H' to 'h'; no longer true) - * 2. 'a' is omitted in normalized time skeleton. + * 2. (Formerly, 'a' was omitted in normalized time skeleton; this is now handled elsewhere) * 3. there is only one appearance for 'h' or 'H', 'm','v', 'z' in normalized * time skeleton * @@ -742,7 +799,8 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { * 2. 'E' and 'EE' are normalized into 'EEE' * 3. 'MM' is normalized into 'M' */ - getDateTimeSkeleton(fSkeleton, dateSkeleton, normalizedDateSkeleton, + UnicodeString convertedSkeleton = normalizeHourMetacharacters(fSkeleton); + getDateTimeSkeleton(convertedSkeleton, dateSkeleton, normalizedDateSkeleton, timeSkeleton, normalizedTimeSkeleton); #ifdef DTITVFMT_DEBUG @@ -750,7 +808,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { char result_1[1000]; char mesg[2000]; fSkeleton.extract(0, fSkeleton.length(), result, "UTF-8"); - sprintf(mesg, "in getBestSkeleton: fSkeleton: %s; \n", result); + snprintf(mesg, sizeof(mesg), "in getBestSkeleton: fSkeleton: %s; \n", result); PRINTMESG(mesg) #endif @@ -760,21 +818,25 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { // with the time interval. // The date/time pattern ( such as {0} {1} ) is saved in // calendar, that is why need to get the CalendarData here. - LocalUResourceBundlePointer dateTimePatternsRes(ures_open(NULL, locale.getBaseName(), &status)); - ures_getByKey(dateTimePatternsRes.getAlias(), dtitvfmt_gCalendarTag, + LocalUResourceBundlePointer dateTimePatternsRes(ures_open(nullptr, locale.getBaseName(), &status)); + ures_getByKey(dateTimePatternsRes.getAlias(), gCalendarTag, dateTimePatternsRes.getAlias(), &status); - ures_getByKeyWithFallback(dateTimePatternsRes.getAlias(), dtitvfmt_gGregorianTag, + ures_getByKeyWithFallback(dateTimePatternsRes.getAlias(), gGregorianTag, dateTimePatternsRes.getAlias(), &status); - ures_getByKeyWithFallback(dateTimePatternsRes.getAlias(), dtitvfmt_gDateTimePatternsTag, + ures_getByKeyWithFallback(dateTimePatternsRes.getAlias(), gDateTimePatternsTag, dateTimePatternsRes.getAlias(), &status); int32_t dateTimeFormatLength; - const UChar* dateTimeFormat = ures_getStringByIndex( + const char16_t* dateTimeFormat = ures_getStringByIndex( dateTimePatternsRes.getAlias(), (int32_t)DateFormat::kDateTime, &dateTimeFormatLength, &status); if ( U_SUCCESS(status) && dateTimeFormatLength >= 3 ) { fDateTimeFormat = new UnicodeString(dateTimeFormat, dateTimeFormatLength); + if (fDateTimeFormat == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } } } @@ -788,7 +850,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { if ( timeSkeleton.length() != 0 ) { if ( dateSkeleton.length() == 0 ) { // prefix with yMd - timeSkeleton.insert(0, dtitvfmt_gDateFormatSkeleton[DateFormat::kShort], -1); + timeSkeleton.insert(0, gDateFormatSkeleton[DateFormat::kShort], -1); UnicodeString pattern = DateFormat::getBestPattern( locale, timeSkeleton, status); if ( U_FAILURE(status) ) { @@ -798,9 +860,17 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { // the first part of the pattern is empty, // the second part of the pattern is the full-pattern // should be used in fall-back. - setPatternInfo(UCAL_DATE, NULL, &pattern, fInfo->getDefaultOrder()); - setPatternInfo(UCAL_MONTH, NULL, &pattern, fInfo->getDefaultOrder()); - setPatternInfo(UCAL_YEAR, NULL, &pattern, fInfo->getDefaultOrder()); + setPatternInfo(UCAL_DATE, nullptr, &pattern, fInfo->getDefaultOrder()); + setPatternInfo(UCAL_MONTH, nullptr, &pattern, fInfo->getDefaultOrder()); + setPatternInfo(UCAL_YEAR, nullptr, &pattern, fInfo->getDefaultOrder()); + + timeSkeleton.insert(0, CAP_G); + pattern = DateFormat::getBestPattern( + locale, timeSkeleton, status); + if ( U_FAILURE(status) ) { + return; + } + setPatternInfo(UCAL_ERA, nullptr, &pattern, fInfo->getDefaultOrder()); } else { // TODO: fall back } @@ -814,7 +884,7 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { // done } else if ( dateSkeleton.length() == 0 ) { // prefix with yMd - timeSkeleton.insert(0, dtitvfmt_gDateFormatSkeleton[DateFormat::kShort], -1); + timeSkeleton.insert(0, gDateFormatSkeleton[DateFormat::kShort], -1); UnicodeString pattern = DateFormat::getBestPattern( locale, timeSkeleton, status); if ( U_FAILURE(status) ) { @@ -824,44 +894,57 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { // the first part of the pattern is empty, // the second part of the pattern is the full-pattern // should be used in fall-back. - setPatternInfo(UCAL_DATE, NULL, &pattern, fInfo->getDefaultOrder()); - setPatternInfo(UCAL_MONTH, NULL, &pattern, fInfo->getDefaultOrder()); - setPatternInfo(UCAL_YEAR, NULL, &pattern, fInfo->getDefaultOrder()); + setPatternInfo(UCAL_DATE, nullptr, &pattern, fInfo->getDefaultOrder()); + setPatternInfo(UCAL_MONTH, nullptr, &pattern, fInfo->getDefaultOrder()); + setPatternInfo(UCAL_YEAR, nullptr, &pattern, fInfo->getDefaultOrder()); + + timeSkeleton.insert(0, CAP_G); + pattern = DateFormat::getBestPattern( + locale, timeSkeleton, status); + if ( U_FAILURE(status) ) { + return; + } + setPatternInfo(UCAL_ERA, nullptr, &pattern, fInfo->getDefaultOrder()); } else { /* if both present, - * 1) when the year, month, or day differs, + * 1) when the era, year, month, or day differs, * concatenate the two original expressions with a separator between, * 2) otherwise, present the date followed by the * range expression for the time. */ /* - * 1) when the year, month, or day differs, + * 1) when the era, year, month, or day differs, * concatenate the two original expressions with a separator between, */ // if field exists, use fall back UnicodeString skeleton = fSkeleton; if ( !fieldExistsInSkeleton(UCAL_DATE, dateSkeleton) ) { // prefix skeleton with 'd' - skeleton.insert(0, dtitv_impl_LOW_D); + skeleton.insert(0, LOW_D); setFallbackPattern(UCAL_DATE, skeleton, status); } if ( !fieldExistsInSkeleton(UCAL_MONTH, dateSkeleton) ) { // then prefix skeleton with 'M' - skeleton.insert(0, dtitv_impl_CAP_M); + skeleton.insert(0, CAP_M); setFallbackPattern(UCAL_MONTH, skeleton, status); } if ( !fieldExistsInSkeleton(UCAL_YEAR, dateSkeleton) ) { // then prefix skeleton with 'y' - skeleton.insert(0, dtitv_impl_LOW_Y); + skeleton.insert(0, LOW_Y); setFallbackPattern(UCAL_YEAR, skeleton, status); } + if ( !fieldExistsInSkeleton(UCAL_ERA, dateSkeleton) ) { + // then prefix skeleton with 'G' + skeleton.insert(0, CAP_G); + setFallbackPattern(UCAL_ERA, skeleton, status); + } /* * 2) otherwise, present the date followed by the * range expression for the time. */ - if ( fDateTimeFormat == NULL ) { + if ( fDateTimeFormat == nullptr ) { // earlier failure getting dateTimeFormat return; } @@ -877,6 +960,97 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { +UnicodeString +DateIntervalFormat::normalizeHourMetacharacters(const UnicodeString& skeleton) const { + UnicodeString result = skeleton; + + char16_t hourMetachar = u'\0'; + char16_t dayPeriodChar = u'\0'; + int32_t hourFieldStart = 0; + int32_t hourFieldLength = 0; + int32_t dayPeriodStart = 0; + int32_t dayPeriodLength = 0; + for (int32_t i = 0; i < result.length(); i++) { + char16_t c = result[i]; + if (c == LOW_J || c == CAP_J || c == CAP_C || c == LOW_H || c == CAP_H || c == LOW_K || c == CAP_K) { + if (hourMetachar == u'\0') { + hourMetachar = c; + hourFieldStart = i; + } + ++hourFieldLength; + } else if (c == LOW_A || c == LOW_B || c == CAP_B) { + if (dayPeriodChar == u'\0') { + dayPeriodChar = c; + dayPeriodStart = i; + } + ++dayPeriodLength; + } else { + if (hourMetachar != u'\0' && dayPeriodChar != u'\0') { + break; + } + } + } + + if (hourMetachar != u'\0') { + UErrorCode err = U_ZERO_ERROR; + char16_t hourChar = CAP_H; + UnicodeString convertedPattern = DateFormat::getBestPattern(fLocale, UnicodeString(hourMetachar), err); + + if (U_SUCCESS(err)) { + // strip literal text from the pattern (so literal characters don't get mistaken for pattern + // characters-- such as the 'h' in 'Uhr' in Germam) + int32_t firstQuotePos; + while ((firstQuotePos = convertedPattern.indexOf(u'\'')) != -1) { + int32_t secondQuotePos = convertedPattern.indexOf(u'\'', firstQuotePos + 1); + if (secondQuotePos == -1) { + secondQuotePos = firstQuotePos; + } + convertedPattern.replace(firstQuotePos, (secondQuotePos - firstQuotePos) + 1, UnicodeString()); + } + + if (convertedPattern.indexOf(LOW_H) != -1) { + hourChar = LOW_H; + } else if (convertedPattern.indexOf(CAP_K) != -1) { + hourChar = CAP_K; + } else if (convertedPattern.indexOf(LOW_K) != -1) { + hourChar = LOW_K; + } + + if (convertedPattern.indexOf(LOW_B) != -1) { + dayPeriodChar = LOW_B; + } else if (convertedPattern.indexOf(CAP_B) != -1) { + dayPeriodChar = CAP_B; + } else if (dayPeriodChar == u'\0') { + dayPeriodChar = LOW_A; + } + } + + UnicodeString hourAndDayPeriod(hourChar); + if (hourChar != CAP_H && hourChar != LOW_K) { + int32_t newDayPeriodLength = 0; + if (dayPeriodLength >= 5 || hourFieldLength >= 5) { + newDayPeriodLength = 5; + } else if (dayPeriodLength >= 3 || hourFieldLength >= 3) { + newDayPeriodLength = 3; + } else { + newDayPeriodLength = 1; + } + for (int32_t i = 0; i < newDayPeriodLength; i++) { + hourAndDayPeriod.append(dayPeriodChar); + } + } + result.replace(hourFieldStart, hourFieldLength, hourAndDayPeriod); + if (dayPeriodStart > hourFieldStart) { + // before deleting the original day period field, adjust its position in case + // we just changed the size of the hour field (and new day period field) + dayPeriodStart += hourAndDayPeriod.length() - hourFieldLength; + } + result.remove(dayPeriodStart, dayPeriodLength); + } + return result; +} + + void U_EXPORT2 DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, UnicodeString& dateSkeleton, @@ -889,83 +1063,80 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, int32_t dCount = 0; int32_t MCount = 0; int32_t yCount = 0; - int32_t hCount = 0; - int32_t HCount = 0; int32_t mCount = 0; int32_t vCount = 0; int32_t zCount = 0; + char16_t hourChar = u'\0'; int32_t i; for (i = 0; i < skeleton.length(); ++i) { - UChar ch = skeleton[i]; + char16_t ch = skeleton[i]; switch ( ch ) { - case dtitv_impl_CAP_E: + case CAP_E: dateSkeleton.append(ch); ++ECount; break; - case dtitv_impl_LOW_D: + case LOW_D: dateSkeleton.append(ch); ++dCount; break; - case dtitv_impl_CAP_M: + case CAP_M: dateSkeleton.append(ch); ++MCount; break; - case dtitv_impl_LOW_Y: + case LOW_Y: dateSkeleton.append(ch); ++yCount; break; - case dtitv_impl_CAP_G: - case dtitv_impl_CAP_Y: - case dtitv_impl_LOW_U: - case dtitv_impl_CAP_Q: - case dtitv_impl_LOW_Q: - case dtitv_impl_CAP_L: - case dtitv_impl_LOW_L: - case dtitv_impl_CAP_W: - case dtitv_impl_LOW_W: - case dtitv_impl_CAP_D: - case dtitv_impl_CAP_F: - case dtitv_impl_LOW_G: - case dtitv_impl_LOW_E: - case dtitv_impl_LOW_C: - case dtitv_impl_CAP_U: - case dtitv_impl_LOW_R: + case CAP_G: + case CAP_Y: + case LOW_U: + case CAP_Q: + case LOW_Q: + case CAP_L: + case LOW_L: + case CAP_W: + case LOW_W: + case CAP_D: + case CAP_F: + case LOW_G: + case LOW_E: + case LOW_C: + case CAP_U: + case LOW_R: normalizedDateSkeleton.append(ch); dateSkeleton.append(ch); break; - case dtitv_impl_LOW_A: - // 'a' is implicitly handled + case LOW_H: + case CAP_H: + case LOW_K: + case CAP_K: timeSkeleton.append(ch); + if (hourChar == u'\0') { + hourChar = ch; + } break; - case dtitv_impl_LOW_H: - timeSkeleton.append(ch); - ++hCount; - break; - case dtitv_impl_CAP_H: - timeSkeleton.append(ch); - ++HCount; - break; - case dtitv_impl_LOW_M: + case LOW_M: timeSkeleton.append(ch); ++mCount; break; - case dtitv_impl_LOW_Z: + case LOW_Z: ++zCount; timeSkeleton.append(ch); break; - case dtitv_impl_LOW_V: + case LOW_V: ++vCount; timeSkeleton.append(ch); break; - case dtitv_impl_CAP_V: - case dtitv_impl_CAP_Z: - case dtitv_impl_LOW_K: - case dtitv_impl_CAP_K: - case dtitv_impl_LOW_J: - case dtitv_impl_LOW_S: - case dtitv_impl_CAP_S: - case dtitv_impl_CAP_A: + case LOW_A: + case CAP_V: + case CAP_Z: + case LOW_J: + case LOW_S: + case CAP_S: + case CAP_A: + case LOW_B: + case CAP_B: timeSkeleton.append(ch); normalizedTimeSkeleton.append(ch); break; @@ -975,46 +1146,43 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, /* generate normalized form for date*/ if ( yCount != 0 ) { for (i = 0; i < yCount; ++i) { - normalizedDateSkeleton.append(dtitv_impl_LOW_Y); + normalizedDateSkeleton.append(LOW_Y); } } if ( MCount != 0 ) { if ( MCount < 3 ) { - normalizedDateSkeleton.append(dtitv_impl_CAP_M); + normalizedDateSkeleton.append(CAP_M); } else { - for ( int32_t j = 0; j < MCount && j < dtitv_impl_MAX_M_COUNT; ++j) { - normalizedDateSkeleton.append(dtitv_impl_CAP_M); + for ( int32_t j = 0; j < MCount && j < MAX_M_COUNT; ++j) { + normalizedDateSkeleton.append(CAP_M); } } } if ( ECount != 0 ) { if ( ECount <= 3 ) { - normalizedDateSkeleton.append(dtitv_impl_CAP_E); + normalizedDateSkeleton.append(CAP_E); } else { - for ( int32_t j = 0; j < ECount && j < dtitv_impl_MAX_E_COUNT; ++j ) { - normalizedDateSkeleton.append(dtitv_impl_CAP_E); + for ( int32_t j = 0; j < ECount && j < MAX_E_COUNT; ++j ) { + normalizedDateSkeleton.append(CAP_E); } } } if ( dCount != 0 ) { - normalizedDateSkeleton.append(dtitv_impl_LOW_D); + normalizedDateSkeleton.append(LOW_D); } /* generate normalized form for time */ - if ( HCount != 0 ) { - normalizedTimeSkeleton.append(dtitv_impl_CAP_H); - } - else if ( hCount != 0 ) { - normalizedTimeSkeleton.append(dtitv_impl_LOW_H); + if ( hourChar != u'\0' ) { + normalizedTimeSkeleton.append(hourChar); } if ( mCount != 0 ) { - normalizedTimeSkeleton.append(dtitv_impl_LOW_M); + normalizedTimeSkeleton.append(LOW_M); } if ( zCount != 0 ) { - normalizedTimeSkeleton.append(dtitv_impl_LOW_Z); + normalizedTimeSkeleton.append(LOW_Z); } if ( vCount != 0 ) { - normalizedTimeSkeleton.append(dtitv_impl_LOW_V); + normalizedTimeSkeleton.append(LOW_V); } } @@ -1039,8 +1207,8 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton, * @param dateSkeleton normalized date skeleton * @param timeSkeleton normalized time skeleton * @return whether the resource is found for the skeleton. - * TRUE if interval pattern found for the skeleton, - * FALSE otherwise. + * true if interval pattern found for the skeleton, + * false otherwise. * @stable ICU 4.0 */ UBool @@ -1071,16 +1239,16 @@ DateIntervalFormat::setSeparateDateTimePtn( int8_t differenceInfo = 0; const UnicodeString* bestSkeleton = fInfo->getBestSkeleton(*skeleton, differenceInfo); - /* best skeleton could be NULL. + /* best skeleton could be nullptr. For example: in "ca" resource file, interval format is defined as following intervalFormats{ fallback{"{0} - {1}"} } there is no skeletons/interval patterns defined, - and the best skeleton match could be NULL + and the best skeleton match could be nullptr */ - if ( bestSkeleton == NULL ) { + if ( bestSkeleton == nullptr ) { return false; } @@ -1091,11 +1259,13 @@ DateIntervalFormat::setSeparateDateTimePtn( status = U_ZERO_ERROR; fDatePattern = new UnicodeString(DateFormat::getBestPattern( fLocale, dateSkeleton, status)); + // no way to report OOM. :( } if ( timeSkeleton.length() != 0) { status = U_ZERO_ERROR; fTimePattern = new UnicodeString(DateFormat::getBestPattern( fLocale, timeSkeleton, status)); + // no way to report OOM. :( } // difference: @@ -1151,7 +1321,7 @@ DateIntervalFormat::setFallbackPattern(UCalendarDateFields field, if ( U_FAILURE(status) ) { return; } - setPatternInfo(field, NULL, &pattern, fInfo->getDefaultOrder()); + setPatternInfo(field, nullptr, &pattern, fInfo->getDefaultOrder()); } @@ -1198,16 +1368,16 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field, const UnicodeString* pattern = &intervalPattern; UBool order = laterDateFirst; // check for "latestFirst:" or "earliestFirst:" prefix - int8_t prefixLength = UPRV_LENGTHOF(dtitvfmt_gLaterFirstPrefix); - int8_t earliestFirstLength = UPRV_LENGTHOF(dtitvfmt_gEarlierFirstPrefix); + int8_t prefixLength = UPRV_LENGTHOF(gLaterFirstPrefix); + int8_t earliestFirstLength = UPRV_LENGTHOF(gEarlierFirstPrefix); UnicodeString realPattern; - if ( intervalPattern.startsWith(dtitvfmt_gLaterFirstPrefix, prefixLength) ) { + if ( intervalPattern.startsWith(gLaterFirstPrefix, prefixLength) ) { order = true; intervalPattern.extract(prefixLength, intervalPattern.length() - prefixLength, realPattern); pattern = &realPattern; - } else if ( intervalPattern.startsWith(dtitvfmt_gEarlierFirstPrefix, + } else if ( intervalPattern.startsWith(gEarlierFirstPrefix, earliestFirstLength) ) { order = false; intervalPattern.extract(earliestFirstLength, @@ -1250,8 +1420,8 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field, * @param extendedBestSkeleton extended best match skeleton * @return whether the interval pattern is found * through extending skeleton or not. - * TRUE if interval pattern is found by - * extending skeleton, FALSE otherwise. + * true if interval pattern is found by + * extending skeleton, false otherwise. * @stable ICU 4.0 */ UBool @@ -1279,7 +1449,11 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field, if ( field == UCAL_AM_PM ) { fInfo->getIntervalPattern(*bestSkeleton, UCAL_HOUR, pattern,status); if ( !pattern.isEmpty() ) { - setIntervalPattern(field, pattern); + UBool suppressDayPeriodField = fSkeleton.indexOf(CAP_J) != -1; + UnicodeString adjustIntervalPattern; + adjustFieldWidth(*skeleton, *bestSkeleton, pattern, differenceInfo, + suppressDayPeriodField, adjustIntervalPattern); + setIntervalPattern(field, adjustIntervalPattern); } return false; } @@ -1289,7 +1463,7 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field, // need to look for it from skeleton 'yMMMd', // if found, adjust field width in interval pattern from // "MMM" to "MMMM". - UChar fieldLetter = fgCalendarFieldToPatternLetter[field]; + char16_t fieldLetter = fgCalendarFieldToPatternLetter[field]; if ( extendedSkeleton ) { *extendedSkeleton = *skeleton; *extendedBestSkeleton = *bestSkeleton; @@ -1311,19 +1485,20 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field, } } if ( !pattern.isEmpty() ) { - if ( differenceInfo != 0 ) { + UBool suppressDayPeriodField = fSkeleton.indexOf(CAP_J) != -1; + if ( differenceInfo != 0 || suppressDayPeriodField) { UnicodeString adjustIntervalPattern; adjustFieldWidth(*skeleton, *bestSkeleton, pattern, differenceInfo, - adjustIntervalPattern); + suppressDayPeriodField, adjustIntervalPattern); setIntervalPattern(field, adjustIntervalPattern); } else { setIntervalPattern(field, pattern); } if ( extendedSkeleton && !extendedSkeleton->isEmpty() ) { - return TRUE; + return true; } } - return FALSE; + return false; } @@ -1331,7 +1506,7 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field, int32_t U_EXPORT2 DateIntervalFormat::splitPatternInto2Part(const UnicodeString& intervalPattern) { UBool inQuote = false; - UChar prevCh = 0; + char16_t prevCh = 0; int32_t count = 0; /* repeatedPattern used to record whether a pattern has already seen. @@ -1359,13 +1534,13 @@ DateIntervalFormat::splitPatternInto2Part(const UnicodeString& intervalPattern) int32_t i; UBool foundRepetition = false; for (i = 0; i < intervalPattern.length(); ++i) { - UChar ch = intervalPattern.charAt(i); + char16_t ch = intervalPattern.charAt(i); if (ch != prevCh && count > 0) { // check the repeativeness of pattern letter UBool repeated = patternRepeated[(int)(prevCh - PATTERN_CHAR_BASE)]; - if ( repeated == FALSE ) { - patternRepeated[prevCh - PATTERN_CHAR_BASE] = TRUE; + if ( repeated == false ) { + patternRepeated[prevCh - PATTERN_CHAR_BASE] = true; } else { foundRepetition = true; break; @@ -1393,14 +1568,15 @@ DateIntervalFormat::splitPatternInto2Part(const UnicodeString& intervalPattern) // "dd MM" ( no repetition ), // "d-d"(last char repeated ), and // "d-d MM" ( repetition found ) - if ( count > 0 && foundRepetition == FALSE ) { - if ( patternRepeated[(int)(prevCh - PATTERN_CHAR_BASE)] == FALSE ) { + if ( count > 0 && foundRepetition == false ) { + if ( patternRepeated[(int)(prevCh - PATTERN_CHAR_BASE)] == false ) { count = 0; } } return (i - count); } +// The following is only called from fallbackFormat, i.e. within the gFormatterMutex lock void DateIntervalFormat::fallbackFormatRange( Calendar& fromCalendar, Calendar& toCalendar, @@ -1417,12 +1593,15 @@ void DateIntervalFormat::fallbackFormatRange( int32_t offsets[2]; UnicodeString patternBody = sf.getTextWithNoArguments(offsets, 2); + UErrorCode tempStatus = U_ZERO_ERROR; // for setContext, ignored // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available. if (offsets[0] < offsets[1]) { firstIndex = 0; appendTo.append(patternBody.tempSubStringBetween(0, offsets[0])); fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1])); + // No capitalization for second part of interval + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(toCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1])); } else { @@ -1430,11 +1609,14 @@ void DateIntervalFormat::fallbackFormatRange( appendTo.append(patternBody.tempSubStringBetween(0, offsets[1])); fDateFormat->_format(toCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0])); + // No capitalization for second part of interval + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0])); } } +// The following is only called from formatImpl, i.e. within the gFormatterMutex lock UnicodeString& DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, Calendar& toCalendar, @@ -1459,6 +1641,7 @@ DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, UnicodeString fullPattern; // for saving the pattern in fDateFormat fDateFormat->toPattern(fullPattern); // save current pattern, restore later + UErrorCode tempStatus = U_ZERO_ERROR; // for setContext, ignored // {0} is time range // {1} is single date portion // TODO(ICU-20406): Use SimpleFormatter Iterator interface when available. @@ -1468,6 +1651,8 @@ DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0], offsets[1])); fDateFormat->applyPattern(*fDatePattern); + // No capitalization for second portion + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1])); } else { @@ -1476,6 +1661,8 @@ DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, fDateFormat->_format(fromCalendar, appendTo, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[1], offsets[0])); fDateFormat->applyPattern(*fTimePattern); + // No capitalization for second portion + fDateFormat->setContext(UDISPCTX_CAPITALIZATION_NONE, tempStatus); fallbackFormatRange(fromCalendar, toCalendar, appendTo, firstIndex, fphandler, status); appendTo.append(patternBody.tempSubStringBetween(offsets[0])); } @@ -1495,8 +1682,8 @@ UBool U_EXPORT2 DateIntervalFormat::fieldExistsInSkeleton(UCalendarDateFields field, const UnicodeString& skeleton) { - const UChar fieldChar = fgCalendarFieldToPatternLetter[field]; - return ( (skeleton.indexOf(fieldChar) == -1)?FALSE:TRUE ) ; + const char16_t fieldChar = fgCalendarFieldToPatternLetter[field]; + return ( (skeleton.indexOf(fieldChar) == -1)?false:true ) ; } @@ -1506,6 +1693,7 @@ DateIntervalFormat::adjustFieldWidth(const UnicodeString& inputSkeleton, const UnicodeString& bestMatchSkeleton, const UnicodeString& bestIntervalPattern, int8_t differenceInfo, + UBool suppressDayPeriodField, UnicodeString& adjustedPtn) { adjustedPtn = bestIntervalPattern; int32_t inputSkeletonFieldWidth[] = @@ -1532,32 +1720,59 @@ DateIntervalFormat::adjustFieldWidth(const UnicodeString& inputSkeleton, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + const int8_t PATTERN_CHAR_BASE = 0x41; + DateIntervalInfo::parseSkeleton(inputSkeleton, inputSkeletonFieldWidth); DateIntervalInfo::parseSkeleton(bestMatchSkeleton, bestMatchSkeletonFieldWidth); - if ( differenceInfo == 2 ) { - adjustedPtn.findAndReplace(UnicodeString((UChar)0x76 /* v */), - UnicodeString((UChar)0x7a /* z */)); + if (suppressDayPeriodField) { + // remove the 'a' and any NBSP/NNBSP on one side of it + findReplaceInPattern(adjustedPtn, UnicodeString(u"\u00A0a",-1), UnicodeString()); + findReplaceInPattern(adjustedPtn, UnicodeString(u"\u202Fa",-1), UnicodeString()); + findReplaceInPattern(adjustedPtn, UnicodeString(u"a\u00A0",-1), UnicodeString()); + findReplaceInPattern(adjustedPtn, UnicodeString(u"a\u202F",-1), UnicodeString()); + findReplaceInPattern(adjustedPtn, UnicodeString(LOW_A), UnicodeString()); + // adjust interior double spaces, remove exterior whitespace + findReplaceInPattern(adjustedPtn, UnicodeString(" "), UnicodeString(" ")); + adjustedPtn.trim(); } + if ( differenceInfo == 2 ) { + if (inputSkeleton.indexOf(LOW_Z) != -1) { + findReplaceInPattern(adjustedPtn, UnicodeString(LOW_V), UnicodeString(LOW_Z)); + } + if (inputSkeleton.indexOf(CAP_K) != -1) { + findReplaceInPattern(adjustedPtn, UnicodeString(LOW_H), UnicodeString(CAP_K)); + } + if (inputSkeleton.indexOf(LOW_K) != -1) { + findReplaceInPattern(adjustedPtn, UnicodeString(CAP_H), UnicodeString(LOW_K)); + } + if (inputSkeleton.indexOf(LOW_B) != -1) { + findReplaceInPattern(adjustedPtn, UnicodeString(LOW_A), UnicodeString(LOW_B)); + } + } + if (adjustedPtn.indexOf(LOW_A) != -1 && bestMatchSkeletonFieldWidth[LOW_A - PATTERN_CHAR_BASE] == 0) { + bestMatchSkeletonFieldWidth[LOW_A - PATTERN_CHAR_BASE] = 1; + } + if (adjustedPtn.indexOf(LOW_B) != -1 && bestMatchSkeletonFieldWidth[LOW_B - PATTERN_CHAR_BASE] == 0) { + bestMatchSkeletonFieldWidth[LOW_B - PATTERN_CHAR_BASE] = 1; + } UBool inQuote = false; - UChar prevCh = 0; + char16_t prevCh = 0; int32_t count = 0; - const int8_t PATTERN_CHAR_BASE = 0x41; - // loop through the pattern string character by character int32_t adjustedPtnLength = adjustedPtn.length(); int32_t i; for (i = 0; i < adjustedPtnLength; ++i) { - UChar ch = adjustedPtn.charAt(i); + char16_t ch = adjustedPtn.charAt(i); if (ch != prevCh && count > 0) { // check the repeativeness of pattern letter - UChar skeletonChar = prevCh; - if ( skeletonChar == dtitv_impl_CAP_L ) { + char16_t skeletonChar = prevCh; + if ( skeletonChar == CAP_L ) { // there is no "L" (always be "M") in skeleton, // but there is "L" in pattern. // for skeleton "M+", the pattern might be "...L..." - skeletonChar = dtitv_impl_CAP_M; + skeletonChar = CAP_M; } int32_t fieldCount = bestMatchSkeletonFieldWidth[(int)(skeletonChar - PATTERN_CHAR_BASE)]; int32_t inputFieldCount = inputSkeletonFieldWidth[(int)(skeletonChar - PATTERN_CHAR_BASE)]; @@ -1591,12 +1806,12 @@ DateIntervalFormat::adjustFieldWidth(const UnicodeString& inputSkeleton, if ( count > 0 ) { // last item // check the repeativeness of pattern letter - UChar skeletonChar = prevCh; - if ( skeletonChar == dtitv_impl_CAP_L ) { + char16_t skeletonChar = prevCh; + if ( skeletonChar == CAP_L ) { // there is no "L" (always be "M") in skeleton, // but there is "L" in pattern. // for skeleton "M+", the pattern might be "...L..." - skeletonChar = dtitv_impl_CAP_M; + skeletonChar = CAP_M; } int32_t fieldCount = bestMatchSkeletonFieldWidth[(int)(skeletonChar - PATTERN_CHAR_BASE)]; int32_t inputFieldCount = inputSkeletonFieldWidth[(int)(skeletonChar - PATTERN_CHAR_BASE)]; @@ -1610,6 +1825,39 @@ DateIntervalFormat::adjustFieldWidth(const UnicodeString& inputSkeleton, } } +void +DateIntervalFormat::findReplaceInPattern(UnicodeString& targetString, + const UnicodeString& strToReplace, + const UnicodeString& strToReplaceWith) { + int32_t firstQuoteIndex = targetString.indexOf(u'\''); + if (firstQuoteIndex == -1) { + targetString.findAndReplace(strToReplace, strToReplaceWith); + } else { + UnicodeString result; + UnicodeString source = targetString; + + while (firstQuoteIndex >= 0) { + int32_t secondQuoteIndex = source.indexOf(u'\'', firstQuoteIndex + 1); + if (secondQuoteIndex == -1) { + secondQuoteIndex = source.length() - 1; + } + + UnicodeString unquotedText(source, 0, firstQuoteIndex); + UnicodeString quotedText(source, firstQuoteIndex, secondQuoteIndex - firstQuoteIndex + 1); + + unquotedText.findAndReplace(strToReplace, strToReplaceWith); + result += unquotedText; + result += quotedText; + + source.remove(0, secondQuoteIndex + 1); + firstQuoteIndex = source.indexOf(u'\''); + } + source.findAndReplace(strToReplace, strToReplaceWith); + result += source; + targetString = result; + } +} + void @@ -1641,17 +1889,17 @@ DateIntervalFormat::concatSingleDate2TimeInterval(UnicodeString& format, -const UChar +const char16_t DateIntervalFormat::fgCalendarFieldToPatternLetter[] = { - /*GyM*/ dtitv_impl_CAP_G, dtitv_impl_LOW_Y, dtitv_impl_CAP_M, - /*wWd*/ dtitv_impl_LOW_W, dtitv_impl_CAP_W, dtitv_impl_LOW_D, - /*DEF*/ dtitv_impl_CAP_D, dtitv_impl_CAP_E, dtitv_impl_CAP_F, - /*ahH*/ dtitv_impl_LOW_A, dtitv_impl_LOW_H, dtitv_impl_CAP_H, - /*msS*/ dtitv_impl_LOW_M, dtitv_impl_LOW_S, dtitv_impl_CAP_S, // MINUTE, SECOND, MILLISECOND - /*z.Y*/ dtitv_impl_LOW_Z, dtitv_impl_SPACE, dtitv_impl_CAP_Y, // ZONE_OFFSET, DST_OFFSET, YEAR_WOY, - /*eug*/ dtitv_impl_LOW_E, dtitv_impl_LOW_U, dtitv_impl_LOW_G, // DOW_LOCAL, EXTENDED_YEAR, JULIAN_DAY, - /*A..*/ dtitv_impl_CAP_A, dtitv_impl_SPACE, dtitv_impl_SPACE, // MILLISECONDS_IN_DAY, IS_LEAP_MONTH, FIELD_COUNT + /*GyM*/ CAP_G, LOW_Y, CAP_M, + /*wWd*/ LOW_W, CAP_W, LOW_D, + /*DEF*/ CAP_D, CAP_E, CAP_F, + /*ahH*/ LOW_A, LOW_H, CAP_H, + /*msS*/ LOW_M, LOW_S, CAP_S, // MINUTE, SECOND, MILLISECOND + /*z.Y*/ LOW_Z, SPACE, CAP_Y, // ZONE_OFFSET, DST_OFFSET, YEAR_WOY, + /*eug*/ LOW_E, LOW_U, LOW_G, // DOW_LOCAL, EXTENDED_YEAR, JULIAN_DAY, + /*A..*/ CAP_A, SPACE, SPACE, // MILLISECONDS_IN_DAY, IS_LEAP_MONTH, FIELD_COUNT }; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp index eb15ef650..c4b6bbcf4 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp @@ -23,6 +23,7 @@ #include #endif +#include "bytesinkutil.h" #include "cmemory.h" #include "cstring.h" #include "unicode/msgfmt.h" @@ -35,6 +36,7 @@ #include "uresimp.h" #include "hash.h" #include "gregoimp.h" +#include "ulocimp.h" #include "uresimp.h" @@ -49,24 +51,23 @@ U_NAMESPACE_BEGIN UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateIntervalInfo) -static const char dtitvinf_gCalendarTag[]="calendar"; -static const char dtitvinf_gGenericTag[]="generic"; -static const char dtitvinf_gGregorianTag[]="gregorian"; -static const char dtitvinf_gIntervalDateTimePatternTag[]="intervalFormats"; -static const char dtitvinf_gFallbackPatternTag[]="fallback"; +static const char gCalendarTag[]="calendar"; +static const char gGregorianTag[]="gregorian"; +static const char gIntervalDateTimePatternTag[]="intervalFormats"; +static const char gFallbackPatternTag[]="fallback"; // {0} -static const UChar dtitvinf_gFirstPattern[] = {dtitv_impl_LEFT_CURLY_BRACKET, dtitv_impl_DIGIT_ZERO, dtitv_impl_RIGHT_CURLY_BRACKET}; +static const char16_t gFirstPattern[] = {LEFT_CURLY_BRACKET, DIGIT_ZERO, RIGHT_CURLY_BRACKET}; // {1} -static const UChar dtitvinf_gSecondPattern[] = {dtitv_impl_LEFT_CURLY_BRACKET, dtitv_impl_DIGIT_ONE, dtitv_impl_RIGHT_CURLY_BRACKET}; +static const char16_t gSecondPattern[] = {LEFT_CURLY_BRACKET, DIGIT_ONE, RIGHT_CURLY_BRACKET}; // default fall-back -static const UChar dtitvinf_gDefaultFallbackPattern[] = {dtitv_impl_LEFT_CURLY_BRACKET, dtitv_impl_DIGIT_ZERO, dtitv_impl_RIGHT_CURLY_BRACKET, dtitv_impl_SPACE, dtitv_impl_EN_DASH, dtitv_impl_SPACE, dtitv_impl_LEFT_CURLY_BRACKET, dtitv_impl_DIGIT_ONE, dtitv_impl_RIGHT_CURLY_BRACKET, 0}; +static const char16_t gDefaultFallbackPattern[] = {LEFT_CURLY_BRACKET, DIGIT_ZERO, RIGHT_CURLY_BRACKET, SPACE, EN_DASH, SPACE, LEFT_CURLY_BRACKET, DIGIT_ONE, RIGHT_CURLY_BRACKET, 0}; DateIntervalInfo::DateIntervalInfo(UErrorCode& status) -: fFallbackIntervalPattern(dtitvinf_gDefaultFallbackPattern), +: fFallbackIntervalPattern(gDefaultFallbackPattern), fFirstDateInPtnIsLaterDate(false), - fIntervalPatterns(NULL) + fIntervalPatterns(nullptr) { fIntervalPatterns = initHash(status); } @@ -74,9 +75,9 @@ DateIntervalInfo::DateIntervalInfo(UErrorCode& status) DateIntervalInfo::DateIntervalInfo(const Locale& locale, UErrorCode& status) -: fFallbackIntervalPattern(dtitvinf_gDefaultFallbackPattern), +: fFallbackIntervalPattern(gDefaultFallbackPattern), fFirstDateInPtnIsLaterDate(false), - fIntervalPatterns(NULL) + fIntervalPatterns(nullptr) { initializeData(locale, status); } @@ -108,10 +109,10 @@ DateIntervalInfo::setFallbackIntervalPattern( if ( U_FAILURE(status) ) { return; } - int32_t firstPatternIndex = fallbackPattern.indexOf(dtitvinf_gFirstPattern, - UPRV_LENGTHOF(dtitvinf_gFirstPattern), 0); - int32_t secondPatternIndex = fallbackPattern.indexOf(dtitvinf_gSecondPattern, - UPRV_LENGTHOF(dtitvinf_gSecondPattern), 0); + int32_t firstPatternIndex = fallbackPattern.indexOf(gFirstPattern, + UPRV_LENGTHOF(gFirstPattern), 0); + int32_t secondPatternIndex = fallbackPattern.indexOf(gSecondPattern, + UPRV_LENGTHOF(gSecondPattern), 0); if ( firstPatternIndex == -1 || secondPatternIndex == -1 ) { status = U_ILLEGAL_ARGUMENT_ERROR; return; @@ -126,7 +127,7 @@ DateIntervalInfo::setFallbackIntervalPattern( DateIntervalInfo::DateIntervalInfo(const DateIntervalInfo& dtitvinf) : UObject(dtitvinf), - fIntervalPatterns(NULL) + fIntervalPatterns(nullptr) { *this = dtitvinf; } @@ -161,17 +162,17 @@ DateIntervalInfo::clone() const { DateIntervalInfo::~DateIntervalInfo() { deleteHash(fIntervalPatterns); - fIntervalPatterns = NULL; + fIntervalPatterns = nullptr; } bool DateIntervalInfo::operator==(const DateIntervalInfo& other) const { - UBool equal = ( + bool equal = ( fFallbackIntervalPattern == other.fFallbackIntervalPattern && fFirstDateInPtnIsLaterDate == other.fFirstDateInPtnIsLaterDate ); - if ( equal == TRUE ) { + if ( equal ) { equal = fIntervalPatterns->equals(*(other.fIntervalPatterns)); } @@ -189,7 +190,7 @@ DateIntervalInfo::getIntervalPattern(const UnicodeString& skeleton, } const UnicodeString* patternsOfOneSkeleton = (UnicodeString*) fIntervalPatterns->get(skeleton); - if ( patternsOfOneSkeleton != NULL ) { + if ( patternsOfOneSkeleton != nullptr ) { IntervalPatternIndex index = calendarFieldToIntervalIndex(field, status); if ( U_FAILURE(status) ) { return result; @@ -219,11 +220,11 @@ DateIntervalInfo::getFallbackIntervalPattern(UnicodeString& result) const { static const int32_t PATH_PREFIX_LENGTH = 17; -static const UChar PATH_PREFIX[] = {dtitv_impl_SOLIDUS, dtitv_impl_CAP_L, dtitv_impl_CAP_O, dtitv_impl_CAP_C, dtitv_impl_CAP_A, dtitv_impl_CAP_L, dtitv_impl_CAP_E, dtitv_impl_SOLIDUS, - dtitv_impl_LOW_C, dtitv_impl_LOW_A, dtitv_impl_LOW_L, dtitv_impl_LOW_E, dtitv_impl_LOW_N, dtitv_impl_LOW_D, dtitv_impl_LOW_A, dtitv_impl_LOW_R, dtitv_impl_SOLIDUS}; +static const char16_t PATH_PREFIX[] = {SOLIDUS, CAP_L, CAP_O, CAP_C, CAP_A, CAP_L, CAP_E, SOLIDUS, + LOW_C, LOW_A, LOW_L, LOW_E, LOW_N, LOW_D, LOW_A, LOW_R, SOLIDUS}; static const int32_t PATH_SUFFIX_LENGTH = 16; -static const UChar PATH_SUFFIX[] = {dtitv_impl_SOLIDUS, dtitv_impl_LOW_I, dtitv_impl_LOW_N, dtitv_impl_LOW_T, dtitv_impl_LOW_E, dtitv_impl_LOW_R, dtitv_impl_LOW_V, dtitv_impl_LOW_A, - dtitv_impl_LOW_L, dtitv_impl_CAP_F, dtitv_impl_LOW_O, dtitv_impl_LOW_R, dtitv_impl_LOW_M, dtitv_impl_LOW_A, dtitv_impl_LOW_T, dtitv_impl_LOW_S}; +static const char16_t PATH_SUFFIX[] = {SOLIDUS, LOW_I, LOW_N, LOW_T, LOW_E, LOW_R, LOW_V, LOW_A, + LOW_L, CAP_F, LOW_O, LOW_R, LOW_M, LOW_A, LOW_T, LOW_S}; /** * Sink for enumerating all of the date interval skeletons. @@ -240,14 +241,14 @@ struct DateIntervalInfo::DateIntervalSink : public ResourceSink { : dateIntervalInfo(diInfo), nextCalendarType(currentCalendarType, -1, US_INV) { } virtual ~DateIntervalSink(); - virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &errorCode) { + virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &errorCode) override { if (U_FAILURE(errorCode)) { return; } // Iterate over all the calendar entries and only pick the 'intervalFormats' table. ResourceTable dateIntervalData = value.getTable(errorCode); if (U_FAILURE(errorCode)) { return; } for (int32_t i = 0; dateIntervalData.getKeyAndValue(i, key, value); i++) { - if (uprv_strcmp(key, dtitvinf_gIntervalDateTimePatternTag) != 0) { + if (uprv_strcmp(key, gIntervalDateTimePatternTag) != 0) { continue; } @@ -339,6 +340,9 @@ struct DateIntervalInfo::DateIntervalSink : public ResourceSink { return UCAL_DATE; } else if (c0 == 'a') { return UCAL_AM_PM; + } else if (c0 == 'B') { + // TODO: Using AM/PM as a proxy for flexible day period isn't really correct, but it's close + return UCAL_AM_PM; } else if (c0 == 'h' || c0 == 'H') { return UCAL_HOUR; } else if (c0 == 'm') { @@ -363,7 +367,7 @@ struct DateIntervalInfo::DateIntervalSink : public ResourceSink { UnicodeString* patternsOfOneSkeleton = (UnicodeString*)(dateIntervalInfo.fIntervalPatterns->get(skeleton)); - if (patternsOfOneSkeleton == NULL || patternsOfOneSkeleton[index].isEmpty()) { + if (patternsOfOneSkeleton == nullptr || patternsOfOneSkeleton[index].isEmpty()) { UnicodeString pattern = value.getUnicodeString(errorCode); dateIntervalInfo.setIntervalPatternInternally(skeleton, lrgDiffCalUnit, pattern, errorCode); @@ -394,65 +398,50 @@ DateIntervalInfo::initializeData(const Locale& locale, UErrorCode& status) const char *locName = locale.getName(); // Get the correct calendar type - const char * calendarTypeToUse = dtitvinf_gGregorianTag; // initial default - char calendarType[ULOC_KEYWORDS_CAPACITY]; // to be filled in with the type to use, if all goes well + const char * calendarTypeToUse = gGregorianTag; // initial default char localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY]; // obtain a locale that always has the calendar key value that should be used - (void)ures_getFunctionalEquivalent(localeWithCalendarKey, ULOC_LOCALE_IDENTIFIER_CAPACITY, NULL, - "calendar", "calendar", locName, NULL, FALSE, &status); + (void)ures_getFunctionalEquivalent(localeWithCalendarKey, ULOC_LOCALE_IDENTIFIER_CAPACITY, nullptr, + "calendar", "calendar", locName, nullptr, false, &status); localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY-1] = 0; // ensure null termination // now get the calendar key value from that locale - int32_t calendarTypeLen = uloc_getKeywordValue(localeWithCalendarKey, "calendar", calendarType, - ULOC_KEYWORDS_CAPACITY, &status); - if (U_SUCCESS(status) && calendarTypeLen < ULOC_KEYWORDS_CAPACITY) { - calendarTypeToUse = calendarType; + CharString calendarType; + { + CharStringByteSink sink(&calendarType); + ulocimp_getKeywordValue(localeWithCalendarKey, "calendar", sink, &status); + } + if (U_SUCCESS(status)) { + calendarTypeToUse = calendarType.data(); } status = U_ZERO_ERROR; // Instantiate the resource bundles UResourceBundle *rb, *calBundle; - rb = ures_open(NULL, locName, &status); + rb = ures_open(nullptr, locName, &status); if (U_FAILURE(status)) { return; } - calBundle = ures_getByKeyWithFallback(rb, dtitvinf_gCalendarTag, NULL, &status); + calBundle = ures_getByKeyWithFallback(rb, gCalendarTag, nullptr, &status); if (U_SUCCESS(status)) { UResourceBundle *calTypeBundle, *itvDtPtnResource; // Get the fallback pattern - const UChar* resStr = nullptr; + const char16_t* resStr = nullptr; int32_t resStrLen = 0; - calTypeBundle = ures_getByKeyWithFallback(calBundle, calendarTypeToUse, NULL, &status); + calTypeBundle = ures_getByKeyWithFallback(calBundle, calendarTypeToUse, nullptr, &status); itvDtPtnResource = ures_getByKeyWithFallback(calTypeBundle, - dtitvinf_gIntervalDateTimePatternTag, NULL, &status); + gIntervalDateTimePatternTag, nullptr, &status); // TODO(ICU-20400): After the fixing, we should find the "fallback" from // the rb directly by the path "calendar/${calendar}/intervalFormats/fallback". if ( U_SUCCESS(status) ) { - resStr = ures_getStringByKeyWithFallback(itvDtPtnResource, dtitvinf_gFallbackPatternTag, + resStr = ures_getStringByKeyWithFallback(itvDtPtnResource, gFallbackPatternTag, &resStrLen, &status); - if ( U_FAILURE(status) ) { - // Try to find "fallback" from "generic" to work around the bug in - // ures_getByKeyWithFallback - UErrorCode localStatus = U_ZERO_ERROR; - UResourceBundle *genericCalBundle = - ures_getByKeyWithFallback(calBundle, dtitvinf_gGenericTag, NULL, &localStatus); - UResourceBundle *genericItvDtPtnResource = - ures_getByKeyWithFallback( - genericCalBundle, dtitvinf_gIntervalDateTimePatternTag, NULL, &localStatus); - resStr = ures_getStringByKeyWithFallback( - genericItvDtPtnResource, dtitvinf_gFallbackPatternTag, &resStrLen, &localStatus); - ures_close(genericItvDtPtnResource); - ures_close(genericCalBundle); - if ( U_SUCCESS(localStatus) ) { - status = U_USING_FALLBACK_WARNING;; - } - } } if ( U_SUCCESS(status) && (resStr != nullptr)) { - UnicodeString pattern = UnicodeString(TRUE, resStr, resStrLen); + UnicodeString pattern = UnicodeString(true, resStr, resStrLen); setFallbackIntervalPattern(pattern, status); } ures_close(itvDtPtnResource); @@ -464,7 +453,7 @@ DateIntervalInfo::initializeData(const Locale& locale, UErrorCode& status) const UnicodeString &calendarTypeToUseUString = sink.getNextCalendarType(); // Already loaded calendar types - Hashtable loadedCalendarTypes(FALSE, status); + Hashtable loadedCalendarTypes(false, status); if (U_SUCCESS(status)) { while (!calendarTypeToUseUString.isBogus()) { @@ -509,13 +498,17 @@ DateIntervalInfo::setIntervalPatternInternally(const UnicodeString& skeleton, } UnicodeString* patternsOfOneSkeleton = (UnicodeString*)(fIntervalPatterns->get(skeleton)); UBool emptyHash = false; - if ( patternsOfOneSkeleton == NULL ) { + if ( patternsOfOneSkeleton == nullptr ) { patternsOfOneSkeleton = new UnicodeString[kIPI_MAX_INDEX]; + if (patternsOfOneSkeleton == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } emptyHash = true; } patternsOfOneSkeleton[index] = intervalPattern; - if ( emptyHash == TRUE ) { + if ( emptyHash ) { fIntervalPatterns->put(skeleton, patternsOfOneSkeleton, status); } } @@ -558,7 +551,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, char result_1[1000]; char mesg[2000]; skeleton.extract(0, skeleton.length(), result, "UTF-8"); - sprintf(mesg, "in getBestSkeleton: skeleton: %s; \n", result); + snprintf(mesg, sizeof(mesg), "in getBestSkeleton: skeleton: %s; \n", result); PRINTMESG(mesg) #endif @@ -590,41 +583,44 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, const int32_t DIFFERENT_FIELD = 0x1000; const int32_t STRING_NUMERIC_DIFFERENCE = 0x100; const int32_t BASE = 0x41; - const UChar CHAR_V = 0x0076; - const UChar CHAR_Z = 0x007A; - // hack for 'v' and 'z'. - // resource bundle only have time skeletons ending with 'v', - // but not for time skeletons ending with 'z'. - UBool replaceZWithV = false; + // hack for certain alternate characters + // resource bundles only have time skeletons containing 'v', 'h', and 'H' + // but not time skeletons containing 'z', 'K', or 'k' + // the skeleton may also include 'a' or 'b', which never occur in the resource bundles, so strip them out too + UBool replacedAlternateChars = false; const UnicodeString* inputSkeleton = &skeleton; UnicodeString copySkeleton; - if ( skeleton.indexOf(CHAR_Z) != -1 ) { + if ( skeleton.indexOf(LOW_Z) != -1 || skeleton.indexOf(LOW_K) != -1 || skeleton.indexOf(CAP_K) != -1 || skeleton.indexOf(LOW_A) != -1 || skeleton.indexOf(LOW_B) != -1 ) { copySkeleton = skeleton; - copySkeleton.findAndReplace(UnicodeString(CHAR_Z), UnicodeString(CHAR_V)); + copySkeleton.findAndReplace(UnicodeString(LOW_Z), UnicodeString(LOW_V)); + copySkeleton.findAndReplace(UnicodeString(LOW_K), UnicodeString(CAP_H)); + copySkeleton.findAndReplace(UnicodeString(CAP_K), UnicodeString(LOW_H)); + copySkeleton.findAndReplace(UnicodeString(LOW_A), UnicodeString()); + copySkeleton.findAndReplace(UnicodeString(LOW_B), UnicodeString()); inputSkeleton = ©Skeleton; - replaceZWithV = true; + replacedAlternateChars = true; } parseSkeleton(*inputSkeleton, inputSkeletonFieldWidth); - int32_t bestDistance = dtitv_impl_MAX_POSITIVE_INT; - const UnicodeString* bestSkeleton = NULL; + int32_t bestDistance = MAX_POSITIVE_INT; + const UnicodeString* bestSkeleton = nullptr; // 0 means exact the same skeletons; // 1 means having the same field, but with different length, - // 2 means only z/v differs + // 2 means only z/v, h/K, or H/k differs // -1 means having different field. bestMatchDistanceInfo = 0; int8_t fieldLength = UPRV_LENGTHOF(skeletonFieldWidth); int32_t pos = UHASH_FIRST; - const UHashElement* elem = NULL; - while ( (elem = fIntervalPatterns->nextElement(pos)) != NULL ) { + const UHashElement* elem = nullptr; + while ( (elem = fIntervalPatterns->nextElement(pos)) != nullptr ) { const UHashTok keyTok = elem->key; UnicodeString* newSkeleton = (UnicodeString*)keyTok.pointer; #ifdef DTITVINF_DEBUG skeleton->extract(0, skeleton->length(), result, "UTF-8"); - sprintf(mesg, "available skeletons: skeleton: %s; \n", result); + snprintf(mesg, sizeof(mesg), "available skeletons: skeleton: %s; \n", result); PRINTMESG(mesg) #endif @@ -668,7 +664,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton, break; } } - if ( replaceZWithV && bestMatchDistanceInfo != -1 ) { + if ( replacedAlternateChars && bestMatchDistanceInfo != -1 ) { bestMatchDistanceInfo = 2; } return bestSkeleton; @@ -711,6 +707,9 @@ DateIntervalInfo::calendarFieldToIntervalIndex(UCalendarDateFields field, case UCAL_SECOND: index = kIPI_SECOND; break; + case UCAL_MILLISECOND: + index = kIPI_MILLISECOND; + break; default: status = U_ILLEGAL_ARGUMENT_ERROR; } @@ -722,12 +721,12 @@ DateIntervalInfo::calendarFieldToIntervalIndex(UCalendarDateFields field, void DateIntervalInfo::deleteHash(Hashtable* hTable) { - if ( hTable == NULL ) { + if ( hTable == nullptr ) { return; } int32_t pos = UHASH_FIRST; - const UHashElement* element = NULL; - while ( (element = hTable->nextElement(pos)) != NULL ) { + const UHashElement* element = nullptr; + while ( (element = hTable->nextElement(pos)) != nullptr ) { const UHashTok valueTok = element->value; const UnicodeString* value = (UnicodeString*)valueTok.pointer; delete[] value; @@ -743,7 +742,7 @@ U_CDECL_BEGIN * * @param val1 one value in comparison * @param val2 the other value in comparison - * @return TRUE if 2 values are the same, FALSE otherwise + * @return true if 2 values are the same, false otherwise */ static UBool U_CALLCONV dtitvinfHashTableValueComparator(UHashTok val1, UHashTok val2); @@ -751,9 +750,9 @@ static UBool U_CALLCONV dtitvinfHashTableValueComparator(UHashTok val1, UHashTok val2) { const UnicodeString* pattern1 = (UnicodeString*)val1.pointer; const UnicodeString* pattern2 = (UnicodeString*)val2.pointer; - UBool ret = TRUE; + UBool ret = true; int8_t i; - for ( i = 0; i < DateIntervalInfo::kMaxIntervalPatternIndex && ret == TRUE; ++i ) { + for ( i = 0; i < DateIntervalInfo::kMaxIntervalPatternIndex && ret ; ++i ) { ret = (pattern1[i] == pattern2[i]); } return ret; @@ -765,16 +764,16 @@ U_CDECL_END Hashtable* DateIntervalInfo::initHash(UErrorCode& status) { if ( U_FAILURE(status) ) { - return NULL; + return nullptr; } Hashtable* hTable; - if ( (hTable = new Hashtable(FALSE, status)) == NULL ) { + if ( (hTable = new Hashtable(false, status)) == nullptr ) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } if ( U_FAILURE(status) ) { delete hTable; - return NULL; + return nullptr; } hTable->setValueComparator(dtitvinfHashTableValueComparator); return hTable; @@ -789,14 +788,18 @@ DateIntervalInfo::copyHash(const Hashtable* source, return; } int32_t pos = UHASH_FIRST; - const UHashElement* element = NULL; + const UHashElement* element = nullptr; if ( source ) { - while ( (element = source->nextElement(pos)) != NULL ) { + while ( (element = source->nextElement(pos)) != nullptr ) { const UHashTok keyTok = element->key; const UnicodeString* key = (UnicodeString*)keyTok.pointer; const UHashTok valueTok = element->value; const UnicodeString* value = (UnicodeString*)valueTok.pointer; UnicodeString* copy = new UnicodeString[kIPI_MAX_INDEX]; + if (copy == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } int8_t i; for ( i = 0; i < kIPI_MAX_INDEX; ++i ) { copy[i] = value[i]; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp index 2f6d90bed..aa23b7cd4 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp @@ -29,6 +29,7 @@ #include "unicode/ustring.h" #include "unicode/rep.h" #include "unicode/region.h" +#include "bytesinkutil.h" #include "cpputils.h" #include "mutex.h" #include "umutex.h" @@ -37,7 +38,9 @@ #include "locbased.h" #include "hash.h" #include "uhash.h" +#include "ulocimp.h" #include "uresimp.h" +#include "ulocimp.h" #include "dtptngen_impl.h" #include "ucln_in.h" #include "charstr.h" @@ -58,7 +61,7 @@ #include "uarrsort.h" struct UResAEntry { - UChar *key; + char16_t *key; UResourceBundle *item; }; @@ -97,10 +100,10 @@ static void ures_a_open(UResourceBundleAIterator *aiter, UResourceBundle *bund, aiter->entries[i].item = ures_getByIndex(aiter->bund, i, nullptr, status); const char *akey = ures_getKey(aiter->entries[i].item); int32_t len = uprv_strlen(akey)+1; - aiter->entries[i].key = (UChar*)uprv_malloc(len*sizeof(UChar)); + aiter->entries[i].key = (char16_t*)uprv_malloc(len*sizeof(char16_t)); u_charsToUChars(akey, aiter->entries[i].key, len); } - uprv_sortArray(aiter->entries, aiter->num, sizeof(UResAEntry), ures_a_codepointSort, nullptr, TRUE, status); + uprv_sortArray(aiter->entries, aiter->num, sizeof(UResAEntry), ures_a_codepointSort, nullptr, true, status); #endif } @@ -113,13 +116,13 @@ static void ures_a_close(UResourceBundleAIterator *aiter) { #endif } -static const UChar *ures_a_getNextString(UResourceBundleAIterator *aiter, int32_t *len, const char **key, UErrorCode *err) { +static const char16_t *ures_a_getNextString(UResourceBundleAIterator *aiter, int32_t *len, const char **key, UErrorCode *err) { #if !defined(U_SORT_ASCII_BUNDLE_ITERATOR) return ures_getNextString(aiter->bund, len, key, err); #else if(U_FAILURE(*err)) return nullptr; UResourceBundle *item = aiter->entries[aiter->cursor].item; - const UChar* ret = ures_getString(item, len, err); + const char16_t* ret = ures_getString(item, len, err); *key = ures_getKey(item); aiter->cursor++; return ret; @@ -135,87 +138,87 @@ U_NAMESPACE_BEGIN // ***************************************************************************** // class DateTimePatternGenerator // ***************************************************************************** -static const UChar Canonical_Items[] = { +static const char16_t Canonical_Items[] = { // GyQMwWEDFdaHmsSv - dtptngen_CAP_G, dtptngen_LOW_Y, dtptngen_CAP_Q, dtptngen_CAP_M, dtptngen_LOW_W, dtptngen_CAP_W, dtptngen_CAP_E, - dtptngen_CAP_D, dtptngen_CAP_F, dtptngen_LOW_D, dtptngen_LOW_A, // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J - dtptngen_CAP_H, dtptngen_LOW_M, dtptngen_LOW_S, dtptngen_CAP_S, dtptngen_LOW_V, 0 + CAP_G, LOW_Y, CAP_Q, CAP_M, LOW_W, CAP_W, CAP_E, + CAP_D, CAP_F, LOW_D, LOW_A, // The UDATPG_x_FIELD constants and these fields have a different order than in ICU4J + CAP_H, LOW_M, LOW_S, CAP_S, LOW_V, 0 }; static const dtTypeElem dtTypes[] = { // patternChar, field, type, minLen, weight - {dtptngen_CAP_G, UDATPG_ERA_FIELD, dtptngen_DT_SHORT, 1, 3,}, - {dtptngen_CAP_G, UDATPG_ERA_FIELD, dtptngen_DT_LONG, 4, 0}, - {dtptngen_CAP_G, UDATPG_ERA_FIELD, dtptngen_DT_NARROW, 5, 0}, - - {dtptngen_LOW_Y, UDATPG_YEAR_FIELD, dtptngen_DT_NUMERIC, 1, 20}, - {dtptngen_CAP_Y, UDATPG_YEAR_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 20}, - {dtptngen_LOW_U, UDATPG_YEAR_FIELD, dtptngen_DT_NUMERIC + 2*dtptngen_DT_DELTA, 1, 20}, - {dtptngen_LOW_R, UDATPG_YEAR_FIELD, dtptngen_DT_NUMERIC + 3*dtptngen_DT_DELTA, 1, 20}, - {dtptngen_CAP_U, UDATPG_YEAR_FIELD, dtptngen_DT_SHORT, 1, 3}, - {dtptngen_CAP_U, UDATPG_YEAR_FIELD, dtptngen_DT_LONG, 4, 0}, - {dtptngen_CAP_U, UDATPG_YEAR_FIELD, dtptngen_DT_NARROW, 5, 0}, - - {dtptngen_CAP_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_NUMERIC, 1, 2}, - {dtptngen_CAP_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_SHORT, 3, 0}, - {dtptngen_CAP_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_LONG, 4, 0}, - {dtptngen_CAP_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_NARROW, 5, 0}, - {dtptngen_LOW_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 2}, - {dtptngen_LOW_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 3, 0}, - {dtptngen_LOW_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_LOW_Q, UDATPG_QUARTER_FIELD, dtptngen_DT_NARROW - dtptngen_DT_DELTA, 5, 0}, - - {dtptngen_CAP_M, UDATPG_MONTH_FIELD, dtptngen_DT_NUMERIC, 1, 2}, - {dtptngen_CAP_M, UDATPG_MONTH_FIELD, dtptngen_DT_SHORT, 3, 0}, - {dtptngen_CAP_M, UDATPG_MONTH_FIELD, dtptngen_DT_LONG, 4, 0}, - {dtptngen_CAP_M, UDATPG_MONTH_FIELD, dtptngen_DT_NARROW, 5, 0}, - {dtptngen_CAP_L, UDATPG_MONTH_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 2}, - {dtptngen_CAP_L, UDATPG_MONTH_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 3, 0}, - {dtptngen_CAP_L, UDATPG_MONTH_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_CAP_L, UDATPG_MONTH_FIELD, dtptngen_DT_NARROW - dtptngen_DT_DELTA, 5, 0}, - {dtptngen_LOW_L, UDATPG_MONTH_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 1}, - - {dtptngen_LOW_W, UDATPG_WEEK_OF_YEAR_FIELD, dtptngen_DT_NUMERIC, 1, 2}, - - {dtptngen_CAP_W, UDATPG_WEEK_OF_MONTH_FIELD, dtptngen_DT_NUMERIC, 1, 0}, - - {dtptngen_CAP_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_SHORT, 1, 3}, - {dtptngen_CAP_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_LONG, 4, 0}, - {dtptngen_CAP_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_NARROW, 5, 0}, - {dtptngen_CAP_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_SHORTER, 6, 0}, - {dtptngen_LOW_C, UDATPG_WEEKDAY_FIELD, dtptngen_DT_NUMERIC + 2*dtptngen_DT_DELTA, 1, 2}, - {dtptngen_LOW_C, UDATPG_WEEKDAY_FIELD, dtptngen_DT_SHORT - 2*dtptngen_DT_DELTA, 3, 0}, - {dtptngen_LOW_C, UDATPG_WEEKDAY_FIELD, dtptngen_DT_LONG - 2*dtptngen_DT_DELTA, 4, 0}, - {dtptngen_LOW_C, UDATPG_WEEKDAY_FIELD, dtptngen_DT_NARROW - 2*dtptngen_DT_DELTA, 5, 0}, - {dtptngen_LOW_C, UDATPG_WEEKDAY_FIELD, dtptngen_DT_SHORTER - 2*dtptngen_DT_DELTA, 6, 0}, - {dtptngen_LOW_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 2}, // dtptngen_LOW_E is currently not used in CLDR data, should not be canonical - {dtptngen_LOW_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 3, 0}, - {dtptngen_LOW_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_LOW_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_NARROW - dtptngen_DT_DELTA, 5, 0}, - {dtptngen_LOW_E, UDATPG_WEEKDAY_FIELD, dtptngen_DT_SHORTER - dtptngen_DT_DELTA, 6, 0}, - - {dtptngen_LOW_D, UDATPG_DAY_FIELD, dtptngen_DT_NUMERIC, 1, 2}, - {dtptngen_LOW_G, UDATPG_DAY_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 20}, // really internal use, so we don't care - - {dtptngen_CAP_D, UDATPG_DAY_OF_YEAR_FIELD, dtptngen_DT_NUMERIC, 1, 3}, - - {dtptngen_CAP_F, UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, dtptngen_DT_NUMERIC, 1, 0}, - - {dtptngen_LOW_A, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_SHORT, 1, 3}, - {dtptngen_LOW_A, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_LONG, 4, 0}, - {dtptngen_LOW_A, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_NARROW, 5, 0}, - {dtptngen_LOW_B, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 1, 3}, - {dtptngen_LOW_B, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_LOW_B, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_NARROW - dtptngen_DT_DELTA, 5, 0}, - // b needs to be closer to a than to B, so we make this 3*dtptngen_DT_DELTA - {dtptngen_CAP_B, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_SHORT - 3*dtptngen_DT_DELTA, 1, 3}, - {dtptngen_CAP_B, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_LONG - 3*dtptngen_DT_DELTA, 4, 0}, - {dtptngen_CAP_B, UDATPG_DAYPERIOD_FIELD, dtptngen_DT_NARROW - 3*dtptngen_DT_DELTA, 5, 0}, - - {dtptngen_CAP_H, UDATPG_HOUR_FIELD, dtptngen_DT_NUMERIC + 10*dtptngen_DT_DELTA, 1, 2}, // 24 hour - {dtptngen_LOW_K, UDATPG_HOUR_FIELD, dtptngen_DT_NUMERIC + 11*dtptngen_DT_DELTA, 1, 2}, // 24 hour - {dtptngen_LOW_H, UDATPG_HOUR_FIELD, dtptngen_DT_NUMERIC, 1, 2}, // 12 hour - {dtptngen_CAP_K, UDATPG_HOUR_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 2}, // 12 hour + {CAP_G, UDATPG_ERA_FIELD, DT_SHORT, 1, 3,}, + {CAP_G, UDATPG_ERA_FIELD, DT_LONG, 4, 0}, + {CAP_G, UDATPG_ERA_FIELD, DT_NARROW, 5, 0}, + + {LOW_Y, UDATPG_YEAR_FIELD, DT_NUMERIC, 1, 20}, + {CAP_Y, UDATPG_YEAR_FIELD, DT_NUMERIC + DT_DELTA, 1, 20}, + {LOW_U, UDATPG_YEAR_FIELD, DT_NUMERIC + 2*DT_DELTA, 1, 20}, + {LOW_R, UDATPG_YEAR_FIELD, DT_NUMERIC + 3*DT_DELTA, 1, 20}, + {CAP_U, UDATPG_YEAR_FIELD, DT_SHORT, 1, 3}, + {CAP_U, UDATPG_YEAR_FIELD, DT_LONG, 4, 0}, + {CAP_U, UDATPG_YEAR_FIELD, DT_NARROW, 5, 0}, + + {CAP_Q, UDATPG_QUARTER_FIELD, DT_NUMERIC, 1, 2}, + {CAP_Q, UDATPG_QUARTER_FIELD, DT_SHORT, 3, 0}, + {CAP_Q, UDATPG_QUARTER_FIELD, DT_LONG, 4, 0}, + {CAP_Q, UDATPG_QUARTER_FIELD, DT_NARROW, 5, 0}, + {LOW_Q, UDATPG_QUARTER_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, + {LOW_Q, UDATPG_QUARTER_FIELD, DT_SHORT - DT_DELTA, 3, 0}, + {LOW_Q, UDATPG_QUARTER_FIELD, DT_LONG - DT_DELTA, 4, 0}, + {LOW_Q, UDATPG_QUARTER_FIELD, DT_NARROW - DT_DELTA, 5, 0}, + + {CAP_M, UDATPG_MONTH_FIELD, DT_NUMERIC, 1, 2}, + {CAP_M, UDATPG_MONTH_FIELD, DT_SHORT, 3, 0}, + {CAP_M, UDATPG_MONTH_FIELD, DT_LONG, 4, 0}, + {CAP_M, UDATPG_MONTH_FIELD, DT_NARROW, 5, 0}, + {CAP_L, UDATPG_MONTH_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, + {CAP_L, UDATPG_MONTH_FIELD, DT_SHORT - DT_DELTA, 3, 0}, + {CAP_L, UDATPG_MONTH_FIELD, DT_LONG - DT_DELTA, 4, 0}, + {CAP_L, UDATPG_MONTH_FIELD, DT_NARROW - DT_DELTA, 5, 0}, + {LOW_L, UDATPG_MONTH_FIELD, DT_NUMERIC + DT_DELTA, 1, 1}, + + {LOW_W, UDATPG_WEEK_OF_YEAR_FIELD, DT_NUMERIC, 1, 2}, + + {CAP_W, UDATPG_WEEK_OF_MONTH_FIELD, DT_NUMERIC, 1, 0}, + + {CAP_E, UDATPG_WEEKDAY_FIELD, DT_SHORT, 1, 3}, + {CAP_E, UDATPG_WEEKDAY_FIELD, DT_LONG, 4, 0}, + {CAP_E, UDATPG_WEEKDAY_FIELD, DT_NARROW, 5, 0}, + {CAP_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER, 6, 0}, + {LOW_C, UDATPG_WEEKDAY_FIELD, DT_NUMERIC + 2*DT_DELTA, 1, 2}, + {LOW_C, UDATPG_WEEKDAY_FIELD, DT_SHORT - 2*DT_DELTA, 3, 0}, + {LOW_C, UDATPG_WEEKDAY_FIELD, DT_LONG - 2*DT_DELTA, 4, 0}, + {LOW_C, UDATPG_WEEKDAY_FIELD, DT_NARROW - 2*DT_DELTA, 5, 0}, + {LOW_C, UDATPG_WEEKDAY_FIELD, DT_SHORTER - 2*DT_DELTA, 6, 0}, + {LOW_E, UDATPG_WEEKDAY_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, // LOW_E is currently not used in CLDR data, should not be canonical + {LOW_E, UDATPG_WEEKDAY_FIELD, DT_SHORT - DT_DELTA, 3, 0}, + {LOW_E, UDATPG_WEEKDAY_FIELD, DT_LONG - DT_DELTA, 4, 0}, + {LOW_E, UDATPG_WEEKDAY_FIELD, DT_NARROW - DT_DELTA, 5, 0}, + {LOW_E, UDATPG_WEEKDAY_FIELD, DT_SHORTER - DT_DELTA, 6, 0}, + + {LOW_D, UDATPG_DAY_FIELD, DT_NUMERIC, 1, 2}, + {LOW_G, UDATPG_DAY_FIELD, DT_NUMERIC + DT_DELTA, 1, 20}, // really internal use, so we don't care + + {CAP_D, UDATPG_DAY_OF_YEAR_FIELD, DT_NUMERIC, 1, 3}, + + {CAP_F, UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, DT_NUMERIC, 1, 0}, + + {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_SHORT, 1, 3}, + {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_LONG, 4, 0}, + {LOW_A, UDATPG_DAYPERIOD_FIELD, DT_NARROW, 5, 0}, + {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - DT_DELTA, 1, 3}, + {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - DT_DELTA, 4, 0}, + {LOW_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - DT_DELTA, 5, 0}, + // b needs to be closer to a than to B, so we make this 3*DT_DELTA + {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_SHORT - 3*DT_DELTA, 1, 3}, + {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_LONG - 3*DT_DELTA, 4, 0}, + {CAP_B, UDATPG_DAYPERIOD_FIELD, DT_NARROW - 3*DT_DELTA, 5, 0}, + + {CAP_H, UDATPG_HOUR_FIELD, DT_NUMERIC + 10*DT_DELTA, 1, 2}, // 24 hour + {LOW_K, UDATPG_HOUR_FIELD, DT_NUMERIC + 11*DT_DELTA, 1, 2}, // 24 hour + {LOW_H, UDATPG_HOUR_FIELD, DT_NUMERIC, 1, 2}, // 12 hour + {CAP_K, UDATPG_HOUR_FIELD, DT_NUMERIC + DT_DELTA, 1, 2}, // 12 hour // The C code has had versions of the following 3, keep & update. Should not need these, but... // Without these, certain tests using e.g. staticGetSkeleton fail because j/J in patterns // get skipped instead of mapped to the right hour chars, for example in @@ -223,36 +226,36 @@ static const dtTypeElem dtTypes[] = { // IntlTestDateTimePatternGeneratorAPI:: testStaticGetSkeleton // DateIntervalFormatTest::testTicket11985 // Need to investigate better handling of jJC replacement e.g. in staticGetSkeleton. - {dtptngen_CAP_J, UDATPG_HOUR_FIELD, dtptngen_DT_NUMERIC + 5*dtptngen_DT_DELTA, 1, 2}, // 12/24 hour no AM/PM - {dtptngen_LOW_J, UDATPG_HOUR_FIELD, dtptngen_DT_NUMERIC + 6*dtptngen_DT_DELTA, 1, 6}, // 12/24 hour - {dtptngen_CAP_C, UDATPG_HOUR_FIELD, dtptngen_DT_NUMERIC + 7*dtptngen_DT_DELTA, 1, 6}, // 12/24 hour with preferred dayPeriods for 12 - - {dtptngen_LOW_M, UDATPG_MINUTE_FIELD, dtptngen_DT_NUMERIC, 1, 2}, - - {dtptngen_LOW_S, UDATPG_SECOND_FIELD, dtptngen_DT_NUMERIC, 1, 2}, - {dtptngen_CAP_A, UDATPG_SECOND_FIELD, dtptngen_DT_NUMERIC + dtptngen_DT_DELTA, 1, 1000}, - - {dtptngen_CAP_S, UDATPG_FRACTIONAL_SECOND_FIELD, dtptngen_DT_NUMERIC, 1, 1000}, - - {dtptngen_LOW_V, UDATPG_ZONE_FIELD, dtptngen_DT_SHORT - 2*dtptngen_DT_DELTA, 1, 0}, - {dtptngen_LOW_V, UDATPG_ZONE_FIELD, dtptngen_DT_LONG - 2*dtptngen_DT_DELTA, 4, 0}, - {dtptngen_LOW_Z, UDATPG_ZONE_FIELD, dtptngen_DT_SHORT, 1, 3}, - {dtptngen_LOW_Z, UDATPG_ZONE_FIELD, dtptngen_DT_LONG, 4, 0}, - {dtptngen_CAP_Z, UDATPG_ZONE_FIELD, dtptngen_DT_NARROW - dtptngen_DT_DELTA, 1, 3}, - {dtptngen_CAP_Z, UDATPG_ZONE_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_CAP_Z, UDATPG_ZONE_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 5, 0}, - {dtptngen_CAP_O, UDATPG_ZONE_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 1, 0}, - {dtptngen_CAP_O, UDATPG_ZONE_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_CAP_V, UDATPG_ZONE_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 1, 0}, - {dtptngen_CAP_V, UDATPG_ZONE_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 2, 0}, - {dtptngen_CAP_V, UDATPG_ZONE_FIELD, dtptngen_DT_LONG-1 - dtptngen_DT_DELTA, 3, 0}, - {dtptngen_CAP_V, UDATPG_ZONE_FIELD, dtptngen_DT_LONG-2 - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_CAP_X, UDATPG_ZONE_FIELD, dtptngen_DT_NARROW - dtptngen_DT_DELTA, 1, 0}, - {dtptngen_CAP_X, UDATPG_ZONE_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 2, 0}, - {dtptngen_CAP_X, UDATPG_ZONE_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, - {dtptngen_LOW_X, UDATPG_ZONE_FIELD, dtptngen_DT_NARROW - dtptngen_DT_DELTA, 1, 0}, - {dtptngen_LOW_X, UDATPG_ZONE_FIELD, dtptngen_DT_SHORT - dtptngen_DT_DELTA, 2, 0}, - {dtptngen_LOW_X, UDATPG_ZONE_FIELD, dtptngen_DT_LONG - dtptngen_DT_DELTA, 4, 0}, + {CAP_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 5*DT_DELTA, 1, 2}, // 12/24 hour no AM/PM + {LOW_J, UDATPG_HOUR_FIELD, DT_NUMERIC + 6*DT_DELTA, 1, 6}, // 12/24 hour + {CAP_C, UDATPG_HOUR_FIELD, DT_NUMERIC + 7*DT_DELTA, 1, 6}, // 12/24 hour with preferred dayPeriods for 12 + + {LOW_M, UDATPG_MINUTE_FIELD, DT_NUMERIC, 1, 2}, + + {LOW_S, UDATPG_SECOND_FIELD, DT_NUMERIC, 1, 2}, + {CAP_A, UDATPG_SECOND_FIELD, DT_NUMERIC + DT_DELTA, 1, 1000}, + + {CAP_S, UDATPG_FRACTIONAL_SECOND_FIELD, DT_NUMERIC, 1, 1000}, + + {LOW_V, UDATPG_ZONE_FIELD, DT_SHORT - 2*DT_DELTA, 1, 0}, + {LOW_V, UDATPG_ZONE_FIELD, DT_LONG - 2*DT_DELTA, 4, 0}, + {LOW_Z, UDATPG_ZONE_FIELD, DT_SHORT, 1, 3}, + {LOW_Z, UDATPG_ZONE_FIELD, DT_LONG, 4, 0}, + {CAP_Z, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 3}, + {CAP_Z, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, + {CAP_Z, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 5, 0}, + {CAP_O, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 1, 0}, + {CAP_O, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, + {CAP_V, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 1, 0}, + {CAP_V, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 2, 0}, + {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-1 - DT_DELTA, 3, 0}, + {CAP_V, UDATPG_ZONE_FIELD, DT_LONG-2 - DT_DELTA, 4, 0}, + {CAP_X, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 0}, + {CAP_X, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 2, 0}, + {CAP_X, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, + {LOW_X, UDATPG_ZONE_FIELD, DT_NARROW - DT_DELTA, 1, 0}, + {LOW_X, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 2, 0}, + {LOW_X, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0}, {0, UDATPG_FIELD_COUNT, 0, 0, 0} , // last row of dtTypes[] }; @@ -273,18 +276,17 @@ static const char* const CLDR_FIELD_WIDTH[] = { // [UDATPG_WIDTH_COUNT] "", "-short", "-narrow" }; -// TODO(ticket:13619): remove when definition uncommented in dtptngen.h. -static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1; static constexpr UDateTimePGDisplayWidth UDATPG_WIDTH_APPENDITEM = UDATPG_WIDE; static constexpr int32_t UDATPG_FIELD_KEY_MAX = 24; // max length of CLDR field tag (type + width) // For appendItems -static const UChar UDATPG_ItemFormat[]= {0x7B, 0x30, 0x7D, 0x20, 0x251C, 0x7B, 0x32, 0x7D, 0x3A, +static const char16_t UDATPG_ItemFormat[]= {0x7B, 0x30, 0x7D, 0x20, 0x251C, 0x7B, 0x32, 0x7D, 0x3A, 0x20, 0x7B, 0x31, 0x7D, 0x2524, 0}; // {0} \u251C{2}: {1}\u2524 -//static const UChar repeatedPatterns[6]={dtptngen_CAP_G, dtptngen_CAP_E, dtptngen_LOW_Z, dtptngen_LOW_V, dtptngen_CAP_Q, 0}; // "GEzvQ" +//static const char16_t repeatedPatterns[6]={CAP_G, CAP_E, LOW_Z, LOW_V, CAP_Q, 0}; // "GEzvQ" static const char DT_DateTimePatternsTag[]="DateTimePatterns"; +static const char DT_DateAtTimePatternsTag[]="DateTimePatterns%atTime"; static const char DT_DateTimeCalendarTag[]="calendar"; static const char DT_DateTimeGregorianTag[]="gregorian"; static const char DT_DateTimeAppendItemsTag[]="appendItems"; @@ -311,6 +313,16 @@ DateTimePatternGenerator::createInstance(const Locale& locale, UErrorCode& statu return U_SUCCESS(status) ? result.orphan() : nullptr; } +DateTimePatternGenerator* U_EXPORT2 +DateTimePatternGenerator::createInstanceNoStdPat(const Locale& locale, UErrorCode& status) { + if (U_FAILURE(status)) { + return nullptr; + } + LocalPointer result( + new DateTimePatternGenerator(locale, status, true), status); + return U_SUCCESS(status) ? result.orphan() : nullptr; +} + DateTimePatternGenerator* U_EXPORT2 DateTimePatternGenerator::createEmptyInstance(UErrorCode& status) { if (U_FAILURE(status)) { @@ -324,6 +336,7 @@ DateTimePatternGenerator::createEmptyInstance(UErrorCode& status) { DateTimePatternGenerator::DateTimePatternGenerator(UErrorCode &status) : skipMatcher(nullptr), fAvailableFormatKeyHash(nullptr), + fDefaultHourFormatChar(0), internalErrorCode(U_ZERO_ERROR) { fp = new FormatParser(); @@ -335,9 +348,10 @@ DateTimePatternGenerator::DateTimePatternGenerator(UErrorCode &status) : } } -DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorCode &status) : +DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorCode &status, UBool skipStdPatterns) : skipMatcher(nullptr), fAvailableFormatKeyHash(nullptr), + fDefaultHourFormatChar(0), internalErrorCode(U_ZERO_ERROR) { fp = new FormatParser(); @@ -348,7 +362,7 @@ DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorC internalErrorCode = status = U_MEMORY_ALLOCATION_ERROR; } else { - initData(locale, status); + initData(locale, status, skipStdPatterns); } } @@ -356,6 +370,7 @@ DateTimePatternGenerator::DateTimePatternGenerator(const DateTimePatternGenerato UObject(), skipMatcher(nullptr), fAvailableFormatKeyHash(nullptr), + fDefaultHourFormatChar(0), internalErrorCode(U_ZERO_ERROR) { fp = new FormatParser(); @@ -380,10 +395,13 @@ DateTimePatternGenerator::operator=(const DateTimePatternGenerator& other) { *fp = *(other.fp); dtMatcher->copyFrom(other.dtMatcher->skeleton); *distanceInfo = *(other.distanceInfo); - dateTimeFormat = other.dateTimeFormat; + for (int32_t style = UDAT_FULL; style <= UDAT_SHORT; style++) { + dateTimeFormat[style] = other.dateTimeFormat[style]; + } decimal = other.decimal; - // NUL-terminate for the C API. - dateTimeFormat.getTerminatedBuffer(); + for (int32_t style = UDAT_FULL; style <= UDAT_SHORT; style++) { + dateTimeFormat[style].getTerminatedBuffer(); // NUL-terminate for the C API. + } decimal.getTerminatedBuffer(); delete skipMatcher; if ( other.skipMatcher == nullptr ) { @@ -414,24 +432,29 @@ DateTimePatternGenerator::operator=(const DateTimePatternGenerator& other) { bool DateTimePatternGenerator::operator==(const DateTimePatternGenerator& other) const { if (this == &other) { - return TRUE; + return true; } if ((pLocale==other.pLocale) && (patternMap->equals(*other.patternMap)) && - (dateTimeFormat==other.dateTimeFormat) && (decimal==other.decimal)) { + (decimal==other.decimal)) { + for (int32_t style = UDAT_FULL; style <= UDAT_SHORT; style++) { + if (dateTimeFormat[style] != other.dateTimeFormat[style]) { + return false; + } + } for ( int32_t i=0 ; i 0) { + if(uprv_strcmp(buffer, "h24") == 0) { + fDefaultHourFormatChar = LOW_K; + } else if(uprv_strcmp(buffer, "h23") == 0) { + fDefaultHourFormatChar = CAP_H; + } else if(uprv_strcmp(buffer, "h12") == 0) { + fDefaultHourFormatChar = LOW_H; + } else if(uprv_strcmp(buffer, "h11") == 0) { + fDefaultHourFormatChar = CAP_K; + } + } + // Check if the region has an alias if (allowedFormats == nullptr) { UErrorCode localStatus = U_ZERO_ERROR; @@ -667,13 +712,16 @@ void DateTimePatternGenerator::getAllowedHourFormats(const Locale &locale, UErro if (allowedFormats != nullptr) { // Lookup is successful // Here allowedFormats points to a list consisting of key for preferredFormat, // followed by one or more keys for allowedFormats, then followed by ALLOWED_HOUR_FORMAT_UNKNOWN. - switch (allowedFormats[0]) { - case ALLOWED_HOUR_FORMAT_h: fDefaultHourFormatChar = dtptngen_LOW_H; break; - case ALLOWED_HOUR_FORMAT_H: fDefaultHourFormatChar = dtptngen_CAP_H; break; - case ALLOWED_HOUR_FORMAT_K: fDefaultHourFormatChar = dtptngen_CAP_K; break; - case ALLOWED_HOUR_FORMAT_k: fDefaultHourFormatChar = dtptngen_LOW_K; break; - default: fDefaultHourFormatChar = dtptngen_CAP_H; break; + if (!fDefaultHourFormatChar) { + switch (allowedFormats[0]) { + case ALLOWED_HOUR_FORMAT_h: fDefaultHourFormatChar = LOW_H; break; + case ALLOWED_HOUR_FORMAT_H: fDefaultHourFormatChar = CAP_H; break; + case ALLOWED_HOUR_FORMAT_K: fDefaultHourFormatChar = CAP_K; break; + case ALLOWED_HOUR_FORMAT_k: fDefaultHourFormatChar = LOW_K; break; + default: fDefaultHourFormatChar = CAP_H; break; + } } + for (int32_t i = 0; i < UPRV_LENGTHOF(fAllowedHourFormats); ++i) { fAllowedHourFormats[i] = allowedFormats[i + 1]; if (fAllowedHourFormats[i] == ALLOWED_HOUR_FORMAT_UNKNOWN) { @@ -681,12 +729,39 @@ void DateTimePatternGenerator::getAllowedHourFormats(const Locale &locale, UErro } } } else { // Lookup failed, twice - fDefaultHourFormatChar = dtptngen_CAP_H; + if (!fDefaultHourFormatChar) { + fDefaultHourFormatChar = CAP_H; + } fAllowedHourFormats[0] = ALLOWED_HOUR_FORMAT_H; fAllowedHourFormats[1] = ALLOWED_HOUR_FORMAT_UNKNOWN; } } +UDateFormatHourCycle +DateTimePatternGenerator::getDefaultHourCycle(UErrorCode& status) const { + if (U_FAILURE(status)) { + return UDAT_HOUR_CYCLE_23; + } + if (fDefaultHourFormatChar == 0) { + // We need to return something, but the caller should ignore it + // anyways since the returned status is a failure. + status = U_UNSUPPORTED_ERROR; + return UDAT_HOUR_CYCLE_23; + } + switch (fDefaultHourFormatChar) { + case CAP_K: + return UDAT_HOUR_CYCLE_11; + case LOW_H: + return UDAT_HOUR_CYCLE_12; + case CAP_H: + return UDAT_HOUR_CYCLE_23; + case LOW_K: + return UDAT_HOUR_CYCLE_24; + default: + UPRV_UNREACHABLE_EXIT; + } +} + UnicodeString DateTimePatternGenerator::getSkeleton(const UnicodeString& pattern, UErrorCode& /*status*/) { @@ -740,7 +815,7 @@ DateTimePatternGenerator::addICUPatterns(const Locale& locale, UErrorCode& statu SimpleDateFormat* sdf; if (df != nullptr && (sdf = dynamic_cast(df)) != nullptr) { sdf->toPattern(dfPattern); - addPattern(dfPattern, FALSE, conflictingString, status); + addPattern(dfPattern, false, conflictingString, status); } // TODO Maybe we should return an error when the date format isn't simple. delete df; @@ -749,7 +824,7 @@ DateTimePatternGenerator::addICUPatterns(const Locale& locale, UErrorCode& statu df = DateFormat::createTimeInstance(style, locale); if (df != nullptr && (sdf = dynamic_cast(df)) != nullptr) { sdf->toPattern(dfPattern); - addPattern(dfPattern, FALSE, conflictingString, status); + addPattern(dfPattern, false, conflictingString, status); // TODO: C++ and Java are inconsistent (see #12568). // C++ uses MEDIUM, but Java uses SHORT. @@ -769,7 +844,7 @@ DateTimePatternGenerator::hackTimes(const UnicodeString& hackPattern, UErrorCode fp->set(hackPattern); UnicodeString mmss; - UBool gotMm=FALSE; + UBool gotMm=false; for (int32_t i=0; iitemNumber; ++i) { UnicodeString field = fp->items[i]; if ( fp->isQuoteLiteral(field) ) { @@ -784,22 +859,22 @@ DateTimePatternGenerator::hackTimes(const UnicodeString& hackPattern, UErrorCode mmss+=field; } else { - UChar ch=field.charAt(0); - if (ch==dtptngen_LOW_M) { - gotMm=TRUE; + char16_t ch=field.charAt(0); + if (ch==LOW_M) { + gotMm=true; mmss+=field; } else { - if (ch==dtptngen_LOW_S) { + if (ch==LOW_S) { if (!gotMm) { break; } mmss+= field; - addPattern(mmss, FALSE, conflictingString, status); + addPattern(mmss, false, conflictingString, status); break; } else { - if (gotMm || ch==dtptngen_LOW_Z || ch==dtptngen_CAP_Z || ch==dtptngen_LOW_V || ch==dtptngen_CAP_V) { + if (gotMm || ch==LOW_Z || ch==CAP_Z || ch==LOW_V || ch==CAP_V) { break; } } @@ -826,26 +901,23 @@ DateTimePatternGenerator::getCalendarTypeToUse(const Locale& locale, CharString& "calendar", locale.getName(), nullptr, - FALSE, + false, &localStatus); localeWithCalendarKey[ULOC_LOCALE_IDENTIFIER_CAPACITY-1] = 0; // ensure null termination // now get the calendar key value from that locale - char calendarType[ULOC_KEYWORDS_CAPACITY]; - int32_t calendarTypeLen = uloc_getKeywordValue( - localeWithCalendarKey, - "calendar", - calendarType, - ULOC_KEYWORDS_CAPACITY, - &localStatus); + destination.clear(); + { + CharStringByteSink sink(&destination); + ulocimp_getKeywordValue( + localeWithCalendarKey, + "calendar", + sink, + &localStatus); + } // If the input locale was invalid, don't fail with missing resource error, instead // continue with default of Gregorian. if (U_FAILURE(localStatus) && localStatus != U_MISSING_RESOURCE_ERROR) { err = localStatus; - return; - } - if (calendarTypeLen < ULOC_KEYWORDS_CAPACITY) { - destination.clear().append(calendarType, -1, err); - if (U_FAILURE(err)) { return; } } } } @@ -871,21 +943,17 @@ struct DateTimePatternGenerator::AppendItemFormatsSink : public ResourceSink { virtual ~AppendItemFormatsSink(); virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { - ResourceTable itemsTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) { - UDateTimePatternField field = dtpg.getAppendFormatNumber(key); - if (field == UDATPG_FIELD_COUNT) { continue; } - const UnicodeString& valueStr = value.getUnicodeString(errorCode); - if (dtpg.getAppendItemFormat(field).isEmpty() && !valueStr.isEmpty()) { - dtpg.setAppendItemFormat(field, valueStr); - } + UErrorCode &errorCode) override { + UDateTimePatternField field = dtpg.getAppendFormatNumber(key); + if (field == UDATPG_FIELD_COUNT) { return; } + const UnicodeString& valueStr = value.getUnicodeString(errorCode); + if (dtpg.getAppendItemFormat(field).isEmpty() && !valueStr.isEmpty()) { + dtpg.setAppendItemFormat(field, valueStr); } } void fillInMissing() { - UnicodeString defaultItemFormat(TRUE, UDATPG_ItemFormat, UPRV_LENGTHOF(UDATPG_ItemFormat)-1); // Read-only alias. + UnicodeString defaultItemFormat(true, UDATPG_ItemFormat, UPRV_LENGTHOF(UDATPG_ItemFormat)-1); // Read-only alias. for (int32_t i = 0; i < UDATPG_FIELD_COUNT; i++) { UDateTimePatternField field = (UDateTimePatternField)i; if (dtpg.getAppendItemFormat(field).isEmpty()) { @@ -904,23 +972,16 @@ struct DateTimePatternGenerator::AppendItemNamesSink : public ResourceSink { virtual ~AppendItemNamesSink(); virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { - ResourceTable itemsTable = value.getTable(errorCode); + UErrorCode &errorCode) override { + UDateTimePGDisplayWidth width; + UDateTimePatternField field = dtpg.getFieldAndWidthIndices(key, &width); + if (field == UDATPG_FIELD_COUNT) { return; } + ResourceTable detailsTable = value.getTable(errorCode); if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) { - UDateTimePGDisplayWidth width; - UDateTimePatternField field = dtpg.getFieldAndWidthIndices(key, &width); - if (field == UDATPG_FIELD_COUNT) { continue; } - ResourceTable detailsTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t j = 0; detailsTable.getKeyAndValue(j, key, value); ++j) { - if (uprv_strcmp(key, "dn") != 0) { continue; } - const UnicodeString& valueStr = value.getUnicodeString(errorCode); - if (dtpg.getFieldDisplayName(field,width).isEmpty() && !valueStr.isEmpty()) { - dtpg.setFieldDisplayName(field,width,valueStr); - } - break; - } + if (!detailsTable.findValue("dn", value)) { return; } + const UnicodeString& valueStr = value.getUnicodeString(errorCode); + if (U_SUCCESS(errorCode) && dtpg.getFieldDisplayName(field,width).isEmpty() && !valueStr.isEmpty()) { + dtpg.setFieldDisplayName(field,width,valueStr); } } @@ -928,15 +989,15 @@ struct DateTimePatternGenerator::AppendItemNamesSink : public ResourceSink { for (int32_t i = 0; i < UDATPG_FIELD_COUNT; i++) { UnicodeString& valueStr = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, UDATPG_WIDE); if (valueStr.isEmpty()) { - valueStr = dtptngen_CAP_F; + valueStr = CAP_F; U_ASSERT(i < 20); if (i < 10) { // F0, F1, ..., F9 - valueStr += (UChar)(i+0x30); + valueStr += (char16_t)(i+0x30); } else { // F10, F11, ... - valueStr += (UChar)0x31; - valueStr += (UChar)(i-10 + 0x30); + valueStr += (char16_t)0x31; + valueStr += (char16_t)(i-10 + 0x30); } // NUL-terminate for the C API. valueStr.getTerminatedBuffer(); @@ -962,20 +1023,16 @@ struct DateTimePatternGenerator::AvailableFormatsSink : public ResourceSink { AvailableFormatsSink(DateTimePatternGenerator& _dtpg) : dtpg(_dtpg) {} virtual ~AvailableFormatsSink(); - virtual void put(const char *key, ResourceValue &value, UBool isRoot, - UErrorCode &errorCode) { - ResourceTable itemsTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) { - const UnicodeString formatKey(key, -1, US_INV); - if (!dtpg.isAvailableFormatSet(formatKey) ) { - dtpg.setAvailableFormat(formatKey, errorCode); - // Add pattern with its associated skeleton. Override any duplicate - // derived from std patterns, but not a previous availableFormats entry: - const UnicodeString& formatValue = value.getUnicodeString(errorCode); - conflictingPattern.remove(); - dtpg.addPatternWithSkeleton(formatValue, &formatKey, !isRoot, conflictingPattern, errorCode); - } + virtual void put(const char *key, ResourceValue &value, UBool /*isRoot*/, + UErrorCode &errorCode) override { + const UnicodeString formatKey(key, -1, US_INV); + if (!dtpg.isAvailableFormatSet(formatKey) ) { + dtpg.setAvailableFormat(formatKey, errorCode); + // Add pattern with its associated skeleton. Override any duplicate + // derived from std patterns, but not a previous availableFormats entry: + const UnicodeString& formatValue = value.getUnicodeString(errorCode); + conflictingPattern.remove(); + dtpg.addPatternWithSkeleton(formatValue, &formatKey, true, conflictingPattern, errorCode); } } }; @@ -1010,13 +1067,13 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale, UErrorCode& errorCod .append('/', errorCode) .append(DT_DateTimeAppendItemsTag, errorCode); // i.e., calendar/xxx/appendItems if (U_FAILURE(errorCode)) { return; } - ures_getAllItemsWithFallback(rb.getAlias(), path.data(), appendItemFormatsSink, err); + ures_getAllChildrenWithFallback(rb.getAlias(), path.data(), appendItemFormatsSink, err); appendItemFormatsSink.fillInMissing(); // Load CLDR item names. err = U_ZERO_ERROR; AppendItemNamesSink appendItemNamesSink(*this); - ures_getAllItemsWithFallback(rb.getAlias(), DT_DateTimeFieldsTag, appendItemNamesSink, err); + ures_getAllChildrenWithFallback(rb.getAlias(), DT_DateTimeFieldsTag, appendItemNamesSink, err); appendItemNamesSink.fillInMissing(); // Load the available formats from CLDR. @@ -1031,7 +1088,7 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale, UErrorCode& errorCod .append('/', errorCode) .append(DT_DateTimeAvailableFormatsTag, errorCode); // i.e., calendar/xxx/availableFormats if (U_FAILURE(errorCode)) { return; } - ures_getAllItemsWithFallback(rb.getAlias(), path.data(), availableFormatsSink, err); + ures_getAllChildrenWithFallback(rb.getAlias(), path.data(), availableFormatsSink, err); } void @@ -1040,7 +1097,7 @@ DateTimePatternGenerator::initHashtable(UErrorCode& err) { if (fAvailableFormatKeyHash!=nullptr) { return; } - LocalPointer hash(new Hashtable(FALSE, err), err); + LocalPointer hash(new Hashtable(false, err), err); if (U_SUCCESS(err)) { fAvailableFormatKeyHash = hash.orphan(); } @@ -1087,9 +1144,9 @@ DateTimePatternGenerator::getMutableFieldDisplayName(UDateTimePatternField field void DateTimePatternGenerator::getAppendName(UDateTimePatternField field, UnicodeString& value) { - value = dtptngen_SINGLE_QUOTE; + value = SINGLE_QUOTE; value += fieldDisplayNames[field][UDATPG_WIDTH_APPENDITEM]; - value += dtptngen_SINGLE_QUOTE; + value += SINGLE_QUOTE; } UnicodeString @@ -1152,7 +1209,21 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UDate } resultPattern.remove(); status = U_ZERO_ERROR; - dtFormat=getDateTimeFormat(); + // determine which dateTimeFormat to use + PtnSkeleton* reqSkeleton = dtMatcher->getSkeletonPtr(); + UDateFormatStyle style = UDAT_SHORT; + int32_t monthFieldLen = reqSkeleton->baseOriginal.getFieldLength(UDATPG_MONTH_FIELD); + if (monthFieldLen == 4) { + if (reqSkeleton->baseOriginal.getFieldLength(UDATPG_WEEKDAY_FIELD) > 0) { + style = UDAT_FULL; + } else { + style = UDAT_LONG; + } + } else if (monthFieldLen == 3) { + style = UDAT_MEDIUM; + } + // and now use it to compose date and time + dtFormat=getDateTimeFormat(style, status); SimpleFormatter(dtFormat, 2, 2, status).format(timePattern, datePattern, resultPattern, status); return resultPattern; } @@ -1168,11 +1239,11 @@ UnicodeString DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status) { UnicodeString patternFormMapped; patternFormMapped.remove(); - UBool inQuoted = FALSE; + UBool inQuoted = false; int32_t patPos, patLen = patternForm.length(); for (patPos = 0; patPos < patLen; patPos++) { - UChar patChr = patternForm.charAt(patPos); - if (patChr == dtptngen_SINGLE_QUOTE) { + char16_t patChr = patternForm.charAt(patPos); + if (patChr == SINGLE_QUOTE) { inQuoted = !inQuoted; } else if (!inQuoted) { // Handle special mappings for 'j' and 'C' in which fields lengths @@ -1181,7 +1252,7 @@ DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& pattern // 1,2 => abbreviated dayPeriod (field length 1..3) // 3,4 => long dayPeriod (field length 4) // 5,6 => narrow dayPeriod (field length 5) - if (patChr == dtptngen_LOW_J || patChr == dtptngen_CAP_C) { + if (patChr == LOW_J || patChr == CAP_C) { int32_t extraLen = 0; // 1 less than total field length while (patPos+1 < patLen && patternForm.charAt(patPos+1)==patChr) { extraLen++; @@ -1189,9 +1260,9 @@ DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& pattern } int32_t hourLen = 1 + (extraLen & 1); int32_t dayPeriodLen = (extraLen < 2)? 1: 3 + (extraLen >> 1); - UChar hourChar = dtptngen_LOW_H; - UChar dayPeriodChar = dtptngen_LOW_A; - if (patChr == dtptngen_LOW_J) { + char16_t hourChar = LOW_H; + char16_t dayPeriodChar = LOW_A; + if (patChr == LOW_J) { hourChar = fDefaultHourFormatChar; } else { AllowedHourFormat bestAllowed; @@ -1202,20 +1273,20 @@ DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& pattern return UnicodeString(); } if (bestAllowed == ALLOWED_HOUR_FORMAT_H || bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_Hb) { - hourChar = dtptngen_CAP_H; + hourChar = CAP_H; } else if (bestAllowed == ALLOWED_HOUR_FORMAT_K || bestAllowed == ALLOWED_HOUR_FORMAT_KB || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) { - hourChar = dtptngen_CAP_K; + hourChar = CAP_K; } else if (bestAllowed == ALLOWED_HOUR_FORMAT_k) { - hourChar = dtptngen_LOW_K; + hourChar = LOW_K; } // in #13183 just add b/B to skeleton, no longer need to set special flags if (bestAllowed == ALLOWED_HOUR_FORMAT_HB || bestAllowed == ALLOWED_HOUR_FORMAT_hB || bestAllowed == ALLOWED_HOUR_FORMAT_KB) { - dayPeriodChar = dtptngen_CAP_B; + dayPeriodChar = CAP_B; } else if (bestAllowed == ALLOWED_HOUR_FORMAT_Hb || bestAllowed == ALLOWED_HOUR_FORMAT_hb || bestAllowed == ALLOWED_HOUR_FORMAT_Kb) { - dayPeriodChar = dtptngen_LOW_B; + dayPeriodChar = LOW_B; } } - if (hourChar==dtptngen_CAP_H || hourChar==dtptngen_LOW_K) { + if (hourChar==CAP_H || hourChar==LOW_K) { dayPeriodLen = 0; } while (dayPeriodLen-- > 0) { @@ -1224,10 +1295,10 @@ DateTimePatternGenerator::mapSkeletonMetacharacters(const UnicodeString& pattern while (hourLen-- > 0) { patternFormMapped.append(hourChar); } - } else if (patChr == dtptngen_CAP_J) { + } else if (patChr == CAP_J) { // Get pattern for skeleton with H, then replace H or k // with fDefaultHourFormatChar (if different) - patternFormMapped.append(dtptngen_CAP_H); + patternFormMapped.append(CAP_H); *flags |= kDTPGSkeletonUsesCapJ; } else { patternFormMapped.append(patChr); @@ -1280,7 +1351,7 @@ DateTimePatternGenerator::addCanonicalItems(UErrorCode& status) { for (int32_t i=0; i 0) { - addPattern(UnicodeString(Canonical_Items[i]), FALSE, conflictingPattern, status); + addPattern(UnicodeString(Canonical_Items[i]), false, conflictingPattern, status); } if (U_FAILURE(status)) { return; } } @@ -1288,56 +1359,119 @@ DateTimePatternGenerator::addCanonicalItems(UErrorCode& status) { void DateTimePatternGenerator::setDateTimeFormat(const UnicodeString& dtFormat) { - dateTimeFormat = dtFormat; - // NUL-terminate for the C API. - dateTimeFormat.getTerminatedBuffer(); + UErrorCode status = U_ZERO_ERROR; + for (int32_t style = UDAT_FULL; style <= UDAT_SHORT; style++) { + setDateTimeFormat((UDateFormatStyle)style, dtFormat, status); + } } const UnicodeString& DateTimePatternGenerator::getDateTimeFormat() const { - return dateTimeFormat; + UErrorCode status = U_ZERO_ERROR; + return getDateTimeFormat(UDAT_MEDIUM, status); } +void +DateTimePatternGenerator::setDateTimeFormat(UDateFormatStyle style, const UnicodeString& dtFormat, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (style < UDAT_FULL || style > UDAT_SHORT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } + dateTimeFormat[style] = dtFormat; + // Note for the following: getTerminatedBuffer() can re-allocate the UnicodeString + // buffer so we do this here before clients request a const ref to the UnicodeString + // or its buffer. + dateTimeFormat[style].getTerminatedBuffer(); // NUL-terminate for the C API. +} + +const UnicodeString& +DateTimePatternGenerator::getDateTimeFormat(UDateFormatStyle style, UErrorCode& status) const { + static const UnicodeString emptyString = UNICODE_STRING_SIMPLE(""); + if (U_FAILURE(status)) { + return emptyString; + } + if (style < UDAT_FULL || style > UDAT_SHORT) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return emptyString; + } + return dateTimeFormat[style]; +} + +static const int32_t cTypeBufMax = 32; + void DateTimePatternGenerator::setDateTimeFromCalendar(const Locale& locale, UErrorCode& status) { if (U_FAILURE(status)) { return; } - const UChar *resStr; + const char16_t *resStr; int32_t resStrLen = 0; - LocalPointer fCalendar(Calendar::createInstance(locale, status), status); - if (U_FAILURE(status)) { return; } - LocalUResourceBundlePointer calData(ures_open(nullptr, locale.getBaseName(), &status)); if (U_FAILURE(status)) { return; } ures_getByKey(calData.getAlias(), DT_DateTimeCalendarTag, calData.getAlias(), &status); if (U_FAILURE(status)) { return; } - LocalUResourceBundlePointer dateTimePatterns; - if (fCalendar->getType() != nullptr && *fCalendar->getType() != '\0' - && uprv_strcmp(fCalendar->getType(), DT_DateTimeGregorianTag) != 0) { - dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), fCalendar->getType(), - nullptr, &status)); - ures_getByKeyWithFallback(dateTimePatterns.getAlias(), DT_DateTimePatternsTag, - dateTimePatterns.getAlias(), &status); + char cType[cTypeBufMax + 1]; + Calendar::getCalendarTypeFromLocale(locale, cType, cTypeBufMax, status); + cType[cTypeBufMax] = 0; + if (U_FAILURE(status) || cType[0] == 0) { + status = U_ZERO_ERROR; + uprv_strcpy(cType, DT_DateTimeGregorianTag); } + UBool cTypeIsGregorian = (uprv_strcmp(cType, DT_DateTimeGregorianTag) == 0); + // Currently, for compatibility with pre-CLDR-42 data, we default to the "atTime" + // combining patterns. Depending on guidance in CLDR 42 spec and on DisplayOptions, + // we may change this. + LocalUResourceBundlePointer specificCalBundle; + LocalUResourceBundlePointer dateTimePatterns; + int32_t dateTimeOffset = 0; // initially for DateTimePatterns%atTime + if (!cTypeIsGregorian) { + specificCalBundle.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), cType, + nullptr, &status)); + dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(specificCalBundle.getAlias(), DT_DateAtTimePatternsTag, // the %atTime variant, 4 entries + nullptr, &status)); + } if (dateTimePatterns.isNull() || status == U_MISSING_RESOURCE_ERROR) { status = U_ZERO_ERROR; - dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), DT_DateTimeGregorianTag, - dateTimePatterns.orphan(), &status)); - ures_getByKeyWithFallback(dateTimePatterns.getAlias(), DT_DateTimePatternsTag, - dateTimePatterns.getAlias(), &status); + specificCalBundle.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), DT_DateTimeGregorianTag, + nullptr, &status)); + dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(specificCalBundle.getAlias(), DT_DateAtTimePatternsTag, // the %atTime variant, 4 entries + nullptr, &status)); } - if (U_FAILURE(status)) { return; } - - if (ures_getSize(dateTimePatterns.getAlias()) <= DateFormat::kDateTime) - { + if (U_SUCCESS(status) && (ures_getSize(dateTimePatterns.getAlias()) < 4)) { status = U_INVALID_FORMAT_ERROR; - return; } - resStr = ures_getStringByIndex(dateTimePatterns.getAlias(), (int32_t)DateFormat::kDateTime, &resStrLen, &status); - setDateTimeFormat(UnicodeString(TRUE, resStr, resStrLen)); + if (status == U_MISSING_RESOURCE_ERROR) { + // Try again with standard variant + status = U_ZERO_ERROR; + dateTimePatterns.orphan(); + dateTimeOffset = (int32_t)DateFormat::kDateTimeOffset; + if (!cTypeIsGregorian) { + specificCalBundle.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), cType, + nullptr, &status)); + dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(specificCalBundle.getAlias(), DT_DateTimePatternsTag, // the standard variant, 13 entries + nullptr, &status)); + } + if (dateTimePatterns.isNull() || status == U_MISSING_RESOURCE_ERROR) { + status = U_ZERO_ERROR; + specificCalBundle.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), DT_DateTimeGregorianTag, + nullptr, &status)); + dateTimePatterns.adoptInstead(ures_getByKeyWithFallback(specificCalBundle.getAlias(), DT_DateTimePatternsTag, // the standard variant, 13 entries + nullptr, &status)); + } + if (U_SUCCESS(status) && (ures_getSize(dateTimePatterns.getAlias()) <= DateFormat::kDateTimeOffset + DateFormat::kShort)) { + status = U_INVALID_FORMAT_ERROR; + } + } + if (U_FAILURE(status)) { return; } + for (int32_t style = UDAT_FULL; style <= UDAT_SHORT; style++) { + resStr = ures_getStringByIndex(dateTimePatterns.getAlias(), dateTimeOffset + style, &resStrLen, &status); + setDateTimeFormat((UDateFormatStyle)style, UnicodeString(true, resStr, resStrLen), status); + } } void @@ -1479,6 +1613,7 @@ DateTimePatternGenerator::getBestRaw(DateTimeMatcher& source, UErrorCode &status, const PtnSkeleton** specifiedSkeletonPtr) { int32_t bestDistance = 0x7fffffff; + int32_t bestMissingFieldMask = -1; DistanceInfo tempInfo; const UnicodeString *bestPattern=nullptr; const PtnSkeleton* specifiedSkeleton=nullptr; @@ -1492,8 +1627,15 @@ DateTimePatternGenerator::getBestRaw(DateTimeMatcher& source, continue; } int32_t distance=source.getDistance(trial, includeMask, tempInfo); - if (distancegetPatternFromSkeleton(*trial.getSkeletonPtr(), &specifiedSkeleton); missingFields->setTo(tempInfo); if (distance==0) { @@ -1546,14 +1688,16 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern, dtMatcher->skeleton.original.appendFieldTo(UDATPG_FRACTIONAL_SECOND_FIELD, field); } else if (dtMatcher->skeleton.type[typeValue]!=0) { // Here: - // - "reqField" is the field from the originally requested skeleton, with length - // "reqFieldLen". + // - "reqField" is the field from the originally requested skeleton after replacement + // of metacharacters 'j', 'C' and 'J', with length "reqFieldLen". // - "field" is the field from the found pattern. // // The adjusted field should consist of characters from the originally requested - // skeleton, except in the case of UDATPG_HOUR_FIELD or UDATPG_MONTH_FIELD or + // skeleton, except in the case of UDATPG_MONTH_FIELD or // UDATPG_WEEKDAY_FIELD or UDATPG_YEAR_FIELD, in which case it should consist - // of characters from the found pattern. + // of characters from the found pattern. In some cases of UDATPG_HOUR_FIELD, + // there is adjustment following the "defaultHourFormatChar". There is explanation + // how it is done below. // // The length of the adjusted field (adjFieldLen) should match that in the originally // requested skeleton, except that in the following cases the length of the adjusted field @@ -1567,16 +1711,20 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern, // a) The length of the field in the skeleton (skelFieldLen) is equal to reqFieldLen. // b) The pattern field is numeric and the skeleton field is not, or vice versa. - UChar reqFieldChar = dtMatcher->skeleton.original.getFieldChar(typeValue); + char16_t reqFieldChar = dtMatcher->skeleton.original.getFieldChar(typeValue); int32_t reqFieldLen = dtMatcher->skeleton.original.getFieldLength(typeValue); - if (reqFieldChar == dtptngen_CAP_E && reqFieldLen < 3) + if (reqFieldChar == CAP_E && reqFieldLen < 3) reqFieldLen = 3; // 1-3 for E are equivalent to 3 for c,e int32_t adjFieldLen = reqFieldLen; if ( (typeValue==UDATPG_HOUR_FIELD && (options & UDATPG_MATCH_HOUR_FIELD_LENGTH)==0) || (typeValue==UDATPG_MINUTE_FIELD && (options & UDATPG_MATCH_MINUTE_FIELD_LENGTH)==0) || (typeValue==UDATPG_SECOND_FIELD && (options & UDATPG_MATCH_SECOND_FIELD_LENGTH)==0) ) { adjFieldLen = field.length(); - } else if (specifiedSkeleton) { + } else if (specifiedSkeleton && reqFieldChar != LOW_C && reqFieldChar != LOW_E) { + // (we skip this section for 'c' and 'e' because unlike the other characters considered in this function, + // they have no minimum field length-- 'E' and 'EE' are equivalent to 'EEE', but 'e' and 'ee' are not + // equivalent to 'eee' -- see the entries for "week day" in + // https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table for more info) int32_t skelFieldLen = specifiedSkeleton->original.getFieldLength(typeValue); UBool patFieldIsNumeric = (row->type > 0); UBool skelFieldIsNumeric = (specifiedSkeleton->type[typeValue] > 0); @@ -1585,15 +1733,37 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern, adjFieldLen = field.length(); } } - UChar c = (typeValue!= UDATPG_HOUR_FIELD + char16_t c = (typeValue!= UDATPG_HOUR_FIELD && typeValue!= UDATPG_MONTH_FIELD && typeValue!= UDATPG_WEEKDAY_FIELD - && (typeValue!= UDATPG_YEAR_FIELD || reqFieldChar==dtptngen_CAP_Y)) + && (typeValue!= UDATPG_YEAR_FIELD || reqFieldChar==CAP_Y)) ? reqFieldChar : field.charAt(0); - if (typeValue == UDATPG_HOUR_FIELD && (flags & kDTPGSkeletonUsesCapJ) != 0) { - c = fDefaultHourFormatChar; + if (c == CAP_E && adjFieldLen < 3) { + c = LOW_E; + } + if (typeValue == UDATPG_HOUR_FIELD && fDefaultHourFormatChar != 0) { + // The adjustment here is required to match spec (https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-hour). + // It is necessary to match the hour-cycle preferred by the Locale. + // Given that, we need to do the following adjustments: + // 1. When hour-cycle is h11 it should replace 'h' by 'K'. + // 2. When hour-cycle is h23 it should replace 'H' by 'k'. + // 3. When hour-cycle is h24 it should replace 'k' by 'H'. + // 4. When hour-cycle is h12 it should replace 'K' by 'h'. + + if ((flags & kDTPGSkeletonUsesCapJ) != 0 || reqFieldChar == fDefaultHourFormatChar) { + c = fDefaultHourFormatChar; + } else if (reqFieldChar == LOW_H && fDefaultHourFormatChar == CAP_K) { + c = CAP_K; + } else if (reqFieldChar == CAP_H && fDefaultHourFormatChar == LOW_K) { + c = LOW_K; + } else if (reqFieldChar == LOW_K && fDefaultHourFormatChar == CAP_H) { + c = CAP_H; + } else if (reqFieldChar == CAP_K && fDefaultHourFormatChar == LOW_H) { + c = LOW_H; + } } + field.remove(); for (int32_t j=adjFieldLen; j>0; --j) { field += c; @@ -1808,14 +1978,14 @@ DateTimePatternGenerator::getRedundants(UErrorCode& status) { UBool DateTimePatternGenerator::isCanonicalItem(const UnicodeString& item) const { if ( item.length() != 1 ) { - return FALSE; + return false; } for (int32_t i=0; iisDupAllowed = other.isDupAllowed; - for (int32_t bootIndex = 0; bootIndex < dtptngen_MAX_PATTERN_ENTRIES; ++bootIndex) { + for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) { PtnElem *curElem, *otherElem, *prevElem=nullptr; otherElem = other.boot[bootIndex]; while (otherElem != nullptr) { @@ -1862,7 +2032,7 @@ PatternMap::copyFrom(const PatternMap& other, UErrorCode& status) { if (prevElem != nullptr) { prevElem->next.adoptInstead(curElem); } else { - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } prevElem = curElem; @@ -1873,15 +2043,15 @@ PatternMap::copyFrom(const PatternMap& other, UErrorCode& status) { } PtnElem* -PatternMap::getHeader(UChar baseChar) const { +PatternMap::getHeader(char16_t baseChar) const { PtnElem* curElem; - if ( (baseChar >= dtptngen_CAP_A) && (baseChar <= dtptngen_CAP_Z) ) { - curElem = boot[baseChar-dtptngen_CAP_A]; + if ( (baseChar >= CAP_A) && (baseChar <= CAP_Z) ) { + curElem = boot[baseChar-CAP_A]; } else { - if ( (baseChar >=dtptngen_LOW_A) && (baseChar <= dtptngen_LOW_Z) ) { - curElem = boot[26+baseChar-dtptngen_LOW_A]; + if ( (baseChar >=LOW_A) && (baseChar <= LOW_Z) ) { + curElem = boot[26+baseChar-LOW_A]; } else { return nullptr; @@ -1891,7 +2061,7 @@ PatternMap::getHeader(UChar baseChar) const { } PatternMap::~PatternMap() { - for (int32_t i=0; i < dtptngen_MAX_PATTERN_ENTRIES; ++i ) { + for (int32_t i=0; i < MAX_PATTERN_ENTRIES; ++i ) { if (boot[i] != nullptr ) { delete boot[i]; boot[i] = nullptr; @@ -1905,17 +2075,17 @@ PatternMap::add(const UnicodeString& basePattern, const UnicodeString& value,// mapped pattern value UBool skeletonWasSpecified, UErrorCode &status) { - UChar baseChar = basePattern.charAt(0); + char16_t baseChar = basePattern.charAt(0); PtnElem *curElem, *baseElem; status = U_ZERO_ERROR; // the baseChar must be A-Z or a-z - if ((baseChar >= dtptngen_CAP_A) && (baseChar <= dtptngen_CAP_Z)) { - baseElem = boot[baseChar-dtptngen_CAP_A]; + if ((baseChar >= CAP_A) && (baseChar <= CAP_Z)) { + baseElem = boot[baseChar-CAP_A]; } else { - if ((baseChar >=dtptngen_LOW_A) && (baseChar <= dtptngen_LOW_Z)) { - baseElem = boot[26+baseChar-dtptngen_LOW_A]; + if ((baseChar >=LOW_A) && (baseChar <= LOW_Z)) { + baseElem = boot[26+baseChar-LOW_A]; } else { status = U_ILLEGAL_CHARACTER; @@ -1933,11 +2103,11 @@ PatternMap::add(const UnicodeString& basePattern, return; // out of memory } newElem->skeletonWasSpecified = skeletonWasSpecified; - if (baseChar >= dtptngen_LOW_A) { - boot[26 + (baseChar - dtptngen_LOW_A)] = newElem.orphan(); // the boot array now owns the PtnElem. + if (baseChar >= LOW_A) { + boot[26 + (baseChar - LOW_A)] = newElem.orphan(); // the boot array now owns the PtnElem. } else { - boot[baseChar - dtptngen_CAP_A] = newElem.orphan(); // the boot array now owns the PtnElem. + boot[baseChar - CAP_A] = newElem.orphan(); // the boot array now owns the PtnElem. } } if ( baseElem != nullptr ) { @@ -1999,10 +2169,10 @@ PatternMap::getPatternFromBasePattern(const UnicodeString& basePattern, UBool& s // Find the pattern from the given skeleton. -// At least when this is called from getBestRaw & addPattern (in which case specifiedSkeletonPtr is non-NULL), +// At least when this is called from getBestRaw & addPattern (in which case specifiedSkeletonPtr is non-nullptr), // the comparison should be based on skeleton.original (which is unique and tied to the distance measurement in bestRaw) // and not skeleton.baseOriginal (which is not unique); otherwise we may pick a different skeleton than the one with the -// optimum distance value in getBestRaw. When this is called from public getRedundants (specifiedSkeletonPtr is NULL), +// optimum distance value in getBestRaw. When this is called from public getRedundants (specifiedSkeletonPtr is nullptr), // for now it will continue to compare based on baseOriginal so as not to change the behavior unnecessarily. const UnicodeString * PatternMap::getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr) const { // key to search for @@ -2013,7 +2183,7 @@ PatternMap::getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleto } // find boot entry - UChar baseChar = skeleton.getFirstChar(); + char16_t baseChar = skeleton.getFirstChar(); if ((curElem=getHeader(baseChar))==nullptr) { return nullptr; // no match } @@ -2040,14 +2210,14 @@ PatternMap::getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleto UBool PatternMap::equals(const PatternMap& other) const { if ( this==&other ) { - return TRUE; + return true; } - for (int32_t bootIndex = 0; bootIndex < dtptngen_MAX_PATTERN_ENTRIES; ++bootIndex) { + for (int32_t bootIndex = 0; bootIndex < MAX_PATTERN_ENTRIES; ++bootIndex) { if (boot[bootIndex] == other.boot[bootIndex]) { continue; } if ((boot[bootIndex] == nullptr) || (other.boot[bootIndex] == nullptr)) { - return FALSE; + return false; } PtnElem *otherElem = other.boot[bootIndex]; PtnElem *myElem = boot[bootIndex]; @@ -2056,25 +2226,25 @@ PatternMap::equals(const PatternMap& other) const { break; } if ((otherElem == nullptr) || (myElem == nullptr)) { - return FALSE; + return false; } if ( (myElem->basePattern != otherElem->basePattern) || (myElem->pattern != otherElem->pattern) ) { - return FALSE; + return false; } if ((myElem->skeleton.getAlias() != otherElem->skeleton.getAlias()) && !myElem->skeleton->equals(*(otherElem->skeleton))) { - return FALSE; + return false; } myElem = myElem->next.getAlias(); otherElem = otherElem->next.getAlias(); } } - return TRUE; + return true; } // find any key existing in the mapping table already. -// return TRUE if there is an existing key, otherwise return FALSE. +// return true if there is an existing key, otherwise return false. PtnElem* PatternMap::getDuplicateElem( const UnicodeString &basePattern, @@ -2090,10 +2260,10 @@ PatternMap::getDuplicateElem( } do { if ( basePattern.compare(curElem->basePattern)==0 ) { - UBool isEqual = TRUE; + UBool isEqual = true; for (int32_t i = 0; i < UDATPG_FIELD_COUNT; ++i) { if (curElem->skeleton->type[i] != skeleton.type[i] ) { - isEqual = FALSE; + isEqual = false; break; } } @@ -2109,7 +2279,7 @@ PatternMap::getDuplicateElem( } // PatternMap::getDuplicateElem -DateTimeMatcher::DateTimeMatcher(void) { +DateTimeMatcher::DateTimeMatcher() { } DateTimeMatcher::~DateTimeMatcher() {} @@ -2118,6 +2288,11 @@ DateTimeMatcher::DateTimeMatcher(const DateTimeMatcher& other) { copyFrom(other.skeleton); } +DateTimeMatcher& DateTimeMatcher::operator=(const DateTimeMatcher& other) { + copyFrom(other.skeleton); + return *this; +} + void DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp) { @@ -2129,11 +2304,11 @@ void DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton& skeletonResult) { int32_t i; for (i=0; iset(pattern); for (i=0; i < fp->itemNumber; i++) { @@ -2152,7 +2327,7 @@ DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton const dtTypeElem *row = &dtTypes[canonicalIndex]; int32_t field = row->field; skeletonResult.original.populate(field, value); - UChar repeatChar = row->patternChar; + char16_t repeatChar = row->patternChar; int32_t repeatCount = row->minLen; skeletonResult.baseOriginal.populate(field, repeatChar, repeatCount); int16_t subField = row->type; @@ -2162,9 +2337,36 @@ DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton } skeletonResult.type[field] = subField; } + + // #20739, we have a skeleton with minutes and milliseconds, but no seconds + // + // Theoretically we would need to check and fix all fields with "gaps": + // for example year-day (no month), month-hour (no day), and so on, All the possible field combinations. + // Plus some smartness: year + hour => should we add month, or add day-of-year? + // What about month + day-of-week, or month + am/pm indicator. + // I think beyond a certain point we should not try to fix bad developer input and try guessing what they mean. + // Garbage in, garbage out. + if (!skeletonResult.original.isFieldEmpty(UDATPG_MINUTE_FIELD) + && !skeletonResult.original.isFieldEmpty(UDATPG_FRACTIONAL_SECOND_FIELD) + && skeletonResult.original.isFieldEmpty(UDATPG_SECOND_FIELD)) { + // Force the use of seconds + for (i = 0; dtTypes[i].patternChar != 0; i++) { + if (dtTypes[i].field == UDATPG_SECOND_FIELD) { + // first entry for UDATPG_SECOND_FIELD + skeletonResult.original.populate(UDATPG_SECOND_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen); + skeletonResult.baseOriginal.populate(UDATPG_SECOND_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen); + // We add value.length, same as above, when type is first initialized. + // The value we want to "fake" here is "s", and 1 means "s".length() + int16_t subField = dtTypes[i].type; + skeletonResult.type[UDATPG_SECOND_FIELD] = (subField > 0) ? subField + 1 : subField; + break; + } + } + } + // #13183, handle special behavior for day period characters (a, b, B) if (!skeletonResult.original.isFieldEmpty(UDATPG_HOUR_FIELD)) { - if (skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==dtptngen_LOW_H || skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==dtptngen_CAP_K) { + if (skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==LOW_H || skeletonResult.original.getFieldChar(UDATPG_HOUR_FIELD)==CAP_K) { // We have a skeleton with 12-hour-cycle format if (skeletonResult.original.isFieldEmpty(UDATPG_DAYPERIOD_FIELD)) { // But we do not have a day period in the skeleton; add the default DAYPERIOD (currently "a") @@ -2174,7 +2376,7 @@ DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton skeletonResult.original.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen); skeletonResult.baseOriginal.populate(UDATPG_DAYPERIOD_FIELD, dtTypes[i].patternChar, dtTypes[i].minLen); skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = dtTypes[i].type; - skeletonResult.addedDefaultDayPeriod = TRUE; + skeletonResult.addedDefaultDayPeriod = true; break; } } @@ -2183,7 +2385,7 @@ DateTimeMatcher::set(const UnicodeString& pattern, FormatParser* fp, PtnSkeleton // Skeleton has 24-hour-cycle hour format and has dayPeriod, delete dayPeriod (i.e. ignore it) skeletonResult.original.clearField(UDATPG_DAYPERIOD_FIELD); skeletonResult.baseOriginal.clearField(UDATPG_DAYPERIOD_FIELD); - skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = dtptngen_NONE; + skeletonResult.type[UDATPG_DAYPERIOD_FIELD] = NONE; } } copyFrom(skeletonResult); @@ -2212,12 +2414,12 @@ DateTimeMatcher::getDistance(const DateTimeMatcher& other, int32_t includeMask, continue; } if (myType==0) {// and other is not - result += dtptngen_EXTRA_FIELD; + result += EXTRA_FIELD; distanceInfo.addExtra(i); } else { if (otherType==0) { - result += dtptngen_MISSING_FIELD; + result += MISSING_FIELD; distanceInfo.addMissing(i); } else { @@ -2242,7 +2444,7 @@ DateTimeMatcher::copyFrom() { UBool DateTimeMatcher::equals(const DateTimeMatcher* other) const { - if (other==nullptr) { return FALSE; } + if (other==nullptr) { return false; } return skeleton.original == other->skeleton.original; } @@ -2283,8 +2485,8 @@ FormatParser::setTokens(const UnicodeString& pattern, int32_t startPos, int32_t } // check the current char is between A-Z or a-z do { - UChar c=pattern.charAt(curLoc); - if ( (c>=dtptngen_CAP_A && c<=dtptngen_CAP_Z) || (c>=dtptngen_LOW_A && c<=dtptngen_LOW_Z) ) { + char16_t c=pattern.charAt(curLoc); + if ( (c>=CAP_A && c<=CAP_Z) || (c>=LOW_A && c<=LOW_Z) ) { curLoc++; } else { @@ -2318,7 +2520,7 @@ FormatParser::set(const UnicodeString& pattern) { else { break; } - } while (result==ADD_TOKEN && itemNumber < dtptngen_MAX_DT_TOKEN); + } while (result==ADD_TOKEN && itemNumber < MAX_DT_TOKEN); } int32_t @@ -2327,7 +2529,7 @@ FormatParser::getCanonicalIndex(const UnicodeString& s, UBool strict) { if (len == 0) { return -1; } - UChar ch = s.charAt(0); + char16_t ch = s.charAt(0); // Verify that all are the same character. for (int32_t l = 1; l < len; l++) { @@ -2357,7 +2559,7 @@ FormatParser::getCanonicalIndex(const UnicodeString& s, UBool strict) { UBool FormatParser::isQuoteLiteral(const UnicodeString& s) { - return (UBool)(s.charAt(0) == dtptngen_SINGLE_QUOTE); + return (UBool)(s.charAt(0) == SINGLE_QUOTE); } // This function assumes the current itemIndex points to the quote literal. @@ -2367,13 +2569,13 @@ FormatParser::getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex) { int32_t i = *itemIndex; quote.remove(); - if (items[i].charAt(0)==dtptngen_SINGLE_QUOTE) { + if (items[i].charAt(0)==SINGLE_QUOTE) { quote += items[i]; ++i; } while ( i < itemNumber ) { - if ( items[i].charAt(0)==dtptngen_SINGLE_QUOTE ) { - if ( (i+1next != nullptr ) { - return TRUE; + return true; } else { headIndex++; @@ -2461,7 +2663,7 @@ PatternMapIterator::hasNext() const { } else { if ( patternMap->boot[headIndex] != nullptr ) { - return TRUE; + return true; } else { headIndex++; @@ -2469,12 +2671,12 @@ PatternMapIterator::hasNext() const { } } } - return FALSE; + return false; } DateTimeMatcher& PatternMapIterator::next() { - while ( bootIndex < dtptngen_MAX_PATTERN_ENTRIES ) { + while ( bootIndex < MAX_PATTERN_ENTRIES ) { if ( nodePtr != nullptr ) { if ( nodePtr->next != nullptr ) { nodePtr = nodePtr->next.getAlias(); @@ -2527,7 +2729,7 @@ void SkeletonFields::clearField(int32_t field) { lengths[field] = 0; } -UChar SkeletonFields::getFieldChar(int32_t field) const { +char16_t SkeletonFields::getFieldChar(int32_t field) const { return chars[field]; } @@ -2539,7 +2741,7 @@ void SkeletonFields::populate(int32_t field, const UnicodeString& value) { populate(field, value.charAt(0), value.length()); } -void SkeletonFields::populate(int32_t field, UChar ch, int32_t length) { +void SkeletonFields::populate(int32_t field, char16_t ch, int32_t length) { chars[field] = (int8_t) ch; lengths[field] = (int8_t) length; } @@ -2556,7 +2758,7 @@ UnicodeString& SkeletonFields::appendTo(UnicodeString& string) const { } UnicodeString& SkeletonFields::appendFieldTo(int32_t field, UnicodeString& string) const { - UChar ch(chars[field]); + char16_t ch(chars[field]); int32_t length = (int32_t) lengths[field]; for (int32_t i=0; i= 0) { + if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) { // for backward compatibility: if DateTimeMatcher.set added a single 'a' that // was not in the provided skeleton, remove it here before returning skeleton. result.remove(pos, 1); @@ -2621,7 +2823,7 @@ PtnSkeleton::getBaseSkeleton() const { UnicodeString result; result = baseOriginal.appendTo(result); int32_t pos; - if (addedDefaultDayPeriod && (pos = result.indexOf(dtptngen_LOW_A)) >= 0) { + if (addedDefaultDayPeriod && (pos = result.indexOf(LOW_A)) >= 0) { // for backward compatibility: if DateTimeMatcher.set added a single 'a' that // was not in the provided skeleton, remove it here before returning skeleton. result.remove(pos, 1); @@ -2629,7 +2831,7 @@ PtnSkeleton::getBaseSkeleton() const { return result; } -UChar +char16_t PtnSkeleton::getFirstChar() const { return baseOriginal.getFirstChar(); } @@ -2657,7 +2859,7 @@ DTSkeletonEnumeration::DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum t return; } - for (bootIndex=0; bootIndex newElem(new UnicodeString(s), status); - if (U_FAILURE(status)) { + LocalPointer newElem(s.clone(), status); + if (U_FAILURE(status)) { return; } fSkeletons->addElement(newElem.getAlias(), status); @@ -2682,12 +2884,13 @@ DTSkeletonEnumeration::DTSkeletonEnumeration(PatternMap& patternMap, dtStrEnum t fSkeletons.adoptInstead(nullptr); return; } - newElem.orphan(); // fSkeletons vector now owns the UnicodeString. + newElem.orphan(); // fSkeletons vector now owns the UnicodeString (although it + // does not use a deleter function to manage the ownership). } curElem = curElem->next.getAlias(); } } - if ((bootIndex==dtptngen_MAX_PATTERN_ENTRIES) && (curElem!=nullptr) ) { + if ((bootIndex==MAX_PATTERN_ENTRIES) && (curElem!=nullptr) ) { status = U_BUFFER_OVERFLOW_ERROR; } } @@ -2713,14 +2916,14 @@ DTSkeletonEnumeration::count(UErrorCode& /*status*/) const { UBool DTSkeletonEnumeration::isCanonicalItem(const UnicodeString& item) { if ( item.length() != 1 ) { - return FALSE; + return false; } for (int32_t i=0; igetOffset(localMillis, FALSE, rawOffset, dstOffset, ec); + zone->getOffset(localMillis, false, rawOffset, dstOffset, ec); delete zone; localMillis += (rawOffset + dstOffset); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/esctrn.h b/src/duckdb/extension/icu/third_party/icu/i18n/esctrn.h index 2a2c6dcfe..a4282ea86 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/esctrn.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/esctrn.h @@ -115,12 +115,12 @@ class EscapeTransliterator : public Transliterator { /** * Transliterator API. */ - virtual EscapeTransliterator* clone() const; + virtual EscapeTransliterator* clone() const override; /** * ICU "poor man's RTTI", returns a UClassID for the actual class. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; /** * ICU "poor man's RTTI", returns a UClassID for this class. @@ -133,7 +133,7 @@ class EscapeTransliterator : public Transliterator { * Implements {@link Transliterator#handleTransliterate}. */ virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, - UBool isIncremental) const; + UBool isIncremental) const override; }; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.cpp index a53cce843..be4010843 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.cpp @@ -19,6 +19,7 @@ U_NAMESPACE_BEGIN UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EthiopicCalendar) +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EthiopicAmeteAlemCalendar) //static const int32_t JD_EPOCH_OFFSET_AMETE_ALEM = -285019; static const int32_t JD_EPOCH_OFFSET_AMETE_MIHRET = 1723856; @@ -29,16 +30,8 @@ static const int32_t AMETE_MIHRET_DELTA = 5500; // 5501 - 1 (Amete Alem 5501 = A //------------------------------------------------------------------------- EthiopicCalendar::EthiopicCalendar(const Locale& aLocale, - UErrorCode& success, - EEraType type /*= AMETE_MIHRET_ERA*/) -: CECalendar(aLocale, success), - eraType(type) -{ -} - -EthiopicCalendar::EthiopicCalendar(const EthiopicCalendar& other) -: CECalendar(other), - eraType(other.eraType) + UErrorCode& success) +: CECalendar(aLocale, success) { } @@ -55,24 +48,9 @@ EthiopicCalendar::clone() const const char * EthiopicCalendar::getType() const { - if (isAmeteAlemEra()) { - return "ethiopic-amete-alem"; - } return "ethiopic"; } -void -EthiopicCalendar::setAmeteAlemEra(UBool onOff) -{ - eraType = onOff ? AMETE_ALEM_ERA : AMETE_MIHRET_ERA; -} - -UBool -EthiopicCalendar::isAmeteAlemEra() const -{ - return (eraType == AMETE_ALEM_ERA); -} - //------------------------------------------------------------------------- // Calendar framework //------------------------------------------------------------------------- @@ -82,70 +60,58 @@ EthiopicCalendar::handleGetExtendedYear() { // Ethiopic calendar uses EXTENDED_YEAR aligned to // Amelete Hihret year always. - int32_t eyear; if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR) { - eyear = internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 - } else if (isAmeteAlemEra()) { - eyear = internalGet(UCAL_YEAR, 1 + AMETE_MIHRET_DELTA) - - AMETE_MIHRET_DELTA; // Default to year 1 of Amelete Mihret - } else { - // The year defaults to the epoch start, the era to AMETE_MIHRET - int32_t era = internalGet(UCAL_ERA, AMETE_MIHRET); - if (era == AMETE_MIHRET) { - eyear = internalGet(UCAL_YEAR, 1); // Default to year 1 - } else { - eyear = internalGet(UCAL_YEAR, 1) - AMETE_MIHRET_DELTA; - } + return internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 + } + // The year defaults to the epoch start, the era to AMETE_MIHRET + if (internalGet(UCAL_ERA, AMETE_MIHRET) == AMETE_MIHRET) { + return internalGet(UCAL_YEAR, 1); // Default to year 1 } - return eyear; + return internalGet(UCAL_YEAR, 1) - AMETE_MIHRET_DELTA; } void EthiopicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &/*status*/) { - int32_t eyear, month, day, era, year; + int32_t eyear, month, day; jdToCE(julianDay, getJDEpochOffset(), eyear, month, day); - if (isAmeteAlemEra()) { - era = AMETE_ALEM; - year = eyear + AMETE_MIHRET_DELTA; - } else { - if (eyear > 0) { - era = AMETE_MIHRET; - year = eyear; - } else { - era = AMETE_ALEM; - year = eyear + AMETE_MIHRET_DELTA; - } - } - internalSet(UCAL_EXTENDED_YEAR, eyear); - internalSet(UCAL_ERA, era); - internalSet(UCAL_YEAR, year); + internalSet(UCAL_ERA, (eyear > 0) ? AMETE_MIHRET : AMETE_ALEM); + internalSet(UCAL_YEAR, (eyear > 0) ? eyear : (eyear + AMETE_MIHRET_DELTA)); internalSet(UCAL_MONTH, month); + internalSet(UCAL_ORDINAL_MONTH, month); internalSet(UCAL_DATE, day); internalSet(UCAL_DAY_OF_YEAR, (30 * month) + day); } -int32_t -EthiopicCalendar::handleGetLimit(UCalendarDateFields field, ELimitType limitType) const +constexpr uint32_t kEthiopicRelatedYearDiff = 8; + +int32_t EthiopicCalendar::getRelatedYear(UErrorCode &status) const { - if (isAmeteAlemEra() && field == UCAL_ERA) { - return 0; // Only one era in this mode, era is always 0 + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; } - return CECalendar::handleGetLimit(field, limitType); + return year + kEthiopicRelatedYearDiff; +} + +void EthiopicCalendar::setRelatedYear(int32_t year) +{ + // set extended year + set(UCAL_EXTENDED_YEAR, year - kEthiopicRelatedYearDiff); } /** * The system maintains a static default century start date and Year. They are - * initialized the first time they are used. Once the system default century date + * initialized the first time they are used. Once the system default century date * and year are set, they do not change. */ -static UDate gethpccal_gSystemDefaultCenturyStart = DBL_MIN; -static int32_t gethpccal_gSystemDefaultCenturyStartYear = -1; -static icu::UInitOnce gethpccal_gSystemDefaultCenturyInit = U_INITONCE_INITIALIZER; +static UDate gSystemDefaultCenturyStart = DBL_MIN; +static int32_t gSystemDefaultCenturyStartYear = -1; +static icu::UInitOnce gSystemDefaultCenturyInit {}; -static void U_CALLCONV ethpccal_initializeSystemDefaultCentury() +static void U_CALLCONV initializeSystemDefaultCentury() { UErrorCode status = U_ZERO_ERROR; EthiopicCalendar calendar(Locale("@calendar=ethiopic"), status); @@ -153,8 +119,8 @@ static void U_CALLCONV ethpccal_initializeSystemDefaultCentury() calendar.setTime(Calendar::getNow(), status); calendar.add(UCAL_YEAR, -80, status); - gethpccal_gSystemDefaultCenturyStart = calendar.getTime(status); - gethpccal_gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); + gSystemDefaultCenturyStart = calendar.getTime(status); + gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); } // We have no recourse upon failure unless we want to propagate the failure // out. @@ -164,19 +130,16 @@ UDate EthiopicCalendar::defaultCenturyStart() const { // lazy-evaluate systemDefaultCenturyStart - umtx_initOnce(gethpccal_gSystemDefaultCenturyInit, ðpccal_initializeSystemDefaultCentury); - return gethpccal_gSystemDefaultCenturyStart; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStart; } int32_t EthiopicCalendar::defaultCenturyStartYear() const { // lazy-evaluate systemDefaultCenturyStartYear - umtx_initOnce(gethpccal_gSystemDefaultCenturyInit, ðpccal_initializeSystemDefaultCentury); - if (isAmeteAlemEra()) { - return gethpccal_gSystemDefaultCenturyStartYear + AMETE_MIHRET_DELTA; - } - return gethpccal_gSystemDefaultCenturyStartYear; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStartYear; } @@ -202,6 +165,95 @@ EthiopicCalendar::ethiopicToJD(int32_t year, int32_t month, int32_t date) } #endif +//------------------------------------------------------------------------- +// Constructors... +//------------------------------------------------------------------------- + +EthiopicAmeteAlemCalendar::EthiopicAmeteAlemCalendar(const Locale& aLocale, + UErrorCode& success) +: EthiopicCalendar(aLocale, success) +{ +} + +EthiopicAmeteAlemCalendar::~EthiopicAmeteAlemCalendar() +{ +} + +EthiopicAmeteAlemCalendar* +EthiopicAmeteAlemCalendar::clone() const +{ + return new EthiopicAmeteAlemCalendar(*this); +} + +//------------------------------------------------------------------------- +// Calendar framework +//------------------------------------------------------------------------- + +const char * +EthiopicAmeteAlemCalendar::getType() const +{ + return "ethiopic-amete-alem"; +} + +int32_t +EthiopicAmeteAlemCalendar::handleGetExtendedYear() +{ + // Ethiopic calendar uses EXTENDED_YEAR aligned to + // Amelete Hihret year always. + if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR) { + return internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 + } + return internalGet(UCAL_YEAR, 1 + AMETE_MIHRET_DELTA) + - AMETE_MIHRET_DELTA; // Default to year 1 of Amelete Mihret +} + +void +EthiopicAmeteAlemCalendar::handleComputeFields(int32_t julianDay, UErrorCode &/*status*/) +{ + int32_t eyear, month, day; + jdToCE(julianDay, getJDEpochOffset(), eyear, month, day); + + internalSet(UCAL_EXTENDED_YEAR, eyear); + internalSet(UCAL_ERA, AMETE_ALEM); + internalSet(UCAL_YEAR, eyear + AMETE_MIHRET_DELTA); + internalSet(UCAL_MONTH, month); + internalSet(UCAL_ORDINAL_MONTH, month); + internalSet(UCAL_DATE, day); + internalSet(UCAL_DAY_OF_YEAR, (30 * month) + day); +} + +int32_t +EthiopicAmeteAlemCalendar::handleGetLimit(UCalendarDateFields field, ELimitType limitType) const +{ + if (field == UCAL_ERA) { + return 0; // Only one era in this mode, era is always 0 + } + return EthiopicCalendar::handleGetLimit(field, limitType); +} + +constexpr uint32_t kEthiopicAmeteAlemRelatedYearDiff = -5492; + +int32_t EthiopicAmeteAlemCalendar::getRelatedYear(UErrorCode &status) const +{ + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; + } + return year + kEthiopicAmeteAlemRelatedYearDiff; +} + +void EthiopicAmeteAlemCalendar::setRelatedYear(int32_t year) +{ + // set extended year + set(UCAL_EXTENDED_YEAR, year - kEthiopicAmeteAlemRelatedYearDiff); +} + +int32_t +EthiopicAmeteAlemCalendar::defaultCenturyStartYear() const +{ + return EthiopicCalendar::defaultCenturyStartYear() + AMETE_MIHRET_DELTA; +} + U_NAMESPACE_END #endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.h b/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.h index d1e8f424b..19d9e0efb 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.h @@ -26,15 +26,6 @@ U_NAMESPACE_BEGIN class EthiopicCalendar : public CECalendar { public: - /** - * Calendar type - use Amete Alem era for all the time or not - * @internal - */ - enum EEraType { - AMETE_MIHRET_ERA, - AMETE_ALEM_ERA - }; - /** * Useful constants for EthiopicCalendar. * @internal @@ -98,7 +89,7 @@ class EthiopicCalendar : public CECalendar { /** * Constant for ነሐሴ, the 12th month of the Ethiopic year. */ - NEHASSA, + NEHASSE, /** * Constant for ጳጉሜን, the 13th month of the Ethiopic year. @@ -122,13 +113,13 @@ class EthiopicCalendar : public CECalendar { * only use Amete Alem for all the time. * @internal */ - EthiopicCalendar(const Locale& aLocale, UErrorCode& success, EEraType type = AMETE_MIHRET_ERA); + EthiopicCalendar(const Locale& aLocale, UErrorCode& success); /** * Copy Constructor * @internal */ - EthiopicCalendar(const EthiopicCalendar& other); + EthiopicCalendar(const EthiopicCalendar& other) = default; /** * Destructor. @@ -141,28 +132,28 @@ class EthiopicCalendar : public CECalendar { * @return return a polymorphic copy of this calendar. * @internal */ - virtual EthiopicCalendar* clone() const; + virtual EthiopicCalendar* clone() const override; /** - * return the calendar type, "ethiopic" + * Return the calendar type, "ethiopic" * @return calendar type * @internal */ - virtual const char * getType() const; + virtual const char * getType() const override; /** - * Set Alem or Mihret era. - * @param onOff Set Amete Alem era if true, otherwise set Amete Mihret era. + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field * @internal */ - void setAmeteAlemEra (UBool onOff); + virtual int32_t getRelatedYear(UErrorCode &status) const override; /** - * Return true if this calendar is set to the Amete Alem era. - * @return true if set to the Amete Alem era. + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field * @internal */ - UBool isAmeteAlemEra() const; + virtual void setRelatedYear(int32_t year) override; protected: //------------------------------------------------------------------------- @@ -171,52 +162,39 @@ class EthiopicCalendar : public CECalendar { /** * Return the extended year defined by the current fields. + * This calendar uses both AMETE_ALEM and AMETE_MIHRET. + * + * EXTENDED_YEAR ERA YEAR + * 0 AMETE_ALEM 5500 + * 1 AMETE_MIHRET 1 * @internal */ - virtual int32_t handleGetExtendedYear(); + virtual int32_t handleGetExtendedYear() override; /** * Compute fields from the JD * @internal */ - virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); - - /** - * Calculate the limit for a specified type of limit and field - * @internal - */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; /** * Returns the date of the start of the default century * @return start of century - in milliseconds since epoch, 1970 * @internal */ - virtual UDate defaultCenturyStart() const; + virtual UDate defaultCenturyStart() const override; /** * Returns the year in which the default century begins * @internal */ - virtual int32_t defaultCenturyStartYear() const; + virtual int32_t defaultCenturyStartYear() const override; /** * Return the date offset from Julian * @internal */ - virtual int32_t getJDEpochOffset() const; - -private: - /** - * When eraType is AMETE_ALEM_ERA, then this calendar use only AMETE_ALEM - * for the era. Otherwise (default), this calendar uses both AMETE_ALEM - * and AMETE_MIHRET. - * - * EXTENDED_YEAR AMETE_ALEM_ERA AMETE_MIHRET_ERA - * 0 Amete Alem 5500 Amete Alem 5500 - * 1 Amete Mihret 1 Amete Alem 5501 - */ - EEraType eraType; + virtual int32_t getJDEpochOffset() const override; public: /** @@ -229,7 +207,7 @@ class EthiopicCalendar : public CECalendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -242,7 +220,7 @@ class EthiopicCalendar : public CECalendar { * @return The class ID for all objects of this class. * @internal */ - U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); #if 0 // We do not want to introduce this API in ICU4C. @@ -266,6 +244,123 @@ class EthiopicCalendar : public CECalendar { #endif }; +/** + * Implement the Ethiopic Amete Alem calendar system. + * @internal + */ +class EthiopicAmeteAlemCalendar : public EthiopicCalendar { + +public: + /** + * Constructs a EthiopicAmeteAlemCalendar based on the current time in the default time zone + * with the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the status of EthiopicCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @internal + */ + EthiopicAmeteAlemCalendar(const Locale& aLocale, UErrorCode& success); + + /** + * Copy Constructor + * @internal + */ + EthiopicAmeteAlemCalendar(const EthiopicAmeteAlemCalendar& other) = default; + + /** + * Destructor. + * @internal + */ + virtual ~EthiopicAmeteAlemCalendar(); + + /** + * Create and return a polymorphic copy of this calendar. + * @return return a polymorphic copy of this calendar. + * @internal + */ + virtual EthiopicAmeteAlemCalendar* clone() const override; + + /** + * Return the calendar type, "ethiopic-amete-alem" + * @return calendar type + * @internal + */ + virtual const char * getType() const override; + + /** + * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual + * override. This method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call + * this method. + * + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @internal + */ + virtual UClassID getDynamicClassID() const override; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @internal + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const override; + + /** + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field + * @internal + */ + virtual void setRelatedYear(int32_t year) override; + +protected: + //------------------------------------------------------------------------- + // Calendar framework + //------------------------------------------------------------------------- + + /** + * Return the extended year defined by the current fields. + * This calendar use only AMETE_ALEM for the era. + * + * EXTENDED_YEAR ERA YEAR + * 0 AMETE_ALEM 5500 + * 1 AMETE_ALEM 5501 + * @internal + */ + virtual int32_t handleGetExtendedYear() override; + + /** + * Compute fields from the JD + * @internal + */ + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; + + /** + * Calculate the limit for a specified type of limit and field + * @internal + */ + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; + /** + * Returns the year in which the default century begins + * @internal + */ + virtual int32_t defaultCenturyStartYear() const override; +}; + U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ #endif /* ETHPCCAL_H */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp index f5d94cd44..65dafc95a 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp @@ -53,10 +53,10 @@ using number::impl::DecimalQuantity; // NOTE: These inlines assume that all fObjects are in fact instances // of the Measure class, which is true as of 3.0. [alan] -// Return TRUE if *a == *b. +// Return true if *a == *b. static inline UBool objectEquals(const UObject* a, const UObject* b) { // LATER: return *a == *b; - return *((const Measure*) a) == *((const Measure*) b); + return *((const Measure*) a) == *b; } // Return a clone of *a. @@ -65,9 +65,9 @@ static inline UObject* objectClone(const UObject* a) { return ((const Measure*) a)->clone(); } -// Return TRUE if *a is an instance of Measure. +// Return true if *a is an instance of Measure. static inline UBool instanceOfMeasure(const UObject* a) { - return dynamic_cast(a) != NULL; + return dynamic_cast(a) != nullptr; } /** @@ -79,7 +79,7 @@ static inline UBool instanceOfMeasure(const UObject* a) { */ static Formattable* createArrayCopy(const Formattable* array, int32_t count) { Formattable *result = new Formattable[count]; - if (result != NULL) { + if (result != nullptr) { for (int32_t i=0; i INT32_MAX) { @@ -421,7 +421,7 @@ Formattable::getLong(UErrorCode& status) const return (int32_t)fValue.fDouble; // loses fraction } case Formattable::kObject: - if (fValue.fObject == NULL) { + if (fValue.fObject == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -450,10 +450,10 @@ Formattable::getInt64(UErrorCode& status) const if (U_FAILURE(status)) { return 0; } - + switch (fType) { - case Formattable::kLong: - case Formattable::kInt64: + case Formattable::kLong: + case Formattable::kInt64: return fValue.fInt64; case Formattable::kDouble: if (fValue.fDouble > (double)U_INT64_MAX) { @@ -462,7 +462,7 @@ Formattable::getInt64(UErrorCode& status) const } else if (fValue.fDouble < (double)U_INT64_MIN) { status = U_INVALID_FORMAT_ERROR; return U_INT64_MIN; - } else if (fabs(fValue.fDouble) > U_DOUBLE_MAX_EXACT_INT && fDecimalQuantity != NULL) { + } else if (fabs(fValue.fDouble) > U_DOUBLE_MAX_EXACT_INT && fDecimalQuantity != nullptr) { if (fDecimalQuantity->fitsInLong(true)) { return fDecimalQuantity->toLong(); } else { @@ -472,9 +472,9 @@ Formattable::getInt64(UErrorCode& status) const } } else { return (int64_t)fValue.fDouble; - } + } case Formattable::kObject: - if (fValue.fObject == NULL) { + if (fValue.fObject == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -496,15 +496,15 @@ Formattable::getDouble(UErrorCode& status) const if (U_FAILURE(status)) { return 0; } - + switch (fType) { - case Formattable::kLong: + case Formattable::kLong: case Formattable::kInt64: // loses precision return (double)fValue.fInt64; case Formattable::kDouble: return fValue.fDouble; case Formattable::kObject: - if (fValue.fObject == NULL) { + if (fValue.fObject == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -522,7 +522,7 @@ Formattable::getDouble(UErrorCode& status) const const UObject* Formattable::getObject() const { - return (fType == kObject) ? fValue.fObject : NULL; + return (fType == kObject) ? fValue.fObject : nullptr; } // ------------------------------------- @@ -623,14 +623,14 @@ Formattable::adoptObject(UObject* objectToAdopt) { } // ------------------------------------- -UnicodeString& -Formattable::getString(UnicodeString& result, UErrorCode& status) const +UnicodeString& +Formattable::getString(UnicodeString& result, UErrorCode& status) const { if (fType != kString) { setError(status, U_INVALID_FORMAT_ERROR); result.setToBogus(); } else { - if (fValue.fString == NULL) { + if (fValue.fString == nullptr) { setError(status, U_MEMORY_ALLOCATION_ERROR); } else { result = *fValue.fString; @@ -640,14 +640,14 @@ Formattable::getString(UnicodeString& result, UErrorCode& status) const } // ------------------------------------- -const UnicodeString& -Formattable::getString(UErrorCode& status) const +const UnicodeString& +Formattable::getString(UErrorCode& status) const { if (fType != kString) { setError(status, U_INVALID_FORMAT_ERROR); return *getBogus(); } - if (fValue.fString == NULL) { + if (fValue.fString == nullptr) { setError(status, U_MEMORY_ALLOCATION_ERROR); return *getBogus(); } @@ -655,14 +655,14 @@ Formattable::getString(UErrorCode& status) const } // ------------------------------------- -UnicodeString& -Formattable::getString(UErrorCode& status) +UnicodeString& +Formattable::getString(UErrorCode& status) { if (fType != kString) { setError(status, U_INVALID_FORMAT_ERROR); return *getBogus(); } - if (fValue.fString == NULL) { + if (fValue.fString == nullptr) { setError(status, U_MEMORY_ALLOCATION_ERROR); return *getBogus(); } @@ -670,15 +670,15 @@ Formattable::getString(UErrorCode& status) } // ------------------------------------- -const Formattable* -Formattable::getArray(int32_t& count, UErrorCode& status) const +const Formattable* +Formattable::getArray(int32_t& count, UErrorCode& status) const { if (fType != kArray) { setError(status, U_INVALID_FORMAT_ERROR); count = 0; - return NULL; + return nullptr; } - count = fValue.fArrayAndCount.fCount; + count = fValue.fArrayAndCount.fCount; return fValue.fArrayAndCount.fArray; } @@ -686,7 +686,7 @@ Formattable::getArray(int32_t& count, UErrorCode& status) const // Gets the bogus string, ensures mondo bogosity. UnicodeString* -Formattable::getBogus() const +Formattable::getBogus() const { return (UnicodeString*)&fBogus; /* cast away const :-( */ } @@ -697,12 +697,12 @@ StringPiece Formattable::getDecimalNumber(UErrorCode &status) { if (U_FAILURE(status)) { return ""; } - if (fDecimalStr != NULL) { + if (fDecimalStr != nullptr) { return fDecimalStr->toStringPiece(); } CharString *decimalStr = internalGetCharString(status); - if(decimalStr == NULL) { + if(decimalStr == nullptr) { return ""; // getDecimalNumber returns "" for error cases } else { return decimalStr->toStringPiece(); @@ -710,8 +710,8 @@ StringPiece Formattable::getDecimalNumber(UErrorCode &status) { } CharString *Formattable::internalGetCharString(UErrorCode &status) { - if(fDecimalStr == NULL) { - if (fDecimalQuantity == NULL) { + if(fDecimalStr == nullptr) { + if (fDecimalQuantity == nullptr) { // No decimal number for the formattable yet. Which means the value was // set directly by the user as an int, int64 or double. If the value came // from parsing, or from the user setting a decimal number, fDecimalNum @@ -725,9 +725,9 @@ CharString *Formattable::internalGetCharString(UErrorCode &status) { } fDecimalStr = new CharString(); - if (fDecimalStr == NULL) { + if (fDecimalStr == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } // Older ICUs called uprv_decNumberToString here, which is not exactly the same as // DecimalQuantity::toScientificString(). The biggest difference is that uprv_decNumberToString does @@ -775,11 +775,11 @@ Formattable::populateDecimalQuantity(number::impl::DecimalQuantity& output, UErr // --------------------------------------- void Formattable::adoptDecimalQuantity(DecimalQuantity *dq) { - if (fDecimalQuantity != NULL) { + if (fDecimalQuantity != nullptr) { delete fDecimalQuantity; } fDecimalQuantity = dq; - if (dq == NULL) { // allow adoptDigitList(NULL) to clear + if (dq == nullptr) { // allow adoptDigitList(nullptr) to clear return; } @@ -815,33 +815,107 @@ Formattable::setDecimalNumber(StringPiece numberString, UErrorCode &status) { // If we are asked for the string, we will regenerate one from fDecimalQuantity. } +#if 0 +//---------------------------------------------------- +// console I/O +//---------------------------------------------------- +#ifdef _DEBUG + +#include +using namespace std; + +#include "unicode/datefmt.h" +#include "unistrm.h" + +class FormattableStreamer /* not : public UObject because all methods are static */ { +public: + static void streamOut(ostream& stream, const Formattable& obj); + +private: + FormattableStreamer() {} // private - forbid instantiation +}; + +// This is for debugging purposes only. This will send a displayable +// form of the Formattable object to the output stream. + +void +FormattableStreamer::streamOut(ostream& stream, const Formattable& obj) +{ + static DateFormat *defDateFormat = 0; + + UnicodeString buffer; + switch(obj.getType()) { + case Formattable::kDate : + // Creates a DateFormat instance for formatting the + // Date instance. + if (defDateFormat == 0) { + defDateFormat = DateFormat::createInstance(); + } + defDateFormat->format(obj.getDate(), buffer); + stream << buffer; + break; + case Formattable::kDouble : + // Output the double as is. + stream << obj.getDouble() << 'D'; + break; + case Formattable::kLong : + // Output the double as is. + stream << obj.getLong() << 'L'; + break; + case Formattable::kString: + // Output the double as is. Please see UnicodeString console + // I/O routine for more details. + stream << '"' << obj.getString(buffer) << '"'; + break; + case Formattable::kArray: + int32_t i, count; + const Formattable* array; + array = obj.getArray(count); + stream << '['; + // Recursively calling the console I/O routine for each element in the array. + for (i=0; itoUFormattable(); - if( fmt == NULL ) { + if( fmt == nullptr ) { *status = U_MEMORY_ALLOCATION_ERROR; } return fmt; } -U_DRAFT void U_EXPORT2 +U_CAPI void U_EXPORT2 ufmt_close(UFormattable *fmt) { Formattable *obj = Formattable::fromUFormattable(fmt); delete obj; } -U_INTERNAL UFormattableType U_EXPORT2 +U_CAPI UFormattableType U_EXPORT2 ufmt_getType(const UFormattable *fmt, UErrorCode *status) { if(U_FAILURE(*status)) { return (UFormattableType)UFMT_COUNT; @@ -851,27 +925,27 @@ ufmt_getType(const UFormattable *fmt, UErrorCode *status) { } -U_INTERNAL UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ufmt_isNumeric(const UFormattable *fmt) { const Formattable *obj = Formattable::fromUFormattable(fmt); return obj->isNumeric(); } -U_DRAFT UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 ufmt_getDate(const UFormattable *fmt, UErrorCode *status) { const Formattable *obj = Formattable::fromUFormattable(fmt); return obj->getDate(*status); } -U_DRAFT double U_EXPORT2 +U_CAPI double U_EXPORT2 ufmt_getDouble(UFormattable *fmt, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); return obj->getDouble(*status); } -U_DRAFT int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ufmt_getLong(UFormattable *fmt, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); @@ -879,12 +953,12 @@ ufmt_getLong(UFormattable *fmt, UErrorCode *status) { } -U_DRAFT const void *U_EXPORT2 +U_CAPI const void *U_EXPORT2 ufmt_getObject(const UFormattable *fmt, UErrorCode *status) { const Formattable *obj = Formattable::fromUFormattable(fmt); const void *ret = obj->getObject(); - if( ret==NULL && + if( ret==nullptr && (obj->getType() != Formattable::kObject) && U_SUCCESS( *status )) { *status = U_INVALID_FORMAT_ERROR; @@ -892,7 +966,7 @@ ufmt_getObject(const UFormattable *fmt, UErrorCode *status) { return ret; } -U_DRAFT const UChar* U_EXPORT2 +U_CAPI const char16_t* U_EXPORT2 ufmt_getUChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); @@ -901,18 +975,18 @@ ufmt_getUChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { if( U_SUCCESS(*status) ){ *status = U_INVALID_FORMAT_ERROR; } - return NULL; + return nullptr; } // This should return a valid string UnicodeString &str = obj->getString(*status); - if( U_SUCCESS(*status) && len != NULL ) { + if( U_SUCCESS(*status) && len != nullptr ) { *len = str.length(); } return str.getTerminatedBuffer(); } -U_DRAFT int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status) { const Formattable *obj = Formattable::fromUFormattable(fmt); @@ -921,22 +995,22 @@ ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status) { return count; } -U_DRAFT UFormattable * U_EXPORT2 +U_CAPI UFormattable * U_EXPORT2 ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); int32_t count; (void)obj->getArray(count, *status); if(U_FAILURE(*status)) { - return NULL; + return nullptr; } else if(n<0 || n>=count) { setError(*status, U_INDEX_OUTOFBOUNDS_ERROR); - return NULL; + return nullptr; } else { return (*obj)[n].toUFormattable(); // returns non-const Formattable } } -U_DRAFT const char * U_EXPORT2 +U_CAPI const char * U_EXPORT2 ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { if(U_FAILURE(*status)) { return ""; @@ -946,18 +1020,18 @@ ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status) { if(U_FAILURE(*status)) { return ""; } - if(charString == NULL) { + if(charString == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return ""; } else { - if(len!=NULL) { + if(len!=nullptr) { *len = charString->length(); } return charString->data(); } } -U_DRAFT int64_t U_EXPORT2 +U_CAPI int64_t U_EXPORT2 ufmt_getInt64(UFormattable *fmt, UErrorCode *status) { Formattable *obj = Formattable::fromUFormattable(fmt); return obj->getInt64(*status); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/fmtable_cnv.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/fmtable_cnv.cpp deleted file mode 100644 index 9a6479277..000000000 --- a/src/duckdb/extension/icu/third_party/icu/i18n/fmtable_cnv.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* Copyright (C) 1997-2010, International Business Machines Corporation and * -* others. All Rights Reserved. * -******************************************************************************* -* -* File FMTABLE.CPP -* -* Modification History: -* -* Date Name Description -* 03/25/97 clhuang Initial Implementation. -******************************************************************************** -*/ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_CONVERSION - -#include "unicode/fmtable.h" - -// ***************************************************************************** -// class Formattable -// ***************************************************************************** - -U_NAMESPACE_BEGIN - -// ------------------------------------- -// Creates a formattable object with a char* string. -// This API is useless. The API that takes a UnicodeString is actually just as good. -// This is just a grandfathered API. - -Formattable::Formattable(const char* stringToCopy) -{ - init(); - fType = kString; - fValue.fString = new UnicodeString(stringToCopy); -} - -U_NAMESPACE_END - -#endif /* #if !UCONFIG_NO_FORMATTING || !UCONFIG_NO_CONVERSION */ - -//eof diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp index fe4bfcda0..10856a4ac 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp @@ -25,6 +25,10 @@ #include "unicode/utypes.h" +#ifndef U_I18N_IMPLEMENTATION +#error U_I18N_IMPLEMENTATION not set - must be set for all ICU source files in i18n/ - see https://unicode-org.github.io/icu/userguide/howtouseicu +#endif + /* * Dummy code: * If all modules in the I18N library are switched off, then there are no diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.cpp index 5251ac907..8dbf954af 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.cpp @@ -6,8 +6,10 @@ #if !UCONFIG_NO_FORMATTING #include "formatted_string_builder.h" +#include "putilimp.h" #include "unicode/ustring.h" #include "unicode/utf16.h" +#include "unicode/unum.h" // for UNumberFormatFields literals namespace { @@ -196,6 +198,9 @@ FormattedStringBuilder::splice(int32_t startThis, int32_t endThis, const Unicod int32_t thisLength = endThis - startThis; int32_t otherLength = endOther - startOther; int32_t count = otherLength - thisLength; + if (U_FAILURE(status)) { + return count; + } int32_t position; if (count > 0) { // Overall, chars need to be added. @@ -220,6 +225,9 @@ int32_t FormattedStringBuilder::append(const FormattedStringBuilder &other, UErr int32_t FormattedStringBuilder::insert(int32_t index, const FormattedStringBuilder &other, UErrorCode &status) { + if (U_FAILURE(status)) { + return 0; + } if (this == &other) { status = U_ILLEGAL_ARGUMENT_ERROR; return 0; @@ -246,7 +254,7 @@ void FormattedStringBuilder::writeTerminator(UErrorCode& status) { return; } getCharPtr()[position] = 0; - getFieldPtr()[position] = UNUM_FIELD_COUNT; + getFieldPtr()[position] = kUndefinedField; fLength--; } @@ -254,12 +262,18 @@ int32_t FormattedStringBuilder::prepareForInsert(int32_t index, int32_t count, U U_ASSERT(index >= 0); U_ASSERT(index <= fLength); U_ASSERT(count >= 0); + U_ASSERT(fZero >= 0); + U_ASSERT(fLength >= 0); + U_ASSERT(getCapacity() - fZero >= fLength); + if (U_FAILURE(status)) { + return count; + } if (index == 0 && fZero - count >= 0) { // Append to start fZero -= count; fLength += count; return fZero; - } else if (index == fLength && fZero + fLength + count < getCapacity()) { + } else if (index == fLength && count <= getCapacity() - fZero - fLength) { // Append to end fLength += count; return fZero + fLength - count; @@ -274,13 +288,26 @@ int32_t FormattedStringBuilder::prepareForInsertHelper(int32_t index, int32_t co int32_t oldZero = fZero; char16_t *oldChars = getCharPtr(); Field *oldFields = getFieldPtr(); - if (fLength + count > oldCapacity) { - int32_t newCapacity = (fLength + count) * 2; - int32_t newZero = newCapacity / 2 - (fLength + count) / 2; + int32_t newLength; + if (uprv_add32_overflow(fLength, count, &newLength)) { + status = U_INPUT_TOO_LONG_ERROR; + return -1; + } + int32_t newZero; + if (newLength > oldCapacity) { + if (newLength > INT32_MAX / 2) { + // We do not support more than 1G char16_t in this code because + // dealing with >2G *bytes* can cause subtle bugs. + status = U_INPUT_TOO_LONG_ERROR; + return -1; + } + // Keep newCapacity also to at most 1G char16_t. + int32_t newCapacity = newLength * 2; + newZero = (newCapacity - newLength) / 2; // C++ note: malloc appears in two places: here and in the assignment operator. - auto newChars = static_cast (uprv_malloc(sizeof(char16_t) * newCapacity)); - auto newFields = static_cast(uprv_malloc(sizeof(Field) * newCapacity)); + auto newChars = static_cast (uprv_malloc(sizeof(char16_t) * static_cast(newCapacity))); + auto newFields = static_cast(uprv_malloc(sizeof(Field) * static_cast(newCapacity))); if (newChars == nullptr || newFields == nullptr) { uprv_free(newChars); uprv_free(newFields); @@ -309,10 +336,8 @@ int32_t FormattedStringBuilder::prepareForInsertHelper(int32_t index, int32_t co fChars.heap.capacity = newCapacity; fFields.heap.ptr = newFields; fFields.heap.capacity = newCapacity; - fZero = newZero; - fLength += count; } else { - int32_t newZero = oldCapacity / 2 - (fLength + count) / 2; + newZero = (oldCapacity - newLength) / 2; // C++ note: memmove is required because src and dest may overlap. // First copy the entire string to the location of the prefix, and then move the suffix @@ -325,16 +350,20 @@ int32_t FormattedStringBuilder::prepareForInsertHelper(int32_t index, int32_t co uprv_memmove2(oldFields + newZero + index + count, oldFields + newZero + index, sizeof(Field) * (fLength - index)); - - fZero = newZero; - fLength += count; } + fZero = newZero; + fLength = newLength; return fZero + index; } int32_t FormattedStringBuilder::remove(int32_t index, int32_t count) { - // TODO: Reset the heap here? (If the string after removal can fit on stack?) + U_ASSERT(0 <= index); + U_ASSERT(index <= fLength); + U_ASSERT(count <= (fLength - index)); + U_ASSERT(index <= getCapacity() - fZero); + int32_t position = index + fZero; + // TODO: Reset the heap here? (If the string after removal can fit on stack?) uprv_memmove2(getCharPtr() + position, getCharPtr() + position + count, sizeof(char16_t) * (fLength - index - count)); @@ -351,7 +380,7 @@ UnicodeString FormattedStringBuilder::toUnicodeString() const { const UnicodeString FormattedStringBuilder::toTempUnicodeString() const { // Readonly-alias constructor: - return UnicodeString(FALSE, getCharPtr() + fZero, fLength); + return UnicodeString(false, getCharPtr() + fZero, fLength); } UnicodeString FormattedStringBuilder::toDebugString() const { @@ -360,11 +389,11 @@ UnicodeString FormattedStringBuilder::toDebugString() const { sb.append(toUnicodeString()); sb.append(u"] [", -1); for (int i = 0; i < fLength; i++) { - if (fieldAt(i) == UNUM_FIELD_COUNT) { + if (fieldAt(i) == kUndefinedField) { sb.append(u'n'); - } else { + } else if (fieldAt(i).getCategory() == UFIELD_CATEGORY_NUMBER) { char16_t c; - switch (fieldAt(i)) { + switch (fieldAt(i).getField()) { case UNUM_SIGN_FIELD: c = u'-'; break; @@ -393,16 +422,18 @@ UnicodeString FormattedStringBuilder::toDebugString() const { c = u'%'; break; case UNUM_PERMILL_FIELD: - c = u'\x2030'; + c = u'‰'; break; case UNUM_CURRENCY_FIELD: c = u'$'; break; default: - c = u'?'; + c = u'0' + fieldAt(i).getField(); break; } sb.append(c); + } else { + sb.append(u'0' + fieldAt(i).getCategory()); } } sb.append(u"]>", -1); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.h b/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.h index 2949ae73e..32e0900ae 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.h @@ -9,7 +9,8 @@ #include -#include "unicode/unum.h" // for UNUM_FIELD_COUNT +#include + #include "cstring.h" #include "uassert.h" #include "fphdlimp.h" @@ -24,7 +25,7 @@ class FormattedValueStringBuilderImpl; * *
      *
    1. Efficient prepend as well as append. - *
    2. Keeps tracks of Fields in an efficient manner. + *
    3. Keeps track of Fields in an efficient manner. *
    * * See also FormattedValueStringBuilderImpl. @@ -54,8 +55,20 @@ class U_I18N_API FormattedStringBuilder : public UMemory { // Convention: bottom 4 bits for field, top 4 bits for field category. // Field category 0 implies the number category so that the number field // literals can be directly passed as a Field type. - // See the helper functions in "StringBuilderFieldUtils" below. - typedef uint8_t Field; + // Exported as U_I18N_API so it can be used by other exports on Windows. + struct U_I18N_API Field { + uint8_t bits; + + Field() = default; + constexpr Field(uint8_t category, uint8_t field); + + inline UFieldCategory getCategory() const; + inline int32_t getField() const; + inline bool isNumeric() const; + inline bool isUndefined() const; + inline bool operator==(const Field& other) const; + inline bool operator!=(const Field& other) const; + }; FormattedStringBuilder &operator=(const FormattedStringBuilder &other); @@ -204,46 +217,52 @@ class U_I18N_API FormattedStringBuilder : public UMemory { friend class FormattedValueStringBuilderImpl; }; +static_assert( + // std::is_pod<> is deprecated. + std::is_standard_layout::value && + std::is_trivial::value, + "Field should be a POD type for efficient initialization"); + +constexpr FormattedStringBuilder::Field::Field(uint8_t category, uint8_t field) + : bits(( + U_ASSERT(category <= 0xf), + U_ASSERT(field <= 0xf), + static_cast((category << 4) | field) + )) {} + /** - * Helper functions for dealing with the Field typedef, which stores fields - * in a compressed format. + * Internal constant for the undefined field for use in FormattedStringBuilder. */ -class StringBuilderFieldUtils { -public: - struct CategoryFieldPair { - int32_t category; - int32_t field; - }; +constexpr FormattedStringBuilder::Field kUndefinedField = {UFIELD_CATEGORY_UNDEFINED, 0}; - /** Compile-time function to construct a Field from a category and a field */ - template - static constexpr FormattedStringBuilder::Field compress() { - static_assert(category != 0, "cannot use Undefined category in FieldUtils"); - static_assert(category <= 0xf, "only 4 bits for category"); - static_assert(field <= 0xf, "only 4 bits for field"); - return static_cast((category << 4) | field); - } +/** + * Internal field to signal "numeric" when fields are not supported in NumberFormat. + */ +constexpr FormattedStringBuilder::Field kGeneralNumericField = {UFIELD_CATEGORY_UNDEFINED, 1}; - /** Runtime inline function to unpack the category and field from the Field */ - static inline CategoryFieldPair expand(FormattedStringBuilder::Field field) { - if (field == UNUM_FIELD_COUNT) { - return {UFIELD_CATEGORY_UNDEFINED, 0}; - } - CategoryFieldPair ret = { - (field >> 4), - (field & 0xf) - }; - if (ret.category == 0) { - ret.category = UFIELD_CATEGORY_NUMBER; - } - return ret; - } +inline UFieldCategory FormattedStringBuilder::Field::getCategory() const { + return static_cast(bits >> 4); +} - static inline bool isNumericField(FormattedStringBuilder::Field field) { - int8_t category = field >> 4; - return category == 0 || category == UFIELD_CATEGORY_NUMBER; - } -}; +inline int32_t FormattedStringBuilder::Field::getField() const { + return bits & 0xf; +} + +inline bool FormattedStringBuilder::Field::isNumeric() const { + return getCategory() == UFIELD_CATEGORY_NUMBER || *this == kGeneralNumericField; +} + +inline bool FormattedStringBuilder::Field::isUndefined() const { + return getCategory() == UFIELD_CATEGORY_UNDEFINED; +} + +inline bool FormattedStringBuilder::Field::operator==(const Field& other) const { + return bits == other.bits; +} + +inline bool FormattedStringBuilder::Field::operator!=(const Field& other) const { + return bits != other.bits; +} U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_impl.h index 9aab36a52..e19392c5b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_impl.h @@ -69,6 +69,9 @@ U_NAMESPACE_BEGIN /** * Implementation of FormattedValue using FieldPositionHandler to accept fields. + * + * TODO(ICU-20897): This class is unused. If it is not needed when fixing ICU-20897, + * it should be deleted. */ class FormattedValueFieldPositionIteratorImpl : public UMemory, public FormattedValue { public: @@ -80,10 +83,10 @@ class FormattedValueFieldPositionIteratorImpl : public UMemory, public Formatted // Implementation of FormattedValue (const): - UnicodeString toString(UErrorCode& status) const U_OVERRIDE; - UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; - Appendable& appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; - UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; + UnicodeString toString(UErrorCode& status) const override; + UnicodeString toTempString(UErrorCode& status) const override; + Appendable& appendTo(Appendable& appendable, UErrorCode& status) const override; + UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const override; // Additional methods used during construction phase only (non-const): @@ -114,6 +117,26 @@ class FormattedValueFieldPositionIteratorImpl : public UMemory, public Formatted }; +// Internal struct that must be exported for MSVC +struct U_I18N_API SpanInfo { + UFieldCategory category; + int32_t spanValue; + int32_t start; + int32_t length; +}; + +// Export an explicit template instantiation of the MaybeStackArray that +// is used as a data member of CEBuffer. +// +// When building DLLs for Windows this is required even though +// no direct access to the MaybeStackArray leaks out of the i18n library. +// +// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples. +// +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +template class U_I18N_API MaybeStackArray; +#endif + /** * Implementation of FormattedValue based on FormattedStringBuilder. * @@ -130,12 +153,15 @@ class U_I18N_API FormattedValueStringBuilderImpl : public UMemory, public Format virtual ~FormattedValueStringBuilderImpl(); + FormattedValueStringBuilderImpl(FormattedValueStringBuilderImpl&&) = default; + FormattedValueStringBuilderImpl& operator=(FormattedValueStringBuilderImpl&&) = default; + // Implementation of FormattedValue (const): - UnicodeString toString(UErrorCode& status) const U_OVERRIDE; - UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; - Appendable& appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; - UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; + UnicodeString toString(UErrorCode& status) const override; + UnicodeString toTempString(UErrorCode& status) const override; + Appendable& appendTo(Appendable& appendable, UErrorCode& status) const override; + UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const override; // Additional helper functions: UBool nextFieldPosition(FieldPosition& fp, UErrorCode& status) const; @@ -146,14 +172,28 @@ class U_I18N_API FormattedValueStringBuilderImpl : public UMemory, public Format inline const FormattedStringBuilder& getStringRef() const { return fString; } + void resetString(); + + /** + * Adds additional metadata used for span fields. + * + * category: the category to use for the span field. + * spanValue: the value of the span field: index of the list item, for example. + * start: the start position within the string of the span. -1 if unknown. + * length: the length of the span, used to split adjacent fields. + */ + void appendSpanInfo(UFieldCategory category, int32_t spanValue, int32_t start, int32_t length, UErrorCode& status); + void prependSpanInfo(UFieldCategory category, int32_t spanValue, int32_t start, int32_t length, UErrorCode& status); private: FormattedStringBuilder fString; FormattedStringBuilder::Field fNumericField; + MaybeStackArray spanIndices; + int32_t spanIndicesCount = 0; bool nextPositionImpl(ConstrainedFieldPosition& cfpos, FormattedStringBuilder::Field numericField, UErrorCode& status) const; static bool isIntOrGroup(FormattedStringBuilder::Field field); - static bool isNumericField(FormattedStringBuilder::Field field); + static bool isTrimmable(FormattedStringBuilder::Field field); int32_t trimBack(int32_t limit) const; int32_t trimFront(int32_t start) const; }; @@ -182,7 +222,7 @@ struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper { /** Implementation of the methods from U_FORMATTED_VALUE_SUBCLASS_AUTO. */ #define UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(Name) \ - Name::Name(Name&& src) U_NOEXCEPT \ + Name::Name(Name&& src) noexcept \ : fData(src.fData), fErrorCode(src.fErrorCode) { \ src.fData = nullptr; \ src.fErrorCode = U_INVALID_STATE_ERROR; \ @@ -191,7 +231,7 @@ struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper { delete fData; \ fData = nullptr; \ } \ - Name& Name::operator=(Name&& src) U_NOEXCEPT { \ + Name& Name::operator=(Name&& src) noexcept { \ delete fData; \ fData = src.fData; \ src.fData = nullptr; \ @@ -212,7 +252,7 @@ struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper { return fData->appendTo(appendable, status); \ } \ UBool Name::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const { \ - UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) \ + UPRV_FORMATTED_VALUE_METHOD_GUARD(false) \ return fData->nextPosition(cfpos, status); \ } @@ -231,7 +271,7 @@ struct UFormattedValueImpl : public UMemory, public UFormattedValueApiHelper { } \ return static_cast(impl)->exportForC(); \ } \ - U_DRAFT const UFormattedValue* U_EXPORT2 \ + U_CAPI const UFormattedValue* U_EXPORT2 \ Prefix ## _resultAsValue (const CType* uresult, UErrorCode* ec) { \ const ImplType* result = HelperType::validate(uresult, *ec); \ if (U_FAILURE(*ec)) { return nullptr; } \ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_iterimpl.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_iterimpl.cpp index 75328fae8..ec770e219 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_iterimpl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_iterimpl.cpp @@ -32,7 +32,7 @@ UnicodeString FormattedValueFieldPositionIteratorImpl::toTempString( UErrorCode&) const { // The alias must point to memory owned by this object; // fastCopyFrom doesn't do this when using a stack buffer. - return UnicodeString(TRUE, fString.getBuffer(), fString.length()); + return UnicodeString(true, fString.getBuffer(), fString.length()); } Appendable& FormattedValueFieldPositionIteratorImpl::appendTo( diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_sbimpl.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_sbimpl.cpp index 01aea722c..72197cdd8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_sbimpl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/formattedval_sbimpl.cpp @@ -15,6 +15,7 @@ #include "formatted_string_builder.h" #include "number_utils.h" #include "static_unicode_sets.h" +#include "unicode/listformatter.h" U_NAMESPACE_BEGIN @@ -45,28 +46,28 @@ Appendable& FormattedValueStringBuilderImpl::appendTo(Appendable& appendable, UE UBool FormattedValueStringBuilderImpl::nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const { // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool - return nextPositionImpl(cfpos, fNumericField, status) ? TRUE : FALSE; + return nextPositionImpl(cfpos, fNumericField, status) ? true : false; } UBool FormattedValueStringBuilderImpl::nextFieldPosition(FieldPosition& fp, UErrorCode& status) const { int32_t rawField = fp.getField(); if (rawField == FieldPosition::DONT_CARE) { - return FALSE; + return false; } if (rawField < 0 || rawField >= UNUM_FIELD_COUNT) { status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } ConstrainedFieldPosition cfpos; cfpos.constrainField(UFIELD_CATEGORY_NUMBER, rawField); cfpos.setState(UFIELD_CATEGORY_NUMBER, rawField, fp.getBeginIndex(), fp.getEndIndex()); - if (nextPositionImpl(cfpos, 0, status)) { + if (nextPositionImpl(cfpos, kUndefinedField, status)) { fp.setBeginIndex(cfpos.getStart()); fp.setEndIndex(cfpos.getLimit()); - return TRUE; + return true; } // Special case: fraction should start after integer if fraction is not present @@ -74,7 +75,7 @@ UBool FormattedValueStringBuilderImpl::nextFieldPosition(FieldPosition& fp, UErr bool inside = false; int32_t i = fString.fZero; for (; i < fString.fZero + fString.fLength; i++) { - if (isIntOrGroup(fString.getFieldPtr()[i]) || fString.getFieldPtr()[i] == UNUM_DECIMAL_SEPARATOR_FIELD) { + if (isIntOrGroup(fString.getFieldPtr()[i]) || fString.getFieldPtr()[i] == Field(UFIELD_CATEGORY_NUMBER, UNUM_DECIMAL_SEPARATOR_FIELD)) { inside = true; } else if (inside) { break; @@ -84,57 +85,108 @@ UBool FormattedValueStringBuilderImpl::nextFieldPosition(FieldPosition& fp, UErr fp.setEndIndex(i - fString.fZero); } - return FALSE; + return false; } void FormattedValueStringBuilderImpl::getAllFieldPositions(FieldPositionIteratorHandler& fpih, UErrorCode& status) const { ConstrainedFieldPosition cfpos; - while (nextPositionImpl(cfpos, 0, status)) { + while (nextPositionImpl(cfpos, kUndefinedField, status)) { fpih.addAttribute(cfpos.getField(), cfpos.getStart(), cfpos.getLimit()); } } +void FormattedValueStringBuilderImpl::resetString() { + fString.clear(); + spanIndicesCount = 0; +} + // Signal the end of the string using a field that doesn't exist and that is -// different from UNUM_FIELD_COUNT, which is used for "null number field". -static constexpr Field kEndField = 0xff; +// different from kUndefinedField, which is used for "null field". +static constexpr Field kEndField = Field(0xf, 0xf); bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& cfpos, Field numericField, UErrorCode& /*status*/) const { - auto numericCAF = StringBuilderFieldUtils::expand(numericField); int32_t fieldStart = -1; - Field currField = UNUM_FIELD_COUNT; + Field currField = kUndefinedField; + bool prevIsSpan = false; + int32_t nextSpanStart = -1; + if (spanIndicesCount > 0) { + int64_t si = cfpos.getInt64IterationContext(); + U_ASSERT(si <= spanIndicesCount); + if (si < spanIndicesCount) { + nextSpanStart = spanIndices[si].start; + } + if (si > 0) { + prevIsSpan = cfpos.getCategory() == spanIndices[si-1].category + && cfpos.getField() == spanIndices[si-1].spanValue; + } + } + bool prevIsNumeric = false; + if (numericField != kUndefinedField) { + prevIsNumeric = cfpos.getCategory() == numericField.getCategory() + && cfpos.getField() == numericField.getField(); + } + bool prevIsInteger = cfpos.getCategory() == UFIELD_CATEGORY_NUMBER + && cfpos.getField() == UNUM_INTEGER_FIELD; + for (int32_t i = fString.fZero + cfpos.getLimit(); i <= fString.fZero + fString.fLength; i++) { Field _field = (i < fString.fZero + fString.fLength) ? fString.getFieldPtr()[i] : kEndField; // Case 1: currently scanning a field. - if (currField != UNUM_FIELD_COUNT) { + if (currField != kUndefinedField) { if (currField != _field) { int32_t end = i - fString.fZero; // Grouping separators can be whitespace; don't throw them out! - if (currField != UNUM_GROUPING_SEPARATOR_FIELD) { + if (isTrimmable(currField)) { end = trimBack(i - fString.fZero); } if (end <= fieldStart) { // Entire field position is ignorable; skip. fieldStart = -1; - currField = UNUM_FIELD_COUNT; + currField = kUndefinedField; i--; // look at this index again continue; } int32_t start = fieldStart; - if (currField != UNUM_GROUPING_SEPARATOR_FIELD) { + if (isTrimmable(currField)) { start = trimFront(start); } - auto caf = StringBuilderFieldUtils::expand(currField); - cfpos.setState(caf.category, caf.field, start, end); + cfpos.setState(currField.getCategory(), currField.getField(), start, end); return true; } continue; } + // Special case: emit normalField if we are pointing at the end of spanField. + if (i > fString.fZero && prevIsSpan) { + int64_t si = cfpos.getInt64IterationContext() - 1; + U_ASSERT(si >= 0); + int32_t previ = i - spanIndices[si].length; + U_ASSERT(previ >= fString.fZero); + Field prevField = fString.getFieldPtr()[previ]; + if (prevField == Field(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD)) { + // Special handling for ULISTFMT_ELEMENT_FIELD + if (cfpos.matchesField(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD)) { + fieldStart = i - fString.fZero - spanIndices[si].length; + int32_t end = fieldStart + spanIndices[si].length; + cfpos.setState( + UFIELD_CATEGORY_LIST, + ULISTFMT_ELEMENT_FIELD, + fieldStart, + end); + return true; + } else { + prevIsSpan = false; + } + } else { + // Re-wind, since there may be multiple fields in the span. + i = previ; + _field = prevField; + } + } // Special case: coalesce the INTEGER if we are pointing at the end of the INTEGER. if (cfpos.matchesField(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD) && i > fString.fZero - // don't return the same field twice in a row: - && i - fString.fZero > cfpos.getLimit() + && !prevIsInteger + && !prevIsNumeric && isIntOrGroup(fString.getFieldPtr()[i - 1]) && !isIntOrGroup(_field)) { int j = i - 1; @@ -147,62 +199,146 @@ bool FormattedValueStringBuilderImpl::nextPositionImpl(ConstrainedFieldPosition& return true; } // Special case: coalesce NUMERIC if we are pointing at the end of the NUMERIC. - if (numericField != 0 - && cfpos.matchesField(numericCAF.category, numericCAF.field) + if (numericField != kUndefinedField + && cfpos.matchesField(numericField.getCategory(), numericField.getField()) && i > fString.fZero - // don't return the same field twice in a row: - && (i - fString.fZero > cfpos.getLimit() - || cfpos.getCategory() != numericCAF.category - || cfpos.getField() != numericCAF.field) - && isNumericField(fString.getFieldPtr()[i - 1]) - && !isNumericField(_field)) { - int j = i - 1; - for (; j >= fString.fZero && isNumericField(fString.getFieldPtr()[j]); j--) {} + && !prevIsNumeric + && fString.getFieldPtr()[i - 1].isNumeric() + && !_field.isNumeric()) { + // Re-wind to the beginning of the field and then emit it + int32_t j = i - 1; + for (; j >= fString.fZero && fString.getFieldPtr()[j].isNumeric(); j--) {} cfpos.setState( - numericCAF.category, - numericCAF.field, + numericField.getCategory(), + numericField.getField(), j - fString.fZero + 1, i - fString.fZero); return true; } + // Check for span field + if (!prevIsSpan && ( + _field == Field(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD) || + i - fString.fZero == nextSpanStart)) { + int64_t si = cfpos.getInt64IterationContext(); + if (si >= spanIndicesCount) { + break; + } + UFieldCategory spanCategory = spanIndices[si].category; + int32_t spanValue = spanIndices[si].spanValue; + int32_t length = spanIndices[si].length; + cfpos.setInt64IterationContext(si + 1); + if (si + 1 < spanIndicesCount) { + nextSpanStart = spanIndices[si + 1].start; + } + if (length == 0) { + // ICU-21871: Don't return fields on empty spans + i--; + continue; + } + if (cfpos.matchesField(spanCategory, spanValue)) { + fieldStart = i - fString.fZero; + int32_t end = fieldStart + length; + cfpos.setState( + spanCategory, + spanValue, + fieldStart, + end); + return true; + } else if (_field == Field(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD)) { + // Special handling for ULISTFMT_ELEMENT_FIELD + if (cfpos.matchesField(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD)) { + fieldStart = i - fString.fZero; + int32_t end = fieldStart + length; + cfpos.setState( + UFIELD_CATEGORY_LIST, + ULISTFMT_ELEMENT_FIELD, + fieldStart, + end); + return true; + } else { + // Failed to match; jump ahead + i += length - 1; + // goto loopend + } + } + } // Special case: skip over INTEGER; will be coalesced later. - if (_field == UNUM_INTEGER_FIELD) { - _field = UNUM_FIELD_COUNT; + else if (_field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD)) { + _field = kUndefinedField; } - // Case 2: no field starting at this position. - if (_field == UNUM_FIELD_COUNT || _field == kEndField) { - continue; + // No field starting at this position. + else if (_field.isUndefined() || _field == kEndField) { + // goto loopend } - // Case 3: check for field starting at this position - auto caf = StringBuilderFieldUtils::expand(_field); - if (cfpos.matchesField(caf.category, caf.field)) { + // No SpanField + else if (cfpos.matchesField(_field.getCategory(), _field.getField())) { fieldStart = i - fString.fZero; currField = _field; } + // loopend: + prevIsSpan = false; + prevIsNumeric = false; + prevIsInteger = false; } - U_ASSERT(currField == UNUM_FIELD_COUNT); + U_ASSERT(currField == kUndefinedField); + // Always set the position to the end so that we don't revisit previous sections + cfpos.setState( + cfpos.getCategory(), + cfpos.getField(), + fString.fLength, + fString.fLength); return false; } +void FormattedValueStringBuilderImpl::appendSpanInfo(UFieldCategory category, int32_t spanValue, int32_t start, int32_t length, UErrorCode& status) { + if (U_FAILURE(status)) { return; } + U_ASSERT(spanIndices.getCapacity() >= spanIndicesCount); + if (spanIndices.getCapacity() == spanIndicesCount) { + if (!spanIndices.resize(spanIndicesCount * 2, spanIndicesCount)) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + } + spanIndices[spanIndicesCount] = {category, spanValue, start, length}; + spanIndicesCount++; +} + +void FormattedValueStringBuilderImpl::prependSpanInfo(UFieldCategory category, int32_t spanValue, int32_t start, int32_t length, UErrorCode& status) { + if (U_FAILURE(status)) { return; } + U_ASSERT(spanIndices.getCapacity() >= spanIndicesCount); + if (spanIndices.getCapacity() == spanIndicesCount) { + if (!spanIndices.resize(spanIndicesCount * 2, spanIndicesCount)) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + } + for (int32_t i = spanIndicesCount - 1; i >= 0; i--) { + spanIndices[i+1] = spanIndices[i]; + } + spanIndices[0] = {category, spanValue, start, length}; + spanIndicesCount++; +} + bool FormattedValueStringBuilderImpl::isIntOrGroup(Field field) { - return field == UNUM_INTEGER_FIELD - || field == UNUM_GROUPING_SEPARATOR_FIELD; + return field == Field(UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD) + || field == Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD); } -bool FormattedValueStringBuilderImpl::isNumericField(Field field) { - return StringBuilderFieldUtils::isNumericField(field); +bool FormattedValueStringBuilderImpl::isTrimmable(Field field) { + return field != Field(UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD) + && field.getCategory() != UFIELD_CATEGORY_LIST; } int32_t FormattedValueStringBuilderImpl::trimBack(int32_t limit) const { - return unisets::get(unisets::UNISET_KEY_DEFAULT_IGNORABLES)->spanBack( + return unisets::get(unisets::DEFAULT_IGNORABLES)->spanBack( fString.getCharPtr() + fString.fZero, limit, USET_SPAN_CONTAINED); } int32_t FormattedValueStringBuilderImpl::trimFront(int32_t start) const { - return start + unisets::get(unisets::UNISET_KEY_DEFAULT_IGNORABLES)->span( + return start + unisets::get(unisets::DEFAULT_IGNORABLES)->span( fString.getCharPtr() + fString.fZero + start, fString.fLength - start, USET_SPAN_CONTAINED); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/formattedvalue.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/formattedvalue.cpp index e2c9c42fc..aacd6ac70 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/formattedvalue.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/formattedvalue.cpp @@ -43,13 +43,13 @@ void ConstrainedFieldPosition::setInt64IterationContext(int64_t context) { UBool ConstrainedFieldPosition::matchesField(int32_t category, int32_t field) const { switch (fConstraint) { case UCFPOS_CONSTRAINT_NONE: - return TRUE; + return true; case UCFPOS_CONSTRAINT_CATEGORY: return fCategory == category; case UCFPOS_CONSTRAINT_FIELD: return fCategory == category && fField == field; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -193,7 +193,7 @@ ucfpos_close(UConstrainedFieldPosition* ptr) { } -U_DRAFT const UChar* U_EXPORT2 +U_CAPI const char16_t* U_EXPORT2 ufmtval_getString( const UFormattedValue* ufmtval, int32_t* pLength, @@ -209,11 +209,13 @@ ufmtval_getString( if (pLength != nullptr) { *pLength = readOnlyAlias.length(); } + // Note: this line triggers -Wreturn-local-addr, but it is safe because toTempString is + // defined to return memory owned by the ufmtval argument. return readOnlyAlias.getBuffer(); } -U_DRAFT UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 ufmtval_nextPosition( const UFormattedValue* ufmtval, UConstrainedFieldPosition* ucfpos, @@ -221,7 +223,7 @@ ufmtval_nextPosition( const auto* fmtval = UFormattedValueApiHelper::validate(ufmtval, *ec); auto* cfpos = UConstrainedFieldPositionImpl::validate(ucfpos, *ec); if (U_FAILURE(*ec)) { - return FALSE; + return false; } return fmtval->fFormattedValue->nextPosition(cfpos->fImpl, *ec); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.cpp index f51bf4bae..e170dc4b9 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.cpp @@ -39,7 +39,7 @@ FieldPositionOnlyHandler::~FieldPositionOnlyHandler() { void FieldPositionOnlyHandler::addAttribute(int32_t id, int32_t start, int32_t limit) { if (pos.getField() == id && (!acceptFirstOnly || !seenFirst)) { - seenFirst = TRUE; + seenFirst = true; pos.setBeginIndex(start + fShift); pos.setEndIndex(limit + fShift); } @@ -54,7 +54,7 @@ FieldPositionOnlyHandler::shiftLast(int32_t delta) { } UBool -FieldPositionOnlyHandler::isRecording(void) const { +FieldPositionOnlyHandler::isRecording() const { return pos.getField() != FieldPosition::DONT_CARE; } @@ -67,7 +67,7 @@ void FieldPositionOnlyHandler::setAcceptFirstOnly(UBool acceptFirstOnly) { FieldPositionIteratorHandler::FieldPositionIteratorHandler(FieldPositionIterator* posIter, UErrorCode& _status) - : iter(posIter), vec(NULL), status(_status), fCategory(UFIELD_CATEGORY_UNDEFINED) { + : iter(posIter), vec(nullptr), status(_status), fCategory(UFIELD_CATEGORY_UNDEFINED) { if (iter && U_SUCCESS(status)) { vec = new UVector32(status); } @@ -85,7 +85,7 @@ FieldPositionIteratorHandler::~FieldPositionIteratorHandler() { iter->setData(vec, status); } // if iter is null, we never allocated vec, so no need to free it - vec = NULL; + vec = nullptr; } void @@ -116,7 +116,7 @@ FieldPositionIteratorHandler::shiftLast(int32_t delta) { } UBool -FieldPositionIteratorHandler::isRecording(void) const { +FieldPositionIteratorHandler::isRecording() const { return U_SUCCESS(status); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.h b/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.h index 00937830f..ad09c6c90 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.h @@ -31,7 +31,7 @@ class U_I18N_API FieldPositionHandler: public UMemory { virtual ~FieldPositionHandler(); virtual void addAttribute(int32_t id, int32_t start, int32_t limit) = 0; virtual void shiftLast(int32_t delta) = 0; - virtual UBool isRecording(void) const = 0; + virtual UBool isRecording() const = 0; void setShift(int32_t delta); }; @@ -41,16 +41,16 @@ class U_I18N_API FieldPositionHandler: public UMemory { class FieldPositionOnlyHandler : public FieldPositionHandler { FieldPosition& pos; - UBool acceptFirstOnly = FALSE; - UBool seenFirst = FALSE; + UBool acceptFirstOnly = false; + UBool seenFirst = false; public: FieldPositionOnlyHandler(FieldPosition& pos); virtual ~FieldPositionOnlyHandler(); - void addAttribute(int32_t id, int32_t start, int32_t limit) U_OVERRIDE; - void shiftLast(int32_t delta) U_OVERRIDE; - UBool isRecording(void) const U_OVERRIDE; + void addAttribute(int32_t id, int32_t start, int32_t limit) override; + void shiftLast(int32_t delta) override; + UBool isRecording() const override; /** * Enable this option to lock in the FieldPosition value after seeing the @@ -62,9 +62,10 @@ class FieldPositionOnlyHandler : public FieldPositionHandler { // utility subclass FieldPositionIteratorHandler +// exported as U_I18N_API for tests -class FieldPositionIteratorHandler : public FieldPositionHandler { - FieldPositionIterator* iter; // can be NULL +class U_I18N_API FieldPositionIteratorHandler : public FieldPositionHandler { + FieldPositionIterator* iter; // can be nullptr UVector32* vec; UErrorCode status; UFieldCategory fCategory; @@ -73,10 +74,10 @@ class FieldPositionIteratorHandler : public FieldPositionHandler { // to be destroyed before status goes out of scope. Easiest thing is to // allocate us on the stack in the same (or narrower) scope as status has. // This attempts to encourage that by blocking heap allocation. - static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete; - static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t) noexcept = delete; + static void* U_EXPORT2 operator new[](size_t) noexcept = delete; #if U_HAVE_PLACEMENT_NEW - static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete; + static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; #endif public: @@ -85,9 +86,9 @@ class FieldPositionIteratorHandler : public FieldPositionHandler { FieldPositionIteratorHandler(UVector32* vec, UErrorCode& status); ~FieldPositionIteratorHandler(); - void addAttribute(int32_t id, int32_t start, int32_t limit) U_OVERRIDE; - void shiftLast(int32_t delta) U_OVERRIDE; - UBool isRecording(void) const U_OVERRIDE; + void addAttribute(int32_t id, int32_t start, int32_t limit) override; + void shiftLast(int32_t delta) override; + UBool isRecording() const override; /** Copies a failed error code into _status. */ inline void getError(UErrorCode& _status) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp index 2db774927..68f1edcc1 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp @@ -22,16 +22,16 @@ U_NAMESPACE_BEGIN FieldPositionIterator::~FieldPositionIterator() { delete data; - data = NULL; + data = nullptr; pos = -1; } FieldPositionIterator::FieldPositionIterator() - : data(NULL), pos(-1) { + : data(nullptr), pos(-1) { } FieldPositionIterator::FieldPositionIterator(const FieldPositionIterator &rhs) - : UObject(rhs), data(NULL), pos(rhs.pos) { + : UObject(rhs), data(nullptr), pos(rhs.pos) { if (rhs.data) { UErrorCode status = U_ZERO_ERROR; @@ -39,7 +39,7 @@ FieldPositionIterator::FieldPositionIterator(const FieldPositionIterator &rhs) data->assign(*rhs.data, status); if (status != U_ZERO_ERROR) { delete data; - data = NULL; + data = nullptr; pos = -1; } } @@ -47,15 +47,15 @@ FieldPositionIterator::FieldPositionIterator(const FieldPositionIterator &rhs) bool FieldPositionIterator::operator==(const FieldPositionIterator &rhs) const { if (&rhs == this) { - return TRUE; + return true; } if (pos != rhs.pos) { - return FALSE; + return false; } if (!data) { - return rhs.data == NULL; + return rhs.data == nullptr; } - return rhs.data ? data->operator==(*rhs.data) : FALSE; + return rhs.data ? data->operator==(*rhs.data) : false; } void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) { @@ -64,7 +64,7 @@ void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) { if (adopt) { if (adopt->size() == 0) { delete adopt; - adopt = NULL; + adopt = nullptr; } else if ((adopt->size() % 4) != 0) { status = U_ILLEGAL_ARGUMENT_ERROR; } else { @@ -87,12 +87,12 @@ void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) { delete data; data = adopt; - pos = adopt == NULL ? -1 : 0; + pos = adopt == nullptr ? -1 : 0; } UBool FieldPositionIterator::next(FieldPosition& fp) { if (pos == -1) { - return FALSE; + return false; } // Ignore the first element of the tetrad: used for field category @@ -105,7 +105,7 @@ UBool FieldPositionIterator::next(FieldPosition& fp) { pos = -1; } - return TRUE; + return true; } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/gender.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/gender.cpp index 32ddbf9a6..d023b5021 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/gender.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/gender.cpp @@ -19,25 +19,30 @@ #if !UCONFIG_NO_FORMATTING +#include + #include "unicode/gender.h" #include "unicode/ugender.h" #include "unicode/ures.h" +#include "bytesinkutil.h" +#include "charstr.h" #include "cmemory.h" #include "cstring.h" #include "mutex.h" #include "uassert.h" #include "ucln_in.h" +#include "ulocimp.h" #include "umutex.h" #include "uhash.h" -static UHashtable* gGenderInfoCache = NULL; +static UHashtable* gGenderInfoCache = nullptr; static const char* gNeutralStr = "neutral"; static const char* gMailTaintsStr = "maleTaints"; static const char* gMixedNeutralStr = "mixedNeutral"; -static icu::GenderInfo* gObjs = NULL; -static icu::UInitOnce gGenderInitOnce = U_INITONCE_INITIALIZER; +static icu::GenderInfo* gObjs = nullptr; +static icu::UInitOnce gGenderInitOnce {}; enum GenderStyle { NEUTRAL, @@ -48,14 +53,14 @@ enum GenderStyle { U_CDECL_BEGIN -static UBool U_CALLCONV gender_cleanup(void) { - if (gGenderInfoCache != NULL) { +static UBool U_CALLCONV gender_cleanup() { + if (gGenderInfoCache != nullptr) { uhash_close(gGenderInfoCache); - gGenderInfoCache = NULL; + gGenderInfoCache = nullptr; delete [] gObjs; } gGenderInitOnce.reset(); - return TRUE; + return true; } U_CDECL_END @@ -64,19 +69,19 @@ U_NAMESPACE_BEGIN void U_CALLCONV GenderInfo_initCache(UErrorCode &status) { ucln_i18n_registerCleanup(UCLN_I18N_GENDERINFO, gender_cleanup); - U_ASSERT(gGenderInfoCache == NULL); + U_ASSERT(gGenderInfoCache == nullptr); if (U_FAILURE(status)) { return; } gObjs = new GenderInfo[GENDER_STYLE_LENGTH]; - if (gObjs == NULL) { + if (gObjs == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } for (int i = 0; i < GENDER_STYLE_LENGTH; i++) { gObjs[i]._style = i; } - gGenderInfoCache = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status); + gGenderInfoCache = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status); if (U_FAILURE(status)) { delete [] gObjs; return; @@ -95,11 +100,11 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat // Make sure our cache exists. umtx_initOnce(gGenderInitOnce, &GenderInfo_initCache, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } static UMutex gGenderMetaLock; - const GenderInfo* result = NULL; + const GenderInfo* result = nullptr; const char* key = locale.getName(); { Mutex lock(&gGenderMetaLock); @@ -112,7 +117,7 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat // On cache miss, try to create GenderInfo from CLDR data result = loadInstance(locale, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } // Try to put our GenderInfo object in cache. If there is a race condition, @@ -125,7 +130,7 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat } else { uhash_put(gGenderInfoCache, uprv_strdup(key), (void*) result, &status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } } } @@ -134,33 +139,39 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat const GenderInfo* GenderInfo::loadInstance(const Locale& locale, UErrorCode& status) { LocalUResourceBundlePointer rb( - ures_openDirect(NULL, "genderList", &status)); + ures_openDirect(nullptr, "genderList", &status)); if (U_FAILURE(status)) { - return NULL; + return nullptr; } - LocalUResourceBundlePointer locRes(ures_getByKey(rb.getAlias(), "genderList", NULL, &status)); + LocalUResourceBundlePointer locRes(ures_getByKey(rb.getAlias(), "genderList", nullptr, &status)); if (U_FAILURE(status)) { - return NULL; + return nullptr; } int32_t resLen = 0; const char* curLocaleName = locale.getName(); UErrorCode key_status = U_ZERO_ERROR; - const UChar* s = ures_getStringByKey(locRes.getAlias(), curLocaleName, &resLen, &key_status); - if (s == NULL) { + const char16_t* s = ures_getStringByKey(locRes.getAlias(), curLocaleName, &resLen, &key_status); + if (s == nullptr) { key_status = U_ZERO_ERROR; - char parentLocaleName[ULOC_FULLNAME_CAPACITY]; - uprv_strcpy(parentLocaleName, curLocaleName); - while (s == NULL && uloc_getParent(parentLocaleName, parentLocaleName, ULOC_FULLNAME_CAPACITY, &key_status) > 0) { + CharString parentLocaleName(curLocaleName, key_status); + while (s == nullptr) { + { + CharString tmp; + CharStringByteSink sink(&tmp); + ulocimp_getParent(parentLocaleName.data(), sink, &status); + if (tmp.isEmpty()) break; + parentLocaleName = std::move(tmp); + } key_status = U_ZERO_ERROR; resLen = 0; - s = ures_getStringByKey(locRes.getAlias(), parentLocaleName, &resLen, &key_status); + s = ures_getStringByKey(locRes.getAlias(), parentLocaleName.data(), &resLen, &key_status); key_status = U_ZERO_ERROR; } } - if (s == NULL) { + if (s == nullptr) { return &gObjs[NEUTRAL]; } - char type_str[256]; + char type_str[256] = ""; u_UCharsToChars(s, type_str, resLen + 1); if (uprv_strcmp(type_str, gNeutralStr) == 0) { return &gObjs[NEUTRAL]; @@ -184,8 +195,8 @@ UGender GenderInfo::getListGender(const UGender* genders, int32_t length, UError if (length == 1) { return genders[0]; } - UBool has_female = FALSE; - UBool has_male = FALSE; + UBool has_female = false; + UBool has_male = false; switch (_style) { case NEUTRAL: return UGENDER_OTHER; @@ -199,13 +210,13 @@ UGender GenderInfo::getListGender(const UGender* genders, int32_t length, UError if (has_male) { return UGENDER_OTHER; } - has_female = TRUE; + has_female = true; break; case UGENDER_MALE: if (has_female) { return UGENDER_OTHER; } - has_male = TRUE; + has_male = true; break; default: break; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/gregocal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/gregocal.cpp index f87fc5ab5..ec14abbbf 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/gregocal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/gregocal.cpp @@ -27,7 +27,7 @@ * add() from Java source. * 07/28/98 stephen Sync up with JDK 1.2 * 09/14/98 stephen Changed type of kOneDay, kOneWeek to double. -* Fixed bug in roll() +* Fixed bug in roll() * 10/15/99 aliu Fixed j31, incorrect WEEK_OF_YEAR computation. * 10/15/99 aliu Fixed j32, cannot set date to Feb 29 2000 AD. * {JDK bug 4210209 4209272} @@ -101,11 +101,12 @@ static const int32_t kGregorianCalendarLimits[UCAL_FIELD_COUNT][4] = { {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // JULIAN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // MILLISECONDS_IN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // IS_LEAP_MONTH + { 0, 0, 11, 11}, // ORDINAL_MONTH }; /* *
    -*                            Greatest       Least
    +*                            Greatest       Least 
     * Field name        Minimum   Minimum     Maximum     Maximum
     * ----------        -------   -------     -------     -------
     * ERA                     0         0           1           1
    @@ -155,7 +156,7 @@ GregorianCalendar::GregorianCalendar(UErrorCode& status)
     :   Calendar(status),
     fGregorianCutover(kPapalCutover),
     fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +fIsGregorian(true), fInvertGregorian(false)
     {
         setTimeInMillis(getNow(), status);
     }
    @@ -166,7 +167,7 @@ GregorianCalendar::GregorianCalendar(TimeZone* zone, UErrorCode& status)
     :   Calendar(zone, Locale::getDefault(), status),
     fGregorianCutover(kPapalCutover),
     fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +fIsGregorian(true), fInvertGregorian(false)
     {
         setTimeInMillis(getNow(), status);
     }
    @@ -177,7 +178,7 @@ GregorianCalendar::GregorianCalendar(const TimeZone& zone, UErrorCode& status)
     :   Calendar(zone, Locale::getDefault(), status),
     fGregorianCutover(kPapalCutover),
     fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +fIsGregorian(true), fInvertGregorian(false)
     {
         setTimeInMillis(getNow(), status);
     }
    @@ -185,10 +186,10 @@ fIsGregorian(TRUE), fInvertGregorian(FALSE)
     // -------------------------------------
     
     GregorianCalendar::GregorianCalendar(const Locale& aLocale, UErrorCode& status)
    -:   Calendar(TimeZone::createDefault(), aLocale, status),
    +:   Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, status),
     fGregorianCutover(kPapalCutover),
     fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +fIsGregorian(true), fInvertGregorian(false)
     {
         setTimeInMillis(getNow(), status);
     }
    @@ -200,7 +201,7 @@ GregorianCalendar::GregorianCalendar(TimeZone* zone, const Locale& aLocale,
                                          :   Calendar(zone, aLocale, status),
                                          fGregorianCutover(kPapalCutover),
                                          fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -                                     fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +                                     fIsGregorian(true), fInvertGregorian(false)
     {
         setTimeInMillis(getNow(), status);
     }
    @@ -212,7 +213,7 @@ GregorianCalendar::GregorianCalendar(const TimeZone& zone, const Locale& aLocale
                                          :   Calendar(zone, aLocale, status),
                                          fGregorianCutover(kPapalCutover),
                                          fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -                                     fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +                                     fIsGregorian(true), fInvertGregorian(false)
     {
         setTimeInMillis(getNow(), status);
     }
    @@ -224,7 +225,7 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
                                          :   Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
                                          fGregorianCutover(kPapalCutover),
                                          fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -                                     fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +                                     fIsGregorian(true), fInvertGregorian(false)
     {
         set(UCAL_ERA, AD);
         set(UCAL_YEAR, year);
    @@ -239,7 +240,7 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
                                          :   Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
                                          fGregorianCutover(kPapalCutover),
                                          fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -                                     fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +                                     fIsGregorian(true), fInvertGregorian(false)
     {
         set(UCAL_ERA, AD);
         set(UCAL_YEAR, year);
    @@ -257,7 +258,7 @@ GregorianCalendar::GregorianCalendar(int32_t year, int32_t month, int32_t date,
                                          :   Calendar(TimeZone::createDefault(), Locale::getDefault(), status),
                                          fGregorianCutover(kPapalCutover),
                                          fCutoverJulianDay(kCutoverJulianDay), fNormalizedGregorianCutover(fGregorianCutover), fGregorianCutoverYear(1582),
    -                                     fIsGregorian(TRUE), fInvertGregorian(FALSE)
    +                                     fIsGregorian(true), fInvertGregorian(false)
     {
         set(UCAL_ERA, AD);
         set(UCAL_YEAR, year);
    @@ -321,7 +322,7 @@ UBool GregorianCalendar::isEquivalentTo(const Calendar& other) const
     void
     GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
     {
    -    if (U_FAILURE(status))
    +    if (U_FAILURE(status)) 
             return;
     
         // Precompute two internal variables which we use to do the actual
    @@ -334,7 +335,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
     
         // Handle the rare case of numeric overflow where the user specifies a time
         // outside of INT32_MIN .. INT32_MAX number of days.
    -
    +    
         if (cutoverDay <= INT32_MIN) {
             cutoverDay = INT32_MIN;
             fGregorianCutover = fNormalizedGregorianCutover = cutoverDay * kOneDay;
    @@ -349,7 +350,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
         // Normalize the year so BC values are represented as 0 and negative
         // values.
         GregorianCalendar *cal = new GregorianCalendar(getTimeZone(), status);
    -    /* test for NULL */
    +    /* test for nullptr */
         if (cal == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
    @@ -358,7 +359,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
             return;
         cal->setTime(date, status);
         fGregorianCutoverYear = cal->get(UCAL_YEAR, status);
    -    if (cal->get(UCAL_ERA, status) == BC)
    +    if (cal->get(UCAL_ERA, status) == BC) 
             fGregorianCutoverYear = 1 - fGregorianCutoverYear;
         fCutoverJulianDay = (int32_t)cutoverDay;
         delete cal;
    @@ -369,12 +370,12 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu
         int32_t eyear, month, dayOfMonth, dayOfYear, unusedRemainder;
     
     
    -    if(U_FAILURE(status)) {
    -        return;
    +    if(U_FAILURE(status)) { 
    +        return; 
         }
     
     #if defined (U_DEBUG_CAL)
    -    fprintf(stderr, "%s:%d: jd%d- (greg's %d)- [cut=%d]\n",
    +    fprintf(stderr, "%s:%d: jd%d- (greg's %d)- [cut=%d]\n", 
             __FILE__, __LINE__, julianDay, getGregorianDayOfYear(), fCutoverJulianDay);
     #endif
     
    @@ -388,7 +389,7 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu
             // The Julian epoch day (not the same as Julian Day)
             // is zero on Saturday December 30, 0 (Gregorian).
             int32_t julianEpochDay = julianDay - (kJan1_1JulianDay - 2);
    -		eyear = (int32_t) ClockMath::floorDivide((4.0*julianEpochDay) + 1464.0, (int32_t) 1461, unusedRemainder);
    +		eyear = (int32_t) ClockMath::floorDivide((4.0*julianEpochDay) + 1464.0, (int32_t) 1461, &unusedRemainder);
     
             // Compute the Julian calendar day number for January 1, eyear
             int32_t january1 = 365*(eyear-1) + ClockMath::floorDivide(eyear-1, (int32_t)4);
    @@ -398,7 +399,7 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu
             // with 8 AD.  Before 8 AD the spacing is irregular; every 3 years
             // from 45 BC to 9 BC, and then none until 8 AD.  However, we don't
             // implement this historical detail; instead, we implement the
    -        // computatinally cleaner proleptic calendar, which assumes
    +        // computationally cleaner proleptic calendar, which assumes
             // consistent 4-year cycles throughout time.
             UBool isLeap = ((eyear&0x3) == 0); // equiv. to (eyear%4 == 0)
     
    @@ -413,11 +414,11 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu
             ++dayOfYear;
     #if defined (U_DEBUG_CAL)
             //     fprintf(stderr, "%d - %d[%d] + 1\n", dayOfYear, isLeap?kLeapNumDays[month]:kNumDays[month], month );
    -        //           fprintf(stderr, "%s:%d:  greg's HCF %d -> %d/%d/%d not %d/%d/%d\n",
    +        //           fprintf(stderr, "%s:%d:  greg's HCF %d -> %d/%d/%d not %d/%d/%d\n", 
             //                   __FILE__, __LINE__,julianDay,
             //          eyear,month,dayOfMonth,
             //          getGregorianYear(), getGregorianMonth(), getGregorianDayOfMonth()  );
    -        fprintf(stderr, "%s:%d: doy %d (greg's %d)- [cut=%d]\n",
    +        fprintf(stderr, "%s:%d: doy %d (greg's %d)- [cut=%d]\n", 
                 __FILE__, __LINE__, dayOfYear, getGregorianDayOfYear(), fCutoverJulianDay);
     #endif
     
    @@ -435,6 +436,7 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu
         }
     
         internalSet(UCAL_MONTH, month);
    +    internalSet(UCAL_ORDINAL_MONTH, month);
         internalSet(UCAL_DAY_OF_MONTH, dayOfMonth);
         internalSet(UCAL_DAY_OF_YEAR, dayOfYear);
         internalSet(UCAL_EXTENDED_YEAR, eyear);
    @@ -458,7 +460,7 @@ GregorianCalendar::getGregorianChange() const
     
     // -------------------------------------
     
    -UBool
    +UBool 
     GregorianCalendar::isLeapYear(int32_t year) const
     {
         // MSVC complains bitterly if we try to use Grego::isLeapYear here
    @@ -470,39 +472,39 @@ GregorianCalendar::isLeapYear(int32_t year) const
     
     // -------------------------------------
     
    -int32_t GregorianCalendar::handleComputeJulianDay(UCalendarDateFields bestField)
    +int32_t GregorianCalendar::handleComputeJulianDay(UCalendarDateFields bestField) 
     {
    -    fInvertGregorian = FALSE;
    +    fInvertGregorian = false;
     
         int32_t jd = Calendar::handleComputeJulianDay(bestField);
     
         if((bestField == UCAL_WEEK_OF_YEAR) &&  // if we are doing WOY calculations, we are counting relative to Jan 1 *julian*
    -        (internalGet(UCAL_EXTENDED_YEAR)==fGregorianCutoverYear) &&
    -        jd >= fCutoverJulianDay) {
    -            fInvertGregorian = TRUE;  // So that the Julian Jan 1 will be used in handleComputeMonthStart
    +        (internalGet(UCAL_EXTENDED_YEAR)==fGregorianCutoverYear) && 
    +        jd >= fCutoverJulianDay) { 
    +            fInvertGregorian = true;  // So that the Julian Jan 1 will be used in handleComputeMonthStart
                 return Calendar::handleComputeJulianDay(bestField);
             }
     
     
             // The following check handles portions of the cutover year BEFORE the
             // cutover itself happens.
    -        //if ((fIsGregorian==TRUE) != (jd >= fCutoverJulianDay)) {  /*  cutoverJulianDay)) { */
    -        if ((fIsGregorian==TRUE) != (jd >= fCutoverJulianDay)) {  /*  cutoverJulianDay)) { */
    +        //if ((fIsGregorian==true) != (jd >= fCutoverJulianDay)) {  /*  cutoverJulianDay)) { */
    +        if ((fIsGregorian) != (jd >= fCutoverJulianDay)) {  /*  cutoverJulianDay)) { */
     #if defined (U_DEBUG_CAL)
    -            fprintf(stderr, "%s:%d: jd [invert] %d\n",
    +            fprintf(stderr, "%s:%d: jd [invert] %d\n", 
                     __FILE__, __LINE__, jd);
     #endif
    -            fInvertGregorian = TRUE;
    +            fInvertGregorian = true;
                 jd = Calendar::handleComputeJulianDay(bestField);
     #if defined (U_DEBUG_CAL)
    -            fprintf(stderr, "%s:%d:  fIsGregorian %s, fInvertGregorian %s - ",
    +            fprintf(stderr, "%s:%d:  fIsGregorian %s, fInvertGregorian %s - ", 
                     __FILE__, __LINE__,fIsGregorian?"T":"F", fInvertGregorian?"T":"F");
    -            fprintf(stderr, " jd NOW %d\n",
    +            fprintf(stderr, " jd NOW %d\n", 
                     jd);
     #endif
             } else {
     #if defined (U_DEBUG_CAL)
    -            fprintf(stderr, "%s:%d: jd [==] %d - %sfIsGregorian %sfInvertGregorian, %d\n",
    +            fprintf(stderr, "%s:%d: jd [==] %d - %sfIsGregorian %sfInvertGregorian, %d\n", 
                     __FILE__, __LINE__, jd, fIsGregorian?"T":"F", fInvertGregorian?"T":"F", bestField);
     #endif
             }
    @@ -511,14 +513,14 @@ int32_t GregorianCalendar::handleComputeJulianDay(UCalendarDateFields bestField)
                 int32_t gregShift = Grego::gregorianShift(internalGet(UCAL_EXTENDED_YEAR));
                 if (bestField == UCAL_DAY_OF_YEAR) {
     #if defined (U_DEBUG_CAL)
    -                fprintf(stderr, "%s:%d: [DOY%d] gregorian shift of JD %d += %d\n",
    +                fprintf(stderr, "%s:%d: [DOY%d] gregorian shift of JD %d += %d\n", 
                         __FILE__, __LINE__, fFields[bestField],jd, gregShift);
     #endif
                     jd -= gregShift;
                 } else if ( bestField == UCAL_WEEK_OF_MONTH ) {
                     int32_t weekShift = 14;
     #if defined (U_DEBUG_CAL)
    -                fprintf(stderr, "%s:%d: [WOY/WOM] gregorian week shift of %d += %d\n",
    +                fprintf(stderr, "%s:%d: [WOY/WOM] gregorian week shift of %d += %d\n", 
                         __FILE__, __LINE__, jd, weekShift);
     #endif
                     jd += weekShift; // shift by weeks for week based fields.
    @@ -537,7 +539,7 @@ int32_t GregorianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month,
         // If the month is out of range, adjust it into range, and
         // modify the extended year value accordingly.
         if (month < 0 || month > 11) {
    -        eyear += ClockMath::floorDivide(month, 12, month);
    +        eyear += ClockMath::floorDivide(month, 12, &month);
         }
     
         UBool isLeap = eyear%4 == 0;
    @@ -546,7 +548,7 @@ int32_t GregorianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month,
     
         nonConstThis->fIsGregorian = (eyear >= fGregorianCutoverYear);
     #if defined (U_DEBUG_CAL)
    -    fprintf(stderr, "%s:%d: (hcms%d/%d) fIsGregorian %s, fInvertGregorian %s\n",
    +    fprintf(stderr, "%s:%d: (hcms%d/%d) fIsGregorian %s, fInvertGregorian %s\n", 
             __FILE__, __LINE__, eyear,month, fIsGregorian?"T":"F", fInvertGregorian?"T":"F");
     #endif
         if (fInvertGregorian) {
    @@ -558,7 +560,7 @@ int32_t GregorianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month,
             // Julian calendar
             int32_t gregShift = Grego::gregorianShift(eyear);
     #if defined (U_DEBUG_CAL)
    -        fprintf(stderr, "%s:%d: (hcms%d/%d) gregorian shift of %d += %d\n",
    +        fprintf(stderr, "%s:%d: (hcms%d/%d) gregorian shift of %d += %d\n", 
                 __FILE__, __LINE__, eyear, month, julianDay, gregShift);
     #endif
             julianDay += gregShift;
    @@ -580,7 +582,7 @@ int32_t GregorianCalendar::handleGetMonthLength(int32_t extendedYear, int32_t mo
         // If the month is out of range, adjust it into range, and
         // modify the extended year value accordingly.
         if (month < 0 || month > 11) {
    -        extendedYear += ClockMath::floorDivide(month, 12, month);
    +        extendedYear += ClockMath::floorDivide(month, 12, &month);
         }
     
         return isLeapYear(extendedYear) ? kLeapMonthLength[month] : kMonthLength[month];
    @@ -608,14 +610,6 @@ GregorianCalendar::monthLength(int32_t month, int32_t year) const
     
     // -------------------------------------
     
    -int32_t
    -GregorianCalendar::yearLength(int32_t year) const
    -{
    -    return isLeapYear(year) ? 366 : 365;
    -}
    -
    -// -------------------------------------
    -
     int32_t
     GregorianCalendar::yearLength() const
     {
    @@ -624,24 +618,6 @@ GregorianCalendar::yearLength() const
     
     // -------------------------------------
     
    -/**
    -* After adjustments such as add(MONTH), add(YEAR), we don't want the
    -* month to jump around.  E.g., we don't want Jan 31 + 1 month to go to Mar
    -* 3, we want it to go to Feb 28.  Adjustments which might run into this
    -* problem call this method to retain the proper month.
    -*/
    -void
    -GregorianCalendar::pinDayOfMonth()
    -{
    -    int32_t monthLen = monthLength(internalGet(UCAL_MONTH));
    -    int32_t dom = internalGet(UCAL_DATE);
    -    if(dom > monthLen)
    -        set(UCAL_DATE, monthLen);
    -}
    -
    -// -------------------------------------
    -
    -
     UBool
     GregorianCalendar::validateFields() const
     {
    @@ -651,7 +627,7 @@ GregorianCalendar::validateFields() const
                 field != UCAL_DAY_OF_YEAR &&
                 isSet((UCalendarDateFields)field) &&
                 ! boundsCheck(internalGet((UCalendarDateFields)field), (UCalendarDateFields)field))
    -            return FALSE;
    +            return false;
         }
     
         // Values differ in Least-Maximum and Maximum should be handled
    @@ -659,15 +635,15 @@ GregorianCalendar::validateFields() const
         if (isSet(UCAL_DATE)) {
             int32_t date = internalGet(UCAL_DATE);
             if (date < getMinimum(UCAL_DATE) ||
    -            date > monthLength(internalGet(UCAL_MONTH))) {
    -                return FALSE;
    +            date > monthLength(internalGetMonth())) {
    +                return false;
                 }
         }
     
         if (isSet(UCAL_DAY_OF_YEAR)) {
             int32_t days = internalGet(UCAL_DAY_OF_YEAR);
             if (days < 1 || days > yearLength()) {
    -            return FALSE;
    +            return false;
             }
         }
     
    @@ -675,10 +651,10 @@ GregorianCalendar::validateFields() const
         // We've checked against minimum and maximum above already.
         if (isSet(UCAL_DAY_OF_WEEK_IN_MONTH) &&
             0 == internalGet(UCAL_DAY_OF_WEEK_IN_MONTH)) {
    -            return FALSE;
    +            return false;
             }
     
    -        return TRUE;
    +        return true;
     }
     
     // -------------------------------------
    @@ -691,8 +667,8 @@ GregorianCalendar::boundsCheck(int32_t value, UCalendarDateFields field) const
     
     // -------------------------------------
     
    -UDate
    -GregorianCalendar::getEpochDay(UErrorCode& status)
    +UDate 
    +GregorianCalendar::getEpochDay(UErrorCode& status) 
     {
         complete(status);
         // Divide by 1000 (convert to seconds) in order to prevent overflow when
    @@ -784,7 +760,7 @@ double GregorianCalendar::computeJulianDayOfYear(UBool isGregorian,
     
     // -------------------------------------
     
    -double
    +double 
     GregorianCalendar::millisToJulianDay(UDate millis)
     {
         return (double)kEpochStartAsJulianDay + ClockMath::floorDivide(millis, (double)kOneDay);
    @@ -801,9 +777,9 @@ GregorianCalendar::julianDayToMillis(double julian)
     // -------------------------------------
     
     int32_t
    -GregorianCalendar::aggregateStamp(int32_t stamp_a, int32_t stamp_b)
    +GregorianCalendar::aggregateStamp(int32_t stamp_a, int32_t stamp_b) 
     {
    -    return (((stamp_a != kUnset && stamp_b != kUnset)
    +    return (((stamp_a != kUnset && stamp_b != kUnset) 
             ? uprv_max(stamp_a, stamp_b)
             : (int32_t)kUnset));
     }
    @@ -815,20 +791,19 @@ GregorianCalendar::aggregateStamp(int32_t stamp_a, int32_t stamp_b)
     * Note: This will be made public later. [LIU]
     */
     
    -void
    +void 
     GregorianCalendar::roll(EDateFields field, int32_t amount, UErrorCode& status) {
    -    roll((UCalendarDateFields) field, amount, status);
    +    roll((UCalendarDateFields) field, amount, status); 
     }
     
     void
    -GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& status)
    -{
    +GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) UPRV_NO_SANITIZE_UNDEFINED {
         if((amount == 0) || U_FAILURE(status)) {
             return;
         }
     
         // J81 processing. (gregorian cutover)
    -    UBool inCutoverMonth = FALSE;
    +    UBool inCutoverMonth = false;
         int32_t cMonthLen=0; // 'c' for cutover; in days
         int32_t cDayOfMonth=0; // no discontinuity: [0, cMonthLen)
         double cMonthStart=0.0; // in ms
    @@ -839,7 +814,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
             case UCAL_DAY_OF_MONTH:
             case UCAL_WEEK_OF_MONTH:
                 {
    -                int32_t max = monthLength(internalGet(UCAL_MONTH));
    +                int32_t max = monthLength(internalGetMonth());
                     UDate t = internalGetTime();
                     // We subtract 1 from the DAY_OF_MONTH to make it zero-based, and an
                     // additional 10 if we are after the cutover. Thus the monthStart
    @@ -849,7 +824,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
                     // A month containing the cutover is 10 days shorter.
                     if ((cMonthStart < fGregorianCutover) &&
                         (cMonthStart + (cMonthLen=(max-10))*kOneDay >= fGregorianCutover)) {
    -                        inCutoverMonth = TRUE;
    +                        inCutoverMonth = true;
                         }
                 }
                 break;
    @@ -872,7 +847,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
             // may be one year before or after the calendar year.
             int32_t isoYear = get(UCAL_YEAR_WOY, status);
             int32_t isoDoy = internalGet(UCAL_DAY_OF_YEAR);
    -        if (internalGet(UCAL_MONTH) == UCAL_JANUARY) {
    +        if (internalGetMonth() == UCAL_JANUARY) {
                 if (woy >= 52) {
                     isoDoy += handleGetYearLength(isoYear);
                 }
    @@ -904,7 +879,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
                                 }
     
         case UCAL_DAY_OF_MONTH:
    -        if( !inCutoverMonth ) {
    +        if( !inCutoverMonth ) { 
                 Calendar::roll(field, amount, status);
                 return;
             } else {
    @@ -919,7 +894,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
                     msIntoMonth += monthLen;
                 }
     #if defined (U_DEBUG_CAL)
    -            fprintf(stderr, "%s:%d: roll DOM %d  -> %.0lf ms  \n",
    +            fprintf(stderr, "%s:%d: roll DOM %d  -> %.0lf ms  \n", 
                     __FILE__, __LINE__,amount, cMonthLen, cMonthStart+msIntoMonth);
     #endif
                 setTimeInMillis(cMonthStart + msIntoMonth, status);
    @@ -927,16 +902,16 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
             }
     
         case UCAL_WEEK_OF_MONTH:
    -        if( !inCutoverMonth ) {
    +        if( !inCutoverMonth ) { 
                 Calendar::roll(field, amount, status);
                 return;
             } else {
     #if defined (U_DEBUG_CAL)
    -            fprintf(stderr, "%s:%d: roll WOM %d ??????????????????? \n",
    +            fprintf(stderr, "%s:%d: roll WOM %d ??????????????????? \n", 
                     __FILE__, __LINE__,amount);
     #endif
                 // NOTE: following copied from  the old
    -            //     GregorianCalendar::roll( WEEK_OF_MONTH )  code
    +            //     GregorianCalendar::roll( WEEK_OF_MONTH )  code 
     
                 // This is tricky, because during the roll we may have to shift
                 // to a different day of the week.  For example:
    @@ -974,7 +949,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
                 // Normalize the DAY_OF_WEEK so that 0 is the first day of the week
                 // in this locale.  We have dow in 0..6.
                 int32_t dow = internalGet(UCAL_DAY_OF_WEEK) - getFirstDayOfWeek();
    -            if (dow < 0)
    +            if (dow < 0) 
                     dow += 7;
     
                 // Find the day of month, compensating for cutover discontinuity.
    @@ -983,7 +958,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
                 // Find the day of the week (normalized for locale) for the first
                 // of the month.
                 int32_t fdm = (dow - dom + 1) % 7;
    -            if (fdm < 0)
    +            if (fdm < 0) 
                     fdm += 7;
     
                 // Get the first day of the first full week of the month,
    @@ -1011,14 +986,14 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
                 // Now roll between start and (limit - 1).
                 int32_t gap = limit - start;
                 int32_t newDom = (dom + amount*7 - start) % gap;
    -            if (newDom < 0)
    +            if (newDom < 0) 
                     newDom += gap;
                 newDom += start;
     
                 // Finally, pin to the real start and end of the month.
    -            if (newDom < 1)
    +            if (newDom < 1) 
                     newDom = 1;
    -            if (newDom > monthLen)
    +            if (newDom > monthLen) 
                     newDom = monthLen;
     
                 // Set the DAY_OF_MONTH.  We rely on the fact that this field
    @@ -1031,7 +1006,7 @@ GregorianCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& s
                 // If we are in the cutover month, manipulate ms directly.  Don't do
                 // this in general because it doesn't work across DST boundaries
                 // (details, details).  This takes care of the discontinuity.
    -            setTimeInMillis(cMonthStart + (newDom-1)*kOneDay, status);
    +            setTimeInMillis(cMonthStart + (newDom-1)*kOneDay, status);                
                 return;
             }
     
    @@ -1145,7 +1120,7 @@ int32_t GregorianCalendar::getActualMaximum(UCalendarDateFields field, UErrorCod
                     return 0;
                 }
     
    -            cal->setLenient(TRUE);
    +            cal->setLenient(true);
     
                 int32_t era = cal->get(UCAL_ERA, status);
                 UDate d = cal->getTime(status);
    @@ -1212,7 +1187,7 @@ int32_t GregorianCalendar::handleGetExtendedYear() {
             year = handleGetExtendedYearFromWeekFields(internalGet(UCAL_YEAR_WOY), internalGet(UCAL_WEEK_OF_YEAR));
     #if defined (U_DEBUG_CAL)
             //    if(internalGet(UCAL_YEAR_WOY) != year) {
    -        fprintf(stderr, "%s:%d: hGEYFWF[%d,%d] ->  %d\n",
    +        fprintf(stderr, "%s:%d: hGEYFWF[%d,%d] ->  %d\n", 
                 __FILE__, __LINE__,internalGet(UCAL_YEAR_WOY),internalGet(UCAL_WEEK_OF_YEAR),year);
             //}
     #endif
    @@ -1235,20 +1210,6 @@ int32_t GregorianCalendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy,
     }
     
     
    -// -------------------------------------
    -
    -UBool
    -GregorianCalendar::inDaylightTime(UErrorCode& status) const
    -{
    -    if (U_FAILURE(status) || !getTimeZone().useDaylightTime())
    -        return FALSE;
    -
    -    // Force an update of the state of the Calendar.
    -    ((GregorianCalendar*)this)->complete(status); // cast away const
    -
    -    return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : FALSE);
    -}
    -
     // -------------------------------------
     
     /**
    @@ -1269,21 +1230,21 @@ GregorianCalendar::getType() const {
     
     /**
      * The system maintains a static default century start date and Year.  They are
    - * initialized the first time they are used.  Once the system default century date
    + * initialized the first time they are used.  Once the system default century date 
      * and year are set, they do not change.
      */
    -static UDate           gregocal_gSystemDefaultCenturyStart       = DBL_MIN;
    -static int32_t         gregocal_gSystemDefaultCenturyStartYear   = -1;
    -static icu::UInitOnce  gregocal_gSystemDefaultCenturyInit        = U_INITONCE_INITIALIZER;
    +static UDate           gSystemDefaultCenturyStart       = DBL_MIN;
    +static int32_t         gSystemDefaultCenturyStartYear   = -1;
    +static icu::UInitOnce  gSystemDefaultCenturyInit        {};
     
     
     UBool GregorianCalendar::haveDefaultCentury() const
     {
    -    return TRUE;
    +    return true;
     }
     
     static void U_CALLCONV
    -gregocal_initializeSystemDefaultCentury()
    +initializeSystemDefaultCentury()
     {
         // initialize systemDefaultCentury and systemDefaultCenturyYear based
         // on the current time.  They'll be set to 80 years before
    @@ -1294,8 +1255,8 @@ gregocal_initializeSystemDefaultCentury()
             calendar.setTime(Calendar::getNow(), status);
             calendar.add(UCAL_YEAR, -80, status);
     
    -        gregocal_gSystemDefaultCenturyStart = calendar.getTime(status);
    -        gregocal_gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status);
    +        gSystemDefaultCenturyStart = calendar.getTime(status);
    +        gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status);
         }
         // We have no recourse upon failure unless we want to propagate the failure
         // out.
    @@ -1303,14 +1264,14 @@ gregocal_initializeSystemDefaultCentury()
     
     UDate GregorianCalendar::defaultCenturyStart() const {
         // lazy-evaluate systemDefaultCenturyStart
    -    umtx_initOnce(gregocal_gSystemDefaultCenturyInit, &gregocal_initializeSystemDefaultCentury);
    -    return gregocal_gSystemDefaultCenturyStart;
    +    umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury);
    +    return gSystemDefaultCenturyStart;
     }
     
     int32_t GregorianCalendar::defaultCenturyStartYear() const {
         // lazy-evaluate systemDefaultCenturyStartYear
    -    umtx_initOnce(gregocal_gSystemDefaultCenturyInit, &gregocal_initializeSystemDefaultCentury);
    -    return gregocal_gSystemDefaultCenturyStartYear;
    +    umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury);
    +    return gSystemDefaultCenturyStartYear;
     }
     
     U_NAMESPACE_END
    diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.cpp
    index 537aa19d8..31b5aeed8 100644
    --- a/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.cpp
    +++ b/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.cpp
    @@ -33,28 +33,35 @@ int64_t ClockMath::floorDivide(int64_t numerator, int64_t denominator) {
     }
     
     int32_t ClockMath::floorDivide(double numerator, int32_t denominator,
    -                          int32_t& remainder) {
    -    double quotient;
    -    quotient = uprv_floor(numerator / denominator);
    -    remainder = (int32_t) (numerator - (quotient * denominator));
    +                          int32_t* remainder) {
    +    // For an integer n and representable ⌊x/n⌋, ⌊RN(x/n)⌋=⌊x/n⌋, where RN is
    +    // rounding to nearest.
    +    double quotient = uprv_floor(numerator / denominator);
    +    if (remainder != nullptr) {
    +      // For doubles x and n, where n is an integer and ⌊x+n⌋ < 2³¹, the
    +      // expression `(int32_t) (x + n)` evaluated with rounding to nearest
    +      // differs from ⌊x+n⌋ if 0 < ⌈x⌉−x ≪ x+n, as `x + n` is rounded up to
    +      // n+⌈x⌉ = ⌊x+n⌋ + 1.  Rewriting it as ⌊x⌋+n makes the addition exact.
    +      *remainder = (int32_t) (uprv_floor(numerator) - (quotient * denominator));
    +    }
         return (int32_t) quotient;
     }
     
     double ClockMath::floorDivide(double dividend, double divisor,
    -                         double& remainder) {
    +                         double* remainder) {
         // Only designed to work for positive divisors
         U_ASSERT(divisor > 0);
         double quotient = floorDivide(dividend, divisor);
    -    remainder = dividend - (quotient * divisor);
    +    double r = dividend - (quotient * divisor);
         // N.B. For certain large dividends, on certain platforms, there
         // is a bug such that the quotient is off by one.  If you doubt
         // this to be true, set a breakpoint below and run cintltst.
    -    if (remainder < 0 || remainder >= divisor) {
    +    if (r < 0 || r >= divisor) {
             // E.g. 6.7317038241449352e+022 / 86400000.0 is wrong on my
             // machine (too high by one).  4.1792057231752762e+024 /
             // 86400000.0 is wrong the other way (too low).
             double q = quotient;
    -        quotient += (remainder < 0) ? -1 : +1;
    +        quotient += (r < 0) ? -1 : +1;
             if (q == quotient) {
                 // For quotients > ~2^53, we won't be able to add or
                 // subtract one, since the LSB of the mantissa will be >
    @@ -65,12 +72,15 @@ double ClockMath::floorDivide(double dividend, double divisor,
                 // values give back an approximate answer rather than
                 // crashing.  For example, UDate values above a ~10^25
                 // might all have a time of midnight.
    -            remainder = 0;
    +            r = 0;
             } else {
    -            remainder = dividend - (quotient * divisor);
    +            r = dividend - (quotient * divisor);
             }
         }
    -    U_ASSERT(0 <= remainder && remainder < divisor);
    +    U_ASSERT(0 <= r && r < divisor);
    +    if (remainder != nullptr) {
    +        *remainder = r;
    +    }
         return quotient;
     }
     
    @@ -106,10 +116,10 @@ void Grego::dayToFields(double day, int32_t& year, int32_t& month,
         // representation.  We use 400-year, 100-year, and 4-year cycles.
         // For example, the 4-year cycle has 4 years + 1 leap day; giving
         // 1461 == 365*4 + 1 days.
    -    int32_t n400 = ClockMath::floorDivide(day, 146097, doy); // 400-year cycle length
    -    int32_t n100 = ClockMath::floorDivide(doy, 36524, doy); // 100-year cycle length
    -    int32_t n4   = ClockMath::floorDivide(doy, 1461, doy); // 4-year cycle length
    -    int32_t n1   = ClockMath::floorDivide(doy, 365, doy);
    +    int32_t n400 = ClockMath::floorDivide(day, 146097, &doy); // 400-year cycle length
    +    int32_t n100 = ClockMath::floorDivide(doy, 36524, &doy); // 100-year cycle length
    +    int32_t n4   = ClockMath::floorDivide(doy, 1461, &doy); // 4-year cycle length
    +    int32_t n1   = ClockMath::floorDivide(doy, 365, &doy);
         year = 400*n400 + 100*n100 + 4*n4 + n1;
         if (n100 == 4 || n1 == 4) {
             doy = 365; // Dec 31 at end of 4- or 400-year cycle
    @@ -137,14 +147,14 @@ void Grego::dayToFields(double day, int32_t& year, int32_t& month,
     void Grego::timeToFields(UDate time, int32_t& year, int32_t& month,
                             int32_t& dom, int32_t& dow, int32_t& doy, int32_t& mid) {
         double millisInDay;
    -    double day = ClockMath::floorDivide((double)time, (double)U_MILLIS_PER_DAY, millisInDay);
    +    double day = ClockMath::floorDivide((double)time, (double)U_MILLIS_PER_DAY, &millisInDay);
         mid = (int32_t)millisInDay;
         dayToFields(day, year, month, dom, dow, doy);
     }
     
     int32_t Grego::dayOfWeek(double day) {
         int32_t dow;
    -    ClockMath::floorDivide(day + UCAL_THURSDAY, 7, dow);
    +    ClockMath::floorDivide(day + int{UCAL_THURSDAY}, 7, &dow);
         return (dow == 0) ? UCAL_SATURDAY : dow;
     }
     
    diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.h b/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.h
    index 06eb32384..d65d6a4f8 100644
    --- a/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.h
    +++ b/src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.h
    @@ -78,7 +78,7 @@ class ClockMath {
          * @return the floor of the quotient
          */
         static int32_t floorDivide(double numerator, int32_t denominator,
    -                               int32_t& remainder);
    +                               int32_t* remainder);
     
         /**
          * For a positive divisor, return the quotient and remainder
    @@ -86,12 +86,12 @@ class ClockMath {
          * 0 <= remainder < divisor.
          *
          * Works around edge-case bugs.  Handles pathological input
    -     * (divident >> divisor) reasonably.
    +     * (dividend >> divisor) reasonably.
          *
          * Calling with a divisor <= 0 is disallowed.
          */
         static double floorDivide(double dividend, double divisor,
    -                              double& remainder);
    +                              double* remainder);
     };
     
     // Useful millisecond constants
    @@ -148,9 +148,9 @@ class ClockMath {
     class Grego {
      public:
         /**
    -     * Return TRUE if the given year is a leap year.
    +     * Return true if the given year is a leap year.
          * @param year Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
    -     * @return TRUE if the year is a leap year
    +     * @return true if the year is a leap year
          */
         static inline UBool isLeapYear(int32_t year);
     
    @@ -214,7 +214,7 @@ class Grego {
          * @param dom output parameter to receive day-of-month (1-based)
          * @param dow output parameter to receive day-of-week (1-based, 1==Sun)
          * @param doy output parameter to receive day-of-year (1-based)
    -     * @param mid output parameter to recieve millis-in-day
    +     * @param mid output parameter to receive millis-in-day
          */
         static void timeToFields(UDate time, int32_t& year, int32_t& month,
                                 int32_t& dom, int32_t& dow, int32_t& doy, int32_t& mid);
    diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.cpp
    index 343d1e525..6451c89c5 100644
    --- a/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.cpp
    +++ b/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.cpp
    @@ -20,10 +20,11 @@
     #if !UCONFIG_NO_FORMATTING
     
     #include "cmemory.h"
    +#include "cstring.h"
     #include "umutex.h"
     #include 
    -#include "gregoimp.h" // Math
    -#include "astro.h" // CalendarAstronomer
    +#include "gregoimp.h" // ClockMath
    +#include "astro.h" // CalendarCache
     #include "uhash.h"
     #include "ucln_in.h"
     
    @@ -37,7 +38,7 @@
     */
     //static const double EPOCH_MILLIS = -180799862400000.; // 1/1/1 HY
     
    -static const int32_t HEBRWCAL_LIMITS[UCAL_FIELD_COUNT][4] = {
    +static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = {
         // Minimum  Greatest    Least  Maximum
         //           Minimum  Maximum
         {        0,        0,        0,        0}, // ERA
    @@ -63,6 +64,7 @@ static const int32_t HEBRWCAL_LIMITS[UCAL_FIELD_COUNT][4] = {
         {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // JULIAN_DAY
         {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // MILLISECONDS_IN_DAY
         {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // IS_LEAP_MONTH
    +    {        0,        0,       11,       12}, // ORDINAL_MONTH
     };
     
     /**
    @@ -134,13 +136,13 @@ static const int16_t  LEAP_MONTH_START[][3] = {
         {  383,        384,        385  },          // Elul
     };
     
    -static icu::CalendarCache *hebrwcal_gCache =  NULL;
    +static icu::CalendarCache *gCache =  nullptr;
     
     U_CDECL_BEGIN
    -static UBool calendar_hebrew_cleanup(void) {
    -    delete hebrwcal_gCache;
    -    hebrwcal_gCache = NULL;
    -    return TRUE;
    +static UBool calendar_hebrew_cleanup() {
    +    delete gCache;
    +    gCache = nullptr;
    +    return true;
     }
     U_CDECL_END
     
    @@ -155,7 +157,7 @@ U_NAMESPACE_BEGIN
     * @internal
     */
     HebrewCalendar::HebrewCalendar(const Locale& aLocale, UErrorCode& success)
    -:   Calendar(TimeZone::createDefault(), aLocale, success)
    +:   Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success)
     
     {
         setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly.
    @@ -187,7 +189,7 @@ HebrewCalendar::HebrewCalendar(const HebrewCalendar& other) : Calendar(other) {
     /**
     * Add a signed amount to a specified field, using this calendar's rules.
     * For example, to add three days to the current date, you can call
    -* add(Calendar.DATE, 3).
    +* add(Calendar.DATE, 3). 
     * 

    * When adding to certain fields, the values of other fields may conflict and * need to be changed. For example, when adding one to the {@link #MONTH MONTH} field @@ -218,6 +220,7 @@ void HebrewCalendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& } switch (field) { case UCAL_MONTH: + case UCAL_ORDINAL_MONTH: { // We can't just do a set(MONTH, get(MONTH) + amount). The // reason is ADAR_1. Suppose amount is +2 and we land in @@ -239,7 +242,7 @@ void HebrewCalendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& } month -= ELUL+1; ++year; - acrossAdar1 = TRUE; + acrossAdar1 = true; } } else { acrossAdar1 = (month > ADAR_1); // started after ADAR_1? @@ -253,7 +256,7 @@ void HebrewCalendar::add(UCalendarDateFields field, int32_t amount, UErrorCode& } month += ELUL+1; --year; - acrossAdar1 = TRUE; + acrossAdar1 = true; } } set(UCAL_MONTH, month); @@ -281,7 +284,7 @@ void HebrewCalendar::add(EDateFields field, int32_t amount, UErrorCode& status) * example, to roll the current date up by three days, you can call * roll(Calendar.DATE, 3). If the * field is rolled past its maximum allowable value, it will "wrap" back -* to its minimum and continue rolling. +* to its minimum and continue rolling. * For example, calling roll(Calendar.DATE, 10) * on a Hebrew calendar set to "25 Av 5758" will result in the date "5 Av 5758". *

    @@ -315,6 +318,7 @@ void HebrewCalendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& } switch (field) { case UCAL_MONTH: + case UCAL_ORDINAL_MONTH: { int32_t month = get(UCAL_MONTH, status); int32_t year = get(UCAL_YEAR, status); @@ -390,10 +394,11 @@ static const int32_t BAHARAD = 11*HOUR_PARTS + 204; int32_t HebrewCalendar::startOfYear(int32_t year, UErrorCode &status) { ucln_i18n_registerCleanup(UCLN_I18N_HEBREW_CALENDAR, calendar_hebrew_cleanup); - int32_t day = CalendarCache::get(&hebrwcal_gCache, year, status); + int32_t day = CalendarCache::get(&gCache, year, status); if (day == 0) { - int32_t months = (235 * year - 234) / 19; // # of months before year + // # of months before year + int32_t months = (int32_t)ClockMath::floorDivide((235 * (int64_t)year - 234), (int64_t)19); int64_t frac = (int64_t)months * MONTH_FRACT + BAHARAD; // Fractional part of day # day = months * 29 + (int32_t)(frac / DAY_PARTS); // Whole # part of calculation @@ -418,7 +423,7 @@ int32_t HebrewCalendar::startOfYear(int32_t year, UErrorCode &status) // Prevents 382-day years. day += 1; } - CalendarCache::put(&hebrwcal_gCache, year, day, status); + CalendarCache::put(&gCache, year, day, status); } return day; } @@ -489,7 +494,7 @@ int32_t HebrewCalendar::monthsInYear(int32_t year) { * @internal */ int32_t HebrewCalendar::handleGetLimit(UCalendarDateFields field, ELimitType limitType) const { - return HEBRWCAL_LIMITS[field][limitType]; + return LIMITS[field][limitType]; } /** @@ -533,7 +538,8 @@ int32_t HebrewCalendar::handleGetYearLength(int32_t eyear) const { } void HebrewCalendar::validateField(UCalendarDateFields field, UErrorCode &status) { - if (field == UCAL_MONTH && !isLeapYear(handleGetExtendedYear()) && internalGet(UCAL_MONTH) == ADAR_1) { + if ((field == UCAL_MONTH || field == UCAL_ORDINAL_MONTH) + && !isLeapYear(handleGetExtendedYear()) && internalGetMonth() == ADAR_1) { status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -553,7 +559,7 @@ void HebrewCalendar::validateField(UCalendarDateFields field, UErrorCode &status *

  • DAY_OF_MONTH *
  • DAY_OF_YEAR *
  • EXTENDED_YEAR -* +* * Subclasses can refer to the DAY_OF_WEEK and DOW_LOCAL fields, * which will be set when this method is called. Subclasses can * also call the getGregorianXxx() methods to obtain Gregorian @@ -566,8 +572,8 @@ void HebrewCalendar::validateField(UCalendarDateFields field, UErrorCode &status */ void HebrewCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) { int32_t d = julianDay - 347997; - double m = ((d * (double)DAY_PARTS)/ (double) MONTH_PARTS); // Months (approx) - int32_t year = (int32_t)( ((19. * m + 234.) / 235.) + 1.); // Years (approx) + double m = ClockMath::floorDivide((d * (double)DAY_PARTS), (double) MONTH_PARTS); // Months (approx) + int32_t year = (int32_t)(ClockMath::floorDivide((19. * m + 234.), 235.) + 1.); // Years (approx) int32_t ys = startOfYear(year, status); // 1st day of year int32_t dayOfYear = (d - ys); @@ -606,9 +612,14 @@ void HebrewCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) internalSet(UCAL_ERA, 0); internalSet(UCAL_YEAR, year); internalSet(UCAL_EXTENDED_YEAR, year); + int32_t ordinal_month = month; + if (!isLeap && ordinal_month > ADAR_1) { + ordinal_month--; + } + internalSet(UCAL_ORDINAL_MONTH, ordinal_month); internalSet(UCAL_MONTH, month); internalSet(UCAL_DAY_OF_MONTH, dayOfMonth); - internalSet(UCAL_DAY_OF_YEAR, dayOfYear); + internalSet(UCAL_DAY_OF_YEAR, dayOfYear); } //------------------------------------------------------------------------- @@ -665,34 +676,38 @@ int32_t HebrewCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, UB return (int) (day + 347997); } -UBool -HebrewCalendar::inDaylightTime(UErrorCode& status) const -{ - // copied from GregorianCalendar - if (U_FAILURE(status) || !getTimeZone().useDaylightTime()) - return FALSE; +constexpr uint32_t kHebrewRelatedYearDiff = -3760; - // Force an update of the state of the Calendar. - ((HebrewCalendar*)this)->complete(status); // cast away const +int32_t HebrewCalendar::getRelatedYear(UErrorCode &status) const +{ + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; + } + return year + kHebrewRelatedYearDiff; +} - return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : FALSE); +void HebrewCalendar::setRelatedYear(int32_t year) +{ + // set extended year + set(UCAL_EXTENDED_YEAR, year - kHebrewRelatedYearDiff); } /** * The system maintains a static default century start date and Year. They are - * initialized the first time they are used. Once the system default century date + * initialized the first time they are used. Once the system default century date * and year are set, they do not change. */ -static UDate hebrwcal_gSystemDefaultCenturyStart = DBL_MIN; -static int32_t hebrwcal_gSystemDefaultCenturyStartYear = -1; -static icu::UInitOnce hebrwcal_gSystemDefaultCenturyInit = U_INITONCE_INITIALIZER; +static UDate gSystemDefaultCenturyStart = DBL_MIN; +static int32_t gSystemDefaultCenturyStartYear = -1; +static icu::UInitOnce gSystemDefaultCenturyInit {}; UBool HebrewCalendar::haveDefaultCentury() const { - return TRUE; + return true; } -static void U_CALLCONV hebrwcal_initializeSystemDefaultCentury() +static void U_CALLCONV initializeSystemDefaultCentury() { // initialize systemDefaultCentury and systemDefaultCenturyYear based // on the current time. They'll be set to 80 years before @@ -703,8 +718,8 @@ static void U_CALLCONV hebrwcal_initializeSystemDefaultCentury() calendar.setTime(Calendar::getNow(), status); calendar.add(UCAL_YEAR, -80, status); - hebrwcal_gSystemDefaultCenturyStart = calendar.getTime(status); - hebrwcal_gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); + gSystemDefaultCenturyStart = calendar.getTime(status); + gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); } // We have no recourse upon failure unless we want to propagate the failure // out. @@ -713,16 +728,59 @@ static void U_CALLCONV hebrwcal_initializeSystemDefaultCentury() UDate HebrewCalendar::defaultCenturyStart() const { // lazy-evaluate systemDefaultCenturyStart - umtx_initOnce(hebrwcal_gSystemDefaultCenturyInit, &hebrwcal_initializeSystemDefaultCentury); - return hebrwcal_gSystemDefaultCenturyStart; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStart; } int32_t HebrewCalendar::defaultCenturyStartYear() const { // lazy-evaluate systemDefaultCenturyStartYear - umtx_initOnce(hebrwcal_gSystemDefaultCenturyInit, &hebrwcal_initializeSystemDefaultCentury); - return hebrwcal_gSystemDefaultCenturyStartYear; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStartYear; +} + +bool HebrewCalendar::inTemporalLeapYear(UErrorCode& status) const { + if (U_FAILURE(status)) return false; + int32_t eyear = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) return false; + return isLeapYear(eyear); +} + +static const char * const gTemporalMonthCodesForHebrew[] = { + "M01", "M02", "M03", "M04", "M05", "M05L", "M06", + "M07", "M08", "M09", "M10", "M11", "M12", nullptr +}; + +const char* HebrewCalendar::getTemporalMonthCode(UErrorCode& status) const { + int32_t month = get(UCAL_MONTH, status); + if (U_FAILURE(status)) return nullptr; + return gTemporalMonthCodesForHebrew[month]; } +void HebrewCalendar::setTemporalMonthCode(const char* code, UErrorCode& status ) +{ + if (U_FAILURE(status)) return; + int32_t len = static_cast(uprv_strlen(code)); + if (len == 3 || len == 4) { + for (int m = 0; gTemporalMonthCodesForHebrew[m] != nullptr; m++) { + if (uprv_strcmp(code, gTemporalMonthCodesForHebrew[m]) == 0) { + set(UCAL_MONTH, m); + return; + } + } + } + status = U_ILLEGAL_ARGUMENT_ERROR; +} + +int32_t HebrewCalendar::internalGetMonth() const { + if (resolveFields(kMonthPrecedence) == UCAL_ORDINAL_MONTH) { + int32_t ordinalMonth = internalGet(UCAL_ORDINAL_MONTH); + HebrewCalendar *nonConstThis = (HebrewCalendar*)this; // cast away const + + int32_t year = nonConstThis->handleGetExtendedYear(); + return ordinalMonth + (((!isLeapYear(year)) && (ordinalMonth > ADAR_1)) ? 1: 0); + } + return Calendar::internalGetMonth(); +} UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HebrewCalendar) diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.h b/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.h index 08136de32..829a64221 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.h @@ -88,7 +88,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * Useful constants for HebrewCalendar. * @internal */ - enum EEras { + enum Month { /** * Constant for Tishri, the 1st month of the Hebrew year. */ @@ -180,19 +180,12 @@ class U_I18N_API HebrewCalendar : public Calendar { */ HebrewCalendar(const HebrewCalendar& source); - /** - * Default assignment operator - * @param right the object to be copied. - * @internal - */ - HebrewCalendar& operator=(const HebrewCalendar& right); - /** * Create and return a polymorphic copy of this calendar. * @return return a polymorphic copy of this calendar. * @internal */ - virtual HebrewCalendar* clone() const; + virtual HebrewCalendar* clone() const override; public: /** @@ -205,7 +198,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -218,7 +211,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * @return The class ID for all objects of this class. * @internal */ - static UClassID U_EXPORT2 getStaticClassID(void); + static UClassID U_EXPORT2 getStaticClassID(); /** * return the calendar type, "hebrew". @@ -226,7 +219,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * @return calendar type * @internal */ - virtual const char * getType() const; + virtual const char * getType() const override; // Calendar API @@ -242,11 +235,11 @@ class U_I18N_API HebrewCalendar : public Calendar { * previously set in the time field is invalid, this will be set to * an error status. */ - virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status); + virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status) override; /** * @deprecated ICU 2.6 use UCalendarDateFields instead of EDateFields */ - virtual void add(EDateFields field, int32_t amount, UErrorCode& status); + virtual void add(EDateFields field, int32_t amount, UErrorCode& status) override; /** @@ -260,7 +253,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * an error status. * @internal */ - virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status); + virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) override; /** * (Overrides Calendar) Rolls up or down by the given amount in the specified field. @@ -273,13 +266,27 @@ class U_I18N_API HebrewCalendar : public Calendar { * an error status. * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. ` */ - virtual void roll(EDateFields field, int32_t amount, UErrorCode& status); + virtual void roll(EDateFields field, int32_t amount, UErrorCode& status) override; /** * @internal */ static UBool isLeapYear(int32_t year) ; + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const override; + + /** + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field + * @internal + */ + virtual void setRelatedYear(int32_t year) override; + protected: /** @@ -303,7 +310,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * LEAST_MAXIMUM, or MAXIMUM * @internal */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; /** * Return the number of days in the given month of the given extended @@ -312,7 +319,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * implementation than the default implementation in Calendar. * @internal */ - virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const; + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const override; /** * Return the number of days in the given extended year of this @@ -321,7 +328,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * default implementation in Calendar. * @stable ICU 2.0 */ - virtual int32_t handleGetYearLength(int32_t eyear) const; + virtual int32_t handleGetYearLength(int32_t eyear) const override; /** * Subclasses may override this method to compute several fields * specific to each calendar system. These are: @@ -337,7 +344,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * a calendar with the specified Julian/Gregorian cutover date. * @internal */ - virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; /** * Return the extended year defined by the current fields. This will * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such @@ -346,7 +353,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * @return the extended year * @internal */ - virtual int32_t handleGetExtendedYear(); + virtual int32_t handleGetExtendedYear() override; /** * Return the Julian day number of day before the first day of the * given month in the given extended year. Subclasses should override @@ -361,7 +368,7 @@ class U_I18N_API HebrewCalendar : public Calendar { * @internal */ virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, - UBool useMonth) const; + UBool useMonth) const override; /** @@ -370,39 +377,72 @@ class U_I18N_API HebrewCalendar : public Calendar { * special handling for month validation for Hebrew calendar. * @internal */ - virtual void validateField(UCalendarDateFields field, UErrorCode &status); + virtual void validateField(UCalendarDateFields field, UErrorCode &status) override; protected: + /** + * Returns true because the Hebrew Calendar does have a default century + * @internal + */ + virtual UBool haveDefaultCentury() const override; /** - * (Overrides Calendar) Return true if the current date for this Calendar is in - * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. - * - * @param status Fill-in parameter which receives the status of this operation. - * @return True if the current date for this Calendar is in Daylight Savings Time, - * false, otherwise. + * Returns the date of the start of the default century + * @return start of century - in milliseconds since epoch, 1970 * @internal */ - virtual UBool inDaylightTime(UErrorCode& status) const; + virtual UDate defaultCenturyStart() const override; - /** - * Returns TRUE because the Hebrew Calendar does have a default century - * @internal - */ - virtual UBool haveDefaultCentury() const; + /** + * Returns the year in which the default century begins + * @internal + */ + virtual int32_t defaultCenturyStartYear() const override; - /** - * Returns the date of the start of the default century - * @return start of century - in milliseconds since epoch, 1970 - * @internal - */ - virtual UDate defaultCenturyStart() const; + public: + /** + * Returns true if the date is in a leap year. + * + * @param status ICU Error Code + * @return True if the date in the fields is in a Temporal proposal + * defined leap year. False otherwise. + */ + virtual bool inTemporalLeapYear(UErrorCode& status) const override; - /** - * Returns the year in which the default century begins - * @internal - */ - virtual int32_t defaultCenturyStartYear() const; + /** + * Gets The Temporal monthCode value corresponding to the month for the date. + * The value is a string identifier that starts with the literal grapheme + * "M" followed by two graphemes representing the zero-padded month number + * of the current month in a normal (non-leap) year and suffixed by an + * optional literal grapheme "L" if this is a leap month in a lunisolar + * calendar. For the Hebrew calendar, the values are "M01" .. "M12" for + * non-leap year, and "M01" .. "M05", "M05L", "M06" .. "M12" for leap year. + * + * @param status ICU Error Code + * @return One of 13 possible strings in {"M01".. "M05", "M05L", + * "M06" .. "M12"}. + * @draft ICU 73 + */ + virtual const char* getTemporalMonthCode(UErrorCode& status) const override; + + /** + * Sets The Temporal monthCode which is a string identifier that starts + * with the literal grapheme "M" followed by two graphemes representing + * the zero-padded month number of the current month in a normal + * (non-leap) year and suffixed by an optional literal grapheme "L" if this + * is a leap month in a lunisolar calendar. For Hebrew calendar, the values + * are "M01" .. "M12" for non-leap years, and "M01" .. "M05", "M05L", "M06" + * .. "M12" for leap year. + * + * @param temporalMonth The value to be set for temporal monthCode. + * @param status ICU Error Code + * + * @draft ICU 73 + */ + virtual void setTemporalMonthCode(const char* code, UErrorCode& status ) override; + + protected: + virtual int32_t internalGetMonth() const override; private: // Calendar-specific implementation /** diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.cpp index 695e1fe3e..29c2749f4 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.cpp @@ -16,7 +16,6 @@ #include "mutex.h" #include #include "gregoimp.h" // Math -#include "astro.h" // CalendarAstronomer #include "uhash.h" // Debugging @@ -40,7 +39,7 @@ IndianCalendar* IndianCalendar::clone() const { } IndianCalendar::IndianCalendar(const Locale& aLocale, UErrorCode& success) - : Calendar(TimeZone::createDefault(), aLocale, success) + : Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. } @@ -51,11 +50,11 @@ IndianCalendar::IndianCalendar(const IndianCalendar& other) : Calendar(other) { IndianCalendar::~IndianCalendar() { } -const char *IndianCalendar::getType() const { +const char *IndianCalendar::getType() const { return "indian"; } - -static const int32_t INDIANCAL_LIMITS[UCAL_FIELD_COUNT][4] = { + +static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = { // Minimum Greatest Least Maximum // Minimum Maximum { 0, 0, 0, 0}, // ERA @@ -81,23 +80,24 @@ static const int32_t INDIANCAL_LIMITS[UCAL_FIELD_COUNT][4] = { {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // JULIAN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // MILLISECONDS_IN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // IS_LEAP_MONTH + { 0, 0, 11, 11}, // ORDINAL_MONTH }; static const int32_t INDIAN_ERA_START = 78; static const int32_t INDIAN_YEAR_START = 80; int32_t IndianCalendar::handleGetLimit(UCalendarDateFields field, ELimitType limitType) const { - return INDIANCAL_LIMITS[field][limitType]; + return LIMITS[field][limitType]; } /* - * Determine whether the given gregorian year is a Leap year + * Determine whether the given gregorian year is a Leap year */ static UBool isGregorianLeap(int32_t year) { return Grego::isLeapYear(year); } - + //---------------------------------------------------------------------- // Calendar framework //---------------------------------------------------------------------- @@ -110,7 +110,7 @@ static UBool isGregorianLeap(int32_t year) */ int32_t IndianCalendar::handleGetMonthLength(int32_t eyear, int32_t month) const { if (month < 0 || month > 11) { - eyear += ClockMath::floorDivide(month, 12, month); + eyear += ClockMath::floorDivide(month, 12, &month); } if (isGregorianLeap(eyear + INDIAN_ERA_START) && month == 0) { @@ -155,7 +155,7 @@ static int32_t* jdToGregorian(double jd, int32_t gregorianDate[3]) { return gregorianDate; } - + //------------------------------------------------------------------------- // Functions for converting from field values to milliseconds.... //------------------------------------------------------------------------- @@ -169,7 +169,7 @@ static double IndianToJD(int32_t year, int32_t month, int32_t date) { if(isGregorianLeap(gyear)) { leapMonth = 31; start = gregorianToJD(gyear, 2 /* The third month in 0 based month */, 21); - } + } else { leapMonth = 30; start = gregorianToJD(gyear, 2 /* The third month in 0 based month */, 22); @@ -205,20 +205,20 @@ static double IndianToJD(int32_t year, int32_t month, int32_t date) { */ int32_t IndianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, UBool /* useMonth */ ) const { - //month is 0 based; converting it to 1-based + //month is 0 based; converting it to 1-based int32_t imonth; // If the month is out of range, adjust it into range, and adjust the extended year accordingly if (month < 0 || month > 11) { - eyear += (int32_t)ClockMath::floorDivide(month, 12, month); + eyear += (int32_t)ClockMath::floorDivide(month, 12, &month); } if(month == 12){ imonth = 1; } else { - imonth = month + 1; + imonth = month + 1; } - + double jd = IndianToJD(eyear ,imonth, 1); return (int32_t)jd; @@ -249,7 +249,7 @@ int32_t IndianCalendar::handleGetExtendedYear() { *
  • MONTH *
  • DAY_OF_MONTH *
  • EXTENDED_YEAR - * + * * The DAY_OF_WEEK and DOW_LOCAL fields are already set when this * method is called. The getGregorianXxx() methods return Gregorian * calendar equivalents for the given Julian day. @@ -294,42 +294,45 @@ void IndianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& /* stat internalSet(UCAL_EXTENDED_YEAR, IndianYear); internalSet(UCAL_YEAR, IndianYear); internalSet(UCAL_MONTH, IndianMonth); + internalSet(UCAL_ORDINAL_MONTH, IndianMonth); internalSet(UCAL_DAY_OF_MONTH, IndianDayOfMonth); internalSet(UCAL_DAY_OF_YEAR, yday + 1); // yday is 0-based -} +} + +constexpr uint32_t kIndianRelatedYearDiff = 79; -UBool -IndianCalendar::inDaylightTime(UErrorCode& status) const +int32_t IndianCalendar::getRelatedYear(UErrorCode &status) const { - // copied from GregorianCalendar - if (U_FAILURE(status) || !getTimeZone().useDaylightTime()) { - return FALSE; + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; } - - // Force an update of the state of the Calendar. - ((IndianCalendar*)this)->complete(status); // cast away const - - return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : FALSE); + return year + kIndianRelatedYearDiff; } +void IndianCalendar::setRelatedYear(int32_t year) +{ + // set extended year + set(UCAL_EXTENDED_YEAR, year - kIndianRelatedYearDiff); +} /** * The system maintains a static default century start date and Year. They are * initialized the first time they are used. Once the system default century date * and year are set, they do not change. */ -static UDate indiancal_gSystemDefaultCenturyStart = DBL_MIN; -static int32_t indiancal_gSystemDefaultCenturyStartYear = -1; -static icu::UInitOnce indiancal_gSystemDefaultCenturyInit = U_INITONCE_INITIALIZER; +static UDate gSystemDefaultCenturyStart = DBL_MIN; +static int32_t gSystemDefaultCenturyStartYear = -1; +static icu::UInitOnce gSystemDefaultCenturyInit {}; UBool IndianCalendar::haveDefaultCentury() const { - return TRUE; + return true; } static void U_CALLCONV -indiancal_initializeSystemDefaultCentury() +initializeSystemDefaultCentury() { // initialize systemDefaultCentury and systemDefaultCenturyYear based // on the current time. They'll be set to 80 years before @@ -344,8 +347,8 @@ indiancal_initializeSystemDefaultCentury() UDate newStart = calendar.getTime ( status ); int32_t newYear = calendar.get ( UCAL_YEAR, status ); - indiancal_gSystemDefaultCenturyStart = newStart; - indiancal_gSystemDefaultCenturyStartYear = newYear; + gSystemDefaultCenturyStart = newStart; + gSystemDefaultCenturyStartYear = newYear; } // We have no recourse upon failure. } @@ -355,16 +358,16 @@ UDate IndianCalendar::defaultCenturyStart() const { // lazy-evaluate systemDefaultCenturyStart - umtx_initOnce(indiancal_gSystemDefaultCenturyInit, &indiancal_initializeSystemDefaultCentury); - return indiancal_gSystemDefaultCenturyStart; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStart; } int32_t IndianCalendar::defaultCenturyStartYear() const { // lazy-evaluate systemDefaultCenturyStartYear - umtx_initOnce(indiancal_gSystemDefaultCenturyInit, &indiancal_initializeSystemDefaultCentury); - return indiancal_gSystemDefaultCenturyStartYear; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStartYear; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.h b/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.h index e259d9bc1..5ef9113a8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/indiancal.h @@ -25,7 +25,7 @@ U_NAMESPACE_BEGIN * Concrete class which provides the Indian calendar. *

    * IndianCalendar is a subclass of Calendar - * that numbers years since the begining of SAKA ERA. This is the civil calendar + * that numbers years since the beginning of SAKA ERA. This is the civil calendar * which is accepted by government of India as Indian National Calendar. * The two calendars most widely used in India today are the Vikrama calendar * followed in North India and the Shalivahana or Saka calendar which is followed @@ -147,7 +147,7 @@ class U_I18N_API IndianCalendar : public Calendar { * @param aLocale The given locale. * @param success Indicates the status of IndianCalendar object construction. * Returns U_ZERO_ERROR if constructed successfully. - * @param beCivil Whether the calendar should be civil (default-TRUE) or religious (FALSE) + * @param beCivil Whether the calendar should be civil (default-true) or religious (false) * @internal */ IndianCalendar(const Locale& aLocale, UErrorCode &success); @@ -186,7 +186,7 @@ class U_I18N_API IndianCalendar : public Calendar { // TODO: copy c'tor, etc // clone - virtual IndianCalendar* clone() const; + virtual IndianCalendar* clone() const override; private: /** @@ -200,7 +200,7 @@ class U_I18N_API IndianCalendar : public Calendar { /** * @internal */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; /** * Return the length (in days) of the given month. @@ -209,13 +209,13 @@ class U_I18N_API IndianCalendar : public Calendar { * @param year The month(0-based) in Indian year * @internal */ - virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const; + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const override; /** * Return the number of days in the given Indian year * @internal */ - virtual int32_t handleGetYearLength(int32_t extendedYear) const; + virtual int32_t handleGetYearLength(int32_t extendedYear) const override; //------------------------------------------------------------------------- // Functions for converting from field values to milliseconds.... @@ -225,7 +225,7 @@ class U_I18N_API IndianCalendar : public Calendar { /** * @internal */ - virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const; + virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const override; //------------------------------------------------------------------------- // Functions for converting from milliseconds to field values @@ -234,7 +234,7 @@ class U_I18N_API IndianCalendar : public Calendar { /** * @internal */ - virtual int32_t handleGetExtendedYear(); + virtual int32_t handleGetExtendedYear() override; /** * Override Calendar to compute several fields specific to the Indian @@ -252,7 +252,7 @@ class U_I18N_API IndianCalendar : public Calendar { * calendar equivalents for the given Julian day. * @internal */ - virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; // UObject stuff public: @@ -261,7 +261,7 @@ class U_I18N_API IndianCalendar : public Calendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -274,7 +274,7 @@ class U_I18N_API IndianCalendar : public Calendar { * @return The class ID for all objects of this class. * @internal */ - static UClassID U_EXPORT2 getStaticClassID(void); + static UClassID U_EXPORT2 getStaticClassID(); /** * return the calendar type, "indian". @@ -282,44 +282,46 @@ class U_I18N_API IndianCalendar : public Calendar { * @return calendar type * @internal */ - virtual const char * getType() const; + virtual const char * getType() const override; -private: - IndianCalendar(); // default constructor not implemented - - // Default century. -protected: + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const override; /** - * (Overrides Calendar) Return true if the current date for this Calendar is in - * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. - * - * @param status Fill-in parameter which receives the status of this operation. - * @return True if the current date for this Calendar is in Daylight Savings Time, - * false, otherwise. + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field * @internal */ - virtual UBool inDaylightTime(UErrorCode& status) const; + virtual void setRelatedYear(int32_t year) override; + +private: + IndianCalendar() = delete; // default constructor not implemented + // Default century. +protected: /** - * Returns TRUE because the Indian Calendar does have a default century + * Returns true because the Indian Calendar does have a default century * @internal */ - virtual UBool haveDefaultCentury() const; + virtual UBool haveDefaultCentury() const override; /** * Returns the date of the start of the default century * @return start of century - in milliseconds since epoch, 1970 * @internal */ - virtual UDate defaultCenturyStart() const; + virtual UDate defaultCenturyStart() const override; /** * Returns the year in which the default century begins * @internal */ - virtual int32_t defaultCenturyStartYear() const; + virtual int32_t defaultCenturyStartYear() const override; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.cpp index 40e99b96a..c21530a73 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.cpp @@ -54,20 +54,20 @@ static void debug_islamcal_msg(const char *pat, ...) // --- The cache -- // cache of months -static icu::CalendarCache *gMonthCache = NULL; -static icu::CalendarAstronomer *gIslamicCalendarAstro = NULL; +static icu::CalendarCache *gMonthCache = nullptr; +static icu::CalendarAstronomer *gIslamicCalendarAstro = nullptr; U_CDECL_BEGIN -static UBool calendar_islamic_cleanup(void) { +static UBool calendar_islamic_cleanup() { if (gMonthCache) { delete gMonthCache; - gMonthCache = NULL; + gMonthCache = nullptr; } if (gIslamicCalendarAstro) { delete gIslamicCalendarAstro; - gIslamicCalendarAstro = NULL; + gIslamicCalendarAstro = nullptr; } - return TRUE; + return true; } U_CDECL_END @@ -206,67 +206,22 @@ int32_t getUmalqura_MonthLength(int32_t y, int32_t m) { //------------------------------------------------------------------------- const char *IslamicCalendar::getType() const { - const char *sType = NULL; - - switch (cType) { - case CIVIL: - sType = "islamic-civil"; - break; - case ASTRONOMICAL: - sType = "islamic"; - break; - case TBLA: - sType = "islamic-tbla"; - break; - case UMALQURA: - sType = "islamic-umalqura"; - break; - default: - UPRV_UNREACHABLE; // out of range - } - return sType; + return "islamic"; } IslamicCalendar* IslamicCalendar::clone() const { return new IslamicCalendar(*this); } -IslamicCalendar::IslamicCalendar(const Locale& aLocale, UErrorCode& success, ECalculationType type) -: Calendar(TimeZone::createDefault(), aLocale, success), -cType(type) +IslamicCalendar::IslamicCalendar(const Locale& aLocale, UErrorCode& success) +: Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. } -IslamicCalendar::IslamicCalendar(const IslamicCalendar& other) : Calendar(other), cType(other.cType) { -} - IslamicCalendar::~IslamicCalendar() { } - -void IslamicCalendar::setCalculationType(ECalculationType type, UErrorCode &status) -{ - if (cType != type) { - // The fields of the calendar will become invalid, because the calendar - // rules are different - UDate m = getTimeInMillis(status); - cType = type; - clear(); - setTimeInMillis(m, status); - } -} - -/** -* Returns true if this object is using the fixed-cycle civil -* calendar, or false if using the religious, astronomical -* calendar. -* @draft ICU 2.4 -*/ -UBool IslamicCalendar::isCivil() { - return (cType == CIVIL); -} - //------------------------------------------------------------------------- // Minimum / Maximum access functions //------------------------------------------------------------------------- @@ -278,7 +233,7 @@ UBool IslamicCalendar::isCivil() { // a month as having 31 days. Since date parsing now uses range checks based // on the table below, we need to change the range for last day of month to // include 31 as a workaround until the implementation is fixed. -static const int32_t ISLAMCAL_LIMITS[UCAL_FIELD_COUNT][4] = { +static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = { // Minimum Greatest Least Maximum // Minimum Maximum { 0, 0, 0, 0}, // ERA @@ -304,13 +259,14 @@ static const int32_t ISLAMCAL_LIMITS[UCAL_FIELD_COUNT][4] = { {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // JULIAN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // MILLISECONDS_IN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // IS_LEAP_MONTH + { 0, 0, 11, 11}, // ORDINAL_MONTH }; /** * @draft ICU 2.4 */ int32_t IslamicCalendar::handleGetLimit(UCalendarDateFields field, ELimitType limitType) const { - return ISLAMCAL_LIMITS[field][limitType]; + return LIMITS[field][limitType]; } //------------------------------------------------------------------------- @@ -365,19 +321,7 @@ UBool IslamicCalendar::civilLeapYear(int32_t year) * from the Hijri epoch, origin 0. */ int32_t IslamicCalendar::yearStart(int32_t year) const{ - if (cType == CIVIL || cType == TBLA || - (cType == UMALQURA && (year < UMALQURA_YEAR_START || year > UMALQURA_YEAR_END))) - { - return (year-1)*354 + ClockMath::floorDivide((3+11*(int64_t)year),(int64_t)30); - } else if(cType==ASTRONOMICAL){ - return trueMonthStart(12*(year-1)); - } else { - year -= UMALQURA_YEAR_START; - // rounded least-squares fit of the dates previously calculated from UMALQURA_MONTHLENGTH iteration - int32_t yrStartLinearEstimate = (int32_t)((354.36720 * (double)year) + 460322.05 + 0.5); - // need a slight correction to some - return yrStartLinearEstimate + umAlQuraYrStartEstimateFix[year]; - } + return trueMonthStart(12*(year-1)); } /** @@ -388,19 +332,7 @@ int32_t IslamicCalendar::yearStart(int32_t year) const{ * @param month The hijri month, 0-based (assumed to be in range 0..11) */ int32_t IslamicCalendar::monthStart(int32_t year, int32_t month) const { - if (cType == CIVIL || cType == TBLA) { - // This does not handle months out of the range 0..11 - return (int32_t)uprv_ceil(29.5*month) - + (year-1)*354 + (int32_t)ClockMath::floorDivide((3+11*(int64_t)year),(int64_t)30); - } else if(cType==ASTRONOMICAL){ - return trueMonthStart(12*(year-1) + month); - } else { - int32_t ms = yearStart(year); - for(int i=0; i< month; i++){ - ms+= handleGetMonthLength(year, i); - } - return ms; - } + return trueMonthStart(12*(year-1) + month); } /** @@ -418,7 +350,7 @@ int32_t IslamicCalendar::trueMonthStart(int32_t month) const if (start==0) { // Make a guess at when the month started, using the average length - UDate origin = HIJRA_MILLIS + UDate origin = HIJRA_MILLIS + uprv_floor(month * CalendarAstronomer::SYNODIC_MONTH) * kOneDay; // moonAge will fail due to memory allocation error @@ -461,7 +393,7 @@ trueMonthStartEnd : /** * Return the "age" of the moon at the given time; this is the difference * in ecliptic latitude between the moon and the sun. This method simply -* calls CalendarAstronomer.moonAge, converts to degrees, +* calls CalendarAstronomer.moonAge, converts to degrees, * and adjusts the result to be in the range [-180, 180]. * * @param time The time at which the moon's age is desired, @@ -473,9 +405,9 @@ double IslamicCalendar::moonAge(UDate time, UErrorCode &status) static UMutex astroLock; // pod bay door lock umtx_lock(&astroLock); - if(gIslamicCalendarAstro == NULL) { + if(gIslamicCalendarAstro == nullptr) { gIslamicCalendarAstro = new CalendarAstronomer(); - if (gIslamicCalendarAstro == NULL) { + if (gIslamicCalendarAstro == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return age; } @@ -506,22 +438,8 @@ double IslamicCalendar::moonAge(UDate time, UErrorCode &status) * @draft ICU 2.4 */ int32_t IslamicCalendar::handleGetMonthLength(int32_t extendedYear, int32_t month) const { - - int32_t length = 0; - - if (cType == CIVIL || cType == TBLA || - (cType == UMALQURA && (extendedYearUMALQURA_YEAR_END)) ) { - length = 29 + (month+1) % 2; - if (month == DHU_AL_HIJJAH && civilLeapYear(extendedYear)) { - length++; - } - } else if(cType == ASTRONOMICAL){ - month = 12*(extendedYear-1) + month; - length = trueMonthStart(month+1) - trueMonthStart(month) ; - } else { - length = getUmalqura_MonthLength(extendedYear - UMALQURA_YEAR_START, month); - } - return length; + month = 12*(extendedYear-1) + month; + return trueMonthStart(month+1) - trueMonthStart(month) ; } /** @@ -529,19 +447,8 @@ int32_t IslamicCalendar::handleGetMonthLength(int32_t extendedYear, int32_t mont * @draft ICU 2.4 */ int32_t IslamicCalendar::handleGetYearLength(int32_t extendedYear) const { - if (cType == CIVIL || cType == TBLA || - (cType == UMALQURA && (extendedYearUMALQURA_YEAR_END)) ) { - return 354 + (civilLeapYear(extendedYear) ? 1 : 0); - } else if(cType == ASTRONOMICAL){ - int32_t month = 12*(extendedYear-1); - return (trueMonthStart(month + 12) - trueMonthStart(month)); - } else { - int len = 0; - for(int i=0; i<12; i++) { - len += handleGetMonthLength(extendedYear, i); - } - return len; - } + int32_t month = 12*(extendedYear-1); + return (trueMonthStart(month + 12) - trueMonthStart(month)); } //------------------------------------------------------------------------- @@ -567,7 +474,7 @@ int32_t IslamicCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, U eyear += (month / 12) - 1; month = (month % 12) + 11; } - return monthStart(eyear, month) + ((cType == TBLA)? ASTRONOMICAL_EPOC: CIVIL_EPOC) - 1; + return monthStart(eyear, month) + getEpoc() - 1; } //------------------------------------------------------------------------- @@ -597,141 +504,141 @@ int32_t IslamicCalendar::handleGetExtendedYear() { *

  • DAY_OF_MONTH *
  • DAY_OF_YEAR *
  • EXTENDED_YEAR -* +* * The DAY_OF_WEEK and DOW_LOCAL fields are already set when this * method is called. The getGregorianXxx() methods return Gregorian * calendar equivalents for the given Julian day. * @draft ICU 2.4 */ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) { - int32_t year, month, dayOfMonth, dayOfYear; - int32_t startDate; - int32_t days = julianDay - CIVIL_EPOC; + if (U_FAILURE(status)) return; + int32_t days = julianDay - getEpoc(); - if (cType == CIVIL || cType == TBLA) { - if(cType == TBLA) { - days = julianDay - ASTRONOMICAL_EPOC; - } - // Use the civil calendar approximation, which is just arithmetic - year = (int32_t)ClockMath::floorDivide(30 * (int64_t)days + 10646, (int64_t)10631); - month = (int32_t)uprv_ceil((days - 29 - yearStart(year)) / 29.5 ); - month = month<11?month:11; - startDate = monthStart(year, month); - } else if(cType == ASTRONOMICAL){ - // Guess at the number of elapsed full months since the epoch - int32_t months = (int32_t)uprv_floor((double)days / CalendarAstronomer::SYNODIC_MONTH); + // Guess at the number of elapsed full months since the epoch + int32_t month = (int32_t)uprv_floor((double)days / CalendarAstronomer::SYNODIC_MONTH); - startDate = (int32_t)uprv_floor(months * CalendarAstronomer::SYNODIC_MONTH); + int32_t startDate = (int32_t)uprv_floor(month * CalendarAstronomer::SYNODIC_MONTH); - double age = moonAge(internalGetTime(), status); - if (U_FAILURE(status)) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - if ( days - startDate >= 25 && age > 0) { - // If we're near the end of the month, assume next month and search backwards - months++; - } - - // Find out the last time that the new moon was actually visible at this longitude - // This returns midnight the night that the moon was visible at sunset. - while ((startDate = trueMonthStart(months)) > days) { - // If it was after the date in question, back up a month and try again - months--; - } + double age = moonAge(internalGetTime(), status); + if (U_FAILURE(status)) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + if ( days - startDate >= 25 && age > 0) { + // If we're near the end of the month, assume next month and search backwards + month++; + } - year = months >= 0 ? ((months / 12) + 1) : ((months + 1 ) / 12); - month = ((months % 12) + 12 ) % 12; - } else if(cType == UMALQURA) { - int32_t umalquraStartdays = yearStart(UMALQURA_YEAR_START) ; - if( days < umalquraStartdays){ - //Use Civil calculation - year = (int32_t)ClockMath::floorDivide( - (30 * (int64_t)days + 10646) , (int64_t)10631.0 ); - month = (int32_t)uprv_ceil((days - 29 - yearStart(year)) / 29.5 ); - month = month<11?month:11; - startDate = monthStart(year, month); - }else{ - int y =UMALQURA_YEAR_START-1, m =0; - long d = 1; - while(d > 0){ - y++; - d = days - yearStart(y) +1; - if(d == handleGetYearLength(y)){ - m=11; - break; - }else if(d < handleGetYearLength(y) ){ - int monthLen = handleGetMonthLength(y, m); - m=0; - while(d > monthLen){ - d -= monthLen; - m++; - monthLen = handleGetMonthLength(y, m); - } - break; - } - } - year = y; - month = m; - } - } else { // invalid 'civil' - UPRV_UNREACHABLE; // should not get here, out of range + // Find out the last time that the new moon was actually visible at this longitude + // This returns midnight the night that the moon was visible at sunset. + while ((startDate = trueMonthStart(month)) > days) { + // If it was after the date in question, back up a month and try again + month--; } - dayOfMonth = (days - monthStart(year, month)) + 1; + int32_t year = month >= 0 ? ((month / 12) + 1) : ((month + 1 ) / 12); + month = ((month % 12) + 12 ) % 12; + int32_t dayOfMonth = (days - monthStart(year, month)) + 1; // Now figure out the day of the year. - dayOfYear = (days - monthStart(year, 0)) + 1; - + int32_t dayOfYear = (days - monthStart(year, 0)) + 1; internalSet(UCAL_ERA, 0); internalSet(UCAL_YEAR, year); internalSet(UCAL_EXTENDED_YEAR, year); internalSet(UCAL_MONTH, month); + internalSet(UCAL_ORDINAL_MONTH, month); internalSet(UCAL_DAY_OF_MONTH, dayOfMonth); internalSet(UCAL_DAY_OF_YEAR, dayOfYear); } -UBool -IslamicCalendar::inDaylightTime(UErrorCode& status) const +int32_t IslamicCalendar::getEpoc() const { + return CIVIL_EPOC; +} + +static int32_t gregoYearFromIslamicStart(int32_t year) { + // ad hoc conversion, improve under #10752 + // rough est for now, ok for grego 1846-2138, + // otherwise occasionally wrong (for 3% of years) + int cycle, offset, shift = 0; + if (year >= 1397) { + cycle = (year - 1397) / 67; + offset = (year - 1397) % 67; + shift = 2*cycle + ((offset >= 33)? 1: 0); + } else { + cycle = (year - 1396) / 67 - 1; + offset = -(year - 1396) % 67; + shift = 2*cycle + ((offset <= 33)? 1: 0); + } + return year + 579 - shift; +} + +int32_t IslamicCalendar::getRelatedYear(UErrorCode &status) const { - // copied from GregorianCalendar - if (U_FAILURE(status) || !getTimeZone().useDaylightTime()) - return FALSE; + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; + } + return gregoYearFromIslamicStart(year); +} - // Force an update of the state of the Calendar. - ((IslamicCalendar*)this)->complete(status); // cast away const +static int32_t firstIslamicStartYearFromGrego(int32_t year) { + // ad hoc conversion, improve under #10752 + // rough est for now, ok for grego 1846-2138, + // otherwise occasionally wrong (for 3% of years) + int cycle, offset, shift = 0; + if (year >= 1977) { + cycle = (year - 1977) / 65; + offset = (year - 1977) % 65; + shift = 2*cycle + ((offset >= 32)? 1: 0); + } else { + cycle = (year - 1976) / 65 - 1; + offset = -(year - 1976) % 65; + shift = 2*cycle + ((offset <= 32)? 1: 0); + } + return year - 579 + shift; +} - return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : FALSE); +void IslamicCalendar::setRelatedYear(int32_t year) +{ + set(UCAL_EXTENDED_YEAR, firstIslamicStartYearFromGrego(year)); } /** * The system maintains a static default century start date and Year. They are - * initialized the first time they are used. Once the system default century date + * initialized the first time they are used. Once the system default century date * and year are set, they do not change. */ -static UDate islamcal_gSystemDefaultCenturyStart = DBL_MIN; -static int32_t islamcal_gSystemDefaultCenturyStartYear = -1; -static icu::UInitOnce islamcal_gSystemDefaultCenturyInit = U_INITONCE_INITIALIZER; +static UDate gSystemDefaultCenturyStart = DBL_MIN; +static int32_t gSystemDefaultCenturyStartYear = -1; +static icu::UInitOnce gSystemDefaultCenturyInit {}; UBool IslamicCalendar::haveDefaultCentury() const { - return TRUE; + return true; } UDate IslamicCalendar::defaultCenturyStart() const { // lazy-evaluate systemDefaultCenturyStart - umtx_initOnce(islamcal_gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); - return islamcal_gSystemDefaultCenturyStart; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStart; } int32_t IslamicCalendar::defaultCenturyStartYear() const { // lazy-evaluate systemDefaultCenturyStartYear - umtx_initOnce(islamcal_gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); - return islamcal_gSystemDefaultCenturyStartYear; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStartYear; +} + +bool +IslamicCalendar::inTemporalLeapYear(UErrorCode &status) const +{ + int32_t days = getActualMaximum(UCAL_DAY_OF_YEAR, status); + if (U_FAILURE(status)) return false; + return days == 355; } @@ -747,16 +654,324 @@ IslamicCalendar::initializeSystemDefaultCentury() calendar.setTime(Calendar::getNow(), status); calendar.add(UCAL_YEAR, -80, status); - islamcal_gSystemDefaultCenturyStart = calendar.getTime(status); - islamcal_gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); + gSystemDefaultCenturyStart = calendar.getTime(status); + gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); } // We have no recourse upon failure unless we want to propagate the failure // out. } +/***************************************************************************** + * IslamicCivilCalendar + *****************************************************************************/ +IslamicCivilCalendar::IslamicCivilCalendar(const Locale& aLocale, UErrorCode& success) + : IslamicCalendar(aLocale, success) +{ +} + +IslamicCivilCalendar::~IslamicCivilCalendar() +{ +} + +const char *IslamicCivilCalendar::getType() const { + return "islamic-civil"; +} + +IslamicCivilCalendar* IslamicCivilCalendar::clone() const { + return new IslamicCivilCalendar(*this); +} + +/** +* Return the day # on which the given year starts. Days are counted +* from the Hijri epoch, origin 0. +*/ +int32_t IslamicCivilCalendar::yearStart(int32_t year) const{ + return static_cast( + (year-1)*354 + ClockMath::floorDivide((3+11*static_cast(year)), + static_cast(30))); +} + +/** +* Return the day # on which the given month starts. Days are counted +* from the Hijri epoch, origin 0. +* +* @param year The hijri year +* @param month The hijri month, 0-based (assumed to be in range 0..11) +*/ +int32_t IslamicCivilCalendar::monthStart(int32_t year, int32_t month) const { + // This does not handle months out of the range 0..11 + return static_cast( + uprv_ceil(29.5*month) + (year-1)*354 + + static_cast(ClockMath::floorDivide( + 3+11*static_cast(year), + static_cast(30)))); +} + +/** +* Return the length (in days) of the given month. +* +* @param year The hijri year +* @param year The hijri month, 0-based +* @draft ICU 2.4 +*/ +int32_t IslamicCivilCalendar::handleGetMonthLength(int32_t extendedYear, int32_t month) const { + int32_t length = 29 + (month+1) % 2; + if (month == DHU_AL_HIJJAH && civilLeapYear(extendedYear)) { + length++; + } + return length; +} + +/** +* Return the number of days in the given Islamic year +* @draft ICU 2.4 +*/ +int32_t IslamicCivilCalendar::handleGetYearLength(int32_t extendedYear) const { + return 354 + (civilLeapYear(extendedYear) ? 1 : 0); +} +/** +* Override Calendar to compute several fields specific to the Islamic +* calendar system. These are: +* +*
    • ERA +*
    • YEAR +*
    • MONTH +*
    • DAY_OF_MONTH +*
    • DAY_OF_YEAR +*
    • EXTENDED_YEAR
    +* +* The DAY_OF_WEEK and DOW_LOCAL fields are already set when this +* method is called. The getGregorianXxx() methods return Gregorian +* calendar equivalents for the given Julian day. +* @draft ICU 2.4 +*/ +void IslamicCivilCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) { + if (U_FAILURE(status)) return; + int32_t days = julianDay - getEpoc(); + + // Use the civil calendar approximation, which is just arithmetic + int32_t year = static_cast( + ClockMath::floorDivide(30 * static_cast(days) + 10646, + static_cast(10631))); + int32_t month = static_cast( + uprv_ceil((days - 29 - yearStart(year)) / 29.5 )); + month = month<11?month:11; + + int32_t dayOfMonth = (days - monthStart(year, month)) + 1; + + // Now figure out the day of the year. + int32_t dayOfYear = (days - monthStart(year, 0)) + 1; + + internalSet(UCAL_ERA, 0); + internalSet(UCAL_YEAR, year); + internalSet(UCAL_EXTENDED_YEAR, year); + internalSet(UCAL_MONTH, month); + internalSet(UCAL_ORDINAL_MONTH, month); + internalSet(UCAL_DAY_OF_MONTH, dayOfMonth); + internalSet(UCAL_DAY_OF_YEAR, dayOfYear); +} +/***************************************************************************** + * IslamicTBLACalendar + *****************************************************************************/ +IslamicTBLACalendar::IslamicTBLACalendar(const Locale& aLocale, UErrorCode& success) + : IslamicCivilCalendar(aLocale, success) +{ +} + +IslamicTBLACalendar::~IslamicTBLACalendar() +{ +} + +const char *IslamicTBLACalendar::getType() const { + return "islamic-tbla"; +} + +IslamicTBLACalendar* IslamicTBLACalendar::clone() const { + return new IslamicTBLACalendar(*this); +} + +int32_t IslamicTBLACalendar::getEpoc() const { + return ASTRONOMICAL_EPOC; +} + +/***************************************************************************** + * IslamicUmalquraCalendar + *****************************************************************************/ +IslamicUmalquraCalendar::IslamicUmalquraCalendar(const Locale& aLocale, UErrorCode& success) + : IslamicCalendar(aLocale, success) +{ +} + +IslamicUmalquraCalendar::~IslamicUmalquraCalendar() +{ +} + +const char *IslamicUmalquraCalendar::getType() const { + return "islamic-umalqura"; +} + +IslamicUmalquraCalendar* IslamicUmalquraCalendar::clone() const { + return new IslamicUmalquraCalendar(*this); +} + +/** +* Return the day # on which the given year starts. Days are counted +* from the Hijri epoch, origin 0. +*/ +int32_t IslamicUmalquraCalendar::yearStart(int32_t year) const { + if (year < UMALQURA_YEAR_START || year > UMALQURA_YEAR_END) { + return static_cast( + (year-1)*354 + ClockMath::floorDivide((3+11*static_cast(year)), + static_cast(30))); + } + year -= UMALQURA_YEAR_START; + // rounded least-squares fit of the dates previously calculated from UMALQURA_MONTHLENGTH iteration + int32_t yrStartLinearEstimate = static_cast( + (354.36720 * (double)year) + 460322.05 + 0.5); + // need a slight correction to some + return yrStartLinearEstimate + umAlQuraYrStartEstimateFix[year]; +} + +/** +* Return the day # on which the given month starts. Days are counted +* from the Hijri epoch, origin 0. +* +* @param year The hijri year +* @param month The hijri month, 0-based (assumed to be in range 0..11) +*/ +int32_t IslamicUmalquraCalendar::monthStart(int32_t year, int32_t month) const { + int32_t ms = yearStart(year); + for(int i=0; i< month; i++){ + ms+= handleGetMonthLength(year, i); + } + return ms; +} + +/** +* Return the length (in days) of the given month. +* +* @param year The hijri year +* @param year The hijri month, 0-based +*/ +int32_t IslamicUmalquraCalendar::handleGetMonthLength(int32_t extendedYear, int32_t month) const { + int32_t length = 0; + if (extendedYearUMALQURA_YEAR_END) { + length = 29 + (month+1) % 2; + if (month == DHU_AL_HIJJAH && civilLeapYear(extendedYear)) { + length++; + } + return length; + } + return getUmalqura_MonthLength(extendedYear - UMALQURA_YEAR_START, month); +} + +/** +* Return the number of days in the given Islamic year +* @draft ICU 2.4 +*/ +int32_t IslamicUmalquraCalendar::handleGetYearLength(int32_t extendedYear) const { + if (extendedYearUMALQURA_YEAR_END) { + return 354 + (civilLeapYear(extendedYear) ? 1 : 0); + } + int len = 0; + for(int i=0; i<12; i++) { + len += handleGetMonthLength(extendedYear, i); + } + return len; +} + +/** +* Override Calendar to compute several fields specific to the Islamic +* calendar system. These are: +* +*
    • ERA +*
    • YEAR +*
    • MONTH +*
    • DAY_OF_MONTH +*
    • DAY_OF_YEAR +*
    • EXTENDED_YEAR
    +* +* The DAY_OF_WEEK and DOW_LOCAL fields are already set when this +* method is called. The getGregorianXxx() methods return Gregorian +* calendar equivalents for the given Julian day. +* @draft ICU 2.4 +*/ +void IslamicUmalquraCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) { + if (U_FAILURE(status)) return; + int32_t year, month, dayOfMonth, dayOfYear; + int32_t days = julianDay - getEpoc(); + + int32_t umalquraStartdays = yearStart(UMALQURA_YEAR_START) ; + if (days < umalquraStartdays) { + //Use Civil calculation + year = (int32_t)ClockMath::floorDivide( + (30 * (int64_t)days + 10646) , (int64_t)10631.0 ); + month = (int32_t)uprv_ceil((days - 29 - yearStart(year)) / 29.5 ); + month = month < 11 ? month : 11; + } else { + int y =UMALQURA_YEAR_START-1, m =0; + long d = 1; + while (d > 0) { + y++; + d = days - yearStart(y) +1; + if (d == handleGetYearLength(y)) { + m=11; + break; + } + if (d < handleGetYearLength(y)){ + int monthLen = handleGetMonthLength(y, m); + m=0; + while(d > monthLen){ + d -= monthLen; + m++; + monthLen = handleGetMonthLength(y, m); + } + break; + } + } + year = y; + month = m; + } + + dayOfMonth = (days - monthStart(year, month)) + 1; + + // Now figure out the day of the year. + dayOfYear = (days - monthStart(year, 0)) + 1; + + internalSet(UCAL_ERA, 0); + internalSet(UCAL_YEAR, year); + internalSet(UCAL_EXTENDED_YEAR, year); + internalSet(UCAL_MONTH, month); + internalSet(UCAL_ORDINAL_MONTH, month); + internalSet(UCAL_DAY_OF_MONTH, dayOfMonth); + internalSet(UCAL_DAY_OF_YEAR, dayOfYear); +} +/***************************************************************************** + * IslamicRGSACalendar + *****************************************************************************/ +IslamicRGSACalendar::IslamicRGSACalendar(const Locale& aLocale, UErrorCode& success) + : IslamicCalendar(aLocale, success) +{ +} + +IslamicRGSACalendar::~IslamicRGSACalendar() +{ +} + +const char *IslamicRGSACalendar::getType() const { + return "islamic-rgsa"; +} + +IslamicRGSACalendar* IslamicRGSACalendar::clone() const { + return new IslamicRGSACalendar(*this); +} UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IslamicCalendar) +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IslamicCivilCalendar) +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IslamicUmalquraCalendar) +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IslamicTBLACalendar) +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IslamicRGSACalendar) U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.h b/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.h index fde58478c..8469269bc 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/islamcal.h @@ -53,7 +53,8 @@ U_NAMESPACE_BEGIN * every 30 years. This calendar is easily calculated and thus predictable in * advance, so it is used as the civil calendar in a number of Arab countries. * This is the default behavior of a newly-created IslamicCalendar - * object. + * object. This calendar variant is implemented in the IslamicCivilCalendar + * class. *

    * The Islamic religious calendar, however, is based on the observation * of the crescent moon. It is thus affected by the position at which the @@ -67,14 +68,10 @@ U_NAMESPACE_BEGIN * moon's illumination, and other factors, it is possible to determine the start * of a lunar month with a fairly high degree of certainty. However, these * calculations are extremely complicated and thus slow, so most algorithms, - * including the one used here, are only approximations of the true astronical + * including the one used here, are only approximations of the true astronomical * calculations. At present, the approximations used in this class are fairly * simplistic; they will be improved in later versions of the code. *

    - * The {@link #setCivil setCivil} method determines - * which approach is used to determine the start of a month. By default, the - * fixed-cycle civil calendar is used. However, if setCivil(false) - * is called, an approximation of the true lunar calendar will be used. * * @see GregorianCalendar * @@ -88,18 +85,6 @@ class U_I18N_API IslamicCalendar : public Calendar { //------------------------------------------------------------------------- // Constants... //------------------------------------------------------------------------- - - /** - * Calendar type - civil or religious or um alqura - * @internal - */ - enum ECalculationType { - ASTRONOMICAL, - CIVIL, - UMALQURA, - TBLA - }; - /** * Constants for the months * @internal @@ -192,16 +177,15 @@ class U_I18N_API IslamicCalendar : public Calendar { * @param aLocale The given locale. * @param success Indicates the status of IslamicCalendar object construction. * Returns U_ZERO_ERROR if constructed successfully. - * @param type The Islamic calendar calculation type. The default value is CIVIL. * @internal */ - IslamicCalendar(const Locale& aLocale, UErrorCode &success, ECalculationType type = CIVIL); + IslamicCalendar(const Locale& aLocale, UErrorCode &success); /** * Copy Constructor * @internal */ - IslamicCalendar(const IslamicCalendar& other); + IslamicCalendar(const IslamicCalendar& other) = default; /** * Destructor. @@ -209,40 +193,20 @@ class U_I18N_API IslamicCalendar : public Calendar { */ virtual ~IslamicCalendar(); - /** - * Sets Islamic calendar calculation type used by this instance. - * - * @param type The calendar calculation type, CIVIL to use the civil - * calendar, ASTRONOMICAL to use the astronomical calendar. - * @internal - */ - void setCalculationType(ECalculationType type, UErrorCode &status); - - /** - * Returns true if this object is using the fixed-cycle civil - * calendar, or false if using the religious, astronomical - * calendar. - * @internal - */ - UBool isCivil(); - - - // TODO: copy c'tor, etc - // clone - virtual IslamicCalendar* clone() const; + virtual IslamicCalendar* clone() const override; - private: + protected: /** * Determine whether a year is a leap year in the Islamic civil calendar */ static UBool civilLeapYear(int32_t year); - + /** * Return the day # on which the given year starts. Days are counted * from the Hijri epoch, origin 0. */ - int32_t yearStart(int32_t year) const; + virtual int32_t yearStart(int32_t year) const; /** * Return the day # on which the given month starts. Days are counted @@ -251,7 +215,7 @@ class U_I18N_API IslamicCalendar : public Calendar { * @param year The hijri year * @param year The hijri month, 0-based */ - int32_t monthStart(int32_t year, int32_t month) const; + virtual int32_t monthStart(int32_t year, int32_t month) const; /** * Find the day number on which a particular month of the true/lunar @@ -263,6 +227,7 @@ class U_I18N_API IslamicCalendar : public Calendar { */ int32_t trueMonthStart(int32_t month) const; + private: /** * Return the "age" of the moon at the given time; this is the difference * in ecliptic latitude between the moon and the sun. This method simply @@ -274,17 +239,6 @@ class U_I18N_API IslamicCalendar : public Calendar { */ static double moonAge(UDate time, UErrorCode &status); - //------------------------------------------------------------------------- - // Internal data.... - // - - /** - * CIVIL if this object uses the fixed-cycle Islamic civil calendar, - * and ASTRONOMICAL if it approximates the true religious calendar using - * astronomical calculations for the time of the new moon. - */ - ECalculationType cType; - //---------------------------------------------------------------------- // Calendar framework //---------------------------------------------------------------------- @@ -292,7 +246,7 @@ class U_I18N_API IslamicCalendar : public Calendar { /** * @internal */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; /** * Return the length (in days) of the given month. @@ -301,13 +255,13 @@ class U_I18N_API IslamicCalendar : public Calendar { * @param year The hijri month, 0-based * @internal */ - virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const; + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const override; /** * Return the number of days in the given Islamic year * @internal */ - virtual int32_t handleGetYearLength(int32_t extendedYear) const; + virtual int32_t handleGetYearLength(int32_t extendedYear) const override; //------------------------------------------------------------------------- // Functions for converting from field values to milliseconds.... @@ -317,7 +271,7 @@ class U_I18N_API IslamicCalendar : public Calendar { /** * @internal */ - virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const; + virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const override; //------------------------------------------------------------------------- // Functions for converting from milliseconds to field values @@ -326,7 +280,7 @@ class U_I18N_API IslamicCalendar : public Calendar { /** * @internal */ - virtual int32_t handleGetExtendedYear(); + virtual int32_t handleGetExtendedYear() override; /** * Override Calendar to compute several fields specific to the Islamic @@ -344,7 +298,13 @@ class U_I18N_API IslamicCalendar : public Calendar { * calendar equivalents for the given Julian day. * @internal */ - virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; + + /** + * Return the epoc. + * @internal + */ + virtual int32_t getEpoc() const; // UObject stuff public: @@ -353,7 +313,7 @@ class U_I18N_API IslamicCalendar : public Calendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -366,52 +326,62 @@ class U_I18N_API IslamicCalendar : public Calendar { * @return The class ID for all objects of this class. * @internal */ - /*U_I18N_API*/ static UClassID U_EXPORT2 getStaticClassID(void); + /*U_I18N_API*/ static UClassID U_EXPORT2 getStaticClassID(); /** - * return the calendar type, "buddhist". + * return the calendar type, "islamic". * * @return calendar type * @internal */ - virtual const char * getType() const; + virtual const char * getType() const override; - private: - IslamicCalendar(); // default constructor not implemented + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const override; - // Default century. - protected: + /** + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field + * @internal + */ + virtual void setRelatedYear(int32_t year) override; /** - * (Overrides Calendar) Return true if the current date for this Calendar is in - * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. + * Returns true if the date is in a leap year. * - * @param status Fill-in parameter which receives the status of this operation. - * @return True if the current date for this Calendar is in Daylight Savings Time, - * false, otherwise. - * @internal + * @param status ICU Error Code + * @return True if the date in the fields is in a Temporal proposal + * defined leap year. False otherwise. */ - virtual UBool inDaylightTime(UErrorCode& status) const; + virtual bool inTemporalLeapYear(UErrorCode &status) const override; + private: + IslamicCalendar() = delete; // default constructor not implemented + // Default century. + protected: /** - * Returns TRUE because the Islamic Calendar does have a default century + * Returns true because the Islamic Calendar does have a default century * @internal */ - virtual UBool haveDefaultCentury() const; + virtual UBool haveDefaultCentury() const override; /** * Returns the date of the start of the default century * @return start of century - in milliseconds since epoch, 1970 * @internal */ - virtual UDate defaultCenturyStart() const; + virtual UDate defaultCenturyStart() const override; /** * Returns the year in which the default century begins * @internal */ - virtual int32_t defaultCenturyStartYear() const; + virtual int32_t defaultCenturyStartYear() const override; private: /** @@ -419,13 +389,375 @@ class U_I18N_API IslamicCalendar : public Calendar { * are considered to fall within so that its start date is 80 years * before the current time. */ - static void U_CALLCONV initializeSystemDefaultCentury(void); + static void U_CALLCONV initializeSystemDefaultCentury(); }; -U_NAMESPACE_END +/* + * IslamicCivilCalendar is one of the two main variants of the Islamic calendar. + * The civil calendar, which uses a fixed cycle of alternating 29- + * and 30-day months, with a leap day added to the last month of 11 out of + * every 30 years. This calendar is easily calculated and thus predictable in + * advance, so it is used as the civil calendar in a number of Arab countries. + * This calendar is referring as "Islamic calendar, tabular (intercalary years + * [2,5,7,10,13,16,18,21,24,26,29]- civil epoch" in CLDR. + */ +class U_I18N_API IslamicCivilCalendar : public IslamicCalendar { + public: + /** + * Constructs an IslamicCivilCalendar based on the current time in the default time zone + * with the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the status of IslamicCivilCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @internal + */ + IslamicCivilCalendar(const Locale& aLocale, UErrorCode &success); -#endif -#endif + /** + * Copy Constructor + * @internal + */ + IslamicCivilCalendar(const IslamicCivilCalendar& other) = default; + + /** + * Destructor. + * @internal + */ + virtual ~IslamicCivilCalendar(); + + // clone + virtual IslamicCivilCalendar* clone() const override; + + /** + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @internal + */ + virtual UClassID getDynamicClassID() const override; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @internal + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * return the calendar type, "islamic-civil". + * + * @return calendar type + * @internal + */ + virtual const char * getType() const override; + + protected: + /** + * Return the day # on which the given year starts. Days are counted + * from the Hijri epoch, origin 0. + * @internal + */ + virtual int32_t yearStart(int32_t year) const override; + + /** + * Return the day # on which the given month starts. Days are counted + * from the Hijri epoch, origin 0. + * + * @param year The hijri year + * @param year The hijri month, 0-based + * @internal + */ + virtual int32_t monthStart(int32_t year, int32_t month) const override; + + /** + * Return the length (in days) of the given month. + * + * @param year The hijri year + * @param year The hijri month, 0-based + * @internal + */ + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const override; + + /** + * Return the number of days in the given Islamic year + * @internal + */ + virtual int32_t handleGetYearLength(int32_t extendedYear) const override; + + /** + * Override Calendar to compute several fields specific to the Islamic + * calendar system. These are: + * + *

    • ERA + *
    • YEAR + *
    • MONTH + *
    • DAY_OF_MONTH + *
    • DAY_OF_YEAR + *
    • EXTENDED_YEAR
    + * + * The DAY_OF_WEEK and DOW_LOCAL fields are already set when this + * method is called. The getGregorianXxx() methods return Gregorian + * calendar equivalents for the given Julian day. + * @internal + */ + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; +}; + +/* + * IslamicTBLACalendar calendar. + * This is a subclass of IslamicCivilCalendar. The only differences in the + * calendar math is it uses different epoch. + * This calendar is referring as "Islamic calendar, tabular (intercalary years + * [2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch" in CLDR. + */ +class U_I18N_API IslamicTBLACalendar : public IslamicCivilCalendar { + public: + /** + * Constructs an IslamicTBLACalendar based on the current time in the default time zone + * with the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the status of IslamicTBLACalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @internal + */ + IslamicTBLACalendar(const Locale& aLocale, UErrorCode &success); + + /** + * Copy Constructor + * @internal + */ + IslamicTBLACalendar(const IslamicTBLACalendar& other) = default; + + /** + * Destructor. + * @internal + */ + virtual ~IslamicTBLACalendar(); + + /** + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @internal + */ + virtual UClassID getDynamicClassID() const override; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @internal + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * return the calendar type, "islamic-tbla". + * + * @return calendar type + * @internal + */ + virtual const char * getType() const override; + // clone + virtual IslamicTBLACalendar* clone() const override; + protected: + /** + * Return the epoc. + * @internal + */ + virtual int32_t getEpoc() const override; +}; + +/* + * IslamicUmalquraCalendar + * This calendar is referred as "Islamic calendar, Umm al-Qura" in CLDR. + */ +class U_I18N_API IslamicUmalquraCalendar : public IslamicCalendar { + public: + /** + * Constructs an IslamicUmalquraCalendar based on the current time in the default time zone + * with the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the status of IslamicUmalquraCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @internal + */ + IslamicUmalquraCalendar(const Locale& aLocale, UErrorCode &success); + + /** + * Copy Constructor + * @internal + */ + IslamicUmalquraCalendar(const IslamicUmalquraCalendar& other) = default; + + /** + * Destructor. + * @internal + */ + virtual ~IslamicUmalquraCalendar(); + + /** + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @internal + */ + virtual UClassID getDynamicClassID() const override; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @internal + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * return the calendar type, "islamic-umalqura". + * + * @return calendar type + * @internal + */ + virtual const char * getType() const override; + + // clone + virtual IslamicUmalquraCalendar* clone() const override; + + protected: + /** + * Return the day # on which the given year starts. Days are counted + * from the Hijri epoch, origin 0. + * @internal + */ + virtual int32_t yearStart(int32_t year) const override; + + /** + * Return the day # on which the given month starts. Days are counted + * from the Hijri epoch, origin 0. + * + * @param year The hijri year + * @param year The hijri month, 0-based + * @internal + */ + virtual int32_t monthStart(int32_t year, int32_t month) const override; + /** + * Return the length (in days) of the given month. + * + * @param year The hijri year + * @param year The hijri month, 0-based + * @internal + */ + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const override; + + /** + * Return the number of days in the given Islamic year + * @internal + */ + virtual int32_t handleGetYearLength(int32_t extendedYear) const override; + + /** + * Override Calendar to compute several fields specific to the Islamic + * calendar system. These are: + * + *
    • ERA + *
    • YEAR + *
    • MONTH + *
    • DAY_OF_MONTH + *
    • DAY_OF_YEAR + *
    • EXTENDED_YEAR
    + * + * The DAY_OF_WEEK and DOW_LOCAL fields are already set when this + * method is called. The getGregorianXxx() methods return Gregorian + * calendar equivalents for the given Julian day. + * @internal + */ + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; +}; + + +/* + * IslamicRGSACalendar + * Islamic calendar, Saudi Arabia sighting. Since the calendar depends on the + * sighting, it is impossible to implement by algorithm ahead of time. It is + * currently identical to IslamicCalendar except the getType will return + * "islamic-rgsa". + */ +class U_I18N_API IslamicRGSACalendar : public IslamicCalendar { + public: + /** + * Constructs an IslamicRGSACalendar based on the current time in the default time zone + * with the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the status of IslamicRGSACalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @internal + */ + IslamicRGSACalendar(const Locale& aLocale, UErrorCode &success); + + /** + * Copy Constructor + * @internal + */ + IslamicRGSACalendar(const IslamicRGSACalendar& other) = default; + + /** + * Destructor. + * @internal + */ + virtual ~IslamicRGSACalendar(); + + /** + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @internal + */ + virtual UClassID getDynamicClassID() const override; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @internal + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * return the calendar type, "islamic-rgsa". + * + * @return calendar type + * @internal + */ + virtual const char * getType() const override; + + // clone + virtual IslamicRGSACalendar* clone() const override; +}; + +U_NAMESPACE_END + +#endif +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.cpp new file mode 100644 index 000000000..c3288bc6b --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.cpp @@ -0,0 +1,43 @@ +// © 2022 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "iso8601cal.h" +#include "unicode/gregocal.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ISO8601Calendar) + +ISO8601Calendar::ISO8601Calendar(const Locale& aLocale, UErrorCode& success) +: GregorianCalendar(aLocale, success) +{ + UErrorCode fwStatus = U_ZERO_ERROR; + int32_t fwLength = aLocale.getKeywordValue("fw", nullptr, 0, fwStatus); + // Do not set first day of week for iso8601 to Monday if we have fw keyword + // and let the value set by the Calendar constructor to take care of it. + if (U_SUCCESS(fwStatus) && fwLength == 0) { + setFirstDayOfWeek(UCAL_MONDAY); + } + setMinimalDaysInFirstWeek(4); +} + +ISO8601Calendar::~ISO8601Calendar() +{ +} + +ISO8601Calendar* ISO8601Calendar::clone() const +{ + return new ISO8601Calendar(*this); +} + +const char *ISO8601Calendar::getType() const +{ + return "iso8601"; +} + +U_NAMESPACE_END + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.h b/src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.h new file mode 100644 index 000000000..688fac358 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.h @@ -0,0 +1,102 @@ +// © 2022 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +#ifndef ISO8601CAL_H +#define ISO8601CAL_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/calendar.h" +#include "unicode/gregocal.h" +#include "unicode/timezone.h" + +U_NAMESPACE_BEGIN + +/** + * Concrete class which provides the ISO8601 calendar. + *

    + * ISO8601Calendar is a subclass of GregorianCalendar + * that the first day of a week is Monday and the minimal days in the first + * week of a year or month is four days. + *

    + * The ISO8601 calendar is identical to the Gregorian calendar in all respects + * except for the first day of week and the minimal days in the first week + * of a year. + * @internal + */ +class ISO8601Calendar : public GregorianCalendar { + public: + //------------------------------------------------------------------------- + // Constructors... + //------------------------------------------------------------------------- + + /** + * Constructs a DangiCalendar based on the current time in the default time zone + * with the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the status of ISO8601Calendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @internal + */ + ISO8601Calendar(const Locale& aLocale, UErrorCode &success); + + /** + * Copy Constructor + * @internal + */ + ISO8601Calendar(const ISO8601Calendar& other) = default; + + /** + * Destructor. + * @internal + */ + virtual ~ISO8601Calendar(); + + /** + * Clone. + * @internal + */ + virtual ISO8601Calendar* clone() const override; + + // UObject stuff + public: + /** + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @internal + */ + virtual UClassID getDynamicClassID() const override; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @internal + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + + /** + * return the calendar type, "iso8601". + * + * @return calendar type + * @internal + */ + virtual const char * getType() const override; + + + private: + + ISO8601Calendar(); // default constructor not implemented +}; + +U_NAMESPACE_END + +#endif +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/japancal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/japancal.cpp index 35b0baa25..fc18d6c0e 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/japancal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/japancal.cpp @@ -39,18 +39,18 @@ #include "cstring.h" static icu::EraRules * gJapaneseEraRules = nullptr; -static icu::UInitOnce gJapaneseEraRulesInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce gJapaneseEraRulesInitOnce {}; static int32_t gCurrentEra = 0; U_CDECL_BEGIN -static UBool japanese_calendar_cleanup(void) { +static UBool japanese_calendar_cleanup() { if (gJapaneseEraRules) { delete gJapaneseEraRules; gJapaneseEraRules = nullptr; } gCurrentEra = 0; gJapaneseEraRulesInitOnce.reset(); - return TRUE; + return true; } U_CDECL_END @@ -58,7 +58,7 @@ U_NAMESPACE_BEGIN UOBJECT_DEFINE_RTTI_IMPLEMENTATION(JapaneseCalendar) -static const int32_t japancal_kGregorianEpoch = 1970; // used as the default value of EXTENDED_YEAR +static const int32_t kGregorianEpoch = 1970; // used as the default value of EXTENDED_YEAR static const char* TENTATIVE_ERA_VAR_NAME = "ICU_ENABLE_TENTATIVE_ERA"; @@ -71,21 +71,21 @@ UBool JapaneseCalendar::enableTentativeEra() { // 1. Environment variable ICU_ENABLE_TENTATIVE_ERA=true or false - UBool includeTentativeEra = FALSE; + UBool includeTentativeEra = false; #if U_PLATFORM_HAS_WINUWP_API == 1 // UWP doesn't allow access to getenv(), but we can call GetEnvironmentVariableW to do the same thing. - UChar varName[26] = {}; + char16_t varName[26] = {}; u_charsToUChars(TENTATIVE_ERA_VAR_NAME, varName, static_cast(uprv_strlen(TENTATIVE_ERA_VAR_NAME))); WCHAR varValue[5] = {}; DWORD ret = GetEnvironmentVariableW(reinterpret_cast(varName), varValue, UPRV_LENGTHOF(varValue)); if ((ret == 4) && (_wcsicmp(varValue, L"true") == 0)) { - includeTentativeEra = TRUE; + includeTentativeEra = true; } #else char *envVarVal = getenv(TENTATIVE_ERA_VAR_NAME); - if (envVarVal != NULL && uprv_stricmp(envVarVal, "true") == 0) { - includeTentativeEra = TRUE; + if (envVarVal != nullptr && uprv_stricmp(envVarVal, "true") == 0) { + includeTentativeEra = true; } #endif return includeTentativeEra; @@ -146,7 +146,7 @@ const char *JapaneseCalendar::getType() const return "japanese"; } -int32_t JapaneseCalendar::getDefaultMonthInYear(int32_t eyear) +int32_t JapaneseCalendar::getDefaultMonthInYear(int32_t eyear) { int32_t era = internalGetEra(); // TODO do we assume we can trust 'era'? What if it is denormalized? @@ -167,7 +167,7 @@ int32_t JapaneseCalendar::getDefaultMonthInYear(int32_t eyear) return month; } -int32_t JapaneseCalendar::getDefaultDayInMonth(int32_t eyear, int32_t month) +int32_t JapaneseCalendar::getDefaultDayInMonth(int32_t eyear, int32_t month) { int32_t era = internalGetEra(); int32_t day = 1; @@ -199,7 +199,7 @@ int32_t JapaneseCalendar::handleGetExtendedYear() if (newerField(UCAL_EXTENDED_YEAR, UCAL_YEAR) == UCAL_EXTENDED_YEAR && newerField(UCAL_EXTENDED_YEAR, UCAL_ERA) == UCAL_EXTENDED_YEAR) { - year = internalGet(UCAL_EXTENDED_YEAR, japancal_kGregorianEpoch); + year = internalGet(UCAL_EXTENDED_YEAR, kGregorianEpoch); } else { UErrorCode status = U_ZERO_ERROR; int32_t eraStartYear = gJapaneseEraRules->getStartYear(internalGet(UCAL_ERA, gCurrentEra), status); @@ -219,18 +219,18 @@ void JapaneseCalendar::handleComputeFields(int32_t julianDay, UErrorCode& status //Calendar::timeToFields(theTime, quick, status); GregorianCalendar::handleComputeFields(julianDay, status); int32_t year = internalGet(UCAL_EXTENDED_YEAR); // Gregorian year - int32_t eraIdx = gJapaneseEraRules->getEraIndex(year, internalGet(UCAL_MONTH) + 1, internalGet(UCAL_DAY_OF_MONTH), status); + int32_t eraIdx = gJapaneseEraRules->getEraIndex(year, internalGetMonth() + 1, internalGet(UCAL_DAY_OF_MONTH), status); internalSet(UCAL_ERA, eraIdx); internalSet(UCAL_YEAR, year - gJapaneseEraRules->getStartYear(eraIdx, status) + 1); } /* -Disable pivoting +Disable pivoting */ UBool JapaneseCalendar::haveDefaultCentury() const { - return FALSE; + return false; } UDate JapaneseCalendar::defaultCenturyStart() const diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/japancal.h b/src/duckdb/extension/icu/third_party/icu/i18n/japancal.h index 03e6361c9..3ae4900a2 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/japancal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/japancal.h @@ -70,14 +70,14 @@ class JapaneseCalendar : public GregorianCalendar { * Check environment variable. * @internal */ - U_I18N_API static UBool U_EXPORT2 enableTentativeEra(void); + U_I18N_API static UBool U_EXPORT2 enableTentativeEra(); /** * Useful constants for JapaneseCalendar. * Exported for use by test code. * @internal */ - U_I18N_API static uint32_t U_EXPORT2 getCurrentEra(void); // the current era + U_I18N_API static uint32_t U_EXPORT2 getCurrentEra(); // the current era /** * Constructs a JapaneseCalendar based on the current time in the default time zone @@ -116,20 +116,20 @@ class JapaneseCalendar : public GregorianCalendar { * @return return a polymorphic copy of this calendar. * @internal */ - virtual JapaneseCalendar* clone() const; + virtual JapaneseCalendar* clone() const override; /** * Return the extended year defined by the current fields. In the * Japanese calendar case, this is equal to the equivalent extended Gregorian year. * @internal */ - virtual int32_t handleGetExtendedYear(); + virtual int32_t handleGetExtendedYear() override; /** * Return the maximum value that this field could have, given the current date. * @internal */ - virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const; + virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const override; public: @@ -143,7 +143,7 @@ class JapaneseCalendar : public GregorianCalendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -156,7 +156,7 @@ class JapaneseCalendar : public GregorianCalendar { * @return The class ID for all objects of this class. * @internal */ - U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); /** * return the calendar type, "japanese". @@ -164,24 +164,24 @@ class JapaneseCalendar : public GregorianCalendar { * @return calendar type * @internal */ - virtual const char * getType() const; + virtual const char * getType() const override; /** - * @return FALSE - no default century in Japanese + * @return false - no default century in Japanese * @internal */ - virtual UBool haveDefaultCentury() const; + virtual UBool haveDefaultCentury() const override; /** * Not used - no default century. * @internal */ - virtual UDate defaultCenturyStart() const; + virtual UDate defaultCenturyStart() const override; /** * Not used - no default century. * @internal */ - virtual int32_t defaultCenturyStartYear() const; + virtual int32_t defaultCenturyStartYear() const override; private: JapaneseCalendar(); // default constructor not implemented @@ -191,19 +191,19 @@ class JapaneseCalendar : public GregorianCalendar { * Calculate the era for internal computation * @internal */ - virtual int32_t internalGetEra() const; + virtual int32_t internalGetEra() const override; /** * Compute fields from the JD * @internal */ - virtual void handleComputeFields(int32_t julianDay, UErrorCode& status); + virtual void handleComputeFields(int32_t julianDay, UErrorCode& status) override; /** * Calculate the limit for a specified type of limit and field * @internal */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; /*** * Called by computeJulianDay. Returns the default month (0-based) for the year, @@ -212,7 +212,7 @@ class JapaneseCalendar : public GregorianCalendar { * @param eyear the extended year * @internal */ - virtual int32_t getDefaultMonthInYear(int32_t eyear); + virtual int32_t getDefaultMonthInYear(int32_t eyear) override; /*** * Called by computeJulianDay. Returns the default day (1-based) for the month, @@ -222,7 +222,7 @@ class JapaneseCalendar : public GregorianCalendar { * @param mon the month in the year * @internal */ - virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month); + virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month) override; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp index 2d0ba8917..3405b5de3 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp @@ -16,11 +16,16 @@ * created by: Umesh P. Nair */ +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + #include "cmemory.h" #include "unicode/fpositer.h" // FieldPositionIterator #include "unicode/listformatter.h" #include "unicode/simpleformatter.h" #include "unicode/ulistformatter.h" +#include "unicode/uscript.h" #include "fphdlimp.h" #include "mutex.h" #include "hash.h" @@ -35,58 +40,226 @@ U_NAMESPACE_BEGIN -struct ListFormatInternal : public UMemory { +namespace { + +class PatternHandler : public UObject { +public: + PatternHandler(const UnicodeString& two, const UnicodeString& end, UErrorCode& errorCode) : + twoPattern(two, 2, 2, errorCode), + endPattern(end, 2, 2, errorCode) { } + + PatternHandler(const SimpleFormatter& two, const SimpleFormatter& end) : + twoPattern(two), + endPattern(end) { } + + virtual ~PatternHandler(); + + virtual PatternHandler* clone() const { return new PatternHandler(twoPattern, endPattern); } + + /** Argument: final string in the list. */ + virtual const SimpleFormatter& getTwoPattern(const UnicodeString&) const { + return twoPattern; + } + + /** Argument: final string in the list. */ + virtual const SimpleFormatter& getEndPattern(const UnicodeString&) const { + return endPattern; + } + +protected: SimpleFormatter twoPattern; + SimpleFormatter endPattern; +}; + +PatternHandler::~PatternHandler() { +} + +class ContextualHandler : public PatternHandler { +public: + ContextualHandler(bool (*testFunc)(const UnicodeString& text), + const UnicodeString& thenTwo, + const UnicodeString& elseTwo, + const UnicodeString& thenEnd, + const UnicodeString& elseEnd, + UErrorCode& errorCode) : + PatternHandler(elseTwo, elseEnd, errorCode), + test(testFunc), + thenTwoPattern(thenTwo, 2, 2, errorCode), + thenEndPattern(thenEnd, 2, 2, errorCode) { } + + ContextualHandler(bool (*testFunc)(const UnicodeString& text), + const SimpleFormatter& thenTwo, SimpleFormatter elseTwo, + const SimpleFormatter& thenEnd, SimpleFormatter elseEnd) : + PatternHandler(elseTwo, elseEnd), + test(testFunc), + thenTwoPattern(thenTwo), + thenEndPattern(thenEnd) { } + + ~ContextualHandler() override; + + PatternHandler* clone() const override { + return new ContextualHandler( + test, thenTwoPattern, twoPattern, thenEndPattern, endPattern); + } + + const SimpleFormatter& getTwoPattern( + const UnicodeString& text) const override { + return (test)(text) ? thenTwoPattern : twoPattern; + } + + const SimpleFormatter& getEndPattern( + const UnicodeString& text) const override { + return (test)(text) ? thenEndPattern : endPattern; + } + +private: + bool (*test)(const UnicodeString&); + SimpleFormatter thenTwoPattern; + SimpleFormatter thenEndPattern; +}; + +ContextualHandler::~ContextualHandler() { +} + +static const char16_t *spanishY = u"{0} y {1}"; +static const char16_t *spanishE = u"{0} e {1}"; +static const char16_t *spanishO = u"{0} o {1}"; +static const char16_t *spanishU = u"{0} u {1}"; +static const char16_t *hebrewVav = u"{0} \u05D5{1}"; +static const char16_t *hebrewVavDash = u"{0} \u05D5-{1}"; + +// Condiction to change to e. +// Starts with "hi" or "i" but not with "hie" nor "hia" +static bool shouldChangeToE(const UnicodeString& text) { + int32_t len = text.length(); + if (len == 0) { return false; } + // Case insensitive match hi but not hie nor hia. + if ((text[0] == u'h' || text[0] == u'H') && + ((len > 1) && (text[1] == u'i' || text[1] == u'I')) && + ((len == 2) || !(text[2] == u'a' || text[2] == u'A' || text[2] == u'e' || text[2] == u'E'))) { + return true; + } + // Case insensitive for "start with i" + if (text[0] == u'i' || text[0] == u'I') { return true; } + return false; +} + +// Condiction to change to u. +// Starts with "o", "ho", and "8". Also "11" by itself. +// re: ^((o|ho|8).*|11)$ +static bool shouldChangeToU(const UnicodeString& text) { + int32_t len = text.length(); + if (len == 0) { return false; } + // Case insensitive match o.* and 8.* + if (text[0] == u'o' || text[0] == u'O' || text[0] == u'8') { return true; } + // Case insensitive match ho.* + if ((text[0] == u'h' || text[0] == u'H') && + ((len > 1) && (text[1] == 'o' || text[1] == u'O'))) { + return true; + } + // match "^11$" and "^11 .*" + if ((len >= 2) && text[0] == u'1' && text[1] == u'1' && (len == 2 || text[2] == u' ')) { return true; } + return false; +} + +// Condiction to change to VAV follow by a dash. +// Starts with non Hebrew letter. +static bool shouldChangeToVavDash(const UnicodeString& text) { + if (text.isEmpty()) { return false; } + UErrorCode status = U_ZERO_ERROR; + return uscript_getScript(text.char32At(0), &status) != USCRIPT_HEBREW; +} + +PatternHandler* createPatternHandler( + const char* lang, const UnicodeString& two, const UnicodeString& end, + UErrorCode& status) { + if (uprv_strcmp(lang, "es") == 0) { + // Spanish + UnicodeString spanishYStr(true, spanishY, -1); + bool twoIsY = two == spanishYStr; + bool endIsY = end == spanishYStr; + if (twoIsY || endIsY) { + UnicodeString replacement(true, spanishE, -1); + return new ContextualHandler( + shouldChangeToE, + twoIsY ? replacement : two, two, + endIsY ? replacement : end, end, status); + } + UnicodeString spanishOStr(true, spanishO, -1); + bool twoIsO = two == spanishOStr; + bool endIsO = end == spanishOStr; + if (twoIsO || endIsO) { + UnicodeString replacement(true, spanishU, -1); + return new ContextualHandler( + shouldChangeToU, + twoIsO ? replacement : two, two, + endIsO ? replacement : end, end, status); + } + } else if (uprv_strcmp(lang, "he") == 0 || uprv_strcmp(lang, "iw") == 0) { + // Hebrew + UnicodeString hebrewVavStr(true, hebrewVav, -1); + bool twoIsVav = two == hebrewVavStr; + bool endIsVav = end == hebrewVavStr; + if (twoIsVav || endIsVav) { + UnicodeString replacement(true, hebrewVavDash, -1); + return new ContextualHandler( + shouldChangeToVavDash, + twoIsVav ? replacement : two, two, + endIsVav ? replacement : end, end, status); + } + } + return new PatternHandler(two, end, status); +} + +} // namespace + +struct ListFormatInternal : public UMemory { SimpleFormatter startPattern; SimpleFormatter middlePattern; - SimpleFormatter endPattern; + LocalPointer patternHandler; ListFormatInternal( const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end, + const Locale& locale, UErrorCode &errorCode) : - twoPattern(two, 2, 2, errorCode), startPattern(start, 2, 2, errorCode), middlePattern(middle, 2, 2, errorCode), - endPattern(end, 2, 2, errorCode) {} + patternHandler(createPatternHandler(locale.getLanguage(), two, end, errorCode), errorCode) { } ListFormatInternal(const ListFormatData &data, UErrorCode &errorCode) : - twoPattern(data.twoPattern, errorCode), startPattern(data.startPattern, errorCode), middlePattern(data.middlePattern, errorCode), - endPattern(data.endPattern, errorCode) { } + patternHandler(createPatternHandler( + data.locale.getLanguage(), data.twoPattern, data.endPattern, errorCode), errorCode) { } ListFormatInternal(const ListFormatInternal &other) : - twoPattern(other.twoPattern), startPattern(other.startPattern), middlePattern(other.middlePattern), - endPattern(other.endPattern) { } + patternHandler(other.patternHandler->clone()) { } }; -#if !UCONFIG_NO_FORMATTING -class FormattedListData : public FormattedValueFieldPositionIteratorImpl { +class FormattedListData : public FormattedValueStringBuilderImpl { public: - FormattedListData(UErrorCode& status) : FormattedValueFieldPositionIteratorImpl(5, status) {} + FormattedListData(UErrorCode&) : FormattedValueStringBuilderImpl(kUndefinedField) {} virtual ~FormattedListData(); }; FormattedListData::~FormattedListData() = default; UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedList) -#endif static Hashtable* listPatternHash = nullptr; -static const char STANDARD_STYLE[] = "standard"; U_CDECL_BEGIN static UBool U_CALLCONV uprv_listformatter_cleanup() { delete listPatternHash; listPatternHash = nullptr; - return TRUE; + return true; } static void U_CALLCONV @@ -179,8 +352,52 @@ const ListFormatInternal* ListFormatter::getListFormatInternal( return result; } -static const UChar solidus = 0x2F; -static const UChar aliasPrefix[] = { 0x6C,0x69,0x73,0x74,0x50,0x61,0x74,0x74,0x65,0x72,0x6E,0x2F }; // "listPattern/" +static const char* typeWidthToStyleString(UListFormatterType type, UListFormatterWidth width) { + switch (type) { + case ULISTFMT_TYPE_AND: + switch (width) { + case ULISTFMT_WIDTH_WIDE: + return "standard"; + case ULISTFMT_WIDTH_SHORT: + return "standard-short"; + case ULISTFMT_WIDTH_NARROW: + return "standard-narrow"; + default: + return nullptr; + } + break; + + case ULISTFMT_TYPE_OR: + switch (width) { + case ULISTFMT_WIDTH_WIDE: + return "or"; + case ULISTFMT_WIDTH_SHORT: + return "or-short"; + case ULISTFMT_WIDTH_NARROW: + return "or-narrow"; + default: + return nullptr; + } + break; + + case ULISTFMT_TYPE_UNITS: + switch (width) { + case ULISTFMT_WIDTH_WIDE: + return "unit"; + case ULISTFMT_WIDTH_SHORT: + return "unit-short"; + case ULISTFMT_WIDTH_NARROW: + return "unit-narrow"; + default: + return nullptr; + } + } + + return nullptr; +} + +static const char16_t solidus = 0x2F; +static const char16_t aliasPrefix[] = { 0x6C,0x69,0x73,0x74,0x50,0x61,0x74,0x74,0x65,0x72,0x6E,0x2F }; // "listPattern/" enum { kAliasPrefixLen = UPRV_LENGTHOF(aliasPrefix), kStyleLenMax = 24 // longest currently is 14 @@ -188,16 +405,9 @@ enum { struct ListFormatter::ListPatternsSink : public ResourceSink { UnicodeString two, start, middle, end; -#if ((U_PLATFORM == U_PF_AIX) || (U_PLATFORM == U_PF_OS390)) && (U_CPLUSPLUS_VERSION < 11) - char aliasedStyle[kStyleLenMax+1]; - ListPatternsSink() { - uprv_memset(aliasedStyle, 0, kStyleLenMax+1); - } -#else char aliasedStyle[kStyleLenMax+1] = {0}; ListPatternsSink() {} -#endif virtual ~ListPatternsSink(); void setAliasedStyle(UnicodeString alias) { @@ -227,7 +437,7 @@ struct ListFormatter::ListPatternsSink : public ResourceSink { } virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/, - UErrorCode &errorCode) { + UErrorCode &errorCode) override { aliasedStyle[0] = 0; if (value.getType() == URES_ALIAS) { setAliasedStyle(value.getAliasUnicodeString(errorCode)); @@ -279,7 +489,8 @@ ListFormatInternal* ListFormatter::loadListFormatInternal( errorCode = U_MISSING_RESOURCE_ERROR; return nullptr; } - ListFormatInternal* result = new ListFormatInternal(sink.two, sink.start, sink.middle, sink.end, errorCode); + + ListFormatInternal* result = new ListFormatInternal(sink.two, sink.start, sink.middle, sink.end, locale, errorCode); if (result == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return nullptr; @@ -297,7 +508,17 @@ ListFormatter* ListFormatter::createInstance(UErrorCode& errorCode) { } ListFormatter* ListFormatter::createInstance(const Locale& locale, UErrorCode& errorCode) { - return createInstance(locale, STANDARD_STYLE, errorCode); + return createInstance(locale, ULISTFMT_TYPE_AND, ULISTFMT_WIDTH_WIDE, errorCode); +} + +ListFormatter* ListFormatter::createInstance( + const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode) { + const char* style = typeWidthToStyleString(type, width); + if (style == nullptr) { + errorCode = U_ILLEGAL_ARGUMENT_ERROR; + return nullptr; + } + return createInstance(locale, style, errorCode); } ListFormatter* ListFormatter::createInstance(const Locale& locale, const char *style, UErrorCode& errorCode) { @@ -325,50 +546,89 @@ ListFormatter::~ListFormatter() { delete owned; } -/** - * Joins first and second using the pattern pat. - * On entry offset is an offset into first or -1 if offset unspecified. - * On exit offset is offset of second in result if recordOffset was set - * Otherwise if it was >=0 it is set to point into result where it used - * to point into first. On exit, result is the join of first and second - * according to pat. Any previous value of result gets replaced. - */ -static void joinStringsAndReplace( - const SimpleFormatter& pat, - const UnicodeString& first, - const UnicodeString& second, - UnicodeString &result, - UBool recordOffset, - int32_t &offset, - int32_t *offsetFirst, - int32_t *offsetSecond, - UErrorCode& errorCode) { - if (U_FAILURE(errorCode)) { - return; - } - const UnicodeString *params[2] = {&first, &second}; - int32_t offsets[2]; - pat.formatAndReplace( - params, - UPRV_LENGTHOF(params), - result, - offsets, - UPRV_LENGTHOF(offsets), - errorCode); - if (U_FAILURE(errorCode)) { - return; +namespace { + +class FormattedListBuilder { +public: + LocalPointer data; + + /** For lists of length 1+ */ + FormattedListBuilder(const UnicodeString& start, UErrorCode& status) + : data(new FormattedListData(status), status) { + if (U_SUCCESS(status)) { + data->getStringRef().append( + start, + {UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD}, + status); + data->appendSpanInfo(UFIELD_CATEGORY_LIST_SPAN, 0, -1, start.length(), status); + } } - if (offsets[0] == -1 || offsets[1] == -1) { - errorCode = U_INVALID_FORMAT_ERROR; - return; + + /** For lists of length 0 */ + FormattedListBuilder(UErrorCode& status) + : data(new FormattedListData(status), status) { } - if (recordOffset) { - offset = offsets[1]; - } else if (offset >= 0) { - offset += offsets[0]; + + void append(const SimpleFormatter& pattern, const UnicodeString& next, int32_t position, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (pattern.getArgumentLimit() != 2) { + status = U_INTERNAL_PROGRAM_ERROR; + return; + } + // In the pattern, {0} are the pre-existing elements and {1} is the new element. + int32_t offsets[] = {0, 0}; + UnicodeString temp = pattern.getTextWithNoArguments(offsets, 2); + if (offsets[0] <= offsets[1]) { + // prefix{0}infix{1}suffix + // Prepend prefix, then append infix, element, and suffix + data->getStringRef().insert( + 0, + temp.tempSubStringBetween(0, offsets[0]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().append( + temp.tempSubStringBetween(offsets[0], offsets[1]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().append( + next, + {UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD}, + status); + data->appendSpanInfo(UFIELD_CATEGORY_LIST_SPAN, position, -1, next.length(), status); + data->getStringRef().append( + temp.tempSubString(offsets[1]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + } else { + // prefix{1}infix{0}suffix + // Prepend infix, element, and prefix, then append suffix. + // (We prepend in reverse order because prepending at index 0 is fast.) + data->getStringRef().insert( + 0, + temp.tempSubStringBetween(offsets[1], offsets[0]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().insert( + 0, + next, + {UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD}, + status); + data->prependSpanInfo(UFIELD_CATEGORY_LIST_SPAN, position, -1, next.length(), status); + data->getStringRef().insert( + 0, + temp.tempSubStringBetween(0, offsets[1]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + data->getStringRef().append( + temp.tempSubString(offsets[0]), + {UFIELD_CATEGORY_LIST, ULISTFMT_LITERAL_FIELD}, + status); + } } - if (offsetFirst != nullptr) *offsetFirst = offsets[0]; - if (offsetSecond != nullptr) *offsetSecond = offsets[1]; +}; + } UnicodeString& ListFormatter::format( @@ -380,19 +640,6 @@ UnicodeString& ListFormatter::format( return format(items, nItems, appendTo, -1, offset, errorCode); } -#if !UCONFIG_NO_FORMATTING -UnicodeString& ListFormatter::format( - const UnicodeString items[], - int32_t nItems, - UnicodeString & appendTo, - FieldPositionIterator* posIter, - UErrorCode& errorCode) const { - int32_t offset; - FieldPositionIteratorHandler handler(posIter, errorCode); - return format_(items, nItems, appendTo, -1, offset, &handler, errorCode); -} -#endif - UnicodeString& ListFormatter::format( const UnicodeString items[], int32_t nItems, @@ -400,177 +647,86 @@ UnicodeString& ListFormatter::format( int32_t index, int32_t &offset, UErrorCode& errorCode) const { - return format_(items, nItems, appendTo, index, offset, nullptr, errorCode); + int32_t initialOffset = appendTo.length(); + auto result = formatStringsToValue(items, nItems, errorCode); + UnicodeStringAppendable appendable(appendTo); + result.appendTo(appendable, errorCode); + if (index >= 0) { + ConstrainedFieldPosition cfpos; + cfpos.constrainField(UFIELD_CATEGORY_LIST_SPAN, index); + result.nextPosition(cfpos, errorCode); + offset = initialOffset + cfpos.getStart(); + } + return appendTo; } -#if !UCONFIG_NO_FORMATTING FormattedList ListFormatter::formatStringsToValue( const UnicodeString items[], int32_t nItems, UErrorCode& errorCode) const { - LocalPointer result(new FormattedListData(errorCode), errorCode); - if (U_FAILURE(errorCode)) { - return FormattedList(errorCode); + if (nItems == 0) { + FormattedListBuilder result(errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); + } + } else if (nItems == 1) { + FormattedListBuilder result(items[0], errorCode); + result.data->getStringRef().writeTerminator(errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); + } + } else if (nItems == 2) { + FormattedListBuilder result(items[0], errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } + result.append( + data->patternHandler->getTwoPattern(items[1]), + items[1], + 1, + errorCode); + result.data->getStringRef().writeTerminator(errorCode); + if (U_FAILURE(errorCode)) { + return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); + } } - UnicodeString string; - int32_t offset; - auto handler = result->getHandler(errorCode); - handler.setCategory(UFIELD_CATEGORY_LIST); - format_(items, nItems, string, -1, offset, &handler, errorCode); - handler.getError(errorCode); - result->appendString(string, errorCode); + + FormattedListBuilder result(items[0], errorCode); if (U_FAILURE(errorCode)) { return FormattedList(errorCode); } - - // Add span fields and sort - ConstrainedFieldPosition cfpos; - cfpos.constrainField(UFIELD_CATEGORY_LIST, ULISTFMT_ELEMENT_FIELD); - int32_t i = 0; - handler.setCategory(UFIELD_CATEGORY_LIST_SPAN); - while (result->nextPosition(cfpos, errorCode)) { - handler.addAttribute(i++, cfpos.getStart(), cfpos.getLimit()); + result.append( + data->startPattern, + items[1], + 1, + errorCode); + for (int32_t i = 2; i < nItems - 1; i++) { + result.append( + data->middlePattern, + items[i], + i, + errorCode); } - handler.getError(errorCode); + result.append( + data->patternHandler->getEndPattern(items[nItems-1]), + items[nItems-1], + nItems-1, + errorCode); + result.data->getStringRef().writeTerminator(errorCode); if (U_FAILURE(errorCode)) { return FormattedList(errorCode); + } else { + return FormattedList(result.data.orphan()); } - result->sort(); - - return FormattedList(result.orphan()); } -#endif -UnicodeString& ListFormatter::format_( - const UnicodeString items[], - int32_t nItems, - UnicodeString& appendTo, - int32_t index, - int32_t &offset, - FieldPositionHandler* handler, - UErrorCode& errorCode) const { -#if !UCONFIG_NO_FORMATTING - offset = -1; - if (U_FAILURE(errorCode)) { - return appendTo; - } - if (data == nullptr) { - errorCode = U_INVALID_STATE_ERROR; - return appendTo; - } - - if (nItems <= 0) { - return appendTo; - } - if (nItems == 1) { - if (index == 0) { - offset = appendTo.length(); - } - if (handler != nullptr) { - handler->addAttribute(ULISTFMT_ELEMENT_FIELD, - appendTo.length(), - appendTo.length() + items[0].length()); - } - appendTo.append(items[0]); - return appendTo; - } - UnicodeString result(items[0]); - if (index == 0) { - offset = 0; - } - int32_t offsetFirst = 0; - int32_t offsetSecond = 0; - int32_t prefixLength = 0; - // for n items, there are 2 * (n + 1) boundary including 0 and the upper - // edge. - MaybeStackArray offsets((handler != nullptr) ? 2 * (nItems + 1): 0); - joinStringsAndReplace( - nItems == 2 ? data->twoPattern : data->startPattern, - result, - items[1], - result, - index == 1, - offset, - &offsetFirst, - &offsetSecond, - errorCode); - if (handler != nullptr) { - offsets[0] = 0; - prefixLength += offsetFirst; - offsets[1] = offsetSecond - prefixLength; - } - if (nItems > 2) { - for (int32_t i = 2; i < nItems - 1; ++i) { - joinStringsAndReplace( - data->middlePattern, - result, - items[i], - result, - index == i, - offset, - &offsetFirst, - &offsetSecond, - errorCode); - if (handler != nullptr) { - prefixLength += offsetFirst; - offsets[i] = offsetSecond - prefixLength; - } - } - joinStringsAndReplace( - data->endPattern, - result, - items[nItems - 1], - result, - index == nItems - 1, - offset, - &offsetFirst, - &offsetSecond, - errorCode); - if (handler != nullptr) { - prefixLength += offsetFirst; - offsets[nItems - 1] = offsetSecond - prefixLength; - } - } - if (handler != nullptr) { - // If there are already some data in appendTo, we need to adjust the index - // by shifting that length while insert into handler. - int32_t shift = appendTo.length() + prefixLength; - // Output the ULISTFMT_ELEMENT_FIELD in the order of the input elements - for (int32_t i = 0; i < nItems; ++i) { - offsets[i + nItems] = offsets[i] + items[i].length() + shift; - offsets[i] += shift; - handler->addAttribute( - ULISTFMT_ELEMENT_FIELD, // id - offsets[i], // index - offsets[i + nItems]); // limit - } - // The locale pattern may reorder the items (such as in ur-IN locale), - // so we cannot assume the array is in ascending order. - // To handle the edging case, just insert the two ends into the array - // and sort. Then we output ULISTFMT_LITERAL_FIELD if the indices - // between the even and odd position are not the same in the sorted array. - offsets[2 * nItems] = shift - prefixLength; - offsets[2 * nItems + 1] = result.length() + shift - prefixLength; - uprv_sortArray(offsets.getAlias(), 2 * (nItems + 1), sizeof(int32_t), - uprv_int32Comparator, nullptr, - false, &errorCode); - for (int32_t i = 0; i <= nItems; ++i) { - if (offsets[i * 2] != offsets[i * 2 + 1]) { - handler->addAttribute( - ULISTFMT_LITERAL_FIELD, // id - offsets[i * 2], // index - offsets[i * 2 + 1]); // limit - } - } - } - if (U_SUCCESS(errorCode)) { - if (offset >= 0) { - offset += appendTo.length(); - } - appendTo += result; - } -#endif - return appendTo; -} U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp index 2783807bc..da4e69b49 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp @@ -38,6 +38,7 @@ #include "uassert.h" #include "unicode/numberformatter.h" #include "number_longnames.h" +#include "number_utypes.h" #include "sharednumberformat.h" #include "sharedpluralrules.h" @@ -47,6 +48,8 @@ U_NAMESPACE_BEGIN +using number::impl::UFormattedNumberData; + static constexpr int32_t WIDTH_INDEX_COUNT = UMEASFMT_WIDTH_NARROW + 1; UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureFormat) @@ -178,12 +181,12 @@ static UBool getString( UnicodeString &result, UErrorCode &status) { int32_t len = 0; - const UChar *resStr = ures_getString(resource, &len, &status); + const char16_t *resStr = ures_getString(resource, &len, &status); if (U_FAILURE(status)) { - return FALSE; + return false; } - result.setTo(TRUE, resStr, len); - return TRUE; + result.setTo(true, resStr, len); + return true; } static UnicodeString loadNumericDateFormatterPattern( @@ -201,7 +204,7 @@ static UnicodeString loadNumericDateFormatterPattern( ures_getByKeyWithFallback( resource, chs.data(), - NULL, + nullptr, &status)); if (U_FAILURE(status)) { return result; @@ -209,7 +212,7 @@ static UnicodeString loadNumericDateFormatterPattern( getString(patternBundle.getAlias(), result, status); // Replace 'h' with 'H' int32_t len = result.length(); - UChar *buffer = result.getBuffer(len); + char16_t *buffer = result.getBuffer(len); for (int32_t i = 0; i < len; ++i) { if (buffer[i] == 0x68) { // 'h' buffer[i] = 0x48; // 'H' @@ -223,7 +226,7 @@ static NumericDateFormatters *loadNumericDateFormatters( const UResourceBundle *resource, UErrorCode &status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } NumericDateFormatters *result = new NumericDateFormatters( loadNumericDateFormatterPattern(resource, "hm", status), @@ -231,12 +234,12 @@ static NumericDateFormatters *loadNumericDateFormatters( loadNumericDateFormatterPattern(resource, "hms", status)); if (U_FAILURE(status)) { delete result; - return NULL; + return nullptr; } return result; } -template<> U_I18N_API +template<> const MeasureFormatCacheData *LocaleCacheKey::createObject( const void * /*unused*/, UErrorCode &status) const { const char *localeId = fLoc.getName(); @@ -245,12 +248,12 @@ const MeasureFormatCacheData *LocaleCacheKey::createObje UNUM_CURRENCY_PLURAL, UNUM_CURRENCY_ISO, UNUM_CURRENCY}; LocalPointer result(new MeasureFormatCacheData(), status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } result->adoptNumericDateFormatters(loadNumericDateFormatters( unitsBundle.getAlias(), status)); if (U_FAILURE(status)) { - return NULL; + return nullptr; } for (int32_t i = 0; i < WIDTH_INDEX_COUNT; ++i) { @@ -263,17 +266,17 @@ const MeasureFormatCacheData *LocaleCacheKey::createObje status = localStatus; } if (U_FAILURE(status)) { - return NULL; + return nullptr; } } NumberFormat *inf = NumberFormat::createInstance( localeId, UNUM_DECIMAL, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } inf->setMaximumFractionDigits(0); DecimalFormat *decfmt = dynamic_cast(inf); - if (decfmt != NULL) { + if (decfmt != nullptr) { decfmt->setRoundingMode(DecimalFormat::kRoundDown); } result->adoptIntegerFormat(inf); @@ -349,12 +352,12 @@ static int32_t toHMS( MeasureFormat::MeasureFormat( const Locale &locale, UMeasureFormatWidth w, UErrorCode &status) - : cache(NULL), - numberFormat(NULL), - pluralRules(NULL), + : cache(nullptr), + numberFormat(nullptr), + pluralRules(nullptr), fWidth(w), - listFormatter(NULL) { - initMeasureFormat(locale, w, NULL, status); + listFormatter(nullptr) { + initMeasureFormat(locale, w, nullptr, status); } MeasureFormat::MeasureFormat( @@ -362,11 +365,11 @@ MeasureFormat::MeasureFormat( UMeasureFormatWidth w, NumberFormat *nfToAdopt, UErrorCode &status) - : cache(NULL), - numberFormat(NULL), - pluralRules(NULL), + : cache(nullptr), + numberFormat(nullptr), + pluralRules(nullptr), fWidth(w), - listFormatter(NULL) { + listFormatter(nullptr) { initMeasureFormat(locale, w, nfToAdopt, status); } @@ -376,11 +379,11 @@ MeasureFormat::MeasureFormat(const MeasureFormat &other) : numberFormat(other.numberFormat), pluralRules(other.pluralRules), fWidth(other.fWidth), - listFormatter(NULL) { + listFormatter(nullptr) { cache->addRef(); numberFormat->addRef(); pluralRules->addRef(); - if (other.listFormatter != NULL) { + if (other.listFormatter != nullptr) { listFormatter = new ListFormatter(*other.listFormatter); } } @@ -395,30 +398,30 @@ MeasureFormat &MeasureFormat::operator=(const MeasureFormat &other) { SharedObject::copyPtr(other.pluralRules, pluralRules); fWidth = other.fWidth; delete listFormatter; - if (other.listFormatter != NULL) { + if (other.listFormatter != nullptr) { listFormatter = new ListFormatter(*other.listFormatter); } else { - listFormatter = NULL; + listFormatter = nullptr; } return *this; } MeasureFormat::MeasureFormat() : - cache(NULL), - numberFormat(NULL), - pluralRules(NULL), + cache(nullptr), + numberFormat(nullptr), + pluralRules(nullptr), fWidth(UMEASFMT_WIDTH_SHORT), - listFormatter(NULL) { + listFormatter(nullptr) { } MeasureFormat::~MeasureFormat() { - if (cache != NULL) { + if (cache != nullptr) { cache->removeRef(); } - if (numberFormat != NULL) { + if (numberFormat != nullptr) { numberFormat->removeRef(); } - if (pluralRules != NULL) { + if (pluralRules != nullptr) { pluralRules->removeRef(); } delete listFormatter; @@ -426,10 +429,10 @@ MeasureFormat::~MeasureFormat() { bool MeasureFormat::operator==(const Format &other) const { if (this == &other) { // Same object, equal - return TRUE; + return true; } if (!Format::operator==(other)) { - return FALSE; + return false; } const MeasureFormat &rhs = static_cast(other); @@ -438,7 +441,7 @@ bool MeasureFormat::operator==(const Format &other) const { // differing widths aren't equivalent if (fWidth != rhs.fWidth) { - return FALSE; + return false; } // Width the same check locales. // We don't need to check locales if both objects have same cache. @@ -448,10 +451,10 @@ bool MeasureFormat::operator==(const Format &other) const { const char *rhsLocaleId = rhs.getLocaleID(status); if (U_FAILURE(status)) { // On failure, assume not equal - return FALSE; + return false; } if (uprv_strcmp(localeId, rhsLocaleId) != 0) { - return FALSE; + return false; } } // Locales same, check NumberFormat if shared data differs. @@ -473,7 +476,7 @@ UnicodeString &MeasureFormat::format( if (obj.getType() == Formattable::kObject) { const UObject* formatObj = obj.getObject(); const Measure* amount = dynamic_cast(formatObj); - if (amount != NULL) { + if (amount != nullptr) { return formatMeasure( *amount, **numberFormat, appendTo, pos, status); } @@ -504,12 +507,13 @@ UnicodeString &MeasureFormat::formatMeasurePerUnit( status = U_UNSUPPORTED_ERROR; return appendTo; } - number::FormattedNumber result; + UFormattedNumberData result; if (auto* lnf = df->toNumberFormatter(status)) { - result = lnf->unit(measure.getUnit()) + result.quantity.setToDouble(measure.getNumber().getDouble(status)); + lnf->unit(measure.getUnit()) .perUnit(perUnit) .unitWidth(getUnitWidth(fWidth)) - .formatDouble(measure.getNumber().getDouble(status), status); + .formatImpl(&result, status); } DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status); appendTo.append(result.toTempString(status)); @@ -543,7 +547,7 @@ UnicodeString &MeasureFormat::formatMeasures( measures, measureCount, appendTo, pos, status); } UnicodeString *results = new UnicodeString[measureCount]; - if (results == NULL) { + if (results == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return appendTo; } @@ -577,7 +581,10 @@ void MeasureFormat::initMeasureFormat( UMeasureFormatWidth w, NumberFormat *nfToAdopt, UErrorCode &status) { - static const char *listStyles[] = {"unit", "unit-short", "unit-narrow"}; + static const UListFormatterWidth listWidths[] = { + ULISTFMT_WIDTH_WIDE, + ULISTFMT_WIDTH_SHORT, + ULISTFMT_WIDTH_NARROW}; LocalPointer nf(nfToAdopt); if (U_FAILURE(status)) { return; @@ -616,7 +623,8 @@ void MeasureFormat::initMeasureFormat( delete listFormatter; listFormatter = ListFormatter::createInstance( locale, - listStyles[getRegularWidth(fWidth)], + ULISTFMT_TYPE_UNITS, + listWidths[getRegularWidth(fWidth)], status); } @@ -627,7 +635,7 @@ void MeasureFormat::adoptNumberFormat( return; } SharedNumberFormat *shared = new SharedNumberFormat(nf.getAlias()); - if (shared == NULL) { + if (shared == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -637,9 +645,9 @@ void MeasureFormat::adoptNumberFormat( UBool MeasureFormat::setMeasureFormatLocale(const Locale &locale, UErrorCode &status) { if (U_FAILURE(status) || locale == getLocale(status)) { - return FALSE; + return false; } - initMeasureFormat(locale, fWidth, NULL, status); + initMeasureFormat(locale, fWidth, nullptr, status); return U_SUCCESS(status); } @@ -675,7 +683,7 @@ UnicodeString &MeasureFormat::formatMeasure( const Formattable& amtNumber = measure.getNumber(); const MeasureUnit& amtUnit = measure.getUnit(); if (isCurrency(amtUnit)) { - UChar isoCode[4]; + char16_t isoCode[4]; u_charsToUChars(amtUnit.getSubtype(), isoCode, 4); return cache->getCurrencyFormat(fWidth)->format( new CurrencyAmount(amtNumber, isoCode, status), @@ -699,11 +707,12 @@ UnicodeString &MeasureFormat::formatMeasure( SimpleFormatter formatter(pattern, 0, 1, status); return QuantityFormatter::format(formatter, formattedNumber, appendTo, pos, status); } - number::FormattedNumber result; + UFormattedNumberData result; if (auto* lnf = df->toNumberFormatter(status)) { - result = lnf->unit(amtUnit) + result.quantity.setToDouble(amtNumber.getDouble(status)); + lnf->unit(amtUnit) .unitWidth(getUnitWidth(fWidth)) - .formatDouble(amtNumber.getDouble(status), status); + .formatImpl(&result, status); } DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status); appendTo.append(result.toTempString(status)); @@ -760,7 +769,7 @@ UnicodeString &MeasureFormat::formatNumeric( FormattedStringBuilder fsb; - UBool protect = FALSE; + UBool protect = false; const int32_t patternLength = pattern.length(); for (int32_t i = 0; i < patternLength; i++) { char16_t c = pattern[i]; @@ -774,11 +783,6 @@ UnicodeString &MeasureFormat::formatNumeric( case u's': value = seconds; break; } - // For undefined field we use UNUM_FIELD_COUNT, for historical reasons. - // See cleanup bug: https://unicode-org.atlassian.net/browse/ICU-20665 - // But we give it a clear name, to keep "the ugly part" in one place. - constexpr UNumberFormatFields undefinedField = UNUM_FIELD_COUNT; - // There is not enough info to add Field(s) for the unit because all we have are plain // text patterns. For example in "21:51" there is no text for something like "hour", // while in something like "21h51" there is ("h"). But we can't really tell... @@ -787,7 +791,7 @@ UnicodeString &MeasureFormat::formatNumeric( case u'm': case u's': if (protect) { - fsb.appendChar16(c, undefinedField, status); + fsb.appendChar16(c, kUndefinedField, status); } else { UnicodeString tmp; if ((i + 1 < patternLength) && pattern[i + 1] == c) { // doubled @@ -797,20 +801,20 @@ UnicodeString &MeasureFormat::formatNumeric( numberFormatter->format(value, tmp, status); } // TODO: Use proper Field - fsb.append(tmp, undefinedField, status); + fsb.append(tmp, kUndefinedField, status); } break; case u'\'': // '' is escaped apostrophe if ((i + 1 < patternLength) && pattern[i + 1] == c) { - fsb.appendChar16(c, undefinedField, status); + fsb.appendChar16(c, kUndefinedField, status); i++; } else { protect = !protect; } break; default: - fsb.appendChar16(c, undefinedField, status); + fsb.appendChar16(c, kUndefinedField, status); } } @@ -861,7 +865,7 @@ UnicodeString &MeasureFormat::formatMeasuresSlowTrack( return appendTo; } // Fix up FieldPosition indexes if our field is found. - if (offset != -1) { + if (fieldPositionFoundIndex != -1 && offset != -1) { pos.setBeginIndex(fpos.getBeginIndex() + offset); pos.setEndIndex(fpos.getEndIndex() + offset); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp index 17d8c0ec0..abb219977 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp @@ -17,9 +17,11 @@ #if !UCONFIG_NO_FORMATTING #include "unicode/uenum.h" +#include "unicode/errorcode.h" #include "ustrenum.h" #include "cstring.h" #include "uassert.h" +#include "measunit_impl.h" U_NAMESPACE_BEGIN @@ -29,64 +31,39 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureUnit) // the "End generated code" comment is auto generated code // and must not be edited manually. For instructions on how to correctly // update this code, refer to: -// http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit +// https://icu.unicode.org/design/formatting/measureformat/updating-measure-unit // -// Start generated code - +// Start generated code for measunit.cpp +// Maps from Type ID to offset in gSubTypes. static const int32_t gOffsets[] = { 0, 2, 7, 17, - 25, - 29, - 328, - 339, - 355, - 359, - 368, - 370, - 374, - 381, - 402, - 404, - 418, - 421, - 427, - 437, - 441, - 445, + 27, + 31, + 332, + 343, + 360, + 364, + 373, + 376, + 380, + 388, + 410, + 414, + 429, + 430, + 436, 447, - 474 + 452, + 456, + 458, + 492 }; -static const int32_t gIndexes[] = { - 0, - 2, - 7, - 17, - 25, - 29, - 29, - 40, - 56, - 60, - 69, - 71, - 75, - 82, - 103, - 105, - 119, - 122, - 128, - 138, - 142, - 146, - 148, - 175 -}; +static const int32_t kCurrencyOffset = 5; // Must be sorted alphabetically. static const char * const gTypes[] = { @@ -118,7 +95,7 @@ static const char * const gTypes[] = { // Must be grouped by type and sorted alphabetically within each type. static const char * const gSubTypes[] = { "g-force", - "meter-per-second-squared", + "meter-per-square-second", "arc-minute", "arc-second", "degree", @@ -134,15 +111,17 @@ static const char * const gSubTypes[] = { "square-meter", "square-mile", "square-yard", + "item", "karat", + "milligram-ofglucose-per-deciliter", "milligram-per-deciliter", "millimole-per-liter", "mole", - "part-per-million", "percent", "permille", + "permillion", "permyriad", - "liter-per-100kilometers", + "liter-per-100-kilometer", "liter-per-kilometer", "mile-per-gallon", "mile-per-gallon-imperial", @@ -366,6 +345,7 @@ static const char * const gSubTypes[] = { "SHP", "SIT", "SKK", + "SLE", "SLL", "SOS", "SRD", @@ -405,6 +385,7 @@ static const char * const gSubTypes[] = { "UYW", "UZS", "VEB", + "VED", "VEF", "VES", "VNC", @@ -467,6 +448,7 @@ static const char * const gSubTypes[] = { "month", "month-person", "nanosecond", + "quarter", "second", "week", "week-person", @@ -485,12 +467,14 @@ static const char * const gSubTypes[] = { "kilojoule", "kilowatt-hour", "therm-us", + "kilowatt-hour-per-100-kilometer", "newton", "pound-force", "gigahertz", "hertz", "kilohertz", "megahertz", + "dot", "dot-per-centimeter", "dot-per-inch", "em", @@ -501,6 +485,7 @@ static const char * const gSubTypes[] = { "astronomical-unit", "centimeter", "decimeter", + "earth-radius", "fathom", "foot", "furlong", @@ -519,14 +504,16 @@ static const char * const gSubTypes[] = { "point", "solar-radius", "yard", + "candela", + "lumen", "lux", "solar-luminosity", "carat", "dalton", "earth-mass", + "grain", "gram", "kilogram", - "metric-ton", "microgram", "milligram", "ounce", @@ -535,9 +522,8 @@ static const char * const gSubTypes[] = { "solar-mass", "stone", "ton", - "base", - "percent", - "permille", + "tonne", + "", "gigawatt", "horsepower", "kilowatt", @@ -546,14 +532,16 @@ static const char * const gSubTypes[] = { "watt", "atmosphere", "bar", + "gasoline-energy-density", "hectopascal", - "inch-hg", + "inch-ofhg", "kilopascal", "megapascal", "millibar", - "millimeter-of-mercury", + "millimeter-ofhg", "pascal", - "pound-per-square-inch", + "pound-force-per-square-inch", + "beaufort", "kilometer-per-hour", "knot", "meter-per-second", @@ -563,7 +551,7 @@ static const char * const gSubTypes[] = { "generic", "kelvin", "newton-meter", - "pound-foot", + "pound-force-foot", "acre-foot", "barrel", "bushel", @@ -578,35 +566,28 @@ static const char * const gSubTypes[] = { "cup", "cup-metric", "deciliter", + "dessert-spoon", + "dessert-spoon-imperial", + "dram", + "drop", "fluid-ounce", "fluid-ounce-imperial", "gallon", "gallon-imperial", "hectoliter", + "jigger", "liter", "megaliter", "milliliter", + "pinch", "pint", "pint-metric", "quart", + "quart-imperial", "tablespoon", "teaspoon" }; -// Must be sorted by first value and then second value. -static int32_t unitPerUnitToSingleUnit[][4] = { - {378, 382, 12, 5}, - {378, 387, 12, 6}, - {388, 343, 19, 0}, - {390, 350, 19, 2}, - {392, 343, 19, 3}, - {392, 463, 4, 2}, - {392, 464, 4, 3}, - {411, 460, 3, 1}, - {414, 12, 18, 9}, - {466, 388, 4, 1} -}; - // Shortcuts to the base unit in order to make the default constructor fast static const int32_t kBaseTypeIdx = 16; static const int32_t kBaseSubTypeIdx = 0; @@ -747,70 +728,86 @@ MeasureUnit MeasureUnit::getSquareYard() { return MeasureUnit(2, 9); } -MeasureUnit *MeasureUnit::createKarat(UErrorCode &status) { +MeasureUnit *MeasureUnit::createItem(UErrorCode &status) { return MeasureUnit::create(3, 0, status); } -MeasureUnit MeasureUnit::getKarat() { +MeasureUnit MeasureUnit::getItem() { return MeasureUnit(3, 0); } -MeasureUnit *MeasureUnit::createMilligramPerDeciliter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKarat(UErrorCode &status) { return MeasureUnit::create(3, 1, status); } -MeasureUnit MeasureUnit::getMilligramPerDeciliter() { +MeasureUnit MeasureUnit::getKarat() { return MeasureUnit(3, 1); } -MeasureUnit *MeasureUnit::createMillimolePerLiter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMilligramOfglucosePerDeciliter(UErrorCode &status) { return MeasureUnit::create(3, 2, status); } -MeasureUnit MeasureUnit::getMillimolePerLiter() { +MeasureUnit MeasureUnit::getMilligramOfglucosePerDeciliter() { return MeasureUnit(3, 2); } -MeasureUnit *MeasureUnit::createMole(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMilligramPerDeciliter(UErrorCode &status) { return MeasureUnit::create(3, 3, status); } -MeasureUnit MeasureUnit::getMole() { +MeasureUnit MeasureUnit::getMilligramPerDeciliter() { return MeasureUnit(3, 3); } -MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMillimolePerLiter(UErrorCode &status) { return MeasureUnit::create(3, 4, status); } -MeasureUnit MeasureUnit::getPartPerMillion() { +MeasureUnit MeasureUnit::getMillimolePerLiter() { return MeasureUnit(3, 4); } -MeasureUnit *MeasureUnit::createPercent(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMole(UErrorCode &status) { return MeasureUnit::create(3, 5, status); } -MeasureUnit MeasureUnit::getPercent() { +MeasureUnit MeasureUnit::getMole() { return MeasureUnit(3, 5); } -MeasureUnit *MeasureUnit::createPermille(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPercent(UErrorCode &status) { return MeasureUnit::create(3, 6, status); } -MeasureUnit MeasureUnit::getPermille() { +MeasureUnit MeasureUnit::getPercent() { return MeasureUnit(3, 6); } -MeasureUnit *MeasureUnit::createPermyriad(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPermille(UErrorCode &status) { return MeasureUnit::create(3, 7, status); } -MeasureUnit MeasureUnit::getPermyriad() { +MeasureUnit MeasureUnit::getPermille() { return MeasureUnit(3, 7); } +MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) { + return MeasureUnit::create(3, 8, status); +} + +MeasureUnit MeasureUnit::getPartPerMillion() { + return MeasureUnit(3, 8); +} + +MeasureUnit *MeasureUnit::createPermyriad(UErrorCode &status) { + return MeasureUnit::create(3, 9, status); +} + +MeasureUnit MeasureUnit::getPermyriad() { + return MeasureUnit(3, 9); +} + MeasureUnit *MeasureUnit::createLiterPer100Kilometers(UErrorCode &status) { return MeasureUnit::create(4, 0, status); } @@ -1019,46 +1016,54 @@ MeasureUnit MeasureUnit::getNanosecond() { return MeasureUnit(7, 10); } -MeasureUnit *MeasureUnit::createSecond(UErrorCode &status) { +MeasureUnit *MeasureUnit::createQuarter(UErrorCode &status) { return MeasureUnit::create(7, 11, status); } -MeasureUnit MeasureUnit::getSecond() { +MeasureUnit MeasureUnit::getQuarter() { return MeasureUnit(7, 11); } -MeasureUnit *MeasureUnit::createWeek(UErrorCode &status) { +MeasureUnit *MeasureUnit::createSecond(UErrorCode &status) { return MeasureUnit::create(7, 12, status); } -MeasureUnit MeasureUnit::getWeek() { +MeasureUnit MeasureUnit::getSecond() { return MeasureUnit(7, 12); } -MeasureUnit *MeasureUnit::createWeekPerson(UErrorCode &status) { +MeasureUnit *MeasureUnit::createWeek(UErrorCode &status) { return MeasureUnit::create(7, 13, status); } -MeasureUnit MeasureUnit::getWeekPerson() { +MeasureUnit MeasureUnit::getWeek() { return MeasureUnit(7, 13); } -MeasureUnit *MeasureUnit::createYear(UErrorCode &status) { +MeasureUnit *MeasureUnit::createWeekPerson(UErrorCode &status) { return MeasureUnit::create(7, 14, status); } -MeasureUnit MeasureUnit::getYear() { +MeasureUnit MeasureUnit::getWeekPerson() { return MeasureUnit(7, 14); } -MeasureUnit *MeasureUnit::createYearPerson(UErrorCode &status) { +MeasureUnit *MeasureUnit::createYear(UErrorCode &status) { return MeasureUnit::create(7, 15, status); } -MeasureUnit MeasureUnit::getYearPerson() { +MeasureUnit MeasureUnit::getYear() { return MeasureUnit(7, 15); } +MeasureUnit *MeasureUnit::createYearPerson(UErrorCode &status) { + return MeasureUnit::create(7, 16, status); +} + +MeasureUnit MeasureUnit::getYearPerson() { + return MeasureUnit(7, 16); +} + MeasureUnit *MeasureUnit::createAmpere(UErrorCode &status) { return MeasureUnit::create(8, 0, status); } @@ -1163,22 +1168,30 @@ MeasureUnit MeasureUnit::getThermUs() { return MeasureUnit(9, 8); } -MeasureUnit *MeasureUnit::createNewton(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKilowattHourPer100Kilometer(UErrorCode &status) { return MeasureUnit::create(10, 0, status); } -MeasureUnit MeasureUnit::getNewton() { +MeasureUnit MeasureUnit::getKilowattHourPer100Kilometer() { return MeasureUnit(10, 0); } -MeasureUnit *MeasureUnit::createPoundForce(UErrorCode &status) { +MeasureUnit *MeasureUnit::createNewton(UErrorCode &status) { return MeasureUnit::create(10, 1, status); } -MeasureUnit MeasureUnit::getPoundForce() { +MeasureUnit MeasureUnit::getNewton() { return MeasureUnit(10, 1); } +MeasureUnit *MeasureUnit::createPoundForce(UErrorCode &status) { + return MeasureUnit::create(10, 2, status); +} + +MeasureUnit MeasureUnit::getPoundForce() { + return MeasureUnit(10, 2); +} + MeasureUnit *MeasureUnit::createGigahertz(UErrorCode &status) { return MeasureUnit::create(11, 0, status); } @@ -1211,62 +1224,70 @@ MeasureUnit MeasureUnit::getMegahertz() { return MeasureUnit(11, 3); } -MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDot(UErrorCode &status) { return MeasureUnit::create(12, 0, status); } -MeasureUnit MeasureUnit::getDotPerCentimeter() { +MeasureUnit MeasureUnit::getDot() { return MeasureUnit(12, 0); } -MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) { return MeasureUnit::create(12, 1, status); } -MeasureUnit MeasureUnit::getDotPerInch() { +MeasureUnit MeasureUnit::getDotPerCentimeter() { return MeasureUnit(12, 1); } -MeasureUnit *MeasureUnit::createEm(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) { return MeasureUnit::create(12, 2, status); } -MeasureUnit MeasureUnit::getEm() { +MeasureUnit MeasureUnit::getDotPerInch() { return MeasureUnit(12, 2); } -MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) { +MeasureUnit *MeasureUnit::createEm(UErrorCode &status) { return MeasureUnit::create(12, 3, status); } -MeasureUnit MeasureUnit::getMegapixel() { +MeasureUnit MeasureUnit::getEm() { return MeasureUnit(12, 3); } -MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) { return MeasureUnit::create(12, 4, status); } -MeasureUnit MeasureUnit::getPixel() { +MeasureUnit MeasureUnit::getMegapixel() { return MeasureUnit(12, 4); } -MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) { return MeasureUnit::create(12, 5, status); } -MeasureUnit MeasureUnit::getPixelPerCentimeter() { +MeasureUnit MeasureUnit::getPixel() { return MeasureUnit(12, 5); } -MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) { return MeasureUnit::create(12, 6, status); } -MeasureUnit MeasureUnit::getPixelPerInch() { +MeasureUnit MeasureUnit::getPixelPerCentimeter() { return MeasureUnit(12, 6); } +MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) { + return MeasureUnit::create(12, 7, status); +} + +MeasureUnit MeasureUnit::getPixelPerInch() { + return MeasureUnit(12, 7); +} + MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) { return MeasureUnit::create(13, 0, status); } @@ -1291,166 +1312,190 @@ MeasureUnit MeasureUnit::getDecimeter() { return MeasureUnit(13, 2); } -MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) { +MeasureUnit *MeasureUnit::createEarthRadius(UErrorCode &status) { return MeasureUnit::create(13, 3, status); } -MeasureUnit MeasureUnit::getFathom() { +MeasureUnit MeasureUnit::getEarthRadius() { return MeasureUnit(13, 3); } -MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) { return MeasureUnit::create(13, 4, status); } -MeasureUnit MeasureUnit::getFoot() { +MeasureUnit MeasureUnit::getFathom() { return MeasureUnit(13, 4); } -MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) { return MeasureUnit::create(13, 5, status); } -MeasureUnit MeasureUnit::getFurlong() { +MeasureUnit MeasureUnit::getFoot() { return MeasureUnit(13, 5); } -MeasureUnit *MeasureUnit::createInch(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) { return MeasureUnit::create(13, 6, status); } -MeasureUnit MeasureUnit::getInch() { +MeasureUnit MeasureUnit::getFurlong() { return MeasureUnit(13, 6); } -MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createInch(UErrorCode &status) { return MeasureUnit::create(13, 7, status); } -MeasureUnit MeasureUnit::getKilometer() { +MeasureUnit MeasureUnit::getInch() { return MeasureUnit(13, 7); } -MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) { return MeasureUnit::create(13, 8, status); } -MeasureUnit MeasureUnit::getLightYear() { +MeasureUnit MeasureUnit::getKilometer() { return MeasureUnit(13, 8); } -MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) { return MeasureUnit::create(13, 9, status); } -MeasureUnit MeasureUnit::getMeter() { +MeasureUnit MeasureUnit::getLightYear() { return MeasureUnit(13, 9); } -MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) { return MeasureUnit::create(13, 10, status); } -MeasureUnit MeasureUnit::getMicrometer() { +MeasureUnit MeasureUnit::getMeter() { return MeasureUnit(13, 10); } -MeasureUnit *MeasureUnit::createMile(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) { return MeasureUnit::create(13, 11, status); } -MeasureUnit MeasureUnit::getMile() { +MeasureUnit MeasureUnit::getMicrometer() { return MeasureUnit(13, 11); } -MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMile(UErrorCode &status) { return MeasureUnit::create(13, 12, status); } -MeasureUnit MeasureUnit::getMileScandinavian() { +MeasureUnit MeasureUnit::getMile() { return MeasureUnit(13, 12); } -MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) { return MeasureUnit::create(13, 13, status); } -MeasureUnit MeasureUnit::getMillimeter() { +MeasureUnit MeasureUnit::getMileScandinavian() { return MeasureUnit(13, 13); } -MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) { return MeasureUnit::create(13, 14, status); } -MeasureUnit MeasureUnit::getNanometer() { +MeasureUnit MeasureUnit::getMillimeter() { return MeasureUnit(13, 14); } -MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) { +MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) { return MeasureUnit::create(13, 15, status); } -MeasureUnit MeasureUnit::getNauticalMile() { +MeasureUnit MeasureUnit::getNanometer() { return MeasureUnit(13, 15); } -MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) { +MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) { return MeasureUnit::create(13, 16, status); } -MeasureUnit MeasureUnit::getParsec() { +MeasureUnit MeasureUnit::getNauticalMile() { return MeasureUnit(13, 16); } -MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) { +MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) { return MeasureUnit::create(13, 17, status); } -MeasureUnit MeasureUnit::getPicometer() { +MeasureUnit MeasureUnit::getParsec() { return MeasureUnit(13, 17); } -MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) { return MeasureUnit::create(13, 18, status); } -MeasureUnit MeasureUnit::getPoint() { +MeasureUnit MeasureUnit::getPicometer() { return MeasureUnit(13, 18); } -MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) { return MeasureUnit::create(13, 19, status); } -MeasureUnit MeasureUnit::getSolarRadius() { +MeasureUnit MeasureUnit::getPoint() { return MeasureUnit(13, 19); } -MeasureUnit *MeasureUnit::createYard(UErrorCode &status) { +MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) { return MeasureUnit::create(13, 20, status); } -MeasureUnit MeasureUnit::getYard() { +MeasureUnit MeasureUnit::getSolarRadius() { return MeasureUnit(13, 20); } -MeasureUnit *MeasureUnit::createLux(UErrorCode &status) { +MeasureUnit *MeasureUnit::createYard(UErrorCode &status) { + return MeasureUnit::create(13, 21, status); +} + +MeasureUnit MeasureUnit::getYard() { + return MeasureUnit(13, 21); +} + +MeasureUnit *MeasureUnit::createCandela(UErrorCode &status) { return MeasureUnit::create(14, 0, status); } -MeasureUnit MeasureUnit::getLux() { +MeasureUnit MeasureUnit::getCandela() { return MeasureUnit(14, 0); } -MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) { +MeasureUnit *MeasureUnit::createLumen(UErrorCode &status) { return MeasureUnit::create(14, 1, status); } -MeasureUnit MeasureUnit::getSolarLuminosity() { +MeasureUnit MeasureUnit::getLumen() { return MeasureUnit(14, 1); } +MeasureUnit *MeasureUnit::createLux(UErrorCode &status) { + return MeasureUnit::create(14, 2, status); +} + +MeasureUnit MeasureUnit::getLux() { + return MeasureUnit(14, 2); +} + +MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) { + return MeasureUnit::create(14, 3, status); +} + +MeasureUnit MeasureUnit::getSolarLuminosity() { + return MeasureUnit(14, 3); +} + MeasureUnit *MeasureUnit::createCarat(UErrorCode &status) { return MeasureUnit::create(15, 0, status); } @@ -1475,30 +1520,38 @@ MeasureUnit MeasureUnit::getEarthMass() { return MeasureUnit(15, 2); } -MeasureUnit *MeasureUnit::createGram(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGrain(UErrorCode &status) { return MeasureUnit::create(15, 3, status); } -MeasureUnit MeasureUnit::getGram() { +MeasureUnit MeasureUnit::getGrain() { return MeasureUnit(15, 3); } -MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGram(UErrorCode &status) { return MeasureUnit::create(15, 4, status); } -MeasureUnit MeasureUnit::getKilogram() { +MeasureUnit MeasureUnit::getGram() { return MeasureUnit(15, 4); } -MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) { return MeasureUnit::create(15, 5, status); } -MeasureUnit MeasureUnit::getMetricTon() { +MeasureUnit MeasureUnit::getKilogram() { return MeasureUnit(15, 5); } +MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) { + return MeasureUnit::create(15, 14, status); +} + +MeasureUnit MeasureUnit::getMetricTon() { + return MeasureUnit(15, 14); +} + MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) { return MeasureUnit::create(15, 6, status); } @@ -1563,6 +1616,14 @@ MeasureUnit MeasureUnit::getTon() { return MeasureUnit(15, 13); } +MeasureUnit *MeasureUnit::createTonne(UErrorCode &status) { + return MeasureUnit::create(15, 14, status); +} + +MeasureUnit MeasureUnit::getTonne() { + return MeasureUnit(15, 14); +} + MeasureUnit *MeasureUnit::createGigawatt(UErrorCode &status) { return MeasureUnit::create(17, 0, status); } @@ -1627,102 +1688,118 @@ MeasureUnit MeasureUnit::getBar() { return MeasureUnit(18, 1); } -MeasureUnit *MeasureUnit::createHectopascal(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGasolineEnergyDensity(UErrorCode &status) { return MeasureUnit::create(18, 2, status); } -MeasureUnit MeasureUnit::getHectopascal() { +MeasureUnit MeasureUnit::getGasolineEnergyDensity() { return MeasureUnit(18, 2); } -MeasureUnit *MeasureUnit::createInchHg(UErrorCode &status) { +MeasureUnit *MeasureUnit::createHectopascal(UErrorCode &status) { return MeasureUnit::create(18, 3, status); } -MeasureUnit MeasureUnit::getInchHg() { +MeasureUnit MeasureUnit::getHectopascal() { return MeasureUnit(18, 3); } -MeasureUnit *MeasureUnit::createKilopascal(UErrorCode &status) { +MeasureUnit *MeasureUnit::createInchHg(UErrorCode &status) { return MeasureUnit::create(18, 4, status); } -MeasureUnit MeasureUnit::getKilopascal() { +MeasureUnit MeasureUnit::getInchHg() { return MeasureUnit(18, 4); } -MeasureUnit *MeasureUnit::createMegapascal(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKilopascal(UErrorCode &status) { return MeasureUnit::create(18, 5, status); } -MeasureUnit MeasureUnit::getMegapascal() { +MeasureUnit MeasureUnit::getKilopascal() { return MeasureUnit(18, 5); } -MeasureUnit *MeasureUnit::createMillibar(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMegapascal(UErrorCode &status) { return MeasureUnit::create(18, 6, status); } -MeasureUnit MeasureUnit::getMillibar() { +MeasureUnit MeasureUnit::getMegapascal() { return MeasureUnit(18, 6); } -MeasureUnit *MeasureUnit::createMillimeterOfMercury(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMillibar(UErrorCode &status) { return MeasureUnit::create(18, 7, status); } -MeasureUnit MeasureUnit::getMillimeterOfMercury() { +MeasureUnit MeasureUnit::getMillibar() { return MeasureUnit(18, 7); } -MeasureUnit *MeasureUnit::createPascal(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMillimeterOfMercury(UErrorCode &status) { return MeasureUnit::create(18, 8, status); } -MeasureUnit MeasureUnit::getPascal() { +MeasureUnit MeasureUnit::getMillimeterOfMercury() { return MeasureUnit(18, 8); } -MeasureUnit *MeasureUnit::createPoundPerSquareInch(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPascal(UErrorCode &status) { return MeasureUnit::create(18, 9, status); } -MeasureUnit MeasureUnit::getPoundPerSquareInch() { +MeasureUnit MeasureUnit::getPascal() { return MeasureUnit(18, 9); } -MeasureUnit *MeasureUnit::createKilometerPerHour(UErrorCode &status) { +MeasureUnit *MeasureUnit::createPoundPerSquareInch(UErrorCode &status) { + return MeasureUnit::create(18, 10, status); +} + +MeasureUnit MeasureUnit::getPoundPerSquareInch() { + return MeasureUnit(18, 10); +} + +MeasureUnit *MeasureUnit::createBeaufort(UErrorCode &status) { return MeasureUnit::create(19, 0, status); } -MeasureUnit MeasureUnit::getKilometerPerHour() { +MeasureUnit MeasureUnit::getBeaufort() { return MeasureUnit(19, 0); } -MeasureUnit *MeasureUnit::createKnot(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKilometerPerHour(UErrorCode &status) { return MeasureUnit::create(19, 1, status); } -MeasureUnit MeasureUnit::getKnot() { +MeasureUnit MeasureUnit::getKilometerPerHour() { return MeasureUnit(19, 1); } -MeasureUnit *MeasureUnit::createMeterPerSecond(UErrorCode &status) { +MeasureUnit *MeasureUnit::createKnot(UErrorCode &status) { return MeasureUnit::create(19, 2, status); } -MeasureUnit MeasureUnit::getMeterPerSecond() { +MeasureUnit MeasureUnit::getKnot() { return MeasureUnit(19, 2); } -MeasureUnit *MeasureUnit::createMilePerHour(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMeterPerSecond(UErrorCode &status) { return MeasureUnit::create(19, 3, status); } -MeasureUnit MeasureUnit::getMilePerHour() { +MeasureUnit MeasureUnit::getMeterPerSecond() { return MeasureUnit(19, 3); } +MeasureUnit *MeasureUnit::createMilePerHour(UErrorCode &status) { + return MeasureUnit::create(19, 4, status); +} + +MeasureUnit MeasureUnit::getMilePerHour() { + return MeasureUnit(19, 4); +} + MeasureUnit *MeasureUnit::createCelsius(UErrorCode &status) { return MeasureUnit::create(20, 0, status); } @@ -1883,117 +1960,173 @@ MeasureUnit MeasureUnit::getDeciliter() { return MeasureUnit(22, 13); } -MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDessertSpoon(UErrorCode &status) { return MeasureUnit::create(22, 14, status); } -MeasureUnit MeasureUnit::getFluidOunce() { +MeasureUnit MeasureUnit::getDessertSpoon() { return MeasureUnit(22, 14); } -MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDessertSpoonImperial(UErrorCode &status) { return MeasureUnit::create(22, 15, status); } -MeasureUnit MeasureUnit::getFluidOunceImperial() { +MeasureUnit MeasureUnit::getDessertSpoonImperial() { return MeasureUnit(22, 15); } -MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDram(UErrorCode &status) { return MeasureUnit::create(22, 16, status); } -MeasureUnit MeasureUnit::getGallon() { +MeasureUnit MeasureUnit::getDram() { return MeasureUnit(22, 16); } -MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) { +MeasureUnit *MeasureUnit::createDrop(UErrorCode &status) { return MeasureUnit::create(22, 17, status); } -MeasureUnit MeasureUnit::getGallonImperial() { +MeasureUnit MeasureUnit::getDrop() { return MeasureUnit(22, 17); } -MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) { return MeasureUnit::create(22, 18, status); } -MeasureUnit MeasureUnit::getHectoliter() { +MeasureUnit MeasureUnit::getFluidOunce() { return MeasureUnit(22, 18); } -MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) { return MeasureUnit::create(22, 19, status); } -MeasureUnit MeasureUnit::getLiter() { +MeasureUnit MeasureUnit::getFluidOunceImperial() { return MeasureUnit(22, 19); } -MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) { return MeasureUnit::create(22, 20, status); } -MeasureUnit MeasureUnit::getMegaliter() { +MeasureUnit MeasureUnit::getGallon() { return MeasureUnit(22, 20); } -MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) { +MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) { return MeasureUnit::create(22, 21, status); } -MeasureUnit MeasureUnit::getMilliliter() { +MeasureUnit MeasureUnit::getGallonImperial() { return MeasureUnit(22, 21); } -MeasureUnit *MeasureUnit::createPint(UErrorCode &status) { +MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) { return MeasureUnit::create(22, 22, status); } -MeasureUnit MeasureUnit::getPint() { +MeasureUnit MeasureUnit::getHectoliter() { return MeasureUnit(22, 22); } -MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) { +MeasureUnit *MeasureUnit::createJigger(UErrorCode &status) { return MeasureUnit::create(22, 23, status); } -MeasureUnit MeasureUnit::getPintMetric() { +MeasureUnit MeasureUnit::getJigger() { return MeasureUnit(22, 23); } -MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) { +MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) { return MeasureUnit::create(22, 24, status); } -MeasureUnit MeasureUnit::getQuart() { +MeasureUnit MeasureUnit::getLiter() { return MeasureUnit(22, 24); } -MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) { return MeasureUnit::create(22, 25, status); } -MeasureUnit MeasureUnit::getTablespoon() { +MeasureUnit MeasureUnit::getMegaliter() { return MeasureUnit(22, 25); } -MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) { +MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) { return MeasureUnit::create(22, 26, status); } -MeasureUnit MeasureUnit::getTeaspoon() { +MeasureUnit MeasureUnit::getMilliliter() { return MeasureUnit(22, 26); } -// End generated code +MeasureUnit *MeasureUnit::createPinch(UErrorCode &status) { + return MeasureUnit::create(22, 27, status); +} + +MeasureUnit MeasureUnit::getPinch() { + return MeasureUnit(22, 27); +} + +MeasureUnit *MeasureUnit::createPint(UErrorCode &status) { + return MeasureUnit::create(22, 28, status); +} + +MeasureUnit MeasureUnit::getPint() { + return MeasureUnit(22, 28); +} + +MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) { + return MeasureUnit::create(22, 29, status); +} + +MeasureUnit MeasureUnit::getPintMetric() { + return MeasureUnit(22, 29); +} + +MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) { + return MeasureUnit::create(22, 30, status); +} + +MeasureUnit MeasureUnit::getQuart() { + return MeasureUnit(22, 30); +} + +MeasureUnit *MeasureUnit::createQuartImperial(UErrorCode &status) { + return MeasureUnit::create(22, 31, status); +} + +MeasureUnit MeasureUnit::getQuartImperial() { + return MeasureUnit(22, 31); +} + +MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) { + return MeasureUnit::create(22, 32, status); +} + +MeasureUnit MeasureUnit::getTablespoon() { + return MeasureUnit(22, 32); +} + +MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) { + return MeasureUnit::create(22, 33, status); +} + +MeasureUnit MeasureUnit::getTeaspoon() { + return MeasureUnit(22, 33); +} + +// End generated code for measunit.cpp static int32_t binarySearch( - const char * const * array, int32_t start, int32_t end, const char * key) { + const char * const * array, int32_t start, int32_t end, StringPiece key) { while (start < end) { int32_t mid = (start + end) / 2; - int32_t cmp = uprv_strcmp(array[mid], key); + int32_t cmp = StringPiece(array[mid]).compare(key); if (cmp < 0) { start = mid + 1; continue; @@ -2006,24 +2139,66 @@ static int32_t binarySearch( return -1; } -MeasureUnit::MeasureUnit() { - fCurrency[0] = 0; - fTypeId = kBaseTypeIdx; - fSubTypeId = kBaseSubTypeIdx; +MeasureUnit::MeasureUnit() : MeasureUnit(kBaseTypeIdx, kBaseSubTypeIdx) { +} + +MeasureUnit::MeasureUnit(int32_t typeId, int32_t subTypeId) + : fImpl(nullptr), fSubTypeId(subTypeId), fTypeId(typeId) { } MeasureUnit::MeasureUnit(const MeasureUnit &other) - : fTypeId(other.fTypeId), fSubTypeId(other.fSubTypeId) { - uprv_strcpy(fCurrency, other.fCurrency); + : fImpl(nullptr) { + *this = other; +} + +MeasureUnit::MeasureUnit(MeasureUnit &&other) noexcept + : fImpl(other.fImpl), + fSubTypeId(other.fSubTypeId), + fTypeId(other.fTypeId) { + other.fImpl = nullptr; +} + +MeasureUnit::MeasureUnit(MeasureUnitImpl&& impl) + : fImpl(nullptr), fSubTypeId(-1), fTypeId(-1) { + if (!findBySubType(impl.identifier.toStringPiece(), this)) { + fImpl = new MeasureUnitImpl(std::move(impl)); + } } MeasureUnit &MeasureUnit::operator=(const MeasureUnit &other) { if (this == &other) { return *this; } + if (fImpl != nullptr) { + delete fImpl; + } + if (other.fImpl) { + ErrorCode localStatus; + fImpl = new MeasureUnitImpl(other.fImpl->copy(localStatus)); + if (!fImpl || localStatus.isFailure()) { + // Unrecoverable allocation error; set to the default unit + *this = MeasureUnit(); + return *this; + } + } else { + fImpl = nullptr; + } + fTypeId = other.fTypeId; + fSubTypeId = other.fSubTypeId; + return *this; +} + +MeasureUnit &MeasureUnit::operator=(MeasureUnit &&other) noexcept { + if (this == &other) { + return *this; + } + if (fImpl != nullptr) { + delete fImpl; + } + fImpl = other.fImpl; + other.fImpl = nullptr; fTypeId = other.fTypeId; fSubTypeId = other.fSubTypeId; - uprv_strcpy(fCurrency, other.fCurrency); return *this; } @@ -2032,32 +2207,41 @@ MeasureUnit *MeasureUnit::clone() const { } MeasureUnit::~MeasureUnit() { + if (fImpl != nullptr) { + delete fImpl; + fImpl = nullptr; + } } const char *MeasureUnit::getType() const { + // We have a type & subtype only if fTypeId is present. + if (fTypeId == -1) { + return ""; + } return gTypes[fTypeId]; } const char *MeasureUnit::getSubtype() const { - return fCurrency[0] == 0 ? gSubTypes[getOffset()] : fCurrency; + // We have a type & subtype only if fTypeId is present. + if (fTypeId == -1) { + return ""; + } + return getIdentifier(); +} + +const char *MeasureUnit::getIdentifier() const { + return fImpl ? fImpl->identifier.data() : gSubTypes[getOffset()]; } bool MeasureUnit::operator==(const UObject& other) const { if (this == &other) { // Same object, equal - return TRUE; + return true; } if (typeid(*this) != typeid(other)) { // Different types, not equal - return FALSE; + return false; } const MeasureUnit &rhs = static_cast(other); - return ( - fTypeId == rhs.fTypeId - && fSubTypeId == rhs.fSubTypeId - && uprv_strcmp(fCurrency, rhs.fCurrency) == 0); -} - -int32_t MeasureUnit::getIndex() const { - return gIndexes[fTypeId] + fSubTypeId; + return uprv_strcmp(getIdentifier(), rhs.getIdentifier()) == 0; } int32_t MeasureUnit::getAvailable( @@ -2111,70 +2295,42 @@ StringEnumeration* MeasureUnit::getAvailableTypes(UErrorCode &errorCode) { gTypes, UPRV_LENGTHOF(gTypes), &errorCode); if (U_FAILURE(errorCode)) { uenum_close(uenum); - return NULL; + return nullptr; } StringEnumeration *result = new UStringEnumeration(uenum); - if (result == NULL) { + if (result == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; uenum_close(uenum); - return NULL; + return nullptr; } return result; } -int32_t MeasureUnit::getIndexCount() { - return gIndexes[UPRV_LENGTHOF(gIndexes) - 1]; -} - -int32_t MeasureUnit::internalGetIndexForTypeAndSubtype(const char *type, const char *subtype) { - int32_t t = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), type); - if (t < 0) { - return t; - } - int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subtype); - if (st < 0) { - return st; - } - return gIndexes[t] + st - gOffsets[t]; -} - -MeasureUnit MeasureUnit::resolveUnitPerUnit( - const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved) { - int32_t unitOffset = unit.getOffset(); - int32_t perUnitOffset = perUnit.getOffset(); +bool MeasureUnit::findBySubType(StringPiece subType, MeasureUnit* output) { + // Sanity checking kCurrencyOffset and final entry in gOffsets + U_ASSERT(uprv_strcmp(gTypes[kCurrencyOffset], "currency") == 0); + U_ASSERT(gOffsets[UPRV_LENGTHOF(gOffsets) - 1] == UPRV_LENGTHOF(gSubTypes)); - // binary search for (unitOffset, perUnitOffset) - int32_t start = 0; - int32_t end = UPRV_LENGTHOF(unitPerUnitToSingleUnit); - while (start < end) { - int32_t mid = (start + end) / 2; - int32_t *midRow = unitPerUnitToSingleUnit[mid]; - if (unitOffset < midRow[0]) { - end = mid; - } else if (unitOffset > midRow[0]) { - start = mid + 1; - } else if (perUnitOffset < midRow[1]) { - end = mid; - } else if (perUnitOffset > midRow[1]) { - start = mid + 1; - } else { - // We found a resolution for our unit / per-unit combo - // return it. - *isResolved = true; - return MeasureUnit(midRow[2], midRow[3]); + for (int32_t t = 0; t < UPRV_LENGTHOF(gOffsets) - 1; t++) { + // Skip currency units + if (t == kCurrencyOffset) { + continue; + } + int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subType); + if (st >= 0) { + output->setTo(t, st - gOffsets[t]); + return true; } } - - *isResolved = false; - return MeasureUnit(); + return false; } MeasureUnit *MeasureUnit::create(int typeId, int subTypeId, UErrorCode &status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } MeasureUnit *result = new MeasureUnit(typeId, subTypeId); - if (result == NULL) { + if (result == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } return result; @@ -2186,42 +2342,59 @@ void MeasureUnit::initTime(const char *timeId) { fTypeId = result; result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], timeId); U_ASSERT(result != -1); - fSubTypeId = result - gOffsets[fTypeId]; + fSubTypeId = result - gOffsets[fTypeId]; } -void MeasureUnit::initCurrency(const char *isoCurrency) { +void MeasureUnit::initCurrency(StringPiece isoCurrency) { int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "currency"); U_ASSERT(result != -1); fTypeId = result; result = binarySearch( gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], isoCurrency); - if (result != -1) { - fSubTypeId = result - gOffsets[fTypeId]; - } else { - uprv_strncpy(fCurrency, isoCurrency, UPRV_LENGTHOF(fCurrency)); - fCurrency[3] = 0; + if (result == -1) { + fImpl = new MeasureUnitImpl(MeasureUnitImpl::forCurrencyCode(isoCurrency)); + if (fImpl) { + fSubTypeId = -1; + return; + } + // malloc error: fall back to the undefined currency + result = binarySearch( + gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], kDefaultCurrency8); + U_ASSERT(result != -1); } -} - -void MeasureUnit::initNoUnit(const char *subtype) { - int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "none"); - U_ASSERT(result != -1); - fTypeId = result; - result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], subtype); - U_ASSERT(result != -1); fSubTypeId = result - gOffsets[fTypeId]; } void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) { fTypeId = typeId; fSubTypeId = subTypeId; - fCurrency[0] = 0; + if (fImpl != nullptr) { + delete fImpl; + fImpl = nullptr; + } } int32_t MeasureUnit::getOffset() const { + if (fTypeId < 0 || fSubTypeId < 0) { + return -1; + } return gOffsets[fTypeId] + fSubTypeId; } +MeasureUnitImpl MeasureUnitImpl::copy(UErrorCode &status) const { + MeasureUnitImpl result; + result.complexity = complexity; + result.identifier.append(identifier, status); + for (int32_t i = 0; i < singleUnits.length(); i++) { + SingleUnitImpl *item = result.singleUnits.emplaceBack(*singleUnits[i]); + if (!item) { + status = U_MEMORY_ALLOCATION_ERROR; + return result; + } + } + return result; +} + U_NAMESPACE_END #endif /* !UNCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/measunit_extra.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/measunit_extra.cpp new file mode 100644 index 000000000..295d6a8ce --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/measunit_extra.cpp @@ -0,0 +1,1260 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// Extra functions for MeasureUnit not needed for all clients. +// Separate .o file so that it can be removed for modularity. + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +// Allow implicit conversion from char16_t* to UnicodeString for this file: +// Helpful in toString methods and elsewhere. +#define UNISTR_FROM_STRING_EXPLICIT + +#include "charstr.h" +#include "cmemory.h" +#include "cstring.h" +#include "measunit_impl.h" +#include "resource.h" +#include "uarrsort.h" +#include "uassert.h" +#include "ucln_in.h" +#include "umutex.h" +#include "unicode/bytestrie.h" +#include "unicode/bytestriebuilder.h" +#include "unicode/localpointer.h" +#include "unicode/stringpiece.h" +#include "unicode/stringtriebuilder.h" +#include "unicode/ures.h" +#include "unicode/ustringtrie.h" +#include "uresimp.h" +#include "util.h" +#include + +U_NAMESPACE_BEGIN + + +namespace { + +// TODO: Propose a new error code for this? +constexpr UErrorCode kUnitIdentifierSyntaxError = U_ILLEGAL_ARGUMENT_ERROR; + +// Trie value offset for SI or binary prefixes. This is big enough to ensure we only +// insert positive integers into the trie. +constexpr int32_t kPrefixOffset = 64; +static_assert(kPrefixOffset + UMEASURE_PREFIX_INTERNAL_MIN_BIN > 0, + "kPrefixOffset is too small for minimum UMeasurePrefix value"); +static_assert(kPrefixOffset + UMEASURE_PREFIX_INTERNAL_MIN_SI > 0, + "kPrefixOffset is too small for minimum UMeasurePrefix value"); + +// Trie value offset for compound parts, e.g. "-per-", "-", "-and-". +constexpr int32_t kCompoundPartOffset = 128; +static_assert(kCompoundPartOffset > kPrefixOffset + UMEASURE_PREFIX_INTERNAL_MAX_BIN, + "Ambiguous token values: prefix tokens are overlapping with CompoundPart tokens"); +static_assert(kCompoundPartOffset > kPrefixOffset + UMEASURE_PREFIX_INTERNAL_MAX_SI, + "Ambiguous token values: prefix tokens are overlapping with CompoundPart tokens"); + +enum CompoundPart { + // Represents "-per-" + COMPOUND_PART_PER = kCompoundPartOffset, + // Represents "-" + COMPOUND_PART_TIMES, + // Represents "-and-" + COMPOUND_PART_AND, +}; + +// Trie value offset for "per-". +constexpr int32_t kInitialCompoundPartOffset = 192; + +enum InitialCompoundPart { + // Represents "per-", the only compound part that can appear at the start of + // an identifier. + INITIAL_COMPOUND_PART_PER = kInitialCompoundPartOffset, +}; + +// Trie value offset for powers like "square-", "cubic-", "pow2-" etc. +constexpr int32_t kPowerPartOffset = 256; + +enum PowerPart { + POWER_PART_P2 = kPowerPartOffset + 2, + POWER_PART_P3, + POWER_PART_P4, + POWER_PART_P5, + POWER_PART_P6, + POWER_PART_P7, + POWER_PART_P8, + POWER_PART_P9, + POWER_PART_P10, + POWER_PART_P11, + POWER_PART_P12, + POWER_PART_P13, + POWER_PART_P14, + POWER_PART_P15, +}; + +// Trie value offset for simple units, e.g. "gram", "nautical-mile", +// "fluid-ounce-imperial". +constexpr int32_t kSimpleUnitOffset = 512; + +const struct UnitPrefixStrings { + const char* const string; + UMeasurePrefix value; +} gUnitPrefixStrings[] = { + // SI prefixes + { "yotta", UMEASURE_PREFIX_YOTTA }, + { "zetta", UMEASURE_PREFIX_ZETTA }, + { "exa", UMEASURE_PREFIX_EXA }, + { "peta", UMEASURE_PREFIX_PETA }, + { "tera", UMEASURE_PREFIX_TERA }, + { "giga", UMEASURE_PREFIX_GIGA }, + { "mega", UMEASURE_PREFIX_MEGA }, + { "kilo", UMEASURE_PREFIX_KILO }, + { "hecto", UMEASURE_PREFIX_HECTO }, + { "deka", UMEASURE_PREFIX_DEKA }, + { "deci", UMEASURE_PREFIX_DECI }, + { "centi", UMEASURE_PREFIX_CENTI }, + { "milli", UMEASURE_PREFIX_MILLI }, + { "micro", UMEASURE_PREFIX_MICRO }, + { "nano", UMEASURE_PREFIX_NANO }, + { "pico", UMEASURE_PREFIX_PICO }, + { "femto", UMEASURE_PREFIX_FEMTO }, + { "atto", UMEASURE_PREFIX_ATTO }, + { "zepto", UMEASURE_PREFIX_ZEPTO }, + { "yocto", UMEASURE_PREFIX_YOCTO }, + // Binary prefixes + { "yobi", UMEASURE_PREFIX_YOBI }, + { "zebi", UMEASURE_PREFIX_ZEBI }, + { "exbi", UMEASURE_PREFIX_EXBI }, + { "pebi", UMEASURE_PREFIX_PEBI }, + { "tebi", UMEASURE_PREFIX_TEBI }, + { "gibi", UMEASURE_PREFIX_GIBI }, + { "mebi", UMEASURE_PREFIX_MEBI }, + { "kibi", UMEASURE_PREFIX_KIBI }, +}; + +/** + * A ResourceSink that collects simple unit identifiers from the keys of the + * convertUnits table into an array, and adds these values to a TrieBuilder, + * with associated values being their index into this array plus a specified + * offset. + * + * Example code: + * + * UErrorCode status = U_ZERO_ERROR; + * BytesTrieBuilder b(status); + * int32_t ARR_SIZE = 200; + * const char *unitIdentifiers[ARR_SIZE]; + * int32_t *unitCategories[ARR_SIZE]; + * SimpleUnitIdentifiersSink identifierSink(gSerializedUnitCategoriesTrie, unitIdentifiers, + * unitCategories, ARR_SIZE, b, kTrieValueOffset); + * LocalUResourceBundlePointer unitsBundle(ures_openDirect(nullptr, "units", &status)); + * ures_getAllItemsWithFallback(unitsBundle.getAlias(), "convertUnits", identifierSink, status); + */ +class SimpleUnitIdentifiersSink : public icu::ResourceSink { + public: + /** + * Constructor. + * @param quantitiesTrieData The data for constructing a quantitiesTrie, + * which maps from a simple unit identifier to an index into the + * gCategories array. + * @param out Array of char* to which pointers to the simple unit + * identifiers will be saved. (Does not take ownership.) + * @param outCategories Array of int32_t to which category indexes will be + * saved: this corresponds to simple unit IDs saved to `out`, mapping + * from the ID to the value produced by the quantitiesTrie (which is an + * index into the gCategories array). + * @param outSize The size of `out` and `outCategories`. + * @param trieBuilder The trie builder to which the simple unit identifier + * should be added. The trie builder must outlive this resource sink. + * @param trieValueOffset This is added to the index of the identifier in + * the `out` array, before adding to `trieBuilder` as the value + * associated with the identifier. + */ + explicit SimpleUnitIdentifiersSink(StringPiece quantitiesTrieData, const char **out, + int32_t *outCategories, int32_t outSize, + BytesTrieBuilder &trieBuilder, int32_t trieValueOffset) + : outArray(out), outCategories(outCategories), outSize(outSize), trieBuilder(trieBuilder), + trieValueOffset(trieValueOffset), quantitiesTrieData(quantitiesTrieData), outIndex(0) {} + + /** + * Adds the table keys found in value to the output vector. + * @param key The key of the resource passed to `value`: the second + * parameter of the ures_getAllItemsWithFallback() call. + * @param value Should be a ResourceTable value, if + * ures_getAllItemsWithFallback() was called correctly for this sink. + * @param noFallback Ignored. + * @param status The standard ICU error code output parameter. + */ + void put(const char * /*key*/, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) override { + ResourceTable table = value.getTable(status); + if (U_FAILURE(status)) return; + + if (outIndex + table.getSize() > outSize) { + status = U_INDEX_OUTOFBOUNDS_ERROR; + return; + } + + BytesTrie quantitiesTrie(quantitiesTrieData.data()); + + // Collect keys from the table resource. + const char *simpleUnitID; + for (int32_t i = 0; table.getKeyAndValue(i, simpleUnitID, value); ++i) { + U_ASSERT(i < table.getSize()); + U_ASSERT(outIndex < outSize); + if (uprv_strcmp(simpleUnitID, "kilogram") == 0) { + // For parsing, we use "gram", the prefixless metric mass unit. We + // thus ignore the SI Base Unit of Mass: it exists due to being the + // mass conversion target unit, but not needed for MeasureUnit + // parsing. + continue; + } + outArray[outIndex] = simpleUnitID; + trieBuilder.add(simpleUnitID, trieValueOffset + outIndex, status); + + // Find the base target unit for this simple unit + ResourceTable table = value.getTable(status); + if (U_FAILURE(status)) { return; } + if (!table.findValue("target", value)) { + status = U_INVALID_FORMAT_ERROR; + break; + } + int32_t len; + const char16_t* uTarget = value.getString(len, status); + CharString target; + target.appendInvariantChars(uTarget, len, status); + if (U_FAILURE(status)) { return; } + quantitiesTrie.reset(); + UStringTrieResult result = quantitiesTrie.next(target.data(), target.length()); + if (!USTRINGTRIE_HAS_VALUE(result)) { + status = U_INVALID_FORMAT_ERROR; + break; + } + outCategories[outIndex] = quantitiesTrie.getValue(); + + outIndex++; + } + } + + private: + const char **outArray; + int32_t *outCategories; + int32_t outSize; + BytesTrieBuilder &trieBuilder; + int32_t trieValueOffset; + + StringPiece quantitiesTrieData; + + int32_t outIndex; +}; + +/** + * A ResourceSink that collects information from `unitQuantities` in the `units` + * resource to provide key->value lookups from base unit to category, as well as + * preserving ordering information for these categories. See `units.txt`. + * + * For example: "kilogram" -> "mass", "meter-per-second" -> "speed". + * + * In C++ unitQuantity values are collected in order into a char16_t* array, while + * unitQuantity keys are added added to a TrieBuilder, with associated values + * being the index into the aforementioned char16_t* array. + */ +class CategoriesSink : public icu::ResourceSink { + public: + /** + * Constructor. + * @param out Array of char16_t* to which unitQuantity values will be saved. + * The pointers returned not owned: they point directly at the resource + * strings in static memory. + * @param outSize The size of the `out` array. + * @param trieBuilder The trie builder to which the keys (base units) of + * each unitQuantity will be added, each with value being the offset + * into `out`. + */ + explicit CategoriesSink(const char16_t **out, int32_t &outSize, BytesTrieBuilder &trieBuilder) + : outQuantitiesArray(out), outSize(outSize), trieBuilder(trieBuilder), outIndex(0) {} + + void put(const char * /*key*/, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) override { + ResourceArray array = value.getArray(status); + if (U_FAILURE(status)) { + return; + } + + if (outIndex + array.getSize() > outSize) { + status = U_INDEX_OUTOFBOUNDS_ERROR; + return; + } + + for (int32_t i = 0; array.getValue(i, value); ++i) { + U_ASSERT(outIndex < outSize); + ResourceTable table = value.getTable(status); + if (U_FAILURE(status)) { + return; + } + if (table.getSize() != 1) { + status = U_INVALID_FORMAT_ERROR; + return; + } + const char *key; + table.getKeyAndValue(0, key, value); + int32_t uTmpLen; + outQuantitiesArray[outIndex] = value.getString(uTmpLen, status); + trieBuilder.add(key, outIndex, status); + outIndex++; + } + } + + private: + const char16_t **outQuantitiesArray; + int32_t &outSize; + BytesTrieBuilder &trieBuilder; + + int32_t outIndex; +}; + +icu::UInitOnce gUnitExtrasInitOnce {}; + +// Array of simple unit IDs. +// +// The array memory itself is owned by this pointer, but the individual char* in +// that array point at static memory. (Note that these char* are also returned +// by SingleUnitImpl::getSimpleUnitID().) +const char **gSimpleUnits = nullptr; + +// Maps from the value associated with each simple unit ID to an index into the +// gCategories array. +int32_t *gSimpleUnitCategories = nullptr; + +char *gSerializedUnitExtrasStemTrie = nullptr; + +// Array of char16_t* pointing at the unit categories (aka "quantities", aka +// "types"), as found in the `unitQuantities` resource. The array memory itself +// is owned by this pointer, but the individual char16_t* in that array point at +// static memory. +const char16_t **gCategories = nullptr; +// Number of items in `gCategories`. +int32_t gCategoriesCount = 0; +// Serialized BytesTrie for mapping from base units to indices into gCategories. +char *gSerializedUnitCategoriesTrie = nullptr; + +UBool U_CALLCONV cleanupUnitExtras() { + uprv_free(gSerializedUnitCategoriesTrie); + gSerializedUnitCategoriesTrie = nullptr; + uprv_free(gCategories); + gCategories = nullptr; + uprv_free(gSerializedUnitExtrasStemTrie); + gSerializedUnitExtrasStemTrie = nullptr; + uprv_free(gSimpleUnitCategories); + gSimpleUnitCategories = nullptr; + uprv_free(gSimpleUnits); + gSimpleUnits = nullptr; + gUnitExtrasInitOnce.reset(); + return true; +} + +void U_CALLCONV initUnitExtras(UErrorCode& status) { + ucln_i18n_registerCleanup(UCLN_I18N_UNIT_EXTRAS, cleanupUnitExtras); + LocalUResourceBundlePointer unitsBundle(ures_openDirect(nullptr, "units", &status)); + + // Collect unitQuantities information into gSerializedUnitCategoriesTrie and gCategories. + const char *CATEGORY_TABLE_NAME = "unitQuantities"; + LocalUResourceBundlePointer unitQuantities( + ures_getByKey(unitsBundle.getAlias(), CATEGORY_TABLE_NAME, nullptr, &status)); + if (U_FAILURE(status)) { return; } + gCategoriesCount = unitQuantities.getAlias()->fSize; + size_t quantitiesMallocSize = sizeof(char16_t *) * gCategoriesCount; + gCategories = static_cast(uprv_malloc(quantitiesMallocSize)); + if (gCategories == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memset(gCategories, 0, quantitiesMallocSize); + BytesTrieBuilder quantitiesBuilder(status); + CategoriesSink categoriesSink(gCategories, gCategoriesCount, quantitiesBuilder); + ures_getAllItemsWithFallback(unitsBundle.getAlias(), CATEGORY_TABLE_NAME, categoriesSink, status); + StringPiece resultQuantities = quantitiesBuilder.buildStringPiece(USTRINGTRIE_BUILD_FAST, status); + if (U_FAILURE(status)) { return; } + // Copy the result into the global constant pointer + size_t numBytesQuantities = resultQuantities.length(); + gSerializedUnitCategoriesTrie = static_cast(uprv_malloc(numBytesQuantities)); + if (gSerializedUnitCategoriesTrie == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memcpy(gSerializedUnitCategoriesTrie, resultQuantities.data(), numBytesQuantities); + + // Build the BytesTrie that Parser needs for parsing unit identifiers. + + BytesTrieBuilder b(status); + if (U_FAILURE(status)) { return; } + + // Add SI and binary prefixes + for (const auto& unitPrefixInfo : gUnitPrefixStrings) { + b.add(unitPrefixInfo.string, unitPrefixInfo.value + kPrefixOffset, status); + } + if (U_FAILURE(status)) { return; } + + // Add syntax parts (compound, power prefixes) + b.add("-per-", COMPOUND_PART_PER, status); + b.add("-", COMPOUND_PART_TIMES, status); + b.add("-and-", COMPOUND_PART_AND, status); + b.add("per-", INITIAL_COMPOUND_PART_PER, status); + b.add("square-", POWER_PART_P2, status); + b.add("cubic-", POWER_PART_P3, status); + b.add("pow2-", POWER_PART_P2, status); + b.add("pow3-", POWER_PART_P3, status); + b.add("pow4-", POWER_PART_P4, status); + b.add("pow5-", POWER_PART_P5, status); + b.add("pow6-", POWER_PART_P6, status); + b.add("pow7-", POWER_PART_P7, status); + b.add("pow8-", POWER_PART_P8, status); + b.add("pow9-", POWER_PART_P9, status); + b.add("pow10-", POWER_PART_P10, status); + b.add("pow11-", POWER_PART_P11, status); + b.add("pow12-", POWER_PART_P12, status); + b.add("pow13-", POWER_PART_P13, status); + b.add("pow14-", POWER_PART_P14, status); + b.add("pow15-", POWER_PART_P15, status); + if (U_FAILURE(status)) { return; } + + // Add sanctioned simple units by offset: simple units all have entries in + // units/convertUnits resources. + LocalUResourceBundlePointer convertUnits( + ures_getByKey(unitsBundle.getAlias(), "convertUnits", nullptr, &status)); + if (U_FAILURE(status)) { return; } + + // Allocate enough space: with identifierSink below skipping kilogram, we're + // probably allocating one more than needed. + int32_t simpleUnitsCount = convertUnits.getAlias()->fSize; + int32_t arrayMallocSize = sizeof(char *) * simpleUnitsCount; + gSimpleUnits = static_cast(uprv_malloc(arrayMallocSize)); + if (gSimpleUnits == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memset(gSimpleUnits, 0, arrayMallocSize); + arrayMallocSize = sizeof(int32_t) * simpleUnitsCount; + gSimpleUnitCategories = static_cast(uprv_malloc(arrayMallocSize)); + if (gSimpleUnitCategories == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memset(gSimpleUnitCategories, 0, arrayMallocSize); + + // Populate gSimpleUnits and build the associated trie. + SimpleUnitIdentifiersSink identifierSink(resultQuantities, gSimpleUnits, gSimpleUnitCategories, + simpleUnitsCount, b, kSimpleUnitOffset); + ures_getAllItemsWithFallback(unitsBundle.getAlias(), "convertUnits", identifierSink, status); + + // Build the CharsTrie + // TODO: Use SLOW or FAST here? + StringPiece result = b.buildStringPiece(USTRINGTRIE_BUILD_FAST, status); + if (U_FAILURE(status)) { return; } + + // Copy the result into the global constant pointer + size_t numBytes = result.length(); + gSerializedUnitExtrasStemTrie = static_cast(uprv_malloc(numBytes)); + if (gSerializedUnitExtrasStemTrie == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + uprv_memcpy(gSerializedUnitExtrasStemTrie, result.data(), numBytes); +} + +class Token { +public: + Token(int32_t match) : fMatch(match) {} + + enum Type { + TYPE_UNDEFINED, + TYPE_PREFIX, + // Token type for "-per-", "-", and "-and-". + TYPE_COMPOUND_PART, + // Token type for "per-". + TYPE_INITIAL_COMPOUND_PART, + TYPE_POWER_PART, + TYPE_SIMPLE_UNIT, + }; + + // Calling getType() is invalid, resulting in an assertion failure, if Token + // value isn't positive. + Type getType() const { + U_ASSERT(fMatch > 0); + if (fMatch < kCompoundPartOffset) { + return TYPE_PREFIX; + } + if (fMatch < kInitialCompoundPartOffset) { + return TYPE_COMPOUND_PART; + } + if (fMatch < kPowerPartOffset) { + return TYPE_INITIAL_COMPOUND_PART; + } + if (fMatch < kSimpleUnitOffset) { + return TYPE_POWER_PART; + } + return TYPE_SIMPLE_UNIT; + } + + UMeasurePrefix getUnitPrefix() const { + U_ASSERT(getType() == TYPE_PREFIX); + return static_cast(fMatch - kPrefixOffset); + } + + // Valid only for tokens with type TYPE_COMPOUND_PART. + int32_t getMatch() const { + U_ASSERT(getType() == TYPE_COMPOUND_PART); + return fMatch; + } + + int32_t getInitialCompoundPart() const { + // Even if there is only one InitialCompoundPart value, we have this + // function for the simplicity of code consistency. + U_ASSERT(getType() == TYPE_INITIAL_COMPOUND_PART); + // Defensive: if this assert fails, code using this function also needs + // to change. + U_ASSERT(fMatch == INITIAL_COMPOUND_PART_PER); + return fMatch; + } + + int8_t getPower() const { + U_ASSERT(getType() == TYPE_POWER_PART); + return static_cast(fMatch - kPowerPartOffset); + } + + int32_t getSimpleUnitIndex() const { + U_ASSERT(getType() == TYPE_SIMPLE_UNIT); + return fMatch - kSimpleUnitOffset; + } + +private: + int32_t fMatch; +}; + +class Parser { +public: + /** + * Factory function for parsing the given identifier. + * + * @param source The identifier to parse. This function does not make a copy + * of source: the underlying string that source points at, must outlive the + * parser. + * @param status ICU error code. + */ + static Parser from(StringPiece source, UErrorCode& status) { + if (U_FAILURE(status)) { + return Parser(); + } + umtx_initOnce(gUnitExtrasInitOnce, &initUnitExtras, status); + if (U_FAILURE(status)) { + return Parser(); + } + return Parser(source); + } + + MeasureUnitImpl parse(UErrorCode& status) { + MeasureUnitImpl result; + + if (U_FAILURE(status)) { + return result; + } + if (fSource.empty()) { + // The dimenionless unit: nothing to parse. leave result as is. + return result; + } + + while (hasNext()) { + bool sawAnd = false; + + SingleUnitImpl singleUnit = nextSingleUnit(sawAnd, status); + if (U_FAILURE(status)) { + return result; + } + + bool added = result.appendSingleUnit(singleUnit, status); + if (U_FAILURE(status)) { + return result; + } + + if (sawAnd && !added) { + // Two similar units are not allowed in a mixed unit. + status = kUnitIdentifierSyntaxError; + return result; + } + + if (result.singleUnits.length() >= 2) { + // nextSingleUnit fails appropriately for "per" and "and" in the + // same identifier. It doesn't fail for other compound units + // (COMPOUND_PART_TIMES). Consequently we take care of that + // here. + UMeasureUnitComplexity complexity = + sawAnd ? UMEASURE_UNIT_MIXED : UMEASURE_UNIT_COMPOUND; + if (result.singleUnits.length() == 2) { + // After appending two singleUnits, the complexity will be `UMEASURE_UNIT_COMPOUND` + U_ASSERT(result.complexity == UMEASURE_UNIT_COMPOUND); + result.complexity = complexity; + } else if (result.complexity != complexity) { + // Can't have mixed compound units + status = kUnitIdentifierSyntaxError; + return result; + } + } + } + + return result; + } + +private: + // Tracks parser progress: the offset into fSource. + int32_t fIndex = 0; + + // Since we're not owning this memory, whatever is passed to the constructor + // should live longer than this Parser - and the parser shouldn't return any + // references to that string. + StringPiece fSource; + BytesTrie fTrie; + + // Set to true when we've seen a "-per-" or a "per-", after which all units + // are in the denominator. Until we find an "-and-", at which point the + // identifier is invalid pending TODO(CLDR-13701). + bool fAfterPer = false; + + Parser() : fSource(""), fTrie(u"") {} + + Parser(StringPiece source) + : fSource(source), fTrie(gSerializedUnitExtrasStemTrie) {} + + inline bool hasNext() const { + return fIndex < fSource.length(); + } + + // Returns the next Token parsed from fSource, advancing fIndex to the end + // of that token in fSource. In case of U_FAILURE(status), the token + // returned will cause an abort if getType() is called on it. + Token nextToken(UErrorCode& status) { + fTrie.reset(); + int32_t match = -1; + // Saves the position in the fSource string for the end of the most + // recent matching token. + int32_t previ = -1; + // Find the longest token that matches a value in the trie: + while (fIndex < fSource.length()) { + auto result = fTrie.next(fSource.data()[fIndex++]); + if (result == USTRINGTRIE_NO_MATCH) { + break; + } else if (result == USTRINGTRIE_NO_VALUE) { + continue; + } + U_ASSERT(USTRINGTRIE_HAS_VALUE(result)); + match = fTrie.getValue(); + previ = fIndex; + if (result == USTRINGTRIE_FINAL_VALUE) { + break; + } + U_ASSERT(result == USTRINGTRIE_INTERMEDIATE_VALUE); + // continue; + } + + if (match < 0) { + status = kUnitIdentifierSyntaxError; + } else { + fIndex = previ; + } + return Token(match); + } + + /** + * Returns the next "single unit" via result. + * + * If a "-per-" was parsed, the result will have appropriate negative + * dimensionality. + * + * Returns an error if we parse both compound units and "-and-", since mixed + * compound units are not yet supported - TODO(CLDR-13701). + * + * @param result Will be overwritten by the result, if status shows success. + * @param sawAnd If an "-and-" was parsed prior to finding the "single + * unit", sawAnd is set to true. If not, it is left as is. + * @param status ICU error code. + */ + SingleUnitImpl nextSingleUnit(bool &sawAnd, UErrorCode &status) { + SingleUnitImpl result; + if (U_FAILURE(status)) { + return result; + } + + // state: + // 0 = no tokens seen yet (will accept power, SI or binary prefix, or simple unit) + // 1 = power token seen (will not accept another power token) + // 2 = SI or binary prefix token seen (will not accept a power, or SI or binary prefix token) + int32_t state = 0; + + bool atStart = fIndex == 0; + Token token = nextToken(status); + if (U_FAILURE(status)) { + return result; + } + + if (atStart) { + // Identifiers optionally start with "per-". + if (token.getType() == Token::TYPE_INITIAL_COMPOUND_PART) { + U_ASSERT(token.getInitialCompoundPart() == INITIAL_COMPOUND_PART_PER); + fAfterPer = true; + result.dimensionality = -1; + + token = nextToken(status); + if (U_FAILURE(status)) { + return result; + } + } + } else { + // All other SingleUnit's are separated from previous SingleUnit's + // via a compound part: + if (token.getType() != Token::TYPE_COMPOUND_PART) { + status = kUnitIdentifierSyntaxError; + return result; + } + + switch (token.getMatch()) { + case COMPOUND_PART_PER: + if (sawAnd) { + // Mixed compound units not yet supported, + // TODO(CLDR-13701). + status = kUnitIdentifierSyntaxError; + return result; + } + fAfterPer = true; + result.dimensionality = -1; + break; + + case COMPOUND_PART_TIMES: + if (fAfterPer) { + result.dimensionality = -1; + } + break; + + case COMPOUND_PART_AND: + if (fAfterPer) { + // Can't start with "-and-", and mixed compound units + // not yet supported, TODO(CLDR-13701). + status = kUnitIdentifierSyntaxError; + return result; + } + sawAnd = true; + break; + } + + token = nextToken(status); + if (U_FAILURE(status)) { + return result; + } + } + + // Read tokens until we have a complete SingleUnit or we reach the end. + while (true) { + switch (token.getType()) { + case Token::TYPE_POWER_PART: + if (state > 0) { + status = kUnitIdentifierSyntaxError; + return result; + } + result.dimensionality *= token.getPower(); + state = 1; + break; + + case Token::TYPE_PREFIX: + if (state > 1) { + status = kUnitIdentifierSyntaxError; + return result; + } + result.unitPrefix = token.getUnitPrefix(); + state = 2; + break; + + case Token::TYPE_SIMPLE_UNIT: + result.index = token.getSimpleUnitIndex(); + return result; + + default: + status = kUnitIdentifierSyntaxError; + return result; + } + + if (!hasNext()) { + // We ran out of tokens before finding a complete single unit. + status = kUnitIdentifierSyntaxError; + return result; + } + token = nextToken(status); + if (U_FAILURE(status)) { + return result; + } + } + + return result; + } +}; + +// Sorting function wrapping SingleUnitImpl::compareTo for use with uprv_sortArray. +int32_t U_CALLCONV +compareSingleUnits(const void* /*context*/, const void* left, const void* right) { + auto realLeft = static_cast(left); + auto realRight = static_cast(right); + return (*realLeft)->compareTo(**realRight); +} + +// Returns an index into the gCategories array, for the "unitQuantity" (aka +// "type" or "category") associated with the given base unit identifier. Returns +// -1 on failure, together with U_UNSUPPORTED_ERROR. +int32_t getUnitCategoryIndex(BytesTrie &trie, StringPiece baseUnitIdentifier, UErrorCode &status) { + UStringTrieResult result = trie.reset().next(baseUnitIdentifier.data(), baseUnitIdentifier.length()); + if (!USTRINGTRIE_HAS_VALUE(result)) { + status = U_UNSUPPORTED_ERROR; + return -1; + } + + return trie.getValue(); +} + +} // namespace + +U_CAPI int32_t U_EXPORT2 +umeas_getPrefixPower(UMeasurePrefix unitPrefix) { + if (unitPrefix >= UMEASURE_PREFIX_INTERNAL_MIN_BIN && + unitPrefix <= UMEASURE_PREFIX_INTERNAL_MAX_BIN) { + return unitPrefix - UMEASURE_PREFIX_INTERNAL_ONE_BIN; + } + U_ASSERT(unitPrefix >= UMEASURE_PREFIX_INTERNAL_MIN_SI && + unitPrefix <= UMEASURE_PREFIX_INTERNAL_MAX_SI); + return unitPrefix - UMEASURE_PREFIX_ONE; +} + +U_CAPI int32_t U_EXPORT2 +umeas_getPrefixBase(UMeasurePrefix unitPrefix) { + if (unitPrefix >= UMEASURE_PREFIX_INTERNAL_MIN_BIN && + unitPrefix <= UMEASURE_PREFIX_INTERNAL_MAX_BIN) { + return 1024; + } + U_ASSERT(unitPrefix >= UMEASURE_PREFIX_INTERNAL_MIN_SI && + unitPrefix <= UMEASURE_PREFIX_INTERNAL_MAX_SI); + return 10; +} + +CharString U_I18N_API getUnitQuantity(const MeasureUnitImpl &baseMeasureUnitImpl, UErrorCode &status) { + CharString result; + MeasureUnitImpl baseUnitImpl = baseMeasureUnitImpl.copy(status); + UErrorCode localStatus = U_ZERO_ERROR; + umtx_initOnce(gUnitExtrasInitOnce, &initUnitExtras, status); + if (U_FAILURE(status)) { + return result; + } + BytesTrie trie(gSerializedUnitCategoriesTrie); + + baseUnitImpl.serialize(status); + StringPiece identifier = baseUnitImpl.identifier.data(); + int32_t idx = getUnitCategoryIndex(trie, identifier, localStatus); + if (U_FAILURE(status)) { + return result; + } + + // In case the base unit identifier did not match any entry. + if (U_FAILURE(localStatus)) { + localStatus = U_ZERO_ERROR; + baseUnitImpl.takeReciprocal(status); + baseUnitImpl.serialize(status); + identifier.set(baseUnitImpl.identifier.data()); + idx = getUnitCategoryIndex(trie, identifier, localStatus); + + if (U_FAILURE(status)) { + return result; + } + } + + // In case the reciprocal of the base unit identifier did not match any entry. + MeasureUnitImpl simplifiedUnit = baseMeasureUnitImpl.copyAndSimplify(status); + if (U_FAILURE(status)) { + return result; + } + if (U_FAILURE(localStatus)) { + localStatus = U_ZERO_ERROR; + simplifiedUnit.serialize(status); + identifier.set(simplifiedUnit.identifier.data()); + idx = getUnitCategoryIndex(trie, identifier, localStatus); + + if (U_FAILURE(status)) { + return result; + } + } + + // In case the simplified base unit identifier did not match any entry. + if (U_FAILURE(localStatus)) { + localStatus = U_ZERO_ERROR; + simplifiedUnit.takeReciprocal(status); + simplifiedUnit.serialize(status); + identifier.set(simplifiedUnit.identifier.data()); + idx = getUnitCategoryIndex(trie, identifier, localStatus); + + if (U_FAILURE(status)) { + return result; + } + } + + // If there is no match at all, throw an exception. + if (U_FAILURE(localStatus)) { + status = U_INVALID_FORMAT_ERROR; + return result; + } + + if (idx < 0 || idx >= gCategoriesCount) { + status = U_INVALID_FORMAT_ERROR; + return result; + } + + result.appendInvariantChars(gCategories[idx], u_strlen(gCategories[idx]), status); + return result; +} + +// In ICU4J, this is MeasureUnit.getSingleUnitImpl(). +SingleUnitImpl SingleUnitImpl::forMeasureUnit(const MeasureUnit& measureUnit, UErrorCode& status) { + MeasureUnitImpl temp; + const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(measureUnit, temp, status); + if (U_FAILURE(status)) { + return {}; + } + if (impl.singleUnits.length() == 0) { + return {}; + } + if (impl.singleUnits.length() == 1) { + return *impl.singleUnits[0]; + } + status = U_ILLEGAL_ARGUMENT_ERROR; + return {}; +} + +MeasureUnit SingleUnitImpl::build(UErrorCode& status) const { + MeasureUnitImpl temp; + temp.appendSingleUnit(*this, status); + // TODO(icu-units#28): the MeasureUnitImpl::build() method uses + // findBySubtype, which is relatively slow. + // - At the time of loading the simple unit IDs, we could also save a + // mapping to the builtin MeasureUnit type and subtype they correspond to. + // - This method could then check dimensionality and index, and if both are + // 1, directly return MeasureUnit instances very quickly. + return std::move(temp).build(status); +} + +const char *SingleUnitImpl::getSimpleUnitID() const { + return gSimpleUnits[index]; +} + +void SingleUnitImpl::appendNeutralIdentifier(CharString &result, UErrorCode &status) const UPRV_NO_SANITIZE_UNDEFINED { + int32_t absPower = std::abs(this->dimensionality); + + U_ASSERT(absPower > 0); // "this function does not support the dimensionless single units"; + + if (absPower == 1) { + // no-op + } else if (absPower == 2) { + result.append(StringPiece("square-"), status); + } else if (absPower == 3) { + result.append(StringPiece("cubic-"), status); + } else if (absPower <= 15) { + result.append(StringPiece("pow"), status); + result.appendNumber(absPower, status); + result.append(StringPiece("-"), status); + } else { + status = U_ILLEGAL_ARGUMENT_ERROR; // Unit Identifier Syntax Error + return; + } + + if (U_FAILURE(status)) { + return; + } + + if (this->unitPrefix != UMEASURE_PREFIX_ONE) { + bool found = false; + for (const auto &unitPrefixInfo : gUnitPrefixStrings) { + // TODO: consider using binary search? If we do this, add a unit + // test to ensure gUnitPrefixStrings is sorted? + if (unitPrefixInfo.value == this->unitPrefix) { + result.append(unitPrefixInfo.string, status); + found = true; + break; + } + } + if (!found) { + status = U_UNSUPPORTED_ERROR; + return; + } + } + + result.append(StringPiece(this->getSimpleUnitID()), status); +} + +int32_t SingleUnitImpl::getUnitCategoryIndex() const { + return gSimpleUnitCategories[index]; +} + +MeasureUnitImpl::MeasureUnitImpl(const SingleUnitImpl &singleUnit, UErrorCode &status) { + this->appendSingleUnit(singleUnit, status); +} + +MeasureUnitImpl MeasureUnitImpl::forIdentifier(StringPiece identifier, UErrorCode& status) { + return Parser::from(identifier, status).parse(status); +} + +const MeasureUnitImpl& MeasureUnitImpl::forMeasureUnit( + const MeasureUnit& measureUnit, MeasureUnitImpl& memory, UErrorCode& status) { + if (measureUnit.fImpl) { + return *measureUnit.fImpl; + } else { + memory = Parser::from(measureUnit.getIdentifier(), status).parse(status); + return memory; + } +} + +MeasureUnitImpl MeasureUnitImpl::forMeasureUnitMaybeCopy( + const MeasureUnit& measureUnit, UErrorCode& status) { + if (measureUnit.fImpl) { + return measureUnit.fImpl->copy(status); + } else { + return Parser::from(measureUnit.getIdentifier(), status).parse(status); + } +} + +void MeasureUnitImpl::takeReciprocal(UErrorCode& /*status*/) { + identifier.clear(); + for (int32_t i = 0; i < singleUnits.length(); i++) { + singleUnits[i]->dimensionality *= -1; + } +} + +MeasureUnitImpl MeasureUnitImpl::copyAndSimplify(UErrorCode &status) const { + MeasureUnitImpl result; + for (int32_t i = 0; i < singleUnits.length(); i++) { + const SingleUnitImpl &singleUnit = *this->singleUnits[i]; + + // The following `for` loop will cause time complexity to be O(n^2). + // However, n is very small (number of units, generally, at maximum equal to 10) + bool unitExist = false; + for (int32_t j = 0; j < result.singleUnits.length(); j++) { + if (uprv_strcmp(result.singleUnits[j]->getSimpleUnitID(), singleUnit.getSimpleUnitID()) == + 0 && + result.singleUnits[j]->unitPrefix == singleUnit.unitPrefix) { + unitExist = true; + result.singleUnits[j]->dimensionality = + result.singleUnits[j]->dimensionality + singleUnit.dimensionality; + break; + } + } + + if (!unitExist) { + result.appendSingleUnit(singleUnit, status); + } + } + + return result; +} + +bool MeasureUnitImpl::appendSingleUnit(const SingleUnitImpl &singleUnit, UErrorCode &status) { + identifier.clear(); + + if (singleUnit.isDimensionless()) { + // Do not append dimensionless units. + return false; + } + + // Find a similar unit that already exists, to attempt to coalesce + SingleUnitImpl *oldUnit = nullptr; + for (int32_t i = 0; i < this->singleUnits.length(); i++) { + auto *candidate = this->singleUnits[i]; + if (candidate->isCompatibleWith(singleUnit)) { + oldUnit = candidate; + } + } + + if (oldUnit) { + // Both dimensionalities will be positive, or both will be negative, by + // virtue of isCompatibleWith(). + oldUnit->dimensionality += singleUnit.dimensionality; + + return false; + } + + // Add a copy of singleUnit + // NOTE: MaybeStackVector::emplaceBackAndCheckErrorCode creates new copy of singleUnit. + this->singleUnits.emplaceBackAndCheckErrorCode(status, singleUnit); + if (U_FAILURE(status)) { + return false; + } + + // If the MeasureUnitImpl is `UMEASURE_UNIT_SINGLE` and after the appending a unit, the `singleUnits` + // contains more than one. thus means the complexity should be `UMEASURE_UNIT_COMPOUND` + if (this->singleUnits.length() > 1 && + this->complexity == UMeasureUnitComplexity::UMEASURE_UNIT_SINGLE) { + this->complexity = UMeasureUnitComplexity::UMEASURE_UNIT_COMPOUND; + } + + return true; +} + +MaybeStackVector +MeasureUnitImpl::extractIndividualUnitsWithIndices(UErrorCode &status) const { + MaybeStackVector result; + + if (this->complexity != UMeasureUnitComplexity::UMEASURE_UNIT_MIXED) { + result.emplaceBackAndCheckErrorCode(status, 0, *this, status); + return result; + } + + for (int32_t i = 0; i < singleUnits.length(); ++i) { + result.emplaceBackAndCheckErrorCode(status, i, *singleUnits[i], status); + if (U_FAILURE(status)) { + return result; + } + } + + return result; +} + +/** + * Normalize a MeasureUnitImpl and generate the identifier string in place. + */ +void MeasureUnitImpl::serialize(UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + + if (this->singleUnits.length() == 0) { + // Dimensionless, constructed by the default constructor. + return; + } + + if (this->complexity == UMEASURE_UNIT_COMPOUND) { + // Note: don't sort a MIXED unit + uprv_sortArray(this->singleUnits.getAlias(), this->singleUnits.length(), + sizeof(this->singleUnits[0]), compareSingleUnits, nullptr, false, &status); + if (U_FAILURE(status)) { + return; + } + } + + CharString result; + bool beforePer = true; + bool firstTimeNegativeDimension = false; + for (int32_t i = 0; i < this->singleUnits.length(); i++) { + if (beforePer && (*this->singleUnits[i]).dimensionality < 0) { + beforePer = false; + firstTimeNegativeDimension = true; + } else if ((*this->singleUnits[i]).dimensionality < 0) { + firstTimeNegativeDimension = false; + } + + if (U_FAILURE(status)) { + return; + } + + if (this->complexity == UMeasureUnitComplexity::UMEASURE_UNIT_MIXED) { + if (result.length() != 0) { + result.append(StringPiece("-and-"), status); + } + } else { + if (firstTimeNegativeDimension) { + if (result.length() == 0) { + result.append(StringPiece("per-"), status); + } else { + result.append(StringPiece("-per-"), status); + } + } else { + if (result.length() != 0) { + result.append(StringPiece("-"), status); + } + } + } + + this->singleUnits[i]->appendNeutralIdentifier(result, status); + } + + this->identifier = CharString(result, status); +} + +MeasureUnit MeasureUnitImpl::build(UErrorCode& status) && { + this->serialize(status); + return MeasureUnit(std::move(*this)); +} + +MeasureUnit MeasureUnit::forIdentifier(StringPiece identifier, UErrorCode& status) { + return Parser::from(identifier, status).parse(status).build(status); +} + +UMeasureUnitComplexity MeasureUnit::getComplexity(UErrorCode& status) const { + MeasureUnitImpl temp; + return MeasureUnitImpl::forMeasureUnit(*this, temp, status).complexity; +} + +UMeasurePrefix MeasureUnit::getPrefix(UErrorCode& status) const { + return SingleUnitImpl::forMeasureUnit(*this, status).unitPrefix; +} + +MeasureUnit MeasureUnit::withPrefix(UMeasurePrefix prefix, UErrorCode& status) const UPRV_NO_SANITIZE_UNDEFINED { + SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status); + singleUnit.unitPrefix = prefix; + return singleUnit.build(status); +} + +int32_t MeasureUnit::getDimensionality(UErrorCode& status) const { + SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status); + if (U_FAILURE(status)) { return 0; } + if (singleUnit.isDimensionless()) { + return 0; + } + return singleUnit.dimensionality; +} + +MeasureUnit MeasureUnit::withDimensionality(int32_t dimensionality, UErrorCode& status) const { + SingleUnitImpl singleUnit = SingleUnitImpl::forMeasureUnit(*this, status); + singleUnit.dimensionality = dimensionality; + return singleUnit.build(status); +} + +MeasureUnit MeasureUnit::reciprocal(UErrorCode& status) const { + MeasureUnitImpl impl = MeasureUnitImpl::forMeasureUnitMaybeCopy(*this, status); + impl.takeReciprocal(status); + return std::move(impl).build(status); +} + +MeasureUnit MeasureUnit::product(const MeasureUnit& other, UErrorCode& status) const { + MeasureUnitImpl impl = MeasureUnitImpl::forMeasureUnitMaybeCopy(*this, status); + MeasureUnitImpl temp; + const MeasureUnitImpl& otherImpl = MeasureUnitImpl::forMeasureUnit(other, temp, status); + if (impl.complexity == UMEASURE_UNIT_MIXED || otherImpl.complexity == UMEASURE_UNIT_MIXED) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return {}; + } + for (int32_t i = 0; i < otherImpl.singleUnits.length(); i++) { + impl.appendSingleUnit(*otherImpl.singleUnits[i], status); + } + if (impl.singleUnits.length() > 1) { + impl.complexity = UMEASURE_UNIT_COMPOUND; + } + return std::move(impl).build(status); +} + +LocalArray MeasureUnit::splitToSingleUnitsImpl(int32_t& outCount, UErrorCode& status) const { + MeasureUnitImpl temp; + const MeasureUnitImpl& impl = MeasureUnitImpl::forMeasureUnit(*this, temp, status); + outCount = impl.singleUnits.length(); + MeasureUnit* arr = new MeasureUnit[outCount]; + if (arr == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return LocalArray(); + } + for (int32_t i = 0; i < outCount; i++) { + arr[i] = impl.singleUnits[i]->build(status); + } + return LocalArray(arr, status); +} + + +U_NAMESPACE_END + +#endif /* !UNCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/measunit_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/measunit_impl.h new file mode 100644 index 000000000..c60ff2fc3 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/measunit_impl.h @@ -0,0 +1,376 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __MEASUNIT_IMPL_H__ +#define __MEASUNIT_IMPL_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/measunit.h" +#include "cmemory.h" +#include "charstr.h" + +U_NAMESPACE_BEGIN + +namespace number { +namespace impl { +class LongNameHandler; +} +} // namespace number + +static const char16_t kDefaultCurrency[] = u"XXX"; +static const char kDefaultCurrency8[] = "XXX"; + +/** + * Looks up the "unitQuantity" (aka "type" or "category") of a base unit + * identifier. The category is returned via `result`, which must initially be + * empty. + * + * This only supports base units: other units must be resolved to base units + * before passing to this function, otherwise U_UNSUPPORTED_ERROR status may be + * returned. + * + * Categories are found in `unitQuantities` in the `units` resource (see + * `units.txt`). + */ +// TODO: make this function accepts any `MeasureUnit` as Java and move it to the `UnitsData` class. +CharString U_I18N_API getUnitQuantity(const MeasureUnitImpl &baseMeasureUnitImpl, UErrorCode &status); + +/** + * A struct representing a single unit (optional SI or binary prefix, and dimensionality). + */ +struct U_I18N_API SingleUnitImpl : public UMemory { + /** + * Gets a single unit from the MeasureUnit. If there are multiple single units, sets an error + * code and returns the base dimensionless unit. Parses if necessary. + */ + static SingleUnitImpl forMeasureUnit(const MeasureUnit& measureUnit, UErrorCode& status); + + /** Transform this SingleUnitImpl into a MeasureUnit, simplifying if possible. */ + MeasureUnit build(UErrorCode& status) const; + + /** + * Returns the "simple unit ID", without SI or dimensionality prefix: this + * instance may represent a square-kilometer, but only "meter" will be + * returned. + * + * The returned pointer points at memory that exists for the duration of the + * program's running. + */ + const char *getSimpleUnitID() const; + + /** + * Generates and append a neutral identifier string for a single unit which means we do not include + * the dimension signal. + */ + void appendNeutralIdentifier(CharString &result, UErrorCode &status) const; + + /** + * Returns the index of this unit's "quantity" in unitQuantities (in + * measunit_extra.cpp). The value of this index determines sort order for + * normalization of unit identifiers. + */ + int32_t getUnitCategoryIndex() const; + + /** + * Compare this SingleUnitImpl to another SingleUnitImpl for the sake of + * sorting and coalescing. + * + * Sort order of units is specified by UTS #35 + * (https://unicode.org/reports/tr35/tr35-info.html#Unit_Identifier_Normalization). + * + * Takes the sign of dimensionality into account, but not the absolute + * value: per-meter is not considered the same as meter, but meter is + * considered the same as square-meter. + * + * The dimensionless unit generally does not get compared, but if it did, it + * would sort before other units by virtue of index being < 0 and + * dimensionality not being negative. + */ + int32_t compareTo(const SingleUnitImpl& other) const { + if (dimensionality < 0 && other.dimensionality > 0) { + // Positive dimensions first + return 1; + } + if (dimensionality > 0 && other.dimensionality < 0) { + return -1; + } + + // Sort by official quantity order + int32_t thisQuantity = this->getUnitCategoryIndex(); + int32_t otherQuantity = other.getUnitCategoryIndex(); + if (thisQuantity < otherQuantity) { + return -1; + } + if (thisQuantity > otherQuantity) { + return 1; + } + + // If quantity order didn't help, then we go by index. + if (index < other.index) { + return -1; + } + if (index > other.index) { + return 1; + } + + // When comparing binary prefixes vs SI prefixes, instead of comparing the actual values, we can + // multiply the binary prefix power by 3 and compare the powers. if they are equal, we can can + // compare the bases. + // NOTE: this methodology will fail if the binary prefix more than or equal 98. + int32_t unitBase = umeas_getPrefixBase(unitPrefix); + int32_t otherUnitBase = umeas_getPrefixBase(other.unitPrefix); + + // Values for comparison purposes only. + int32_t unitPower = unitBase == 1024 /* Binary Prefix */ ? umeas_getPrefixPower(unitPrefix) * 3 + : umeas_getPrefixPower(unitPrefix); + int32_t otherUnitPower = + otherUnitBase == 1024 /* Binary Prefix */ ? umeas_getPrefixPower(other.unitPrefix) * 3 + : umeas_getPrefixPower(other.unitPrefix); + + // NOTE: if the unitPower is less than the other, + // we return 1 not -1. Thus because we want th sorting order + // for the bigger prefix to be before the smaller. + // Example: megabyte should come before kilobyte. + if (unitPower < otherUnitPower) { + return 1; + } + if (unitPower > otherUnitPower) { + return -1; + } + + if (unitBase < otherUnitBase) { + return 1; + } + if (unitBase > otherUnitBase) { + return -1; + } + + return 0; + } + + /** + * Return whether this SingleUnitImpl is compatible with another for the purpose of coalescing. + * + * Units with the same base unit and SI or binary prefix should match, except that they must also + * have the same dimensionality sign, such that we don't merge numerator and denominator. + */ + bool isCompatibleWith(const SingleUnitImpl& other) const { + return (compareTo(other) == 0); + } + + /** + * Returns true if this unit is the "dimensionless base unit", as produced + * by the MeasureUnit() default constructor. (This does not include the + * likes of concentrations or angles.) + */ + bool isDimensionless() const { + return index == -1; + } + + /** + * Simple unit index, unique for every simple unit, -1 for the dimensionless + * unit. This is an index into a string list in measunit_extra.cpp, as + * loaded by SimpleUnitIdentifiersSink. + * + * The default value is -1, meaning the dimensionless unit: + * isDimensionless() will return true, until index is changed. + */ + int32_t index = -1; + + /** + * SI or binary prefix. + * + * This is ignored for the dimensionless unit. + */ + UMeasurePrefix unitPrefix = UMEASURE_PREFIX_ONE; + + /** + * Dimensionality. + * + * This is meaningless for the dimensionless unit. + */ + int32_t dimensionality = 1; +}; + +// Forward declaration +struct MeasureUnitImplWithIndex; + +// Export explicit template instantiations of MaybeStackArray, MemoryPool and +// MaybeStackVector. This is required when building DLLs for Windows. (See +// datefmt.h, collationiterator.h, erarules.h and others for similar examples.) +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +template class U_I18N_API MaybeStackArray; +template class U_I18N_API MemoryPool; +template class U_I18N_API MaybeStackVector; +#endif + +/** + * Internal representation of measurement units. Capable of representing all complexities of units, + * including mixed and compound units. + */ +class U_I18N_API MeasureUnitImpl : public UMemory { + public: + MeasureUnitImpl() = default; + MeasureUnitImpl(MeasureUnitImpl &&other) = default; + // No copy constructor, use MeasureUnitImpl::copy() to make it explicit. + MeasureUnitImpl(const MeasureUnitImpl &other, UErrorCode &status) = delete; + MeasureUnitImpl(const SingleUnitImpl &singleUnit, UErrorCode &status); + + MeasureUnitImpl &operator=(MeasureUnitImpl &&other) noexcept = default; + + /** Extract the MeasureUnitImpl from a MeasureUnit. */ + static inline const MeasureUnitImpl *get(const MeasureUnit &measureUnit) { + return measureUnit.fImpl; + } + + /** + * Parse a unit identifier into a MeasureUnitImpl. + * + * @param identifier The unit identifier string. + * @param status Set if the identifier string is not valid. + * @return A newly parsed value object. Behaviour of this unit is + * unspecified if an error is returned via status. + */ + static MeasureUnitImpl forIdentifier(StringPiece identifier, UErrorCode& status); + + /** + * Extract the MeasureUnitImpl from a MeasureUnit, or parse if it is not present. + * + * @param measureUnit The source MeasureUnit. + * @param memory A place to write the new MeasureUnitImpl if parsing is required. + * @param status Set if an error occurs. + * @return A reference to either measureUnit.fImpl or memory. + */ + static const MeasureUnitImpl& forMeasureUnit( + const MeasureUnit& measureUnit, MeasureUnitImpl& memory, UErrorCode& status); + + /** + * Extract the MeasureUnitImpl from a MeasureUnit, or parse if it is not present. + * + * @param measureUnit The source MeasureUnit. + * @param status Set if an error occurs. + * @return A value object, either newly parsed or copied from measureUnit. + */ + static MeasureUnitImpl forMeasureUnitMaybeCopy( + const MeasureUnit& measureUnit, UErrorCode& status); + + /** + * Used for currency units. + */ + static inline MeasureUnitImpl forCurrencyCode(StringPiece currencyCode) { + MeasureUnitImpl result; + UErrorCode localStatus = U_ZERO_ERROR; + result.identifier.append(currencyCode, localStatus); + // localStatus is not expected to fail since currencyCode should be 3 chars long + return result; + } + + /** Transform this MeasureUnitImpl into a MeasureUnit, simplifying if possible. */ + MeasureUnit build(UErrorCode& status) &&; + + /** + * Create a copy of this MeasureUnitImpl. Don't use copy constructor to make this explicit. + */ + MeasureUnitImpl copy(UErrorCode& status) const; + + /** + * Extracts the list of all the individual units inside the `MeasureUnitImpl` with their indices. + * For example: + * - if the `MeasureUnitImpl` is `foot-per-hour` + * it will return a list of 1 {(0, `foot-per-hour`)} + * - if the `MeasureUnitImpl` is `foot-and-inch` + * it will return a list of 2 {(0, `foot`), (1, `inch`)} + */ + MaybeStackVector + extractIndividualUnitsWithIndices(UErrorCode &status) const; + + /** Mutates this MeasureUnitImpl to take the reciprocal. */ + void takeReciprocal(UErrorCode& status); + + /** + * Returns a simplified version of the unit. + * NOTE: the simplification happen when there are two units equals in their base unit and their + * prefixes. + * + * Example 1: "square-meter-per-meter" --> "meter" + * Example 2: "square-millimeter-per-meter" --> "square-millimeter-per-meter" + */ + MeasureUnitImpl copyAndSimplify(UErrorCode &status) const; + + /** + * Mutates this MeasureUnitImpl to append a single unit. + * + * @return true if a new item was added. If unit is the dimensionless unit, + * it is never added: the return value will always be false. + */ + bool appendSingleUnit(const SingleUnitImpl& singleUnit, UErrorCode& status); + + /** + * Normalizes a MeasureUnitImpl and generate the identifier string in place. + */ + void serialize(UErrorCode &status); + + /** The complexity, either SINGLE, COMPOUND, or MIXED. */ + UMeasureUnitComplexity complexity = UMEASURE_UNIT_SINGLE; + + /** + * The list of single units. These may be summed or multiplied, based on the + * value of the complexity field. + * + * The "dimensionless" unit (SingleUnitImpl default constructor) must not be + * added to this list. + */ + MaybeStackVector singleUnits; + + /** + * The full unit identifier. Owned by the MeasureUnitImpl. Empty if not computed. + */ + CharString identifier; + + // For calling serialize + // TODO(icu-units#147): revisit serialization + friend class number::impl::LongNameHandler; +}; + +struct U_I18N_API MeasureUnitImplWithIndex : public UMemory { + const int32_t index; + MeasureUnitImpl unitImpl; + // Makes a copy of unitImpl. + MeasureUnitImplWithIndex(int32_t index, const MeasureUnitImpl &unitImpl, UErrorCode &status) + : index(index), unitImpl(unitImpl.copy(status)) { + } + MeasureUnitImplWithIndex(int32_t index, const SingleUnitImpl &singleUnitImpl, UErrorCode &status) + : index(index), unitImpl(MeasureUnitImpl(singleUnitImpl, status)) { + } +}; + +// Export explicit template instantiations of MaybeStackArray, MemoryPool and +// MaybeStackVector. This is required when building DLLs for Windows. (See +// datefmt.h, collationiterator.h, erarules.h and others for similar examples.) +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +template class U_I18N_API MaybeStackArray; +template class U_I18N_API MemoryPool; +template class U_I18N_API MaybeStackVector; + +// Export an explicit template instantiation of the LocalPointer that is used as a +// data member of MeasureUnitImpl. +// (When building DLLs for Windows this is required.) +#if defined(_MSC_VER) +// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!= +#pragma warning(push) +#pragma warning(disable : 4661) +#endif +template class U_I18N_API LocalPointerBase; +template class U_I18N_API LocalPointer; +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +#endif + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ +#endif //__MEASUNIT_IMPL_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp index cf8e3568a..cdbd99503 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp @@ -23,7 +23,7 @@ U_NAMESPACE_BEGIN UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Measure) -Measure::Measure() {} +Measure::Measure() : unit(nullptr) {} Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit, UErrorCode& ec) : @@ -35,7 +35,7 @@ Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit, } Measure::Measure(const Measure& other) : - UObject(other), unit(0) { + UObject(other), unit(nullptr) { *this = other; } @@ -43,7 +43,11 @@ Measure& Measure::operator=(const Measure& other) { if (this != &other) { delete unit; number = other.number; - unit = other.unit->clone(); + if (other.unit != nullptr) { + unit = other.unit->clone(); + } else { + unit = nullptr; + } } return *this; } @@ -58,15 +62,15 @@ Measure::~Measure() { bool Measure::operator==(const UObject& other) const { if (this == &other) { // Same object, equal - return TRUE; + return true; } if (typeid(*this) != typeid(other)) { // Different types, not equal - return FALSE; + return false; } const Measure &m = static_cast(other); return number == m.number && - ((unit == NULL) == (m.unit == NULL)) && - (unit == NULL || *unit == *m.unit); + ((unit == nullptr) == (m.unit == nullptr)) && + (unit == nullptr || *unit == *m.unit); } U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp index b187a0078..29fb4b3a0 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp @@ -55,87 +55,87 @@ // class MessageFormat // ***************************************************************************** -#define MSGFMT_SINGLE_QUOTE ((UChar)0x0027) -#define MSGFMT_COMMA ((UChar)0x002C) -#define MSGFMT_LEFT_CURLY_BRACE ((UChar)0x007B) -#define MSGFMT_RIGHT_CURLY_BRACE ((UChar)0x007D) +#define SINGLE_QUOTE ((char16_t)0x0027) +#define COMMA ((char16_t)0x002C) +#define LEFT_CURLY_BRACE ((char16_t)0x007B) +#define RIGHT_CURLY_BRACE ((char16_t)0x007D) //--------------------------------------- // static data -static const UChar ID_NUMBER[] = { +static const char16_t ID_NUMBER[] = { 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0 /* "number" */ }; -static const UChar ID_DATE[] = { +static const char16_t ID_DATE[] = { 0x64, 0x61, 0x74, 0x65, 0 /* "date" */ }; -static const UChar ID_TIME[] = { +static const char16_t ID_TIME[] = { 0x74, 0x69, 0x6D, 0x65, 0 /* "time" */ }; -static const UChar ID_SPELLOUT[] = { +static const char16_t ID_SPELLOUT[] = { 0x73, 0x70, 0x65, 0x6c, 0x6c, 0x6f, 0x75, 0x74, 0 /* "spellout" */ }; -static const UChar ID_ORDINAL[] = { +static const char16_t ID_ORDINAL[] = { 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0 /* "ordinal" */ }; -static const UChar ID_DURATION[] = { +static const char16_t ID_DURATION[] = { 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0 /* "duration" */ }; // MessageFormat Type List Number, Date, Time or Choice -static const UChar * const TYPE_IDS[] = { +static const char16_t * const TYPE_IDS[] = { ID_NUMBER, ID_DATE, ID_TIME, ID_SPELLOUT, ID_ORDINAL, ID_DURATION, - NULL, + nullptr, }; -static const UChar ID_EMPTY[] = { +static const char16_t ID_EMPTY[] = { 0 /* empty string, used for default so that null can mark end of list */ }; -static const UChar ID_CURRENCY[] = { +static const char16_t ID_CURRENCY[] = { 0x63, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x63, 0x79, 0 /* "currency" */ }; -static const UChar ID_PERCENT[] = { +static const char16_t ID_PERCENT[] = { 0x70, 0x65, 0x72, 0x63, 0x65, 0x6E, 0x74, 0 /* "percent" */ }; -static const UChar ID_INTEGER[] = { +static const char16_t ID_INTEGER[] = { 0x69, 0x6E, 0x74, 0x65, 0x67, 0x65, 0x72, 0 /* "integer" */ }; // NumberFormat modifier list, default, currency, percent or integer -static const UChar * const NUMBER_STYLE_IDS[] = { +static const char16_t * const NUMBER_STYLE_IDS[] = { ID_EMPTY, ID_CURRENCY, ID_PERCENT, ID_INTEGER, - NULL, + nullptr, }; -static const UChar ID_SHORT[] = { +static const char16_t ID_SHORT[] = { 0x73, 0x68, 0x6F, 0x72, 0x74, 0 /* "short" */ }; -static const UChar ID_MEDIUM[] = { +static const char16_t ID_MEDIUM[] = { 0x6D, 0x65, 0x64, 0x69, 0x75, 0x6D, 0 /* "medium" */ }; -static const UChar ID_LONG[] = { +static const char16_t ID_LONG[] = { 0x6C, 0x6F, 0x6E, 0x67, 0 /* "long" */ }; -static const UChar ID_FULL[] = { +static const char16_t ID_FULL[] = { 0x66, 0x75, 0x6C, 0x6C, 0 /* "full" */ }; // DateFormat modifier list, default, short, medium, long or full -static const UChar * const DATE_STYLE_IDS[] = { +static const char16_t * const DATE_STYLE_IDS[] = { ID_EMPTY, ID_SHORT, ID_MEDIUM, ID_LONG, ID_FULL, - NULL, + nullptr, }; static const icu::DateFormat::EStyle DATE_STYLES[] = { @@ -148,11 +148,11 @@ static const icu::DateFormat::EStyle DATE_STYLES[] = { static const int32_t DEFAULT_INITIAL_CAPACITY = 10; -static const UChar NULL_STRING[] = { +static const char16_t NULL_STRING[] = { 0x6E, 0x75, 0x6C, 0x6C, 0 // "null" }; -static const UChar OTHER_STRING[] = { +static const char16_t OTHER_STRING[] = { 0x6F, 0x74, 0x68, 0x65, 0x72, 0 // "other" }; @@ -177,7 +177,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(FormatNameEnumeration) * the given UnicodeString. */ static UnicodeString& itos(int32_t i, UnicodeString& appendTo) { - UChar temp[16]; + char16_t temp[16]; uprv_itou(temp,16,i,10,0); // 10 == radix appendTo.append(temp, -1); return appendTo; @@ -194,7 +194,7 @@ class AppendableWrapper : public UMemory { app.appendString(s.getBuffer(), s.length()); len += s.length(); } - void append(const UChar* s, const int32_t sLength) { + void append(const char16_t* s, const int32_t sLength) { app.appendString(s, sLength); len += sLength; } @@ -234,16 +234,16 @@ MessageFormat::MessageFormat(const UnicodeString& pattern, UErrorCode& success) : fLocale(Locale::getDefault()), // Uses the default locale msgPattern(success), - formatAliases(NULL), + formatAliases(nullptr), formatAliasesCapacity(0), - argTypes(NULL), + argTypes(nullptr), argTypeCount(0), argTypeCapacity(0), - hasArgTypeConflicts(FALSE), - defaultNumberFormat(NULL), - defaultDateFormat(NULL), - cachedFormatters(NULL), - customFormatArgStarts(NULL), + hasArgTypeConflicts(false), + defaultNumberFormat(nullptr), + defaultDateFormat(nullptr), + cachedFormatters(nullptr), + customFormatArgStarts(nullptr), pluralProvider(*this, UPLURAL_TYPE_CARDINAL), ordinalProvider(*this, UPLURAL_TYPE_ORDINAL) { @@ -256,16 +256,16 @@ MessageFormat::MessageFormat(const UnicodeString& pattern, UErrorCode& success) : fLocale(newLocale), msgPattern(success), - formatAliases(NULL), + formatAliases(nullptr), formatAliasesCapacity(0), - argTypes(NULL), + argTypes(nullptr), argTypeCount(0), argTypeCapacity(0), - hasArgTypeConflicts(FALSE), - defaultNumberFormat(NULL), - defaultDateFormat(NULL), - cachedFormatters(NULL), - customFormatArgStarts(NULL), + hasArgTypeConflicts(false), + defaultNumberFormat(nullptr), + defaultDateFormat(nullptr), + cachedFormatters(nullptr), + customFormatArgStarts(nullptr), pluralProvider(*this, UPLURAL_TYPE_CARDINAL), ordinalProvider(*this, UPLURAL_TYPE_ORDINAL) { @@ -279,16 +279,16 @@ MessageFormat::MessageFormat(const UnicodeString& pattern, UErrorCode& success) : fLocale(newLocale), msgPattern(success), - formatAliases(NULL), + formatAliases(nullptr), formatAliasesCapacity(0), - argTypes(NULL), + argTypes(nullptr), argTypeCount(0), argTypeCapacity(0), - hasArgTypeConflicts(FALSE), - defaultNumberFormat(NULL), - defaultDateFormat(NULL), - cachedFormatters(NULL), - customFormatArgStarts(NULL), + hasArgTypeConflicts(false), + defaultNumberFormat(nullptr), + defaultDateFormat(nullptr), + cachedFormatters(nullptr), + customFormatArgStarts(nullptr), pluralProvider(*this, UPLURAL_TYPE_CARDINAL), ordinalProvider(*this, UPLURAL_TYPE_ORDINAL) { @@ -301,20 +301,20 @@ MessageFormat::MessageFormat(const MessageFormat& that) Format(that), fLocale(that.fLocale), msgPattern(that.msgPattern), - formatAliases(NULL), + formatAliases(nullptr), formatAliasesCapacity(0), - argTypes(NULL), + argTypes(nullptr), argTypeCount(0), argTypeCapacity(0), hasArgTypeConflicts(that.hasArgTypeConflicts), - defaultNumberFormat(NULL), - defaultDateFormat(NULL), - cachedFormatters(NULL), - customFormatArgStarts(NULL), + defaultNumberFormat(nullptr), + defaultDateFormat(nullptr), + cachedFormatters(nullptr), + customFormatArgStarts(nullptr), pluralProvider(*this, UPLURAL_TYPE_CARDINAL), ordinalProvider(*this, UPLURAL_TYPE_ORDINAL) { - // This will take care of creating the hash tables (since they are NULL). + // This will take care of creating the hash tables (since they are nullptr). UErrorCode ec = U_ZERO_ERROR; copyObjects(that, ec); if (U_FAILURE(ec)) { @@ -338,17 +338,17 @@ MessageFormat::~MessageFormat() /** * Allocate argTypes[] to at least the given capacity and return - * TRUE if successful. If not, leave argTypes[] unchanged. + * true if successful. If not, leave argTypes[] unchanged. * - * If argTypes is NULL, allocate it. If it is not NULL, enlarge it + * If argTypes is nullptr, allocate it. If it is not nullptr, enlarge it * if necessary to be at least as large as specified. */ UBool MessageFormat::allocateArgTypes(int32_t capacity, UErrorCode& status) { if (U_FAILURE(status)) { - return FALSE; + return false; } if (argTypeCapacity >= capacity) { - return TRUE; + return true; } if (capacity < DEFAULT_INITIAL_CAPACITY) { capacity = DEFAULT_INITIAL_CAPACITY; @@ -357,13 +357,13 @@ UBool MessageFormat::allocateArgTypes(int32_t capacity, UErrorCode& status) { } Formattable::Type* a = (Formattable::Type*) uprv_realloc(argTypes, sizeof(*argTypes) * capacity); - if (a == NULL) { + if (a == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } argTypes = a; argTypeCapacity = capacity; - return TRUE; + return true; } // ------------------------------------- @@ -392,45 +392,45 @@ MessageFormat::operator=(const MessageFormat& that) bool MessageFormat::operator==(const Format& rhs) const { - if (this == &rhs) return TRUE; - - MessageFormat& that = (MessageFormat&)rhs; + if (this == &rhs) return true; // Check class ID before checking MessageFormat members - if (!Format::operator==(rhs) || - msgPattern != that.msgPattern || + if (!Format::operator==(rhs)) return false; + + const MessageFormat& that = static_cast(rhs); + if (msgPattern != that.msgPattern || fLocale != that.fLocale) { - return FALSE; + return false; } // Compare hashtables. - if ((customFormatArgStarts == NULL) != (that.customFormatArgStarts == NULL)) { - return FALSE; + if ((customFormatArgStarts == nullptr) != (that.customFormatArgStarts == nullptr)) { + return false; } - if (customFormatArgStarts == NULL) { - return TRUE; + if (customFormatArgStarts == nullptr) { + return true; } UErrorCode ec = U_ZERO_ERROR; const int32_t count = uhash_count(customFormatArgStarts); const int32_t rhs_count = uhash_count(that.customFormatArgStarts); if (count != rhs_count) { - return FALSE; + return false; } int32_t idx = 0, rhs_idx = 0, pos = UHASH_FIRST, rhs_pos = UHASH_FIRST; for (; idx < count && rhs_idx < rhs_count && U_SUCCESS(ec); ++idx, ++rhs_idx) { const UHashElement* cur = uhash_nextElement(customFormatArgStarts, &pos); const UHashElement* rhs_cur = uhash_nextElement(that.customFormatArgStarts, &rhs_pos); if (cur->key.integer != rhs_cur->key.integer) { - return FALSE; + return false; } const Format* format = (const Format*)uhash_iget(cachedFormatters, cur->key.integer); const Format* rhs_format = (const Format*)uhash_iget(that.cachedFormatters, rhs_cur->key.integer); if (*format != *rhs_format) { - return FALSE; + return false; } } - return TRUE; + return true; } // ------------------------------------- @@ -450,9 +450,9 @@ MessageFormat::setLocale(const Locale& theLocale) { if (fLocale != theLocale) { delete defaultNumberFormat; - defaultNumberFormat = NULL; + defaultNumberFormat = nullptr; delete defaultDateFormat; - defaultDateFormat = NULL; + defaultDateFormat = nullptr; fLocale = theLocale; setLocaleIDs(fLocale.getName(), fLocale.getName()); pluralProvider.reset(); @@ -500,11 +500,11 @@ MessageFormat::applyPattern(const UnicodeString& pattern, void MessageFormat::resetPattern() { msgPattern.clear(); uhash_close(cachedFormatters); - cachedFormatters = NULL; + cachedFormatters = nullptr; uhash_close(customFormatArgStarts); - customFormatArgStarts = NULL; + customFormatArgStarts = nullptr; argTypeCount = 0; - hasArgTypeConflicts = FALSE; + hasArgTypeConflicts = false; } void @@ -515,7 +515,8 @@ MessageFormat::applyPattern(const UnicodeString& pattern, if (aposMode != msgPattern.getApostropheMode()) { msgPattern.clearPatternAndSetApostropheMode(aposMode); } - applyPattern(pattern, *parseError, status); + UParseError tempParseError; + applyPattern(pattern, (parseError == nullptr) ? tempParseError : *parseError, status); } // ------------------------------------- @@ -523,7 +524,7 @@ MessageFormat::applyPattern(const UnicodeString& pattern, UnicodeString& MessageFormat::toPattern(UnicodeString& appendTo) const { - if ((customFormatArgStarts != NULL && 0 != uhash_count(customFormatArgStarts)) || + if ((customFormatArgStarts != nullptr && 0 != uhash_count(customFormatArgStarts)) || 0 == msgPattern.countParts() ) { appendTo.setToBogus(); @@ -554,7 +555,7 @@ void MessageFormat::setArgStartFormat(int32_t argStart, delete formatter; return; } - if (cachedFormatters == NULL) { + if (cachedFormatters == nullptr) { cachedFormatters=uhash_open(uhash_hashLong, uhash_compareLong, equalFormatsForHash, &status); if (U_FAILURE(status)) { @@ -563,7 +564,7 @@ void MessageFormat::setArgStartFormat(int32_t argStart, } uhash_setValueDeleter(cachedFormatters, uprv_deleteUObject); } - if (formatter == NULL) { + if (formatter == nullptr) { formatter = new DummyFormat(); } uhash_iput(cachedFormatters, argStart, formatter, &status); @@ -583,23 +584,23 @@ void MessageFormat::setCustomArgStartFormat(int32_t argStart, Format* formatter, UErrorCode& status) { setArgStartFormat(argStart, formatter, status); - if (customFormatArgStarts == NULL) { + if (customFormatArgStarts == nullptr) { customFormatArgStarts=uhash_open(uhash_hashLong, uhash_compareLong, - NULL, &status); + nullptr, &status); } uhash_iputi(customFormatArgStarts, argStart, 1, &status); } Format* MessageFormat::getCachedFormatter(int32_t argumentNumber) const { - if (cachedFormatters == NULL) { - return NULL; + if (cachedFormatters == nullptr) { + return nullptr; } void* ptr = uhash_iget(cachedFormatters, argumentNumber); - if (ptr != NULL && dynamic_cast((Format*)ptr) == NULL) { + if (ptr != nullptr && dynamic_cast((Format*)ptr) == nullptr) { return (Format*) ptr; } else { - // Not cached, or a DummyFormat representing setFormat(NULL). - return NULL; + // Not cached, or a DummyFormat representing setFormat(nullptr). + return nullptr; } } @@ -609,14 +610,14 @@ Format* MessageFormat::getCachedFormatter(int32_t argumentNumber) const { void MessageFormat::adoptFormats(Format** newFormats, int32_t count) { - if (newFormats == NULL || count < 0) { + if (newFormats == nullptr || count < 0) { return; } // Throw away any cached formatters. - if (cachedFormatters != NULL) { + if (cachedFormatters != nullptr) { uhash_removeAll(cachedFormatters); } - if (customFormatArgStarts != NULL) { + if (customFormatArgStarts != nullptr) { uhash_removeAll(customFormatArgStarts); } @@ -637,19 +638,19 @@ MessageFormat::adoptFormats(Format** newFormats, // ------------------------------------- // Sets the new formats array and updates the array count. -// This MessageFormat instance maks a copy of the new formats. +// This MessageFormat instance makes a copy of the new formats. void MessageFormat::setFormats(const Format** newFormats, int32_t count) { - if (newFormats == NULL || count < 0) { + if (newFormats == nullptr || count < 0) { return; } // Throw away any cached formatters. - if (cachedFormatters != NULL) { + if (cachedFormatters != nullptr) { uhash_removeAll(cachedFormatters); } - if (customFormatArgStarts != NULL) { + if (customFormatArgStarts != nullptr) { uhash_removeAll(customFormatArgStarts); } @@ -657,10 +658,10 @@ MessageFormat::setFormats(const Format** newFormats, int32_t formatNumber = 0; for (int32_t partIndex = 0; formatNumber < count && U_SUCCESS(status) && (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { - Format* newFormat = NULL; - if (newFormats[formatNumber] != NULL) { + Format* newFormat = nullptr; + if (newFormats[formatNumber] != nullptr) { newFormat = newFormats[formatNumber]->clone(); - if (newFormat == NULL) { + if (newFormat == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } } @@ -715,11 +716,11 @@ MessageFormat::adoptFormat(const UnicodeString& formatName, Format* f; if (p.isValid()) { f = p.orphan(); - } else if (formatToAdopt == NULL) { - f = NULL; + } else if (formatToAdopt == nullptr) { + f = nullptr; } else { f = formatToAdopt->clone(); - if (f == NULL) { + if (f == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -757,19 +758,19 @@ MessageFormat::setFormat(int32_t n, const Format& newFormat) { // Do nothing if the variable is not less than the array count. Format * MessageFormat::getFormat(const UnicodeString& formatName, UErrorCode& status) { - if (U_FAILURE(status) || cachedFormatters == NULL) return NULL; + if (U_FAILURE(status) || cachedFormatters == nullptr) return nullptr; int32_t argNumber = MessagePattern::validateArgumentName(formatName); if (argNumber < UMSGPAT_ARG_NAME_NOT_NUMBER) { status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } for (int32_t partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { if (argNameMatches(partIndex + 1, formatName, argNumber)) { return getCachedFormatter(partIndex); } } - return NULL; + return nullptr; } // ------------------------------------- @@ -791,7 +792,7 @@ MessageFormat::setFormat(const UnicodeString& formatName, ) { if (argNameMatches(partIndex + 1, formatName, argNumber)) { Format* new_format = newFormat.clone(); - if (new_format == NULL) { + if (new_format == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -852,21 +853,23 @@ UnicodeString MessageFormat::getArgName(int32_t partIndex) { StringEnumeration* MessageFormat::getFormatNames(UErrorCode& status) { - if (U_FAILURE(status)) return NULL; + if (U_FAILURE(status)) return nullptr; - UVector *fFormatNames = new UVector(status); + LocalPointer formatNames(new UVector(status), status); if (U_FAILURE(status)) { - status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - fFormatNames->setDeleter(uprv_deleteUObject); + formatNames->setDeleter(uprv_deleteUObject); for (int32_t partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { - fFormatNames->addElement(new UnicodeString(getArgName(partIndex + 1)), status); + LocalPointer name(getArgName(partIndex + 1).clone(), status); + formatNames->adoptElement(name.orphan(), status); + if (U_FAILURE(status)) return nullptr; } - StringEnumeration* nameEnumerator = new FormatNameEnumeration(fFormatNames, status); - return nameEnumerator; + LocalPointer nameEnumerator( + new FormatNameEnumeration(std::move(formatNames), status), status); + return U_SUCCESS(status) ? nameEnumerator.orphan() : nullptr; } // ------------------------------------- @@ -880,7 +883,7 @@ MessageFormat::format(const Formattable* source, FieldPosition& ignore, UErrorCode& success) const { - return format(source, NULL, cnt, appendTo, &ignore, success); + return format(source, nullptr, cnt, appendTo, &ignore, success); } // ------------------------------------- @@ -896,7 +899,7 @@ MessageFormat::format( const UnicodeString& pattern, UErrorCode& success) { MessageFormat temp(pattern, success); - return temp.format(arguments, NULL, cnt, appendTo, NULL, success); + return temp.format(arguments, nullptr, cnt, appendTo, nullptr, success); } // ------------------------------------- @@ -918,7 +921,7 @@ MessageFormat::format(const Formattable& source, } int32_t cnt; const Formattable* tmpPtr = source.getArray(cnt); - return format(tmpPtr, NULL, cnt, appendTo, &ignore, success); + return format(tmpPtr, nullptr, cnt, appendTo, &ignore, success); } UnicodeString& @@ -927,7 +930,7 @@ MessageFormat::format(const UnicodeString* argumentNames, int32_t count, UnicodeString& appendTo, UErrorCode& success) const { - return format(arguments, argumentNames, count, appendTo, NULL, success); + return format(arguments, argumentNames, count, appendTo, nullptr, success); } // Does linear search to find the match for an ArgName. @@ -939,7 +942,7 @@ const Formattable* MessageFormat::getArgFromListByName(const Formattable* argume return arguments + i; } } - return NULL; + return nullptr; } @@ -956,7 +959,7 @@ MessageFormat::format(const Formattable* arguments, UnicodeStringAppendable usapp(appendTo); AppendableWrapper app(usapp); - format(0, NULL, arguments, argumentNames, cnt, app, pos, status); + format(0, nullptr, arguments, argumentNames, cnt, app, pos, status); return appendTo; } @@ -971,7 +974,7 @@ class PluralSelectorContext { PluralSelectorContext(int32_t start, const UnicodeString &name, const Formattable &num, double off, UErrorCode &errorCode) : startIndex(start), argName(name), offset(off), - numberArgIndex(-1), formatter(NULL), forReplaceNumber(FALSE) { + numberArgIndex(-1), formatter(nullptr), forReplaceNumber(false) { // number needs to be set even when select() is not called. // Keep it as a Number/Formattable: // For format() methods, and to preserve information (e.g., BigDecimal). @@ -994,14 +997,14 @@ class PluralSelectorContext { const Format *formatter; /** formatted argument number - plural offset */ UnicodeString numberString; - /** TRUE if number-offset was formatted with the stock number formatter */ + /** true if number-offset was formatted with the stock number formatter */ UBool forReplaceNumber; }; } // namespace -// if argumentNames is NULL, this means arguments is a numeric array. -// arguments can not be NULL. +// if argumentNames is nullptr, this means arguments is a numeric array. +// arguments can not be nullptr. // We use const void *plNumber rather than const PluralSelectorContext *pluralNumber // so that we need not declare the PluralSelectorContext in the public header file. void MessageFormat::format(int32_t msgStart, const void *plNumber, @@ -1046,31 +1049,31 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber, UMessagePatternArgType argType = part->getArgType(); part = &msgPattern.getPart(++i); const Formattable* arg; - UBool noArg = FALSE; + UBool noArg = false; UnicodeString argName = msgPattern.getSubstring(*part); - if (argumentNames == NULL) { + if (argumentNames == nullptr) { int32_t argNumber = part->getValue(); // ARG_NUMBER if (0 <= argNumber && argNumber < cnt) { arg = arguments + argNumber; } else { - arg = NULL; - noArg = TRUE; + arg = nullptr; + noArg = true; } } else { arg = getArgFromListByName(arguments, argumentNames, cnt, argName); - if (arg == NULL) { - noArg = TRUE; + if (arg == nullptr) { + noArg = true; } } ++i; int32_t prevDestLength = appendTo.length(); - const Format* formatter = NULL; + const Format* formatter = nullptr; if (noArg) { appendTo.append( - UnicodeString(MSGFMT_LEFT_CURLY_BRACE).append(argName).append(MSGFMT_RIGHT_CURLY_BRACE)); - } else if (arg == NULL) { + UnicodeString(LEFT_CURLY_BRACE).append(argName).append(RIGHT_CURLY_BRACE)); + } else if (arg == nullptr) { appendTo.append(NULL_STRING, 4); - } else if(plNumber!=NULL && + } else if(plNumber!=nullptr && static_cast(plNumber)->numberArgIndex==(i-2)) { const PluralSelectorContext &pluralNumber = *static_cast(plNumber); @@ -1093,11 +1096,11 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber, // handled below according to argType. UnicodeString subMsgString; formatter->format(*arg, subMsgString, success); - if (subMsgString.indexOf(MSGFMT_LEFT_CURLY_BRACE) >= 0 || - (subMsgString.indexOf(MSGFMT_SINGLE_QUOTE) >= 0 && !MessageImpl::jdkAposMode(msgPattern)) + if (subMsgString.indexOf(LEFT_CURLY_BRACE) >= 0 || + (subMsgString.indexOf(SINGLE_QUOTE) >= 0 && !MessageImpl::jdkAposMode(msgPattern)) ) { MessageFormat subMsgFormat(subMsgString, fLocale, success); - subMsgFormat.format(0, NULL, arguments, argumentNames, cnt, appendTo, ignore, success); + subMsgFormat.format(0, nullptr, arguments, argumentNames, cnt, appendTo, ignore, success); } else { appendTo.append(subMsgString); } @@ -1105,9 +1108,9 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber, appendTo.formatAndAppend(formatter, *arg, success); } } else if (argType == UMSGPAT_ARG_TYPE_NONE || (cachedFormatters && uhash_iget(cachedFormatters, i - 2))) { - // We arrive here if getCachedFormatter returned NULL, but there was actually an element in the hash table. + // We arrive here if getCachedFormatter returned nullptr, but there was actually an element in the hash table. // This can only happen if the hash table contained a DummyFormat, so the if statement above is a check - // for the hash table containind DummyFormat. + // for the hash table containing DummyFormat. if (arg->isNumeric()) { const NumberFormat* nf = getDefaultNumberFormat(success); appendTo.formatAndAppend(nf, *arg, success); @@ -1126,7 +1129,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber, // because only this one converts non-double numeric types to double. const double number = arg->getDouble(success); int32_t subMsgStart = ChoiceFormat::findSubMessage(msgPattern, i, number); - formatComplexSubMessage(subMsgStart, NULL, arguments, argumentNames, + formatComplexSubMessage(subMsgStart, nullptr, arguments, argumentNames, cnt, appendTo, success); } else if (UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE(argType)) { if (!arg->isNumeric()) { @@ -1145,7 +1148,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber, cnt, appendTo, success); } else if (argType == UMSGPAT_ARG_TYPE_SELECT) { int32_t subMsgStart = SelectFormat::findSubMessage(msgPattern, i, arg->getString(success), success); - formatComplexSubMessage(subMsgStart, NULL, arguments, argumentNames, + formatComplexSubMessage(subMsgStart, nullptr, arguments, argumentNames, cnt, appendTo, success); } else { // This should never happen. @@ -1171,7 +1174,7 @@ void MessageFormat::formatComplexSubMessage(int32_t msgStart, } if (!MessageImpl::jdkAposMode(msgPattern)) { - format(msgStart, plNumber, arguments, argumentNames, cnt, appendTo, NULL, success); + format(msgStart, plNumber, arguments, argumentNames, cnt, appendTo, nullptr, success); return; } @@ -1213,11 +1216,11 @@ void MessageFormat::formatComplexSubMessage(int32_t msgStart, prevIndex = index; } } - if (sb.indexOf(MSGFMT_LEFT_CURLY_BRACE) >= 0) { + if (sb.indexOf(LEFT_CURLY_BRACE) >= 0) { UnicodeString emptyPattern; // gcc 3.3.3 fails with "UnicodeString()" as the first parameter. MessageFormat subMsgFormat(emptyPattern, fLocale, success); - subMsgFormat.applyPattern(sb, UMSGPAT_APOS_DOUBLE_REQUIRED, NULL, success); - subMsgFormat.format(0, NULL, arguments, argumentNames, cnt, appendTo, NULL, success); + subMsgFormat.applyPattern(sb, UMSGPAT_APOS_DOUBLE_REQUIRED, nullptr, success); + subMsgFormat.format(0, nullptr, arguments, argumentNames, cnt, appendTo, nullptr, success); } else { appendTo.append(sb); } @@ -1246,12 +1249,12 @@ UnicodeString MessageFormat::getLiteralStringUntilNextArgument(int32_t from) con FieldPosition* MessageFormat::updateMetaData(AppendableWrapper& /*dest*/, int32_t /*prevLength*/, FieldPosition* /*fp*/, const Formattable* /*argId*/) const { // Unlike in Java, there are no field attributes defined for MessageFormat. Do nothing. - return NULL; + return nullptr; /* - if (fp != NULL && Field.ARGUMENT.equals(fp.getFieldAttribute())) { + if (fp != nullptr && Field.ARGUMENT.equals(fp.getFieldAttribute())) { fp->setBeginIndex(prevLength); fp->setEndIndex(dest.get_length()); - return NULL; + return nullptr; } return fp; */ @@ -1266,7 +1269,7 @@ MessageFormat::findOtherSubMessage(int32_t partIndex) const { } // Iterate over (ARG_SELECTOR [ARG_INT|ARG_DOUBLE] message) tuples // until ARG_LIMIT or end of plural-only pattern. - UnicodeString other(FALSE, OTHER_STRING, 5); + UnicodeString other(false, OTHER_STRING, 5); do { part=&msgPattern.getPart(partIndex++); UMessagePatternPartType type=part->getType(); @@ -1323,14 +1326,14 @@ void MessageFormat::copyObjects(const MessageFormat& that, UErrorCode& ec) { } uprv_memcpy(argTypes, that.argTypes, argTypeCount * sizeof(argTypes[0])); } - if (cachedFormatters != NULL) { + if (cachedFormatters != nullptr) { uhash_removeAll(cachedFormatters); } - if (customFormatArgStarts != NULL) { + if (customFormatArgStarts != nullptr) { uhash_removeAll(customFormatArgStarts); } if (that.cachedFormatters) { - if (cachedFormatters == NULL) { + if (cachedFormatters == nullptr) { cachedFormatters=uhash_open(uhash_hashLong, uhash_compareLong, equalFormatsForHash, &ec); if (U_FAILURE(ec)) { @@ -1353,9 +1356,9 @@ void MessageFormat::copyObjects(const MessageFormat& that, UErrorCode& ec) { } } if (that.customFormatArgStarts) { - if (customFormatArgStarts == NULL) { + if (customFormatArgStarts == nullptr) { customFormatArgStarts=uhash_open(uhash_hashLong, uhash_compareLong, - NULL, &ec); + nullptr, &ec); } const int32_t count = uhash_count(that.customFormatArgStarts); int32_t pos, idx; @@ -1376,13 +1379,13 @@ MessageFormat::parse(int32_t msgStart, count = 0; if (U_FAILURE(ec)) { pos.setErrorIndex(pos.getIndex()); - return NULL; + return nullptr; } // parse() does not work with named arguments. if (msgPattern.hasNamedArguments()) { ec = U_ARGUMENT_TYPE_MISMATCH; pos.setErrorIndex(pos.getIndex()); - return NULL; + return nullptr; } LocalArray resultArray(new Formattable[argTypeCount ? argTypeCount : 1]); const UnicodeString& msgString=msgPattern.getPatternString(); @@ -1391,7 +1394,7 @@ MessageFormat::parse(int32_t msgStart, ParsePosition tempStatus(0); for(int32_t i=msgStart+1; ; ++i) { - UBool haveArgResult = FALSE; + UBool haveArgResult = false; const MessagePattern::Part* part=&msgPattern.getPart(i); const UMessagePatternPartType type=part->getType(); int32_t index=part->getIndex(); @@ -1402,7 +1405,7 @@ MessageFormat::parse(int32_t msgStart, prevIndex += len; } else { pos.setErrorIndex(sourceOffset); - return NULL; // leave index as is to signal error + return nullptr; // leave index as is to signal error } if(type==UMSGPAT_PART_TYPE_MSG_LIMIT) { // Things went well! Done. @@ -1423,24 +1426,24 @@ MessageFormat::parse(int32_t msgStart, int32_t argNumber = part->getValue(); // ARG_NUMBER UnicodeString key; ++i; - const Format* formatter = NULL; + const Format* formatter = nullptr; Formattable& argResult = resultArray[argNumber]; - if(cachedFormatters!=NULL && (formatter = getCachedFormatter(i - 2))!=NULL) { + if(cachedFormatters!=nullptr && (formatter = getCachedFormatter(i - 2))!=nullptr) { // Just parse using the formatter. tempStatus.setIndex(sourceOffset); formatter->parseObject(source, argResult, tempStatus); if (tempStatus.getIndex() == sourceOffset) { pos.setErrorIndex(sourceOffset); - return NULL; // leave index as is to signal error + return nullptr; // leave index as is to signal error } sourceOffset = tempStatus.getIndex(); - haveArgResult = TRUE; + haveArgResult = true; } else if( argType==UMSGPAT_ARG_TYPE_NONE || (cachedFormatters && uhash_iget(cachedFormatters, i -2))) { - // We arrive here if getCachedFormatter returned NULL, but there was actually an element in the hash table. + // We arrive here if getCachedFormatter returned nullptr, but there was actually an element in the hash table. // This can only happen if the hash table contained a DummyFormat, so the if statement above is a check - // for the hash table containind DummyFormat. + // for the hash table containing DummyFormat. // Match as a string. // if at end, use longest possible match @@ -1455,16 +1458,16 @@ MessageFormat::parse(int32_t msgStart, } if (next < 0) { pos.setErrorIndex(sourceOffset); - return NULL; // leave index as is to signal error + return nullptr; // leave index as is to signal error } else { UnicodeString strValue(source.tempSubString(sourceOffset, next - sourceOffset)); UnicodeString compValue; - compValue.append(MSGFMT_LEFT_CURLY_BRACE); + compValue.append(LEFT_CURLY_BRACE); itos(argNumber, compValue); - compValue.append(MSGFMT_RIGHT_CURLY_BRACE); + compValue.append(RIGHT_CURLY_BRACE); if (0 != strValue.compare(compValue)) { argResult.setString(strValue); - haveArgResult = TRUE; + haveArgResult = true; } sourceOffset = next; } @@ -1473,19 +1476,19 @@ MessageFormat::parse(int32_t msgStart, double choiceResult = ChoiceFormat::parseArgument(msgPattern, i, source, tempStatus); if (tempStatus.getIndex() == sourceOffset) { pos.setErrorIndex(sourceOffset); - return NULL; // leave index as is to signal error + return nullptr; // leave index as is to signal error } argResult.setDouble(choiceResult); - haveArgResult = TRUE; + haveArgResult = true; sourceOffset = tempStatus.getIndex(); } else if(UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE(argType) || argType==UMSGPAT_ARG_TYPE_SELECT) { // Parsing not supported. ec = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } else { // This should never happen. ec = U_INTERNAL_PROGRAM_ERROR; - return NULL; + return nullptr; } if (haveArgResult && count <= argNumber) { count = argNumber + 1; @@ -1519,7 +1522,7 @@ MessageFormat::parse(const UnicodeString& source, { if (msgPattern.hasNamedArguments()) { success = U_ARGUMENT_TYPE_MISMATCH; - return NULL; + return nullptr; } ParsePosition status(0); // Calls the actual implementation method and starts @@ -1528,7 +1531,7 @@ MessageFormat::parse(const UnicodeString& source, if (status.getIndex() == 0) { success = U_MESSAGE_PARSE_ERROR; delete[] result; - return NULL; + return nullptr; } return result; } @@ -1543,7 +1546,7 @@ MessageFormat::parseObject( const UnicodeString& source, { int32_t cnt = 0; Formattable* tmpResult = parse(source, status, cnt); - if (tmpResult != NULL) + if (tmpResult != nullptr) result.adoptArray(tmpResult, cnt); } @@ -1552,10 +1555,10 @@ MessageFormat::autoQuoteApostrophe(const UnicodeString& pattern, UErrorCode& sta UnicodeString result; if (U_SUCCESS(status)) { int32_t plen = pattern.length(); - const UChar* pat = pattern.getBuffer(); + const char16_t* pat = pattern.getBuffer(); int32_t blen = plen * 2 + 1; // space for null termination, convenience - UChar* buf = result.getBuffer(blen); - if (buf == NULL) { + char16_t* buf = result.getBuffer(blen); + if (buf == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } else { int32_t len = umsg_autoQuoteApostrophe(pat, plen, buf, blen, &status); @@ -1572,7 +1575,7 @@ MessageFormat::autoQuoteApostrophe(const UnicodeString& pattern, UErrorCode& sta static Format* makeRBNF(URBNFRuleSetTag tag, const Locale& locale, const UnicodeString& defaultRuleSet, UErrorCode& ec) { RuleBasedNumberFormat* fmt = new RuleBasedNumberFormat(tag, locale, ec); - if (fmt == NULL) { + if (fmt == nullptr) { ec = U_MEMORY_ALLOCATION_ERROR; } else if (U_SUCCESS(ec) && defaultRuleSet.length() > 0) { UErrorCode localStatus = U_ZERO_ERROR; // ignore unrecognized default rule set @@ -1586,10 +1589,10 @@ void MessageFormat::cacheExplicitFormats(UErrorCode& status) { return; } - if (cachedFormatters != NULL) { + if (cachedFormatters != nullptr) { uhash_removeAll(cachedFormatters); } - if (customFormatArgStarts != NULL) { + if (customFormatArgStarts != nullptr) { uhash_removeAll(customFormatArgStarts); } @@ -1620,7 +1623,7 @@ void MessageFormat::cacheExplicitFormats(UErrorCode& status) { for (int32_t i = 0; i < argTypeCount; ++i) { argTypes[i] = Formattable::kObject; } - hasArgTypeConflicts = FALSE; + hasArgTypeConflicts = false; // This loop starts at part index 1 because we do need to examine // ARG_START parts. (But we can ignore the MSG_START.) @@ -1671,7 +1674,7 @@ void MessageFormat::cacheExplicitFormats(UErrorCode& status) { } if (argNumber != -1) { if (argTypes[argNumber] != Formattable::kObject && argTypes[argNumber] != formattableType) { - hasArgTypeConflicts = TRUE; + hasArgTypeConflicts = true; } argTypes[argNumber] = formattableType; } @@ -1682,9 +1685,9 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin Formattable::Type& formattableType, UParseError& parseError, UErrorCode& ec) { if (U_FAILURE(ec)) { - return NULL; + return nullptr; } - Format* fmt = NULL; + Format* fmt = nullptr; int32_t typeID, styleID; DateFormat::EStyle date_style; int32_t firstNonSpace; @@ -1745,9 +1748,9 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin fmt = DateFormat::createTimeInstance(date_style, fLocale); } - if (styleID < 0 && fmt != NULL) { + if (styleID < 0 && fmt != nullptr) { SimpleDateFormat* sdtfmt = dynamic_cast(fmt); - if (sdtfmt != NULL) { + if (sdtfmt != nullptr) { sdtfmt->applyPattern(style); } } @@ -1779,15 +1782,15 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin //------------------------------------- // Finds the string, s, in the string array, list. int32_t MessageFormat::findKeyword(const UnicodeString& s, - const UChar * const *list) + const char16_t * const *list) { if (s.isEmpty()) { return 0; // default } int32_t length = s.length(); - const UChar *ps = PatternProps::trimWhiteSpace(s.getBuffer(), length); - UnicodeString buffer(FALSE, ps, length); + const char16_t *ps = PatternProps::trimWhiteSpace(s.getBuffer(), length); + UnicodeString buffer(false, ps, length); // Trims the space characters and turns all characters // in s to lower case. buffer.toLower(""); @@ -1806,10 +1809,10 @@ NumberFormat* MessageFormat::createIntegerFormat(const Locale& locale, UErrorCode& status) const { NumberFormat *temp = NumberFormat::createInstance(locale, status); DecimalFormat *temp2; - if (temp != NULL && (temp2 = dynamic_cast(temp)) != NULL) { + if (temp != nullptr && (temp2 = dynamic_cast(temp)) != nullptr) { temp2->setMaximumFractionDigits(0); - temp2->setDecimalSeparatorAlwaysShown(FALSE); - temp2->setParseIntegerOnly(TRUE); + temp2->setDecimalSeparatorAlwaysShown(false); + temp2->setParseIntegerOnly(true); } return temp; @@ -1817,19 +1820,19 @@ MessageFormat::createIntegerFormat(const Locale& locale, UErrorCode& status) con /** * Return the default number format. Used to format a numeric - * argument when subformats[i].format is NULL. Returns NULL + * argument when subformats[i].format is nullptr. Returns nullptr * on failure. * * Semantically const but may modify *this. */ const NumberFormat* MessageFormat::getDefaultNumberFormat(UErrorCode& ec) const { - if (defaultNumberFormat == NULL) { + if (defaultNumberFormat == nullptr) { MessageFormat* t = (MessageFormat*) this; t->defaultNumberFormat = NumberFormat::createInstance(fLocale, ec); if (U_FAILURE(ec)) { delete t->defaultNumberFormat; - t->defaultNumberFormat = NULL; - } else if (t->defaultNumberFormat == NULL) { + t->defaultNumberFormat = nullptr; + } else if (t->defaultNumberFormat == nullptr) { ec = U_MEMORY_ALLOCATION_ERROR; } } @@ -1838,16 +1841,16 @@ const NumberFormat* MessageFormat::getDefaultNumberFormat(UErrorCode& ec) const /** * Return the default date format. Used to format a date - * argument when subformats[i].format is NULL. Returns NULL + * argument when subformats[i].format is nullptr. Returns nullptr * on failure. * * Semantically const but may modify *this. */ const DateFormat* MessageFormat::getDefaultDateFormat(UErrorCode& ec) const { - if (defaultDateFormat == NULL) { + if (defaultDateFormat == nullptr) { MessageFormat* t = (MessageFormat*) this; t->defaultDateFormat = DateFormat::createDateTimeInstance(DateFormat::kShort, DateFormat::kShort, fLocale); - if (t->defaultDateFormat == NULL) { + if (t->defaultDateFormat == nullptr) { ec = U_MEMORY_ALLOCATION_ERROR; } } @@ -1870,7 +1873,7 @@ UBool MessageFormat::equalFormats(const void* left, const void* right) { bool MessageFormat::DummyFormat::operator==(const Format&) const { - return TRUE; + return true; } MessageFormat::DummyFormat* MessageFormat::DummyFormat::clone() const { @@ -1912,9 +1915,9 @@ void MessageFormat::DummyFormat::parseObject(const UnicodeString&, } -FormatNameEnumeration::FormatNameEnumeration(UVector *fNameList, UErrorCode& /*status*/) { +FormatNameEnumeration::FormatNameEnumeration(LocalPointer nameList, UErrorCode& /*status*/) { pos=0; - fFormatNames = fNameList; + fFormatNames = std::move(nameList); } const UnicodeString* @@ -1922,7 +1925,7 @@ FormatNameEnumeration::snext(UErrorCode& status) { if (U_SUCCESS(status) && pos < fFormatNames->size()) { return (const UnicodeString*)fFormatNames->elementAt(pos++); } - return NULL; + return nullptr; } void @@ -1932,15 +1935,14 @@ FormatNameEnumeration::reset(UErrorCode& /*status*/) { int32_t FormatNameEnumeration::count(UErrorCode& /*status*/) const { - return (fFormatNames==NULL) ? 0 : fFormatNames->size(); + return (fFormatNames==nullptr) ? 0 : fFormatNames->size(); } FormatNameEnumeration::~FormatNameEnumeration() { - delete fFormatNames; } MessageFormat::PluralSelectorProvider::PluralSelectorProvider(const MessageFormat &mf, UPluralType t) - : msgFormat(mf), rules(NULL), type(t) { + : msgFormat(mf), rules(nullptr), type(t) { } MessageFormat::PluralSelectorProvider::~PluralSelectorProvider() { @@ -1950,13 +1952,13 @@ MessageFormat::PluralSelectorProvider::~PluralSelectorProvider() { UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double number, UErrorCode& ec) const { if (U_FAILURE(ec)) { - return UnicodeString(FALSE, OTHER_STRING, 5); + return UnicodeString(false, OTHER_STRING, 5); } MessageFormat::PluralSelectorProvider* t = const_cast(this); - if(rules == NULL) { + if(rules == nullptr) { t->rules = PluralRules::forLocale(msgFormat.fLocale, type, ec); if (U_FAILURE(ec)) { - return UnicodeString(FALSE, OTHER_STRING, 5); + return UnicodeString(false, OTHER_STRING, 5); } } // Select a sub-message according to how the number is formatted, @@ -1968,25 +1970,25 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu PluralSelectorContext &context = *static_cast(ctx); int32_t otherIndex = msgFormat.findOtherSubMessage(context.startIndex); context.numberArgIndex = msgFormat.findFirstPluralNumberArg(otherIndex, context.argName); - if(context.numberArgIndex > 0 && msgFormat.cachedFormatters != NULL) { + if(context.numberArgIndex > 0 && msgFormat.cachedFormatters != nullptr) { context.formatter = (const Format*)uhash_iget(msgFormat.cachedFormatters, context.numberArgIndex); } - if(context.formatter == NULL) { + if(context.formatter == nullptr) { context.formatter = msgFormat.getDefaultNumberFormat(ec); - context.forReplaceNumber = TRUE; + context.forReplaceNumber = true; } if (context.number.getDouble(ec) != number) { ec = U_INTERNAL_PROGRAM_ERROR; - return UnicodeString(FALSE, OTHER_STRING, 5); + return UnicodeString(false, OTHER_STRING, 5); } context.formatter->format(context.number, context.numberString, ec); auto* decFmt = dynamic_cast(context.formatter); - if(decFmt != NULL) { + if(decFmt != nullptr) { number::impl::DecimalQuantity dq; decFmt->formatToDecimalQuantity(context.number, dq, ec); if (U_FAILURE(ec)) { - return UnicodeString(FALSE, OTHER_STRING, 5); + return UnicodeString(false, OTHER_STRING, 5); } return rules->select(dq); } else { @@ -1996,7 +1998,7 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu void MessageFormat::PluralSelectorProvider::reset() { delete rules; - rules = NULL; + rules = nullptr; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt_impl.h index 1cece1a09..84344a3a2 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/msgfmt_impl.h @@ -26,16 +26,16 @@ U_NAMESPACE_BEGIN class FormatNameEnumeration : public StringEnumeration { public: - FormatNameEnumeration(UVector *fFormatNames, UErrorCode& status); + FormatNameEnumeration(LocalPointer fFormatNames, UErrorCode& status); virtual ~FormatNameEnumeration(); - static UClassID U_EXPORT2 getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; - virtual const UnicodeString* snext(UErrorCode& status); - virtual void reset(UErrorCode& status); - virtual int32_t count(UErrorCode& status) const; + static UClassID U_EXPORT2 getStaticClassID(); + virtual UClassID getDynamicClassID() const override; + virtual const UnicodeString* snext(UErrorCode& status) override; + virtual void reset(UErrorCode& status) override; + virtual int32_t count(UErrorCode& status) const override; private: int32_t pos; - UVector *fFormatNames; + LocalPointer fFormatNames; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/name2uni.h b/src/duckdb/extension/icu/third_party/icu/i18n/name2uni.h index b67171863..6881c6bc8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/name2uni.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/name2uni.h @@ -1,93 +1,93 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2001-2007, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 06/07/01 aliu Creation. -// ********************************************************************** -// */ -// #ifndef NAME2UNI_H -// #define NAME2UNI_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/translit.h" -// #include "unicode/uniset.h" - -// U_NAMESPACE_BEGIN - -// /** -// * A transliterator that performs name to character mapping. -// * It recognizes the Perl syntax \N{name}. -// * @author Alan Liu -// */ -// class NameUnicodeTransliterator : public Transliterator { -// public: - -// /** -// * Constructs a transliterator. -// * @param adoptedFilter the filter for this transliterator. -// */ -// NameUnicodeTransliterator(UnicodeFilter* adoptedFilter = 0); - -// /** -// * Destructor. -// */ -// virtual ~NameUnicodeTransliterator(); - -// /** -// * Copy constructor. -// */ -// NameUnicodeTransliterator(const NameUnicodeTransliterator&); - -// /** -// * Transliterator API. -// * @return A copy of the object. -// */ -// virtual NameUnicodeTransliterator* clone() const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for the actual class. -// */ -// virtual UClassID getDynamicClassID() const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for this class. -// */ -// U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); - -// protected: - -// /** -// * Implements {@link Transliterator#handleTransliterate}. -// * @param text the buffer holding transliterated and -// * untransliterated text -// * @param offset the start and limit of the text, the position -// * of the cursor, and the start and limit of transliteration. -// * @param incremental if true, assume more text may be coming after -// * pos.contextLimit. Otherwise, assume the text is complete. -// */ -// virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, -// UBool isIncremental) const; - -// /** -// * Set of characters which occur in Unicode character names. -// */ -// UnicodeSet legal; -// private: -// /** -// * Assignment operator. -// */ -// NameUnicodeTransliterator& operator=(const NameUnicodeTransliterator&); -// }; - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2001-2007, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 06/07/01 aliu Creation. +********************************************************************** +*/ +#ifndef NAME2UNI_H +#define NAME2UNI_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/translit.h" +#include "unicode/uniset.h" + +U_NAMESPACE_BEGIN + +/** + * A transliterator that performs name to character mapping. + * It recognizes the Perl syntax \N{name}. + * @author Alan Liu + */ +class NameUnicodeTransliterator : public Transliterator { +public: + + /** + * Constructs a transliterator. + * @param adoptedFilter the filter for this transliterator. + */ + NameUnicodeTransliterator(UnicodeFilter* adoptedFilter = 0); + + /** + * Destructor. + */ + virtual ~NameUnicodeTransliterator(); + + /** + * Copy constructor. + */ + NameUnicodeTransliterator(const NameUnicodeTransliterator&); + + /** + * Transliterator API. + * @return A copy of the object. + */ + virtual NameUnicodeTransliterator* clone() const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + + protected: + + /** + * Implements {@link Transliterator#handleTransliterate}. + * @param text the buffer holding transliterated and + * untransliterated text + * @param offset the start and limit of the text, the position + * of the cursor, and the start and limit of transliteration. + * @param incremental if true, assume more text may be coming after + * pos.contextLimit. Otherwise, assume the text is complete. + */ + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, + UBool isIncremental) const override; + + /** + * Set of characters which occur in Unicode character names. + */ + UnicodeSet legal; +private: + /** + * Assignment operator. + */ + NameUnicodeTransliterator& operator=(const NameUnicodeTransliterator&); +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nfrlist.h b/src/duckdb/extension/icu/third_party/icu/i18n/nfrlist.h index 3eb1882b2..1864d4d3b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nfrlist.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nfrlist.h @@ -39,7 +39,7 @@ class NFRuleList : public UMemory { uint32_t fCapacity; public: NFRuleList(uint32_t capacity = 10) - : fStuff(capacity ? (NFRule**)uprv_malloc(capacity * sizeof(NFRule*)) : NULL) + : fStuff(capacity ? (NFRule**)uprv_malloc(capacity * sizeof(NFRule*)) : nullptr) , fCount(0) , fCapacity(capacity) {} ~NFRuleList() { @@ -50,10 +50,10 @@ class NFRuleList : public UMemory { uprv_free(fStuff); } } - NFRule* operator[](uint32_t index) const { return fStuff != NULL ? fStuff[index] : NULL; } + NFRule* operator[](uint32_t index) const { return fStuff != nullptr ? fStuff[index] : nullptr; } NFRule* remove(uint32_t index) { - if (fStuff == NULL) { - return NULL; + if (fStuff == nullptr) { + return nullptr; } NFRule* result = fStuff[index]; fCount -= 1; @@ -67,7 +67,7 @@ class NFRuleList : public UMemory { fCapacity += 10; fStuff = (NFRule**)uprv_realloc(fStuff, fCapacity * sizeof(NFRule*)); // assume success } - if (fStuff != NULL) { + if (fStuff != nullptr) { fStuff[fCount++] = thing; } else { fCapacity = 0; @@ -75,17 +75,17 @@ class NFRuleList : public UMemory { } } uint32_t size() const { return fCount; } - NFRule* last() const { return (fCount > 0 && fStuff != NULL) ? fStuff[fCount-1] : NULL; } + NFRule* last() const { return (fCount > 0 && fStuff != nullptr) ? fStuff[fCount-1] : nullptr; } NFRule** release() { - add(NULL); // ensure null termination + add(nullptr); // ensure null termination NFRule** result = fStuff; - fStuff = NULL; + fStuff = nullptr; fCount = 0; fCapacity = 0; return result; } void deleteAll() { - NFRule** tmp = NULL; + NFRule** tmp = nullptr; int32_t size = fCount; if (size > 0) { tmp = release(); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp index dc337728f..1f4b9b9d2 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp @@ -37,7 +37,7 @@ enum { /** 0.x */ PROPER_FRACTION_RULE_INDEX = 2, /** x.0 */ - MASTER_RULE_INDEX = 3, + DEFAULT_RULE_INDEX = 3, /** Inf */ INFINITY_RULE_INDEX = 4, /** NaN */ @@ -118,17 +118,17 @@ util_lcm(int64_t x, int64_t y) } #endif -static const UChar nfrs_gPercent = 0x0025; -static const UChar nfrs_gColon = 0x003a; -static const UChar nfrs_gSemicolon = 0x003b; -static const UChar nfrs_gLineFeed = 0x000a; +static const char16_t gPercent = 0x0025; +static const char16_t gColon = 0x003a; +static const char16_t gSemicolon = 0x003b; +static const char16_t gLineFeed = 0x000a; -static const UChar nfrs_gPercentPercent[] = +static const char16_t gPercentPercent[] = { 0x25, 0x25, 0 }; /* "%%" */ -static const UChar nfrs_gNoparse[] = +static const char16_t gNoparse[] = { 0x40, 0x6E, 0x6F, 0x70, 0x61, 0x72, 0x73, 0x65, 0 }; /* "@noparse" */ @@ -138,12 +138,12 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions, , rules(0) , owner(_owner) , fractionRules() - , fIsFractionRuleSet(FALSE) - , fIsPublic(FALSE) - , fIsParseable(TRUE) + , fIsFractionRuleSet(false) + , fIsPublic(false) + , fIsParseable(true) { for (int32_t i = 0; i < NON_NUMERICAL_RULE_LENGTH; ++i) { - nonNumericalRules[i] = NULL; + nonNumericalRules[i] = nullptr; } if (U_FAILURE(status)) { @@ -162,8 +162,8 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions, // name can be omitted in formatter descriptions that consist // of only one rule set), copy it out into our "name" member // and delete it from the description - if (description.charAt(0) == nfrs_gPercent) { - int32_t pos = description.indexOf(nfrs_gColon); + if (description.charAt(0) == gPercent) { + int32_t pos = description.indexOf(gColon); if (pos == -1) { // throw new IllegalArgumentException("Rule set name doesn't end in colon"); status = U_PARSE_ERROR; @@ -182,10 +182,10 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions, status = U_PARSE_ERROR; } - fIsPublic = name.indexOf(nfrs_gPercentPercent, 2, 0) != 0; + fIsPublic = name.indexOf(gPercentPercent, 2, 0) != 0; - if ( name.endsWith(nfrs_gNoparse,8) ) { - fIsParseable = FALSE; + if ( name.endsWith(gNoparse,8) ) { + fIsParseable = false; name.truncate(name.length()-8); // remove the @noparse from the name } @@ -214,7 +214,7 @@ NFRuleSet::parseRules(UnicodeString& description, UErrorCode& status) UnicodeString currentDescription; int32_t oldP = 0; while (oldP < description.length()) { - int32_t p = description.indexOf(nfrs_gSemicolon, oldP); + int32_t p = description.indexOf(gSemicolon, oldP); if (p == -1) { p = description.length(); } @@ -231,7 +231,7 @@ NFRuleSet::parseRules(UnicodeString& description, UErrorCode& status) // (this isn't a for loop because we might be deleting items from // the vector-- we want to make sure we only increment i when - // we _didn't_ delete aything from the vector) + // we _didn't_ delete anything from the vector) int32_t rulesSize = rules.size(); for (int32_t i = 0; i < rulesSize; i++) { NFRule* rule = rules[i]; @@ -273,13 +273,13 @@ void NFRuleSet::setNonNumericalRule(NFRule *rule) { nonNumericalRules[NEGATIVE_RULE_INDEX] = rule; } else if (baseValue == NFRule::kImproperFractionRule) { - setBestFractionRule(IMPROPER_FRACTION_RULE_INDEX, rule, TRUE); + setBestFractionRule(IMPROPER_FRACTION_RULE_INDEX, rule, true); } else if (baseValue == NFRule::kProperFractionRule) { - setBestFractionRule(PROPER_FRACTION_RULE_INDEX, rule, TRUE); + setBestFractionRule(PROPER_FRACTION_RULE_INDEX, rule, true); } - else if (baseValue == NFRule::kMasterRule) { - setBestFractionRule(MASTER_RULE_INDEX, rule, TRUE); + else if (baseValue == NFRule::kDefaultRule) { + setBestFractionRule(DEFAULT_RULE_INDEX, rule, true); } else if (baseValue == NFRule::kInfinityRule) { delete nonNumericalRules[INFINITY_RULE_INDEX]; @@ -303,7 +303,7 @@ void NFRuleSet::setBestFractionRule(int32_t originalIndex, NFRule *newRule, UBoo fractionRules.add(newRule); } NFRule *bestResult = nonNumericalRules[originalIndex]; - if (bestResult == NULL) { + if (bestResult == nullptr) { nonNumericalRules[originalIndex] = newRule; } else { @@ -323,7 +323,7 @@ NFRuleSet::~NFRuleSet() for (int i = 0; i < NON_NUMERICAL_RULE_LENGTH; i++) { if (i != IMPROPER_FRACTION_RULE_INDEX && i != PROPER_FRACTION_RULE_INDEX - && i != MASTER_RULE_INDEX) + && i != DEFAULT_RULE_INDEX) { delete nonNumericalRules[i]; } @@ -339,9 +339,9 @@ util_equalRules(const NFRule* rule1, const NFRule* rule2) return *rule1 == *rule2; } } else if (!rule2) { - return TRUE; + return true; } - return FALSE; + return false; } bool @@ -354,19 +354,19 @@ NFRuleSet::operator==(const NFRuleSet& rhs) const // ...then compare the non-numerical rule lists... for (int i = 0; i < NON_NUMERICAL_RULE_LENGTH; i++) { if (!util_equalRules(nonNumericalRules[i], rhs.nonNumericalRules[i])) { - return FALSE; + return false; } } // ...then compare the rule lists... for (uint32_t i = 0; i < rules.size(); ++i) { if (*rules[i] != *rhs.rules[i]) { - return FALSE; + return false; } } - return TRUE; + return true; } - return FALSE; + return false; } void @@ -375,12 +375,12 @@ NFRuleSet::setDecimalFormatSymbols(const DecimalFormatSymbols &newSymbols, UErro rules[i]->setDecimalFormatSymbols(newSymbols, status); } // Switch the fraction rules to mirror the DecimalFormatSymbols. - for (int32_t nonNumericalIdx = IMPROPER_FRACTION_RULE_INDEX; nonNumericalIdx <= MASTER_RULE_INDEX; nonNumericalIdx++) { + for (int32_t nonNumericalIdx = IMPROPER_FRACTION_RULE_INDEX; nonNumericalIdx <= DEFAULT_RULE_INDEX; nonNumericalIdx++) { if (nonNumericalRules[nonNumericalIdx]) { for (uint32_t fIdx = 0; fIdx < fractionRules.size(); fIdx++) { NFRule *fractionRule = fractionRules[fIdx]; if (nonNumericalRules[nonNumericalIdx]->getBaseValue() == fractionRule->getBaseValue()) { - setBestFractionRule(nonNumericalIdx, fractionRule, FALSE); + setBestFractionRule(nonNumericalIdx, fractionRule, false); } } } @@ -472,9 +472,9 @@ NFRuleSet::findDoubleRule(double number) const } } - // if there's a master rule, use it to format the number - if (nonNumericalRules[MASTER_RULE_INDEX]) { - return nonNumericalRules[MASTER_RULE_INDEX]; + // if there's a default rule, use it to format the number + if (nonNumericalRules[DEFAULT_RULE_INDEX]) { + return nonNumericalRules[DEFAULT_RULE_INDEX]; } // and if we haven't yet returned a rule, use findNormalRule() @@ -507,13 +507,13 @@ NFRuleSet::findNormalRule(int64_t number) const // do them in findRule(), because the version of format() that // takes a long bypasses findRule() and goes straight to this // function. This function does skip the fraction rules since - // we know the value is an integer (it also skips the master + // we know the value is an integer (it also skips the default // rule, since it's considered a fraction rule. Skipping the - // master rule in this function is also how we avoid infinite + // default rule in this function is also how we avoid infinite // recursion) // {dlf} unfortunately this fails if there are no rules except - // special rules. If there are no rules, use the master rule. + // special rules. If there are no rules, use the default rule. // binary-search the rule list for the applicable rule // (a rule is used for all values from its base value to @@ -535,7 +535,7 @@ NFRuleSet::findNormalRule(int64_t number) const } } if (hi == 0) { // bad rule set, minimum base > 0 - return NULL; // want to throw exception here + return nullptr; // want to throw exception here } NFRule *result = rules[hi - 1]; @@ -547,14 +547,14 @@ NFRuleSet::findNormalRule(int64_t number) const // return if (result->shouldRollBack(number)) { if (hi == 1) { // bad rule set, no prior rule to rollback to from this base - return NULL; + return nullptr; } result = rules[hi - 2]; } return result; } - // else use the master rule - return nonNumericalRules[MASTER_RULE_INDEX]; + // else use the default rule + return nonNumericalRules[DEFAULT_RULE_INDEX]; } /** @@ -630,7 +630,7 @@ NFRuleSet::findFractionRuleSetRule(double number) const // value, then the first one (the one we found above) is used if // the numerator of the fraction is 1 and the second one is used if // the numerator of the fraction is anything else (this lets us - // do things like "one third"/"two thirds" without haveing to define + // do things like "one third"/"two thirds" without having to define // a whole bunch of extra rule sets) if ((unsigned)(winner + 1) < rules.size() && rules[winner + 1]->getBaseValue() == rules[winner]->getBaseValue()) { @@ -647,7 +647,7 @@ NFRuleSet::findFractionRuleSetRule(double number) const /** * Parses a string. Matches the string to be parsed against each * of its rules (with a base value less than upperBound) and returns - * the value produced by the rule that matched the most charcters + * the value produced by the rule that matched the most characters * in the source string. * @param text The string to parse * @param parsePosition The initial position is ignored and assumed @@ -671,7 +671,7 @@ NFRuleSet::findFractionRuleSetRule(double number) const static void dumpUS(FILE* f, const UnicodeString& us) { int len = us.length(); char* buf = (char *)uprv_malloc((len+1)*sizeof(char)); //new char[len+1]; - if (buf != NULL) { + if (buf != nullptr) { us.extract(0, len, buf); buf[len] = 0; fprintf(f, "%s", buf); @@ -762,7 +762,7 @@ NFRuleSet::parse(const UnicodeString& text, ParsePosition& pos, double upperBoun #ifdef RBNF_DEBUG fprintf(stderr, " exit\n"); #endif - // finally, update the parse postion we were passed to point to the + // finally, update the parse position we were passed to point to the // first character we didn't use, and return the result that // corresponds to that string of characters pos = highWaterMark; @@ -777,13 +777,13 @@ NFRuleSet::appendRules(UnicodeString& result) const // the rule set name goes first... result.append(name); - result.append(nfrs_gColon); - result.append(nfrs_gLineFeed); + result.append(gColon); + result.append(gLineFeed); // followed by the regular rules... for (i = 0; i < rules.size(); i++) { rules[i]->_appendRuleText(result); - result.append(nfrs_gLineFeed); + result.append(gLineFeed); } // followed by the special rules (if they exist) @@ -792,19 +792,19 @@ NFRuleSet::appendRules(UnicodeString& result) const if (nonNumericalRules[i]) { if (rule->getBaseValue() == NFRule::kImproperFractionRule || rule->getBaseValue() == NFRule::kProperFractionRule - || rule->getBaseValue() == NFRule::kMasterRule) + || rule->getBaseValue() == NFRule::kDefaultRule) { for (uint32_t fIdx = 0; fIdx < fractionRules.size(); fIdx++) { NFRule *fractionRule = fractionRules[fIdx]; if (fractionRule->getBaseValue() == rule->getBaseValue()) { fractionRule->_appendRuleText(result); - result.append(nfrs_gLineFeed); + result.append(gLineFeed); } } } else { rule->_appendRuleText(result); - result.append(nfrs_gLineFeed); + result.append(gLineFeed); } } } @@ -821,7 +821,7 @@ int64_t util64_fromDouble(double d) { } else if (d > mant) { d = mant; } - UBool neg = d < 0; + UBool neg = d < 0; if (neg) { d = -d; } @@ -852,15 +852,15 @@ uint64_t util64_pow(uint32_t base, uint16_t exponent) { return result; } -static const uint8_t asciiDigits[] = { +static const uint8_t asciiDigits[] = { 0x30u, 0x31u, 0x32u, 0x33u, 0x34u, 0x35u, 0x36u, 0x37u, 0x38u, 0x39u, 0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6au, 0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x70u, 0x71u, 0x72u, 0x73u, 0x74u, 0x75u, 0x76u, - 0x77u, 0x78u, 0x79u, 0x7au, + 0x77u, 0x78u, 0x79u, 0x7au, }; -static const UChar kUMinus = (UChar)0x002d; +static const char16_t kUMinus = (char16_t)0x002d; #ifdef RBNF_DEBUG static const char kMinus = '-'; @@ -910,7 +910,7 @@ int64_t util64_atoi(const char* str, uint32_t radix) return result; } -int64_t util64_utoi(const UChar* str, uint32_t radix) +int64_t util64_utoi(const char16_t* str, uint32_t radix) { if (radix > 36) { radix = 36; @@ -925,7 +925,7 @@ int64_t util64_utoi(const UChar* str, uint32_t radix) neg = 1; } int64_t result = 0; - UChar c; + char16_t c; uint8_t b; while (((c = *str++) < 0x0080) && (b = digitInfo[c]) && ((b &= 0x7f) < radix)) { result *= lradix; @@ -938,7 +938,7 @@ int64_t util64_utoi(const UChar* str, uint32_t radix) } uint32_t util64_toa(int64_t w, char* buf, uint32_t len, uint32_t radix, UBool raw) -{ +{ if (radix > 36) { radix = 36; } else if (radix < 2) { @@ -983,8 +983,8 @@ uint32_t util64_toa(int64_t w, char* buf, uint32_t len, uint32_t radix, UBool ra } #endif -uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool raw) -{ +uint32_t util64_tou(int64_t w, char16_t* buf, uint32_t len, uint32_t radix, UBool raw) +{ if (radix > 36) { radix = 36; } else if (radix < 2) { @@ -992,13 +992,13 @@ uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool r } int64_t base = radix; - UChar* p = buf; + char16_t* p = buf; if (len && (w < 0) && (radix == 10) && !raw) { w = -w; *p++ = kUMinus; --len; } else if (len && (w == 0)) { - *p++ = (UChar)raw ? 0 : asciiDigits[0]; + *p++ = (char16_t)raw ? 0 : asciiDigits[0]; --len; } @@ -1006,7 +1006,7 @@ uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool r int64_t n = w / base; int64_t m = n * base; int32_t d = (int32_t)(w-m); - *p++ = (UChar)(raw ? d : asciiDigits[d]); + *p++ = (char16_t)(raw ? d : asciiDigits[d]); w = n; --len; } @@ -1019,7 +1019,7 @@ uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool r ++buf; } while (--p > buf) { - UChar c = *p; + char16_t c = *p; *p = *buf; *buf = c; ++buf; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.h b/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.h index 1c3bf4219..a1beedda1 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nfrs.h @@ -36,7 +36,7 @@ class NFRuleSet : public UMemory { void parseRules(UnicodeString& rules, UErrorCode& status); void setNonNumericalRule(NFRule *rule); void setBestFractionRule(int32_t originalIndex, NFRule *newRule, UBool rememberRule); - void makeIntoFractionRuleSet() { fIsFractionRuleSet = TRUE; } + void makeIntoFractionRuleSet() { fIsFractionRuleSet = true; } ~NFRuleSet(); @@ -93,11 +93,11 @@ int64_t util64_fromDouble(double d); uint64_t util64_pow(uint32_t radix, uint16_t exponent); // convert n to digit string in buffer, return length of string -uint32_t util64_tou(int64_t n, UChar* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = FALSE); +uint32_t util64_tou(int64_t n, char16_t* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = false); #ifdef RBNF_DEBUG -int64_t util64_utoi(const UChar* str, uint32_t radix = 10); -uint32_t util64_toa(int64_t n, char* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = FALSE); +int64_t util64_utoi(const char16_t* str, uint32_t radix = 10); +uint32_t util64_toa(int64_t n, char* buffer, uint32_t buflen, uint32_t radix = 10, UBool raw = false); int64_t util64_atoi(const char* str, uint32_t radix); #endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp index b1c83121a..51bd4c974 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp @@ -40,10 +40,10 @@ NFRule::NFRule(const RuleBasedNumberFormat* _rbnf, const UnicodeString &_ruleTex , exponent(0) , decimalPoint(0) , fRuleText(_ruleText) - , sub1(NULL) - , sub2(NULL) + , sub1(nullptr) + , sub2(nullptr) , formatter(_rbnf) - , rulePatternFormat(NULL) + , rulePatternFormat(nullptr) { if (!fRuleText.isEmpty()) { parseRuleDescriptor(fRuleText, status); @@ -54,54 +54,54 @@ NFRule::~NFRule() { if (sub1 != sub2) { delete sub2; - sub2 = NULL; + sub2 = nullptr; } delete sub1; - sub1 = NULL; + sub1 = nullptr; delete rulePatternFormat; - rulePatternFormat = NULL; + rulePatternFormat = nullptr; } -static const UChar nfrule_gLeftBracket = 0x005b; -static const UChar nfrule_gRightBracket = 0x005d; -static const UChar nfrule_gColon = 0x003a; -static const UChar nfrule_gZero = 0x0030; -static const UChar nfrule_gNine = 0x0039; -static const UChar nfrule_gSpace = 0x0020; -static const UChar nfrule_gSlash = 0x002f; -static const UChar nfrule_gGreaterThan = 0x003e; -static const UChar nfrule_gLessThan = 0x003c; -static const UChar nfrule_gComma = 0x002c; -static const UChar nfrule_gDot = 0x002e; -static const UChar nfrule_gTick = 0x0027; -//static const UChar gMinus = 0x002d; -static const UChar nfrule_gSemicolon = 0x003b; -static const UChar nfrule_gX = 0x0078; - -static const UChar nfrule_gMinusX[] = {0x2D, 0x78, 0}; /* "-x" */ -static const UChar nfrule_gInf[] = {0x49, 0x6E, 0x66, 0}; /* "Inf" */ -static const UChar nfrule_gNaN[] = {0x4E, 0x61, 0x4E, 0}; /* "NaN" */ - -static const UChar nfrule_gDollarOpenParenthesis[] = {0x24, 0x28, 0}; /* "$(" */ -static const UChar nfrule_gClosedParenthesisDollar[] = {0x29, 0x24, 0}; /* ")$" */ - -static const UChar nfrule_gLessLess[] = {0x3C, 0x3C, 0}; /* "<<" */ -static const UChar nfrule_gLessPercent[] = {0x3C, 0x25, 0}; /* "<%" */ -static const UChar nfrule_gLessHash[] = {0x3C, 0x23, 0}; /* "<#" */ -static const UChar nfrule_gLessZero[] = {0x3C, 0x30, 0}; /* "<0" */ -static const UChar nfrule_gGreaterGreater[] = {0x3E, 0x3E, 0}; /* ">>" */ -static const UChar nfrule_gGreaterPercent[] = {0x3E, 0x25, 0}; /* ">%" */ -static const UChar nfrule_gGreaterHash[] = {0x3E, 0x23, 0}; /* ">#" */ -static const UChar nfrule_gGreaterZero[] = {0x3E, 0x30, 0}; /* ">0" */ -static const UChar nfrule_gEqualPercent[] = {0x3D, 0x25, 0}; /* "=%" */ -static const UChar nfrule_gEqualHash[] = {0x3D, 0x23, 0}; /* "=#" */ -static const UChar nfrule_gEqualZero[] = {0x3D, 0x30, 0}; /* "=0" */ -static const UChar nfrule_gGreaterGreaterGreater[] = {0x3E, 0x3E, 0x3E, 0}; /* ">>>" */ - -static const UChar * const nfrule_RULE_PREFIXES[] = { - nfrule_gLessLess, nfrule_gLessPercent, nfrule_gLessHash, nfrule_gLessZero, - nfrule_gGreaterGreater, nfrule_gGreaterPercent,nfrule_gGreaterHash, nfrule_gGreaterZero, - nfrule_gEqualPercent, nfrule_gEqualHash, nfrule_gEqualZero, NULL +static const char16_t gLeftBracket = 0x005b; +static const char16_t gRightBracket = 0x005d; +static const char16_t gColon = 0x003a; +static const char16_t gZero = 0x0030; +static const char16_t gNine = 0x0039; +static const char16_t gSpace = 0x0020; +static const char16_t gSlash = 0x002f; +static const char16_t gGreaterThan = 0x003e; +static const char16_t gLessThan = 0x003c; +static const char16_t gComma = 0x002c; +static const char16_t gDot = 0x002e; +static const char16_t gTick = 0x0027; +//static const char16_t gMinus = 0x002d; +static const char16_t gSemicolon = 0x003b; +static const char16_t gX = 0x0078; + +static const char16_t gMinusX[] = {0x2D, 0x78, 0}; /* "-x" */ +static const char16_t gInf[] = {0x49, 0x6E, 0x66, 0}; /* "Inf" */ +static const char16_t gNaN[] = {0x4E, 0x61, 0x4E, 0}; /* "NaN" */ + +static const char16_t gDollarOpenParenthesis[] = {0x24, 0x28, 0}; /* "$(" */ +static const char16_t gClosedParenthesisDollar[] = {0x29, 0x24, 0}; /* ")$" */ + +static const char16_t gLessLess[] = {0x3C, 0x3C, 0}; /* "<<" */ +static const char16_t gLessPercent[] = {0x3C, 0x25, 0}; /* "<%" */ +static const char16_t gLessHash[] = {0x3C, 0x23, 0}; /* "<#" */ +static const char16_t gLessZero[] = {0x3C, 0x30, 0}; /* "<0" */ +static const char16_t gGreaterGreater[] = {0x3E, 0x3E, 0}; /* ">>" */ +static const char16_t gGreaterPercent[] = {0x3E, 0x25, 0}; /* ">%" */ +static const char16_t gGreaterHash[] = {0x3E, 0x23, 0}; /* ">#" */ +static const char16_t gGreaterZero[] = {0x3E, 0x30, 0}; /* ">0" */ +static const char16_t gEqualPercent[] = {0x3D, 0x25, 0}; /* "=%" */ +static const char16_t gEqualHash[] = {0x3D, 0x23, 0}; /* "=#" */ +static const char16_t gEqualZero[] = {0x3D, 0x30, 0}; /* "=0" */ +static const char16_t gGreaterGreaterGreater[] = {0x3E, 0x3E, 0x3E, 0}; /* ">>>" */ + +static const char16_t * const RULE_PREFIXES[] = { + gLessLess, gLessPercent, gLessHash, gLessZero, + gGreaterGreater, gGreaterPercent,gGreaterHash, gGreaterZero, + gEqualPercent, gEqualHash, gEqualZero, nullptr }; void @@ -115,9 +115,9 @@ NFRule::makeRules(UnicodeString& description, // we know we're making at least one rule, so go ahead and // new it up and initialize its basevalue and divisor // (this also strips the rule descriptor, if any, off the - // descripton string) + // description string) NFRule* rule1 = new NFRule(rbnf, description, status); - /* test for NULL */ + /* test for nullptr */ if (rule1 == 0) { status = U_MEMORY_ALLOCATION_ERROR; return; @@ -126,8 +126,8 @@ NFRule::makeRules(UnicodeString& description, // check the description to see whether there's text enclosed // in brackets - int32_t brack1 = description.indexOf(nfrule_gLeftBracket); - int32_t brack2 = brack1 < 0 ? -1 : description.indexOf(nfrule_gRightBracket); + int32_t brack1 = description.indexOf(gLeftBracket); + int32_t brack2 = brack1 < 0 ? -1 : description.indexOf(gRightBracket); // if the description doesn't contain a matched pair of brackets, // or if it's of a type that doesn't recognize bracketed text, @@ -144,7 +144,7 @@ NFRule::makeRules(UnicodeString& description, else { // if the description does contain a matched pair of brackets, // then it's really shorthand for two rules (with one exception) - NFRule* rule2 = NULL; + NFRule* rule2 = nullptr; UnicodeString sbuf; // we'll actually only split the rule into two rules if its @@ -153,7 +153,7 @@ NFRule::makeRules(UnicodeString& description, if ((rule1->baseValue > 0 && (rule1->baseValue % util64_pow(rule1->radix, rule1->exponent)) == 0) || rule1->getType() == kImproperFractionRule - || rule1->getType() == kMasterRule) { + || rule1->getType() == kDefaultRule) { // if it passes that test, new up the second rule. If the // rule set both rules will belong to is a fraction rule @@ -161,7 +161,7 @@ NFRule::makeRules(UnicodeString& description, // increment the original rule's base value ("rule1" actually // goes SECOND in the rule set's rule list) rule2 = new NFRule(rbnf, UnicodeString(), status); - /* test for NULL */ + /* test for nullptr */ if (rule2 == 0) { status = U_MEMORY_ALLOCATION_ERROR; return; @@ -181,9 +181,9 @@ NFRule::makeRules(UnicodeString& description, } // if the description began with "x.0" and contains bracketed - // text, it describes both the master rule and the + // text, it describes both the default rule and the // improper fraction rule - else if (rule1->getType() == kMasterRule) { + else if (rule1->getType() == kDefaultRule) { rule2->baseValue = rule1->baseValue; rule1->setType(kImproperFractionRule); } @@ -193,7 +193,7 @@ NFRule::makeRules(UnicodeString& description, rule2->radix = rule1->radix; rule2->exponent = rule1->exponent; - // rule2's rule text omits the stuff in brackets: initalize + // rule2's rule text omits the stuff in brackets: initialize // its rule text and substitutions accordingly sbuf.append(description, 0, brack1); if (brack2 + 1 < description.length()) { @@ -217,7 +217,7 @@ NFRule::makeRules(UnicodeString& description, // BEFORE rule1 in the list: in all cases, rule2 OMITS the // material in the brackets and rule1 INCLUDES the material // in the brackets) - if (rule2 != NULL) { + if (rule2 != nullptr) { if (rule2->baseValue >= kNoBase) { rules.add(rule2); } @@ -252,7 +252,7 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) // the description consists of a rule descriptor and a rule body, // separated by a colon. The rule descriptor is optional. If // it's omitted, just set the base value to 0. - int32_t p = description.indexOf(nfrule_gColon); + int32_t p = description.indexOf(gColon); if (p != -1) { // copy the descriptor out into its own string and strip it, // along with any trailing whitespace, out of the original @@ -270,16 +270,16 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) // for one of the special rules. If it does, set the base // value to the correct identifier value int descriptorLength = descriptor.length(); - UChar firstChar = descriptor.charAt(0); - UChar lastChar = descriptor.charAt(descriptorLength - 1); - if (firstChar >= nfrule_gZero && firstChar <= nfrule_gNine && lastChar != nfrule_gX) { + char16_t firstChar = descriptor.charAt(0); + char16_t lastChar = descriptor.charAt(descriptorLength - 1); + if (firstChar >= gZero && firstChar <= gNine && lastChar != gX) { // if the rule descriptor begins with a digit, it's a descriptor // for a normal rule // since we don't have Long.parseLong, and this isn't much work anyway, // just build up the value as we encounter the digits. int64_t val = 0; p = 0; - UChar c = nfrule_gSpace; + char16_t c = gSpace; // begin parsing the descriptor: copy digits // into "tempValue", skip periods, commas, and spaces, @@ -288,13 +288,13 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) int64_t ll_10 = 10; while (p < descriptorLength) { c = descriptor.charAt(p); - if (c >= nfrule_gZero && c <= nfrule_gNine) { - val = val * ll_10 + (int32_t)(c - nfrule_gZero); + if (c >= gZero && c <= gNine) { + val = val * ll_10 + (int32_t)(c - gZero); } - else if (c == nfrule_gSlash || c == nfrule_gGreaterThan) { + else if (c == gSlash || c == gGreaterThan) { break; } - else if (PatternProps::isWhiteSpace(c) || c == nfrule_gComma || c == nfrule_gDot) { + else if (PatternProps::isWhiteSpace(c) || c == gComma || c == gDot) { } else { // throw new IllegalArgumentException("Illegal character in rule descriptor"); @@ -311,19 +311,19 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) // now parsing the rule's radix. Again, accumulate digits // in tempValue, skip punctuation, stop on a > mark, and // throw an exception on anything else - if (c == nfrule_gSlash) { + if (c == gSlash) { val = 0; ++p; ll_10 = 10; while (p < descriptorLength) { c = descriptor.charAt(p); - if (c >= nfrule_gZero && c <= nfrule_gNine) { - val = val * ll_10 + (int32_t)(c - nfrule_gZero); + if (c >= gZero && c <= gNine) { + val = val * ll_10 + (int32_t)(c - gZero); } - else if (c == nfrule_gGreaterThan) { + else if (c == gGreaterThan) { break; } - else if (PatternProps::isWhiteSpace(c) || c == nfrule_gComma || c == nfrule_gDot) { + else if (PatternProps::isWhiteSpace(c) || c == gComma || c == gDot) { } else { // throw new IllegalArgumentException("Illegal character is rule descriptor"); @@ -349,10 +349,10 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) // decrement the exponent (unless the exponent is already 0). // If we see another character before reaching the end of // the descriptor, that's also a syntax error. - if (c == nfrule_gGreaterThan) { + if (c == gGreaterThan) { while (p < descriptor.length()) { c = descriptor.charAt(p); - if (c == nfrule_gGreaterThan && exponent > 0) { + if (c == gGreaterThan && exponent > 0) { --exponent; } else { // throw new IllegalArgumentException("Illegal character in rule descriptor"); @@ -363,26 +363,26 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) } } } - else if (0 == descriptor.compare(nfrule_gMinusX, 2)) { + else if (0 == descriptor.compare(gMinusX, 2)) { setType(kNegativeNumberRule); } else if (descriptorLength == 3) { - if (firstChar == nfrule_gZero && lastChar == nfrule_gX) { + if (firstChar == gZero && lastChar == gX) { setBaseValue(kProperFractionRule, status); decimalPoint = descriptor.charAt(1); } - else if (firstChar == nfrule_gX && lastChar == nfrule_gX) { + else if (firstChar == gX && lastChar == gX) { setBaseValue(kImproperFractionRule, status); decimalPoint = descriptor.charAt(1); } - else if (firstChar == nfrule_gX && lastChar == nfrule_gZero) { - setBaseValue(kMasterRule, status); + else if (firstChar == gX && lastChar == gZero) { + setBaseValue(kDefaultRule, status); decimalPoint = descriptor.charAt(1); } - else if (descriptor.compare(nfrule_gNaN, 3) == 0) { + else if (descriptor.compare(gNaN, 3) == 0) { setBaseValue(kNaNRule, status); } - else if (descriptor.compare(nfrule_gInf, 3) == 0) { + else if (descriptor.compare(gInf, 3) == 0) { setBaseValue(kInfinityRule, status); } } @@ -392,7 +392,7 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status) // finally, if the rule body begins with an apostrophe, strip it off // (this is generally used to put whitespace at the beginning of // a rule's rule text) - if (description.length() > 0 && description.charAt(0) == nfrule_gTick) { + if (description.length() > 0 && description.charAt(0) == gTick) { description.removeBetween(0, 1); } @@ -420,17 +420,17 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet, } fRuleText = ruleText; sub1 = extractSubstitution(ruleSet, predecessor, status); - if (sub1 == NULL) { + if (sub1 == nullptr) { // Small optimization. There is no need to create a redundant NullSubstitution. - sub2 = NULL; + sub2 = nullptr; } else { sub2 = extractSubstitution(ruleSet, predecessor, status); } - int32_t pluralRuleStart = fRuleText.indexOf(nfrule_gDollarOpenParenthesis, -1, 0); - int32_t pluralRuleEnd = (pluralRuleStart >= 0 ? fRuleText.indexOf(nfrule_gClosedParenthesisDollar, -1, pluralRuleStart) : -1); + int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0); + int32_t pluralRuleEnd = (pluralRuleStart >= 0 ? fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) : -1); if (pluralRuleEnd >= 0) { - int32_t endType = fRuleText.indexOf(nfrule_gComma, pluralRuleStart); + int32_t endType = fRuleText.indexOf(gComma, pluralRuleStart); if (endType < 0) { status = U_PARSE_ERROR; return; @@ -469,7 +469,7 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet, const NFRule* predecessor, UErrorCode& status) { - NFSubstitution* result = NULL; + NFSubstitution* result = nullptr; // search the rule's rule text for the first two characters of // a substitution token @@ -479,21 +479,21 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet, // if we didn't find one, create a null substitution positioned // at the end of the rule text if (subStart == -1) { - return NULL; + return nullptr; } // special-case the ">>>" token, since searching for the > at the // end will actually find the > in the middle - if (fRuleText.indexOf(nfrule_gGreaterGreaterGreater, 3, 0) == subStart) { + if (fRuleText.indexOf(gGreaterGreaterGreater, 3, 0) == subStart) { subEnd = subStart + 2; // otherwise the substitution token ends with the same character // it began with } else { - UChar c = fRuleText.charAt(subStart); + char16_t c = fRuleText.charAt(subStart); subEnd = fRuleText.indexOf(c, subStart + 1); // special case for '<%foo<<' - if (c == nfrule_gLessThan && subEnd != -1 && subEnd < fRuleText.length() - 1 && fRuleText.charAt(subEnd+1) == c) { + if (c == gLessThan && subEnd != -1 && subEnd < fRuleText.length() - 1 && fRuleText.charAt(subEnd+1) == c) { // ordinals use "=#,##0==%abbrev=" as their rule. Notice that the '==' in the middle // occurs because of the juxtaposition of two different rules. The check for '<' is a hack // to get around this. Having the duplicate at the front would cause problems with @@ -506,7 +506,7 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet, // unmatched token character), create a null substitution positioned // at the end of the rule if (subEnd == -1) { - return NULL; + return nullptr; } // if we get here, we have a real substitution token (or at least @@ -549,10 +549,10 @@ NFRule::setBaseValue(int64_t newBaseValue, UErrorCode& status) // description didn't specify a base value. This means it // has substitutions, and some substitutions hold on to copies // of the rule's divisor. Fix their copies of the divisor. - if (sub1 != NULL) { + if (sub1 != nullptr) { sub1->setDivisor(radix, exponent, status); } - if (sub2 != NULL) { + if (sub2 != nullptr) { sub2->setDivisor(radix, exponent, status); } @@ -600,8 +600,8 @@ int32_t NFRule::indexOfAnyRulePrefix() const { int result = -1; - for (int i = 0; nfrule_RULE_PREFIXES[i]; i++) { - int32_t pos = fRuleText.indexOf(*nfrule_RULE_PREFIXES[i]); + for (int i = 0; RULE_PREFIXES[i]; i++) { + int32_t pos = fRuleText.indexOf(*RULE_PREFIXES[i]); if (pos != -1 && (result == -1 || pos < result)) { result = pos; } @@ -621,9 +621,9 @@ util_equalSubstitutions(const NFSubstitution* sub1, const NFSubstitution* sub2) return *sub1 == *sub2; } } else if (!sub2) { - return TRUE; + return true; } - return FALSE; + return false; } /** @@ -650,7 +650,7 @@ NFRule::operator==(const NFRule& rhs) const */ static void util_append64(UnicodeString& result, int64_t n) { - UChar buffer[256]; + char16_t buffer[256]; int32_t len = util64_tou(n, buffer, sizeof(buffer)); UnicodeString temp(buffer, len); result.append(temp); @@ -660,12 +660,12 @@ void NFRule::_appendRuleText(UnicodeString& result) const { switch (getType()) { - case kNegativeNumberRule: result.append(nfrule_gMinusX, 2); break; - case kImproperFractionRule: result.append(nfrule_gX).append(decimalPoint == 0 ? nfrule_gDot : decimalPoint).append(nfrule_gX); break; - case kProperFractionRule: result.append(nfrule_gZero).append(decimalPoint == 0 ? nfrule_gDot : decimalPoint).append(nfrule_gX); break; - case kMasterRule: result.append(nfrule_gX).append(decimalPoint == 0 ? nfrule_gDot : decimalPoint).append(nfrule_gZero); break; - case kInfinityRule: result.append(nfrule_gInf, 3); break; - case kNaNRule: result.append(nfrule_gNaN, 3); break; + case kNegativeNumberRule: result.append(gMinusX, 2); break; + case kImproperFractionRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gX); break; + case kProperFractionRule: result.append(gZero).append(decimalPoint == 0 ? gDot : decimalPoint).append(gX); break; + case kDefaultRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gZero); break; + case kInfinityRule: result.append(gInf, 3); break; + case kNaNRule: result.append(gNaN, 3); break; default: // for a normal rule, write out its base value, and if the radix is // something other than 10, write out the radix (with the preceding @@ -675,23 +675,23 @@ NFRule::_appendRuleText(UnicodeString& result) const // a colon. util_append64(result, baseValue); if (radix != 10) { - result.append(nfrule_gSlash); + result.append(gSlash); util_append64(result, radix); } int numCarets = expectedExponent() - exponent; for (int i = 0; i < numCarets; i++) { - result.append(nfrule_gGreaterThan); + result.append(gGreaterThan); } break; } - result.append(nfrule_gColon); - result.append(nfrule_gSpace); + result.append(gColon); + result.append(gSpace); // if the rule text begins with a space, write an apostrophe // (whitespace after the rule descriptor is ignored; the // apostrophe is used to make the whitespace significant) - if (fRuleText.charAt(0) == nfrule_gSpace && (sub1 == NULL || sub1->getPos() != 0)) { - result.append(nfrule_gTick); + if (fRuleText.charAt(0) == gSpace && (sub1 == nullptr || sub1->getPos() != 0)) { + result.append(gTick); } // now, write the rule's rule text, inserting appropriate @@ -700,11 +700,11 @@ NFRule::_appendRuleText(UnicodeString& result) const ruleTextCopy.setTo(fRuleText); UnicodeString temp; - if (sub2 != NULL) { + if (sub2 != nullptr) { sub2->toString(temp); ruleTextCopy.insert(sub2->getPos(), temp); } - if (sub1 != NULL) { + if (sub1 != nullptr) { sub1->toString(temp); ruleTextCopy.insert(sub1->getPos(), temp); } @@ -713,7 +713,7 @@ NFRule::_appendRuleText(UnicodeString& result) const // and finally, top the whole thing off with a semicolon and // return the result - result.append(nfrule_gSemicolon); + result.append(gSemicolon); } int64_t NFRule::getDivisor() const @@ -749,8 +749,8 @@ NFRule::doFormat(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32 toInsertInto.insert(pos, fRuleText); } else { - pluralRuleStart = fRuleText.indexOf(nfrule_gDollarOpenParenthesis, -1, 0); - int pluralRuleEnd = fRuleText.indexOf(nfrule_gClosedParenthesisDollar, -1, pluralRuleStart); + pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0); + int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart); int initialLength = toInsertInto.length(); if (pluralRuleEnd < fRuleText.length() - 1) { toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2)); @@ -763,10 +763,10 @@ NFRule::doFormat(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32 lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength); } - if (sub2 != NULL) { + if (sub2 != nullptr) { sub2->doSubstitution(number, toInsertInto, pos - (sub2->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status); } - if (sub1 != NULL) { + if (sub1 != nullptr) { sub1->doSubstitution(number, toInsertInto, pos - (sub1->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status); } } @@ -795,8 +795,8 @@ NFRule::doFormat(double number, UnicodeString& toInsertInto, int32_t pos, int32_ toInsertInto.insert(pos, fRuleText); } else { - pluralRuleStart = fRuleText.indexOf(nfrule_gDollarOpenParenthesis, -1, 0); - int pluralRuleEnd = fRuleText.indexOf(nfrule_gClosedParenthesisDollar, -1, pluralRuleStart); + pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0); + int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart); int initialLength = toInsertInto.length(); if (pluralRuleEnd < fRuleText.length() - 1) { toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2)); @@ -817,10 +817,10 @@ NFRule::doFormat(double number, UnicodeString& toInsertInto, int32_t pos, int32_ lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength); } - if (sub2 != NULL) { + if (sub2 != nullptr) { sub2->doSubstitution(number, toInsertInto, pos - (sub2->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status); } - if (sub1 != NULL) { + if (sub1 != nullptr) { sub1->doSubstitution(number, toInsertInto, pos - (sub1->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status); } } @@ -852,11 +852,11 @@ NFRule::shouldRollBack(int64_t number) const // a modulus substitution, its base value isn't an even multiple // of 100, and the value we're trying to format _is_ an even // multiple of 100. This is called the "rollback rule." - if ((sub1 != NULL && sub1->isModulusSubstitution()) || (sub2 != NULL && sub2->isModulusSubstitution())) { + if ((sub1 != nullptr && sub1->isModulusSubstitution()) || (sub2 != nullptr && sub2->isModulusSubstitution())) { int64_t re = util64_pow(radix, exponent); return (number % re) == 0 && (baseValue % re) != 0; } - return FALSE; + return false; } //----------------------------------------------------------------------- @@ -887,7 +887,7 @@ NFRule::shouldRollBack(int64_t number) const static void dumpUS(FILE* f, const UnicodeString& us) { int len = us.length(); char* buf = (char *)uprv_malloc((len+1)*sizeof(char)); //new char[len+1]; - if (buf != NULL) { + if (buf != nullptr) { us.extract(0, len, buf); buf[len] = 0; fprintf(f, "%s", buf); @@ -908,8 +908,8 @@ NFRule::doParse(const UnicodeString& text, ParsePosition pp; UnicodeString workText(text); - int32_t sub1Pos = sub1 != NULL ? sub1->getPos() : fRuleText.length(); - int32_t sub2Pos = sub2 != NULL ? sub2->getPos() : fRuleText.length(); + int32_t sub1Pos = sub1 != nullptr ? sub1->getPos() : fRuleText.length(); + int32_t sub2Pos = sub2 != nullptr ? sub2->getPos() : fRuleText.length(); // check to see whether the text before the first substitution // matches the text at the beginning of the string being @@ -943,19 +943,19 @@ NFRule::doParse(const UnicodeString& text, // restored for ICU4C port parsePosition.setErrorIndex(pp.getErrorIndex()); resVal.setLong(0); - return TRUE; + return true; } if (baseValue == kInfinityRule) { // If you match this, don't try to perform any calculations on it. parsePosition.setIndex(pp.getIndex()); resVal.setDouble(uprv_getInfinity()); - return TRUE; + return true; } if (baseValue == kNaNRule) { // If you match this, don't try to perform any calculations on it. parsePosition.setIndex(pp.getIndex()); resVal.setDouble(uprv_getNaN()); - return TRUE; + return true; } // this is the fun part. The basic guts of the rule-matching @@ -1010,7 +1010,7 @@ NFRule::doParse(const UnicodeString& text, // null substitution), pp is now pointing at the first unmatched // character. Take note of that, and try matchToDelimiter() // on the input text again - if (pp.getIndex() != 0 || sub1 == NULL) { + if (pp.getIndex() != 0 || sub1 == nullptr) { start = pp.getIndex(); UnicodeString workText2; @@ -1030,7 +1030,7 @@ NFRule::doParse(const UnicodeString& text, // if we got a successful match on this second // matchToDelimiter() call, update the high-water mark // and result (if necessary) - if (pp2.getIndex() != 0 || sub2 == NULL) { + if (pp2.getIndex() != 0 || sub2 == nullptr) { if (prefixLength + pp.getIndex() + pp2.getIndex() > highWaterMark) { highWaterMark = prefixLength + pp.getIndex() + pp2.getIndex(); result = partialResult; @@ -1078,12 +1078,12 @@ NFRule::doParse(const UnicodeString& text, // we have to account for it here. By definition, if the matching // rule in a fraction rule set has no substitutions, its numerator // is 1, and so the result is the reciprocal of its base value. - if (isFractionRule && highWaterMark > 0 && sub1 == NULL) { + if (isFractionRule && highWaterMark > 0 && sub1 == nullptr) { result = 1 / result; } resVal.setDouble(result); - return TRUE; // ??? do we need to worry if it is a long or a double? + return true; // ??? do we need to worry if it is a long or a double? } /** @@ -1191,7 +1191,7 @@ NFRule::matchToDelimiter(const UnicodeString& text, if (subText.length() > 0) { UBool success = sub->doParse(subText, tempPP, _baseValue, upperBound, #if UCONFIG_NO_COLLATION - FALSE, + false, #else formatter->isLenient(), #endif @@ -1235,7 +1235,7 @@ NFRule::matchToDelimiter(const UnicodeString& text, // for "delimiter". Instead, just use "sub" to parse as much of // "text" as possible. } - else if (sub == NULL) { + else if (sub == nullptr) { return _baseValue; } else { @@ -1245,7 +1245,7 @@ NFRule::matchToDelimiter(const UnicodeString& text, // try to match the whole string against the substitution UBool success = sub->doParse(text, tempPP, _baseValue, upperBound, #if UCONFIG_NO_COLLATION - FALSE, + false, #else formatter->isLenient(), #endif @@ -1297,6 +1297,10 @@ NFRule::prefixLength(const UnicodeString& str, const UnicodeString& prefix, UErr #if !UCONFIG_NO_COLLATION // go through all this grief if we're in lenient-parse mode if (formatter->isLenient()) { + // Check if non-lenient rule finds the text before call lenient parsing + if (str.startsWith(prefix)) { + return prefix.length(); + } // get the formatter's collator and use it to create two // collation element iterators, one over the target string // and another over the prefix (right now, we'll throw an @@ -1305,7 +1309,7 @@ NFRule::prefixLength(const UnicodeString& str, const UnicodeString& prefix, UErr // the CollationElementIterator protocol. Hopefully, this // will change someday.) const RuleBasedCollator* collator = formatter->getCollator(); - if (collator == NULL) { + if (collator == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -1483,8 +1487,8 @@ NFRule::findText(const UnicodeString& str, rulePatternFormat->parseType(str, this, result, position); int start = position.getBeginIndex(); if (start >= 0) { - int32_t pluralRuleStart = fRuleText.indexOf(nfrule_gDollarOpenParenthesis, -1, 0); - int32_t pluralRuleSuffix = fRuleText.indexOf(nfrule_gClosedParenthesisDollar, -1, pluralRuleStart) + 2; + int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0); + int32_t pluralRuleSuffix = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) + 2; int32_t matchLen = position.getEndIndex() - start; UnicodeString prefix(fRuleText.tempSubString(0, pluralRuleStart)); UnicodeString suffix(fRuleText.tempSubString(pluralRuleSuffix)); @@ -1505,9 +1509,15 @@ NFRule::findText(const UnicodeString& str, return str.indexOf(key, startingAt); } else { - // but if lenient parsing is turned ON, we've got some work - // ahead of us - return findTextLenient(str, key, startingAt, length); + // Check if non-lenient rule finds the text before call lenient parsing + *length = key.length(); + int32_t pos = str.indexOf(key, startingAt); + if(pos >= 0) { + return pos; + } else { + // but if lenient parsing is turned ON, we've got some work ahead of us + return findTextLenient(str, key, startingAt, length); + } } } @@ -1523,7 +1533,7 @@ NFRule::findTextLenient(const UnicodeString& str, // in JDK 1.2, CollationElementIterator provides us with an // API to map between character offsets and collation elements // and we can do this by marching through the string comparing - // collation elements. We can't do that in JDK 1.1. Insted, + // collation elements. We can't do that in JDK 1.1. Instead, // we have to go through this horrible slow mess: int32_t p = startingAt; int32_t keyLen = 0; @@ -1569,7 +1579,7 @@ NFRule::allIgnorable(const UnicodeString& str, UErrorCode& status) const { // if the string is empty, we can just return true if (str.length() == 0) { - return TRUE; + return true; } #if !UCONFIG_NO_COLLATION @@ -1578,16 +1588,16 @@ NFRule::allIgnorable(const UnicodeString& str, UErrorCode& status) const // element is 0 (ignorable) at the primary level if (formatter->isLenient()) { const RuleBasedCollator* collator = formatter->getCollator(); - if (collator == NULL) { + if (collator == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } LocalPointer iter(collator->createCollationElementIterator(str)); // Memory allocation error check. if (iter.isNull()) { status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } UErrorCode err = U_ZERO_ERROR; @@ -1603,15 +1613,15 @@ NFRule::allIgnorable(const UnicodeString& str, UErrorCode& status) const // if lenient parsing is turned off, there is no such thing as // an ignorable character: return true only if the string is empty - return FALSE; + return false; } void NFRule::setDecimalFormatSymbols(const DecimalFormatSymbols& newSymbols, UErrorCode& status) { - if (sub1 != NULL) { + if (sub1 != nullptr) { sub1->setDecimalFormatSymbols(newSymbols, status); } - if (sub2 != NULL) { + if (sub2 != nullptr) { sub2->setDecimalFormatSymbols(newSymbols, status); } } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.h b/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.h index 0934b5490..fda74fabf 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nfrule.h @@ -38,7 +38,7 @@ class NFRule : public UMemory { kNegativeNumberRule = -1, kImproperFractionRule = -2, kProperFractionRule = -3, - kMasterRule = -4, + kDefaultRule = -4, kInfinityRule = -5, kNaNRule = -6, kOtherRule = -7 @@ -63,7 +63,7 @@ class NFRule : public UMemory { int64_t getBaseValue() const { return baseValue; } void setBaseValue(int64_t value, UErrorCode& status); - UChar getDecimalPoint() const { return decimalPoint; } + char16_t getDecimalPoint() const { return decimalPoint; } int64_t getDivisor() const; @@ -108,7 +108,7 @@ class NFRule : public UMemory { int64_t baseValue; int32_t radix; int16_t exponent; - UChar decimalPoint; + char16_t decimalPoint; UnicodeString fRuleText; NFSubstitution* sub1; NFSubstitution* sub2; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp index 77e49af87..5256b8a39 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp @@ -25,23 +25,23 @@ #if U_HAVE_RBNF -static const UChar gLessThan = 0x003c; -static const UChar gEquals = 0x003d; -static const UChar gGreaterThan = 0x003e; -static const UChar gPercent = 0x0025; -static const UChar gPound = 0x0023; -static const UChar gZero = 0x0030; -static const UChar gSpace = 0x0020; - -static const UChar gEqualsEquals[] = +static const char16_t gLessThan = 0x003c; +static const char16_t gEquals = 0x003d; +static const char16_t gGreaterThan = 0x003e; +static const char16_t gPercent = 0x0025; +static const char16_t gPound = 0x0023; +static const char16_t gZero = 0x0030; +static const char16_t gSpace = 0x0020; + +static const char16_t gEqualsEquals[] = { 0x3D, 0x3D, 0 }; /* "==" */ -static const UChar gGreaterGreaterGreaterThan[] = +static const char16_t gGreaterGreaterGreaterThan[] = { 0x3E, 0x3E, 0x3E, 0 }; /* ">>>" */ -static const UChar gGreaterGreaterThan[] = +static const char16_t gGreaterGreaterThan[] = { 0x3E, 0x3E, 0 }; /* ">>" */ @@ -58,15 +58,15 @@ class SameValueSubstitution : public NFSubstitution { UErrorCode& status); virtual ~SameValueSubstitution(); - virtual int64_t transformNumber(int64_t number) const { return number; } - virtual double transformNumber(double number) const { return number; } - virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { return newRuleValue; } - virtual double calcUpperBound(double oldUpperBound) const { return oldUpperBound; } - virtual UChar tokenChar() const { return (UChar)0x003d; } // '=' + virtual int64_t transformNumber(int64_t number) const override { return number; } + virtual double transformNumber(double number) const override { return number; } + virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const override { return newRuleValue; } + virtual double calcUpperBound(double oldUpperBound) const override { return oldUpperBound; } + virtual char16_t tokenChar() const override { return (char16_t)0x003d; } // '=' public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; SameValueSubstitution::~SameValueSubstitution() {} @@ -88,7 +88,7 @@ class MultiplierSubstitution : public NFSubstitution { } virtual ~MultiplierSubstitution(); - virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) { + virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) override { divisor = util64_pow(radix, exponent); if(divisor == 0) { @@ -96,31 +96,49 @@ class MultiplierSubstitution : public NFSubstitution { } } - virtual bool operator==(const NFSubstitution& rhs) const; + virtual bool operator==(const NFSubstitution& rhs) const override; - virtual int64_t transformNumber(int64_t number) const { + virtual int64_t transformNumber(int64_t number) const override { return number / divisor; } - virtual double transformNumber(double number) const { - if (getRuleSet()) { + virtual double transformNumber(double number) const override { + bool doFloor = getRuleSet() != nullptr; + if (!doFloor) { + // This is a HACK that partially addresses ICU-22313. The original code wanted us to do + // floor() on the result if we were passing it to another rule set, but not if we were passing + // it to a DecimalFormat. But the DurationRules rule set has multiplier substitutions where + // we DO want to do the floor() operation. What we REALLY want is to do floor() any time + // the owning rule also has a ModulusSubsitution, but we don't have access to that information + // here, so instead we're doing a floor() any time the DecimalFormat has maxFracDigits equal to + // 0. This seems to work with our existing rule sets, but could be a problem in the future, + // but the "real" fix for DurationRules isn't worth doing, since we're deprecating DurationRules + // anyway. This is enough to keep it from being egregiously wrong, without obvious side + // effects. --rtg 8/16/23 + const DecimalFormat* decimalFormat = getNumberFormat(); + if (decimalFormat == nullptr || decimalFormat->getMaximumFractionDigits() == 0) { + doFloor = true; + } + } + + if (doFloor) { return uprv_floor(number / divisor); } else { return number / divisor; } } - virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { + virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const override { return newRuleValue * divisor; } - virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast(divisor); } + virtual double calcUpperBound(double /*oldUpperBound*/) const override { return static_cast(divisor); } - virtual UChar tokenChar() const { return (UChar)0x003c; } // '<' + virtual char16_t tokenChar() const override { return (char16_t)0x003c; } // '<' public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; MultiplierSubstitution::~MultiplierSubstitution() {} @@ -137,7 +155,7 @@ class ModulusSubstitution : public NFSubstitution { UErrorCode& status); virtual ~ModulusSubstitution(); - virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) { + virtual void setDivisor(int32_t radix, int16_t exponent, UErrorCode& status) override { divisor = util64_pow(radix, exponent); if (divisor == 0) { @@ -145,37 +163,37 @@ class ModulusSubstitution : public NFSubstitution { } } - virtual bool operator==(const NFSubstitution& rhs) const; + virtual bool operator==(const NFSubstitution& rhs) const override; - virtual void doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const; - virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const; + virtual void doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const override; + virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const override; - virtual int64_t transformNumber(int64_t number) const { return number % divisor; } - virtual double transformNumber(double number) const { return uprv_fmod(number, static_cast(divisor)); } + virtual int64_t transformNumber(int64_t number) const override { return number % divisor; } + virtual double transformNumber(double number) const override { return uprv_fmod(number, static_cast(divisor)); } - virtual UBool doParse(const UnicodeString& text, + virtual UBool doParse(const UnicodeString& text, ParsePosition& parsePosition, double baseValue, double upperBound, UBool lenientParse, uint32_t nonNumericalExecutedRuleMask, - Formattable& result) const; + Formattable& result) const override; - virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const override { return oldRuleValue - uprv_fmod(oldRuleValue, static_cast(divisor)) + newRuleValue; } - virtual double calcUpperBound(double /*oldUpperBound*/) const { return static_cast(divisor); } + virtual double calcUpperBound(double /*oldUpperBound*/) const override { return static_cast(divisor); } - virtual UBool isModulusSubstitution() const { return TRUE; } + virtual UBool isModulusSubstitution() const override { return true; } - virtual UChar tokenChar() const { return (UChar)0x003e; } // '>' + virtual char16_t tokenChar() const override { return (char16_t)0x003e; } // '>' - virtual void toString(UnicodeString& result) const; + virtual void toString(UnicodeString& result) const override; public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; ModulusSubstitution::~ModulusSubstitution() {} @@ -189,15 +207,15 @@ class IntegralPartSubstitution : public NFSubstitution { : NFSubstitution(_pos, _ruleSet, description, status) {} virtual ~IntegralPartSubstitution(); - virtual int64_t transformNumber(int64_t number) const { return number; } - virtual double transformNumber(double number) const { return uprv_floor(number); } - virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; } - virtual double calcUpperBound(double /*oldUpperBound*/) const { return DBL_MAX; } - virtual UChar tokenChar() const { return (UChar)0x003c; } // '<' + virtual int64_t transformNumber(int64_t number) const override { return number; } + virtual double transformNumber(double number) const override { return uprv_floor(number); } + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const override { return newRuleValue + oldRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const override { return DBL_MAX; } + virtual char16_t tokenChar() const override { return (char16_t)0x003c; } // '<' public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; IntegralPartSubstitution::~IntegralPartSubstitution() {} @@ -213,12 +231,12 @@ class FractionalPartSubstitution : public NFSubstitution { UErrorCode& status); virtual ~FractionalPartSubstitution(); - virtual bool operator==(const NFSubstitution& rhs) const; + virtual bool operator==(const NFSubstitution& rhs) const override; - virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const; - virtual void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/, int32_t /*recursionCount*/, UErrorCode& /*status*/) const {} - virtual int64_t transformNumber(int64_t /*number*/) const { return 0; } - virtual double transformNumber(double number) const { return number - uprv_floor(number); } + virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const override; + virtual void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/, int32_t /*recursionCount*/, UErrorCode& /*status*/) const override {} + virtual int64_t transformNumber(int64_t /*number*/) const override { return 0; } + virtual double transformNumber(double number) const override { return number - uprv_floor(number); } virtual UBool doParse(const UnicodeString& text, ParsePosition& parsePosition, @@ -226,15 +244,15 @@ class FractionalPartSubstitution : public NFSubstitution { double upperBound, UBool lenientParse, uint32_t nonNumericalExecutedRuleMask, - Formattable& result) const; + Formattable& result) const override; - virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; } - virtual double calcUpperBound(double /*oldUpperBound*/) const { return 0.0; } - virtual UChar tokenChar() const { return (UChar)0x003e; } // '>' + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const override { return newRuleValue + oldRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const override { return 0.0; } + virtual char16_t tokenChar() const override { return (char16_t)0x003e; } // '>' public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; FractionalPartSubstitution::~FractionalPartSubstitution() {} @@ -248,15 +266,15 @@ class AbsoluteValueSubstitution : public NFSubstitution { : NFSubstitution(_pos, _ruleSet, description, status) {} virtual ~AbsoluteValueSubstitution(); - virtual int64_t transformNumber(int64_t number) const { return number >= 0 ? number : -number; } - virtual double transformNumber(double number) const { return uprv_fabs(number); } - virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { return -newRuleValue; } - virtual double calcUpperBound(double /*oldUpperBound*/) const { return DBL_MAX; } - virtual UChar tokenChar() const { return (UChar)0x003e; } // '>' + virtual int64_t transformNumber(int64_t number) const override { return number >= 0 ? number : -number; } + virtual double transformNumber(double number) const override { return uprv_fabs(number); } + virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const override { return -newRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const override { return DBL_MAX; } + virtual char16_t tokenChar() const override { return (char16_t)0x003e; } // '>' public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; AbsoluteValueSubstitution::~AbsoluteValueSubstitution() {} @@ -278,37 +296,37 @@ class NumeratorSubstitution : public NFSubstitution { NFRuleSet* _ruleSet, const UnicodeString& description, UErrorCode& status) - : NFSubstitution(_pos, _ruleSet, fixdesc(description), status), denominator(_denominator) + : NFSubstitution(_pos, _ruleSet, fixdesc(description), status), denominator(_denominator) { ldenominator = util64_fromDouble(denominator); withZeros = description.endsWith(LTLT, 2); } virtual ~NumeratorSubstitution(); - virtual bool operator==(const NFSubstitution& rhs) const; + virtual bool operator==(const NFSubstitution& rhs) const override; - virtual int64_t transformNumber(int64_t number) const { return number * ldenominator; } - virtual double transformNumber(double number) const { return uprv_round(number * denominator); } + virtual int64_t transformNumber(int64_t number) const override { return number * ldenominator; } + virtual double transformNumber(double number) const override { return uprv_round(number * denominator); } - virtual void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/, int32_t /*recursionCount*/, UErrorCode& /*status*/) const {} - virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const; - virtual UBool doParse(const UnicodeString& text, + virtual void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/, int32_t /*recursionCount*/, UErrorCode& /*status*/) const override {} + virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos, int32_t recursionCount, UErrorCode& status) const override; + virtual UBool doParse(const UnicodeString& text, ParsePosition& parsePosition, double baseValue, double upperBound, UBool /*lenientParse*/, uint32_t nonNumericalExecutedRuleMask, - Formattable& result) const; + Formattable& result) const override; - virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue / oldRuleValue; } - virtual double calcUpperBound(double /*oldUpperBound*/) const { return denominator; } - virtual UChar tokenChar() const { return (UChar)0x003c; } // '<' + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const override { return newRuleValue / oldRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const override { return denominator; } + virtual char16_t tokenChar() const override { return (char16_t)0x003c; } // '<' private: - static const UChar LTLT[2]; + static const char16_t LTLT[2]; public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; NumeratorSubstitution::~NumeratorSubstitution() {} @@ -324,7 +342,7 @@ NFSubstitution::makeSubstitution(int32_t pos, { // if the description is empty, return a NullSubstitution if (description.length() == 0) { - return NULL; + return nullptr; } switch (description.charAt(0)) { @@ -335,14 +353,14 @@ NFSubstitution::makeSubstitution(int32_t pos, if (rule->getBaseValue() == NFRule::kNegativeNumberRule) { // throw new IllegalArgumentException("<< not allowed in negative-number rule"); status = U_PARSE_ERROR; - return NULL; + return nullptr; } // if the rule is a fraction rule, return an // IntegralPartSubstitution else if (rule->getBaseValue() == NFRule::kImproperFractionRule || rule->getBaseValue() == NFRule::kProperFractionRule - || rule->getBaseValue() == NFRule::kMasterRule) { + || rule->getBaseValue() == NFRule::kDefaultRule) { return new IntegralPartSubstitution(pos, ruleSet, description, status); } @@ -371,7 +389,7 @@ NFSubstitution::makeSubstitution(int32_t pos, // FractionalPartSubstitution else if (rule->getBaseValue() == NFRule::kImproperFractionRule || rule->getBaseValue() == NFRule::kProperFractionRule - || rule->getBaseValue() == NFRule::kMasterRule) { + || rule->getBaseValue() == NFRule::kDefaultRule) { return new FractionalPartSubstitution(pos, ruleSet, description, status); } @@ -380,7 +398,7 @@ NFSubstitution::makeSubstitution(int32_t pos, else if (ruleSet->isFractionRuleSet()) { // throw new IllegalArgumentException(">> not allowed in fraction rule set"); status = U_PARSE_ERROR; - return NULL; + return nullptr; } // otherwise, return a ModulusSubstitution @@ -399,14 +417,14 @@ NFSubstitution::makeSubstitution(int32_t pos, // throw new IllegalArgumentException("Illegal substitution character"); status = U_PARSE_ERROR; } - return NULL; + return nullptr; } NFSubstitution::NFSubstitution(int32_t _pos, const NFRuleSet* _ruleSet, const UnicodeString& description, UErrorCode& status) - : pos(_pos), ruleSet(NULL), numberFormat(NULL) + : pos(_pos), ruleSet(nullptr), numberFormat(nullptr) { // the description should begin and end with the same character. // If it doesn't that's a syntax error. Otherwise, @@ -448,7 +466,7 @@ NFSubstitution::NFSubstitution(int32_t _pos, return; } DecimalFormat *tempNumberFormat = new DecimalFormat(workingDescription, *sym, status); - /* test for NULL */ + /* test for nullptr */ if (!tempNumberFormat) { status = U_MEMORY_ALLOCATION_ERROR; return; @@ -467,9 +485,9 @@ NFSubstitution::NFSubstitution(int32_t _pos, // a number even when it's 0) // this causes problems when >>> is used in a frationalPartSubstitution - // this->ruleSet = NULL; + // this->ruleSet = nullptr; this->ruleSet = _ruleSet; - this->numberFormat = NULL; + this->numberFormat = nullptr; } else { // and of the description is none of these things, it's a syntax error @@ -482,7 +500,7 @@ NFSubstitution::NFSubstitution(int32_t _pos, NFSubstitution::~NFSubstitution() { delete numberFormat; - numberFormat = NULL; + numberFormat = nullptr; } /** @@ -499,7 +517,7 @@ NFSubstitution::setDivisor(int32_t /*radix*/, int16_t /*exponent*/, UErrorCode& void NFSubstitution::setDecimalFormatSymbols(const DecimalFormatSymbols &newSymbols, UErrorCode& /*status*/) { - if (numberFormat != NULL) { + if (numberFormat != nullptr) { numberFormat->setDecimalFormatSymbols(newSymbols); } } @@ -523,10 +541,10 @@ NFSubstitution::operator==(const NFSubstitution& rhs) const // this should be called by subclasses before their own equality tests return typeid(*this) == typeid(rhs) && pos == rhs.pos - && (ruleSet == NULL) == (rhs.ruleSet == NULL) + && (ruleSet == nullptr) == (rhs.ruleSet == nullptr) // && ruleSet == rhs.ruleSet causes circularity, other checks to make instead? - && (numberFormat == NULL - ? (rhs.numberFormat == NULL) + && (numberFormat == nullptr + ? (rhs.numberFormat == nullptr) : (*numberFormat == *rhs.numberFormat)); } @@ -547,9 +565,9 @@ NFSubstitution::toString(UnicodeString& text) const text.append(tokenChar()); UnicodeString temp; - if (ruleSet != NULL) { + if (ruleSet != nullptr) { ruleSet->getName(temp); - } else if (numberFormat != NULL) { + } else if (numberFormat != nullptr) { numberFormat->toPattern(temp); } text.append(temp); @@ -573,12 +591,12 @@ NFSubstitution::toString(UnicodeString& text) const void NFSubstitution::doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t _pos, int32_t recursionCount, UErrorCode& status) const { - if (ruleSet != NULL) { + if (ruleSet != nullptr) { // Perform a transformation on the number that is dependent // on the type of substitution this is, then just call its // rule set's format() method to format the result ruleSet->format(transformNumber(number), toInsertInto, _pos + this->pos, recursionCount, status); - } else if (numberFormat != NULL) { + } else if (numberFormat != nullptr) { if (number <= MAX_INT64_IN_DOUBLE) { // or perform the transformation on the number (preserving // the result's fractional part if the formatter it set @@ -592,20 +610,20 @@ NFSubstitution::doSubstitution(int64_t number, UnicodeString& toInsertInto, int3 UnicodeString temp; numberFormat->format(numberToFormat, temp, status); toInsertInto.insert(_pos + this->pos, temp); - } - else { - // We have gone beyond double precision. Something has to give. - // We're favoring accuracy of the large number over potential rules - // that round like a CompactDecimalFormat, which is not a common use case. - // - // Perform a transformation on the number that is dependent - // on the type of substitution this is, then just call its - // rule set's format() method to format the result - int64_t numberToFormat = transformNumber(number); + } + else { + // We have gone beyond double precision. Something has to give. + // We're favoring accuracy of the large number over potential rules + // that round like a CompactDecimalFormat, which is not a common use case. + // + // Perform a transformation on the number that is dependent + // on the type of substitution this is, then just call its + // rule set's format() method to format the result + int64_t numberToFormat = transformNumber(number); UnicodeString temp; numberFormat->format(numberToFormat, temp, status); toInsertInto.insert(_pos + this->pos, temp); - } + } } } @@ -634,16 +652,16 @@ NFSubstitution::doSubstitution(double number, UnicodeString& toInsertInto, int32 // if the result is an integer, from here on out we work in integer // space (saving time and memory and preserving accuracy) - if (numberToFormat == uprv_floor(numberToFormat) && ruleSet != NULL) { + if (numberToFormat == uprv_floor(numberToFormat) && ruleSet != nullptr) { ruleSet->format(util64_fromDouble(numberToFormat), toInsertInto, _pos + this->pos, recursionCount, status); // if the result isn't an integer, then call either our rule set's // format() method or our DecimalFormat's format() method to // format the result } else { - if (ruleSet != NULL) { + if (ruleSet != nullptr) { ruleSet->format(numberToFormat, toInsertInto, _pos + this->pos, recursionCount, status); - } else if (numberFormat != NULL) { + } else if (numberFormat != nullptr) { UnicodeString temp; numberFormat->format(numberToFormat, temp); toInsertInto.insert(_pos + this->pos, temp); @@ -715,7 +733,7 @@ NFSubstitution::doParse(const UnicodeString& text, // be false even when the formatter's lenient-parse mode is // on), then also try parsing the text using a default- // constructed NumberFormat - if (ruleSet != NULL) { + if (ruleSet != nullptr) { ruleSet->parse(text, parsePosition, upperBound, nonNumericalExecutedRuleMask, result); if (lenientParse && !ruleSet->isFractionRuleSet() && parsePosition.getIndex() == 0) { UErrorCode status = U_ZERO_ERROR; @@ -727,7 +745,7 @@ NFSubstitution::doParse(const UnicodeString& text, } // ...or use our DecimalFormat to parse the text - } else if (numberFormat != NULL) { + } else if (numberFormat != nullptr) { numberFormat->parse(text, result, parsePosition); } @@ -763,11 +781,11 @@ NFSubstitution::doParse(const UnicodeString& text, // the result. tempResult = composeRuleValue(tempResult, baseValue); result.setDouble(tempResult); - return TRUE; + return true; // if the parse was UNsuccessful, return 0 } else { result.setLong(0); - return FALSE; + return false; } } @@ -779,7 +797,7 @@ NFSubstitution::doParse(const UnicodeString& text, */ UBool NFSubstitution::isModulusSubstitution() const { - return FALSE; + return false; } //=================================================================== @@ -834,7 +852,7 @@ ModulusSubstitution::ModulusSubstitution(int32_t _pos, UErrorCode& status) : NFSubstitution(_pos, _ruleSet, description, status) , divisor(rule->getDivisor()) - , ruleToUse(NULL) + , ruleToUse(nullptr) { // the owning rule's divisor controls the behavior of this // substitution: rather than keeping a backpointer to the rule, @@ -845,7 +863,7 @@ ModulusSubstitution::ModulusSubstitution(int32_t _pos, } if (0 == description.compare(gGreaterGreaterGreaterThan, 3)) { - // the >>> token doesn't alter how this substituion calculates the + // the >>> token doesn't alter how this substitution calculates the // values it uses for formatting and parsing, but it changes // what's done with that value after it's obtained: >>> short- // circuits the rule-search process and goes straight to the @@ -882,7 +900,7 @@ ModulusSubstitution::doSubstitution(int64_t number, UnicodeString& toInsertInto, // if this isn't a >>> substitution, just use the inherited version // of this function (which uses either a rule set or a DecimalFormat // to format its substitution value) - if (ruleToUse == NULL) { + if (ruleToUse == nullptr) { NFSubstitution::doSubstitution(number, toInsertInto, _pos, recursionCount, status); // a >>> substitution goes straight to a particular rule to @@ -907,7 +925,7 @@ ModulusSubstitution::doSubstitution(double number, UnicodeString& toInsertInto, // if this isn't a >>> substitution, just use the inherited version // of this function (which uses either a rule set or a DecimalFormat // to format its substitution value) - if (ruleToUse == NULL) { + if (ruleToUse == nullptr) { NFSubstitution::doSubstitution(number, toInsertInto, _pos, recursionCount, status); // a >>> substitution goes straight to a particular rule to @@ -943,14 +961,14 @@ ModulusSubstitution::doParse(const UnicodeString& text, { // if this isn't a >>> substitution, we can just use the // inherited parse() routine to do the parsing - if (ruleToUse == NULL) { + if (ruleToUse == nullptr) { return NFSubstitution::doParse(text, parsePosition, baseValue, upperBound, lenientParse, nonNumericalExecutedRuleMask, result); // but if it IS a >>> substitution, we have to do it here: we // use the specific rule's doParse() method, and then we have to // do some of the other work of NFRuleSet.parse() } else { - ruleToUse->doParse(text, parsePosition, FALSE, upperBound, nonNumericalExecutedRuleMask, result); + ruleToUse->doParse(text, parsePosition, false, upperBound, nonNumericalExecutedRuleMask, result); if (parsePosition.getIndex() != 0) { UErrorCode status = U_ZERO_ERROR; @@ -959,7 +977,7 @@ ModulusSubstitution::doParse(const UnicodeString& text, result.setDouble(tempResult); } - return TRUE; + return true; } } /** @@ -976,7 +994,7 @@ ModulusSubstitution::toString(UnicodeString& text) const // either the name of the rule set it uses, or the pattern of // the DecimalFormat it uses - if ( ruleToUse != NULL ) { // Must have been a >>> substitution. + if ( ruleToUse != nullptr ) { // Must have been a >>> substitution. text.remove(); text.append(tokenChar()); text.append(tokenChar()); @@ -1007,17 +1025,17 @@ FractionalPartSubstitution::FractionalPartSubstitution(int32_t _pos, const UnicodeString& description, UErrorCode& status) : NFSubstitution(_pos, _ruleSet, description, status) - , byDigits(FALSE) - , useSpaces(TRUE) + , byDigits(false) + , useSpaces(true) { // akk, ruleSet can change in superclass constructor if (0 == description.compare(gGreaterGreaterThan, 2) || 0 == description.compare(gGreaterGreaterGreaterThan, 3) || _ruleSet == getRuleSet()) { - byDigits = TRUE; + byDigits = true; if (0 == description.compare(gGreaterGreaterGreaterThan, 3)) { - useSpaces = FALSE; + useSpaces = false; } } else { // cast away const @@ -1059,14 +1077,14 @@ FractionalPartSubstitution::doSubstitution(double number, UnicodeString& toInser // // this flag keeps us from formatting trailing zeros. It starts // // out false because we're pulling from the right, and switches // // to true the first time we encounter a non-zero digit - // UBool doZeros = FALSE; + // UBool doZeros = false; // for (int32_t i = 0; i < kMaxDecimalDigits; i++) { // int64_t digit = numberToFormat % 10; // if (digit != 0 || doZeros) { // if (doZeros && useSpaces) { // toInsertInto.insert(_pos + getPos(), gSpace); // } - // doZeros = TRUE; + // doZeros = true; // getRuleSet()->format(digit, toInsertInto, _pos + getPos()); // } // numberToFormat /= 10; @@ -1075,8 +1093,8 @@ FractionalPartSubstitution::doSubstitution(double number, UnicodeString& toInser DecimalQuantity dl; dl.setToDouble(number); dl.roundToMagnitude(-20, UNUM_ROUND_HALFEVEN, status); // round to 20 fraction digits. - - UBool pad = FALSE; + + UBool pad = false; for (int32_t didx = dl.getLowerDisplayMagnitude(); didx<0; didx++) { // Loop iterates over fraction digits, starting with the LSD. // include both real digits from the number, and zeros @@ -1084,7 +1102,7 @@ FractionalPartSubstitution::doSubstitution(double number, UnicodeString& toInser if (pad && useSpaces) { toInsertInto.insert(_pos + getPos(), gSpace); } else { - pad = TRUE; + pad = true; } int64_t digit = dl.getDigit(didx); getRuleSet()->format(digit, toInsertInto, _pos + getPos(), recursionCount, status); @@ -1146,7 +1164,7 @@ FractionalPartSubstitution::doParse(const UnicodeString& text, DecimalQuantity dl; int32_t totalDigits = 0; - NumberFormat* fmt = NULL; + NumberFormat* fmt = nullptr; while (workText.length() > 0 && workPos.getIndex() != 0) { workPos.setIndex(0); Formattable temp; @@ -1163,7 +1181,7 @@ FractionalPartSubstitution::doParse(const UnicodeString& text, fmt = NumberFormat::createInstance(status); if (U_FAILURE(status)) { delete fmt; - fmt = NULL; + fmt = nullptr; } } if (fmt) { @@ -1191,7 +1209,7 @@ FractionalPartSubstitution::doParse(const UnicodeString& text, result = dl.toDouble(); result = composeRuleValue(result, baseValue); resVal.setDouble(result); - return TRUE; + return true; } } @@ -1224,7 +1242,7 @@ NumeratorSubstitution::doSubstitution(double number, UnicodeString& toInsertInto int64_t longNF = util64_fromDouble(numberToFormat); const NFRuleSet* aruleSet = getRuleSet(); - if (withZeros && aruleSet != NULL) { + if (withZeros && aruleSet != nullptr) { // if there are leading zeros in the decimal expansion then emit them int64_t nf =longNF; int32_t len = toInsertInto.length(); @@ -1237,14 +1255,14 @@ NumeratorSubstitution::doSubstitution(double number, UnicodeString& toInsertInto // if the result is an integer, from here on out we work in integer // space (saving time and memory and preserving accuracy) - if (numberToFormat == longNF && aruleSet != NULL) { + if (numberToFormat == longNF && aruleSet != nullptr) { aruleSet->format(longNF, toInsertInto, apos + getPos(), recursionCount, status); // if the result isn't an integer, then call either our rule set's // format() method or our DecimalFormat's format() method to // format the result } else { - if (aruleSet != NULL) { + if (aruleSet != nullptr) { aruleSet->format(numberToFormat, toInsertInto, apos + getPos(), recursionCount, status); } else { UnicodeString temp; @@ -1254,8 +1272,8 @@ NumeratorSubstitution::doSubstitution(double number, UnicodeString& toInsertInto } } -UBool -NumeratorSubstitution::doParse(const UnicodeString& text, +UBool +NumeratorSubstitution::doParse(const UnicodeString& text, ParsePosition& parsePosition, double baseValue, double upperBound, @@ -1301,7 +1319,7 @@ NumeratorSubstitution::doParse(const UnicodeString& text, } // we've parsed off the zeros, now let's parse the rest from our current position - NFSubstitution::doParse(workText, parsePosition, withZeros ? 1 : baseValue, upperBound, FALSE, nonNumericalExecutedRuleMask, result); + NFSubstitution::doParse(workText, parsePosition, withZeros ? 1 : baseValue, upperBound, false, nonNumericalExecutedRuleMask, result); if (withZeros) { // any base value will do in this case. is there a way to @@ -1322,7 +1340,7 @@ NumeratorSubstitution::doParse(const UnicodeString& text, result.setDouble((double)n/(double)d); } - return TRUE; + return true; } bool @@ -1334,8 +1352,8 @@ NumeratorSubstitution::operator==(const NFSubstitution& rhs) const UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NumeratorSubstitution) -const UChar NumeratorSubstitution::LTLT[] = { 0x003c, 0x003c }; - +const char16_t NumeratorSubstitution::LTLT[] = { 0x003c, 0x003c }; + U_NAMESPACE_END /* U_HAVE_RBNF */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.h b/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.h index 49eb0a070..d252f8649 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.h @@ -234,7 +234,7 @@ class NFSubstitution : public UObject { * substitutions of this type. Used by toString(). * @return This substitution's token character. */ - virtual UChar tokenChar() const = 0; + virtual char16_t tokenChar() const = 0; /** * Returns true if this is a modulus substitution. (We didn't do this @@ -245,12 +245,12 @@ class NFSubstitution : public UObject { virtual UBool isModulusSubstitution() const; private: - NFSubstitution(const NFSubstitution &other); // forbid copying of this class - NFSubstitution &operator=(const NFSubstitution &other); // forbid copying of this class + NFSubstitution(const NFSubstitution &other) = delete; // forbid copying of this class + NFSubstitution &operator=(const NFSubstitution &other) = delete; // forbid copying of this class public: - static UClassID getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; + static UClassID getStaticClassID(); + virtual UClassID getDynamicClassID() const override; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nortrans.h b/src/duckdb/extension/icu/third_party/icu/i18n/nortrans.h index 45fc6b571..01cb97ab3 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nortrans.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nortrans.h @@ -1,102 +1,102 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 2001-2010, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 07/03/01 aliu Creation. -// ********************************************************************** -// */ -// #ifndef NORTRANS_H -// #define NORTRANS_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/translit.h" -// #include "unicode/normalizer2.h" - -// U_NAMESPACE_BEGIN - -// /** -// * A transliterator that performs normalization. -// * @author Alan Liu -// */ -// class NormalizationTransliterator : public Transliterator { -// const Normalizer2 &fNorm2; - -// public: - -// /** -// * Destructor. -// */ -// virtual ~NormalizationTransliterator(); - -// /** -// * Copy constructor. -// */ -// NormalizationTransliterator(const NormalizationTransliterator&); - -// /** -// * Transliterator API. -// * @return A copy of the object. -// */ -// virtual NormalizationTransliterator* clone() const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for the actual class. -// */ -// virtual UClassID getDynamicClassID() const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for this class. -// */ -// U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); - -// protected: - -// /** -// * Implements {@link Transliterator#handleTransliterate}. -// * @param text the buffer holding transliterated and -// * untransliterated text -// * @param offset the start and limit of the text, the position -// * of the cursor, and the start and limit of transliteration. -// * @param incremental if true, assume more text may be coming after -// * pos.contextLimit. Otherwise, assume the text is complete. -// */ -// virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, -// UBool isIncremental) const; -// public: - -// /** -// * System registration hook. Public to Transliterator only. -// */ -// static void registerIDs(); - -// private: - -// // Transliterator::Factory methods -// static Transliterator* _create(const UnicodeString& ID, -// Token context); - -// /** -// * Constructs a transliterator. This method is private. -// * Public users must use the factory method createInstance(). -// */ -// NormalizationTransliterator(const UnicodeString& id, const Normalizer2 &norm2); - -// private: -// /** -// * Assignment operator. -// */ -// NormalizationTransliterator& operator=(const NormalizationTransliterator&); -// }; - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2001-2010, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 07/03/01 aliu Creation. +********************************************************************** +*/ +#ifndef NORTRANS_H +#define NORTRANS_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/translit.h" +#include "unicode/normalizer2.h" + +U_NAMESPACE_BEGIN + +/** + * A transliterator that performs normalization. + * @author Alan Liu + */ +class NormalizationTransliterator : public Transliterator { + const Normalizer2 &fNorm2; + + public: + + /** + * Destructor. + */ + virtual ~NormalizationTransliterator(); + + /** + * Copy constructor. + */ + NormalizationTransliterator(const NormalizationTransliterator&); + + /** + * Transliterator API. + * @return A copy of the object. + */ + virtual NormalizationTransliterator* clone() const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + + protected: + + /** + * Implements {@link Transliterator#handleTransliterate}. + * @param text the buffer holding transliterated and + * untransliterated text + * @param offset the start and limit of the text, the position + * of the cursor, and the start and limit of transliteration. + * @param incremental if true, assume more text may be coming after + * pos.contextLimit. Otherwise, assume the text is complete. + */ + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, + UBool isIncremental) const override; + public: + + /** + * System registration hook. Public to Transliterator only. + */ + static void registerIDs(); + + private: + + // Transliterator::Factory methods + static Transliterator* _create(const UnicodeString& ID, + Token context); + + /** + * Constructs a transliterator. This method is private. + * Public users must use the factory method createInstance(). + */ + NormalizationTransliterator(const UnicodeString& id, const Normalizer2 &norm2); + +private: + /** + * Assignment operator. + */ + NormalizationTransliterator& operator=(const NormalizationTransliterator&); +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nounit.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/nounit.cpp deleted file mode 100644 index 076f76f19..000000000 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nounit.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#include "unicode/nounit.h" -#include "uassert.h" - -#if !UCONFIG_NO_FORMATTING - -U_NAMESPACE_BEGIN - -UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NoUnit) - -NoUnit U_EXPORT2 NoUnit::base() { - return NoUnit("base"); -} - -NoUnit U_EXPORT2 NoUnit::percent() { - return NoUnit("percent"); -} - -NoUnit U_EXPORT2 NoUnit::permille() { - return NoUnit("permille"); -} - -NoUnit::NoUnit(const char* subtype) { - initNoUnit(subtype); -} - -NoUnit::NoUnit(const NoUnit& other) : MeasureUnit(other) { -} - -NoUnit* NoUnit::clone() const { - return new NoUnit(*this); -} - -NoUnit::~NoUnit() { -} - - -U_NAMESPACE_END - -#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/nultrans.h b/src/duckdb/extension/icu/third_party/icu/i18n/nultrans.h index 2d449c3da..f5f2fbc91 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/nultrans.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/nultrans.h @@ -1,73 +1,73 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (c) 2000-2007, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 01/11/2000 aliu Creation. -// ********************************************************************** -// */ -// #ifndef NULTRANS_H -// #define NULTRANS_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/translit.h" - -// U_NAMESPACE_BEGIN - -// /** -// * A transliterator that leaves text unchanged. -// * @author Alan Liu -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// class NullTransliterator : public Transliterator { - -// public: - -// /** -// * Constructs a transliterator. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// NullTransliterator(); - -// /** -// * Destructor. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// virtual ~NullTransliterator(); - -// /** -// * Transliterator API. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// virtual NullTransliterator* clone() const; - -// /** -// * Implements {@link Transliterator#handleTransliterate}. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, -// UBool isIncremental) const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for the actual class. -// */ -// virtual UClassID getDynamicClassID() const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for this class. -// */ -// U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); - -// }; - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2000-2007, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 01/11/2000 aliu Creation. +********************************************************************** +*/ +#ifndef NULTRANS_H +#define NULTRANS_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/translit.h" + +U_NAMESPACE_BEGIN + +/** + * A transliterator that leaves text unchanged. + * @author Alan Liu + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ +class NullTransliterator : public Transliterator { + +public: + + /** + * Constructs a transliterator. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + NullTransliterator(); + + /** + * Destructor. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + virtual ~NullTransliterator(); + + /** + * Transliterator API. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + virtual NullTransliterator* clone() const override; + + /** + * Implements {@link Transliterator#handleTransliterate}. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, + UBool isIncremental) const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_affixutils.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_affixutils.cpp index 2229c0c58..5f5ff4c3a 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_affixutils.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_affixutils.cpp @@ -64,7 +64,7 @@ int32_t AffixUtils::estimateLength(const UnicodeString &patternString, UErrorCod } break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } offset += U16_LENGTH(cp); @@ -97,8 +97,8 @@ UnicodeString AffixUtils::escape(const UnicodeString &input) { case u'-': case u'+': case u'%': - case u'\x2030': - case u'\xa4': + case u'‰': + case u'¤': if (state == STATE_BASE) { output.append(u'\''); output.append(cp); @@ -131,27 +131,29 @@ UnicodeString AffixUtils::escape(const UnicodeString &input) { Field AffixUtils::getFieldForType(AffixPatternType type) { switch (type) { case TYPE_MINUS_SIGN: - return UNUM_SIGN_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD}; case TYPE_PLUS_SIGN: - return UNUM_SIGN_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_SIGN_FIELD}; + case TYPE_APPROXIMATELY_SIGN: + return {UFIELD_CATEGORY_NUMBER, UNUM_APPROXIMATELY_SIGN_FIELD}; case TYPE_PERCENT: - return UNUM_PERCENT_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD}; case TYPE_PERMILLE: - return UNUM_PERMILL_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_PERMILL_FIELD}; case TYPE_CURRENCY_SINGLE: - return UNUM_CURRENCY_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}; case TYPE_CURRENCY_DOUBLE: - return UNUM_CURRENCY_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}; case TYPE_CURRENCY_TRIPLE: - return UNUM_CURRENCY_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}; case TYPE_CURRENCY_QUAD: - return UNUM_CURRENCY_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}; case TYPE_CURRENCY_QUINT: - return UNUM_CURRENCY_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}; case TYPE_CURRENCY_OVERFLOW: - return UNUM_CURRENCY_FIELD; + return {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -165,7 +167,11 @@ AffixUtils::unescape(const UnicodeString &affixPattern, FormattedStringBuilder & if (U_FAILURE(status)) { return length; } if (tag.type == TYPE_CURRENCY_OVERFLOW) { // Don't go to the provider for this special case - length += output.insertCodePoint(position + length, 0xFFFD, UNUM_CURRENCY_FIELD, status); + length += output.insertCodePoint( + position + length, + 0xFFFD, + {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}, + status); } else if (tag.type < 0) { length += output.insert( position + length, provider.getSymbol(tag.type), getFieldForType(tag.type), status); @@ -218,7 +224,7 @@ bool AffixUtils::hasCurrencySymbols(const UnicodeString &affixPattern, UErrorCod while (hasNext(tag, affixPattern)) { tag = nextToken(tag, affixPattern, status); if (U_FAILURE(status)) { return false; } - if (tag.type < 0 && getFieldForType(tag.type) == UNUM_CURRENCY_FIELD) { + if (tag.type < 0 && getFieldForType(tag.type) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) { return true; } } @@ -291,11 +297,13 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, return makeTag(offset + count, TYPE_MINUS_SIGN, STATE_BASE, 0); case u'+': return makeTag(offset + count, TYPE_PLUS_SIGN, STATE_BASE, 0); + case u'~': + return makeTag(offset + count, TYPE_APPROXIMATELY_SIGN, STATE_BASE, 0); case u'%': return makeTag(offset + count, TYPE_PERCENT, STATE_BASE, 0); - case u'\x2030': + case u'‰': return makeTag(offset + count, TYPE_PERMILLE, STATE_BASE, 0); - case u'\xa4': + case u'¤': state = STATE_FIRST_CURR; offset += count; // continue to the next code point @@ -328,7 +336,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, break; } case STATE_FIRST_CURR: - if (cp == u'\xa4') { + if (cp == u'¤') { state = STATE_SECOND_CURR; offset += count; // continue to the next code point @@ -337,7 +345,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, return makeTag(offset, TYPE_CURRENCY_SINGLE, STATE_BASE, 0); } case STATE_SECOND_CURR: - if (cp == u'\xa4') { + if (cp == u'¤') { state = STATE_THIRD_CURR; offset += count; // continue to the next code point @@ -346,7 +354,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, return makeTag(offset, TYPE_CURRENCY_DOUBLE, STATE_BASE, 0); } case STATE_THIRD_CURR: - if (cp == u'\xa4') { + if (cp == u'¤') { state = STATE_FOURTH_CURR; offset += count; // continue to the next code point @@ -355,7 +363,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, return makeTag(offset, TYPE_CURRENCY_TRIPLE, STATE_BASE, 0); } case STATE_FOURTH_CURR: - if (cp == u'\xa4') { + if (cp == u'¤') { state = STATE_FIFTH_CURR; offset += count; // continue to the next code point @@ -364,7 +372,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, return makeTag(offset, TYPE_CURRENCY_QUAD, STATE_BASE, 0); } case STATE_FIFTH_CURR: - if (cp == u'\xa4') { + if (cp == u'¤') { state = STATE_OVERFLOW_CURR; offset += count; // continue to the next code point @@ -373,7 +381,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, return makeTag(offset, TYPE_CURRENCY_QUINT, STATE_BASE, 0); } case STATE_OVERFLOW_CURR: - if (cp == u'\xa4') { + if (cp == u'¤') { offset += count; // continue to the next code point and loop back to this state break; @@ -381,7 +389,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0); } default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } // End of string @@ -410,7 +418,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString, case STATE_OVERFLOW_CURR: return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0); default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.cpp index dee276771..8f2314d68 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.cpp @@ -7,10 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif - #include #include @@ -105,4 +102,16 @@ const LocalizedNumberFormatter& LocalizedNumberFormatterAsFormat::getNumberForma return fFormatter; } + +// Definitions of public API methods (put here for dependency disentanglement) + +Format* LocalizedNumberFormatter::toFormat(UErrorCode& status) const { + if (U_FAILURE(status)) { + return nullptr; + } + LocalPointer retval( + new LocalizedNumberFormatterAsFormat(*this, fMacros.locale), status); + return retval.orphan(); +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.h index ca162ae2a..f921b4294 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_asformat.h @@ -25,7 +25,6 @@ namespace impl { * A wrapper around LocalizedNumberFormatter implementing the Format interface, enabling improved * compatibility with other APIs. * - * @draft ICU 62 * @see NumberFormatter */ class U_I18N_API LocalizedNumberFormatterAsFormat : public Format { @@ -35,37 +34,37 @@ class U_I18N_API LocalizedNumberFormatterAsFormat : public Format { /** * Destructor. */ - ~LocalizedNumberFormatterAsFormat() U_OVERRIDE; + ~LocalizedNumberFormatterAsFormat() override; /** * Equals operator. */ - bool operator==(const Format& other) const U_OVERRIDE; + bool operator==(const Format& other) const override; /** * Creates a copy of this object. */ - LocalizedNumberFormatterAsFormat* clone() const U_OVERRIDE; + LocalizedNumberFormatterAsFormat* clone() const override; /** * Formats a Number using the wrapped LocalizedNumberFormatter. The provided formattable must be a * number type. */ UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPosition& pos, - UErrorCode& status) const U_OVERRIDE; + UErrorCode& status) const override; /** * Formats a Number using the wrapped LocalizedNumberFormatter. The provided formattable must be a * number type. */ UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPositionIterator* posIter, - UErrorCode& status) const U_OVERRIDE; + UErrorCode& status) const override; /** * Not supported: sets an error index and returns. */ void parseObject(const UnicodeString& source, Formattable& result, - ParsePosition& parse_pos) const U_OVERRIDE; + ParsePosition& parse_pos) const override; /** * Gets the LocalizedNumberFormatter that this wrapper class uses to format numbers. @@ -87,7 +86,7 @@ class U_I18N_API LocalizedNumberFormatterAsFormat : public Format { */ const LocalizedNumberFormatter& getNumberFormatter() const; - UClassID getDynamicClassID() const U_OVERRIDE; + UClassID getDynamicClassID() const override; static UClassID U_EXPORT2 getStaticClassID(); private: diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_capi.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_capi.cpp index 406279946..abada9ad8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_capi.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_capi.cpp @@ -7,17 +7,17 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif - #include "fphdlimp.h" #include "number_utypes.h" #include "numparse_types.h" #include "formattedval_impl.h" +#include "number_decnum.h" #include "unicode/numberformatter.h" #include "unicode/unumberformatter.h" +#include "unicode/simplenumberformatter.h" +#include "unicode/usimplenumberformatter.h" using namespace icu; using namespace icu::number; @@ -37,6 +37,24 @@ struct UNumberFormatterData : public UMemory, LocalizedNumberFormatter fFormatter; }; +/** + * Implementation class for USimpleNumber. Wraps a SimpleNumberFormatter. + */ +struct USimpleNumberData : public UMemory, + // Magic number as ASCII == "SNM" (SimpleNuMber) + public IcuCApiHelper { + SimpleNumber fNumber; +}; + +/** + * Implementation class for USimpleNumberFormatter. Wraps a SimpleNumberFormatter. + */ +struct USimpleNumberFormatterData : public UMemory, + // Magic number as ASCII == "SNF" (SimpleNumberFormatter) + public IcuCApiHelper { + SimpleNumberFormatter fFormatter; +}; + struct UFormattedNumberImpl; // Magic number as ASCII == "FDN" (FormatteDNumber) @@ -48,6 +66,8 @@ struct UFormattedNumberImpl : public UFormattedValueImpl, public UFormattedNumbe FormattedNumber fImpl; UFormattedNumberData fData; + + void setTo(FormattedNumber value); }; UFormattedNumberImpl::UFormattedNumberImpl() @@ -60,6 +80,10 @@ UFormattedNumberImpl::~UFormattedNumberImpl() { fImpl.fData = nullptr; } +void UFormattedNumberImpl::setTo(FormattedNumber value) { + fData = std::move(*value.fData); +} + } } U_NAMESPACE_END @@ -84,7 +108,7 @@ const DecimalQuantity* icu::number::impl::validateUFormattedNumberToDecimalQuant U_CAPI UNumberFormatter* U_EXPORT2 -unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale, +unumf_openForSkeletonAndLocale(const char16_t* skeleton, int32_t skeletonLen, const char* locale, UErrorCode* ec) { auto* impl = new UNumberFormatterData(); if (impl == nullptr) { @@ -98,7 +122,7 @@ unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const } U_CAPI UNumberFormatter* U_EXPORT2 -unumf_openForSkeletonAndLocaleWithError(const UChar* skeleton, int32_t skeletonLen, const char* locale, +unumf_openForSkeletonAndLocaleWithError(const char16_t* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec) { auto* impl = new UNumberFormatterData(); if (impl == nullptr) { @@ -107,7 +131,8 @@ unumf_openForSkeletonAndLocaleWithError(const UChar* skeleton, int32_t skeletonL } // Readonly-alias constructor (first argument is whether we are NUL-terminated) UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen); - impl->fFormatter = NumberFormatter::forSkeleton(skeletonString, *perror, *ec).locale(locale); + UParseError tempParseError; + impl->fFormatter = NumberFormatter::forSkeleton(skeletonString, (perror == nullptr) ? tempParseError : *perror, *ec).locale(locale); return impl->exportForC(); } @@ -118,7 +143,8 @@ unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNum auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); if (U_FAILURE(*ec)) { return; } - result->fData.getStringRef().clear(); + result->fData.resetString(); + result->fData.quantity.clear(); result->fData.quantity.setToLong(value); formatter->fFormatter.formatImpl(&result->fData, *ec); } @@ -130,7 +156,8 @@ unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedN auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); if (U_FAILURE(*ec)) { return; } - result->fData.getStringRef().clear(); + result->fData.resetString(); + result->fData.quantity.clear(); result->fData.quantity.setToDouble(value); formatter->fFormatter.formatImpl(&result->fData, *ec); } @@ -142,14 +169,15 @@ unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32 auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); if (U_FAILURE(*ec)) { return; } - result->fData.getStringRef().clear(); + result->fData.resetString(); + result->fData.quantity.clear(); result->fData.quantity.setToDecNumber({value, valueLen}, *ec); if (U_FAILURE(*ec)) { return; } formatter->fFormatter.formatImpl(&result->fData, *ec); } U_CAPI int32_t U_EXPORT2 -unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity, +unumf_resultToString(const UFormattedNumber* uresult, char16_t* buffer, int32_t bufferCapacity, UErrorCode* ec) { const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); if (U_FAILURE(*ec)) { return 0; } @@ -159,28 +187,28 @@ unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t buf return 0; } - return result->fImpl.toTempString(*ec).extract(buffer, bufferCapacity, *ec); + return result->fData.toTempString(*ec).extract(buffer, bufferCapacity, *ec); } U_CAPI UBool U_EXPORT2 unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec) { const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); - if (U_FAILURE(*ec)) { return FALSE; } + if (U_FAILURE(*ec)) { return false; } if (ufpos == nullptr) { *ec = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } FieldPosition fp; fp.setField(ufpos->field); fp.setBeginIndex(ufpos->beginIndex); fp.setEndIndex(ufpos->endIndex); - bool retval = result->fImpl.nextFieldPosition(fp, *ec); + bool retval = result->fData.nextFieldPosition(fp, *ec); ufpos->beginIndex = fp.getBeginIndex(); ufpos->endIndex = fp.getEndIndex(); // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool - return retval ? TRUE : FALSE; + return retval ? true : false; } U_CAPI void U_EXPORT2 @@ -195,7 +223,25 @@ unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPosition } auto* fpi = reinterpret_cast(ufpositer); - result->fImpl.getAllFieldPositions(*fpi, *ec); + FieldPositionIteratorHandler fpih(fpi, *ec); + result->fData.getAllFieldPositions(fpih, *ec); +} + +U_CAPI int32_t U_EXPORT2 +unumf_resultToDecimalNumber( + const UFormattedNumber* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec) { + const auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return 0; + } + DecNum decnum; + return result->fData.quantity + .toDecNum(decnum, *ec) + .toCharString(*ec) + .extract(dest, destCapacity, *ec); } U_CAPI void U_EXPORT2 @@ -206,6 +252,154 @@ unumf_close(UNumberFormatter* f) { } +///// SIMPLE NUMBER FORMATTER ///// + +U_CAPI USimpleNumber* U_EXPORT2 +usnum_openForInt64(int64_t value, UErrorCode* ec) { + auto* number = new USimpleNumberData(); + if (number == nullptr) { + *ec = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } + number->fNumber = SimpleNumber::forInt64(value, *ec); + return number->exportForC(); +} + +U_CAPI void U_EXPORT2 +usnum_setToInt64(USimpleNumber* unumber, int64_t value, UErrorCode* ec) { + auto* number = USimpleNumberData::validate(unumber, *ec); + if (U_FAILURE(*ec)) { + return; + } + number->fNumber = SimpleNumber::forInt64(value, *ec); +} + +U_CAPI void U_EXPORT2 +usnum_multiplyByPowerOfTen(USimpleNumber* unumber, int32_t power, UErrorCode* ec) { + auto* number = USimpleNumberData::validate(unumber, *ec); + if (U_FAILURE(*ec)) { + return; + } + number->fNumber.multiplyByPowerOfTen(power, *ec); +} + +U_CAPI void U_EXPORT2 +usnum_roundTo(USimpleNumber* unumber, int32_t position, UNumberFormatRoundingMode roundingMode, UErrorCode* ec) { + auto* number = USimpleNumberData::validate(unumber, *ec); + if (U_FAILURE(*ec)) { + return; + } + number->fNumber.roundTo(position, roundingMode, *ec); +} + +U_CAPI void U_EXPORT2 +usnum_setMinimumIntegerDigits(USimpleNumber* unumber, int32_t minimumIntegerDigits, UErrorCode* ec) { + auto* number = USimpleNumberData::validate(unumber, *ec); + if (U_FAILURE(*ec)) { + return; + } + number->fNumber.setMinimumIntegerDigits(minimumIntegerDigits, *ec); +} + +U_CAPI void U_EXPORT2 +usnum_setMinimumFractionDigits(USimpleNumber* unumber, int32_t minimumFractionDigits, UErrorCode* ec) { + auto* number = USimpleNumberData::validate(unumber, *ec); + if (U_FAILURE(*ec)) { + return; + } + number->fNumber.setMinimumFractionDigits(minimumFractionDigits, *ec); +} + +U_CAPI void U_EXPORT2 +usnum_truncateStart(USimpleNumber* unumber, int32_t maximumIntegerDigits, UErrorCode* ec) { + auto* number = USimpleNumberData::validate(unumber, *ec); + if (U_FAILURE(*ec)) { + return; + } + number->fNumber.truncateStart(maximumIntegerDigits, *ec); +} + +U_CAPI void U_EXPORT2 +usnum_setSign(USimpleNumber* unumber, USimpleNumberSign sign, UErrorCode* ec) { + auto* number = USimpleNumberData::validate(unumber, *ec); + if (U_FAILURE(*ec)) { + return; + } + number->fNumber.setSign(sign, *ec); +} + +U_CAPI USimpleNumberFormatter* U_EXPORT2 +usnumf_openForLocale(const char* locale, UErrorCode* ec) { + auto* impl = new USimpleNumberFormatterData(); + if (impl == nullptr) { + *ec = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } + impl->fFormatter = SimpleNumberFormatter::forLocale(locale, *ec); + return impl->exportForC(); +} + +U_CAPI USimpleNumberFormatter* U_EXPORT2 +usnumf_openForLocaleAndGroupingStrategy( + const char* locale, UNumberGroupingStrategy groupingStrategy, UErrorCode* ec) { + auto* impl = new USimpleNumberFormatterData(); + if (impl == nullptr) { + *ec = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } + impl->fFormatter = SimpleNumberFormatter::forLocaleAndGroupingStrategy(locale, groupingStrategy, *ec); + return impl->exportForC(); +} + +U_CAPI void U_EXPORT2 +usnumf_format( + const USimpleNumberFormatter* uformatter, + USimpleNumber* unumber, + UFormattedNumber* uresult, + UErrorCode* ec) { + auto* formatter = USimpleNumberFormatterData::validate(uformatter, *ec); + auto* number = USimpleNumberData::validate(unumber, *ec); + auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return; + } + auto localResult = formatter->fFormatter.format(std::move(number->fNumber), *ec); + if (U_FAILURE(*ec)) { + return; + } + result->setTo(std::move(localResult)); +} + +U_CAPI void U_EXPORT2 +usnumf_formatInt64( + const USimpleNumberFormatter* uformatter, + int64_t value, + UFormattedNumber* uresult, + UErrorCode* ec) { + auto* formatter = USimpleNumberFormatterData::validate(uformatter, *ec); + auto* result = UFormattedNumberApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return; + } + auto localResult = formatter->fFormatter.formatInt64(value, *ec); + result->setTo(std::move(localResult)); +} + +U_CAPI void U_EXPORT2 +usnum_close(USimpleNumber* unumber) { + UErrorCode localStatus = U_ZERO_ERROR; + const USimpleNumberData* impl = USimpleNumberData::validate(unumber, localStatus); + delete impl; +} + +U_CAPI void U_EXPORT2 +usnumf_close(USimpleNumberFormatter* uformatter) { + UErrorCode localStatus = U_ZERO_ERROR; + const USimpleNumberFormatterData* impl = USimpleNumberFormatterData::validate(uformatter, localStatus); + delete impl; +} + + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.cpp index a3e6bca8e..2cfa65a03 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.cpp @@ -22,7 +22,7 @@ namespace { // A dummy object used when a "0" compact decimal entry is encountered. This is necessary // in order to prevent falling back to root. Object equality ("==") is intended. -const UChar *USE_FALLBACK = u""; +const char16_t *USE_FALLBACK = u""; /** Produces a string like "NumberElements/latn/patternsShort/decimalFormat". */ void getResourceBundleKey(const char *nsName, CompactStyle compactStyle, CompactType compactType, @@ -34,11 +34,11 @@ void getResourceBundleKey(const char *nsName, CompactStyle compactStyle, Compact sb.append(compactType == CompactType::TYPE_DECIMAL ? "/decimalFormat" : "/currencyFormat", status); } -int32_t number_compact_getIndex(int32_t magnitude, StandardPlural::Form plural) { +int32_t getIndex(int32_t magnitude, StandardPlural::Form plural) { return magnitude * StandardPlural::COUNT + plural; } -int32_t countZeros(const UChar *patternString, int32_t patternLength) { +int32_t countZeros(const char16_t *patternString, int32_t patternLength) { // NOTE: This strategy for computing the number of zeros is a hack for efficiency. // It could break if there are any 0s that aren't part of the main pattern. int32_t numZeros = 0; @@ -55,7 +55,7 @@ int32_t countZeros(const UChar *patternString, int32_t patternLength) { } // namespace // NOTE: patterns and multipliers both get zero-initialized. -CompactData::CompactData() : patterns(), multipliers(), largestMagnitude(0), isEmpty(TRUE) { +CompactData::CompactData() : patterns(), multipliers(), largestMagnitude(0), isEmpty(true) { } void CompactData::populate(const Locale &locale, const char *nsName, CompactStyle compactStyle, @@ -104,17 +104,33 @@ int32_t CompactData::getMultiplier(int32_t magnitude) const { return multipliers[magnitude]; } -const UChar *CompactData::getPattern(int32_t magnitude, StandardPlural::Form plural) const { +const char16_t *CompactData::getPattern( + int32_t magnitude, + const PluralRules *rules, + const DecimalQuantity &dq) const { if (magnitude < 0) { return nullptr; } if (magnitude > largestMagnitude) { magnitude = largestMagnitude; } - const UChar *patternString = patterns[number_compact_getIndex(magnitude, plural)]; + const char16_t *patternString = nullptr; + if (dq.hasIntegerValue()) { + int64_t i = dq.toLong(true); + if (i == 0) { + patternString = patterns[getIndex(magnitude, StandardPlural::Form::EQ_0)]; + } else if (i == 1) { + patternString = patterns[getIndex(magnitude, StandardPlural::Form::EQ_1)]; + } + if (patternString != nullptr) { + return patternString; + } + } + StandardPlural::Form plural = utils::getStandardPlural(rules, dq); + patternString = patterns[getIndex(magnitude, plural)]; if (patternString == nullptr && plural != StandardPlural::OTHER) { // Fall back to "other" plural variant - patternString = patterns[number_compact_getIndex(magnitude, StandardPlural::OTHER)]; + patternString = patterns[getIndex(magnitude, StandardPlural::OTHER)]; } if (patternString == USE_FALLBACK) { // == is intended // Return null if USE_FALLBACK is present @@ -135,14 +151,14 @@ void CompactData::getUniquePatterns(UVector &output, UErrorCode &status) const { // Insert pattern into the UVector if the UVector does not already contain the pattern. // Search the UVector from the end since identical patterns are likely to be adjacent. for (int32_t i = output.size() - 1; i >= 0; i--) { - if (u_strcmp(pattern, static_cast(output[i])) == 0) { + if (u_strcmp(pattern, static_cast(output[i])) == 0) { goto continue_outer; } } // The string was not found; add it to the UVector. - // ANDY: This requires a const_cast. Why? - output.addElement(const_cast(pattern), status); + // Note: must cast off const from pattern to store it in a UVector, which expects (void *) + output.addElement(const_cast(pattern), status); continue_outer: continue; @@ -157,28 +173,31 @@ void CompactData::CompactDataSink::put(const char *key, ResourceValue &value, UB for (int i3 = 0; powersOfTenTable.getKeyAndValue(i3, key, value); ++i3) { // Assumes that the keys are always of the form "10000" where the magnitude is the - // length of the key minus one. We expect magnitudes to be less than MAX_DIGITS. + // length of the key minus one. We only support magnitudes less than COMPACT_MAX_DIGITS; + // ignore entries that have greater magnitude. auto magnitude = static_cast (strlen(key) - 1); + U_ASSERT(magnitude < COMPACT_MAX_DIGITS); // debug assert + if (magnitude >= COMPACT_MAX_DIGITS) { // skip in production + continue; + } int8_t multiplier = data.multipliers[magnitude]; - U_ASSERT(magnitude < COMPACT_MAX_DIGITS); // Iterate over the plural variants ("one", "other", etc) ResourceTable pluralVariantsTable = value.getTable(status); if (U_FAILURE(status)) { return; } for (int i4 = 0; pluralVariantsTable.getKeyAndValue(i4, key, value); ++i4) { - // Skip this magnitude/plural if we already have it from a child locale. // Note: This also skips USE_FALLBACK entries. StandardPlural::Form plural = StandardPlural::fromString(key, status); if (U_FAILURE(status)) { return; } - if (data.patterns[number_compact_getIndex(magnitude, plural)] != nullptr) { + if (data.patterns[getIndex(magnitude, plural)] != nullptr) { continue; } // The value "0" means that we need to use the default pattern and not fall back // to parent locales. Example locale where this is relevant: 'it'. int32_t patternLength; - const UChar *patternString = value.getString(patternLength, status); + const char16_t *patternString = value.getString(patternLength, status); if (U_FAILURE(status)) { return; } if (u_strcmp(patternString, u"0") == 0) { patternString = USE_FALLBACK; @@ -186,7 +205,7 @@ void CompactData::CompactDataSink::put(const char *key, ResourceValue &value, UB } // Save the pattern string. We will parse it lazily. - data.patterns[number_compact_getIndex(magnitude, plural)] = patternString; + data.patterns[getIndex(magnitude, plural)] = patternString; // If necessary, compute the multiplier: the difference between the magnitude // and the number of zeros in the pattern. @@ -215,19 +234,25 @@ void CompactData::CompactDataSink::put(const char *key, ResourceValue &value, UB /// END OF CompactData.java; BEGIN CompactNotation.java /// /////////////////////////////////////////////////////////// -CompactHandler::CompactHandler(CompactStyle compactStyle, const Locale &locale, const char *nsName, - CompactType compactType, const PluralRules *rules, - MutablePatternModifier *buildReference, const MicroPropsGenerator *parent, - UErrorCode &status) - : rules(rules), parent(parent) { +CompactHandler::CompactHandler( + CompactStyle compactStyle, + const Locale &locale, + const char *nsName, + CompactType compactType, + const PluralRules *rules, + MutablePatternModifier *buildReference, + bool safe, + const MicroPropsGenerator *parent, + UErrorCode &status) + : rules(rules), parent(parent), safe(safe) { data.populate(locale, nsName, compactStyle, compactType, status); - if (buildReference != nullptr) { + if (safe) { // Safe code path precomputeAllModifiers(*buildReference, status); - safe = TRUE; } else { // Unsafe code path - safe = FALSE; + // Store the MutablePatternModifier reference. + unsafePatternModifier = buildReference; } } @@ -254,13 +279,13 @@ void CompactHandler::precomputeAllModifiers(MutablePatternModifier &buildReferen } for (int32_t i = 0; i < precomputedModsLength; i++) { - auto patternString = static_cast(allPatterns[i]); + auto patternString = static_cast(allPatterns[i]); UnicodeString hello(patternString); CompactModInfo &info = precomputedMods[i]; ParsedPatternInfo patternInfo; PatternParser::parseToPatternInfo(UnicodeString(patternString), patternInfo, status); if (U_FAILURE(status)) { return; } - buildReference.setPatternInfo(&patternInfo, UNUM_COMPACT_FIELD); + buildReference.setPatternInfo(&patternInfo, {UFIELD_CATEGORY_NUMBER, UNUM_COMPACT_FIELD}); info.mod = buildReference.createImmutable(status); if (U_FAILURE(status)) { return; } info.patternString = patternString; @@ -274,18 +299,18 @@ void CompactHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micr // Treat zero, NaN, and infinity as if they had magnitude 0 int32_t magnitude; + int32_t multiplier = 0; if (quantity.isZeroish()) { magnitude = 0; micros.rounder.apply(quantity, status); } else { // TODO: Revisit chooseMultiplierAndApply - int32_t multiplier = micros.rounder.chooseMultiplierAndApply(quantity, data, status); + multiplier = micros.rounder.chooseMultiplierAndApply(quantity, data, status); magnitude = quantity.isZeroish() ? 0 : quantity.getMagnitude(); magnitude -= multiplier; } - StandardPlural::Form plural = utils::getStandardPlural(rules, quantity); - const UChar *patternString = data.getPattern(magnitude, plural); + const char16_t *patternString = data.getPattern(magnitude, rules, quantity); if (patternString == nullptr) { // Use the default (non-compact) modifier. // No need to take any action. @@ -309,10 +334,18 @@ void CompactHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micr // C++ Note: Use unsafePatternInfo for proper lifecycle. ParsedPatternInfo &patternInfo = const_cast(this)->unsafePatternInfo; PatternParser::parseToPatternInfo(UnicodeString(patternString), patternInfo, status); - static_cast(const_cast(micros.modMiddle)) - ->setPatternInfo(&patternInfo, UNUM_COMPACT_FIELD); + unsafePatternModifier->setPatternInfo( + &unsafePatternInfo, + {UFIELD_CATEGORY_NUMBER, UNUM_COMPACT_FIELD}); + unsafePatternModifier->setNumberProperties(quantity.signum(), StandardPlural::Form::COUNT); + micros.modMiddle = unsafePatternModifier; } + // Change the exponent only after we select appropriate plural form + // for formatting purposes so that we preserve expected formatted + // string behavior. + quantity.adjustExponent(-1 * multiplier); + // We already performed rounding. Do not perform it again. micros.rounder = RoundingImpl::passThrough(); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.h index dda5f9f9b..aee1df745 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_compact.h @@ -17,7 +17,7 @@ U_NAMESPACE_BEGIN namespace number { namespace impl { -static const int32_t COMPACT_MAX_DIGITS = 15; +static const int32_t COMPACT_MAX_DIGITS = 20; class CompactData : public MultiplierProducer { public: @@ -26,14 +26,17 @@ class CompactData : public MultiplierProducer { void populate(const Locale &locale, const char *nsName, CompactStyle compactStyle, CompactType compactType, UErrorCode &status); - int32_t getMultiplier(int32_t magnitude) const U_OVERRIDE; + int32_t getMultiplier(int32_t magnitude) const override; - const UChar *getPattern(int32_t magnitude, StandardPlural::Form plural) const; + const char16_t *getPattern( + int32_t magnitude, + const PluralRules *rules, + const DecimalQuantity &dq) const; void getUniquePatterns(UVector &output, UErrorCode &status) const; private: - const UChar *patterns[(COMPACT_MAX_DIGITS + 1) * StandardPlural::COUNT]; + const char16_t *patterns[(COMPACT_MAX_DIGITS + 1) * StandardPlural::COUNT]; int8_t multipliers[COMPACT_MAX_DIGITS + 1]; int8_t largestMagnitude; UBool isEmpty; @@ -42,7 +45,7 @@ class CompactData : public MultiplierProducer { public: explicit CompactDataSink(CompactData &data) : data(data) {} - void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE; + void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) override; private: CompactData &data; @@ -51,20 +54,26 @@ class CompactData : public MultiplierProducer { struct CompactModInfo { const ImmutablePatternModifier *mod; - const UChar* patternString; + const char16_t* patternString; }; class CompactHandler : public MicroPropsGenerator, public UMemory { public: - CompactHandler(CompactStyle compactStyle, const Locale &locale, const char *nsName, - CompactType compactType, const PluralRules *rules, - MutablePatternModifier *buildReference, const MicroPropsGenerator *parent, - UErrorCode &status); - - ~CompactHandler() U_OVERRIDE; + CompactHandler( + CompactStyle compactStyle, + const Locale &locale, + const char *nsName, + CompactType compactType, + const PluralRules *rules, + MutablePatternModifier *buildReference, + bool safe, + const MicroPropsGenerator *parent, + UErrorCode &status); + + ~CompactHandler() override; void - processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const U_OVERRIDE; + processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const override; private: const PluralRules *rules; @@ -74,6 +83,7 @@ class CompactHandler : public MicroPropsGenerator, public UMemory { int32_t precomputedModsLength = 0; CompactData data; ParsedPatternInfo unsafePatternInfo; + MutablePatternModifier* unsafePatternModifier; UBool safe; /** Used by the safe code path */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.cpp index c5cd679c8..8d5127556 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.cpp @@ -7,10 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif - #include "numparse_types.h" #include "number_currencysymbols.h" @@ -47,6 +44,16 @@ UnicodeString CurrencySymbols::getNarrowCurrencySymbol(UErrorCode& status) const return loadSymbol(UCURR_NARROW_SYMBOL_NAME, status); } +UnicodeString CurrencySymbols::getFormalCurrencySymbol(UErrorCode& status) const { + // Note: currently no override is available for formal currency symbol + return loadSymbol(UCURR_FORMAL_SYMBOL_NAME, status); +} + +UnicodeString CurrencySymbols::getVariantCurrencySymbol(UErrorCode& status) const { + // Note: currently no override is available for variant currency symbol + return loadSymbol(UCURR_VARIANT_SYMBOL_NAME, status); +} + UnicodeString CurrencySymbols::getCurrencySymbol(UErrorCode& status) const { if (!fCurrencySymbol.isBogus()) { return fCurrencySymbol; @@ -69,7 +76,7 @@ UnicodeString CurrencySymbols::loadSymbol(UCurrNameStyle selector, UErrorCode& s if (symbol == isoCode) { return UnicodeString(isoCode, 3); } else { - return UnicodeString(TRUE, symbol, symbolLen); + return UnicodeString(true, symbol, symbolLen); } } @@ -97,10 +104,14 @@ UnicodeString CurrencySymbols::getPluralName(StandardPlural::Form plural, UError if (symbol == isoCode) { return UnicodeString(isoCode, 3); } else { - return UnicodeString(TRUE, symbol, symbolLen); + return UnicodeString(true, symbol, symbolLen); } } +bool CurrencySymbols::hasEmptyCurrencySymbol() const { + return !fCurrencySymbol.isBogus() && fCurrencySymbol.isEmpty(); +} + CurrencyUnit icu::number::impl::resolveCurrency(const DecimalFormatProperties& properties, const Locale& locale, diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.h index 9996bf96a..c2223bd0f 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.h @@ -31,12 +31,18 @@ class U_I18N_API CurrencySymbols : public UMemory { UnicodeString getNarrowCurrencySymbol(UErrorCode& status) const; + UnicodeString getFormalCurrencySymbol(UErrorCode& status) const; + + UnicodeString getVariantCurrencySymbol(UErrorCode& status) const; + UnicodeString getCurrencySymbol(UErrorCode& status) const; UnicodeString getIntlCurrencySymbol(UErrorCode& status) const; UnicodeString getPluralName(StandardPlural::Form plural, UErrorCode& status) const; + bool hasEmptyCurrencySymbol() const; + protected: // Required fields: CurrencyUnit fCurrency; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.cpp index 2c4c2ce7e..659465d08 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.cpp @@ -20,6 +20,7 @@ #include "charstr.h" #include "number_utils.h" #include "uassert.h" +#include "util.h" using namespace icu; using namespace icu::number; @@ -88,7 +89,7 @@ DecimalQuantity::DecimalQuantity(const DecimalQuantity &other) { *this = other; } -DecimalQuantity::DecimalQuantity(DecimalQuantity&& src) U_NOEXCEPT { +DecimalQuantity::DecimalQuantity(DecimalQuantity&& src) noexcept { *this = std::move(src); } @@ -101,7 +102,7 @@ DecimalQuantity &DecimalQuantity::operator=(const DecimalQuantity &other) { return *this; } -DecimalQuantity& DecimalQuantity::operator=(DecimalQuantity&& src) U_NOEXCEPT { +DecimalQuantity& DecimalQuantity::operator=(DecimalQuantity&& src) noexcept { if (this == &src) { return *this; } @@ -120,6 +121,7 @@ void DecimalQuantity::copyFieldsFrom(const DecimalQuantity& other) { origDouble = other.origDouble; origDelta = other.origDelta; isApproximate = other.isApproximate; + exponent = other.exponent; } void DecimalQuantity::clear() { @@ -179,20 +181,22 @@ uint64_t DecimalQuantity::getPositionFingerprint() const { return fingerprint; } -void DecimalQuantity::roundToIncrement(double roundingIncrement, RoundingMode roundingMode, - UErrorCode& status) { +void DecimalQuantity::roundToIncrement( + uint64_t increment, + digits_t magnitude, + RoundingMode roundingMode, + UErrorCode& status) { // Do not call this method with an increment having only a 1 or a 5 digit! // Use a more efficient call to either roundToMagnitude() or roundToNickel(). // Check a few popular rounding increments; a more thorough check is in Java. - U_ASSERT(roundingIncrement != 0.01); - U_ASSERT(roundingIncrement != 0.05); - U_ASSERT(roundingIncrement != 0.1); - U_ASSERT(roundingIncrement != 0.5); - U_ASSERT(roundingIncrement != 1); - U_ASSERT(roundingIncrement != 5); + U_ASSERT(increment != 1); + U_ASSERT(increment != 5); + DecimalQuantity incrementDQ; + incrementDQ.setToLong(increment); + incrementDQ.adjustMagnitude(magnitude); DecNum incrementDN; - incrementDN.setTo(roundingIncrement, status); + incrementDQ.toDecNum(incrementDN, status); if (U_FAILURE(status)) { return; } // Divide this DecimalQuantity by the increment, round, then multiply back. @@ -252,6 +256,12 @@ bool DecimalQuantity::adjustMagnitude(int32_t delta) { return false; } +int32_t DecimalQuantity::adjustToZeroScale() { + int32_t retval = scale; + scale = 0; + return retval; +} + double DecimalQuantity::getPluralOperand(PluralOperand operand) const { // If this assertion fails, you need to call roundToInfinity() or some other rounding method. // See the comment at the top of this file explaining the "isApproximate" field. @@ -269,11 +279,29 @@ double DecimalQuantity::getPluralOperand(PluralOperand operand) const { return fractionCount(); case PLURAL_OPERAND_W: return fractionCountWithoutTrailingZeros(); + case PLURAL_OPERAND_E: + return static_cast(getExponent()); + case PLURAL_OPERAND_C: + // Plural operand `c` is currently an alias for `e`. + return static_cast(getExponent()); default: return std::abs(toDouble()); } } +int32_t DecimalQuantity::getExponent() const { + return exponent; +} + +void DecimalQuantity::adjustExponent(int delta) { + exponent = exponent + delta; +} + +void DecimalQuantity::resetExponent() { + adjustMagnitude(exponent); + exponent = 0; +} + bool DecimalQuantity::hasIntegerValue() const { return scale >= 0; } @@ -307,11 +335,13 @@ int8_t DecimalQuantity::getDigit(int32_t magnitude) const { } int32_t DecimalQuantity::fractionCount() const { - return -getLowerDisplayMagnitude(); + int32_t fractionCountWithExponent = -getLowerDisplayMagnitude() - exponent; + return fractionCountWithExponent > 0 ? fractionCountWithExponent : 0; } int32_t DecimalQuantity::fractionCountWithoutTrailingZeros() const { - return -scale > 0 ? -scale : 0; // max(-scale, 0) + int32_t fractionCountWithExponent = -scale - exponent; + return fractionCountWithExponent > 0 ? fractionCountWithExponent : 0; // max(-fractionCountWithExponent, 0) } bool DecimalQuantity::isNegative() const { @@ -319,10 +349,14 @@ bool DecimalQuantity::isNegative() const { } Signum DecimalQuantity::signum() const { - if (isNegative()) { + bool isZero = (isZeroish() && !isInfinite()); + bool isNeg = isNegative(); + if (isZero && isNeg) { + return SIGNUM_NEG_ZERO; + } else if (isZero) { + return SIGNUM_POS_ZERO; + } else if (isNeg) { return SIGNUM_NEG; - } else if (isZeroish() && !isInfinite()) { - return SIGNUM_ZERO; } else { return SIGNUM_POS; } @@ -422,9 +456,6 @@ void DecimalQuantity::_setToDoubleFast(double n) { // TODO: Make a fast path for other types of doubles. if (!std::numeric_limits::is_iec559) { convertToAccurateDouble(); - // Turn off the approximate double flag, since the value is now exact. - isApproximate = false; - origDouble = 0.0; return; } @@ -439,8 +470,14 @@ void DecimalQuantity::_setToDoubleFast(double n) { return; } + if (exponent == -1023 || exponent == 1024) { + // The extreme values of exponent are special; use slow path. + convertToAccurateDouble(); + return; + } + // 3.3219... is log2(10) - auto fracLength = static_cast ((52 - exponent) / 3.32192809489); + auto fracLength = static_cast ((52 - exponent) / 3.32192809488736234787031942948939017586); if (fracLength >= 0) { int32_t i = fracLength; // 1e22 is the largest exact double. @@ -452,7 +489,7 @@ void DecimalQuantity::_setToDoubleFast(double n) { for (; i <= -22; i += 22) n /= 1e22; n /= DOUBLE_MULTIPLIERS[-i]; } - auto result = static_cast(std::round(n)); + auto result = static_cast(uprv_round(n)); if (result != 0) { _setToLong(result); scale -= fracLength; @@ -510,23 +547,86 @@ void DecimalQuantity::_setToDecNum(const DecNum& decnum, UErrorCode& status) { if (decnum.isNegative()) { flags |= NEGATIVE_FLAG; } - if (!decnum.isZero()) { + if (decnum.isNaN()) { + flags |= NAN_FLAG; + } else if (decnum.isInfinity()) { + flags |= INFINITY_FLAG; + } else if (!decnum.isZero()) { readDecNumberToBcd(decnum); compact(); } } +DecimalQuantity DecimalQuantity::fromExponentString(UnicodeString num, UErrorCode& status) { + if (num.indexOf(u'e') >= 0 || num.indexOf(u'c') >= 0 + || num.indexOf(u'E') >= 0 || num.indexOf(u'C') >= 0) { + int32_t ePos = num.lastIndexOf('e'); + if (ePos < 0) { + ePos = num.lastIndexOf('c'); + } + if (ePos < 0) { + ePos = num.lastIndexOf('E'); + } + if (ePos < 0) { + ePos = num.lastIndexOf('C'); + } + int32_t expNumPos = ePos + 1; + UnicodeString exponentStr = num.tempSubString(expNumPos, num.length() - expNumPos); + + // parse exponentStr into exponent, but note that parseAsciiInteger doesn't handle the minus sign + bool isExpStrNeg = num[expNumPos] == u'-'; + int32_t exponentParsePos = isExpStrNeg ? 1 : 0; + int32_t exponent = ICU_Utility::parseAsciiInteger(exponentStr, exponentParsePos); + exponent = isExpStrNeg ? -exponent : exponent; + + // Compute the decNumber representation + UnicodeString fractionStr = num.tempSubString(0, ePos); + CharString fracCharStr = CharString(); + fracCharStr.appendInvariantChars(fractionStr, status); + DecNum decnum; + decnum.setTo(fracCharStr.toStringPiece(), status); + + // Clear and set this DecimalQuantity instance + DecimalQuantity dq; + dq.setToDecNum(decnum, status); + int32_t numFracDigit = getVisibleFractionCount(fractionStr); + dq.setMinFraction(numFracDigit); + dq.adjustExponent(exponent); + + return dq; + } else { + DecimalQuantity dq; + int numFracDigit = getVisibleFractionCount(num); + + CharString numCharStr = CharString(); + numCharStr.appendInvariantChars(num, status); + dq.setToDecNumber(numCharStr.toStringPiece(), status); + + dq.setMinFraction(numFracDigit); + return dq; + } +} + +int32_t DecimalQuantity::getVisibleFractionCount(UnicodeString value) { + int decimalPos = value.indexOf('.') + 1; + if (decimalPos == 0) { + return 0; + } else { + return value.length() - decimalPos; + } +} + int64_t DecimalQuantity::toLong(bool truncateIfOverflow) const { // NOTE: Call sites should be guarded by fitsInLong(), like this: // if (dq.fitsInLong()) { /* use dq.toLong() */ } else { /* use some fallback */ } // Fallback behavior upon truncateIfOverflow is to truncate at 17 digits. uint64_t result = 0L; - int32_t upperMagnitude = scale + precision - 1; + int32_t upperMagnitude = exponent + scale + precision - 1; if (truncateIfOverflow) { upperMagnitude = std::min(upperMagnitude, 17); } for (int32_t magnitude = upperMagnitude; magnitude >= 0; magnitude--) { - result = result * 10 + getDigitPos(magnitude - scale); + result = result * 10 + getDigitPos(magnitude - scale - exponent); } if (isNegative()) { return static_cast(0LL - result); // i.e., -result @@ -536,7 +636,7 @@ int64_t DecimalQuantity::toLong(bool truncateIfOverflow) const { uint64_t DecimalQuantity::toFractionLong(bool includeTrailingZeros) const { uint64_t result = 0L; - int32_t magnitude = -1; + int32_t magnitude = -1 - exponent; int32_t lowerMagnitude = scale; if (includeTrailingZeros) { lowerMagnitude = std::min(lowerMagnitude, rReqPos); @@ -560,7 +660,7 @@ bool DecimalQuantity::fitsInLong(bool ignoreFraction) const { if (isZeroish()) { return true; } - if (scale < 0 && !ignoreFraction) { + if (exponent + scale < 0 && !ignoreFraction) { return false; } int magnitude = getMagnitude(); @@ -606,19 +706,24 @@ double DecimalQuantity::toDouble() const { &count); } -void DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const { +DecNum& DecimalQuantity::toDecNum(DecNum& output, UErrorCode& status) const { // Special handling for zero if (precision == 0) { output.setTo("0", status); + return output; } // Use the BCD constructor. We need to do a little bit of work to convert, though. // The decNumber constructor expects most-significant first, but we store least-significant first. - MaybeStackArray ubcd(precision); + MaybeStackArray ubcd(precision, status); + if (U_FAILURE(status)) { + return output; + } for (int32_t m = 0; m < precision; m++) { ubcd[precision - m - 1] = static_cast(getDigitPos(m)); } output.setTo(ubcd.getAlias(), precision, scale, isNegative(), status); + return output; } void DecimalQuantity::truncate() { @@ -794,6 +899,7 @@ void DecimalQuantity::roundToMagnitude(int32_t magnitude, RoundingMode roundingM // Perform truncation if (position >= precision) { + U_ASSERT(trailingDigit == 0); setBcdToZero(); scale = magnitude; } else { @@ -811,6 +917,10 @@ void DecimalQuantity::roundToMagnitude(int32_t magnitude, RoundingMode roundingM // do not return: use the bubbling logic below } else { setDigitPos(0, 5); + // If the quantity was set to 0, we may need to restore a digit. + if (precision == 0) { + precision = 1; + } // compact not necessary: digit at position 0 is nonzero return; } @@ -877,16 +987,72 @@ UnicodeString DecimalQuantity::toPlainString() const { if (isNegative()) { sb.append(u'-'); } - if (precision == 0 || getMagnitude() < 0) { + if (precision == 0) { + sb.append(u'0'); + return sb; + } + int32_t upper = scale + precision + exponent - 1; + int32_t lower = scale + exponent; + if (upper < lReqPos - 1) { + upper = lReqPos - 1; + } + if (lower > rReqPos) { + lower = rReqPos; + } + int32_t p = upper; + if (p < 0) { sb.append(u'0'); } - for (int m = getUpperDisplayMagnitude(); m >= getLowerDisplayMagnitude(); m--) { - if (m == -1) { sb.append(u'.'); } - sb.append(getDigit(m) + u'0'); + for (; p >= 0; p--) { + sb.append(u'0' + getDigitPos(p - scale - exponent)); + } + if (lower < 0) { + sb.append(u'.'); + } + for(; p >= lower; p--) { + sb.append(u'0' + getDigitPos(p - scale - exponent)); } return sb; } + +UnicodeString DecimalQuantity::toExponentString() const { + U_ASSERT(!isApproximate); + UnicodeString sb; + if (isNegative()) { + sb.append(u'-'); + } + + int32_t upper = scale + precision - 1; + int32_t lower = scale; + if (upper < lReqPos - 1) { + upper = lReqPos - 1; + } + if (lower > rReqPos) { + lower = rReqPos; + } + int32_t p = upper; + if (p < 0) { + sb.append(u'0'); + } + for (; p >= 0; p--) { + sb.append(u'0' + getDigitPos(p - scale)); + } + if (lower < 0) { + sb.append(u'.'); + } + for(; p >= lower; p--) { + sb.append(u'0' + getDigitPos(p - scale)); + } + + if (exponent != 0) { + sb.append(u'c'); + ICU_Utility::appendNumber(sb, exponent); + } + + return sb; +} + UnicodeString DecimalQuantity::toScientificString() const { U_ASSERT(!isApproximate); UnicodeString result; @@ -908,7 +1074,7 @@ UnicodeString DecimalQuantity::toScientificString() const { } } result.append(u'E'); - int32_t _scale = upperPos + scale; + int32_t _scale = upperPos + scale + exponent; if (_scale == INT32_MIN) { result.append({u"-2147483648", -1}); return result; @@ -966,13 +1132,8 @@ void DecimalQuantity::shiftLeft(int32_t numDigits) { } if (usingBytes) { ensureCapacity(precision + numDigits); - int i = precision + numDigits - 1; - for (; i >= numDigits; i--) { - fBCD.bcdBytes.ptr[i] = fBCD.bcdBytes.ptr[i - numDigits]; - } - for (; i >= 0; i--) { - fBCD.bcdBytes.ptr[i] = 0; - } + uprv_memmove(fBCD.bcdBytes.ptr + numDigits, fBCD.bcdBytes.ptr, precision); + uprv_memset(fBCD.bcdBytes.ptr, 0, numDigits); } else { fBCD.bcdLong <<= (numDigits * 4); } @@ -1021,6 +1182,7 @@ void DecimalQuantity::setBcdToZero() { isApproximate = false; origDouble = 0; origDelta = 0; + exponent = 0; } void DecimalQuantity::readIntToBcd(int32_t n) { @@ -1285,7 +1447,11 @@ bool DecimalQuantity::operator==(const DecimalQuantity& other) const { } UnicodeString DecimalQuantity::toString() const { - MaybeStackArray digits(precision + 1); + UErrorCode localStatus = U_ZERO_ERROR; + MaybeStackArray digits(precision + 1, localStatus); + if (U_FAILURE(localStatus)) { + return ICU_Utility::makeBogusString(); + } for (int32_t i = 0; i < precision; i++) { digits[i] = getDigitPos(precision - i - 1) + '0'; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.h index 73aaa0615..2211fe9c1 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.h @@ -20,7 +20,7 @@ namespace impl { class DecNum; /** - * An class for representing a number to be processed by the decimal formatting pipeline. Includes + * A class for representing a number to be processed by the decimal formatting pipeline. Includes * methods for rounding, plural rules, and decimal digit extraction. * *

    By design, this is NOT IMMUTABLE and NOT THREAD SAFE. It is intended to be an intermediate @@ -36,7 +36,7 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { DecimalQuantity(const DecimalQuantity &other); /** Move constructor. */ - DecimalQuantity(DecimalQuantity &&src) U_NOEXCEPT; + DecimalQuantity(DecimalQuantity &&src) noexcept; DecimalQuantity(); @@ -50,7 +50,7 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { DecimalQuantity &operator=(const DecimalQuantity &other); /** Move assignment */ - DecimalQuantity &operator=(DecimalQuantity&& src) U_NOEXCEPT; + DecimalQuantity &operator=(DecimalQuantity&& src) noexcept; /** * Sets the minimum integer digits that this {@link DecimalQuantity} should generate. @@ -81,11 +81,15 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { * *

    If rounding to a power of ten, use the more efficient {@link #roundToMagnitude} instead. * - * @param roundingIncrement The increment to which to round. + * @param increment The increment to which to round. + * @param magnitude The power of 10 to which to round. * @param roundingMode The {@link RoundingMode} to use if rounding is necessary. */ - void roundToIncrement(double roundingIncrement, RoundingMode roundingMode, - UErrorCode& status); + void roundToIncrement( + uint64_t increment, + digits_t magnitude, + RoundingMode roundingMode, + UErrorCode& status); /** Removes all fraction digits. */ void truncate(); @@ -140,12 +144,44 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { */ bool adjustMagnitude(int32_t delta); + /** + * Scales the number such that the least significant nonzero digit is at magnitude 0. + * + * @return The previous magnitude of the least significant digit. + */ + int32_t adjustToZeroScale(); + /** * @return The power of ten corresponding to the most significant nonzero digit. * The number must not be zero. */ int32_t getMagnitude() const; + /** + * @return The value of the (suppressed) exponent after the number has been + * put into a notation with exponents (ex: compact, scientific). Ex: given + * the number 1000 as "1K" / "1E3", the return value will be 3 (positive). + */ + int32_t getExponent() const; + + /** + * Adjusts the value for the (suppressed) exponent stored when using + * notation with exponents (ex: compact, scientific). + * + *

    Adjusting the exponent is decoupled from {@link #adjustMagnitude} in + * order to allow flexibility for {@link StandardPlural} to be selected in + * formatting (ex: for compact notation) either with or without the exponent + * applied in the value of the number. + * @param delta + * The value to adjust the exponent by. + */ + void adjustExponent(int32_t delta); + + /** + * Resets the DecimalQuantity to the value before adjustMagnitude and adjustExponent. + */ + void resetExponent(); + /** * @return Whether the value represented by this {@link DecimalQuantity} is * zero, infinity, or NaN. @@ -159,14 +195,24 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { Signum signum() const; /** @return Whether the value represented by this {@link DecimalQuantity} is infinite. */ - bool isInfinite() const U_OVERRIDE; + bool isInfinite() const override; /** @return Whether the value represented by this {@link DecimalQuantity} is not a number. */ - bool isNaN() const U_OVERRIDE; + bool isNaN() const override; - /** @param truncateIfOverflow if false and the number does NOT fit, fails with an assertion error. */ + /** + * Note: this method incorporates the value of {@code exponent} + * (for cases such as compact notation) to return the proper long value + * represented by the result. + * @param truncateIfOverflow if false and the number does NOT fit, fails with an assertion error. + */ int64_t toLong(bool truncateIfOverflow = false) const; + /** + * Note: this method incorporates the value of {@code exponent} + * (for cases such as compact notation) to return the proper long value + * represented by the result. + */ uint64_t toFractionLong(bool includeTrailingZeros) const; /** @@ -179,7 +225,7 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { double toDouble() const; /** Computes a DecNum representation of this DecimalQuantity, saving it to the output parameter. */ - void toDecNum(DecNum& output, UErrorCode& status) const; + DecNum& toDecNum(DecNum& output, UErrorCode& status) const; DecimalQuantity &setToInt(int32_t n); @@ -187,12 +233,21 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { DecimalQuantity &setToDouble(double n); - /** decNumber is similar to BigDecimal in Java. */ + /** + * Produces a DecimalQuantity that was parsed from a string by the decNumber + * C Library. + * + * decNumber is similar to BigDecimal in Java, and supports parsing strings + * such as "123.456621E+40". + */ DecimalQuantity &setToDecNumber(StringPiece n, UErrorCode& status); /** Internal method if the caller already has a DecNum. */ DecimalQuantity &setToDecNum(const DecNum& n, UErrorCode& status); + /** Returns a DecimalQuantity after parsing the input string. */ + static DecimalQuantity fromExponentString(UnicodeString n, UErrorCode& status); + /** * Appends a digit, optionally with one or more leading zeros, to the end of the value represented * by this DecimalQuantity. @@ -212,9 +267,9 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { */ void appendDigit(int8_t value, int32_t leadingZeros, bool appendAsInteger); - double getPluralOperand(PluralOperand operand) const U_OVERRIDE; + double getPluralOperand(PluralOperand operand) const override; - bool hasIntegerValue() const U_OVERRIDE; + bool hasIntegerValue() const override; /** * Gets the digit at the specified magnitude. For example, if the represented number is 12.3, @@ -274,6 +329,10 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { /** Returns the string without exponential notation. Slightly slower than toScientificString(). */ UnicodeString toPlainString() const; + /** Returns the string using ASCII digits and using exponential notation for non-zero + exponents, following the UTS 35 specification for plural rule samples. */ + UnicodeString toExponentString() const; + /** Visible for testing */ inline bool isUsingBytes() { return usingBytes; } @@ -351,6 +410,10 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { int32_t lReqPos = 0; int32_t rReqPos = 0; + // The value of the (suppressed) exponent after the number has been put into + // a notation with exponents (ex: compact, scientific). + int32_t exponent = 0; + /** * The BCD of the 16 digits of the number represented by this object. Every 4 bits of the long map * to one digit. For example, the number "12345" in BCD is "0x12345". @@ -388,7 +451,9 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { /** * Sets the digit in the BCD list. This method only sets the digit; it is the caller's - * responsibility to call {@link #compact} after setting the digit. + * responsibility to call {@link #compact} after setting the digit, and to ensure + * that the precision field is updated to reflect the correct number of digits if a + * nonzero digit is added to the decimal. * * @param position The position of the digit to pop, counted in BCD units from the least * significant digit. If outside the range supported by the implementation, an AssertionError @@ -423,7 +488,7 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { /** * Sets the internal representation to zero. Clears any values stored in scale, precision, - * hasDouble, origDouble, origDelta, and BCD data. + * hasDouble, origDouble, origDelta, exponent, and BCD data. */ void setBcdToZero(); @@ -471,6 +536,8 @@ class U_I18N_API DecimalQuantity : public IFixedDecimal, public UMemory { void _setToDecNum(const DecNum& dn, UErrorCode& status); + static int32_t getVisibleFractionCount(UnicodeString value); + void convertToAccurateDouble(); /** Ensure that a byte array of at least 40 digits is allocated. */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.cpp index 30481ce5b..6dbfc69ec 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.cpp @@ -18,10 +18,10 @@ namespace { alignas(DecimalFormatProperties) char kRawDefaultProperties[sizeof(DecimalFormatProperties)]; -icu::UInitOnce gDefaultPropertiesInitOnce = U_INITONCE_INITIALIZER; +icu::UInitOnce gDefaultPropertiesInitOnce {}; void U_CALLCONV initDefaultProperties(UErrorCode&) { - // can't fail, uses placement new into staticly allocated space. + // can't fail, uses placement new into statically allocated space. new(kRawDefaultProperties) DecimalFormatProperties(); // set to the default instance } @@ -40,6 +40,7 @@ void DecimalFormatProperties::clear() { decimalPatternMatchRequired = false; decimalSeparatorAlwaysShown = false; exponentSignAlwaysShown = false; + currencyAsDecimal = false; formatFailIfMoreThanMaxDigits = false; formatWidth = -1; groupingSize = -1; @@ -88,6 +89,7 @@ DecimalFormatProperties::_equals(const DecimalFormatProperties& other, bool igno eq = eq && currencyUsage == other.currencyUsage; eq = eq && decimalSeparatorAlwaysShown == other.decimalSeparatorAlwaysShown; eq = eq && exponentSignAlwaysShown == other.exponentSignAlwaysShown; + eq = eq && currencyAsDecimal == other.currencyAsDecimal; eq = eq && formatFailIfMoreThanMaxDigits == other.formatFailIfMoreThanMaxDigits; eq = eq && formatWidth == other.formatWidth; eq = eq && magnitudeMultiplier == other.magnitudeMultiplier; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.h index 1ce84d9dc..5f72f6498 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.h @@ -38,7 +38,7 @@ namespace impl { // Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties // Using this wrapper is rather unfortunate, but is needed on Windows platforms in order to allow -// for DLL-exporting an fully specified template instantiation. +// for DLL-exporting a fully specified template instantiation. class U_I18N_API CurrencyPluralInfoWrapper { public: LocalPointer fPtr; @@ -52,7 +52,8 @@ class U_I18N_API CurrencyPluralInfoWrapper { } CurrencyPluralInfoWrapper& operator=(const CurrencyPluralInfoWrapper& other) { - if (!other.fPtr.isNull()) { + if (this != &other && // self-assignment: no-op + !other.fPtr.isNull()) { fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr)); } return *this; @@ -104,6 +105,7 @@ struct U_I18N_API DecimalFormatProperties : public UMemory { bool decimalPatternMatchRequired; bool decimalSeparatorAlwaysShown; bool exponentSignAlwaysShown; + bool currencyAsDecimal; bool formatFailIfMoreThanMaxDigits; // ICU4C-only int32_t formatWidth; int32_t groupingSize; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_decnum.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_decnum.h index 0c7399dbd..94a0b31bc 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_decnum.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_decnum.h @@ -9,6 +9,7 @@ #include "decNumber.h" #include "charstr.h" +#include "bytesinkutil.h" U_NAMESPACE_BEGIN @@ -55,8 +56,22 @@ class U_I18N_API DecNum : public UMemory { bool isZero() const; + /** Is infinity or NaN */ + bool isSpecial() const; + + bool isInfinity() const; + + bool isNaN() const; + void toString(ByteSink& output, UErrorCode& status) const; + inline CharString toCharString(UErrorCode& status) const { + CharString cstr; + CharStringByteSink sink(&cstr); + toString(sink, status); + return cstr; + } + inline const decNumber* getRawDecNumber() const { return fData.getAlias(); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_fluent.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_fluent.cpp index dac91be3b..45d6b06c6 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_fluent.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_fluent.cpp @@ -11,9 +11,9 @@ #include "number_formatimpl.h" #include "umutex.h" #include "number_asformat.h" -#include "number_skeletons.h" #include "number_utils.h" #include "number_utypes.h" +#include "number_mapper.h" #include "util.h" #include "fphdlimp.h" @@ -21,6 +21,16 @@ using namespace icu; using namespace icu::number; using namespace icu::number::impl; +#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) +// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method +// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation +// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is +// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes, +// they will all be passed to the linker, and the linker will still find and export all the class members. +#pragma warning(push) +#pragma warning(disable: 4661) +#endif + template Derived NumberFormatterSettings::notation(const Notation& notation) const& { Derived copy(*this); @@ -264,6 +274,62 @@ Derived NumberFormatterSettings::scale(const Scale& scale)&& { return move; } +template +Derived NumberFormatterSettings::usage(const StringPiece usage) const& { + Derived copy(*this); + copy.fMacros.usage.set(usage); + return copy; +} + +template +Derived NumberFormatterSettings::usage(const StringPiece usage)&& { + Derived move(std::move(*this)); + move.fMacros.usage.set(usage); + return move; +} + +template +Derived NumberFormatterSettings::displayOptions(const DisplayOptions &displayOptions) const & { + Derived copy(*this); + // `displayCase` does not recognise the `undefined` + if (displayOptions.getGrammaticalCase() == UDISPOPT_GRAMMATICAL_CASE_UNDEFINED) { + copy.fMacros.unitDisplayCase.set(nullptr); + return copy; + } + + copy.fMacros.unitDisplayCase.set( + udispopt_getGrammaticalCaseIdentifier(displayOptions.getGrammaticalCase())); + return copy; +} + +template +Derived NumberFormatterSettings::displayOptions(const DisplayOptions &displayOptions) && { + Derived move(std::move(*this)); + // `displayCase` does not recognise the `undefined` + if (displayOptions.getGrammaticalCase() == UDISPOPT_GRAMMATICAL_CASE_UNDEFINED) { + move.fMacros.unitDisplayCase.set(nullptr); + return move; + } + + move.fMacros.unitDisplayCase.set( + udispopt_getGrammaticalCaseIdentifier(displayOptions.getGrammaticalCase())); + return move; +} + +template +Derived NumberFormatterSettings::unitDisplayCase(const StringPiece unitDisplayCase) const& { + Derived copy(*this); + copy.fMacros.unitDisplayCase.set(unitDisplayCase); + return copy; +} + +template +Derived NumberFormatterSettings::unitDisplayCase(const StringPiece unitDisplayCase)&& { + Derived move(std::move(*this)); + move.fMacros.unitDisplayCase.set(unitDisplayCase); + return move; +} + template Derived NumberFormatterSettings::padding(const Padder& padder) const& { Derived copy(*this); @@ -293,43 +359,34 @@ Derived NumberFormatterSettings::threshold(int32_t threshold)&& { } template -Derived NumberFormatterSettings::macros(const icu::number::impl::MacroProps& macros) const& { +Derived NumberFormatterSettings::macros(const impl::MacroProps& macros) const& { Derived copy(*this); copy.fMacros = macros; return copy; } template -Derived NumberFormatterSettings::macros(const icu::number::impl::MacroProps& macros)&& { +Derived NumberFormatterSettings::macros(const impl::MacroProps& macros)&& { Derived move(std::move(*this)); move.fMacros = macros; return move; } template -Derived NumberFormatterSettings::macros(icu::number::impl::MacroProps&& macros) const& { +Derived NumberFormatterSettings::macros(impl::MacroProps&& macros) const& { Derived copy(*this); copy.fMacros = std::move(macros); return copy; } template -Derived NumberFormatterSettings::macros(icu::number::impl::MacroProps&& macros)&& { +Derived NumberFormatterSettings::macros(impl::MacroProps&& macros)&& { Derived move(std::move(*this)); move.fMacros = std::move(macros); return move; } -template -UnicodeString NumberFormatterSettings::toSkeleton(UErrorCode& status) const { - if (U_FAILURE(status)) { - return ICU_Utility::makeBogusString(); - } - if (fMacros.copyErrorTo(status)) { - return ICU_Utility::makeBogusString(); - } - return skeleton::generate(fMacros, status); -} +// Note: toSkeleton defined in number_skeletons.cpp template LocalPointer NumberFormatterSettings::clone() const & { @@ -358,116 +415,134 @@ LocalizedNumberFormatter NumberFormatter::withLocale(const Locale& locale) { return with().locale(locale); } -UnlocalizedNumberFormatter -NumberFormatter::forSkeleton(const UnicodeString& skeleton, UErrorCode& status) { - return skeleton::create(skeleton, nullptr, status); -} - -UnlocalizedNumberFormatter -NumberFormatter::forSkeleton(const UnicodeString& skeleton, UParseError& perror, UErrorCode& status) { - return skeleton::create(skeleton, &perror, status); -} +// Note: forSkeleton defined in number_skeletons.cpp -template using fluent_NFS = NumberFormatterSettings; -using fluent_LNF = LocalizedNumberFormatter; -using fluent_UNF = UnlocalizedNumberFormatter; +template using NFS = NumberFormatterSettings; +using LNF = LocalizedNumberFormatter; +using UNF = UnlocalizedNumberFormatter; -UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const fluent_UNF& other) - : fluent_UNF(static_cast&>(other)) {} +UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const UNF& other) + : UNF(static_cast&>(other)) {} -UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const fluent_NFS& other) - : fluent_NFS(other) { +UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(const NFS& other) + : NFS(other) { // No additional fields to assign } // Make default copy constructor call the NumberFormatterSettings copy constructor. -UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(fluent_UNF&& src) U_NOEXCEPT - : fluent_UNF(static_cast&&>(src)) {} +UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(UNF&& src) noexcept + : UNF(static_cast&&>(src)) {} -UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(fluent_NFS&& src) U_NOEXCEPT - : fluent_NFS(std::move(src)) { +UnlocalizedNumberFormatter::UnlocalizedNumberFormatter(NFS&& src) noexcept + : NFS(std::move(src)) { // No additional fields to assign } -UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(const fluent_UNF& other) { - fluent_NFS::operator=(static_cast&>(other)); +UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(const UNF& other) { + NFS::operator=(static_cast&>(other)); // No additional fields to assign return *this; } -UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(fluent_UNF&& src) U_NOEXCEPT { - fluent_NFS::operator=(static_cast&&>(src)); +UnlocalizedNumberFormatter& UnlocalizedNumberFormatter::operator=(UNF&& src) noexcept { + NFS::operator=(static_cast&&>(src)); // No additional fields to assign return *this; } // Make default copy constructor call the NumberFormatterSettings copy constructor. -LocalizedNumberFormatter::LocalizedNumberFormatter(const fluent_LNF& other) - : fluent_LNF(static_cast&>(other)) {} +LocalizedNumberFormatter::LocalizedNumberFormatter(const LNF& other) + : LNF(static_cast&>(other)) {} -LocalizedNumberFormatter::LocalizedNumberFormatter(const fluent_NFS& other) - : fluent_NFS(other) { - // No additional fields to assign (let call count and compiled formatter reset to defaults) +LocalizedNumberFormatter::LocalizedNumberFormatter(const NFS& other) + : NFS(other) { + UErrorCode localStatus = U_ZERO_ERROR; // Can't bubble up the error + lnfCopyHelper(static_cast(other), localStatus); } -LocalizedNumberFormatter::LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT - : fluent_LNF(static_cast&&>(src)) {} +LocalizedNumberFormatter::LocalizedNumberFormatter(LocalizedNumberFormatter&& src) noexcept + : LNF(static_cast&&>(src)) {} -LocalizedNumberFormatter::LocalizedNumberFormatter(fluent_NFS&& src) U_NOEXCEPT - : fluent_NFS(std::move(src)) { - // For the move operators, copy over the compiled formatter. - // Note: if the formatter is not compiled, call count information is lost. - if (static_cast(src).fCompiled != nullptr) { - lnfMoveHelper(static_cast(src)); - } +LocalizedNumberFormatter::LocalizedNumberFormatter(NFS&& src) noexcept + : NFS(std::move(src)) { + lnfMoveHelper(std::move(static_cast(src))); } -LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(const fluent_LNF& other) { - fluent_NFS::operator=(static_cast&>(other)); - // Reset to default values. - clear(); +LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(const LNF& other) { + if (this == &other) { return *this; } // self-assignment: no-op + NFS::operator=(static_cast&>(other)); + UErrorCode localStatus = U_ZERO_ERROR; // Can't bubble up the error + lnfCopyHelper(other, localStatus); return *this; } -LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(fluent_LNF&& src) U_NOEXCEPT { - fluent_NFS::operator=(static_cast&&>(src)); - // For the move operators, copy over the compiled formatter. - // Note: if the formatter is not compiled, call count information is lost. - if (static_cast(src).fCompiled != nullptr) { - // Formatter is compiled - lnfMoveHelper(static_cast(src)); - } else { - clear(); - } +LocalizedNumberFormatter& LocalizedNumberFormatter::operator=(LNF&& src) noexcept { + NFS::operator=(static_cast&&>(src)); + lnfMoveHelper(std::move(src)); return *this; } -void LocalizedNumberFormatter::clear() { - // Reset to default values. +void LocalizedNumberFormatter::resetCompiled() { auto* callCount = reinterpret_cast(fUnsafeCallCount); umtx_storeRelease(*callCount, 0); - delete fCompiled; fCompiled = nullptr; } -void LocalizedNumberFormatter::lnfMoveHelper(fluent_LNF&& src) { +void LocalizedNumberFormatter::lnfMoveHelper(LNF&& src) { // Copy over the compiled formatter and set call count to INT32_MIN as in computeCompiled(). // Don't copy the call count directly because doing so requires a loadAcquire/storeRelease. // The bits themselves appear to be platform-dependent, so copying them might not be safe. - auto* callCount = reinterpret_cast(fUnsafeCallCount); - umtx_storeRelease(*callCount, INT32_MIN); delete fCompiled; - fCompiled = src.fCompiled; - // Reset the source object to leave it in a safe state. - auto* srcCallCount = reinterpret_cast(src.fUnsafeCallCount); - umtx_storeRelease(*srcCallCount, 0); - src.fCompiled = nullptr; + if (src.fCompiled != nullptr) { + auto* callCount = reinterpret_cast(fUnsafeCallCount); + umtx_storeRelease(*callCount, INT32_MIN); + fCompiled = src.fCompiled; + // Reset the source object to leave it in a safe state. + src.resetCompiled(); + } else { + resetCompiled(); + } + + // Unconditionally move the warehouse + delete fWarehouse; + fWarehouse = src.fWarehouse; + src.fWarehouse = nullptr; +} + +void LocalizedNumberFormatter::lnfCopyHelper(const LNF&, UErrorCode& status) { + // When copying, always reset the compiled formatter. + delete fCompiled; + resetCompiled(); + + // If MacroProps has a reference to AffixPatternProvider, we need to copy it. + // If MacroProps has a reference to PluralRules, copy that one, too. + delete fWarehouse; + if (fMacros.affixProvider || fMacros.rules) { + LocalPointer warehouse(new DecimalFormatWarehouse(), status); + if (U_FAILURE(status)) { + fWarehouse = nullptr; + return; + } + if (fMacros.affixProvider) { + warehouse->affixProvider.setTo(fMacros.affixProvider, status); + fMacros.affixProvider = &warehouse->affixProvider.get(); + } + if (fMacros.rules) { + warehouse->rules.adoptInsteadAndCheckErrorCode( + new PluralRules(*fMacros.rules), status); + fMacros.rules = warehouse->rules.getAlias(); + } + fWarehouse = warehouse.orphan(); + } else { + fWarehouse = nullptr; + } } LocalizedNumberFormatter::~LocalizedNumberFormatter() { delete fCompiled; + delete fWarehouse; } LocalizedNumberFormatter::LocalizedNumberFormatter(const MacroProps& macros, const Locale& locale) { @@ -488,123 +563,6 @@ LocalizedNumberFormatter UnlocalizedNumberFormatter::locale(const Locale& locale return LocalizedNumberFormatter(std::move(fMacros), locale); } -SymbolsWrapper::SymbolsWrapper(const SymbolsWrapper& other) { - doCopyFrom(other); -} - -SymbolsWrapper::SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT { - doMoveFrom(std::move(src)); -} - -SymbolsWrapper& SymbolsWrapper::operator=(const SymbolsWrapper& other) { - if (this == &other) { - return *this; - } - doCleanup(); - doCopyFrom(other); - return *this; -} - -SymbolsWrapper& SymbolsWrapper::operator=(SymbolsWrapper&& src) U_NOEXCEPT { - if (this == &src) { - return *this; - } - doCleanup(); - doMoveFrom(std::move(src)); - return *this; -} - -SymbolsWrapper::~SymbolsWrapper() { - doCleanup(); -} - -void SymbolsWrapper::setTo(const DecimalFormatSymbols& dfs) { - doCleanup(); - fType = SYMPTR_DFS; - fPtr.dfs = new DecimalFormatSymbols(dfs); -} - -void SymbolsWrapper::setTo(const NumberingSystem* ns) { - doCleanup(); - fType = SYMPTR_NS; - fPtr.ns = ns; -} - -void SymbolsWrapper::doCopyFrom(const SymbolsWrapper& other) { - fType = other.fType; - switch (fType) { - case SYMPTR_NONE: - // No action necessary - break; - case SYMPTR_DFS: - // Memory allocation failures are exposed in copyErrorTo() - if (other.fPtr.dfs != nullptr) { - fPtr.dfs = new DecimalFormatSymbols(*other.fPtr.dfs); - } else { - fPtr.dfs = nullptr; - } - break; - case SYMPTR_NS: - // Memory allocation failures are exposed in copyErrorTo() - if (other.fPtr.ns != nullptr) { - fPtr.ns = new NumberingSystem(*other.fPtr.ns); - } else { - fPtr.ns = nullptr; - } - break; - } -} - -void SymbolsWrapper::doMoveFrom(SymbolsWrapper&& src) { - fType = src.fType; - switch (fType) { - case SYMPTR_NONE: - // No action necessary - break; - case SYMPTR_DFS: - fPtr.dfs = src.fPtr.dfs; - src.fPtr.dfs = nullptr; - break; - case SYMPTR_NS: - fPtr.ns = src.fPtr.ns; - src.fPtr.ns = nullptr; - break; - } -} - -void SymbolsWrapper::doCleanup() { - switch (fType) { - case SYMPTR_NONE: - // No action necessary - break; - case SYMPTR_DFS: - delete fPtr.dfs; - break; - case SYMPTR_NS: - delete fPtr.ns; - break; - } -} - -bool SymbolsWrapper::isDecimalFormatSymbols() const { - return fType == SYMPTR_DFS; -} - -bool SymbolsWrapper::isNumberingSystem() const { - return fType == SYMPTR_NS; -} - -const DecimalFormatSymbols* SymbolsWrapper::getDecimalFormatSymbols() const { - U_ASSERT(fType == SYMPTR_DFS); - return fPtr.dfs; -} - -const NumberingSystem* SymbolsWrapper::getNumberingSystem() const { - U_ASSERT(fType == SYMPTR_NS); - return fPtr.ns; -} - - FormattedNumber LocalizedNumberFormatter::formatInt(int64_t value, UErrorCode& status) const { if (U_FAILURE(status)) { return FormattedNumber(U_ILLEGAL_ARGUMENT_ERROR); } auto results = new UFormattedNumberData(); @@ -682,11 +640,11 @@ LocalizedNumberFormatter::formatDecimalQuantity(const DecimalQuantity& dq, UErro } } -void LocalizedNumberFormatter::formatImpl(icu::number::impl::UFormattedNumberData* results, UErrorCode& status) const { +void LocalizedNumberFormatter::formatImpl(impl::UFormattedNumberData* results, UErrorCode& status) const { if (computeCompiled(status)) { - fCompiled->format(results->quantity, results->getStringRef(), status); + fCompiled->format(results, status); } else { - NumberFormatterImpl::formatStatic(fMacros, results->quantity, results->getStringRef(), status); + NumberFormatterImpl::formatStatic(fMacros, results, status); } if (U_FAILURE(status)) { return; @@ -756,7 +714,7 @@ bool LocalizedNumberFormatter::computeCompiled(UErrorCode& status) const { } } -const icu::number::impl::NumberFormatterImpl* LocalizedNumberFormatter::getCompiled() const { +const impl::NumberFormatterImpl* LocalizedNumberFormatter::getCompiled() const { return fCompiled; } @@ -766,14 +724,15 @@ int32_t LocalizedNumberFormatter::getCallCount() const { return umtx_loadAcquire(*callCount); } -Format* LocalizedNumberFormatter::toFormat(UErrorCode& status) const { - if (U_FAILURE(status)) { - return nullptr; - } - LocalPointer retval( - new LocalizedNumberFormatterAsFormat(*this, fMacros.locale), status); - return retval.orphan(); +// Note: toFormat defined in number_asformat.cpp + +const DecimalFormatSymbols* LocalizedNumberFormatter::getDecimalFormatSymbols() const { + return fMacros.symbols.getDecimalFormatSymbols(); } +#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) +// Warning 4661. +#pragma warning(pop) +#endif #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.cpp index 2e2c4a962..53bac49a5 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.cpp @@ -24,60 +24,22 @@ using namespace icu; using namespace icu::number; using namespace icu::number::impl; -namespace { - -struct CurrencyFormatInfoResult { - bool exists; - const char16_t* pattern; - const char16_t* decimalSeparator; - const char16_t* groupingSeparator; -}; - -CurrencyFormatInfoResult -getCurrencyFormatInfo(const Locale& locale, const char* isoCode, UErrorCode& status) { - // TODO: Load this data in a centralized location like ICU4J? - // TODO: Move this into the CurrencySymbols class? - // TODO: Parts of this same data are loaded in dcfmtsym.cpp; should clean up. - CurrencyFormatInfoResult result = {false, nullptr, nullptr, nullptr}; - if (U_FAILURE(status)) { return result; } - CharString key; - key.append("Currencies/", status); - key.append(isoCode, status); - UErrorCode localStatus = status; - LocalUResourceBundlePointer bundle(ures_open(U_ICUDATA_CURR, locale.getName(), &localStatus)); - ures_getByKeyWithFallback(bundle.getAlias(), key.data(), bundle.getAlias(), &localStatus); - if (U_SUCCESS(localStatus) && - ures_getSize(bundle.getAlias()) > 2) { // the length is 3 if more data is present - ures_getByIndex(bundle.getAlias(), 2, bundle.getAlias(), &localStatus); - int32_t dummy; - result.exists = true; - result.pattern = ures_getStringByIndex(bundle.getAlias(), 0, &dummy, &localStatus); - result.decimalSeparator = ures_getStringByIndex(bundle.getAlias(), 1, &dummy, &localStatus); - result.groupingSeparator = ures_getStringByIndex(bundle.getAlias(), 2, &dummy, &localStatus); - status = localStatus; - } else if (localStatus != U_MISSING_RESOURCE_ERROR) { - status = localStatus; - } - return result; -} - -} // namespace - - -MicroPropsGenerator::~MicroPropsGenerator() = default; - NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, UErrorCode& status) : NumberFormatterImpl(macros, true, status) { } -int32_t NumberFormatterImpl::formatStatic(const MacroProps& macros, DecimalQuantity& inValue, - FormattedStringBuilder& outString, UErrorCode& status) { +int32_t NumberFormatterImpl::formatStatic(const MacroProps ¯os, UFormattedNumberData *results, + UErrorCode &status) { + DecimalQuantity &inValue = results->quantity; + FormattedStringBuilder &outString = results->getStringRef(); NumberFormatterImpl impl(macros, false, status); MicroProps& micros = impl.preProcessUnsafe(inValue, status); if (U_FAILURE(status)) { return 0; } - int32_t length = writeNumber(micros, inValue, outString, 0, status); + int32_t length = writeNumber(micros.simple, inValue, outString, 0, status); length += writeAffixes(micros, outString, 0, length, status); + results->outputUnit = std::move(micros.outputUnit); + results->gender = micros.gender; return length; } @@ -93,13 +55,16 @@ int32_t NumberFormatterImpl::getPrefixSuffixStatic(const MacroProps& macros, Sig // The "unsafe" method simply re-uses fMicros, eliminating the extra copy operation. // See MicroProps::processQuantity() for details. -int32_t NumberFormatterImpl::format(DecimalQuantity& inValue, FormattedStringBuilder& outString, - UErrorCode& status) const { +int32_t NumberFormatterImpl::format(UFormattedNumberData *results, UErrorCode &status) const { + DecimalQuantity &inValue = results->quantity; + FormattedStringBuilder &outString = results->getStringRef(); MicroProps micros; preProcess(inValue, micros, status); if (U_FAILURE(status)) { return 0; } - int32_t length = writeNumber(micros, inValue, outString, 0, status); + int32_t length = writeNumber(micros.simple, inValue, outString, 0, status); length += writeAffixes(micros, outString, 0, length, status); + results->outputUnit = std::move(micros.outputUnit); + results->gender = micros.gender; return length; } @@ -111,7 +76,6 @@ void NumberFormatterImpl::preProcess(DecimalQuantity& inValue, MicroProps& micro return; } fMicroPropsGenerator->processQuantity(inValue, microsOut, status); - microsOut.rounder.apply(inValue, status); microsOut.integerWidth.apply(inValue, status); } @@ -124,7 +88,6 @@ MicroProps& NumberFormatterImpl::preProcessUnsafe(DecimalQuantity& inValue, UErr return fMicros; // must always return a value } fMicroPropsGenerator->processQuantity(inValue, fMicros, status); - fMicros.rounder.apply(inValue, status); fMicros.integerWidth.apply(inValue, status); return fMicros; } @@ -171,30 +134,37 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, // Pre-compute a few values for efficiency. bool isCurrency = utils::unitIsCurrency(macros.unit); - bool isNoUnit = utils::unitIsNoUnit(macros.unit); + bool isBaseUnit = utils::unitIsBaseUnit(macros.unit); bool isPercent = utils::unitIsPercent(macros.unit); bool isPermille = utils::unitIsPermille(macros.unit); + bool isCompactNotation = macros.notation.fType == Notation::NTN_COMPACT; bool isAccounting = - macros.sign == UNUM_SIGN_ACCOUNTING || macros.sign == UNUM_SIGN_ACCOUNTING_ALWAYS || - macros.sign == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO; + macros.sign == UNUM_SIGN_ACCOUNTING || + macros.sign == UNUM_SIGN_ACCOUNTING_ALWAYS || + macros.sign == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO || + macros.sign == UNUM_SIGN_ACCOUNTING_NEGATIVE; CurrencyUnit currency(u"", status); if (isCurrency) { currency = CurrencyUnit(macros.unit, status); // Restore CurrencyUnit from MeasureUnit } - const CurrencySymbols* currencySymbols; - if (macros.currencySymbols != nullptr) { - // Used by the DecimalFormat code path - currencySymbols = macros.currencySymbols; - } else { - fWarehouse.fCurrencySymbols = {currency, macros.locale, status}; - currencySymbols = &fWarehouse.fCurrencySymbols; - } UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_SHORT; if (macros.unitWidth != UNUM_UNIT_WIDTH_COUNT) { unitWidth = macros.unitWidth; } - bool isCldrUnit = !isCurrency && !isNoUnit && - (unitWidth == UNUM_UNIT_WIDTH_FULL_NAME || !(isPercent || isPermille)); + // Use CLDR unit data for all MeasureUnits (not currency and not + // no-unit), except use the dedicated percent pattern for percent and + // permille. However, use the CLDR unit data for percent/permille if a + // long name was requested OR if compact notation is being used, since + // compact notation overrides the middle modifier (micros.modMiddle) + // normally used for the percent pattern. + bool isCldrUnit = !isCurrency + && !isBaseUnit + && (unitWidth == UNUM_UNIT_WIDTH_FULL_NAME + || !(isPercent || isPermille) + || isCompactNotation + ); + bool isMixedUnit = isCldrUnit && (uprv_strcmp(macros.unit.getType(), "") == 0) && + macros.unit.getComplexity(status) == UMEASURE_UNIT_MIXED; // Select the numbering system. LocalPointer nsLocal; @@ -211,45 +181,33 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, uprv_strncpy(fMicros.nsName, nsName, 8); fMicros.nsName[8] = 0; // guarantee NUL-terminated + // Default gender: none. + fMicros.gender = ""; + // Resolve the symbols. Do this here because currency may need to customize them. if (macros.symbols.isDecimalFormatSymbols()) { - fMicros.symbols = macros.symbols.getDecimalFormatSymbols(); + fMicros.simple.symbols = macros.symbols.getDecimalFormatSymbols(); } else { - auto newSymbols = new DecimalFormatSymbols(macros.locale, *ns, status); - if (newSymbols == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; + LocalPointer newSymbols( + new DecimalFormatSymbols(macros.locale, *ns, status), status); + if (U_FAILURE(status)) { return nullptr; } - fMicros.symbols = newSymbols; - // Give ownership to the NumberFormatterImpl. - fSymbols.adoptInstead(fMicros.symbols); + if (isCurrency) { + newSymbols->setCurrency(currency.getISOCurrency(), status); + if (U_FAILURE(status)) { + return nullptr; + } + } + fMicros.simple.symbols = newSymbols.getAlias(); + fSymbols.adoptInstead(newSymbols.orphan()); } // Load and parse the pattern string. It is used for grouping sizes and affixes only. // If we are formatting currency, check for a currency-specific pattern. const char16_t* pattern = nullptr; - if (isCurrency) { - CurrencyFormatInfoResult info = getCurrencyFormatInfo( - macros.locale, currency.getSubtype(), status); - if (info.exists) { - pattern = info.pattern; - // It's clunky to clone an object here, but this code is not frequently executed. - auto symbols = new DecimalFormatSymbols(*fMicros.symbols); - if (symbols == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return nullptr; - } - fMicros.symbols = symbols; - fSymbols.adoptInstead(symbols); - symbols->setSymbol( - DecimalFormatSymbols::ENumberFormatSymbol::kMonetarySeparatorSymbol, - UnicodeString(info.decimalSeparator), - FALSE); - symbols->setSymbol( - DecimalFormatSymbols::ENumberFormatSymbol::kMonetaryGroupingSeparatorSymbol, - UnicodeString(info.groupingSeparator), - FALSE); - } + if (isCurrency && fMicros.simple.symbols->getCurrencyPattern() != nullptr) { + pattern = fMicros.simple.symbols->getCurrencyPattern(); } if (pattern == nullptr) { CldrPatternStyle patternStyle; @@ -267,6 +225,9 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, patternStyle = CLDR_PATTERN_STYLE_CURRENCY; } pattern = utils::getPatternForStyle(macros.locale, nsName, patternStyle, status); + if (U_FAILURE(status)) { + return nullptr; + } } auto patternInfo = new ParsedPatternInfo(); if (patternInfo == nullptr) { @@ -275,11 +236,32 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, } fPatternInfo.adoptInstead(patternInfo); PatternParser::parseToPatternInfo(UnicodeString(pattern), *patternInfo, status); + if (U_FAILURE(status)) { + return nullptr; + } ///////////////////////////////////////////////////////////////////////////////////// /// START POPULATING THE DEFAULT MICROPROPS AND BUILDING THE MICROPROPS GENERATOR /// ///////////////////////////////////////////////////////////////////////////////////// + // Unit Preferences and Conversions as our first step + if (macros.usage.isSet()) { + if (!isCldrUnit) { + // We only support "usage" when the input unit is specified, and is + // a CLDR Unit. + status = U_ILLEGAL_ARGUMENT_ERROR; + return nullptr; + } + auto usagePrefsHandler = + new UsagePrefsHandler(macros.locale, macros.unit, macros.usage.fValue, chain, status); + fUsagePrefsHandler.adoptInsteadAndCheckErrorCode(usagePrefsHandler, status); + chain = fUsagePrefsHandler.getAlias(); + } else if (isMixedUnit) { + auto unitConversionHandler = new UnitConversionHandler(macros.unit, chain, status); + fUnitConversionHandler.adoptInsteadAndCheckErrorCode(unitConversionHandler, status); + chain = fUnitConversionHandler.getAlias(); + } + // Multiplier if (macros.scale.isValid()) { fMicros.helpers.multiplier.setAndChain(macros.scale, chain); @@ -290,32 +272,33 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, Precision precision; if (!macros.precision.isBogus()) { precision = macros.precision; - } else if (macros.notation.fType == Notation::NTN_COMPACT) { + } else if (isCompactNotation) { precision = Precision::integer().withMinDigits(2); } else if (isCurrency) { precision = Precision::currency(UCURR_USAGE_STANDARD); + } else if (macros.usage.isSet()) { + // Bogus Precision - it will get set in the UsagePrefsHandler instead + precision = Precision(); } else { precision = Precision::maxFraction(6); } UNumberFormatRoundingMode roundingMode; - if (macros.roundingMode != kDefaultMode) { - roundingMode = macros.roundingMode; - } else { - // Temporary until ICU 64 - roundingMode = precision.fRoundingMode; - } + roundingMode = macros.roundingMode; fMicros.rounder = {precision, roundingMode, currency, status}; + if (U_FAILURE(status)) { + return nullptr; + } // Grouping strategy if (!macros.grouper.isBogus()) { - fMicros.grouping = macros.grouper; - } else if (macros.notation.fType == Notation::NTN_COMPACT) { + fMicros.simple.grouping = macros.grouper; + } else if (isCompactNotation) { // Compact notation uses minGrouping by default since ICU 59 - fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_MIN2); + fMicros.simple.grouping = Grouper::forStrategy(UNUM_GROUPING_MIN2); } else { - fMicros.grouping = Grouper::forStrategy(UNUM_GROUPING_AUTO); + fMicros.simple.grouping = Grouper::forStrategy(UNUM_GROUPING_AUTO); } - fMicros.grouping.setLocaleData(*fPatternInfo, macros.locale); + fMicros.simple.grouping.setLocaleData(*fPatternInfo, macros.locale); // Padding strategy if (!macros.padder.isBogus()) { @@ -340,17 +323,17 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, // Decimal mark display if (macros.decimal != UNUM_DECIMAL_SEPARATOR_COUNT) { - fMicros.decimal = macros.decimal; + fMicros.simple.decimal = macros.decimal; } else { - fMicros.decimal = UNUM_DECIMAL_SEPARATOR_AUTO; + fMicros.simple.decimal = UNUM_DECIMAL_SEPARATOR_AUTO; } // Use monetary separator symbols - fMicros.useCurrency = isCurrency; + fMicros.simple.useCurrency = isCurrency; // Inner modifier (scientific notation) if (macros.notation.fType == Notation::NTN_SCIENTIFIC) { - auto newScientificHandler = new ScientificHandler(¯os.notation, fMicros.symbols, chain); + auto newScientificHandler = new ScientificHandler(¯os.notation, fMicros.simple.symbols, chain); if (newScientificHandler == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return nullptr; @@ -369,58 +352,96 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, return nullptr; } fPatternModifier.adoptInstead(patternModifier); - patternModifier->setPatternInfo( - macros.affixProvider != nullptr ? macros.affixProvider - : static_cast(fPatternInfo.getAlias()), - UNUM_FIELD_COUNT); - patternModifier->setPatternAttributes(fMicros.sign, isPermille); + const AffixPatternProvider* affixProvider = + macros.affixProvider != nullptr && ( + // For more information on this condition, see ICU-22073 + !isCompactNotation || isCurrency == macros.affixProvider->hasCurrencySign()) + ? macros.affixProvider + : static_cast(fPatternInfo.getAlias()); + patternModifier->setPatternInfo(affixProvider, kUndefinedField); + patternModifier->setPatternAttributes(fMicros.sign, isPermille, macros.approximately); if (patternModifier->needsPlurals()) { patternModifier->setSymbols( - fMicros.symbols, - currencySymbols, + fMicros.simple.symbols, + currency, unitWidth, - resolvePluralRules(macros.rules, macros.locale, status)); + resolvePluralRules(macros.rules, macros.locale, status), + status); } else { - patternModifier->setSymbols(fMicros.symbols, currencySymbols, unitWidth, nullptr); + patternModifier->setSymbols(fMicros.simple.symbols, currency, unitWidth, nullptr, status); } if (safe) { - fImmutablePatternModifier.adoptInstead(patternModifier->createImmutableAndChain(chain, status)); - chain = fImmutablePatternModifier.getAlias(); - } else { - patternModifier->addToChain(chain); - chain = patternModifier; + fImmutablePatternModifier.adoptInsteadAndCheckErrorCode(patternModifier->createImmutable(status), + status); + } + if (U_FAILURE(status)) { + return nullptr; + } + + // currencyAsDecimal + if (affixProvider->currencyAsDecimal()) { + fMicros.simple.currencyAsDecimal = patternModifier->getCurrencySymbolForUnitWidth(status); } // Outer modifier (CLDR units and currency long names) if (isCldrUnit) { - fLongNameHandler.adoptInstead( - LongNameHandler::forMeasureUnit( - macros.locale, - macros.unit, - macros.perUnit, - unitWidth, - resolvePluralRules(macros.rules, macros.locale, status), - chain, - status)); - chain = fLongNameHandler.getAlias(); + const char *unitDisplayCase = ""; + if (macros.unitDisplayCase.isSet()) { + unitDisplayCase = macros.unitDisplayCase.fValue; + } + if (macros.usage.isSet()) { + fLongNameMultiplexer.adoptInsteadAndCheckErrorCode( + LongNameMultiplexer::forMeasureUnits( + macros.locale, *fUsagePrefsHandler->getOutputUnits(), unitWidth, unitDisplayCase, + resolvePluralRules(macros.rules, macros.locale, status), chain, status), + status); + chain = fLongNameMultiplexer.getAlias(); + } else if (isMixedUnit) { + fMixedUnitLongNameHandler.adoptInsteadAndCheckErrorCode(new MixedUnitLongNameHandler(), + status); + MixedUnitLongNameHandler::forMeasureUnit( + macros.locale, macros.unit, unitWidth, unitDisplayCase, + resolvePluralRules(macros.rules, macros.locale, status), chain, + fMixedUnitLongNameHandler.getAlias(), status); + chain = fMixedUnitLongNameHandler.getAlias(); + } else { + MeasureUnit unit = macros.unit; + if (!utils::unitIsBaseUnit(macros.perUnit)) { + unit = unit.product(macros.perUnit.reciprocal(status), status); + // This isn't strictly necessary, but was what we specced out + // when perUnit became a backward-compatibility thing: + // unit/perUnit use case is only valid if both units are + // built-ins, or the product is a built-in. + if (uprv_strcmp(unit.getType(), "") == 0 && + (uprv_strcmp(macros.unit.getType(), "") == 0 || + uprv_strcmp(macros.perUnit.getType(), "") == 0)) { + status = U_UNSUPPORTED_ERROR; + return nullptr; + } + } + fLongNameHandler.adoptInsteadAndCheckErrorCode(new LongNameHandler(), status); + LongNameHandler::forMeasureUnit(macros.locale, unit, unitWidth, unitDisplayCase, + resolvePluralRules(macros.rules, macros.locale, status), + chain, fLongNameHandler.getAlias(), status); + chain = fLongNameHandler.getAlias(); + } } else if (isCurrency && unitWidth == UNUM_UNIT_WIDTH_FULL_NAME) { - fLongNameHandler.adoptInstead( - LongNameHandler::forCurrencyLongNames( - macros.locale, - currency, - resolvePluralRules(macros.rules, macros.locale, status), - chain, - status)); + fLongNameHandler.adoptInsteadAndCheckErrorCode( + LongNameHandler::forCurrencyLongNames( + macros.locale, currency, resolvePluralRules(macros.rules, macros.locale, status), chain, + status), + status); chain = fLongNameHandler.getAlias(); } else { // No outer modifier required fMicros.modOuter = &fMicros.helpers.emptyWeakModifier; } + if (U_FAILURE(status)) { + return nullptr; + } // Compact notation - // NOTE: Compact notation can (but might not) override the middle modifier and rounding. - // It therefore needs to go at the end of the chain. - if (macros.notation.fType == Notation::NTN_COMPACT) { + if (isCompactNotation) { CompactType compactType = (isCurrency && unitWidth != UNUM_UNIT_WIDTH_FULL_NAME) ? CompactType::TYPE_CURRENCY : CompactType::TYPE_DECIMAL; auto newCompactHandler = new CompactHandler( @@ -429,9 +450,13 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, nsName, compactType, resolvePluralRules(macros.rules, macros.locale, status), - safe ? patternModifier : nullptr, + patternModifier, + safe, chain, status); + if (U_FAILURE(status)) { + return nullptr; + } if (newCompactHandler == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return nullptr; @@ -439,13 +464,27 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, fCompactHandler.adoptInstead(newCompactHandler); chain = fCompactHandler.getAlias(); } + if (U_FAILURE(status)) { + return nullptr; + } + + // Always add the pattern modifier as the last element of the chain. + if (safe) { + fImmutablePatternModifier->addToChain(chain); + chain = fImmutablePatternModifier.getAlias(); + } else { + patternModifier->addToChain(chain); + chain = patternModifier; + } return chain; } const PluralRules* -NumberFormatterImpl::resolvePluralRules(const PluralRules* rulesPtr, const Locale& locale, - UErrorCode& status) { +NumberFormatterImpl::resolvePluralRules( + const PluralRules* rulesPtr, + const Locale& locale, + UErrorCode& status) { if (rulesPtr != nullptr) { return rulesPtr; } @@ -456,8 +495,13 @@ NumberFormatterImpl::resolvePluralRules(const PluralRules* rulesPtr, const Local return fRules.getAlias(); } -int32_t NumberFormatterImpl::writeAffixes(const MicroProps& micros, FormattedStringBuilder& string, - int32_t start, int32_t end, UErrorCode& status) { +int32_t NumberFormatterImpl::writeAffixes( + const MicroProps& micros, + FormattedStringBuilder& string, + int32_t start, + int32_t end, + UErrorCode& status) { + U_ASSERT(micros.modOuter != nullptr); // Always apply the inner modifier (which is "strong"). int32_t length = micros.modInner->apply(string, start, end, status); if (micros.padding.isValid()) { @@ -470,51 +514,85 @@ int32_t NumberFormatterImpl::writeAffixes(const MicroProps& micros, FormattedStr return length; } -int32_t NumberFormatterImpl::writeNumber(const MicroProps& micros, DecimalQuantity& quantity, - FormattedStringBuilder& string, int32_t index, - UErrorCode& status) { +int32_t NumberFormatterImpl::writeNumber( + const SimpleMicroProps& micros, + DecimalQuantity& quantity, + FormattedStringBuilder& string, + int32_t index, + UErrorCode& status) { int32_t length = 0; if (quantity.isInfinite()) { length += string.insert( length + index, micros.symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kInfinitySymbol), - UNUM_INTEGER_FIELD, + {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD}, status); } else if (quantity.isNaN()) { length += string.insert( length + index, micros.symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kNaNSymbol), - UNUM_INTEGER_FIELD, + {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD}, status); } else { // Add the integer digits - length += writeIntegerDigits(micros, quantity, string, length + index, status); + length += writeIntegerDigits( + micros, + quantity, + string, + length + index, + status); // Add the decimal point if (quantity.getLowerDisplayMagnitude() < 0 || micros.decimal == UNUM_DECIMAL_SEPARATOR_ALWAYS) { - length += string.insert( + if (!micros.currencyAsDecimal.isBogus()) { + length += string.insert( length + index, - micros.useCurrency ? micros.symbols->getSymbol( - DecimalFormatSymbols::ENumberFormatSymbol::kMonetarySeparatorSymbol) : micros - .symbols - ->getSymbol( - DecimalFormatSymbols::ENumberFormatSymbol::kDecimalSeparatorSymbol), - UNUM_DECIMAL_SEPARATOR_FIELD, + micros.currencyAsDecimal, + {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}, status); + } else if (micros.useCurrency) { + length += string.insert( + length + index, + micros.symbols->getSymbol( + DecimalFormatSymbols::ENumberFormatSymbol::kMonetarySeparatorSymbol), + {UFIELD_CATEGORY_NUMBER, UNUM_DECIMAL_SEPARATOR_FIELD}, + status); + } else { + length += string.insert( + length + index, + micros.symbols->getSymbol( + DecimalFormatSymbols::ENumberFormatSymbol::kDecimalSeparatorSymbol), + {UFIELD_CATEGORY_NUMBER, UNUM_DECIMAL_SEPARATOR_FIELD}, + status); + } } // Add the fraction digits length += writeFractionDigits(micros, quantity, string, length + index, status); + + if (length == 0) { + // Force output of the digit for value 0 + length += utils::insertDigitFromSymbols( + string, + index, + 0, + *micros.symbols, + {UFIELD_CATEGORY_NUMBER, UNUM_INTEGER_FIELD}, + status); + } } return length; } -int32_t NumberFormatterImpl::writeIntegerDigits(const MicroProps& micros, DecimalQuantity& quantity, - FormattedStringBuilder& string, int32_t index, - UErrorCode& status) { +int32_t NumberFormatterImpl::writeIntegerDigits( + const SimpleMicroProps& micros, + DecimalQuantity& quantity, + FormattedStringBuilder& string, + int32_t index, + UErrorCode& status) { int length = 0; int integerCount = quantity.getUpperDisplayMagnitude() + 1; for (int i = 0; i < integerCount; i++) { @@ -526,28 +604,42 @@ int32_t NumberFormatterImpl::writeIntegerDigits(const MicroProps& micros, Decima DecimalFormatSymbols::ENumberFormatSymbol::kMonetaryGroupingSeparatorSymbol) : micros.symbols->getSymbol( DecimalFormatSymbols::ENumberFormatSymbol::kGroupingSeparatorSymbol), - UNUM_GROUPING_SEPARATOR_FIELD, + {UFIELD_CATEGORY_NUMBER, UNUM_GROUPING_SEPARATOR_FIELD}, status); } // Get and append the next digit value int8_t nextDigit = quantity.getDigit(i); length += utils::insertDigitFromSymbols( - string, index, nextDigit, *micros.symbols, UNUM_INTEGER_FIELD, status); + string, + index, + nextDigit, + *micros.symbols, + {UFIELD_CATEGORY_NUMBER, + UNUM_INTEGER_FIELD}, + status); } return length; } -int32_t NumberFormatterImpl::writeFractionDigits(const MicroProps& micros, DecimalQuantity& quantity, - FormattedStringBuilder& string, int32_t index, - UErrorCode& status) { +int32_t NumberFormatterImpl::writeFractionDigits( + const SimpleMicroProps& micros, + DecimalQuantity& quantity, + FormattedStringBuilder& string, + int32_t index, + UErrorCode& status) { int length = 0; int fractionCount = -quantity.getLowerDisplayMagnitude(); for (int i = 0; i < fractionCount; i++) { // Get and append the next digit value int8_t nextDigit = quantity.getDigit(-i - 1); length += utils::insertDigitFromSymbols( - string, length + index, nextDigit, *micros.symbols, UNUM_FRACTION_FIELD, status); + string, + length + index, + nextDigit, + *micros.symbols, + {UFIELD_CATEGORY_NUMBER, UNUM_FRACTION_FIELD}, + status); } return length; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.h index 206c5f58c..62d532126 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.h @@ -10,11 +10,13 @@ #include "number_types.h" #include "formatted_string_builder.h" #include "number_patternstring.h" +#include "number_usageprefs.h" #include "number_utils.h" #include "number_patternmodifier.h" #include "number_longnames.h" #include "number_compact.h" #include "number_microprops.h" +#include "number_utypes.h" U_NAMESPACE_BEGIN namespace number { namespace impl { @@ -31,12 +33,17 @@ class NumberFormatterImpl : public UMemory { */ NumberFormatterImpl(const MacroProps ¯os, UErrorCode &status); + /** + * Default constructor; leaves the NumberFormatterImpl in an undefined state. + * Takes an error code to prevent the method from being called accidentally. + */ + NumberFormatterImpl(UErrorCode &) {} + /** * Builds and evaluates an "unsafe" MicroPropsGenerator, which is cheaper but can be used only once. */ - static int32_t - formatStatic(const MacroProps ¯os, DecimalQuantity &inValue, FormattedStringBuilder &outString, - UErrorCode &status); + static int32_t formatStatic(const MacroProps ¯os, UFormattedNumberData *results, + UErrorCode &status); /** * Prints only the prefix and suffix; used for DecimalFormat getters. @@ -51,7 +58,7 @@ class NumberFormatterImpl : public UMemory { /** * Evaluates the "safe" MicroPropsGenerator created by "fromMacros". */ - int32_t format(DecimalQuantity& inValue, FormattedStringBuilder& outString, UErrorCode& status) const; + int32_t format(UFormattedNumberData *results, UErrorCode &status) const; /** * Like format(), but saves the result into an output MicroProps without additional processing. @@ -72,17 +79,27 @@ class NumberFormatterImpl : public UMemory { * Synthesizes the output string from a MicroProps and DecimalQuantity. * This method formats only the main number, not affixes. */ - static int32_t writeNumber(const MicroProps& micros, DecimalQuantity& quantity, - FormattedStringBuilder& string, int32_t index, UErrorCode& status); + static int32_t writeNumber( + const SimpleMicroProps& micros, + DecimalQuantity& quantity, + FormattedStringBuilder& string, + int32_t index, + UErrorCode& status); /** * Adds the affixes. Intended to be called immediately after formatNumber. */ - static int32_t writeAffixes(const MicroProps& micros, FormattedStringBuilder& string, int32_t start, - int32_t end, UErrorCode& status); + static int32_t writeAffixes( + const MicroProps& micros, + FormattedStringBuilder& string, + int32_t start, + int32_t end, + UErrorCode& status); private: - // Head of the MicroPropsGenerator linked list: + // Head of the MicroPropsGenerator linked list. Subclasses' processQuantity + // methods process this list in a parent-first order, such that the last + // item added, which this points to, typically has its logic executed last. const MicroPropsGenerator *fMicroPropsGenerator = nullptr; // Tail of the list: @@ -90,21 +107,22 @@ class NumberFormatterImpl : public UMemory { // Other fields possibly used by the number formatting pipeline: // TODO: Convert more of these LocalPointers to value objects to reduce the number of news? + LocalPointer fUsagePrefsHandler; + LocalPointer fUnitConversionHandler; LocalPointer fSymbols; LocalPointer fRules; LocalPointer fPatternInfo; LocalPointer fScientificHandler; LocalPointer fPatternModifier; - LocalPointer fImmutablePatternModifier; - LocalPointer fLongNameHandler; + LocalPointer fImmutablePatternModifier; + LocalPointer fLongNameHandler; + // TODO: use a common base class that enables fLongNameHandler, + // fLongNameMultiplexer, and fMixedUnitLongNameHandler to be merged into one + // member? + LocalPointer fMixedUnitLongNameHandler; + LocalPointer fLongNameMultiplexer; LocalPointer fCompactHandler; - // Value objects possibly used by the number formatting pipeline: - struct Warehouse { - CurrencySymbols fCurrencySymbols; - } fWarehouse; - - NumberFormatterImpl(const MacroProps ¯os, bool safe, UErrorCode &status); MicroProps& preProcessUnsafe(DecimalQuantity &inValue, UErrorCode &status); @@ -136,12 +154,20 @@ class NumberFormatterImpl : public UMemory { macrosToMicroGenerator(const MacroProps ¯os, bool safe, UErrorCode &status); static int32_t - writeIntegerDigits(const MicroProps µs, DecimalQuantity &quantity, FormattedStringBuilder &string, - int32_t index, UErrorCode &status); + writeIntegerDigits( + const SimpleMicroProps& micros, + DecimalQuantity &quantity, + FormattedStringBuilder &string, + int32_t index, + UErrorCode &status); static int32_t - writeFractionDigits(const MicroProps µs, DecimalQuantity &quantity, FormattedStringBuilder &string, - int32_t index, UErrorCode &status); + writeFractionDigits( + const SimpleMicroProps& micros, + DecimalQuantity &quantity, + FormattedStringBuilder &string, + int32_t index, + UErrorCode &status); }; } // namespace impl diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_grouping.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_grouping.cpp index cff412630..54aeffee8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_grouping.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_grouping.cpp @@ -18,7 +18,7 @@ namespace { int16_t getMinGroupingForLocale(const Locale& locale) { // TODO: Cache this? UErrorCode localStatus = U_ZERO_ERROR; - LocalUResourceBundlePointer bundle(ures_open(NULL, locale.getName(), &localStatus)); + LocalUResourceBundlePointer bundle(ures_open(nullptr, locale.getName(), &localStatus)); int32_t resultLen = 0; const char16_t* result = ures_getStringByKeyWithFallback( bundle.getAlias(), @@ -47,7 +47,7 @@ Grouper Grouper::forStrategy(UNumberGroupingStrategy grouping) { case UNUM_GROUPING_THOUSANDS: return {3, 3, 1, grouping}; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -63,7 +63,14 @@ Grouper Grouper::forProperties(const DecimalFormatProperties& properties) { return {grouping1, grouping2, minGrouping, UNUM_GROUPING_COUNT}; } -void Grouper::setLocaleData(const number::impl::ParsedPatternInfo &patternInfo, const Locale& locale) { +void Grouper::setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale) { + if (fMinGrouping == -2) { + fMinGrouping = getMinGroupingForLocale(locale); + } else if (fMinGrouping == -3) { + fMinGrouping = static_cast(uprv_max(2, getMinGroupingForLocale(locale))); + } else { + // leave fMinGrouping alone + } if (fGrouping1 != -2 && fGrouping2 != -4) { return; } @@ -76,18 +83,11 @@ void Grouper::setLocaleData(const number::impl::ParsedPatternInfo &patternInfo, if (grouping3 == -1) { grouping2 = grouping1; } - if (fMinGrouping == -2) { - fMinGrouping = getMinGroupingForLocale(locale); - } else if (fMinGrouping == -3) { - fMinGrouping = static_cast(uprv_max(2, getMinGroupingForLocale(locale))); - } else { - // leave fMinGrouping alone - } fGrouping1 = grouping1; fGrouping2 = grouping2; } -bool Grouper::groupAtPosition(int32_t position, const number::impl::DecimalQuantity &value) const { +bool Grouper::groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const { U_ASSERT(fGrouping1 > -2); if (fGrouping1 == -1 || fGrouping1 == 0) { // Either -1 or 0 means "no grouping" diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_integerwidth.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_integerwidth.cpp index b6fa212b4..10b853423 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_integerwidth.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_integerwidth.cpp @@ -39,7 +39,10 @@ IntegerWidth IntegerWidth::truncateAt(int32_t maxInt) { } } -void IntegerWidth::apply(number::impl::DecimalQuantity& quantity, UErrorCode& status) const { +void IntegerWidth::apply(impl::DecimalQuantity& quantity, UErrorCode& status) const { + if (U_FAILURE(status)) { + return; + } if (fHasError) { status = U_ILLEGAL_ARGUMENT_ERROR; } else if (fUnion.minMaxInt.fMaxInt == -1) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.cpp index a0636f072..96c6ca6bf 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.cpp @@ -5,11 +5,14 @@ #if !UCONFIG_NO_FORMATTING +#include + #include "unicode/simpleformatter.h" #include "unicode/ures.h" #include "ureslocs.h" #include "charstr.h" #include "uresimp.h" +#include "measunit_impl.h" #include "number_longnames.h" #include "number_microprops.h" #include @@ -22,22 +25,100 @@ using namespace icu::number::impl; namespace { -constexpr int32_t number_longnames_DNAM_INDEX = StandardPlural::Form::COUNT; -constexpr int32_t number_longnames_PER_INDEX = StandardPlural::Form::COUNT + 1; -constexpr int32_t number_longnames_ARRAY_LENGTH = StandardPlural::Form::COUNT + 2; +/** + * Display Name (this format has no placeholder). + * + * Used as an index into the LongNameHandler::simpleFormats array. Units + * resources cover the normal set of PluralRules keys, as well as `dnam` and + * `per` forms. + */ +constexpr int32_t DNAM_INDEX = StandardPlural::Form::COUNT; +/** + * "per" form (e.g. "{0} per day" is day's "per" form). + * + * Used as an index into the LongNameHandler::simpleFormats array. Units + * resources cover the normal set of PluralRules keys, as well as `dnam` and + * `per` forms. + */ +constexpr int32_t PER_INDEX = StandardPlural::Form::COUNT + 1; +/** + * Gender of the word, in languages with grammatical gender. + */ +constexpr int32_t GENDER_INDEX = StandardPlural::Form::COUNT + 2; +// Number of keys in the array populated by PluralTableSink. +constexpr int32_t ARRAY_LENGTH = StandardPlural::Form::COUNT + 3; -static int32_t number_longnames_getIndex(const char* pluralKeyword, UErrorCode& status) { - // pluralKeyword can also be "dnam" or "per" - if (uprv_strcmp(pluralKeyword, "dnam") == 0) { - return number_longnames_DNAM_INDEX; - } else if (uprv_strcmp(pluralKeyword, "per") == 0) { - return number_longnames_PER_INDEX; - } else { - StandardPlural::Form plural = StandardPlural::fromString(pluralKeyword, status); - return plural; +// TODO(icu-units#28): load this list from resources, after creating a "&set" +// function for use in ldml2icu rules. +const int32_t GENDER_COUNT = 7; +const char *gGenders[GENDER_COUNT] = {"animate", "common", "feminine", "inanimate", + "masculine", "neuter", "personal"}; + +// Converts a UnicodeString to a const char*, either pointing to a string in +// gGenders, or pointing to an empty string if an appropriate string was not +// found. +const char *getGenderString(UnicodeString uGender, UErrorCode status) { + if (uGender.length() == 0) { + return ""; + } + CharString gender; + gender.appendInvariantChars(uGender, status); + if (U_FAILURE(status)) { + return ""; + } + int32_t first = 0; + int32_t last = GENDER_COUNT; + while (first < last) { + int32_t mid = (first + last) / 2; + int32_t cmp = uprv_strcmp(gender.data(), gGenders[mid]); + if (cmp == 0) { + return gGenders[mid]; + } else if (cmp > 0) { + first = mid + 1; + } else if (cmp < 0) { + last = mid; + } } + // We don't return an error in case our gGenders list is incomplete in + // production. + // + // TODO(icu-units#28): a unit test checking all locales' genders are covered + // by gGenders? Else load a complete list of genders found in + // grammaticalFeatures in an initOnce. + return ""; } +// Returns the array index that corresponds to the given pluralKeyword. +static int32_t getIndex(const char* pluralKeyword, UErrorCode& status) { + // pluralKeyword can also be "dnam", "per", or "gender" + switch (*pluralKeyword) { + case 'd': + if (uprv_strcmp(pluralKeyword + 1, "nam") == 0) { + return DNAM_INDEX; + } + break; + case 'g': + if (uprv_strcmp(pluralKeyword + 1, "ender") == 0) { + return GENDER_INDEX; + } + break; + case 'p': + if (uprv_strcmp(pluralKeyword + 1, "er") == 0) { + return PER_INDEX; + } + break; + default: + break; + } + StandardPlural::Form plural = StandardPlural::fromString(pluralKeyword, status); + return plural; +} + +// Selects a string out of the `strings` array which corresponds to the +// specified plural form, with fallback to the OTHER form. +// +// The `strings` array must have ARRAY_LENGTH items: one corresponding to each +// of the plural forms, plus a display name ("dnam") and a "per" form. static UnicodeString getWithPlural( const UnicodeString* strings, StandardPlural::Form plural, @@ -53,54 +134,342 @@ static UnicodeString getWithPlural( return result; } +enum PlaceholderPosition { PH_EMPTY, PH_NONE, PH_BEGINNING, PH_MIDDLE, PH_END }; + +/** + * Returns three outputs extracted from pattern. + * + * @param coreUnit is extracted as per Extract(...) in the spec: + * https://unicode.org/reports/tr35/tr35-general.html#compound-units + * @param PlaceholderPosition indicates where in the string the placeholder was + * found. + * @param joinerChar Iff the placeholder was at the beginning or end, joinerChar + * contains the space character (if any) that separated the placeholder from + * the rest of the pattern. Otherwise, joinerChar is set to NUL. Only one + * space character is considered. + */ +void extractCorePattern(const UnicodeString &pattern, + UnicodeString &coreUnit, + PlaceholderPosition &placeholderPosition, + char16_t &joinerChar) { + joinerChar = 0; + int32_t len = pattern.length(); + if (pattern.startsWith(u"{0}", 3)) { + placeholderPosition = PH_BEGINNING; + if (u_isJavaSpaceChar(pattern[3])) { + joinerChar = pattern[3]; + coreUnit.setTo(pattern, 4, len - 4); + } else { + coreUnit.setTo(pattern, 3, len - 3); + } + } else if (pattern.endsWith(u"{0}", 3)) { + placeholderPosition = PH_END; + if (u_isJavaSpaceChar(pattern[len - 4])) { + coreUnit.setTo(pattern, 0, len - 4); + joinerChar = pattern[len - 4]; + } else { + coreUnit.setTo(pattern, 0, len - 3); + } + } else if (pattern.indexOf(u"{0}", 3, 1, len - 2) == -1) { + placeholderPosition = PH_NONE; + coreUnit = pattern; + } else { + placeholderPosition = PH_MIDDLE; + coreUnit = pattern; + } +} ////////////////////////// /// BEGIN DATA LOADING /// ////////////////////////// +// Gets the gender of a built-in unit: unit must be a built-in. Returns an empty +// string both in case of unknown gender and in case of unknown unit. +UnicodeString +getGenderForBuiltin(const Locale &locale, const MeasureUnit &builtinUnit, UErrorCode &status) { + LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status)); + if (U_FAILURE(status)) { return {}; } + + // Map duration-year-person, duration-week-person, etc. to duration-year, duration-week, ... + // TODO(ICU-20400): Get duration-*-person data properly with aliases. + StringPiece subtypeForResource; + int32_t subtypeLen = static_cast(uprv_strlen(builtinUnit.getSubtype())); + if (subtypeLen > 7 && uprv_strcmp(builtinUnit.getSubtype() + subtypeLen - 7, "-person") == 0) { + subtypeForResource = {builtinUnit.getSubtype(), subtypeLen - 7}; + } else { + subtypeForResource = builtinUnit.getSubtype(); + } + + CharString key; + key.append("units/", status); + key.append(builtinUnit.getType(), status); + key.append("/", status); + key.append(subtypeForResource, status); + key.append("/gender", status); + + UErrorCode localStatus = status; + int32_t resultLen = 0; + const char16_t *result = + ures_getStringByKeyWithFallback(unitsBundle.getAlias(), key.data(), &resultLen, &localStatus); + if (U_SUCCESS(localStatus)) { + status = localStatus; + return UnicodeString(true, result, resultLen); + } else { + // TODO(icu-units#28): "$unitRes/gender" does not exist. Do we want to + // check whether the parent "$unitRes" exists? Then we could return + // U_MISSING_RESOURCE_ERROR for incorrect usage (e.g. builtinUnit not + // being a builtin). + return {}; + } +} + +// Loads data from a resource tree with paths matching +// $key/$pluralForm/$gender/$case, with lateral inheritance for missing cases +// and genders. +// +// An InflectedPluralSink is configured to load data for a specific gender and +// case. It loads all plural forms, because selection between plural forms is +// dependent upon the value being formatted. +// +// See data/unit/de.txt and data/unit/fr.txt for examples - take a look at +// units/compound/power2: German has case, French has differences for gender, +// but no case. +// +// TODO(icu-units#138): Conceptually similar to PluralTableSink, however the +// tree structures are different. After homogenizing the structures, we may be +// able to unify the two classes. +// +// TODO: Spec violation: expects presence of "count" - does not fallback to an +// absent "count"! If this fallback were added, getCompoundValue could be +// superseded? +class InflectedPluralSink : public ResourceSink { + public: + // Accepts `char*` rather than StringPiece because + // ResourceTable::findValue(...) requires a null-terminated `char*`. + // + // NOTE: outArray MUST have a length of at least ARRAY_LENGTH. No bounds + // checking is performed. + explicit InflectedPluralSink(const char *gender, const char *caseVariant, UnicodeString *outArray) + : gender(gender), caseVariant(caseVariant), outArray(outArray) { + // Initialize the array to bogus strings. + for (int32_t i = 0; i < ARRAY_LENGTH; i++) { + outArray[i].setToBogus(); + } + } + + // See ResourceSink::put(). + void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) override { + int32_t pluralIndex = getIndex(key, status); + if (U_FAILURE(status)) { return; } + if (!outArray[pluralIndex].isBogus()) { + // We already have a pattern + return; + } + ResourceTable genderTable = value.getTable(status); + ResourceTable caseTable; // This instance has to outlive `value` + if (loadForPluralForm(genderTable, caseTable, value, status)) { + outArray[pluralIndex] = value.getUnicodeString(status); + } + } + + private: + // Tries to load data for the configured gender from `genderTable`. Returns + // true if found, returning the data in `value`. The returned data will be + // for the configured gender if found, falling back to "neuter" and + // no-gender if not. The caseTable parameter holds the intermediate + // ResourceTable for the sake of lifetime management. + bool loadForPluralForm(const ResourceTable &genderTable, + ResourceTable &caseTable, + ResourceValue &value, + UErrorCode &status) { + if (uprv_strcmp(gender, "") != 0) { + if (loadForGender(genderTable, gender, caseTable, value, status)) { + return true; + } + if (uprv_strcmp(gender, "neuter") != 0 && + loadForGender(genderTable, "neuter", caseTable, value, status)) { + return true; + } + } + if (loadForGender(genderTable, "_", caseTable, value, status)) { + return true; + } + return false; + } + + // Tries to load data for the given gender from `genderTable`. Returns true + // if found, returning the data in `value`. The returned data will be for + // the configured case if found, falling back to "nominative" and no-case if + // not. + bool loadForGender(const ResourceTable &genderTable, + const char *genderVal, + ResourceTable &caseTable, + ResourceValue &value, + UErrorCode &status) { + if (!genderTable.findValue(genderVal, value)) { + return false; + } + caseTable = value.getTable(status); + if (uprv_strcmp(caseVariant, "") != 0) { + if (loadForCase(caseTable, caseVariant, value)) { + return true; + } + if (uprv_strcmp(caseVariant, "nominative") != 0 && + loadForCase(caseTable, "nominative", value)) { + return true; + } + } + if (loadForCase(caseTable, "_", value)) { + return true; + } + return false; + } + + // Tries to load data for the given case from `caseTable`. Returns true if + // found, returning the data in `value`. + bool loadForCase(const ResourceTable &caseTable, const char *caseValue, ResourceValue &value) { + if (!caseTable.findValue(caseValue, value)) { + return false; + } + return true; + } + + const char *gender; + const char *caseVariant; + UnicodeString *outArray; +}; + +// Fetches localised formatting patterns for the given subKey. See documentation +// for InflectedPluralSink for details. +// +// Data is loaded for the appropriate unit width, with missing data filled in +// from unitsShort. +void getInflectedMeasureData(StringPiece subKey, + const Locale &locale, + const UNumberUnitWidth &width, + const char *gender, + const char *caseVariant, + UnicodeString *outArray, + UErrorCode &status) { + InflectedPluralSink sink(gender, caseVariant, outArray); + LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status)); + if (U_FAILURE(status)) { return; } + + CharString key; + key.append("units", status); + if (width == UNUM_UNIT_WIDTH_NARROW) { + key.append("Narrow", status); + } else if (width == UNUM_UNIT_WIDTH_SHORT) { + key.append("Short", status); + } + key.append("/", status); + key.append(subKey, status); + + UErrorCode localStatus = status; + ures_getAllChildrenWithFallback(unitsBundle.getAlias(), key.data(), sink, localStatus); + if (width == UNUM_UNIT_WIDTH_SHORT) { + status = localStatus; + return; + } +} + class PluralTableSink : public ResourceSink { public: + // NOTE: outArray MUST have a length of at least ARRAY_LENGTH. No bounds + // checking is performed. explicit PluralTableSink(UnicodeString *outArray) : outArray(outArray) { // Initialize the array to bogus strings. - for (int32_t i = 0; i < number_longnames_ARRAY_LENGTH; i++) { + for (int32_t i = 0; i < ARRAY_LENGTH; i++) { outArray[i].setToBogus(); } } - void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE { - ResourceTable pluralsTable = value.getTable(status); + void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) override { + if (uprv_strcmp(key, "case") == 0) { + return; + } + int32_t index = getIndex(key, status); if (U_FAILURE(status)) { return; } - for (int32_t i = 0; pluralsTable.getKeyAndValue(i, key, value); ++i) { - int32_t index = number_longnames_getIndex(key, status); - if (U_FAILURE(status)) { return; } - if (!outArray[index].isBogus()) { - continue; - } - outArray[index] = value.getUnicodeString(status); - if (U_FAILURE(status)) { return; } + if (!outArray[index].isBogus()) { + return; } + outArray[index] = value.getUnicodeString(status); + if (U_FAILURE(status)) { return; } } private: UnicodeString *outArray; }; -// NOTE: outArray MUST have room for all StandardPlural values. No bounds checking is performed. - -void getMeasureData(const Locale &locale, const MeasureUnit &unit, const UNumberUnitWidth &width, - UnicodeString *outArray, UErrorCode &status) { +/** + * Populates outArray with `locale`-specific values for `unit` through use of + * PluralTableSink. Only the set of basic units are supported! + * + * Reading from resources *unitsNarrow* and *unitsShort* (for width + * UNUM_UNIT_WIDTH_NARROW), or just *unitsShort* (for width + * UNUM_UNIT_WIDTH_SHORT). For other widths, it reads just "units". + * + * @param unit must be a built-in unit, i.e. must have a type and subtype, + * listed in gTypes and gSubTypes in measunit.cpp. + * @param unitDisplayCase the empty string and "nominative" are treated the + * same. For other cases, strings for the requested case are used if found. + * (For any missing case-specific data, we fall back to nominative.) + * @param outArray must be of fixed length ARRAY_LENGTH. + */ +void getMeasureData(const Locale &locale, + const MeasureUnit &unit, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + UnicodeString *outArray, + UErrorCode &status) { PluralTableSink sink(outArray); LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status)); if (U_FAILURE(status)) { return; } + CharString subKey; + subKey.append("/", status); + subKey.append(unit.getType(), status); + subKey.append("/", status); + + // Check if unitSubType is an alias or not. + LocalUResourceBundlePointer aliasBundle(ures_open(U_ICUDATA_ALIAS, "metadata", &status)); + + UErrorCode aliasStatus = status; + StackUResourceBundle aliasFillIn; + CharString aliasKey; + aliasKey.append("alias/unit/", aliasStatus); + aliasKey.append(unit.getSubtype(), aliasStatus); + aliasKey.append("/replacement", aliasStatus); + ures_getByKeyWithFallback(aliasBundle.getAlias(), aliasKey.data(), aliasFillIn.getAlias(), + &aliasStatus); + CharString unitSubType; + if (!U_FAILURE(aliasStatus)) { + // This means the subType is an alias. Then, replace unitSubType with the replacement. + auto replacement = ures_getUnicodeString(aliasFillIn.getAlias(), &status); + unitSubType.appendInvariantChars(replacement, status); + } else { + unitSubType.append(unit.getSubtype(), status); + } + // Map duration-year-person, duration-week-person, etc. to duration-year, duration-week, ... // TODO(ICU-20400): Get duration-*-person data properly with aliases. - StringPiece subtypeForResource; - int32_t subtypeLen = static_cast(uprv_strlen(unit.getSubtype())); - if (subtypeLen > 7 && uprv_strcmp(unit.getSubtype() + subtypeLen - 7, "-person") == 0) { - subtypeForResource = {unit.getSubtype(), subtypeLen - 7}; + int32_t subtypeLen = static_cast(uprv_strlen(unitSubType.data())); + if (subtypeLen > 7 && uprv_strcmp(unitSubType.data() + subtypeLen - 7, "-person") == 0) { + subKey.append({unitSubType.data(), subtypeLen - 7}, status); } else { - subtypeForResource = unit.getSubtype(); + subKey.append({unitSubType.data(), subtypeLen}, status); + } + + if (width != UNUM_UNIT_WIDTH_FULL_NAME) { + UErrorCode localStatus = status; + CharString genderKey; + genderKey.append("units", localStatus); + genderKey.append(subKey, localStatus); + genderKey.append("/gender", localStatus); + StackUResourceBundle fillIn; + ures_getByKeyWithFallback(unitsBundle.getAlias(), genderKey.data(), fillIn.getAlias(), + &localStatus); + outArray[GENDER_INDEX] = ures_getUnicodeString(fillIn.getAlias(), &localStatus); } CharString key; @@ -110,30 +479,41 @@ void getMeasureData(const Locale &locale, const MeasureUnit &unit, const UNumber } else if (width == UNUM_UNIT_WIDTH_SHORT) { key.append("Short", status); } - key.append("/", status); - key.append(unit.getType(), status); - key.append("/", status); - key.append(subtypeForResource, status); + key.append(subKey, status); + + // Grab desired case first, if available. Then grab no-case data to fill in + // the gaps. + if (width == UNUM_UNIT_WIDTH_FULL_NAME && unitDisplayCase[0] != 0) { + CharString caseKey; + caseKey.append(key, status); + caseKey.append("/case/", status); + caseKey.append(unitDisplayCase, status); + UErrorCode localStatus = U_ZERO_ERROR; + // TODO(icu-units#138): our fallback logic is not spec-compliant: + // lateral fallback should happen before locale fallback. Switch to + // getInflectedMeasureData after homogenizing data format? Find a unit + // test case that demonstrates the incorrect fallback logic (via + // regional variant of an inflected language?) + ures_getAllChildrenWithFallback(unitsBundle.getAlias(), caseKey.data(), sink, localStatus); + } + + // TODO(icu-units#138): our fallback logic is not spec-compliant: we + // check the given case, then go straight to the no-case data. The spec + // states we should first look for case="nominative". As part of #138, + // either get the spec changed, or add unit tests that warn us if + // case="nominative" data differs from no-case data? UErrorCode localStatus = U_ZERO_ERROR; - ures_getAllItemsWithFallback(unitsBundle.getAlias(), key.data(), sink, localStatus); + ures_getAllChildrenWithFallback(unitsBundle.getAlias(), key.data(), sink, localStatus); if (width == UNUM_UNIT_WIDTH_SHORT) { if (U_FAILURE(localStatus)) { status = localStatus; } return; } - - // TODO(ICU-13353): The fallback to short does not work in ICU4C. - // Manually fall back to short (this is done automatically in Java). - key.clear(); - key.append("unitsShort/", status); - key.append(unit.getType(), status); - key.append("/", status); - key.append(subtypeForResource, status); - ures_getAllItemsWithFallback(unitsBundle.getAlias(), key.data(), sink, status); } +// NOTE: outArray MUST have a length of at least ARRAY_LENGTH. void getCurrencyLongNameData(const Locale &locale, const CurrencyUnit ¤cy, UnicodeString *outArray, UErrorCode &status) { // In ICU4J, this method gets a CurrencyData from CurrencyData.provider. @@ -141,7 +521,7 @@ void getCurrencyLongNameData(const Locale &locale, const CurrencyUnit ¤cy, PluralTableSink sink(outArray); LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_CURR, locale.getName(), &status)); if (U_FAILURE(status)) { return; } - ures_getAllItemsWithFallback(unitsBundle.getAlias(), "CurrencyUnitPatterns", sink, status); + ures_getAllChildrenWithFallback(unitsBundle.getAlias(), "CurrencyUnitPatterns", sink, status); if (U_FAILURE(status)) { return; } for (int32_t i = 0; i < StandardPlural::Form::COUNT; i++) { UnicodeString &pattern = outArray[i]; @@ -162,7 +542,10 @@ void getCurrencyLongNameData(const Locale &locale, const CurrencyUnit ¤cy, } } -UnicodeString getPerUnitFormat(const Locale& locale, const UNumberUnitWidth &width, UErrorCode& status) { +UnicodeString getCompoundValue(StringPiece compoundKey, + const Locale &locale, + const UNumberUnitWidth &width, + UErrorCode &status) { LocalUResourceBundlePointer unitsBundle(ures_open(U_ICUDATA_UNIT, locale.getName(), &status)); if (U_FAILURE(status)) { return {}; } CharString key; @@ -172,83 +555,893 @@ UnicodeString getPerUnitFormat(const Locale& locale, const UNumberUnitWidth &wid } else if (width == UNUM_UNIT_WIDTH_SHORT) { key.append("Short", status); } - key.append("/compound/per", status); + key.append("/compound/", status); + key.append(compoundKey, status); + + UErrorCode localStatus = status; int32_t len = 0; - const UChar* ptr = ures_getStringByKeyWithFallback(unitsBundle.getAlias(), key.data(), &len, &status); + const char16_t *ptr = + ures_getStringByKeyWithFallback(unitsBundle.getAlias(), key.data(), &len, &localStatus); + if (U_FAILURE(localStatus) && width != UNUM_UNIT_WIDTH_SHORT) { + // Fall back to short, which contains more compound data + key.clear(); + key.append("unitsShort/compound/", status); + key.append(compoundKey, status); + ptr = ures_getStringByKeyWithFallback(unitsBundle.getAlias(), key.data(), &len, &status); + } else { + status = localStatus; + } + if (U_FAILURE(status)) { + return {}; + } return UnicodeString(ptr, len); } +/** + * Loads and applies deriveComponent rules from CLDR's grammaticalFeatures.xml. + * + * Consider a deriveComponent rule that looks like this: + * + * + * + * Instantiating an instance as follows: + * + * DerivedComponents d(loc, "case", "per"); + * + * Applying the rule in the XML element above, `d.value0("foo")` will be "foo", + * and `d.value1("foo")` will be "nominative". + * + * The values returned by value0(...) and value1(...) are valid only while the + * instance exists. In case of any kind of failure, value0(...) and value1(...) + * will return "". + */ +class DerivedComponents { + public: + /** + * Constructor. + * + * The feature and structure parameters must be null-terminated. The string + * referenced by compoundValue must exist for longer than the + * DerivedComponents instance. + */ + DerivedComponents(const Locale &locale, const char *feature, const char *structure) { + StackUResourceBundle derivationsBundle, stackBundle; + ures_openDirectFillIn(derivationsBundle.getAlias(), nullptr, "grammaticalFeatures", &status); + ures_getByKey(derivationsBundle.getAlias(), "grammaticalData", derivationsBundle.getAlias(), + &status); + ures_getByKey(derivationsBundle.getAlias(), "derivations", derivationsBundle.getAlias(), + &status); + if (U_FAILURE(status)) { + return; + } + UErrorCode localStatus = U_ZERO_ERROR; + // TODO(icu-units#28): use standard normal locale resolution algorithms + // rather than just grabbing language: + ures_getByKey(derivationsBundle.getAlias(), locale.getLanguage(), stackBundle.getAlias(), + &localStatus); + // TODO(icu-units#28): + // - code currently assumes if the locale exists, the rules are there - + // instead of falling back to root when the requested rule is missing. + // - investigate ures.h functions, see if one that uses res_findResource() + // might be better (or use res_findResource directly), or maybe help + // improve ures documentation to guide function selection? + if (localStatus == U_MISSING_RESOURCE_ERROR) { + ures_getByKey(derivationsBundle.getAlias(), "root", stackBundle.getAlias(), &status); + } else { + status = localStatus; + } + ures_getByKey(stackBundle.getAlias(), "component", stackBundle.getAlias(), &status); + ures_getByKey(stackBundle.getAlias(), feature, stackBundle.getAlias(), &status); + ures_getByKey(stackBundle.getAlias(), structure, stackBundle.getAlias(), &status); + UnicodeString val0 = ures_getUnicodeStringByIndex(stackBundle.getAlias(), 0, &status); + UnicodeString val1 = ures_getUnicodeStringByIndex(stackBundle.getAlias(), 1, &status); + if (U_SUCCESS(status)) { + if (val0.compare(UnicodeString(u"compound")) == 0) { + compound0_ = true; + } else { + compound0_ = false; + value0_.appendInvariantChars(val0, status); + } + if (val1.compare(UnicodeString(u"compound")) == 0) { + compound1_ = true; + } else { + compound1_ = false; + value1_.appendInvariantChars(val1, status); + } + } + } + + // Returns a StringPiece that is only valid as long as the instance exists. + StringPiece value0(const StringPiece compoundValue) const { + return compound0_ ? compoundValue : value0_.toStringPiece(); + } + + // Returns a StringPiece that is only valid as long as the instance exists. + StringPiece value1(const StringPiece compoundValue) const { + return compound1_ ? compoundValue : value1_.toStringPiece(); + } + + // Returns a char* that is only valid as long as the instance exists. + const char *value0(const char *compoundValue) const { + return compound0_ ? compoundValue : value0_.data(); + } + + // Returns a char* that is only valid as long as the instance exists. + const char *value1(const char *compoundValue) const { + return compound1_ ? compoundValue : value1_.data(); + } + + private: + UErrorCode status = U_ZERO_ERROR; + + // Holds strings referred to by value0 and value1; + bool compound0_ = false, compound1_ = false; + CharString value0_, value1_; +}; + +// TODO(icu-units#28): test somehow? Associate with an ICU ticket for adding +// testsuite support for testing with synthetic data? +/** + * Loads and returns the value in rules that look like these: + * + * + * + * + * Currently a fake example, but spec compliant: + * + * + * NOTE: If U_FAILURE(status), returns an empty string. + */ +UnicodeString +getDeriveCompoundRule(Locale locale, const char *feature, const char *structure, UErrorCode &status) { + StackUResourceBundle derivationsBundle, stackBundle; + ures_openDirectFillIn(derivationsBundle.getAlias(), nullptr, "grammaticalFeatures", &status); + ures_getByKey(derivationsBundle.getAlias(), "grammaticalData", derivationsBundle.getAlias(), + &status); + ures_getByKey(derivationsBundle.getAlias(), "derivations", derivationsBundle.getAlias(), &status); + // TODO: use standard normal locale resolution algorithms rather than just grabbing language: + ures_getByKey(derivationsBundle.getAlias(), locale.getLanguage(), stackBundle.getAlias(), &status); + // TODO: + // - code currently assumes if the locale exists, the rules are there - + // instead of falling back to root when the requested rule is missing. + // - investigate ures.h functions, see if one that uses res_findResource() + // might be better (or use res_findResource directly), or maybe help + // improve ures documentation to guide function selection? + if (status == U_MISSING_RESOURCE_ERROR) { + status = U_ZERO_ERROR; + ures_getByKey(derivationsBundle.getAlias(), "root", stackBundle.getAlias(), &status); + } + ures_getByKey(stackBundle.getAlias(), "compound", stackBundle.getAlias(), &status); + ures_getByKey(stackBundle.getAlias(), feature, stackBundle.getAlias(), &status); + UnicodeString uVal = ures_getUnicodeStringByKey(stackBundle.getAlias(), structure, &status); + if (U_FAILURE(status)) { + return {}; + } + U_ASSERT(!uVal.isBogus()); + return uVal; +} + +// Returns the gender string for structures following these rules: +// +// +// +// +// Fake example: +// +// +// data0 and data1 should be pattern arrays (UnicodeString[ARRAY_SIZE]) that +// correspond to value="0" and value="1". +// +// Pass a nullptr to data1 if the structure has no concept of value="1" (e.g. +// "prefix" doesn't). +UnicodeString getDerivedGender(Locale locale, + const char *structure, + UnicodeString *data0, + UnicodeString *data1, + UErrorCode &status) { + UnicodeString val = getDeriveCompoundRule(locale, "gender", structure, status); + if (val.length() == 1) { + switch (val[0]) { + case u'0': + return data0[GENDER_INDEX]; + case u'1': + if (data1 == nullptr) { + return {}; + } + return data1[GENDER_INDEX]; + } + } + return val; +} + //////////////////////// /// END DATA LOADING /// //////////////////////// -} // namespace +// TODO: promote this somewhere? It's based on patternprops.cpp' trimWhitespace +const char16_t *trimSpaceChars(const char16_t *s, int32_t &length) { + if (length <= 0 || (!u_isJavaSpaceChar(s[0]) && !u_isJavaSpaceChar(s[length - 1]))) { + return s; + } + int32_t start = 0; + int32_t limit = length; + while (start < limit && u_isJavaSpaceChar(s[start])) { + ++start; + } + if (start < limit) { + // There is non-white space at start; we will not move limit below that, + // so we need not test start 0); // Else it would not be COMPOUND + if (mui.singleUnits[endSlice]->dimensionality < 0) { + // We have a -per- construct + UnicodeString perRule = getDeriveCompoundRule(locale, "gender", "per", status); + if (perRule.length() != 1) { + // Fixed gender for -per- units + return perRule; + } + if (perRule[0] == u'1') { + // Find the start of the denominator. We already know there is one. + while (mui.singleUnits[startSlice]->dimensionality >= 0) { + startSlice++; + } + } else { + // Find the end of the numerator + while (endSlice >= 0 && mui.singleUnits[endSlice]->dimensionality < 0) { + endSlice--; + } + if (endSlice < 0) { + // We have only a denominator, e.g. "per-second". + // TODO(icu-units#28): find out what gender to use in the + // absence of a first value - mentioned in CLDR-14253. + return {}; + } + } + } + if (endSlice > startSlice) { + // We have a -times- construct + UnicodeString timesRule = getDeriveCompoundRule(locale, "gender", "times", status); + if (timesRule.length() != 1) { + // Fixed gender for -times- units + return timesRule; + } + if (timesRule[0] == u'0') { + endSlice = startSlice; + } else { + // We assume timesRule[0] == u'1' + startSlice = endSlice; + } } + U_ASSERT(startSlice == endSlice); + singleUnitIndex = startSlice; + } else if (mui.complexity == UMEASURE_UNIT_MIXED) { + status = U_INTERNAL_PROGRAM_ERROR; + return {}; + } else { + U_ASSERT(mui.complexity == UMEASURE_UNIT_SINGLE); + U_ASSERT(mui.singleUnits.length() == 1); } - auto* result = new LongNameHandler(rules, parent); - if (result == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return nullptr; + // Now we know which singleUnit's gender we want + const SingleUnitImpl *singleUnit = mui.singleUnits[singleUnitIndex]; + // Check for any power-prefix gender override: + if (std::abs(singleUnit->dimensionality) != 1) { + UnicodeString powerRule = getDeriveCompoundRule(locale, "gender", "power", status); + if (powerRule.length() != 1) { + // Fixed gender for -powN- units + return powerRule; + } + // powerRule[0] == u'0'; u'1' not currently in spec. } - UnicodeString simpleFormats[number_longnames_ARRAY_LENGTH]; - getMeasureData(loc, unit, width, simpleFormats, status); - if (U_FAILURE(status)) { return result; } - result->simpleFormatsToModifiers(simpleFormats, UNUM_MEASURE_UNIT_FIELD, status); - return result; + // Check for any SI and binary prefix gender override: + if (std::abs(singleUnit->dimensionality) != 1) { + UnicodeString prefixRule = getDeriveCompoundRule(locale, "gender", "prefix", status); + if (prefixRule.length() != 1) { + // Fixed gender for -powN- units + return prefixRule; + } + // prefixRule[0] == u'0'; u'1' not currently in spec. + } + // Now we've boiled it down to the gender of one simple unit identifier: + return getGenderForBuiltin(locale, MeasureUnit::forIdentifier(singleUnit->getSimpleUnitID(), status), + status); } -LongNameHandler* -LongNameHandler::forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, - const UNumberUnitWidth &width, const PluralRules *rules, - const MicroPropsGenerator *parent, UErrorCode &status) { - auto* result = new LongNameHandler(rules, parent); - if (result == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return nullptr; +void maybeCalculateGender(const Locale &locale, + const MeasureUnit &unitRef, + UnicodeString *outArray, + UErrorCode &status) { + if (outArray[GENDER_INDEX].isBogus()) { + UnicodeString meterGender = getGenderForBuiltin(locale, MeasureUnit::getMeter(), status); + if (meterGender.isEmpty()) { + // No gender for meter: assume ungendered language + return; + } + // We have a gendered language, but are lacking gender for unitRef. + outArray[GENDER_INDEX] = calculateGenderForUnit(locale, unitRef, status); + } +} + +} // namespace + +void LongNameHandler::forMeasureUnit(const Locale &loc, + const MeasureUnit &unitRef, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + const PluralRules *rules, + const MicroPropsGenerator *parent, + LongNameHandler *fillIn, + UErrorCode &status) { + // From https://unicode.org/reports/tr35/tr35-general.html#compound-units - + // Points 1 and 2 are mostly handled by MeasureUnit: + // + // 1. If the unitId is empty or invalid, fail + // 2. Put the unitId into normalized order + U_ASSERT(fillIn != nullptr); + + if (uprv_strcmp(unitRef.getType(), "") != 0) { + // Handling built-in units: + // + // 3. Set result to be getValue(unitId with length, pluralCategory, caseVariant) + // - If result is not empty, return it + UnicodeString simpleFormats[ARRAY_LENGTH]; + getMeasureData(loc, unitRef, width, unitDisplayCase, simpleFormats, status); + maybeCalculateGender(loc, unitRef, simpleFormats, status); + if (U_FAILURE(status)) { + return; + } + fillIn->rules = rules; + fillIn->parent = parent; + fillIn->simpleFormatsToModifiers(simpleFormats, + {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status); + if (!simpleFormats[GENDER_INDEX].isBogus()) { + fillIn->gender = getGenderString(simpleFormats[GENDER_INDEX], status); + } + return; + + // TODO(icu-units#145): figure out why this causes a failure in + // format/MeasureFormatTest/TestIndividualPluralFallback and other + // tests, when it should have been an alternative for the lines above: + + // forArbitraryUnit(loc, unitRef, width, unitDisplayCase, fillIn, status); + // fillIn->rules = rules; + // fillIn->parent = parent; + // return; + } else { + // Check if it is a MeasureUnit this constructor handles: this + // constructor does not handle mixed units + U_ASSERT(unitRef.getComplexity(status) != UMEASURE_UNIT_MIXED); + forArbitraryUnit(loc, unitRef, width, unitDisplayCase, fillIn, status); + fillIn->rules = rules; + fillIn->parent = parent; + return; + } +} + +void LongNameHandler::forArbitraryUnit(const Locale &loc, + const MeasureUnit &unitRef, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + LongNameHandler *fillIn, + UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + if (fillIn == nullptr) { + status = U_INTERNAL_PROGRAM_ERROR; + return; + } + + // Numbered list items are from the algorithms at + // https://unicode.org/reports/tr35/tr35-general.html#compound-units: + // + // 4. Divide the unitId into numerator (the part before the "-per-") and + // denominator (the part after the "-per-). If both are empty, fail + MeasureUnitImpl unit; + MeasureUnitImpl perUnit; + { + MeasureUnitImpl fullUnit = MeasureUnitImpl::forMeasureUnitMaybeCopy(unitRef, status); + if (U_FAILURE(status)) { + return; + } + for (int32_t i = 0; i < fullUnit.singleUnits.length(); i++) { + SingleUnitImpl *subUnit = fullUnit.singleUnits[i]; + if (subUnit->dimensionality > 0) { + unit.appendSingleUnit(*subUnit, status); + } else { + subUnit->dimensionality *= -1; + perUnit.appendSingleUnit(*subUnit, status); + } + } } - UnicodeString primaryData[number_longnames_ARRAY_LENGTH]; - getMeasureData(loc, unit, width, primaryData, status); - if (U_FAILURE(status)) { return result; } - UnicodeString secondaryData[number_longnames_ARRAY_LENGTH]; - getMeasureData(loc, perUnit, width, secondaryData, status); - if (U_FAILURE(status)) { return result; } - UnicodeString perUnitFormat; - if (!secondaryData[number_longnames_PER_INDEX].isBogus()) { - perUnitFormat = secondaryData[number_longnames_PER_INDEX]; + // TODO(icu-units#28): check placeholder logic, see if it needs to be + // present here instead of only in processPatternTimes: + // + // 5. Set both globalPlaceholder and globalPlaceholderPosition to be empty + + DerivedComponents derivedPerCases(loc, "case", "per"); + + // 6. numeratorUnitString + UnicodeString numeratorUnitData[ARRAY_LENGTH]; + processPatternTimes(std::move(unit), loc, width, derivedPerCases.value0(unitDisplayCase), + numeratorUnitData, status); + + // 7. denominatorUnitString + UnicodeString denominatorUnitData[ARRAY_LENGTH]; + processPatternTimes(std::move(perUnit), loc, width, derivedPerCases.value1(unitDisplayCase), + denominatorUnitData, status); + + // TODO(icu-units#139): + // - implement DerivedComponents for "plural/times" and "plural/power": + // French has different rules, we'll be producing the wrong results + // currently. (Prove via tests!) + // - implement DerivedComponents for "plural/per", "plural/prefix", + // "case/times", "case/power", and "case/prefix" - although they're + // currently hardcoded. Languages with different rules are surely on the + // way. + // + // Currently we only use "case/per", "plural/times", "case/times", and + // "case/power". + // + // This may have impact on multiSimpleFormatsToModifiers(...) below too? + // These rules are currently (ICU 69) all the same and hard-coded below. + UnicodeString perUnitPattern; + if (!denominatorUnitData[PER_INDEX].isBogus()) { + // If we have no denominator, we obtain the empty string: + perUnitPattern = denominatorUnitData[PER_INDEX]; } else { - UnicodeString rawPerUnitFormat = getPerUnitFormat(loc, width, status); - if (U_FAILURE(status)) { return result; } - // rawPerUnitFormat is something like "{0}/{1}"; we need to substitute in the secondary unit. - SimpleFormatter compiled(rawPerUnitFormat, 2, 2, status); - if (U_FAILURE(status)) { return result; } - UnicodeString secondaryFormat = getWithPlural(secondaryData, StandardPlural::Form::ONE, status); - if (U_FAILURE(status)) { return result; } - SimpleFormatter secondaryCompiled(secondaryFormat, 1, 1, status); - if (U_FAILURE(status)) { return result; } - UnicodeString secondaryString = secondaryCompiled.getTextWithNoArguments().trim(); - // TODO: Why does UnicodeString need to be explicit in the following line? - compiled.format(UnicodeString(u"{0}"), secondaryString, perUnitFormat, status); - if (U_FAILURE(status)) { return result; } - } - result->multiSimpleFormatsToModifiers(primaryData, perUnitFormat, UNUM_MEASURE_UNIT_FIELD, status); - return result; + // 8. Set perPattern to be getValue([per], locale, length) + UnicodeString rawPerUnitFormat = getCompoundValue("per", loc, width, status); + // rawPerUnitFormat is something like "{0} per {1}"; we need to substitute in the secondary unit. + SimpleFormatter perPatternFormatter(rawPerUnitFormat, 2, 2, status); + if (U_FAILURE(status)) { + return; + } + // Plural and placeholder handling for 7. denominatorUnitString: + // TODO(icu-units#139): hardcoded: + // + UnicodeString denominatorFormat = + getWithPlural(denominatorUnitData, StandardPlural::Form::ONE, status); + // Some "one" pattern may not contain "{0}". For example in "ar" or "ne" locale. + SimpleFormatter denominatorFormatter(denominatorFormat, 0, 1, status); + if (U_FAILURE(status)) { + return; + } + UnicodeString denominatorPattern = denominatorFormatter.getTextWithNoArguments(); + int32_t trimmedLen = denominatorPattern.length(); + const char16_t *trimmed = trimSpaceChars(denominatorPattern.getBuffer(), trimmedLen); + UnicodeString denominatorString(false, trimmed, trimmedLen); + // 9. If the denominatorString is empty, set result to + // [numeratorString], otherwise set result to format(perPattern, + // numeratorString, denominatorString) + // + // TODO(icu-units#28): Why does UnicodeString need to be explicit in the + // following line? + perPatternFormatter.format(UnicodeString(u"{0}"), denominatorString, perUnitPattern, status); + if (U_FAILURE(status)) { + return; + } + } + if (perUnitPattern.length() == 0) { + fillIn->simpleFormatsToModifiers(numeratorUnitData, + {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status); + } else { + fillIn->multiSimpleFormatsToModifiers(numeratorUnitData, perUnitPattern, + {UFIELD_CATEGORY_NUMBER, UNUM_MEASURE_UNIT_FIELD}, status); + } + + // Gender + // + // TODO(icu-units#28): find out what gender to use in the absence of a first + // value - e.g. what's the gender of "per-second"? Mentioned in CLDR-14253. + // + // gender/per deriveCompound rules don't say: + // + fillIn->gender = getGenderString( + getDerivedGender(loc, "per", numeratorUnitData, denominatorUnitData, status), status); +} + +void LongNameHandler::processPatternTimes(MeasureUnitImpl &&productUnit, + Locale loc, + const UNumberUnitWidth &width, + const char *caseVariant, + UnicodeString *outArray, + UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + if (productUnit.complexity == UMEASURE_UNIT_MIXED) { + // These are handled by MixedUnitLongNameHandler + status = U_UNSUPPORTED_ERROR; + return; + } + +#if U_DEBUG + for (int32_t pluralIndex = 0; pluralIndex < ARRAY_LENGTH; pluralIndex++) { + U_ASSERT(outArray[pluralIndex].length() == 0); + U_ASSERT(!outArray[pluralIndex].isBogus()); + } +#endif + + if (productUnit.identifier.isEmpty()) { + // TODO(icu-units#28): consider when serialize should be called. + // identifier might also be empty for MeasureUnit(). + productUnit.serialize(status); + } + if (U_FAILURE(status)) { + return; + } + if (productUnit.identifier.length() == 0) { + // MeasureUnit(): no units: return empty strings. + return; + } + + MeasureUnit builtinUnit; + if (MeasureUnit::findBySubType(productUnit.identifier.toStringPiece(), &builtinUnit)) { + // TODO(icu-units#145): spec doesn't cover builtin-per-builtin, it + // breaks them all down. Do we want to drop this? + // - findBySubType isn't super efficient, if we skip it and go to basic + // singles, we don't have to construct MeasureUnit's anymore. + // - Check all the existing unit tests that fail without this: is it due + // to incorrect fallback via getMeasureData? + // - Do those unit tests cover this code path representatively? + if (builtinUnit != MeasureUnit()) { + getMeasureData(loc, builtinUnit, width, caseVariant, outArray, status); + maybeCalculateGender(loc, builtinUnit, outArray, status); + } + return; + } + + // 2. Set timesPattern to be getValue(times, locale, length) + UnicodeString timesPattern = getCompoundValue("times", loc, width, status); + SimpleFormatter timesPatternFormatter(timesPattern, 2, 2, status); + if (U_FAILURE(status)) { + return; + } + + PlaceholderPosition globalPlaceholder[ARRAY_LENGTH]; + char16_t globalJoinerChar = 0; + // Numbered list items are from the algorithms at + // https://unicode.org/reports/tr35/tr35-general.html#compound-units: + // + // pattern(...) point 5: + // - Set both globalPlaceholder and globalPlaceholderPosition to be empty + // + // 3. Set result to be empty + for (int32_t pluralIndex = 0; pluralIndex < ARRAY_LENGTH; pluralIndex++) { + // Initial state: empty string pattern, via all falling back to OTHER: + if (pluralIndex == StandardPlural::Form::OTHER) { + outArray[pluralIndex].remove(); + } else { + outArray[pluralIndex].setToBogus(); + } + globalPlaceholder[pluralIndex] = PH_EMPTY; + } + + // Empty string represents "compound" (propagate the plural form). + const char *pluralCategory = ""; + DerivedComponents derivedTimesPlurals(loc, "plural", "times"); + DerivedComponents derivedTimesCases(loc, "case", "times"); + DerivedComponents derivedPowerCases(loc, "case", "power"); + + // 4. For each single_unit in product_unit + for (int32_t singleUnitIndex = 0; singleUnitIndex < productUnit.singleUnits.length(); + singleUnitIndex++) { + SingleUnitImpl *singleUnit = productUnit.singleUnits[singleUnitIndex]; + const char *singlePluralCategory; + const char *singleCaseVariant; + // TODO(icu-units#28): ensure we have unit tests that change/fail if we + // assign incorrect case variants here: + if (singleUnitIndex < productUnit.singleUnits.length() - 1) { + // 4.1. If hasMultiple + singlePluralCategory = derivedTimesPlurals.value0(pluralCategory); + singleCaseVariant = derivedTimesCases.value0(caseVariant); + pluralCategory = derivedTimesPlurals.value1(pluralCategory); + caseVariant = derivedTimesCases.value1(caseVariant); + } else { + singlePluralCategory = derivedTimesPlurals.value1(pluralCategory); + singleCaseVariant = derivedTimesCases.value1(caseVariant); + } + + // 4.2. Get the gender of that single_unit + MeasureUnit simpleUnit; + if (!MeasureUnit::findBySubType(singleUnit->getSimpleUnitID(), &simpleUnit)) { + // Ideally all simple units should be known, but they're not: + // 100-kilometer is internally treated as a simple unit, but it is + // not a built-in unit and does not have formatting data in CLDR 39. + // + // TODO(icu-units#28): test (desirable) invariants in unit tests. + status = U_UNSUPPORTED_ERROR; + return; + } + const char *gender = getGenderString(getGenderForBuiltin(loc, simpleUnit, status), status); + + // 4.3. If singleUnit starts with a dimensionality_prefix, such as 'square-' + U_ASSERT(singleUnit->dimensionality > 0); + int32_t dimensionality = singleUnit->dimensionality; + UnicodeString dimensionalityPrefixPatterns[ARRAY_LENGTH]; + if (dimensionality != 1) { + // 4.3.1. set dimensionalityPrefixPattern to be + // getValue(that dimensionality_prefix, locale, length, singlePluralCategory, singleCaseVariant, gender), + // such as "{0} kwadratowym" + CharString dimensionalityKey("compound/power", status); + dimensionalityKey.appendNumber(dimensionality, status); + getInflectedMeasureData(dimensionalityKey.toStringPiece(), loc, width, gender, + singleCaseVariant, dimensionalityPrefixPatterns, status); + if (U_FAILURE(status)) { + // At the time of writing, only pow2 and pow3 are supported. + // Attempting to format other powers results in a + // U_RESOURCE_TYPE_MISMATCH. We convert the error if we + // understand it: + if (status == U_RESOURCE_TYPE_MISMATCH && dimensionality > 3) { + status = U_UNSUPPORTED_ERROR; + } + return; + } + + // TODO(icu-units#139): + // 4.3.2. set singlePluralCategory to be power0(singlePluralCategory) + + // 4.3.3. set singleCaseVariant to be power0(singleCaseVariant) + singleCaseVariant = derivedPowerCases.value0(singleCaseVariant); + // 4.3.4. remove the dimensionality_prefix from singleUnit + singleUnit->dimensionality = 1; + } + + // 4.4. if singleUnit starts with an si_prefix, such as 'centi' + UMeasurePrefix prefix = singleUnit->unitPrefix; + UnicodeString prefixPattern; + if (prefix != UMEASURE_PREFIX_ONE) { + // 4.4.1. set siPrefixPattern to be getValue(that si_prefix, locale, + // length), such as "centy{0}" + CharString prefixKey; + // prefixKey looks like "1024p3" or "10p-2": + prefixKey.appendNumber(umeas_getPrefixBase(prefix), status); + prefixKey.append('p', status); + prefixKey.appendNumber(umeas_getPrefixPower(prefix), status); + // Contains a pattern like "centy{0}". + prefixPattern = getCompoundValue(prefixKey.toStringPiece(), loc, width, status); + + // 4.4.2. set singlePluralCategory to be prefix0(singlePluralCategory) + // + // TODO(icu-units#139): that refers to these rules: + // + // though I'm not sure what other value they might end up having. + // + // 4.4.3. set singleCaseVariant to be prefix0(singleCaseVariant) + // + // TODO(icu-units#139): that refers to: + // but the prefix (value0) doesn't have case, the rest simply + // propagates. + + // 4.4.4. remove the si_prefix from singleUnit + singleUnit->unitPrefix = UMEASURE_PREFIX_ONE; + } + + // 4.5. Set corePattern to be the getValue(singleUnit, locale, length, + // singlePluralCategory, singleCaseVariant), such as "{0} metrem" + UnicodeString singleUnitArray[ARRAY_LENGTH]; + // At this point we are left with a Simple Unit: + U_ASSERT(uprv_strcmp(singleUnit->build(status).getIdentifier(), singleUnit->getSimpleUnitID()) == + 0); + getMeasureData(loc, singleUnit->build(status), width, singleCaseVariant, singleUnitArray, + status); + if (U_FAILURE(status)) { + // Shouldn't happen if we have data for all single units + return; + } + + // Calculate output gender + if (!singleUnitArray[GENDER_INDEX].isBogus()) { + U_ASSERT(!singleUnitArray[GENDER_INDEX].isEmpty()); + UnicodeString uVal; + + if (prefix != UMEASURE_PREFIX_ONE) { + singleUnitArray[GENDER_INDEX] = + getDerivedGender(loc, "prefix", singleUnitArray, nullptr, status); + } + + if (dimensionality != 1) { + singleUnitArray[GENDER_INDEX] = + getDerivedGender(loc, "power", singleUnitArray, nullptr, status); + } + + UnicodeString timesGenderRule = getDeriveCompoundRule(loc, "gender", "times", status); + if (timesGenderRule.length() == 1) { + switch (timesGenderRule[0]) { + case u'0': + if (singleUnitIndex == 0) { + U_ASSERT(outArray[GENDER_INDEX].isBogus()); + outArray[GENDER_INDEX] = singleUnitArray[GENDER_INDEX]; + } + break; + case u'1': + if (singleUnitIndex == productUnit.singleUnits.length() - 1) { + U_ASSERT(outArray[GENDER_INDEX].isBogus()); + outArray[GENDER_INDEX] = singleUnitArray[GENDER_INDEX]; + } + } + } else { + if (outArray[GENDER_INDEX].isBogus()) { + outArray[GENDER_INDEX] = timesGenderRule; + } + } + } + + // Calculate resulting patterns for each plural form + for (int32_t pluralIndex = 0; pluralIndex < StandardPlural::Form::COUNT; pluralIndex++) { + StandardPlural::Form plural = static_cast(pluralIndex); + + // singleUnitArray[pluralIndex] looks something like "{0} Meter" + if (outArray[pluralIndex].isBogus()) { + if (singleUnitArray[pluralIndex].isBogus()) { + // Let the usual plural fallback mechanism take care of this + // plural form + continue; + } else { + // Since our singleUnit can have a plural form that outArray + // doesn't yet have (relying on fallback to OTHER), we start + // by grabbing it with the normal plural fallback mechanism + outArray[pluralIndex] = getWithPlural(outArray, plural, status); + if (U_FAILURE(status)) { + return; + } + } + } + + if (uprv_strcmp(singlePluralCategory, "") != 0) { + plural = static_cast(getIndex(singlePluralCategory, status)); + } + + // 4.6. Extract(corePattern, coreUnit, placeholder, placeholderPosition) from that pattern. + UnicodeString coreUnit; + PlaceholderPosition placeholderPosition; + char16_t joinerChar; + extractCorePattern(getWithPlural(singleUnitArray, plural, status), coreUnit, + placeholderPosition, joinerChar); + + // 4.7 If the position is middle, then fail + if (placeholderPosition == PH_MIDDLE) { + status = U_UNSUPPORTED_ERROR; + return; + } + + // 4.8. If globalPlaceholder is empty + if (globalPlaceholder[pluralIndex] == PH_EMPTY) { + globalPlaceholder[pluralIndex] = placeholderPosition; + globalJoinerChar = joinerChar; + } else { + // Expect all units involved to have the same placeholder position + U_ASSERT(globalPlaceholder[pluralIndex] == placeholderPosition); + // TODO(icu-units#28): Do we want to add a unit test that checks + // for consistent joiner chars? Probably not, given how + // inconsistent they are. File a CLDR ticket with examples? + } + // Now coreUnit would be just "Meter" + + // 4.9. If siPrefixPattern is not empty + if (prefix != UMEASURE_PREFIX_ONE) { + SimpleFormatter prefixCompiled(prefixPattern, 1, 1, status); + if (U_FAILURE(status)) { + return; + } + + // 4.9.1. Set coreUnit to be the combineLowercasing(locale, length, siPrefixPattern, + // coreUnit) + UnicodeString tmp; + // combineLowercasing(locale, length, prefixPattern, coreUnit) + // + // TODO(icu-units#28): run this only if prefixPattern does not + // contain space characters - do languages "as", "bn", "hi", + // "kk", etc have concepts of upper and lower case?: + if (width == UNUM_UNIT_WIDTH_FULL_NAME) { + coreUnit.toLower(loc); + } + prefixCompiled.format(coreUnit, tmp, status); + if (U_FAILURE(status)) { + return; + } + coreUnit = tmp; + } + + // 4.10. If dimensionalityPrefixPattern is not empty + if (dimensionality != 1) { + SimpleFormatter dimensionalityCompiled( + getWithPlural(dimensionalityPrefixPatterns, plural, status), 1, 1, status); + if (U_FAILURE(status)) { + return; + } + + // 4.10.1. Set coreUnit to be the combineLowercasing(locale, length, + // dimensionalityPrefixPattern, coreUnit) + UnicodeString tmp; + // combineLowercasing(locale, length, prefixPattern, coreUnit) + // + // TODO(icu-units#28): run this only if prefixPattern does not + // contain space characters - do languages "as", "bn", "hi", + // "kk", etc have concepts of upper and lower case?: + if (width == UNUM_UNIT_WIDTH_FULL_NAME) { + coreUnit.toLower(loc); + } + dimensionalityCompiled.format(coreUnit, tmp, status); + if (U_FAILURE(status)) { + return; + } + coreUnit = tmp; + } + + if (outArray[pluralIndex].length() == 0) { + // 4.11. If the result is empty, set result to be coreUnit + outArray[pluralIndex] = coreUnit; + } else { + // 4.12. Otherwise set result to be format(timesPattern, result, coreUnit) + UnicodeString tmp; + timesPatternFormatter.format(outArray[pluralIndex], coreUnit, tmp, status); + outArray[pluralIndex] = tmp; + } + } + } + for (int32_t pluralIndex = 0; pluralIndex < StandardPlural::Form::COUNT; pluralIndex++) { + if (globalPlaceholder[pluralIndex] == PH_BEGINNING) { + UnicodeString tmp; + tmp.append(u"{0}", 3); + if (globalJoinerChar != 0) { + tmp.append(globalJoinerChar); + } + tmp.append(outArray[pluralIndex]); + outArray[pluralIndex] = tmp; + } else if (globalPlaceholder[pluralIndex] == PH_END) { + if (globalJoinerChar != 0) { + outArray[pluralIndex].append(globalJoinerChar); + } + outArray[pluralIndex].append(u"{0}", 3); + } + } } UnicodeString LongNameHandler::getUnitDisplayName( @@ -259,9 +1452,9 @@ UnicodeString LongNameHandler::getUnitDisplayName( if (U_FAILURE(status)) { return ICU_Utility::makeBogusString(); } - UnicodeString simpleFormats[number_longnames_ARRAY_LENGTH]; - getMeasureData(loc, unit, width, simpleFormats, status); - return simpleFormats[number_longnames_DNAM_INDEX]; + UnicodeString simpleFormats[ARRAY_LENGTH]; + getMeasureData(loc, unit, width, "", simpleFormats, status); + return simpleFormats[DNAM_INDEX]; } UnicodeString LongNameHandler::getUnitPattern( @@ -273,8 +1466,8 @@ UnicodeString LongNameHandler::getUnitPattern( if (U_FAILURE(status)) { return ICU_Utility::makeBogusString(); } - UnicodeString simpleFormats[number_longnames_ARRAY_LENGTH]; - getMeasureData(loc, unit, width, simpleFormats, status); + UnicodeString simpleFormats[ARRAY_LENGTH]; + getMeasureData(loc, unit, width, "", simpleFormats, status); // The above already handles fallback from other widths to short if (U_FAILURE(status)) { return ICU_Utility::makeBogusString(); @@ -293,10 +1486,11 @@ LongNameHandler* LongNameHandler::forCurrencyLongNames(const Locale &loc, const status = U_MEMORY_ALLOCATION_ERROR; return nullptr; } - UnicodeString simpleFormats[number_longnames_ARRAY_LENGTH]; + UnicodeString simpleFormats[ARRAY_LENGTH]; getCurrencyLongNameData(loc, currency, simpleFormats, status); if (U_FAILURE(status)) { return nullptr; } - result->simpleFormatsToModifiers(simpleFormats, UNUM_CURRENCY_FIELD, status); + result->simpleFormatsToModifiers(simpleFormats, {UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}, status); + // TODO(icu-units#28): currency gender? return result; } @@ -308,7 +1502,7 @@ void LongNameHandler::simpleFormatsToModifiers(const UnicodeString *simpleFormat if (U_FAILURE(status)) { return; } SimpleFormatter compiledFormatter(simpleFormat, 0, 1, status); if (U_FAILURE(status)) { return; } - fModifiers[i] = SimpleModifier(compiledFormatter, field, false, {this, SIGNUM_ZERO, plural}); + fModifiers[i] = SimpleModifier(compiledFormatter, field, false, {this, SIGNUM_POS_ZERO, plural}); } } @@ -321,23 +1515,252 @@ void LongNameHandler::multiSimpleFormatsToModifiers(const UnicodeString *leadFor UnicodeString leadFormat = getWithPlural(leadFormats, plural, status); if (U_FAILURE(status)) { return; } UnicodeString compoundFormat; - trailCompiled.format(leadFormat, compoundFormat, status); - if (U_FAILURE(status)) { return; } + if (leadFormat.length() == 0) { + compoundFormat = trailFormat; + } else { + trailCompiled.format(leadFormat, compoundFormat, status); + if (U_FAILURE(status)) { return; } + } SimpleFormatter compoundCompiled(compoundFormat, 0, 1, status); if (U_FAILURE(status)) { return; } - fModifiers[i] = SimpleModifier(compoundCompiled, field, false, {this, SIGNUM_ZERO, plural}); + fModifiers[i] = SimpleModifier(compoundCompiled, field, false, {this, SIGNUM_POS_ZERO, plural}); } } void LongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const { - parent->processQuantity(quantity, micros, status); + if (parent != nullptr) { + parent->processQuantity(quantity, micros, status); + } StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, rules, quantity, status); micros.modOuter = &fModifiers[pluralForm]; + micros.gender = gender; } const Modifier* LongNameHandler::getModifier(Signum /*signum*/, StandardPlural::Form plural) const { return &fModifiers[plural]; } +void MixedUnitLongNameHandler::forMeasureUnit(const Locale &loc, + const MeasureUnit &mixedUnit, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + const PluralRules *rules, + const MicroPropsGenerator *parent, + MixedUnitLongNameHandler *fillIn, + UErrorCode &status) { + U_ASSERT(mixedUnit.getComplexity(status) == UMEASURE_UNIT_MIXED); + U_ASSERT(fillIn != nullptr); + if (U_FAILURE(status)) { + return; + } + + MeasureUnitImpl temp; + const MeasureUnitImpl &impl = MeasureUnitImpl::forMeasureUnit(mixedUnit, temp, status); + // Defensive, for production code: + if (impl.complexity != UMEASURE_UNIT_MIXED) { + // Should be using the normal LongNameHandler + status = U_UNSUPPORTED_ERROR; + return; + } + + fillIn->fMixedUnitCount = impl.singleUnits.length(); + fillIn->fMixedUnitData.adoptInstead(new UnicodeString[fillIn->fMixedUnitCount * ARRAY_LENGTH]); + for (int32_t i = 0; i < fillIn->fMixedUnitCount; i++) { + // Grab data for each of the components. + UnicodeString *unitData = &fillIn->fMixedUnitData[i * ARRAY_LENGTH]; + // TODO(CLDR-14582): check from the CLDR-14582 ticket whether this + // propagation of unitDisplayCase is correct: + getMeasureData(loc, impl.singleUnits[i]->build(status), width, unitDisplayCase, unitData, + status); + // TODO(ICU-21494): if we add support for gender for mixed units, we may + // need maybeCalculateGender() here. + } + + // TODO(icu-units#120): Make sure ICU doesn't output zero-valued + // high-magnitude fields + // * for mixed units count N, produce N listFormatters, one for each subset + // that might be formatted. + UListFormatterWidth listWidth = ULISTFMT_WIDTH_SHORT; + if (width == UNUM_UNIT_WIDTH_NARROW) { + listWidth = ULISTFMT_WIDTH_NARROW; + } else if (width == UNUM_UNIT_WIDTH_FULL_NAME) { + // This might be the same as SHORT in most languages: + listWidth = ULISTFMT_WIDTH_WIDE; + } + fillIn->fListFormatter.adoptInsteadAndCheckErrorCode( + ListFormatter::createInstance(loc, ULISTFMT_TYPE_UNITS, listWidth, status), status); + // TODO(ICU-21494): grab gender of each unit, calculate the gender + // associated with this list formatter, save it for later. + fillIn->rules = rules; + fillIn->parent = parent; + + // We need a localised NumberFormatter for the numbers of the bigger units + // (providing Arabic numerals, for example). + fillIn->fNumberFormatter = NumberFormatter::withLocale(loc); +} + +void MixedUnitLongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + U_ASSERT(fMixedUnitCount > 1); + if (parent != nullptr) { + parent->processQuantity(quantity, micros, status); + } + micros.modOuter = getMixedUnitModifier(quantity, micros, status); +} + +const Modifier *MixedUnitLongNameHandler::getMixedUnitModifier(DecimalQuantity &quantity, + MicroProps µs, + UErrorCode &status) const { + if (micros.mixedMeasuresCount == 0) { + U_ASSERT(micros.mixedMeasuresCount > 0); // Mixed unit: we must have more than one unit value + status = U_UNSUPPORTED_ERROR; + return µs.helpers.emptyWeakModifier; + } + + // Algorithm: + // + // For the mixed-units measurement of: "3 yard, 1 foot, 2.6 inch", we should + // find "3 yard" and "1 foot" in micros.mixedMeasures. + // + // Obtain long-names with plural forms corresponding to measure values: + // * {0} yards, {0} foot, {0} inches + // + // Format the integer values appropriately and modify with the format + // strings: + // - 3 yards, 1 foot + // + // Use ListFormatter to combine, with one placeholder: + // - 3 yards, 1 foot and {0} inches + // + // Return a SimpleModifier for this pattern, letting the rest of the + // pipeline take care of the remaining inches. + + LocalArray outputMeasuresList(new UnicodeString[fMixedUnitCount], status); + if (U_FAILURE(status)) { + return µs.helpers.emptyWeakModifier; + } + + StandardPlural::Form quantityPlural = StandardPlural::Form::OTHER; + for (int32_t i = 0; i < micros.mixedMeasuresCount; i++) { + DecimalQuantity fdec; + + // If numbers are negative, only the first number needs to have its + // negative sign formatted. + int64_t number = i > 0 ? std::abs(micros.mixedMeasures[i]) : micros.mixedMeasures[i]; + + if (micros.indexOfQuantity == i) { // Insert placeholder for `quantity` + // If quantity is not the first value and quantity is negative + if (micros.indexOfQuantity > 0 && quantity.isNegative()) { + quantity.negate(); + } + + StandardPlural::Form quantityPlural = + utils::getPluralSafe(micros.rounder, rules, quantity, status); + UnicodeString quantityFormatWithPlural = + getWithPlural(&fMixedUnitData[i * ARRAY_LENGTH], quantityPlural, status); + SimpleFormatter quantityFormatter(quantityFormatWithPlural, 0, 1, status); + quantityFormatter.format(UnicodeString(u"{0}"), outputMeasuresList[i], status); + } else { + fdec.setToLong(number); + StandardPlural::Form pluralForm = utils::getStandardPlural(rules, fdec); + UnicodeString simpleFormat = + getWithPlural(&fMixedUnitData[i * ARRAY_LENGTH], pluralForm, status); + SimpleFormatter compiledFormatter(simpleFormat, 0, 1, status); + UnicodeString num; + auto appendable = UnicodeStringAppendable(num); + + fNumberFormatter.formatDecimalQuantity(fdec, status).appendTo(appendable, status); + compiledFormatter.format(num, outputMeasuresList[i], status); + } + } + + // TODO(ICU-21494): implement gender for lists of mixed units. Presumably we + // can set micros.gender to the gender associated with the list formatter in + // use below (once we have correct support for that). And then document this + // appropriately? "getMixedUnitModifier" doesn't sound like it would do + // something like this. + + // Combine list into a "premixed" pattern + UnicodeString premixedFormatPattern; + fListFormatter->format(outputMeasuresList.getAlias(), fMixedUnitCount, premixedFormatPattern, + status); + SimpleFormatter premixedCompiled(premixedFormatPattern, 0, 1, status); + if (U_FAILURE(status)) { + return µs.helpers.emptyWeakModifier; + } + + micros.helpers.mixedUnitModifier = + SimpleModifier(premixedCompiled, kUndefinedField, false, {this, SIGNUM_POS_ZERO, quantityPlural}); + return µs.helpers.mixedUnitModifier; +} + +const Modifier *MixedUnitLongNameHandler::getModifier(Signum /*signum*/, + StandardPlural::Form /*plural*/) const { + // TODO(icu-units#28): investigate this method when investigating where + // ModifierStore::getModifier() gets used. To be sure it remains + // unreachable: + UPRV_UNREACHABLE_EXIT; + return nullptr; +} + +LongNameMultiplexer *LongNameMultiplexer::forMeasureUnits(const Locale &loc, + const MaybeStackVector &units, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + const PluralRules *rules, + const MicroPropsGenerator *parent, + UErrorCode &status) { + LocalPointer result(new LongNameMultiplexer(parent), status); + if (U_FAILURE(status)) { + return nullptr; + } + U_ASSERT(units.length() > 0); + if (result->fHandlers.resize(units.length()) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } + result->fMeasureUnits.adoptInstead(new MeasureUnit[units.length()]); + for (int32_t i = 0, length = units.length(); i < length; i++) { + const MeasureUnit &unit = *units[i]; + result->fMeasureUnits[i] = unit; + if (unit.getComplexity(status) == UMEASURE_UNIT_MIXED) { + MixedUnitLongNameHandler *mlnh = result->fMixedUnitHandlers.createAndCheckErrorCode(status); + MixedUnitLongNameHandler::forMeasureUnit(loc, unit, width, unitDisplayCase, rules, nullptr, + mlnh, status); + result->fHandlers[i] = mlnh; + } else { + LongNameHandler *lnh = result->fLongNameHandlers.createAndCheckErrorCode(status); + LongNameHandler::forMeasureUnit(loc, unit, width, unitDisplayCase, rules, nullptr, lnh, status); + result->fHandlers[i] = lnh; + } + if (U_FAILURE(status)) { + return nullptr; + } + } + return result.orphan(); +} + +void LongNameMultiplexer::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + // We call parent->processQuantity() from the Multiplexer, instead of + // letting LongNameHandler handle it: we don't know which LongNameHandler to + // call until we've called the parent! + fParent->processQuantity(quantity, micros, status); + + // Call the correct LongNameHandler based on outputUnit + for (int i = 0; i < fHandlers.getCapacity(); i++) { + if (fMeasureUnits[i] == micros.outputUnit) { + fHandlers[i]->processQuantity(quantity, micros, status); + return; + } + } + if (U_FAILURE(status)) { + return; + } + // We shouldn't receive any outputUnit for which we haven't already got a + // LongNameHandler: + status = U_INTERNAL_PROGRAM_ERROR; +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.h index a19425aa2..56d8c9b24 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.h @@ -7,6 +7,8 @@ #ifndef __NUMBER_LONGNAMES_H__ #define __NUMBER_LONGNAMES_H__ +#include "cmemory.h" +#include "unicode/listformatter.h" #include "unicode/uversion.h" #include "number_utils.h" #include "number_modifiers.h" @@ -14,6 +16,8 @@ U_NAMESPACE_BEGIN namespace number { namespace impl { +// LongNameHandler takes care of formatting currency and measurement unit names, +// as well as populating the gender of measure units. class LongNameHandler : public MicroPropsGenerator, public ModifierStore, public UMemory { public: static UnicodeString getUnitDisplayName( @@ -22,6 +26,8 @@ class LongNameHandler : public MicroPropsGenerator, public ModifierStore, public UNumberUnitWidth width, UErrorCode& status); + // This function does not support inflections or other newer NumberFormatter + // features: it exists to support the older not-recommended MeasureFormat. static UnicodeString getUnitPattern( const Locale& loc, const MeasureUnit& unit, @@ -33,34 +39,230 @@ class LongNameHandler : public MicroPropsGenerator, public ModifierStore, public forCurrencyLongNames(const Locale &loc, const CurrencyUnit ¤cy, const PluralRules *rules, const MicroPropsGenerator *parent, UErrorCode &status); - static LongNameHandler* - forMeasureUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, - const UNumberUnitWidth &width, const PluralRules *rules, - const MicroPropsGenerator *parent, UErrorCode &status); + /** + * Construct a localized LongNameHandler for the specified MeasureUnit. + * + * Mixed units are not supported, use MixedUnitLongNameHandler::forMeasureUnit. + * + * This function uses a fillIn instead of returning a pointer, because we + * want to fill in instances in a MemoryPool (which cannot adopt pointers it + * didn't create itself). + * + * @param loc The desired locale. + * @param unitRef The measure unit to construct a LongNameHandler for. + * @param width Specifies the desired unit rendering. + * @param unitDisplayCase Specifies the desired grammatical case. If the + * specified case is not found, we fall back to nominative or no-case. + * @param rules Does not take ownership. + * @param parent Does not take ownership. + * @param fillIn Required. + */ + static void forMeasureUnit(const Locale &loc, + const MeasureUnit &unitRef, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + const PluralRules *rules, + const MicroPropsGenerator *parent, + LongNameHandler *fillIn, + UErrorCode &status); + /** + * Selects the plural-appropriate Modifier from the set of fModifiers based + * on the plural form. + */ void - processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const U_OVERRIDE; + processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const override; - const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE; + const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const override; private: + // A set of pre-computed modifiers, one for each plural form. SimpleModifier fModifiers[StandardPlural::Form::COUNT]; + // Not owned const PluralRules *rules; + // Not owned const MicroPropsGenerator *parent; + // Grammatical gender of the formatted result. Not owned: must point at + // static or global strings. + const char *gender = ""; LongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent) - : rules(rules), parent(parent) {} + : rules(rules), parent(parent) { + } - static LongNameHandler* - forCompoundUnit(const Locale &loc, const MeasureUnit &unit, const MeasureUnit &perUnit, - const UNumberUnitWidth &width, const PluralRules *rules, - const MicroPropsGenerator *parent, UErrorCode &status); + LongNameHandler() : rules(nullptr), parent(nullptr) { + } + + // Enables MemoryPool::emplaceBack(): requires access to + // the private constructors. + friend class MemoryPool; + + // Allow macrosToMicroGenerator to call the private default constructor. + friend class NumberFormatterImpl; + + // Fills in LongNameHandler fields for formatting units identified `unit`. + static void forArbitraryUnit(const Locale &loc, + const MeasureUnit &unit, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + LongNameHandler *fillIn, + UErrorCode &status); + // Roughly corresponds to patternTimes(...) in the spec: + // https://unicode.org/reports/tr35/tr35-general.html#compound-units + // + // productUnit is an rvalue reference to indicate this function consumes it, + // leaving it in a not-useful / undefined state. + static void processPatternTimes(MeasureUnitImpl &&productUnit, + Locale loc, + const UNumberUnitWidth &width, + const char *caseVariant, + UnicodeString *outArray, + UErrorCode &status); + + // Sets fModifiers to use the patterns from `simpleFormats`. void simpleFormatsToModifiers(const UnicodeString *simpleFormats, Field field, UErrorCode &status); + + // Sets fModifiers to a combination of `leadFormats` (one per plural form) + // and `trailFormat` appended to each. + // + // With a leadFormat of "{0}m" and a trailFormat of "{0}/s", it produces a + // pattern of "{0}m/s" by inserting each leadFormat pattern into trailFormat. void multiSimpleFormatsToModifiers(const UnicodeString *leadFormats, UnicodeString trailFormat, Field field, UErrorCode &status); }; +// Similar to LongNameHandler, but only for MIXED units. +class MixedUnitLongNameHandler : public MicroPropsGenerator, public ModifierStore, public UMemory { + public: + /** + * Construct a localized MixedUnitLongNameHandler for the specified + * MeasureUnit. It must be a MIXED unit. + * + * This function uses a fillIn instead of returning a pointer, because we + * want to fill in instances in a MemoryPool (which cannot adopt pointers it + * didn't create itself). + * + * @param loc The desired locale. + * @param mixedUnit The mixed measure unit to construct a + * MixedUnitLongNameHandler for. + * @param width Specifies the desired unit rendering. + * @param unitDisplayCase Specifies the desired grammatical case. If the + * specified case is not found, we fall back to nominative or no-case. + * @param rules Does not take ownership. + * @param parent Does not take ownership. + * @param fillIn Required. + */ + static void forMeasureUnit(const Locale &loc, + const MeasureUnit &mixedUnit, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + const PluralRules *rules, + const MicroPropsGenerator *parent, + MixedUnitLongNameHandler *fillIn, + UErrorCode &status); + + /** + * Produces a plural-appropriate Modifier for a mixed unit: `quantity` is + * taken as the final smallest unit, while the larger unit values must be + * provided via `micros.mixedMeasures`. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const override; + + // Required for ModifierStore. And ModifierStore is required by + // SimpleModifier constructor's last parameter. We assert his will never get + // called though. + const Modifier *getModifier(Signum signum, StandardPlural::Form plural) const override; + + private: + // Not owned + const PluralRules *rules; + + // Not owned + const MicroPropsGenerator *parent; + + // Total number of units in the MeasureUnit this handler was configured for: + // for "foot-and-inch", this will be 2. + int32_t fMixedUnitCount = 1; + + // Stores unit data for each of the individual units. For each unit, it + // stores ARRAY_LENGTH strings, as returned by getMeasureData. (Each unit + // with index `i` has ARRAY_LENGTH strings starting at index + // `i*ARRAY_LENGTH` in this array.) + LocalArray fMixedUnitData; + + // Formats the larger units of Mixed Unit measurements. + LocalizedNumberFormatter fNumberFormatter; + + // Joins mixed units together. + LocalPointer fListFormatter; + + MixedUnitLongNameHandler(const PluralRules *rules, const MicroPropsGenerator *parent) + : rules(rules), parent(parent) { + } + + MixedUnitLongNameHandler() : rules(nullptr), parent(nullptr) { + } + + // Allow macrosToMicroGenerator to call the private default constructor. + friend class NumberFormatterImpl; + + // Enables MemoryPool::emplaceBack(): requires access to + // the private constructors. + friend class MemoryPool; + + // For a mixed unit, returns a Modifier that takes only one parameter: the + // smallest and final unit of the set. The bigger units' values and labels + // get baked into this Modifier, together with the unit label of the final + // unit. + const Modifier *getMixedUnitModifier(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const; +}; + +/** + * A MicroPropsGenerator that multiplexes between different LongNameHandlers, + * depending on the outputUnit. + * + * See processQuantity() for the input requirements. + */ +class LongNameMultiplexer : public MicroPropsGenerator, public UMemory { + public: + // Produces a multiplexer for LongNameHandlers, one for each unit in + // `units`. An individual unit might be a mixed unit. + static LongNameMultiplexer *forMeasureUnits(const Locale &loc, + const MaybeStackVector &units, + const UNumberUnitWidth &width, + const char *unitDisplayCase, + const PluralRules *rules, + const MicroPropsGenerator *parent, + UErrorCode &status); + + // The output unit must be provided via `micros.outputUnit`, it must match + // one of the units provided to the factory function. + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const override; + + private: + /** + * Because we only know which LongNameHandler we wish to call after calling + * earlier MicroPropsGenerators in the chain, LongNameMultiplexer keeps the + * parent link, while the LongNameHandlers are given no parents. + */ + MemoryPool fLongNameHandlers; + MemoryPool fMixedUnitHandlers; + // Unowned pointers to instances owned by MaybeStackVectors. + MaybeStackArray fHandlers; + // Each MeasureUnit corresponds to the same-index MicroPropsGenerator + // pointed to in fHandlers. + LocalArray fMeasureUnits; + + const MicroPropsGenerator *fParent; + + LongNameMultiplexer(const MicroPropsGenerator *parent) : fParent(parent) { + } +}; + } // namespace impl } // namespace number U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.cpp index 79938ecde..2f398d4a9 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.cpp @@ -7,16 +7,12 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif - #include "number_mapper.h" #include "number_patternstring.h" #include "unicode/errorcode.h" #include "number_utils.h" -#include "number_currencysymbols.h" using namespace icu; using namespace icu::number; @@ -66,17 +62,8 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert // AFFIXES // ///////////// - AffixPatternProvider* affixProvider; - if (properties.currencyPluralInfo.fPtr.isNull()) { - warehouse.currencyPluralInfoAPP.setToBogus(); - warehouse.propertiesAPP.setTo(properties, status); - affixProvider = &warehouse.propertiesAPP; - } else { - warehouse.currencyPluralInfoAPP.setTo(*properties.currencyPluralInfo.fPtr, properties, status); - warehouse.propertiesAPP.setToBogus(); - affixProvider = &warehouse.currencyPluralInfoAPP; - } - macros.affixProvider = affixProvider; + warehouse.affixProvider.setTo(properties, status); + macros.affixProvider = &warehouse.affixProvider.get(); /////////// // UNITS // @@ -86,15 +73,13 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert !properties.currency.isNull() || !properties.currencyPluralInfo.fPtr.isNull() || !properties.currencyUsage.isNull() || - affixProvider->hasCurrencySign()); + warehouse.affixProvider.get().hasCurrencySign()); CurrencyUnit currency = resolveCurrency(properties, locale, status); UCurrencyUsage currencyUsage = properties.currencyUsage.getOrDefault(UCURR_USAGE_STANDARD); if (useCurrency) { // NOTE: Slicing is OK. macros.unit = currency; // NOLINT } - warehouse.currencySymbols = {currency, locale, symbols, status}; - macros.currencySymbols = &warehouse.currencySymbols; /////////////////////// // ROUNDING STRATEGY // @@ -107,6 +92,8 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert int32_t minSig = properties.minimumSignificantDigits; int32_t maxSig = properties.maximumSignificantDigits; double roundingIncrement = properties.roundingIncrement; + // Not assigning directly to macros.roundingMode here: we change + // roundingMode if and when we also change macros.precision. RoundingMode roundingMode = properties.roundingMode.getOrDefault(UNUM_ROUND_HALFEVEN); bool explicitMinMaxFrac = minFrac != -1 || maxFrac != -1; bool explicitMinMaxSig = minSig != -1 || maxSig != -1; @@ -128,10 +115,8 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert } // Validate min/max int/frac. // For backwards compatibility, minimum overrides maximum if the two conflict. - // The following logic ensures that there is always a minimum of at least one digit. if (minInt == 0 && maxFrac != 0) { - // Force a digit after the decimal point. - minFrac = minFrac <= 0 ? 1 : minFrac; + minFrac = (minFrac < 0 || (minFrac == 0 && maxInt == 0)) ? 1 : minFrac; maxFrac = maxFrac < 0 ? -1 : maxFrac < minFrac ? minFrac : maxFrac; minInt = 0; maxInt = maxInt < 0 ? -1 : maxInt > kMaxIntFracSig ? -1 : maxInt; @@ -149,7 +134,8 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert if (PatternStringUtils::ignoreRoundingIncrement(roundingIncrement, maxFrac)) { precision = Precision::constructFraction(minFrac, maxFrac); } else { - precision = Precision::constructIncrement(roundingIncrement, minFrac); + // Convert the double increment to an integer increment + precision = Precision::increment(roundingIncrement).withMinFraction(minFrac); } } else if (explicitMinMaxSig) { minSig = minSig < 1 ? 1 : minSig > kMaxIntFracSig ? kMaxIntFracSig : minSig; @@ -162,7 +148,7 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert precision = Precision::constructCurrency(currencyUsage); } if (!precision.isBogus()) { - precision.fRoundingMode = roundingMode; + macros.roundingMode = roundingMode; macros.precision = precision; } @@ -256,7 +242,7 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert // TODO: Reset maxSig_ = 1 + minFrac_ to follow the spec. macros.precision = Precision::constructSignificant(minSig_, maxSig_); } - macros.precision.fRoundingMode = roundingMode; + macros.roundingMode = roundingMode; } } @@ -270,8 +256,6 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert } else { macros.notation = Notation::compactShort(); } - // Do not forward the affix provider. - macros.affixProvider = nullptr; } ///////////////// @@ -308,9 +292,14 @@ MacroProps NumberPropertyMapper::oldToNew(const DecimalFormatProperties& propert } else if (rounding_.fType == Precision::PrecisionType::RND_INCREMENT || rounding_.fType == Precision::PrecisionType::RND_INCREMENT_ONE || rounding_.fType == Precision::PrecisionType::RND_INCREMENT_FIVE) { - increment_ = rounding_.fUnion.increment.fIncrement; minFrac_ = rounding_.fUnion.increment.fMinFrac; + // If incrementRounding is used, maxFrac is set equal to minFrac maxFrac_ = rounding_.fUnion.increment.fMinFrac; + // Convert the integer increment to a double + DecimalQuantity dq; + dq.setToLong(rounding_.fUnion.increment.fIncrement); + dq.adjustMagnitude(rounding_.fUnion.increment.fIncrementMagnitude); + increment_ = dq.toDouble(); } else if (rounding_.fType == Precision::PrecisionType::RND_SIGNIFICANT) { minSig_ = rounding_.fUnion.fracSig.fMinSig; maxSig_ = rounding_.fUnion.fracSig.fMaxSig; @@ -396,7 +385,10 @@ void PropertiesAffixPatternProvider::setTo(const DecimalFormatProperties& proper AffixUtils::hasCurrencySymbols(ppp, status) || AffixUtils::hasCurrencySymbols(psp, status) || AffixUtils::hasCurrencySymbols(npp, status) || - AffixUtils::hasCurrencySymbols(nsp, status)); + AffixUtils::hasCurrencySymbols(nsp, status) || + properties.currencyAsDecimal); + + fCurrencyAsDecimal = properties.currencyAsDecimal; } char16_t PropertiesAffixPatternProvider::charAt(int flags, int i) const { @@ -461,6 +453,10 @@ bool PropertiesAffixPatternProvider::hasBody() const { return true; } +bool PropertiesAffixPatternProvider::currencyAsDecimal() const { + return fCurrencyAsDecimal; +} + void CurrencyPluralInfoAffixProvider::setTo(const CurrencyPluralInfo& cpi, const DecimalFormatProperties& properties, @@ -471,9 +467,8 @@ void CurrencyPluralInfoAffixProvider::setTo(const CurrencyPluralInfo& cpi, DecimalFormatProperties pluralProperties(properties); for (int32_t plural = 0; plural < StandardPlural::COUNT; plural++) { const char* keyword = StandardPlural::getKeyword(static_cast(plural)); - UnicodeString kwstr = UnicodeString::fromUTF8(StringPiece(keyword)); UnicodeString patternString; - patternString = cpi.getCurrencyPluralPattern(kwstr, patternString); + patternString = cpi.getCurrencyPluralPattern(keyword, patternString); PatternParser::parseToExistingProperties( patternString, pluralProperties, @@ -522,5 +517,9 @@ bool CurrencyPluralInfoAffixProvider::hasBody() const { return affixesByPlural[StandardPlural::OTHER].hasBody(); } +bool CurrencyPluralInfoAffixProvider::currencyAsDecimal() const { + return affixesByPlural[StandardPlural::OTHER].currencyAsDecimal(); +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.h index de7d9c386..c01607e56 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.h @@ -20,6 +20,10 @@ namespace number { namespace impl { +class AutoAffixPatternProvider; +class CurrencyPluralInfoAffixProvider; + + class PropertiesAffixPatternProvider : public AffixPatternProvider, public UMemory { public: bool isBogus() const { @@ -32,31 +36,27 @@ class PropertiesAffixPatternProvider : public AffixPatternProvider, public UMemo void setTo(const DecimalFormatProperties& properties, UErrorCode& status); - PropertiesAffixPatternProvider() = default; // puts instance in valid but undefined state - - PropertiesAffixPatternProvider(const DecimalFormatProperties& properties, UErrorCode& status) { - setTo(properties, status); - } - // AffixPatternProvider Methods: - char16_t charAt(int32_t flags, int32_t i) const U_OVERRIDE; + char16_t charAt(int32_t flags, int32_t i) const override; - int32_t length(int32_t flags) const U_OVERRIDE; + int32_t length(int32_t flags) const override; - UnicodeString getString(int32_t flags) const U_OVERRIDE; + UnicodeString getString(int32_t flags) const override; - bool hasCurrencySign() const U_OVERRIDE; + bool hasCurrencySign() const override; - bool positiveHasPlusSign() const U_OVERRIDE; + bool positiveHasPlusSign() const override; - bool hasNegativeSubpattern() const U_OVERRIDE; + bool hasNegativeSubpattern() const override; - bool negativeHasMinusSign() const U_OVERRIDE; + bool negativeHasMinusSign() const override; - bool containsSymbolType(AffixPatternType, UErrorCode&) const U_OVERRIDE; + bool containsSymbolType(AffixPatternType, UErrorCode&) const override; - bool hasBody() const U_OVERRIDE; + bool hasBody() const override; + + bool currencyAsDecimal() const override; private: UnicodeString posPrefix; @@ -64,10 +64,16 @@ class PropertiesAffixPatternProvider : public AffixPatternProvider, public UMemo UnicodeString negPrefix; UnicodeString negSuffix; bool isCurrencyPattern; + bool fCurrencyAsDecimal; + + PropertiesAffixPatternProvider() = default; // puts instance in valid but undefined state const UnicodeString& getStringInternal(int32_t flags) const; bool fBogus{true}; + + friend class AutoAffixPatternProvider; + friend class CurrencyPluralInfoAffixProvider; }; @@ -86,38 +92,85 @@ class CurrencyPluralInfoAffixProvider : public AffixPatternProvider, public UMem // AffixPatternProvider Methods: - char16_t charAt(int32_t flags, int32_t i) const U_OVERRIDE; + char16_t charAt(int32_t flags, int32_t i) const override; - int32_t length(int32_t flags) const U_OVERRIDE; + int32_t length(int32_t flags) const override; - UnicodeString getString(int32_t flags) const U_OVERRIDE; + UnicodeString getString(int32_t flags) const override; - bool hasCurrencySign() const U_OVERRIDE; + bool hasCurrencySign() const override; - bool positiveHasPlusSign() const U_OVERRIDE; + bool positiveHasPlusSign() const override; - bool hasNegativeSubpattern() const U_OVERRIDE; + bool hasNegativeSubpattern() const override; - bool negativeHasMinusSign() const U_OVERRIDE; + bool negativeHasMinusSign() const override; - bool containsSymbolType(AffixPatternType, UErrorCode&) const U_OVERRIDE; + bool containsSymbolType(AffixPatternType, UErrorCode&) const override; - bool hasBody() const U_OVERRIDE; + bool hasBody() const override; + + bool currencyAsDecimal() const override; private: PropertiesAffixPatternProvider affixesByPlural[StandardPlural::COUNT]; + CurrencyPluralInfoAffixProvider() = default; + bool fBogus{true}; + + friend class AutoAffixPatternProvider; +}; + + +class AutoAffixPatternProvider { + public: + inline AutoAffixPatternProvider() = default; + + inline AutoAffixPatternProvider(const DecimalFormatProperties& properties, UErrorCode& status) { + setTo(properties, status); + } + + inline void setTo(const DecimalFormatProperties& properties, UErrorCode& status) { + if (properties.currencyPluralInfo.fPtr.isNull()) { + propertiesAPP.setTo(properties, status); + currencyPluralInfoAPP.setToBogus(); + } else { + propertiesAPP.setToBogus(); + currencyPluralInfoAPP.setTo(*properties.currencyPluralInfo.fPtr, properties, status); + } + } + + inline void setTo(const AffixPatternProvider* provider, UErrorCode& status) { + if (auto ptr = dynamic_cast(provider)) { + propertiesAPP = *ptr; + } else if (auto ptr = dynamic_cast(provider)) { + currencyPluralInfoAPP = *ptr; + } else { + status = U_INTERNAL_PROGRAM_ERROR; + } + } + + inline const AffixPatternProvider& get() const { + if (!currencyPluralInfoAPP.isBogus()) { + return currencyPluralInfoAPP; + } else { + return propertiesAPP; + } + } + + private: + PropertiesAffixPatternProvider propertiesAPP; + CurrencyPluralInfoAffixProvider currencyPluralInfoAPP; }; /** * A struct for ownership of a few objects needed for formatting. */ -struct DecimalFormatWarehouse { - PropertiesAffixPatternProvider propertiesAPP; - CurrencyPluralInfoAffixProvider currencyPluralInfoAPP; - CurrencySymbols currencySymbols; +struct DecimalFormatWarehouse : public UMemory { + AutoAffixPatternProvider affixProvider; + LocalPointer rules; }; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_microprops.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_microprops.h index d2393aea5..18addaae0 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_microprops.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_microprops.h @@ -18,37 +18,134 @@ #include "number_roundingutils.h" #include "decNumber.h" #include "charstr.h" +#include "util.h" U_NAMESPACE_BEGIN namespace number { namespace impl { +/** + * A copyable container for the integer values of mixed unit measurements. + * + * If memory allocation fails during copying, no values are copied and status is + * set to U_MEMORY_ALLOCATION_ERROR. + */ +class IntMeasures : public MaybeStackArray { + public: + /** + * Default constructor initializes with internal T[stackCapacity] buffer. + * + * Stack Capacity: most mixed units are expected to consist of two or three + * subunits, so one or two integer measures should be enough. + */ + IntMeasures() : MaybeStackArray() {} + + /** + * Copy constructor. + * + * If memory allocation fails during copying, no values are copied and + * status is set to U_MEMORY_ALLOCATION_ERROR. + */ + IntMeasures(const IntMeasures &other) : MaybeStackArray() { + this->operator=(other); + } + + // Assignment operator + IntMeasures &operator=(const IntMeasures &rhs) { + if (this == &rhs) { + return *this; + } + copyFrom(rhs, status); + return *this; + } + + /** Move constructor */ + IntMeasures(IntMeasures &&src) = default; + + /** Move assignment */ + IntMeasures &operator=(IntMeasures &&src) = default; + + UErrorCode status = U_ZERO_ERROR; +}; + +struct SimpleMicroProps : public UMemory { + Grouper grouping; + bool useCurrency = false; + UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_AUTO; + + // Currency symbol to be used as the decimal separator + UnicodeString currencyAsDecimal = ICU_Utility::makeBogusString(); + + // Note: This struct has no direct ownership of the following pointer. + const DecimalFormatSymbols* symbols = nullptr; +}; + +/** + * MicroProps is the first MicroPropsGenerator that should be should be called, + * producing an initialized MicroProps instance that will be passed on and + * modified throughout the rest of the chain of MicroPropsGenerator instances. + */ struct MicroProps : public MicroPropsGenerator { + SimpleMicroProps simple; // NOTE: All of these fields are properly initialized in NumberFormatterImpl. RoundingImpl rounder; - Grouper grouping; Padder padding; IntegerWidth integerWidth; UNumberSignDisplay sign; - UNumberDecimalSeparatorDisplay decimal; - bool useCurrency; char nsName[9]; + // No ownership: must point at a string which will outlive MicroProps + // instances, e.g. a string with static storage duration, or just a string + // that will never be deallocated or modified. + const char *gender; + // Note: This struct has no direct ownership of the following pointers. - const DecimalFormatSymbols* symbols; + + // Pointers to Modifiers provided by the number formatting pipeline (when + // the value is known): + + // A Modifier provided by LongNameHandler, used for currency long names and + // units. If there is no LongNameHandler needed, this should be an + // EmptyModifier. (This is typically the third modifier applied.) const Modifier* modOuter; - const Modifier* modMiddle; + // A Modifier for short currencies and compact notation. (This is typically + // the second modifier applied.) + const Modifier* modMiddle = nullptr; + // A Modifier provided by ScientificHandler, used for scientific notation. + // This is typically the first modifier applied. const Modifier* modInner; // The following "helper" fields may optionally be used during the MicroPropsGenerator. // They live here to retain memory. struct { + // The ScientificModifier for which ScientificHandler is responsible. + // ScientificHandler::processQuantity() modifies this Modifier. ScientificModifier scientificModifier; + // EmptyModifier used for modOuter EmptyModifier emptyWeakModifier{false}; + // EmptyModifier used for modInner EmptyModifier emptyStrongModifier{true}; MultiplierFormatHandler multiplier; + // A Modifier used for Mixed Units. When formatting mixed units, + // LongNameHandler assigns this Modifier. + SimpleModifier mixedUnitModifier; } helpers; + // The MeasureUnit with which the output is represented. May also have + // UMEASURE_UNIT_MIXED complexity, in which case mixedMeasures comes into + // play. + MeasureUnit outputUnit; + + // Contains all the values of each unit in mixed units. For quantity (which is the floating value of + // the smallest unit in the mixed unit), the value stores in `quantity`. + // NOTE: the value of quantity in `mixedMeasures` will be left unset. + IntMeasures mixedMeasures; + + // Points to quantity position, -1 if the position is not set yet. + int32_t indexOfQuantity = -1; + + // Number of mixedMeasures that have been populated + int32_t mixedMeasuresCount = 0; MicroProps() = default; @@ -56,7 +153,23 @@ struct MicroProps : public MicroPropsGenerator { MicroProps& operator=(const MicroProps& other) = default; - void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const U_OVERRIDE { + /** + * As MicroProps is the "base instance", this implementation of + * MicroPropsGenerator::processQuantity() just ensures that the output + * `micros` is correctly initialized. + * + * For the "safe" invocation of this function, micros must not be *this, + * such that a copy of the base instance is made. For the "unsafe" path, + * this function can be used only once, because the base MicroProps instance + * will be modified and thus not be available for re-use. + * + * @param quantity The quantity for consideration and optional mutation. + * @param micros The MicroProps instance to populate. If this parameter is + * not already `*this`, it will be overwritten with a copy of `*this`. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const override { + (void) quantity; (void) status; if (this == µs) { // Unsafe path: no need to perform a copy. @@ -65,6 +178,7 @@ struct MicroProps : public MicroPropsGenerator { U_ASSERT(exhausted); } else { // Safe path: copy self into the output micros. + U_ASSERT(!exhausted); micros = *this; } } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.cpp index 26a9e9259..0f6fdafb0 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.cpp @@ -17,35 +17,35 @@ using namespace icu::number::impl; namespace { // TODO: This is copied from simpleformatter.cpp -const int32_t NUMBER_MODIFIERS_ARG_NUM_LIMIT = 0x100; +const int32_t ARG_NUM_LIMIT = 0x100; // These are the default currency spacing UnicodeSets in CLDR. // Pre-compute them for performance. // The Java unit test testCurrencySpacingPatternStability() will start failing if these change in CLDR. -icu::UInitOnce gDefaultCurrencySpacingInitOnce = U_INITONCE_INITIALIZER; +icu::UInitOnce gDefaultCurrencySpacingInitOnce {}; UnicodeSet *UNISET_DIGIT = nullptr; -UnicodeSet *UNISET_NOTS = nullptr; +UnicodeSet *UNISET_NOTSZ = nullptr; UBool U_CALLCONV cleanupDefaultCurrencySpacing() { delete UNISET_DIGIT; UNISET_DIGIT = nullptr; - delete UNISET_NOTS; - UNISET_NOTS = nullptr; + delete UNISET_NOTSZ; + UNISET_NOTSZ = nullptr; gDefaultCurrencySpacingInitOnce.reset(); - return TRUE; + return true; } void U_CALLCONV initDefaultCurrencySpacing(UErrorCode &status) { ucln_i18n_registerCleanup(UCLN_I18N_CURRENCY_SPACING, cleanupDefaultCurrencySpacing); UNISET_DIGIT = new UnicodeSet(UnicodeString(u"[:digit:]"), status); - UNISET_NOTS = new UnicodeSet(UnicodeString(u"[:^S:]"), status); - if (UNISET_DIGIT == nullptr || UNISET_NOTS == nullptr) { + UNISET_NOTSZ = new UnicodeSet(UnicodeString(u"[[:^S:]&[:^Z:]]"), status); + if (UNISET_DIGIT == nullptr || UNISET_NOTSZ == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } UNISET_DIGIT->freeze(); - UNISET_NOTS->freeze(); + UNISET_NOTSZ->freeze(); } } // namespace @@ -62,12 +62,21 @@ Modifier::Parameters::Parameters( ModifierStore::~ModifierStore() = default; -AdoptingModifierStore::~AdoptingModifierStore() { +AdoptingSignumModifierStore::~AdoptingSignumModifierStore() { for (const Modifier *mod : mods) { delete mod; } } +AdoptingSignumModifierStore& +AdoptingSignumModifierStore::operator=(AdoptingSignumModifierStore&& other) noexcept { + for (size_t i=0; imods[i] = other.mods[i]; + other.mods[i] = nullptr; + } + return *this; +} + int32_t ConstantAffixModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex, UErrorCode &status) const { @@ -89,16 +98,16 @@ bool ConstantAffixModifier::isStrong() const { return fStrong; } -bool ConstantAffixModifier::containsField(UNumberFormatFields field) const { +bool ConstantAffixModifier::containsField(Field field) const { (void)field; // This method is not currently used. - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } void ConstantAffixModifier::getParameters(Parameters& output) const { (void)output; // This method is not currently used. - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } bool ConstantAffixModifier::semanticallyEquivalent(const Modifier& other) const { @@ -124,7 +133,7 @@ SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field fie fCompiledPattern.getBuffer(), fCompiledPattern.length()); if (argLimit == 0) { // No arguments in compiled pattern - fPrefixLength = fCompiledPattern.charAt(1) - NUMBER_MODIFIERS_ARG_NUM_LIMIT; + fPrefixLength = fCompiledPattern.charAt(1) - ARG_NUM_LIMIT; U_ASSERT(2 + fPrefixLength == fCompiledPattern.length()); // Set suffixOffset = -1 to indicate no arguments in compiled pattern. fSuffixOffset = -1; @@ -133,7 +142,7 @@ SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field fie U_ASSERT(argLimit == 1); if (fCompiledPattern.charAt(1) != 0) { // Found prefix - fPrefixLength = fCompiledPattern.charAt(1) - NUMBER_MODIFIERS_ARG_NUM_LIMIT; + fPrefixLength = fCompiledPattern.charAt(1) - ARG_NUM_LIMIT; fSuffixOffset = 3 + fPrefixLength; } else { // No prefix @@ -142,7 +151,7 @@ SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field fie } if (3 + fPrefixLength < fCompiledPattern.length()) { // Found suffix - fSuffixLength = fCompiledPattern.charAt(fSuffixOffset) - NUMBER_MODIFIERS_ARG_NUM_LIMIT; + fSuffixLength = fCompiledPattern.charAt(fSuffixOffset) - ARG_NUM_LIMIT; } else { // No suffix fSuffixLength = 0; @@ -151,7 +160,7 @@ SimpleModifier::SimpleModifier(const SimpleFormatter &simpleFormatter, Field fie } SimpleModifier::SimpleModifier() - : fField(UNUM_FIELD_COUNT), fStrong(false), fPrefixLength(0), fSuffixLength(0) { + : fField(kUndefinedField), fStrong(false), fPrefixLength(0), fSuffixLength(0) { } int32_t SimpleModifier::apply(FormattedStringBuilder &output, int leftIndex, int rightIndex, @@ -178,10 +187,10 @@ bool SimpleModifier::isStrong() const { return fStrong; } -bool SimpleModifier::containsField(UNumberFormatFields field) const { +bool SimpleModifier::containsField(Field field) const { (void)field; // This method is not currently used. - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } void SimpleModifier::getParameters(Parameters& output) const { @@ -242,11 +251,11 @@ SimpleModifier::formatTwoArgPattern(const SimpleFormatter& compiled, FormattedSt int32_t prefixLength = compiledPattern.charAt(offset); offset++; - if (prefixLength < NUMBER_MODIFIERS_ARG_NUM_LIMIT) { + if (prefixLength < ARG_NUM_LIMIT) { // No prefix prefixLength = 0; } else { - prefixLength -= NUMBER_MODIFIERS_ARG_NUM_LIMIT; + prefixLength -= ARG_NUM_LIMIT; result.insert(index + length, compiledPattern, offset, offset + prefixLength, field, status); offset += prefixLength; length += prefixLength; @@ -255,11 +264,11 @@ SimpleModifier::formatTwoArgPattern(const SimpleFormatter& compiled, FormattedSt int32_t infixLength = compiledPattern.charAt(offset); offset++; - if (infixLength < NUMBER_MODIFIERS_ARG_NUM_LIMIT) { + if (infixLength < ARG_NUM_LIMIT) { // No infix infixLength = 0; } else { - infixLength -= NUMBER_MODIFIERS_ARG_NUM_LIMIT; + infixLength -= ARG_NUM_LIMIT; result.insert(index + length, compiledPattern, offset, offset + infixLength, field, status); offset += infixLength; length += infixLength; @@ -271,7 +280,7 @@ SimpleModifier::formatTwoArgPattern(const SimpleFormatter& compiled, FormattedSt // No suffix suffixLength = 0; } else { - suffixLength = compiledPattern.charAt(offset) - NUMBER_MODIFIERS_ARG_NUM_LIMIT; + suffixLength = compiledPattern.charAt(offset) - ARG_NUM_LIMIT; offset++; result.insert(index + length, compiledPattern, offset, offset + suffixLength, field, status); length += suffixLength; @@ -292,7 +301,7 @@ int32_t ConstantMultiFieldModifier::apply(FormattedStringBuilder &output, int le leftIndex + length, rightIndex + length, UnicodeString(), 0, 0, - UNUM_FIELD_COUNT, status); + kUndefinedField, status); } length += output.insert(rightIndex + length, fSuffix, status); return length; @@ -310,7 +319,7 @@ bool ConstantMultiFieldModifier::isStrong() const { return fStrong; } -bool ConstantMultiFieldModifier::containsField(UNumberFormatFields field) const { +bool ConstantMultiFieldModifier::containsField(Field field) const { return fPrefix.containsField(field) || fSuffix.containsField(field); } @@ -342,7 +351,7 @@ CurrencySpacingEnabledModifier::CurrencySpacingEnabledModifier(const FormattedSt : ConstantMultiFieldModifier(prefix, suffix, overwrite, strong) { // Check for currency spacing. Do not build the UnicodeSets unless there is // a currency code point at a boundary. - if (prefix.length() > 0 && prefix.fieldAt(prefix.length() - 1) == UNUM_CURRENCY_FIELD) { + if (prefix.length() > 0 && prefix.fieldAt(prefix.length() - 1) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) { int prefixCp = prefix.getLastCodePoint(); UnicodeSet prefixUnicodeSet = getUnicodeSet(symbols, IN_CURRENCY, PREFIX, status); if (prefixUnicodeSet.contains(prefixCp)) { @@ -357,8 +366,8 @@ CurrencySpacingEnabledModifier::CurrencySpacingEnabledModifier(const FormattedSt fAfterPrefixUnicodeSet.setToBogus(); fAfterPrefixInsert.setToBogus(); } - if (suffix.length() > 0 && suffix.fieldAt(0) == UNUM_CURRENCY_FIELD) { - int suffixCp = suffix.getLastCodePoint(); + if (suffix.length() > 0 && suffix.fieldAt(0) == Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) { + int suffixCp = suffix.getFirstCodePoint(); UnicodeSet suffixUnicodeSet = getUnicodeSet(symbols, IN_CURRENCY, SUFFIX, status); if (suffixUnicodeSet.contains(suffixCp)) { fBeforeSuffixUnicodeSet = getUnicodeSet(symbols, IN_NUMBER, SUFFIX, status); @@ -381,12 +390,20 @@ int32_t CurrencySpacingEnabledModifier::apply(FormattedStringBuilder &output, in if (rightIndex - leftIndex > 0 && !fAfterPrefixUnicodeSet.isBogus() && fAfterPrefixUnicodeSet.contains(output.codePointAt(leftIndex))) { // TODO: Should we use the CURRENCY field here? - length += output.insert(leftIndex, fAfterPrefixInsert, UNUM_FIELD_COUNT, status); + length += output.insert( + leftIndex, + fAfterPrefixInsert, + kUndefinedField, + status); } if (rightIndex - leftIndex > 0 && !fBeforeSuffixUnicodeSet.isBogus() && fBeforeSuffixUnicodeSet.contains(output.codePointBefore(rightIndex))) { // TODO: Should we use the CURRENCY field here? - length += output.insert(rightIndex + length, fBeforeSuffixInsert, UNUM_FIELD_COUNT, status); + length += output.insert( + rightIndex + length, + fBeforeSuffixInsert, + kUndefinedField, + status); } // Call super for the remaining logic @@ -422,7 +439,7 @@ CurrencySpacingEnabledModifier::applyCurrencySpacingAffix(FormattedStringBuilder // This works even if the last code point in the prefix is 2 code units because the // field value gets populated to both indices in the field array. Field affixField = (affix == PREFIX) ? output.fieldAt(index - 1) : output.fieldAt(index); - if (affixField != UNUM_CURRENCY_FIELD) { + if (affixField != Field(UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD)) { return 0; } int affixCp = (affix == PREFIX) ? output.codePointBefore(index) : output.codePointAt(index); @@ -443,7 +460,7 @@ CurrencySpacingEnabledModifier::applyCurrencySpacingAffix(FormattedStringBuilder // However, the build code path is more efficient, and this is the most natural // place to put currency spacing in the non-build code path. // TODO: Should we use the CURRENCY field here? - return output.insert(index, spacingString, UNUM_FIELD_COUNT, status); + return output.insert(index, spacingString, kUndefinedField, status); } UnicodeSet @@ -461,8 +478,8 @@ CurrencySpacingEnabledModifier::getUnicodeSet(const DecimalFormatSymbols &symbol status); if (pattern.compare(u"[:digit:]", -1) == 0) { return *UNISET_DIGIT; - } else if (pattern.compare(u"[:^S:]", -1) == 0) { - return *UNISET_NOTS; + } else if (pattern.compare(u"[[:^S:]&[:^Z:]]", -1) == 0) { + return *UNISET_NOTSZ; } else { return UnicodeSet(pattern, status); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.h index c84c6aa27..da6956bcf 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.h @@ -29,19 +29,19 @@ class U_I18N_API ConstantAffixModifier : public Modifier, public UObject { : fPrefix(prefix), fSuffix(suffix), fField(field), fStrong(strong) {} int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const U_OVERRIDE; + UErrorCode &status) const override; - int32_t getPrefixLength() const U_OVERRIDE; + int32_t getPrefixLength() const override; - int32_t getCodePointCount() const U_OVERRIDE; + int32_t getCodePointCount() const override; - bool isStrong() const U_OVERRIDE; + bool isStrong() const override; - bool containsField(UNumberFormatFields field) const U_OVERRIDE; + bool containsField(Field field) const override; - void getParameters(Parameters& output) const U_OVERRIDE; + void getParameters(Parameters& output) const override; - bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE; + bool semanticallyEquivalent(const Modifier& other) const override; private: UnicodeString fPrefix; @@ -65,19 +65,19 @@ class U_I18N_API SimpleModifier : public Modifier, public UMemory { SimpleModifier(); int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const U_OVERRIDE; + UErrorCode &status) const override; - int32_t getPrefixLength() const U_OVERRIDE; + int32_t getPrefixLength() const override; - int32_t getCodePointCount() const U_OVERRIDE; + int32_t getCodePointCount() const override; - bool isStrong() const U_OVERRIDE; + bool isStrong() const override; - bool containsField(UNumberFormatFields field) const U_OVERRIDE; + bool containsField(Field field) const override; - void getParameters(Parameters& output) const U_OVERRIDE; + void getParameters(Parameters& output) const override; - bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE; + bool semanticallyEquivalent(const Modifier& other) const override; /** * TODO: This belongs in SimpleFormatterImpl. The only reason I haven't moved it there yet is because @@ -158,19 +158,19 @@ class U_I18N_API ConstantMultiFieldModifier : public Modifier, public UMemory { fStrong(strong) {} int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const U_OVERRIDE; + UErrorCode &status) const override; - int32_t getPrefixLength() const U_OVERRIDE; + int32_t getPrefixLength() const override; - int32_t getCodePointCount() const U_OVERRIDE; + int32_t getCodePointCount() const override; - bool isStrong() const U_OVERRIDE; + bool isStrong() const override; - bool containsField(UNumberFormatFields field) const U_OVERRIDE; + bool containsField(Field field) const override; - void getParameters(Parameters& output) const U_OVERRIDE; + void getParameters(Parameters& output) const override; - bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE; + bool semanticallyEquivalent(const Modifier& other) const override; protected: // NOTE: In Java, these are stored as array pointers. In C++, the FormattedStringBuilder is stored by @@ -195,7 +195,7 @@ class U_I18N_API CurrencySpacingEnabledModifier : public ConstantMultiFieldModif UErrorCode &status); int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const U_OVERRIDE; + UErrorCode &status) const override; /** Unsafe code path */ static int32_t @@ -235,7 +235,7 @@ class U_I18N_API EmptyModifier : public Modifier, public UMemory { explicit EmptyModifier(bool isStrong) : fStrong(isStrong) {} int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const U_OVERRIDE { + UErrorCode &status) const override { (void)output; (void)leftIndex; (void)rightIndex; @@ -243,28 +243,28 @@ class U_I18N_API EmptyModifier : public Modifier, public UMemory { return 0; } - int32_t getPrefixLength() const U_OVERRIDE { + int32_t getPrefixLength() const override { return 0; } - int32_t getCodePointCount() const U_OVERRIDE { + int32_t getCodePointCount() const override { return 0; } - bool isStrong() const U_OVERRIDE { + bool isStrong() const override { return fStrong; } - bool containsField(UNumberFormatFields field) const U_OVERRIDE { + bool containsField(Field field) const override { (void)field; return false; } - void getParameters(Parameters& output) const U_OVERRIDE { + void getParameters(Parameters& output) const override { output.obj = nullptr; } - bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE { + bool semanticallyEquivalent(const Modifier& other) const override { return other.getCodePointCount() == 0; } @@ -272,13 +272,45 @@ class U_I18N_API EmptyModifier : public Modifier, public UMemory { bool fStrong; }; +/** An adopting Modifier store that varies by signum but not plural form. */ +class U_I18N_API AdoptingSignumModifierStore : public UMemory { + public: + virtual ~AdoptingSignumModifierStore(); + + AdoptingSignumModifierStore() = default; + + // No copying! + AdoptingSignumModifierStore(const AdoptingSignumModifierStore &other) = delete; + AdoptingSignumModifierStore& operator=(const AdoptingSignumModifierStore& other) = delete; + + // Moving is OK + AdoptingSignumModifierStore(AdoptingSignumModifierStore &&other) noexcept { + *this = std::move(other); + } + AdoptingSignumModifierStore& operator=(AdoptingSignumModifierStore&& other) noexcept; + + /** Take ownership of the Modifier and slot it in at the given Signum. */ + void adoptModifier(Signum signum, const Modifier* mod) { + U_ASSERT(mods[signum] == nullptr); + mods[signum] = mod; + } + + inline const Modifier*& operator[](Signum signum) { + return mods[signum]; + } + inline Modifier const* operator[](Signum signum) const { + return mods[signum]; + } + + private: + const Modifier* mods[SIGNUM_COUNT] = {}; +}; + /** - * This implementation of ModifierStore adopts Modifer pointers. + * This implementation of ModifierStore adopts Modifier pointers. */ class U_I18N_API AdoptingModifierStore : public ModifierStore, public UMemory { public: - virtual ~AdoptingModifierStore(); - static constexpr StandardPlural::Form DEFAULT_STANDARD_PLURAL = StandardPlural::OTHER; AdoptingModifierStore() = default; @@ -286,46 +318,36 @@ class U_I18N_API AdoptingModifierStore : public ModifierStore, public UMemory { // No copying! AdoptingModifierStore(const AdoptingModifierStore &other) = delete; - /** - * Sets the Modifier with the specified signum and plural form. - */ - void adoptModifier(Signum signum, StandardPlural::Form plural, const Modifier *mod) { - U_ASSERT(mods[getModIndex(signum, plural)] == nullptr); - mods[getModIndex(signum, plural)] = mod; + // Moving is OK + AdoptingModifierStore(AdoptingModifierStore &&other) = default; + + /** Sets the modifiers for a specific plural form. */ + void adoptSignumModifierStore(StandardPlural::Form plural, AdoptingSignumModifierStore other) { + mods[plural] = std::move(other); } - /** - * Sets the Modifier with the specified signum. - * The modifier will apply to all plural forms. - */ - void adoptModifierWithoutPlural(Signum signum, const Modifier *mod) { - U_ASSERT(mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)] == nullptr); - mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)] = mod; + /** Sets the modifiers for the default plural form. */ + void adoptSignumModifierStoreNoPlural(AdoptingSignumModifierStore other) { + mods[DEFAULT_STANDARD_PLURAL] = std::move(other); } /** Returns a reference to the modifier; no ownership change. */ - const Modifier *getModifier(Signum signum, StandardPlural::Form plural) const U_OVERRIDE { - const Modifier* modifier = mods[getModIndex(signum, plural)]; + const Modifier *getModifier(Signum signum, StandardPlural::Form plural) const override { + const Modifier* modifier = mods[plural][signum]; if (modifier == nullptr && plural != DEFAULT_STANDARD_PLURAL) { - modifier = mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)]; + modifier = mods[DEFAULT_STANDARD_PLURAL][signum]; } return modifier; } /** Returns a reference to the modifier; no ownership change. */ const Modifier *getModifierWithoutPlural(Signum signum) const { - return mods[getModIndex(signum, DEFAULT_STANDARD_PLURAL)]; + return mods[DEFAULT_STANDARD_PLURAL][signum]; } private: // NOTE: mods is zero-initialized (to nullptr) - const Modifier *mods[3 * StandardPlural::COUNT] = {}; - - inline static int32_t getModIndex(Signum signum, StandardPlural::Form plural) { - U_ASSERT(signum >= -1 && signum <= 1); - U_ASSERT(plural >= 0 && plural < StandardPlural::COUNT); - return static_cast(plural) * 3 + (signum + 1); - } + AdoptingSignumModifierStore mods[StandardPlural::COUNT] = {}; }; } // namespace impl diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.cpp index 33ea6aff2..dd5b3f8e0 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.cpp @@ -7,10 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif - #include "number_decnum.h" #include "number_types.h" @@ -49,6 +46,7 @@ Scale::Scale(const Scale& other) } Scale& Scale::operator=(const Scale& other) { + if (this == &other) { return *this; } // self-assignment: no-op fMagnitude = other.fMagnitude; if (other.fArbitrary != nullptr) { UErrorCode localStatus = U_ZERO_ERROR; @@ -60,13 +58,13 @@ Scale& Scale::operator=(const Scale& other) { return *this; } -Scale::Scale(Scale&& src) U_NOEXCEPT +Scale::Scale(Scale&& src) noexcept : fMagnitude(src.fMagnitude), fArbitrary(src.fArbitrary), fError(src.fError) { // Take ownership away from src if necessary src.fArbitrary = nullptr; } -Scale& Scale::operator=(Scale&& src) U_NOEXCEPT { +Scale& Scale::operator=(Scale&& src) noexcept { fMagnitude = src.fMagnitude; if (fArbitrary != nullptr) { delete fArbitrary; @@ -130,7 +128,7 @@ Scale Scale::byDoubleAndPowerOfTen(double multiplicand, int32_t power) { return {power, decnum.orphan()}; } -void Scale::applyTo(number::impl::DecimalQuantity& quantity) const { +void Scale::applyTo(impl::DecimalQuantity& quantity) const { quantity.adjustMagnitude(fMagnitude); if (fArbitrary != nullptr) { UErrorCode localStatus = U_ZERO_ERROR; @@ -138,7 +136,7 @@ void Scale::applyTo(number::impl::DecimalQuantity& quantity) const { } } -void Scale::applyReciprocalTo(number::impl::DecimalQuantity& quantity) const { +void Scale::applyReciprocalTo(impl::DecimalQuantity& quantity) const { quantity.adjustMagnitude(-fMagnitude); if (fArbitrary != nullptr) { UErrorCode localStatus = U_ZERO_ERROR; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.h index d8235dc60..c752935b7 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.h @@ -25,7 +25,7 @@ class U_I18N_API MultiplierFormatHandler : public MicroPropsGenerator, public UM void setAndChain(const Scale& multiplier, const MicroPropsGenerator* parent); void processQuantity(DecimalQuantity& quantity, MicroProps& micros, - UErrorCode& status) const U_OVERRIDE; + UErrorCode& status) const override; private: Scale fMultiplier; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_notation.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_notation.cpp index ccc73393d..b3cabb57a 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_notation.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_notation.cpp @@ -37,7 +37,7 @@ ScientificNotation Notation::engineering() { } ScientificNotation::ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, - number::impl::digits_t fMinExponentDigits, + impl::digits_t fMinExponentDigits, UNumberSignDisplay fExponentSignDisplay) { ScientificSettings settings; settings.fEngineeringInterval = fEngineeringInterval; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_output.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_output.cpp index 2cd5665c3..729a2cd5e 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_output.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_output.cpp @@ -5,11 +5,13 @@ #if !UCONFIG_NO_FORMATTING +#include "unicode/measunit.h" #include "unicode/numberformatter.h" #include "number_utypes.h" #include "util.h" #include "number_decimalquantity.h" #include "number_decnum.h" +#include "numrange_impl.h" U_NAMESPACE_BEGIN namespace number { @@ -19,19 +21,9 @@ UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumber) #define UPRV_NOARG -UBool FormattedNumber::nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) - return fData->nextFieldPosition(fieldPosition, status); -} - -void FormattedNumber::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const { - FieldPositionIteratorHandler fpih(&iterator, status); - getAllFieldPositionsImpl(fpih, status); -} - void FormattedNumber::toDecimalNumber(ByteSink& sink, UErrorCode& status) const { UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) - number::impl::DecNum decnum; + impl::DecNum decnum; fData->quantity.toDecNum(decnum, status); decnum.toString(sink, status); } @@ -42,7 +34,18 @@ void FormattedNumber::getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpi fData->getAllFieldPositions(fpih, status); } -void FormattedNumber::getDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const { +MeasureUnit FormattedNumber::getOutputUnit(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(MeasureUnit()) + return fData->outputUnit; +} + +UDisplayOptionsNounClass FormattedNumber::getNounClass(UErrorCode &status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(UDISPOPT_NOUN_CLASS_UNDEFINED); + const char *nounClass = fData->gender; + return udispopt_fromNounClassIdentifier(nounClass); +} + +void FormattedNumber::getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const { UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) output = fData->quantity; } @@ -51,6 +54,32 @@ void FormattedNumber::getDecimalQuantity(number::impl::DecimalQuantity& output, impl::UFormattedNumberData::~UFormattedNumberData() = default; +UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumberRange) + +#define UPRV_NOARG + +void FormattedNumberRange::getDecimalNumbers(ByteSink& sink1, ByteSink& sink2, UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) + impl::DecNum decnum1; + impl::DecNum decnum2; + fData->quantity1.toDecNum(decnum1, status).toString(sink1, status); + fData->quantity2.toDecNum(decnum2, status).toString(sink2, status); +} + +UNumberRangeIdentityResult FormattedNumberRange::getIdentityResult(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(UNUM_IDENTITY_RESULT_NOT_EQUAL) + return fData->identityResult; +} + +const impl::UFormattedNumberRangeData* FormattedNumberRange::getData(UErrorCode& status) const { + UPRV_FORMATTED_VALUE_METHOD_GUARD(nullptr) + return fData; +} + + +impl::UFormattedNumberRangeData::~UFormattedNumberRangeData() = default; + + } // namespace number U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_padding.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_padding.cpp index c68a9875b..c320c3ffb 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_padding.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_padding.cpp @@ -21,7 +21,7 @@ addPaddingHelper(UChar32 paddingCp, int32_t requiredPadding, FormattedStringBuil UErrorCode &status) { for (int32_t i = 0; i < requiredPadding; i++) { // TODO: If appending to the end, this will cause actual insertion operations. Improve. - string.insertCodePoint(index, paddingCp, UNUM_FIELD_COUNT, status); + string.insertCodePoint(index, paddingCp, kUndefinedField, status); } return U16_LENGTH(paddingCp) * requiredPadding; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.cpp index 724f5b974..6f398c6ac 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.cpp @@ -28,17 +28,23 @@ void MutablePatternModifier::setPatternInfo(const AffixPatternProvider* patternI fField = field; } -void MutablePatternModifier::setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille) { +void MutablePatternModifier::setPatternAttributes( + UNumberSignDisplay signDisplay, + bool perMille, + bool approximately) { fSignDisplay = signDisplay; fPerMilleReplacesPercent = perMille; + fApproximately = approximately; } void MutablePatternModifier::setSymbols(const DecimalFormatSymbols* symbols, - const CurrencySymbols* currencySymbols, - const UNumberUnitWidth unitWidth, const PluralRules* rules) { + const CurrencyUnit& currency, + const UNumberUnitWidth unitWidth, + const PluralRules* rules, + UErrorCode& status) { U_ASSERT((rules != nullptr) == needsPlurals()); fSymbols = symbols; - fCurrencySymbols = currencySymbols; + fCurrencySymbols = {currency, symbols->getLocale(), *symbols, status}; fUnitWidth = unitWidth; fRules = rules; } @@ -54,13 +60,22 @@ bool MutablePatternModifier::needsPlurals() const { // Silently ignore any error codes. } -ImmutablePatternModifier* MutablePatternModifier::createImmutable(UErrorCode& status) { - return createImmutableAndChain(nullptr, status); -} +AdoptingSignumModifierStore MutablePatternModifier::createImmutableForPlural(StandardPlural::Form plural, UErrorCode& status) { + AdoptingSignumModifierStore pm; -ImmutablePatternModifier* -MutablePatternModifier::createImmutableAndChain(const MicroPropsGenerator* parent, UErrorCode& status) { + setNumberProperties(SIGNUM_POS, plural); + pm.adoptModifier(SIGNUM_POS, createConstantModifier(status)); + setNumberProperties(SIGNUM_NEG_ZERO, plural); + pm.adoptModifier(SIGNUM_NEG_ZERO, createConstantModifier(status)); + setNumberProperties(SIGNUM_POS_ZERO, plural); + pm.adoptModifier(SIGNUM_POS_ZERO, createConstantModifier(status)); + setNumberProperties(SIGNUM_NEG, plural); + pm.adoptModifier(SIGNUM_NEG, createConstantModifier(status)); + + return pm; +} +ImmutablePatternModifier* MutablePatternModifier::createImmutable(UErrorCode& status) { // TODO: Move StandardPlural VALUES to standardplural.h static const StandardPlural::Form STANDARD_PLURAL_VALUES[] = { StandardPlural::Form::ZERO, @@ -79,31 +94,21 @@ MutablePatternModifier::createImmutableAndChain(const MicroPropsGenerator* paren if (needsPlurals()) { // Slower path when we require the plural keyword. for (StandardPlural::Form plural : STANDARD_PLURAL_VALUES) { - setNumberProperties(SIGNUM_POS, plural); - pm->adoptModifier(SIGNUM_POS, plural, createConstantModifier(status)); - setNumberProperties(SIGNUM_ZERO, plural); - pm->adoptModifier(SIGNUM_ZERO, plural, createConstantModifier(status)); - setNumberProperties(SIGNUM_NEG, plural); - pm->adoptModifier(SIGNUM_NEG, plural, createConstantModifier(status)); + pm->adoptSignumModifierStore(plural, createImmutableForPlural(plural, status)); } if (U_FAILURE(status)) { delete pm; return nullptr; } - return new ImmutablePatternModifier(pm, fRules, parent); // adopts pm + return new ImmutablePatternModifier(pm, fRules); // adopts pm } else { // Faster path when plural keyword is not needed. - setNumberProperties(SIGNUM_POS, StandardPlural::Form::COUNT); - pm->adoptModifierWithoutPlural(SIGNUM_POS, createConstantModifier(status)); - setNumberProperties(SIGNUM_ZERO, StandardPlural::Form::COUNT); - pm->adoptModifierWithoutPlural(SIGNUM_ZERO, createConstantModifier(status)); - setNumberProperties(SIGNUM_NEG, StandardPlural::Form::COUNT); - pm->adoptModifierWithoutPlural(SIGNUM_NEG, createConstantModifier(status)); + pm->adoptSignumModifierStoreNoPlural(createImmutableForPlural(StandardPlural::Form::COUNT, status)); if (U_FAILURE(status)) { delete pm; return nullptr; } - return new ImmutablePatternModifier(pm, nullptr, parent); // adopts pm + return new ImmutablePatternModifier(pm, nullptr); // adopts pm } } @@ -120,13 +125,16 @@ ConstantMultiFieldModifier* MutablePatternModifier::createConstantModifier(UErro } } -ImmutablePatternModifier::ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules, - const MicroPropsGenerator* parent) - : pm(pm), rules(rules), parent(parent) {} +ImmutablePatternModifier::ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules) + : pm(pm), rules(rules), parent(nullptr) {} void ImmutablePatternModifier::processQuantity(DecimalQuantity& quantity, MicroProps& micros, UErrorCode& status) const { parent->processQuantity(quantity, micros, status); + micros.rounder.apply(quantity, status); + if (micros.modMiddle != nullptr) { + return; + } applyToMicros(micros, quantity, status); } @@ -148,6 +156,10 @@ const Modifier* ImmutablePatternModifier::getModifier(Signum signum, StandardPlu } } +void ImmutablePatternModifier::addToChain(const MicroPropsGenerator* parent) { + this->parent = parent; +} + /** Used by the unsafe code path. */ MicroPropsGenerator& MutablePatternModifier::addToChain(const MicroPropsGenerator* parent) { @@ -158,6 +170,10 @@ MicroPropsGenerator& MutablePatternModifier::addToChain(const MicroPropsGenerato void MutablePatternModifier::processQuantity(DecimalQuantity& fq, MicroProps& micros, UErrorCode& status) const { fParent->processQuantity(fq, micros, status); + micros.rounder.apply(fq, status); + if (micros.modMiddle != nullptr) { + return; + } // The unsafe code path performs self-mutation, so we need a const_cast. // This method needs to be const because it overrides a const method in the parent class. auto nonConstThis = const_cast(this); @@ -186,7 +202,7 @@ int32_t MutablePatternModifier::apply(FormattedStringBuilder& output, int32_t le UnicodeString(), 0, 0, - UNUM_FIELD_COUNT, + kUndefinedField, status); } CurrencySpacingEnabledModifier::applyCurrencySpacing( @@ -230,22 +246,22 @@ bool MutablePatternModifier::isStrong() const { return fStrong; } -bool MutablePatternModifier::containsField(UNumberFormatFields field) const { +bool MutablePatternModifier::containsField(Field field) const { (void)field; // This method is not currently used. - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } void MutablePatternModifier::getParameters(Parameters& output) const { (void)output; // This method is not currently used. - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } bool MutablePatternModifier::semanticallyEquivalent(const Modifier& other) const { (void)other; // This method is not currently used. - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } int32_t MutablePatternModifier::insertPrefix(FormattedStringBuilder& sb, int position, UErrorCode& status) { @@ -263,7 +279,14 @@ int32_t MutablePatternModifier::insertSuffix(FormattedStringBuilder& sb, int pos /** This method contains the heart of the logic for rendering LDML affix strings. */ void MutablePatternModifier::prepareAffix(bool isPrefix) { PatternStringUtils::patternInfoToStringBuilder( - *fPatternInfo, isPrefix, fSignum, fSignDisplay, fPlural, fPerMilleReplacesPercent, currentAffix); + *fPatternInfo, + isPrefix, + PatternStringUtils::resolveSignDisplay(fSignDisplay, fSignum), + fApproximately, + fPlural, + fPerMilleReplacesPercent, + false, // dropCurrencySymbols + currentAffix); } UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const { @@ -273,42 +296,53 @@ UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const { return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol); case AffixPatternType::TYPE_PLUS_SIGN: return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol); + case AffixPatternType::TYPE_APPROXIMATELY_SIGN: + return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kApproximatelySignSymbol); case AffixPatternType::TYPE_PERCENT: return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPercentSymbol); case AffixPatternType::TYPE_PERMILLE: return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPerMillSymbol); - case AffixPatternType::TYPE_CURRENCY_SINGLE: { - // UnitWidth ISO and HIDDEN overrides the singular currency symbol. - if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE) { - return fCurrencySymbols->getIntlCurrencySymbol(localStatus); - } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN) { - return UnicodeString(); - } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW) { - return fCurrencySymbols->getNarrowCurrencySymbol(localStatus); - } else { - return fCurrencySymbols->getCurrencySymbol(localStatus); - } - } + case AffixPatternType::TYPE_CURRENCY_SINGLE: + return getCurrencySymbolForUnitWidth(localStatus); case AffixPatternType::TYPE_CURRENCY_DOUBLE: - return fCurrencySymbols->getIntlCurrencySymbol(localStatus); + return fCurrencySymbols.getIntlCurrencySymbol(localStatus); case AffixPatternType::TYPE_CURRENCY_TRIPLE: // NOTE: This is the code path only for patterns containing "¤¤¤". // Plural currencies set via the API are formatted in LongNameHandler. // This code path is used by DecimalFormat via CurrencyPluralInfo. U_ASSERT(fPlural != StandardPlural::Form::COUNT); - return fCurrencySymbols->getPluralName(fPlural, localStatus); + return fCurrencySymbols.getPluralName(fPlural, localStatus); case AffixPatternType::TYPE_CURRENCY_QUAD: return UnicodeString(u"\uFFFD"); case AffixPatternType::TYPE_CURRENCY_QUINT: return UnicodeString(u"\uFFFD"); default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; + } +} + +UnicodeString MutablePatternModifier::getCurrencySymbolForUnitWidth(UErrorCode& status) const { + switch (fUnitWidth) { + case UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW: + return fCurrencySymbols.getNarrowCurrencySymbol(status); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_SHORT: + return fCurrencySymbols.getCurrencySymbol(status); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE: + return fCurrencySymbols.getIntlCurrencySymbol(status); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_FORMAL: + return fCurrencySymbols.getFormalCurrencySymbol(status); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_VARIANT: + return fCurrencySymbols.getVariantCurrencySymbol(status); + case UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN: + return UnicodeString(); + default: + return fCurrencySymbols.getCurrencySymbol(status); } } UnicodeString MutablePatternModifier::toUnicodeString() const { // Never called by AffixUtils - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.h index b2c90e0af..ee38c20c9 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.h @@ -42,17 +42,19 @@ class MutablePatternModifier; // Exported as U_I18N_API because it is needed for the unit test PatternModifierTest class U_I18N_API ImmutablePatternModifier : public MicroPropsGenerator, public UMemory { public: - ~ImmutablePatternModifier() U_OVERRIDE = default; + ~ImmutablePatternModifier() override = default; - void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const U_OVERRIDE; + void processQuantity(DecimalQuantity&, MicroProps& micros, UErrorCode& status) const override; void applyToMicros(MicroProps& micros, const DecimalQuantity& quantity, UErrorCode& status) const; const Modifier* getModifier(Signum signum, StandardPlural::Form plural) const; + // Non-const method: + void addToChain(const MicroPropsGenerator* parent); + private: - ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules, - const MicroPropsGenerator* parent); + ImmutablePatternModifier(AdoptingModifierStore* pm, const PluralRules* rules); const LocalPointer pm; const PluralRules* rules; @@ -87,7 +89,7 @@ class U_I18N_API MutablePatternModifier public UMemory { public: - ~MutablePatternModifier() U_OVERRIDE = default; + ~MutablePatternModifier() override = default; /** * @param isStrong @@ -114,24 +116,28 @@ class U_I18N_API MutablePatternModifier * Whether to force a plus sign on positive numbers. * @param perMille * Whether to substitute the percent sign in the pattern with a permille sign. + * @param approximately + * Whether to prepend approximately to the sign */ - void setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille); + void setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille, bool approximately); /** * Sets locale-specific details that affect the symbols substituted into the pattern string affixes. * * @param symbols * The desired instance of DecimalFormatSymbols. - * @param currencySymbols - * The currency symbols to be used when substituting currency values into the affixes. + * @param currency + * The currency to be used when substituting currency values into the affixes. * @param unitWidth * The width used to render currencies. * @param rules * Required if the triple currency sign, "¤¤¤", appears in the pattern, which can be determined from the * convenience method {@link #needsPlurals()}. + * @param status + * Set if an error occurs while loading currency data. */ - void setSymbols(const DecimalFormatSymbols* symbols, const CurrencySymbols* currencySymbols, - UNumberUnitWidth unitWidth, const PluralRules* rules); + void setSymbols(const DecimalFormatSymbols* symbols, const CurrencyUnit& currency, + UNumberUnitWidth unitWidth, const PluralRules* rules, UErrorCode& status); /** * Sets attributes of the current number being processed. @@ -150,6 +156,9 @@ class U_I18N_API MutablePatternModifier */ bool needsPlurals() const; + /** Creates a quantity-dependent Modifier for the specified plural form. */ + AdoptingSignumModifierStore createImmutableForPlural(StandardPlural::Form plural, UErrorCode& status); + /** * Creates a new quantity-dependent Modifier that behaves the same as the current instance, but which is immutable * and can be saved for future use. The number properties in the current instance are mutated; all other properties @@ -165,44 +174,34 @@ class U_I18N_API MutablePatternModifier */ ImmutablePatternModifier *createImmutable(UErrorCode &status); - /** - * Creates a new quantity-dependent Modifier that behaves the same as the current instance, but which is immutable - * and can be saved for future use. The number properties in the current instance are mutated; all other properties - * are left untouched. - * - *

    - * CREATES A NEW HEAP OBJECT; THE CALLER GETS OWNERSHIP. - * - * @param parent - * The QuantityChain to which to chain this immutable. - * @return An immutable that supports both positive and negative numbers. - */ - ImmutablePatternModifier * - createImmutableAndChain(const MicroPropsGenerator *parent, UErrorCode &status); - MicroPropsGenerator &addToChain(const MicroPropsGenerator *parent); - void processQuantity(DecimalQuantity &, MicroProps µs, UErrorCode &status) const U_OVERRIDE; + void processQuantity(DecimalQuantity &, MicroProps µs, UErrorCode &status) const override; int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const U_OVERRIDE; + UErrorCode &status) const override; - int32_t getPrefixLength() const U_OVERRIDE; + int32_t getPrefixLength() const override; - int32_t getCodePointCount() const U_OVERRIDE; + int32_t getCodePointCount() const override; - bool isStrong() const U_OVERRIDE; + bool isStrong() const override; - bool containsField(UNumberFormatFields field) const U_OVERRIDE; + bool containsField(Field field) const override; - void getParameters(Parameters& output) const U_OVERRIDE; + void getParameters(Parameters& output) const override; - bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE; + bool semanticallyEquivalent(const Modifier& other) const override; /** * Returns the string that substitutes a given symbol type in a pattern. */ - UnicodeString getSymbol(AffixPatternType type) const U_OVERRIDE; + UnicodeString getSymbol(AffixPatternType type) const override; + + /** + * Returns the currency symbol for the unit width specified in setSymbols() + */ + UnicodeString getCurrencySymbolForUnitWidth(UErrorCode& status) const; UnicodeString toUnicodeString() const; @@ -215,11 +214,12 @@ class U_I18N_API MutablePatternModifier Field fField; UNumberSignDisplay fSignDisplay; bool fPerMilleReplacesPercent; + bool fApproximately; // Symbol details (initialized in setSymbols) const DecimalFormatSymbols *fSymbols; UNumberUnitWidth fUnitWidth; - const CurrencySymbols *fCurrencySymbols; + CurrencySymbols fCurrencySymbols; const PluralRules *fRules; // Number details (initialized in setNumberProperties) diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.cpp index 6c59e71b5..aa082be5a 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.cpp @@ -7,13 +7,8 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif - -#ifndef UNISTR_FROM_CHAR_EXPLICIT #define UNISTR_FROM_CHAR_EXPLICIT -#endif #include "uassert.h" #include "number_patternstring.h" @@ -55,7 +50,7 @@ PatternParser::parseToExistingProperties(const UnicodeString& pattern, DecimalFo char16_t ParsedPatternInfo::charAt(int32_t flags, int32_t index) const { const Endpoints& endpoints = getEndpoints(flags); if (index < 0 || index >= endpoints.end - endpoints.start) { - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } return pattern.charAt(endpoints.start + index); } @@ -120,6 +115,10 @@ bool ParsedPatternInfo::hasBody() const { return positive.integerTotal > 0; } +bool ParsedPatternInfo::currencyAsDecimal() const { + return positive.hasCurrencyDecimal; +} + ///////////////////////////////////////////////////// /// BEGIN RECURSIVE DESCENT PARSER IMPLEMENTATION /// ///////////////////////////////////////////////////// @@ -132,8 +131,20 @@ UChar32 ParsedPatternInfo::ParserState::peek() { } } +UChar32 ParsedPatternInfo::ParserState::peek2() { + if (offset == pattern.length()) { + return -1; + } + int32_t cp1 = pattern.char32At(offset); + int32_t offset2 = offset + U16_LENGTH(cp1); + if (offset2 == pattern.length()) { + return -1; + } + return pattern.char32At(offset2); +} + UChar32 ParsedPatternInfo::ParserState::next() { - int codePoint = peek(); + int32_t codePoint = peek(); offset += U16_LENGTH(codePoint); return codePoint; } @@ -233,11 +244,11 @@ void ParsedPatternInfo::consumeAffix(Endpoints& endpoints, UErrorCode& status) { currentSubpattern->hasPercentSign = true; break; - case u'\x2030': + case u'‰': currentSubpattern->hasPerMilleSign = true; break; - case u'\xa4': + case u'¤': currentSubpattern->hasCurrencySign = true; break; @@ -291,6 +302,35 @@ void ParsedPatternInfo::consumeFormat(UErrorCode& status) { currentSubpattern->widthExceptAffixes += 1; consumeFractionFormat(status); if (U_FAILURE(status)) { return; } + } else if (state.peek() == u'¤') { + // Check if currency is a decimal separator + switch (state.peek2()) { + case u'#': + case u'0': + case u'1': + case u'2': + case u'3': + case u'4': + case u'5': + case u'6': + case u'7': + case u'8': + case u'9': + break; + default: + // Currency symbol followed by a non-numeric character; + // treat as a normal affix. + return; + } + // Currency symbol is followed by a numeric character; + // treat as a decimal separator. + currentSubpattern->hasCurrencySign = true; + currentSubpattern->hasCurrencyDecimal = true; + currentSubpattern->hasDecimal = true; + currentSubpattern->widthExceptAffixes += 1; + state.next(); // consume the symbol + consumeFractionFormat(status); + if (U_FAILURE(status)) { return; } } } @@ -570,6 +610,9 @@ PatternParser::patternInfoToProperties(DecimalFormatProperties& properties, Pars properties.decimalSeparatorAlwaysShown = false; } + // Persist the currency as decimal separator + properties.currencyAsDecimal = positive.hasCurrencyDecimal; + // Scientific notation settings if (positive.exponentZeros > 0) { properties.exponentSignAlwaysShown = positive.exponentHasPlusSign; @@ -691,10 +734,10 @@ UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatP int32_t exponentDigits = uprv_min(properties.minimumExponentDigits, dosMax); bool exponentShowPlusSign = properties.exponentSignAlwaysShown; - PropertiesAffixPatternProvider affixes(properties, status); + AutoAffixPatternProvider affixProvider(properties, status); // Prefixes - sb.append(affixes.getString(AffixPatternProvider::AFFIX_POS_PREFIX)); + sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_POS_PREFIX)); int32_t afterPrefixPos = sb.length(); // Figure out the grouping sizes. @@ -707,7 +750,7 @@ UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatP int32_t groupingLength = grouping1 + grouping2 + 1; // Figure out the digits we need to put in the pattern. - double roundingInterval = properties.roundingIncrement; + double increment = properties.roundingIncrement; UnicodeString digitsString; int32_t digitsStringScale = 0; if (maxSig != uprv_min(dosMax, -1)) { @@ -718,14 +761,14 @@ UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatP while (digitsString.length() < maxSig) { digitsString.append(u'#'); } - } else if (roundingInterval != 0.0 && !ignoreRoundingIncrement(roundingInterval,maxFrac)) { - // Rounding Interval. - digitsStringScale = -roundingutils::doubleFractionLength(roundingInterval, nullptr); - // TODO: Check for DoS here? + } else if (increment != 0.0 && !ignoreRoundingIncrement(increment,maxFrac)) { + // Rounding Increment. DecimalQuantity incrementQuantity; - incrementQuantity.setToDouble(roundingInterval); + incrementQuantity.setToDouble(increment); + incrementQuantity.roundToInfinity(); + digitsStringScale = incrementQuantity.getLowerDisplayMagnitude(); incrementQuantity.adjustMagnitude(-digitsStringScale); - incrementQuantity.roundToMagnitude(0, kDefaultMode, status); + incrementQuantity.setMinInteger(minInt - digitsStringScale); UnicodeString str = incrementQuantity.toPlainString(); if (str.charAt(0) == u'-') { // TODO: Unsupported operation exception or fail silently? @@ -755,7 +798,11 @@ UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatP } // Decimal separator if (magnitude == 0 && (alwaysShowDecimal || mN < 0)) { - sb.append(u'.'); + if (properties.currencyAsDecimal) { + sb.append(u'¤'); + } else { + sb.append(u'.'); + } } if (!useGrouping) { continue; @@ -783,7 +830,7 @@ UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatP // Suffixes int32_t beforeSuffixPos = sb.length(); - sb.append(affixes.getString(AffixPatternProvider::AFFIX_POS_SUFFIX)); + sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_POS_SUFFIX)); // Resolve Padding if (paddingWidth > 0 && !paddingLocation.isNull()) { @@ -819,16 +866,16 @@ UnicodeString PatternStringUtils::propertiesToPatternString(const DecimalFormatP // Negative affixes // Ignore if the negative prefix pattern is "-" and the negative suffix is empty - if (affixes.hasNegativeSubpattern()) { + if (affixProvider.get().hasNegativeSubpattern()) { sb.append(u';'); - sb.append(affixes.getString(AffixPatternProvider::AFFIX_NEG_PREFIX)); + sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_NEG_PREFIX)); // Copy the positive digit format into the negative. // This is optional; the pattern is the same as if '#' were appended here instead. // NOTE: It is not safe to append the UnicodeString to itself, so we need to copy. - // See http://bugs.icu-project.org/trac/ticket/13707 + // See https://unicode-org.atlassian.net/browse/ICU-13707 UnicodeString copy(sb); sb.append(copy, afterPrefixPos, beforeSuffixPos - afterPrefixPos); - sb.append(affixes.getString(AffixPatternProvider::AFFIX_NEG_SUFFIX)); + sb.append(affixProvider.get().getString(AffixPatternProvider::AFFIX_NEG_SUFFIX)); } return sb; @@ -874,6 +921,7 @@ PatternStringUtils::convertLocalized(const UnicodeString& input, const DecimalFo UnicodeString table[LEN][2]; int standIdx = toLocalized ? 0 : 1; int localIdx = toLocalized ? 1 : 0; + // TODO: Add approximately sign here? table[0][standIdx] = u"%"; table[0][localIdx] = symbols.getConstSymbol(DecimalFormatSymbols::kPercentSymbol); table[1][standIdx] = u"‰"; @@ -904,9 +952,7 @@ PatternStringUtils::convertLocalized(const UnicodeString& input, const DecimalFo // Special case: quotes are NOT allowed to be in any localIdx strings. // Substitute them with '’' instead. for (int32_t i = 0; i < LEN; i++) { - UnicodeString oldText(u'\''); - UnicodeString newText(u'\x2019'); - table[i][localIdx].findAndReplace(oldText, newText); + table[i][localIdx].findAndReplace(u'\'', u'’'); } // Iterate through the string and convert. @@ -922,7 +968,7 @@ PatternStringUtils::convertLocalized(const UnicodeString& input, const DecimalFo UnicodeString result; int state = 0; for (int offset = 0; offset < input.length(); offset++) { - UChar ch = input.charAt(offset); + char16_t ch = input.charAt(offset); // Handle a quote character (state shift) if (ch == u'\'') { @@ -1007,23 +1053,22 @@ PatternStringUtils::convertLocalized(const UnicodeString& input, const DecimalFo } void PatternStringUtils::patternInfoToStringBuilder(const AffixPatternProvider& patternInfo, bool isPrefix, - Signum signum, UNumberSignDisplay signDisplay, + PatternSignType patternSignType, + bool approximately, StandardPlural::Form plural, - bool perMilleReplacesPercent, UnicodeString& output) { + bool perMilleReplacesPercent, + bool dropCurrencySymbols, + UnicodeString& output) { // Should the output render '+' where '-' would normally appear in the pattern? - bool plusReplacesMinusSign = signum != -1 && ( - signDisplay == UNUM_SIGN_ALWAYS || signDisplay == UNUM_SIGN_ACCOUNTING_ALWAYS || ( - signum == 1 && ( - signDisplay == UNUM_SIGN_EXCEPT_ZERO || - signDisplay == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO))) && - patternInfo.positiveHasPlusSign() == false; - - // Should we use the affix from the negative subpattern? (If not, we will use the positive - // subpattern.) - // TODO: Deal with signum - bool useNegativeAffixPattern = patternInfo.hasNegativeSubpattern() && ( - signum == -1 || (patternInfo.negativeHasMinusSign() && plusReplacesMinusSign)); + bool plusReplacesMinusSign = (patternSignType == PATTERN_SIGN_TYPE_POS_SIGN) + && !patternInfo.positiveHasPlusSign(); + + // Should we use the affix from the negative subpattern? + // (If not, we will use the positive subpattern.) + bool useNegativeAffixPattern = patternInfo.hasNegativeSubpattern() + && (patternSignType == PATTERN_SIGN_TYPE_NEG + || (patternInfo.negativeHasMinusSign() && (plusReplacesMinusSign || approximately))); // Resolve the flags for the affix pattern. int flags = 0; @@ -1042,13 +1087,27 @@ void PatternStringUtils::patternInfoToStringBuilder(const AffixPatternProvider& bool prependSign; if (!isPrefix || useNegativeAffixPattern) { prependSign = false; - } else if (signum == -1) { - prependSign = signDisplay != UNUM_SIGN_NEVER; + } else if (patternSignType == PATTERN_SIGN_TYPE_NEG) { + prependSign = true; } else { - prependSign = plusReplacesMinusSign; + prependSign = plusReplacesMinusSign || approximately; + } + + // What symbols should take the place of the sign placeholder? + const char16_t* signSymbols = u"-"; + if (approximately) { + if (plusReplacesMinusSign) { + signSymbols = u"~+"; + } else if (patternSignType == PATTERN_SIGN_TYPE_NEG) { + signSymbols = u"~-"; + } else { + signSymbols = u"~"; + } + } else if (plusReplacesMinusSign) { + signSymbols = u"+"; } - // Compute the length of the affix pattern. + // Compute the number of tokens in the affix pattern (signSymbols is considered one token). int length = patternInfo.length(flags) + (prependSign ? 1 : 0); // Finally, set the result into the StringBuilder. @@ -1062,14 +1121,92 @@ void PatternStringUtils::patternInfoToStringBuilder(const AffixPatternProvider& } else { candidate = patternInfo.charAt(flags, index); } - if (plusReplacesMinusSign && candidate == u'-') { - candidate = u'+'; + if (candidate == u'-') { + if (u_strlen(signSymbols) == 1) { + candidate = signSymbols[0]; + } else { + output.append(signSymbols[0]); + candidate = signSymbols[1]; + } } if (perMilleReplacesPercent && candidate == u'%') { - candidate = u'\x2030'; + candidate = u'‰'; + } + if (dropCurrencySymbols && candidate == u'\u00A4') { + continue; } output.append(candidate); } } +PatternSignType PatternStringUtils::resolveSignDisplay(UNumberSignDisplay signDisplay, Signum signum) { + switch (signDisplay) { + case UNUM_SIGN_AUTO: + case UNUM_SIGN_ACCOUNTING: + switch (signum) { + case SIGNUM_NEG: + case SIGNUM_NEG_ZERO: + return PATTERN_SIGN_TYPE_NEG; + case SIGNUM_POS_ZERO: + case SIGNUM_POS: + return PATTERN_SIGN_TYPE_POS; + default: + break; + } + break; + + case UNUM_SIGN_ALWAYS: + case UNUM_SIGN_ACCOUNTING_ALWAYS: + switch (signum) { + case SIGNUM_NEG: + case SIGNUM_NEG_ZERO: + return PATTERN_SIGN_TYPE_NEG; + case SIGNUM_POS_ZERO: + case SIGNUM_POS: + return PATTERN_SIGN_TYPE_POS_SIGN; + default: + break; + } + break; + + case UNUM_SIGN_EXCEPT_ZERO: + case UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO: + switch (signum) { + case SIGNUM_NEG: + return PATTERN_SIGN_TYPE_NEG; + case SIGNUM_NEG_ZERO: + case SIGNUM_POS_ZERO: + return PATTERN_SIGN_TYPE_POS; + case SIGNUM_POS: + return PATTERN_SIGN_TYPE_POS_SIGN; + default: + break; + } + break; + + case UNUM_SIGN_NEGATIVE: + case UNUM_SIGN_ACCOUNTING_NEGATIVE: + switch (signum) { + case SIGNUM_NEG: + return PATTERN_SIGN_TYPE_NEG; + case SIGNUM_NEG_ZERO: + case SIGNUM_POS_ZERO: + case SIGNUM_POS: + return PATTERN_SIGN_TYPE_POS; + default: + break; + } + break; + + case UNUM_SIGN_NEVER: + return PATTERN_SIGN_TYPE_POS; + + default: + break; + } + + UPRV_UNREACHABLE_EXIT; + return PATTERN_SIGN_TYPE_POS; +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.h index 1191d2982..989d0d346 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.h @@ -22,6 +22,18 @@ namespace impl { // Forward declaration class PatternParser; +// Note: the order of fields in this enum matters for parsing. +enum PatternSignType { + /** Render using normal positive subpattern rules */ + PATTERN_SIGN_TYPE_POS, + /** Render using rules to force the display of a plus sign */ + PATTERN_SIGN_TYPE_POS_SIGN, + /** Render using negative subpattern rules */ + PATTERN_SIGN_TYPE_NEG, + /** Count for looping over the possibilities */ + PATTERN_SIGN_TYPE_COUNT +}; + // Exported as U_I18N_API because it is a public member field of exported ParsedSubpatternInfo struct U_I18N_API Endpoints { int32_t start = 0; @@ -50,6 +62,7 @@ struct U_I18N_API ParsedSubpatternInfo { bool hasPercentSign = false; bool hasPerMilleSign = false; bool hasCurrencySign = false; + bool hasCurrencyDecimal = false; bool hasMinusSign = false; bool hasPlusSign = false; @@ -67,30 +80,32 @@ struct U_I18N_API ParsedPatternInfo : public AffixPatternProvider, public UMemor ParsedPatternInfo() : state(this->pattern), currentSubpattern(nullptr) {} - ~ParsedPatternInfo() U_OVERRIDE = default; + ~ParsedPatternInfo() override = default; // Need to declare this explicitly because of the destructor - ParsedPatternInfo& operator=(ParsedPatternInfo&& src) U_NOEXCEPT = default; + ParsedPatternInfo& operator=(ParsedPatternInfo&& src) noexcept = default; static int32_t getLengthFromEndpoints(const Endpoints& endpoints); - char16_t charAt(int32_t flags, int32_t index) const U_OVERRIDE; + char16_t charAt(int32_t flags, int32_t index) const override; + + int32_t length(int32_t flags) const override; - int32_t length(int32_t flags) const U_OVERRIDE; + UnicodeString getString(int32_t flags) const override; - UnicodeString getString(int32_t flags) const U_OVERRIDE; + bool positiveHasPlusSign() const override; - bool positiveHasPlusSign() const U_OVERRIDE; + bool hasNegativeSubpattern() const override; - bool hasNegativeSubpattern() const U_OVERRIDE; + bool negativeHasMinusSign() const override; - bool negativeHasMinusSign() const U_OVERRIDE; + bool hasCurrencySign() const override; - bool hasCurrencySign() const U_OVERRIDE; + bool containsSymbolType(AffixPatternType type, UErrorCode& status) const override; - bool containsSymbolType(AffixPatternType type, UErrorCode& status) const U_OVERRIDE; + bool hasBody() const override; - bool hasBody() const U_OVERRIDE; + bool currencyAsDecimal() const override; private: struct U_I18N_API ParserState { @@ -100,15 +115,20 @@ struct U_I18N_API ParsedPatternInfo : public AffixPatternProvider, public UMemor explicit ParserState(const UnicodeString& _pattern) : pattern(_pattern) {} - ParserState& operator=(ParserState&& src) U_NOEXCEPT { + ParserState& operator=(ParserState&& src) noexcept { // Leave pattern reference alone; it will continue to point to the same place in memory, // which gets overwritten by ParsedPatternInfo's implicit move assignment. offset = src.offset; return *this; } + /** Returns the next code point, or -1 if string is too short. */ UChar32 peek(); + /** Returns the code point after the next code point, or -1 if string is too short. */ + UChar32 peek2(); + + /** Returns the next code point and then steps forward. */ UChar32 next(); // TODO: We don't currently do anything with the message string. @@ -233,7 +253,7 @@ class U_I18N_API PatternStringUtils { * * This test is needed for both NumberPropertyMapper::oldToNew and * PatternStringUtils::propertiesToPatternString. In Java it cannot be - * exported by NumberPropertyMapper (package provate) so it is in + * exported by NumberPropertyMapper (package private) so it is in * PatternStringUtils, do the same in C. * * @param roundIncr @@ -295,10 +315,15 @@ class U_I18N_API PatternStringUtils { * substitution, and plural forms for CurrencyPluralInfo. */ static void patternInfoToStringBuilder(const AffixPatternProvider& patternInfo, bool isPrefix, - Signum signum, UNumberSignDisplay signDisplay, - StandardPlural::Form plural, bool perMilleReplacesPercent, + PatternSignType patternSignType, + bool approximately, + StandardPlural::Form plural, + bool perMilleReplacesPercent, + bool dropCurrencySymbols, UnicodeString& output); + static PatternSignType resolveSignDisplay(UNumberSignDisplay signDisplay, Signum signum); + private: /** @return The number of chars inserted. */ static int escapePaddingString(UnicodeString input, UnicodeString& output, int startIndex, diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_rounding.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_rounding.cpp index 612546408..e6bb509ff 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_rounding.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_rounding.cpp @@ -5,13 +5,17 @@ #if !UCONFIG_NO_FORMATTING +#include "charstr.h" #include "uassert.h" #include "unicode/numberformatter.h" #include "number_types.h" #include "number_decimalquantity.h" #include "double-conversion.h" #include "number_roundingutils.h" +#include "number_skeletons.h" +#include "number_decnum.h" #include "putilimp.h" +#include "string_segment.h" using namespace icu; using namespace icu::number; @@ -19,6 +23,38 @@ using namespace icu::number::impl; using double_conversion::DoubleToStringConverter; +using icu::StringSegment; + +void number::impl::parseIncrementOption(const StringSegment &segment, + Precision &outPrecision, + UErrorCode &status) { + // Need to do char <-> char16_t conversion... + U_ASSERT(U_SUCCESS(status)); + CharString buffer; + SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); + + // Utilize DecimalQuantity/decNumber to parse this for us. + DecimalQuantity dq; + UErrorCode localStatus = U_ZERO_ERROR; + dq.setToDecNumber({buffer.data(), buffer.length()}, localStatus); + if (U_FAILURE(localStatus) || dq.isNaN() || dq.isInfinite()) { + // throw new SkeletonSyntaxException("Invalid rounding increment", segment, e); + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return; + } + // Now we break apart the number into a mantissa and exponent (magnitude). + int32_t magnitude = dq.adjustToZeroScale(); + // setToDecNumber drops trailing zeros, so we search for the '.' manually. + for (int32_t i=0; i(length - point); -} - - Precision Precision::unlimited() { - return Precision(RND_NONE, {}, kDefaultMode); + return Precision(RND_NONE, {}); } FractionPrecision Precision::integer() { @@ -157,9 +165,27 @@ Precision Precision::minMaxSignificantDigits(int32_t minSignificantDigits, int32 } } +Precision Precision::trailingZeroDisplay(UNumberTrailingZeroDisplay trailingZeroDisplay) const { + Precision result(*this); // copy constructor + result.fTrailingZeroDisplay = trailingZeroDisplay; + return result; +} + IncrementPrecision Precision::increment(double roundingIncrement) { if (roundingIncrement > 0.0) { - return constructIncrement(roundingIncrement, 0); + DecimalQuantity dq; + dq.setToDouble(roundingIncrement); + dq.roundToInfinity(); + int32_t magnitude = dq.adjustToZeroScale(); + return constructIncrement(dq.toLong(), magnitude); + } else { + return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR}; + } +} + +IncrementPrecision Precision::incrementExact(uint64_t mantissa, int16_t magnitude) { + if (mantissa > 0.0) { + return constructIncrement(mantissa, magnitude); } else { return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR}; } @@ -169,10 +195,34 @@ CurrencyPrecision Precision::currency(UCurrencyUsage currencyUsage) { return constructCurrency(currencyUsage); } +Precision FractionPrecision::withSignificantDigits( + int32_t minSignificantDigits, + int32_t maxSignificantDigits, + UNumberRoundingPriority priority) const { + if (fType == RND_ERROR) { return *this; } // no-op in error state + if (minSignificantDigits >= 1 && + maxSignificantDigits >= minSignificantDigits && + maxSignificantDigits <= kMaxIntFracSig) { + return constructFractionSignificant( + *this, + minSignificantDigits, + maxSignificantDigits, + priority, + false); + } else { + return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR}; + } +} + Precision FractionPrecision::withMinDigits(int32_t minSignificantDigits) const { if (fType == RND_ERROR) { return *this; } // no-op in error state if (minSignificantDigits >= 1 && minSignificantDigits <= kMaxIntFracSig) { - return constructFractionSignificant(*this, minSignificantDigits, -1); + return constructFractionSignificant( + *this, + 1, + minSignificantDigits, + UNUM_ROUNDING_PRIORITY_RELAXED, + true); } else { return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR}; } @@ -181,7 +231,11 @@ Precision FractionPrecision::withMinDigits(int32_t minSignificantDigits) const { Precision FractionPrecision::withMaxDigits(int32_t maxSignificantDigits) const { if (fType == RND_ERROR) { return *this; } // no-op in error state if (maxSignificantDigits >= 1 && maxSignificantDigits <= kMaxIntFracSig) { - return constructFractionSignificant(*this, -1, maxSignificantDigits); + return constructFractionSignificant(*this, + 1, + maxSignificantDigits, + UNUM_ROUNDING_PRIORITY_STRICT, + true); } else { return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR}; } @@ -195,11 +249,11 @@ Precision Precision::withCurrency(const CurrencyUnit ¤cy, UErrorCode &stat double increment = ucurr_getRoundingIncrementForUsage(isoCode, fUnion.currencyUsage, &status); int32_t minMaxFrac = ucurr_getDefaultFractionDigitsForUsage( isoCode, fUnion.currencyUsage, &status); - if (increment != 0.0) { - return constructIncrement(increment, minMaxFrac); - } else { - return constructFraction(minMaxFrac, minMaxFrac); - } + Precision retval = (increment != 0.0) + ? Precision::increment(increment) + : static_cast(Precision::fixedFraction(minMaxFrac)); + retval.fTrailingZeroDisplay = fTrailingZeroDisplay; + return retval; } // Public method on CurrencyPrecision subclass @@ -215,7 +269,9 @@ Precision CurrencyPrecision::withCurrency(const CurrencyUnit ¤cy) const { Precision IncrementPrecision::withMinFraction(int32_t minFrac) const { if (fType == RND_ERROR) { return *this; } // no-op in error state if (minFrac >= 0 && minFrac <= kMaxIntFracSig) { - return constructIncrement(fUnion.increment.fIncrement, minFrac); + IncrementPrecision copy = *this; + copy.fUnion.increment.fMinFrac = minFrac; + return copy; } else { return {U_NUMBER_ARG_OUTOFBOUNDS_ERROR}; } @@ -229,7 +285,7 @@ FractionPrecision Precision::constructFraction(int32_t minFrac, int32_t maxFrac) settings.fMaxSig = -1; PrecisionUnion union_; union_.fracSig = settings; - return {RND_FRACTION, union_, kDefaultMode}; + return {RND_FRACTION, union_}; } Precision Precision::constructSignificant(int32_t minSig, int32_t maxSig) { @@ -240,48 +296,52 @@ Precision Precision::constructSignificant(int32_t minSig, int32_t maxSig) { settings.fMaxSig = static_cast(maxSig); PrecisionUnion union_; union_.fracSig = settings; - return {RND_SIGNIFICANT, union_, kDefaultMode}; + return {RND_SIGNIFICANT, union_}; } Precision -Precision::constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig) { +Precision::constructFractionSignificant( + const FractionPrecision &base, + int32_t minSig, + int32_t maxSig, + UNumberRoundingPriority priority, + bool retain) { FractionSignificantSettings settings = base.fUnion.fracSig; settings.fMinSig = static_cast(minSig); settings.fMaxSig = static_cast(maxSig); + settings.fPriority = priority; + settings.fRetain = retain; PrecisionUnion union_; union_.fracSig = settings; - return {RND_FRACTION_SIGNIFICANT, union_, kDefaultMode}; + return {RND_FRACTION_SIGNIFICANT, union_}; } -IncrementPrecision Precision::constructIncrement(double increment, int32_t minFrac) { +IncrementPrecision Precision::constructIncrement(uint64_t increment, digits_t magnitude) { IncrementSettings settings; // Note: For number formatting, fIncrement is used for RND_INCREMENT but not // RND_INCREMENT_ONE or RND_INCREMENT_FIVE. However, fIncrement is used in all // three when constructing a skeleton. settings.fIncrement = increment; - settings.fMinFrac = static_cast(minFrac); - // One of the few pre-computed quantities: - // Note: it is possible for minFrac to be more than maxFrac... (misleading) - int8_t singleDigit; - settings.fMaxFrac = roundingutils::doubleFractionLength(increment, &singleDigit); + settings.fIncrementMagnitude = magnitude; + settings.fMinFrac = magnitude > 0 ? 0 : -magnitude; PrecisionUnion union_; union_.increment = settings; - if (singleDigit == 1) { + if (increment == 1) { // NOTE: In C++, we must return the correct value type with the correct union. // It would be invalid to return a RND_FRACTION here because the methods on the // IncrementPrecision type assume that the union is backed by increment data. - return {RND_INCREMENT_ONE, union_, kDefaultMode}; - } else if (singleDigit == 5) { - return {RND_INCREMENT_FIVE, union_, kDefaultMode}; + return {RND_INCREMENT_ONE, union_}; + } else if (increment == 5) { + return {RND_INCREMENT_FIVE, union_}; } else { - return {RND_INCREMENT, union_, kDefaultMode}; + return {RND_INCREMENT, union_}; } } CurrencyPrecision Precision::constructCurrency(UCurrencyUsage usage) { PrecisionUnion union_; union_.currencyUsage = usage; - return {RND_CURRENCY, union_, kDefaultMode}; + return {RND_CURRENCY, union_}; } @@ -294,9 +354,7 @@ RoundingImpl::RoundingImpl(const Precision& precision, UNumberFormatRoundingMode } RoundingImpl RoundingImpl::passThrough() { - RoundingImpl retval; - retval.fPassThrough = true; - return retval; + return {}; } bool RoundingImpl::isSignificantDigits() const { @@ -304,7 +362,7 @@ bool RoundingImpl::isSignificantDigits() const { } int32_t -RoundingImpl::chooseMultiplierAndApply(number::impl::DecimalQuantity &input, const number::impl::MultiplierProducer &producer, +RoundingImpl::chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl::MultiplierProducer &producer, UErrorCode &status) { // Do not call this method with zero, NaN, or infinity. U_ASSERT(!input.isZeroish()); @@ -342,10 +400,14 @@ RoundingImpl::chooseMultiplierAndApply(number::impl::DecimalQuantity &input, con } /** This is the method that contains the actual rounding logic. */ -void RoundingImpl::apply(number::impl::DecimalQuantity &value, UErrorCode& status) const { +void RoundingImpl::apply(impl::DecimalQuantity &value, UErrorCode& status) const { + if (U_FAILURE(status)) { + return; + } if (fPassThrough) { return; } + int32_t resolvedMinFraction = 0; switch (fPrecision.fType) { case Precision::RND_BOGUS: case Precision::RND_ERROR: @@ -362,8 +424,8 @@ void RoundingImpl::apply(number::impl::DecimalQuantity &value, UErrorCode& statu getRoundingMagnitudeFraction(fPrecision.fUnion.fracSig.fMaxFrac), fRoundingMode, status); - value.setMinFraction( - uprv_max(0, -getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac))); + resolvedMinFraction = + uprv_max(0, -getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac)); break; case Precision::RND_SIGNIFICANT: @@ -371,8 +433,8 @@ void RoundingImpl::apply(number::impl::DecimalQuantity &value, UErrorCode& statu getRoundingMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMaxSig), fRoundingMode, status); - value.setMinFraction( - uprv_max(0, -getDisplayMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMinSig))); + resolvedMinFraction = + uprv_max(0, -getDisplayMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMinSig)); // Make sure that digits are displayed on zero. if (value.isZeroish() && fPrecision.fUnion.fracSig.fMinSig > 0) { value.setMinInteger(1); @@ -380,61 +442,108 @@ void RoundingImpl::apply(number::impl::DecimalQuantity &value, UErrorCode& statu break; case Precision::RND_FRACTION_SIGNIFICANT: { - int32_t displayMag = getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac); - int32_t roundingMag = getRoundingMagnitudeFraction(fPrecision.fUnion.fracSig.fMaxFrac); - if (fPrecision.fUnion.fracSig.fMinSig == -1) { - // Max Sig override - int32_t candidate = getRoundingMagnitudeSignificant( - value, - fPrecision.fUnion.fracSig.fMaxSig); - roundingMag = uprv_max(roundingMag, candidate); + // From ECMA-402: + /* + Let sResult be ToRawPrecision(...). + Let fResult be ToRawFixed(...). + If intlObj.[[RoundingType]] is morePrecision, then + If sResult.[[RoundingMagnitude]] ≤ fResult.[[RoundingMagnitude]], then + Let result be sResult. + Else, + Let result be fResult. + Else, + Assert: intlObj.[[RoundingType]] is lessPrecision. + If sResult.[[RoundingMagnitude]] ≤ fResult.[[RoundingMagnitude]], then + Let result be fResult. + Else, + Let result be sResult. + */ + + int32_t roundingMag1 = getRoundingMagnitudeFraction(fPrecision.fUnion.fracSig.fMaxFrac); + int32_t roundingMag2 = getRoundingMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMaxSig); + int32_t roundingMag; + if (fPrecision.fUnion.fracSig.fPriority == UNUM_ROUNDING_PRIORITY_RELAXED) { + roundingMag = uprv_min(roundingMag1, roundingMag2); + } else { + roundingMag = uprv_max(roundingMag1, roundingMag2); + } + if (!value.isZeroish()) { + int32_t upperMag = value.getMagnitude(); + value.roundToMagnitude(roundingMag, fRoundingMode, status); + if (!value.isZeroish() && value.getMagnitude() != upperMag && roundingMag1 == roundingMag2) { + // roundingMag2 needs to be the magnitude after rounding + roundingMag2 += 1; + } + } + + int32_t displayMag1 = getDisplayMagnitudeFraction(fPrecision.fUnion.fracSig.fMinFrac); + int32_t displayMag2 = getDisplayMagnitudeSignificant(value, fPrecision.fUnion.fracSig.fMinSig); + int32_t displayMag; + if (fPrecision.fUnion.fracSig.fRetain) { + // withMinDigits + withMaxDigits + displayMag = uprv_min(displayMag1, displayMag2); + } else if (fPrecision.fUnion.fracSig.fPriority == UNUM_ROUNDING_PRIORITY_RELAXED) { + if (roundingMag2 <= roundingMag1) { + displayMag = displayMag2; + } else { + displayMag = displayMag1; + } } else { - // Min Sig override - int32_t candidate = getDisplayMagnitudeSignificant( - value, - fPrecision.fUnion.fracSig.fMinSig); - roundingMag = uprv_min(roundingMag, candidate); + U_ASSERT(fPrecision.fUnion.fracSig.fPriority == UNUM_ROUNDING_PRIORITY_STRICT); + if (roundingMag2 <= roundingMag1) { + displayMag = displayMag1; + } else { + displayMag = displayMag2; + } } - value.roundToMagnitude(roundingMag, fRoundingMode, status); - value.setMinFraction(uprv_max(0, -displayMag)); + resolvedMinFraction = uprv_max(0, -displayMag); + break; } case Precision::RND_INCREMENT: value.roundToIncrement( fPrecision.fUnion.increment.fIncrement, + fPrecision.fUnion.increment.fIncrementMagnitude, fRoundingMode, status); - value.setMinFraction(fPrecision.fUnion.increment.fMinFrac); + resolvedMinFraction = fPrecision.fUnion.increment.fMinFrac; break; case Precision::RND_INCREMENT_ONE: value.roundToMagnitude( - -fPrecision.fUnion.increment.fMaxFrac, + fPrecision.fUnion.increment.fIncrementMagnitude, fRoundingMode, status); - value.setMinFraction(fPrecision.fUnion.increment.fMinFrac); + resolvedMinFraction = fPrecision.fUnion.increment.fMinFrac; break; case Precision::RND_INCREMENT_FIVE: value.roundToNickel( - -fPrecision.fUnion.increment.fMaxFrac, + fPrecision.fUnion.increment.fIncrementMagnitude, fRoundingMode, status); - value.setMinFraction(fPrecision.fUnion.increment.fMinFrac); + resolvedMinFraction = fPrecision.fUnion.increment.fMinFrac; break; case Precision::RND_CURRENCY: // Call .withCurrency() before .apply()! - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; + } + + if (fPrecision.fTrailingZeroDisplay == UNUM_TRAILING_ZERO_AUTO || + // PLURAL_OPERAND_T returns fraction digits as an integer + value.getPluralOperand(PLURAL_OPERAND_T) != 0) { + value.setMinFraction(resolvedMinFraction); } } -void RoundingImpl::apply(number::impl::DecimalQuantity &value, int32_t minInt, UErrorCode /*status*/) { +void RoundingImpl::apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode /*status*/) { // This method is intended for the one specific purpose of helping print "00.000E0". + // Question: Is it useful to look at trailingZeroDisplay here? U_ASSERT(isSignificantDigits()); U_ASSERT(value.isZeroish()); value.setMinFraction(fPrecision.fUnion.fracSig.fMinSig - minInt); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_roundingutils.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_roundingutils.h index 66712a207..665712725 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_roundingutils.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_roundingutils.h @@ -8,6 +8,7 @@ #define __NUMBER_ROUNDINGUTILS_H__ #include "number_types.h" +#include "string_segment.h" U_NAMESPACE_BEGIN namespace number { @@ -44,6 +45,9 @@ enum Section { inline bool getRoundingDirection(bool isEven, bool isNegative, Section section, RoundingMode roundingMode, UErrorCode &status) { + if (U_FAILURE(status)) { + return false; + } switch (roundingMode) { case RoundingMode::UNUM_ROUND_UP: // round away from zero @@ -100,6 +104,45 @@ getRoundingDirection(bool isEven, bool isNegative, Section section, RoundingMode } break; + case RoundingMode::UNUM_ROUND_HALF_ODD: + switch (section) { + case SECTION_MIDPOINT: + return !isEven; + case SECTION_LOWER: + return true; + case SECTION_UPPER: + return false; + default: + break; + } + break; + + case RoundingMode::UNUM_ROUND_HALF_CEILING: + switch (section) { + case SECTION_MIDPOINT: + return isNegative; + case SECTION_LOWER: + return true; + case SECTION_UPPER: + return false; + default: + break; + } + break; + + case RoundingMode::UNUM_ROUND_HALF_FLOOR: + switch (section) { + case SECTION_MIDPOINT: + return !isNegative; + case SECTION_LOWER: + return true; + case SECTION_UPPER: + return false; + default: + break; + } + break; + default: break; } @@ -131,15 +174,6 @@ inline bool roundsAtMidpoint(int roundingMode) { } } -/** - * Computes the number of fraction digits in a double. Used for computing maxFrac for an increment. - * Calls into the DoubleToStringConverter library to do so. - * - * @param singleDigit An output parameter; set to a number if that is the - * only digit in the double, or -1 if there is more than one digit. - */ -digits_t doubleFractionLength(double input, int8_t* singleDigit); - } // namespace roundingutils @@ -150,7 +184,7 @@ digits_t doubleFractionLength(double input, int8_t* singleDigit); */ class RoundingImpl { public: - RoundingImpl() = default; // default constructor: leaves object in undefined state + RoundingImpl() = default; // defaults to pass-through rounder RoundingImpl(const Precision& precision, UNumberFormatRoundingMode roundingMode, const CurrencyUnit& currency, UErrorCode& status); @@ -175,20 +209,34 @@ class RoundingImpl { * @return The number of orders of magnitude the input was adjusted by this method. */ int32_t - chooseMultiplierAndApply(number::impl::DecimalQuantity &input, const number::impl::MultiplierProducer &producer, + chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl::MultiplierProducer &producer, UErrorCode &status); - void apply(number::impl::DecimalQuantity &value, UErrorCode &status) const; + void apply(impl::DecimalQuantity &value, UErrorCode &status) const; /** Version of {@link #apply} that obeys minInt constraints. Used for scientific notation compatibility mode. */ - void apply(number::impl::DecimalQuantity &value, int32_t minInt, UErrorCode status); + void apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode status); private: Precision fPrecision; UNumberFormatRoundingMode fRoundingMode; - bool fPassThrough; + bool fPassThrough = true; // default value + + // Permits access to fPrecision. + friend class units::UnitsRouter; + + // Permits access to fPrecision. + friend class UnitConversionHandler; }; +/** + * Parses Precision-related skeleton strings without knowledge of MacroProps + * - see blueprint_helpers::parseIncrementOption(). + * + * Referencing MacroProps means needing to pull in the .o files that have the + * destructors for the SymbolsWrapper, StringProp, and Scale classes. + */ +void parseIncrementOption(const StringSegment &segment, Precision &outPrecision, UErrorCode &status); } // namespace impl } // namespace number diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.cpp index f3de74141..d365d982d 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.cpp @@ -44,21 +44,21 @@ int32_t ScientificModifier::apply(FormattedStringBuilder &output, int32_t /*left i += output.insert( i, fHandler->fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kExponentialSymbol), - UNUM_EXPONENT_SYMBOL_FIELD, + {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SYMBOL_FIELD}, status); if (fExponent < 0 && fHandler->fSettings.fExponentSignDisplay != UNUM_SIGN_NEVER) { i += output.insert( i, fHandler->fSymbols ->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol), - UNUM_EXPONENT_SIGN_FIELD, + {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SIGN_FIELD}, status); } else if (fExponent >= 0 && fHandler->fSettings.fExponentSignDisplay == UNUM_SIGN_ALWAYS) { i += output.insert( i, fHandler->fSymbols ->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol), - UNUM_EXPONENT_SIGN_FIELD, + {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_SIGN_FIELD}, status); } // Append the exponent digits (using a simple inline algorithm) @@ -70,7 +70,7 @@ int32_t ScientificModifier::apply(FormattedStringBuilder &output, int32_t /*left i - j, d, *fHandler->fSymbols, - UNUM_EXPONENT_FIELD, + {UFIELD_CATEGORY_NUMBER, UNUM_EXPONENT_FIELD}, status); } return i - rightIndex; @@ -93,10 +93,10 @@ bool ScientificModifier::isStrong() const { return true; } -bool ScientificModifier::containsField(UNumberFormatFields field) const { +bool ScientificModifier::containsField(Field field) const { (void)field; // This method is not used for inner modifiers. - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } void ScientificModifier::getParameters(Parameters& output) const { @@ -149,6 +149,11 @@ void ScientificHandler::processQuantity(DecimalQuantity &quantity, MicroProps &m mod.set(exponent, this); micros.modInner = &mod; + // Change the exponent only after we select appropriate plural form + // for formatting purposes so that we preserve expected formatted + // string behavior. + quantity.adjustExponent(exponent); + // We already performed rounding. Do not perform it again. micros.rounder = RoundingImpl::passThrough(); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.h index 1c9ce1efa..22140a09a 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_scientific.h @@ -22,19 +22,19 @@ class U_I18N_API ScientificModifier : public UMemory, public Modifier { void set(int32_t exponent, const ScientificHandler *handler); int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const U_OVERRIDE; + UErrorCode &status) const override; - int32_t getPrefixLength() const U_OVERRIDE; + int32_t getPrefixLength() const override; - int32_t getCodePointCount() const U_OVERRIDE; + int32_t getCodePointCount() const override; - bool isStrong() const U_OVERRIDE; + bool isStrong() const override; - bool containsField(UNumberFormatFields field) const U_OVERRIDE; + bool containsField(Field field) const override; - void getParameters(Parameters& output) const U_OVERRIDE; + void getParameters(Parameters& output) const override; - bool semanticallyEquivalent(const Modifier& other) const U_OVERRIDE; + bool semanticallyEquivalent(const Modifier& other) const override; private: int32_t fExponent; @@ -47,12 +47,12 @@ class ScientificHandler : public UMemory, public MicroPropsGenerator, public Mul const MicroPropsGenerator *parent); void - processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const U_OVERRIDE; + processQuantity(DecimalQuantity &quantity, MicroProps µs, UErrorCode &status) const override; - int32_t getMultiplier(int32_t magnitude) const U_OVERRIDE; + int32_t getMultiplier(int32_t magnitude) const override; private: - const Notation::ScientificSettings& fSettings; + const Notation::ScientificSettings fSettings; const DecimalFormatSymbols *fSymbols; const MicroPropsGenerator *fParent; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_simple.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_simple.cpp new file mode 100644 index 000000000..a2af6be42 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_simple.cpp @@ -0,0 +1,255 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/numberformatter.h" +#include "unicode/simplenumberformatter.h" +#include "number_formatimpl.h" +#include "number_utils.h" +#include "number_patternmodifier.h" +#include "number_utypes.h" + +using namespace icu; +using namespace icu::number; +using namespace icu::number::impl; + + +SimpleNumber +SimpleNumber::forInt64(int64_t value, UErrorCode& status) { + if (U_FAILURE(status)) { + return SimpleNumber(); + } + auto results = new UFormattedNumberData(); + if (results == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return SimpleNumber(); + } + results->quantity.setToLong(value); + return SimpleNumber(results, status); +} + +SimpleNumber::SimpleNumber(UFormattedNumberData* data, UErrorCode& status) : fData(data) { + if (U_FAILURE(status)) { + return; + } + if (fData == nullptr) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } + if (fData->quantity.isNegative()) { + fSign = UNUM_SIMPLE_NUMBER_MINUS_SIGN; + } else { + fSign = UNUM_SIMPLE_NUMBER_NO_SIGN; + } +} + +void SimpleNumber::cleanup() { + delete fData; + fData = nullptr; +} + +void SimpleNumber::multiplyByPowerOfTen(int32_t power, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (fData == nullptr) { + status = U_INVALID_STATE_ERROR; + return; + } + fData->quantity.adjustMagnitude(power); +} + +void SimpleNumber::roundTo(int32_t position, UNumberFormatRoundingMode roundingMode, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (fData == nullptr) { + status = U_INVALID_STATE_ERROR; + return; + } + fData->quantity.roundToMagnitude(position, roundingMode, status); +} + +void SimpleNumber::setMinimumIntegerDigits(uint32_t position, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (fData == nullptr) { + status = U_INVALID_STATE_ERROR; + return; + } + fData->quantity.setMinInteger(position); +} + +void SimpleNumber::setMinimumFractionDigits(uint32_t position, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (fData == nullptr) { + status = U_INVALID_STATE_ERROR; + return; + } + fData->quantity.setMinFraction(position); +} + +void SimpleNumber::truncateStart(uint32_t position, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (fData == nullptr) { + status = U_INVALID_STATE_ERROR; + return; + } + fData->quantity.applyMaxInteger(position); +} + +void SimpleNumber::setSign(USimpleNumberSign sign, UErrorCode& status) { + if (U_FAILURE(status)) { + return; + } + if (fData == nullptr) { + status = U_INVALID_STATE_ERROR; + return; + } + fSign = sign; +} + + +void SimpleNumberFormatter::cleanup() { + delete fOwnedSymbols; + delete fMicros; + delete fPatternModifier; + fOwnedSymbols = nullptr; + fMicros = nullptr; + fPatternModifier = nullptr; +} + +SimpleNumberFormatter SimpleNumberFormatter::forLocale(const icu::Locale &locale, UErrorCode &status) { + return SimpleNumberFormatter::forLocaleAndGroupingStrategy(locale, UNUM_GROUPING_AUTO, status); +} + +SimpleNumberFormatter SimpleNumberFormatter::forLocaleAndGroupingStrategy( + const icu::Locale &locale, + UNumberGroupingStrategy groupingStrategy, + UErrorCode &status) { + SimpleNumberFormatter retval; + retval.fOwnedSymbols = new DecimalFormatSymbols(locale, status); + if (U_FAILURE(status)) { + return retval; + } + if (retval.fOwnedSymbols == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return retval; + } + retval.initialize(locale, *retval.fOwnedSymbols, groupingStrategy, status); + return retval; +} + + +SimpleNumberFormatter SimpleNumberFormatter::forLocaleAndSymbolsAndGroupingStrategy( + const icu::Locale &locale, + const DecimalFormatSymbols &symbols, + UNumberGroupingStrategy groupingStrategy, + UErrorCode &status) { + SimpleNumberFormatter retval; + retval.initialize(locale, symbols, groupingStrategy, status); + return retval; +} + + +void SimpleNumberFormatter::initialize( + const icu::Locale &locale, + const DecimalFormatSymbols &symbols, + UNumberGroupingStrategy groupingStrategy, + UErrorCode &status) { + if (U_FAILURE(status)) { + return; + } + + fMicros = new SimpleMicroProps(); + if (fMicros == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + fMicros->symbols = &symbols; + + auto pattern = utils::getPatternForStyle( + locale, + symbols.getNumberingSystemName(), + CLDR_PATTERN_STYLE_DECIMAL, + status); + if (U_FAILURE(status)) { + return; + } + + ParsedPatternInfo patternInfo; + PatternParser::parseToPatternInfo(UnicodeString(pattern), patternInfo, status); + if (U_FAILURE(status)) { + return; + } + + auto grouper = Grouper::forStrategy(groupingStrategy); + grouper.setLocaleData(patternInfo, locale); + fMicros->grouping = grouper; + + MutablePatternModifier patternModifier(false); + patternModifier.setPatternInfo(&patternInfo, kUndefinedField); + patternModifier.setPatternAttributes(UNUM_SIGN_EXCEPT_ZERO, false, false); + patternModifier.setSymbols(fMicros->symbols, {}, UNUM_UNIT_WIDTH_SHORT, nullptr, status); + + fPatternModifier = new AdoptingSignumModifierStore(patternModifier.createImmutableForPlural(StandardPlural::COUNT, status)); + + fGroupingStrategy = groupingStrategy; + return; +} + +FormattedNumber SimpleNumberFormatter::format(SimpleNumber value, UErrorCode &status) const { + formatImpl(value.fData, value.fSign, status); + + // Do not save the results object if we encountered a failure. + if (U_SUCCESS(status)) { + auto temp = value.fData; + value.fData = nullptr; + return FormattedNumber(temp); + } else { + return FormattedNumber(status); + } +} + +void SimpleNumberFormatter::formatImpl(UFormattedNumberData* data, USimpleNumberSign sign, UErrorCode &status) const { + if (U_FAILURE(status)) { + return; + } + if (data == nullptr) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } + if (fPatternModifier == nullptr || fMicros == nullptr) { + status = U_INVALID_STATE_ERROR; + return; + } + + Signum signum; + if (sign == UNUM_SIMPLE_NUMBER_MINUS_SIGN) { + signum = SIGNUM_NEG; + } else if (sign == UNUM_SIMPLE_NUMBER_PLUS_SIGN) { + signum = SIGNUM_POS; + } else { + signum = SIGNUM_POS_ZERO; + } + + const Modifier* modifier = (*fPatternModifier)[signum]; + auto length = NumberFormatterImpl::writeNumber( + *fMicros, + data->quantity, + data->getStringRef(), + 0, + status); + length += modifier->apply(data->getStringRef(), 0, length, status); + data->getStringRef().writeTerminator(status); +} + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.cpp index 4b4043ab0..ef3befbff 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.cpp @@ -7,11 +7,10 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "number_decnum.h" +#include "number_roundingutils.h" #include "number_skeletons.h" #include "umutex.h" #include "ucln_in.h" @@ -23,6 +22,9 @@ #include "uinvchar.h" #include "charstr.h" #include "string_segment.h" +#include "unicode/errorcode.h" +#include "util.h" +#include "measunit_impl.h" using namespace icu; using namespace icu::number; @@ -31,7 +33,7 @@ using namespace icu::number::impl::skeleton; namespace { -icu::UInitOnce gNumberSkeletonsInitOnce = U_INITONCE_INITIALIZER; +icu::UInitOnce gNumberSkeletonsInitOnce {}; char16_t* kSerializedStemTrie = nullptr; @@ -39,7 +41,7 @@ UBool U_CALLCONV cleanupNumberSkeletons() { uprv_free(kSerializedStemTrie); kSerializedStemTrie = nullptr; gNumberSkeletonsInitOnce.reset(); - return TRUE; + return true; } void U_CALLCONV initNumberSkeletons(UErrorCode& status) { @@ -66,9 +68,13 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) { b.add(u"rounding-mode-down", STEM_ROUNDING_MODE_DOWN, status); b.add(u"rounding-mode-up", STEM_ROUNDING_MODE_UP, status); b.add(u"rounding-mode-half-even", STEM_ROUNDING_MODE_HALF_EVEN, status); + b.add(u"rounding-mode-half-odd", STEM_ROUNDING_MODE_HALF_ODD, status); + b.add(u"rounding-mode-half-ceiling", STEM_ROUNDING_MODE_HALF_CEILING, status); + b.add(u"rounding-mode-half-floor", STEM_ROUNDING_MODE_HALF_FLOOR, status); b.add(u"rounding-mode-half-down", STEM_ROUNDING_MODE_HALF_DOWN, status); b.add(u"rounding-mode-half-up", STEM_ROUNDING_MODE_HALF_UP, status); b.add(u"rounding-mode-unnecessary", STEM_ROUNDING_MODE_UNNECESSARY, status); + b.add(u"integer-width-trunc", STEM_INTEGER_WIDTH_TRUNC, status); b.add(u"group-off", STEM_GROUP_OFF, status); b.add(u"group-min2", STEM_GROUP_MIN2, status); b.add(u"group-auto", STEM_GROUP_AUTO, status); @@ -79,6 +85,8 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) { b.add(u"unit-width-short", STEM_UNIT_WIDTH_SHORT, status); b.add(u"unit-width-full-name", STEM_UNIT_WIDTH_FULL_NAME, status); b.add(u"unit-width-iso-code", STEM_UNIT_WIDTH_ISO_CODE, status); + b.add(u"unit-width-formal", STEM_UNIT_WIDTH_FORMAL, status); + b.add(u"unit-width-variant", STEM_UNIT_WIDTH_VARIANT, status); b.add(u"unit-width-hidden", STEM_UNIT_WIDTH_HIDDEN, status); b.add(u"sign-auto", STEM_SIGN_AUTO, status); b.add(u"sign-always", STEM_SIGN_ALWAYS, status); @@ -87,6 +95,8 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) { b.add(u"sign-accounting-always", STEM_SIGN_ACCOUNTING_ALWAYS, status); b.add(u"sign-except-zero", STEM_SIGN_EXCEPT_ZERO, status); b.add(u"sign-accounting-except-zero", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status); + b.add(u"sign-negative", STEM_SIGN_NEGATIVE, status); + b.add(u"sign-accounting-negative", STEM_SIGN_ACCOUNTING_NEGATIVE, status); b.add(u"decimal-auto", STEM_DECIMAL_AUTO, status); b.add(u"decimal-always", STEM_DECIMAL_ALWAYS, status); if (U_FAILURE(status)) { return; } @@ -95,12 +105,32 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) { b.add(u"precision-increment", STEM_PRECISION_INCREMENT, status); b.add(u"measure-unit", STEM_MEASURE_UNIT, status); b.add(u"per-measure-unit", STEM_PER_MEASURE_UNIT, status); + b.add(u"unit", STEM_UNIT, status); + b.add(u"usage", STEM_UNIT_USAGE, status); b.add(u"currency", STEM_CURRENCY, status); b.add(u"integer-width", STEM_INTEGER_WIDTH, status); b.add(u"numbering-system", STEM_NUMBERING_SYSTEM, status); b.add(u"scale", STEM_SCALE, status); if (U_FAILURE(status)) { return; } + // Section 3 (concise tokens): + b.add(u"K", STEM_COMPACT_SHORT, status); + b.add(u"KK", STEM_COMPACT_LONG, status); + b.add(u"%", STEM_PERCENT, status); + b.add(u"%x100", STEM_PERCENT_100, status); + b.add(u",_", STEM_GROUP_OFF, status); + b.add(u",?", STEM_GROUP_MIN2, status); + b.add(u",!", STEM_GROUP_ON_ALIGNED, status); + b.add(u"+!", STEM_SIGN_ALWAYS, status); + b.add(u"+_", STEM_SIGN_NEVER, status); + b.add(u"()", STEM_SIGN_ACCOUNTING, status); + b.add(u"()!", STEM_SIGN_ACCOUNTING_ALWAYS, status); + b.add(u"+?", STEM_SIGN_EXCEPT_ZERO, status); + b.add(u"()?", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status); + b.add(u"+-", STEM_SIGN_NEGATIVE, status); + b.add(u"()-", STEM_SIGN_ACCOUNTING_NEGATIVE, status); + if (U_FAILURE(status)) { return; } + // Build the CharsTrie // TODO: Use SLOW or FAST here? UnicodeString result; @@ -131,21 +161,6 @@ UPRV_BLOCK_MACRO_BEGIN { \ } UPRV_BLOCK_MACRO_END -#define SKELETON_UCHAR_TO_CHAR(dest, src, start, end, status) (void)(dest); \ -UPRV_BLOCK_MACRO_BEGIN { \ - UErrorCode conversionStatus = U_ZERO_ERROR; \ - (dest).appendInvariantChars({FALSE, (src).getBuffer() + (start), (end) - (start)}, conversionStatus); \ - if (conversionStatus == U_INVARIANT_CONVERSION_ERROR) { \ - /* Don't propagate the invariant conversion error; it is a skeleton syntax error */ \ - (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \ - return; \ - } else if (U_FAILURE(conversionStatus)) { \ - (status) = conversionStatus; \ - return; \ - } \ -} UPRV_BLOCK_MACRO_END - - } // anonymous namespace @@ -162,23 +177,20 @@ Notation stem_to_object::notation(skeleton::StemEnum stem) { case STEM_NOTATION_SIMPLE: return Notation::simple(); default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } MeasureUnit stem_to_object::unit(skeleton::StemEnum stem) { switch (stem) { case STEM_BASE_UNIT: - // Slicing is okay - return NoUnit::base(); // NOLINT + return MeasureUnit(); case STEM_PERCENT: - // Slicing is okay - return NoUnit::percent(); // NOLINT + return MeasureUnit::getPercent(); case STEM_PERMILLE: - // Slicing is okay - return NoUnit::permille(); // NOLINT + return MeasureUnit::getPermille(); default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -193,7 +205,7 @@ Precision stem_to_object::precision(skeleton::StemEnum stem) { case STEM_PRECISION_CURRENCY_CASH: return Precision::currency(UCURR_USAGE_CASH); default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -209,6 +221,12 @@ UNumberFormatRoundingMode stem_to_object::roundingMode(skeleton::StemEnum stem) return UNUM_ROUND_UP; case STEM_ROUNDING_MODE_HALF_EVEN: return UNUM_ROUND_HALFEVEN; + case STEM_ROUNDING_MODE_HALF_ODD: + return UNUM_ROUND_HALF_ODD; + case STEM_ROUNDING_MODE_HALF_CEILING: + return UNUM_ROUND_HALF_CEILING; + case STEM_ROUNDING_MODE_HALF_FLOOR: + return UNUM_ROUND_HALF_FLOOR; case STEM_ROUNDING_MODE_HALF_DOWN: return UNUM_ROUND_HALFDOWN; case STEM_ROUNDING_MODE_HALF_UP: @@ -216,7 +234,7 @@ UNumberFormatRoundingMode stem_to_object::roundingMode(skeleton::StemEnum stem) case STEM_ROUNDING_MODE_UNNECESSARY: return UNUM_ROUND_UNNECESSARY; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -247,6 +265,10 @@ UNumberUnitWidth stem_to_object::unitWidth(skeleton::StemEnum stem) { return UNUM_UNIT_WIDTH_FULL_NAME; case STEM_UNIT_WIDTH_ISO_CODE: return UNUM_UNIT_WIDTH_ISO_CODE; + case STEM_UNIT_WIDTH_FORMAL: + return UNUM_UNIT_WIDTH_FORMAL; + case STEM_UNIT_WIDTH_VARIANT: + return UNUM_UNIT_WIDTH_VARIANT; case STEM_UNIT_WIDTH_HIDDEN: return UNUM_UNIT_WIDTH_HIDDEN; default: @@ -270,6 +292,10 @@ UNumberSignDisplay stem_to_object::signDisplay(skeleton::StemEnum stem) { return UNUM_SIGN_EXCEPT_ZERO; case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO: return UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO; + case STEM_SIGN_NEGATIVE: + return UNUM_SIGN_NEGATIVE; + case STEM_SIGN_ACCOUNTING_NEGATIVE: + return UNUM_SIGN_ACCOUNTING_NEGATIVE; default: return UNUM_SIGN_COUNT; // for objects, throw; for enums, return COUNT } @@ -304,6 +330,15 @@ void enum_to_stem_string::roundingMode(UNumberFormatRoundingMode value, UnicodeS case UNUM_ROUND_HALFEVEN: sb.append(u"rounding-mode-half-even", -1); break; + case UNUM_ROUND_HALF_ODD: + sb.append(u"rounding-mode-half-odd", -1); + break; + case UNUM_ROUND_HALF_CEILING: + sb.append(u"rounding-mode-half-ceiling", -1); + break; + case UNUM_ROUND_HALF_FLOOR: + sb.append(u"rounding-mode-half-floor", -1); + break; case UNUM_ROUND_HALFDOWN: sb.append(u"rounding-mode-half-down", -1); break; @@ -314,7 +349,7 @@ void enum_to_stem_string::roundingMode(UNumberFormatRoundingMode value, UnicodeS sb.append(u"rounding-mode-unnecessary", -1); break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -336,7 +371,7 @@ void enum_to_stem_string::groupingStrategy(UNumberGroupingStrategy value, Unicod sb.append(u"group-thousands", -1); break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -354,11 +389,17 @@ void enum_to_stem_string::unitWidth(UNumberUnitWidth value, UnicodeString& sb) { case UNUM_UNIT_WIDTH_ISO_CODE: sb.append(u"unit-width-iso-code", -1); break; + case UNUM_UNIT_WIDTH_FORMAL: + sb.append(u"unit-width-formal", -1); + break; + case UNUM_UNIT_WIDTH_VARIANT: + sb.append(u"unit-width-variant", -1); + break; case UNUM_UNIT_WIDTH_HIDDEN: sb.append(u"unit-width-hidden", -1); break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -385,8 +426,14 @@ void enum_to_stem_string::signDisplay(UNumberSignDisplay value, UnicodeString& s case UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO: sb.append(u"sign-accounting-except-zero", -1); break; + case UNUM_SIGN_NEGATIVE: + sb.append(u"sign-negative", -1); + break; + case UNUM_SIGN_ACCOUNTING_NEGATIVE: + sb.append(u"sign-accounting-negative", -1); + break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -400,7 +447,7 @@ enum_to_stem_string::decimalSeparatorDisplay(UNumberDecimalSeparatorDisplay valu sb.append(u"decimal-always", -1); break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } @@ -452,6 +499,7 @@ UnicodeString skeleton::generate(const MacroProps& macros, UErrorCode& status) { MacroProps skeleton::parseSkeleton( const UnicodeString& skeletonString, int32_t& errOffset, UErrorCode& status) { U_ASSERT(U_SUCCESS(status)); + U_ASSERT(kSerializedStemTrie != nullptr); // Add a trailing whitespace to the end of the skeleton string to make code cleaner. UnicodeString tempSkeletonString(skeletonString); @@ -531,6 +579,8 @@ MacroProps skeleton::parseSkeleton( case STATE_INCREMENT_PRECISION: case STATE_MEASURE_UNIT: case STATE_PER_MEASURE_UNIT: + case STATE_IDENTIFIER_UNIT: + case STATE_UNIT_USAGE: case STATE_CURRENCY_UNIT: case STATE_INTEGER_WIDTH: case STATE_NUMBERING_SYSTEM: @@ -556,15 +606,25 @@ MacroProps skeleton::parseSkeleton( ParseState skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, SeenMacroProps& seen, MacroProps& macros, UErrorCode& status) { + U_ASSERT(U_SUCCESS(status)); + // First check for "blueprint" stems, which start with a "signal char" switch (segment.charAt(0)) { case u'.': - CHECK_NULL(seen, precision, status); + CHECK_NULL(seen, precision, status); blueprint_helpers::parseFractionStem(segment, macros, status); return STATE_FRACTION_PRECISION; case u'@': - CHECK_NULL(seen, precision, status); + CHECK_NULL(seen, precision, status); blueprint_helpers::parseDigitsStem(segment, macros, status); + return STATE_PRECISION; + case u'E': + CHECK_NULL(seen, notation, status); + blueprint_helpers::parseScientificStem(segment, macros, status); + return STATE_NULL; + case u'0': + CHECK_NULL(seen, integerWidth, status); + blueprint_helpers::parseIntegerStem(segment, macros, status); return STATE_NULL; default: break; @@ -589,7 +649,7 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se case STEM_SCIENTIFIC: case STEM_ENGINEERING: case STEM_NOTATION_SIMPLE: - CHECK_NULL(seen, notation, status); + CHECK_NULL(seen, notation, status); macros.notation = stem_to_object::notation(stem); switch (stem) { case STEM_SCIENTIFIC: @@ -602,21 +662,28 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se case STEM_BASE_UNIT: case STEM_PERCENT: case STEM_PERMILLE: - CHECK_NULL(seen, unit, status); + CHECK_NULL(seen, unit, status); macros.unit = stem_to_object::unit(stem); return STATE_NULL; + case STEM_PERCENT_100: + CHECK_NULL(seen, scale, status); + CHECK_NULL(seen, unit, status); + macros.scale = Scale::powerOfTen(2); + macros.unit = NoUnit::percent(); + return STATE_NULL; + case STEM_PRECISION_INTEGER: case STEM_PRECISION_UNLIMITED: case STEM_PRECISION_CURRENCY_STANDARD: case STEM_PRECISION_CURRENCY_CASH: - CHECK_NULL(seen, precision, status); + CHECK_NULL(seen, precision, status); macros.precision = stem_to_object::precision(stem); switch (stem) { case STEM_PRECISION_INTEGER: return STATE_FRACTION_PRECISION; // allows for "precision-integer/@##" default: - return STATE_NULL; + return STATE_PRECISION; } case STEM_ROUNDING_MODE_CEILING: @@ -624,24 +691,32 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se case STEM_ROUNDING_MODE_DOWN: case STEM_ROUNDING_MODE_UP: case STEM_ROUNDING_MODE_HALF_EVEN: + case STEM_ROUNDING_MODE_HALF_ODD: + case STEM_ROUNDING_MODE_HALF_CEILING: + case STEM_ROUNDING_MODE_HALF_FLOOR: case STEM_ROUNDING_MODE_HALF_DOWN: case STEM_ROUNDING_MODE_HALF_UP: case STEM_ROUNDING_MODE_UNNECESSARY: - CHECK_NULL(seen, roundingMode, status); + CHECK_NULL(seen, roundingMode, status); macros.roundingMode = stem_to_object::roundingMode(stem); return STATE_NULL; + case STEM_INTEGER_WIDTH_TRUNC: + CHECK_NULL(seen, integerWidth, status); + macros.integerWidth = IntegerWidth::zeroFillTo(0).truncateAt(0); + return STATE_NULL; + case STEM_GROUP_OFF: case STEM_GROUP_MIN2: case STEM_GROUP_AUTO: case STEM_GROUP_ON_ALIGNED: case STEM_GROUP_THOUSANDS: - CHECK_NULL(seen, grouper, status); + CHECK_NULL(seen, grouper, status); macros.grouper = Grouper::forStrategy(stem_to_object::groupingStrategy(stem)); return STATE_NULL; case STEM_LATIN: - CHECK_NULL(seen, symbols, status); + CHECK_NULL(seen, symbols, status); macros.symbols.setTo(NumberingSystem::createInstanceByName("latn", status)); return STATE_NULL; @@ -649,8 +724,10 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se case STEM_UNIT_WIDTH_SHORT: case STEM_UNIT_WIDTH_FULL_NAME: case STEM_UNIT_WIDTH_ISO_CODE: + case STEM_UNIT_WIDTH_FORMAL: + case STEM_UNIT_WIDTH_VARIANT: case STEM_UNIT_WIDTH_HIDDEN: - CHECK_NULL(seen, unitWidth, status); + CHECK_NULL(seen, unitWidth, status); macros.unitWidth = stem_to_object::unitWidth(stem); return STATE_NULL; @@ -661,53 +738,66 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se case STEM_SIGN_ACCOUNTING_ALWAYS: case STEM_SIGN_EXCEPT_ZERO: case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO: - CHECK_NULL(seen, sign, status); + case STEM_SIGN_NEGATIVE: + case STEM_SIGN_ACCOUNTING_NEGATIVE: + CHECK_NULL(seen, sign, status); macros.sign = stem_to_object::signDisplay(stem); return STATE_NULL; case STEM_DECIMAL_AUTO: case STEM_DECIMAL_ALWAYS: - CHECK_NULL(seen, decimal, status); + CHECK_NULL(seen, decimal, status); macros.decimal = stem_to_object::decimalSeparatorDisplay(stem); return STATE_NULL; - // Stems requiring an option: + // Stems requiring an option: case STEM_PRECISION_INCREMENT: - CHECK_NULL(seen, precision, status); + CHECK_NULL(seen, precision, status); return STATE_INCREMENT_PRECISION; case STEM_MEASURE_UNIT: - CHECK_NULL(seen, unit, status); + CHECK_NULL(seen, unit, status); return STATE_MEASURE_UNIT; case STEM_PER_MEASURE_UNIT: - CHECK_NULL(seen, perUnit, status); + CHECK_NULL(seen, perUnit, status); return STATE_PER_MEASURE_UNIT; + case STEM_UNIT: + CHECK_NULL(seen, unit, status); + CHECK_NULL(seen, perUnit, status); + return STATE_IDENTIFIER_UNIT; + + case STEM_UNIT_USAGE: + CHECK_NULL(seen, usage, status); + return STATE_UNIT_USAGE; + case STEM_CURRENCY: - CHECK_NULL(seen, unit, status); + CHECK_NULL(seen, unit, status); + CHECK_NULL(seen, perUnit, status); return STATE_CURRENCY_UNIT; case STEM_INTEGER_WIDTH: - CHECK_NULL(seen, integerWidth, status); + CHECK_NULL(seen, integerWidth, status); return STATE_INTEGER_WIDTH; case STEM_NUMBERING_SYSTEM: - CHECK_NULL(seen, symbols, status); + CHECK_NULL(seen, symbols, status); return STATE_NUMBERING_SYSTEM; case STEM_SCALE: - CHECK_NULL(seen, scale, status); + CHECK_NULL(seen, scale, status); return STATE_SCALE; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } ParseState skeleton::parseOption(ParseState stem, const StringSegment& segment, MacroProps& macros, UErrorCode& status) { + U_ASSERT(U_SUCCESS(status)); ///// Required options: ///// @@ -721,9 +811,15 @@ ParseState skeleton::parseOption(ParseState stem, const StringSegment& segment, case STATE_PER_MEASURE_UNIT: blueprint_helpers::parseMeasurePerUnitOption(segment, macros, status); return STATE_NULL; + case STATE_IDENTIFIER_UNIT: + blueprint_helpers::parseIdentifierUnitOption(segment, macros, status); + return STATE_NULL; + case STATE_UNIT_USAGE: + blueprint_helpers::parseUnitUsageOption(segment, macros, status); + return STATE_NULL; case STATE_INCREMENT_PRECISION: blueprint_helpers::parseIncrementOption(segment, macros, status); - return STATE_NULL; + return STATE_PRECISION; case STATE_INTEGER_WIDTH: blueprint_helpers::parseIntegerWidthOption(segment, macros, status); return STATE_NULL; @@ -763,6 +859,22 @@ ParseState skeleton::parseOption(ParseState stem, const StringSegment& segment, switch (stem) { case STATE_FRACTION_PRECISION: if (blueprint_helpers::parseFracSigOption(segment, macros, status)) { + return STATE_PRECISION; + } + if (U_FAILURE(status)) { + return {}; + } + // If the fracSig option was not found, try normal precision options. + stem = STATE_PRECISION; + break; + default: + break; + } + + // Trailing zeros option + switch (stem) { + case STATE_PRECISION: + if (blueprint_helpers::parseTrailingZeroOption(segment, macros, status)) { return STATE_NULL; } if (U_FAILURE(status)) { @@ -791,7 +903,7 @@ void GeneratorHelpers::generateSkeleton(const MacroProps& macros, UnicodeString& sb.append(u' '); } if (U_FAILURE(status)) { return; } - if (GeneratorHelpers::perUnit(macros, sb, status)) { + if (GeneratorHelpers::usage(macros, sb, status)) { sb.append(u' '); } if (U_FAILURE(status)) { return; } @@ -837,15 +949,15 @@ void GeneratorHelpers::generateSkeleton(const MacroProps& macros, UnicodeString& status = U_UNSUPPORTED_ERROR; return; } - if (macros.affixProvider != nullptr) { + if (macros.unitDisplayCase.isSet()) { status = U_UNSUPPORTED_ERROR; return; } - if (macros.rules != nullptr) { + if (macros.affixProvider != nullptr) { status = U_UNSUPPORTED_ERROR; return; } - if (macros.currencySymbols != nullptr) { + if (macros.rules != nullptr) { status = U_UNSUPPORTED_ERROR; return; } @@ -859,7 +971,7 @@ void GeneratorHelpers::generateSkeleton(const MacroProps& macros, UnicodeString& bool blueprint_helpers::parseExponentWidthOption(const StringSegment& segment, MacroProps& macros, UErrorCode&) { - if (segment.charAt(0) != u'+') { + if (!isWildcardChar(segment.charAt(0))) { return false; } int32_t offset = 1; @@ -881,7 +993,7 @@ bool blueprint_helpers::parseExponentWidthOption(const StringSegment& segment, M void blueprint_helpers::generateExponentWidthOption(int32_t minExponentDigits, UnicodeString& sb, UErrorCode&) { - sb.append(u'+'); + sb.append(kWildcardChar); appendMultiple(sb, u'e', minExponentDigits); } @@ -910,7 +1022,7 @@ void blueprint_helpers::parseCurrencyOption(const StringSegment& segment, MacroP status = U_NUMBER_SKELETON_SYNTAX_ERROR; return; } - const UChar* currencyCode = segment.toTempUnicodeString().getBuffer(); + const char16_t* currencyCode = segment.toTempUnicodeString().getBuffer(); UErrorCode localStatus = U_ZERO_ERROR; CurrencyUnit currency(currencyCode, localStatus); if (U_FAILURE(localStatus)) { @@ -930,6 +1042,7 @@ blueprint_helpers::generateCurrencyOption(const CurrencyUnit& currency, UnicodeS void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { + U_ASSERT(U_SUCCESS(status)); const UnicodeString stemString = segment.toTempUnicodeString(); // NOTE: The category (type) of the unit is guaranteed to be a valid subtag (alphanumeric) @@ -944,15 +1057,14 @@ void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, Mac return; } - // Need to do char <-> UChar conversion... - U_ASSERT(U_SUCCESS(status)); + // Need to do char <-> char16_t conversion... CharString type; SKELETON_UCHAR_TO_CHAR(type, stemString, 0, firstHyphen, status); CharString subType; SKELETON_UCHAR_TO_CHAR(subType, stemString, firstHyphen + 1, stemString.length(), status); - // Note: the largest type as of this writing (March 2018) is "volume", which has 24 units. - static constexpr int32_t CAPACITY = 30; + // Note: the largest type as of this writing (Aug 2020) is "volume", which has 33 units. + static constexpr int32_t CAPACITY = 40; MeasureUnit units[CAPACITY]; UErrorCode localStatus = U_ZERO_ERROR; int32_t numUnits = MeasureUnit::getAvailable(type.data(), units, CAPACITY, localStatus); @@ -973,17 +1085,9 @@ void blueprint_helpers::parseMeasureUnitOption(const StringSegment& segment, Mac status = U_NUMBER_SKELETON_SYNTAX_ERROR; } -void blueprint_helpers::generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb, - UErrorCode&) { - // Need to do char <-> UChar conversion... - sb.append(UnicodeString(measureUnit.getType(), -1, US_INV)); - sb.append(u'-'); - sb.append(UnicodeString(measureUnit.getSubtype(), -1, US_INV)); -} - void blueprint_helpers::parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { - // A little bit of a hack: safe the current unit (numerator), call the main measure unit + // A little bit of a hack: save the current unit (numerator), call the main measure unit // parsing code, put back the numerator unit, and put the new unit into per-unit. MeasureUnit numerator = macros.unit; parseMeasureUnitOption(segment, macros, status); @@ -992,6 +1096,33 @@ void blueprint_helpers::parseMeasurePerUnitOption(const StringSegment& segment, macros.unit = numerator; } +void blueprint_helpers::parseIdentifierUnitOption(const StringSegment& segment, MacroProps& macros, + UErrorCode& status) { + // Need to do char <-> char16_t conversion... + U_ASSERT(U_SUCCESS(status)); + CharString buffer; + SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); + + ErrorCode internalStatus; + macros.unit = MeasureUnit::forIdentifier(buffer.toStringPiece(), internalStatus); + if (internalStatus.isFailure()) { + // throw new SkeletonSyntaxException("Invalid core unit identifier", segment, e); + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return; + } +} + +void blueprint_helpers::parseUnitUsageOption(const StringSegment &segment, MacroProps ¯os, + UErrorCode &status) { + // Need to do char <-> char16_t conversion... + U_ASSERT(U_SUCCESS(status)); + CharString buffer; + SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); + macros.usage.set(buffer.toStringPiece()); + // We do not do any validation of the usage string: it depends on the + // unitPreferenceData in the units resources. +} + void blueprint_helpers::parseFractionStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { U_ASSERT(segment.charAt(0) == u'.'); @@ -1006,7 +1137,7 @@ void blueprint_helpers::parseFractionStem(const StringSegment& segment, MacroPro } } if (offset < segment.length()) { - if (segment.charAt(offset) == u'+') { + if (isWildcardChar(segment.charAt(offset))) { maxFrac = -1; offset++; } else { @@ -1029,7 +1160,11 @@ void blueprint_helpers::parseFractionStem(const StringSegment& segment, MacroPro } // Use the public APIs to enforce bounds checking if (maxFrac == -1) { - macros.precision = Precision::minFraction(minFrac); + if (minFrac == 0) { + macros.precision = Precision::unlimited(); + } else { + macros.precision = Precision::minFraction(minFrac); + } } else { macros.precision = Precision::minMaxFraction(minFrac, maxFrac); } @@ -1044,7 +1179,7 @@ blueprint_helpers::generateFractionStem(int32_t minFrac, int32_t maxFrac, Unicod sb.append(u'.'); appendMultiple(sb, u'0', minFrac); if (maxFrac == -1) { - sb.append(u'+'); + sb.append(kWildcardChar); } else { appendMultiple(sb, u'#', maxFrac - minFrac); } @@ -1053,9 +1188,9 @@ blueprint_helpers::generateFractionStem(int32_t minFrac, int32_t maxFrac, Unicod void blueprint_helpers::parseDigitsStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { U_ASSERT(segment.charAt(0) == u'@'); - int offset = 0; - int minSig = 0; - int maxSig; + int32_t offset = 0; + int32_t minSig = 0; + int32_t maxSig; for (; offset < segment.length(); offset++) { if (segment.charAt(offset) == u'@') { minSig++; @@ -1064,7 +1199,7 @@ blueprint_helpers::parseDigitsStem(const StringSegment& segment, MacroProps& mac } } if (offset < segment.length()) { - if (segment.charAt(offset) == u'+') { + if (isWildcardChar(segment.charAt(offset))) { maxSig = -1; offset++; } else { @@ -1097,12 +1232,82 @@ void blueprint_helpers::generateDigitsStem(int32_t minSig, int32_t maxSig, UnicodeString& sb, UErrorCode&) { appendMultiple(sb, u'@', minSig); if (maxSig == -1) { - sb.append(u'+'); + sb.append(kWildcardChar); } else { appendMultiple(sb, u'#', maxSig - minSig); } } +void blueprint_helpers::parseScientificStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { + U_ASSERT(segment.charAt(0) == u'E'); + { + int32_t offset = 1; + if (segment.length() == offset) { + goto fail; + } + bool isEngineering = false; + if (segment.charAt(offset) == u'E') { + isEngineering = true; + offset++; + if (segment.length() == offset) { + goto fail; + } + } + UNumberSignDisplay signDisplay = UNUM_SIGN_AUTO; + if (segment.charAt(offset) == u'+') { + offset++; + if (segment.length() == offset) { + goto fail; + } + if (segment.charAt(offset) == u'!') { + signDisplay = UNUM_SIGN_ALWAYS; + } else if (segment.charAt(offset) == u'?') { + signDisplay = UNUM_SIGN_EXCEPT_ZERO; + } else { + // NOTE: Other sign displays are not included because they aren't useful in this context + goto fail; + } + offset++; + if (segment.length() == offset) { + goto fail; + } + } + int32_t minDigits = 0; + for (; offset < segment.length(); offset++) { + if (segment.charAt(offset) != u'0') { + goto fail; + } + minDigits++; + } + macros.notation = (isEngineering ? Notation::engineering() : Notation::scientific()) + .withExponentSignDisplay(signDisplay) + .withMinExponentDigits(minDigits); + return; + } + fail: void(); + // throw new SkeletonSyntaxException("Invalid scientific stem", segment); + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return; +} + +void blueprint_helpers::parseIntegerStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { + U_ASSERT(segment.charAt(0) == u'0'); + int32_t offset = 1; + for (; offset < segment.length(); offset++) { + if (segment.charAt(offset) != u'0') { + offset--; + break; + } + } + if (offset < segment.length()) { + // throw new SkeletonSyntaxException("Invalid integer stem", segment); + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return; + } + macros.integerWidth = IntegerWidth::zeroFillTo(offset); + return; +} + bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { if (segment.charAt(0) != u'@') { @@ -1118,21 +1323,14 @@ bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroPr break; } } - // For the frac-sig option, there must be minSig or maxSig but not both. - // Valid: @+, @@+, @@@+ - // Valid: @#, @##, @### - // Invalid: @, @@, @@@ - // Invalid: @@#, @@##, @@@# if (offset < segment.length()) { - if (segment.charAt(offset) == u'+') { + if (isWildcardChar(segment.charAt(offset))) { + // @+, @@+, @@@+ maxSig = -1; offset++; - } else if (minSig > 1) { - // @@#, @@##, @@@# - // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment); - status = U_NUMBER_SKELETON_SYNTAX_ERROR; - return false; } else { + // @#, @##, @### + // @@#, @@##, @@@# maxSig = minSig; for (; offset < segment.length(); offset++) { if (segment.charAt(offset) == u'#') { @@ -1144,68 +1342,73 @@ bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroPr } } else { // @, @@, @@@ - // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment); - status = U_NUMBER_SKELETON_SYNTAX_ERROR; - return false; + maxSig = minSig; } + auto& oldPrecision = static_cast(macros.precision); if (offset < segment.length()) { - // throw new SkeletonSyntaxException("Invalid digits option for fraction rounder", segment); + UNumberRoundingPriority priority; + if (maxSig == -1) { + // The wildcard character is not allowed with the priority annotation + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return false; + } + if (segment.codePointAt(offset) == u'r') { + priority = UNUM_ROUNDING_PRIORITY_RELAXED; + offset++; + } else if (segment.codePointAt(offset) == u's') { + priority = UNUM_ROUNDING_PRIORITY_STRICT; + offset++; + } else { + // Invalid digits option for fraction rounder + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return false; + } + if (offset < segment.length()) { + // Invalid digits option for fraction rounder + status = U_NUMBER_SKELETON_SYNTAX_ERROR; + return false; + } + macros.precision = oldPrecision.withSignificantDigits(minSig, maxSig, priority); + } else if (maxSig == -1) { + // withMinDigits + macros.precision = oldPrecision.withMinDigits(minSig); + } else if (minSig == 1) { + // withMaxDigits + macros.precision = oldPrecision.withMaxDigits(maxSig); + } else { + // Digits options with both min and max sig require the priority option status = U_NUMBER_SKELETON_SYNTAX_ERROR; return false; } - auto& oldPrecision = static_cast(macros.precision); - if (maxSig == -1) { - macros.precision = oldPrecision.withMinDigits(minSig); - } else { - macros.precision = oldPrecision.withMaxDigits(maxSig); - } return true; } -void blueprint_helpers::parseIncrementOption(const StringSegment& segment, MacroProps& macros, - UErrorCode& status) { - // Need to do char <-> UChar conversion... - U_ASSERT(U_SUCCESS(status)); - CharString buffer; - SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); - - // Utilize DecimalQuantity/decNumber to parse this for us. - DecimalQuantity dq; - UErrorCode localStatus = U_ZERO_ERROR; - dq.setToDecNumber({buffer.data(), buffer.length()}, localStatus); - if (U_FAILURE(localStatus)) { - // throw new SkeletonSyntaxException("Invalid rounding increment", segment, e); - status = U_NUMBER_SKELETON_SYNTAX_ERROR; - return; +bool blueprint_helpers::parseTrailingZeroOption(const StringSegment& segment, MacroProps& macros, UErrorCode&) { + if (segment == u"w") { + macros.precision = macros.precision.trailingZeroDisplay(UNUM_TRAILING_ZERO_HIDE_IF_WHOLE); + return true; } - double increment = dq.toDouble(); + return false; +} - // We also need to figure out how many digits. Do a brute force string operation. - int decimalOffset = 0; - while (decimalOffset < segment.length() && segment.charAt(decimalOffset) != '.') { - decimalOffset++; - } - if (decimalOffset == segment.length()) { - macros.precision = Precision::increment(increment); - } else { - int32_t fractionLength = segment.length() - decimalOffset - 1; - macros.precision = Precision::increment(increment).withMinFraction(fractionLength); - } +void blueprint_helpers::parseIncrementOption(const StringSegment &segment, MacroProps ¯os, + UErrorCode &status) { + number::impl::parseIncrementOption(segment, macros.precision, status); } -void blueprint_helpers::generateIncrementOption(double increment, int32_t trailingZeros, UnicodeString& sb, - UErrorCode&) { +void blueprint_helpers::generateIncrementOption( + uint32_t increment, + digits_t incrementMagnitude, + int32_t minFrac, + UnicodeString& sb, + UErrorCode&) { // Utilize DecimalQuantity/double_conversion to format this for us. DecimalQuantity dq; - dq.setToDouble(increment); - dq.roundToInfinity(); + dq.setToLong(increment); + dq.adjustMagnitude(incrementMagnitude); + dq.setMinFraction(minFrac); sb.append(dq.toPlainString()); - - // We might need to append extra trailing zeros for min fraction... - if (trailingZeros > 0) { - appendMultiple(sb, u'0', trailingZeros); - } } void blueprint_helpers::parseIntegerWidthOption(const StringSegment& segment, MacroProps& macros, @@ -1213,7 +1416,7 @@ void blueprint_helpers::parseIntegerWidthOption(const StringSegment& segment, Ma int32_t offset = 0; int32_t minInt = 0; int32_t maxInt; - if (segment.charAt(0) == u'+') { + if (isWildcardChar(segment.charAt(0))) { maxInt = -1; offset++; } else { @@ -1254,7 +1457,7 @@ void blueprint_helpers::parseIntegerWidthOption(const StringSegment& segment, Ma void blueprint_helpers::generateIntegerWidthOption(int32_t minInt, int32_t maxInt, UnicodeString& sb, UErrorCode&) { if (maxInt == -1) { - sb.append(u'+'); + sb.append(kWildcardChar); } else { appendMultiple(sb, u'#', maxInt - minInt); } @@ -1263,7 +1466,7 @@ void blueprint_helpers::generateIntegerWidthOption(int32_t minInt, int32_t maxIn void blueprint_helpers::parseNumberingSystemOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { - // Need to do char <-> UChar conversion... + // Need to do char <-> char16_t conversion... U_ASSERT(U_SUCCESS(status)); CharString buffer; SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); @@ -1280,13 +1483,13 @@ void blueprint_helpers::parseNumberingSystemOption(const StringSegment& segment, void blueprint_helpers::generateNumberingSystemOption(const NumberingSystem& ns, UnicodeString& sb, UErrorCode&) { - // Need to do char <-> UChar conversion... + // Need to do char <-> char16_t conversion... sb.append(UnicodeString(ns.getName(), -1, US_INV)); } void blueprint_helpers::parseScaleOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status) { - // Need to do char <-> UChar conversion... + // Need to do char <-> char16_t conversion... U_ASSERT(U_SUCCESS(status)); CharString buffer; SKELETON_UCHAR_TO_CHAR(buffer, segment.toTempUnicodeString(), 0, segment.length(), status); @@ -1294,7 +1497,7 @@ void blueprint_helpers::parseScaleOption(const StringSegment& segment, MacroProp LocalPointer decnum(new DecNum(), status); if (U_FAILURE(status)) { return; } decnum->setTo({buffer.data(), buffer.length()}, status); - if (U_FAILURE(status)) { + if (U_FAILURE(status) || decnum->isSpecial()) { // This is a skeleton syntax error; don't let the low-level decnum error bubble up status = U_NUMBER_SKELETON_SYNTAX_ERROR; return; @@ -1361,50 +1564,46 @@ bool GeneratorHelpers::notation(const MacroProps& macros, UnicodeString& sb, UEr } bool GeneratorHelpers::unit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) { - if (utils::unitIsCurrency(macros.unit)) { + MeasureUnit unit = macros.unit; + if (!utils::unitIsBaseUnit(macros.perUnit)) { + if (utils::unitIsCurrency(macros.unit) || utils::unitIsCurrency(macros.perUnit)) { + status = U_UNSUPPORTED_ERROR; + return false; + } + unit = unit.product(macros.perUnit.reciprocal(status), status); + } + + if (utils::unitIsCurrency(unit)) { sb.append(u"currency/", -1); - CurrencyUnit currency(macros.unit, status); + CurrencyUnit currency(unit, status); if (U_FAILURE(status)) { return false; } blueprint_helpers::generateCurrencyOption(currency, sb, status); return true; - } else if (utils::unitIsNoUnit(macros.unit)) { - if (utils::unitIsPercent(macros.unit)) { - sb.append(u"percent", -1); - return true; - } else if (utils::unitIsPermille(macros.unit)) { - sb.append(u"permille", -1); - return true; - } else { - // Default value is not shown in normalized form - return false; - } + } else if (utils::unitIsBaseUnit(unit)) { + // Default value is not shown in normalized form + return false; + } else if (utils::unitIsPercent(unit)) { + sb.append(u"percent", -1); + return true; + } else if (utils::unitIsPermille(unit)) { + sb.append(u"permille", -1); + return true; } else { - sb.append(u"measure-unit/", -1); - blueprint_helpers::generateMeasureUnitOption(macros.unit, sb, status); + sb.append(u"unit/", -1); + sb.append(unit.getIdentifier()); return true; } } -bool GeneratorHelpers::perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) { - // Per-units are currently expected to be only MeasureUnits. - if (utils::unitIsNoUnit(macros.perUnit)) { - if (utils::unitIsPercent(macros.perUnit) || utils::unitIsPermille(macros.perUnit)) { - status = U_UNSUPPORTED_ERROR; - return false; - } else { - // Default value: ok to ignore - return false; - } - } else if (utils::unitIsCurrency(macros.perUnit)) { - status = U_UNSUPPORTED_ERROR; - return false; - } else { - sb.append(u"per-measure-unit/", -1); - blueprint_helpers::generateMeasureUnitOption(macros.perUnit, sb, status); +bool GeneratorHelpers::usage(const MacroProps& macros, UnicodeString& sb, UErrorCode& /* status */) { + if (macros.usage.isSet()) { + sb.append(u"usage/", -1); + sb.append(UnicodeString(macros.usage.fValue, -1, US_INV)); return true; } + return false; } bool GeneratorHelpers::precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status) { @@ -1420,10 +1619,21 @@ bool GeneratorHelpers::precision(const MacroProps& macros, UnicodeString& sb, UE const Precision::FractionSignificantSettings& impl = macros.precision.fUnion.fracSig; blueprint_helpers::generateFractionStem(impl.fMinFrac, impl.fMaxFrac, sb, status); sb.append(u'/'); - if (impl.fMinSig == -1) { - blueprint_helpers::generateDigitsStem(1, impl.fMaxSig, sb, status); + if (impl.fRetain) { + if (impl.fPriority == UNUM_ROUNDING_PRIORITY_RELAXED) { + // withMinDigits + blueprint_helpers::generateDigitsStem(impl.fMaxSig, -1, sb, status); + } else { + // withMaxDigits + blueprint_helpers::generateDigitsStem(1, impl.fMaxSig, sb, status); + } } else { - blueprint_helpers::generateDigitsStem(impl.fMinSig, -1, sb, status); + blueprint_helpers::generateDigitsStem(impl.fMinSig, impl.fMaxSig, sb, status); + if (impl.fPriority == UNUM_ROUNDING_PRIORITY_RELAXED) { + sb.append(u'r'); + } else { + sb.append(u's'); + } } } else if (macros.precision.fType == Precision::RND_INCREMENT || macros.precision.fType == Precision::RND_INCREMENT_ONE @@ -1432,7 +1642,8 @@ bool GeneratorHelpers::precision(const MacroProps& macros, UnicodeString& sb, UE sb.append(u"precision-increment/", -1); blueprint_helpers::generateIncrementOption( impl.fIncrement, - impl.fMinFrac - impl.fMaxFrac, + impl.fIncrementMagnitude, + impl.fMinFrac, sb, status); } else if (macros.precision.fType == Precision::RND_CURRENCY) { @@ -1447,6 +1658,10 @@ bool GeneratorHelpers::precision(const MacroProps& macros, UnicodeString& sb, UE return false; } + if (macros.precision.fTrailingZeroDisplay == UNUM_TRAILING_ZERO_HIDE_IF_WHOLE) { + sb.append(u"/w", -1); + } + // NOTE: Always return true for rounding because the default value depends on other options. return true; } @@ -1479,10 +1694,15 @@ bool GeneratorHelpers::integerWidth(const MacroProps& macros, UnicodeString& sb, // Error or Default return false; } + const auto& minMaxInt = macros.integerWidth.fUnion.minMaxInt; + if (minMaxInt.fMinInt == 0 && minMaxInt.fMaxInt == 0) { + sb.append(u"integer-width-trunc", -1); + return true; + } sb.append(u"integer-width/", -1); blueprint_helpers::generateIntegerWidthOption( - macros.integerWidth.fUnion.minMaxInt.fMinInt, - macros.integerWidth.fUnion.minMaxInt.fMaxInt, + minMaxInt.fMinInt, + minMaxInt.fMaxInt, sb, status); return true; @@ -1545,4 +1765,49 @@ bool GeneratorHelpers::scale(const MacroProps& macros, UnicodeString& sb, UError } +// Definitions of public API methods (put here for dependency disentanglement) + +#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) +// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method +// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation +// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is +// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes, +// they will all be passed to the linker, and the linker will still find and export all the class members. +#pragma warning(push) +#pragma warning(disable: 4661) +#endif + +template +UnicodeString NumberFormatterSettings::toSkeleton(UErrorCode& status) const { + if (U_FAILURE(status)) { + return ICU_Utility::makeBogusString(); + } + if (fMacros.copyErrorTo(status)) { + return ICU_Utility::makeBogusString(); + } + return skeleton::generate(fMacros, status); +} + +// Declare all classes that implement NumberFormatterSettings +// See https://stackoverflow.com/a/495056/1407170 +template +class icu::number::NumberFormatterSettings; +template +class icu::number::NumberFormatterSettings; + +UnlocalizedNumberFormatter +NumberFormatter::forSkeleton(const UnicodeString& skeleton, UErrorCode& status) { + return skeleton::create(skeleton, nullptr, status); +} + +UnlocalizedNumberFormatter +NumberFormatter::forSkeleton(const UnicodeString& skeleton, UParseError& perror, UErrorCode& status) { + return skeleton::create(skeleton, &perror, status); +} + +#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) +// Warning 4661. +#pragma warning(pop) +#endif + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.h index 59af77192..27f69cd48 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.h @@ -22,10 +22,12 @@ struct SeenMacroProps; // namespace for enums and entrypoint functions namespace skeleton { -/////////////////////////////////////////////////////////////////////////////////////// -// NOTE: For an example of how to add a new stem to the number skeleton parser, see: // -// http://bugs.icu-project.org/trac/changeset/41193 // -/////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////// +// NOTE: For examples of how to add a new stem to the number skeleton parser, see: // +// https://github.com/unicode-org/icu/commit/a2a7982216b2348070dc71093775ac7195793d73 // +// and // +// https://github.com/unicode-org/icu/commit/6fe86f3934a8a5701034f648a8f7c5087e84aa28 // +//////////////////////////////////////////////////////////////////////////////////////// /** * While parsing a skeleton, this enum records what type of option we expect to find next. @@ -40,12 +42,15 @@ enum ParseState { STATE_SCIENTIFIC, STATE_FRACTION_PRECISION, + STATE_PRECISION, // Section 2: An option is required: STATE_INCREMENT_PRECISION, STATE_MEASURE_UNIT, STATE_PER_MEASURE_UNIT, + STATE_IDENTIFIER_UNIT, + STATE_UNIT_USAGE, STATE_CURRENCY_UNIT, STATE_INTEGER_WIDTH, STATE_NUMBERING_SYSTEM, @@ -71,6 +76,7 @@ enum StemEnum { STEM_BASE_UNIT, STEM_PERCENT, STEM_PERMILLE, + STEM_PERCENT_100, // concise-only STEM_PRECISION_INTEGER, STEM_PRECISION_UNLIMITED, STEM_PRECISION_CURRENCY_STANDARD, @@ -80,9 +86,13 @@ enum StemEnum { STEM_ROUNDING_MODE_DOWN, STEM_ROUNDING_MODE_UP, STEM_ROUNDING_MODE_HALF_EVEN, + STEM_ROUNDING_MODE_HALF_ODD, + STEM_ROUNDING_MODE_HALF_CEILING, + STEM_ROUNDING_MODE_HALF_FLOOR, STEM_ROUNDING_MODE_HALF_DOWN, STEM_ROUNDING_MODE_HALF_UP, STEM_ROUNDING_MODE_UNNECESSARY, + STEM_INTEGER_WIDTH_TRUNC, STEM_GROUP_OFF, STEM_GROUP_MIN2, STEM_GROUP_AUTO, @@ -93,6 +103,8 @@ enum StemEnum { STEM_UNIT_WIDTH_SHORT, STEM_UNIT_WIDTH_FULL_NAME, STEM_UNIT_WIDTH_ISO_CODE, + STEM_UNIT_WIDTH_FORMAL, + STEM_UNIT_WIDTH_VARIANT, STEM_UNIT_WIDTH_HIDDEN, STEM_SIGN_AUTO, STEM_SIGN_ALWAYS, @@ -101,6 +113,8 @@ enum StemEnum { STEM_SIGN_ACCOUNTING_ALWAYS, STEM_SIGN_EXCEPT_ZERO, STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, + STEM_SIGN_NEGATIVE, + STEM_SIGN_ACCOUNTING_NEGATIVE, STEM_DECIMAL_AUTO, STEM_DECIMAL_ALWAYS, @@ -109,12 +123,25 @@ enum StemEnum { STEM_PRECISION_INCREMENT, STEM_MEASURE_UNIT, STEM_PER_MEASURE_UNIT, + STEM_UNIT, + STEM_UNIT_USAGE, STEM_CURRENCY, STEM_INTEGER_WIDTH, STEM_NUMBERING_SYSTEM, STEM_SCALE, }; +/** Default wildcard char, accepted on input and printed in output */ +constexpr char16_t kWildcardChar = u'*'; + +/** Alternative wildcard char, accept on input but not printed in output */ +constexpr char16_t kAltWildcardChar = u'+'; + +/** Checks whether the char is a wildcard on input */ +inline bool isWildcardChar(char16_t c) { + return c == kWildcardChar || c == kAltWildcardChar; +} + /** * Creates a NumberFormatter corresponding to the given skeleton string. * @@ -220,12 +247,20 @@ void parseCurrencyOption(const StringSegment& segment, MacroProps& macros, UErro void generateCurrencyOption(const CurrencyUnit& currency, UnicodeString& sb, UErrorCode& status); +// "measure-unit/" is deprecated in favour of "unit/". void parseMeasureUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); -void generateMeasureUnitOption(const MeasureUnit& measureUnit, UnicodeString& sb, UErrorCode& status); - +// "per-measure-unit/" is deprecated in favour of "unit/". void parseMeasurePerUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); +/** + * Parses unit identifiers like "meter-per-second" and "foot-and-inch", as + * specified via a "unit/" concise skeleton. + */ +void parseIdentifierUnitOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); + +void parseUnitUsageOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); + void parseFractionStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status); void generateFractionStem(int32_t minFrac, int32_t maxFrac, UnicodeString& sb, UErrorCode& status); @@ -234,13 +269,24 @@ void parseDigitsStem(const StringSegment& segment, MacroProps& macros, UErrorCod void generateDigitsStem(int32_t minSig, int32_t maxSig, UnicodeString& sb, UErrorCode& status); +void parseScientificStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status); + +// Note: no generateScientificStem since this syntax was added later in ICU 67 + +void parseIntegerStem(const StringSegment& segment, MacroProps& macros, UErrorCode& status); + +// Note: no generateIntegerStem since this syntax was added later in ICU 67 + /** @return Whether we successfully found and parsed a frac-sig option. */ bool parseFracSigOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); +/** @return Whether we successfully found and parsed a trailing zero option. */ +bool parseTrailingZeroOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); + void parseIncrementOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); void -generateIncrementOption(double increment, int32_t trailingZeros, UnicodeString& sb, UErrorCode& status); +generateIncrementOption(uint32_t increment, digits_t incrementMagnitude, int32_t minFrac, UnicodeString& sb, UErrorCode& status); void parseIntegerWidthOption(const StringSegment& segment, MacroProps& macros, UErrorCode& status); @@ -278,7 +324,7 @@ class GeneratorHelpers { static bool unit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); - static bool perUnit(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); + static bool usage(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); static bool precision(const MacroProps& macros, UnicodeString& sb, UErrorCode& status); @@ -308,6 +354,7 @@ struct SeenMacroProps { bool notation = false; bool unit = false; bool perUnit = false; + bool usage = false; bool precision = false; bool roundingMode = false; bool grouper = false; @@ -320,6 +367,24 @@ struct SeenMacroProps { bool scale = false; }; +namespace { + +#define SKELETON_UCHAR_TO_CHAR(dest, src, start, end, status) (void)(dest); \ +UPRV_BLOCK_MACRO_BEGIN { \ + UErrorCode conversionStatus = U_ZERO_ERROR; \ + (dest).appendInvariantChars({false, (src).getBuffer() + (start), (end) - (start)}, conversionStatus); \ + if (conversionStatus == U_INVARIANT_CONVERSION_ERROR) { \ + /* Don't propagate the invariant conversion error; it is a skeleton syntax error */ \ + (status) = U_NUMBER_SKELETON_SYNTAX_ERROR; \ + return; \ + } else if (U_FAILURE(conversionStatus)) { \ + (status) = conversionStatus; \ + return; \ + } \ +} UPRV_BLOCK_MACRO_END + +} // namespace + } // namespace impl } // namespace number U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_symbolswrapper.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_symbolswrapper.cpp new file mode 100644 index 000000000..4742a69c1 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_symbolswrapper.cpp @@ -0,0 +1,131 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "number_microprops.h" +#include "unicode/numberformatter.h" + +using namespace icu; +using namespace icu::number; +using namespace icu::number::impl; + +SymbolsWrapper::SymbolsWrapper(const SymbolsWrapper &other) { + doCopyFrom(other); +} + +SymbolsWrapper::SymbolsWrapper(SymbolsWrapper &&src) noexcept { + doMoveFrom(std::move(src)); +} + +SymbolsWrapper &SymbolsWrapper::operator=(const SymbolsWrapper &other) { + if (this == &other) { + return *this; + } + doCleanup(); + doCopyFrom(other); + return *this; +} + +SymbolsWrapper &SymbolsWrapper::operator=(SymbolsWrapper &&src) noexcept { + if (this == &src) { + return *this; + } + doCleanup(); + doMoveFrom(std::move(src)); + return *this; +} + +SymbolsWrapper::~SymbolsWrapper() { + doCleanup(); +} + +void SymbolsWrapper::setTo(const DecimalFormatSymbols &dfs) { + doCleanup(); + fType = SYMPTR_DFS; + fPtr.dfs = new DecimalFormatSymbols(dfs); +} + +void SymbolsWrapper::setTo(const NumberingSystem *ns) { + doCleanup(); + fType = SYMPTR_NS; + fPtr.ns = ns; +} + +void SymbolsWrapper::doCopyFrom(const SymbolsWrapper &other) { + fType = other.fType; + switch (fType) { + case SYMPTR_NONE: + // No action necessary + break; + case SYMPTR_DFS: + // Memory allocation failures are exposed in copyErrorTo() + if (other.fPtr.dfs != nullptr) { + fPtr.dfs = new DecimalFormatSymbols(*other.fPtr.dfs); + } else { + fPtr.dfs = nullptr; + } + break; + case SYMPTR_NS: + // Memory allocation failures are exposed in copyErrorTo() + if (other.fPtr.ns != nullptr) { + fPtr.ns = new NumberingSystem(*other.fPtr.ns); + } else { + fPtr.ns = nullptr; + } + break; + } +} + +void SymbolsWrapper::doMoveFrom(SymbolsWrapper &&src) { + fType = src.fType; + switch (fType) { + case SYMPTR_NONE: + // No action necessary + break; + case SYMPTR_DFS: + fPtr.dfs = src.fPtr.dfs; + src.fPtr.dfs = nullptr; + break; + case SYMPTR_NS: + fPtr.ns = src.fPtr.ns; + src.fPtr.ns = nullptr; + break; + } +} + +void SymbolsWrapper::doCleanup() { + switch (fType) { + case SYMPTR_NONE: + // No action necessary + break; + case SYMPTR_DFS: + delete fPtr.dfs; + break; + case SYMPTR_NS: + delete fPtr.ns; + break; + } +} + +bool SymbolsWrapper::isDecimalFormatSymbols() const { + return fType == SYMPTR_DFS; +} + +bool SymbolsWrapper::isNumberingSystem() const { + return fType == SYMPTR_NS; +} + +const DecimalFormatSymbols *SymbolsWrapper::getDecimalFormatSymbols() const { + U_ASSERT(fType == SYMPTR_DFS); + return fPtr.dfs; +} + +const NumberingSystem *SymbolsWrapper::getNumberingSystem() const { + U_ASSERT(fType == SYMPTR_NS); + return fPtr.ns; +} + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_types.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_types.h index d62aa6a66..84846efb9 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_types.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_types.h @@ -62,26 +62,29 @@ enum AffixPatternType { // Represents a plus sign symbol '+'. TYPE_PLUS_SIGN = -2, + // Represents an approximately sign symbol '~'. + TYPE_APPROXIMATELY_SIGN = -3, + // Represents a percent sign symbol '%'. - TYPE_PERCENT = -3, + TYPE_PERCENT = -4, // Represents a permille sign symbol '‰'. - TYPE_PERMILLE = -4, + TYPE_PERMILLE = -5, // Represents a single currency symbol '¤'. - TYPE_CURRENCY_SINGLE = -5, + TYPE_CURRENCY_SINGLE = -6, // Represents a double currency symbol '¤¤'. - TYPE_CURRENCY_DOUBLE = -6, + TYPE_CURRENCY_DOUBLE = -7, // Represents a triple currency symbol '¤¤¤'. - TYPE_CURRENCY_TRIPLE = -7, + TYPE_CURRENCY_TRIPLE = -8, // Represents a quadruple currency symbol '¤¤¤¤'. - TYPE_CURRENCY_QUAD = -8, + TYPE_CURRENCY_QUAD = -9, // Represents a quintuple currency symbol '¤¤¤¤¤'. - TYPE_CURRENCY_QUINT = -9, + TYPE_CURRENCY_QUINT = -10, // Represents a sequence of six or more currency symbols. TYPE_CURRENCY_OVERFLOW = -15 @@ -92,9 +95,11 @@ enum CompactType { }; enum Signum { - SIGNUM_NEG = -1, - SIGNUM_ZERO = 0, - SIGNUM_POS = 1 + SIGNUM_NEG = 0, + SIGNUM_NEG_ZERO = 1, + SIGNUM_POS_ZERO = 2, + SIGNUM_POS = 3, + SIGNUM_COUNT = 4, }; @@ -135,6 +140,11 @@ class U_I18N_API AffixPatternProvider { * number instead of rendering the number. */ virtual bool hasBody() const = 0; + + /** + * True if the currency symbol should replace the decimal separator. + */ + virtual bool currencyAsDecimal() const = 0; }; @@ -192,7 +202,7 @@ class U_I18N_API Modifier { /** * Whether the modifier contains at least one occurrence of the given field. */ - virtual bool containsField(UNumberFormatFields field) const = 0; + virtual bool containsField(Field field) const = 0; /** * A fill-in for getParameters(). obj will always be set; if non-null, the other @@ -244,31 +254,31 @@ class U_I18N_API ModifierStore { * itself. The {@link #processQuantity} method performs the final step in the number processing pipeline: it uses the * quantity to generate a finalized {@link MicroProps}, which can be used to render the number to output. * - *

    * In other words, this interface is used for the parts of number processing that are quantity-dependent. * - *

    * In order to allow for multiple different objects to all mutate the same MicroProps, a "chain" of MicroPropsGenerators * are linked together, and each one is responsible for manipulating a certain quantity-dependent part of the * MicroProps. At the tail of the linked list is a base instance of {@link MicroProps} with properties that are not * quantity-dependent. Each element in the linked list calls {@link #processQuantity} on its "parent", then does its * work, and then returns the result. * + * This chain of MicroPropsGenerators is typically constructed by NumberFormatterImpl::macrosToMicroGenerator() when + * constructing a NumberFormatter. + * * Exported as U_I18N_API because it is a base class for other exported types * */ class U_I18N_API MicroPropsGenerator { public: - virtual ~MicroPropsGenerator(); + virtual ~MicroPropsGenerator() = default; /** - * Considers the given {@link DecimalQuantity}, optionally mutates it, and returns a {@link MicroProps}. + * Considers the given {@link DecimalQuantity}, optionally mutates it, and + * populates a {@link MicroProps} instance. * - * @param quantity - * The quantity for consideration and optional mutation. - * @param micros - * The MicroProps instance to populate. - * @return A MicroProps instance resolved for the quantity. + * @param quantity The quantity for consideration and optional mutation. + * @param micros The MicroProps instance to populate. It will be modified as + * needed for the given quantity. */ virtual void processQuantity(DecimalQuantity& quantity, MicroProps& micros, UErrorCode& status) const = 0; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.cpp new file mode 100644 index 000000000..6f7fdaa9d --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.cpp @@ -0,0 +1,216 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "number_usageprefs.h" +#include "cstring.h" +#include "number_decimalquantity.h" +#include "number_microprops.h" +#include "number_roundingutils.h" +#include "number_skeletons.h" +#include "unicode/char16ptr.h" +#include "unicode/currunit.h" +#include "unicode/fmtable.h" +#include "unicode/measure.h" +#include "unicode/numberformatter.h" +#include "unicode/platform.h" +#include "unicode/unum.h" +#include "unicode/urename.h" +#include "units_data.h" + +using namespace icu; +using namespace icu::number; +using namespace icu::number::impl; +using icu::StringSegment; +using icu::units::ConversionRates; + +// Copy constructor +StringProp::StringProp(const StringProp &other) : StringProp() { + this->operator=(other); +} + +// Copy assignment operator +StringProp &StringProp::operator=(const StringProp &other) { + if (this == &other) { return *this; } // self-assignment: no-op + fLength = 0; + fError = other.fError; + if (fValue != nullptr) { + uprv_free(fValue); + fValue = nullptr; + } + if (other.fValue == nullptr) { + return *this; + } + if (U_FAILURE(other.fError)) { + // We don't bother trying to allocating memory if we're in any case busy + // copying an errored StringProp. + return *this; + } + fValue = (char *)uprv_malloc(other.fLength + 1); + if (fValue == nullptr) { + fError = U_MEMORY_ALLOCATION_ERROR; + return *this; + } + fLength = other.fLength; + uprv_strncpy(fValue, other.fValue, fLength + 1); + return *this; +} + +// Move constructor +StringProp::StringProp(StringProp &&src) noexcept : fValue(src.fValue), + fLength(src.fLength), + fError(src.fError) { + // Take ownership away from src if necessary + src.fValue = nullptr; +} + +// Move assignment operator +StringProp &StringProp::operator=(StringProp &&src) noexcept { + if (this == &src) { + return *this; + } + if (fValue != nullptr) { + uprv_free(fValue); + } + fValue = src.fValue; + fLength = src.fLength; + fError = src.fError; + // Take ownership away from src if necessary + src.fValue = nullptr; + return *this; +} + +StringProp::~StringProp() { + if (fValue != nullptr) { + uprv_free(fValue); + fValue = nullptr; + } +} + +void StringProp::set(StringPiece value) { + if (fValue != nullptr) { + uprv_free(fValue); + fValue = nullptr; + } + fLength = value.length(); + fValue = (char *)uprv_malloc(fLength + 1); + if (fValue == nullptr) { + fLength = 0; + fError = U_MEMORY_ALLOCATION_ERROR; + return; + } + if (fLength > 0) { + uprv_strncpy(fValue, value.data(), fLength); + } + fValue[fLength] = 0; +} + +// Populates micros.mixedMeasures and modifies quantity, based on the values in +// measures. +void mixedMeasuresToMicros(const MaybeStackVector &measures, DecimalQuantity *quantity, + MicroProps *micros, UErrorCode status) { + micros->mixedMeasuresCount = measures.length(); + + if (micros->mixedMeasures.getCapacity() < micros->mixedMeasuresCount) { + if (micros->mixedMeasures.resize(micros->mixedMeasuresCount) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + } + + for (int32_t i = 0; i < micros->mixedMeasuresCount; i++) { + switch (measures[i]->getNumber().getType()) { + case Formattable::kInt64: + micros->mixedMeasures[i] = measures[i]->getNumber().getInt64(); + break; + + case Formattable::kDouble: + U_ASSERT(micros->indexOfQuantity < 0); + quantity->setToDouble(measures[i]->getNumber().getDouble()); + micros->indexOfQuantity = i; + break; + + default: + U_ASSERT(0 == "Found a Measure Number which is neither a double nor an int"); + UPRV_UNREACHABLE_EXIT; + break; + } + + if (U_FAILURE(status)) { + return; + } + } + + if (micros->indexOfQuantity < 0) { + // There is no quantity. + status = U_INTERNAL_PROGRAM_ERROR; + } +} + +UsagePrefsHandler::UsagePrefsHandler(const Locale &locale, + const MeasureUnit &inputUnit, + const StringPiece usage, + const MicroPropsGenerator *parent, + UErrorCode &status) + : fUnitsRouter(inputUnit, locale, usage, status), + fParent(parent) { +} + +void UsagePrefsHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + fParent->processQuantity(quantity, micros, status); + if (U_FAILURE(status)) { + return; + } + + quantity.roundToInfinity(); // Enables toDouble + const units::RouteResult routed = fUnitsRouter.route(quantity.toDouble(), µs.rounder, status); + if (U_FAILURE(status)) { + return; + } + const MaybeStackVector& routedMeasures = routed.measures; + micros.outputUnit = routed.outputUnit.copy(status).build(status); + if (U_FAILURE(status)) { + return; + } + + mixedMeasuresToMicros(routedMeasures, &quantity, µs, status); +} + +UnitConversionHandler::UnitConversionHandler(const MeasureUnit &targetUnit, + const MicroPropsGenerator *parent, UErrorCode &status) + : fOutputUnit(targetUnit), fParent(parent) { + MeasureUnitImpl tempInput, tempOutput; + + ConversionRates conversionRates(status); + if (U_FAILURE(status)) { + return; + } + + const MeasureUnitImpl &targetUnitImpl = + MeasureUnitImpl::forMeasureUnit(targetUnit, tempOutput, status); + fUnitConverter.adoptInsteadAndCheckErrorCode( + new ComplexUnitsConverter(targetUnitImpl, conversionRates, status), status); +} + +void UnitConversionHandler::processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const { + fParent->processQuantity(quantity, micros, status); + if (U_FAILURE(status)) { + return; + } + quantity.roundToInfinity(); // Enables toDouble + MaybeStackVector measures = + fUnitConverter->convert(quantity.toDouble(), µs.rounder, status); + micros.outputUnit = fOutputUnit; + if (U_FAILURE(status)) { + return; + } + + mixedMeasuresToMicros(measures, &quantity, µs, status); +} + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.h new file mode 100644 index 000000000..e90df99d3 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.h @@ -0,0 +1,126 @@ +// © 2020 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBER_USAGEPREFS_H__ +#define __NUMBER_USAGEPREFS_H__ + +#include "cmemory.h" +#include "number_types.h" +#include "unicode/listformatter.h" +#include "unicode/localpointer.h" +#include "unicode/locid.h" +#include "unicode/measunit.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" +#include "units_converter.h" +#include "units_router.h" + +U_NAMESPACE_BEGIN + +using ::icu::units::ComplexUnitsConverter; +using ::icu::units::UnitsRouter; + +namespace number { +namespace impl { + +/** + * A MicroPropsGenerator which uses UnitsRouter to produce output converted to a + * MeasureUnit appropriate for a particular localized usage: see + * NumberFormatterSettings::usage(). + */ +class U_I18N_API UsagePrefsHandler : public MicroPropsGenerator, public UMemory { + public: + UsagePrefsHandler(const Locale &locale, const MeasureUnit &inputUnit, const StringPiece usage, + const MicroPropsGenerator *parent, UErrorCode &status); + + /** + * Obtains the appropriate output value, MeasureUnit and + * rounding/precision behaviour from the UnitsRouter. + * + * The output unit is passed on to the LongNameHandler via + * micros.outputUnit. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const override; + + /** + * Returns the list of possible output units, i.e. the full set of + * preferences, for the localized, usage-specific unit preferences. + * + * The returned pointer should be valid for the lifetime of the + * UsagePrefsHandler instance. + */ + const MaybeStackVector *getOutputUnits() const { + return fUnitsRouter.getOutputUnits(); + } + + private: + UnitsRouter fUnitsRouter; + const MicroPropsGenerator *fParent; +}; + +} // namespace impl +} // namespace number + +// Export explicit template instantiations of LocalPointerBase and LocalPointer. +// This is required when building DLLs for Windows. (See datefmt.h, +// collationiterator.h, erarules.h and others for similar examples.) +// +// Note: These need to be outside of the number::impl namespace, or Clang will +// generate a compile error. +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +#if defined(_MSC_VER) +// Ignore warning 4661 as LocalPointerBase does not use operator== or operator!= +#pragma warning(push) +#pragma warning(disable: 4661) +#endif +template class U_I18N_API LocalPointerBase; +template class U_I18N_API LocalPointer; +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +#endif + +namespace number { +namespace impl { + +/** + * A MicroPropsGenerator which converts a measurement from one MeasureUnit to + * another. In particular, the output MeasureUnit may be a mixed unit. (The + * input unit may not be a mixed unit.) + */ +class U_I18N_API UnitConversionHandler : public MicroPropsGenerator, public UMemory { + public: + /** + * Constructor. + * + * @param targetUnit Specifies the output MeasureUnit. The input MeasureUnit + * is derived from it: in case of a mixed unit, the biggest unit is + * taken as the input unit. If not a mixed unit, the input unit will be + * the same as the output unit and no unit conversion takes place. + * @param parent The parent MicroPropsGenerator. + * @param status Receives status. + */ + UnitConversionHandler(const MeasureUnit &targetUnit, const MicroPropsGenerator *parent, + UErrorCode &status); + + /** + * Obtains the appropriate output values from the Unit Converter. + */ + void processQuantity(DecimalQuantity &quantity, MicroProps µs, + UErrorCode &status) const override; + private: + MeasureUnit fOutputUnit; + LocalPointer fUnitConverter; + const MicroPropsGenerator *fParent; +}; + +} // namespace impl +} // namespace number +U_NAMESPACE_END + +#endif // __NUMBER_USAGEPREFS_H__ +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.cpp index 4ac99acb2..ad7053214 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include #include @@ -72,7 +70,7 @@ const char16_t* utils::getPatternForStyle(const Locale& locale, const char* nsNa break; default: patternKey = "decimalFormat"; // silence compiler error - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } LocalUResourceBundlePointer res(ures_open(nullptr, locale.getName(), &status)); if (U_FAILURE(status)) { return u""; } @@ -182,12 +180,6 @@ void DecNum::_setTo(const char* str, int32_t maxDigits, UErrorCode& status) { status = U_UNSUPPORTED_ERROR; return; } - - // For consistency with Java BigDecimal, no support for DecNum that is NaN or Infinity! - if (decNumberIsSpecial(fData.getAlias())) { - status = U_UNSUPPORTED_ERROR; - return; - } } void @@ -254,13 +246,28 @@ bool DecNum::isZero() const { return decNumberIsZero(fData.getAlias()); } +bool DecNum::isSpecial() const { + return decNumberIsSpecial(fData.getAlias()); +} + +bool DecNum::isInfinity() const { + return decNumberIsInfinite(fData.getAlias()); +} + +bool DecNum::isNaN() const { + return decNumberIsNaN(fData.getAlias()); +} + void DecNum::toString(ByteSink& output, UErrorCode& status) const { if (U_FAILURE(status)) { return; } // "string must be at least dn->digits+14 characters long" int32_t minCapacity = fData.getAlias()->digits + 14; - MaybeStackArray buffer(minCapacity); + MaybeStackArray buffer(minCapacity, status); + if (U_FAILURE(status)) { + return; + } uprv_decNumberToString(fData, buffer.getAlias()); output.Append(buffer.getAlias(), static_cast(uprv_strlen(buffer.getAlias()))); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.h index 93195f080..bc369c940 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_utils.h @@ -49,8 +49,8 @@ inline bool unitIsCurrency(const MeasureUnit& unit) { return uprv_strcmp("currency", unit.getType()) == 0; } -inline bool unitIsNoUnit(const MeasureUnit& unit) { - return uprv_strcmp("none", unit.getType()) == 0; +inline bool unitIsBaseUnit(const MeasureUnit& unit) { + return unit == MeasureUnit(); } inline bool unitIsPercent(const MeasureUnit& unit) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/number_utypes.h b/src/duckdb/extension/icu/third_party/icu/i18n/number_utypes.h index 6dbe5bee6..0c1304018 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/number_utypes.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/number_utypes.h @@ -28,15 +28,26 @@ const DecimalQuantity* validateUFormattedNumberToDecimalQuantity( * This struct is held internally by the C++ version FormattedNumber since the member types are not * declared in the public header file. * - * The DecimalQuantity is not currently being used by FormattedNumber, but at some point it could be used - * to add a toDecNumber() or similar method. + * Exported as U_I18N_API for tests */ -class UFormattedNumberData : public FormattedValueStringBuilderImpl { +class U_I18N_API UFormattedNumberData : public FormattedValueStringBuilderImpl { public: - UFormattedNumberData() : FormattedValueStringBuilderImpl(0) {} + UFormattedNumberData() : FormattedValueStringBuilderImpl(kUndefinedField) {} virtual ~UFormattedNumberData(); + UFormattedNumberData(UFormattedNumberData&&) = default; + UFormattedNumberData& operator=(UFormattedNumberData&&) = default; + + // The formatted quantity. DecimalQuantity quantity; + + // The output unit for the formatted quantity. + // TODO(units,hugovdm): populate this correctly for the general case - it's + // currently only implemented for the .usage() use case. + MeasureUnit outputUnit; + + // The gender of the formatted output. + const char *gender = ""; }; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp index a8b55be4b..74689e136 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp @@ -13,7 +13,7 @@ * Date Name Description * 02/19/97 aliu Converted from java. * 03/18/97 clhuang Implemented with C++ APIs. -* 04/17/97 aliu Enlarged MAX_INTEGER_DIGITS to fully accomodate the +* 04/17/97 aliu Enlarged MAX_INTEGER_DIGITS to fully accommodate the * largest double, by default. * Changed DigitCount to int per code review. * 07/20/98 stephen Changed operator== to check for grouping @@ -74,32 +74,32 @@ static inline void debugout(UnicodeString s) { // If no number pattern can be located for a locale, this is the last // resort. The patterns are same as the ones in root locale. -static const UChar gLastResortDecimalPat[] = { +static const char16_t gLastResortDecimalPat[] = { 0x23, 0x2C, 0x23, 0x23, 0x30, 0x2E, 0x23, 0x23, 0x23, 0 /* "#,##0.###" */ }; -static const UChar gLastResortCurrencyPat[] = { +static const char16_t gLastResortCurrencyPat[] = { 0xA4, 0xA0, 0x23, 0x2C, 0x23, 0x23, 0x30, 0x2E, 0x30, 0x30, 0 /* "\u00A4\u00A0#,##0.00" */ }; -static const UChar gLastResortPercentPat[] = { +static const char16_t gLastResortPercentPat[] = { 0x23, 0x2C, 0x23, 0x23, 0x30, 0x25, 0 /* "#,##0%" */ }; -static const UChar gLastResortScientificPat[] = { +static const char16_t gLastResortScientificPat[] = { 0x23, 0x45, 0x30, 0 /* "#E0" */ }; -static const UChar gLastResortIsoCurrencyPat[] = { +static const char16_t gLastResortIsoCurrencyPat[] = { 0xA4, 0xA4, 0xA0, 0x23, 0x2C, 0x23, 0x23, 0x30, 0x2E, 0x30, 0x30, 0 /* "\u00A4\u00A4\u00A0#,##0.00" */ }; -static const UChar gLastResortPluralCurrencyPat[] = { +static const char16_t gLastResortPluralCurrencyPat[] = { 0x23, 0x2C, 0x23, 0x23, 0x30, 0x2E, 0x23, 0x23, 0x23, 0x20, 0xA4, 0xA4, 0xA4, 0 /* "#,##0.### \u00A4\u00A4\u00A4*/ }; -static const UChar gLastResortAccountingCurrencyPat[] = { +static const char16_t gLastResortAccountingCurrencyPat[] = { 0xA4, 0xA0, 0x23, 0x2C, 0x23, 0x23, 0x30, 0x2E, 0x30, 0x30, 0 /* "\u00A4\u00A0#,##0.00" */ }; -static const UChar gSingleCurrencySign[] = {0xA4, 0}; -static const UChar gDoubleCurrencySign[] = {0xA4, 0xA4, 0}; +static const char16_t gSingleCurrencySign[] = {0xA4, 0}; +static const char16_t gDoubleCurrencySign[] = {0xA4, 0xA4, 0}; -static const UChar gSlash = 0x2f; +static const char16_t gSlash = 0x2f; // If the maximum base 10 exponent were 4, then the largest number would // be 99,999 which has 5 digits. @@ -108,39 +108,39 @@ static const UChar gSlash = 0x2f; const int32_t icu::NumberFormat::gDefaultMaxIntegerDigits = 2000000000; const int32_t icu::NumberFormat::gDefaultMinIntegerDigits = 127; -static const UChar * const gLastResortNumberPatterns[UNUM_FORMAT_STYLE_COUNT] = { - NULL, // UNUM_PATTERN_DECIMAL +static const char16_t * const gLastResortNumberPatterns[UNUM_FORMAT_STYLE_COUNT] = { + nullptr, // UNUM_PATTERN_DECIMAL gLastResortDecimalPat, // UNUM_DECIMAL gLastResortCurrencyPat, // UNUM_CURRENCY gLastResortPercentPat, // UNUM_PERCENT gLastResortScientificPat, // UNUM_SCIENTIFIC - NULL, // UNUM_SPELLOUT - NULL, // UNUM_ORDINAL - NULL, // UNUM_DURATION - NULL, // UNUM_NUMBERING_SYSTEM - NULL, // UNUM_PATTERN_RULEBASED + nullptr, // UNUM_SPELLOUT + nullptr, // UNUM_ORDINAL + nullptr, // UNUM_DURATION + gLastResortDecimalPat, // UNUM_NUMBERING_SYSTEM + nullptr, // UNUM_PATTERN_RULEBASED gLastResortIsoCurrencyPat, // UNUM_CURRENCY_ISO gLastResortPluralCurrencyPat, // UNUM_CURRENCY_PLURAL gLastResortAccountingCurrencyPat, // UNUM_CURRENCY_ACCOUNTING gLastResortCurrencyPat, // UNUM_CASH_CURRENCY - NULL, // UNUM_DECIMAL_COMPACT_SHORT - NULL, // UNUM_DECIMAL_COMPACT_LONG + nullptr, // UNUM_DECIMAL_COMPACT_SHORT + nullptr, // UNUM_DECIMAL_COMPACT_LONG gLastResortCurrencyPat, // UNUM_CURRENCY_STANDARD }; // Keys used for accessing resource bundles static const icu::number::impl::CldrPatternStyle gFormatCldrStyles[UNUM_FORMAT_STYLE_COUNT] = { - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_DECIMAL + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_DECIMAL icu::number::impl::CLDR_PATTERN_STYLE_DECIMAL, // UNUM_DECIMAL icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY icu::number::impl::CLDR_PATTERN_STYLE_PERCENT, // UNUM_PERCENT icu::number::impl::CLDR_PATTERN_STYLE_SCIENTIFIC, // UNUM_SCIENTIFIC - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_SPELLOUT - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_ORDINAL - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DURATION - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_NUMBERING_SYSTEM - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_RULEBASED + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_SPELLOUT + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_ORDINAL + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DURATION + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_NUMBERING_SYSTEM + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_PATTERN_RULEBASED // For UNUM_CURRENCY_ISO and UNUM_CURRENCY_PLURAL, // the pattern is the same as the pattern of UNUM_CURRENCY // except for replacing the single currency sign with @@ -149,18 +149,18 @@ static const icu::number::impl::CldrPatternStyle gFormatCldrStyles[UNUM_FORMAT_S icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_PLURAL icu::number::impl::CLDR_PATTERN_STYLE_ACCOUNTING, // UNUM_CURRENCY_ACCOUNTING icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CASH_CURRENCY - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_SHORT - /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_LONG + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_SHORT + /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT, // UNUM_DECIMAL_COMPACT_LONG icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY, // UNUM_CURRENCY_STANDARD }; // Static hashtable cache of NumberingSystem objects used by NumberFormat -static UHashtable * NumberingSystem_cache = NULL; -static icu::UInitOnce gNSCacheInitOnce = U_INITONCE_INITIALIZER; +static UHashtable * NumberingSystem_cache = nullptr; +static icu::UInitOnce gNSCacheInitOnce {}; #if !UCONFIG_NO_SERVICE -static icu::ICULocaleService* gService = NULL; -static icu::UInitOnce gServiceInitOnce = U_INITONCE_INITIALIZER; +static icu::ICULocaleService* gService = nullptr; +static icu::UInitOnce gServiceInitOnce {}; #endif /** @@ -172,21 +172,21 @@ deleteNumberingSystem(void *obj) { delete (icu::NumberingSystem *)obj; } -static UBool U_CALLCONV numfmt_cleanup(void) { +static UBool U_CALLCONV numfmt_cleanup() { #if !UCONFIG_NO_SERVICE gServiceInitOnce.reset(); if (gService) { delete gService; - gService = NULL; + gService = nullptr; } #endif gNSCacheInitOnce.reset(); if (NumberingSystem_cache) { // delete NumberingSystem_cache; uhash_close(NumberingSystem_cache); - NumberingSystem_cache = NULL; + NumberingSystem_cache = nullptr; } - return TRUE; + return true; } U_CDECL_END @@ -210,7 +210,7 @@ SimpleNumberFormatFactory::SimpleNumberFormatFactory(const Locale& locale, UBool SimpleNumberFormatFactory::~SimpleNumberFormatFactory() {} -UBool SimpleNumberFormatFactory::visible(void) const { +UBool SimpleNumberFormatFactory::visible() const { return _visible; } @@ -222,20 +222,20 @@ SimpleNumberFormatFactory::getSupportedIDs(int32_t &count, UErrorCode& status) c return &_id; } count = 0; - return NULL; + return nullptr; } #endif /* #if !UCONFIG_NO_SERVICE */ // ------------------------------------- // default constructor NumberFormat::NumberFormat() -: fGroupingUsed(TRUE), +: fGroupingUsed(true), fMaxIntegerDigits(gDefaultMaxIntegerDigits), fMinIntegerDigits(1), fMaxFractionDigits(3), // invariant, >= minFractionDigits fMinFractionDigits(0), - fParseIntegerOnly(FALSE), - fLenient(FALSE), + fParseIntegerOnly(false), + fLenient(false), fCapitalizationContext(UDISPCTX_CAPITALIZATION_NONE) { fCurrency[0] = 0; @@ -294,39 +294,39 @@ NumberFormat::operator==(const Format& that) const #ifdef FMT_DEBUG // This code makes it easy to determine why two format objects that should // be equal aren't. - UBool first = TRUE; + UBool first = true; if (!Format::operator==(that)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("Format::!="); } if (!(fMaxIntegerDigits == other->fMaxIntegerDigits && fMinIntegerDigits == other->fMinIntegerDigits)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("Integer digits !="); } if (!(fMaxFractionDigits == other->fMaxFractionDigits && fMinFractionDigits == other->fMinFractionDigits)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("Fraction digits !="); } if (!(fGroupingUsed == other->fGroupingUsed)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("fGroupingUsed != "); } if (!(fParseIntegerOnly == other->fParseIntegerOnly)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("fParseIntegerOnly != "); } if (!(u_strcmp(fCurrency, other->fCurrency) == 0)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("fCurrency !="); } if (!(fLenient == other->fLenient)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("fLenient != "); } if (!(fCapitalizationContext == other->fCapitalizationContext)) { - if (first) { printf("[ "); first = FALSE; } else { printf(", "); } + if (first) { printf("[ "); first = false; } else { printf(", "); } debug("fCapitalizationContext != "); } if (!first) { printf(" ]"); } @@ -474,45 +474,45 @@ NumberFormat::format(StringPiece decimalNum, */ class ArgExtractor { const Formattable* num; - UChar save[4]; + char16_t save[4]; UBool fWasCurrency; public: ArgExtractor(const NumberFormat& nf, const Formattable& obj, UErrorCode& status); ~ArgExtractor(); - const Formattable* number(void) const; - const UChar *iso(void) const; - UBool wasCurrency(void) const; + const Formattable* number() const; + const char16_t *iso() const; + UBool wasCurrency() const; }; inline const Formattable* -ArgExtractor::number(void) const { +ArgExtractor::number() const { return num; } inline UBool -ArgExtractor::wasCurrency(void) const { +ArgExtractor::wasCurrency() const { return fWasCurrency; } -inline const UChar * -ArgExtractor::iso(void) const { +inline const char16_t * +ArgExtractor::iso() const { return save; } ArgExtractor::ArgExtractor(const NumberFormat& /*nf*/, const Formattable& obj, UErrorCode& /*status*/) - : num(&obj), fWasCurrency(FALSE) { + : num(&obj), fWasCurrency(false) { - const UObject* o = obj.getObject(); // most commonly o==NULL + const UObject* o = obj.getObject(); // most commonly o==nullptr const CurrencyAmount* amt; - if (o != NULL && (amt = dynamic_cast(o)) != NULL) { + if (o != nullptr && (amt = dynamic_cast(o)) != nullptr) { // getISOCurrency() returns a pointer to internal storage, so we // copy it to retain it across the call to setCurrency(). - //const UChar* curr = amt->getISOCurrency(); + //const char16_t* curr = amt->getISOCurrency(); u_strcpy(save, amt->getISOCurrency()); num = &amt->getNumber(); - fWasCurrency=TRUE; + fWasCurrency=true; } else { save[0]=0; } @@ -564,7 +564,7 @@ NumberFormat::format(const Formattable& obj, ArgExtractor arg(*this, obj, status); const Formattable *n = arg.number(); - const UChar *iso = arg.iso(); + const char16_t *iso = arg.iso(); if(arg.wasCurrency() && u_strcmp(iso, getCurrency())) { // trying to format a different currency. @@ -575,7 +575,7 @@ NumberFormat::format(const Formattable& obj, return cloneFmt->format(*n, appendTo, pos, status); } - if (n->isNumeric() && n->getDecimalQuantity() != NULL) { + if (n->isNumeric() && n->getDecimalQuantity() != nullptr) { // Decimal Number. We will have a DigitList available if the value was // set to a decimal number, or if the value originated with a parse. // @@ -619,7 +619,7 @@ NumberFormat::format(const Formattable& obj, ArgExtractor arg(*this, obj, status); const Formattable *n = arg.number(); - const UChar *iso = arg.iso(); + const char16_t *iso = arg.iso(); if(arg.wasCurrency() && u_strcmp(iso, getCurrency())) { // trying to format a different currency. @@ -630,7 +630,7 @@ NumberFormat::format(const Formattable& obj, return cloneFmt->format(*n, appendTo, posIter, status); } - if (n->isNumeric() && n->getDecimalQuantity() != NULL) { + if (n->isNumeric() && n->getDecimalQuantity() != nullptr) { // Decimal Number format(*n->getDecimalQuantity(), appendTo, posIter, status); } else { @@ -733,7 +733,7 @@ CurrencyAmount* NumberFormat::parseCurrency(const UnicodeString& text, int32_t start = pos.getIndex(); parse(text, parseResult, pos); if (pos.getIndex() != start) { - UChar curr[4]; + char16_t curr[4]; UErrorCode ec = U_ZERO_ERROR; getEffectiveCurrency(curr, ec); if (U_SUCCESS(ec)) { @@ -745,7 +745,7 @@ CurrencyAmount* NumberFormat::parseCurrency(const UnicodeString& text, } } } - return NULL; + return nullptr; } // ------------------------------------- @@ -860,7 +860,7 @@ class ICUNumberFormatFactory : public ICUResourceBundleFactory { public: virtual ~ICUNumberFormatFactory(); protected: - virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* /* service */, UErrorCode& status) const { + virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* /* service */, UErrorCode& status) const override { return NumberFormat::makeInstance(loc, (UNumberFormatStyle)kind, status); } }; @@ -878,27 +878,28 @@ class NFFactory : public LocaleKeyFactory { NFFactory(NumberFormatFactory* delegate) : LocaleKeyFactory(delegate->visible() ? VISIBLE : INVISIBLE) , _delegate(delegate) - , _ids(NULL) + , _ids(nullptr) { } virtual ~NFFactory(); - virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override { if (handlesKey(key, status)) { - const LocaleKey& lkey = (const LocaleKey&)key; + const LocaleKey* lkey = dynamic_cast(&key); + U_ASSERT(lkey != nullptr); Locale loc; - lkey.canonicalLocale(loc); - int32_t kind = lkey.kind(); + lkey->canonicalLocale(loc); + int32_t kind = lkey->kind(); UObject* result = _delegate->createFormat(loc, (UNumberFormatStyle)kind); - if (result == NULL) { - result = service->getKey((ICUServiceKey&)key /* cast away const */, NULL, this, status); + if (result == nullptr) { + result = service->getKey(const_cast(key) /* cast away const */, nullptr, this, status); } return result; } - return NULL; + return nullptr; } protected: @@ -907,7 +908,7 @@ class NFFactory : public LocaleKeyFactory { * otherwise). This can be called often and might need to be * cached if it is expensive to create. */ - virtual const Hashtable* getSupportedIDs(UErrorCode& status) const + virtual const Hashtable* getSupportedIDs(UErrorCode& status) const override { if (U_SUCCESS(status)) { if (!_ids) { @@ -922,7 +923,7 @@ class NFFactory : public LocaleKeyFactory { } return _ids; } - return NULL; + return nullptr; } }; @@ -943,19 +944,20 @@ class ICUNumberFormatService : public ICULocaleService { virtual ~ICUNumberFormatService(); - virtual UObject* cloneInstance(UObject* instance) const { + virtual UObject* cloneInstance(UObject* instance) const override { return ((NumberFormat*)instance)->clone(); } - virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /* actualID */, UErrorCode& status) const { - LocaleKey& lkey = (LocaleKey&)key; - int32_t kind = lkey.kind(); + virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /* actualID */, UErrorCode& status) const override { + const LocaleKey* lkey = dynamic_cast(&key); + U_ASSERT(lkey != nullptr); + int32_t kind = lkey->kind(); Locale loc; - lkey.currentLocale(loc); + lkey->currentLocale(loc); return NumberFormat::makeInstance(loc, (UNumberFormatStyle)kind, status); } - virtual UBool isDefault() const { + virtual UBool isDefault() const override { return countFactories() == 1; } }; @@ -965,20 +967,20 @@ ICUNumberFormatService::~ICUNumberFormatService() {} // ------------------------------------- static void U_CALLCONV initNumberFormatService() { - U_ASSERT(gService == NULL); + U_ASSERT(gService == nullptr); ucln_i18n_registerCleanup(UCLN_I18N_NUMFMT, numfmt_cleanup); gService = new ICUNumberFormatService(); } static ICULocaleService* -getNumberFormatService(void) +getNumberFormatService() { umtx_initOnce(gServiceInitOnce, &initNumberFormatService); return gService; } static UBool haveService() { - return !gServiceInitOnce.isReset() && (getNumberFormatService() != NULL); + return !gServiceInitOnce.isReset() && (getNumberFormatService() != nullptr); } // ------------------------------------- @@ -993,12 +995,12 @@ NumberFormat::registerFactory(NumberFormatFactory* toAdopt, UErrorCode& status) ICULocaleService *service = getNumberFormatService(); if (service) { NFFactory *tempnnf = new NFFactory(toAdopt); - if (tempnnf != NULL) { + if (tempnnf != nullptr) { return service->registerFactory(tempnnf, status); } } status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } // ------------------------------------- @@ -1007,25 +1009,25 @@ UBool U_EXPORT2 NumberFormat::unregister(URegistryKey key, UErrorCode& status) { if (U_FAILURE(status)) { - return FALSE; + return false; } if (haveService()) { return gService->unregister(key, status); } else { status = U_ILLEGAL_ARGUMENT_ERROR; - return FALSE; + return false; } } // ------------------------------------- StringEnumeration* U_EXPORT2 -NumberFormat::getAvailableLocales(void) +NumberFormat::getAvailableLocales() { ICULocaleService *service = getNumberFormatService(); if (service) { return service->getAvailableLocales(); } - return NULL; // no way to return error condition + return nullptr; // no way to return error condition } #endif /* UCONFIG_NO_SERVICE */ // ------------------------------------- @@ -1057,11 +1059,11 @@ NumberFormat::createInstance(const Locale& loc, UNumberFormatStyle kind, UErrorC } const SharedNumberFormat *shared = createSharedInstance(loc, kind, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } NumberFormat *result = (*shared)->clone(); shared->removeRef(); - if (result == NULL) { + if (result == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } return result; @@ -1177,7 +1179,7 @@ NumberFormat::setMinimumFractionDigits(int32_t newValue) // ------------------------------------- -void NumberFormat::setCurrency(const UChar* theCurrency, UErrorCode& ec) { +void NumberFormat::setCurrency(const char16_t* theCurrency, UErrorCode& ec) { if (U_FAILURE(ec)) { return; } @@ -1193,14 +1195,14 @@ const char16_t* NumberFormat::getCurrency() const { return fCurrency; } -void NumberFormat::getEffectiveCurrency(UChar* result, UErrorCode& ec) const { - const UChar* c = getCurrency(); +void NumberFormat::getEffectiveCurrency(char16_t* result, UErrorCode& ec) const { + const char16_t* c = getCurrency(); if (*c != 0) { u_strncpy(result, c, 3); result[3] = 0; } else { const char* loc = getLocaleID(ULOC_VALID_LOCALE, ec); - if (loc == NULL) { + if (loc == nullptr) { loc = uloc_getDefault(); } ucurr_forLocale(loc, result, 4, &ec); @@ -1239,16 +1241,16 @@ UDisplayContext NumberFormat::getContext(UDisplayContextType type, UErrorCode& s // or percent) for the desired locale. static void U_CALLCONV nscacheInit() { - U_ASSERT(NumberingSystem_cache == NULL); + U_ASSERT(NumberingSystem_cache == nullptr); ucln_i18n_registerCleanup(UCLN_I18N_NUMFMT, numfmt_cleanup); UErrorCode status = U_ZERO_ERROR; NumberingSystem_cache = uhash_open(uhash_hashLong, uhash_compareLong, - NULL, + nullptr, &status); if (U_FAILURE(status)) { // Number Format code will run with no cache if creation fails. - NumberingSystem_cache = NULL; + NumberingSystem_cache = nullptr; return; } uhash_setValueDeleter(NumberingSystem_cache, deleteNumberingSystem); @@ -1261,13 +1263,13 @@ const SharedNumberFormat *LocaleCacheKey::createObject( NumberFormat *nf = NumberFormat::internalCreateInstance( localeId, UNUM_DECIMAL, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } SharedNumberFormat *result = new SharedNumberFormat(nf); - if (result == NULL) { + if (result == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; delete nf; - return NULL; + return nullptr; } result->addRef(); return result; @@ -1276,20 +1278,20 @@ const SharedNumberFormat *LocaleCacheKey::createObject( const SharedNumberFormat* U_EXPORT2 NumberFormat::createSharedInstance(const Locale& loc, UNumberFormatStyle kind, UErrorCode& status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } if (kind != UNUM_DECIMAL) { status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } - const SharedNumberFormat *result = NULL; + const SharedNumberFormat *result = nullptr; UnifiedCache::getByLocale(loc, result, status); return result; } UBool NumberFormat::isStyleSupported(UNumberFormatStyle style) { - return gLastResortNumberPatterns[style] != NULL; + return gLastResortNumberPatterns[style] != nullptr; } NumberFormat* @@ -1304,11 +1306,19 @@ NumberFormat::makeInstance(const Locale& desiredLocale, UNumberFormatStyle style, UBool mustBeDecimalFormat, UErrorCode& status) { - if (U_FAILURE(status)) return NULL; + if (U_FAILURE(status)) return nullptr; if (style < 0 || style >= UNUM_FORMAT_STYLE_COUNT) { status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; + } + + // For the purposes of general number formatting, UNUM_NUMBERING_SYSTEM should behave the same + // was as UNUM_DECIMAL. In both cases, you get either a DecimalFormat or a RuleBasedNumberFormat + // depending on the locale's numbering system (either the default one for the locale or a specific + // one specified by using the "@numbers=" or "-u-nu-" parameter in the locale ID. + if (style == UNUM_NUMBERING_SYSTEM) { + style = UNUM_DECIMAL; } // Some styles are not supported. This is a result of merging @@ -1319,7 +1329,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale, // because this method does not take a pattern string. if (!isStyleSupported(style)) { status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } #if U_PLATFORM_USES_ONLY_WIN32_API @@ -1329,11 +1339,11 @@ NumberFormat::makeInstance(const Locale& desiredLocale, // if the locale has "@compat=host", create a host-specific NumberFormat if (U_SUCCESS(status) && count > 0 && uprv_strcmp(buffer, "host") == 0) { - UBool curr = TRUE; + UBool curr = true; switch (style) { case UNUM_DECIMAL: - curr = FALSE; + curr = false; // fall-through U_FALLTHROUGH; @@ -1361,15 +1371,15 @@ NumberFormat::makeInstance(const Locale& desiredLocale, // Get cached numbering system LocalPointer ownedNs; - NumberingSystem *ns = NULL; - if (NumberingSystem_cache != NULL) { + NumberingSystem *ns = nullptr; + if (NumberingSystem_cache != nullptr) { // TODO: Bad hash key usage, see ticket #8504. int32_t hashKey = desiredLocale.hashCode(); static UMutex nscacheMutex; Mutex lock(&nscacheMutex); ns = (NumberingSystem *)uhash_iget(NumberingSystem_cache, hashKey); - if (ns == NULL) { + if (ns == nullptr) { ns = NumberingSystem::createInstance(desiredLocale,status); uhash_iput(NumberingSystem_cache, hashKey, (void*)ns, &status); } @@ -1380,25 +1390,25 @@ NumberFormat::makeInstance(const Locale& desiredLocale, // check results of getting a numbering system if (U_FAILURE(status)) { - return NULL; + return nullptr; } if (mustBeDecimalFormat && ns->isAlgorithmic()) { status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } LocalPointer symbolsToAdopt; UnicodeString pattern; - LocalUResourceBundlePointer ownedResource(ures_open(NULL, desiredLocale.getName(), &status)); + LocalUResourceBundlePointer ownedResource(ures_open(nullptr, desiredLocale.getName(), &status)); if (U_FAILURE(status)) { - return NULL; + return nullptr; } else { // Loads the decimal symbols of the desired locale. symbolsToAdopt.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(desiredLocale, status), status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } // Load the pattern from data using the common library function @@ -1407,15 +1417,15 @@ NumberFormat::makeInstance(const Locale& desiredLocale, ns->getName(), gFormatCldrStyles[style], status); - pattern = UnicodeString(TRUE, patternPtr, -1); + pattern = UnicodeString(true, patternPtr, -1); } if (U_FAILURE(status)) { - return NULL; + return nullptr; } if(style==UNUM_CURRENCY || style == UNUM_CURRENCY_ISO || style == UNUM_CURRENCY_ACCOUNTING || style == UNUM_CASH_CURRENCY || style == UNUM_CURRENCY_STANDARD){ - const UChar* currPattern = symbolsToAdopt->getCurrencyPattern(); - if(currPattern!=NULL){ + const char16_t* currPattern = symbolsToAdopt->getCurrencyPattern(); + if(currPattern!=nullptr){ pattern.setTo(currPattern, u_strlen(currPattern)); } } @@ -1450,9 +1460,9 @@ NumberFormat::makeInstance(const Locale& desiredLocale, } RuleBasedNumberFormat *r = new RuleBasedNumberFormat(desiredRulesType,nsLoc,status); - if (r == NULL) { + if (r == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } r->setDefaultRuleSet(nsRuleSetName,status); f.adoptInstead(r); @@ -1460,8 +1470,8 @@ NumberFormat::makeInstance(const Locale& desiredLocale, // replace single currency sign in the pattern with double currency sign // if the style is UNUM_CURRENCY_ISO if (style == UNUM_CURRENCY_ISO) { - pattern.findAndReplace(UnicodeString(TRUE, gSingleCurrencySign, 1), - UnicodeString(TRUE, gDoubleCurrencySign, 2)); + pattern.findAndReplace(UnicodeString(true, gSingleCurrencySign, 1), + UnicodeString(true, gDoubleCurrencySign, 2)); } // "new DecimalFormat()" does not adopt the symbols argument if its memory allocation fails. @@ -1496,7 +1506,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale, f->setLocaleIDs(ures_getLocaleByType(ownedResource.getAlias(), ULOC_VALID_LOCALE, &status), ures_getLocaleByType(ownedResource.getAlias(), ULOC_ACTUAL_LOCALE, &status)); if (U_FAILURE(status)) { - return NULL; + return nullptr; } return f.orphan(); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.cpp index 7e97c0bc1..ad3d48b47 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numparse_types.h" #include "numparse_affixes.h" @@ -103,7 +101,7 @@ void AffixPatternMatcherBuilder::consumeToken(AffixPatternType type, UChar32 cp, addMatcher(fWarehouse.currency(status)); break; default: - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } } else if (fIgnorables != nullptr && fIgnorables->getSet()->contains(cp)) { @@ -129,8 +127,8 @@ void AffixPatternMatcherBuilder::addMatcher(NumberParseMatcher& matcher) { fMatchers[fMatchersLen++] = &matcher; } -AffixPatternMatcher AffixPatternMatcherBuilder::build() { - return AffixPatternMatcher(fMatchers, fMatchersLen, fPattern); +AffixPatternMatcher AffixPatternMatcherBuilder::build(UErrorCode& status) { + return AffixPatternMatcher(fMatchers, fMatchersLen, fPattern, status); } AffixTokenMatcherWarehouse::AffixTokenMatcherWarehouse(const AffixTokenMatcherSetupData* setupData) @@ -171,6 +169,10 @@ NumberParseMatcher* AffixTokenMatcherWarehouse::nextCodePointMatcher(UChar32 cp, return result; } +bool AffixTokenMatcherWarehouse::hasEmptyCurrencySymbol() const { + return fSetupData->currencySymbols.hasEmptyCurrencySymbol(); +} + CodePointMatcher::CodePointMatcher(UChar32 cp) : fCp(cp) {} @@ -211,12 +213,13 @@ AffixPatternMatcher AffixPatternMatcher::fromAffixPattern(const UnicodeString& a AffixPatternMatcherBuilder builder(affixPattern, tokenWarehouse, ignorables); AffixUtils::iterateWithConsumer(affixPattern, builder, status); - return builder.build(); + return builder.build(status); } AffixPatternMatcher::AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, - const UnicodeString& pattern) - : ArraySeriesMatcher(matchers, matchersLen), fPattern(pattern) {} + const UnicodeString& pattern, UErrorCode& status) + : ArraySeriesMatcher(matchers, matchersLen), fPattern(pattern, status) { +} UnicodeString AffixPatternMatcher::getPattern() const { return fPattern.toAliasedUnicodeString(); @@ -273,8 +276,6 @@ void AffixMatcherWarehouse::createAffixMatchers(const AffixPatternProvider& patt // Use initial capacity of 6, the highest possible number of AffixMatchers. UnicodeString sb; bool includeUnpaired = 0 != (parseFlags & PARSE_FLAG_INCLUDE_UNPAIRED_AFFIXES); - UNumberSignDisplay signDisplay = (0 != (parseFlags & PARSE_FLAG_PLUS_SIGN_ALLOWED)) ? UNUM_SIGN_ALWAYS - : UNUM_SIGN_AUTO; int32_t numAffixMatchers = 0; int32_t numAffixPatternMatchers = 0; @@ -283,28 +284,48 @@ void AffixMatcherWarehouse::createAffixMatchers(const AffixPatternProvider& patt AffixPatternMatcher* posSuffix = nullptr; // Pre-process the affix strings to resolve LDML rules like sign display. - for (int8_t signumInt = 1; signumInt >= -1; signumInt--) { - auto signum = static_cast(signumInt); + for (int8_t typeInt = 0; typeInt < PATTERN_SIGN_TYPE_COUNT * 2; typeInt++) { + auto type = static_cast(typeInt / 2); + bool dropCurrencySymbols = (typeInt % 2) == 1; + + if (dropCurrencySymbols && !patternInfo.hasCurrencySign()) { + continue; + } + if (dropCurrencySymbols && !fTokenWarehouse->hasEmptyCurrencySymbol()) { + continue; + } + + // Skip affixes in some cases + if (type == PATTERN_SIGN_TYPE_POS + && 0 != (parseFlags & PARSE_FLAG_PLUS_SIGN_ALLOWED)) { + continue; + } + if (type == PATTERN_SIGN_TYPE_POS_SIGN + && 0 == (parseFlags & PARSE_FLAG_PLUS_SIGN_ALLOWED)) { + continue; + } // Generate Prefix + // TODO: Handle approximately sign? bool hasPrefix = false; PatternStringUtils::patternInfoToStringBuilder( - patternInfo, true, signum, signDisplay, StandardPlural::OTHER, false, sb); + patternInfo, true, type, false, StandardPlural::OTHER, false, dropCurrencySymbols, sb); fAffixPatternMatchers[numAffixPatternMatchers] = AffixPatternMatcher::fromAffixPattern( sb, *fTokenWarehouse, parseFlags, &hasPrefix, status); AffixPatternMatcher* prefix = hasPrefix ? &fAffixPatternMatchers[numAffixPatternMatchers++] : nullptr; // Generate Suffix + // TODO: Handle approximately sign? bool hasSuffix = false; PatternStringUtils::patternInfoToStringBuilder( - patternInfo, false, signum, signDisplay, StandardPlural::OTHER, false, sb); + patternInfo, false, type, false, StandardPlural::OTHER, false, dropCurrencySymbols, sb); fAffixPatternMatchers[numAffixPatternMatchers] = AffixPatternMatcher::fromAffixPattern( sb, *fTokenWarehouse, parseFlags, &hasSuffix, status); AffixPatternMatcher* suffix = hasSuffix ? &fAffixPatternMatchers[numAffixPatternMatchers++] : nullptr; - if (signum == 1) { + if (type == PATTERN_SIGN_TYPE_POS) { posPrefix = prefix; posSuffix = suffix; } else if (equals(prefix, posPrefix) && equals(suffix, posSuffix)) { @@ -313,17 +334,17 @@ void AffixMatcherWarehouse::createAffixMatchers(const AffixPatternProvider& patt } // Flags for setting in the ParsedNumber; the token matchers may add more. - int flags = (signum == -1) ? FLAG_NEGATIVE : 0; + int flags = (type == PATTERN_SIGN_TYPE_NEG) ? FLAG_NEGATIVE : 0; // Note: it is indeed possible for posPrefix and posSuffix to both be null. // We still need to add that matcher for strict mode to work. fAffixMatchers[numAffixMatchers++] = {prefix, suffix, flags}; if (includeUnpaired && prefix != nullptr && suffix != nullptr) { // The following if statements are designed to prevent adding two identical matchers. - if (signum == 1 || !equals(prefix, posPrefix)) { + if (type == PATTERN_SIGN_TYPE_POS || !equals(prefix, posPrefix)) { fAffixMatchers[numAffixMatchers++] = {prefix, nullptr, flags}; } - if (signum == 1 || !equals(suffix, posSuffix)) { + if (type == PATTERN_SIGN_TYPE_POS || !equals(suffix, posSuffix)) { fAffixMatchers[numAffixMatchers++] = {nullptr, suffix, flags}; } } @@ -440,28 +461,3 @@ UnicodeString AffixMatcher::toString() const { #endif /* #if !UCONFIG_NO_FORMATTING */ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.h b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.h index e02b17ba2..81b633c26 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.h @@ -28,7 +28,7 @@ using ::icu::number::impl::TokenConsumer; using ::icu::number::impl::CurrencySymbols; -class CodePointMatcher : public NumberParseMatcher, public UMemory { +class U_I18N_API CodePointMatcher : public NumberParseMatcher, public UMemory { public: CodePointMatcher() = default; // WARNING: Leaves the object in an unusable state @@ -53,7 +53,7 @@ class CodePointMatcher : public NumberParseMatcher, public UMemory { // Note: These need to be outside of the numparse::impl namespace, or Clang will generate a compile error. #if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN template class U_I18N_API MaybeStackArray; -template class U_I18N_API MaybeStackArray; +template class U_I18N_API MaybeStackArray; template class U_I18N_API MemoryPool; template class U_I18N_API numparse::impl::CompactUnicodeString<4>; #endif @@ -101,6 +101,8 @@ class U_I18N_API AffixTokenMatcherWarehouse : public UMemory { NumberParseMatcher* nextCodePointMatcher(UChar32 cp, UErrorCode& status); + bool hasEmptyCurrencySymbol() const; + private: // NOTE: The following field may be unsafe to access after construction is done! const AffixTokenMatcherSetupData* fSetupData; @@ -128,7 +130,7 @@ class AffixPatternMatcherBuilder : public TokenConsumer, public MutableMatcherCo void consumeToken(::icu::number::impl::AffixPatternType type, UChar32 cp, UErrorCode& status) override; /** NOTE: You can build only once! */ - AffixPatternMatcher build(); + AffixPatternMatcher build(UErrorCode& status); private: ArraySeriesMatcher::MatcherArray fMatchers; @@ -160,7 +162,8 @@ class U_I18N_API AffixPatternMatcher : public ArraySeriesMatcher { private: CompactUnicodeString<4> fPattern; - AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, const UnicodeString& pattern); + AffixPatternMatcher(MatcherArray& matchers, int32_t matchersLen, const UnicodeString& pattern, + UErrorCode& status); friend class AffixPatternMatcherBuilder; }; @@ -203,10 +206,12 @@ class AffixMatcherWarehouse { UErrorCode& status); private: - // 9 is the limit: positive, zero, and negative, each with prefix, suffix, and prefix+suffix - AffixMatcher fAffixMatchers[9]; - // 6 is the limit: positive, zero, and negative, a prefix and a suffix for each - AffixPatternMatcher fAffixPatternMatchers[6]; + // 18 is the limit: positive, zero, and negative, each with prefix, suffix, and prefix+suffix, + // and doubled since there may be an empty currency symbol + AffixMatcher fAffixMatchers[18]; + // 6 is the limit: positive, zero, and negative, a prefix and a suffix for each, + // and doubled since there may be an empty currency symbol + AffixPatternMatcher fAffixPatternMatchers[12]; // Reference to the warehouse for tokens used by the AffixPatternMatchers AffixTokenMatcherWarehouse* fTokenWarehouse; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.cpp index 66308a068..2f7e1ab28 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numparse_types.h" #include "numparse_compositions.h" diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.h b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.h index 5196c8ba6..f085912de 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.h @@ -1,12 +1,11 @@ // © 2018 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -#ifndef __SOURCE_NUMPARSE_COMPOSITIONS_H_ -#define __SOURCE_NUMPARSE_COMPOSITIONS_H_ - #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING +#ifndef __SOURCE_NUMPARSE_COMPOSITIONS__ +#define __SOURCE_NUMPARSE_COMPOSITIONS__ #include "numparse_types.h" diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.cpp index 610abe2f2..7bbb060f3 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numparse_types.h" #include "numparse_currency.h" @@ -44,7 +42,7 @@ CombinedCurrencyMatcher::CombinedCurrencyMatcher(const CurrencySymbols& currency // TODO: Figure out how to make this faster and re-enable. // Computing the "lead code points" set for fastpathing is too slow to use in production. - // See http://bugs.icu-project.org/trac/ticket/13584 + // See https://unicode-org.atlassian.net/browse/ICU-13584 // // Compute the full set of characters that could be the first in a currency to allow for // // efficient smoke test. // fLeadCodePoints.add(fCurrency1.char32At(0)); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.h b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.h index a94943312..4e99334a3 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.h @@ -44,7 +44,7 @@ class U_I18N_API CombinedCurrencyMatcher : public NumberParseMatcher, public UMe UnicodeString toString() const override; private: - UChar fCurrencyCode[4]; + char16_t fCurrencyCode[4]; UnicodeString fCurrency1; UnicodeString fCurrency2; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.cpp index 768fc06b9..8b99fd7ad 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.cpp @@ -7,9 +7,8 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif + #include "numparse_types.h" #include "numparse_decimal.h" #include "static_unicode_sets.h" @@ -34,16 +33,16 @@ DecimalMatcher::DecimalMatcher(const DecimalFormatSymbols& symbols, const Groupe decimalSeparator = symbols.getConstSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol); } bool strictSeparators = 0 != (parseFlags & PARSE_FLAG_STRICT_SEPARATORS); - unisets::Key groupingKey = strictSeparators ? unisets::UNISET_KEY_STRICT_ALL_SEPARATORS - : unisets::UNISET_KEY_ALL_SEPARATORS; + unisets::Key groupingKey = strictSeparators ? unisets::STRICT_ALL_SEPARATORS + : unisets::ALL_SEPARATORS; // Attempt to find separators in the static cache groupingUniSet = unisets::get(groupingKey); unisets::Key decimalKey = unisets::chooseFrom( decimalSeparator, - strictSeparators ? unisets::UNISET_KEY_STRICT_COMMA : unisets::UNISET_KEY_COMMA, - strictSeparators ? unisets::UNISET_KEY_STRICT_PERIOD : unisets::UNISET_KEY_PERIOD); + strictSeparators ? unisets::STRICT_COMMA : unisets::COMMA, + strictSeparators ? unisets::STRICT_PERIOD : unisets::PERIOD); if (decimalKey >= 0) { decimalUniSet = unisets::get(decimalKey); } else if (!decimalSeparator.isEmpty()) { @@ -53,15 +52,15 @@ DecimalMatcher::DecimalMatcher(const DecimalFormatSymbols& symbols, const Groupe decimalUniSet = set; fLocalDecimalUniSet.adoptInstead(set); } else { - decimalUniSet = unisets::get(unisets::UNISET_KEY_EMPTY); + decimalUniSet = unisets::get(unisets::EMPTY); } if (groupingKey >= 0 && decimalKey >= 0) { // Everything is available in the static cache separatorSet = groupingUniSet; leadSet = unisets::get( - strictSeparators ? unisets::UNISET_KEY_DIGITS_OR_ALL_SEPARATORS - : unisets::UNISET_KEY_DIGITS_OR_STRICT_ALL_SEPARATORS); + strictSeparators ? unisets::DIGITS_OR_ALL_SEPARATORS + : unisets::DIGITS_OR_STRICT_ALL_SEPARATORS); } else { auto* set = new UnicodeSet(); set->addAll(*groupingUniSet); @@ -89,7 +88,7 @@ DecimalMatcher::DecimalMatcher(const DecimalFormatSymbols& symbols, const Groupe grouping2 = grouper.getSecondary(); // Fraction grouping parsing is disabled for now but could be enabled later. - // See http://bugs.icu-project.org/trac/ticket/10794 + // See https://unicode-org.atlassian.net/browse/ICU-10794 // fractionGrouping = 0 != (parseFlags & PARSE_FLAG_FRACTION_GROUPING_ENABLED); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.h b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.h index ec6c76487..07c9afecc 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.h @@ -39,7 +39,7 @@ class DecimalMatcher : public NumberParseMatcher, public UMemory { bool groupingDisabled; // Fraction grouping parsing is disabled for now but could be enabled later. - // See http://bugs.icu-project.org/trac/ticket/10794 + // See https://unicode-org.atlassian.net/browse/ICU-10794 // bool fractionGrouping; /** If true, do not accept numbers in the fraction */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_impl.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_impl.cpp index ab81e47f8..91c60747f 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_impl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_impl.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include #include @@ -85,23 +83,14 @@ NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatPr const DecimalFormatSymbols& symbols, bool parseCurrency, UErrorCode& status) { Locale locale = symbols.getLocale(); - PropertiesAffixPatternProvider localPAPP; - CurrencyPluralInfoAffixProvider localCPIAP; - AffixPatternProvider* affixProvider; - if (properties.currencyPluralInfo.fPtr.isNull()) { - localPAPP.setTo(properties, status); - affixProvider = &localPAPP; - } else { - localCPIAP.setTo(*properties.currencyPluralInfo.fPtr, properties, status); - affixProvider = &localCPIAP; - } - if (affixProvider == nullptr || U_FAILURE(status)) { return nullptr; } + AutoAffixPatternProvider affixProvider(properties, status); + if (U_FAILURE(status)) { return nullptr; } CurrencyUnit currency = resolveCurrency(properties, locale, status); CurrencySymbols currencySymbols(currency, locale, symbols, status); bool isStrict = properties.parseMode.getOrDefault(PARSE_MODE_STRICT) == PARSE_MODE_STRICT; Grouper grouper = Grouper::forProperties(properties); int parseFlags = 0; - if (affixProvider == nullptr || U_FAILURE(status)) { return nullptr; } + if (U_FAILURE(status)) { return nullptr; } if (!properties.parseCaseSensitive) { parseFlags |= PARSE_FLAG_IGNORE_CASE; } @@ -123,7 +112,7 @@ NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatPr if (grouper.getPrimary() <= 0) { parseFlags |= PARSE_FLAG_GROUPING_DISABLED; } - if (parseCurrency || affixProvider->hasCurrencySign()) { + if (parseCurrency || affixProvider.get().hasCurrencySign()) { parseFlags |= PARSE_FLAG_MONETARY_SEPARATORS; } if (!parseCurrency) { @@ -145,13 +134,13 @@ NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatPr parser->fLocalMatchers.affixTokenMatcherWarehouse = {&affixSetupData}; parser->fLocalMatchers.affixMatcherWarehouse = {&parser->fLocalMatchers.affixTokenMatcherWarehouse}; parser->fLocalMatchers.affixMatcherWarehouse.createAffixMatchers( - *affixProvider, *parser, ignorables, parseFlags, status); + affixProvider.get(), *parser, ignorables, parseFlags, status); //////////////////////// /// CURRENCY MATCHER /// //////////////////////// - if (parseCurrency || affixProvider->hasCurrencySign()) { + if (parseCurrency || affixProvider.get().hasCurrencySign()) { parser->addMatcher(parser->fLocalMatchers.currency = {currencySymbols, symbols, parseFlags, status}); } @@ -161,10 +150,10 @@ NumberParserImpl::createParserFromProperties(const number::impl::DecimalFormatPr // ICU-TC meeting, April 11, 2018: accept percent/permille only if it is in the pattern, // and to maintain regressive behavior, divide by 100 even if no percent sign is present. - if (!isStrict && affixProvider->containsSymbolType(AffixPatternType::TYPE_PERCENT, status)) { + if (!isStrict && affixProvider.get().containsSymbolType(AffixPatternType::TYPE_PERCENT, status)) { parser->addMatcher(parser->fLocalMatchers.percent = {symbols}); } - if (!isStrict && affixProvider->containsSymbolType(AffixPatternType::TYPE_PERMILLE, status)) { + if (!isStrict && affixProvider.get().containsSymbolType(AffixPatternType::TYPE_PERMILLE, status)) { parser->addMatcher(parser->fLocalMatchers.permille = {symbols}); } @@ -296,7 +285,7 @@ void NumberParserImpl::parseGreedy(StringSegment& segment, ParsedNumber& result, i++; continue; } - UPRV_UNREACHABLE; + UPRV_UNREACHABLE_EXIT; } // NOTE: If we get here, the greedy parse completed without consuming the entire string. diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_parsednumber.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_parsednumber.cpp index 1e63bbd65..4b373a3c3 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_parsednumber.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_parsednumber.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numparse_types.h" #include "number_decimalquantity.h" diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_scientific.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_scientific.cpp index efa01228d..4b88cd998 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_scientific.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_scientific.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numparse_types.h" #include "numparse_scientific.h" @@ -24,11 +22,11 @@ using namespace icu::numparse::impl; namespace { inline const UnicodeSet& minusSignSet() { - return *unisets::get(unisets::UNISET_KEY_MINUS_SIGN); + return *unisets::get(unisets::MINUS_SIGN); } inline const UnicodeSet& plusSignSet() { - return *unisets::get(unisets::UNISET_KEY_PLUS_SIGN); + return *unisets::get(unisets::PLUS_SIGN); } } // namespace diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_symbols.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_symbols.cpp index 7379f1a57..608f4f5c8 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_symbols.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_symbols.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numparse_types.h" #include "numparse_symbols.h" @@ -75,8 +73,8 @@ IgnorablesMatcher::IgnorablesMatcher(parse_flags_t parseFlags) : SymbolMatcher( {}, (0 != (parseFlags & PARSE_FLAG_STRICT_IGNORABLES)) ? - unisets::UNISET_KEY_STRICT_IGNORABLES : - unisets::UNISET_KEY_DEFAULT_IGNORABLES) { + unisets::STRICT_IGNORABLES : + unisets::DEFAULT_IGNORABLES) { } bool IgnorablesMatcher::isFlexible() const { @@ -97,7 +95,7 @@ void IgnorablesMatcher::accept(StringSegment&, ParsedNumber&) const { InfinityMatcher::InfinityMatcher(const DecimalFormatSymbols& dfs) - : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kInfinitySymbol), unisets::UNISET_KEY_INFINITY_SIGN) { + : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kInfinitySymbol), unisets::INFINITY_SIGN) { } bool InfinityMatcher::isDisabled(const ParsedNumber& result) const { @@ -111,7 +109,7 @@ void InfinityMatcher::accept(StringSegment& segment, ParsedNumber& result) const MinusSignMatcher::MinusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing) - : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol), unisets::UNISET_KEY_MINUS_SIGN), + : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kMinusSignSymbol), unisets::MINUS_SIGN), fAllowTrailing(allowTrailing) { } @@ -126,7 +124,7 @@ void MinusSignMatcher::accept(StringSegment& segment, ParsedNumber& result) cons NanMatcher::NanMatcher(const DecimalFormatSymbols& dfs) - : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kNaNSymbol), unisets::UNISET_KEY_EMPTY) { + : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kNaNSymbol), unisets::EMPTY) { } bool NanMatcher::isDisabled(const ParsedNumber& result) const { @@ -140,7 +138,7 @@ void NanMatcher::accept(StringSegment& segment, ParsedNumber& result) const { PaddingMatcher::PaddingMatcher(const UnicodeString& padString) - : SymbolMatcher(padString, unisets::UNISET_KEY_EMPTY) {} + : SymbolMatcher(padString, unisets::EMPTY) {} bool PaddingMatcher::isFlexible() const { return true; @@ -156,7 +154,7 @@ void PaddingMatcher::accept(StringSegment&, ParsedNumber&) const { PercentMatcher::PercentMatcher(const DecimalFormatSymbols& dfs) - : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPercentSymbol), unisets::UNISET_KEY_PERCENT_SIGN) { + : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPercentSymbol), unisets::PERCENT_SIGN) { } bool PercentMatcher::isDisabled(const ParsedNumber& result) const { @@ -170,7 +168,7 @@ void PercentMatcher::accept(StringSegment& segment, ParsedNumber& result) const PermilleMatcher::PermilleMatcher(const DecimalFormatSymbols& dfs) - : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPerMillSymbol), unisets::UNISET_KEY_PERMILLE_SIGN) { + : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPerMillSymbol), unisets::PERMILLE_SIGN) { } bool PermilleMatcher::isDisabled(const ParsedNumber& result) const { @@ -184,7 +182,7 @@ void PermilleMatcher::accept(StringSegment& segment, ParsedNumber& result) const PlusSignMatcher::PlusSignMatcher(const DecimalFormatSymbols& dfs, bool allowTrailing) - : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol), unisets::UNISET_KEY_PLUS_SIGN), + : SymbolMatcher(dfs.getConstSymbol(DecimalFormatSymbols::kPlusSignSymbol), unisets::PLUS_SIGN), fAllowTrailing(allowTrailing) { } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_types.h b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_types.h index b4007c2ff..8e881793f 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_types.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_types.h @@ -64,14 +64,15 @@ class CompactUnicodeString { fBuffer[0] = 0; } - CompactUnicodeString(const UnicodeString& text) - : fBuffer(text.length() + 1) { - uprv_memcpy(fBuffer.getAlias(), text.getBuffer(), sizeof(UChar) * text.length()); + CompactUnicodeString(const UnicodeString& text, UErrorCode& status) + : fBuffer(text.length() + 1, status) { + if (U_FAILURE(status)) { return; } + uprv_memcpy(fBuffer.getAlias(), text.getBuffer(), sizeof(char16_t) * text.length()); fBuffer[text.length()] = 0; } inline UnicodeString toAliasedUnicodeString() const { - return UnicodeString(TRUE, fBuffer.getAlias(), -1); + return UnicodeString(true, fBuffer.getAlias(), -1); } bool operator==(const CompactUnicodeString& other) const { @@ -80,7 +81,7 @@ class CompactUnicodeString { } private: - MaybeStackArray fBuffer; + MaybeStackArray fBuffer; }; @@ -124,7 +125,7 @@ class U_I18N_API ParsedNumber { /** * The currency that got consumed. */ - UChar currencyCode[4]; + char16_t currencyCode[4]; ParsedNumber(); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_utils.h b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_utils.h index 4b07c81ed..8fda4f436 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_utils.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_utils.h @@ -15,21 +15,21 @@ namespace impl { namespace utils { -// inline static void putLeadCodePoints(const UnicodeSet* input, UnicodeSet* output) { -// for (int32_t i = 0; i < input->getRangeCount(); i++) { -// output->add(input->getRangeStart(i), input->getRangeEnd(i)); -// } -// // TODO: ANDY: How to iterate over the strings in ICU4C UnicodeSet? -// } - -// inline static void putLeadCodePoint(const UnicodeString& input, UnicodeSet* output) { -// if (!input.isEmpty()) { -// output->add(input.char32At(0)); -// } -// } - -inline static void copyCurrencyCode(UChar* dest, const UChar* src) { - uprv_memcpy(dest, src, sizeof(UChar) * 3); +inline static void putLeadCodePoints(const UnicodeSet* input, UnicodeSet* output) { + for (int32_t i = 0; i < input->getRangeCount(); i++) { + output->add(input->getRangeStart(i), input->getRangeEnd(i)); + } + // TODO: ANDY: How to iterate over the strings in ICU4C UnicodeSet? +} + +inline static void putLeadCodePoint(const UnicodeString& input, UnicodeSet* output) { + if (!input.isEmpty()) { + output->add(input.char32At(0)); + } +} + +inline static void copyCurrencyCode(char16_t* dest, const char16_t* src) { + uprv_memcpy(dest, src, sizeof(char16_t) * 3); dest[3] = 0; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.cpp index 13ab3cd54..12d3465c4 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.cpp @@ -7,9 +7,7 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numparse_types.h" #include "numparse_validators.h" diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.h b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.h index 5d43b779d..9bb4b482b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.h @@ -16,33 +16,33 @@ namespace impl { class ValidationMatcher : public NumberParseMatcher { public: - bool match(StringSegment&, ParsedNumber&, UErrorCode&) const U_OVERRIDE { + bool match(StringSegment&, ParsedNumber&, UErrorCode&) const override { // No-op return false; } - bool smokeTest(const StringSegment&) const U_OVERRIDE { + bool smokeTest(const StringSegment&) const override { // No-op return false; } - void postProcess(ParsedNumber& result) const U_OVERRIDE = 0; + void postProcess(ParsedNumber& result) const override = 0; }; class RequireAffixValidator : public ValidationMatcher, public UMemory { public: - void postProcess(ParsedNumber& result) const U_OVERRIDE; + void postProcess(ParsedNumber& result) const override; - UnicodeString toString() const U_OVERRIDE; + UnicodeString toString() const override; }; class RequireCurrencyValidator : public ValidationMatcher, public UMemory { public: - void postProcess(ParsedNumber& result) const U_OVERRIDE; + void postProcess(ParsedNumber& result) const override; - UnicodeString toString() const U_OVERRIDE; + UnicodeString toString() const override; }; @@ -52,9 +52,9 @@ class RequireDecimalSeparatorValidator : public ValidationMatcher, public UMemor RequireDecimalSeparatorValidator(bool patternHasDecimalSeparator); - void postProcess(ParsedNumber& result) const U_OVERRIDE; + void postProcess(ParsedNumber& result) const override; - UnicodeString toString() const U_OVERRIDE; + UnicodeString toString() const override; private: bool fPatternHasDecimalSeparator; @@ -63,9 +63,9 @@ class RequireDecimalSeparatorValidator : public ValidationMatcher, public UMemor class RequireNumberValidator : public ValidationMatcher, public UMemory { public: - void postProcess(ParsedNumber& result) const U_OVERRIDE; + void postProcess(ParsedNumber& result) const override; - UnicodeString toString() const U_OVERRIDE; + UnicodeString toString() const override; }; @@ -78,9 +78,9 @@ class MultiplierParseHandler : public ValidationMatcher, public UMemory { MultiplierParseHandler(::icu::number::Scale multiplier); - void postProcess(ParsedNumber& result) const U_OVERRIDE; + void postProcess(ParsedNumber& result) const override; - UnicodeString toString() const U_OVERRIDE; + UnicodeString toString() const override; private: ::icu::number::Scale fMultiplier; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numrange_capi.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_capi.cpp new file mode 100644 index 000000000..9222969eb --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_capi.cpp @@ -0,0 +1,198 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +// Allow implicit conversion from char16_t* to UnicodeString for this file: +// Helpful in toString methods and elsewhere. +#define UNISTR_FROM_STRING_EXPLICIT + +#include "fphdlimp.h" +#include "number_utypes.h" +#include "numparse_types.h" +#include "formattedval_impl.h" +#include "numrange_impl.h" +#include "number_decnum.h" +#include "unicode/numberrangeformatter.h" +#include "unicode/unumberrangeformatter.h" + +using namespace icu; +using namespace icu::number; +using namespace icu::number::impl; + + +U_NAMESPACE_BEGIN +namespace number { +namespace impl { + +/** + * Implementation class for UNumberRangeFormatter. Wraps a LocalizedRangeNumberFormatter. + */ +struct UNumberRangeFormatterData : public UMemory, + // Magic number as ASCII == "NRF" (NumberRangeFormatter) + public IcuCApiHelper { + LocalizedNumberRangeFormatter fFormatter; +}; + +struct UFormattedNumberRangeImpl; + +// Magic number as ASCII == "FDN" (FormatteDNumber) +typedef IcuCApiHelper UFormattedNumberRangeApiHelper; + +struct UFormattedNumberRangeImpl : public UFormattedValueImpl, public UFormattedNumberRangeApiHelper { + UFormattedNumberRangeImpl(); + ~UFormattedNumberRangeImpl(); + + FormattedNumberRange fImpl; + UFormattedNumberRangeData fData; +}; + +UFormattedNumberRangeImpl::UFormattedNumberRangeImpl() + : fImpl(&fData) { + fFormattedValue = &fImpl; +} + +UFormattedNumberRangeImpl::~UFormattedNumberRangeImpl() { + // Disown the data from fImpl so it doesn't get deleted twice + fImpl.fData = nullptr; +} + +} // namespace impl +} // namespace number +U_NAMESPACE_END + + +UPRV_FORMATTED_VALUE_CAPI_NO_IMPLTYPE_AUTO_IMPL( + UFormattedNumberRange, + UFormattedNumberRangeImpl, + UFormattedNumberRangeApiHelper, + unumrf) + + +const UFormattedNumberRangeData* number::impl::validateUFormattedNumberRange( + const UFormattedNumberRange* uresult, UErrorCode& status) { + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, status); + if (U_FAILURE(status)) { + return nullptr; + } + return &result->fData; +} + + +U_CAPI UNumberRangeFormatter* U_EXPORT2 +unumrf_openForSkeletonWithCollapseAndIdentityFallback( + const char16_t* skeleton, + int32_t skeletonLen, + UNumberRangeCollapse collapse, + UNumberRangeIdentityFallback identityFallback, + const char* locale, + UParseError* perror, + UErrorCode* ec) { + auto* impl = new UNumberRangeFormatterData(); + if (impl == nullptr) { + *ec = U_MEMORY_ALLOCATION_ERROR; + return nullptr; + } + // Readonly-alias constructor (first argument is whether we are NUL-terminated) + UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen); + UParseError tempParseError; + impl->fFormatter = NumberRangeFormatter::withLocale(locale) + .numberFormatterBoth(NumberFormatter::forSkeleton(skeletonString, (perror == nullptr) ? tempParseError : *perror, *ec)) + .collapse(collapse) + .identityFallback(identityFallback); + return impl->exportForC(); +} + +U_CAPI void U_EXPORT2 +unumrf_formatDoubleRange( + const UNumberRangeFormatter* uformatter, + double first, + double second, + UFormattedNumberRange* uresult, + UErrorCode* ec) { + const UNumberRangeFormatterData* formatter = UNumberRangeFormatterData::validate(uformatter, *ec); + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { return; } + + result->fData.resetString(); + result->fData.quantity1.clear(); + result->fData.quantity2.clear(); + result->fData.quantity1.setToDouble(first); + result->fData.quantity2.setToDouble(second); + formatter->fFormatter.formatImpl(result->fData, first == second, *ec); +} + +U_CAPI void U_EXPORT2 +unumrf_formatDecimalRange( + const UNumberRangeFormatter* uformatter, + const char* first, int32_t firstLen, + const char* second, int32_t secondLen, + UFormattedNumberRange* uresult, + UErrorCode* ec) { + const UNumberRangeFormatterData* formatter = UNumberRangeFormatterData::validate(uformatter, *ec); + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { return; } + + result->fData.resetString(); + result->fData.quantity1.clear(); + result->fData.quantity2.clear(); + result->fData.quantity1.setToDecNumber({first, firstLen}, *ec); + result->fData.quantity2.setToDecNumber({second, secondLen}, *ec); + formatter->fFormatter.formatImpl(result->fData, first == second, *ec); +} + +U_CAPI UNumberRangeIdentityResult U_EXPORT2 +unumrf_resultGetIdentityResult( + const UFormattedNumberRange* uresult, + UErrorCode* ec) { + auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return UNUM_IDENTITY_RESULT_COUNT; + } + return result->fData.identityResult; +} + +U_CAPI int32_t U_EXPORT2 +unumrf_resultGetFirstDecimalNumber( + const UFormattedNumberRange* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec) { + const auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return 0; + } + DecNum decnum; + return result->fData.quantity1.toDecNum(decnum, *ec) + .toCharString(*ec) + .extract(dest, destCapacity, *ec); +} + +U_CAPI int32_t U_EXPORT2 +unumrf_resultGetSecondDecimalNumber( + const UFormattedNumberRange* uresult, + char* dest, + int32_t destCapacity, + UErrorCode* ec) { + const auto* result = UFormattedNumberRangeApiHelper::validate(uresult, *ec); + if (U_FAILURE(*ec)) { + return 0; + } + DecNum decnum; + return result->fData.quantity2 + .toDecNum(decnum, *ec) + .toCharString(*ec) + .extract(dest, destCapacity, *ec); +} + +U_CAPI void U_EXPORT2 +unumrf_close(UNumberRangeFormatter* f) { + UErrorCode localStatus = U_ZERO_ERROR; + const UNumberRangeFormatterData* impl = UNumberRangeFormatterData::validate(f, localStatus); + delete impl; +} + + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numrange_fluent.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_fluent.cpp index 8d192a901..0944f3024 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numrange_fluent.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_fluent.cpp @@ -7,13 +7,12 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "numrange_impl.h" #include "util.h" #include "number_utypes.h" +#include "number_decnum.h" using namespace icu; using namespace icu::number; @@ -192,68 +191,69 @@ LocalizedNumberRangeFormatter NumberRangeFormatter::withLocale(const Locale& loc } -template using numrange_fluent_NFS = NumberRangeFormatterSettings; -using numrange_fluent_LNF = LocalizedNumberRangeFormatter; -using numrange_fluent_UNF = UnlocalizedNumberRangeFormatter; +template using NFS = NumberRangeFormatterSettings; +using LNF = LocalizedNumberRangeFormatter; +using UNF = UnlocalizedNumberRangeFormatter; -UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const numrange_fluent_UNF& other) - : numrange_fluent_UNF(static_cast&>(other)) {} +UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const UNF& other) + : UNF(static_cast&>(other)) {} -UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const numrange_fluent_NFS& other) - : numrange_fluent_NFS(other) { +UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(const NFS& other) + : NFS(other) { // No additional fields to assign } // Make default copy constructor call the NumberRangeFormatterSettings copy constructor. -UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(numrange_fluent_UNF&& src) U_NOEXCEPT - : numrange_fluent_UNF(static_cast&&>(src)) {} +UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(UNF&& src) noexcept + : UNF(static_cast&&>(src)) {} -UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(numrange_fluent_NFS&& src) U_NOEXCEPT - : numrange_fluent_NFS(std::move(src)) { +UnlocalizedNumberRangeFormatter::UnlocalizedNumberRangeFormatter(NFS&& src) noexcept + : NFS(std::move(src)) { // No additional fields to assign } -UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(const numrange_fluent_UNF& other) { - numrange_fluent_NFS::operator=(static_cast&>(other)); +UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(const UNF& other) { + NFS::operator=(static_cast&>(other)); // No additional fields to assign return *this; } -UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(numrange_fluent_UNF&& src) U_NOEXCEPT { - numrange_fluent_NFS::operator=(static_cast&&>(src)); +UnlocalizedNumberRangeFormatter& UnlocalizedNumberRangeFormatter::operator=(UNF&& src) noexcept { + NFS::operator=(static_cast&&>(src)); // No additional fields to assign return *this; } // Make default copy constructor call the NumberRangeFormatterSettings copy constructor. -LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const numrange_fluent_LNF& other) - : numrange_fluent_LNF(static_cast&>(other)) {} +LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const LNF& other) + : LNF(static_cast&>(other)) {} -LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const numrange_fluent_NFS& other) - : numrange_fluent_NFS(other) { +LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(const NFS& other) + : NFS(other) { // No additional fields to assign } -LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT - : numrange_fluent_LNF(static_cast&&>(src)) {} +LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) noexcept + : LNF(static_cast&&>(src)) {} -LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(numrange_fluent_NFS&& src) U_NOEXCEPT - : numrange_fluent_NFS(std::move(src)) { +LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(NFS&& src) noexcept + : NFS(std::move(src)) { // Steal the compiled formatter - numrange_fluent_LNF&& _src = static_cast(src); + LNF&& _src = static_cast(src); auto* stolen = _src.fAtomicFormatter.exchange(nullptr); delete fAtomicFormatter.exchange(stolen); } -LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(const numrange_fluent_LNF& other) { - numrange_fluent_NFS::operator=(static_cast&>(other)); +LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(const LNF& other) { + if (this == &other) { return *this; } // self-assignment: no-op + NFS::operator=(static_cast&>(other)); // Do not steal; just clear delete fAtomicFormatter.exchange(nullptr); return *this; } -LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(numrange_fluent_LNF&& src) U_NOEXCEPT { - numrange_fluent_NFS::operator=(static_cast&&>(src)); +LocalizedNumberRangeFormatter& LocalizedNumberRangeFormatter::operator=(LNF&& src) noexcept { + NFS::operator=(static_cast&&>(src)); // Steal the compiled formatter auto* stolen = src.fAtomicFormatter.exchange(nullptr); delete fAtomicFormatter.exchange(stolen); @@ -336,7 +336,7 @@ void LocalizedNumberRangeFormatter::formatImpl( results.getStringRef().writeTerminator(status); } -const icu::number::impl::NumberRangeFormatterImpl* +const impl::NumberRangeFormatterImpl* LocalizedNumberRangeFormatter::getFormatter(UErrorCode& status) const { // TODO: Move this into umutex.h? (similar logic also in decimfmt.cpp) // See ICU-20146 @@ -354,6 +354,7 @@ LocalizedNumberRangeFormatter::getFormatter(UErrorCode& status) const { // Try computing the formatter on our own auto* temp = new NumberRangeFormatterImpl(fMacros, status); if (U_FAILURE(status)) { + delete temp; return nullptr; } if (temp == nullptr) { @@ -377,45 +378,4 @@ LocalizedNumberRangeFormatter::getFormatter(UErrorCode& status) const { } -UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedNumberRange) - -#define UPRV_NOARG - -UBool FormattedNumberRange::nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(FALSE) - // NOTE: MSVC sometimes complains when implicitly converting between bool and UBool - return fData->nextFieldPosition(fieldPosition, status); -} - -void FormattedNumberRange::getAllFieldPositions(FieldPositionIterator& iterator, UErrorCode& status) const { - FieldPositionIteratorHandler fpih(&iterator, status); - getAllFieldPositionsImpl(fpih, status); -} - -void FormattedNumberRange::getAllFieldPositionsImpl( - FieldPositionIteratorHandler& fpih, UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(UPRV_NOARG) - fData->getAllFieldPositions(fpih, status); -} - -UnicodeString FormattedNumberRange::getFirstDecimal(UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) - return fData->quantity1.toScientificString(); -} - -UnicodeString FormattedNumberRange::getSecondDecimal(UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(ICU_Utility::makeBogusString()) - return fData->quantity2.toScientificString(); -} - -UNumberRangeIdentityResult FormattedNumberRange::getIdentityResult(UErrorCode& status) const { - UPRV_FORMATTED_VALUE_METHOD_GUARD(UNUM_IDENTITY_RESULT_NOT_EQUAL) - return fData->identityResult; -} - - -UFormattedNumberRangeData::~UFormattedNumberRangeData() = default; - - - #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.cpp index 5529027c9..002a8b2a2 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.cpp @@ -7,13 +7,12 @@ // Allow implicit conversion from char16_t* to UnicodeString for this file: // Helpful in toString methods and elsewhere. -#ifndef UNISTR_FROM_STRING_EXPLICIT #define UNISTR_FROM_STRING_EXPLICIT -#endif #include "unicode/numberrangeformatter.h" #include "numrange_impl.h" #include "patternprops.h" +#include "pluralranges.h" #include "uresimp.h" #include "util.h" @@ -31,14 +30,15 @@ constexpr int8_t identity2d(UNumberRangeIdentityFallback a, UNumberRangeIdentity struct NumberRangeData { SimpleFormatter rangePattern; - SimpleFormatter approximatelyPattern; + // Note: approximatelyPattern is unused since ICU 69. + // SimpleFormatter approximatelyPattern; }; class NumberRangeDataSink : public ResourceSink { public: NumberRangeDataSink(NumberRangeData& data) : fData(data) {} - void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE { + void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) override { ResourceTable miscTable = value.getTable(status); if (U_FAILURE(status)) { return; } for (int i = 0; miscTable.getKeyAndValue(i, key, value); i++) { @@ -47,12 +47,16 @@ class NumberRangeDataSink : public ResourceSink { continue; // have already seen this pattern } fData.rangePattern = {value.getUnicodeString(status), status}; - } else if (uprv_strcmp(key, "approximately") == 0) { + } + /* + // Note: approximatelyPattern is unused since ICU 69. + else if (uprv_strcmp(key, "approximately") == 0) { if (hasApproxData()) { continue; // have already seen this pattern } fData.approximatelyPattern = {value.getUnicodeString(status), status}; } + */ } } @@ -60,21 +64,26 @@ class NumberRangeDataSink : public ResourceSink { return fData.rangePattern.getArgumentLimit() != 0; } + /* + // Note: approximatelyPattern is unused since ICU 69. bool hasApproxData() { return fData.approximatelyPattern.getArgumentLimit() != 0; } + */ bool isComplete() { - return hasRangeData() && hasApproxData(); + return hasRangeData() /* && hasApproxData() */; } void fillInDefaults(UErrorCode& status) { if (!hasRangeData()) { fData.rangePattern = {u"{0}–{1}", status}; } + /* if (!hasApproxData()) { fData.approximatelyPattern = {u"~{0}", status}; } + */ } private: @@ -83,7 +92,7 @@ class NumberRangeDataSink : public ResourceSink { void getNumberRangeData(const char* localeName, const char* nsName, NumberRangeData& data, UErrorCode& status) { if (U_FAILURE(status)) { return; } - LocalUResourceBundlePointer rb(ures_open(NULL, localeName, &status)); + LocalUResourceBundlePointer rb(ures_open(nullptr, localeName, &status)); if (U_FAILURE(status)) { return; } NumberRangeDataSink sink(data); @@ -108,102 +117,20 @@ void getNumberRangeData(const char* localeName, const char* nsName, NumberRangeD sink.fillInDefaults(status); } -class PluralRangesDataSink : public ResourceSink { - public: - PluralRangesDataSink(StandardPluralRanges& output) : fOutput(output) {} - - void put(const char* /*key*/, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE { - ResourceArray entriesArray = value.getArray(status); - if (U_FAILURE(status)) { return; } - fOutput.setCapacity(entriesArray.getSize()); - for (int i = 0; entriesArray.getValue(i, value); i++) { - ResourceArray pluralFormsArray = value.getArray(status); - if (U_FAILURE(status)) { return; } - pluralFormsArray.getValue(0, value); - StandardPlural::Form first = StandardPlural::fromString(value.getUnicodeString(status), status); - if (U_FAILURE(status)) { return; } - pluralFormsArray.getValue(1, value); - StandardPlural::Form second = StandardPlural::fromString(value.getUnicodeString(status), status); - if (U_FAILURE(status)) { return; } - pluralFormsArray.getValue(2, value); - StandardPlural::Form result = StandardPlural::fromString(value.getUnicodeString(status), status); - if (U_FAILURE(status)) { return; } - fOutput.addPluralRange(first, second, result); - } - } - - private: - StandardPluralRanges& fOutput; -}; - -void getPluralRangesData(const Locale& locale, StandardPluralRanges& output, UErrorCode& status) { - if (U_FAILURE(status)) { return; } - LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "pluralRanges", &status)); - if (U_FAILURE(status)) { return; } - - CharString dataPath; - dataPath.append("locales/", -1, status); - dataPath.append(locale.getLanguage(), -1, status); - if (U_FAILURE(status)) { return; } - int32_t setLen; - // Not all languages are covered: fail gracefully - UErrorCode internalStatus = U_ZERO_ERROR; - const UChar* set = ures_getStringByKeyWithFallback(rb.getAlias(), dataPath.data(), &setLen, &internalStatus); - if (U_FAILURE(internalStatus)) { return; } - - dataPath.clear(); - dataPath.append("rules/", -1, status); - dataPath.appendInvariantChars(set, setLen, status); - if (U_FAILURE(status)) { return; } - PluralRangesDataSink sink(output); - ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, status); - if (U_FAILURE(status)) { return; } -} - } // namespace -void StandardPluralRanges::initialize(const Locale& locale, UErrorCode& status) { - getPluralRangesData(locale, *this, status); -} - -void StandardPluralRanges::addPluralRange( - StandardPlural::Form first, - StandardPlural::Form second, - StandardPlural::Form result) { - U_ASSERT(fTriplesLen < fTriples.getCapacity()); - fTriples[fTriplesLen] = {first, second, result}; - fTriplesLen++; -} - -void StandardPluralRanges::setCapacity(int32_t length) { - if (length > fTriples.getCapacity()) { - fTriples.resize(length, 0); - } -} - -StandardPlural::Form -StandardPluralRanges::resolve(StandardPlural::Form first, StandardPlural::Form second) const { - for (int32_t i=0; iapply(data.getStringRef(), 0, length, status); - length += micros1.modMiddle->apply(data.getStringRef(), 0, length, status); - length += fApproximatelyModifier.apply(data.getStringRef(), 0, length, status); - micros1.modOuter->apply(data.getStringRef(), 0, length, status); + // Re-format using the approximately formatter: + MicroProps microsAppx; + data.quantity1.resetExponent(); + fApproximatelyFormatter.preProcess(data.quantity1, microsAppx, status); + int32_t length = NumberFormatterImpl::writeNumber(microsAppx.simple, data.quantity1, data.getStringRef(), 0, status); + length += microsAppx.modInner->apply(data.getStringRef(), 0, length, status); + length += microsAppx.modMiddle->apply(data.getStringRef(), 0, length, status); + microsAppx.modOuter->apply(data.getStringRef(), 0, length, status); } else { formatRange(data, micros1, micros2, status); } @@ -370,7 +308,8 @@ void NumberRangeFormatterImpl::formatRange(UFormattedNumberRangeData& data, // Only collapse if the modifier is a unit. // TODO: Make a better way to check for a unit? // TODO: Handle case where the modifier has both notation and unit (compact currency)? - if (!mm->containsField(UNUM_CURRENCY_FIELD) && !mm->containsField(UNUM_PERCENT_FIELD)) { + if (!mm->containsField({UFIELD_CATEGORY_NUMBER, UNUM_CURRENCY_FIELD}) + && !mm->containsField({UFIELD_CATEGORY_NUMBER, UNUM_PERCENT_FIELD})) { collapseMiddle = false; } } else if (fCollapse == UNUM_RANGE_COLLAPSE_AUTO) { @@ -388,7 +327,7 @@ void NumberRangeFormatterImpl::formatRange(UFormattedNumberRangeData& data, // INNER MODIFIER collapseInner = micros1.modInner->semanticallyEquivalent(*micros2.modInner); - // All done checking for collapsability. + // All done checking for collapsibility. break; } @@ -411,6 +350,7 @@ void NumberRangeFormatterImpl::formatRange(UFormattedNumberRangeData& data, #define UPRV_INDEX_1 (lengthPrefix + length1) #define UPRV_INDEX_2 (lengthPrefix + length1 + lengthInfix) #define UPRV_INDEX_3 (lengthPrefix + length1 + lengthInfix + length2) + #define UPRV_INDEX_4 (lengthPrefix + length1 + lengthInfix + length2 + lengthSuffix) int32_t lengthRange = SimpleModifier::formatTwoArgPattern( fRangeFormatter, @@ -418,7 +358,7 @@ void NumberRangeFormatterImpl::formatRange(UFormattedNumberRangeData& data, 0, &lengthPrefix, &lengthSuffix, - UNUM_FIELD_COUNT, + kUndefinedField, status); if (U_FAILURE(status)) { return; } lengthInfix = lengthRange - lengthPrefix - lengthSuffix; @@ -436,45 +376,55 @@ void NumberRangeFormatterImpl::formatRange(UFormattedNumberRangeData& data, if (repeatInner || repeatMiddle || repeatOuter) { // Add spacing if there is not already spacing if (!PatternProps::isWhiteSpace(string.charAt(UPRV_INDEX_1))) { - lengthInfix += string.insertCodePoint(UPRV_INDEX_1, u'\u0020', UNUM_FIELD_COUNT, status); + lengthInfix += string.insertCodePoint(UPRV_INDEX_1, u'\u0020', kUndefinedField, status); } if (!PatternProps::isWhiteSpace(string.charAt(UPRV_INDEX_2 - 1))) { - lengthInfix += string.insertCodePoint(UPRV_INDEX_2, u'\u0020', UNUM_FIELD_COUNT, status); + lengthInfix += string.insertCodePoint(UPRV_INDEX_2, u'\u0020', kUndefinedField, status); } } } - length1 += NumberFormatterImpl::writeNumber(micros1, data.quantity1, string, UPRV_INDEX_0, status); - length2 += NumberFormatterImpl::writeNumber(micros2, data.quantity2, string, UPRV_INDEX_2, status); + length1 += NumberFormatterImpl::writeNumber(micros1.simple, data.quantity1, string, UPRV_INDEX_0, status); + // ICU-21684: Write the second number to a temp string to avoid repeated insert operations + FormattedStringBuilder tempString; + NumberFormatterImpl::writeNumber(micros2.simple, data.quantity2, tempString, 0, status); + length2 += string.insert(UPRV_INDEX_2, tempString, status); // TODO: Support padding? if (collapseInner) { - // Note: this is actually a mix of prefix and suffix, but adding to infix length works const Modifier& mod = resolveModifierPlurals(*micros1.modInner, *micros2.modInner); - lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status); + lengthSuffix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_4, status); + lengthPrefix += mod.getPrefixLength(); + lengthSuffix -= mod.getPrefixLength(); } else { length1 += micros1.modInner->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status); - length2 += micros2.modInner->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status); + length2 += micros2.modInner->apply(string, UPRV_INDEX_2, UPRV_INDEX_4, status); } if (collapseMiddle) { - // Note: this is actually a mix of prefix and suffix, but adding to infix length works const Modifier& mod = resolveModifierPlurals(*micros1.modMiddle, *micros2.modMiddle); - lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status); + lengthSuffix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_4, status); + lengthPrefix += mod.getPrefixLength(); + lengthSuffix -= mod.getPrefixLength(); } else { length1 += micros1.modMiddle->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status); - length2 += micros2.modMiddle->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status); + length2 += micros2.modMiddle->apply(string, UPRV_INDEX_2, UPRV_INDEX_4, status); } if (collapseOuter) { - // Note: this is actually a mix of prefix and suffix, but adding to infix length works const Modifier& mod = resolveModifierPlurals(*micros1.modOuter, *micros2.modOuter); - lengthInfix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_3, status); + lengthSuffix += mod.apply(string, UPRV_INDEX_0, UPRV_INDEX_4, status); + lengthPrefix += mod.getPrefixLength(); + lengthSuffix -= mod.getPrefixLength(); } else { length1 += micros1.modOuter->apply(string, UPRV_INDEX_0, UPRV_INDEX_1, status); - length2 += micros2.modOuter->apply(string, UPRV_INDEX_2, UPRV_INDEX_3, status); + length2 += micros2.modOuter->apply(string, UPRV_INDEX_2, UPRV_INDEX_4, status); } + + // Now that all pieces are added, save the span info. + data.appendSpanInfo(UFIELD_CATEGORY_NUMBER_RANGE_SPAN, 0, UPRV_INDEX_0, length1, status); + data.appendSpanInfo(UFIELD_CATEGORY_NUMBER_RANGE_SPAN, 1, UPRV_INDEX_2, length2, status); } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.h index f88e30091..ac1d8a589 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.h @@ -15,6 +15,7 @@ #include "number_formatimpl.h" #include "formatted_string_builder.h" #include "formattedval_impl.h" +#include "pluralranges.h" U_NAMESPACE_BEGIN namespace number { namespace impl { @@ -31,7 +32,7 @@ namespace impl { */ class UFormattedNumberRangeData : public FormattedValueStringBuilderImpl { public: - UFormattedNumberRangeData() : FormattedValueStringBuilderImpl(0) {} + UFormattedNumberRangeData() : FormattedValueStringBuilderImpl(kUndefinedField) {} virtual ~UFormattedNumberRangeData(); DecimalQuantity quantity1; @@ -40,36 +41,6 @@ class UFormattedNumberRangeData : public FormattedValueStringBuilderImpl { }; -class StandardPluralRanges : public UMemory { - public: - void initialize(const Locale& locale, UErrorCode& status); - StandardPlural::Form resolve(StandardPlural::Form first, StandardPlural::Form second) const; - - /** Used for data loading. */ - void addPluralRange( - StandardPlural::Form first, - StandardPlural::Form second, - StandardPlural::Form result); - - /** Used for data loading. */ - void setCapacity(int32_t length); - - private: - struct StandardPluralRangeTriple { - StandardPlural::Form first; - StandardPlural::Form second; - StandardPlural::Form result; - }; - - // TODO: An array is simple here, but it results in linear lookup time. - // Certain locales have 20-30 entries in this list. - // Consider changing to a smarter data structure. - typedef MaybeStackArray PluralRangeTriples; - PluralRangeTriples fTriples; - int32_t fTriplesLen = 0; -}; - - class NumberRangeFormatterImpl : public UMemory { public: NumberRangeFormatterImpl(const RangeMacroProps& macros, UErrorCode& status); @@ -85,7 +56,7 @@ class NumberRangeFormatterImpl : public UMemory { UNumberRangeIdentityFallback fIdentityFallback; SimpleFormatter fRangeFormatter; - SimpleModifier fApproximatelyModifier; + NumberFormatterImpl fApproximatelyFormatter; StandardPluralRanges fPluralRanges; @@ -105,6 +76,11 @@ class NumberRangeFormatterImpl : public UMemory { }; +/** Helper function used in upluralrules.cpp */ +const UFormattedNumberRangeData* validateUFormattedNumberRange( + const UFormattedNumberRange* uresult, UErrorCode& status); + + } // namespace impl } // namespace number U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numsys.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/numsys.cpp index 60dd5106d..0d5c43e4b 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numsys.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numsys.cpp @@ -38,16 +38,16 @@ U_NAMESPACE_BEGIN // Useful constants #define DEFAULT_DIGITS UNICODE_STRING_SIMPLE("0123456789") -static const char numsys_gNumberingSystems[] = "numberingSystems"; -static const char numsys_gNumberElements[] = "NumberElements"; -static const char numsys_gDefault[] = "default"; -static const char numsys_gNative[] = "native"; -static const char numsys_gTraditional[] = "traditional"; -static const char numsys_gFinance[] = "finance"; -static const char numsys_gDesc[] = "desc"; -static const char numsys_gRadix[] = "radix"; -static const char numsys_gAlgorithmic[] = "algorithmic"; -static const char numsys_gLatn[] = "latn"; +static const char gNumberingSystems[] = "numberingSystems"; +static const char gNumberElements[] = "NumberElements"; +static const char gDefault[] = "default"; +static const char gNative[] = "native"; +static const char gTraditional[] = "traditional"; +static const char gFinance[] = "finance"; +static const char gDesc[] = "desc"; +static const char gRadix[] = "radix"; +static const char gAlgorithmic[] = "algorithmic"; +static const char gLatn[] = "latn"; UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NumberingSystem) @@ -61,10 +61,10 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NumsysNameEnumeration) NumberingSystem::NumberingSystem() { radix = 10; - algorithmic = FALSE; + algorithmic = false; UnicodeString defaultDigits = DEFAULT_DIGITS; desc.setTo(defaultDigits); - uprv_strcpy(name,numsys_gLatn); + uprv_strcpy(name,gLatn); } /** @@ -72,7 +72,7 @@ NumberingSystem::NumberingSystem() { * @draft ICU 4.2 */ -NumberingSystem::NumberingSystem(const NumberingSystem& other) +NumberingSystem::NumberingSystem(const NumberingSystem& other) : UObject(other) { *this=other; } @@ -116,9 +116,9 @@ NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) { return nullptr; } - UBool nsResolved = TRUE; - UBool usingFallback = FALSE; - char buffer[ULOC_KEYWORDS_CAPACITY]; + UBool nsResolved = true; + UBool usingFallback = false; + char buffer[ULOC_KEYWORDS_CAPACITY] = ""; int32_t count = inLocale.getKeywordValue("numbers", buffer, sizeof(buffer), status); if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) { // the "numbers" keyword exceeds ULOC_KEYWORDS_CAPACITY; ignore and use default. @@ -128,19 +128,19 @@ NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) { if ( count > 0 ) { // @numbers keyword was specified in the locale U_ASSERT(count < ULOC_KEYWORDS_CAPACITY); buffer[count] = '\0'; // Make sure it is null terminated. - if ( !uprv_strcmp(buffer,numsys_gDefault) || !uprv_strcmp(buffer,numsys_gNative) || - !uprv_strcmp(buffer,numsys_gTraditional) || !uprv_strcmp(buffer,numsys_gFinance)) { - nsResolved = FALSE; + if ( !uprv_strcmp(buffer,gDefault) || !uprv_strcmp(buffer,gNative) || + !uprv_strcmp(buffer,gTraditional) || !uprv_strcmp(buffer,gFinance)) { + nsResolved = false; } } else { - uprv_strcpy(buffer, numsys_gDefault); - nsResolved = FALSE; + uprv_strcpy(buffer, gDefault); + nsResolved = false; } if (!nsResolved) { // Resolve the numbering system ( default, native, traditional or finance ) into a "real" numbering system UErrorCode localStatus = U_ZERO_ERROR; LocalUResourceBundlePointer resource(ures_open(nullptr, inLocale.getName(), &localStatus)); - LocalUResourceBundlePointer numberElementsRes(ures_getByKey(resource.getAlias(), numsys_gNumberElements, nullptr, &localStatus)); + LocalUResourceBundlePointer numberElementsRes(ures_getByKey(resource.getAlias(), gNumberElements, nullptr, &localStatus)); // Don't stomp on the catastrophic failure of OOM. if (localStatus == U_MEMORY_ALLOCATION_ERROR) { status = U_MEMORY_ALLOCATION_ERROR; @@ -149,7 +149,7 @@ NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) { while (!nsResolved) { localStatus = U_ZERO_ERROR; count = 0; - const UChar *nsName = ures_getStringByKeyWithFallback(numberElementsRes.getAlias(), buffer, &count, &localStatus); + const char16_t *nsName = ures_getStringByKeyWithFallback(numberElementsRes.getAlias(), buffer, &count, &localStatus); // Don't stomp on the catastrophic failure of OOM. if (localStatus == U_MEMORY_ALLOCATION_ERROR) { status = U_MEMORY_ALLOCATION_ERROR; @@ -158,17 +158,17 @@ NumberingSystem::createInstance(const Locale & inLocale, UErrorCode& status) { if ( count > 0 && count < ULOC_KEYWORDS_CAPACITY ) { // numbering system found u_UCharsToChars(nsName, buffer, count); buffer[count] = '\0'; // Make sure it is null terminated. - nsResolved = TRUE; - } + nsResolved = true; + } if (!nsResolved) { // Fallback behavior per TR35 - traditional falls back to native, finance and native fall back to default - if (!uprv_strcmp(buffer,numsys_gNative) || !uprv_strcmp(buffer,numsys_gFinance)) { - uprv_strcpy(buffer,numsys_gDefault); - } else if (!uprv_strcmp(buffer,numsys_gTraditional)) { - uprv_strcpy(buffer,numsys_gNative); + if (!uprv_strcmp(buffer,gNative) || !uprv_strcmp(buffer,gFinance)) { + uprv_strcpy(buffer,gDefault); + } else if (!uprv_strcmp(buffer,gTraditional)) { + uprv_strcpy(buffer,gNative); } else { // If we get here we couldn't find even the default numbering system - usingFallback = TRUE; - nsResolved = TRUE; + usingFallback = true; + nsResolved = true; } } } @@ -196,16 +196,16 @@ NumberingSystem::createInstanceByName(const char *name, UErrorCode& status) { int32_t radix = 10; int32_t algorithmic = 0; - LocalUResourceBundlePointer numberingSystemsInfo(ures_openDirect(nullptr, numsys_gNumberingSystems, &status)); - LocalUResourceBundlePointer nsCurrent(ures_getByKey(numberingSystemsInfo.getAlias(), numsys_gNumberingSystems, nullptr, &status)); + LocalUResourceBundlePointer numberingSystemsInfo(ures_openDirect(nullptr, gNumberingSystems, &status)); + LocalUResourceBundlePointer nsCurrent(ures_getByKey(numberingSystemsInfo.getAlias(), gNumberingSystems, nullptr, &status)); LocalUResourceBundlePointer nsTop(ures_getByKey(nsCurrent.getAlias(), name, nullptr, &status)); - UnicodeString nsd = ures_getUnicodeStringByKey(nsTop.getAlias(), numsys_gDesc, &status); + UnicodeString nsd = ures_getUnicodeStringByKey(nsTop.getAlias(), gDesc, &status); - ures_getByKey(nsTop.getAlias(), numsys_gRadix, nsCurrent.getAlias(), &status); + ures_getByKey(nsTop.getAlias(), gRadix, nsCurrent.getAlias(), &status); radix = ures_getInt(nsCurrent.getAlias(), &status); - ures_getByKey(nsTop.getAlias(), numsys_gAlgorithmic, nsCurrent.getAlias(), &status); + ures_getByKey(nsTop.getAlias(), gAlgorithmic, nsCurrent.getAlias(), &status); algorithmic = ures_getInt(nsCurrent.getAlias(), &status); UBool isAlgorithmic = ( algorithmic == 1 ); @@ -271,7 +271,7 @@ UBool NumberingSystem::isAlgorithmic() const { namespace { UVector* gNumsysNames = nullptr; -UInitOnce gNumSysInitOnce = U_INITONCE_INITIALIZER; +UInitOnce gNumSysInitOnce {}; U_CFUNC UBool U_CALLCONV numSysCleanup() { delete gNumsysNames; @@ -313,12 +313,7 @@ U_CFUNC void initNumsysNames(UErrorCode &status) { } const char *nsName = ures_getKey(nsCurrent.getAlias()); LocalPointer newElem(new UnicodeString(nsName, -1, US_INV), status); - if (U_SUCCESS(status)) { - numsysNames->addElement(newElem.getAlias(), status); - if (U_SUCCESS(status)) { - newElem.orphan(); // on success, the numsysNames vector owns newElem. - } - } + numsysNames->adoptElement(newElem.orphan(), status); } ures_close(numberingSystemsInfo); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/numsys_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/numsys_impl.h index e76e634dd..42cf102a1 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/numsys_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/numsys_impl.h @@ -29,8 +29,8 @@ class NumsysNameEnumeration : public StringEnumeration { NumsysNameEnumeration(UErrorCode& status); virtual ~NumsysNameEnumeration(); - static UClassID U_EXPORT2 getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const override; + static UClassID U_EXPORT2 getStaticClassID(); + virtual UClassID getDynamicClassID() const override; virtual const UnicodeString* snext(UErrorCode& status) override; virtual void reset(UErrorCode& status) override; virtual int32_t count(UErrorCode& status) const override; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp index 01b913ab7..260e345d7 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp @@ -52,14 +52,14 @@ static void debug_tz_msg(const char *pat, ...) #endif static UBool arrayEqual(const void *a1, const void *a2, int32_t size) { - if (a1 == NULL && a2 == NULL) { - return TRUE; + if (a1 == nullptr && a2 == nullptr) { + return true; } - if ((a1 != NULL && a2 == NULL) || (a1 == NULL && a2 != NULL)) { - return FALSE; + if ((a1 != nullptr && a2 == nullptr) || (a1 == nullptr && a2 != nullptr)) { + return false; } if (a1 == a2) { - return TRUE; + return true; } return (uprv_memcmp(a1, a2, size) == 0); @@ -87,7 +87,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(OlsonTimeZone) * Default constructor. Creates a time zone with an empty ID and * a fixed GMT offset of zero. */ -/*OlsonTimeZone::OlsonTimeZone() : finalYear(INT32_MAX), finalMillis(DBL_MAX), finalZone(0), transitionRulesInitialized(FALSE) { +/*OlsonTimeZone::OlsonTimeZone() : finalYear(INT32_MAX), finalMillis(DBL_MAX), finalZone(0), transitionRulesInitialized(false) { clearTransitionRules(); constructEmpty(); }*/ @@ -97,17 +97,17 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(OlsonTimeZone) * constructor fails so the resultant object is well-behaved. */ void OlsonTimeZone::constructEmpty() { - canonicalID = NULL; + canonicalID = nullptr; transitionCountPre32 = transitionCount32 = transitionCountPost32 = 0; - transitionTimesPre32 = transitionTimes32 = transitionTimesPost32 = NULL; + transitionTimesPre32 = transitionTimes32 = transitionTimesPost32 = nullptr; - typeMapData = NULL; + typeMapData = nullptr; typeCount = 1; typeOffsets = ZEROS; - finalZone = NULL; + finalZone = nullptr; } /** @@ -121,11 +121,11 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, const UResourceBundle* res, const UnicodeString& tzid, UErrorCode& ec) : - BasicTimeZone(tzid), finalZone(NULL) + BasicTimeZone(tzid), finalZone(nullptr) { clearTransitionRules(); U_DEBUG_TZ_MSG(("OlsonTimeZone(%s)\n", ures_getKey((UResourceBundle*)res))); - if ((top == NULL || res == NULL) && U_SUCCESS(ec)) { + if ((top == nullptr || res == nullptr) && U_SUCCESS(ec)) { ec = U_ILLEGAL_ARGUMENT_ERROR; } if (U_SUCCESS(ec)) { @@ -142,7 +142,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, transitionCountPre32 = static_cast(len >> 1); if (ec == U_MISSING_RESOURCE_ERROR) { // No pre-32bit transitions - transitionTimesPre32 = NULL; + transitionTimesPre32 = nullptr; transitionCountPre32 = 0; ec = U_ZERO_ERROR; } else if (U_SUCCESS(ec) && (len < 0 || len > 0x7FFF || (len & 1) != 0) /* len must be even */) { @@ -155,7 +155,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, transitionCount32 = static_cast(len); if (ec == U_MISSING_RESOURCE_ERROR) { // No 32bit transitions - transitionTimes32 = NULL; + transitionTimes32 = nullptr; transitionCount32 = 0; ec = U_ZERO_ERROR; } else if (U_SUCCESS(ec) && (len < 0 || len > 0x7FFF)) { @@ -168,7 +168,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, transitionCountPost32 = static_cast(len >> 1); if (ec == U_MISSING_RESOURCE_ERROR) { // No pre-32bit transitions - transitionTimesPost32 = NULL; + transitionTimesPost32 = nullptr; transitionCountPost32 = 0; ec = U_ZERO_ERROR; } else if (U_SUCCESS(ec) && (len < 0 || len > 0x7FFF || (len & 1) != 0) /* len must be even */) { @@ -184,7 +184,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, typeCount = (int16_t) len >> 1; // Type map data must be of the same size as the transition count - typeMapData = NULL; + typeMapData = nullptr; if (transitionCount() > 0) { ures_getByKey(res, kTYPEMAP, r.getAlias(), &ec); typeMapData = ures_getBinary(r.getAlias(), &len, &ec); @@ -197,58 +197,60 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, } // Process final rule and data, if any - const UChar *ruleIdUStr = ures_getStringByKey(res, kFINALRULE, &len, &ec); - ures_getByKey(res, kFINALRAW, r.getAlias(), &ec); - int32_t ruleRaw = ures_getInt(r.getAlias(), &ec); - ures_getByKey(res, kFINALYEAR, r.getAlias(), &ec); - int32_t ruleYear = ures_getInt(r.getAlias(), &ec); if (U_SUCCESS(ec)) { - UnicodeString ruleID(TRUE, ruleIdUStr, len); - UResourceBundle *rule = TimeZone::loadRule(top, ruleID, NULL, ec); - const int32_t *ruleData = ures_getIntVector(rule, &len, &ec); - if (U_SUCCESS(ec) && len == 11) { - UnicodeString emptyStr; - finalZone = new SimpleTimeZone( - ruleRaw * U_MILLIS_PER_SECOND, - emptyStr, - (int8_t)ruleData[0], (int8_t)ruleData[1], (int8_t)ruleData[2], - ruleData[3] * U_MILLIS_PER_SECOND, - (SimpleTimeZone::TimeMode) ruleData[4], - (int8_t)ruleData[5], (int8_t)ruleData[6], (int8_t)ruleData[7], - ruleData[8] * U_MILLIS_PER_SECOND, - (SimpleTimeZone::TimeMode) ruleData[9], - ruleData[10] * U_MILLIS_PER_SECOND, ec); - if (finalZone == NULL) { - ec = U_MEMORY_ALLOCATION_ERROR; - } else { - finalStartYear = ruleYear; + const char16_t *ruleIdUStr = ures_getStringByKey(res, kFINALRULE, &len, &ec); + ures_getByKey(res, kFINALRAW, r.getAlias(), &ec); + int32_t ruleRaw = ures_getInt(r.getAlias(), &ec); + ures_getByKey(res, kFINALYEAR, r.getAlias(), &ec); + int32_t ruleYear = ures_getInt(r.getAlias(), &ec); + if (U_SUCCESS(ec)) { + UnicodeString ruleID(true, ruleIdUStr, len); + UResourceBundle *rule = TimeZone::loadRule(top, ruleID, nullptr, ec); + const int32_t *ruleData = ures_getIntVector(rule, &len, &ec); + if (U_SUCCESS(ec) && len == 11) { + UnicodeString emptyStr; + finalZone = new SimpleTimeZone( + ruleRaw * U_MILLIS_PER_SECOND, + emptyStr, + (int8_t)ruleData[0], (int8_t)ruleData[1], (int8_t)ruleData[2], + ruleData[3] * U_MILLIS_PER_SECOND, + (SimpleTimeZone::TimeMode) ruleData[4], + (int8_t)ruleData[5], (int8_t)ruleData[6], (int8_t)ruleData[7], + ruleData[8] * U_MILLIS_PER_SECOND, + (SimpleTimeZone::TimeMode) ruleData[9], + ruleData[10] * U_MILLIS_PER_SECOND, ec); + if (finalZone == nullptr) { + ec = U_MEMORY_ALLOCATION_ERROR; + } else { + finalStartYear = ruleYear; - // Note: Setting finalStartYear to the finalZone is problematic. When a date is around - // year boundary, SimpleTimeZone may return false result when DST is observed at the - // beginning of year. We could apply safe margin (day or two), but when one of recurrent - // rules falls around year boundary, it could return false result. Without setting the - // start year, finalZone works fine around the year boundary of the start year. + // Note: Setting finalStartYear to the finalZone is problematic. When a date is around + // year boundary, SimpleTimeZone may return false result when DST is observed at the + // beginning of year. We could apply safe margin (day or two), but when one of recurrent + // rules falls around year boundary, it could return false result. Without setting the + // start year, finalZone works fine around the year boundary of the start year. - // finalZone->setStartYear(finalStartYear); + // finalZone->setStartYear(finalStartYear); - // Compute the millis for Jan 1, 0:00 GMT of the finalYear + // Compute the millis for Jan 1, 0:00 GMT of the finalYear - // Note: finalStartMillis is used for detecting either if - // historic transition data or finalZone to be used. In an - // extreme edge case - for example, two transitions fall into - // small windows of time around the year boundary, this may - // result incorrect offset computation. But I think it will - // never happen practically. Yoshito - Feb 20, 2010 - finalStartMillis = Grego::fieldsToDay(finalStartYear, 0, 1) * U_MILLIS_PER_DAY; + // Note: finalStartMillis is used for detecting either if + // historic transition data or finalZone to be used. In an + // extreme edge case - for example, two transitions fall into + // small windows of time around the year boundary, this may + // result incorrect offset computation. But I think it will + // never happen practically. Yoshito - Feb 20, 2010 + finalStartMillis = Grego::fieldsToDay(finalStartYear, 0, 1) * U_MILLIS_PER_DAY; + } + } else { + ec = U_INVALID_FORMAT_ERROR; } - } else { - ec = U_INVALID_FORMAT_ERROR; + ures_close(rule); + } else if (ec == U_MISSING_RESOURCE_ERROR) { + // No final zone + ec = U_ZERO_ERROR; } - ures_close(rule); - } else if (ec == U_MISSING_RESOURCE_ERROR) { - // No final zone - ec = U_ZERO_ERROR; } // initialize canonical ID @@ -272,6 +274,7 @@ OlsonTimeZone::OlsonTimeZone(const OlsonTimeZone& other) : * Assignment operator */ OlsonTimeZone& OlsonTimeZone::operator=(const OlsonTimeZone& other) { + if (this == &other) { return *this; } // self-assignment: no-op canonicalID = other.canonicalID; transitionTimesPre32 = other.transitionTimesPre32; @@ -370,7 +373,7 @@ int32_t OlsonTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, year = -year; } - if (finalZone != NULL && year >= finalStartYear) { + if (finalZone != nullptr && year >= finalStartYear) { return finalZone->getOffset(era, year, month, dom, dow, millis, monthLength, ec); } @@ -378,7 +381,7 @@ int32_t OlsonTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, // Compute local epoch millis from input fields UDate date = (UDate)(Grego::fieldsToDay(year, month, dom) * U_MILLIS_PER_DAY + millis); int32_t rawoff, dstoff; - getHistoricalOffset(date, TRUE, kDaylight, kStandard, rawoff, dstoff); + getHistoricalOffset(date, true, kDaylight, kStandard, rawoff, dstoff); return rawoff + dstoff; } @@ -390,23 +393,23 @@ void OlsonTimeZone::getOffset(UDate date, UBool local, int32_t& rawoff, if (U_FAILURE(ec)) { return; } - if (finalZone != NULL && date >= finalStartMillis) { + if (finalZone != nullptr && date >= finalStartMillis) { finalZone->getOffset(date, local, rawoff, dstoff, ec); } else { getHistoricalOffset(date, local, kFormer, kLatter, rawoff, dstoff); } } -void -OlsonTimeZone::getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, - int32_t& rawoff, int32_t& dstoff, UErrorCode& ec) const { +void OlsonTimeZone::getOffsetFromLocal(UDate date, UTimeZoneLocalOption nonExistingTimeOpt, + UTimeZoneLocalOption duplicatedTimeOpt, + int32_t& rawoff, int32_t& dstoff, UErrorCode& ec) const { if (U_FAILURE(ec)) { return; } - if (finalZone != NULL && date >= finalStartMillis) { + if (finalZone != nullptr && date >= finalStartMillis) { finalZone->getOffsetFromLocal(date, nonExistingTimeOpt, duplicatedTimeOpt, rawoff, dstoff, ec); } else { - getHistoricalOffset(date, TRUE, nonExistingTimeOpt, duplicatedTimeOpt, rawoff, dstoff); + getHistoricalOffset(date, true, nonExistingTimeOpt, duplicatedTimeOpt, rawoff, dstoff); } } @@ -427,8 +430,7 @@ void OlsonTimeZone::setRawOffset(int32_t /*offsetMillis*/) { int32_t OlsonTimeZone::getRawOffset() const { UErrorCode ec = U_ZERO_ERROR; int32_t raw, dst; - getOffset((double) uprv_getUTCtime() * U_MILLIS_PER_SECOND, - FALSE, raw, dst, ec); + getOffset(uprv_getUTCtime(), false, raw, dst, ec); return raw; } @@ -557,12 +559,12 @@ OlsonTimeZone::getHistoricalOffset(UDate date, UBool local, UBool OlsonTimeZone::useDaylightTime() const { // If DST was observed in 1942 (for example) but has never been // observed from 1943 to the present, most clients will expect - // this method to return FALSE. This method determines whether + // this method to return false. This method determines whether // DST is in use in the current year (at any point in the year) - // and returns TRUE if so. + // and returns true if so. UDate current = uprv_getUTCtime(); - if (finalZone != NULL && current >= finalStartMillis) { + if (finalZone != nullptr && current >= finalStartMillis) { return finalZone->useDaylightTime(); } @@ -573,7 +575,7 @@ UBool OlsonTimeZone::useDaylightTime() const { double start = Grego::fieldsToDay(year, 0, 1) * SECONDS_PER_DAY; double limit = Grego::fieldsToDay(year+1, 0, 1) * SECONDS_PER_DAY; - // Return TRUE if DST is observed at any time during the current + // Return true if DST is observed at any time during the current // year. for (int16_t i = 0; i < transitionCount(); ++i) { double transition = (double)transitionTimeInSeconds(i); @@ -582,14 +584,14 @@ UBool OlsonTimeZone::useDaylightTime() const { } if ((transition >= start && dstOffsetAt(i) != 0) || (transition > start && dstOffsetAt(i - 1) != 0)) { - return TRUE; + return true; } } - return FALSE; + return false; } int32_t OlsonTimeZone::getDSTSavings() const{ - if (finalZone != NULL){ + if (finalZone != nullptr){ return finalZone->getDSTSavings(); } return TimeZone::getDSTSavings(); @@ -599,45 +601,45 @@ OlsonTimeZone::getDSTSavings() const{ */ UBool OlsonTimeZone::inDaylightTime(UDate date, UErrorCode& ec) const { int32_t raw, dst; - getOffset(date, FALSE, raw, dst, ec); + getOffset(date, false, raw, dst, ec); return dst != 0; } UBool OlsonTimeZone::hasSameRules(const TimeZone &other) const { if (this == &other) { - return TRUE; + return true; } const OlsonTimeZone* z = dynamic_cast(&other); - if (z == NULL) { - return FALSE; + if (z == nullptr) { + return false; } // [sic] pointer comparison: typeMapData points into // memory-mapped or DLL space, so if two zones have the same // pointer, they are equal. if (typeMapData == z->typeMapData) { - return TRUE; + return true; } // If the pointers are not equal, the zones may still // be equal if their rules and transitions are equal - if ((finalZone == NULL && z->finalZone != NULL) - || (finalZone != NULL && z->finalZone == NULL) - || (finalZone != NULL && z->finalZone != NULL && *finalZone != *z->finalZone)) { - return FALSE; + if ((finalZone == nullptr && z->finalZone != nullptr) + || (finalZone != nullptr && z->finalZone == nullptr) + || (finalZone != nullptr && z->finalZone != nullptr && *finalZone != *z->finalZone)) { + return false; } - if (finalZone != NULL) { + if (finalZone != nullptr) { if (finalStartYear != z->finalStartYear || finalStartMillis != z->finalStartMillis) { - return FALSE; + return false; } } if (typeCount != z->typeCount || transitionCountPre32 != z->transitionCountPre32 || transitionCount32 != z->transitionCount32 || transitionCountPost32 != z->transitionCountPost32) { - return FALSE; + return false; } return @@ -649,34 +651,34 @@ OlsonTimeZone::hasSameRules(const TimeZone &other) const { } void -OlsonTimeZone::clearTransitionRules(void) { - initialRule = NULL; - firstTZTransition = NULL; - firstFinalTZTransition = NULL; - historicRules = NULL; +OlsonTimeZone::clearTransitionRules() { + initialRule = nullptr; + firstTZTransition = nullptr; + firstFinalTZTransition = nullptr; + historicRules = nullptr; historicRuleCount = 0; - finalZoneWithStartYear = NULL; + finalZoneWithStartYear = nullptr; firstTZTransitionIdx = 0; transitionRulesInitOnce.reset(); } void -OlsonTimeZone::deleteTransitionRules(void) { - if (initialRule != NULL) { +OlsonTimeZone::deleteTransitionRules() { + if (initialRule != nullptr) { delete initialRule; } - if (firstTZTransition != NULL) { + if (firstTZTransition != nullptr) { delete firstTZTransition; } - if (firstFinalTZTransition != NULL) { + if (firstFinalTZTransition != nullptr) { delete firstFinalTZTransition; } - if (finalZoneWithStartYear != NULL) { + if (finalZoneWithStartYear != nullptr) { delete finalZoneWithStartYear; } - if (historicRules != NULL) { + if (historicRules != nullptr) { for (int i = 0; i < historicRuleCount; i++) { - if (historicRules[i] != NULL) { + if (historicRules[i] != nullptr) { delete historicRules[i]; } } @@ -718,7 +720,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { dst = initialDstOffset() * U_MILLIS_PER_SECOND; initialRule = new InitialTimeZoneRule((dst == 0 ? stdName : dstName), raw, dst); // Check to make sure initialRule was created - if (initialRule == NULL) { + if (initialRule == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; @@ -743,7 +745,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { } else { // Build historic rule array UDate* times = (UDate*)uprv_malloc(sizeof(UDate)*transCount); /* large enough to store all transition times */ - if (times == NULL) { + if (times == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; @@ -754,7 +756,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { for (transitionIdx = firstTZTransitionIdx; transitionIdx < transCount; transitionIdx++) { if (typeIdx == (int16_t)typeMapData[transitionIdx]) { UDate tt = (UDate)transitionTime(transitionIdx); - if (finalZone == NULL || tt <= finalStartMillis) { + if (finalZone == nullptr || tt <= finalStartMillis) { // Exclude transitions after finalMillis times[nTimes++] = tt; } @@ -764,24 +766,24 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { // Create a TimeArrayTimeZoneRule raw = typeOffsets[typeIdx << 1] * U_MILLIS_PER_SECOND; dst = typeOffsets[(typeIdx << 1) + 1] * U_MILLIS_PER_SECOND; - if (historicRules == NULL) { + if (historicRules == nullptr) { historicRuleCount = typeCount; historicRules = (TimeArrayTimeZoneRule**)uprv_malloc(sizeof(TimeArrayTimeZoneRule*)*historicRuleCount); - if (historicRules == NULL) { + if (historicRules == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); uprv_free(times); return; } for (int i = 0; i < historicRuleCount; i++) { - // Initialize TimeArrayTimeZoneRule pointers as NULL - historicRules[i] = NULL; + // Initialize TimeArrayTimeZoneRule pointers as nullptr + historicRules[i] = nullptr; } } historicRules[typeIdx] = new TimeArrayTimeZoneRule((dst == 0 ? stdName : dstName), raw, dst, times, nTimes, DateTimeRule::UTC_TIME); // Check for memory allocation error - if (historicRules[typeIdx] == NULL) { + if (historicRules[typeIdx] == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; @@ -795,29 +797,29 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { firstTZTransition = new TimeZoneTransition((UDate)transitionTime(firstTZTransitionIdx), *initialRule, *historicRules[typeIdx]); // Check to make sure firstTZTransition was created. - if (firstTZTransition == NULL) { + if (firstTZTransition == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; } } } - if (finalZone != NULL) { - // Get the first occurence of final rule starts + if (finalZone != nullptr) { + // Get the first occurrence of final rule starts UDate startTime = (UDate)finalStartMillis; - TimeZoneRule *firstFinalRule = NULL; + TimeZoneRule *firstFinalRule = nullptr; if (finalZone->useDaylightTime()) { /* * Note: When an OlsonTimeZone is constructed, we should set the final year - * as the start year of finalZone. However, the bounday condition used for + * as the start year of finalZone. However, the boundary condition used for * getting offset from finalZone has some problems. * For now, we do not set the valid start year when the construction time * and create a clone and set the start year when extracting rules. */ finalZoneWithStartYear = finalZone->clone(); // Check to make sure finalZone was actually cloned. - if (finalZoneWithStartYear == NULL) { + if (finalZoneWithStartYear == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; @@ -828,7 +830,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { finalZoneWithStartYear->getNextTransition(startTime, false, tzt); firstFinalRule = tzt.getTo()->clone(); // Check to make sure firstFinalRule received proper clone. - if (firstFinalRule == NULL) { + if (firstFinalRule == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; @@ -838,7 +840,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { // final rule with no transitions finalZoneWithStartYear = finalZone->clone(); // Check to make sure finalZone was actually cloned. - if (finalZoneWithStartYear == NULL) { + if (finalZoneWithStartYear == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; @@ -847,23 +849,23 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) { firstFinalRule = new TimeArrayTimeZoneRule(tzid, finalZone->getRawOffset(), 0, &startTime, 1, DateTimeRule::UTC_TIME); // Check firstFinalRule was properly created. - if (firstFinalRule == NULL) { + if (firstFinalRule == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; } } - TimeZoneRule *prevRule = NULL; + TimeZoneRule *prevRule = nullptr; if (transCount > 0) { prevRule = historicRules[typeMapData[transCount - 1]]; } - if (prevRule == NULL) { + if (prevRule == nullptr) { // No historic transitions, but only finalZone available prevRule = initialRule; } firstFinalTZTransition = new TimeZoneTransition(); // Check to make sure firstFinalTZTransition was created before dereferencing - if (firstFinalTZTransition == NULL) { + if (firstFinalTZTransition == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; deleteTransitionRules(); return; @@ -879,24 +881,24 @@ OlsonTimeZone::getNextTransition(UDate base, UBool inclusive, TimeZoneTransition UErrorCode status = U_ZERO_ERROR; checkTransitionRules(status); if (U_FAILURE(status)) { - return FALSE; + return false; } - if (finalZone != NULL) { + if (finalZone != nullptr) { if (inclusive && base == firstFinalTZTransition->getTime()) { result = *firstFinalTZTransition; - return TRUE; + return true; } else if (base >= firstFinalTZTransition->getTime()) { if (finalZone->useDaylightTime()) { //return finalZone->getNextTransition(base, inclusive, result); return finalZoneWithStartYear->getNextTransition(base, inclusive, result); } else { // No more transitions - return FALSE; + return false; } } } - if (historicRules != NULL) { + if (historicRules != nullptr) { // Find a historical transition int16_t transCount = transitionCount(); int16_t ttidx = transCount - 1; @@ -907,15 +909,15 @@ OlsonTimeZone::getNextTransition(UDate base, UBool inclusive, TimeZoneTransition } } if (ttidx == transCount - 1) { - if (firstFinalTZTransition != NULL) { + if (firstFinalTZTransition != nullptr) { result = *firstFinalTZTransition; - return TRUE; + return true; } else { - return FALSE; + return false; } } else if (ttidx < firstTZTransitionIdx) { result = *firstTZTransition; - return TRUE; + return true; } else { // Create a TimeZoneTransition TimeZoneRule *to = historicRules[typeMapData[ttidx + 1]]; @@ -933,10 +935,10 @@ OlsonTimeZone::getNextTransition(UDate base, UBool inclusive, TimeZoneTransition result.setTime(startTime); result.adoptFrom(from->clone()); result.adoptTo(to->clone()); - return TRUE; + return true; } } - return FALSE; + return false; } UBool @@ -944,25 +946,25 @@ OlsonTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransi UErrorCode status = U_ZERO_ERROR; checkTransitionRules(status); if (U_FAILURE(status)) { - return FALSE; + return false; } - if (finalZone != NULL) { + if (finalZone != nullptr) { if (inclusive && base == firstFinalTZTransition->getTime()) { result = *firstFinalTZTransition; - return TRUE; + return true; } else if (base > firstFinalTZTransition->getTime()) { if (finalZone->useDaylightTime()) { //return finalZone->getPreviousTransition(base, inclusive, result); return finalZoneWithStartYear->getPreviousTransition(base, inclusive, result); } else { result = *firstFinalTZTransition; - return TRUE; + return true; } } } - if (historicRules != NULL) { + if (historicRules != nullptr) { // Find a historical transition int16_t ttidx = transitionCount() - 1; for (; ttidx >= firstTZTransitionIdx; ttidx--) { @@ -973,10 +975,10 @@ OlsonTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransi } if (ttidx < firstTZTransitionIdx) { // No more transitions - return FALSE; + return false; } else if (ttidx == firstTZTransitionIdx) { result = *firstTZTransition; - return TRUE; + return true; } else { // Create a TimeZoneTransition TimeZoneRule *to = historicRules[typeMapData[ttidx]]; @@ -994,10 +996,10 @@ OlsonTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransi result.setTime(startTime); result.adoptFrom(from->clone()); result.adoptTo(to->clone()); - return TRUE; + return true; } } - return FALSE; + return false; } int32_t @@ -1011,16 +1013,16 @@ OlsonTimeZone::countTransitionRules(UErrorCode& status) const { } int32_t count = 0; - if (historicRules != NULL) { + if (historicRules != nullptr) { // historicRules may contain null entries when original zoneinfo data // includes non transition data. for (int32_t i = 0; i < historicRuleCount; i++) { - if (historicRules[i] != NULL) { + if (historicRules[i] != nullptr) { count++; } } } - if (finalZone != NULL) { + if (finalZone != nullptr) { if (finalZone->useDaylightTime()) { count += 2; } else { @@ -1048,11 +1050,11 @@ OlsonTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial, // Transition rules int32_t cnt = 0; - if (historicRules != NULL && trscount > cnt) { + if (historicRules != nullptr && trscount > cnt) { // historicRules may contain null entries when original zoneinfo data // includes non transition data. for (int32_t i = 0; i < historicRuleCount; i++) { - if (historicRules[i] != NULL) { + if (historicRules[i] != nullptr) { trsrules[cnt++] = historicRules[i]; if (cnt >= trscount) { break; @@ -1060,7 +1062,7 @@ OlsonTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial, } } } - if (finalZoneWithStartYear != NULL && trscount > cnt) { + if (finalZoneWithStartYear != nullptr && trscount > cnt) { const InitialTimeZoneRule *tmpini; int32_t tmpcnt = trscount - cnt; finalZoneWithStartYear->getTimeZoneRules(tmpini, &trsrules[cnt], tmpcnt, status); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.h b/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.h index c4e225910..9fe0d5dfe 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/olsontz.h @@ -146,12 +146,12 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { /** * Returns true if the two TimeZone objects are equal. */ - virtual bool operator==(const TimeZone& other) const; + virtual bool operator==(const TimeZone& other) const override; /** * TimeZone API. */ - virtual OlsonTimeZone* clone() const; + virtual OlsonTimeZone* clone() const override; /** * TimeZone API. @@ -161,14 +161,14 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { /** * TimeZone API. */ - virtual UClassID getDynamicClassID() const; + virtual UClassID getDynamicClassID() const override; /** * TimeZone API. Do not call this; prefer getOffset(UDate,...). */ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, uint8_t dayOfWeek, - int32_t millis, UErrorCode& ec) const; + int32_t millis, UErrorCode& ec) const override; /** * TimeZone API. Do not call this; prefer getOffset(UDate,...). @@ -176,26 +176,28 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, uint8_t dayOfWeek, int32_t millis, int32_t monthLength, - UErrorCode& ec) const; + UErrorCode& ec) const override; /** * TimeZone API. */ virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, - int32_t& dstOffset, UErrorCode& ec) const; + int32_t& dstOffset, UErrorCode& ec) const override; /** * BasicTimeZone API. */ - virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, - int32_t& rawoff, int32_t& dstoff, UErrorCode& ec) const; + virtual void getOffsetFromLocal( + UDate date, UTimeZoneLocalOption nonExistingTimeOpt, + UTimeZoneLocalOption duplicatedTimeOpt, + int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const override; /** * TimeZone API. This method has no effect since objects of this * class are quasi-immutable (the base class allows the ID to be * changed). */ - virtual void setRawOffset(int32_t offsetMillis); + virtual void setRawOffset(int32_t offsetMillis) override; /** * TimeZone API. For a historical zone, the raw offset can change @@ -203,30 +205,30 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { * expected behavior, this method returns the raw offset for the * current moment in time. */ - virtual int32_t getRawOffset() const; + virtual int32_t getRawOffset() const override; /** * TimeZone API. For a historical zone, whether DST is used or * not varies over time. In order to approximate expected - * behavior, this method returns TRUE if DST is observed at any + * behavior, this method returns true if DST is observed at any * point in the current year. */ - virtual UBool useDaylightTime() const; + virtual UBool useDaylightTime() const override; /** * TimeZone API. */ - virtual UBool inDaylightTime(UDate date, UErrorCode& ec) const; + virtual UBool inDaylightTime(UDate date, UErrorCode& ec) const override; /** * TimeZone API. */ - virtual int32_t getDSTSavings() const; + virtual int32_t getDSTSavings() const override; /** * TimeZone API. Also comare historic transitions. */ - virtual UBool hasSameRules(const TimeZone& other) const; + virtual UBool hasSameRules(const TimeZone& other) const override; /** * BasicTimeZone API. @@ -234,9 +236,9 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the first transition after the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. */ - virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const override; /** * BasicTimeZone API. @@ -244,9 +246,9 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { * @param base The base time. * @param inclusive Whether the base time is inclusive or not. * @param result Receives the most recent transition before the base time. - * @return TRUE if the transition is found. + * @return true if the transition is found. */ - virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const override; /** * BasicTimeZone API. @@ -256,12 +258,12 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { * @param status Receives error status code. * @return The number of TimeZoneRules representing time transitions. */ - virtual int32_t countTransitionRules(UErrorCode& status) const; + virtual int32_t countTransitionRules(UErrorCode& status) const override; /** * Gets the InitialTimeZoneRule and the set of TimeZoneRule * which represent time transitions for this time zone. On successful return, - * the argument initial points to non-NULL InitialTimeZoneRule and + * the argument initial points to non-nullptr InitialTimeZoneRule and * the array trsrules is filled with 0 or multiple TimeZoneRule * instances up to the size specified by trscount. The results are referencing the * rule instance held by this time zone instance. Therefore, after this time zone @@ -274,13 +276,13 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { * @param status Receives error status code. */ virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, - const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const; + const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const override; /** * Internal API returning the canonical ID of this zone. * This ID won't be affected by setID(). */ - const UChar *getCanonicalID() const; + const char16_t *getCanonicalID() const; private: /** @@ -326,20 +328,20 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { /** * Time of each transition in seconds from 1970 epoch before 32bit second range (<= 1900). * Each transition in this range is represented by a pair of int32_t. - * Length is transitionCount int32_t's. NULL if no transitions in this range. + * Length is transitionCount int32_t's. nullptr if no transitions in this range. */ const int32_t *transitionTimesPre32; // alias into res; do not delete /** * Time of each transition in seconds from 1970 epoch in 32bit second range. - * Length is transitionCount int32_t's. NULL if no transitions in this range. + * Length is transitionCount int32_t's. nullptr if no transitions in this range. */ const int32_t *transitionTimes32; // alias into res; do not delete /** * Time of each transition in seconds from 1970 epoch after 32bit second range (>= 2038). * Each transition in this range is represented by a pair of int32_t. - * Length is transitionCount int32_t's. NULL if no transitions in this range. + * Length is transitionCount int32_t's. nullptr if no transitions in this range. */ const int32_t *transitionTimesPost32; // alias into res; do not delete @@ -358,14 +360,14 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { /** * Type description data, consisting of transitionCount uint8_t * type indices (from 0..typeCount-1). - * Length is transitionCount int16_t's. NULL if no transitions. + * Length is transitionCount int16_t's. nullptr if no transitions. */ const uint8_t *typeMapData; // alias into res; do not delete /** * A SimpleTimeZone that governs the behavior for date >= finalMillis. */ - SimpleTimeZone *finalZone; // owned, may be NULL + SimpleTimeZone *finalZone; // owned, may be nullptr /** * For date >= finalMillis, the finalZone will be used. @@ -380,11 +382,11 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { /* * Canonical (CLDR) ID of this zone */ - const UChar *canonicalID; + const char16_t *canonicalID; /* BasicTimeZone support */ - void clearTransitionRules(void); - void deleteTransitionRules(void); + void clearTransitionRules(); + void deleteTransitionRules(); void checkTransitionRules(UErrorCode& status) const; public: // Internal, for access from plain C code @@ -398,7 +400,7 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone { TimeArrayTimeZoneRule **historicRules; int16_t historicRuleCount; SimpleTimeZone *finalZoneWithStartYear; // hack - UInitOnce transitionRulesInitOnce = U_INITONCE_INITIALIZER; + UInitOnce transitionRulesInitOnce {}; }; inline int16_t @@ -439,7 +441,7 @@ OlsonTimeZone::initialDstOffset() const { return typeOffsets[1]; } -inline const UChar* +inline const char16_t* OlsonTimeZone::getCanonicalID() const { return canonicalID; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/persncal.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/persncal.cpp index 9510a234c..ab13f4343 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/persncal.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/persncal.cpp @@ -58,6 +58,7 @@ static const int32_t kPersianCalendarLimits[UCAL_FIELD_COUNT][4] = { {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // JULIAN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // MILLISECONDS_IN_DAY {/*N/A*/-1,/*N/A*/-1,/*N/A*/-1,/*N/A*/-1}, // IS_LEAP_MONTH + { 0, 0, 11, 11}, // ORDINAL_MONTH }; U_NAMESPACE_BEGIN @@ -70,7 +71,7 @@ static const int32_t PERSIAN_EPOCH = 1948320; // Constructors... //------------------------------------------------------------------------- -const char *PersianCalendar::getType() const { +const char *PersianCalendar::getType() const { return "persian"; } @@ -79,7 +80,7 @@ PersianCalendar* PersianCalendar::clone() const { } PersianCalendar::PersianCalendar(const Locale& aLocale, UErrorCode& success) - : Calendar(TimeZone::createDefault(), aLocale, success) + : Calendar(TimeZone::forLocaleOrDefault(aLocale), aLocale, success) { setTimeInMillis(getNow(), success); // Call this again now that the vtable is set up properly. } @@ -110,18 +111,18 @@ int32_t PersianCalendar::handleGetLimit(UCalendarDateFields field, ELimitType li UBool PersianCalendar::isLeapYear(int32_t year) { int32_t remainder; - ClockMath::floorDivide(25 * year + 11, 33, remainder); + ClockMath::floorDivide(25 * year + 11, 33, &remainder); return (remainder < 8); } - + /** * Return the day # on which the given year starts. Days are counted * from the Persian epoch, origin 0. */ int32_t PersianCalendar::yearStart(int32_t year) { - return handleComputeMonthStart(year,0,FALSE); + return handleComputeMonthStart(year,0,false); } - + /** * Return the day # on which the given month starts. Days are counted * from the Persian epoch, origin 0. @@ -130,9 +131,9 @@ int32_t PersianCalendar::yearStart(int32_t year) { * @param year The Persian month, 0-based */ int32_t PersianCalendar::monthStart(int32_t year, int32_t month) const { - return handleComputeMonthStart(year,month,TRUE); + return handleComputeMonthStart(year,month,true); } - + //---------------------------------------------------------------------- // Calendar framework //---------------------------------------------------------------------- @@ -147,7 +148,7 @@ int32_t PersianCalendar::handleGetMonthLength(int32_t extendedYear, int32_t mont // If the month is out of range, adjust it into range, and // modify the extended year value accordingly. if (month < 0 || month > 11) { - extendedYear += ClockMath::floorDivide(month, 12, month); + extendedYear += ClockMath::floorDivide(month, 12, &month); } return isLeapYear(extendedYear) ? kPersianLeapMonthLength[month] : kPersianMonthLength[month]; @@ -159,7 +160,7 @@ int32_t PersianCalendar::handleGetMonthLength(int32_t extendedYear, int32_t mont int32_t PersianCalendar::handleGetYearLength(int32_t extendedYear) const { return isLeapYear(extendedYear) ? 366 : 365; } - + //------------------------------------------------------------------------- // Functions for converting from field values to milliseconds.... //------------------------------------------------------------------------- @@ -169,7 +170,7 @@ int32_t PersianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, U // If the month is out of range, adjust it into range, and // modify the extended year value accordingly. if (month < 0 || month > 11) { - eyear += ClockMath::floorDivide(month, 12, month); + eyear += ClockMath::floorDivide(month, 12, &month); } int32_t julianDay = PERSIAN_EPOCH - 1 + 365 * (eyear - 1) + ClockMath::floorDivide(8 * eyear + 21, 33); @@ -205,7 +206,7 @@ int32_t PersianCalendar::handleGetExtendedYear() { *

  • DAY_OF_MONTH *
  • DAY_OF_YEAR *
  • EXTENDED_YEAR - * + * * The DAY_OF_WEEK and DOW_LOCAL fields are already set when this * method is called. */ @@ -229,35 +230,40 @@ void PersianCalendar::handleComputeFields(int32_t julianDay, UErrorCode &/*statu internalSet(UCAL_YEAR, year); internalSet(UCAL_EXTENDED_YEAR, year); internalSet(UCAL_MONTH, month); + internalSet(UCAL_ORDINAL_MONTH, month); internalSet(UCAL_DAY_OF_MONTH, dayOfMonth); internalSet(UCAL_DAY_OF_YEAR, dayOfYear); -} +} -UBool -PersianCalendar::inDaylightTime(UErrorCode& status) const -{ - // copied from GregorianCalendar - if (U_FAILURE(status) || !getTimeZone().useDaylightTime()) - return FALSE; +constexpr uint32_t kPersianRelatedYearDiff = 622; - // Force an update of the state of the Calendar. - ((PersianCalendar*)this)->complete(status); // cast away const +int32_t PersianCalendar::getRelatedYear(UErrorCode &status) const +{ + int32_t year = get(UCAL_EXTENDED_YEAR, status); + if (U_FAILURE(status)) { + return 0; + } + return year + kPersianRelatedYearDiff; +} - return (UBool)(U_SUCCESS(status) ? (internalGet(UCAL_DST_OFFSET) != 0) : FALSE); +void PersianCalendar::setRelatedYear(int32_t year) +{ + // set extended year + set(UCAL_EXTENDED_YEAR, year - kPersianRelatedYearDiff); } // default century -static UDate persncal_gSystemDefaultCenturyStart = DBL_MIN; -static int32_t persncal_gSystemDefaultCenturyStartYear = -1; -static icu::UInitOnce persncal_gSystemDefaultCenturyInit = U_INITONCE_INITIALIZER; +static UDate gSystemDefaultCenturyStart = DBL_MIN; +static int32_t gSystemDefaultCenturyStartYear = -1; +static icu::UInitOnce gSystemDefaultCenturyInit {}; UBool PersianCalendar::haveDefaultCentury() const { - return TRUE; + return true; } -static void U_CALLCONV persncal_initializeSystemDefaultCentury() { +static void U_CALLCONV initializeSystemDefaultCentury() { // initialize systemDefaultCentury and systemDefaultCenturyYear based // on the current time. They'll be set to 80 years before // the current time. @@ -268,8 +274,8 @@ static void U_CALLCONV persncal_initializeSystemDefaultCentury() { calendar.setTime(Calendar::getNow(), status); calendar.add(UCAL_YEAR, -80, status); - persncal_gSystemDefaultCenturyStart = calendar.getTime(status); - persncal_gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); + gSystemDefaultCenturyStart = calendar.getTime(status); + gSystemDefaultCenturyStartYear = calendar.get(UCAL_YEAR, status); } // We have no recourse upon failure unless we want to propagate the failure // out. @@ -277,14 +283,14 @@ static void U_CALLCONV persncal_initializeSystemDefaultCentury() { UDate PersianCalendar::defaultCenturyStart() const { // lazy-evaluate systemDefaultCenturyStart - umtx_initOnce(persncal_gSystemDefaultCenturyInit, &persncal_initializeSystemDefaultCentury); - return persncal_gSystemDefaultCenturyStart; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStart; } int32_t PersianCalendar::defaultCenturyStartYear() const { // lazy-evaluate systemDefaultCenturyStartYear - umtx_initOnce(persncal_gSystemDefaultCenturyInit, &persncal_initializeSystemDefaultCentury); - return persncal_gSystemDefaultCenturyStartYear; + umtx_initOnce(gSystemDefaultCenturyInit, &initializeSystemDefaultCentury); + return gSystemDefaultCenturyStartYear; } UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PersianCalendar) diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/persncal.h b/src/duckdb/extension/icu/third_party/icu/i18n/persncal.h index ce6d7397b..b943321a5 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/persncal.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/persncal.h @@ -164,7 +164,7 @@ class PersianCalendar : public Calendar { // TODO: copy c'tor, etc // clone - virtual PersianCalendar* clone() const; + virtual PersianCalendar* clone() const override; private: /** @@ -194,7 +194,7 @@ class PersianCalendar : public Calendar { /** * @internal */ - virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const override; /** * Return the length (in days) of the given month. @@ -203,13 +203,13 @@ class PersianCalendar : public Calendar { * @param year The hijri shamsi month, 0-based * @internal */ - virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const; + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const override; /** * Return the number of days in the given Persian year * @internal */ - virtual int32_t handleGetYearLength(int32_t extendedYear) const; + virtual int32_t handleGetYearLength(int32_t extendedYear) const override; //------------------------------------------------------------------------- // Functions for converting from field values to milliseconds.... @@ -219,7 +219,7 @@ class PersianCalendar : public Calendar { /** * @internal */ - virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const; + virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, UBool useMonth) const override; //------------------------------------------------------------------------- // Functions for converting from milliseconds to field values @@ -228,7 +228,7 @@ class PersianCalendar : public Calendar { /** * @internal */ - virtual int32_t handleGetExtendedYear(); + virtual int32_t handleGetExtendedYear() override; /** * Override Calendar to compute several fields specific to the Persian @@ -246,7 +246,7 @@ class PersianCalendar : public Calendar { * calendar equivalents for the given Julian day. * @internal */ - virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status) override; // UObject stuff public: @@ -255,7 +255,7 @@ class PersianCalendar : public Calendar { * same class ID. Objects of other classes have different class IDs. * @internal */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; /** * Return the class ID for this class. This is useful only for comparing to a return @@ -268,7 +268,7 @@ class PersianCalendar : public Calendar { * @return The class ID for all objects of this class. * @internal */ - U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); /** * return the calendar type, "persian". @@ -276,42 +276,44 @@ class PersianCalendar : public Calendar { * @return calendar type * @internal */ - virtual const char * getType() const; + virtual const char * getType() const override; - private: - PersianCalendar(); // default constructor not implemented - - protected: + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const override; /** - * (Overrides Calendar) Return true if the current date for this Calendar is in - * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. - * - * @param status Fill-in parameter which receives the status of this operation. - * @return True if the current date for this Calendar is in Daylight Savings Time, - * false, otherwise. + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field * @internal */ - virtual UBool inDaylightTime(UErrorCode& status) const; + virtual void setRelatedYear(int32_t year) override; + + private: + PersianCalendar(); // default constructor not implemented + protected: /** - * Returns TRUE because the Persian Calendar does have a default century + * Returns true because the Persian Calendar does have a default century * @internal */ - virtual UBool haveDefaultCentury() const; + virtual UBool haveDefaultCentury() const override; /** * Returns the date of the start of the default century * @return start of century - in milliseconds since epoch, 1970 * @internal */ - virtual UDate defaultCenturyStart() const; + virtual UDate defaultCenturyStart() const override; /** * Returns the year in which the default century begins * @internal */ - virtual int32_t defaultCenturyStartYear() const; + virtual int32_t defaultCenturyStartYear() const override; }; U_NAMESPACE_END diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/pluralranges.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/pluralranges.cpp new file mode 100644 index 000000000..403836f62 --- /dev/null +++ b/src/duckdb/extension/icu/third_party/icu/i18n/pluralranges.cpp @@ -0,0 +1,144 @@ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +// Allow implicit conversion from char16_t* to UnicodeString for this file: +// Helpful in toString methods and elsewhere. +#define UNISTR_FROM_STRING_EXPLICIT + +#include "unicode/numberrangeformatter.h" +#include "pluralranges.h" +#include "uresimp.h" +#include "charstr.h" +#include "uassert.h" +#include "util.h" +#include "numrange_impl.h" + +U_NAMESPACE_BEGIN + + +namespace { + +class PluralRangesDataSink : public ResourceSink { + public: + PluralRangesDataSink(StandardPluralRanges& output) : fOutput(output) {} + + void put(const char* /*key*/, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) override { + ResourceArray entriesArray = value.getArray(status); + if (U_FAILURE(status)) { return; } + fOutput.setCapacity(entriesArray.getSize(), status); + if (U_FAILURE(status)) { return; } + for (int i = 0; entriesArray.getValue(i, value); i++) { + ResourceArray pluralFormsArray = value.getArray(status); + if (U_FAILURE(status)) { return; } + if (pluralFormsArray.getSize() != 3) { + status = U_RESOURCE_TYPE_MISMATCH; + return; + } + pluralFormsArray.getValue(0, value); + StandardPlural::Form first = StandardPlural::fromString(value.getUnicodeString(status), status); + if (U_FAILURE(status)) { return; } + pluralFormsArray.getValue(1, value); + StandardPlural::Form second = StandardPlural::fromString(value.getUnicodeString(status), status); + if (U_FAILURE(status)) { return; } + pluralFormsArray.getValue(2, value); + StandardPlural::Form result = StandardPlural::fromString(value.getUnicodeString(status), status); + if (U_FAILURE(status)) { return; } + fOutput.addPluralRange(first, second, result); + } + } + + private: + StandardPluralRanges& fOutput; +}; + +void getPluralRangesData(const Locale& locale, StandardPluralRanges& output, UErrorCode& status) { + LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "pluralRanges", &status)); + if (U_FAILURE(status)) { return; } + + CharString dataPath; + dataPath.append("locales/", -1, status); + dataPath.append(locale.getLanguage(), -1, status); + if (U_FAILURE(status)) { return; } + int32_t setLen; + // Not all languages are covered: fail gracefully + UErrorCode internalStatus = U_ZERO_ERROR; + const char16_t* set = ures_getStringByKeyWithFallback(rb.getAlias(), dataPath.data(), &setLen, &internalStatus); + if (U_FAILURE(internalStatus)) { return; } + + dataPath.clear(); + dataPath.append("rules/", -1, status); + dataPath.appendInvariantChars(set, setLen, status); + if (U_FAILURE(status)) { return; } + PluralRangesDataSink sink(output); + ures_getAllItemsWithFallback(rb.getAlias(), dataPath.data(), sink, status); +} + +} // namespace + + +StandardPluralRanges +StandardPluralRanges::forLocale(const Locale& locale, UErrorCode& status) { + StandardPluralRanges result; + getPluralRangesData(locale, result, status); + return result; +} + +StandardPluralRanges +StandardPluralRanges::copy(UErrorCode& status) const { + StandardPluralRanges result; + if (fTriplesLen > result.fTriples.getCapacity()) { + if (result.fTriples.resize(fTriplesLen) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return result; + } + } + uprv_memcpy(result.fTriples.getAlias(), + fTriples.getAlias(), + fTriplesLen * sizeof(fTriples[0])); + result.fTriplesLen = fTriplesLen; + return result; +} + +LocalPointer +StandardPluralRanges::toPointer(UErrorCode& status) && noexcept { + return LocalPointer(new StandardPluralRanges(std::move(*this)), status); +} + +void StandardPluralRanges::addPluralRange( + StandardPlural::Form first, + StandardPlural::Form second, + StandardPlural::Form result) { + U_ASSERT(fTriplesLen < fTriples.getCapacity()); + fTriples[fTriplesLen] = {first, second, result}; + fTriplesLen++; +} + +void StandardPluralRanges::setCapacity(int32_t length, UErrorCode& status) { + if (U_FAILURE(status)) { return; } + if (length > fTriples.getCapacity()) { + if (fTriples.resize(length, 0) == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + } + } +} + +StandardPlural::Form +StandardPluralRanges::resolve(StandardPlural::Form first, StandardPlural::Form second) const { + for (int32_t i=0; i toPointer(UErrorCode& status) && noexcept; + + /** Select rule based on the first and second forms */ + StandardPlural::Form resolve(StandardPlural::Form first, StandardPlural::Form second) const; + + /** Used for data loading. */ + void addPluralRange( + StandardPlural::Form first, + StandardPlural::Form second, + StandardPlural::Form result); + + /** Used for data loading. */ + void setCapacity(int32_t length, UErrorCode& status); + + private: + struct StandardPluralRangeTriple { + StandardPlural::Form first; + StandardPlural::Form second; + StandardPlural::Form result; + }; + + // TODO: An array is simple here, but it results in linear lookup time. + // Certain locales have 20-30 entries in this list. + // Consider changing to a smarter data structure. + typedef MaybeStackArray PluralRangeTriples; + PluralRangeTriples fTriples; + int32_t fTriplesLen = 0; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ +#endif //__PLURALRANGES_H__ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp index 292a3168a..33a539cd1 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp @@ -31,7 +31,7 @@ U_NAMESPACE_BEGIN using number::impl::DecimalQuantity; -static const UChar OTHER_STRING[] = { +static const char16_t OTHER_STRING[] = { 0x6F, 0x74, 0x68, 0x65, 0x72, 0 // "other" }; @@ -40,23 +40,23 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PluralFormat) PluralFormat::PluralFormat(UErrorCode& status) : locale(Locale::getDefault()), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { - init(NULL, UPLURAL_TYPE_CARDINAL, status); + init(nullptr, UPLURAL_TYPE_CARDINAL, status); } PluralFormat::PluralFormat(const Locale& loc, UErrorCode& status) : locale(loc), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { - init(NULL, UPLURAL_TYPE_CARDINAL, status); + init(nullptr, UPLURAL_TYPE_CARDINAL, status); } PluralFormat::PluralFormat(const PluralRules& rules, UErrorCode& status) : locale(Locale::getDefault()), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { init(&rules, UPLURAL_TYPE_COUNT, status); } @@ -66,7 +66,7 @@ PluralFormat::PluralFormat(const Locale& loc, UErrorCode& status) : locale(loc), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { init(&rules, UPLURAL_TYPE_COUNT, status); } @@ -76,18 +76,18 @@ PluralFormat::PluralFormat(const Locale& loc, UErrorCode& status) : locale(loc), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { - init(NULL, type, status); + init(nullptr, type, status); } PluralFormat::PluralFormat(const UnicodeString& pat, UErrorCode& status) : locale(Locale::getDefault()), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { - init(NULL, UPLURAL_TYPE_CARDINAL, status); + init(nullptr, UPLURAL_TYPE_CARDINAL, status); applyPattern(pat, status); } @@ -96,9 +96,9 @@ PluralFormat::PluralFormat(const Locale& loc, UErrorCode& status) : locale(loc), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { - init(NULL, UPLURAL_TYPE_CARDINAL, status); + init(nullptr, UPLURAL_TYPE_CARDINAL, status); applyPattern(pat, status); } @@ -107,7 +107,7 @@ PluralFormat::PluralFormat(const PluralRules& rules, UErrorCode& status) : locale(Locale::getDefault()), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { init(&rules, UPLURAL_TYPE_COUNT, status); applyPattern(pat, status); @@ -119,7 +119,7 @@ PluralFormat::PluralFormat(const Locale& loc, UErrorCode& status) : locale(loc), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { init(&rules, UPLURAL_TYPE_COUNT, status); applyPattern(pat, status); @@ -131,9 +131,9 @@ PluralFormat::PluralFormat(const Locale& loc, UErrorCode& status) : locale(loc), msgPattern(status), - numberFormat(NULL), + numberFormat(nullptr), offset(0) { - init(NULL, type, status); + init(nullptr, type, status); applyPattern(pat, status); } @@ -141,7 +141,7 @@ PluralFormat::PluralFormat(const PluralFormat& other) : Format(other), locale(other.locale), msgPattern(other.msgPattern), - numberFormat(NULL), + numberFormat(nullptr), offset(other.offset) { copyObjects(other); } @@ -149,19 +149,19 @@ PluralFormat::PluralFormat(const PluralFormat& other) void PluralFormat::copyObjects(const PluralFormat& other) { UErrorCode status = U_ZERO_ERROR; - if (numberFormat != NULL) { + if (numberFormat != nullptr) { delete numberFormat; } - if (pluralRulesWrapper.pluralRules != NULL) { + if (pluralRulesWrapper.pluralRules != nullptr) { delete pluralRulesWrapper.pluralRules; } - if (other.numberFormat == NULL) { + if (other.numberFormat == nullptr) { numberFormat = NumberFormat::createInstance(locale, status); } else { numberFormat = other.numberFormat->clone(); } - if (other.pluralRulesWrapper.pluralRules == NULL) { + if (other.pluralRulesWrapper.pluralRules == nullptr) { pluralRulesWrapper.pluralRules = PluralRules::forLocale(locale, status); } else { pluralRulesWrapper.pluralRules = other.pluralRulesWrapper.pluralRules->clone(); @@ -179,11 +179,11 @@ PluralFormat::init(const PluralRules* rules, UPluralType type, UErrorCode& statu return; } - if (rules==NULL) { + if (rules==nullptr) { pluralRulesWrapper.pluralRules = PluralRules::forLocale(locale, type, status); } else { pluralRulesWrapper.pluralRules = rules->clone(); - if (pluralRulesWrapper.pluralRules == NULL) { + if (pluralRulesWrapper.pluralRules == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -194,7 +194,7 @@ PluralFormat::init(const PluralRules* rules, UPluralType type, UErrorCode& statu void PluralFormat::applyPattern(const UnicodeString& newPattern, UErrorCode& status) { - msgPattern.parsePluralStyle(newPattern, NULL, status); + msgPattern.parsePluralStyle(newPattern, nullptr, status); if (U_FAILURE(status)) { msgPattern.clear(); offset = 0; @@ -343,9 +343,9 @@ PluralFormat::setLocale(const Locale& loc, UErrorCode& status) { msgPattern.clear(); delete numberFormat; offset = 0; - numberFormat = NULL; + numberFormat = nullptr; pluralRulesWrapper.reset(); - init(NULL, UPLURAL_TYPE_CARDINAL, status); + init(nullptr, UPLURAL_TYPE_CARDINAL, status); } void @@ -354,7 +354,7 @@ PluralFormat::setNumberFormat(const NumberFormat* format, UErrorCode& status) { return; } NumberFormat* nf = format->clone(); - if (nf != NULL) { + if (nf != nullptr) { delete numberFormat; numberFormat = nf; } else { @@ -384,19 +384,19 @@ PluralFormat::operator=(const PluralFormat& other) { bool PluralFormat::operator==(const Format& other) const { if (this == &other) { - return TRUE; + return true; } if (!Format::operator==(other)) { - return FALSE; + return false; } const PluralFormat& o = (const PluralFormat&)other; return locale == o.locale && msgPattern == o.msgPattern && // implies same offset - (numberFormat == NULL) == (o.numberFormat == NULL) && - (numberFormat == NULL || *numberFormat == *o.numberFormat) && - (pluralRulesWrapper.pluralRules == NULL) == (o.pluralRulesWrapper.pluralRules == NULL) && - (pluralRulesWrapper.pluralRules == NULL || + (numberFormat == nullptr) == (o.numberFormat == nullptr) && + (numberFormat == nullptr || *numberFormat == *o.numberFormat) && + (pluralRulesWrapper.pluralRules == nullptr) == (o.pluralRulesWrapper.pluralRules == nullptr) && + (pluralRulesWrapper.pluralRules == nullptr || *pluralRulesWrapper.pluralRules == *o.pluralRulesWrapper.pluralRules); } @@ -434,11 +434,11 @@ int32_t PluralFormat::findSubMessage(const MessagePattern& pattern, int32_t part // (In other words, we never call the selector if we match against an explicit value, // or if the only non-explicit keyword is "other".) UnicodeString keyword; - UnicodeString other(FALSE, OTHER_STRING, 5); + UnicodeString other(false, OTHER_STRING, 5); // When we find a match, we set msgStart>0 and also set this boolean to true // to avoid matching the keyword again (duplicates are allowed) // while we continue to look for an explicit-value match. - UBool haveKeywordMatch=FALSE; + UBool haveKeywordMatch=false; // msgStart is 0 until we find any appropriate sub-message. // We remember the first "other" sub-message if we have not seen any // appropriate sub-message before. @@ -477,7 +477,7 @@ int32_t PluralFormat::findSubMessage(const MessagePattern& pattern, int32_t part // This is the first "other" sub-message, // and the selected keyword is also "other". // Do not match "other" again. - haveKeywordMatch=TRUE; + haveKeywordMatch=true; } } } else { @@ -486,7 +486,7 @@ int32_t PluralFormat::findSubMessage(const MessagePattern& pattern, int32_t part if(msgStart!=0 && (0 == keyword.compare(other))) { // We have already seen an "other" sub-message. // Do not match "other" again. - haveKeywordMatch=TRUE; + haveKeywordMatch=true; // Skip keyword matching but do getLimitPartIndex(). } } @@ -494,7 +494,7 @@ int32_t PluralFormat::findSubMessage(const MessagePattern& pattern, int32_t part // keyword matches msgStart=partIndex; // Do not match this keyword again. - haveKeywordMatch=TRUE; + haveKeywordMatch=true; } } } @@ -548,10 +548,16 @@ void PluralFormat::parseType(const UnicodeString& source, const NFRule *rbnfLeni } UnicodeString currArg = pattern.tempSubString(partStart->getLimit(), partLimit->getIndex() - partStart->getLimit()); - if (rbnfLenientScanner != NULL) { - // If lenient parsing is turned ON, we've got some time consuming parsing ahead of us. - int32_t length = -1; - currMatchIndex = rbnfLenientScanner->findTextLenient(source, currArg, startingAt, &length); + if (rbnfLenientScanner != nullptr) { + // Check if non-lenient rule finds the text before call lenient parsing + int32_t tempIndex = source.indexOf(currArg, startingAt); + if (tempIndex >= 0) { + currMatchIndex = tempIndex; + } else { + // If lenient parsing is turned ON, we've got some time consuming parsing ahead of us. + int32_t length = -1; + currMatchIndex = rbnfLenientScanner->findTextLenient(source, currArg, startingAt, &length); + } } else { currMatchIndex = source.indexOf(currArg, startingAt); @@ -589,7 +595,7 @@ UnicodeString PluralFormat::PluralSelectorAdapter::select(void *context, double void PluralFormat::PluralSelectorAdapter::reset() { delete pluralRules; - pluralRules = NULL; + pluralRules = nullptr; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp index 9c1791a9b..839d14147 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp @@ -12,6 +12,8 @@ #include #include +#include + #include "unicode/utypes.h" #include "unicode/localpointer.h" #include "unicode/plurrule.h" @@ -19,12 +21,15 @@ #include "unicode/ures.h" #include "unicode/numfmt.h" #include "unicode/decimfmt.h" +#include "unicode/numberrangeformatter.h" +#include "bytesinkutil.h" #include "charstr.h" #include "cmemory.h" #include "cstring.h" #include "hash.h" #include "locutil.h" #include "mutex.h" +#include "number_decnum.h" #include "patternprops.h" #include "plurrule_impl.h" #include "putilimp.h" @@ -36,29 +41,37 @@ #include "unifiedcache.h" #include "number_decimalquantity.h" #include "util.h" +#include "pluralranges.h" +#include "numrange_impl.h" +#include "ulocimp.h" #if !UCONFIG_NO_FORMATTING U_NAMESPACE_BEGIN +using namespace icu::pluralimpl; +using icu::number::impl::DecNum; using icu::number::impl::DecimalQuantity; - -static const UChar PLURAL_KEYWORD_OTHER[]={PLURRULE_LOW_O,PLURRULE_LOW_T,PLURRULE_LOW_H,PLURRULE_LOW_E,PLURRULE_LOW_R,0}; -static const UChar PLURAL_DEFAULT_RULE[]={PLURRULE_LOW_O,PLURRULE_LOW_T,PLURRULE_LOW_H,PLURRULE_LOW_E,PLURRULE_LOW_R,PLURRULE_COLON,PLURRULE_SPACE,PLURRULE_LOW_N,0}; -static const UChar PK_IN[]={PLURRULE_LOW_I,PLURRULE_LOW_N,0}; -static const UChar PK_NOT[]={PLURRULE_LOW_N,PLURRULE_LOW_O,PLURRULE_LOW_T,0}; -static const UChar PK_IS[]={PLURRULE_LOW_I,PLURRULE_LOW_S,0}; -static const UChar PK_MOD[]={PLURRULE_LOW_M,PLURRULE_LOW_O,PLURRULE_LOW_D,0}; -static const UChar PK_AND[]={PLURRULE_LOW_A,PLURRULE_LOW_N,PLURRULE_LOW_D,0}; -static const UChar PK_OR[]={PLURRULE_LOW_O,PLURRULE_LOW_R,0}; -static const UChar PK_VAR_N[]={PLURRULE_LOW_N,0}; -static const UChar PK_VAR_I[]={PLURRULE_LOW_I,0}; -static const UChar PK_VAR_F[]={PLURRULE_LOW_F,0}; -static const UChar PK_VAR_T[]={PLURRULE_LOW_T,0}; -static const UChar PK_VAR_V[]={PLURRULE_LOW_V,0}; -static const UChar PK_WITHIN[]={PLURRULE_LOW_W,PLURRULE_LOW_I,PLURRULE_LOW_T,PLURRULE_LOW_H,PLURRULE_LOW_I,PLURRULE_LOW_N,0}; -static const UChar PK_DECIMAL[]={PLURRULE_LOW_D,PLURRULE_LOW_E,PLURRULE_LOW_C,PLURRULE_LOW_I,PLURRULE_LOW_M,PLURRULE_LOW_A,PLURRULE_LOW_L,0}; -static const UChar PK_INTEGER[]={PLURRULE_LOW_I,PLURRULE_LOW_N,PLURRULE_LOW_T,PLURRULE_LOW_E,PLURRULE_LOW_G,PLURRULE_LOW_E,PLURRULE_LOW_R,0}; +using icu::number::impl::RoundingMode; + +static const char16_t PLURAL_KEYWORD_OTHER[]={LOW_O,LOW_T,LOW_H,LOW_E,LOW_R,0}; +static const char16_t PLURAL_DEFAULT_RULE[]={LOW_O,LOW_T,LOW_H,LOW_E,LOW_R,COLON,SPACE,LOW_N,0}; +static const char16_t PK_IN[]={LOW_I,LOW_N,0}; +static const char16_t PK_NOT[]={LOW_N,LOW_O,LOW_T,0}; +static const char16_t PK_IS[]={LOW_I,LOW_S,0}; +static const char16_t PK_MOD[]={LOW_M,LOW_O,LOW_D,0}; +static const char16_t PK_AND[]={LOW_A,LOW_N,LOW_D,0}; +static const char16_t PK_OR[]={LOW_O,LOW_R,0}; +static const char16_t PK_VAR_N[]={LOW_N,0}; +static const char16_t PK_VAR_I[]={LOW_I,0}; +static const char16_t PK_VAR_F[]={LOW_F,0}; +static const char16_t PK_VAR_T[]={LOW_T,0}; +static const char16_t PK_VAR_E[]={LOW_E,0}; +static const char16_t PK_VAR_C[]={LOW_C,0}; +static const char16_t PK_VAR_V[]={LOW_V,0}; +static const char16_t PK_WITHIN[]={LOW_W,LOW_I,LOW_T,LOW_H,LOW_I,LOW_N,0}; +static const char16_t PK_DECIMAL[]={LOW_D,LOW_E,LOW_C,LOW_I,LOW_M,LOW_A,LOW_L,0}; +static const char16_t PK_INTEGER[]={LOW_I,LOW_N,LOW_T,LOW_E,LOW_G,LOW_E,LOW_R,0}; UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PluralRules) UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PluralKeywordEnumeration) @@ -66,6 +79,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PluralKeywordEnumeration) PluralRules::PluralRules(UErrorCode& /*status*/) : UObject(), mRules(nullptr), + mStandardPluralRanges(nullptr), mInternalStatus(U_ZERO_ERROR) { } @@ -73,6 +87,7 @@ PluralRules::PluralRules(UErrorCode& /*status*/) PluralRules::PluralRules(const PluralRules& other) : UObject(other), mRules(nullptr), + mStandardPluralRanges(nullptr), mInternalStatus(U_ZERO_ERROR) { *this=other; @@ -80,6 +95,7 @@ PluralRules::PluralRules(const PluralRules& other) PluralRules::~PluralRules() { delete mRules; + delete mStandardPluralRanges; } SharedPluralRules::~SharedPluralRules() { @@ -88,14 +104,20 @@ SharedPluralRules::~SharedPluralRules() { PluralRules* PluralRules::clone() const { - PluralRules* newObj = new PluralRules(*this); // Since clone doesn't have a 'status' parameter, the best we can do is return nullptr if // the newly created object was not fully constructed properly (an error occurred). - if (newObj != nullptr && U_FAILURE(newObj->mInternalStatus)) { - delete newObj; - newObj = nullptr; + UErrorCode localStatus = U_ZERO_ERROR; + return clone(localStatus); +} + +PluralRules* +PluralRules::clone(UErrorCode& status) const { + LocalPointer newObj(new PluralRules(*this), status); + if (U_SUCCESS(status) && U_FAILURE(newObj->mInternalStatus)) { + status = newObj->mInternalStatus; + newObj.adoptInstead(nullptr); } - return newObj; + return newObj.orphan(); } PluralRules& @@ -103,6 +125,8 @@ PluralRules::operator=(const PluralRules& other) { if (this != &other) { delete mRules; mRules = nullptr; + delete mStandardPluralRanges; + mStandardPluralRanges = nullptr; mInternalStatus = other.mInternalStatus; if (U_FAILURE(mInternalStatus)) { // bail out early if the object we were copying from was already 'invalid'. @@ -118,6 +142,11 @@ PluralRules::operator=(const PluralRules& other) { mInternalStatus = mRules->fInternalStatus; } } + if (other.mStandardPluralRanges != nullptr) { + mStandardPluralRanges = other.mStandardPluralRanges->copy(mInternalStatus) + .toPointer(mInternalStatus) + .orphan(); + } } return *this; } @@ -154,7 +183,7 @@ PluralRules::createRules(const UnicodeString& description, UErrorCode& status) { PluralRules* U_EXPORT2 PluralRules::createDefaultRules(UErrorCode& status) { - return createRules(UnicodeString(TRUE, PLURAL_DEFAULT_RULE, -1), status); + return createRules(UnicodeString(true, PLURAL_DEFAULT_RULE, -1), status); } /******************************************************************************/ @@ -210,11 +239,8 @@ PluralRules::forLocale(const Locale& locale, UPluralType type, UErrorCode& statu if (U_FAILURE(status)) { return nullptr; } - PluralRules *result = (*shared)->clone(); + PluralRules *result = (*shared)->clone(status); shared->removeRef(); - if (result == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - } return result; } @@ -251,6 +277,10 @@ PluralRules::internalForLocale(const Locale& locale, UPluralType type, UErrorCod // Original impl used default rules. // Ask the question to ICU Core. + newObj->mStandardPluralRanges = StandardPluralRanges::forLocale(locale, status) + .toPointer(status) + .orphan(); + return newObj.orphan(); } @@ -271,19 +301,50 @@ PluralRules::select(const number::FormattedNumber& number, UErrorCode& status) c if (U_FAILURE(status)) { return ICU_Utility::makeBogusString(); } + if (U_FAILURE(mInternalStatus)) { + status = mInternalStatus; + return ICU_Utility::makeBogusString(); + } return select(dq); } UnicodeString PluralRules::select(const IFixedDecimal &number) const { if (mRules == nullptr) { - return UnicodeString(TRUE, PLURAL_DEFAULT_RULE, -1); + return UnicodeString(true, PLURAL_DEFAULT_RULE, -1); } else { return mRules->select(number); } } +UnicodeString +PluralRules::select(const number::FormattedNumberRange& range, UErrorCode& status) const { + return select(range.getData(status), status); +} + +UnicodeString +PluralRules::select(const number::impl::UFormattedNumberRangeData* impl, UErrorCode& status) const { + if (U_FAILURE(status)) { + return ICU_Utility::makeBogusString(); + } + if (U_FAILURE(mInternalStatus)) { + status = mInternalStatus; + return ICU_Utility::makeBogusString(); + } + if (mStandardPluralRanges == nullptr) { + // Happens if PluralRules was constructed via createRules() + status = U_UNSUPPORTED_ERROR; + return ICU_Utility::makeBogusString(); + } + auto form1 = StandardPlural::fromString(select(impl->quantity1), status); + auto form2 = StandardPlural::fromString(select(impl->quantity2), status); + if (U_FAILURE(status)) { + return ICU_Utility::makeBogusString(); + } + auto result = mStandardPluralRanges->resolve(form1, form2); + return UnicodeString(StandardPlural::getKeyword(result), -1, US_INV); +} StringEnumeration* @@ -315,19 +376,23 @@ PluralRules::getAllKeywordValues(const UnicodeString & /* keyword */, double * / return 0; } +/** + * Helper method for the overrides of getSamples() for double and DecimalQuantity + * return value types. Provide only one of an allocated array of double or + * DecimalQuantity, and a nullptr for the other. + */ +static int32_t +getSamplesFromString(const UnicodeString &samples, double *destDbl, + DecimalQuantity* destDq, int32_t destCapacity, + UErrorCode& status) { -static double scaleForInt(double d) { - double scale = 1.0; - while (d != floor(d)) { - d = d * 10.0; - scale = scale * 10.0; + if ((destDbl == nullptr && destDq == nullptr) + || (destDbl != nullptr && destDq != nullptr)) { + status = U_INTERNAL_PROGRAM_ERROR; + return 0; } - return scale; -} -static int32_t -getSamplesFromString(const UnicodeString &samples, double *dest, - int32_t destCapacity, UErrorCode& status) { + bool isDouble = destDbl != nullptr; int32_t sampleCount = 0; int32_t sampleStartIdx = 0; int32_t sampleEndIdx = 0; @@ -335,57 +400,84 @@ getSamplesFromString(const UnicodeString &samples, double *dest, //std::string ss; // TODO: debugging. // std::cout << "PluralRules::getSamples(), samples = \"" << samples.toUTF8String(ss) << "\"\n"; for (sampleCount = 0; sampleCount < destCapacity && sampleStartIdx < samples.length(); ) { - sampleEndIdx = samples.indexOf(PLURRULE_COMMA, sampleStartIdx); + sampleEndIdx = samples.indexOf(COMMA, sampleStartIdx); if (sampleEndIdx == -1) { sampleEndIdx = samples.length(); } const UnicodeString &sampleRange = samples.tempSubStringBetween(sampleStartIdx, sampleEndIdx); // ss.erase(); // std::cout << "PluralRules::getSamples(), samplesRange = \"" << sampleRange.toUTF8String(ss) << "\"\n"; - int32_t tildeIndex = sampleRange.indexOf(PLURRULE_TILDE); + int32_t tildeIndex = sampleRange.indexOf(TILDE); if (tildeIndex < 0) { - FixedDecimal fixed(sampleRange, status); - double sampleValue = fixed.source; - if (fixed.visibleDecimalDigitCount == 0 || sampleValue != floor(sampleValue)) { - dest[sampleCount++] = sampleValue; + DecimalQuantity dq = DecimalQuantity::fromExponentString(sampleRange, status); + if (isDouble) { + // See warning note below about lack of precision for floating point samples for numbers with + // trailing zeroes in the decimal fraction representation. + double dblValue = dq.toDouble(); + if (!(dblValue == floor(dblValue) && dq.fractionCount() > 0)) { + destDbl[sampleCount++] = dblValue; + } + } else { + destDq[sampleCount++] = dq; } } else { - - FixedDecimal fixedLo(sampleRange.tempSubStringBetween(0, tildeIndex), status); - FixedDecimal fixedHi(sampleRange.tempSubStringBetween(tildeIndex+1), status); - double rangeLo = fixedLo.source; - double rangeHi = fixedHi.source; + DecimalQuantity rangeLo = + DecimalQuantity::fromExponentString(sampleRange.tempSubStringBetween(0, tildeIndex), status); + DecimalQuantity rangeHi = DecimalQuantity::fromExponentString(sampleRange.tempSubStringBetween(tildeIndex+1), status); if (U_FAILURE(status)) { break; } - if (rangeHi < rangeLo) { + if (rangeHi.toDouble() < rangeLo.toDouble()) { status = U_INVALID_FORMAT_ERROR; break; } - // For ranges of samples with fraction decimal digits, scale the number up so that we - // are adding one in the units place. Avoids roundoffs from repetitive adds of tenths. - - double scale = scaleForInt(rangeLo); - double t = scaleForInt(rangeHi); - if (t > scale) { - scale = t; - } - rangeLo *= scale; - rangeHi *= scale; - for (double n=rangeLo; n<=rangeHi; n+=1) { - // Hack Alert: don't return any decimal samples with integer values that - // originated from a format with trailing decimals. - // This API is returning doubles, which can't distinguish having displayed - // zeros to the right of the decimal. - // This results in test failures with values mapping back to a different keyword. - double sampleValue = n/scale; - if (!(sampleValue == floor(sampleValue) && fixedLo.visibleDecimalDigitCount > 0)) { - dest[sampleCount++] = sampleValue; + DecimalQuantity incrementDq; + incrementDq.setToInt(1); + int32_t lowerDispMag = rangeLo.getLowerDisplayMagnitude(); + int32_t exponent = rangeLo.getExponent(); + int32_t incrementScale = lowerDispMag + exponent; + incrementDq.adjustMagnitude(incrementScale); + double incrementVal = incrementDq.toDouble(); // 10 ^ incrementScale + + + DecimalQuantity dq(rangeLo); + double dblValue = dq.toDouble(); + double end = rangeHi.toDouble(); + + while (dblValue <= end) { + if (isDouble) { + // Hack Alert: don't return any decimal samples with integer values that + // originated from a format with trailing decimals. + // This API is returning doubles, which can't distinguish having displayed + // zeros to the right of the decimal. + // This results in test failures with values mapping back to a different keyword. + if (!(dblValue == floor(dblValue) && dq.fractionCount() > 0)) { + destDbl[sampleCount++] = dblValue; + } + } else { + destDq[sampleCount++] = dq; } if (sampleCount >= destCapacity) { break; } + + // Increment dq for next iteration + + // Because DecNum and DecimalQuantity do not support + // add operations, we need to convert to/from double, + // despite precision lossiness for decimal fractions like 0.1. + dblValue += incrementVal; + DecNum newDqDecNum; + newDqDecNum.setTo(dblValue, status); + DecimalQuantity newDq; + newDq.setToDecNum(newDqDecNum, status); + newDq.setMinFraction(-lowerDispMag); + newDq.roundToMagnitude(lowerDispMag, RoundingMode::UNUM_ROUND_HALFEVEN, status); + newDq.adjustMagnitude(-exponent); + newDq.adjustExponent(exponent); + dblValue = newDq.toDouble(); + dq = newDq; } } sampleStartIdx = sampleEndIdx + 1; @@ -393,24 +485,53 @@ getSamplesFromString(const UnicodeString &samples, double *dest, return sampleCount; } - int32_t PluralRules::getSamples(const UnicodeString &keyword, double *dest, int32_t destCapacity, UErrorCode& status) { - if (destCapacity == 0 || U_FAILURE(status)) { + if (U_FAILURE(status)) { + return 0; + } + if (U_FAILURE(mInternalStatus)) { + status = mInternalStatus; + return 0; + } + if (dest != nullptr ? destCapacity < 0 : destCapacity != 0) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } + RuleChain *rc = rulesForKeyword(keyword); + if (rc == nullptr) { + return 0; + } + int32_t numSamples = getSamplesFromString(rc->fIntegerSamples, dest, nullptr, destCapacity, status); + if (numSamples == 0) { + numSamples = getSamplesFromString(rc->fDecimalSamples, dest, nullptr, destCapacity, status); + } + return numSamples; +} + +int32_t +PluralRules::getSamples(const UnicodeString &keyword, DecimalQuantity *dest, + int32_t destCapacity, UErrorCode& status) { + if (U_FAILURE(status)) { return 0; } if (U_FAILURE(mInternalStatus)) { status = mInternalStatus; return 0; } + if (dest != nullptr ? destCapacity < 0 : destCapacity != 0) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return 0; + } RuleChain *rc = rulesForKeyword(keyword); if (rc == nullptr) { return 0; } - int32_t numSamples = getSamplesFromString(rc->fIntegerSamples, dest, destCapacity, status); + + int32_t numSamples = getSamplesFromString(rc->fIntegerSamples, nullptr, dest, destCapacity, status); if (numSamples == 0) { - numSamples = getSamplesFromString(rc->fDecimalSamples, dest, destCapacity, status); + numSamples = getSamplesFromString(rc->fDecimalSamples, nullptr, dest, destCapacity, status); } return numSamples; } @@ -437,7 +558,7 @@ PluralRules::isKeyword(const UnicodeString& keyword) const { UnicodeString PluralRules::getKeywordOther() const { - return UnicodeString(TRUE, PLURAL_KEYWORD_OTHER, 5); + return UnicodeString(true, PLURAL_KEYWORD_OTHER, 5); } bool @@ -446,34 +567,34 @@ PluralRules::operator==(const PluralRules& other) const { UErrorCode status= U_ZERO_ERROR; if ( this == &other ) { - return TRUE; + return true; } LocalPointer myKeywordList(getKeywords(status)); LocalPointer otherKeywordList(other.getKeywords(status)); if (U_FAILURE(status)) { - return FALSE; + return false; } if (myKeywordList->count(status)!=otherKeywordList->count(status)) { - return FALSE; + return false; } myKeywordList->reset(status); while ((ptrKeyword=myKeywordList->snext(status))!=nullptr) { if (!other.isKeyword(*ptrKeyword)) { - return FALSE; + return false; } } otherKeywordList->reset(status); while ((ptrKeyword=otherKeywordList->snext(status))!=nullptr) { if (!this->isKeyword(*ptrKeyword)) { - return FALSE; + return false; } } if (U_FAILURE(status)) { - return FALSE; + return false; } - return TRUE; + return true; } @@ -496,11 +617,11 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr return; } switch (type) { - case plurrule_token_tAnd: + case tAnd: U_ASSERT(curAndConstraint != nullptr); curAndConstraint = curAndConstraint->add(status); break; - case plurrule_token_tOr: + case tOr: { U_ASSERT(currentChain != nullptr); OrConstraint *orNode=currentChain->ruleHeader; @@ -517,22 +638,22 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr curAndConstraint = orNode->add(status); } break; - case plurrule_token_tIs: + case tIs: U_ASSERT(curAndConstraint != nullptr); U_ASSERT(curAndConstraint->value == -1); U_ASSERT(curAndConstraint->rangeList == nullptr); break; - case plurrule_token_tNot: + case tNot: U_ASSERT(curAndConstraint != nullptr); - curAndConstraint->negated=TRUE; + curAndConstraint->negated=true; break; - case plurrule_token_tNotEqual: - curAndConstraint->negated=TRUE; + case tNotEqual: + curAndConstraint->negated=true; U_FALLTHROUGH; - case plurrule_token_tIn: - case plurrule_token_tWithin: - case plurrule_token_tEqual: + case tIn: + case tWithin: + case tEqual: { U_ASSERT(curAndConstraint != nullptr); LocalPointer newRangeList(new UVector32(status), status); @@ -545,10 +666,10 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr rangeLowIdx = 0; rangeHiIdx = 1; curAndConstraint->value=PLURAL_RANGE_HIGH; - curAndConstraint->integerOnly = (type != plurrule_token_tWithin); + curAndConstraint->integerOnly = (type != tWithin); } break; - case plurrule_token_tNumber: + case tNumber: U_ASSERT(curAndConstraint != nullptr); if ( (curAndConstraint->op==AndConstraint::MOD)&& (curAndConstraint->opNum == -1 ) ) { @@ -578,7 +699,7 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr } } break; - case plurrule_token_tComma: + case tComma: // TODO: rule syntax checking is inadequate, can happen with badly formed rules. // Catch cases like "n mod 10, is 1" here instead. if (curAndConstraint == nullptr || curAndConstraint->rangeList == nullptr) { @@ -591,19 +712,21 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr rangeHiIdx = curAndConstraint->rangeList->size(); curAndConstraint->rangeList->addElement(-1, status); // range Hi break; - case plurrule_token_tMod: + case tMod: U_ASSERT(curAndConstraint != nullptr); curAndConstraint->op=AndConstraint::MOD; break; - case plurrule_token_tVariableN: - case plurrule_token_tVariableI: - case plurrule_token_tVariableF: - case plurrule_token_tVariableT: - case plurrule_token_tVariableV: + case tVariableN: + case tVariableI: + case tVariableF: + case tVariableT: + case tVariableE: + case tVariableC: + case tVariableV: U_ASSERT(curAndConstraint != nullptr); curAndConstraint->digitsType = type; break; - case plurrule_token_tKeyword: + case tKeyword: { RuleChain *newChain = new RuleChain; if (newChain == nullptr) { @@ -635,28 +758,28 @@ PluralRuleParser::parse(const UnicodeString& ruleData, PluralRules *prules, UErr } break; - case plurrule_token_tInteger: + case tInteger: for (;;) { getNextToken(status); - if (U_FAILURE(status) || type == plurrule_token_tSemiColon || type == plurrule_token_tEOF || type == plurrule_token_tAt) { + if (U_FAILURE(status) || type == tSemiColon || type == tEOF || type == tAt) { break; } - if (type == plurrule_token_tEllipsis) { - currentChain->fIntegerSamplesUnbounded = TRUE; + if (type == tEllipsis) { + currentChain->fIntegerSamplesUnbounded = true; continue; } currentChain->fIntegerSamples.append(token); } break; - case plurrule_token_tDecimal: + case tDecimal: for (;;) { getNextToken(status); - if (U_FAILURE(status) || type == plurrule_token_tSemiColon || type == plurrule_token_tEOF || type == plurrule_token_tAt) { + if (U_FAILURE(status) || type == tSemiColon || type == tEOF || type == tAt) { break; } - if (type == plurrule_token_tEllipsis) { - currentChain->fDecimalSamplesUnbounded = TRUE; + if (type == tEllipsis) { + currentChain->fDecimalSamplesUnbounded = true; continue; } currentChain->fDecimalSamples.append(token); @@ -703,19 +826,24 @@ PluralRules::getRuleFromResource(const Locale& locale, UPluralType type, UErrorC } int32_t resLen=0; const char *curLocaleName=locale.getBaseName(); - const UChar* s = ures_getStringByKey(locRes.getAlias(), curLocaleName, &resLen, &errCode); + const char16_t* s = ures_getStringByKey(locRes.getAlias(), curLocaleName, &resLen, &errCode); if (s == nullptr) { // Check parent locales. UErrorCode status = U_ZERO_ERROR; - char parentLocaleName[ULOC_FULLNAME_CAPACITY]; const char *curLocaleName2=locale.getBaseName(); - uprv_strcpy(parentLocaleName, curLocaleName2); + CharString parentLocaleName(curLocaleName2, status); - while (uloc_getParent(parentLocaleName, parentLocaleName, - ULOC_FULLNAME_CAPACITY, &status) > 0) { + for (;;) { + { + CharString tmp; + CharStringByteSink sink(&tmp); + ulocimp_getParent(parentLocaleName.data(), sink, &status); + if (tmp.isEmpty()) break; + parentLocaleName = std::move(tmp); + } resLen=0; - s = ures_getStringByKey(locRes.getAlias(), parentLocaleName, &resLen, &status); + s = ures_getStringByKey(locRes.getAlias(), parentLocaleName.data(), &resLen, &status); if (s != nullptr) { errCode = U_ZERO_ERROR; break; @@ -747,9 +875,9 @@ PluralRules::getRuleFromResource(const Locale& locale, UPluralType type, UErrorC UnicodeString rules = ures_getNextUnicodeString(setRes.getAlias(), &key, &errCode); UnicodeString uKey(key, -1, US_INV); result.append(uKey); - result.append(PLURRULE_COLON); + result.append(COLON); result.append(rules); - result.append(PLURRULE_SEMI_COLON); + result.append(SEMI_COLON); } return result; } @@ -800,10 +928,10 @@ AndConstraint::~AndConstraint() { UBool AndConstraint::isFulfilled(const IFixedDecimal &number) { - UBool result = TRUE; - if (digitsType == plurrule_token_none) { + UBool result = true; + if (digitsType == none) { // An empty AndConstraint, created by a rule with a keyword but no following expression. - return TRUE; + return true; } PluralOperand operand = tokenTypeToPluralOperand(digitsType); @@ -812,7 +940,7 @@ AndConstraint::isFulfilled(const IFixedDecimal &number) { // May be non-integer (n option only) do { if (integerOnly && n != uprv_floor(n)) { - result = FALSE; + result = false; break; } @@ -824,14 +952,14 @@ AndConstraint::isFulfilled(const IFixedDecimal &number) { n == value; // 'is' rule break; } - result = FALSE; // 'in' or 'within' rule + result = false; // 'in' or 'within' rule for (int32_t r=0; rsize(); r+=2) { if (rangeList->elementAti(r) <= n && n <= rangeList->elementAti(r+1)) { - result = TRUE; + result = true; break; } } - } while (FALSE); + } while (false); if (negated) { result = !result; @@ -907,10 +1035,10 @@ OrConstraint::add(UErrorCode& status) { UBool OrConstraint::isFulfilled(const IFixedDecimal &number) { OrConstraint* orRule=this; - UBool result=FALSE; + UBool result=false; while (orRule!=nullptr && !result) { - result=TRUE; + result=true; AndConstraint* andRule = orRule->childNode; while (andRule!=nullptr && result) { result = andRule->isFulfilled(number); @@ -928,7 +1056,7 @@ RuleChain::RuleChain(const RuleChain& other) : fIntegerSamples(other.fIntegerSamples), fDecimalSamplesUnbounded(other.fDecimalSamplesUnbounded), fIntegerSamplesUnbounded(other.fIntegerSamplesUnbounded), fInternalStatus(other.fInternalStatus) { if (U_FAILURE(this->fInternalStatus)) { - return; // stop early if the object we are copying from is invalid. + return; // stop early if the object we are copying from is invalid. } if (other.ruleHeader != nullptr) { this->ruleHeader = new OrConstraint(*(other.ruleHeader)); @@ -967,36 +1095,40 @@ RuleChain::select(const IFixedDecimal &number) const { } } } - return UnicodeString(TRUE, PLURAL_KEYWORD_OTHER, 5); + return UnicodeString(true, PLURAL_KEYWORD_OTHER, 5); } static UnicodeString tokenString(tokenType tok) { UnicodeString s; switch (tok) { - case plurrule_token_tVariableN: - s.append(PLURRULE_LOW_N); break; - case plurrule_token_tVariableI: - s.append(PLURRULE_LOW_I); break; - case plurrule_token_tVariableF: - s.append(PLURRULE_LOW_F); break; - case plurrule_token_tVariableV: - s.append(PLURRULE_LOW_V); break; - case plurrule_token_tVariableT: - s.append(PLURRULE_LOW_T); break; + case tVariableN: + s.append(LOW_N); break; + case tVariableI: + s.append(LOW_I); break; + case tVariableF: + s.append(LOW_F); break; + case tVariableV: + s.append(LOW_V); break; + case tVariableT: + s.append(LOW_T); break; + case tVariableE: + s.append(LOW_E); break; + case tVariableC: + s.append(LOW_C); break; default: - s.append(PLURRULE_TILDE); + s.append(TILDE); } return s; } void RuleChain::dumpRules(UnicodeString& result) { - UChar digitString[16]; + char16_t digitString[16]; if ( ruleHeader != nullptr ) { result += fKeyword; - result += PLURRULE_COLON; - result += PLURRULE_SPACE; + result += COLON; + result += SPACE; OrConstraint* orRule=ruleHeader; while ( orRule != nullptr ) { AndConstraint* andRule=orRule->childNode; @@ -1014,7 +1146,7 @@ RuleChain::dumpRules(UnicodeString& result) { } else { result += tokenString(andRule->digitsType); - result += PLURRULE_SPACE; + result += SPACE; if (andRule->op==AndConstraint::MOD) { result += UNICODE_STRING_SIMPLE("mod "); uprv_itou(digitString,16, andRule->opNum,10,0); @@ -1102,20 +1234,20 @@ RuleChain::getKeywords(int32_t capacityOfKeywords, UnicodeString* keywords, int3 UBool RuleChain::isKeyword(const UnicodeString& keywordParam) const { if ( fKeyword == keywordParam ) { - return TRUE; + return true; } if ( fNext != nullptr ) { return fNext->isKeyword(keywordParam); } else { - return FALSE; + return false; } } PluralRuleParser::PluralRuleParser() : - ruleIndex(0), token(), type(plurrule_token_none), prevType(plurrule_token_none), + ruleIndex(0), token(), type(none), prevType(none), curAndConstraint(nullptr), currentChain(nullptr), rangeLowIdx(-1), rangeHiIdx(-1) { } @@ -1142,92 +1274,98 @@ PluralRuleParser::checkSyntax(UErrorCode &status) if (U_FAILURE(status)) { return; } - if (!(prevType==plurrule_token_none || prevType==plurrule_token_tSemiColon)) { - type = getKeyType(token, type); // Switch token type from plurrule_token_tKeyword if we scanned a reserved word, + if (!(prevType==none || prevType==tSemiColon)) { + type = getKeyType(token, type); // Switch token type from tKeyword if we scanned a reserved word, // and we are not at the start of a rule, where a // keyword is expected. } switch(prevType) { - case plurrule_token_none: - case plurrule_token_tSemiColon: - if (type!=plurrule_token_tKeyword && type != plurrule_token_tEOF) { + case none: + case tSemiColon: + if (type!=tKeyword && type != tEOF) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tVariableN: - case plurrule_token_tVariableI: - case plurrule_token_tVariableF: - case plurrule_token_tVariableT: - case plurrule_token_tVariableV: - if (type != plurrule_token_tIs && type != plurrule_token_tMod && type != plurrule_token_tIn && - type != plurrule_token_tNot && type != plurrule_token_tWithin && type != plurrule_token_tEqual && type != plurrule_token_tNotEqual) { + case tVariableN: + case tVariableI: + case tVariableF: + case tVariableT: + case tVariableE: + case tVariableC: + case tVariableV: + if (type != tIs && type != tMod && type != tIn && + type != tNot && type != tWithin && type != tEqual && type != tNotEqual) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tKeyword: - if (type != plurrule_token_tColon) { + case tKeyword: + if (type != tColon) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tColon: - if (!(type == plurrule_token_tVariableN || - type == plurrule_token_tVariableI || - type == plurrule_token_tVariableF || - type == plurrule_token_tVariableT || - type == plurrule_token_tVariableV || - type == plurrule_token_tAt)) { + case tColon: + if (!(type == tVariableN || + type == tVariableI || + type == tVariableF || + type == tVariableT || + type == tVariableE || + type == tVariableC || + type == tVariableV || + type == tAt)) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tIs: - if ( type != plurrule_token_tNumber && type != plurrule_token_tNot) { + case tIs: + if ( type != tNumber && type != tNot) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tNot: - if (type != plurrule_token_tNumber && type != plurrule_token_tIn && type != plurrule_token_tWithin) { + case tNot: + if (type != tNumber && type != tIn && type != tWithin) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tMod: - case plurrule_token_tDot2: - case plurrule_token_tIn: - case plurrule_token_tWithin: - case plurrule_token_tEqual: - case plurrule_token_tNotEqual: - if (type != plurrule_token_tNumber) { + case tMod: + case tDot2: + case tIn: + case tWithin: + case tEqual: + case tNotEqual: + if (type != tNumber) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tAnd: - case plurrule_token_tOr: - if ( type != plurrule_token_tVariableN && - type != plurrule_token_tVariableI && - type != plurrule_token_tVariableF && - type != plurrule_token_tVariableT && - type != plurrule_token_tVariableV) { + case tAnd: + case tOr: + if ( type != tVariableN && + type != tVariableI && + type != tVariableF && + type != tVariableT && + type != tVariableE && + type != tVariableC && + type != tVariableV) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tComma: - if (type != plurrule_token_tNumber) { + case tComma: + if (type != tNumber) { status = U_UNEXPECTED_TOKEN; } break; - case plurrule_token_tNumber: - if (type != plurrule_token_tDot2 && type != plurrule_token_tSemiColon && type != plurrule_token_tIs && type != plurrule_token_tNot && - type != plurrule_token_tIn && type != plurrule_token_tEqual && type != plurrule_token_tNotEqual && type != plurrule_token_tWithin && - type != plurrule_token_tAnd && type != plurrule_token_tOr && type != plurrule_token_tComma && type != plurrule_token_tAt && - type != plurrule_token_tEOF) + case tNumber: + if (type != tDot2 && type != tSemiColon && type != tIs && type != tNot && + type != tIn && type != tEqual && type != tNotEqual && type != tWithin && + type != tAnd && type != tOr && type != tComma && type != tAt && + type != tEOF) { status = U_UNEXPECTED_TOKEN; } // TODO: a comma following a number that is not part of a range will be allowed. // It's not the only case of this sort of thing. Parser needs a re-write. break; - case plurrule_token_tAt: - if (type != plurrule_token_tDecimal && type != plurrule_token_tInteger) { + case tAt: + if (type != tDecimal && type != tInteger) { status = U_UNEXPECTED_TOKEN; } break; @@ -1249,71 +1387,71 @@ PluralRuleParser::getNextToken(UErrorCode &status) return; } - UChar ch; + char16_t ch; while (ruleIndex < ruleSrc->length()) { ch = ruleSrc->charAt(ruleIndex); type = charType(ch); - if (type != plurrule_token_tSpace) { + if (type != tSpace) { break; } ++(ruleIndex); } if (ruleIndex >= ruleSrc->length()) { - type = plurrule_token_tEOF; + type = tEOF; return; } int32_t curIndex= ruleIndex; switch (type) { - case plurrule_token_tColon: - case plurrule_token_tSemiColon: - case plurrule_token_tComma: - case plurrule_token_tEllipsis: - case plurrule_token_tTilde: // scanned '~' - case plurrule_token_tAt: // scanned '@' - case plurrule_token_tEqual: // scanned '=' - case plurrule_token_tMod: // scanned '%' + case tColon: + case tSemiColon: + case tComma: + case tEllipsis: + case tTilde: // scanned '~' + case tAt: // scanned '@' + case tEqual: // scanned '=' + case tMod: // scanned '%' // Single character tokens. ++curIndex; break; - case plurrule_token_tNotEqual: // scanned '!' - if (ruleSrc->charAt(curIndex+1) == PLURRULE_EQUALS) { + case tNotEqual: // scanned '!' + if (ruleSrc->charAt(curIndex+1) == EQUALS) { curIndex += 2; } else { - type = plurrule_token_none; + type = none; curIndex += 1; } break; - case plurrule_token_tKeyword: - while (type == plurrule_token_tKeyword && ++curIndex < ruleSrc->length()) { + case tKeyword: + while (type == tKeyword && ++curIndex < ruleSrc->length()) { ch = ruleSrc->charAt(curIndex); type = charType(ch); } - type = plurrule_token_tKeyword; + type = tKeyword; break; - case plurrule_token_tNumber: - while (type == plurrule_token_tNumber && ++curIndex < ruleSrc->length()) { + case tNumber: + while (type == tNumber && ++curIndex < ruleSrc->length()) { ch = ruleSrc->charAt(curIndex); type = charType(ch); } - type = plurrule_token_tNumber; + type = tNumber; break; - case plurrule_token_tDot: + case tDot: // We could be looking at either ".." in a range, or "..." at the end of a sample. - if (curIndex+1 >= ruleSrc->length() || ruleSrc->charAt(curIndex+1) != PLURRULE_DOT) { + if (curIndex+1 >= ruleSrc->length() || ruleSrc->charAt(curIndex+1) != DOT) { ++curIndex; break; // Single dot } - if (curIndex+2 >= ruleSrc->length() || ruleSrc->charAt(curIndex+2) != PLURRULE_DOT) { + if (curIndex+2 >= ruleSrc->length() || ruleSrc->charAt(curIndex+2) != DOT) { curIndex += 2; - type = plurrule_token_tDot2; + type = tDot2; break; // double dot } - type = plurrule_token_tEllipsis; + type = tEllipsis; curIndex += 3; break; // triple dot @@ -1330,38 +1468,38 @@ PluralRuleParser::getNextToken(UErrorCode &status) } tokenType -PluralRuleParser::charType(UChar ch) { - if ((ch>=PLURRULE_U_ZERO) && (ch<=PLURRULE_U_NINE)) { - return plurrule_token_tNumber; +PluralRuleParser::charType(char16_t ch) { + if ((ch>=U_ZERO) && (ch<=U_NINE)) { + return tNumber; } - if (ch>=PLURRULE_LOW_A && ch<=PLURRULE_LOW_Z) { - return plurrule_token_tKeyword; + if (ch>=LOW_A && ch<=LOW_Z) { + return tKeyword; } switch (ch) { - case PLURRULE_COLON: - return plurrule_token_tColon; - case PLURRULE_SPACE: - return plurrule_token_tSpace; - case PLURRULE_SEMI_COLON: - return plurrule_token_tSemiColon; - case PLURRULE_DOT: - return plurrule_token_tDot; - case PLURRULE_COMMA: - return plurrule_token_tComma; - case PLURRULE_EXCLAMATION: - return plurrule_token_tNotEqual; - case PLURRULE_EQUALS: - return plurrule_token_tEqual; - case PLURRULE_PERCENT_SIGN: - return plurrule_token_tMod; - case PLURRULE_AT: - return plurrule_token_tAt; - case PLURRULE_ELLIPSIS: - return plurrule_token_tEllipsis; - case PLURRULE_TILDE: - return plurrule_token_tTilde; + case COLON: + return tColon; + case SPACE: + return tSpace; + case SEMI_COLON: + return tSemiColon; + case DOT: + return tDot; + case COMMA: + return tComma; + case EXCLAMATION: + return tNotEqual; + case EQUALS: + return tEqual; + case PERCENT_SIGN: + return tMod; + case AT: + return tAt; + case ELLIPSIS: + return tEllipsis; + case TILDE: + return tTilde; default : - return plurrule_token_none; + return none; } } @@ -1371,38 +1509,42 @@ PluralRuleParser::charType(UChar ch) { tokenType PluralRuleParser::getKeyType(const UnicodeString &token, tokenType keyType) { - if (keyType != plurrule_token_tKeyword) { + if (keyType != tKeyword) { return keyType; } if (0 == token.compare(PK_VAR_N, 1)) { - keyType = plurrule_token_tVariableN; + keyType = tVariableN; } else if (0 == token.compare(PK_VAR_I, 1)) { - keyType = plurrule_token_tVariableI; + keyType = tVariableI; } else if (0 == token.compare(PK_VAR_F, 1)) { - keyType = plurrule_token_tVariableF; + keyType = tVariableF; } else if (0 == token.compare(PK_VAR_T, 1)) { - keyType = plurrule_token_tVariableT; + keyType = tVariableT; + } else if (0 == token.compare(PK_VAR_E, 1)) { + keyType = tVariableE; + } else if (0 == token.compare(PK_VAR_C, 1)) { + keyType = tVariableC; } else if (0 == token.compare(PK_VAR_V, 1)) { - keyType = plurrule_token_tVariableV; + keyType = tVariableV; } else if (0 == token.compare(PK_IS, 2)) { - keyType = plurrule_token_tIs; + keyType = tIs; } else if (0 == token.compare(PK_AND, 3)) { - keyType = plurrule_token_tAnd; + keyType = tAnd; } else if (0 == token.compare(PK_IN, 2)) { - keyType = plurrule_token_tIn; + keyType = tIn; } else if (0 == token.compare(PK_WITHIN, 6)) { - keyType = plurrule_token_tWithin; + keyType = tWithin; } else if (0 == token.compare(PK_NOT, 3)) { - keyType = plurrule_token_tNot; + keyType = tNot; } else if (0 == token.compare(PK_MOD, 3)) { - keyType = plurrule_token_tMod; + keyType = tMod; } else if (0 == token.compare(PK_OR, 2)) { - keyType = plurrule_token_tOr; + keyType = tOr; } else if (0 == token.compare(PK_DECIMAL, 7)) { - keyType = plurrule_token_tDecimal; + keyType = tDecimal; } else if (0 == token.compare(PK_INTEGER, 7)) { - keyType = plurrule_token_tInteger; + keyType = tInteger; } return keyType; } @@ -1414,34 +1556,24 @@ PluralKeywordEnumeration::PluralKeywordEnumeration(RuleChain *header, UErrorCode return; } fKeywordNames.setDeleter(uprv_deleteUObject); - UBool addKeywordOther = TRUE; + UBool addKeywordOther = true; RuleChain *node = header; while (node != nullptr) { - auto newElem = new UnicodeString(node->fKeyword); - if (newElem == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - fKeywordNames.addElement(newElem, status); + LocalPointer newElem(node->fKeyword.clone(), status); + fKeywordNames.adoptElement(newElem.orphan(), status); if (U_FAILURE(status)) { - delete newElem; return; } if (0 == node->fKeyword.compare(PLURAL_KEYWORD_OTHER, 5)) { - addKeywordOther = FALSE; + addKeywordOther = false; } node = node->fNext; } if (addKeywordOther) { - auto newElem = new UnicodeString(PLURAL_KEYWORD_OTHER); - if (newElem == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - fKeywordNames.addElement(newElem, status); + LocalPointer newElem(new UnicodeString(PLURAL_KEYWORD_OTHER), status); + fKeywordNames.adoptElement(newElem.orphan(), status); if (U_FAILURE(status)) { - delete newElem; return; } } @@ -1470,26 +1602,34 @@ PluralKeywordEnumeration::~PluralKeywordEnumeration() { PluralOperand tokenTypeToPluralOperand(tokenType tt) { switch(tt) { - case plurrule_token_tVariableN: + case tVariableN: return PLURAL_OPERAND_N; - case plurrule_token_tVariableI: + case tVariableI: return PLURAL_OPERAND_I; - case plurrule_token_tVariableF: + case tVariableF: return PLURAL_OPERAND_F; - case plurrule_token_tVariableV: + case tVariableV: return PLURAL_OPERAND_V; - case plurrule_token_tVariableT: + case tVariableT: return PLURAL_OPERAND_T; + case tVariableE: + return PLURAL_OPERAND_E; + case tVariableC: + return PLURAL_OPERAND_E; default: - UPRV_UNREACHABLE; // unexpected. + UPRV_UNREACHABLE_EXIT; // unexpected. } } -FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f) { - init(n, v, f); +FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f, int32_t e, int32_t c) { + init(n, v, f, e, c); +} + +FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f, int32_t e) { + init(n, v, f, e); // check values. TODO make into unit test. - // - // long visiblePower = (int) Math.pow(10, v); + // + // long visiblePower = (int) Math.pow(10.0, v); // if (decimalDigits > visiblePower) { // throw new IllegalArgumentException(); // } @@ -1502,6 +1642,10 @@ FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f) { // } } +FixedDecimal::FixedDecimal(double n, int32_t v, int64_t f) { + init(n, v, f); +} + FixedDecimal::FixedDecimal(double n, int32_t v) { // Ugly, but for samples we don't care. init(n, v, getFractionalDigits(n, v)); @@ -1521,20 +1665,50 @@ FixedDecimal::FixedDecimal() { FixedDecimal::FixedDecimal(const UnicodeString &num, UErrorCode &status) { CharString cs; - cs.appendInvariantChars(num, status); + int32_t parsedExponent = 0; + int32_t parsedCompactExponent = 0; + + int32_t exponentIdx = num.indexOf(u'e'); + if (exponentIdx < 0) { + exponentIdx = num.indexOf(u'E'); + } + int32_t compactExponentIdx = num.indexOf(u'c'); + if (compactExponentIdx < 0) { + compactExponentIdx = num.indexOf(u'C'); + } + + if (exponentIdx >= 0) { + cs.appendInvariantChars(num.tempSubString(0, exponentIdx), status); + int32_t expSubstrStart = exponentIdx + 1; + parsedExponent = ICU_Utility::parseAsciiInteger(num, expSubstrStart); + } + else if (compactExponentIdx >= 0) { + cs.appendInvariantChars(num.tempSubString(0, compactExponentIdx), status); + int32_t expSubstrStart = compactExponentIdx + 1; + parsedCompactExponent = ICU_Utility::parseAsciiInteger(num, expSubstrStart); + + parsedExponent = parsedCompactExponent; + exponentIdx = compactExponentIdx; + } + else { + cs.appendInvariantChars(num, status); + } + DecimalQuantity dl; dl.setToDecNumber(cs.toStringPiece(), status); if (U_FAILURE(status)) { init(0, 0, 0); return; } - int32_t decimalPoint = num.indexOf(PLURRULE_DOT); + + int32_t decimalPoint = num.indexOf(DOT); double n = dl.toDouble(); if (decimalPoint == -1) { - init(n, 0, 0); + init(n, 0, 0, parsedExponent); } else { - int32_t v = num.length() - decimalPoint - 1; - init(n, v, getFractionalDigits(n, v)); + int32_t fractionNumLength = exponentIdx < 0 ? num.length() : cs.length(); + int32_t v = fractionNumLength - decimalPoint - 1; + init(n, v, getFractionalDigits(n, v), parsedExponent); } } @@ -1545,6 +1719,7 @@ FixedDecimal::FixedDecimal(const FixedDecimal &other) { decimalDigits = other.decimalDigits; decimalDigitsWithoutTrailingZeros = other.decimalDigitsWithoutTrailingZeros; intValue = other.intValue; + exponent = other.exponent; _hasIntegerValue = other._hasIntegerValue; isNegative = other.isNegative; _isNaN = other._isNaN; @@ -1553,6 +1728,10 @@ FixedDecimal::FixedDecimal(const FixedDecimal &other) { FixedDecimal::~FixedDecimal() = default; +FixedDecimal FixedDecimal::createWithExponent(double n, int32_t v, int32_t e) { + return FixedDecimal(n, v, getFractionalDigits(n, v), e); +} + void FixedDecimal::init(double n) { int32_t numFractionDigits = decimals(n); @@ -1561,15 +1740,29 @@ void FixedDecimal::init(double n) { void FixedDecimal::init(double n, int32_t v, int64_t f) { + int32_t exponent = 0; + init(n, v, f, exponent); +} + +void FixedDecimal::init(double n, int32_t v, int64_t f, int32_t e) { + // Currently, `c` is an alias for `e` + init(n, v, f, e, e); +} + +void FixedDecimal::init(double n, int32_t v, int64_t f, int32_t e, int32_t c) { isNegative = n < 0.0; source = fabs(n); _isNaN = uprv_isNaN(source); _isInfinite = uprv_isInfinite(source); + exponent = e; + if (exponent == 0) { + exponent = c; + } if (_isNaN || _isInfinite) { v = 0; f = 0; intValue = 0; - _hasIntegerValue = FALSE; + _hasIntegerValue = false; } else { intValue = (int64_t)source; _hasIntegerValue = (source == intValue); @@ -1595,13 +1788,13 @@ void FixedDecimal::init(double n, int32_t v, int64_t f) { // A single multiply of the original number works more reliably. static int32_t p10[] = {1, 10, 100, 1000, 10000}; UBool FixedDecimal::quickInit(double n) { - UBool success = FALSE; + UBool success = false; n = fabs(n); int32_t numFractionDigits; for (numFractionDigits = 0; numFractionDigits <= 3; numFractionDigits++) { double scaledN = n * p10[numFractionDigits]; if (scaledN == floor(scaledN)) { - success = TRUE; + success = true; break; } } @@ -1624,11 +1817,9 @@ int32_t FixedDecimal::decimals(double n) { } } - // Slow path, convert with sprintf, parse converted output. + // Slow path, convert with snprintf, parse converted output. char buf[30] = {0}; - int used_buffer = snprintf(buf, 30, "%1.15e", n); - (void)used_buffer; - U_ASSERT(used_buffer > 0); + snprintf(buf, sizeof(buf), "%1.15e", n); // formatted number looks like this: 1.234567890123457e-01 int exponent = atoi(buf+18); int numFractionDigits = 15; @@ -1647,7 +1838,7 @@ int32_t FixedDecimal::decimals(double n) { // v is the number of visible fraction digits in the displayed form of the number. // Example: n = 1001.234, v = 6, result = 234000 // TODO: need to think through how this is used in the plural rule context. -// This function can easily encounter integer overflow, +// This function can easily encounter integer overflow, // and can easily return noise digits when the precision of a double is exceeded. int64_t FixedDecimal::getFractionalDigits(double n, int32_t v) { @@ -1662,7 +1853,9 @@ int64_t FixedDecimal::getFractionalDigits(double n, int32_t v) { case 3: return (int64_t)(fract*1000.0 + 0.5); default: double scaled = floor(fract * pow(10.0, (double)v) + 0.5); - if (scaled > U_INT64_MAX) { + if (scaled >= static_cast(U_INT64_MAX)) { + // Note: a double cannot accurately represent U_INT64_MAX. Casting it to double + // will round up to the next representable value, which is U_INT64_MAX + 1. return U_INT64_MAX; } else { return (int64_t)scaled; @@ -1689,13 +1882,15 @@ void FixedDecimal::adjustForMinFractionDigits(int32_t minFractionDigits) { double FixedDecimal::getPluralOperand(PluralOperand operand) const { switch(operand) { - case PLURAL_OPERAND_N: return source; - case PLURAL_OPERAND_I: return static_cast(intValue); + case PLURAL_OPERAND_N: return (exponent == 0 ? source : source * pow(10.0, exponent)); + case PLURAL_OPERAND_I: return (double) longValue(); case PLURAL_OPERAND_F: return static_cast(decimalDigits); case PLURAL_OPERAND_T: return static_cast(decimalDigitsWithoutTrailingZeros); case PLURAL_OPERAND_V: return visibleDecimalDigitCount; + case PLURAL_OPERAND_E: return exponent; + case PLURAL_OPERAND_C: return exponent; default: - UPRV_UNREACHABLE; // unexpected. + UPRV_UNREACHABLE_EXIT; // unexpected. } } @@ -1719,6 +1914,35 @@ int32_t FixedDecimal::getVisibleFractionDigitCount() const { return visibleDecimalDigitCount; } +bool FixedDecimal::operator==(const FixedDecimal &other) const { + return source == other.source && visibleDecimalDigitCount == other.visibleDecimalDigitCount + && decimalDigits == other.decimalDigits && exponent == other.exponent; +} + +UnicodeString FixedDecimal::toString() const { + char pattern[15]; + char buffer[20]; + if (exponent != 0) { + snprintf(pattern, sizeof(pattern), "%%.%dfe%%d", visibleDecimalDigitCount); + snprintf(buffer, sizeof(buffer), pattern, source, exponent); + } else { + snprintf(pattern, sizeof(pattern), "%%.%df", visibleDecimalDigitCount); + snprintf(buffer, sizeof(buffer), pattern, source); + } + return UnicodeString(buffer, -1, US_INV); +} + +double FixedDecimal::doubleValue() const { + return (isNegative ? -source : source) * pow(10.0, exponent); +} + +int64_t FixedDecimal::longValue() const { + if (exponent == 0) { + return intValue; + } else { + return (long) (pow(10.0, exponent) * intValue); + } +} PluralAvailableLocalesEnumeration::PluralAvailableLocalesEnumeration(UErrorCode &status) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/plurrule_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/plurrule_impl.h index 87cdcb6b9..4de6d6460 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/plurrule_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/plurrule_impl.h @@ -12,8 +12,8 @@ */ -#ifndef PLURRULE_IMPL_H -#define PLURRULE_IMPL_H +#ifndef PLURRULE_IMPL +#define PLURRULE_IMPL // Internal definitions for the PluralRules implementation. @@ -30,117 +30,125 @@ #include "hash.h" #include "uassert.h" +/** + * A FixedDecimal version of UPLRULES_NO_UNIQUE_VALUE used in PluralRulesTest + * for parsing of samples. + */ +#define UPLRULES_NO_UNIQUE_VALUE_DECIMAL(ERROR_CODE) (DecimalQuantity::fromExponentString(u"-0.00123456777", ERROR_CODE)) + class PluralRulesTest; U_NAMESPACE_BEGIN class AndConstraint; class RuleChain; -class Digiplurrule_token_tInterval; +class DigitInterval; class PluralRules; class VisibleDigits; -// namespace pluralimpl { +namespace pluralimpl { // TODO: Remove this and replace with u"" literals. Was for EBCDIC compatibility. -static const UChar PLURRULE_DOT = ((UChar) 0x002E); -// static const UChar PLURRULE_SINGLE_QUOTE = ((UChar) 0x0027); -// static const UChar PLURRULE_SLASH = ((UChar) 0x002F); -// static const UChar PLURRULE_BACKSLASH = ((UChar) 0x005C); -static const UChar PLURRULE_SPACE = ((UChar) 0x0020); -static const UChar PLURRULE_EXCLAMATION = ((UChar) 0x0021); -// static const UChar PLURRULE_QUOTATION_MARK = ((UChar) 0x0022); -// static const UChar PLURRULE_NUMBER_SIGN = ((UChar) 0x0023); -static const UChar PLURRULE_PERCENT_SIGN = ((UChar) 0x0025); -// static const UChar PLURRULE_ASTERISK = ((UChar) 0x002A); -static const UChar PLURRULE_COMMA = ((UChar) 0x002C); -// static const UChar PLURRULE_HYPHEN = ((UChar) 0x002D); -static const UChar PLURRULE_U_ZERO = ((UChar) 0x0030); -// static const UChar PLURRULE_U_ONE = ((UChar) 0x0031); -// static const UChar PLURRULE_U_TWO = ((UChar) 0x0032); -// static const UChar PLURRULE_U_THREE = ((UChar) 0x0033); -// static const UChar PLURRULE_U_FOUR = ((UChar) 0x0034); -// static const UChar PLURRULE_U_FIVE = ((UChar) 0x0035); -// static const UChar PLURRULE_U_SIX = ((UChar) 0x0036); -// static const UChar PLURRULE_U_SEVEN = ((UChar) 0x0037); -// static const UChar PLURRULE_U_EIGHT = ((UChar) 0x0038); -static const UChar PLURRULE_U_NINE = ((UChar) 0x0039); -static const UChar PLURRULE_COLON = ((UChar) 0x003A); -static const UChar PLURRULE_SEMI_COLON = ((UChar) 0x003B); -static const UChar PLURRULE_EQUALS = ((UChar) 0x003D); -static const UChar PLURRULE_AT = ((UChar) 0x0040); -// static const UChar PLURRULE_CAP_A = ((UChar) 0x0041); -// static const UChar PLURRULE_CAP_B = ((UChar) 0x0042); -// static const UChar PLURRULE_CAP_R = ((UChar) 0x0052); -// static const UChar PLURRULE_CAP_Z = ((UChar) 0x005A); -// static const UChar PLURRULE_LOWLINE = ((UChar) 0x005F); -// static const UChar PLURRULE_LEFTBRACE = ((UChar) 0x007B); -// static const UChar PLURRULE_RIGHTBRACE = ((UChar) 0x007D); -static const UChar PLURRULE_TILDE = ((UChar) 0x007E); -static const UChar PLURRULE_ELLIPSIS = ((UChar) 0x2026); - -static const UChar PLURRULE_LOW_A = ((UChar) 0x0061); -// static const UChar PLURRULE_LOW_B = ((UChar) 0x0062); -static const UChar PLURRULE_LOW_C = ((UChar) 0x0063); -static const UChar PLURRULE_LOW_D = ((UChar) 0x0064); -static const UChar PLURRULE_LOW_E = ((UChar) 0x0065); -static const UChar PLURRULE_LOW_F = ((UChar) 0x0066); -static const UChar PLURRULE_LOW_G = ((UChar) 0x0067); -static const UChar PLURRULE_LOW_H = ((UChar) 0x0068); -static const UChar PLURRULE_LOW_I = ((UChar) 0x0069); -// static const UChar PLURRULE_LOW_J = ((UChar) 0x006a); -// static const UChar PLURRULE_LOW_K = ((UChar) 0x006B); -static const UChar PLURRULE_LOW_L = ((UChar) 0x006C); -static const UChar PLURRULE_LOW_M = ((UChar) 0x006D); -static const UChar PLURRULE_LOW_N = ((UChar) 0x006E); -static const UChar PLURRULE_LOW_O = ((UChar) 0x006F); -// static const UChar PLURRULE_LOW_P = ((UChar) 0x0070); -// static const UChar PLURRULE_LOW_Q = ((UChar) 0x0071); -static const UChar PLURRULE_LOW_R = ((UChar) 0x0072); -static const UChar PLURRULE_LOW_S = ((UChar) 0x0073); -static const UChar PLURRULE_LOW_T = ((UChar) 0x0074); -// static const UChar PLURRULE_LOW_U = ((UChar) 0x0075); -static const UChar PLURRULE_LOW_V = ((UChar) 0x0076); -static const UChar PLURRULE_LOW_W = ((UChar) 0x0077); -// static const UChar PLURRULE_LOW_Y = ((UChar) 0x0079); -static const UChar PLURRULE_LOW_Z = ((UChar) 0x007A); - -// } +static const char16_t DOT = ((char16_t) 0x002E); +static const char16_t SINGLE_QUOTE = ((char16_t) 0x0027); +static const char16_t SLASH = ((char16_t) 0x002F); +static const char16_t BACKSLASH = ((char16_t) 0x005C); +static const char16_t SPACE = ((char16_t) 0x0020); +static const char16_t EXCLAMATION = ((char16_t) 0x0021); +static const char16_t QUOTATION_MARK = ((char16_t) 0x0022); +static const char16_t NUMBER_SIGN = ((char16_t) 0x0023); +static const char16_t PERCENT_SIGN = ((char16_t) 0x0025); +static const char16_t ASTERISK = ((char16_t) 0x002A); +static const char16_t COMMA = ((char16_t) 0x002C); +static const char16_t HYPHEN = ((char16_t) 0x002D); +static const char16_t U_ZERO = ((char16_t) 0x0030); +static const char16_t U_ONE = ((char16_t) 0x0031); +static const char16_t U_TWO = ((char16_t) 0x0032); +static const char16_t U_THREE = ((char16_t) 0x0033); +static const char16_t U_FOUR = ((char16_t) 0x0034); +static const char16_t U_FIVE = ((char16_t) 0x0035); +static const char16_t U_SIX = ((char16_t) 0x0036); +static const char16_t U_SEVEN = ((char16_t) 0x0037); +static const char16_t U_EIGHT = ((char16_t) 0x0038); +static const char16_t U_NINE = ((char16_t) 0x0039); +static const char16_t COLON = ((char16_t) 0x003A); +static const char16_t SEMI_COLON = ((char16_t) 0x003B); +static const char16_t EQUALS = ((char16_t) 0x003D); +static const char16_t AT = ((char16_t) 0x0040); +static const char16_t CAP_A = ((char16_t) 0x0041); +static const char16_t CAP_B = ((char16_t) 0x0042); +static const char16_t CAP_R = ((char16_t) 0x0052); +static const char16_t CAP_Z = ((char16_t) 0x005A); +static const char16_t LOWLINE = ((char16_t) 0x005F); +static const char16_t LEFTBRACE = ((char16_t) 0x007B); +static const char16_t RIGHTBRACE = ((char16_t) 0x007D); +static const char16_t TILDE = ((char16_t) 0x007E); +static const char16_t ELLIPSIS = ((char16_t) 0x2026); + +static const char16_t LOW_A = ((char16_t) 0x0061); +static const char16_t LOW_B = ((char16_t) 0x0062); +static const char16_t LOW_C = ((char16_t) 0x0063); +static const char16_t LOW_D = ((char16_t) 0x0064); +static const char16_t LOW_E = ((char16_t) 0x0065); +static const char16_t LOW_F = ((char16_t) 0x0066); +static const char16_t LOW_G = ((char16_t) 0x0067); +static const char16_t LOW_H = ((char16_t) 0x0068); +static const char16_t LOW_I = ((char16_t) 0x0069); +static const char16_t LOW_J = ((char16_t) 0x006a); +static const char16_t LOW_K = ((char16_t) 0x006B); +static const char16_t LOW_L = ((char16_t) 0x006C); +static const char16_t LOW_M = ((char16_t) 0x006D); +static const char16_t LOW_N = ((char16_t) 0x006E); +static const char16_t LOW_O = ((char16_t) 0x006F); +static const char16_t LOW_P = ((char16_t) 0x0070); +static const char16_t LOW_Q = ((char16_t) 0x0071); +static const char16_t LOW_R = ((char16_t) 0x0072); +static const char16_t LOW_S = ((char16_t) 0x0073); +static const char16_t LOW_T = ((char16_t) 0x0074); +static const char16_t LOW_U = ((char16_t) 0x0075); +static const char16_t LOW_V = ((char16_t) 0x0076); +static const char16_t LOW_W = ((char16_t) 0x0077); +static const char16_t LOW_Y = ((char16_t) 0x0079); +static const char16_t LOW_Z = ((char16_t) 0x007A); + +} static const int32_t PLURAL_RANGE_HIGH = 0x7fffffff; enum tokenType { - plurrule_token_none, - plurrule_token_tNumber, - plurrule_token_tComma, - plurrule_token_tSemiColon, - plurrule_token_tSpace, - plurrule_token_tColon, - plurrule_token_tAt, // '@' - plurrule_token_tDot, - plurrule_token_tDot2, - plurrule_token_tEllipsis, - plurrule_token_tKeyword, - plurrule_token_tAnd, - plurrule_token_tOr, - plurrule_token_tMod, // 'mod' or '%' - plurrule_token_tNot, // 'not' only. - plurrule_token_tIn, // 'in' only. - plurrule_token_tEqual, // '=' only. - plurrule_token_tNotEqual, // '!=' - plurrule_token_tTilde, - plurrule_token_tWithin, - plurrule_token_tIs, - plurrule_token_tVariableN, - plurrule_token_tVariableI, - plurrule_token_tVariableF, - plurrule_token_tVariableV, - plurrule_token_tVariableT, - plurrule_token_tDecimal, - plurrule_token_tInteger, - plurrule_token_tEOF + none, + tNumber, + tComma, + tSemiColon, + tSpace, + tColon, + tAt, // '@' + tDot, + tDot2, + tEllipsis, + tKeyword, + tAnd, + tOr, + tMod, // 'mod' or '%' + tNot, // 'not' only. + tIn, // 'in' only. + tEqual, // '=' only. + tNotEqual, // '!=' + tTilde, + tWithin, + tIs, + tVariableN, + tVariableI, + tVariableF, + tVariableV, + tVariableT, + tVariableE, + tVariableC, + tDecimal, + tInteger, + tEOF }; @@ -156,7 +164,7 @@ class PluralRuleParser: public UMemory { private: static tokenType getKeyType(const UnicodeString& token, tokenType type); - static tokenType charType(UChar ch); + static tokenType charType(char16_t ch); static UBool isValidKeyword(const UnicodeString& token); const UnicodeString *ruleSrc; // The rules string. @@ -214,6 +222,21 @@ enum PluralOperand { */ PLURAL_OPERAND_W, + /** + * Suppressed exponent for scientific notation (exponent needed in + * scientific notation to approximate i). + */ + PLURAL_OPERAND_E, + + /** + * This operand is currently treated as an alias for `PLURAL_OPERAND_E`. + * In the future, it will represent: + * + * Suppressed exponent for compact notation (exponent needed in + * compact notation to approximate i). + */ + PLURAL_OPERAND_C, + /** * THIS OPERAND IS DEPRECATED AND HAS BEEN REMOVED FROM THE SPEC. * @@ -267,37 +290,54 @@ class U_I18N_API FixedDecimal: public IFixedDecimal, public UObject { * @param n the number, e.g. 12.345 * @param v The number of visible fraction digits, e.g. 3 * @param f The fraction digits, e.g. 345 + * @param e The exponent, e.g. 7 in 1.2e7, for scientific notation + * @param c Currently: an alias for param `e`. */ + FixedDecimal(double n, int32_t v, int64_t f, int32_t e, int32_t c); + FixedDecimal(double n, int32_t v, int64_t f, int32_t e); FixedDecimal(double n, int32_t v, int64_t f); FixedDecimal(double n, int32_t); explicit FixedDecimal(double n); FixedDecimal(); - ~FixedDecimal() U_OVERRIDE; + ~FixedDecimal() override; FixedDecimal(const UnicodeString &s, UErrorCode &ec); FixedDecimal(const FixedDecimal &other); - double getPluralOperand(PluralOperand operand) const U_OVERRIDE; - bool isNaN() const U_OVERRIDE; - bool isInfinite() const U_OVERRIDE; - bool hasIntegerValue() const U_OVERRIDE; + static FixedDecimal createWithExponent(double n, int32_t v, int32_t e); + + double getPluralOperand(PluralOperand operand) const override; + bool isNaN() const override; + bool isInfinite() const override; + bool hasIntegerValue() const override; bool isNanOrInfinity() const; // used in decimfmtimpl.cpp int32_t getVisibleFractionDigitCount() const; + void init(double n, int32_t v, int64_t f, int32_t e, int32_t c); + void init(double n, int32_t v, int64_t f, int32_t e); void init(double n, int32_t v, int64_t f); void init(double n); UBool quickInit(double n); // Try a fast-path only initialization, - // return TRUE if successful. + // return true if successful. void adjustForMinFractionDigits(int32_t min); static int64_t getFractionalDigits(double n, int32_t v); static int32_t decimals(double n); + FixedDecimal& operator=(const FixedDecimal& other) = default; + bool operator==(const FixedDecimal &other) const; + + UnicodeString toString() const; + + double doubleValue() const; + int64_t longValue() const; + double source; int32_t visibleDecimalDigitCount; int64_t decimalDigits; int64_t decimalDigitsWithoutTrailingZeros; int64_t intValue; + int32_t exponent; UBool _hasIntegerValue; UBool isNegative; UBool _isNaN; @@ -314,12 +354,12 @@ class AndConstraint : public UMemory { int32_t opNum = -1; // for mod expressions, the right operand of the mod. int32_t value = -1; // valid for 'is' rules only. UVector32 *rangeList = nullptr; // for 'in', 'within' rules. Null otherwise. - UBool negated = FALSE; // TRUE for negated rules. - UBool integerOnly = FALSE; // TRUE for 'within' rules. - tokenType digitsType = plurrule_token_none; // n | i | v | f constraint. + UBool negated = false; // true for negated rules. + UBool integerOnly = false; // true for 'within' rules. + tokenType digitsType = none; // n | i | v | f constraint. AndConstraint *next = nullptr; // Internal error status, used for errors that occur during the copy constructor. - UErrorCode fInternalStatus = U_ZERO_ERROR; + UErrorCode fInternalStatus = U_ZERO_ERROR; AndConstraint() = default; AndConstraint(const AndConstraint& other); @@ -351,8 +391,8 @@ class RuleChain : public UMemory { OrConstraint *ruleHeader = nullptr; UnicodeString fDecimalSamples; // Samples strings from rule source UnicodeString fIntegerSamples; // without @decimal or @integer, otherwise unprocessed. - UBool fDecimalSamplesUnbounded = FALSE; - UBool fIntegerSamplesUnbounded = FALSE; + UBool fDecimalSamplesUnbounded = false; + UBool fIntegerSamplesUnbounded = false; // Internal error status, used for errors that occur during the copy constructor. UErrorCode fInternalStatus = U_ZERO_ERROR; @@ -370,11 +410,11 @@ class PluralKeywordEnumeration : public StringEnumeration { public: PluralKeywordEnumeration(RuleChain *header, UErrorCode& status); virtual ~PluralKeywordEnumeration(); - static UClassID U_EXPORT2 getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; - virtual const UnicodeString* snext(UErrorCode& status); - virtual void reset(UErrorCode& status); - virtual int32_t count(UErrorCode& status) const; + static UClassID U_EXPORT2 getStaticClassID(); + virtual UClassID getDynamicClassID() const override; + virtual const UnicodeString* snext(UErrorCode& status) override; + virtual void reset(UErrorCode& status) override; + virtual int32_t count(UErrorCode& status) const override; private: int32_t pos; UVector fKeywordNames; @@ -385,9 +425,9 @@ class U_I18N_API PluralAvailableLocalesEnumeration: public StringEnumeration { public: PluralAvailableLocalesEnumeration(UErrorCode &status); virtual ~PluralAvailableLocalesEnumeration(); - virtual const char* next(int32_t *resultLength, UErrorCode& status); - virtual void reset(UErrorCode& status); - virtual int32_t count(UErrorCode& status) const; + virtual const char* next(int32_t *resultLength, UErrorCode& status) override; + virtual void reset(UErrorCode& status) override; + virtual int32_t count(UErrorCode& status) const override; private: UErrorCode fOpenStatus; UResourceBundle *fLocales = nullptr; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.cpp index e88b70fbd..0a1982e3d 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.cpp @@ -32,14 +32,14 @@ U_NAMESPACE_BEGIN QuantityFormatter::QuantityFormatter() { for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) { - formatters[i] = NULL; + formatters[i] = nullptr; } } QuantityFormatter::QuantityFormatter(const QuantityFormatter &other) { for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) { - if (other.formatters[i] == NULL) { - formatters[i] = NULL; + if (other.formatters[i] == nullptr) { + formatters[i] = nullptr; } else { formatters[i] = new SimpleFormatter(*other.formatters[i]); } @@ -53,8 +53,8 @@ QuantityFormatter &QuantityFormatter::operator=( } for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) { delete formatters[i]; - if (other.formatters[i] == NULL) { - formatters[i] = NULL; + if (other.formatters[i] == nullptr) { + formatters[i] = nullptr; } else { formatters[i] = new SimpleFormatter(*other.formatters[i]); } @@ -71,7 +71,7 @@ QuantityFormatter::~QuantityFormatter() { void QuantityFormatter::reset() { for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) { delete formatters[i]; - formatters[i] = NULL; + formatters[i] = nullptr; } } @@ -81,26 +81,26 @@ UBool QuantityFormatter::addIfAbsent( UErrorCode &status) { int32_t pluralIndex = StandardPlural::indexFromString(variant, status); if (U_FAILURE(status)) { - return FALSE; + return false; } - if (formatters[pluralIndex] != NULL) { - return TRUE; + if (formatters[pluralIndex] != nullptr) { + return true; } SimpleFormatter *newFmt = new SimpleFormatter(rawPattern, 0, 1, status); - if (newFmt == NULL) { + if (newFmt == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; - return FALSE; + return false; } if (U_FAILURE(status)) { delete newFmt; - return FALSE; + return false; } formatters[pluralIndex] = newFmt; - return TRUE; + return true; } UBool QuantityFormatter::isValid() const { - return formatters[StandardPlural::OTHER] != NULL; + return formatters[StandardPlural::OTHER] != nullptr; } const SimpleFormatter *QuantityFormatter::getByVariant( @@ -108,7 +108,7 @@ const SimpleFormatter *QuantityFormatter::getByVariant( U_ASSERT(isValid()); int32_t pluralIndex = StandardPlural::indexOrOtherIndexFromString(variant); const SimpleFormatter *pattern = formatters[pluralIndex]; - if (pattern == NULL) { + if (pattern == nullptr) { pattern = formatters[StandardPlural::OTHER]; } return pattern; @@ -127,9 +127,9 @@ UnicodeString &QuantityFormatter::format( return appendTo; } const SimpleFormatter *pattern = formatters[p]; - if (pattern == NULL) { + if (pattern == nullptr) { pattern = formatters[StandardPlural::OTHER]; - if (pattern == NULL) { + if (pattern == nullptr) { status = U_INVALID_STATE_ERROR; return appendTo; } @@ -152,7 +152,7 @@ StandardPlural::Form QuantityFormatter::selectPlural( } UnicodeString pluralKeyword; const DecimalFormat *decFmt = dynamic_cast(&fmt); - if (decFmt != NULL) { + if (decFmt != nullptr) { number::impl::DecimalQuantity dq; decFmt->formatToDecimalQuantity(number, dq, status); if (U_FAILURE(status)) { @@ -204,7 +204,8 @@ void QuantityFormatter::formatAndSelect( if (U_FAILURE(status)) { return; } - output.append(result, UNUM_FIELD_COUNT, status); + // This code path is probably RBNF. Use the generic numeric field. + output.append(result, kGeneralNumericField, status); if (U_FAILURE(status)) { return; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.h b/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.h index daaef4f06..ca0c0ee37 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.h @@ -74,19 +74,19 @@ class U_I18N_API QuantityFormatter : public UMemory { * @param variant "zero", "one", "two", "few", "many", "other" * @param rawPattern the pattern for the variant e.g "{0} meters" * @param status any error returned here. - * @return TRUE on success; FALSE if status was set to a non zero error. + * @return true on success; false if status was set to a non zero error. */ UBool addIfAbsent(const char *variant, const UnicodeString &rawPattern, UErrorCode &status); /** - * returns TRUE if this object has at least the "other" variant. + * returns true if this object has at least the "other" variant. */ UBool isValid() const; /** * Gets the pattern formatter that would be used for a particular variant. - * If isValid() returns TRUE, this method is guaranteed to return a - * non-NULL value. + * If isValid() returns true, this method is guaranteed to return a + * non-nullptr value. */ const SimpleFormatter *getByVariant(const char *variant) const; @@ -112,7 +112,7 @@ class U_I18N_API QuantityFormatter : public UMemory { /** * Selects the standard plural form for the number/formatter/rules. - * TODO(13591): Remove this method. + * Used in MeasureFormat for backwards compatibility with NumberFormat. */ static StandardPlural::Form selectPlural( const Formattable &number, diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp index 0efc2ddce..06599b4fd 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp @@ -26,7 +26,7 @@ #include "unicode/utf16.h" #include "unicode/udata.h" #include "unicode/udisplaycontext.h" -// #include "unicode/brkiter.h" +#include "unicode/brkiter.h" #include "unicode/ucasemap.h" #include "cmemory.h" @@ -45,19 +45,19 @@ #define U_ICUDATA_RBNF U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "rbnf" -static const UChar rbnf_gPercentPercent[] = +static const char16_t gPercentPercent[] = { 0x25, 0x25, 0 }; /* "%%" */ // All urbnf objects are created through openRules, so we init all of the // Unicode string constants required by rbnf, nfrs, or nfr here. -static const UChar rbnf_gLenientParse[] = +static const char16_t gLenientParse[] = { 0x25, 0x25, 0x6C, 0x65, 0x6E, 0x69, 0x65, 0x6E, 0x74, 0x2D, 0x70, 0x61, 0x72, 0x73, 0x65, 0x3A, 0 }; /* "%%lenient-parse:" */ -static const UChar rbnf_gSemiColon = 0x003B; -static const UChar rbnf_gSemiPercent[] = +static const char16_t gSemiColon = 0x003B; +static const char16_t gSemiPercent[] = { 0x3B, 0x25, 0 }; /* ";%" */ @@ -83,92 +83,92 @@ class LocalizationInfo : public UMemory { protected: virtual ~LocalizationInfo(); uint32_t refcount; - + public: LocalizationInfo() : refcount(0) {} - - LocalizationInfo* ref(void) { + + LocalizationInfo* ref() { ++refcount; return this; } - - LocalizationInfo* unref(void) { + + LocalizationInfo* unref() { if (refcount && --refcount == 0) { delete this; } - return NULL; + return nullptr; } - + virtual bool operator==(const LocalizationInfo* rhs) const; inline bool operator!=(const LocalizationInfo* rhs) const { return !operator==(rhs); } - - virtual int32_t getNumberOfRuleSets(void) const = 0; - virtual const UChar* getRuleSetName(int32_t index) const = 0; - virtual int32_t getNumberOfDisplayLocales(void) const = 0; - virtual const UChar* getLocaleName(int32_t index) const = 0; - virtual const UChar* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const = 0; - - virtual int32_t indexForLocale(const UChar* locale) const; - virtual int32_t indexForRuleSet(const UChar* ruleset) const; - + + virtual int32_t getNumberOfRuleSets() const = 0; + virtual const char16_t* getRuleSetName(int32_t index) const = 0; + virtual int32_t getNumberOfDisplayLocales() const = 0; + virtual const char16_t* getLocaleName(int32_t index) const = 0; + virtual const char16_t* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const = 0; + + virtual int32_t indexForLocale(const char16_t* locale) const; + virtual int32_t indexForRuleSet(const char16_t* ruleset) const; + // virtual UClassID getDynamicClassID() const = 0; -// static UClassID getStaticClassID(void); +// static UClassID getStaticClassID(); }; LocalizationInfo::~LocalizationInfo() {} //UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(LocalizationInfo) -// if both strings are NULL, this returns TRUE -static UBool -streq(const UChar* lhs, const UChar* rhs) { +// if both strings are nullptr, this returns true +static UBool +streq(const char16_t* lhs, const char16_t* rhs) { if (rhs == lhs) { - return TRUE; + return true; } if (lhs && rhs) { return u_strcmp(lhs, rhs) == 0; } - return FALSE; + return false; } bool LocalizationInfo::operator==(const LocalizationInfo* rhs) const { if (rhs) { if (this == rhs) { - return TRUE; + return true; } - + int32_t rsc = getNumberOfRuleSets(); if (rsc == rhs->getNumberOfRuleSets()) { for (int i = 0; i < rsc; ++i) { if (!streq(getRuleSetName(i), rhs->getRuleSetName(i))) { - return FALSE; + return false; } } int32_t dlc = getNumberOfDisplayLocales(); if (dlc == rhs->getNumberOfDisplayLocales()) { for (int i = 0; i < dlc; ++i) { - const UChar* locale = getLocaleName(i); + const char16_t* locale = getLocaleName(i); int32_t ix = rhs->indexForLocale(locale); // if no locale, ix is -1, getLocaleName returns null, so streq returns false if (!streq(locale, rhs->getLocaleName(ix))) { - return FALSE; + return false; } for (int j = 0; j < rsc; ++j) { if (!streq(getDisplayName(i, j), rhs->getDisplayName(ix, j))) { - return FALSE; + return false; } } } - return TRUE; + return true; } } } - return FALSE; + return false; } int32_t -LocalizationInfo::indexForLocale(const UChar* locale) const { +LocalizationInfo::indexForLocale(const char16_t* locale) const { for (int i = 0; i < getNumberOfDisplayLocales(); ++i) { if (streq(locale, getLocaleName(i))) { return i; @@ -178,7 +178,7 @@ LocalizationInfo::indexForLocale(const UChar* locale) const { } int32_t -LocalizationInfo::indexForRuleSet(const UChar* ruleset) const { +LocalizationInfo::indexForRuleSet(const char16_t* ruleset) const { if (ruleset) { for (int i = 0; i < getNumberOfRuleSets(); ++i) { if (streq(ruleset, getRuleSetName(i))) { @@ -198,23 +198,23 @@ class VArray { int32_t size; Fn_Deleter deleter; public: - VArray() : buf(NULL), cap(0), size(0), deleter(NULL) {} - - VArray(Fn_Deleter del) : buf(NULL), cap(0), size(0), deleter(del) {} - + VArray() : buf(nullptr), cap(0), size(0), deleter(nullptr) {} + + VArray(Fn_Deleter del) : buf(nullptr), cap(0), size(0), deleter(del) {} + ~VArray() { if (deleter) { for (int i = 0; i < size; ++i) { (*deleter)(buf[i]); } } - uprv_free(buf); + uprv_free(buf); } - + int32_t length() { return size; } - + void add(void* elem, UErrorCode& status) { if (U_SUCCESS(status)) { if (size == cap) { @@ -225,12 +225,12 @@ class VArray { } else { cap += 256; } - if (buf == NULL) { + if (buf == nullptr) { buf = (void**)uprv_malloc(cap * sizeof(void*)); } else { buf = (void**)uprv_realloc(buf, cap * sizeof(void*)); } - if (buf == NULL) { + if (buf == nullptr) { // if we couldn't realloc, we leak the memory we've already allocated, but we're in deep trouble anyway status = U_MEMORY_ALLOCATION_ERROR; return; @@ -242,10 +242,10 @@ class VArray { buf[size++] = elem; } } - - void** release(void) { + + void** release() { void** result = buf; - buf = NULL; + buf = nullptr; cap = 0; size = 0; return result; @@ -255,91 +255,91 @@ class VArray { class LocDataParser; class StringLocalizationInfo : public LocalizationInfo { - UChar* info; - UChar*** data; + char16_t* info; + char16_t*** data; int32_t numRuleSets; int32_t numLocales; friend class LocDataParser; - StringLocalizationInfo(UChar* i, UChar*** d, int32_t numRS, int32_t numLocs) + StringLocalizationInfo(char16_t* i, char16_t*** d, int32_t numRS, int32_t numLocs) : info(i), data(d), numRuleSets(numRS), numLocales(numLocs) { } - + public: static StringLocalizationInfo* create(const UnicodeString& info, UParseError& perror, UErrorCode& status); - + virtual ~StringLocalizationInfo(); - virtual int32_t getNumberOfRuleSets(void) const { return numRuleSets; } - virtual const UChar* getRuleSetName(int32_t index) const; - virtual int32_t getNumberOfDisplayLocales(void) const { return numLocales; } - virtual const UChar* getLocaleName(int32_t index) const; - virtual const UChar* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const; - + virtual int32_t getNumberOfRuleSets() const override { return numRuleSets; } + virtual const char16_t* getRuleSetName(int32_t index) const override; + virtual int32_t getNumberOfDisplayLocales() const override { return numLocales; } + virtual const char16_t* getLocaleName(int32_t index) const override; + virtual const char16_t* getDisplayName(int32_t localeIndex, int32_t ruleIndex) const override; + // virtual UClassID getDynamicClassID() const; -// static UClassID getStaticClassID(void); - +// static UClassID getStaticClassID(); + private: void init(UErrorCode& status) const; }; enum { - rbnf_OPEN_ANGLE = 0x003c, /* '<' */ - rbnf_CLOSE_ANGLE = 0x003e, /* '>' */ - rbnf_COMMA = 0x002c, - rbnf_TICK = 0x0027, - rbnf_QUOTE = 0x0022, - rbnf_SPACE = 0x0020 + OPEN_ANGLE = 0x003c, /* '<' */ + CLOSE_ANGLE = 0x003e, /* '>' */ + COMMA = 0x002c, + TICK = 0x0027, + QUOTE = 0x0022, + SPACE = 0x0020 }; /** * Utility for parsing a localization string and returning a StringLocalizationInfo*. */ class LocDataParser { - UChar* data; - const UChar* e; - UChar* p; - UChar ch; + char16_t* data; + const char16_t* e; + char16_t* p; + char16_t ch; UParseError& pe; UErrorCode& ec; - + public: - LocDataParser(UParseError& parseError, UErrorCode& status) - : data(NULL), e(NULL), p(NULL), ch(0xffff), pe(parseError), ec(status) {} + LocDataParser(UParseError& parseError, UErrorCode& status) + : data(nullptr), e(nullptr), p(nullptr), ch(0xffff), pe(parseError), ec(status) {} ~LocDataParser() {} - + /* * On a successful parse, return a StringLocalizationInfo*, otherwise delete locData, set perror and status, - * and return NULL. The StringLocalizationInfo will adopt locData if it is created. + * and return nullptr. The StringLocalizationInfo will adopt locData if it is created. */ - StringLocalizationInfo* parse(UChar* data, int32_t len); - + StringLocalizationInfo* parse(char16_t* data, int32_t len); + private: - - inline void inc(void) { + + inline void inc() { ++p; ch = 0xffff; } - inline UBool checkInc(UChar c) { + inline UBool checkInc(char16_t c) { if (p < e && (ch == c || *p == c)) { inc(); - return TRUE; + return true; } - return FALSE; + return false; } - inline UBool check(UChar c) { + inline UBool check(char16_t c) { return p < e && (ch == c || *p == c); } - inline void skipWhitespace(void) { + inline void skipWhitespace() { while (p < e && PatternProps::isWhiteSpace(ch != 0xffff ? ch : *p)) { inc(); } } - inline UBool inList(UChar c, const UChar* list) const { - if (*list == rbnf_SPACE && PatternProps::isWhiteSpace(c)) { - return TRUE; + inline UBool inList(char16_t c, const char16_t* list) const { + if (*list == SPACE && PatternProps::isWhiteSpace(c)) { + return true; } while (*list && *list != c) { ++list; @@ -347,38 +347,38 @@ class LocDataParser { return *list == c; } void parseError(const char* msg); - - StringLocalizationInfo* doParse(void); - - UChar** nextArray(int32_t& requiredLength); - UChar* nextString(void); + + StringLocalizationInfo* doParse(); + + char16_t** nextArray(int32_t& requiredLength); + char16_t* nextString(); }; #ifdef RBNF_DEBUG -#define rbnf_ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \ +#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \ parseError(msg); \ - return NULL; \ + return nullptr; \ } UPRV_BLOCK_MACRO_END #define EXPLANATION_ARG explanationArg #else -#define rbnf_ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \ - parseError(NULL); \ - return NULL; \ +#define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \ + parseError(nullptr); \ + return nullptr; \ } UPRV_BLOCK_MACRO_END #define EXPLANATION_ARG #endif + - -static const UChar Drbnf_QUOTE_STOPLIST[] = { - rbnf_QUOTE, 0 +static const char16_t DQUOTE_STOPLIST[] = { + QUOTE, 0 }; -static const UChar Srbnf_QUOTE_STOPLIST[] = { - rbnf_TICK, 0 +static const char16_t SQUOTE_STOPLIST[] = { + TICK, 0 }; -static const UChar NOrbnf_QUOTE_STOPLIST[] = { - rbnf_SPACE, rbnf_COMMA, rbnf_CLOSE_ANGLE, rbnf_OPEN_ANGLE, rbnf_TICK, rbnf_QUOTE, 0 +static const char16_t NOQUOTE_STOPLIST[] = { + SPACE, COMMA, CLOSE_ANGLE, OPEN_ANGLE, TICK, QUOTE, 0 }; static void @@ -387,10 +387,10 @@ DeleteFn(void* p) { } StringLocalizationInfo* -LocDataParser::parse(UChar* _data, int32_t len) { +LocDataParser::parse(char16_t* _data, int32_t len) { if (U_FAILURE(ec)) { if (_data) uprv_free(_data); - return NULL; + return nullptr; } pe.line = 0; @@ -398,15 +398,15 @@ LocDataParser::parse(UChar* _data, int32_t len) { pe.postContext[0] = 0; pe.preContext[0] = 0; - if (_data == NULL) { + if (_data == nullptr) { ec = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } if (len <= 0) { ec = U_ILLEGAL_ARGUMENT_ERROR; uprv_free(_data); - return NULL; + return nullptr; } data = _data; @@ -419,129 +419,129 @@ LocDataParser::parse(UChar* _data, int32_t len) { StringLocalizationInfo* -LocDataParser::doParse(void) { +LocDataParser::doParse() { skipWhitespace(); - if (!checkInc(rbnf_OPEN_ANGLE)) { - rbnf_ERROR("Missing open angle"); + if (!checkInc(OPEN_ANGLE)) { + ERROR("Missing open angle"); } else { VArray array(DeleteFn); - UBool mightHaveNext = TRUE; + UBool mightHaveNext = true; int32_t requiredLength = -1; while (mightHaveNext) { - mightHaveNext = FALSE; - UChar** elem = nextArray(requiredLength); + mightHaveNext = false; + char16_t** elem = nextArray(requiredLength); skipWhitespace(); - UBool haveComma = check(rbnf_COMMA); + UBool haveComma = check(COMMA); if (elem) { array.add(elem, ec); if (haveComma) { inc(); - mightHaveNext = TRUE; + mightHaveNext = true; } } else if (haveComma) { - rbnf_ERROR("Unexpected character"); + ERROR("Unexpected character"); } } skipWhitespace(); - if (!checkInc(rbnf_CLOSE_ANGLE)) { - if (check(rbnf_OPEN_ANGLE)) { - rbnf_ERROR("Missing comma in outer array"); + if (!checkInc(CLOSE_ANGLE)) { + if (check(OPEN_ANGLE)) { + ERROR("Missing comma in outer array"); } else { - rbnf_ERROR("Missing close angle bracket in outer array"); + ERROR("Missing close angle bracket in outer array"); } } skipWhitespace(); if (p != e) { - rbnf_ERROR("Extra text after close of localization data"); + ERROR("Extra text after close of localization data"); } - array.add(NULL, ec); + array.add(nullptr, ec); if (U_SUCCESS(ec)) { - int32_t numLocs = array.length() - 2; // subtract first, NULL - UChar*** result = (UChar***)array.release(); - - return new StringLocalizationInfo(data, result, requiredLength-2, numLocs); // subtract first, NULL + int32_t numLocs = array.length() - 2; // subtract first, nullptr + char16_t*** result = (char16_t***)array.release(); + + return new StringLocalizationInfo(data, result, requiredLength-2, numLocs); // subtract first, nullptr } } - - rbnf_ERROR("Unknown error"); + + ERROR("Unknown error"); } -UChar** +char16_t** LocDataParser::nextArray(int32_t& requiredLength) { if (U_FAILURE(ec)) { - return NULL; + return nullptr; } - + skipWhitespace(); - if (!checkInc(rbnf_OPEN_ANGLE)) { - rbnf_ERROR("Missing open angle"); + if (!checkInc(OPEN_ANGLE)) { + ERROR("Missing open angle"); } VArray array; - UBool mightHaveNext = TRUE; + UBool mightHaveNext = true; while (mightHaveNext) { - mightHaveNext = FALSE; - UChar* elem = nextString(); + mightHaveNext = false; + char16_t* elem = nextString(); skipWhitespace(); - UBool haveComma = check(rbnf_COMMA); + UBool haveComma = check(COMMA); if (elem) { array.add(elem, ec); if (haveComma) { inc(); - mightHaveNext = TRUE; + mightHaveNext = true; } } else if (haveComma) { - rbnf_ERROR("Unexpected comma"); + ERROR("Unexpected comma"); } } skipWhitespace(); - if (!checkInc(rbnf_CLOSE_ANGLE)) { - if (check(rbnf_OPEN_ANGLE)) { - rbnf_ERROR("Missing close angle bracket in inner array"); + if (!checkInc(CLOSE_ANGLE)) { + if (check(OPEN_ANGLE)) { + ERROR("Missing close angle bracket in inner array"); } else { - rbnf_ERROR("Missing comma in inner array"); + ERROR("Missing comma in inner array"); } } - array.add(NULL, ec); + array.add(nullptr, ec); if (U_SUCCESS(ec)) { if (requiredLength == -1) { requiredLength = array.length() + 1; } else if (array.length() != requiredLength) { ec = U_ILLEGAL_ARGUMENT_ERROR; - rbnf_ERROR("Array not of required length"); + ERROR("Array not of required length"); } - - return (UChar**)array.release(); + + return (char16_t**)array.release(); } - rbnf_ERROR("Unknown Error"); + ERROR("Unknown Error"); } -UChar* +char16_t* LocDataParser::nextString() { - UChar* result = NULL; - + char16_t* result = nullptr; + skipWhitespace(); if (p < e) { - const UChar* terminators; - UChar c = *p; - UBool haveQuote = c == rbnf_QUOTE || c == rbnf_TICK; + const char16_t* terminators; + char16_t c = *p; + UBool haveQuote = c == QUOTE || c == TICK; if (haveQuote) { inc(); - terminators = c == rbnf_QUOTE ? Drbnf_QUOTE_STOPLIST : Srbnf_QUOTE_STOPLIST; + terminators = c == QUOTE ? DQUOTE_STOPLIST : SQUOTE_STOPLIST; } else { - terminators = NOrbnf_QUOTE_STOPLIST; + terminators = NOQUOTE_STOPLIST; } - UChar* start = p; + char16_t* start = p; while (p < e && !inList(*p, terminators)) ++p; if (p == e) { - rbnf_ERROR("Unexpected end of data"); + ERROR("Unexpected end of data"); } - - UChar x = *p; + + char16_t x = *p; if (p > start) { ch = x; *p = 0x0; // terminate by writing to data @@ -549,13 +549,13 @@ LocDataParser::nextString() { } if (haveQuote) { if (x != c) { - rbnf_ERROR("Missing matching quote"); + ERROR("Missing matching quote"); } else if (p == start) { - rbnf_ERROR("Empty string"); + ERROR("Empty string"); } inc(); - } else if (x == rbnf_OPEN_ANGLE || x == rbnf_TICK || x == rbnf_QUOTE) { - rbnf_ERROR("Unexpected character in string"); + } else if (x == OPEN_ANGLE || x == TICK || x == QUOTE) { + ERROR("Unexpected character in string"); } } @@ -569,17 +569,17 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG) return; } - const UChar* start = p - U_PARSE_CONTEXT_LEN - 1; + const char16_t* start = p - U_PARSE_CONTEXT_LEN - 1; if (start < data) { start = data; } - for (UChar* x = p; --x >= start;) { + for (char16_t* x = p; --x >= start;) { if (!*x) { start = x+1; break; } } - const UChar* limit = p + U_PARSE_CONTEXT_LEN - 1; + const char16_t* limit = p + U_PARSE_CONTEXT_LEN - 1; if (limit > e) { limit = e; } @@ -588,16 +588,16 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG) u_strncpy(pe.postContext, p, (int32_t)(limit-p)); pe.postContext[limit-p] = 0; pe.offset = (int32_t)(p - data); - + #ifdef RBNF_DEBUG fprintf(stderr, "%s at or near character %ld: ", EXPLANATION_ARG, p-data); UnicodeString msg; msg.append(start, p - start); - msg.append((UChar)0x002f); /* SOLIDUS/SLASH */ + msg.append((char16_t)0x002f); /* SOLIDUS/SLASH */ msg.append(p, limit-p); msg.append(UNICODE_STRING_SIMPLE("'")); - + char buf[128]; int32_t len = msg.extract(0, msg.length(), buf, 128); if (len >= 128) { @@ -608,12 +608,12 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG) fprintf(stderr, "%s\n", buf); fflush(stderr); #endif - + uprv_free(data); - data = NULL; - p = NULL; - e = NULL; - + data = nullptr; + p = nullptr; + e = nullptr; + if (U_SUCCESS(ec)) { ec = U_PARSE_ERROR; } @@ -621,33 +621,33 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG) //UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringLocalizationInfo) -StringLocalizationInfo* +StringLocalizationInfo* StringLocalizationInfo::create(const UnicodeString& info, UParseError& perror, UErrorCode& status) { if (U_FAILURE(status)) { - return NULL; + return nullptr; } - + int32_t len = info.length(); if (len == 0) { - return NULL; // no error; + return nullptr; // no error; } - - UChar* p = (UChar*)uprv_malloc(len * sizeof(UChar)); + + char16_t* p = (char16_t*)uprv_malloc(len * sizeof(char16_t)); if (!p) { status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } info.extract(p, len, status); if (!U_FAILURE(status)) { status = U_ZERO_ERROR; // clear warning about non-termination } - + LocDataParser parser(perror, status); return parser.parse(p, len); } StringLocalizationInfo::~StringLocalizationInfo() { - for (UChar*** p = (UChar***)data; *p; ++p) { + for (char16_t*** p = (char16_t***)data; *p; ++p) { // remaining data is simply pointer into our unicode string data. if (*p) uprv_free(*p); } @@ -656,174 +656,174 @@ StringLocalizationInfo::~StringLocalizationInfo() { } -const UChar* +const char16_t* StringLocalizationInfo::getRuleSetName(int32_t index) const { if (index >= 0 && index < getNumberOfRuleSets()) { return data[0][index]; } - return NULL; + return nullptr; } -const UChar* +const char16_t* StringLocalizationInfo::getLocaleName(int32_t index) const { if (index >= 0 && index < getNumberOfDisplayLocales()) { return data[index+1][0]; } - return NULL; + return nullptr; } -const UChar* +const char16_t* StringLocalizationInfo::getDisplayName(int32_t localeIndex, int32_t ruleIndex) const { if (localeIndex >= 0 && localeIndex < getNumberOfDisplayLocales() && ruleIndex >= 0 && ruleIndex < getNumberOfRuleSets()) { return data[localeIndex+1][ruleIndex+1]; } - return NULL; + return nullptr; } // ---------- -RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, +RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, const UnicodeString& locs, const Locale& alocale, UParseError& perror, UErrorCode& status) - : fRuleSets(NULL) - , ruleSetDescriptions(NULL) + : fRuleSets(nullptr) + , ruleSetDescriptions(nullptr) , numRuleSets(0) - , defaultRuleSet(NULL) + , defaultRuleSet(nullptr) , locale(alocale) - , collator(NULL) - , decimalFormatSymbols(NULL) - , defaultInfinityRule(NULL) - , defaultNaNRule(NULL) + , collator(nullptr) + , decimalFormatSymbols(nullptr) + , defaultInfinityRule(nullptr) + , defaultNaNRule(nullptr) , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary) - , lenient(FALSE) - , lenientParseRules(NULL) - , localizations(NULL) - , capitalizationInfoSet(FALSE) - , capitalizationForUIListMenu(FALSE) - , capitalizationForStandAlone(FALSE) - , capitalizationBrkIter(NULL) + , lenient(false) + , lenientParseRules(nullptr) + , localizations(nullptr) + , capitalizationInfoSet(false) + , capitalizationForUIListMenu(false) + , capitalizationForStandAlone(false) + , capitalizationBrkIter(nullptr) { LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, status); init(description, locinfo, perror, status); } -RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, +RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, const UnicodeString& locs, UParseError& perror, UErrorCode& status) - : fRuleSets(NULL) - , ruleSetDescriptions(NULL) + : fRuleSets(nullptr) + , ruleSetDescriptions(nullptr) , numRuleSets(0) - , defaultRuleSet(NULL) + , defaultRuleSet(nullptr) , locale(Locale::getDefault()) - , collator(NULL) - , decimalFormatSymbols(NULL) - , defaultInfinityRule(NULL) - , defaultNaNRule(NULL) + , collator(nullptr) + , decimalFormatSymbols(nullptr) + , defaultInfinityRule(nullptr) + , defaultNaNRule(nullptr) , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary) - , lenient(FALSE) - , lenientParseRules(NULL) - , localizations(NULL) - , capitalizationInfoSet(FALSE) - , capitalizationForUIListMenu(FALSE) - , capitalizationForStandAlone(FALSE) - , capitalizationBrkIter(NULL) + , lenient(false) + , lenientParseRules(nullptr) + , localizations(nullptr) + , capitalizationInfoSet(false) + , capitalizationForUIListMenu(false) + , capitalizationForStandAlone(false) + , capitalizationBrkIter(nullptr) { LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, status); init(description, locinfo, perror, status); } -RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, +RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, LocalizationInfo* info, const Locale& alocale, UParseError& perror, UErrorCode& status) - : fRuleSets(NULL) - , ruleSetDescriptions(NULL) + : fRuleSets(nullptr) + , ruleSetDescriptions(nullptr) , numRuleSets(0) - , defaultRuleSet(NULL) + , defaultRuleSet(nullptr) , locale(alocale) - , collator(NULL) - , decimalFormatSymbols(NULL) - , defaultInfinityRule(NULL) - , defaultNaNRule(NULL) + , collator(nullptr) + , decimalFormatSymbols(nullptr) + , defaultInfinityRule(nullptr) + , defaultNaNRule(nullptr) , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary) - , lenient(FALSE) - , lenientParseRules(NULL) - , localizations(NULL) - , capitalizationInfoSet(FALSE) - , capitalizationForUIListMenu(FALSE) - , capitalizationForStandAlone(FALSE) - , capitalizationBrkIter(NULL) + , lenient(false) + , lenientParseRules(nullptr) + , localizations(nullptr) + , capitalizationInfoSet(false) + , capitalizationForUIListMenu(false) + , capitalizationForStandAlone(false) + , capitalizationBrkIter(nullptr) { init(description, info, perror, status); } -RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, - UParseError& perror, - UErrorCode& status) - : fRuleSets(NULL) - , ruleSetDescriptions(NULL) +RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, + UParseError& perror, + UErrorCode& status) + : fRuleSets(nullptr) + , ruleSetDescriptions(nullptr) , numRuleSets(0) - , defaultRuleSet(NULL) + , defaultRuleSet(nullptr) , locale(Locale::getDefault()) - , collator(NULL) - , decimalFormatSymbols(NULL) - , defaultInfinityRule(NULL) - , defaultNaNRule(NULL) + , collator(nullptr) + , decimalFormatSymbols(nullptr) + , defaultInfinityRule(nullptr) + , defaultNaNRule(nullptr) , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary) - , lenient(FALSE) - , lenientParseRules(NULL) - , localizations(NULL) - , capitalizationInfoSet(FALSE) - , capitalizationForUIListMenu(FALSE) - , capitalizationForStandAlone(FALSE) - , capitalizationBrkIter(NULL) + , lenient(false) + , lenientParseRules(nullptr) + , localizations(nullptr) + , capitalizationInfoSet(false) + , capitalizationForUIListMenu(false) + , capitalizationForStandAlone(false) + , capitalizationBrkIter(nullptr) { - init(description, NULL, perror, status); + init(description, nullptr, perror, status); } -RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, +RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, const Locale& aLocale, - UParseError& perror, - UErrorCode& status) - : fRuleSets(NULL) - , ruleSetDescriptions(NULL) + UParseError& perror, + UErrorCode& status) + : fRuleSets(nullptr) + , ruleSetDescriptions(nullptr) , numRuleSets(0) - , defaultRuleSet(NULL) + , defaultRuleSet(nullptr) , locale(aLocale) - , collator(NULL) - , decimalFormatSymbols(NULL) - , defaultInfinityRule(NULL) - , defaultNaNRule(NULL) + , collator(nullptr) + , decimalFormatSymbols(nullptr) + , defaultInfinityRule(nullptr) + , defaultNaNRule(nullptr) , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary) - , lenient(FALSE) - , lenientParseRules(NULL) - , localizations(NULL) - , capitalizationInfoSet(FALSE) - , capitalizationForUIListMenu(FALSE) - , capitalizationForStandAlone(FALSE) - , capitalizationBrkIter(NULL) + , lenient(false) + , lenientParseRules(nullptr) + , localizations(nullptr) + , capitalizationInfoSet(false) + , capitalizationForUIListMenu(false) + , capitalizationForStandAlone(false) + , capitalizationBrkIter(nullptr) { - init(description, NULL, perror, status); + init(description, nullptr, perror, status); } RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& alocale, UErrorCode& status) - : fRuleSets(NULL) - , ruleSetDescriptions(NULL) + : fRuleSets(nullptr) + , ruleSetDescriptions(nullptr) , numRuleSets(0) - , defaultRuleSet(NULL) + , defaultRuleSet(nullptr) , locale(alocale) - , collator(NULL) - , decimalFormatSymbols(NULL) - , defaultInfinityRule(NULL) - , defaultNaNRule(NULL) + , collator(nullptr) + , decimalFormatSymbols(nullptr) + , defaultInfinityRule(nullptr) + , defaultNaNRule(nullptr) , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary) - , lenient(FALSE) - , lenientParseRules(NULL) - , localizations(NULL) - , capitalizationInfoSet(FALSE) - , capitalizationForUIListMenu(FALSE) - , capitalizationForStandAlone(FALSE) - , capitalizationBrkIter(NULL) + , lenient(false) + , lenientParseRules(nullptr) + , localizations(nullptr) + , capitalizationInfoSet(false) + , capitalizationForUIListMenu(false) + , capitalizationForStandAlone(false) + , capitalizationBrkIter(nullptr) { if (U_FAILURE(status)) { return; @@ -840,18 +840,18 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& } // TODO: read localization info from resource - LocalizationInfo* locinfo = NULL; + LocalizationInfo* locinfo = nullptr; UResourceBundle* nfrb = ures_open(U_ICUDATA_RBNF, locale.getName(), &status); if (U_SUCCESS(status)) { setLocaleIDs(ures_getLocaleByType(nfrb, ULOC_VALID_LOCALE, &status), ures_getLocaleByType(nfrb, ULOC_ACTUAL_LOCALE, &status)); - UResourceBundle* rbnfRules = ures_getByKeyWithFallback(nfrb, rules_tag, NULL, &status); + UResourceBundle* rbnfRules = ures_getByKeyWithFallback(nfrb, rules_tag, nullptr, &status); if (U_FAILURE(status)) { ures_close(nfrb); } - UResourceBundle* ruleSets = ures_getByKeyWithFallback(rbnfRules, fmt_tag, NULL, &status); + UResourceBundle* ruleSets = ures_getByKeyWithFallback(rbnfRules, fmt_tag, nullptr, &status); if (U_FAILURE(status)) { ures_close(rbnfRules); ures_close(nfrb); @@ -860,7 +860,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& UnicodeString desc; while (ures_hasNext(ruleSets)) { - desc.append(ures_getNextUnicodeString(ruleSets,NULL,&status)); + desc.append(ures_getNextUnicodeString(ruleSets,nullptr,&status)); } UParseError perror; @@ -874,23 +874,23 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs) : NumberFormat(rhs) - , fRuleSets(NULL) - , ruleSetDescriptions(NULL) + , fRuleSets(nullptr) + , ruleSetDescriptions(nullptr) , numRuleSets(0) - , defaultRuleSet(NULL) + , defaultRuleSet(nullptr) , locale(rhs.locale) - , collator(NULL) - , decimalFormatSymbols(NULL) - , defaultInfinityRule(NULL) - , defaultNaNRule(NULL) + , collator(nullptr) + , decimalFormatSymbols(nullptr) + , defaultInfinityRule(nullptr) + , defaultNaNRule(nullptr) , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary) - , lenient(FALSE) - , lenientParseRules(NULL) - , localizations(NULL) - , capitalizationInfoSet(FALSE) - , capitalizationForUIListMenu(FALSE) - , capitalizationForStandAlone(FALSE) - , capitalizationBrkIter(NULL) + , lenient(false) + , lenientParseRules(nullptr) + , localizations(nullptr) + , capitalizationInfoSet(false) + , capitalizationForUIListMenu(false) + , capitalizationForStandAlone(false) + , capitalizationBrkIter(nullptr) { this->operator=(rhs); } @@ -911,7 +911,7 @@ RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs) UParseError perror; setDecimalFormatSymbols(*rhs.getDecimalFormatSymbols()); - init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : NULL, perror, status); + init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : nullptr, perror, status); setDefaultRuleSet(rhs.getDefaultRuleSetName(), status); setRoundingMode(rhs.getRoundingMode()); @@ -919,7 +919,7 @@ RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs) capitalizationForUIListMenu = rhs.capitalizationForUIListMenu; capitalizationForStandAlone = rhs.capitalizationForStandAlone; #if !UCONFIG_NO_BREAK_ITERATION - capitalizationBrkIter = (rhs.capitalizationBrkIter!=NULL)? rhs.capitalizationBrkIter->clone(): NULL; + capitalizationBrkIter = (rhs.capitalizationBrkIter!=nullptr)? rhs.capitalizationBrkIter->clone(): nullptr; #endif return *this; @@ -940,45 +940,45 @@ bool RuleBasedNumberFormat::operator==(const Format& other) const { if (this == &other) { - return TRUE; + return true; } if (typeid(*this) == typeid(other)) { - const RuleBasedNumberFormat& rhs = (const RuleBasedNumberFormat&)other; + const RuleBasedNumberFormat& rhs = static_cast(other); // test for capitalization info equality is adequately handled // by the NumberFormat test for fCapitalizationContext equality; // the info here is just derived from that. if (locale == rhs.locale && lenient == rhs.lenient && - (localizations == NULL - ? rhs.localizations == NULL - : (rhs.localizations == NULL - ? FALSE + (localizations == nullptr + ? rhs.localizations == nullptr + : (rhs.localizations == nullptr + ? false : *localizations == rhs.localizations))) { NFRuleSet** p = fRuleSets; NFRuleSet** q = rhs.fRuleSets; - if (p == NULL) { - return q == NULL; - } else if (q == NULL) { - return FALSE; + if (p == nullptr) { + return q == nullptr; + } else if (q == nullptr) { + return false; } while (*p && *q && (**p == **q)) { ++p; ++q; } - return *q == NULL && *p == NULL; + return *q == nullptr && *p == nullptr; } } - return FALSE; + return false; } UnicodeString RuleBasedNumberFormat::getRules() const { UnicodeString result; - if (fRuleSets != NULL) { + if (fRuleSets != nullptr) { for (NFRuleSet** p = fRuleSets; *p; ++p) { (*p)->appendRules(result); } @@ -990,7 +990,7 @@ UnicodeString RuleBasedNumberFormat::getRuleSetName(int32_t index) const { if (localizations) { - UnicodeString string(TRUE, localizations->getRuleSetName(index), (int32_t)-1); + UnicodeString string(true, localizations->getRuleSetName(index), (int32_t)-1); return string; } else if (fRuleSets) { @@ -1026,27 +1026,27 @@ RuleBasedNumberFormat::getNumberOfRuleSetNames() const return result; } -int32_t -RuleBasedNumberFormat::getNumberOfRuleSetDisplayNameLocales(void) const { +int32_t +RuleBasedNumberFormat::getNumberOfRuleSetDisplayNameLocales() const { if (localizations) { return localizations->getNumberOfDisplayLocales(); } return 0; } -Locale +Locale RuleBasedNumberFormat::getRuleSetDisplayNameLocale(int32_t index, UErrorCode& status) const { if (U_FAILURE(status)) { return Locale(""); } if (localizations && index >= 0 && index < localizations->getNumberOfDisplayLocales()) { - UnicodeString name(TRUE, localizations->getLocaleName(index), -1); + UnicodeString name(true, localizations->getLocaleName(index), -1); char buffer[64]; int32_t cap = name.length() + 1; char* bp = buffer; if (cap > 64) { bp = (char *)uprv_malloc(cap); - if (bp == NULL) { + if (bp == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return Locale(""); } @@ -1063,25 +1063,25 @@ RuleBasedNumberFormat::getRuleSetDisplayNameLocale(int32_t index, UErrorCode& st return retLocale; } -UnicodeString +UnicodeString RuleBasedNumberFormat::getRuleSetDisplayName(int32_t index, const Locale& localeParam) { if (localizations && index >= 0 && index < localizations->getNumberOfRuleSets()) { - UnicodeString localeName(localeParam.getBaseName(), -1, UnicodeString::kInvariant); + UnicodeString localeName(localeParam.getBaseName(), -1, UnicodeString::kInvariant); int32_t len = localeName.length(); - UChar* localeStr = localeName.getBuffer(len + 1); + char16_t* localeStr = localeName.getBuffer(len + 1); while (len >= 0) { localeStr[len] = 0; int32_t ix = localizations->indexForLocale(localeStr); if (ix >= 0) { - UnicodeString name(TRUE, localizations->getDisplayName(ix, index), -1); + UnicodeString name(true, localizations->getDisplayName(ix, index), -1); return name; } - - // trim trailing portion, skipping over ommitted sections + + // trim trailing portion, skipping over omitted sections do { --len;} while (len > 0 && localeStr[len] != 0x005f); // underscore while (len > 0 && localeStr[len-1] == 0x005F) --len; } - UnicodeString name(TRUE, localizations->getRuleSetName(index), -1); + UnicodeString name(true, localizations->getRuleSetName(index), -1); return name; } UnicodeString bogus; @@ -1089,7 +1089,7 @@ RuleBasedNumberFormat::getRuleSetDisplayName(int32_t index, const Locale& locale return bogus; } -UnicodeString +UnicodeString RuleBasedNumberFormat::getRuleSetDisplayName(const UnicodeString& ruleSetName, const Locale& localeParam) { if (localizations) { UnicodeString rsn(ruleSetName); @@ -1113,7 +1113,7 @@ RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status } status = U_ILLEGAL_ARGUMENT_ERROR; } - return NULL; + return nullptr; } UnicodeString& @@ -1208,7 +1208,7 @@ RuleBasedNumberFormat::format(int64_t number, UErrorCode& status) const { if (U_SUCCESS(status)) { - if (ruleSetName.indexOf(rbnf_gPercentPercent, 2, 0) == 0) { + if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) { // throw new IllegalArgumentException("Can't use internal rule set"); status = U_ILLEGAL_ARGUMENT_ERROR; } else { @@ -1230,7 +1230,7 @@ RuleBasedNumberFormat::format(double number, UErrorCode& status) const { if (U_SUCCESS(status)) { - if (ruleSetName.indexOf(rbnf_gPercentPercent, 2, 0) == 0) { + if (ruleSetName.indexOf(gPercentPercent, 2, 0) == 0) { // throw new IllegalArgumentException("Can't use internal rule set"); status = U_ILLEGAL_ARGUMENT_ERROR; } else { @@ -1326,7 +1326,7 @@ RuleBasedNumberFormat::adjustForCapitalizationContext(int32_t startPos, if (capitalizationContext != UDISPCTX_CAPITALIZATION_NONE && startPos == 0 && currentResult.length() > 0) { // capitalize currentResult according to context UChar32 ch = currentResult.char32At(0); - if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != NULL && + if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != nullptr && ( capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) || (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) { @@ -1402,18 +1402,18 @@ RuleBasedNumberFormat::setLenient(UBool enabled) lenient = enabled; if (!enabled && collator) { delete collator; - collator = NULL; + collator = nullptr; } } #endif -void +void RuleBasedNumberFormat::setDefaultRuleSet(const UnicodeString& ruleSetName, UErrorCode& status) { if (U_SUCCESS(status)) { if (ruleSetName.isEmpty()) { if (localizations) { - UnicodeString name(TRUE, localizations->getRuleSetName(0), -1); + UnicodeString name(true, localizations->getRuleSetName(0), -1); defaultRuleSet = findRuleSet(name, status); } else { initDefaultRuleSet(); @@ -1422,7 +1422,7 @@ RuleBasedNumberFormat::setDefaultRuleSet(const UnicodeString& ruleSetName, UErro status = U_ILLEGAL_ARGUMENT_ERROR; } else { NFRuleSet* result = findRuleSet(ruleSetName, status); - if (result != NULL) { + if (result != nullptr) { defaultRuleSet = result; } } @@ -1440,10 +1440,10 @@ RuleBasedNumberFormat::getDefaultRuleSetName() const { return result; } -void +void RuleBasedNumberFormat::initDefaultRuleSet() { - defaultRuleSet = NULL; + defaultRuleSet = nullptr; if (!fRuleSets) { return; } @@ -1480,7 +1480,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali { // TODO: implement UParseError uprv_memset(&pErr, 0, sizeof(UParseError)); - // Note: this can leave ruleSets == NULL, so remaining code should check + // Note: this can leave ruleSets == nullptr, so remaining code should check if (U_FAILURE(status)) { return; } @@ -1492,7 +1492,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali return; } - this->localizations = localizationInfos == NULL ? NULL : localizationInfos->ref(); + this->localizations = localizationInfos == nullptr ? nullptr : localizationInfos->ref(); UnicodeString description(rules); if (!description.length()) { @@ -1501,7 +1501,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali } // start by stripping the trailing whitespace from all the rules - // (this is all the whitespace follwing each semicolon in the + // (this is all the whitespace following each semicolon in the // description). This allows us to look for rule-set boundaries // by searching for ";%" without having to worry about whitespace // between the ; and the % @@ -1511,21 +1511,21 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali // is, pull them out into our temporary holding place for them, // and delete them from the description before the real desciption- // parsing code sees them - int32_t lp = description.indexOf(rbnf_gLenientParse, -1, 0); + int32_t lp = description.indexOf(gLenientParse, -1, 0); if (lp != -1) { // we've got to make sure we're not in the middle of a rule // (where "%%lenient-parse" would actually get treated as // rule text) - if (lp == 0 || description.charAt(lp - 1) == rbnf_gSemiColon) { + if (lp == 0 || description.charAt(lp - 1) == gSemiColon) { // locate the beginning and end of the actual collation // rules (there may be whitespace between the name and // the first token in the description) - int lpEnd = description.indexOf(rbnf_gSemiPercent, 2, lp); + int lpEnd = description.indexOf(gSemiPercent, 2, lp); if (lpEnd == -1) { lpEnd = description.length() - 1; } - int lpStart = lp + u_strlen(rbnf_gLenientParse); + int lpStart = lp + u_strlen(gLenientParse); while (PatternProps::isWhiteSpace(description.charAt(lpStart))) { ++lpStart; } @@ -1533,7 +1533,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali // copy out the lenient-parse rules and delete them // from the description lenientParseRules = new UnicodeString(); - /* test for NULL */ + /* test for nullptr */ if (lenientParseRules == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; return; @@ -1548,7 +1548,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali // rule sets (";%" marks the end of one rule set and the beginning // of the next) numRuleSets = 0; - for (int32_t p = description.indexOf(rbnf_gSemiPercent, 2, 0); p != -1; p = description.indexOf(rbnf_gSemiPercent, 2, p)) { + for (int32_t p = description.indexOf(gSemiPercent, 2, 0); p != -1; p = description.indexOf(gSemiPercent, 2, p)) { ++numRuleSets; ++p; } @@ -1556,14 +1556,14 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali // our rule list is an array of the appropriate size fRuleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *)); - /* test for NULL */ + /* test for nullptr */ if (fRuleSets == 0) { status = U_MEMORY_ALLOCATION_ERROR; return; } for (int i = 0; i <= numRuleSets; ++i) { - fRuleSets[i] = NULL; + fRuleSets[i] = nullptr; } // divide up the descriptions into individual rule-set descriptions @@ -1587,7 +1587,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali { int curRuleSet = 0; int32_t start = 0; - for (int32_t p = description.indexOf(rbnf_gSemiPercent, 2, 0); p != -1; p = description.indexOf(rbnf_gSemiPercent, 2, start)) { + for (int32_t p = description.indexOf(gSemiPercent, 2, 0); p != -1; p = description.indexOf(gSemiPercent, 2, start)) { ruleSetDescriptions[curRuleSet].setTo(description, start, p + 1 - start); fRuleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status); if (fRuleSets[curRuleSet] == nullptr) { @@ -1612,7 +1612,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali // by appending more rule sets to the end) // {dlf} Initialization of a fraction rule set requires the default rule - // set to be known. For purposes of initialization, this is always the + // set to be known. For purposes of initialization, this is always the // last public rule set, no matter what the localization data says. initDefaultRuleSet(); @@ -1631,14 +1631,14 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali // The C code keeps the localization array as is, rather than building // a separate array of the public rule set names, so we have less work // to do here-- but we still need to check the names. - + if (localizationInfos) { // confirm the names, if any aren't in the rules, that's an error // it is ok if the rules contain public rule sets that are not in this list for (int32_t i = 0; i < localizationInfos->getNumberOfRuleSets(); ++i) { - UnicodeString name(TRUE, localizationInfos->getRuleSetName(i), -1); + UnicodeString name(true, localizationInfos->getRuleSetName(i), -1); NFRuleSet* rs = findRuleSet(name, status); - if (rs == NULL) { + if (rs == nullptr) { break; // error } if (i == 0) { @@ -1661,17 +1661,17 @@ RuleBasedNumberFormat::setContext(UDisplayContext value, UErrorCode& status) if (!capitalizationInfoSet && (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE)) { initCapitalizationContextInfo(locale); - capitalizationInfoSet = TRUE; + capitalizationInfoSet = true; } #if !UCONFIG_NO_BREAK_ITERATION - if ( capitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || + if ( capitalizationBrkIter == nullptr && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) || (value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) { status = U_ZERO_ERROR; capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status); if (U_FAILURE(status)) { delete capitalizationBrkIter; - capitalizationBrkIter = NULL; + capitalizationBrkIter = nullptr; } } #endif @@ -1682,15 +1682,15 @@ void RuleBasedNumberFormat::initCapitalizationContextInfo(const Locale& thelocale) { #if !UCONFIG_NO_BREAK_ITERATION - const char * localeID = (thelocale != NULL)? thelocale.getBaseName(): NULL; + const char * localeID = (thelocale != nullptr)? thelocale.getBaseName(): nullptr; UErrorCode status = U_ZERO_ERROR; - UResourceBundle *rb = ures_open(NULL, localeID, &status); + UResourceBundle *rb = ures_open(nullptr, localeID, &status); rb = ures_getByKeyWithFallback(rb, "contextTransforms", rb, &status); rb = ures_getByKeyWithFallback(rb, "number-spellout", rb, &status); - if (U_SUCCESS(status) && rb != NULL) { + if (U_SUCCESS(status) && rb != nullptr) { int32_t len = 0; const int32_t * intVector = ures_getIntVector(rb, &len, &status); - if (U_SUCCESS(status) && intVector != NULL && len >= 2) { + if (U_SUCCESS(status) && intVector != nullptr && len >= 2) { capitalizationForUIListMenu = static_cast(intVector[0]); capitalizationForStandAlone = static_cast(intVector[1]); } @@ -1715,7 +1715,7 @@ RuleBasedNumberFormat::stripWhitespace(UnicodeString& description) // locate the next semicolon in the text and copy the text from // our current position up to that semicolon into the result - int32_t p = description.indexOf(rbnf_gSemiColon, start); + int32_t p = description.indexOf(gSemiColon, start); if (p == -1) { // or if we don't find a semicolon, just copy the rest of // the string into the result @@ -1748,34 +1748,34 @@ RuleBasedNumberFormat::dispose() delete *p; } uprv_free(fRuleSets); - fRuleSets = NULL; + fRuleSets = nullptr; } if (ruleSetDescriptions) { delete [] ruleSetDescriptions; - ruleSetDescriptions = NULL; + ruleSetDescriptions = nullptr; } #if !UCONFIG_NO_COLLATION delete collator; #endif - collator = NULL; + collator = nullptr; delete decimalFormatSymbols; - decimalFormatSymbols = NULL; + decimalFormatSymbols = nullptr; delete defaultInfinityRule; - defaultInfinityRule = NULL; + defaultInfinityRule = nullptr; delete defaultNaNRule; - defaultNaNRule = NULL; + defaultNaNRule = nullptr; delete lenientParseRules; - lenientParseRules = NULL; + lenientParseRules = nullptr; #if !UCONFIG_NO_BREAK_ITERATION delete capitalizationBrkIter; - capitalizationBrkIter = NULL; + capitalizationBrkIter = nullptr; #endif if (localizations) { @@ -1799,11 +1799,11 @@ RuleBasedNumberFormat::getCollator() const { #if !UCONFIG_NO_COLLATION if (!fRuleSets) { - return NULL; + return nullptr; } // lazy-evaluate the collator - if (collator == NULL && lenient) { + if (collator == nullptr && lenient) { // create a default collator based on the formatter's locale, // then pull out that collator's rules, append any additional // rules specified in the description, and create a _new_ @@ -1813,18 +1813,18 @@ RuleBasedNumberFormat::getCollator() const Collator* temp = Collator::createInstance(locale, status); RuleBasedCollator* newCollator; - if (U_SUCCESS(status) && (newCollator = dynamic_cast(temp)) != NULL) { + if (U_SUCCESS(status) && (newCollator = dynamic_cast(temp)) != nullptr) { if (lenientParseRules) { UnicodeString rules(newCollator->getRules()); rules.append(*lenientParseRules); newCollator = new RuleBasedCollator(rules, status); // Exit if newCollator could not be created. - if (newCollator == NULL) { - return NULL; + if (newCollator == nullptr) { + return nullptr; } } else { - temp = NULL; + temp = nullptr; } if (U_SUCCESS(status)) { newCollator->setAttribute(UCOL_DECOMPOSITION_MODE, UCOL_ON, status); @@ -1875,7 +1875,7 @@ RuleBasedNumberFormat::initializeDefaultInfinityRule(UErrorCode &status) if (U_FAILURE(status)) { return nullptr; } - if (defaultInfinityRule == NULL) { + if (defaultInfinityRule == nullptr) { UnicodeString rule(UNICODE_STRING_SIMPLE("Inf: ")); rule.append(getDecimalFormatSymbols()->getSymbol(DecimalFormatSymbols::kInfinitySymbol)); LocalPointer temp(new NFRule(this, rule, status), status); @@ -1919,11 +1919,11 @@ RuleBasedNumberFormat::getDefaultNaNRule() const void RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt) { - if (symbolsToAdopt == NULL) { - return; // do not allow caller to set decimalFormatSymbols to NULL + if (symbolsToAdopt == nullptr) { + return; // do not allow caller to set decimalFormatSymbols to nullptr } - if (decimalFormatSymbols != NULL) { + if (decimalFormatSymbols != nullptr) { delete decimalFormatSymbols; } @@ -1934,11 +1934,11 @@ RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsTo UErrorCode status = U_ZERO_ERROR; delete defaultInfinityRule; - defaultInfinityRule = NULL; + defaultInfinityRule = nullptr; initializeDefaultInfinityRule(status); // Reset with the new DecimalFormatSymbols delete defaultNaNRule; - defaultNaNRule = NULL; + defaultNaNRule = nullptr; initializeDefaultNaNRule(status); // Reset with the new DecimalFormatSymbols if (fRuleSets) { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/rbt.h b/src/duckdb/extension/icu/third_party/icu/i18n/rbt.h index ba452010b..59fa286a4 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/rbt.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/rbt.h @@ -1,223 +1,223 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 1999-2007, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 11/17/99 aliu Creation. -// ********************************************************************** -// */ -// #ifndef RBT_H -// #define RBT_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/translit.h" -// #include "unicode/utypes.h" -// #include "unicode/parseerr.h" -// #include "unicode/udata.h" - -// #define U_ICUDATA_TRANSLIT U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "translit" - -// U_NAMESPACE_BEGIN - -// class TransliterationRuleData; - -// /** -// * RuleBasedTransliterator is a transliterator -// * built from a set of rules as defined for -// * Transliterator::createFromRules(). -// * See the C++ class Transliterator documentation for the rule syntax. -// * -// * @author Alan Liu -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// class RuleBasedTransliterator : public Transliterator { -// private: -// /** -// * The data object is immutable, so we can freely share it with -// * other instances of RBT, as long as we do NOT own this object. -// * TODO: data is no longer immutable. See bugs #1866, 2155 -// */ -// TransliterationRuleData* fData; - -// /** -// * If true, we own the data object and must delete it. -// */ -// UBool isDataOwned; - -// public: - -// /** -// * Constructs a new transliterator from the given rules. -// * @param rules rules, separated by ';' -// * @param direction either FORWARD or REVERSE. -// * @exception IllegalArgumentException if rules are malformed. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// RuleBasedTransliterator(const UnicodeString& id, -// const UnicodeString& rules, -// UTransDirection direction, -// UnicodeFilter* adoptedFilter, -// UParseError& parseError, -// UErrorCode& status); - -// /** -// * Constructs a new transliterator from the given rules. -// * @param rules rules, separated by ';' -// * @param direction either FORWARD or REVERSE. -// * @exception IllegalArgumentException if rules are malformed. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// /*RuleBasedTransliterator(const UnicodeString& id, -// const UnicodeString& rules, -// UTransDirection direction, -// UnicodeFilter* adoptedFilter, -// UErrorCode& status);*/ - -// /** -// * Covenience constructor with no filter. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// /*RuleBasedTransliterator(const UnicodeString& id, -// const UnicodeString& rules, -// UTransDirection direction, -// UErrorCode& status);*/ - -// /** -// * Covenience constructor with no filter and FORWARD direction. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// /*RuleBasedTransliterator(const UnicodeString& id, -// const UnicodeString& rules, -// UErrorCode& status);*/ - -// /** -// * Covenience constructor with FORWARD direction. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// /*RuleBasedTransliterator(const UnicodeString& id, -// const UnicodeString& rules, -// UnicodeFilter* adoptedFilter, -// UErrorCode& status);*/ -// private: - -// friend class TransliteratorRegistry; // to access TransliterationRuleData convenience ctor -// /** -// * Covenience constructor. -// * @param id the id for the transliterator. -// * @param theData the rule data for the transliterator. -// * @param adoptedFilter the filter for the transliterator -// */ -// RuleBasedTransliterator(const UnicodeString& id, -// const TransliterationRuleData* theData, -// UnicodeFilter* adoptedFilter = 0); - - -// friend class Transliterator; // to access following ct - -// /** -// * Internal constructor. -// * @param id the id for the transliterator. -// * @param theData the rule data for the transliterator. -// * @param isDataAdopted determine who will own the 'data' object. True, the caller should not delete 'data'. -// */ -// RuleBasedTransliterator(const UnicodeString& id, -// TransliterationRuleData* data, -// UBool isDataAdopted); - -// public: - -// /** -// * Copy constructor. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// RuleBasedTransliterator(const RuleBasedTransliterator&); - -// virtual ~RuleBasedTransliterator(); - -// /** -// * Implement Transliterator API. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// virtual RuleBasedTransliterator* clone() const; - -// protected: -// /** -// * Implements {@link Transliterator#handleTransliterate}. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// virtual void handleTransliterate(Replaceable& text, UTransPosition& offsets, -// UBool isIncremental) const; - -// public: -// /** -// * Return a representation of this transliterator as source rules. -// * These rules will produce an equivalent transliterator if used -// * to construct a new transliterator. -// * @param result the string to receive the rules. Previous -// * contents will be deleted. -// * @param escapeUnprintable if TRUE then convert unprintable -// * character to their hex escape representations, \uxxxx or -// * \Uxxxxxxxx. Unprintable characters are those other than -// * U+000A, U+0020..U+007E. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// virtual UnicodeString& toRules(UnicodeString& result, -// UBool escapeUnprintable) const; - -// protected: -// /** -// * Implement Transliterator framework -// */ -// virtual void handleGetSourceSet(UnicodeSet& result) const; - -// public: -// /** -// * Override Transliterator framework -// */ -// virtual UnicodeSet& getTargetSet(UnicodeSet& result) const; - -// /** -// * Return the class ID for this class. This is useful only for -// * comparing to a return value from getDynamicClassID(). For example: -// *
    -//      * .      Base* polymorphic_pointer = createPolymorphicObject();
    -//      * .      if (polymorphic_pointer->getDynamicClassID() ==
    -//      * .          Derived::getStaticClassID()) ...
    -//      * 
    -// * @return The class ID for all objects of this class. -// * @internal Use transliterator factory methods instead since this class will be removed in that release. -// */ -// U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); - -// /** -// * Returns a unique class ID polymorphically. This method -// * is to implement a simple version of RTTI, since not all C++ -// * compilers support genuine RTTI. Polymorphic operator==() and -// * clone() methods call this method. -// * -// * @return The class ID for this object. All objects of a given -// * class have the same class ID. Objects of other classes have -// * different class IDs. -// */ -// virtual UClassID getDynamicClassID(void) const; - -// private: - -// void _construct(const UnicodeString& rules, -// UTransDirection direction, -// UParseError& parseError, -// UErrorCode& status); -// }; - - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2007, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. +********************************************************************** +*/ +#ifndef RBT_H +#define RBT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/translit.h" +#include "unicode/utypes.h" +#include "unicode/parseerr.h" +#include "unicode/udata.h" + +#define U_ICUDATA_TRANSLIT U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "translit" + +U_NAMESPACE_BEGIN + +class TransliterationRuleData; + +/** + * RuleBasedTransliterator is a transliterator + * built from a set of rules as defined for + * Transliterator::createFromRules(). + * See the C++ class Transliterator documentation for the rule syntax. + * + * @author Alan Liu + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ +class RuleBasedTransliterator : public Transliterator { +private: + /** + * The data object is immutable, so we can freely share it with + * other instances of RBT, as long as we do NOT own this object. + * TODO: data is no longer immutable. See bugs #1866, 2155 + */ + TransliterationRuleData* fData; + + /** + * If true, we own the data object and must delete it. + */ + UBool isDataOwned; + +public: + + /** + * Constructs a new transliterator from the given rules. + * @param rules rules, separated by ';' + * @param direction either FORWARD or REVERSE. + * @exception IllegalArgumentException if rules are malformed. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + RuleBasedTransliterator(const UnicodeString& id, + const UnicodeString& rules, + UTransDirection direction, + UnicodeFilter* adoptedFilter, + UParseError& parseError, + UErrorCode& status); + + /** + * Constructs a new transliterator from the given rules. + * @param rules rules, separated by ';' + * @param direction either FORWARD or REVERSE. + * @exception IllegalArgumentException if rules are malformed. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + /*RuleBasedTransliterator(const UnicodeString& id, + const UnicodeString& rules, + UTransDirection direction, + UnicodeFilter* adoptedFilter, + UErrorCode& status);*/ + + /** + * Convenience constructor with no filter. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + /*RuleBasedTransliterator(const UnicodeString& id, + const UnicodeString& rules, + UTransDirection direction, + UErrorCode& status);*/ + + /** + * Convenience constructor with no filter and FORWARD direction. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + /*RuleBasedTransliterator(const UnicodeString& id, + const UnicodeString& rules, + UErrorCode& status);*/ + + /** + * Convenience constructor with FORWARD direction. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + /*RuleBasedTransliterator(const UnicodeString& id, + const UnicodeString& rules, + UnicodeFilter* adoptedFilter, + UErrorCode& status);*/ +private: + + friend class TransliteratorRegistry; // to access TransliterationRuleData convenience ctor + /** + * Convenience constructor. + * @param id the id for the transliterator. + * @param theData the rule data for the transliterator. + * @param adoptedFilter the filter for the transliterator + */ + RuleBasedTransliterator(const UnicodeString& id, + const TransliterationRuleData* theData, + UnicodeFilter* adoptedFilter = 0); + + + friend class Transliterator; // to access following ct + + /** + * Internal constructor. + * @param id the id for the transliterator. + * @param theData the rule data for the transliterator. + * @param isDataAdopted determine who will own the 'data' object. True, the caller should not delete 'data'. + */ + RuleBasedTransliterator(const UnicodeString& id, + TransliterationRuleData* data, + UBool isDataAdopted); + +public: + + /** + * Copy constructor. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + RuleBasedTransliterator(const RuleBasedTransliterator&); + + virtual ~RuleBasedTransliterator(); + + /** + * Implement Transliterator API. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + virtual RuleBasedTransliterator* clone() const override; + +protected: + /** + * Implements {@link Transliterator#handleTransliterate}. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + virtual void handleTransliterate(Replaceable& text, UTransPosition& offsets, + UBool isIncremental) const override; + +public: + /** + * Return a representation of this transliterator as source rules. + * These rules will produce an equivalent transliterator if used + * to construct a new transliterator. + * @param result the string to receive the rules. Previous + * contents will be deleted. + * @param escapeUnprintable if true then convert unprintable + * character to their hex escape representations, \uxxxx or + * \Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + virtual UnicodeString& toRules(UnicodeString& result, + UBool escapeUnprintable) const override; + +protected: + /** + * Implement Transliterator framework + */ + virtual void handleGetSourceSet(UnicodeSet& result) const override; + +public: + /** + * Override Transliterator framework + */ + virtual UnicodeSet& getTargetSet(UnicodeSet& result) const override; + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + *
    +     * .      Base* polymorphic_pointer = createPolymorphicObject();
    +     * .      if (polymorphic_pointer->getDynamicClassID() ==
    +     * .          Derived::getStaticClassID()) ...
    +     * 
    + * @return The class ID for all objects of this class. + * @internal Use transliterator factory methods instead since this class will be removed in that release. + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + + /** + * Returns a unique class ID polymorphically. This method + * is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + */ + virtual UClassID getDynamicClassID() const override; + +private: + + void _construct(const UnicodeString& rules, + UTransDirection direction, + UParseError& parseError, + UErrorCode& status); +}; + + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/rbt_data.h b/src/duckdb/extension/icu/third_party/icu/i18n/rbt_data.h index 6cc8cd8e2..43cbb4795 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/rbt_data.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/rbt_data.h @@ -1,154 +1,154 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 1999-2007, International Business Machines Corporation -// * and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 11/17/99 aliu Creation. -// ********************************************************************** -// */ -// #ifndef RBT_DATA_H -// #define RBT_DATA_H - -// #include "unicode/utypes.h" -// #include "unicode/uclean.h" - -// #if !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/uobject.h" -// #include "rbt_set.h" -// #include "hash.h" - -// U_NAMESPACE_BEGIN - -// class UnicodeFunctor; -// class UnicodeMatcher; -// class UnicodeReplacer; - -// /** -// * The rule data for a RuleBasedTransliterators. RBT objects hold -// * a const pointer to a TRD object that they do not own. TRD objects -// * are essentially the parsed rules in compact, usable form. The -// * TRD objects themselves are held for the life of the process in -// * a static cache owned by Transliterator. -// * -// * This class' API is a little asymmetric. There is a method to -// * define a variable, but no way to define a set. This is because the -// * sets are defined by the parser in a UVector, and the vector is -// * copied into a fixed-size array here. Once this is done, no new -// * sets may be defined. In practice, there is no need to do so, since -// * generating the data and using it are discrete phases. When there -// * is a need to access the set data during the parse phase, another -// * data structure handles this. See the parsing code for more -// * details. -// */ -// class TransliterationRuleData : public UMemory { - -// public: - -// // PUBLIC DATA MEMBERS - -// /** -// * Rule table. May be empty. -// */ -// TransliterationRuleSet ruleSet; - -// /** -// * Map variable name (String) to variable (UnicodeString). A variable name -// * corresponds to zero or more characters, stored in a UnicodeString in -// * this hash. One or more of these chars may also correspond to a -// * UnicodeMatcher, in which case the character in the UnicodeString in this hash is -// * a stand-in: it is an index for a secondary lookup in -// * data.variables. The stand-in also represents the UnicodeMatcher in -// * the stored rules. -// */ -// Hashtable variableNames; - -// /** -// * Map category variable (UChar) to set (UnicodeFunctor). -// * Variables that correspond to a set of characters are mapped -// * from variable name to a stand-in character in data.variableNames. -// * The stand-in then serves as a key in this hash to lookup the -// * actual UnicodeFunctor object. In addition, the stand-in is -// * stored in the rule text to represent the set of characters. -// * variables[i] represents character (variablesBase + i). -// */ -// UnicodeFunctor** variables; - -// /** -// * Flag that indicates whether the variables are owned (if a single -// * call to Transliterator::createFromRules() produces a CompoundTransliterator -// * with more than one RuleBasedTransliterator as children, they all share -// * the same variables list, so only the first one is considered to own -// * the variables) -// */ -// UBool variablesAreOwned; - -// /** -// * The character that represents variables[0]. Characters -// * variablesBase through variablesBase + -// * variablesLength - 1 represent UnicodeFunctor objects. -// */ -// UChar variablesBase; - -// /** -// * The length of variables. -// */ -// int32_t variablesLength; - -// public: - -// /** -// * Constructor -// * @param status Output param set to success/failure code on exit. -// */ -// TransliterationRuleData(UErrorCode& status); - -// /** -// * Copy Constructor -// */ -// TransliterationRuleData(const TransliterationRuleData&); - -// /** -// * destructor -// */ -// ~TransliterationRuleData(); - -// /** -// * Given a stand-in character, return the UnicodeFunctor that it -// * represents, or NULL if it doesn't represent anything. -// * @param standIn the given stand-in character. -// * @return the UnicodeFunctor that 'standIn' represents -// */ -// UnicodeFunctor* lookup(UChar32 standIn) const; - -// /** -// * Given a stand-in character, return the UnicodeMatcher that it -// * represents, or NULL if it doesn't represent anything or if it -// * represents something that is not a matcher. -// * @param standIn the given stand-in character. -// * @return return the UnicodeMatcher that 'standIn' represents -// */ -// UnicodeMatcher* lookupMatcher(UChar32 standIn) const; - -// /** -// * Given a stand-in character, return the UnicodeReplacer that it -// * represents, or NULL if it doesn't represent anything or if it -// * represents something that is not a replacer. -// * @param standIn the given stand-in character. -// * @return return the UnicodeReplacer that 'standIn' represents -// */ -// UnicodeReplacer* lookupReplacer(UChar32 standIn) const; - - -// private: -// TransliterationRuleData &operator=(const TransliterationRuleData &other); // forbid copying of this class -// }; - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2007, International Business Machines Corporation +* and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. +********************************************************************** +*/ +#ifndef RBT_DATA_H +#define RBT_DATA_H + +#include "unicode/utypes.h" +#include "unicode/uclean.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/uobject.h" +#include "rbt_set.h" +#include "hash.h" + +U_NAMESPACE_BEGIN + +class UnicodeFunctor; +class UnicodeMatcher; +class UnicodeReplacer; + +/** + * The rule data for a RuleBasedTransliterators. RBT objects hold + * a const pointer to a TRD object that they do not own. TRD objects + * are essentially the parsed rules in compact, usable form. The + * TRD objects themselves are held for the life of the process in + * a static cache owned by Transliterator. + * + * This class' API is a little asymmetric. There is a method to + * define a variable, but no way to define a set. This is because the + * sets are defined by the parser in a UVector, and the vector is + * copied into a fixed-size array here. Once this is done, no new + * sets may be defined. In practice, there is no need to do so, since + * generating the data and using it are discrete phases. When there + * is a need to access the set data during the parse phase, another + * data structure handles this. See the parsing code for more + * details. + */ +class TransliterationRuleData : public UMemory { + +public: + + // PUBLIC DATA MEMBERS + + /** + * Rule table. May be empty. + */ + TransliterationRuleSet ruleSet; + + /** + * Map variable name (String) to variable (UnicodeString). A variable name + * corresponds to zero or more characters, stored in a UnicodeString in + * this hash. One or more of these chars may also correspond to a + * UnicodeMatcher, in which case the character in the UnicodeString in this hash is + * a stand-in: it is an index for a secondary lookup in + * data.variables. The stand-in also represents the UnicodeMatcher in + * the stored rules. + */ + Hashtable variableNames; + + /** + * Map category variable (char16_t) to set (UnicodeFunctor). + * Variables that correspond to a set of characters are mapped + * from variable name to a stand-in character in data.variableNames. + * The stand-in then serves as a key in this hash to lookup the + * actual UnicodeFunctor object. In addition, the stand-in is + * stored in the rule text to represent the set of characters. + * variables[i] represents character (variablesBase + i). + */ + UnicodeFunctor** variables; + + /** + * Flag that indicates whether the variables are owned (if a single + * call to Transliterator::createFromRules() produces a CompoundTransliterator + * with more than one RuleBasedTransliterator as children, they all share + * the same variables list, so only the first one is considered to own + * the variables) + */ + UBool variablesAreOwned; + + /** + * The character that represents variables[0]. Characters + * variablesBase through variablesBase + + * variablesLength - 1 represent UnicodeFunctor objects. + */ + char16_t variablesBase; + + /** + * The length of variables. + */ + int32_t variablesLength; + +public: + + /** + * Constructor + * @param status Output param set to success/failure code on exit. + */ + TransliterationRuleData(UErrorCode& status); + + /** + * Copy Constructor + */ + TransliterationRuleData(const TransliterationRuleData&); + + /** + * destructor + */ + ~TransliterationRuleData(); + + /** + * Given a stand-in character, return the UnicodeFunctor that it + * represents, or nullptr if it doesn't represent anything. + * @param standIn the given stand-in character. + * @return the UnicodeFunctor that 'standIn' represents + */ + UnicodeFunctor* lookup(UChar32 standIn) const; + + /** + * Given a stand-in character, return the UnicodeMatcher that it + * represents, or nullptr if it doesn't represent anything or if it + * represents something that is not a matcher. + * @param standIn the given stand-in character. + * @return return the UnicodeMatcher that 'standIn' represents + */ + UnicodeMatcher* lookupMatcher(UChar32 standIn) const; + + /** + * Given a stand-in character, return the UnicodeReplacer that it + * represents, or nullptr if it doesn't represent anything or if it + * represents something that is not a replacer. + * @param standIn the given stand-in character. + * @return return the UnicodeReplacer that 'standIn' represents + */ + UnicodeReplacer* lookupReplacer(UChar32 standIn) const; + + +private: + TransliterationRuleData &operator=(const TransliterationRuleData &other); // forbid copying of this class +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/rbt_pars.h b/src/duckdb/extension/icu/third_party/icu/i18n/rbt_pars.h index 61ce9727e..11cf50e75 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/rbt_pars.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/rbt_pars.h @@ -107,14 +107,14 @@ class TransliteratorParser : public UMemory { * variableLimit. At any point during parsing, available * variables are variableNext..variableLimit-1. */ - UChar variableNext; + char16_t variableNext; /** * The last available stand-in for variables. This is discovered * dynamically. At any point during parsing, available variables are * variableNext..variableLimit-1. */ - UChar variableLimit; + char16_t variableLimit; /** * When we encounter an undefined variable, we do not immediately signal @@ -130,7 +130,7 @@ class TransliteratorParser : public UMemory { * patterns. This is allocated the first time it is needed, and * reused thereafter. */ - UChar dotStandIn; + char16_t dotStandIn; public: @@ -156,7 +156,7 @@ class TransliteratorParser : public UMemory { * call returns. * @param rules rules, separated by ';' * @param direction either FORWARD or REVERSE. - * @param pe Struct to recieve information on position + * @param pe Struct to receive information on position * of error if an error is encountered * @param ec Output param set to success/failure code. */ @@ -210,7 +210,7 @@ class TransliteratorParser : public UMemory { /** * Assert that the given character is NOT within the variable range. - * If it is, return FALSE. This is neccesary to ensure that the + * If it is, return false. This is necessary to ensure that the * variable range does not overlap characters used in a rule. * @param ch the given character. * @return True, if the given character is NOT within the variable range. @@ -272,9 +272,9 @@ class TransliteratorParser : public UMemory { * @param pos the position in pattern at which to start parsing. * @return the stand-in character used to represent it. */ - UChar parseSet(const UnicodeString& rule, - ParsePosition& pos, - UErrorCode& status); + char16_t parseSet(const UnicodeString& rule, + ParsePosition& pos, + UErrorCode& status); /** * Generate and return a stand-in for a new UnicodeFunctor. Store @@ -282,14 +282,14 @@ class TransliteratorParser : public UMemory { * @param adopted the UnicodeFunctor to be adopted. * @return a stand-in for a new UnicodeFunctor. */ - UChar generateStandInFor(UnicodeFunctor* adopted, UErrorCode& status); + char16_t generateStandInFor(UnicodeFunctor* adopted, UErrorCode& status); /** * Return the standin for segment seg (1-based). * @param seg the given segment. * @return the standIn character for the given segment. */ - UChar getSegmentStandin(int32_t seg, UErrorCode& status); + char16_t getSegmentStandin(int32_t seg, UErrorCode& status); /** * Set the object for segment seg (1-based). @@ -303,7 +303,7 @@ class TransliteratorParser : public UMemory { * time and reused thereafter. * @return the stand-in for the dot set. */ - UChar getDotStandIn(UErrorCode& status); + char16_t getDotStandIn(UErrorCode& status); /** * Append the value of the given variable name to the given diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/rbt_set.h b/src/duckdb/extension/icu/third_party/icu/i18n/rbt_set.h index 7837402ea..fb436ff67 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/rbt_set.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/rbt_set.h @@ -1,167 +1,167 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (C) 1999-2007, International Business Machines Corporation -// * and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 11/17/99 aliu Creation. -// ********************************************************************** -// */ -// #ifndef RBT_SET_H -// #define RBT_SET_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/uobject.h" -// #include "unicode/utrans.h" -// #include "uvector.h" - -// U_NAMESPACE_BEGIN - -// class Replaceable; -// class TransliterationRule; -// class TransliterationRuleData; -// class UnicodeFilter; -// class UnicodeString; -// class UnicodeSet; - -// /** -// * A set of rules for a RuleBasedTransliterator. -// * @author Alan Liu -// */ -// class TransliterationRuleSet : public UMemory { -// /** -// * Vector of rules, in the order added. This is used while the -// * rule set is getting built. After that, freeze() reorders and -// * indexes the rules into rules[]. Any given rule is stored once -// * in ruleVector, and one or more times in rules[]. ruleVector -// * owns and deletes the rules. -// */ -// UVector* ruleVector; - -// /** -// * Sorted and indexed table of rules. This is created by freeze() -// * from the rules in ruleVector. It contains alias pointers to -// * the rules in ruleVector. It is zero before freeze() is called -// * and non-zero thereafter. -// */ -// TransliterationRule** rules; - -// /** -// * Index table. For text having a first character c, compute x = c&0xFF. -// * Now use rules[index[x]..index[x+1]-1]. This index table is created by -// * freeze(). Before freeze() is called it contains garbage. -// */ -// int32_t index[257]; - -// /** -// * Length of the longest preceding context -// */ -// int32_t maxContextLength; - -// public: - -// /** -// * Construct a new empty rule set. -// * @param status Output parameter filled in with success or failure status. -// */ -// TransliterationRuleSet(UErrorCode& status); - -// /** -// * Copy constructor. -// */ -// TransliterationRuleSet(const TransliterationRuleSet&); - -// /** -// * Destructor. -// */ -// virtual ~TransliterationRuleSet(); - -// /** -// * Change the data object that this rule belongs to. Used -// * internally by the TransliterationRuleData copy constructor. -// * @param data the new data value to be set. -// */ -// void setData(const TransliterationRuleData* data); - -// /** -// * Return the maximum context length. -// * @return the length of the longest preceding context. -// */ -// virtual int32_t getMaximumContextLength(void) const; - -// /** -// * Add a rule to this set. Rules are added in order, and order is -// * significant. The last call to this method must be followed by -// * a call to freeze() before the rule set is used. -// * This method must not be called after freeze() has been -// * called. -// * -// * @param adoptedRule the rule to add -// */ -// virtual void addRule(TransliterationRule* adoptedRule, -// UErrorCode& status); - -// /** -// * Check this for masked rules and index it to optimize performance. -// * The sequence of operations is: (1) add rules to a set using -// * addRule(); (2) freeze the set using -// * freeze(); (3) use the rule set. If -// * addRule() is called after calling this method, it -// * invalidates this object, and this method must be called again. -// * That is, freeze() may be called multiple times, -// * although for optimal performance it shouldn't be. -// * @param parseError A pointer to UParseError to receive information about errors -// * occurred. -// * @param status Output parameter filled in with success or failure status. -// */ -// virtual void freeze(UParseError& parseError, UErrorCode& status); - -// /** -// * Transliterate the given text with the given UTransPosition -// * indices. Return TRUE if the transliteration should continue -// * or FALSE if it should halt (because of a U_PARTIAL_MATCH match). -// * Note that FALSE is only ever returned if isIncremental is TRUE. -// * @param text the text to be transliterated -// * @param index the position indices, which will be updated -// * @param isIncremental if TRUE, assume new text may be inserted -// * at index.limit, and return FALSE if thre is a partial match. -// * @return TRUE unless a U_PARTIAL_MATCH has been obtained, -// * indicating that transliteration should stop until more text -// * arrives. -// */ -// UBool transliterate(Replaceable& text, -// UTransPosition& index, -// UBool isIncremental); - -// /** -// * Create rule strings that represents this rule set. -// * @param result string to receive the rule strings. Current -// * contents will be deleted. -// * @param escapeUnprintable True, will escape the unprintable characters -// * @return A reference to 'result'. -// */ -// virtual UnicodeString& toRules(UnicodeString& result, -// UBool escapeUnprintable) const; - -// /** -// * Return the set of all characters that may be modified -// * (getTarget=false) or emitted (getTarget=true) by this set. -// */ -// UnicodeSet& getSourceTargetSet(UnicodeSet& result, -// UBool getTarget) const; - -// private: - -// TransliterationRuleSet &operator=(const TransliterationRuleSet &other); // forbid copying of this class -// }; - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2007, International Business Machines Corporation +* and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. +********************************************************************** +*/ +#ifndef RBT_SET_H +#define RBT_SET_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/uobject.h" +#include "unicode/utrans.h" +#include "uvector.h" + +U_NAMESPACE_BEGIN + +class Replaceable; +class TransliterationRule; +class TransliterationRuleData; +class UnicodeFilter; +class UnicodeString; +class UnicodeSet; + +/** + * A set of rules for a RuleBasedTransliterator. + * @author Alan Liu + */ +class TransliterationRuleSet : public UMemory { + /** + * Vector of rules, in the order added. This is used while the + * rule set is getting built. After that, freeze() reorders and + * indexes the rules into rules[]. Any given rule is stored once + * in ruleVector, and one or more times in rules[]. ruleVector + * owns and deletes the rules. + */ + UVector* ruleVector; + + /** + * Sorted and indexed table of rules. This is created by freeze() + * from the rules in ruleVector. It contains alias pointers to + * the rules in ruleVector. It is zero before freeze() is called + * and non-zero thereafter. + */ + TransliterationRule** rules; + + /** + * Index table. For text having a first character c, compute x = c&0xFF. + * Now use rules[index[x]..index[x+1]-1]. This index table is created by + * freeze(). Before freeze() is called it contains garbage. + */ + int32_t index[257]; + + /** + * Length of the longest preceding context + */ + int32_t maxContextLength; + +public: + + /** + * Construct a new empty rule set. + * @param status Output parameter filled in with success or failure status. + */ + TransliterationRuleSet(UErrorCode& status); + + /** + * Copy constructor. + */ + TransliterationRuleSet(const TransliterationRuleSet&); + + /** + * Destructor. + */ + virtual ~TransliterationRuleSet(); + + /** + * Change the data object that this rule belongs to. Used + * internally by the TransliterationRuleData copy constructor. + * @param data the new data value to be set. + */ + void setData(const TransliterationRuleData* data); + + /** + * Return the maximum context length. + * @return the length of the longest preceding context. + */ + virtual int32_t getMaximumContextLength() const; + + /** + * Add a rule to this set. Rules are added in order, and order is + * significant. The last call to this method must be followed by + * a call to freeze() before the rule set is used. + * This method must not be called after freeze() has been + * called. + * + * @param adoptedRule the rule to add + */ + virtual void addRule(TransliterationRule* adoptedRule, + UErrorCode& status); + + /** + * Check this for masked rules and index it to optimize performance. + * The sequence of operations is: (1) add rules to a set using + * addRule(); (2) freeze the set using + * freeze(); (3) use the rule set. If + * addRule() is called after calling this method, it + * invalidates this object, and this method must be called again. + * That is, freeze() may be called multiple times, + * although for optimal performance it shouldn't be. + * @param parseError A pointer to UParseError to receive information about errors + * occurred. + * @param status Output parameter filled in with success or failure status. + */ + virtual void freeze(UParseError& parseError, UErrorCode& status); + + /** + * Transliterate the given text with the given UTransPosition + * indices. Return true if the transliteration should continue + * or false if it should halt (because of a U_PARTIAL_MATCH match). + * Note that false is only ever returned if isIncremental is true. + * @param text the text to be transliterated + * @param index the position indices, which will be updated + * @param isIncremental if true, assume new text may be inserted + * at index.limit, and return false if thrre is a partial match. + * @return true unless a U_PARTIAL_MATCH has been obtained, + * indicating that transliteration should stop until more text + * arrives. + */ + UBool transliterate(Replaceable& text, + UTransPosition& index, + UBool isIncremental); + + /** + * Create rule strings that represents this rule set. + * @param result string to receive the rule strings. Current + * contents will be deleted. + * @param escapeUnprintable True, will escape the unprintable characters + * @return A reference to 'result'. + */ + virtual UnicodeString& toRules(UnicodeString& result, + UBool escapeUnprintable) const; + + /** + * Return the set of all characters that may be modified + * (getTarget=false) or emitted (getTarget=true) by this set. + */ + UnicodeSet& getSourceTargetSet(UnicodeSet& result, + UBool getTarget) const; + +private: + + TransliterationRuleSet &operator=(const TransliterationRuleSet &other); // forbid copying of this class +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp index 7cf1d37e5..e4d71436c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp @@ -25,42 +25,49 @@ U_NAMESPACE_BEGIN /** * A struct representing a time zone transition */ -struct Transition { +struct Transition : public UMemory { UDate time; TimeZoneRule* from; TimeZoneRule* to; }; +U_CDECL_BEGIN +static void U_CALLCONV +deleteTransition(void* obj) { + delete static_cast(obj); +} +U_CDECL_END + static UBool compareRules(UVector* rules1, UVector* rules2) { - if (rules1 == NULL && rules2 == NULL) { - return TRUE; - } else if (rules1 == NULL || rules2 == NULL) { - return FALSE; + if (rules1 == nullptr && rules2 == nullptr) { + return true; + } else if (rules1 == nullptr || rules2 == nullptr) { + return false; } int32_t size = rules1->size(); if (size != rules2->size()) { - return FALSE; + return false; } for (int32_t i = 0; i < size; i++) { TimeZoneRule *r1 = (TimeZoneRule*)rules1->elementAt(i); TimeZoneRule *r2 = (TimeZoneRule*)rules2->elementAt(i); if (*r1 != *r2) { - return FALSE; + return false; } } - return TRUE; + return true; } UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedTimeZone) RuleBasedTimeZone::RuleBasedTimeZone(const UnicodeString& id, InitialTimeZoneRule* initialRule) -: BasicTimeZone(id), fInitialRule(initialRule), fHistoricRules(NULL), fFinalRules(NULL), - fHistoricTransitions(NULL), fUpToDate(FALSE) { +: BasicTimeZone(id), fInitialRule(initialRule), fHistoricRules(nullptr), fFinalRules(nullptr), + fHistoricTransitions(nullptr), fUpToDate(false) { } RuleBasedTimeZone::RuleBasedTimeZone(const RuleBasedTimeZone& source) : BasicTimeZone(source), fInitialRule(source.fInitialRule->clone()), - fHistoricTransitions(NULL), fUpToDate(FALSE) { + fHistoricTransitions(nullptr), fUpToDate(false) { fHistoricRules = copyRules(source.fHistoricRules); fFinalRules = copyRules(source.fFinalRules); if (source.fUpToDate) { @@ -83,7 +90,7 @@ RuleBasedTimeZone::operator=(const RuleBasedTimeZone& right) { fHistoricRules = copyRules(right.fHistoricRules); fFinalRules = copyRules(right.fFinalRules); deleteTransitions(); - fUpToDate = FALSE; + fUpToDate = false; } return *this; } @@ -91,21 +98,20 @@ RuleBasedTimeZone::operator=(const RuleBasedTimeZone& right) { bool RuleBasedTimeZone::operator==(const TimeZone& that) const { if (this == &that) { - return TRUE; + return true; } - if (typeid(*this) != typeid(that) - || BasicTimeZone::operator==(that) == FALSE) { - return FALSE; + if (typeid(*this) != typeid(that) || !BasicTimeZone::operator==(that)) { + return false; } RuleBasedTimeZone *rbtz = (RuleBasedTimeZone*)&that; if (*fInitialRule != *(rbtz->fInitialRule)) { - return FALSE; + return false; } if (compareRules(fHistoricRules, rbtz->fHistoricRules) && compareRules(fFinalRules, rbtz->fFinalRules)) { - return TRUE; + return true; } - return FALSE; + return false; } bool @@ -115,35 +121,38 @@ RuleBasedTimeZone::operator!=(const TimeZone& that) const { void RuleBasedTimeZone::addTransitionRule(TimeZoneRule* rule, UErrorCode& status) { + LocalPointerlpRule(rule); if (U_FAILURE(status)) { return; } AnnualTimeZoneRule* atzrule = dynamic_cast(rule); - if (atzrule != NULL && atzrule->getEndYear() == AnnualTimeZoneRule::MAX_YEAR) { + if (atzrule != nullptr && atzrule->getEndYear() == AnnualTimeZoneRule::MAX_YEAR) { // A final rule - if (fFinalRules == NULL) { - fFinalRules = new UVector(status); + if (fFinalRules == nullptr) { + LocalPointer lpFinalRules(new UVector(uprv_deleteUObject, nullptr, status), status); if (U_FAILURE(status)) { return; } + fFinalRules = lpFinalRules.orphan(); } else if (fFinalRules->size() >= 2) { // Cannot handle more than two final rules status = U_INVALID_STATE_ERROR; return; } - fFinalRules->addElement((void*)rule, status); + fFinalRules->adoptElement(lpRule.orphan(), status); } else { // Non-final rule - if (fHistoricRules == NULL) { - fHistoricRules = new UVector(status); + if (fHistoricRules == nullptr) { + LocalPointer lpHistoricRules(new UVector(uprv_deleteUObject, nullptr, status), status); if (U_FAILURE(status)) { return; } + fHistoricRules = lpHistoricRules.orphan(); } - fHistoricRules->addElement((void*)rule, status); + fHistoricRules->adoptElement(lpRule.orphan(), status); } // Mark dirty, so transitions are recalculated at next complete() call - fUpToDate = FALSE; + fUpToDate = false; } @@ -171,36 +180,35 @@ RuleBasedTimeZone::complete(UErrorCode& status) { } // Make sure either no final rules or a pair of AnnualTimeZoneRules // are available. - if (fFinalRules != NULL && fFinalRules->size() != 2) { + if (fFinalRules != nullptr && fFinalRules->size() != 2) { status = U_INVALID_STATE_ERROR; return; } - UBool *done = NULL; // Create a TimezoneTransition and add to the list - if (fHistoricRules != NULL || fFinalRules != NULL) { + if (fHistoricRules != nullptr || fFinalRules != nullptr) { TimeZoneRule *curRule = fInitialRule; UDate lastTransitionTime = MIN_MILLIS; // Build the transition array which represents historical time zone // transitions. - if (fHistoricRules != NULL && fHistoricRules->size() > 0) { + if (fHistoricRules != nullptr && fHistoricRules->size() > 0) { int32_t i; int32_t historicCount = fHistoricRules->size(); - done = (UBool*)uprv_malloc(sizeof(UBool) * historicCount); - if (done == NULL) { + LocalMemory done((bool *)uprv_malloc(sizeof(bool) * historicCount)); + if (done == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; goto cleanup; } for (i = 0; i < historicCount; i++) { - done[i] = FALSE; + done[i] = false; } - while (TRUE) { + while (true) { int32_t curStdOffset = curRule->getRawOffset(); int32_t curDstSavings = curRule->getDSTSavings(); UDate nextTransitionTime = MAX_MILLIS; - TimeZoneRule *nextRule = NULL; - TimeZoneRule *r = NULL; + TimeZoneRule *nextRule = nullptr; + TimeZoneRule *r = nullptr; UBool avail; UDate tt; UnicodeString curName, name; @@ -214,7 +222,7 @@ RuleBasedTimeZone::complete(UErrorCode& status) { avail = r->getNextStart(lastTransitionTime, curStdOffset, curDstSavings, false, tt); if (!avail) { // No more transitions from this rule - skip this rule next time - done[i] = TRUE; + done[i] = true; } else { r->getName(name); if (*r == *curRule || @@ -229,12 +237,12 @@ RuleBasedTimeZone::complete(UErrorCode& status) { } } - if (nextRule == NULL) { + if (nextRule == nullptr) { // Check if all historic rules are done - UBool bDoneAll = TRUE; + UBool bDoneAll = true; for (int32_t j = 0; j < historicCount; j++) { if (!done[j]) { - bDoneAll = FALSE; + bDoneAll = false; break; } } @@ -243,7 +251,7 @@ RuleBasedTimeZone::complete(UErrorCode& status) { } } - if (fFinalRules != NULL) { + if (fFinalRules != nullptr) { // Check if one of final rules has earlier transition date for (i = 0; i < 2 /* fFinalRules->size() */; i++) { TimeZoneRule *fr = (TimeZoneRule*)fFinalRules->elementAt(i); @@ -261,26 +269,27 @@ RuleBasedTimeZone::complete(UErrorCode& status) { } } - if (nextRule == NULL) { + if (nextRule == nullptr) { // Nothing more break; } - if (fHistoricTransitions == NULL) { - fHistoricTransitions = new UVector(status); + if (fHistoricTransitions == nullptr) { + LocalPointer lpHistoricTransitions( + new UVector(deleteTransition, nullptr, status), status); if (U_FAILURE(status)) { goto cleanup; } + fHistoricTransitions = lpHistoricTransitions.orphan(); } - Transition *trst = (Transition*)uprv_malloc(sizeof(Transition)); - if (trst == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; + LocalPointer trst(new Transition, status); + if (U_FAILURE(status)) { goto cleanup; } trst->time = nextTransitionTime; trst->from = curRule; trst->to = nextRule; - fHistoricTransitions->addElement(trst, status); + fHistoricTransitions->adoptElement(trst.orphan(), status); if (U_FAILURE(status)) { goto cleanup; } @@ -288,12 +297,14 @@ RuleBasedTimeZone::complete(UErrorCode& status) { curRule = nextRule; } } - if (fFinalRules != NULL) { - if (fHistoricTransitions == NULL) { - fHistoricTransitions = new UVector(status); + if (fFinalRules != nullptr) { + if (fHistoricTransitions == nullptr) { + LocalPointer lpHistoricTransitions( + new UVector(deleteTransition, nullptr, status), status); if (U_FAILURE(status)) { goto cleanup; } + fHistoricTransitions = lpHistoricTransitions.orphan(); } // Append the first transition for each TimeZoneRule *rule0 = (TimeZoneRule*)fFinalRules->elementAt(0); @@ -306,16 +317,10 @@ RuleBasedTimeZone::complete(UErrorCode& status) { status = U_INVALID_STATE_ERROR; goto cleanup; } - Transition *final0 = (Transition*)uprv_malloc(sizeof(Transition)); - if (final0 == NULL) { - status = U_MEMORY_ALLOCATION_ERROR; - goto cleanup; - } - Transition *final1 = (Transition*)uprv_malloc(sizeof(Transition)); - if (final1 == NULL) { - uprv_free(final0); - status = U_MEMORY_ALLOCATION_ERROR; - goto cleanup; + LocalPointer final0(new Transition, status); + LocalPointer final1(new Transition, status); + if (U_FAILURE(status)) { + goto cleanup; } if (tt0 < tt1) { final0->time = tt0; @@ -332,28 +337,19 @@ RuleBasedTimeZone::complete(UErrorCode& status) { final1->from = rule1; final1->to = rule0; } - fHistoricTransitions->addElement(final0, status); - if (U_FAILURE(status)) { - goto cleanup; - } - fHistoricTransitions->addElement(final1, status); + fHistoricTransitions->adoptElement(final0.orphan(), status); + fHistoricTransitions->adoptElement(final1.orphan(), status); if (U_FAILURE(status)) { goto cleanup; } } } - fUpToDate = TRUE; - if (done != NULL) { - uprv_free(done); - } + fUpToDate = true; return; cleanup: deleteTransitions(); - if (done != NULL) { - uprv_free(done); - } - fUpToDate = FALSE; + fUpToDate = false; } RuleBasedTimeZone* @@ -390,7 +386,7 @@ RuleBasedTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t d } int32_t rawOffset, dstOffset; UDate time = (UDate)Grego::fieldsToDay(year, month, day) * U_MILLIS_PER_DAY + millis; - getOffsetInternal(time, TRUE, kDaylight, kStandard, rawOffset, dstOffset, status); + getOffsetInternal(time, true, kDaylight, kStandard, rawOffset, dstOffset, status); if (U_FAILURE(status)) { return 0; } @@ -403,10 +399,10 @@ RuleBasedTimeZone::getOffset(UDate date, UBool local, int32_t& rawOffset, getOffsetInternal(date, local, kFormer, kLatter, rawOffset, dstOffset, status); } -void -RuleBasedTimeZone::getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, - int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const { - getOffsetInternal(date, TRUE, nonExistingTimeOpt, duplicatedTimeOpt, rawOffset, dstOffset, status); +void RuleBasedTimeZone::getOffsetFromLocal(UDate date, UTimeZoneLocalOption nonExistingTimeOpt, + UTimeZoneLocalOption duplicatedTimeOpt, + int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const { + getOffsetInternal(date, true, nonExistingTimeOpt, duplicatedTimeOpt, rawOffset, dstOffset, status); } @@ -431,8 +427,8 @@ RuleBasedTimeZone::getOffsetInternal(UDate date, UBool local, status = U_INVALID_STATE_ERROR; return; } - const TimeZoneRule *rule = NULL; - if (fHistoricTransitions == NULL) { + const TimeZoneRule *rule = nullptr; + if (fHistoricTransitions == nullptr) { rule = fInitialRule; } else { UDate tstart = getTransitionTime((Transition*)fHistoricTransitions->elementAt(0), @@ -444,10 +440,10 @@ RuleBasedTimeZone::getOffsetInternal(UDate date, UBool local, UDate tend = getTransitionTime((Transition*)fHistoricTransitions->elementAt(idx), local, NonExistingTimeOpt, DuplicatedTimeOpt); if (date > tend) { - if (fFinalRules != NULL) { + if (fFinalRules != nullptr) { rule = findRuleInFinal(date, local, NonExistingTimeOpt, DuplicatedTimeOpt); } - if (rule == NULL) { + if (rule == nullptr) { // no final rules or the given time is before the first transition // specified by the final rules -> use the last rule rule = ((Transition*)fHistoricTransitions->elementAt(idx))->to; @@ -465,7 +461,7 @@ RuleBasedTimeZone::getOffsetInternal(UDate date, UBool local, } } } - if (rule != NULL) { + if (rule != nullptr) { rawOffset = rule->getRawOffset(); dstOffset = rule->getDSTSavings(); } @@ -478,68 +474,67 @@ RuleBasedTimeZone::setRawOffset(int32_t /*offsetMillis*/) { } int32_t -RuleBasedTimeZone::getRawOffset(void) const { +RuleBasedTimeZone::getRawOffset() const { // Note: This implementation returns standard GMT offset // as of current time. UErrorCode status = U_ZERO_ERROR; int32_t raw, dst; - getOffset(uprv_getUTCtime() * U_MILLIS_PER_SECOND, - FALSE, raw, dst, status); + getOffset(uprv_getUTCtime(), false, raw, dst, status); return raw; } UBool -RuleBasedTimeZone::useDaylightTime(void) const { +RuleBasedTimeZone::useDaylightTime() const { // Note: This implementation returns true when // daylight saving time is used as of now or // after the next transition. UErrorCode status = U_ZERO_ERROR; - UDate now = uprv_getUTCtime() * U_MILLIS_PER_SECOND; + UDate now = uprv_getUTCtime(); int32_t raw, dst; - getOffset(now, FALSE, raw, dst, status); + getOffset(now, false, raw, dst, status); if (dst != 0) { - return TRUE; + return true; } // If DST is not used now, check if DST is used after the next transition UDate time; TimeZoneRule *from, *to; - UBool avail = findNext(now, FALSE, time, from, to); + UBool avail = findNext(now, false, time, from, to); if (avail && to->getDSTSavings() != 0) { - return TRUE; + return true; } - return FALSE; + return false; } UBool RuleBasedTimeZone::inDaylightTime(UDate date, UErrorCode& status) const { if (U_FAILURE(status)) { - return FALSE; + return false; } int32_t raw, dst; - getOffset(date, FALSE, raw, dst, status); + getOffset(date, false, raw, dst, status); if (dst != 0) { - return TRUE; + return true; } - return FALSE; + return false; } UBool RuleBasedTimeZone::hasSameRules(const TimeZone& other) const { if (this == &other) { - return TRUE; + return true; } if (typeid(*this) != typeid(other)) { - return FALSE; + return false; } - const RuleBasedTimeZone& that = (const RuleBasedTimeZone&)other; + const RuleBasedTimeZone& that = static_cast(other); if (*fInitialRule != *(that.fInitialRule)) { - return FALSE; + return false; } if (compareRules(fHistoricRules, that.fHistoricRules) && compareRules(fFinalRules, that.fFinalRules)) { - return TRUE; + return true; } - return FALSE; + return false; } UBool @@ -547,18 +542,18 @@ RuleBasedTimeZone::getNextTransition(UDate base, UBool inclusive, TimeZoneTransi UErrorCode status = U_ZERO_ERROR; completeConst(status); if (U_FAILURE(status)) { - return FALSE; + return false; } UDate transitionTime; TimeZoneRule *fromRule, *toRule; UBool found = findNext(base, inclusive, transitionTime, fromRule, toRule); if (found) { result.setTime(transitionTime); - result.setFrom((const TimeZoneRule&)*fromRule); - result.setTo((const TimeZoneRule&)*toRule); - return TRUE; + result.setFrom(*fromRule); + result.setTo(*toRule); + return true; } - return FALSE; + return false; } UBool @@ -566,27 +561,27 @@ RuleBasedTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTr UErrorCode status = U_ZERO_ERROR; completeConst(status); if (U_FAILURE(status)) { - return FALSE; + return false; } UDate transitionTime; TimeZoneRule *fromRule, *toRule; UBool found = findPrev(base, inclusive, transitionTime, fromRule, toRule); if (found) { result.setTime(transitionTime); - result.setFrom((const TimeZoneRule&)*fromRule); - result.setTo((const TimeZoneRule&)*toRule); - return TRUE; + result.setFrom(*fromRule); + result.setTo(*toRule); + return true; } - return FALSE; + return false; } int32_t RuleBasedTimeZone::countTransitionRules(UErrorCode& /*status*/) const { int32_t count = 0; - if (fHistoricRules != NULL) { + if (fHistoricRules != nullptr) { count += fHistoricRules->size(); } - if (fFinalRules != NULL) { + if (fFinalRules != nullptr) { count += fFinalRules->size(); } return count; @@ -606,14 +601,14 @@ RuleBasedTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial, // Transition rules int32_t cnt = 0; int32_t idx; - if (fHistoricRules != NULL && cnt < trscount) { + if (fHistoricRules != nullptr && cnt < trscount) { int32_t historicCount = fHistoricRules->size(); idx = 0; while (cnt < trscount && idx < historicCount) { trsrules[cnt++] = (const TimeZoneRule*)fHistoricRules->elementAt(idx++); } } - if (fFinalRules != NULL && cnt < trscount) { + if (fFinalRules != nullptr && cnt < trscount) { int32_t finalCount = fFinalRules->size(); idx = 0; while (cnt < trscount && idx < finalCount) { @@ -625,78 +620,60 @@ RuleBasedTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial, } void -RuleBasedTimeZone::deleteRules(void) { +RuleBasedTimeZone::deleteRules() { delete fInitialRule; - fInitialRule = NULL; - if (fHistoricRules != NULL) { - while (!fHistoricRules->isEmpty()) { - delete (TimeZoneRule*)(fHistoricRules->orphanElementAt(0)); - } + fInitialRule = nullptr; + if (fHistoricRules != nullptr) { delete fHistoricRules; - fHistoricRules = NULL; + fHistoricRules = nullptr; } - if (fFinalRules != NULL) { - while (!fFinalRules->isEmpty()) { - delete (AnnualTimeZoneRule*)(fFinalRules->orphanElementAt(0)); - } + if (fFinalRules != nullptr) { delete fFinalRules; - fFinalRules = NULL; + fFinalRules = nullptr; } } void -RuleBasedTimeZone::deleteTransitions(void) { - if (fHistoricTransitions != NULL) { - while (!fHistoricTransitions->isEmpty()) { - Transition *trs = (Transition*)fHistoricTransitions->orphanElementAt(0); - uprv_free(trs); - } +RuleBasedTimeZone::deleteTransitions() { + if (fHistoricTransitions != nullptr) { delete fHistoricTransitions; } - fHistoricTransitions = NULL; + fHistoricTransitions = nullptr; } UVector* RuleBasedTimeZone::copyRules(UVector* source) { - if (source == NULL) { - return NULL; + if (source == nullptr) { + return nullptr; } UErrorCode ec = U_ZERO_ERROR; int32_t size = source->size(); - UVector *rules = new UVector(size, ec); + LocalPointer rules(new UVector(uprv_deleteUObject, nullptr, size, ec), ec); if (U_FAILURE(ec)) { - return NULL; + return nullptr; } int32_t i; for (i = 0; i < size; i++) { - rules->addElement(((TimeZoneRule*)source->elementAt(i))->clone(), ec); + LocalPointer rule(((TimeZoneRule*)source->elementAt(i))->clone(), ec); + rules->adoptElement(rule.orphan(), ec); if (U_FAILURE(ec)) { - break; - } - } - if (U_FAILURE(ec)) { - // In case of error, clean up - for (i = 0; i < rules->size(); i++) { - TimeZoneRule *rule = (TimeZoneRule*)rules->orphanElementAt(i); - delete rule; + return nullptr; } - delete rules; - return NULL; } - return rules; + return rules.orphan(); } TimeZoneRule* RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local, int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const { - if (fFinalRules == NULL) { - return NULL; + if (fFinalRules == nullptr) { + return nullptr; } AnnualTimeZoneRule* fr0 = (AnnualTimeZoneRule*)fFinalRules->elementAt(0); AnnualTimeZoneRule* fr1 = (AnnualTimeZoneRule*)fFinalRules->elementAt(1); - if (fr0 == NULL || fr1 == NULL) { - return NULL; + if (fr0 == nullptr || fr1 == nullptr) { + return nullptr; } UDate start0, start1; @@ -710,7 +687,7 @@ RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local, NonExistingTimeOpt, DuplicatedTimeOpt); base -= localDelta; } - UBool avail0 = fr0->getPreviousStart(base, fr1->getRawOffset(), fr1->getDSTSavings(), TRUE, start0); + UBool avail0 = fr0->getPreviousStart(base, fr1->getRawOffset(), fr1->getDSTSavings(), true, start0); base = date; if (local) { @@ -719,7 +696,7 @@ RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local, NonExistingTimeOpt, DuplicatedTimeOpt); base -= localDelta; } - UBool avail1 = fr1->getPreviousStart(base, fr0->getRawOffset(), fr0->getDSTSavings(), TRUE, start1); + UBool avail1 = fr1->getPreviousStart(base, fr0->getRawOffset(), fr0->getDSTSavings(), true, start1); if (!avail0 || !avail1) { if (avail0) { @@ -728,7 +705,7 @@ RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local, return fr1; } // Both rules take effect after the given time - return NULL; + return nullptr; } return (start0 > start1) ? fr0 : fr1; @@ -737,35 +714,35 @@ RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local, UBool RuleBasedTimeZone::findNext(UDate base, UBool inclusive, UDate& transitionTime, TimeZoneRule*& fromRule, TimeZoneRule*& toRule) const { - if (fHistoricTransitions == NULL) { - return FALSE; + if (fHistoricTransitions == nullptr) { + return false; } - UBool isFinal = FALSE; - UBool found = FALSE; + UBool isFinal = false; + UBool found = false; Transition result; Transition *tzt = (Transition*)fHistoricTransitions->elementAt(0); UDate tt = tzt->time; if (tt > base || (inclusive && tt == base)) { result = *tzt; - found = TRUE; + found = true; } else { int32_t idx = fHistoricTransitions->size() - 1; tzt = (Transition*)fHistoricTransitions->elementAt(idx); tt = tzt->time; if (inclusive && tt == base) { result = *tzt; - found = TRUE; + found = true; } else if (tt <= base) { - if (fFinalRules != NULL) { + if (fFinalRules != nullptr) { // Find a transion time with finalRules TimeZoneRule *r0 = (TimeZoneRule*)fFinalRules->elementAt(0); TimeZoneRule *r1 = (TimeZoneRule*)fFinalRules->elementAt(1); UDate start0, start1; UBool avail0 = r0->getNextStart(base, r1->getRawOffset(), r1->getDSTSavings(), inclusive, start0); UBool avail1 = r1->getNextStart(base, r0->getRawOffset(), r0->getDSTSavings(), inclusive, start1); - // avail0/avail1 should be always TRUE + // avail0/avail1 should be always true if (!avail0 && !avail1) { - return FALSE; + return false; } if (!avail1 || start0 < start1) { result.time = start0; @@ -776,8 +753,8 @@ RuleBasedTimeZone::findNext(UDate base, UBool inclusive, UDate& transitionTime, result.from = r0; result.to = r1; } - isFinal = TRUE; - found = TRUE; + isFinal = true; + found = true; } } else { // Find a transition within the historic transitions @@ -795,7 +772,7 @@ RuleBasedTimeZone::findNext(UDate base, UBool inclusive, UDate& transitionTime, result.time = prev->time; result.from = prev->from; result.to = prev->to; - found = TRUE; + found = true; } } if (found) { @@ -803,52 +780,52 @@ RuleBasedTimeZone::findNext(UDate base, UBool inclusive, UDate& transitionTime, if (result.from->getRawOffset() == result.to->getRawOffset() && result.from->getDSTSavings() == result.to->getDSTSavings()) { if (isFinal) { - return FALSE; + return false; } else { // No offset changes. Try next one if not final - return findNext(result.time, FALSE /* always exclusive */, + return findNext(result.time, false /* always exclusive */, transitionTime, fromRule, toRule); } } transitionTime = result.time; fromRule = result.from; toRule = result.to; - return TRUE; + return true; } - return FALSE; + return false; } UBool RuleBasedTimeZone::findPrev(UDate base, UBool inclusive, UDate& transitionTime, TimeZoneRule*& fromRule, TimeZoneRule*& toRule) const { - if (fHistoricTransitions == NULL) { - return FALSE; + if (fHistoricTransitions == nullptr) { + return false; } - UBool found = FALSE; + UBool found = false; Transition result; Transition *tzt = (Transition*)fHistoricTransitions->elementAt(0); UDate tt = tzt->time; if (inclusive && tt == base) { result = *tzt; - found = TRUE; + found = true; } else if (tt < base) { int32_t idx = fHistoricTransitions->size() - 1; tzt = (Transition*)fHistoricTransitions->elementAt(idx); tt = tzt->time; if (inclusive && tt == base) { result = *tzt; - found = TRUE; + found = true; } else if (tt < base) { - if (fFinalRules != NULL) { + if (fFinalRules != nullptr) { // Find a transion time with finalRules TimeZoneRule *r0 = (TimeZoneRule*)fFinalRules->elementAt(0); TimeZoneRule *r1 = (TimeZoneRule*)fFinalRules->elementAt(1); UDate start0, start1; UBool avail0 = r0->getPreviousStart(base, r1->getRawOffset(), r1->getDSTSavings(), inclusive, start0); UBool avail1 = r1->getPreviousStart(base, r0->getRawOffset(), r0->getDSTSavings(), inclusive, start1); - // avail0/avail1 should be always TRUE + // avail0/avail1 should be always true if (!avail0 && !avail1) { - return FALSE; + return false; } if (!avail1 || start0 > start1) { result.time = start0; @@ -862,7 +839,7 @@ RuleBasedTimeZone::findPrev(UDate base, UBool inclusive, UDate& transitionTime, } else { result = *tzt; } - found = TRUE; + found = true; } else { // Find a transition within the historic transitions idx--; @@ -875,7 +852,7 @@ RuleBasedTimeZone::findPrev(UDate base, UBool inclusive, UDate& transitionTime, idx--; } result = *tzt; - found = TRUE; + found = true; } } if (found) { @@ -883,15 +860,15 @@ RuleBasedTimeZone::findPrev(UDate base, UBool inclusive, UDate& transitionTime, if (result.from->getRawOffset() == result.to->getRawOffset() && result.from->getDSTSavings() == result.to->getDSTSavings()) { // No offset changes. Try next one if not final - return findPrev(result.time, FALSE /* always exclusive */, + return findPrev(result.time, false /* always exclusive */, transitionTime, fromRule, toRule); } transitionTime = result.time; fromRule = result.from; toRule = result.to; - return TRUE; + return true; } - return FALSE; + return false; } UDate diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/region.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/region.cpp index 0d9e7a1b7..26440b659 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/region.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/region.cpp @@ -39,37 +39,32 @@ U_CDECL_BEGIN -static void U_CALLCONV -deleteRegion(void *obj) { - delete (icu::Region *)obj; -} - /** * Cleanup callback func */ -static UBool U_CALLCONV region_cleanup(void) +static UBool U_CALLCONV region_cleanup() { icu::Region::cleanupRegionData(); - return TRUE; + return true; } U_CDECL_END U_NAMESPACE_BEGIN -static UInitOnce gRegionDataInitOnce = U_INITONCE_INITIALIZER; +static UInitOnce gRegionDataInitOnce {}; static UVector* availableRegions[URGN_LIMIT]; -static UHashtable *regionAliases = NULL; -static UHashtable *regionIDMap = NULL; -static UHashtable *numericCodeMap = NULL; -static UVector *allRegions = NULL; +static UHashtable *regionAliases = nullptr; +static UHashtable *regionIDMap = nullptr; +static UHashtable *numericCodeMap = nullptr; +static UVector *allRegions = nullptr; -static const UChar UNKNOWN_REGION_ID [] = { 0x5A, 0x5A, 0 }; /* "ZZ" */ -static const UChar OUTLYING_OCEANIA_REGION_ID [] = { 0x51, 0x4F, 0 }; /* "QO" */ -static const UChar WORLD_ID [] = { 0x30, 0x30, 0x31, 0 }; /* "001" */ -static const UChar RANGE_MARKER = 0x7E; /* '~' */ +static const char16_t UNKNOWN_REGION_ID [] = { 0x5A, 0x5A, 0 }; /* "ZZ" */ +static const char16_t OUTLYING_OCEANIA_REGION_ID [] = { 0x51, 0x4F, 0 }; /* "QO" */ +static const char16_t WORLD_ID [] = { 0x30, 0x30, 0x31, 0 }; /* "001" */ +static const char16_t RANGE_MARKER = 0x7E; /* '~' */ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegionNameEnumeration) @@ -84,100 +79,93 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegionNameEnumeration) void U_CALLCONV Region::loadRegionData(UErrorCode &status) { // Construct service objs first - LocalUHashtablePointer newRegionIDMap(uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status)); - LocalUHashtablePointer newNumericCodeMap(uhash_open(uhash_hashLong,uhash_compareLong,NULL,&status)); - LocalUHashtablePointer newRegionAliases(uhash_open(uhash_hashUnicodeString,uhash_compareUnicodeString,NULL,&status)); + LocalUHashtablePointer newRegionIDMap(uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, &status)); + LocalUHashtablePointer newNumericCodeMap(uhash_open(uhash_hashLong,uhash_compareLong,nullptr,&status)); + LocalUHashtablePointer newRegionAliases(uhash_open(uhash_hashUnicodeString,uhash_compareUnicodeString,nullptr,&status)); LocalPointer continents(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); LocalPointer groupings(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); - allRegions = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status); + LocalPointer lpAllRegions(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); + allRegions = lpAllRegions.orphan(); - LocalUResourceBundlePointer metadata(ures_openDirect(NULL,"metadata",&status)); - LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(),"alias",NULL,&status)); - LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(),"territory",NULL,&status)); + LocalUResourceBundlePointer metadata(ures_openDirect(nullptr,"metadata",&status)); + LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(),"alias",nullptr,&status)); + LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(),"territory",nullptr,&status)); - LocalUResourceBundlePointer supplementalData(ures_openDirect(NULL,"supplementalData",&status)); - LocalUResourceBundlePointer codeMappings(ures_getByKey(supplementalData.getAlias(),"codeMappings",NULL,&status)); + LocalUResourceBundlePointer supplementalData(ures_openDirect(nullptr,"supplementalData",&status)); + LocalUResourceBundlePointer codeMappings(ures_getByKey(supplementalData.getAlias(),"codeMappings",nullptr,&status)); - LocalUResourceBundlePointer idValidity(ures_getByKey(supplementalData.getAlias(),"idValidity",NULL,&status)); - LocalUResourceBundlePointer regionList(ures_getByKey(idValidity.getAlias(),"region",NULL,&status)); - LocalUResourceBundlePointer regionRegular(ures_getByKey(regionList.getAlias(),"regular",NULL,&status)); - LocalUResourceBundlePointer regionMacro(ures_getByKey(regionList.getAlias(),"macroregion",NULL,&status)); - LocalUResourceBundlePointer regionUnknown(ures_getByKey(regionList.getAlias(),"unknown",NULL,&status)); + LocalUResourceBundlePointer idValidity(ures_getByKey(supplementalData.getAlias(),"idValidity",nullptr,&status)); + LocalUResourceBundlePointer regionList(ures_getByKey(idValidity.getAlias(),"region",nullptr,&status)); + LocalUResourceBundlePointer regionRegular(ures_getByKey(regionList.getAlias(),"regular",nullptr,&status)); + LocalUResourceBundlePointer regionMacro(ures_getByKey(regionList.getAlias(),"macroregion",nullptr,&status)); + LocalUResourceBundlePointer regionUnknown(ures_getByKey(regionList.getAlias(),"unknown",nullptr,&status)); - LocalUResourceBundlePointer territoryContainment(ures_getByKey(supplementalData.getAlias(),"territoryContainment",NULL,&status)); - LocalUResourceBundlePointer worldContainment(ures_getByKey(territoryContainment.getAlias(),"001",NULL,&status)); - LocalUResourceBundlePointer groupingContainment(ures_getByKey(territoryContainment.getAlias(),"grouping",NULL,&status)); + LocalUResourceBundlePointer territoryContainment(ures_getByKey(supplementalData.getAlias(),"territoryContainment",nullptr,&status)); + LocalUResourceBundlePointer worldContainment(ures_getByKey(territoryContainment.getAlias(),"001",nullptr,&status)); + LocalUResourceBundlePointer groupingContainment(ures_getByKey(territoryContainment.getAlias(),"grouping",nullptr,&status)); + ucln_i18n_registerCleanup(UCLN_I18N_REGION, region_cleanup); if (U_FAILURE(status)) { return; } // now, initialize - uhash_setValueDeleter(newRegionIDMap.getAlias(), deleteRegion); // regionIDMap owns objs - uhash_setKeyDeleter(newRegionAliases.getAlias(), uprv_deleteUObject); // regionAliases owns the string keys + uhash_setValueDeleter(newRegionIDMap.getAlias(), uprv_deleteUObject); // regionIDMap owns objs + uhash_setKeyDeleter(newRegionAliases.getAlias(), uprv_deleteUObject); // regionAliases owns the string keys - while ( ures_hasNext(regionRegular.getAlias()) ) { - UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),NULL,&status); + while (U_SUCCESS(status) && ures_hasNext(regionRegular.getAlias())) { + UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),nullptr,&status); int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER); - UChar buf[6]; + char16_t buf[6]; regionName.extract(buf,6,status); if ( rangeMarkerLocation > 0 ) { - UChar endRange = regionName.charAt(rangeMarkerLocation+1); + char16_t endRange = regionName.charAt(rangeMarkerLocation+1); buf[rangeMarkerLocation] = 0; - while ( buf[rangeMarkerLocation-1] <= endRange ) { + while (U_SUCCESS(status) && buf[rangeMarkerLocation-1] <= endRange) { LocalPointer newRegion(new UnicodeString(buf), status); - allRegions->addElement(newRegion.orphan(),status); + allRegions->adoptElement(newRegion.orphan(), status); buf[rangeMarkerLocation-1]++; } } else { LocalPointer newRegion(new UnicodeString(regionName), status); - allRegions->addElement(newRegion.orphan(),status); + allRegions->adoptElement(newRegion.orphan(), status); } } - while ( ures_hasNext(regionMacro.getAlias()) ) { - UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),NULL,&status); + while (U_SUCCESS(status) && ures_hasNext(regionMacro.getAlias())) { + UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),nullptr,&status); int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER); - UChar buf[6]; + char16_t buf[6]; regionName.extract(buf,6,status); if ( rangeMarkerLocation > 0 ) { - UChar endRange = regionName.charAt(rangeMarkerLocation+1); + char16_t endRange = regionName.charAt(rangeMarkerLocation+1); buf[rangeMarkerLocation] = 0; - while ( buf[rangeMarkerLocation-1] <= endRange ) { + while ( buf[rangeMarkerLocation-1] <= endRange && U_SUCCESS(status)) { LocalPointer newRegion(new UnicodeString(buf), status); - allRegions->addElement(newRegion.orphan(),status); + allRegions->adoptElement(newRegion.orphan(),status); buf[rangeMarkerLocation-1]++; } } else { LocalPointer newRegion(new UnicodeString(regionName), status); - allRegions->addElement(newRegion.orphan(),status); + allRegions->adoptElement(newRegion.orphan(),status); } } - while ( ures_hasNext(regionUnknown.getAlias()) ) { - LocalPointer regionName (new UnicodeString(ures_getNextUnicodeString(regionUnknown.getAlias(),NULL,&status),status)); - allRegions->addElement(regionName.orphan(),status); + while (U_SUCCESS(status) && ures_hasNext(regionUnknown.getAlias())) { + LocalPointer regionName ( + new UnicodeString(ures_getNextUnicodeString(regionUnknown.getAlias(), nullptr, &status), status)); + allRegions->adoptElement(regionName.orphan(),status); } - while ( ures_hasNext(worldContainment.getAlias()) ) { - UnicodeString *continentName = new UnicodeString(ures_getNextUnicodeString(worldContainment.getAlias(),NULL,&status)); - continents->addElement(continentName,status); + while (U_SUCCESS(status) && ures_hasNext(worldContainment.getAlias())) { + UnicodeString *continentName = new UnicodeString(ures_getNextUnicodeString(worldContainment.getAlias(),nullptr,&status)); + continents->adoptElement(continentName,status); } - - UResourceBundle *groupingBundle = nullptr; - while ( ures_hasNext(groupingContainment.getAlias()) ) { - groupingBundle = ures_getNextResource(groupingContainment.getAlias(), groupingBundle, &status); - if (U_FAILURE(status)) { - break; - } - UnicodeString *groupingName = new UnicodeString(ures_getKey(groupingBundle), -1, US_INV); - if (groupingName) { - groupings->addElement(groupingName,status); - } + if (U_FAILURE(status)) { + return; } - ures_close(groupingBundle); for ( int32_t i = 0 ; i < allRegions->size() ; i++ ) { LocalPointer r(new Region(), status); @@ -203,21 +191,54 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { uhash_put(newRegionIDMap.getAlias(),idStrAlias,(void *)(r.orphan()),&status); // regionIDMap takes ownership } + UResourceBundle *groupingBundle = nullptr; + while (U_SUCCESS(status) && ures_hasNext(groupingContainment.getAlias())) { + groupingBundle = ures_getNextResource(groupingContainment.getAlias(), groupingBundle, &status); + if (U_FAILURE(status)) { + break; + } + UnicodeString *groupingName = new UnicodeString(ures_getKey(groupingBundle), -1, US_INV); + LocalPointer lpGroupingName(groupingName, status); + groupings->adoptElement(lpGroupingName.orphan(), status); + if (U_FAILURE(status)) { + break; + } + Region *grouping = (Region *) uhash_get(newRegionIDMap.getAlias(), groupingName); + if (grouping != nullptr) { + for (int32_t i = 0; i < ures_getSize(groupingBundle) && U_SUCCESS(status); i++) { + UnicodeString child = ures_getUnicodeStringByIndex(groupingBundle, i, &status); + if (U_SUCCESS(status)) { + if (grouping->containedRegions == nullptr) { + LocalPointer lpContainedRegions( + new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); + grouping->containedRegions = lpContainedRegions.orphan(); + if (U_FAILURE(status)) { + break; + } + } + LocalPointer lpChildCopy(new UnicodeString(child), status); + grouping->containedRegions->adoptElement(lpChildCopy.orphan(), status); + } + } + } + } + ures_close(groupingBundle); + // Process the territory aliases - while ( ures_hasNext(territoryAlias.getAlias()) ) { - LocalUResourceBundlePointer res(ures_getNextResource(territoryAlias.getAlias(),NULL,&status)); + while (U_SUCCESS(status) && ures_hasNext(territoryAlias.getAlias())) { + LocalUResourceBundlePointer res(ures_getNextResource(territoryAlias.getAlias(),nullptr,&status)); const char *aliasFrom = ures_getKey(res.getAlias()); LocalPointer aliasFromStr(new UnicodeString(aliasFrom, -1, US_INV), status); UnicodeString aliasTo = ures_getUnicodeStringByKey(res.getAlias(),"replacement",&status); - res.adoptInstead(NULL); + res.adoptInstead(nullptr); const Region *aliasToRegion = (Region *) uhash_get(newRegionIDMap.getAlias(),&aliasTo); Region *aliasFromRegion = (Region *)uhash_get(newRegionIDMap.getAlias(),aliasFromStr.getAlias()); - if ( aliasToRegion != NULL && aliasFromRegion == NULL ) { // This is just an alias from some string to a region + if ( aliasToRegion != nullptr && aliasFromRegion == nullptr ) { // This is just an alias from some string to a region uhash_put(newRegionAliases.getAlias(),(void *)aliasFromStr.orphan(), (void *)aliasToRegion,&status); } else { - if ( aliasFromRegion == NULL ) { // Deprecated region code not in the master codes list - so need to create a deprecated region for it. + if ( aliasFromRegion == nullptr ) { // Deprecated region code not in the primary codes list - so need to create a deprecated region for it. LocalPointer newRgn(new Region, status); if ( U_SUCCESS(status) ) { aliasFromRegion = newRgn.orphan(); @@ -249,7 +270,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { } UnicodeString currentRegion; //currentRegion.remove(); TODO: was already 0 length? - for (int32_t i = 0 ; i < aliasTo.length() ; i++ ) { + for (int32_t i = 0 ; i < aliasTo.length() && U_SUCCESS(status); i++ ) { if ( aliasTo.charAt(i) != 0x0020 ) { currentRegion.append(aliasTo.charAt(i)); } @@ -257,7 +278,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { Region *target = (Region *)uhash_get(newRegionIDMap.getAlias(),(void *)¤tRegion); if (target) { LocalPointer preferredValue(new UnicodeString(target->idStr), status); - aliasFromRegion->preferredValues->addElement((void *)preferredValue.orphan(),status); // may add null if err + aliasFromRegion->preferredValues->adoptElement(preferredValue.orphan(),status); // may add null if err } currentRegion.remove(); } @@ -266,9 +287,9 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { } // Process the code mappings - This will allow us to assign numeric codes to most of the territories. - while ( ures_hasNext(codeMappings.getAlias()) ) { - UResourceBundle *mapping = ures_getNextResource(codeMappings.getAlias(),NULL,&status); - if ( ures_getType(mapping) == URES_ARRAY && ures_getSize(mapping) == 3) { + while (U_SUCCESS(status) && ures_hasNext(codeMappings.getAlias())) { + UResourceBundle *mapping = ures_getNextResource(codeMappings.getAlias(),nullptr,&status); + if (U_SUCCESS(status) && ures_getType(mapping) == URES_ARRAY && ures_getSize(mapping) == 3) { UnicodeString codeMappingID = ures_getUnicodeStringByIndex(mapping,0,&status); UnicodeString codeMappingNumber = ures_getUnicodeStringByIndex(mapping,1,&status); UnicodeString codeMapping3Letter = ures_getUnicodeStringByIndex(mapping,2,&status); @@ -327,7 +348,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { // Load territory containment info from the supplemental data. while ( ures_hasNext(territoryContainment.getAlias()) ) { - LocalUResourceBundlePointer mapping(ures_getNextResource(territoryContainment.getAlias(),NULL,&status)); + LocalUResourceBundlePointer mapping(ures_getNextResource(territoryContainment.getAlias(),nullptr,&status)); if( U_FAILURE(status) ) { return; // error out } @@ -342,19 +363,27 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { for ( int j = 0 ; j < ures_getSize(mapping.getAlias()); j++ ) { UnicodeString child = ures_getUnicodeStringByIndex(mapping.getAlias(),j,&status); Region *childRegion = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&child); - if ( parentRegion != NULL && childRegion != NULL ) { + if ( parentRegion != nullptr && childRegion != nullptr ) { // Add the child region to the set of regions contained by the parent - if (parentRegion->containedRegions == NULL) { - parentRegion->containedRegions = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status); + if (parentRegion->containedRegions == nullptr) { + LocalPointer lpContainedRegions( + new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); + parentRegion->containedRegions = lpContainedRegions.orphan(); + if (U_FAILURE(status)) { + return; + } } LocalPointer childStr(new UnicodeString(), status); - if( U_FAILURE(status) ) { + if (U_FAILURE(status)) { return; // error out } childStr->fastCopyFrom(childRegion->idStr); - parentRegion->containedRegions->addElement((void *)childStr.orphan(),status); + parentRegion->containedRegions->adoptElement(childStr.orphan(),status); + if (U_FAILURE(status)) { + return; + } // Set the parent region to be the containing region of the child. // Regions of type GROUPING can't be set as the parent, since another region @@ -370,7 +399,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { int32_t pos = UHASH_FIRST; while ( const UHashElement* element = uhash_nextElement(newRegionIDMap.getAlias(),&pos)) { Region *ar = (Region *)element->value.pointer; - if ( availableRegions[ar->fType] == NULL ) { + if ( availableRegions[ar->fType] == nullptr ) { LocalPointer newAr(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); availableRegions[ar->fType] = newAr.orphan(); } @@ -378,10 +407,9 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) { if( U_FAILURE(status) ) { return; // error out } - availableRegions[ar->fType]->addElement((void *)arString.orphan(),status); + availableRegions[ar->fType]->adoptElement(arString.orphan(), status); } - ucln_i18n_registerCleanup(UCLN_I18N_REGION, region_cleanup); // copy hashtables numericCodeMap = newNumericCodeMap.orphan(); regionIDMap = newRegionIDMap.orphan(); @@ -392,6 +420,7 @@ void Region::cleanupRegionData() { for (int32_t i = 0 ; i < URGN_LIMIT ; i++ ) { if ( availableRegions[i] ) { delete availableRegions[i]; + availableRegions[i] = nullptr; } } @@ -407,12 +436,11 @@ void Region::cleanupRegionData() { uhash_close(regionIDMap); } if (allRegions) { - allRegions->removeAllElements(); // Don't need the temporary list anymore. delete allRegions; - allRegions = NULL; + allRegions = nullptr; } - regionAliases = numericCodeMap = regionIDMap = NULL; + regionAliases = numericCodeMap = regionIDMap = nullptr; gRegionDataInitOnce.reset(); } @@ -420,9 +448,9 @@ void Region::cleanupRegionData() { Region::Region () : code(-1), fType(URGN_UNKNOWN), - containingRegion(NULL), - containedRegions(NULL), - preferredValues(NULL) { + containingRegion(nullptr), + containedRegions(nullptr), + preferredValues(nullptr) { id[0] = 0; } @@ -457,19 +485,19 @@ Region::operator!=(const Region &that) const { * Returns a pointer to a Region using the given region code. The region code can be either 2-letter ISO code, * 3-letter ISO code, UNM.49 numeric code, or other valid Unicode Region Code as defined by the LDML specification. * The identifier will be canonicalized internally using the supplemental metadata as defined in the CLDR. - * If the region code is NULL or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ) + * If the region code is nullptr or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ) */ const Region* U_EXPORT2 Region::getInstance(const char *region_code, UErrorCode &status) { umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } if ( !region_code ) { status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } UnicodeString regionCodeString = UnicodeString(region_code, -1, US_INV); @@ -481,7 +509,7 @@ Region::getInstance(const char *region_code, UErrorCode &status) { if ( !r ) { // Unknown region code status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) { @@ -505,7 +533,7 @@ Region::getInstance (int32_t code, UErrorCode &status) { umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } Region *r = (Region *)uhash_iget(numericCodeMap,code); @@ -517,12 +545,12 @@ Region::getInstance (int32_t code, UErrorCode &status) { } if( U_FAILURE(status) ) { - return NULL; + return nullptr; } if ( !r ) { status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) { @@ -544,13 +572,13 @@ StringEnumeration* U_EXPORT2 Region::getAvailable(URegionType type, UErrorCode &status) { umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status) if (U_FAILURE(status)) { - return NULL; + return nullptr; } return new RegionNameEnumeration(availableRegions[type],status); } /** - * Returns a pointer to the region that contains this region. Returns NULL if this region is code "001" (World) + * Returns a pointer to the region that contains this region. Returns nullptr if this region is code "001" (World) * or "ZZ" (Unknown region). For example, calling this method with region "IT" (Italy) returns the * region "039" (Southern Europe). */ @@ -563,17 +591,17 @@ Region::getContainingRegion() const { /** * Return a pointer to the region that geographically contains this region and matches the given type, - * moving multiple steps up the containment chain if necessary. Returns NULL if no containing region can be found + * moving multiple steps up the containment chain if necessary. Returns nullptr if no containing region can be found * that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "URGN_DEPRECATED", or "URGN_UNKNOWN" - * are not appropriate for use in this API. NULL will be returned in this case. For example, calling this method + * are not appropriate for use in this API. nullptr will be returned in this case. For example, calling this method * with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "150" ( Europe ). */ const Region* Region::getContainingRegion(URegionType type) const { UErrorCode status = U_ZERO_ERROR; umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); - if ( containingRegion == NULL ) { - return NULL; + if ( containingRegion == nullptr ) { + return nullptr; } return ( containingRegion->fType == type)? containingRegion: containingRegion->getContainingRegion(type); @@ -582,7 +610,7 @@ Region::getContainingRegion(URegionType type) const { /** * Return an enumeration over the IDs of all the regions that are immediate children of this region in the * region hierarchy. These returned regions could be either macro regions, territories, or a mixture of the two, - * depending on the containment data as defined in CLDR. This API may return NULL if this region doesn't have + * depending on the containment data as defined in CLDR. This API may return nullptr if this region doesn't have * any sub-regions. For example, calling this method with region "150" (Europe) returns an enumeration containing * the various sub regions of Europe - "039" (Southern Europe) - "151" (Eastern Europe) - "154" (Northern Europe) * and "155" (Western Europe). @@ -591,7 +619,7 @@ StringEnumeration* Region::getContainedRegions(UErrorCode &status) const { umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status) if (U_FAILURE(status)) { - return NULL; + return nullptr; } return new RegionNameEnumeration(containedRegions,status); } @@ -605,33 +633,30 @@ Region::getContainedRegions(UErrorCode &status) const { StringEnumeration* Region::getContainedRegions( URegionType type, UErrorCode &status ) const { umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status) + + UVector result(nullptr, uhash_compareChars, status); + LocalPointer cr(getContainedRegions(status), status); if (U_FAILURE(status)) { - return NULL; + return nullptr; } - UVector *result = new UVector(NULL, uhash_compareChars, status); - - StringEnumeration *cr = getContainedRegions(status); - - for ( int32_t i = 0 ; i < cr->count(status) ; i++ ) { - const char *regionId = cr->next(NULL,status); - const Region *r = Region::getInstance(regionId,status); + const char *regionId; + while((regionId = cr->next(nullptr, status)) != nullptr && U_SUCCESS(status)) { + const Region *r = Region::getInstance(regionId, status); if ( r->getType() == type) { - result->addElement((void *)&r->idStr,status); + result.addElement(const_cast(&r->idStr), status); } else { - StringEnumeration *children = r->getContainedRegions(type, status); - for ( int32_t j = 0 ; j < children->count(status) ; j++ ) { - const char *id2 = children->next(NULL,status); + LocalPointer children(r->getContainedRegions(type, status)); + const char *id2; + while(U_SUCCESS(status) && ((id2 = children->next(nullptr, status)) != nullptr)) { const Region *r2 = Region::getInstance(id2,status); - result->addElement((void *)&r2->idStr,status); + result.addElement(const_cast(&r2->idStr), status); } - delete children; } } - delete cr; - StringEnumeration* resultEnumeration = new RegionNameEnumeration(result,status); - delete result; - return resultEnumeration; + LocalPointer resultEnumeration( + new RegionNameEnumeration(&result, status), status); + return U_SUCCESS(status) ? resultEnumeration.orphan() : nullptr; } /** @@ -643,33 +668,33 @@ Region::contains(const Region &other) const { umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); if (!containedRegions) { - return FALSE; + return false; } if (containedRegions->contains((void *)&other.idStr)) { - return TRUE; + return true; } else { for ( int32_t i = 0 ; i < containedRegions->size() ; i++ ) { UnicodeString *crStr = (UnicodeString *)containedRegions->elementAt(i); Region *cr = (Region *) uhash_get(regionIDMap,(void *)crStr); if ( cr && cr->contains(other) ) { - return TRUE; + return true; } } } - return FALSE; + return false; } /** * For deprecated regions, return an enumeration over the IDs of the regions that are the preferred replacement - * regions for this region. Returns NULL for a non-deprecated region. For example, calling this method with region + * regions for this region. Returns nullptr for a non-deprecated region. For example, calling this method with region * "SU" (Soviet Union) would return a list of the regions containing "RU" (Russia), "AM" (Armenia), "AZ" (Azerbaijan), etc... */ StringEnumeration* Region::getPreferredValues(UErrorCode &status) const { umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status) if (U_FAILURE(status) || fType != URGN_DEPRECATED) { - return NULL; + return nullptr; } return new RegionNameEnumeration(preferredValues,status); } @@ -696,28 +721,31 @@ Region::getType() const { return fType; } -RegionNameEnumeration::RegionNameEnumeration(UVector *fNameList, UErrorCode& status) { - pos=0; - if (fNameList && U_SUCCESS(status)) { - fRegionNames = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, fNameList->size(),status); - for ( int32_t i = 0 ; i < fNameList->size() ; i++ ) { - UnicodeString* this_region_name = (UnicodeString *)fNameList->elementAt(i); - UnicodeString* new_region_name = new UnicodeString(*this_region_name); - fRegionNames->addElement((void *)new_region_name,status); +RegionNameEnumeration::RegionNameEnumeration(UVector *nameList, UErrorCode& status) : + pos(0), fRegionNames(nullptr) { + // TODO: https://unicode-org.atlassian.net/browse/ICU-21829 + // Is all of the copying going on here really necessary? + if (nameList && U_SUCCESS(status)) { + LocalPointer regionNames( + new UVector(uprv_deleteUObject, uhash_compareUnicodeString, nameList->size(), status), status); + for ( int32_t i = 0 ; U_SUCCESS(status) && i < nameList->size() ; i++ ) { + UnicodeString* this_region_name = (UnicodeString *)nameList->elementAt(i); + LocalPointer new_region_name(new UnicodeString(*this_region_name), status); + regionNames->adoptElement(new_region_name.orphan(), status); + } + if (U_SUCCESS(status)) { + fRegionNames = regionNames.orphan(); } - } - else { - fRegionNames = NULL; } } const UnicodeString* RegionNameEnumeration::snext(UErrorCode& status) { - if (U_FAILURE(status) || (fRegionNames==NULL)) { - return NULL; + if (U_FAILURE(status) || (fRegionNames==nullptr)) { + return nullptr; } const UnicodeString* nextStr = (const UnicodeString *)fRegionNames->elementAt(pos); - if (nextStr!=NULL) { + if (nextStr!=nullptr) { pos++; } return nextStr; @@ -730,7 +758,7 @@ RegionNameEnumeration::reset(UErrorCode& /*status*/) { int32_t RegionNameEnumeration::count(UErrorCode& /*status*/) const { - return (fRegionNames==NULL) ? 0 : fRegionNames->size(); + return (fRegionNames==nullptr) ? 0 : fRegionNames->size(); } RegionNameEnumeration::~RegionNameEnumeration() { diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/region_impl.h b/src/duckdb/extension/icu/third_party/icu/i18n/region_impl.h index 5e5a64529..edabc6d0f 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/region_impl.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/region_impl.h @@ -26,13 +26,17 @@ U_NAMESPACE_BEGIN class RegionNameEnumeration : public StringEnumeration { public: - RegionNameEnumeration(UVector *fNameList, UErrorCode& status); + /** + * Construct an string enumeration over the supplied name list. + * Makes a copy of the supplied input name list; does not retain a reference to the original. + */ + RegionNameEnumeration(UVector *nameList, UErrorCode& status); virtual ~RegionNameEnumeration(); - static UClassID U_EXPORT2 getStaticClassID(void); - virtual UClassID getDynamicClassID(void) const; - virtual const UnicodeString* snext(UErrorCode& status); - virtual void reset(UErrorCode& status); - virtual int32_t count(UErrorCode& status) const; + static UClassID U_EXPORT2 getStaticClassID(); + virtual UClassID getDynamicClassID() const override; + virtual const UnicodeString* snext(UErrorCode& status) override; + virtual void reset(UErrorCode& status) override; + virtual int32_t count(UErrorCode& status) const override; private: int32_t pos; UVector *fRegionNames; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/reldatefmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/reldatefmt.cpp deleted file mode 100644 index 002168ffd..000000000 --- a/src/duckdb/extension/icu/third_party/icu/i18n/reldatefmt.cpp +++ /dev/null @@ -1,1416 +0,0 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -****************************************************************************** -* Copyright (C) 2014-2016, International Business Machines Corporation and -* others. All Rights Reserved. -****************************************************************************** -* -* File reldatefmt.cpp -****************************************************************************** -*/ - -#include "unicode/reldatefmt.h" - -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION - -#include -#include -#include "unicode/dtfmtsym.h" -#include "unicode/ucasemap.h" -#include "unicode/ureldatefmt.h" -#include "unicode/udisplaycontext.h" -#include "unicode/unum.h" -#include "unicode/localpointer.h" -#include "unicode/plurrule.h" -#include "unicode/simpleformatter.h" -#include "unicode/decimfmt.h" -#include "unicode/numfmt.h" -// #include "unicode/brkiter.h" -#include "unicode/simpleformatter.h" -#include "uresimp.h" -#include "unicode/ures.h" -#include "cstring.h" -#include "ucln_in.h" -#include "mutex.h" -#include "charstr.h" -#include "uassert.h" -#include "quantityformatter.h" -#include "resource.h" -#include "sharedbreakiterator.h" -#include "sharedpluralrules.h" -#include "sharednumberformat.h" -#include "standardplural.h" -#include "unifiedcache.h" -#include "util.h" -#include "formatted_string_builder.h" -#include "number_utypes.h" -#include "number_modifiers.h" -#include "formattedval_impl.h" -#include "number_utils.h" - -// Copied from uscript_props.cpp - -U_NAMESPACE_BEGIN - -// RelativeDateTimeFormatter specific data for a single locale -class RelativeDateTimeCacheData: public SharedObject { -public: - RelativeDateTimeCacheData() : combinedDateAndTime(nullptr) { - // Initialize the cache arrays - for (int32_t style = 0; style < UDAT_STYLE_COUNT; ++style) { - for (int32_t relUnit = 0; relUnit < UDAT_REL_UNIT_COUNT; ++relUnit) { - for (int32_t pl = 0; pl < StandardPlural::COUNT; ++pl) { - relativeUnitsFormatters[style][relUnit][0][pl] = nullptr; - relativeUnitsFormatters[style][relUnit][1][pl] = nullptr; - } - } - } - for (int32_t i = 0; i < UDAT_STYLE_COUNT; ++i) { - fallBackCache[i] = -1; - } - } - virtual ~RelativeDateTimeCacheData(); - - // no numbers: e.g Next Tuesday; Yesterday; etc. - UnicodeString absoluteUnits[UDAT_STYLE_COUNT][UDAT_ABSOLUTE_UNIT_COUNT][UDAT_DIRECTION_COUNT]; - - // SimpleFormatter pointers for relative unit format, - // e.g., Next Tuesday; Yesterday; etc. For third index, 0 - // means past, e.g., 5 days ago; 1 means future, e.g., in 5 days. - SimpleFormatter *relativeUnitsFormatters[UDAT_STYLE_COUNT] - [UDAT_REL_UNIT_COUNT][2][StandardPlural::COUNT]; - - const UnicodeString& getAbsoluteUnitString(int32_t fStyle, - UDateAbsoluteUnit unit, - UDateDirection direction) const; - const SimpleFormatter* getRelativeUnitFormatter(int32_t fStyle, - UDateRelativeUnit unit, - int32_t pastFutureIndex, - int32_t pluralUnit) const; - const SimpleFormatter* getRelativeDateTimeUnitFormatter(int32_t fStyle, - URelativeDateTimeUnit unit, - int32_t pastFutureIndex, - int32_t pluralUnit) const; - - const UnicodeString emptyString; - - // Mappping from source to target styles for alias fallback. - int32_t fallBackCache[UDAT_STYLE_COUNT]; - - void adoptCombinedDateAndTime(SimpleFormatter *fmtToAdopt) { - delete combinedDateAndTime; - combinedDateAndTime = fmtToAdopt; - } - const SimpleFormatter *getCombinedDateAndTime() const { - return combinedDateAndTime; - } - -private: - SimpleFormatter *combinedDateAndTime; - RelativeDateTimeCacheData(const RelativeDateTimeCacheData &other); - RelativeDateTimeCacheData& operator=( - const RelativeDateTimeCacheData &other); -}; - -RelativeDateTimeCacheData::~RelativeDateTimeCacheData() { - // clear out the cache arrays - for (int32_t style = 0; style < UDAT_STYLE_COUNT; ++style) { - for (int32_t relUnit = 0; relUnit < UDAT_REL_UNIT_COUNT; ++relUnit) { - for (int32_t pl = 0; pl < StandardPlural::COUNT; ++pl) { - delete relativeUnitsFormatters[style][relUnit][0][pl]; - delete relativeUnitsFormatters[style][relUnit][1][pl]; - } - } - } - delete combinedDateAndTime; -} - - -// Use fallback cache for absolute units. -const UnicodeString& RelativeDateTimeCacheData::getAbsoluteUnitString( - int32_t fStyle, UDateAbsoluteUnit unit, UDateDirection direction) const { - int32_t style = fStyle; - do { - if (!absoluteUnits[style][unit][direction].isEmpty()) { - return absoluteUnits[style][unit][direction]; - } - style = fallBackCache[style]; - } while (style != -1); - return emptyString; -} - - const SimpleFormatter* RelativeDateTimeCacheData::getRelativeUnitFormatter( - int32_t fStyle, - UDateRelativeUnit unit, - int32_t pastFutureIndex, - int32_t pluralUnit) const { - URelativeDateTimeUnit rdtunit = UDAT_REL_UNIT_COUNT; - switch (unit) { - case UDAT_RELATIVE_YEARS: rdtunit = UDAT_REL_UNIT_YEAR; break; - case UDAT_RELATIVE_MONTHS: rdtunit = UDAT_REL_UNIT_MONTH; break; - case UDAT_RELATIVE_WEEKS: rdtunit = UDAT_REL_UNIT_WEEK; break; - case UDAT_RELATIVE_DAYS: rdtunit = UDAT_REL_UNIT_DAY; break; - case UDAT_RELATIVE_HOURS: rdtunit = UDAT_REL_UNIT_HOUR; break; - case UDAT_RELATIVE_MINUTES: rdtunit = UDAT_REL_UNIT_MINUTE; break; - case UDAT_RELATIVE_SECONDS: rdtunit = UDAT_REL_UNIT_SECOND; break; - default: // a unit that the above method does not handle - return nullptr; - } - - return getRelativeDateTimeUnitFormatter(fStyle, rdtunit, pastFutureIndex, pluralUnit); - } - - // Use fallback cache for SimpleFormatter relativeUnits. - const SimpleFormatter* RelativeDateTimeCacheData::getRelativeDateTimeUnitFormatter( - int32_t fStyle, - URelativeDateTimeUnit unit, - int32_t pastFutureIndex, - int32_t pluralUnit) const { - while (true) { - int32_t style = fStyle; - do { - if (relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit] != nullptr) { - return relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit]; - } - style = fallBackCache[style]; - } while (style != -1); - - if (pluralUnit == StandardPlural::OTHER) { - break; - } - pluralUnit = StandardPlural::OTHER; - } - return nullptr; // No formatter found. - } - -static UBool getStringWithFallback( - const UResourceBundle *resource, - const char *key, - UnicodeString &result, - UErrorCode &status) { - int32_t len = 0; - const UChar *resStr = ures_getStringByKeyWithFallback( - resource, key, &len, &status); - if (U_FAILURE(status)) { - return FALSE; - } - result.setTo(TRUE, resStr, len); - return TRUE; -} - - -static UBool getStringByIndex( - const UResourceBundle *resource, - int32_t idx, - UnicodeString &result, - UErrorCode &status) { - int32_t len = 0; - const UChar *resStr = ures_getStringByIndex( - resource, idx, &len, &status); - if (U_FAILURE(status)) { - return FALSE; - } - result.setTo(TRUE, resStr, len); - return TRUE; -} - -namespace { - -/** - * Sink for enumerating all of the measurement unit display names. - * - * More specific bundles (en_GB) are enumerated before their parents (en_001, en, root): - * Only store a value if it is still missing, that is, it has not been overridden. - */ -struct RelDateTimeFmtDataSink : public ResourceSink { - - /** - * Sink for patterns for relative dates and times. For example, - * fields/relative/... - */ - - // Generic unit enum for storing Unit info. - typedef enum RelAbsUnit { - INVALID_UNIT = -1, - SECOND, - MINUTE, - HOUR, - DAY, - WEEK, - MONTH, - QUARTER, - YEAR, - SUNDAY, - MONDAY, - TUESDAY, - WEDNESDAY, - THURSDAY, - FRIDAY, - SATURDAY - } RelAbsUnit; - - static int32_t relUnitFromGeneric(RelAbsUnit genUnit) { - // Converts the generic units to UDAT_RELATIVE version. - switch (genUnit) { - case SECOND: - return UDAT_REL_UNIT_SECOND; - case MINUTE: - return UDAT_REL_UNIT_MINUTE; - case HOUR: - return UDAT_REL_UNIT_HOUR; - case DAY: - return UDAT_REL_UNIT_DAY; - case WEEK: - return UDAT_REL_UNIT_WEEK; - case MONTH: - return UDAT_REL_UNIT_MONTH; - case QUARTER: - return UDAT_REL_UNIT_QUARTER; - case YEAR: - return UDAT_REL_UNIT_YEAR; - case SUNDAY: - return UDAT_REL_UNIT_SUNDAY; - case MONDAY: - return UDAT_REL_UNIT_MONDAY; - case TUESDAY: - return UDAT_REL_UNIT_TUESDAY; - case WEDNESDAY: - return UDAT_REL_UNIT_WEDNESDAY; - case THURSDAY: - return UDAT_REL_UNIT_THURSDAY; - case FRIDAY: - return UDAT_REL_UNIT_FRIDAY; - case SATURDAY: - return UDAT_REL_UNIT_SATURDAY; - default: - return -1; - } - } - - static int32_t absUnitFromGeneric(RelAbsUnit genUnit) { - // Converts the generic units to UDAT_RELATIVE version. - switch (genUnit) { - case DAY: - return UDAT_ABSOLUTE_DAY; - case WEEK: - return UDAT_ABSOLUTE_WEEK; - case MONTH: - return UDAT_ABSOLUTE_MONTH; - case QUARTER: - return UDAT_ABSOLUTE_QUARTER; - case YEAR: - return UDAT_ABSOLUTE_YEAR; - case SUNDAY: - return UDAT_ABSOLUTE_SUNDAY; - case MONDAY: - return UDAT_ABSOLUTE_MONDAY; - case TUESDAY: - return UDAT_ABSOLUTE_TUESDAY; - case WEDNESDAY: - return UDAT_ABSOLUTE_WEDNESDAY; - case THURSDAY: - return UDAT_ABSOLUTE_THURSDAY; - case FRIDAY: - return UDAT_ABSOLUTE_FRIDAY; - case SATURDAY: - return UDAT_ABSOLUTE_SATURDAY; - case HOUR: - return UDAT_ABSOLUTE_HOUR; - case MINUTE: - return UDAT_ABSOLUTE_MINUTE; - default: - return -1; - } - } - - static int32_t keyToDirection(const char* key) { - if (uprv_strcmp(key, "-2") == 0) { - return UDAT_DIRECTION_LAST_2; - } - if (uprv_strcmp(key, "-1") == 0) { - return UDAT_DIRECTION_LAST; - } - if (uprv_strcmp(key, "0") == 0) { - return UDAT_DIRECTION_THIS; - } - if (uprv_strcmp(key, "1") == 0) { - return UDAT_DIRECTION_NEXT; - } - if (uprv_strcmp(key, "2") == 0) { - return UDAT_DIRECTION_NEXT_2; - } - return -1; - } - - // Values kept between levels of parsing the CLDR data. - int32_t pastFutureIndex; // 0 == past or 1 == future - UDateRelativeDateTimeFormatterStyle style; // {LONG, SHORT, NARROW} - RelAbsUnit genericUnit; - - RelativeDateTimeCacheData &outputData; - - // Constructor - RelDateTimeFmtDataSink(RelativeDateTimeCacheData& cacheData) - : outputData(cacheData) { - // Clear cacheData.fallBackCache - cacheData.fallBackCache[UDAT_STYLE_LONG] = -1; - cacheData.fallBackCache[UDAT_STYLE_SHORT] = -1; - cacheData.fallBackCache[UDAT_STYLE_NARROW] = -1; - } - - ~RelDateTimeFmtDataSink(); - - // Utility functions - static UDateRelativeDateTimeFormatterStyle styleFromString(const char *s) { - int32_t len = static_cast(uprv_strlen(s)); - if (len >= 7 && uprv_strcmp(s + len - 7, "-narrow") == 0) { - return UDAT_STYLE_NARROW; - } - if (len >= 6 && uprv_strcmp(s + len - 6, "-short") == 0) { - return UDAT_STYLE_SHORT; - } - return UDAT_STYLE_LONG; - } - - static int32_t styleSuffixLength(UDateRelativeDateTimeFormatterStyle style) { - switch (style) { - case UDAT_STYLE_NARROW: - return 7; - case UDAT_STYLE_SHORT: - return 6; - default: - return 0; - } - } - - // Utility functions - static UDateRelativeDateTimeFormatterStyle styleFromAliasUnicodeString(UnicodeString s) { - static const UChar narrow[7] = {0x002D, 0x006E, 0x0061, 0x0072, 0x0072, 0x006F, 0x0077}; - static const UChar sshort[6] = {0x002D, 0x0073, 0x0068, 0x006F, 0x0072, 0x0074,}; - if (s.endsWith(narrow, 7)) { - return UDAT_STYLE_NARROW; - } - if (s.endsWith(sshort, 6)) { - return UDAT_STYLE_SHORT; - } - return UDAT_STYLE_LONG; - } - - static RelAbsUnit unitOrNegativeFromString(const char* keyword, int32_t length) { - // Quick check from string to enum. - switch (length) { - case 3: - if (uprv_strncmp(keyword, "day", length) == 0) { - return DAY; - } else if (uprv_strncmp(keyword, "sun", length) == 0) { - return SUNDAY; - } else if (uprv_strncmp(keyword, "mon", length) == 0) { - return MONDAY; - } else if (uprv_strncmp(keyword, "tue", length) == 0) { - return TUESDAY; - } else if (uprv_strncmp(keyword, "wed", length) == 0) { - return WEDNESDAY; - } else if (uprv_strncmp(keyword, "thu", length) == 0) { - return THURSDAY; - } else if (uprv_strncmp(keyword, "fri", length) == 0) { - return FRIDAY; - } else if (uprv_strncmp(keyword, "sat", length) == 0) { - return SATURDAY; - } - break; - case 4: - if (uprv_strncmp(keyword, "hour", length) == 0) { - return HOUR; - } else if (uprv_strncmp(keyword, "week", length) == 0) { - return WEEK; - } else if (uprv_strncmp(keyword, "year", length) == 0) { - return YEAR; - } - break; - case 5: - if (uprv_strncmp(keyword, "month", length) == 0) { - return MONTH; - } - break; - case 6: - if (uprv_strncmp(keyword, "minute", length) == 0) { - return MINUTE; - } else if (uprv_strncmp(keyword, "second", length) == 0) { - return SECOND; - } - break; - case 7: - if (uprv_strncmp(keyword, "quarter", length) == 0) { - return QUARTER; // TODO: Check @provisional - } - break; - default: - break; - } - return INVALID_UNIT; - } - - void handlePlainDirection(ResourceValue &value, UErrorCode &errorCode) { - // Handle Display Name for PLAIN direction for some units. - if (U_FAILURE(errorCode)) { return; } - - int32_t absUnit = absUnitFromGeneric(genericUnit); - if (absUnit < 0) { - return; // Not interesting. - } - - // Store displayname if not set. - if (outputData.absoluteUnits[style] - [absUnit][UDAT_DIRECTION_PLAIN].isEmpty()) { - outputData.absoluteUnits[style] - [absUnit][UDAT_DIRECTION_PLAIN].fastCopyFrom(value.getUnicodeString(errorCode)); - return; - } - } - - void consumeTableRelative(const char *key, ResourceValue &value, UErrorCode &errorCode) { - ResourceTable unitTypesTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - - for (int32_t i = 0; unitTypesTable.getKeyAndValue(i, key, value); ++i) { - if (value.getType() == URES_STRING) { - int32_t direction = keyToDirection(key); - if (direction < 0) { - continue; - } - - int32_t relUnitIndex = relUnitFromGeneric(genericUnit); - if (relUnitIndex == UDAT_REL_UNIT_SECOND && uprv_strcmp(key, "0") == 0 && - outputData.absoluteUnits[style][UDAT_ABSOLUTE_NOW][UDAT_DIRECTION_PLAIN].isEmpty()) { - // Handle "NOW" - outputData.absoluteUnits[style][UDAT_ABSOLUTE_NOW] - [UDAT_DIRECTION_PLAIN].fastCopyFrom(value.getUnicodeString(errorCode)); - } - - int32_t absUnitIndex = absUnitFromGeneric(genericUnit); - if (absUnitIndex < 0) { - continue; - } - // Only reset if slot is empty. - if (outputData.absoluteUnits[style][absUnitIndex][direction].isEmpty()) { - outputData.absoluteUnits[style][absUnitIndex] - [direction].fastCopyFrom(value.getUnicodeString(errorCode)); - } - } - } - } - - void consumeTimeDetail(int32_t relUnitIndex, - const char *key, ResourceValue &value, UErrorCode &errorCode) { - ResourceTable unitTypesTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - - for (int32_t i = 0; unitTypesTable.getKeyAndValue(i, key, value); ++i) { - if (value.getType() == URES_STRING) { - int32_t pluralIndex = StandardPlural::indexOrNegativeFromString(key); - if (pluralIndex >= 0) { - SimpleFormatter **patterns = - outputData.relativeUnitsFormatters[style][relUnitIndex] - [pastFutureIndex]; - // Only set if not already established. - if (patterns[pluralIndex] == nullptr) { - patterns[pluralIndex] = new SimpleFormatter( - value.getUnicodeString(errorCode), 0, 1, errorCode); - if (patterns[pluralIndex] == nullptr) { - errorCode = U_MEMORY_ALLOCATION_ERROR; - } - } - } - } - } - } - - void consumeTableRelativeTime(const char *key, ResourceValue &value, UErrorCode &errorCode) { - ResourceTable relativeTimeTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - - int32_t relUnitIndex = relUnitFromGeneric(genericUnit); - if (relUnitIndex < 0) { - return; - } - for (int32_t i = 0; relativeTimeTable.getKeyAndValue(i, key, value); ++i) { - if (uprv_strcmp(key, "past") == 0) { - pastFutureIndex = 0; - } else if (uprv_strcmp(key, "future") == 0) { - pastFutureIndex = 1; - } else { - // Unknown key. - continue; - } - consumeTimeDetail(relUnitIndex, key, value, errorCode); - } - } - - void consumeAlias(const char *key, const ResourceValue &value, UErrorCode &errorCode) { - - UDateRelativeDateTimeFormatterStyle sourceStyle = styleFromString(key); - const UnicodeString valueStr = value.getAliasUnicodeString(errorCode); - if (U_FAILURE(errorCode)) { return; } - - UDateRelativeDateTimeFormatterStyle targetStyle = - styleFromAliasUnicodeString(valueStr); - - if (sourceStyle == targetStyle) { - errorCode = U_INVALID_FORMAT_ERROR; - return; - } - if (outputData.fallBackCache[sourceStyle] != -1 && - outputData.fallBackCache[sourceStyle] != targetStyle) { - errorCode = U_INVALID_FORMAT_ERROR; - return; - } - outputData.fallBackCache[sourceStyle] = targetStyle; - } - - void consumeTimeUnit(const char *key, ResourceValue &value, UErrorCode &errorCode) { - ResourceTable unitTypesTable = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - - for (int32_t i = 0; unitTypesTable.getKeyAndValue(i, key, value); ++i) { - // Handle display name. - if (uprv_strcmp(key, "dn") == 0 && value.getType() == URES_STRING) { - handlePlainDirection(value, errorCode); - } - if (value.getType() == URES_TABLE) { - if (uprv_strcmp(key, "relative") == 0) { - consumeTableRelative(key, value, errorCode); - } else if (uprv_strcmp(key, "relativeTime") == 0) { - consumeTableRelativeTime(key, value, errorCode); - } - } - } - } - - virtual void put(const char *key, ResourceValue &value, - UBool /*noFallback*/, UErrorCode &errorCode) { - // Main entry point to sink - ResourceTable table = value.getTable(errorCode); - if (U_FAILURE(errorCode)) { return; } - for (int32_t i = 0; table.getKeyAndValue(i, key, value); ++i) { - if (value.getType() == URES_ALIAS) { - consumeAlias(key, value, errorCode); - } else { - style = styleFromString(key); - int32_t unitSize = static_cast(uprv_strlen(key)) - styleSuffixLength(style); - genericUnit = unitOrNegativeFromString(key, unitSize); - if (style >= 0 && genericUnit != INVALID_UNIT) { - consumeTimeUnit(key, value, errorCode); - } - } - } - } - -}; - -// Virtual destructors must be defined out of line. -RelDateTimeFmtDataSink::~RelDateTimeFmtDataSink() {} -} // namespace - -static const DateFormatSymbols::DtWidthType styleToDateFormatSymbolWidth[UDAT_STYLE_COUNT] = { - DateFormatSymbols::WIDE, DateFormatSymbols::SHORT, DateFormatSymbols::NARROW -}; - -// Get days of weeks from the DateFormatSymbols class. -static void loadWeekdayNames(UnicodeString absoluteUnits[UDAT_STYLE_COUNT] - [UDAT_ABSOLUTE_UNIT_COUNT][UDAT_DIRECTION_COUNT], - const char* localeId, - UErrorCode& status) { - if (U_FAILURE(status)) { - return; - } - Locale locale(localeId); - DateFormatSymbols dfSym(locale, status); - if (U_FAILURE(status)) { - return; - } - for (int32_t style = 0; style < UDAT_STYLE_COUNT; ++style) { - DateFormatSymbols::DtWidthType dtfmtWidth = styleToDateFormatSymbolWidth[style]; - int32_t count; - const UnicodeString* weekdayNames = - dfSym.getWeekdays(count, DateFormatSymbols::STANDALONE, dtfmtWidth); - for (int32_t dayIndex = UDAT_ABSOLUTE_SUNDAY; - dayIndex <= UDAT_ABSOLUTE_SATURDAY; ++ dayIndex) { - int32_t dateSymbolIndex = (dayIndex - UDAT_ABSOLUTE_SUNDAY) + UCAL_SUNDAY; - absoluteUnits[style][dayIndex][UDAT_DIRECTION_PLAIN].fastCopyFrom( - weekdayNames[dateSymbolIndex]); - } - } -} - -static UBool loadUnitData( - const UResourceBundle *resource, - RelativeDateTimeCacheData &cacheData, - const char* localeId, - UErrorCode &status) { - - RelDateTimeFmtDataSink sink(cacheData); - - ures_getAllItemsWithFallback(resource, "fields", sink, status); - if (U_FAILURE(status)) { - return false; - } - - // Get the weekday names from DateFormatSymbols. - loadWeekdayNames(cacheData.absoluteUnits, localeId, status); - return U_SUCCESS(status); -} - -static UBool getDateTimePattern( - const UResourceBundle *resource, - UnicodeString &result, - UErrorCode &status) { - UnicodeString defaultCalendarName; - if (!getStringWithFallback( - resource, - "calendar/default", - defaultCalendarName, - status)) { - return FALSE; - } - CharString pathBuffer; - pathBuffer.append("calendar/", status) - .appendInvariantChars(defaultCalendarName, status) - .append("/DateTimePatterns", status); - LocalUResourceBundlePointer topLevel( - ures_getByKeyWithFallback( - resource, pathBuffer.data(), nullptr, &status)); - if (U_FAILURE(status)) { - return FALSE; - } - int32_t size = ures_getSize(topLevel.getAlias()); - if (size <= 8) { - // Oops, size is too small to access the index that we want, fallback - // to a hard-coded value. - result = UNICODE_STRING_SIMPLE("{1} {0}"); - return TRUE; - } - return getStringByIndex(topLevel.getAlias(), 8, result, status); -} - -template<> U_I18N_API -const RelativeDateTimeCacheData *LocaleCacheKey::createObject(const void * /*unused*/, UErrorCode &status) const { - const char *localeId = fLoc.getName(); - LocalUResourceBundlePointer topLevel(ures_open(nullptr, localeId, &status)); - if (U_FAILURE(status)) { - return nullptr; - } - LocalPointer result( - new RelativeDateTimeCacheData()); - if (result.isNull()) { - status = U_MEMORY_ALLOCATION_ERROR; - return nullptr; - } - if (!loadUnitData( - topLevel.getAlias(), - *result, - localeId, - status)) { - return nullptr; - } - UnicodeString dateTimePattern; - if (!getDateTimePattern(topLevel.getAlias(), dateTimePattern, status)) { - return nullptr; - } - result->adoptCombinedDateAndTime( - new SimpleFormatter(dateTimePattern, 2, 2, status)); - if (U_FAILURE(status)) { - return nullptr; - } - result->addRef(); - return result.orphan(); -} - - - -static constexpr number::impl::Field kRDTNumericField - = StringBuilderFieldUtils::compress(); - -static constexpr number::impl::Field kRDTLiteralField - = StringBuilderFieldUtils::compress(); - -class FormattedRelativeDateTimeData : public FormattedValueStringBuilderImpl { -public: - FormattedRelativeDateTimeData() : FormattedValueStringBuilderImpl(kRDTNumericField) {} - virtual ~FormattedRelativeDateTimeData(); -}; - -FormattedRelativeDateTimeData::~FormattedRelativeDateTimeData() = default; - - -UPRV_FORMATTED_VALUE_SUBCLASS_AUTO_IMPL(FormattedRelativeDateTime) - - -RelativeDateTimeFormatter::RelativeDateTimeFormatter(UErrorCode& status) : - fCache(nullptr), - fNumberFormat(nullptr), - fPluralRules(nullptr), - fStyle(UDAT_STYLE_LONG), - fContext(UDISPCTX_CAPITALIZATION_NONE), - fOptBreakIterator(nullptr) { - init(nullptr, nullptr, status); -} - -RelativeDateTimeFormatter::RelativeDateTimeFormatter( - const Locale& locale, UErrorCode& status) : - fCache(nullptr), - fNumberFormat(nullptr), - fPluralRules(nullptr), - fStyle(UDAT_STYLE_LONG), - fContext(UDISPCTX_CAPITALIZATION_NONE), - fOptBreakIterator(nullptr), - fLocale(locale) { - init(nullptr, nullptr, status); -} - -RelativeDateTimeFormatter::RelativeDateTimeFormatter( - const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status) : - fCache(nullptr), - fNumberFormat(nullptr), - fPluralRules(nullptr), - fStyle(UDAT_STYLE_LONG), - fContext(UDISPCTX_CAPITALIZATION_NONE), - fOptBreakIterator(nullptr), - fLocale(locale) { - init(nfToAdopt, nullptr, status); -} - -RelativeDateTimeFormatter::RelativeDateTimeFormatter( - const Locale& locale, - NumberFormat *nfToAdopt, - UDateRelativeDateTimeFormatterStyle styl, - UDisplayContext capitalizationContext, - UErrorCode& status) : - fCache(nullptr), - fNumberFormat(nullptr), - fPluralRules(nullptr), - fStyle(styl), - fContext(capitalizationContext), - fOptBreakIterator(nullptr), - fLocale(locale) { - if (U_FAILURE(status)) { - return; - } - if ((capitalizationContext >> 8) != UDISPCTX_TYPE_CAPITALIZATION) { - status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - if (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE) { - BreakIterator *bi = BreakIterator::createSentenceInstance(locale, status); - if (U_FAILURE(status)) { - return; - } - init(nfToAdopt, bi, status); - } else { - init(nfToAdopt, nullptr, status); - } -} - -RelativeDateTimeFormatter::RelativeDateTimeFormatter( - const RelativeDateTimeFormatter& other) - : UObject(other), - fCache(other.fCache), - fNumberFormat(other.fNumberFormat), - fPluralRules(other.fPluralRules), - fStyle(other.fStyle), - fContext(other.fContext), - fOptBreakIterator(other.fOptBreakIterator), - fLocale(other.fLocale) { - fCache->addRef(); - fNumberFormat->addRef(); - fPluralRules->addRef(); - if (fOptBreakIterator != nullptr) { - fOptBreakIterator->addRef(); - } -} - -RelativeDateTimeFormatter& RelativeDateTimeFormatter::operator=( - const RelativeDateTimeFormatter& other) { - if (this != &other) { - SharedObject::copyPtr(other.fCache, fCache); - SharedObject::copyPtr(other.fNumberFormat, fNumberFormat); - SharedObject::copyPtr(other.fPluralRules, fPluralRules); - SharedObject::copyPtr(other.fOptBreakIterator, fOptBreakIterator); - fStyle = other.fStyle; - fContext = other.fContext; - fLocale = other.fLocale; - } - return *this; -} - -RelativeDateTimeFormatter::~RelativeDateTimeFormatter() { - if (fCache != nullptr) { - fCache->removeRef(); - } - if (fNumberFormat != nullptr) { - fNumberFormat->removeRef(); - } - if (fPluralRules != nullptr) { - fPluralRules->removeRef(); - } - if (fOptBreakIterator != nullptr) { - fOptBreakIterator->removeRef(); - } -} - -const NumberFormat& RelativeDateTimeFormatter::getNumberFormat() const { - return **fNumberFormat; -} - -UDisplayContext RelativeDateTimeFormatter::getCapitalizationContext() const { - return fContext; -} - -UDateRelativeDateTimeFormatterStyle RelativeDateTimeFormatter::getFormatStyle() const { - return fStyle; -} - - -// To reduce boilerplate code, we use a helper function that forwards variadic -// arguments to the formatImpl function. - -template -UnicodeString& RelativeDateTimeFormatter::doFormat( - F callback, - UnicodeString& appendTo, - UErrorCode& status, - Args... args) const { - FormattedRelativeDateTimeData output; - (this->*callback)(std::forward(args)..., output, status); - if (U_FAILURE(status)) { - return appendTo; - } - UnicodeString result = output.getStringRef().toUnicodeString(); - return appendTo.append(adjustForContext(result)); -} - -template -FormattedRelativeDateTime RelativeDateTimeFormatter::doFormatToValue( - F callback, - UErrorCode& status, - Args... args) const { - if (!checkNoAdjustForContext(status)) { - return FormattedRelativeDateTime(status); - } - LocalPointer output( - new FormattedRelativeDateTimeData(), status); - if (U_FAILURE(status)) { - return FormattedRelativeDateTime(status); - } - (this->*callback)(std::forward(args)..., *output, status); - output->getStringRef().writeTerminator(status); - return FormattedRelativeDateTime(output.orphan()); -} - -UnicodeString& RelativeDateTimeFormatter::format( - double quantity, - UDateDirection direction, - UDateRelativeUnit unit, - UnicodeString& appendTo, - UErrorCode& status) const { - return doFormat( - &RelativeDateTimeFormatter::formatImpl, - appendTo, - status, - quantity, - direction, - unit); -} - -FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue( - double quantity, - UDateDirection direction, - UDateRelativeUnit unit, - UErrorCode& status) const { - return doFormatToValue( - &RelativeDateTimeFormatter::formatImpl, - status, - quantity, - direction, - unit); -} - -void RelativeDateTimeFormatter::formatImpl( - double quantity, - UDateDirection direction, - UDateRelativeUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const { - if (U_FAILURE(status)) { - return; - } - if (direction != UDAT_DIRECTION_LAST && direction != UDAT_DIRECTION_NEXT) { - status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - int32_t bFuture = direction == UDAT_DIRECTION_NEXT ? 1 : 0; - - StandardPlural::Form pluralForm; - QuantityFormatter::formatAndSelect( - quantity, - **fNumberFormat, - **fPluralRules, - output.getStringRef(), - pluralForm, - status); - if (U_FAILURE(status)) { - return; - } - - const SimpleFormatter* formatter = - fCache->getRelativeUnitFormatter(fStyle, unit, bFuture, pluralForm); - if (formatter == nullptr) { - // TODO: WARN - look at quantity formatter's action with an error. - status = U_INVALID_FORMAT_ERROR; - return; - } - - number::impl::SimpleModifier modifier(*formatter, kRDTLiteralField, false); - modifier.formatAsPrefixSuffix( - output.getStringRef(), 0, output.getStringRef().length(), status); -} - -UnicodeString& RelativeDateTimeFormatter::formatNumeric( - double offset, - URelativeDateTimeUnit unit, - UnicodeString& appendTo, - UErrorCode& status) const { - return doFormat( - &RelativeDateTimeFormatter::formatNumericImpl, - appendTo, - status, - offset, - unit); -} - -FormattedRelativeDateTime RelativeDateTimeFormatter::formatNumericToValue( - double offset, - URelativeDateTimeUnit unit, - UErrorCode& status) const { - return doFormatToValue( - &RelativeDateTimeFormatter::formatNumericImpl, - status, - offset, - unit); -} - -void RelativeDateTimeFormatter::formatNumericImpl( - double offset, - URelativeDateTimeUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const { - if (U_FAILURE(status)) { - return; - } - UDateDirection direction = UDAT_DIRECTION_NEXT; - if (std::signbit(offset)) { // needed to handle -0.0 - direction = UDAT_DIRECTION_LAST; - offset = -offset; - } - if (direction != UDAT_DIRECTION_LAST && direction != UDAT_DIRECTION_NEXT) { - status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - int32_t bFuture = direction == UDAT_DIRECTION_NEXT ? 1 : 0; - - StandardPlural::Form pluralForm; - QuantityFormatter::formatAndSelect( - offset, - **fNumberFormat, - **fPluralRules, - output.getStringRef(), - pluralForm, - status); - if (U_FAILURE(status)) { - return; - } - - const SimpleFormatter* formatter = - fCache->getRelativeDateTimeUnitFormatter(fStyle, unit, bFuture, pluralForm); - if (formatter == nullptr) { - // TODO: WARN - look at quantity formatter's action with an error. - status = U_INVALID_FORMAT_ERROR; - return; - } - - number::impl::SimpleModifier modifier(*formatter, kRDTLiteralField, false); - modifier.formatAsPrefixSuffix( - output.getStringRef(), 0, output.getStringRef().length(), status); -} - -UnicodeString& RelativeDateTimeFormatter::format( - UDateDirection direction, - UDateAbsoluteUnit unit, - UnicodeString& appendTo, - UErrorCode& status) const { - return doFormat( - &RelativeDateTimeFormatter::formatAbsoluteImpl, - appendTo, - status, - direction, - unit); -} - -FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue( - UDateDirection direction, - UDateAbsoluteUnit unit, - UErrorCode& status) const { - return doFormatToValue( - &RelativeDateTimeFormatter::formatAbsoluteImpl, - status, - direction, - unit); -} - -void RelativeDateTimeFormatter::formatAbsoluteImpl( - UDateDirection direction, - UDateAbsoluteUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const { - if (U_FAILURE(status)) { - return; - } - if (unit == UDAT_ABSOLUTE_NOW && direction != UDAT_DIRECTION_PLAIN) { - status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - - // Get string using fallback. - output.getStringRef().append( - fCache->getAbsoluteUnitString(fStyle, unit, direction), - kRDTLiteralField, - status); -} - -UnicodeString& RelativeDateTimeFormatter::format( - double offset, - URelativeDateTimeUnit unit, - UnicodeString& appendTo, - UErrorCode& status) const { - return doFormat( - &RelativeDateTimeFormatter::formatRelativeImpl, - appendTo, - status, - offset, - unit); -} - -FormattedRelativeDateTime RelativeDateTimeFormatter::formatToValue( - double offset, - URelativeDateTimeUnit unit, - UErrorCode& status) const { - return doFormatToValue( - &RelativeDateTimeFormatter::formatRelativeImpl, - status, - offset, - unit); -} - -void RelativeDateTimeFormatter::formatRelativeImpl( - double offset, - URelativeDateTimeUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const { - if (U_FAILURE(status)) { - return; - } - // TODO: - // The full implementation of this depends on CLDR data that is not yet available, - // see: http://unicode.org/cldr/trac/ticket/9165 Add more relative field data. - // In the meantime do a quick bring-up by calling the old format method; this - // leaves some holes (even for data that is currently available, such as quarter). - // When the new CLDR data is available, update the data storage accordingly, - // rewrite this to use it directly, and rewrite the old format method to call this - // new one; that is covered by http://bugs.icu-project.org/trac/ticket/12171. - UDateDirection direction = UDAT_DIRECTION_COUNT; - if (offset > -2.1 && offset < 2.1) { - // Allow a 1% epsilon, so offsets in -1.01..-0.99 map to LAST - double offsetx100 = offset * 100.0; - int32_t intoffset = (offsetx100 < 0)? (int32_t)(offsetx100-0.5) : (int32_t)(offsetx100+0.5); - switch (intoffset) { - case -200/*-2*/: direction = UDAT_DIRECTION_LAST_2; break; - case -100/*-1*/: direction = UDAT_DIRECTION_LAST; break; - case 0/* 0*/: direction = UDAT_DIRECTION_THIS; break; - case 100/* 1*/: direction = UDAT_DIRECTION_NEXT; break; - case 200/* 2*/: direction = UDAT_DIRECTION_NEXT_2; break; - default: break; - } - } - UDateAbsoluteUnit absunit = UDAT_ABSOLUTE_UNIT_COUNT; - switch (unit) { - case UDAT_REL_UNIT_YEAR: absunit = UDAT_ABSOLUTE_YEAR; break; - case UDAT_REL_UNIT_QUARTER: absunit = UDAT_ABSOLUTE_QUARTER; break; - case UDAT_REL_UNIT_MONTH: absunit = UDAT_ABSOLUTE_MONTH; break; - case UDAT_REL_UNIT_WEEK: absunit = UDAT_ABSOLUTE_WEEK; break; - case UDAT_REL_UNIT_DAY: absunit = UDAT_ABSOLUTE_DAY; break; - case UDAT_REL_UNIT_SECOND: - if (direction == UDAT_DIRECTION_THIS) { - absunit = UDAT_ABSOLUTE_NOW; - direction = UDAT_DIRECTION_PLAIN; - } - break; - case UDAT_REL_UNIT_SUNDAY: absunit = UDAT_ABSOLUTE_SUNDAY; break; - case UDAT_REL_UNIT_MONDAY: absunit = UDAT_ABSOLUTE_MONDAY; break; - case UDAT_REL_UNIT_TUESDAY: absunit = UDAT_ABSOLUTE_TUESDAY; break; - case UDAT_REL_UNIT_WEDNESDAY: absunit = UDAT_ABSOLUTE_WEDNESDAY; break; - case UDAT_REL_UNIT_THURSDAY: absunit = UDAT_ABSOLUTE_THURSDAY; break; - case UDAT_REL_UNIT_FRIDAY: absunit = UDAT_ABSOLUTE_FRIDAY; break; - case UDAT_REL_UNIT_SATURDAY: absunit = UDAT_ABSOLUTE_SATURDAY; break; - case UDAT_REL_UNIT_HOUR: absunit = UDAT_ABSOLUTE_HOUR; break; - case UDAT_REL_UNIT_MINUTE: absunit = UDAT_ABSOLUTE_MINUTE; break; - default: break; - } - if (direction != UDAT_DIRECTION_COUNT && absunit != UDAT_ABSOLUTE_UNIT_COUNT) { - formatAbsoluteImpl(direction, absunit, output, status); - if (output.getStringRef().length() != 0) { - return; - } - } - // otherwise fallback to formatNumeric - formatNumericImpl(offset, unit, output, status); -} - -UnicodeString& RelativeDateTimeFormatter::combineDateAndTime( - const UnicodeString& relativeDateString, const UnicodeString& timeString, - UnicodeString& appendTo, UErrorCode& status) const { - return fCache->getCombinedDateAndTime()->format( - timeString, relativeDateString, appendTo, status); -} - -UnicodeString& RelativeDateTimeFormatter::adjustForContext(UnicodeString &str) const { - if (fOptBreakIterator == nullptr - || str.length() == 0 || !u_islower(str.char32At(0))) { - return str; - } - - // Must guarantee that one thread at a time accesses the shared break - // iterator. - static UMutex gBrkIterMutex; - Mutex lock(&gBrkIterMutex); - str.toTitle( - fOptBreakIterator->get(), - fLocale, - U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT); - return str; -} - -UBool RelativeDateTimeFormatter::checkNoAdjustForContext(UErrorCode& status) const { - // This is unsupported because it's hard to keep fields in sync with title - // casing. The code could be written and tested if there is demand. - if (fOptBreakIterator != nullptr) { - status = U_UNSUPPORTED_ERROR; - return FALSE; - } - return TRUE; -} - -void RelativeDateTimeFormatter::init( - NumberFormat *nfToAdopt, - BreakIterator *biToAdopt, - UErrorCode &status) { - LocalPointer nf(nfToAdopt); - LocalPointer bi(biToAdopt); - UnifiedCache::getByLocale(fLocale, fCache, status); - if (U_FAILURE(status)) { - return; - } - const SharedPluralRules *pr = PluralRules::createSharedInstance( - fLocale, UPLURAL_TYPE_CARDINAL, status); - if (U_FAILURE(status)) { - return; - } - SharedObject::copyPtr(pr, fPluralRules); - pr->removeRef(); - if (nf.isNull()) { - const SharedNumberFormat *shared = NumberFormat::createSharedInstance( - fLocale, UNUM_DECIMAL, status); - if (U_FAILURE(status)) { - return; - } - SharedObject::copyPtr(shared, fNumberFormat); - shared->removeRef(); - } else { - SharedNumberFormat *shared = new SharedNumberFormat(nf.getAlias()); - if (shared == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - nf.orphan(); - SharedObject::copyPtr(shared, fNumberFormat); - } - if (bi.isNull()) { - SharedObject::clearPtr(fOptBreakIterator); - } else { - SharedBreakIterator *shared = new SharedBreakIterator(bi.getAlias()); - if (shared == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return; - } - bi.orphan(); - SharedObject::copyPtr(shared, fOptBreakIterator); - } -} - -U_NAMESPACE_END - -// Plain C API - -U_NAMESPACE_USE - - -// Magic number: "FRDT" (FormattedRelativeDateTime) in ASCII -UPRV_FORMATTED_VALUE_CAPI_AUTO_IMPL( - FormattedRelativeDateTime, - UFormattedRelativeDateTime, - UFormattedRelativeDateTimeImpl, - UFormattedRelativeDateTimeApiHelper, - ureldatefmt, - 0x46524454) - - -U_CAPI URelativeDateTimeFormatter* U_EXPORT2 -ureldatefmt_open( const char* locale, - UNumberFormat* nfToAdopt, - UDateRelativeDateTimeFormatterStyle width, - UDisplayContext capitalizationContext, - UErrorCode* status ) -{ - if (U_FAILURE(*status)) { - return nullptr; - } - LocalPointer formatter(new RelativeDateTimeFormatter(Locale(locale), - (NumberFormat*)nfToAdopt, width, - capitalizationContext, *status), *status); - if (U_FAILURE(*status)) { - return nullptr; - } - return (URelativeDateTimeFormatter*)formatter.orphan(); -} - -U_CAPI void U_EXPORT2 -ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt) -{ - delete (RelativeDateTimeFormatter*)reldatefmt; -} - -U_CAPI int32_t U_EXPORT2 -ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, - double offset, - URelativeDateTimeUnit unit, - UChar* result, - int32_t resultCapacity, - UErrorCode* status) -{ - if (U_FAILURE(*status)) { - return 0; - } - if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - UnicodeString res; - if (result != nullptr) { - // nullptr destination for pure preflighting: empty dummy string - // otherwise, alias the destination buffer (copied from udat_format) - res.setTo(result, 0, resultCapacity); - } - ((RelativeDateTimeFormatter*)reldatefmt)->formatNumeric(offset, unit, res, *status); - if (U_FAILURE(*status)) { - return 0; - } - return res.extract(result, resultCapacity, *status); -} - -U_STABLE void U_EXPORT2 -ureldatefmt_formatNumericToResult( - const URelativeDateTimeFormatter* reldatefmt, - double offset, - URelativeDateTimeUnit unit, - UFormattedRelativeDateTime* result, - UErrorCode* status) { - if (U_FAILURE(*status)) { - return; - } - auto* fmt = reinterpret_cast(reldatefmt); - auto* resultImpl = UFormattedRelativeDateTimeApiHelper::validate(result, *status); - resultImpl->fImpl = fmt->formatNumericToValue(offset, unit, *status); -} - -U_CAPI int32_t U_EXPORT2 -ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, - double offset, - URelativeDateTimeUnit unit, - UChar* result, - int32_t resultCapacity, - UErrorCode* status) -{ - if (U_FAILURE(*status)) { - return 0; - } - if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - UnicodeString res; - if (result != nullptr) { - // nullptr destination for pure preflighting: empty dummy string - // otherwise, alias the destination buffer (copied from udat_format) - res.setTo(result, 0, resultCapacity); - } - ((RelativeDateTimeFormatter*)reldatefmt)->format(offset, unit, res, *status); - if (U_FAILURE(*status)) { - return 0; - } - return res.extract(result, resultCapacity, *status); -} - -U_DRAFT void U_EXPORT2 -ureldatefmt_formatToResult( - const URelativeDateTimeFormatter* reldatefmt, - double offset, - URelativeDateTimeUnit unit, - UFormattedRelativeDateTime* result, - UErrorCode* status) { - if (U_FAILURE(*status)) { - return; - } - auto* fmt = reinterpret_cast(reldatefmt); - auto* resultImpl = UFormattedRelativeDateTimeApiHelper::validate(result, *status); - resultImpl->fImpl = fmt->formatToValue(offset, unit, *status); -} - -U_CAPI int32_t U_EXPORT2 -ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt, - const UChar * relativeDateString, - int32_t relativeDateStringLen, - const UChar * timeString, - int32_t timeStringLen, - UChar* result, - int32_t resultCapacity, - UErrorCode* status ) -{ - if (U_FAILURE(*status)) { - return 0; - } - if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0 || - (relativeDateString == nullptr ? relativeDateStringLen != 0 : relativeDateStringLen < -1) || - (timeString == nullptr ? timeStringLen != 0 : timeStringLen < -1)) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - UnicodeString relDateStr((UBool)(relativeDateStringLen == -1), relativeDateString, relativeDateStringLen); - UnicodeString timeStr((UBool)(timeStringLen == -1), timeString, timeStringLen); - UnicodeString res(result, 0, resultCapacity); - ((RelativeDateTimeFormatter*)reldatefmt)->combineDateAndTime(relDateStr, timeStr, res, *status); - if (U_FAILURE(*status)) { - return 0; - } - return res.extract(result, resultCapacity, *status); -} - -#endif /* !UCONFIG_NO_FORMATTING */ diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp index 1c8c44a88..7015c1308 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp @@ -19,7 +19,7 @@ #include "unicode/smpdtfmt.h" #include "unicode/udisplaycontext.h" #include "unicode/uchar.h" -// #include "unicode/brkiter.h" +#include "unicode/brkiter.h" #include "unicode/ucasemap.h" #include "reldtfmt.h" #include "cmemory.h" @@ -34,26 +34,26 @@ U_NAMESPACE_BEGIN struct URelativeString { int32_t offset; /** offset of this item, such as, the relative date **/ int32_t len; /** length of the string **/ - const UChar* string; /** string, or NULL if not set **/ + const char16_t* string; /** string, or nullptr if not set **/ }; UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RelativeDateFormat) RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) : - DateFormat(other), fDateTimeFormatter(NULL), fDatePattern(other.fDatePattern), - fTimePattern(other.fTimePattern), fCombinedFormat(NULL), + DateFormat(other), fDateTimeFormatter(nullptr), fDatePattern(other.fDatePattern), + fTimePattern(other.fTimePattern), fCombinedFormat(nullptr), fDateStyle(other.fDateStyle), fLocale(other.fLocale), - fDatesLen(other.fDatesLen), fDates(NULL), + fDatesLen(other.fDatesLen), fDates(nullptr), fCombinedHasDateAtStart(other.fCombinedHasDateAtStart), fCapitalizationInfoSet(other.fCapitalizationInfoSet), fCapitalizationOfRelativeUnitsForUIListMenu(other.fCapitalizationOfRelativeUnitsForUIListMenu), fCapitalizationOfRelativeUnitsForStandAlone(other.fCapitalizationOfRelativeUnitsForStandAlone), - fCapitalizationBrkIter(NULL) + fCapitalizationBrkIter(nullptr) { - if(other.fDateTimeFormatter != NULL) { + if(other.fDateTimeFormatter != nullptr) { fDateTimeFormatter = other.fDateTimeFormatter->clone(); } - if(other.fCombinedFormat != NULL) { + if(other.fCombinedFormat != nullptr) { fCombinedFormat = new SimpleFormatter(*other.fCombinedFormat); } if (fDatesLen > 0) { @@ -61,7 +61,7 @@ RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) : uprv_memcpy(fDates, other.fDates, sizeof(fDates[0])*(size_t)fDatesLen); } #if !UCONFIG_NO_BREAK_ITERATION - if (other.fCapitalizationBrkIter != NULL) { + if (other.fCapitalizationBrkIter != nullptr) { fCapitalizationBrkIter = (other.fCapitalizationBrkIter)->clone(); } #endif @@ -69,15 +69,23 @@ RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) : RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const Locale& locale, UErrorCode& status) : - DateFormat(), fDateTimeFormatter(NULL), fDatePattern(), fTimePattern(), fCombinedFormat(NULL), - fDateStyle(dateStyle), fLocale(locale), fDatesLen(0), fDates(NULL), - fCombinedHasDateAtStart(FALSE), fCapitalizationInfoSet(FALSE), - fCapitalizationOfRelativeUnitsForUIListMenu(FALSE), fCapitalizationOfRelativeUnitsForStandAlone(FALSE), - fCapitalizationBrkIter(NULL) + DateFormat(), fDateTimeFormatter(nullptr), fDatePattern(), fTimePattern(), fCombinedFormat(nullptr), + fDateStyle(dateStyle), fLocale(locale), fDatesLen(0), fDates(nullptr), + fCombinedHasDateAtStart(false), fCapitalizationInfoSet(false), + fCapitalizationOfRelativeUnitsForUIListMenu(false), fCapitalizationOfRelativeUnitsForStandAlone(false), + fCapitalizationBrkIter(nullptr) { if(U_FAILURE(status) ) { return; } + if (dateStyle != UDAT_FULL_RELATIVE && + dateStyle != UDAT_LONG_RELATIVE && + dateStyle != UDAT_MEDIUM_RELATIVE && + dateStyle != UDAT_SHORT_RELATIVE && + dateStyle != UDAT_RELATIVE) { + status = U_ILLEGAL_ARGUMENT_ERROR; + return; + } if (timeStyle < UDAT_NONE || timeStyle > UDAT_SHORT) { // don't support other time styles (e.g. relative styles), for now @@ -91,7 +99,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS if (baseDateStyle != UDAT_NONE) { df = createDateInstance((EStyle)baseDateStyle, locale); fDateTimeFormatter=dynamic_cast(df); - if (fDateTimeFormatter == NULL) { + if (fDateTimeFormatter == nullptr) { status = U_UNSUPPORTED_ERROR; return; } @@ -99,7 +107,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS if (timeStyle != UDAT_NONE) { df = createTimeInstance((EStyle)timeStyle, locale); SimpleDateFormat *sdf = dynamic_cast(df); - if (sdf != NULL) { + if (sdf != nullptr) { sdf->toPattern(fTimePattern); delete sdf; } @@ -108,7 +116,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS // does not matter whether timeStyle is UDAT_NONE, we need something for fDateTimeFormatter df = createTimeInstance((EStyle)timeStyle, locale); fDateTimeFormatter=dynamic_cast(df); - if (fDateTimeFormatter == NULL) { + if (fDateTimeFormatter == nullptr) { status = U_UNSUPPORTED_ERROR; delete df; return; @@ -117,7 +125,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS } // Initialize the parent fCalendar, so that parse() works correctly. - initializeCalendar(NULL, locale, status); + initializeCalendar(nullptr, locale, status); loadDates(status); } @@ -146,35 +154,35 @@ bool RelativeDateFormat::operator==(const Format& other) const { fTimePattern==that->fTimePattern && fLocale==that->fLocale ); } - return FALSE; + return false; } -static const UChar APOSTROPHE = (UChar)0x0027; +static const char16_t APOSTROPHE = (char16_t)0x0027; UnicodeString& RelativeDateFormat::format( Calendar& cal, UnicodeString& appendTo, FieldPosition& pos) const { - + UErrorCode status = U_ZERO_ERROR; UnicodeString relativeDayString; UDisplayContext capitalizationContext = getContext(UDISPCTX_TYPE_CAPITALIZATION, status); - + // calculate the difference, in days, between 'cal' and now. int dayDiff = dayDifference(cal, status); // look up string int32_t len = 0; - const UChar *theString = getStringForDay(dayDiff, len, status); - if(U_SUCCESS(status) && (theString!=NULL)) { + const char16_t *theString = getStringForDay(dayDiff, len, status); + if(U_SUCCESS(status) && (theString!=nullptr)) { // found a relative string relativeDayString.setTo(theString, len); } - if ( relativeDayString.length() > 0 && !fDatePattern.isEmpty() && - (fTimePattern.isEmpty() || fCombinedFormat == NULL || fCombinedHasDateAtStart)) { + if ( relativeDayString.length() > 0 && !fDatePattern.isEmpty() && + (fTimePattern.isEmpty() || fCombinedFormat == nullptr || fCombinedHasDateAtStart)) { #if !UCONFIG_NO_BREAK_ITERATION // capitalize relativeDayString according to context for relative, set formatter no context - if ( u_islower(relativeDayString.char32At(0)) && fCapitalizationBrkIter!= NULL && + if ( u_islower(relativeDayString.char32At(0)) && fCapitalizationBrkIter!= nullptr && ( capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || (capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && fCapitalizationOfRelativeUnitsForUIListMenu) || (capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && fCapitalizationOfRelativeUnitsForStandAlone) ) ) { @@ -191,7 +199,7 @@ UnicodeString& RelativeDateFormat::format( Calendar& cal, if (fDatePattern.isEmpty()) { fDateTimeFormatter->applyPattern(fTimePattern); fDateTimeFormatter->format(cal,appendTo,pos); - } else if (fTimePattern.isEmpty() || fCombinedFormat == NULL) { + } else if (fTimePattern.isEmpty() || fCombinedFormat == nullptr) { if (relativeDayString.length() > 0) { appendTo.append(relativeDayString); } else { @@ -221,8 +229,8 @@ UnicodeString& RelativeDateFormat::format( Calendar& cal, UnicodeString& -RelativeDateFormat::format(const Formattable& obj, - UnicodeString& appendTo, +RelativeDateFormat::format(const Formattable& obj, + UnicodeString& appendTo, FieldPosition& pos, UErrorCode& status) const { @@ -243,22 +251,22 @@ void RelativeDateFormat::parse( const UnicodeString& text, // no date pattern, try parsing as time fDateTimeFormatter->applyPattern(fTimePattern); fDateTimeFormatter->parse(text,cal,pos); - } else if (fTimePattern.isEmpty() || fCombinedFormat == NULL) { + } else if (fTimePattern.isEmpty() || fCombinedFormat == nullptr) { // no time pattern or way to combine, try parsing as date // first check whether text matches a relativeDayString - UBool matchedRelative = FALSE; + UBool matchedRelative = false; for (int n=0; n < fDatesLen && !matchedRelative; n++) { - if (fDates[n].string != NULL && + if (fDates[n].string != nullptr && text.compare(startIndex, fDates[n].len, fDates[n].string) == 0) { // it matched, handle the relative day string UErrorCode status = U_ZERO_ERROR; - matchedRelative = TRUE; + matchedRelative = true; // Set the calendar to now+offset cal.setTime(Calendar::getNow(),status); cal.add(UCAL_DATE,fDates[n].offset, status); - if(U_FAILURE(status)) { + if(U_FAILURE(status)) { // failure in setting calendar field, set offset to beginning of rel day string pos.setErrorIndex(startIndex); } else { @@ -280,7 +288,7 @@ void RelativeDateFormat::parse( const UnicodeString& text, UErrorCode status = U_ZERO_ERROR; for (int n=0; n < fDatesLen; n++) { int32_t relativeStringOffset; - if (fDates[n].string != NULL && + if (fDates[n].string != nullptr && (relativeStringOffset = modifiedText.indexOf(fDates[n].string, fDates[n].len, startIndex)) >= startIndex) { // it matched, replace the relative date with a real one for parsing UnicodeString dateString; @@ -289,7 +297,7 @@ void RelativeDateFormat::parse( const UnicodeString& text, // Set the calendar to now+offset tempCal->setTime(Calendar::getNow(),status); tempCal->add(UCAL_DATE,fDates[n].offset, status); - if(U_FAILURE(status)) { + if(U_FAILURE(status)) { pos.setErrorIndex(startIndex); delete tempCal; return; @@ -334,7 +342,7 @@ UDate RelativeDateFormat::parse( const UnicodeString& text, ParsePosition& pos) const { // redefined here because the other parse() function hides this function's - // cunterpart on DateFormat + // counterpart on DateFormat return DateFormat::parse(text, pos); } @@ -347,20 +355,20 @@ RelativeDateFormat::parse(const UnicodeString& text, UErrorCode& status) const } -const UChar *RelativeDateFormat::getStringForDay(int32_t day, int32_t &len, UErrorCode &status) const { +const char16_t *RelativeDateFormat::getStringForDay(int32_t day, int32_t &len, UErrorCode &status) const { if(U_FAILURE(status)) { - return NULL; + return nullptr; } // Is it inside the resource bundle's range? int n = day + UDAT_DIRECTION_THIS; if (n >= 0 && n < fDatesLen) { - if (fDates[n].offset == day && fDates[n].string != NULL) { + if (fDates[n].offset == day && fDates[n].string != nullptr) { len = fDates[n].len; return fDates[n].string; } } - return NULL; // not found. + return nullptr; // not found. } UnicodeString& @@ -370,7 +378,7 @@ RelativeDateFormat::toPattern(UnicodeString& result, UErrorCode& status) const result.remove(); if (fDatePattern.isEmpty()) { result.setTo(fTimePattern); - } else if (fTimePattern.isEmpty() || fCombinedFormat == NULL) { + } else if (fTimePattern.isEmpty() || fCombinedFormat == nullptr) { result.setTo(fDatePattern); } else { fCombinedFormat->format(fTimePattern, fDatePattern, result, status); @@ -424,17 +432,17 @@ RelativeDateFormat::setContext(UDisplayContext value, UErrorCode& status) if (!fCapitalizationInfoSet && (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE)) { initCapitalizationContextInfo(fLocale); - fCapitalizationInfoSet = TRUE; + fCapitalizationInfoSet = true; } #if !UCONFIG_NO_BREAK_ITERATION - if ( fCapitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || + if ( fCapitalizationBrkIter == nullptr && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && fCapitalizationOfRelativeUnitsForUIListMenu) || (value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && fCapitalizationOfRelativeUnitsForStandAlone)) ) { status = U_ZERO_ERROR; fCapitalizationBrkIter = BreakIterator::createSentenceInstance(fLocale, status); if (U_FAILURE(status)) { delete fCapitalizationBrkIter; - fCapitalizationBrkIter = NULL; + fCapitalizationBrkIter = nullptr; } } #endif @@ -445,17 +453,17 @@ void RelativeDateFormat::initCapitalizationContextInfo(const Locale& thelocale) { #if !UCONFIG_NO_BREAK_ITERATION - const char * localeID = (thelocale != NULL)? thelocale.getBaseName(): NULL; + const char * localeID = (thelocale != nullptr)? thelocale.getBaseName(): nullptr; UErrorCode status = U_ZERO_ERROR; - LocalUResourceBundlePointer rb(ures_open(NULL, localeID, &status)); + LocalUResourceBundlePointer rb(ures_open(nullptr, localeID, &status)); ures_getByKeyWithFallback(rb.getAlias(), "contextTransforms/relative", rb.getAlias(), &status); - if (U_SUCCESS(status) && rb != NULL) { + if (U_SUCCESS(status) && rb != nullptr) { int32_t len = 0; const int32_t * intVector = ures_getIntVector(rb.getAlias(), &len, &status); - if (U_SUCCESS(status) && intVector != NULL && len >= 2) { + if (U_SUCCESS(status) && intVector != nullptr && len >= 2) { fCapitalizationOfRelativeUnitsForUIListMenu = static_cast(intVector[0]); fCapitalizationOfRelativeUnitsForStandAlone = static_cast(intVector[1]); } @@ -477,7 +485,7 @@ struct RelDateFmtDataSink : public ResourceSink { RelDateFmtDataSink(URelativeString* fDates, int32_t len) : fDatesPtr(fDates), fDatesLen(len) { for (int32_t i = 0; i < fDatesLen; ++i) { fDatesPtr[i].offset = 0; - fDatesPtr[i].string = NULL; + fDatesPtr[i].string = nullptr; fDatesPtr[i].len = -1; } } @@ -485,7 +493,7 @@ struct RelDateFmtDataSink : public ResourceSink { virtual ~RelDateFmtDataSink(); virtual void put(const char *key, ResourceValue &value, - UBool /*noFallback*/, UErrorCode &errorCode) { + UBool /*noFallback*/, UErrorCode &errorCode) override { ResourceTable relDayTable = value.getTable(errorCode); int32_t n = 0; int32_t len = 0; @@ -495,7 +503,7 @@ struct RelDateFmtDataSink : public ResourceSink { // Put in the proper spot, but don't override existing data. n = offset + UDAT_DIRECTION_THIS; // Converts to index in UDAT_R - if (n < fDatesLen && fDatesPtr[n].string == NULL) { + if (n < fDatesLen && fDatesPtr[n].string == nullptr) { // Not found and n is an empty slot. fDatesPtr[n].offset = offset; fDatesPtr[n].string = value.getString(len, errorCode); @@ -512,15 +520,15 @@ RelDateFmtDataSink::~RelDateFmtDataSink() {} } // Namespace -static const UChar patItem1[] = {0x7B,0x31,0x7D}; // "{1}" +static const char16_t patItem1[] = {0x7B,0x31,0x7D}; // "{1}" static const int32_t patItem1Len = 3; void RelativeDateFormat::loadDates(UErrorCode &status) { - UResourceBundle *rb = ures_open(NULL, fLocale.getBaseName(), &status); + UResourceBundle *rb = ures_open(nullptr, fLocale.getBaseName(), &status); LocalUResourceBundlePointer dateTimePatterns( ures_getByKeyWithFallback(rb, "calendar/gregorian/DateTimePatterns", - (UResourceBundle*)NULL, &status)); + (UResourceBundle*)nullptr, &status)); if(U_SUCCESS(status)) { int32_t patternsSize = ures_getSize(dateTimePatterns.getAlias()); if (patternsSize > kDateTime) { @@ -534,11 +542,11 @@ void RelativeDateFormat::loadDates(UErrorCode &status) { } } - const UChar *resStr = ures_getStringByIndex(dateTimePatterns.getAlias(), glueIndex, &resStrLen, &status); + const char16_t *resStr = ures_getStringByIndex(dateTimePatterns.getAlias(), glueIndex, &resStrLen, &status); if (U_SUCCESS(status) && resStrLen >= patItem1Len && u_strncmp(resStr,patItem1,patItem1Len)==0) { - fCombinedHasDateAtStart = TRUE; + fCombinedHasDateAtStart = true; } - fCombinedFormat = new SimpleFormatter(UnicodeString(TRUE, resStr, resStrLen), 2, 2, status); + fCombinedFormat = new SimpleFormatter(UnicodeString(true, resStr, resStrLen), 2, 2, status); } } @@ -567,7 +575,7 @@ RelativeDateFormat::initializeCalendar(TimeZone* adoptZone, const Locale& locale if(!U_FAILURE(status)) { fCalendar = Calendar::createInstance(adoptZone?adoptZone:TimeZone::createDefault(), locale, status); } - if (U_SUCCESS(status) && fCalendar == NULL) { + if (U_SUCCESS(status) && fCalendar == nullptr) { status = U_MEMORY_ALLOCATION_ERROR; } return fCalendar; @@ -582,7 +590,7 @@ int32_t RelativeDateFormat::dayDifference(Calendar &cal, UErrorCode &status) { nowCal->setTime(Calendar::getNow(), status); // For the day difference, we are interested in the difference in the (modified) julian day number - // which is midnight to midnight. Using fieldDifference() is NOT correct here, because + // which is midnight to midnight. Using fieldDifference() is NOT correct here, because // 6pm Jan 4th to 10am Jan 5th should be considered "tomorrow". int32_t dayDiff = cal.get(UCAL_JULIAN_DAY, status) - nowCal->get(UCAL_JULIAN_DAY, status); diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.h b/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.h index 24fffb7b5..3af43d49c 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.h @@ -21,7 +21,7 @@ #include "unicode/datefmt.h" #include "unicode/smpdtfmt.h" -// #include "unicode/brkiter.h" +#include "unicode/brkiter.h" U_NAMESPACE_BEGIN @@ -71,7 +71,7 @@ class RelativeDateFormat : public DateFormat { * @return A copy of the object. * @internal ICU 3.8 */ - virtual RelativeDateFormat* clone() const; + virtual RelativeDateFormat* clone() const override; /** * Return true if the given Format objects are semantically equal. Objects @@ -80,7 +80,7 @@ class RelativeDateFormat : public DateFormat { * @return true if the given Format objects are semantically equal. * @internal ICU 3.8 */ - virtual bool operator==(const Format& other) const; + virtual bool operator==(const Format& other) const override; using DateFormat::format; @@ -103,7 +103,7 @@ class RelativeDateFormat : public DateFormat { */ virtual UnicodeString& format( Calendar& cal, UnicodeString& appendTo, - FieldPosition& pos) const; + FieldPosition& pos) const override; /** * Format an object to produce a string. This method handles Formattable @@ -122,7 +122,7 @@ class RelativeDateFormat : public DateFormat { virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, FieldPosition& pos, - UErrorCode& status) const; + UErrorCode& status) const override; /** @@ -146,7 +146,7 @@ class RelativeDateFormat : public DateFormat { */ virtual void parse( const UnicodeString& text, Calendar& cal, - ParsePosition& pos) const; + ParsePosition& pos) const override; /** * Parse a date/time string starting at the given parse position. For @@ -187,7 +187,7 @@ class RelativeDateFormat : public DateFormat { * @internal ICU 3.8 */ virtual UDate parse( const UnicodeString& text, - UErrorCode& status) const; + UErrorCode& status) const override; /** * Return a single pattern string generated by combining the patterns for the @@ -233,7 +233,7 @@ class RelativeDateFormat : public DateFormat { * with this date-time formatter. * @internal ICU 4.8 */ - virtual const DateFormatSymbols* getDateFormatSymbols(void) const; + virtual const DateFormatSymbols* getDateFormatSymbols() const; /** * Set a particular UDisplayContext value in the formatter, such as @@ -242,10 +242,10 @@ class RelativeDateFormat : public DateFormat { * @param value The UDisplayContext value to set. * @param status Input/output status. If at entry this indicates a failure * status, the function will do nothing; otherwise this will be - * updated with any new status from the function. + * updated with any new status from the function. * @internal ICU 53 */ - virtual void setContext(UDisplayContext value, UErrorCode& status); + virtual void setContext(UDisplayContext value, UErrorCode& status) override; private: SimpleDateFormat *fDateTimeFormatter; @@ -273,9 +273,9 @@ class RelativeDateFormat : public DateFormat { * Get the string at a specific offset. * @param day day offset ( -1, 0, 1, etc.. ) * @param len on output, length of string. - * @return the string, or NULL if none at that location. + * @return the string, or nullptr if none at that location. */ - const UChar *getStringForDay(int32_t day, int32_t &len, UErrorCode &status) const; + const char16_t *getStringForDay(int32_t day, int32_t &len, UErrorCode &status) const; /** * Load the Date string array @@ -294,7 +294,7 @@ class RelativeDateFormat : public DateFormat { /** * initializes fCalendar from parameters. Returns fCalendar as a convenience. - * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault(). + * @param adoptZone Zone to be adopted, or nullptr for TimeZone::createDefault(). * @param locale Locale of the calendar * @param status Error code * @return the newly constructed fCalendar @@ -314,7 +314,7 @@ class RelativeDateFormat : public DateFormat { * @return The class ID for all objects of this class. * @internal ICU 3.8 */ - U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); /** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This @@ -327,7 +327,7 @@ class RelativeDateFormat : public DateFormat { * other classes have different class IDs. * @internal ICU 3.8 */ - virtual UClassID getDynamicClassID(void) const; + virtual UClassID getDynamicClassID() const override; }; diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/remtrans.h b/src/duckdb/extension/icu/third_party/icu/i18n/remtrans.h index 41a7e0e88..398cc5177 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/remtrans.h +++ b/src/duckdb/extension/icu/third_party/icu/i18n/remtrans.h @@ -1,80 +1,80 @@ -// // © 2016 and later: Unicode, Inc. and others. -// // License & terms of use: http://www.unicode.org/copyright.html -// /* -// ********************************************************************** -// * Copyright (c) 2001-2007, International Business Machines -// * Corporation and others. All Rights Reserved. -// ********************************************************************** -// * Date Name Description -// * 04/02/2001 aliu Creation. -// ********************************************************************** -// */ -// #ifndef REMTRANS_H -// #define REMTRANS_H - -// #include "unicode/utypes.h" - -// #if !UCONFIG_NO_TRANSLITERATION - -// #include "unicode/translit.h" - -// U_NAMESPACE_BEGIN - -// /** -// * A transliterator that removes text. -// * @author Alan Liu -// */ -// class RemoveTransliterator : public Transliterator { - -// public: - -// /** -// * Constructs a transliterator. -// */ -// RemoveTransliterator(); - -// /** -// * Destructor. -// */ -// virtual ~RemoveTransliterator(); - -// /** -// * System registration hook. -// */ -// static void registerIDs(); - -// /** -// * Transliterator API. -// * @return A copy of the object. -// */ -// virtual RemoveTransliterator* clone() const; - -// /** -// * Implements {@link Transliterator#handleTransliterate}. -// * @param text the buffer holding transliterated and -// * untransliterated text -// * @param offset the start and limit of the text, the position -// * of the cursor, and the start and limit of transliteration. -// * @param incremental if true, assume more text may be coming after -// * pos.contextLimit. Otherwise, assume the text is complete. -// */ -// virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, -// UBool isIncremental) const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for the actual class. -// */ -// virtual UClassID getDynamicClassID() const; - -// /** -// * ICU "poor man's RTTI", returns a UClassID for this class. -// */ -// U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); - -// }; - -// U_NAMESPACE_END - -// #endif /* #if !UCONFIG_NO_TRANSLITERATION */ - -// #endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2001-2007, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 04/02/2001 aliu Creation. +********************************************************************** +*/ +#ifndef REMTRANS_H +#define REMTRANS_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/translit.h" + +U_NAMESPACE_BEGIN + +/** + * A transliterator that removes text. + * @author Alan Liu + */ +class RemoveTransliterator : public Transliterator { + +public: + + /** + * Constructs a transliterator. + */ + RemoveTransliterator(); + + /** + * Destructor. + */ + virtual ~RemoveTransliterator(); + + /** + * System registration hook. + */ + static void registerIDs(); + + /** + * Transliterator API. + * @return A copy of the object. + */ + virtual RemoveTransliterator* clone() const override; + + /** + * Implements {@link Transliterator#handleTransliterate}. + * @param text the buffer holding transliterated and + * untransliterated text + * @param offset the start and limit of the text, the position + * of the cursor, and the start and limit of transliteration. + * @param incremental if true, assume more text may be coming after + * pos.contextLimit. Otherwise, assume the text is complete. + */ + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, + UBool isIncremental) const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + */ + virtual UClassID getDynamicClassID() const override; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + */ + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); + +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp index f00d536c2..cf4cfc87f 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp @@ -32,6 +32,7 @@ #include "unicode/utf8.h" #include "unicode/uversion.h" #include "bocsu.h" +#include "bytesinkutil.h" #include "charstr.h" #include "cmemory.h" #include "collation.h" @@ -50,6 +51,7 @@ #include "ucol_imp.h" #include "uhash.h" #include "uitercollationiterator.h" +#include "ulocimp.h" #include "ustr_imp.h" #include "utf16collationiterator.h" #include "utf8collationiterator.h" @@ -66,15 +68,15 @@ class FixedSortKeyByteSink : public SortKeyByteSink { virtual ~FixedSortKeyByteSink(); private: - virtual void AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length); - virtual UBool Resize(int32_t appendCapacity, int32_t length); + virtual void AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length) override; + virtual UBool Resize(int32_t appendCapacity, int32_t length) override; }; FixedSortKeyByteSink::~FixedSortKeyByteSink() {} void FixedSortKeyByteSink::AppendBeyondCapacity(const char *bytes, int32_t /*n*/, int32_t length) { - // buffer_ != NULL && bytes != NULL && n > 0 && appended_ > capacity_ + // buffer_ != nullptr && bytes != nullptr && n > 0 && appended_ > capacity_ // Fill the buffer completely. int32_t available = capacity_ - length; if (available > 0) { @@ -84,7 +86,7 @@ FixedSortKeyByteSink::AppendBeyondCapacity(const char *bytes, int32_t /*n*/, int UBool FixedSortKeyByteSink::Resize(int32_t /*appendCapacity*/, int32_t /*length*/) { - return FALSE; + return false; } } // namespace @@ -98,8 +100,8 @@ class CollationKeyByteSink : public SortKeyByteSink { virtual ~CollationKeyByteSink(); private: - virtual void AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length); - virtual UBool Resize(int32_t appendCapacity, int32_t length); + virtual void AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length) override; + virtual UBool Resize(int32_t appendCapacity, int32_t length) override; CollationKey &key_; }; @@ -108,7 +110,7 @@ CollationKeyByteSink::~CollationKeyByteSink() {} void CollationKeyByteSink::AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length) { - // buffer_ != NULL && bytes != NULL && n > 0 && appended_ > capacity_ + // buffer_ != nullptr && bytes != nullptr && n > 0 && appended_ > capacity_ if (Resize(n, length)) { uprv_memcpy(buffer_ + length, bytes, n); } @@ -116,8 +118,8 @@ CollationKeyByteSink::AppendBeyondCapacity(const char *bytes, int32_t n, int32_t UBool CollationKeyByteSink::Resize(int32_t appendCapacity, int32_t length) { - if (buffer_ == NULL) { - return FALSE; // allocation failed before already + if (buffer_ == nullptr) { + return false; // allocation failed before already } int32_t newCapacity = 2 * capacity_; int32_t altCapacity = length + 2 * appendCapacity; @@ -128,13 +130,13 @@ CollationKeyByteSink::Resize(int32_t appendCapacity, int32_t length) { newCapacity = 200; } uint8_t *newBuffer = key_.reallocate(newCapacity, length); - if (newBuffer == NULL) { + if (newBuffer == nullptr) { SetNotOk(); - return FALSE; + return false; } buffer_ = reinterpret_cast(newBuffer); capacity_ = newCapacity; - return TRUE; + return true; } RuleBasedCollator::RuleBasedCollator(const RuleBasedCollator &other) @@ -152,15 +154,15 @@ RuleBasedCollator::RuleBasedCollator(const RuleBasedCollator &other) RuleBasedCollator::RuleBasedCollator(const uint8_t *bin, int32_t length, const RuleBasedCollator *base, UErrorCode &errorCode) - : data(NULL), - settings(NULL), - tailoring(NULL), - cacheEntry(NULL), + : data(nullptr), + settings(nullptr), + tailoring(nullptr), + cacheEntry(nullptr), validLocale(""), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { + actualLocaleIsSameAsValid(false) { if(U_FAILURE(errorCode)) { return; } - if(bin == NULL || length == 0 || base == NULL) { + if(bin == nullptr || length == 0 || base == nullptr) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -188,7 +190,7 @@ RuleBasedCollator::RuleBasedCollator(const CollationCacheEntry *entry) cacheEntry(entry), validLocale(entry->validLocale), explicitlySetAttributes(0), - actualLocaleIsSameAsValid(FALSE) { + actualLocaleIsSameAsValid(false) { settings->addRef(); cacheEntry->addRef(); } @@ -204,9 +206,9 @@ RuleBasedCollator::adoptTailoring(CollationTailoring *t, UErrorCode &errorCode) t->deleteIfZeroRefCount(); return; } - U_ASSERT(settings == NULL && data == NULL && tailoring == NULL && cacheEntry == NULL); + U_ASSERT(settings == nullptr && data == nullptr && tailoring == nullptr && cacheEntry == nullptr); cacheEntry = new CollationCacheEntry(t->actualLocale, t); - if(cacheEntry == NULL) { + if(cacheEntry == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; t->deleteIfZeroRefCount(); return; @@ -217,7 +219,7 @@ RuleBasedCollator::adoptTailoring(CollationTailoring *t, UErrorCode &errorCode) tailoring = t; cacheEntry->addRef(); validLocale = t->actualLocale; - actualLocaleIsSameAsValid = FALSE; + actualLocaleIsSameAsValid = false; } RuleBasedCollator * @@ -241,19 +243,19 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedCollator) bool RuleBasedCollator::operator==(const Collator& other) const { - if(this == &other) { return TRUE; } - if(!Collator::operator==(other)) { return FALSE; } + if(this == &other) { return true; } + if(!Collator::operator==(other)) { return false; } const RuleBasedCollator &o = static_cast(other); - if(*settings != *o.settings) { return FALSE; } - if(data == o.data) { return TRUE; } - UBool thisIsRoot = data->base == NULL; - UBool otherIsRoot = o.data->base == NULL; + if(*settings != *o.settings) { return false; } + if(data == o.data) { return true; } + UBool thisIsRoot = data->base == nullptr; + UBool otherIsRoot = o.data->base == nullptr; U_ASSERT(!thisIsRoot || !otherIsRoot); // otherwise their data pointers should be == - if(thisIsRoot != otherIsRoot) { return FALSE; } + if(thisIsRoot != otherIsRoot) { return false; } if((thisIsRoot || !tailoring->rules.isEmpty()) && (otherIsRoot || !o.tailoring->rules.isEmpty())) { // Shortcut: If both collators have valid rule strings, then compare those. - if(tailoring->rules == o.tailoring->rules) { return TRUE; } + if(tailoring->rules == o.tailoring->rules) { return true; } } // Different rule strings can result in the same or equivalent tailoring. // The rule strings are optional in ICU resource bundles, although included by default. @@ -261,20 +263,20 @@ RuleBasedCollator::operator==(const Collator& other) const { UErrorCode errorCode = U_ZERO_ERROR; LocalPointer thisTailored(getTailoredSet(errorCode)); LocalPointer otherTailored(o.getTailoredSet(errorCode)); - if(U_FAILURE(errorCode)) { return FALSE; } - if(*thisTailored != *otherTailored) { return FALSE; } + if(U_FAILURE(errorCode)) { return false; } + if(*thisTailored != *otherTailored) { return false; } // For completeness, we should compare all of the mappings; // or we should create a list of strings, sort it with one collator, // and check if both collators compare adjacent strings the same // (order & strength, down to quaternary); or similar. // Testing equality of collators seems unusual. - return TRUE; + return true; } int32_t RuleBasedCollator::hashCode() const { int32_t h = settings->hashCode(); - if(data->base == NULL) { return h; } // root collator + if(data->base == nullptr) { return h; } // root collator // Do not rely on the rule string, see comments in operator==(). UErrorCode errorCode = U_ZERO_ERROR; LocalPointer set(getTailoredSet(errorCode)); @@ -290,10 +292,10 @@ void RuleBasedCollator::setLocales(const Locale &requested, const Locale &valid, const Locale &actual) { if(actual == tailoring->actualLocale) { - actualLocaleIsSameAsValid = FALSE; + actualLocaleIsSameAsValid = false; } else { U_ASSERT(actual == valid); - actualLocaleIsSameAsValid = TRUE; + actualLocaleIsSameAsValid = true; } // Do not modify tailoring.actualLocale: // We cannot be sure that that would be thread-safe. @@ -321,7 +323,7 @@ RuleBasedCollator::getLocale(ULocDataLocaleType type, UErrorCode& errorCode) con const char * RuleBasedCollator::internalGetLocaleID(ULocDataLocaleType type, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { - return NULL; + return nullptr; } const Locale *result; switch(type) { @@ -334,9 +336,9 @@ RuleBasedCollator::internalGetLocaleID(ULocDataLocaleType type, UErrorCode &erro case ULOC_REQUESTED_LOCALE: default: errorCode = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; + return nullptr; } - if(result->isBogus()) { return NULL; } + if(result->isBogus()) { return nullptr; } const char *id = result->getName(); return id[0] == 0 ? "root" : id; } @@ -366,17 +368,17 @@ RuleBasedCollator::getVersion(UVersionInfo version) const { UnicodeSet * RuleBasedCollator::getTailoredSet(UErrorCode &errorCode) const { - if(U_FAILURE(errorCode)) { return NULL; } + if(U_FAILURE(errorCode)) { return nullptr; } UnicodeSet *tailored = new UnicodeSet(); - if(tailored == NULL) { + if(tailored == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } - if(data->base != NULL) { + if(data->base != nullptr) { TailoredSet(tailored).forData(data, errorCode); if(U_FAILURE(errorCode)) { delete tailored; - return NULL; + return nullptr; } } return tailored; @@ -387,19 +389,19 @@ RuleBasedCollator::internalGetContractionsAndExpansions( UnicodeSet *contractions, UnicodeSet *expansions, UBool addPrefixes, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return; } - if(contractions != NULL) { + if(contractions != nullptr) { contractions->clear(); } - if(expansions != NULL) { + if(expansions != nullptr) { expansions->clear(); } - ContractionsAndExpansions(contractions, expansions, NULL, addPrefixes).forData(data, errorCode); + ContractionsAndExpansions(contractions, expansions, nullptr, addPrefixes).forData(data, errorCode); } void RuleBasedCollator::internalAddContractions(UChar32 c, UnicodeSet &set, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return; } - ContractionsAndExpansions(&set, NULL, NULL, FALSE).forCodePoint(data, c, errorCode); + ContractionsAndExpansions(&set, nullptr, nullptr, false).forCodePoint(data, c, errorCode); } const CollationSettings & @@ -457,7 +459,7 @@ RuleBasedCollator::setAttribute(UColAttribute attr, UColAttributeValue value, } } CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings); - if(ownedSettings == NULL) { + if(ownedSettings == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -532,13 +534,14 @@ RuleBasedCollator::setMaxVariable(UColReorderCode group, UErrorCode &errorCode) } } CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings); - if(ownedSettings == NULL) { + if(ownedSettings == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return *this; } if(group == UCOL_REORDER_CODE_DEFAULT) { - group = (UColReorderCode)(UCOL_REORDER_CODE_FIRST + defaultSettings.getMaxVariable()); + group = (UColReorderCode)( + UCOL_REORDER_CODE_FIRST + int32_t{defaultSettings.getMaxVariable()}); } uint32_t varTop = data->getLastPrimaryForGroup(group); U_ASSERT(varTop != 0); @@ -556,7 +559,7 @@ RuleBasedCollator::setMaxVariable(UColReorderCode group, UErrorCode &errorCode) UColReorderCode RuleBasedCollator::getMaxVariable() const { - return (UColReorderCode)(UCOL_REORDER_CODE_FIRST + settings->getMaxVariable()); + return (UColReorderCode)(UCOL_REORDER_CODE_FIRST + int32_t{settings->getMaxVariable()}); } uint32_t @@ -565,9 +568,9 @@ RuleBasedCollator::getVariableTop(UErrorCode & /*errorCode*/) const { } uint32_t -RuleBasedCollator::setVariableTop(const UChar *varTop, int32_t len, UErrorCode &errorCode) { +RuleBasedCollator::setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return 0; } - if(varTop == NULL && len !=0) { + if(varTop == nullptr && len !=0) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -616,7 +619,7 @@ RuleBasedCollator::setVariableTop(uint32_t varTop, UErrorCode &errorCode) { varTop = v; if(varTop != settings->variableTop) { CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings); - if(ownedSettings == NULL) { + if(ownedSettings == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -638,7 +641,7 @@ int32_t RuleBasedCollator::getReorderCodes(int32_t *dest, int32_t capacity, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return 0; } - if(capacity < 0 || (dest == NULL && capacity > 0)) { + if(capacity < 0 || (dest == nullptr && capacity > 0)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -656,7 +659,7 @@ void RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length, UErrorCode &errorCode) { if(U_FAILURE(errorCode)) { return; } - if(length < 0 || (reorderCodes == NULL && length > 0)) { + if(length < 0 || (reorderCodes == nullptr && length > 0)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -671,7 +674,7 @@ RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length, if(length == 1 && reorderCodes[0] == UCOL_REORDER_CODE_DEFAULT) { if(settings != &defaultSettings) { CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings); - if(ownedSettings == NULL) { + if(ownedSettings == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -681,7 +684,7 @@ RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length, return; } CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings); - if(ownedSettings == NULL) { + if(ownedSettings == nullptr) { errorCode = U_MEMORY_ALLOCATION_ERROR; return; } @@ -721,11 +724,11 @@ RuleBasedCollator::compare(const UnicodeString &left, const UnicodeString &right } UCollationResult -RuleBasedCollator::compare(const UChar *left, int32_t leftLength, - const UChar *right, int32_t rightLength, +RuleBasedCollator::compare(const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return UCOL_EQUAL; } - if((left == NULL && leftLength != 0) || (right == NULL && rightLength != 0)) { + if((left == nullptr && leftLength != 0) || (right == nullptr && rightLength != 0)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return UCOL_EQUAL; } @@ -745,7 +748,7 @@ RuleBasedCollator::compareUTF8(const StringPiece &left, const StringPiece &right if(U_FAILURE(errorCode)) { return UCOL_EQUAL; } const uint8_t *leftBytes = reinterpret_cast(left.data()); const uint8_t *rightBytes = reinterpret_cast(right.data()); - if((leftBytes == NULL && !left.empty()) || (rightBytes == NULL && !right.empty())) { + if((leftBytes == nullptr && !left.empty()) || (rightBytes == nullptr && !right.empty())) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return UCOL_EQUAL; } @@ -757,7 +760,7 @@ RuleBasedCollator::internalCompareUTF8(const char *left, int32_t leftLength, const char *right, int32_t rightLength, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return UCOL_EQUAL; } - if((left == NULL && leftLength != 0) || (right == NULL && rightLength != 0)) { + if((left == nullptr && leftLength != 0) || (right == nullptr && rightLength != 0)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return UCOL_EQUAL; } @@ -808,7 +811,7 @@ class NFDIterator : public UObject { UChar32 nextDecomposedCodePoint(const Normalizer2Impl &nfcImpl, UChar32 c) { if(index >= 0) { return c; } decomp = nfcImpl.getDecomposition(c, buffer, length); - if(decomp == NULL) { return c; } + if(decomp == nullptr) { return c; } index = 0; U16_NEXT_UNSAFE(decomp, index, c); return c; @@ -820,24 +823,24 @@ class NFDIterator : public UObject { */ virtual UChar32 nextRawCodePoint() = 0; private: - const UChar *decomp; - UChar buffer[4]; + const char16_t *decomp; + char16_t buffer[4]; int32_t index; int32_t length; }; class UTF16NFDIterator : public NFDIterator { public: - UTF16NFDIterator(const UChar *text, const UChar *textLimit) : s(text), limit(textLimit) {} + UTF16NFDIterator(const char16_t *text, const char16_t *textLimit) : s(text), limit(textLimit) {} protected: - virtual UChar32 nextRawCodePoint() { + virtual UChar32 nextRawCodePoint() override { if(s == limit) { return U_SENTINEL; } UChar32 c = *s++; - if(limit == NULL && c == 0) { - s = NULL; + if(limit == nullptr && c == 0) { + s = nullptr; return U_SENTINEL; } - UChar trail; + char16_t trail; if(U16_IS_LEAD(c) && s != limit && U16_IS_TRAIL(trail = *s)) { ++s; c = U16_GET_SUPPLEMENTARY(c, trail); @@ -845,18 +848,18 @@ class UTF16NFDIterator : public NFDIterator { return c; } - const UChar *s; - const UChar *limit; + const char16_t *s; + const char16_t *limit; }; class FCDUTF16NFDIterator : public UTF16NFDIterator { public: - FCDUTF16NFDIterator(const Normalizer2Impl &nfcImpl, const UChar *text, const UChar *textLimit) - : UTF16NFDIterator(NULL, NULL) { + FCDUTF16NFDIterator(const Normalizer2Impl &nfcImpl, const char16_t *text, const char16_t *textLimit) + : UTF16NFDIterator(nullptr, nullptr) { UErrorCode errorCode = U_ZERO_ERROR; - const UChar *spanLimit = nfcImpl.makeFCD(text, textLimit, NULL, errorCode); + const char16_t *spanLimit = nfcImpl.makeFCD(text, textLimit, nullptr, errorCode); if(U_FAILURE(errorCode)) { return; } - if(spanLimit == textLimit || (textLimit == NULL && *spanLimit == 0)) { + if(spanLimit == textLimit || (textLimit == nullptr && *spanLimit == 0)) { s = text; limit = spanLimit; } else { @@ -882,7 +885,7 @@ class UTF8NFDIterator : public NFDIterator { UTF8NFDIterator(const uint8_t *text, int32_t textLength) : s(text), pos(0), length(textLength) {} protected: - virtual UChar32 nextRawCodePoint() { + virtual UChar32 nextRawCodePoint() override { if(pos == length || (s[pos] == 0 && length < 0)) { return U_SENTINEL; } UChar32 c; U8_NEXT_OR_FFFD(s, pos, length, c); @@ -897,9 +900,9 @@ class UTF8NFDIterator : public NFDIterator { class FCDUTF8NFDIterator : public NFDIterator { public: FCDUTF8NFDIterator(const CollationData *data, const uint8_t *text, int32_t textLength) - : u8ci(data, FALSE, text, 0, textLength) {} + : u8ci(data, false, text, 0, textLength) {} protected: - virtual UChar32 nextRawCodePoint() { + virtual UChar32 nextRawCodePoint() override { UErrorCode errorCode = U_ZERO_ERROR; return u8ci.nextCodePoint(errorCode); } @@ -911,7 +914,7 @@ class UIterNFDIterator : public NFDIterator { public: UIterNFDIterator(UCharIterator &it) : iter(it) {} protected: - virtual UChar32 nextRawCodePoint() { + virtual UChar32 nextRawCodePoint() override { return uiter_next32(&iter); } private: @@ -921,9 +924,9 @@ class UIterNFDIterator : public NFDIterator { class FCDUIterNFDIterator : public NFDIterator { public: FCDUIterNFDIterator(const CollationData *data, UCharIterator &it, int32_t startIndex) - : uici(data, FALSE, it, startIndex) {} + : uici(data, false, it, startIndex) {} protected: - virtual UChar32 nextRawCodePoint() { + virtual UChar32 nextRawCodePoint() override { UErrorCode errorCode = U_ZERO_ERROR; return uici.nextCodePoint(errorCode); } @@ -965,8 +968,8 @@ UCollationResult compareNFDIter(const Normalizer2Impl &nfcImpl, } // namespace UCollationResult -RuleBasedCollator::doCompare(const UChar *left, int32_t leftLength, - const UChar *right, int32_t rightLength, +RuleBasedCollator::doCompare(const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength, UErrorCode &errorCode) const { // U_FAILURE(errorCode) checked by caller. if(left == right && leftLength == rightLength) { @@ -974,13 +977,13 @@ RuleBasedCollator::doCompare(const UChar *left, int32_t leftLength, } // Identical-prefix test. - const UChar *leftLimit; - const UChar *rightLimit; + const char16_t *leftLimit; + const char16_t *rightLimit; int32_t equalPrefixLength = 0; if(leftLength < 0) { - leftLimit = NULL; - rightLimit = NULL; - UChar c; + leftLimit = nullptr; + rightLimit = nullptr; + char16_t c; while((c = left[equalPrefixLength]) == right[equalPrefixLength]) { if(c == 0) { return UCOL_EQUAL; } ++equalPrefixLength; @@ -1121,7 +1124,7 @@ RuleBasedCollator::doCompare(const uint8_t *left, int32_t leftLength, UBool numeric = settings->isNumeric(); if(equalPrefixLength > 0) { - UBool unsafe = FALSE; + UBool unsafe = false; if(equalPrefixLength != leftLength) { int32_t i = equalPrefixLength; UChar32 c; @@ -1282,12 +1285,12 @@ RuleBasedCollator::getCollationKey(const UnicodeString &s, CollationKey &key, } CollationKey & -RuleBasedCollator::getCollationKey(const UChar *s, int32_t length, CollationKey& key, +RuleBasedCollator::getCollationKey(const char16_t *s, int32_t length, CollationKey& key, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return key.setToBogus(); } - if(s == NULL && length != 0) { + if(s == nullptr && length != 0) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return key.setToBogus(); } @@ -1311,13 +1314,13 @@ RuleBasedCollator::getSortKey(const UnicodeString &s, } int32_t -RuleBasedCollator::getSortKey(const UChar *s, int32_t length, +RuleBasedCollator::getSortKey(const char16_t *s, int32_t length, uint8_t *dest, int32_t capacity) const { - if((s == NULL && length != 0) || capacity < 0 || (dest == NULL && capacity > 0)) { + if((s == nullptr && length != 0) || capacity < 0 || (dest == nullptr && capacity > 0)) { return 0; } uint8_t noDest[1] = { 0 }; - if(dest == NULL) { + if(dest == nullptr) { // Distinguish pure preflighting from an allocation error. dest = noDest; capacity = 0; @@ -1329,22 +1332,22 @@ RuleBasedCollator::getSortKey(const UChar *s, int32_t length, } void -RuleBasedCollator::writeSortKey(const UChar *s, int32_t length, +RuleBasedCollator::writeSortKey(const char16_t *s, int32_t length, SortKeyByteSink &sink, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return; } - const UChar *limit = (length >= 0) ? s + length : NULL; + const char16_t *limit = (length >= 0) ? s + length : nullptr; UBool numeric = settings->isNumeric(); CollationKeys::LevelCallback callback; if(settings->dontCheckFCD()) { UTF16CollationIterator iter(data, numeric, s, s, limit); CollationKeys::writeSortKeyUpToQuaternary(iter, data->compressibleBytes, *settings, sink, Collation::PRIMARY_LEVEL, - callback, TRUE, errorCode); + callback, true, errorCode); } else { FCDUTF16CollationIterator iter(data, numeric, s, s, limit); CollationKeys::writeSortKeyUpToQuaternary(iter, data->compressibleBytes, *settings, sink, Collation::PRIMARY_LEVEL, - callback, TRUE, errorCode); + callback, true, errorCode); } if(settings->getStrength() == UCOL_IDENTICAL) { writeIdenticalLevel(s, limit, sink, errorCode); @@ -1354,10 +1357,10 @@ RuleBasedCollator::writeSortKey(const UChar *s, int32_t length, } void -RuleBasedCollator::writeIdenticalLevel(const UChar *s, const UChar *limit, +RuleBasedCollator::writeIdenticalLevel(const char16_t *s, const char16_t *limit, SortKeyByteSink &sink, UErrorCode &errorCode) const { // NFD quick check - const UChar *nfdQCYesLimit = data->nfcImpl.decompose(s, limit, NULL, errorCode); + const char16_t *nfdQCYesLimit = data->nfcImpl.decompose(s, limit, nullptr, errorCode); if(U_FAILURE(errorCode)) { return; } sink.Append(Collation::LEVEL_SEPARATOR_BYTE); UChar32 prev = 0; @@ -1366,7 +1369,7 @@ RuleBasedCollator::writeIdenticalLevel(const UChar *s, const UChar *limit, } // Is there non-NFD text? int32_t destLengthEstimate; - if(limit != NULL) { + if(limit != nullptr) { if(nfdQCYesLimit == limit) { return; } destLengthEstimate = (int32_t)(limit - nfdQCYesLimit); } else { @@ -1398,14 +1401,14 @@ class PartLevelCallback : public CollationKeys::LevelCallback { levelCapacity = sink.GetRemainingCapacity(); } virtual ~PartLevelCallback() {} - virtual UBool needToWrite(Collation::Level l) { + virtual UBool needToWrite(Collation::Level l) override { if(!sink.Overflowed()) { // Remember a level that will be at least partially written. level = l; levelCapacity = sink.GetRemainingCapacity(); - return TRUE; + return true; } else { - return FALSE; + return false; } } Collation::Level getLevel() const { return level; } @@ -1423,7 +1426,7 @@ int32_t RuleBasedCollator::internalNextSortKeyPart(UCharIterator *iter, uint32_t state[2], uint8_t *dest, int32_t count, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return 0; } - if(iter == NULL || state == NULL || count < 0 || (count > 0 && dest == NULL)) { + if(iter == nullptr || state == nullptr || count < 0 || (count > 0 && dest == nullptr)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -1440,11 +1443,11 @@ RuleBasedCollator::internalNextSortKeyPart(UCharIterator *iter, uint32_t state[2 if(settings->dontCheckFCD()) { UIterCollationIterator ci(data, numeric, *iter); CollationKeys::writeSortKeyUpToQuaternary(ci, data->compressibleBytes, *settings, - sink, level, callback, FALSE, errorCode); + sink, level, callback, false, errorCode); } else { FCDUIterCollationIterator ci(data, numeric, *iter, 0); CollationKeys::writeSortKeyUpToQuaternary(ci, data->compressibleBytes, *settings, - sink, level, callback, FALSE, errorCode); + sink, level, callback, false, errorCode); } if(U_FAILURE(errorCode)) { return 0; } if(sink.NumberOfBytesAppended() > count) { @@ -1466,9 +1469,9 @@ RuleBasedCollator::internalNextSortKeyPart(UCharIterator *iter, uint32_t state[2 for(;;) { UChar32 c = iter->next(iter); if(c < 0) { break; } - s.append((UChar)c); + s.append((char16_t)c); } - const UChar *sArray = s.getBuffer(); + const char16_t *sArray = s.getBuffer(); writeIdenticalLevel(sArray, sArray + s.length(), sink, errorCode); if(U_FAILURE(errorCode)) { return 0; } if(sink.NumberOfBytesAppended() > count) { @@ -1491,8 +1494,8 @@ void RuleBasedCollator::internalGetCEs(const UnicodeString &str, UVector64 &ces, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return; } - const UChar *s = str.getBuffer(); - const UChar *limit = s + str.length(); + const char16_t *s = str.getBuffer(); + const char16_t *limit = s + str.length(); UBool numeric = settings->isNumeric(); if(settings->dontCheckFCD()) { UTF16CollationIterator iter(data, numeric, s, s, limit); @@ -1541,18 +1544,18 @@ RuleBasedCollator::internalGetShortDefinitionString(const char *locale, char *buffer, int32_t capacity, UErrorCode &errorCode) const { if(U_FAILURE(errorCode)) { return 0; } - if(buffer == NULL ? capacity != 0 : capacity < 0) { + if(buffer == nullptr ? capacity != 0 : capacity < 0) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; return 0; } - if(locale == NULL) { + if(locale == nullptr) { locale = internalGetLocaleID(ULOC_VALID_LOCALE, errorCode); } char resultLocale[ULOC_FULLNAME_CAPACITY + 1]; int32_t length = ucol_getFunctionalEquivalent(resultLocale, ULOC_FULLNAME_CAPACITY, "collation", locale, - NULL, &errorCode); + nullptr, &errorCode); if(U_FAILURE(errorCode)) { return 0; } resultLocale[length] = 0; @@ -1578,8 +1581,12 @@ RuleBasedCollator::internalGetShortDefinitionString(const char *locale, appendAttribute(result, 'F', getAttribute(UCOL_FRENCH_COLLATION, errorCode), errorCode); } // Note: UCOL_HIRAGANA_QUATERNARY_MODE is deprecated and never changes away from default. - length = uloc_getKeywordValue(resultLocale, "collation", subtag, UPRV_LENGTHOF(subtag), &errorCode); - appendSubtag(result, 'K', subtag, length, errorCode); + { + CharString collation; + CharStringByteSink sink(&collation); + ulocimp_getKeywordValue(resultLocale, "collation", sink, &errorCode); + appendSubtag(result, 'K', collation.data(), collation.length(), errorCode); + } length = uloc_getLanguage(resultLocale, subtag, UPRV_LENGTHOF(subtag), &errorCode); if (length == 0) { appendSubtag(result, 'L', "root", 4, errorCode); @@ -1600,10 +1607,7 @@ RuleBasedCollator::internalGetShortDefinitionString(const char *locale, appendSubtag(result, 'Z', subtag, length, errorCode); if(U_FAILURE(errorCode)) { return 0; } - if(result.length() <= capacity) { - uprv_memcpy(buffer, result.data(), result.length()); - } - return u_terminateChars(buffer, capacity, result.length(), &errorCode); + return result.extract(buffer, capacity, errorCode); } UBool @@ -1625,11 +1629,11 @@ RuleBasedCollator::initMaxExpansions(UErrorCode &errorCode) const { CollationElementIterator * RuleBasedCollator::createCollationElementIterator(const UnicodeString& source) const { UErrorCode errorCode = U_ZERO_ERROR; - if(!initMaxExpansions(errorCode)) { return NULL; } + if(!initMaxExpansions(errorCode)) { return nullptr; } CollationElementIterator *cei = new CollationElementIterator(source, this, errorCode); if(U_FAILURE(errorCode)) { delete cei; - return NULL; + return nullptr; } return cei; } @@ -1637,11 +1641,11 @@ RuleBasedCollator::createCollationElementIterator(const UnicodeString& source) c CollationElementIterator * RuleBasedCollator::createCollationElementIterator(const CharacterIterator& source) const { UErrorCode errorCode = U_ZERO_ERROR; - if(!initMaxExpansions(errorCode)) { return NULL; } + if(!initMaxExpansions(errorCode)) { return nullptr; } CollationElementIterator *cei = new CollationElementIterator(source, this, errorCode); if(U_FAILURE(errorCode)) { delete cei; - return NULL; + return nullptr; } return cei; } diff --git a/src/duckdb/extension/icu/third_party/icu/i18n/scientificnumberformatter.cpp b/src/duckdb/extension/icu/third_party/icu/i18n/scientificnumberformatter.cpp index b9f31cf03..8f9c19c38 100644 --- a/src/duckdb/extension/icu/third_party/icu/i18n/scientificnumberformatter.cpp +++ b/src/duckdb/extension/icu/third_party/icu/i18n/scientificnumberformatter.cpp @@ -20,7 +20,7 @@ U_NAMESPACE_BEGIN -static const UChar kSuperscriptDigits[] = { +static const char16_t kSuperscriptDigits[] = { 0x2070, 0xB9, 0xB2, @@ -32,8 +32,8 @@ static const UChar kSuperscriptDigits[] = { 0x2078, 0x2079}; -static const UChar kSuperscriptPlusSign = 0x207A; -static const UChar kSuperscriptMinusSign = 0x207B; +static const char16_t kSuperscriptPlusSign = 0x207A; +static const char16_t kSuperscriptMinusSign = 0x207B; static UBool copyAsSuperscript( const UnicodeString &s, @@ -42,19 +42,19 @@ static UBool copyAsSuperscript( UnicodeString &result, UErrorCode &status) { if (U_FAILURE(status)) { - return FALSE; + return false; } for (int32_t i = beginIndex; i < endIndex;) { UChar32 c = s.char32At(i); int32_t digit = u_charDigitValue(c); if (digit < 0) { status = U_INVALID_CHAR_FOUND; - return FALSE; + return false; } result.append(kSuperscriptDigits[digit]); i += U16_LENGTH(c); } - return TRUE; + return true; } ScientificNumberFormatter *ScientificNumberFormatter::createSuperscriptInstance( @@ -101,22 +101,22 @@ ScientificNumberFormatter *ScientificNumberFormatter::createInstance( LocalPointer fmt(fmtToAdopt); LocalPointer